From ba76af92c90c52823b8140ac3be26fbf69d467bd Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 18 十二月 2024 10:04:10 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   91 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 74 insertions(+), 17 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 33442ff..c416d59 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"
@@ -195,6 +195,10 @@
                 LogService.CustomWriteLog("2:", DateTime.Now.ToString("yyyy-MM-dd"));
                 int TrueCount = 0, SumCount = 0;
                 LogService.CustomWriteLog("list.Count:"+ list.Count, DateTime.Now.ToString("yyyy-MM-dd"));
+
+                string sReturn = "";
+                oSystemParameter.ShowBill(ref sReturn);
+
                 for (int i = 0; i < list.Count; i++)
                 {
                     TrueCount = 0;
@@ -230,17 +234,21 @@
                         var HMainSourceEntryID = list[i]["婧愬崟瀛愬唴鐮�"].ToString();
                         var HPlanQty = list[i]["璁″垝鏁伴噺"].ToString();
                         var HEmpID = list[i]["HEmpID"].ToString();
+                        var HWorkQty = list[i]["灏忔椂浜ц兘"].ToString();
 
                         LogService.CustomWriteLog("2.05:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
 
-                        if (HSourceID == ""|| HSourceID == "0")
+                        if (oSystemParameter.omodel.WMS_CampanyName != "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                         {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
+                            if (HSourceID == "" || HSourceID == "0")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
+                                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");
@@ -264,7 +272,7 @@
                             " HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," +
                             "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," +
                             "HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty" +
-                            ",HICMOInterID,HICMOEntryID,HPlanEndDate,HEmpID)values" +
+                            ",HICMOInterID,HICMOEntryID,HPlanEndDate,HEmpID,HWorkQty)values" +
                             $"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," +
                             $"'{BillType}',GETDATE(),1,'{user}',getdate(),'{HICMOBillNo}','{HOrderType}'," +
                             $"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HProdORGID == "" ? 0.ToString() : HProdORGID)}," +
@@ -272,7 +280,7 @@
                             $" 0, {(HSplitQty == "" ? 0.ToString() : HSplitQty)}, {(HDayPlanSumQty == "" ? 0.ToString() : HDayPlanSumQty)},'{HPlanBeginDate}'," +
                             $"'{HSeOrderBillNo}','{HICMOBillType}',{(HSourceStockInQty == "" ? 0.ToString() : HSourceStockInQty)},{(HLeftPlanQty == "" ? 0.ToString() : HLeftPlanQty)},'{HOrderLev}',getdate()," +
                             $"{HMainSourceInterID},{HMainSourceEntryID},{HMainSourceInterID},{HMainSourceEntryID},{HPlanQty}," +
-                            $"{HMainSourceInterID},{HMainSourceEntryID},'{HPlanEndDate}','{HEmpID}')";
+                            $"{HMainSourceInterID},{HMainSourceEntryID},'{HPlanEndDate}','{HEmpID}','{HWorkQty}')";
 
                         //LogService.Write("sql:" + sql);
                         //涓昏〃
@@ -300,15 +308,19 @@
                         var HSplitQty = list[i]["鎷嗗崟鏁伴噺"].ToString();
 
                         LogService.CustomWriteLog("2.1:"+i, DateTime.Now.ToString("yyyy-MM-dd"));
-
-                        if (HSourceID == "" || HSourceID == "0")
+                        
+                        if (oSystemParameter.omodel.WMS_CampanyName != "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                         {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
+                            if (HSourceID == "" || HSourceID == "0")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
                         }
+
                         var str = 0;
                         if (!int.TryParse(HYX, out str))
                         {
@@ -431,7 +443,7 @@
                 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 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())).ToString()=="闈炴暟瀛�" ? 0 : dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())) })");               
+                            $" '{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())) })");               
             }
 
             objJsonResult.code = "1";
@@ -2825,5 +2837,50 @@
             }
         }
         #endregion
+
+        #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鏍规嵁杞﹂棿娣诲姞鏈帓浜х敓浜ц鍗�
+        [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillListByDept")]
+        [HttpGet]
+        public object JIT_ICMOBillListByDept(string HDeptID)
+        {
+            try
+            {
+                //鏌ヨ閫夋嫨杞﹂棿涓湭鎺掍骇杩囩殑鐢熶骇璁㈠崟淇℃伅锛堟坊搴风鎶�--鐢熶骇璁㈠崟鐘舵�佷负涓嬭揪锛�
+                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++)
+                    {
+                        ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+                    }
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ユ棤鏁版嵁锛屽綋鍓嶆墍閫夎溅闂翠笅鏆傛棤鏈帓浜т笖璁㈠崟鐘舵�佷负涓嬭揪鐨勭敓浜ц鍗曚俊鎭紒";
+                    objJsonResult.data = "";
+                    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

--
Gitblit v1.9.1