From f95cc9aa0dae0ab3b7ec8b213c8be18ca47bfac2 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 07 十一月 2025 11:16:47 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/品质管理/首件检验单/QC_FirstPieceCheckBillController.cs |  338 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 330 insertions(+), 8 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 fd67d27..02486bb 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"
@@ -202,7 +202,7 @@
                 List<object> columnNameList = new List<object>();
 
                 string sql1 = "select * from h_v_QC_FirstPieceCheckBill_Edit where 1 = 1  ";
-                string sql = sql1 + sWhere + " order by hmainid desc";
+                string sql = sql1 + sWhere + " order by hmainid desc,hsubid asc";
                 ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBill_Edit");
 
                 //娣诲姞鍒楀悕
@@ -278,6 +278,9 @@
                 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();
+
+
+                
                 //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
                 string s = "";
                 int sYear = 0;
@@ -323,6 +326,7 @@
                 BillNew.omodel.HBatchNo = ClsPub.isStrNull(mainList[0].HBatchNo);
                 BillNew.omodel.HTakeSampleCheckBillID = ClsPub.isLong(mainList[0].HTakeSampleCheckBillID);
                 BillNew.omodel.HTakeSampleCheckBillNo = ClsPub.isStrNull(mainList[0].HTakeSampleCheckBillNo);
+                BillNew.omodel.HRemarkSN = mainList[0].HRemarkSN;
                 List<Model.ClsQC_FirstPieceCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillSub>>(msg3);
                 BillNew.DetailColl = new List<Model.ClsQC_FirstPieceCheckBillSub>();
                 for (int i = 0; i < subList.ToArray().Length; i++)
@@ -369,6 +373,13 @@
                         oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect);
                         oSub.HInspectInstruMentID = DBUtility.ClsPub.isLong(subList[i].HInspectInstruMentID);
                         oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult);
+
+                        oSub.HQualityStdID = DBUtility.ClsPub.isLong(subList[i].HQualityStdID);//
+                        oSub.HInspectMethodID = DBUtility.ClsPub.isLong(subList[i].HInspectMethodID);//
+                        oSub.HInspectBasisID = DBUtility.ClsPub.isLong(subList[i].HInspectBasisID);//
+                        oSub.HCompareSymbol = DBUtility.ClsPub.isStrNull(subList[i].HCompareSymbol);//
+
+
                         BillNew.DetailColl.Add(oSub);
                     }
                     else
@@ -380,7 +391,11 @@
                         return objJsonResult;
                     }
                 }
-               
+
+
+                
+
+
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 if (OperationType.Equals("1") || OperationType.Equals("2"))
                 {
@@ -388,6 +403,24 @@
                 }
                 else
                 {
+                    if (BillOld.ShowBill(mainList[0].HInterID, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鍒ゆ柇鏄惁鍙紪杈�
+                    if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+
                     bResult = BillNew.ModifyBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                 }
                 //鎻愮ず
@@ -395,7 +428,6 @@
                 {
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
-                    //objJsonResult.Message = "鍗曟嵁瀛樼洏瀹屾瘯!鍗曟嵁鍙�:" + mainList[0].HBillNo.Trim();
                     objJsonResult.Message = ClsPub.sExeReturnInfo+"鍗曟嵁鍙�:" + mainList[0].HBillNo.Trim();
                     objJsonResult.data = null;
                     return objJsonResult;
@@ -498,7 +530,7 @@
         }
         #endregion
 
-
+        #region 杩斿洖妫�楠屽�煎垪琛�
         /// <summary>
         ///杩斿洖妫�楠屽�煎垪琛�
         /// </summary>
@@ -553,6 +585,7 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
         #region 棣栦欢妫�楠屽崟缁存姢 瀹℃牳 鍙嶅鏍� 鍏抽棴 鍙嶅叧闂� 浣滃簾 鍙嶄綔搴�
         /// <summary>
@@ -1063,9 +1096,7 @@
         }
         #endregion
 
-
-
-
+        # region 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
         /// <summary>
         /// 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
         /// </summary>
@@ -1096,11 +1127,30 @@
                     return objJsonResult;
                 }
 
+                var s = "";
+                if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                //鍒ゆ柇鏄惁鍙垹闄�
+                if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
 
                 //寮�濮嬩簨鐗�
                 oCN.BeginTran();
 
-                var ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain");
+                var ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain");            
+
                 //鍒犻櫎鍓嶆帶鍒�
                 DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_QC_FirstPieceCheckBill_BeforeDelCtrl  " + HInterID.ToString() + ",'" + user + "'", "h_p_QC_FirstPieceCheckBill_BeforeDelCtrl");
                 if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
@@ -1170,6 +1220,7 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
         #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓哄伐搴忚繘绔欏崟
         [Route("QC_FirstPieceCheckBill/get_StationInBill")]
@@ -1227,6 +1278,62 @@
         }
         #endregion
 
