From a5fa0991eeb084e3ddaac69fce80dfd32d06db41 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 19 四月 2024 13:31:37 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |  153 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 130 insertions(+), 23 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index d89d13b..2dbbae2 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -431,7 +431,7 @@
                 }
                 //涓昏〃
 
-                //LogService.Write($"5.绯荤粺鎺у埗鏌ヨ鍒ゆ柇锛岀敤鏃�" + sw.Elapsed);
+                LogService.Write($"5.绯荤粺鎺у埗鏌ヨ鍒ゆ柇锛岀敤鏃�" + sw.Elapsed);
                 ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl");
                 if (ds == null)
                 {
@@ -442,7 +442,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                //LogService.Write($"5.1锛岀敤鏃�" + sw.Elapsed);
+                LogService.Write($"5.1锛岀敤鏃�" + sw.Elapsed);
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     oCN.RollBack();
@@ -452,7 +452,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                //LogService.Write($"5.2锛岀敤鏃�" + sw.Elapsed);
+                LogService.Write($"5.2锛岀敤鏃�" + sw.Elapsed);
                 if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
                 {
                     oCN.RollBack();
@@ -462,17 +462,18 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                //LogService.Write($"6.鍒ゆ柇缁撴潫锛岀敤鏃�" + sw.Elapsed);
+                LogService.Write($"6.鍒ゆ柇缁撴潫锛岀敤鏃�" + sw.Elapsed);
                 oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + ","+ num + "");
-                //LogService.Write($"6.1锛岀敤鏃�" + sw.Elapsed);
+                LogService.Write($"6.1锛岀敤鏃�" + sw.Elapsed);
                 oCN.RunProc("exec h_p_Mes_ProcessExchangeChangeStatus  " + HInterID + " ");
-                //LogService.Write($"6.2锛岀敤鏃�" + sw.Elapsed);
+                LogService.Write($"6.2锛岀敤鏃�" + sw.Elapsed);
                 oCN.RunProc("exec h_p_Mes_StationOutBillBackBarCode  " + HInterID + " ");
-                //LogService.Write($"7.瀛樺偍杩囩▼缁撴潫锛岀敤鏃�" + sw.Elapsed);
+                LogService.Write($"7.瀛樺偍杩囩▼缁撴潫锛岀敤鏃�" + sw.Elapsed);
                 //鍒ゆ柇鏄惁鏄� 鏈亾宸ュ簭 
                 ds1 = oCN.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a  " +
                                     " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID  " +
                                     " Where a.HInterID=" + HProcExchInterID + " and b.HEntryID=" + HProcExchEntryID + " ", "Sc_ProcessExchangeBillMain");
+                LogService.Write($"7.1.鏌ヨ锛岀敤鏃�" + sw.Elapsed);
                 //鍒ゆ柇鏄惁鏄柊澧�
                 if ("Add".Equals(eventType))
                 {
@@ -523,6 +524,7 @@
                         }
                     }
                 }
+                LogService.Write($"7.2.鏌ヨ锛岀敤鏃�" + sw.Elapsed);
 
                 //=========================淇濆瓨鍚庢帶鍒�  
                 DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_StationOutBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Sc_StationOutBill_AfterSaveCtrl");
@@ -548,7 +550,7 @@
                 //============================
 
 
-                //LogService.Write($"10.浜嬪姟缁撴潫锛岀敤鏃�" + sw.Elapsed);
+                LogService.Write($"10.浜嬪姟缁撴潫锛岀敤鏃�" + sw.Elapsed);
                 oCN.Commit();
                 string sReturn = "";
                 if (oSystemParameter.ShowBill(ref sReturn) == true)
@@ -2185,7 +2187,30 @@
                         }
                     }
 
-                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo))
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string HBillNo = oBill.omodel.HBillNo;
+                    string sql1 = "exec h_p_Sc_StationOutBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + HDeleteMan + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationOutBill_BeforeDelCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, HBillNo, "h_p_Sc_StationOutBill_AfterDelCtrl", HDeleteMan, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
@@ -2496,12 +2521,13 @@
                 }
               
             
-                var HBillNo = HInterID.Split(',');
+                var HInterIDs = HInterID.Split(',');
+                string[] HBillNo = new string[HInterIDs.Length];
                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
 
-                for (int i = 0; i < HBillNo.Length; i++)
+                for (int i = 0; i < HInterIDs.Length; i++)
                 {
-                    if (HBillNo[i] == "0")
+                    if (HInterIDs[i] == "0")
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
@@ -2510,7 +2536,7 @@
                         return objJsonResult;
                     }
                     //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
