From 5bee62e95d6cd1d5306e99c0e4b6349b663ca0ce Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 09 一月 2025 09:15:49 +0800
Subject: [PATCH] 工艺路线孙表新增;排产锁定工单(添康反写排产完成日期到金蝶);批改小时产能;批改上班工时;不良原因添加班组过滤

---
 WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs                |  101 ++++++++++++++++++++
 WebAPI/Controllers/MateOutController.cs                            |   36 ++++++
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   75 ++++++++++++++
 WebAPI/Controllers/LMESController.cs                               |   33 ++++++
 WebAPI/Models/Gy_RoutingBillSub_WorkQty.cs                         |   18 +++
 WebAPI/WebAPI.csproj                                               |    1 
 6 files changed, 258 insertions(+), 6 deletions(-)

diff --git a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
index 08d95d3..1d97270 100644
--- a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
+++ b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -569,6 +569,107 @@
             return objJsonResult;
         }
 
+        //宸ヨ壓璺嚎瀛欒〃 鏂板
+        [Route("Gy_RoutingBillSub/AddWorkQty")]
+        [HttpPost]
+        public object AddWorkQty([FromBody] JObject sMainSub)
+        {
+            try
+            {
+                var _value = sMainSub["sMainSub"].ToString();
+                string msg1 = _value.ToString();
+
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+                string msg2 = sArray[0].ToString();
+                string user = sArray[1].ToString();
+
+                //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "宸ヨ壓璺嚎鏃犳潈闄愮紪杈�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                List<Gy_RoutingBillSub_WorkQty> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_RoutingBillSub_WorkQty>>(msg2);
+                int i = 0;
+
+                oCN.BeginTran();//寮�濮嬩簨鐗�
+
+                foreach (Gy_RoutingBillSub_WorkQty oSub in DetailColl)
+                {
+                    i++;
+
+                    if (i == 1)
+                    {
+                        //鍏堝垹闄ゅ巻鍙茬粦瀹氭暟鎹悗鍦ㄩ噸鏂颁繚瀛�
+                        oCN.RunProc("delete from Gy_RoutingBillSub_WorkQty where HInterID = " + oSub.HInterID + " and HEntryID = " + oSub.HEntryID);
+                    };
+
+                    oCN.RunProc($"insert into Gy_RoutingBillSub_WorkQty" +
+                        $"(HInterID,HEntryID,HEntrySubID,HSourceID,HWorkQty_Source,HEntryStdEmpQty,HEntryStdEmpAvg,HSortNum,HRemark)" +
+                        $"values({oSub.HInterID},{oSub.HEntryID},{i},{oSub.HSourceID},{oSub.HWorkQty_Source},{oSub.HEntryStdEmpQty}" +
+                        $",{oSub.HEntryStdEmpAvg},{oSub.HSortNum},'{oSub.HRemark}')");
+                }
+
+                oCN.Commit();//鎻愪氦浜嬬墿
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();//鍥炴粴浜嬬墿
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }           
+        }
+        #endregion
+
+        #region 宸ヨ壓璺嚎瀛欒〃缂栬緫鑾峰彇鏁版嵁
+        [Route("Gy_RoutingBill/EditWorkQty")]
+        [HttpGet]
+        public object EditWorkQty(long HInterID,long HEntryID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn($"select * from h_v_Gy_RoutingBillSub_WorkQtyEdit where hmainid={HInterID} and hsubid={HEntryID} order by HEntrySubID asc", "h_v_Gy_RoutingBillSub_WorkQtyEdit");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "false锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         #endregion
 
         #region 涓存椂瀹氶鎶ヨ〃
diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index e6e1b31..04b9bc9 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -1777,6 +1777,39 @@
 
         #endregion
 
+        #region  宸ヨ壓璺嚎鎵规敼灏忔椂浜ц兘
+        [Route("Gy_RoutingBill/BulkWorkQty")]
+        [HttpGet]
+        public object BulkWorkQty(string HMaterNumber1, string HMaterNumber2,string HProcID, string HWorkQty)
+        {
+            try
+            {
+                oCN.BeginTran();
+
+                string sql = $"update b set b.HWorkQty = {HWorkQty} from Gy_RoutingBillMain a left join Gy_RoutingBillSub b on a.HInterID = b.HInterID left join Gy_Material m on a.HMaterID = m.HItemID where m.HNumber between '{HMaterNumber1}' and '{HMaterNumber2}' and b.HProcID = {HProcID} and a.HCloseMan = ''";
+
+                //鎵ц鏇存柊涓婄彮宸ユ椂璇彞
+                oCN.RunProc(sql);
+
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵规敼鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #endregion
 
         /// <summary>
diff --git a/WebAPI/Controllers/MateOutController.cs b/WebAPI/Controllers/MateOutController.cs
index 49f11f2..55605d9 100644
--- a/WebAPI/Controllers/MateOutController.cs
+++ b/WebAPI/Controllers/MateOutController.cs
@@ -2267,7 +2267,7 @@
         /// </summary>
         [Route("Sc_BadReasonReport/list")]
         [HttpGet]
-        public object list(string sWhere, string user)
+        public object list(string sWhere, string user,string HGroupID)
         {
             try
             {
@@ -2291,7 +2291,7 @@
                 }
                 else
                 {
-                    ds = oCN.RunProcReturn("exec h_p_Sc_BadReasonReport '" + sWhere + "'", "h_p_Sc_BadReasonReport");
+                    ds = oCN.RunProcReturn("exec h_p_Sc_BadReasonReport '" + sWhere + "','" + HGroupID + "'", "h_p_Sc_BadReasonReport");
                 }
 
                 //娣诲姞鍒楀悕
@@ -2726,6 +2726,38 @@
         }
         #endregion
 
+        #region  宸ュ巶鏃ュ巻鎵规敼涓婄彮宸ユ椂
+        [Route("Gy_PlanShifts/BulkWorkTime")]
+        [HttpGet]
+        public object BulkWorkTime(string HSourceNumber1, string HSourceNumber2, string HBeginDate, string HEndDate,string HWorkTime)
+        {
+            try
+            {               
+                oCN.BeginTran();
+
+                string sql = $"update a set HOverTimes = {HWorkTime} from Gy_PlanShifts a left join Gy_Source b on a.HSourceID = b.HItemID where b.HNumber between '{HSourceNumber1}' and '{HSourceNumber2}' and CONVERT(varchar(120),a.HDate,23) between CONVERT(varchar(120),'{HBeginDate}',23) and CONVERT(varchar(120),'{HEndDate}',23)";
+
+                //鎵ц鏇存柊涓婄彮宸ユ椂璇彞
+                oCN.RunProc(sql);
+
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵规敼鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }        
+        #endregion
 
         #region  鍒舵垚鐜囨槑缁嗘姤琛�
         [Route("MaterOutEntryReport/Sc_ProductedRateReport")]
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
index d4efe32..c3a0b96 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
@@ -169,6 +169,9 @@
 
             try
             {
+                Stopwatch sw = new Stopwatch();//璁℃椂鍣�
+                sw.Start();//寮�濮嬭鏃�
+
                 if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user))
                 {
                     objJsonResult.code = "0";
@@ -198,9 +201,8 @@
 
                 string sReturn = "";
                 oSystemParameter.ShowBill(ref sReturn);
-
                 for (int i = 0; i < list.Count; i++)
-                {
+                {                                     
                     TrueCount = 0;
                     SumCount = 0;
                     long HInterID = 0;
@@ -248,10 +250,10 @@
                                 objJsonResult.data = null;
                                 return objJsonResult;
                             }
-                        }                      
-
+                        }
                         ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
                             $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
+
                         if (ds.Tables[0].Rows.Count > 0)
                         {
                             objJsonResult.code = "0";
@@ -393,6 +395,8 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+
+                   
                 }
 
                 LogService.CustomWriteLog("2.5:", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -401,6 +405,8 @@
                 oCN.RunProc("exec REALESE_SC_ICMOBILLSTATUS_TMP");
 
                 LogService.CustomWriteLog("2.6:", DateTime.Now.ToString("yyyy-MM-dd"));
+                sw.Stop();//缁撴潫璁℃椂
+                LogService.Write($"========================1.鎺掍骇璁㈠崟鎬荤敤鏃讹細" + sw.Elapsed);
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -444,6 +450,15 @@
                     "HMasterDate,HQty,HUseTimes)" +
                             $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," +
                             $" '{date}', {HQTY},{ ((dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())).ToString() == "闈炴暟瀛�" ? 0 : dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())) })");               
+            }
+
+            string sReturn = "";
+            oSystemParameter.ShowBill(ref sReturn);
+            if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+            {
+                //鎶婃帓浜ц鍗曞畬宸ユ棩鏈熷弽鍐欏埌閲戣澏閿�鍞鍗曚笂
+                string sql = "exec h_p_JIT_UpdateEndDateToERP " + HInterID + ",'" + HBillNo + "'";
+                oCN.RunProc(sql);
             }
 
             objJsonResult.code = "1";
@@ -2618,6 +2633,58 @@
         }
         #endregion
 
+        #region 鐢熶骇鏃ヨ鍒掑钩鍙� 閿佸畾宸ュ崟
+        [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHLockedOrder")]
+        [HttpGet]
+        public object JIT_DayPlanPlatFormBillHLockedOrder(string HInterIDs)
+        {
+            try
+            {
+                oCN.RunProc($"update Sc_WorkBillSortBillMain set HLockOrder = 1 where HInterID in ({HInterIDs})");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢熶骇鏃ヨ鍒掑钩鍙� 瑙i攣宸ュ崟
+        [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHUnlockOrder")]
+        [HttpGet]
+        public object JIT_DayPlanPlatFormBillHUnlockOrder(string HInterIDs)
+        {
+            try
+            {
+                oCN.RunProc($"update Sc_WorkBillSortBillMain set HLockOrder = 0 where HInterID in ({HInterIDs})");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鐢熶骇璁㈠崟鏌ヨ
         [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillList")]
         [HttpGet]
diff --git a/WebAPI/Models/Gy_RoutingBillSub_WorkQty.cs b/WebAPI/Models/Gy_RoutingBillSub_WorkQty.cs
new file mode 100644
index 0000000..199ca20
--- /dev/null
+++ b/WebAPI/Models/Gy_RoutingBillSub_WorkQty.cs
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Gy_RoutingBillSub_WorkQty : DBUtility.ClsXt_BaseBillSub
+    {
+        public Int64 HEntrySubID { get; set; }//瀛欒〃ID
+        public Int64 HSourceID { get; set; }//鐢熶骇璧勬簮ID 
+        public Decimal HWorkQty_Source { get; set; }//鐢熶骇璧勬簮浜ц兘  
+        public Decimal HEntryStdEmpQty { get; set; }//鐢熶骇璧勬簮鏍囧噯浜烘暟  
+        public Decimal HEntryStdEmpAvg { get; set; }//鐢熶骇璧勬簮浜哄潎浜ц兘
+        public Int64 HSortNum { get; set; }//浼樺厛绾�
+        
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index f1aa900..53cee8c 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -827,6 +827,7 @@
     <Compile Include="Models\ClsSc_AssemblyBillSub.cs" />
     <Compile Include="Models\ClsSc_MESBeginWorkBillSub_RelationBill.cs" />
     <Compile Include="Models\Gy_MouldFileSub_SubMater.cs" />
+    <Compile Include="Models\Gy_RoutingBillSub_WorkQty.cs" />
     <Compile Include="Models\QC_OutCompCheckBillSub_ValueGrid.cs" />
     <Compile Include="Models\SBGL\SBBB\Sb_EquipMentCollectionTechParam_Temp.cs" />
     <Compile Include="Models\SBGL\SBBB\Sb_EquipMentCollectionTechParam.cs" />

--
Gitblit v1.9.1