From 19c616c00b49b4785ff429780f8295ceb8171bd5 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 28 八月 2023 10:04:03 +0800
Subject: [PATCH] 异常反馈单 列表

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |  134 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 122 insertions(+), 12 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 bce88e6..2a7ef44 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"
@@ -8,6 +8,7 @@
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using System.Diagnostics;
+using System.Threading;
 
 namespace WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�
 {
@@ -42,7 +43,8 @@
                 omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere);
 
                 ds = oCN.RunProcReturn($"exec h_p_JIT_Sc_WorkBillSortBill_Query '{omdelMian.HPlanBeginDate}',{(omdelMian.HProdORGID == null ? 0 : omdelMian.HProdORGID)},'{omdelMian.HSeOrderBillNo}'" +
-                    $",'{omdelMian.HPlanEndDate.AddDays(1)}',{omdelMian.HMaterID},'{omdelMian.HICMOBillNo}',{omdelMian.HWorkShopID}", "h_p_JIT_Sc_WorkBillSortBill_Query");
+                    $",'{omdelMian.HPlanEndDate.AddDays(1)}',{omdelMian.HMaterID},'{omdelMian.HICMOBillNo}',{omdelMian.HWorkShopID}" +
+                    $",'{omdelMian.HMastersDate}','{omdelMian.sWheres}'", "h_p_JIT_Sc_WorkBillSortBill_Query");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -220,14 +222,16 @@
                             " HMaterID, HMaterName, HMaterModel, HUnitID, HSeOrderBillQty," +
                             " HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," +
                             "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," +
-                            "HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty)values" +
+                            "HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty" +
+                            ",HICMOInterID,HICMOEntryID)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)}," +
                             $" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}," +
                             $" 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},{HMainSourceInterID},{HMainSourceEntryID},{HPlanQty}," +
+                            $"{HMainSourceInterID},{HMainSourceEntryID})";
 
                         //LogService.Write("sql:" + sql);
                         //涓昏〃
@@ -241,6 +245,13 @@
                         var HICMOEntrySEQ = list[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
                         var HSourceID = list[i]["HSourceID"].ToString();
                         var HYX = list[i]["浼樺厛绾�"].ToString();
+                        var HWorkQty = list[i]["灏忔椂浜ц兘"].ToString();
+                        var HProdTimes = list[i]["鐢熶骇鍛ㄦ湡"].ToString();
+                        var HReadyTimes = list[i]["寮�宸ヤ綑閲�"].ToString();
+                        var HLastBeginDate = list[i]["鏈�杩熷紑宸ユ棩鏈�"].ToString();
+                        var HLastEndDate = list[i]["鏈�杩熷畬宸ユ棩鏈�"].ToString();
+                        var HOrderNeedQty = list[i]["璁㈠崟闇�姹傛暟閲�"].ToString();
+                        var HOrderCommitDate = list[i]["璁㈠崟浜よ揣鏈�"].ToString();
 
                         if (HSourceID == "" || HSourceID == "0")
                         {
@@ -272,7 +283,10 @@
                             return objJsonResult;
                         }
 
-                        oCN.RunProc($"update Sc_WorkBillSortBillMain set HSourceID={(HSourceID == "" ? 0.ToString() : HSourceID)},HYX={HYX} where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'");
+                        oCN.RunProc($"update Sc_WorkBillSortBillMain set HSourceID={(HSourceID == "" ? 0.ToString() : HSourceID)},HYX={HYX}" +
+                            $",HWorkQty={HWorkQty},HProdTimes={HProdTimes},HReadyTimes={HReadyTimes},HLastBeginDate='{HLastBeginDate}'" +
+                            $",HLastEndDate='{HLastEndDate}',HOrderNeedQty={HOrderNeedQty},HOrderCommitDate='{HOrderCommitDate}'" +
+                            $" where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'");
                     }
 
                     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)}'");
@@ -289,8 +303,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)
                             {
                                 TrueCount += 1;
@@ -299,7 +313,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]);
                         }
                     }
                 }
@@ -332,11 +346,10 @@
             }
         }
 
-        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");
-
             int count = 0;
             if (ds.Tables[0].Rows.Count > 0)
             {
@@ -345,7 +358,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"?0: HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString()))}" +
                             $"  where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}");
                         count += 1;
                     }
@@ -356,9 +369,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";
@@ -2586,5 +2599,102 @@
         }
         #endregion
 
+        #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鏁版嵁鍑嗗 璁剧疆浠诲姟鍗曠浉鍏充俊鎭�
+        [Route("JIT_DayPlanPlatFormBill/ReadyData")]
+        [HttpGet]
+        public object ReadyData(string HICOMNum)
+        {
+            try
+            {
+                var list = HICOMNum.Split(',');
+                DataTable dt = new DataTable("date");
+                dt.Columns.Add("HICMOInterID", typeof(string));
+                dt.Columns.Add("HICMOEntryID", typeof(string));
+                dt.Columns.Add("灏忔椂浜ц兘", typeof(string));
+                dt.Columns.Add("鐢熶骇鍛ㄦ湡", typeof(decimal));
+                dt.Columns.Add("寮�宸ヤ綑閲�", typeof(decimal));
+                dt.Columns.Add("鏈�杩熷紑宸ユ棩鏈�", typeof(DateTime));
+                dt.Columns.Add("鏈�杩熷畬宸ユ棩鏈�", typeof(DateTime));
+                dt.Columns.Add("璁㈠崟闇�姹傛暟閲�", typeof(decimal));
+                dt.Columns.Add("璁㈠崟浜よ揣鏈�", typeof(DateTime));
+
+                for (int i = 0; i < list.Length; i++)
+                {
+                    string HICMOInterID = list[i].Split(';')[0].ToString();
+                    string HICMOEntryID = list[i].Split(';')[1].ToString();
+
+                    Thread.Sleep(100);
+                    ds = oCN.RunProcReturn("exec h_p_Sc_GetInfoByICMOBillNo " + HICMOInterID+","+ HICMOEntryID, "h_p_Sc_GetInfoByICMOBillNo");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        
+                    }
+                    else
+                    {
+                        DataRow dr = dt.NewRow();
+                        dr["灏忔椂浜ц兘"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["浜ц兘"]);
+                        dr["鐢熶骇鍛ㄦ湡"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["鐢熶骇鍛ㄦ湡"]);
+                        dr["寮�宸ヤ綑閲�"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["寮�宸ヤ綑閲�"]);
+                        dr["鏈�杩熷紑宸ユ棩鏈�"] = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["鏈�杩熷紑宸ユ棩鏈�"]);
+                        dr["鏈�杩熷畬宸ユ棩鏈�"] = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["鏈�杩熷畬宸ユ棩鏈�"]);
+                        dr["璁㈠崟闇�姹傛暟閲�"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["璁㈠崟闇�姹傛暟"]);
+                        dr["璁㈠崟浜よ揣鏈�"] = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["璁㈠崟浜よ揣鏈�"]);
+                        dr["HICMOInterID"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["HICMOInterID"]);
+                        dr["HICMOEntryID"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["HICMOEntryID"]);
+                        dt.Rows.Add(dr);
+                    }
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = dt;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #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