-                    if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo))
+                    if (oBill.ShowBill(long.Parse(HInterIDs[i]), ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         if (oBill.omodel.HChecker.Trim() != "")
                         {
@@ -2520,6 +2546,7 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
+                        HBillNo[i] = oBill.omodel.HBillNo;
                     }
                     else
                     {
@@ -2532,10 +2559,32 @@
                 }
 
                 int j = 0;
-                for (int i = 0; i < HBillNo.Length; i++)
+                for (int i = 0; i < HInterIDs.Length; i++)
                 {
+                    //瀹℃牳鍓嶆帶鍒�
+                    string sql = "exec h_p_Sc_StationOutBill_BeforeCheckCtrl " + HInterIDs[i] + ",'" + HBillNo[i] + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_BeforeCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+
                     //瀹℃牳
-                    if (Cj_StationOutBillCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
+                    if (Cj_StationOutBillCheckBill(long.Parse(HInterIDs[i]), HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         j += 1;
                     }
@@ -2566,7 +2615,7 @@
         }
 
         //瀹℃牳
-        public bool Cj_StationOutBillCheckBill(Int64 lngBillKey, string CurUserName,bool HLastSubProc, ref string sReturn)
+        public bool Cj_StationOutBillCheckBill(Int64 lngBillKey, string HBillNo, string CurUserName,bool HLastSubProc, ref string sReturn)
         {
             try
             {
@@ -2594,6 +2643,23 @@
                 else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�")
                 {
                 }
+
+                //瀹℃牳鍚庢帶鍒�
+                string sql = "exec h_p_Sc_StationOutBill_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_AfterCheckCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "瀹℃牳杩囩▼涓嚭閿欙紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    oCN.RollBack();
+                    return false;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    oCN.RollBack();
+                    return false;
+                }
+
                 sReturn = sReturn + " 瀹℃牳鍔熻兘锛�";
                 oCN.Commit();
                 return true;
@@ -2640,16 +2706,17 @@
                 }
               
 
-                var HBillNo = HInterID.Split(',');
+                var HInterIDs = HInterID.Split(',');
+                string[] HBillNo = new string[HInterIDs.Length];
                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
 
                 //鑾峰彇绯荤粺鍙傛暟
                 string Ret = "";
                 oSystemParameter.ShowBill(ref Ret);
 
-                    for (int i = 0; i < HBillNo.Length; i++)
+                    for (int i = 0; i < HInterIDs.Length; i++)
                 {
-                    if (long.Parse(HBillNo[i]) == 0)
+                    if (long.Parse(HInterIDs[i]) == 0)
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
@@ -2659,7 +2726,7 @@
                     }
 
                     //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
-                    if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo))
+                    if (oBill.ShowBill(long.Parse(HInterIDs[i]), ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         if (oBill.omodel.HChecker.Trim() == "")
                         {
@@ -2682,6 +2749,8 @@
                                 return objJsonResult;
                             }
                         }
+
+                        HBillNo[i] = oBill.omodel.HBillNo;
                     }
                     else
                     {
@@ -2694,10 +2763,31 @@
                 }
 
                 int j = 0;
-                for (int i = 0; i < HBillNo.Length; i++)
+                for (int i = 0; i < HInterIDs.Length; i++)
                 {
+                    //鍙嶅鏍稿墠鎺у埗
+                    string sql = "exec h_p_Sc_StationOutBill_BeforeUnCheckCtrl " + HInterIDs[i] + ",'" + HBillNo[i] + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_BeforeUnCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     //鍙嶅鏍�
-                    if (Cj_StationOutBillAbandonCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
+                    if (Cj_StationOutBillAbandonCheckBill(long.Parse(HInterIDs[i]),HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         j += 1;
                     }
@@ -2728,7 +2818,7 @@
         }
 
         //鍙嶅鏍�
-        public bool Cj_StationOutBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, bool HLastSubProc, ref string sReturn)
+        public bool Cj_StationOutBillAbandonCheckBill(Int64 lngBillKey,string HBillNo, string CurUserName, bool HLastSubProc, ref string sReturn)
         {
             if (Cj_StationInBillisUse(lngBillKey, ref sReturn))
             {
@@ -2761,6 +2851,23 @@
                 else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�")
                 {
                 }
+
+                //鍙嶅鏍稿悗鎺у埗
+                string sql = "exec h_p_Sc_StationOutBill_AfterUnCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_AfterUnCheckCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "鍙嶅鏍歌繃绋嬩腑鍑洪敊锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                    oCN.RollBack();
+                    return false;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    oCN.RollBack();
+                    return false;
+                }
+
                 sReturn = sReturn + "鍙嶅鏍稿姛鑳斤紒";
                 oCN.Commit();
                 return true;

--
Gitblit v1.9.1