From 9b6cd6ba2508314b3a4967b3764153170d40e66c Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期四, 14 八月 2025 10:32:46 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |   82 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 68 insertions(+), 14 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 94c868c..dcdd61b 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -153,6 +153,9 @@
                 double HBackWorkByMaterQty = list[0].HBackWorkByMaterQty;//閬楀け鏁伴噺
                 int HMouldID = list[0].HMouldID;//妯″叿id
                 double HMachineWorkTimes = list[0].HMachineWorkTimes;//璁惧宸ユ椂
+                int HIsTimeFlag = list[0].HIsTimeFlag;//鏄惁璁℃椂
+                string HRelBeginTime = list[0].HRelBeginTime;//寮�宸ユ椂闂�
+                string HRelEndTime = list[0].HRelEndTime;//瀹屽伐鏃堕棿
                 LogService.Write($"1.瀛楁璧嬪�硷紝鐢ㄦ椂" + sw.Elapsed );
 
                 //鍗曟嵁瀹屾暣鎬у垽鏂�
@@ -233,7 +236,7 @@
                     }
 
                     //鍒ゆ柇瀹㈡埛涓嶄负榫欏北姹介厤
-                    if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤" && oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�" && oSystemParameter.omodel.WMS_CampanyName != "娣诲悍绉戞妧") //绯荤粺鍙傛暟                      
+                    if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤" && oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�" && oSystemParameter.omodel.WMS_CampanyName != "娣诲悍绉戞妧" && oSystemParameter.omodel.WMS_CampanyName != "娴疯瘹") //绯荤粺鍙傛暟                      
                     {
                         if (HSourceID == 0)
                         {
@@ -413,7 +416,7 @@
                     ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" +
                     ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" +
                     ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID,HWasterQty_Work,HWasterQty_Mater,HBackWorkQty,HShiftsID" +
-                    ",HToCheckQty,HLossQty,HBackWorkByMaterQty,HMouldID,HMachineWorkTimes " +
+                    ",HToCheckQty,HLossQty,HBackWorkByMaterQty,HMouldID,HMachineWorkTimes,HIsTimeFlag,HRelBeginTime,HRelEndTime " +
                     ") " +
                     " values('" + BillType + "','" + (OperationType == "5" ? "SUB" : HBillSubType)  + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",'"+ HDate + "','" + HMaker + "',getdate(),'" + HMouldNum + "'" +
                     "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL +
@@ -424,7 +427,7 @@
                     "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) +
                     "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID +
                     "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + "," + HWasterQty_Work + "," + HWasterQty_Mater + "," + HBackWorkQty +
-                    "," + HShiftsID + "," + HToCheckQty + "," + HLossQty + ","+ HBackWorkByMaterQty + "," + HMouldID + ",'" + HMachineWorkTimes + "') ");
+                    "," + HShiftsID + "," + HToCheckQty + "," + HLossQty + ","+ HBackWorkByMaterQty + "," + HMouldID + ",'" + HMachineWorkTimes + "',"+ HIsTimeFlag + ",'" + HRelBeginTime + "','" + HRelEndTime +  "') ");
 
                     LogService.Write($"4.鏂板缁撴潫锛岀敤鏃�" + sw.Elapsed);
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板宸ュ簭鍑虹珯鍗曟嵁:" + HBillNo);
@@ -471,7 +474,10 @@
                     ",HBackWorkQty=" + HBackWorkQty +
                     ",HBackWorkByMaterQty=" + HBackWorkByMaterQty +
                     ",HMouldID=" + HMouldID +
-                    ",HMachineWorkTimes=" + HMachineWorkTimes +  
+                    ",HMachineWorkTimes=" + HMachineWorkTimes +
+                    ",HIsTimeFlag=" + HIsTimeFlag +
+                    ",HRelBeginTime='" + HRelBeginTime + "'" +
+                    ",HRelEndTime='" + HRelEndTime + "'" +
                     " where HInterID=" + HInterID);
 
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼宸ュ簭鍑虹珯鍗曟嵁:" + HBillNo);
@@ -2754,7 +2760,7 @@
                 int j = 0;
                 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)
@@ -2774,7 +2780,7 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
-
+                    //================================================================================
 
                     //瀹℃牳
                     if (Cj_StationOutBillCheckBill(long.Parse(HInterIDs[i]), HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
@@ -2850,7 +2856,7 @@
                     LogService.Write("鍑虹珯鍗曟嵁瀹℃牳鏇存敼娴佽浆鍗℃暟閲�,娴佽浆鍗�:" + HProcExchBillNo + ",鍑虹珯鍗曞彿锛�" + HBillNo + ",鍘熸祦杞崱鏁伴噺:" + HProcExchQty + ",鏂版祦杞崱鏁伴噺:" + HQty);
                 }
 
-                //瀹℃牳鍚庢帶鍒�
+                //瀹℃牳鍚庢帶鍒�================================================================================
                 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)
@@ -2865,7 +2871,7 @@
                     oCN.RollBack();
                     return false;
                 }
-               
+                //================================================================================
 
                 sReturn = sReturn + " 瀹℃牳鍔熻兘锛�";
                 oCN.Commit();
@@ -2972,7 +2978,7 @@
                 int j = 0;
                 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)
@@ -2992,7 +2998,7 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
-
+                    //================================================================================
                     //鍙嶅鏍�
                     if (Cj_StationOutBillAbandonCheckBill(long.Parse(HInterIDs[i]),HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
@@ -3086,7 +3092,7 @@
                 return false; ;
             }
         }
-
+        #endregion
 
         #region 宸ュ簭鍑虹珯鍏抽棴/鍙嶅叧闂姛鑳�
         [Route("Cj_StationOutBill/CloseCj_StationOutBill")]
@@ -3151,8 +3157,32 @@
                             return objJsonResult;
                         }
                     }
+                    var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+
+                    //鍏抽棴鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Sc_StationOutBill_BeforeCloseCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationOutBill_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_StationOutBill_AfterCloseCtrl", user, ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -3178,8 +3208,32 @@
                             return objJsonResult;
                         }
                     }
+                    var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                    //鍙嶅叧闂墠鎺у埗=========================================      
+                    string sql1 = "exec h_p_Sc_StationOutBill_BeforeUnCloseCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationOutBill_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_StationOutBill_AfterUnCloseCtrl", user, ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -3211,7 +3265,7 @@
 
 
 
-        //鏄惁琚叧鑱�
+        #region //鏄惁琚叧鑱�
         public bool Cj_StationInBillisUse(Int64 lngBillKey, ref string sReturn)
         {
             try

--
Gitblit v1.9.1