From 9536a6d14c8f1ac9001a4d27ec0e87b761634ab4 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期五, 27 十月 2023 14:14:09 +0800
Subject: [PATCH] 特批申请单

---
 WebAPI/Controllers/QC_ManagementController.cs |  175 ++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 102 insertions(+), 73 deletions(-)

diff --git a/WebAPI/Controllers/QC_ManagementController.cs b/WebAPI/Controllers/QC_ManagementController.cs
index 4cc2c52..7452035 100644
--- a/WebAPI/Controllers/QC_ManagementController.cs
+++ b/WebAPI/Controllers/QC_ManagementController.cs
@@ -13,6 +13,8 @@
 {
     public class QC_ManagementController : ApiController
     {
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
 
         #region 閿欒杩斿洖鏂规硶
         // GET: QC_Management
@@ -1127,80 +1129,82 @@
                 return objJsonResult;
             }
         }
+        #region [浼垹闄ゆā寮廬
+        ///// <summary>
+        ///// 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
+        ///// </summary>
+        ///// <returns></returns>
+        //[Route("DeltetQC_FirstPieceCheck")]
+        //[HttpGet]
+        //public object DeltetQC_FirstPieceCheck(string HInterID,string user)
+        //{
+        //    DataSet ds;
+        //    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;
+        //        }
 
-        /// <summary>
-        /// 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
-        /// </summary>
-        /// <returns></returns>
-        [Route("DeltetQC_FirstPieceCheck")]
-        [HttpGet]
-        public object DeltetQC_FirstPieceCheck(string HInterID,string user)
-        {
-            DataSet ds;
-            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;
-                }
+        //        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        //        if (string.IsNullOrWhiteSpace(HInterID))
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "HInterID涓虹┖锛�";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
+        //        oCN.BeginTran();//寮�濮嬩簨鍔�
+        //        ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain");
+        //        DataSet ds2 = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub where HInterID=" + HInterID, "QC_FirstPieceCheckBillSub");
+        //        if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2 == null || ds2.Tables[0].Rows.Count == 0)
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "娌℃湁杩欎釜鍗曟嵁锛屾棤娉曞垹闄わ紒";
+        //            objJsonResult.data = null;
+        //            return objJsonResult; ;
+        //        }
+        //        var HCloseMan = Convert.ToString(ds.Tables[0].Rows[0]["HCloseMan"]);
+        //        var HCloseMan2 = Convert.ToString(ds2.Tables[0].Rows[0]["HCloseMan"]);
+        //        if (!string.IsNullOrWhiteSpace(HCloseMan) || !string.IsNullOrWhiteSpace(HCloseMan2))
+        //        {
+        //            oCN.RollBack();//鍥炴粴浜嬪姟
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "鍗曟嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
 
-                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (string.IsNullOrWhiteSpace(HInterID))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "HInterID涓虹┖锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-                ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain");
-                DataSet ds2 = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub where HInterID=" + HInterID, "QC_FirstPieceCheckBillSub");
-                if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2 == null || ds2.Tables[0].Rows.Count == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁杩欎釜鍗曟嵁锛屾棤娉曞垹闄わ紒";
-                    objJsonResult.data = null;
-                    return objJsonResult; ;
-                }
-                var HCloseMan = Convert.ToString(ds.Tables[0].Rows[0]["HCloseMan"]);
-                var HCloseMan2 = Convert.ToString(ds2.Tables[0].Rows[0]["HCloseMan"]);
-                if (!string.IsNullOrWhiteSpace(HCloseMan) || !string.IsNullOrWhiteSpace(HCloseMan2))
-                {
-                    oCN.RollBack();//鍥炴粴浜嬪姟
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+        //        oCN.RunProc("update QC_FirstPieceCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID);
+        //        oCN.RunProc("update QC_FirstPieceCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID);
+        //        oCN.Commit();//鎻愪氦浜嬪姟
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 1;
+        //        objJsonResult.Message = "* 鍗曟嵁鍒犻櫎鎴愬姛锛�";
+        //        objJsonResult.data = null;
+        //        return objJsonResult; ;
 
-                oCN.RunProc("update QC_FirstPieceCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID);
-                oCN.RunProc("update QC_FirstPieceCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID);
-                oCN.Commit();//鎻愪氦浜嬪姟
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "* 鍗曟嵁鍒犻櫎鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 0;
+        //        objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+        //        objJsonResult.data = null;
+        //        return objJsonResult;
+        //    }
+        //}
+        #endregion
+       
         #endregion
 
         #region 宸℃
@@ -1219,6 +1223,7 @@
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
             string user = sArray[2].ToString();
+            string badmsg = sArray[3].ToString();
 
 
             string UserName = "";
@@ -1251,7 +1256,7 @@
                     oItem.HBillSubType = "7506";
                     oItem.HBillStatus = 0;
                     oItem.HPeriod = 0;
-                    oItem.HMaker = "";
+                    oItem.HMaker = user;
                     oItem.HMainSourceInterID = oItem.HInterID;
 
                     //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -1297,10 +1302,34 @@
                     oItemSub.HRelationQty = 0;
                     oItemSub.HRelationMoney = 0;
                     oItemSub.HCloseMan = "";
-                    oItemSub.HRemark = "";
+                    //oItemSub.HRemark = "";
                     oBill.DetailColl.Add(oItemSub);
 
                 }
+                badmsg = badmsg.Substring(1, badmsg.Length - 2);
+                badmsg = badmsg.Replace("\\", "");
+                badmsg = badmsg.Replace("\n", "");  //\n
+                List<Model.ClsQC_PatrolProcCheckBillSub_BadReason> bs = new List<Model.ClsQC_PatrolProcCheckBillSub_BadReason>();
+                bs = oListModels.getObjectByJson_ClsQC_PatrolProcCheckBillSub_BadReason(badmsg);
+                int j = 0;
+                foreach (Model.ClsQC_PatrolProcCheckBillSub_BadReason badSub in bs)
+                {
+                    badSub.HBillNo_bak = oBill.omodel.HBillNo;//鍗曟嵁鍙凤紙澶囦唤锛屼互鍏嶅唴鐮佷涪澶憋紝鎵句笉鍒板搴斾富琛級
+                    j++;
+                    if (string.IsNullOrWhiteSpace(badSub.HBillNo_bak))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病澶囦唤鍗曟嵁鍙凤紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    badSub.HInterID = oBill.omodel.HInterID;
+                    badSub.HEntryID = j;
+                    badSub.HSEQ = j;             
+                    oBill.DetailColl_Bad.Add(badSub);
+                }
+
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;

--
Gitblit v1.9.1