From a91fdba94705dd25cecccc7a4a5dcc2b3f2c09a6 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期一, 22 十二月 2025 16:16:00 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/QC_POStockInCheckBillController.cs |  328 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 326 insertions(+), 2 deletions(-)

diff --git a/WebAPI/Controllers/QC_POStockInCheckBillController.cs b/WebAPI/Controllers/QC_POStockInCheckBillController.cs
index a639dbf..1405bdb 100644
--- a/WebAPI/Controllers/QC_POStockInCheckBillController.cs
+++ b/WebAPI/Controllers/QC_POStockInCheckBillController.cs
@@ -21,7 +21,7 @@
         public WebServer webserver = new WebServer();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         public DAL.ClsQC_POStockInCheckBill BillOld = new DAL.ClsQC_POStockInCheckBill();
-
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
         //DataSet ds;
 
 
@@ -103,6 +103,229 @@
             }
         }
         #endregion
+
+        #region 鏉ユ枡妫�楠屽崟鏍规嵁婧愬崟鑾峰彇淇℃伅-婧愬崟涓洪噰璐鍗�(1102)
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("QC_POStockInCheckBill/get_POOrderList_Tmp")]
+        [HttpGet]
+        public object get_POOrderList_Tmp(int HInterID, int HEntryID, string HBillType)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                if (HInterID == 0 || HBillType.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�" + HInterID + "锛汬EntryID锛�" + HEntryID + "锛汬BillType锛�" + HBillType + "锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                string sReturn = "";
+                string sql = "";
+                if (oSystemParameter.ShowBill(ref sReturn))
+                {
+                    switch (oSystemParameter.omodel.QC_POStockInCheckBill_QCSchemeSource)
+                    {
+                        case "鐗╂枡":
+                            sql = "exec h_p_QC_GetInfoByPOOrderBill " + "'鐗╂枡'" + "," + HInterID + "," + HEntryID + "," + HBillType;
+                            break;
+                    }
+
+                }
+
+                ds = oCN.RunProcReturn(sql, "h_p_QC_GetInfoByPOOrderBill");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃煡璇㈠埌鏁版嵁锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    //娣诲姞鍒楀悕
+                    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 = "杩斿洖璁板綍鎴愬姛锛�";
+                    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 鏉ユ枡妫�楠屽崟鏍规嵁婧愬崟鑾峰彇淇℃伅-婧愬崟涓烘敹鏂欓�氱煡鍗�(1103)
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("QC_POStockInCheckBill/get_POInStockBill_Tmp")]
+        [HttpGet]
+        public object get_POInStockBill_Tmp(int HInterID, int HEntryID, string HBillType)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                if (HInterID == 0 || HBillType.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�" + HInterID + "锛汬EntryID锛�" + HEntryID + "锛汬BillType锛�" + HBillType + "锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                string sReturn = "";
+                string sql = "";
+                if (oSystemParameter.ShowBill(ref sReturn))
+                {
+                    switch (oSystemParameter.omodel.QC_POStockInCheckBill_QCSchemeSource)
+                    {
+                        case "鐗╂枡":
+                            sql = "exec h_p_QC_GetInfoByPOInStockBill " + "'鐗╂枡'" + "," + HInterID + "," + HEntryID + "," + HBillType;
+                            break;
+                    }
+
+                }
+
+                ds = oCN.RunProcReturn(sql, "h_p_QC_GetInfoByPOInStockBill");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃煡璇㈠埌鏁版嵁锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    //娣诲姞鍒楀悕
+                    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 = "杩斿洖璁板綍鎴愬姛锛�";
+                    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 鏉ユ枡妫�楠屽崟鏍规嵁婧愬崟鑾峰彇淇℃伅-婧愬崟涓洪噰璐叆搴撳崟(1201)
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("QC_POStockInCheckBill/get_Kf_POStockInBill_Tmp")]
+        [HttpGet]
+        public object get_Kf_POStockInBill_Tmp(int HInterID, int HEntryID, string HBillType)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                if (HInterID == 0 || HBillType.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�" + HInterID + "锛汬EntryID锛�" + HEntryID + "锛汬BillType锛�" + HBillType + "锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                string sReturn = "";
+                string sql = "";
+                if (oSystemParameter.ShowBill(ref sReturn))
+                {
+                    switch (oSystemParameter.omodel.QC_POStockInCheckBill_QCSchemeSource)
+                    {
+                        case "鐗╂枡":
+                            sql = "exec h_p_QC_GetInfoByKfPOStockInBill " + "'鐗╂枡'" + "," + HInterID + "," + HEntryID + "," + HBillType;
+                            break;
+                    }
+
+                }
+
+                ds = oCN.RunProcReturn(sql, "h_p_QC_GetInfoByKfPOStockInBill");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃煡璇㈠埌鏁版嵁锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    //娣诲姞鍒楀悕
+                    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 = "杩斿洖璁板綍鎴愬姛锛�";
+                    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 [杩斿洖妫�楠屽�煎垪琛╙
         /// <summary>
@@ -748,6 +971,15 @@
             string OperationType = sArray[2].ToString().Trim();
             string user = sArray[3].ToString();
             string Value = sArray[4].ToString();
+            string BadReason = null;
+            if (sArray.Length > 4)
+            {
+                BadReason = sArray[5].ToString();
+            }
+            if (String.IsNullOrWhiteSpace(BadReason) == true)
+            {
+                BadReason = "[]";
+            }
             bool bResult;
             try
             {
@@ -780,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;
                 //鍥哄畾璧嬪��=================================
@@ -812,9 +1056,12 @@
                 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 = 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++)
                 {
@@ -860,6 +1107,12 @@
                         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.HCompareSymbol = DBUtility.ClsPub.isStrNull(subList[i].HCompareSymbol);
+                        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
@@ -869,6 +1122,25 @@
                         objJsonResult.Message = "鏃犳槑缁嗚淇℃伅!";
                         objJsonResult.data = null;
                         return objJsonResult;
+                    }
+                }
+
+                for (int i = 0; i < badReasonList.ToArray().Length; i++)
+                {
+                    if (i >= 0)//HQty
+                    {
+                        Model.ClsQC_POStockInCheckBillSub_BadReason oSub = new Model.ClsQC_POStockInCheckBillSub_BadReason();
+                        oSub.HInterID = mainList[0].HInterID;
+                        oSub.HEntryID = i + 1;
+                        oSub.HRemark = ClsPub.isStrNull(subList[i].HRemark);
+                        oSub.HCloseMan = DBUtility.ClsPub.isStrNull(badReasonList[i].HCloseMan);
+                        oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(badReasonList[i].HEntryCloseDate);
+                        oSub.HCloseType = DBUtility.ClsPub.isBool(badReasonList[i].HCloseType);
+                        oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo);
+                        oSub.HQty = badReasonList[i].HQty;
+                        oSub.HBadReasonID = badReasonList[i].HBadReasonID;
+
+                        BillNew.DetailCol1_BadReason.Add(oSub);
                     }
                 }
 
@@ -932,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