From b8940573cf1d9bb5b3ddaca6aed87cc953c6bc43 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 14 八月 2023 08:54:30 +0800
Subject: [PATCH] 日计划报表优化

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   47 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 41 insertions(+), 6 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 231d35d..a13a382 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"
@@ -304,7 +304,8 @@
                             objJsonResult = AddBillSub(HInterID == 0 ? list[i]["hmainid"].ToString() : HInterID.ToString()
                                 , HBillNo == "" ? list[i]["鍗曟嵁鍙�"].ToString() : HBillNo
                                  , DateTime.Parse(DateTime.Now.AddDays(j).ToString("yyyy-MM-dd").ToString())
-                                 , int.Parse(list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString()));
+                                 , int.Parse(list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString())
+                                 , list[i]);
 
                             if (objJsonResult.count == 1)
                             {
@@ -314,7 +315,7 @@
                         //涓昏〃鏈夋暟鎹� 瀛愯〃鏃犳暟鎹�
                         if (j == 30 && SumCount == 0 && HInterID != 0 && HBillNo != "")
                         {
-                            objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0);
+                            objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0, list[i]);
                         }
                     }
                 }
@@ -347,7 +348,7 @@
             }
         }
 
-        public json AddBillSub(string HInterID, string HBillNo, DateTime date, int HQTY)
+        public json AddBillSub(string HInterID, string HBillNo, DateTime date, int HQTY, Dictionary<string, string> dic)
         {
             //鑾峰彇琛ㄦ牸鏁版嵁
             ds = oCN.RunProcReturn($"select * from  h_v_JIT_Sc_WorkBillSortBillList where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList");
@@ -360,7 +361,7 @@
                 {
                     if (DateTime.Parse(ds.Tables[0].Rows[i]["鏃ヨ鍒掔敓浜ф棩鏈�"].ToString()) == date)
                     {
-                        oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY}" +
+                        oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY},HUseTimes={(dic["灏忔椂浜ц兘"]==""?0: HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString()))}" +
                             $"  where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}");
                         count += 1;
                     }
@@ -371,9 +372,9 @@
             {
                 //鎻掑叆瀛愯〃
                 oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," +
-                    "HMasterDate,HQty)" +
+                    "HMasterDate,HQty,HUseTimes)" +
                             $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," +
-                            $" '{date}', {HQTY})");
+                            $" '{date}', {HQTY},{(dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString()))})");
             }
 
             objJsonResult.code = "1";
@@ -2664,5 +2665,39 @@
         }
         #endregion
 
+        #region  缂烘枡鍒嗘瀽鎶ヨ〃
+        public class MaterialShorAnalysis
+        {
+            public int? HORGID;
+            public DateTime HBEGINDATE;
+            public DateTime HENDDATE;
+        }
+        [Route("JIT_DayPlanPlatFormBill/MaterialShorAnalysisReport")]
+        [HttpGet]
+        public object MaterialShorAnalysisReport(string sWhere)
+        {
+            try
+            {
+                MaterialShorAnalysis Report = JsonConvert.DeserializeObject<MaterialShorAnalysis>(sWhere);
+
+                ds = oCN.RunProcReturn($"exec h_p_JIT_MaterialShorAnalysisReportList {Report.HORGID},'{Report.HBEGINDATE}','{Report.HENDDATE}' ", "h_p_JIT_PODemandPlanBill_ReportList");
+
+                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
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1