From 033d6d49fbb0a924653c7fd3ef3700a24f37ee59 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期一, 22 十二月 2025 16:16:41 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/QC_POStockInCheckBillController.cs |   84 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 74 insertions(+), 10 deletions(-)

diff --git a/WebAPI/Controllers/QC_POStockInCheckBillController.cs b/WebAPI/Controllers/QC_POStockInCheckBillController.cs
index f861f2d..1405bdb 100644
--- a/WebAPI/Controllers/QC_POStockInCheckBillController.cs
+++ b/WebAPI/Controllers/QC_POStockInCheckBillController.cs
@@ -971,8 +971,12 @@
             string OperationType = sArray[2].ToString().Trim();
             string user = sArray[3].ToString();
             string Value = sArray[4].ToString();
-            string BadReason = sArray[5].ToString();
-            if(String.IsNullOrWhiteSpace(BadReason) == true)
+            string BadReason = null;
+            if (sArray.Length > 4)
+            {
+                BadReason = sArray[5].ToString();
+            }
+            if (String.IsNullOrWhiteSpace(BadReason) == true)
             {
                 BadReason = "[]";
             }
@@ -1008,6 +1012,18 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                // 鍒ゆ柇鍗曟嵁鏄惁閲嶅
+                DataSet ds2 = oCN.RunProcReturn("select top 1 HInterID from QC_POStockInCheckBillMain where HInterID=" + mainList[0].HInterID, "QC_POStockInCheckBillMain");
+                if(ds2.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹湁璇紒鍗曟嵁閲嶅鎻愪氦!";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+
                 BillNew.omodel.HYear = sYear;
                 BillNew.omodel.HPeriod = sPeriod;
                 //鍥哄畾璧嬪��=================================
@@ -1041,9 +1057,11 @@
                 BillNew.omodel.HTakeSampleCheckBillID = ClsPub.isLong(mainList[0].HTakeSampleCheckBillID);
                 BillNew.omodel.HTakeSampleCheckBillNo = ClsPub.isStrNull(mainList[0].HTakeSampleCheckBillNo);
                 BillNew.omodel.HRemarkSN = ClsPub.isStrNull(mainList[0].HRemarkSN);
+                BillNew.omodel.HCheckQty = mainList[0].HCheckQty;
                 List<Model.ClsQC_POStockInCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_POStockInCheckBillSub>>(msg3);
                 List<Model.ClsQC_POStockInCheckBillSub_BadReason> badReasonList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_POStockInCheckBillSub_BadReason>>(BadReason);
                 BillNew.DetailColl = new List<Model.ClsQC_POStockInCheckBillSub>();
+
 
                 for (int i = 0; i < subList.ToArray().Length; i++)
                 {
@@ -1093,6 +1111,8 @@
                         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.HInspectValQ = subList[i].HInspectValQ;
+
                         BillNew.DetailColl.Add(oSub);
                     }
                     else
@@ -1121,14 +1141,6 @@
                         oSub.HBadReasonID = badReasonList[i].HBadReasonID;
 
                         BillNew.DetailCol1_BadReason.Add(oSub);
-                    }
-                    else
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鏃犳槑缁嗚淇℃伅!";
-                        objJsonResult.data = null;
-                        return objJsonResult;
                     }
                 }
 
@@ -1192,6 +1204,58 @@
         }
         #endregion
 
+        #region [妫�楠屽崟鑾峰彇 涓嶈壇鍘熷洜]
+        [Route("QC_POStockInCheckBill_BadReason/getBadReasonList")]
+        [HttpGet]
+        public object getBadReasonList(Int64 HInterID, string user)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                List<object> columnNameList = new List<object>();
+
+                ds = oCN.RunProcReturn("select * from QC_POStockInCheckBillSub_BadReason  where  HInterID=" + HInterID, "QC_POStockInCheckBillSub_BadReason");
+
+                //娣诲姞鍒楀悕
+                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;
+            }
+        }
+        #endregion
+
         #region [鏉ユ枡鍏ュ簱妫�楠屽崟]
         /// <summary>
         /// 杩斿洖鍒楄〃

--
Gitblit v1.9.1