From 9b4915b7b3669ffe80774740bd06c547ece49494 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 31 三月 2025 12:47:27 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |  113 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 97 insertions(+), 16 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 cd518ae..a704b66 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"
@@ -580,35 +580,64 @@
         }
 
         public json AddBillSub(string HInterID, string HBillNo, DateTime date, double HQTY, Dictionary<string, string> dic)
-        {         
+        {
+            string sReturn = "";
+            oSystemParameter.ShowBill(ref sReturn);
+
             //鑾峰彇琛ㄦ牸鏁版嵁
             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)
             {
-                //鍒ゆ柇瀛愯〃鏄惁鏈夊綋鏃ョ殑鏃ユ湡浠ュ強鏃ユ湡鎵�瀵瑰簲鐨勬暟閲�
-                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                 {
-                    if (DateTime.Parse(ds.Tables[0].Rows[i]["鏃ヨ鍒掔敓浜ф棩鏈�"].ToString()) == date)
+                    //鍒ゆ柇瀛愯〃鏄惁鏈夊綋鏃ョ殑鏃ユ湡浠ュ強鏃ユ湡鎵�瀵瑰簲鐨勬暟閲�
+                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                     {
-                        oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY},HUseTimes={(dic["灏忔椂浜ц兘"]=="0"?0: HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString()))}" +
-                            $"  where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}");
-                        count += 1;
+                        if (DateTime.Parse(ds.Tables[0].Rows[i]["鏃ヨ鍒掔敓浜ф棩鏈�"].ToString()) == date)
+                        {
+                            oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY},HUseTimes={(dic["浜х嚎鎬讳骇鑳�"] == "0" ? 0 : HQTY / float.Parse(dic["浜х嚎鎬讳骇鑳�"].ToString()))}" +
+                                $"  where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}");
+                            count += 1;
+                        }
                     }
                 }
+                else
+                {
+                    //鍒ゆ柇瀛愯〃鏄惁鏈夊綋鏃ョ殑鏃ユ湡浠ュ強鏃ユ湡鎵�瀵瑰簲鐨勬暟閲�
+                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                    {
+                        if (DateTime.Parse(ds.Tables[0].Rows[i]["鏃ヨ鍒掔敓浜ф棩鏈�"].ToString()) == date)
+                        {
+                            oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY},HUseTimes={(dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString()))}" +
+                                $"  where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}");
+                            count += 1;
+                        }
+                    }
+                }               
             }
            
             if (count != 1)
             {
-                //鎻掑叆瀛愯〃
-                oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," +
-                    "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())) })");               
+                if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                    //鎻掑叆瀛愯〃
+                    oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," +
+                        "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())) })");
+                }
+                else
+                {
+                    //鎻掑叆瀛愯〃
+                    oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," +
+                        "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 == "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
             {
                 //鎶婃帓浜ц鍗曞畬宸ユ棩鏈熷弽鍐欏埌閲戣澏閿�鍞鍗曚笂
@@ -1775,6 +1804,7 @@
                 string fProWorkShopId = omdelMian.HWorkShopID.ToString();
                 var fPrdOrgId = omdelMian.HProdORGID;
                 string sqlName = "";//AIS20210811135644
+                string WMS_CampanyName = "";    //瀹㈡埛鍚嶇О
                 //瀹㈡埛鍒跺畾
                 string sErr = "";
                 if (oSystemParameter.ShowBill(ref sErr))
@@ -1794,6 +1824,7 @@
                     else if (oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐")
                     {
                         sqlName = "AIS20250102123554";
+                        WMS_CampanyName = "瀹濆伐";
                     }
                     else
                     {
@@ -1801,8 +1832,11 @@
                     }
                 }
 
-
-                if (HTLType == "缂烘枡")
+                if (WMS_CampanyName == "瀹濆伐")
+                {
+                    objJsonResult = (json)JIT_MOMaterLack(fProWorkShopId, fPrdOrgId, user, sqlName);
+                }
+                else if (HTLType == "缂烘枡")
                 {
                     objJsonResult = (json)JIT_QL(fProWorkShopId, fPrdOrgId, user, sqlName);
                 }
@@ -2733,6 +2767,51 @@
                 return objJsonResult;
             }
         }
+
+        /// <summary>
+        /// 閫氳繃娆犳枡琛�   绠楁彁鏂� 瀹濆伐
+        /// </summary>
+        /// <returns></returns>
+        public object JIT_MOMaterLack(string HWorkShopID, int? HProdORGID, string user, string sqlName)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_JIT_PODemandPlanBill_MOMaterLack " + HWorkShopID.ToString() + ",'" + user + "'," + HProdORGID.ToString(), "h_p_JIT_PODemandPlanBill_MOMaterLack");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎻愭枡杩愮畻鍙戠敓閿欒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);    //杩愮畻鎴愬姛
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎻愭枡杩愮畻澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
         #endregion
 
         #region 鐢熶骇鏃ヨ鍒掑钩鍙� 閿佸畾
@@ -3376,5 +3455,7 @@
         }
         #endregion
 
+        
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1