+        #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓哄伐搴忚繘绔欏崟 閫氳繃鍗曟嵁鍙疯幏鍙�
+        [Route("QC_FirstPieceCheckBill/get_StationInBill_ByHBillNo")]
+        [HttpGet]
+        public object get_StationInBill_ByHBillNo(string HBillNo, 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_ByHBillNo " + "'宸ュ簭','" + HBillNo + "'";
+                            break;
+                        case "鐗╂枡":
+                            sql = "exec h_p_QC_FirstPiece_GetStationInBillList_ByHBillNo " + "'鐗╂枡','" + HBillNo + "'";
+                            break;
+                        case "宸ヨ壓璺嚎":
+                            sql = "exec h_p_QC_FirstPiece_GetStationInBillList_ByHBillNo " + "'宸ヨ壓璺嚎','" + HBillNo + "'";
+                            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 棣栦欢/宸ュ簭 妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓哄伐搴忔祦杞崱
         [Route("CheckBill/get_ProcessExchangeBill")]
         [HttpGet]
@@ -1250,6 +1357,62 @@
                             break;
                         case "宸ヨ壓璺嚎":
                             sql = "exec h_p_QC_FirstPiece_GetProcessExchangeBillList " + "'宸ヨ壓璺嚎','" + HInterID + "','" + HEntryID + "'";
+                            break;
+                    }
+
+                }
+
+                ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetProcessExchangeBillList");
+
+                //娣诲姞鍒楀悕
+                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 棣栦欢/宸ュ簭 妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓哄伐搴忔祦杞崱 鏍规嵁鍗曟嵁鍙锋煡璇�
+        [Route("CheckBill/get_ProcessExchangeBill_ByBillNo")]
+        [HttpGet]
+        public object get_ProcessExchangeBill_ByBillNo(string HBillNo, 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_GetProcessExchangeBillList_ByBillNo " + "'宸ュ簭','" + HBillNo + "'";
+                            break;
+                        case "鐗╂枡":
+                            sql = "exec h_p_QC_FirstPiece_GetProcessExchangeBillList_ByBillNo " + "'鐗╂枡','" + HBillNo + "'";
+                            break;
+                        case "宸ヨ壓璺嚎":
+                            sql = "exec h_p_QC_FirstPiece_GetProcessExchangeBillList_ByBillNo " + "'宸ヨ壓璺嚎','" + HBillNo + "'";
                             break;
                     }
 
@@ -1393,5 +1556,164 @@
         }
         #endregion
 
+        #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓虹敓浜ц鍗�
+        [Route("QC_FirstPieceCheckBill/get_ICMOBill")]
+        [HttpGet]
+        public object get_ICMOBill(string HICMOInterID, string HICMOEntryID, 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_GetICMOBillList " + "'鐗╂枡','" + HICMOInterID + "','" + HICMOEntryID + "'";
+                            break;
+                        case "宸ヨ壓璺嚎":
+                            sql = "exec h_p_QC_FirstPiece_GetICMOBillList " + "'宸ヨ壓璺嚎','" + HICMOInterID + "','" + HICMOEntryID + "'";
+                            break;
+                    }
+
+                }
+
+                ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetICMOBillList");
+
+                //娣诲姞鍒楀悕
+                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 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓虹敓浜ц鍗� 閫氳繃鍗曟嵁鍙峰甫鍑�
+        [Route("QC_FirstPieceCheckBill/get_ICMOBill_ByBillNo")]
+        [HttpGet]
+        public object get_ICMOBill_ByBillNo(string HBillNo, 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_GetICMOBillList_ByBillNo " + "'鐗╂枡','" + HBillNo + "'";
+                            break;
+                        case "宸ヨ壓璺嚎":
+                            sql = "exec h_p_QC_FirstPiece_GetICMOBillList_ByBillNo " + "'宸ヨ壓璺嚎','" + HBillNo + "'";
+                            break;
+                    }
+
+                }
+
+                ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetICMOBillList_ByBillNo");
+
+                //娣诲姞鍒楀悕
+                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 宸℃妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓虹敓浜ц鍗�
+        [Route("QC_PatrolProcCheckBill/get_ICMOBill")]
+        [HttpGet]
+        public object get_ICMOBill_PatrolProcCheck(string HICMOInterID, string HICMOEntryID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                string sReturn = "";
+                string sql = "";
+                if (oSystemParameter.ShowBill(ref sReturn))
+                {
+                    switch (oSystemParameter.omodel.QC_PatrolProcCheckBill_QCSchemeSource)
+                    {
+                        case "鐗╂枡":
+                            sql = "exec h_p_QC_PatrolProcCheck_GetICMOBillList " + "'鐗╂枡','" + HICMOInterID + "','" + HICMOEntryID + "'";
+                            break;
+                        case "宸ヨ壓璺嚎":
+                            sql = "exec h_p_QC_PatrolProcCheck_GetICMOBillList " + "'宸ヨ壓璺嚎','" + HICMOInterID + "','" + HICMOEntryID + "'";
+                            break;
+                    }
+
+                }
+
+                ds = oCN.RunProcReturn(sql, "h_p_QC_PatrolProcCheck_GetICMOBillList");
+
+                //娣诲姞鍒楀悕
+                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
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1