From 1ac724081443a0cea3c8e2f46b9016a6f0851bfc Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 23 十一月 2023 17:07:26 +0800
Subject: [PATCH] 生产日记报表:查询时增加根据用户关联客户过滤
---
WebAPI/Controllers/品质管理/首件检验单/QC_FirstPieceCheckBillController.cs | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 335 insertions(+), 4 deletions(-)
diff --git "a/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_FirstPieceCheckBillController.cs" "b/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_FirstPieceCheckBillController.cs"
index 5256e23..8112c58 100644
--- "a/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_FirstPieceCheckBillController.cs"
+++ "b/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_FirstPieceCheckBillController.cs"
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -19,6 +20,59 @@
private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
DataSet ds;
+ //鑾峰彇绯荤粺鍙傛暟
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+
+ #region 棣栦欢妫�楠屽崟鍒楄〃
+ [Route("QC_FirstPieceCheckBill/QC_FirstPieceCheckBillList")]
+ [HttpGet]
+ public object QC_FirstPieceCheckBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ string sql1 = "select * from h_v_QC_FirstPieceCheckBill where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBill");
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.list = columnNameList;
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁鏌ヨ鍒版暟鎹�";
+ objJsonResult.list = columnNameList;
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
#region 棣栦欢妫�楠屽崟淇濆瓨
[Route("QC_FirstPieceCheckBill/set_SaveBill")]
@@ -37,9 +91,21 @@
string msg2 = sArray[0].ToString();
string msg3 = sArray[1].ToString();
string OperationType = sArray[2].ToString().Trim();
+ string user = sArray[3].ToString();
+ string Value = sArray[4].ToString();
bool bResult;
try
{
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("QC_FirstPieceCheckBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
msg2 = "[" + msg2.ToString() + "]";
List<Model.ClsQC_FirstPieceCheckBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillMain>>(msg2);
DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill();
@@ -80,6 +146,7 @@
BillNew.omodel.HMainSourceEntryID = ClsPub.isLong(mainList[0].HMainSourceEntryID);
BillNew.omodel.HMainSourceBillNo = ClsPub.isStrNull(mainList[0].HMainSourceBillNo);
BillNew.omodel.HMainSourceBillType = ClsPub.isStrNull(mainList[0].HMainSourceBillType);
+ BillNew.omodel.HQCSchemeID = ClsPub.isLong(mainList[0].HQCSchemeID);
BillNew.omodel.HBillStatus = 1;
List<Model.ClsQC_FirstPieceCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillSub>>(msg3);
BillNew.DetailColl = new List<Model.ClsQC_FirstPieceCheckBillSub>();
@@ -108,6 +175,25 @@
oSub.HMin = DBUtility.ClsPub.isStrNull(subList[i].HMin);
oSub.HAvg = DBUtility.ClsPub.isStrNull(subList[i].HAvg);
oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo);
+
+ oSub.HSampleSchemeID= DBUtility.ClsPub.isLong(subList[i].HSampleSchemeID);
+ oSub.HSampleQty= DBUtility.ClsPub.isLong(subList[i].HSampleQty);
+ oSub.HSampleDamageQty= DBUtility.ClsPub.isDoule(subList[i].HSampleDamageQty);
+ oSub.HAcceptQty= DBUtility.ClsPub.isLong(subList[i].HAcceptQty);
+ oSub.HRejectQty= DBUtility.ClsPub.isLong(subList[i].HRejectQty);
+ oSub.HSampleUnRightQty= DBUtility.ClsPub.isDoule(subList[i].HSampleUnRightQty);
+ oSub.HStatus= DBUtility.ClsPub.isStrNull(subList[i].HStatus);
+ oSub.HUnitID= DBUtility.ClsPub.isLong(subList[i].HUnitID);
+ oSub.HInspectVal= DBUtility.ClsPub.isStrNull(subList[i].HInspectVal);
+ oSub.HTargetVal= DBUtility.ClsPub.isStrNull(subList[i].HTargetVal);
+ oSub.HUpLimit= DBUtility.ClsPub.isStrNull(subList[i].HUpLimit);
+ oSub.HDownLimit= DBUtility.ClsPub.isStrNull(subList[i].HDownLimit);
+ oSub.HUpOffSet= DBUtility.ClsPub.isStrNull(subList[i].HUpOffSet);
+ oSub.HDownOffSet= DBUtility.ClsPub.isStrNull(subList[i].HDownOffSet);
+ oSub.HAnalysisMethod = DBUtility.ClsPub.isStrNull(subList[i].HAnalysisMethod);
+ oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect);
+ oSub.HInspectInstruMentID = DBUtility.ClsPub.isLong(subList[i].HInspectInstruMentID);
+ oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult);
BillNew.DetailColl.Add(oSub);
}
else
@@ -119,6 +205,7 @@
return objJsonResult;
}
}
+
//淇濆瓨瀹屾瘯鍚庡鐞�
if (OperationType.Equals("1") || OperationType.Equals("2"))
{
@@ -156,6 +243,250 @@
return objJsonResult;
}
}
+ #endregion
+
+ #region 妫�楠屽�间繚瀛�
+ [Route("QC_FirstPieceCheckBill/set_SaveValue")]
+ [HttpPost]
+ public object set_SaveValue([FromBody] JObject msg)
+ {
+ ListModels oListModels = new ListModels();
+ try
+ {
+ var _value = msg["msg"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+
+ string Value = sArray[0].ToString(); //妫�楠屽�艰〃鏍�
+ Int64 HInterID = Convert.ToInt64(sArray[1]); //涓籌D
+ Int64 HEntryID = Convert.ToInt64(sArray[2]); //瀛怚D
+ bool bResult;
+
+
+ List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid> valueList = new List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid>();
+ valueList = oListModels.getObjectByJson_ClsQC_FirstPieceCheckBillSub_ValueGrid(Value);
+
+ DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill();
+
+ for (int i = 0; i < valueList.ToArray().Length; i++)
+ {
+ if (i >= 0)//HQty
+ {
+ Model.ClsQC_FirstPieceCheckBillSub_ValueGrid oSub_Value = new Model.ClsQC_FirstPieceCheckBillSub_ValueGrid();
+ oSub_Value.HInterID = HInterID;
+ oSub_Value.HEntryID = HEntryID;
+ oSub_Value.HSEQ = i + 1;
+ oSub_Value.HInSpectResult = ClsPub.isStrNull(valueList[i].HInSpectResult);
+ oSub_Value.HInSpectValue = ClsPub.isDoule(valueList[i].HInSpectValue);
+ oSub_Value.HInSpectValueB = ClsPub.isLong(valueList[i].HInSpectValueB);
+ oSub_Value.HInSpectValueT = ClsPub.isStrNull(valueList[i].HInSpectValueT);
+
+ BillNew.DetailColl_Value.Add(oSub_Value);
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳槑缁嗚淇℃伅!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ bResult = BillNew.AddValue(ref ClsPub.sExeReturnInfo, ref HInterID, ref HEntryID);
+
+ if (bResult == true)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨妫�楠屽�兼垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ /// <summary>
+ ///杩斿洖妫�楠屽�煎垪琛�
+ /// </summary>
+ /// <param name="sWhere"></param>
+ /// <returns></returns>
+ [Route("QC_ValueTable/getValueList")]
+ [HttpGet]
+ public object getValueList(Int64 HInterID, Int64 HEntryID, string user)
+ {
+ DataSet ds;
+ try
+ {
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ List<object> columnNameList = new List<object>();
+
+ ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub_ValueGrid where HInterID="+ HInterID + " and HEntryID="+ HEntryID, "h_v_QC_FirstPieceCheckBillList");
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳娴嬪�兼暟鎹紒";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ /// <summary>
+ /// 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
+ /// </summary>
+ /// <returns></returns>
+ [Route("DeltetQC_FirstPieceCheck")]
+ [HttpGet]
+ public object DeltetQC_FirstPieceCheck(string HInterID, string user)
+ {
+ string ModRightNameCheck = "QC_FirstPieceCheckBill_Delete";
+ try
+ {
+ //鍒犻櫎鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //寮�濮嬩簨鐗�
+ oCN.BeginTran();
+ oCN.RunProc("Delete From QC_FirstPieceCheckBillMain where HInterID = " + HInterID);
+ oCN.RunProc("Delete From QC_FirstPieceCheckBillSub where HInterID = " + HInterID);
+ oCN.RunProc("Delete From QC_FirstPieceCheckBillSub_ValueGrid where HInterID = " + HInterID);
+ oCN.RunProc("Delete From QC_FirstPieceCheckBillSub_Result where HInterID = " + HInterID);
+ //鎻愪氦浜嬪姟
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack(); //鍥炴粴浜嬬墿
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓哄伐搴忚繘绔欏崟
+ [Route("QC_FirstPieceCheckBill/get_StationInBill")]
+ [HttpGet]
+ public object get_StationInBill(string HInterID, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ string sReturn = "";
+ string sql = "";
+ if (oSystemParameter.ShowBill(ref sReturn))
+ {
+ switch (oSystemParameter.omodel.QC_FirstPieceCheckBill_QCSchemeSource)
+ {
+ case "宸ュ簭":
+ sql = "exec h_p_QC_FirstPiece_GetStationInBillList " + "'宸ュ簭','" + HInterID + "'";
+ break;
+ case "鐗╂枡":
+ sql = "exec h_p_QC_FirstPiece_GetStationInBillList " + "'鐗╂枡','" + HInterID + "'";
+ break;
+ case "宸ヨ壓璺嚎":
+ sql = "exec h_p_QC_FirstPiece_GetStationInBillList " + "'宸ヨ壓璺嚎','" + HInterID + "'";
+ break;
+ }
+
+ }
+
+ ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetStationInBillList");
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
#endregion
#region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓虹敓浜х姸鎬佷复鏃惰〃锛�3722锛�
@@ -165,7 +496,7 @@
/// </summary>
[Route("QC_FirstPieceCheckBill/get_ICMOBillStatus_Tmp")]
[HttpGet]
- public object get_ICMOBillStatus_Tmp(int HInterID,int HEntryID,string HBillType)
+ public object get_ICMOBillStatus_Tmp(int HInterID, int HEntryID, string HBillType)
{
try
{
@@ -173,7 +504,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�"+ HInterID+ "锛汬EntryID锛�"+ HEntryID + "锛汬BillType锛�"+ HBillType+"锛�";
+ objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�" + HInterID + "锛汬EntryID锛�" + HEntryID + "锛汬BillType锛�" + HBillType + "锛�";
objJsonResult.data = null;
return objJsonResult;
}
@@ -208,6 +539,6 @@
}
}
#endregion
- //
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1