From 3df114e408bf13f3e804106ba9c0c6b97c84763f Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期五, 21 三月 2025 10:45:08 +0800 Subject: [PATCH] 采购调价单和要料计划项目费用审核工艺路线修改 --- WebAPI/Controllers/SCGL/日计划管理/Sc_JIT_ComplementGoodBillController.cs | 103 +++++++++++++++++++++++++++++++++++---------------- 1 files changed, 71 insertions(+), 32 deletions(-) diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_JIT_ComplementGoodBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_JIT_ComplementGoodBillController.cs" index b6b05a8..3507868 100644 --- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_JIT_ComplementGoodBillController.cs" +++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_JIT_ComplementGoodBillController.cs" @@ -1,4 +1,5 @@ 锘縰sing DBUtility; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -32,6 +33,7 @@ { try { + List<object> a = new List<object>(); //鏌ヨ鏉冮檺 if (!DBUtility.ClsPub.Security_Log_second("JIT_ComplementGoodBill_Query", 1, false, user)) { @@ -43,11 +45,17 @@ } ds = oCN.RunProcReturn("select * from h_v_JIT_Gy_WorkWarehouseBillList where 1=1 " + sWhere + " order by hmainid desc ", "h_v_JIT_Gy_WorkWarehouseBillList"); - + foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢� + { + Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆 + a.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; objJsonResult.data = ds.Tables[0]; + objJsonResult.list = a; return objJsonResult; } catch (Exception e) @@ -292,6 +300,7 @@ { try { + List<object> A = new List<object>(); //鏌ヨ鏉冮檺 if (!DBUtility.ClsPub.Security_Log_second("Cg_PODemandPlanConfigBill_Query", 1, false, user)) { @@ -303,11 +312,18 @@ } ds = oCN.RunProcReturn("select * from h_v_JIT_Cg_PODemandPlanConfigBillList where 1=1 " + sWhere + " order by hmainid desc ", "h_v_JIT_Cg_PODemandPlanConfigBillList"); - + foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢� + { + Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆 + A.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; objJsonResult.data = ds.Tables[0]; + objJsonResult.list = A; + return objJsonResult; } catch (Exception e) @@ -451,7 +467,7 @@ return objJsonResult; } - if (oSystemParameter.omodel.WMS_CampanyName != "甯呭▉") + if (oSystemParameter.omodel.WMS_CampanyName != "甯呭▉"&& oSystemParameter.omodel.WMS_CampanyName != "瀹濆伐") { if (oSub.HLeadTime_Sec == 0 || oSub.HLeadTime_Sec == null) { @@ -608,7 +624,15 @@ { row[j] = ExcelDs.Tables[0].Rows[i][j].ToString(); } - tb2.Rows.Add(row); + //濡傛灉琛ㄦ牸绗琲琛岀殑绗竴鍒椾负绌猴紝鍒欏垽鏂负杩欎竴琛岀殑鏁版嵁涓虹┖锛岃烦鍑哄惊鐜苟涓斾笉鎶婃暟鎹啓鍏� tb2 + if (ExcelDs.Tables[0].Rows[i][0].ToString() == "") + { + continue; + } + else + { + tb2.Rows.Add(row); + } } @@ -846,8 +870,8 @@ } else { - objJsonResult.code = "1"; - objJsonResult.count = 1; + objJsonResult.code = "0"; + objJsonResult.count = 0; objJsonResult.Message = "绗�" + index + "琛�,缁勭粐浠g爜涓虹┖"; objJsonResult.data = null; return objJsonResult; @@ -909,12 +933,10 @@ int i = 1; foreach (Dictionary<string, string> item in list) { - long HInterID = DBUtility.ClsPub.CreateBillID_Prod("4611", ref DBUtility.ClsPub.sExeReturnInfo);//鑾峰緱涓�涓柊鐨刬d - string HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("4611", ref DBUtility.ClsPub.sExeReturnInfo, true);//鑾峰緱涓�涓柊鐨勫崟鎹彿 - string HOrgID = item["HOrgID"].ToString();//缁勭粐ID string HSupID = item["HSupID"].ToString();//渚涘簲鍟� - string HSupplierName = item["渚涘簲鍟�"].ToString(); string HMaterID = item["HMaterID"].ToString();//鐗╂枡ID + string HOrgID = item["HOrgID"].ToString();//缁勭粐ID + string HSupplierName = item["渚涘簲鍟�"].ToString(); string HMaterName = item["鐗╂枡鍚嶇О"].ToString(); string HMaterModel = item["瑙勬牸鍨嬪彿"].ToString(); string HUnitID = item["HUnitID"].ToString();//璁¢噺鍗曚綅 @@ -929,21 +951,33 @@ string JIMLC = item["JIT鏈�灏忚捣閫侀噺"].ToString(); string HRemark = item["澶囨敞"].ToString(); - - string sql = "insert into Cg_PODemandPlanConfigBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HOrgId)" + - $"values({HInterID}, '{HBillNo}',{DateTime.Now.Year}, {DateTime.Now.Month}, '4611', '4611', GETDATE(), 1, '{user}', GETDATE(), {HOrgID})"; - string sql1 = "insert into Cg_PODemandPlanConfigBillSub(HInterID,HEntryID,HRemark,HSupplierID,HSupplierName,HMaterID," + - "HMaterName, HMaterModel, HJITMaterGroup, HJITSafeStock, HJITMaterDemand, HJITBatchQty, HDeliveryPeriod, " + - "HLeadTime, HLeadTime_Sec, HDeliveryMode, HDeliveryDaysCtrl,HUnitID,HJITMinDeliveryQty)values" + - $"({HInterID}, 1, '{HRemark}', {(HSupID == "" ? "0" : HSupID)}, '{HSupplierName}', {(HMaterID == "" ? "0" : HMaterID)}," + - $" '{HMaterName}', '{HMaterModel}', '{JITType}', {(JITPSL == "" ? "0" : JITPSL)}, {(JITMDSC == "" ? "0" : JITMDSC)},{(JIPEB == "" ? "0" : JIPEB)},{(JITPBCC == "" ? "0" : JITPBCC)}," + - $" {(JISLT == "" ? "0" : JISLT)}, {(JIDLT == "" ? "0" : JIDLT)}, '', {(JITDCD == "" ? "0" : JITDCD)} ,{HUnitID},{JIMLC})"; - LogService.Write("sql" + i + ":" + sql); - LogService.Write("sql1" + i + ":" + sql1); - //涓昏〃 - oCN.RunProc(sql); - //瀛愯〃 - oCN.RunProc(sql1); + ds = oCN.RunProcReturn("select * from Cg_PODemandPlanConfigBillSub where HMaterID=" + HMaterID + " and HSupplierID=" + HSupID, "Cg_PODemandPlanConfigBillSub"); + + if (ds.Tables[0].Rows.Count == 0) + { + + long HInterID = DBUtility.ClsPub.CreateBillID_Prod("4611", ref DBUtility.ClsPub.sExeReturnInfo);//鑾峰緱涓�涓柊鐨刬d + string HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("4611", ref DBUtility.ClsPub.sExeReturnInfo, true);//鑾峰緱涓�涓柊鐨勫崟鎹彿 + + + string sql = "insert into Cg_PODemandPlanConfigBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HOrgId)" + + $"values({HInterID}, '{HBillNo}',{DateTime.Now.Year}, {DateTime.Now.Month}, '4611', '4611', GETDATE(), 1, '{user}', GETDATE(), {HOrgID})"; + string sql1 = "insert into Cg_PODemandPlanConfigBillSub(HInterID,HEntryID,HRemark,HSupplierID,HSupplierName,HMaterID," + + "HMaterName, HMaterModel, HJITMaterGroup, HJITSafeStock, HJITMaterDemand, HJITBatchQty, HDeliveryPeriod, " + + "HLeadTime, HLeadTime_Sec, HDeliveryMode, HDeliveryDaysCtrl,HUnitID,HJITMinDeliveryQty)values" + + $"({HInterID}, 1, '{HRemark}', {(HSupID == "" ? "0" : HSupID)}, '{HSupplierName}', {(HMaterID == "" ? "0" : HMaterID)}," + + $" '{HMaterName}', '{HMaterModel}', '{JITType}', {(JITPSL == "" ? "0" : JITPSL)}, {(JITMDSC == "" ? "0" : JITMDSC)},{(JIPEB == "" ? "0" : JIPEB)},{(JITPBCC == "" ? "0" : JITPBCC)}," + + $" {(JISLT == "" ? "0" : JISLT)}, {(JIDLT == "" ? "0" : JIDLT)}, '', {(JITDCD == "" ? "0" : JITDCD)} ,{HUnitID},{JIMLC})"; + //涓昏〃 + oCN.RunProc(sql); + //瀛愯〃 + oCN.RunProc(sql1); + } + else + { + oCN.RunProc(" update Cg_PODemandPlanConfigBillSub set HLeadTime=" + JISLT + " where HMaterID=" + HMaterID + " and HSupplierID=" + HSupID); + } + i++; } @@ -1108,8 +1142,9 @@ public json AddNeedBillSub(string msg3) { + string Ret = ""; omodelNeedsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JIT_NeedMaterPlanConfigBillSub>>(msg3); - + oSystemParameter.ShowBill(ref Ret); foreach (Models.JIT_NeedMaterPlanConfigBillSub oSub in omodelNeedsub) { if (oSub.HWorkShopID == 0 || oSub.HWorkShopID == null) @@ -1144,14 +1179,18 @@ objJsonResult.data = null; return objJsonResult; } - if (oSub.HDeliveryDaysCtrl == 0 || oSub.HDeliveryDaysCtrl == null) + if (oSystemParameter.omodel.WMS_CampanyName != "瀹濆伐") { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = " JIT閫佽揣鎺у埗澶╂暟涓嶈兘涓虹┖"; - objJsonResult.data = null; - return objJsonResult; + if (oSub.HDeliveryDaysCtrl == 0 || oSub.HDeliveryDaysCtrl == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = " JIT閫佽揣鎺у埗澶╂暟涓嶈兘涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } } + } //鍒犻櫎瀛愯〃 -- Gitblit v1.9.1