From 25c2291ded30737b07fb7c93e5e231cc64733d2a Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期二, 19 八月 2025 16:15:29 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CJGL/Cj_StationInBillController.cs |  143 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 116 insertions(+), 27 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
index 6f67eec..4b6519c 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -366,15 +366,34 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
+                if (oSystemParameter.ShowBill(ref sReturn) == true)
                 {
-                    oCN.RollBack();
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "[0000-2-015]" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  鍒ゆ柇瀹㈡埛
+                    {
+                        if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
+                        {
+                            oCN.RollBack();
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message =DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    else
+                    {
+                        if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
+                        {
+                            oCN.RollBack();
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "[0000-2-015]" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
                 }
+              
                 oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID + ",1");
                 //鍒ゆ柇鏄惁鏄� 棣栭亾宸ュ簭
                 ds1 = oCN.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a  " +
@@ -389,7 +408,7 @@
 
                 }
 
-                //=========================淇濆瓨鍚庢帶鍒�  
+                //=========================淇濆瓨鍚庢帶鍒�  ============================
                 DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_StationInBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Sc_StationInBill_AfterSaveCtrl");
                 if (ds2 == null)
                 {
@@ -410,7 +429,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                //============================
+                //=======================================================
 
                 oCN.Commit();
                
@@ -908,8 +927,9 @@
         [HttpGet]
         public object set_ShowBillJudge(string HBillNo)
         {
+            string sReturn = "";
             try
-            {
+            {                
                 ds = oCN.RunProcReturn("exec h_p_MES_StationInBill_DelCtrl  '" + HBillNo + "'", "h_p_MES_StationInBill_DelCtrl");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
@@ -938,11 +958,34 @@
             }
             catch (Exception e)
             {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "[0000-1-038]Exception锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
+                if (oSystemParameter.ShowBill(ref sReturn) == true)
+                {
+                    if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  鍒ゆ柇瀹㈡埛
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = e.ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "[0000-1-038]Exception锛�" + e.ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }                
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "[0000-1-038]Exception锛�" + e.ToString();
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
             }
         }
         #endregion
@@ -990,8 +1033,6 @@
         {
             try
             {
-                string ModRightNameCheck = "";
-
                 if (HBillSubType == "SUB")
                 {
                     //瀹℃牳鏉冮檺
@@ -1046,7 +1087,7 @@
                     return objJsonResult;
                 }
 
-                //瀹℃牳鍓嶆帶鍒�
+                //瀹℃牳鍓嶆帶鍒�==========================================================================
                 string HBillNo = oBill.omodel.HBillNo;
                 string sql = "exec h_p_Sc_StationInBill_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                 ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_BeforeCheckCtrl");
@@ -1067,7 +1108,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
+                //=============================================================================
                 //瀹℃牳
                 if (Cj_StationInBillCheckBill(HInterID, HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
@@ -1127,7 +1168,7 @@
                 {
                 }
 
-                //瀹℃牳鍚庢帶鍒�
+                //瀹℃牳鍚庢帶鍒�=======================================================
                 string sql = "exec h_p_Sc_StationInBill_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                 ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_AfterCheckCtrl");
                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
@@ -1142,7 +1183,7 @@
                     oCN.RollBack();
                     return false;
                 }
-
+                //====================================================================
                 sReturn = sReturn + " 瀹℃牳鍔熻兘锛�";
                 oCN.Commit();
                 return true;
@@ -1220,7 +1261,7 @@
                     return objJsonResult;
                 }
 
-                //鍙嶅鏍稿墠鎺у埗
+                //鍙嶅鏍稿墠鎺у埗=============================================================================
                 string HBillNo = oBill.omodel.HBillNo;
                 string sql = "exec h_p_Sc_StationInBill_BeforeUnCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                 ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_BeforeUnCheckCtrl");
@@ -1241,7 +1282,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
+                //============================================================================================
                 //鍙嶅鏍�
                 if (Cj_StationInBillAbandonCheckBill(HInterID, HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
@@ -1305,7 +1346,7 @@
                 {
                 }
 
-                //鍙嶅鏍稿悗鎺у埗
+                //鍙嶅鏍稿悗鎺у埗========================================================================
                 string sql = "exec h_p_Sc_StationInBill_AfterUnCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                 ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_AfterUnCheckCtrl");
                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
@@ -1320,7 +1361,7 @@
                     oCN.RollBack();
                     return false;
                 }
-
+                //============================================================================================
                 sReturn = sReturn + "鍙嶅鏍稿姛鑳斤紒";
                 oCN.Commit();
                 return true;
@@ -1420,8 +1461,32 @@
                             return objJsonResult;
                         }
                     }
+                    var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+
+                    //鍏抽棴鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Sc_ShiftsBeginInfoBill_BeforeCloseCtrl " + HInterID + ",'" +HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_ShiftsBeginInfoBill_BeforeCloseCtrl");
+                    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 (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    if (!BillOld.CloseBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ShiftsBeginInfoBill_AfterCloseCtrl", user,ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -1447,8 +1512,32 @@
                             return objJsonResult;
                         }
                     }
+                    var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                    //鍙嶅叧闂墠鎺у埗=========================================      
+                    string sql1 = "exec h_p_Sc_StationInBill_BeforeUnCloseCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationInBill_BeforeUnCloseCtrl");
+                    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 (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    if (!BillOld.CancelClose(Int64.Parse(HInterID), HBillNo, "h_p_Sc_StationInBill_AfterUnCloseCtrl", user, ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;

--
Gitblit v1.9.1