From c11f1a7ae168a68fbbbcc52936fd3c8781b26b97 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期五, 19 十二月 2025 14:15:24 +0800
Subject: [PATCH] 新增 来料通知单 不良原因保存接口

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

diff --git a/WebAPI/Controllers/QC_POStockInCheckBillController.cs b/WebAPI/Controllers/QC_POStockInCheckBillController.cs
index a639dbf..f861f2d 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,11 @@
             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)
+            {
+                BadReason = "[]";
+            }
             bool bResult;
             try
             {
@@ -812,8 +1040,9 @@
                 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);
                 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 +1089,10 @@
                         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);
                         BillNew.DetailColl.Add(oSub);
                     }
                     else
@@ -872,6 +1105,33 @@
                     }
                 }
 
+                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);
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏃犳槑缁嗚淇℃伅!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
 
 
 

--
Gitblit v1.9.1