From b7f9458b0ec768c1bef45f83c1926031e2cc5cae Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 16 一月 2024 10:04:42 +0800
Subject: [PATCH] 采购入库单收料通知单,保存前反写关联数量的存储过程

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   76 +++++++++++++++++++++++++++++++++----
 1 files changed, 67 insertions(+), 9 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 284343d..914e073 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"
@@ -160,7 +160,7 @@
 
                 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"));
                 for (int i = 0; i < list.Count; i++)
                 {
                     TrueCount = 0;
@@ -204,7 +204,7 @@
                             return objJsonResult;
                         }
 
-                        ds = oCN.RunProcReturn($"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+                        ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
                             $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
                         if (ds.Tables[0].Rows.Count > 0)
                         {
@@ -283,6 +283,9 @@
 
                         if (ds.Tables[0].Rows.Count > 1)
                         {
+                            LogService.CustomWriteLog("绗�" + i + 1 + "琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�", DateTime.Now.ToString("yyyy-MM-dd"));
+                            LogService.CustomWriteLog($"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+                              $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", DateTime.Now.ToString("yyyy-MM-dd"));
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
                             objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!";
@@ -310,7 +313,7 @@
                             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())
+                                 , Math.Round(double.Parse(list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString()),1)
                                  , list[i]);
                             if (objJsonResult.count == 1)
                             {
@@ -334,9 +337,7 @@
                         return objJsonResult;
                     }
                 }
-
              
-
                 //鍚屾鏃ヨ鍒掑伐鍗�
                 oCN.RunProc("exec REALESE_SC_ICMOBILLSTATUS_TMP");
 
@@ -356,8 +357,8 @@
             }
         }
 
-        public json AddBillSub(string HInterID, string HBillNo, DateTime date, int HQTY, Dictionary<string, string> dic)
-        {
+        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");
             int count = 0;
@@ -374,14 +375,14 @@
                     }
                 }
             }
-
+           
             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" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString()))})");
+                            $" '{date}', {HQTY},{(dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString()))})");               
             }
 
             objJsonResult.code = "1";
@@ -2713,5 +2714,62 @@
         }
         #endregion
 
+        #region 鏍规嵁鐗╂枡ID鑾峰彇宸ヨ壓璺嚎 鍒楄〃
+        [Route("JIT_DayPlanPlatFormBill/GetRoutingListByMater")]
+        [HttpGet]
+        public object GetRoutingListByMater(int HMaterID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                int IsHavingPermissions = 1;
+
+                //鍒ゆ柇鏄惁鏈夊伐鑹鸿矾绾跨紪杈戞潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Edit", 1, false, user))
+                {
+                    IsHavingPermissions = 0;
+                }
+
+                ds = oCN.RunProcReturn("select * from  h_v_JIT_GetRoutingList_Mater where HMaterID = " + HMaterID , "h_v_JIT_GetRoutingList_Mater");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "褰撳墠鐗╂枡娌℃湁缁存姢宸ヨ壓璺嚎锛佽鑱旂郴璁″垝閮ㄨ繘琛岀淮鎶�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.IsHavingPermissions = IsHavingPermissions;
+                    return objJsonResult;
+                }
+                else
+                {
+                    //娣诲姞鍒楀悕
+                    foreach (DataColumn col in ds.Tables[0].Columns)
+                    {
+                        Type dataType = col.DataType;
+                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                    }
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    objJsonResult.IsHavingPermissions = IsHavingPermissions;
+                    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