From 54c1a953d8318a09ce874b16adb42f902cbef547 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期二, 21 一月 2025 13:52:24 +0800
Subject: [PATCH] 缝纫排产获取开工,完工日期;添康删除日计划工单逻辑调整

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   87 +++++++++++++++++++++++++++--
 WebAPI/Controllers/SCGL/日计划管理/Sc_WorkBillSortBillController.cs     |   41 +++++++++----
 2 files changed, 110 insertions(+), 18 deletions(-)

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 c3a0b96..d24395d 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"
@@ -251,7 +251,7 @@
                                 return objJsonResult;
                             }
                         }
-                        ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+                        ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" +
                             $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
 
                         if (ds.Tables[0].Rows.Count > 0)
@@ -333,7 +333,7 @@
                             return objJsonResult;
                         }
 
-                        ds = oCN.RunProcReturn($"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+                        ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" +
                               $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
 
                         if (ds.Tables[0].Rows.Count > 1)
@@ -358,6 +358,11 @@
                     oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString()} where HInterID={(HInterID==0?int.Parse(list[i]["hmainid"].ToString()):HInterID)} and HBillNo='{(HBillNo==""?list[i]["鍗曟嵁鍙�"].ToString(): HBillNo)}'");
 
                     int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
+
+                    if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                        SumDay = 180;
+                    }            
 
                     LogService.CustomWriteLog("2.3:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
                     for (int j = 0; j < SumDay; j++)
@@ -427,7 +432,7 @@
         public json AddBillSub(string HInterID, string HBillNo, DateTime date, double HQTY, Dictionary<string, string> dic)
         {         
             //鑾峰彇琛ㄦ牸鏁版嵁
-            ds = oCN.RunProcReturn($"select * from  h_v_JIT_Sc_WorkBillSortBillList where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList");
+            ds = oCN.RunProcReturn($"select * from  h_v_JIT_Sc_WorkBillSortBill_PC where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBill_PC");
             int count = 0;
             if (ds.Tables[0].Rows.Count > 0)
             {
@@ -2925,16 +2930,31 @@
         {
             try
             {
+                //鑾峰彇鏄剧ず绯荤粺鍙傛暟
+                string sReturn = "";
+                oSystemParameter.ShowBill(ref sReturn);
+
                 //鏌ヨ閫夋嫨杞﹂棿涓湭鎺掍骇杩囩殑鐢熶骇璁㈠崟淇℃伅锛堟坊搴风鎶�--鐢熶骇璁㈠崟鐘舵�佷负涓嬭揪锛�
                 ds = oCN.RunProcReturn($"exec h_p_JIT_ICMOBillListByDept '{HDeptID}'", "h_p_JIT_ICMOBillListByDept");
 
                 if (ds.Tables[0].Rows.Count > 0 && ds != null)
                 {
-                    //鏁版嵁琛ㄦ牸娣诲姞鍔ㄦ�佹棩鏈�
-                    for (int j = 1; j <= 31; j++)
+                    if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                     {
-                        ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+                        //鏁版嵁琛ㄦ牸娣诲姞鍔ㄦ�佹棩鏈�
+                        for (int j = 1; j <= 180; j++)
+                        {
+                            ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+                        }
                     }
+                    else
+                    {
+                        //鏁版嵁琛ㄦ牸娣诲姞鍔ㄦ�佹棩鏈�
+                        for (int j = 1; j <= 31; j++)
+                        {
+                            ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+                        }
+                    }                   
 
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -2962,5 +2982,60 @@
             }
         }
         #endregion
+
+        #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鑾峰彇瀹屽伐鏃ユ湡
+        [Route("JIT_DayPlanPlatFormBill/GetICMOCompletionDate")]
+        [HttpGet]
+        public object GetICMOCompletionDate(string HDeptID)
+        {
+            try
+            {
+                //鏇存柊鏃ヨ鍒掑伐鍗曠殑瀹屽伐鏃ユ湡
+                oCN.RunProc($"exec h_p_JIT_GetICMOCompletionDate '{HDeptID}'");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇瀹屽伐鏃ユ湡鎴愬姛锛�";
+                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/GetICMOEarlyDate")]
+        [HttpGet]
+        public object GetICMOEarlyDate(string HDeptID)
+        {
+            try
+            {
+                //鏇存柊鐢熶骇璁㈠崟鐨勬渶鏃╁紑宸ユ棩鏈�
+                oCN.RunProc($"exec h_p_JIT_GetICMOEarlyDate '{HDeptID}'");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇鏈�鏃╁紑宸ユ棩鏈熸垚鍔燂紒";
+                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
+
     }
 }
\ No newline at end of file
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
index fb4aa7a..44839ac 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
@@ -18,6 +18,7 @@
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         Sc_WorkBillSortBillMain omdelMian = new Sc_WorkBillSortBillMain();
         List<Sc_WorkBillSortBillSub> omodelsub = new List<Sc_WorkBillSortBillSub>();
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
         #region 鏃ヨ鍒掑伐鍗� 鍒楄〃
         [Route("Sc_WorkBillSortBill/Sc_WorkBillSortBillList")]
@@ -309,21 +310,14 @@
                 {
                     var NumData = HInterID.Split(',');
 
+                    //鑾峰彇绯荤粺鍙傛暟
+                    string sReturn = "";
+                    oSystemParameter.ShowBill(ref sReturn);                   
+
                     for (int i = 0; i < NumData.Length; i++)
                     {
-                        ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1 and hmainid=" + NumData[i], "h_v_JIT_Sc_WorkBillSortBillList");
-
-                        if (ds.Tables[0].Rows.Count > 0)
+                        if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧")
                         {
-                            if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
-                            {
-                                objJsonResult.code = "0";
-                                objJsonResult.count = 0;
-                                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
-                                objJsonResult.data = null;
-                                return objJsonResult;
-                            }
-
                             oCN.BeginTran();//寮�鍚簨鍔�
 
                             oCN.RunProc($"delete from Sc_WorkBillSortBillSub where HInterID={ NumData[i]}");
@@ -331,6 +325,29 @@
 
                             oCN.Commit();//缁撴潫浜嬪姟
                         }
+                        else
+                        {
+                            ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1 and hmainid=" + NumData[i], "h_v_JIT_Sc_WorkBillSortBillList");
+
+                            if (ds.Tables[0].Rows.Count > 0)
+                            {
+                                if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+                                {
+                                    objJsonResult.code = "0";
+                                    objJsonResult.count = 0;
+                                    objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                                    objJsonResult.data = null;
+                                    return objJsonResult;
+                                }
+
+                                oCN.BeginTran();//寮�鍚簨鍔�
+
+                                oCN.RunProc($"delete from Sc_WorkBillSortBillSub where HInterID={ NumData[i]}");
+                                oCN.RunProc($"delete from Sc_WorkBillSortBillMain where HInterID={ NumData[i]}");
+
+                                oCN.Commit();//缁撴潫浜嬪姟
+                            }
+                        }                        
                     }
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;

--
Gitblit v1.9.1