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 | 268 ++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 203 insertions(+), 65 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 e393046..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"
@@ -20,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")]
@@ -93,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>();
@@ -138,6 +192,8 @@
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
@@ -187,58 +243,7 @@
return objJsonResult;
}
}
- #endregion
-
- #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓虹敓浜х姸鎬佷复鏃惰〃锛�3722锛�
- /// <summary>
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
- [Route("QC_FirstPieceCheckBill/get_ICMOBillStatus_Tmp")]
- [HttpGet]
- public object get_ICMOBillStatus_Tmp(int HInterID,int HEntryID,string HBillType)
- {
- try
- {
- if (HInterID == 0 || HBillType.Equals(""))
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�"+ HInterID+ "锛汬EntryID锛�"+ HEntryID + "锛汬BillType锛�"+ HBillType+"锛�";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- ds = oCN.RunProcReturn("exec h_p_QC_GetInfoByICMOStatusBill " + HInterID + "," + HEntryID + "," + HBillType, "h_p_QC_GetInfoByICMOStatusBill");
- }
- if (ds == null || ds.Tables[0].Rows.Count == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- 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;
- }
- }
- #endregion
+ #endregion
#region 妫�楠屽�间繚瀛�
[Route("QC_FirstPieceCheckBill/set_SaveValue")]
@@ -259,7 +264,7 @@
List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid> valueList = new List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid>();
- valueList = oListModels.getObjectByJson_ClsClsQC_FirstPieceCheckBillSub_ValueGrid(Value);
+ valueList = oListModels.getObjectByJson_ClsQC_FirstPieceCheckBillSub_ValueGrid(Value);
DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill();
@@ -272,7 +277,7 @@
oSub_Value.HEntryID = HEntryID;
oSub_Value.HSEQ = i + 1;
oSub_Value.HInSpectResult = ClsPub.isStrNull(valueList[i].HInSpectResult);
- oSub_Value.HInSpectValue = ClsPub.isLong(valueList[i].HInSpectValue);
+ oSub_Value.HInSpectValue = ClsPub.isDoule(valueList[i].HInSpectValue);
oSub_Value.HInSpectValueB = ClsPub.isLong(valueList[i].HInSpectValueB);
oSub_Value.HInSpectValueT = ClsPub.isStrNull(valueList[i].HInSpectValueT);
@@ -331,8 +336,17 @@
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)
{
@@ -340,13 +354,14 @@
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.Message = "鏃犳娴嬪�兼暟鎹紒";
objJsonResult.data = ds.Tables[0];
return objJsonResult;
}
@@ -363,19 +378,91 @@
}
}
- #region 棣栦欢妫�楠屽崟鍒楄〃
- [Route("QC_FirstPieceCheckBill/QC_FirstPieceCheckBillList")]
+ /// <summary>
+ /// 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
+ /// </summary>
+ /// <returns></returns>
+ [Route("DeltetQC_FirstPieceCheck")]
[HttpGet]
- public object QC_FirstPieceCheckBillList(string sWhere, string user)
+ 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 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");
+ 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)
{
@@ -383,19 +470,70 @@
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
}
-
+
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess锛�";
- objJsonResult.list = columnNameList;
objJsonResult.data = ds.Tables[0];
- return objJsonResult;
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓虹敓浜х姸鎬佷复鏃惰〃锛�3722锛�
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("QC_FirstPieceCheckBill/get_ICMOBillStatus_Tmp")]
+ [HttpGet]
+ public object get_ICMOBillStatus_Tmp(int HInterID, int HEntryID, string HBillType)
+ {
+ try
+ {
+ if (HInterID == 0 || HBillType.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�" + HInterID + "锛汬EntryID锛�" + HEntryID + "锛汬BillType锛�" + HBillType + "锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ ds = oCN.RunProcReturn("exec h_p_QC_GetInfoByICMOStatusBill " + HInterID + "," + HEntryID + "," + HBillType, "h_p_QC_GetInfoByICMOStatusBill");
+ }
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ 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;
}
--
Gitblit v1.9.1