From 01437b53f9b7ef99bb614b6f3df94351ab03acc0 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期五, 20 五月 2022 15:24:47 +0800 Subject: [PATCH] 功能完善 --- WebAPI/Controllers/SCGL/日计划管理/Sc_JIT_ComplementGoodBillController.cs | 189 ++++++++++++++++++++++++++++++++----- WebAPI/Controllers/SCGL/日计划管理/Sc_WorkDemandPlanBillController.cs | 30 ++--- WebAPI/Controllers/SCGL/日计划管理/Sc_WorkBillSortBillController.cs | 24 ++-- WebAPI/Controllers/SCGL/日计划管理/JIT_Cg_PODemandPlanBillController.cs | 28 ++--- 4 files changed, 199 insertions(+), 72 deletions(-) diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_Cg_PODemandPlanBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_Cg_PODemandPlanBillController.cs" index a5c7176..a117d1f 100644 --- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_Cg_PODemandPlanBillController.cs" +++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_Cg_PODemandPlanBillController.cs" @@ -86,10 +86,8 @@ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); - - int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d - int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 - string user = sArray[4].ToString(); + int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); try { if (!DBUtility.ClsPub.Security_Log("Cg_PODemandPlanBill_Edit", 1, false, user)) @@ -103,7 +101,11 @@ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<JIT_Cg_PODemandPlanBillMain>(msg2); string BillType = "4608"; - + ds = ds = oCN.RunProcReturn($"select * from h_v_JIT_Cg_PODemandPlanBillList where hmainid={omdelMian.HInterID} and 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Cg_PODemandPlanBillList"); + if (ds.Tables[0].Rows.Count > 0) + { + OperationType = 3; + } if (OperationType == 1)//鏂板 { @@ -126,7 +128,7 @@ $",HRemark='{omdelMian.HRemark}',HExplanation='{omdelMian.HExplanation}' where HInterID={omdelMian.HInterID}"); } //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub(msg3, hentryid); + objJsonResult = AddBillSub(msg3); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -152,16 +154,10 @@ } } - public json AddBillSub(string msg3, int hentryid) + public json AddBillSub(string msg3) { - if (hentryid != -1) - { - //鑾峰彇琛ㄦ牸鏁版嵁 - ds = oCN.RunProcReturn($"select * from h_v_JIT_Cg_PODemandPlanBillList where 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Cg_PODemandPlanBillList"); - //鍒犻櫎瀛愯〃 - oCN.RunProc("delete from JIT_Cg_PODemandPlanBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); - } - + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from JIT_Cg_PODemandPlanBillSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JIT_Cg_PODemandPlanBillSub>>(msg3); int i = 1; @@ -177,7 +173,7 @@ ", HCloseMan, HEntryCloseDate, HSendQty, HReciveQty, HCloseStatus" + ", HRemoveQty, HSeOrderBillNo, HUnReciveQty, HPOOrderBillDate, HPOOrderBillDeliveryDate" + ", HPOOrderBillRemark, HPOOrderBillNote)" + - $"values({omdelMian.HInterID}, {(hentryid == -1 ? i : omodelsub.Count == 1 ? hentryid : i == 1 ? hentryid : (i + ds.Tables[0].Rows.Count - 1))}, '{oSub.HLaterReason}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}, '{oSub.HMaterName}'" + + $"values({omdelMian.HInterID}, {i}, '{oSub.HLaterReason}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}, '{oSub.HMaterName}'" + $", '{oSub.HMaterModel}', {(oSub.HUnitID == null ? 0 : oSub.HUnitID)}, '{oSub.HErpClsID}', {(oSub.HQty == null ? 0 : oSub.HQty)}, '{oSub.HRemark}'" + $", {(oSub.HPURCHASEORGID == null ? 0 : oSub.HPURCHASEORGID)}, '{oSub.HStatus}', {(oSub.HFixleadTime == null ? 0 : oSub.HFixleadTime)}, '{oSub.HDayPlanBillNo}', {oSub.HSourceInterID}" + $", {oSub.HSourceEntryID}, '{oSub.HSourceBillNo}', '{oSub.HSourceBillType}', {(oSub.HWorkShopID == null ? 0 : oSub.HWorkShopID)}, '{oSub.HDayPlanDate}'" + 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 3a9d87e..1ae15f5 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" @@ -91,9 +91,8 @@ string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); - int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d - int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 - string user = sArray[4].ToString(); + int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); try { if (!DBUtility.ClsPub.Security_Log("JIT_ComplementGoodBill_Edit", 1, false, user)) @@ -106,8 +105,23 @@ } omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2); + + if (omdelMian.HPRDORGID.ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "缁勭粐涓嶈兘涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + string BillType = "4612"; + ds = ds = oCN.RunProcReturn($"select * from h_v_JIT_Gy_WorkWarehouseBillList where hmainid={omdelMian.HInterID} and 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Gy_WorkWarehouseBillList"); + if (ds.Tables[0].Rows.Count > 0) + { + OperationType = 3; + } if (OperationType == 1)//鏂板 { @@ -123,12 +137,9 @@ ",HUpDater='" + omdelMian.HMaker + "'" + ",HUpDateDate='" + DateTime.Now+ "'" + " where HInterID=" + omdelMian.HInterID.ToString()); - - //鍒犻櫎瀛愯〃 - oCN.RunProc("delete from Gy_WorkWarehouseBillMainSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); } //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub(msg3, hentryid); + objJsonResult = AddBillSub(msg3); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -154,9 +165,33 @@ } } - public json AddBillSub(string msg3, int hentryid) + public json AddBillSub(string msg3) { omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_WorkWarehouseBillMainSub>>(msg3); + + foreach (Models.Gy_WorkWarehouseBillMainSub oSub in omodelsub) + { + if (oSub.HWorkShopID == 0 || oSub.HWorkShopID ==null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐢熶骇杞﹂棿涓嶈兘涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + if (oSub.HWHID == 0|| oSub.HWHID == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠撳簱涓嶈兘涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + } + + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from Gy_WorkWarehouseBillMainSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); + int i = 1; //鎻掑叆瀛愯〃 foreach (Models.Gy_WorkWarehouseBillMainSub oSub in omodelsub) @@ -164,7 +199,7 @@ oCN.RunProc("insert into Gy_WorkWarehouseBillMainSub(HInterID,HEntryID,HRemark,HWorkShopID," + "HWorkShopName,HWHID,HWHName) " + "values(" - + omdelMian.HInterID.ToString() + "," + (hentryid == -1 ? i : hentryid) + ",'" + oSub.HRemark + "'," + (oSub.HWorkShopID==null?0:oSub.HWorkShopID) + + omdelMian.HInterID.ToString() + "," + i + ",'" + oSub.HRemark + "'," + (oSub.HWorkShopID==null?0:oSub.HWorkShopID) + ",'" +oSub.HWorkShopName + "'," + (oSub.HWHID==null?0: oSub.HWHID) + ",'" + oSub.HWHName.ToString()+ "') "); i++; } @@ -316,9 +351,8 @@ string msg2 = sArray[0].ToString();//涓昏〃鏁版嵁 string msg3 = sArray[1].ToString();//瀛愯〃鏁版嵁 - int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d - int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 - string user = sArray[4].ToString(); + int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); try { if (!DBUtility.ClsPub.Security_Log("Cg_PODemandPlanConfigBill_Edit", 1, false, user)) @@ -333,6 +367,11 @@ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2); string BillType = "4611"; + ds = ds = oCN.RunProcReturn($"select * from h_v_JIT_Cg_PODemandPlanConfigBillList where hmainid={omdelMian.HInterID} and 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Cg_PODemandPlanConfigBillList"); + if (ds.Tables[0].Rows.Count > 0) + { + OperationType = 3; + } if (OperationType == 1)//鏂板 { @@ -348,12 +387,9 @@ ",HUpDater='" + omdelMian.HMaker + "'" + ",HUpDateDate='" + DateTime.Now + "'" + " where HInterID=" + omdelMian.HInterID.ToString()); - - //鍒犻櫎瀛愯〃 - oCN.RunProc("delete from Cg_PODemandPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); } //淇濆瓨瀛愯〃 - objJsonResult = AddPODBillSub(msg3, hentryid); + objJsonResult = AddPODBillSub(msg3); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -379,9 +415,58 @@ } } - public json AddPODBillSub(string msg3, int hentryid) + public json AddPODBillSub(string msg3) { omodelPODsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Cg_PODemandPlanConfigBillSub>>(msg3); + + foreach (Models.Cg_PODemandPlanConfigBillSub oSub in omodelPODsub) + { + if (oSub.HSupplierID == 0 || oSub.HSupplierID == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "渚涘簲鍟嗕笉鑳戒负绌�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oSub.HMaterID == 0 || oSub.HMaterID == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐗╂枡涓嶈兘涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + if (oSub.HLeadTime == 0 || oSub.HLeadTime == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = " JIT渚涜揣鎻愬墠鏈熶笉鑳戒负绌�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oSub.HLeadTime_Sec == 0 || oSub.HLeadTime_Sec == null) + { + 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; + } + } + + + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from Cg_PODemandPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); + int i = 1; //鎻掑叆瀛愯〃 foreach (Models.Cg_PODemandPlanConfigBillSub oSub in omodelPODsub) @@ -389,7 +474,7 @@ oCN.RunProc("insert into Cg_PODemandPlanConfigBillSub(HInterID,HEntryID,HRemark,HSupplierID,HSupplierName,HMaterID," + "HMaterName, HMaterModel, HJITMaterGroup, HJITSafeStock, HJITMaterDemand, HJITBatchQty, HDeliveryPeriod, " + "HLeadTime, HLeadTime_Sec, HDeliveryMode, HDeliveryDaysCtrl)values" + - $"({omdelMian.HInterID}, {(hentryid == -1 ? i : hentryid) }, '{oSub.HRemark}', {(oSub.HSupplierID==null?0: oSub.HSupplierID)}, '{oSub.HSupplierName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," + + $"({omdelMian.HInterID}, {i}, '{oSub.HRemark}', {(oSub.HSupplierID==null?0: oSub.HSupplierID)}, '{oSub.HSupplierName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," + $" '{oSub.HMaterName}', '{oSub.HMaterModel}', '{oSub.HJITMaterGroup}', {(oSub.HJITSafeStock == null ? 0 : oSub.HJITSafeStock)}, {(oSub.HJITMaterDemand == null ? 0 : oSub.HJITMaterDemand)},{(oSub.HJITBatchQty == null ? 0 : oSub.HJITBatchQty)},{(oSub.HDeliveryPeriod == null ? 0 : oSub.HDeliveryPeriod)}," + $" {(oSub.HLeadTime == null ? 0 : oSub.HLeadTime)}, {(oSub.HLeadTime_Sec == null ? 0 : oSub.HLeadTime_Sec)}, '{oSub.HDeliveryMode}', {(oSub.HDeliveryDaysCtrl == null ? 0 : oSub.HDeliveryDaysCtrl)}) "); i++; @@ -542,9 +627,8 @@ string msg2 = sArray[0].ToString();//涓昏〃鏁版嵁 string msg3 = sArray[1].ToString();//瀛愯〃鏁版嵁 - int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d - int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 - string user = sArray[4].ToString(); + int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); try { if (!DBUtility.ClsPub.Security_Log("JIT_NeedMaterPlanConfigBill_Edit", 1, false, user)) @@ -558,6 +642,12 @@ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2); string BillType = "4615"; + + ds = ds = oCN.RunProcReturn($"select * from h_v_JIT_NeedMaterPlanConfigBillList where hmainid={omdelMian.HInterID} and 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_NeedMaterPlanConfigBillList"); + if (ds.Tables[0].Rows.Count > 0) + { + OperationType = 3; + } if (OperationType == 1)//鏂板 @@ -575,12 +665,9 @@ ",HUpDater='" + omdelMian.HMaker + "'" + ",HUpDateDate='" + DateTime.Now + "'" + " where HInterID=" + omdelMian.HInterID.ToString()); - - //鍒犻櫎瀛愯〃 - oCN.RunProc("delete from JIT_NeedMaterPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); } //淇濆瓨瀛愯〃 - objJsonResult = AddNeedBillSub(msg3, hentryid); + objJsonResult = AddNeedBillSub(msg3); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -606,9 +693,57 @@ } } - public json AddNeedBillSub(string msg3, int hentryid) + public json AddNeedBillSub(string msg3) { omodelNeedsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JIT_NeedMaterPlanConfigBillSub>>(msg3); + + foreach (Models.Cg_PODemandPlanConfigBillSub oSub in omodelPODsub) + { + if (oSub.HSupplierID == 0 || oSub.HSupplierID == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "渚涘簲鍟嗕笉鑳戒负绌�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oSub.HMaterID == 0 || oSub.HMaterID == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐗╂枡涓嶈兘涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + if (oSub.HLeadTime == 0 || oSub.HLeadTime == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = " JIT渚涜揣鎻愬墠鏈熶笉鑳戒负绌�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oSub.HLeadTime_Sec == 0 || oSub.HLeadTime_Sec == null) + { + 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; + } + } + + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from JIT_NeedMaterPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); + int i = 1; //鎻掑叆瀛愯〃 foreach (Models.JIT_NeedMaterPlanConfigBillSub oSub in omodelNeedsub) @@ -616,7 +751,7 @@ oCN.RunProc("insert into JIT_NeedMaterPlanConfigBillSub(HInterID,HEntryID,HRemark,HWorkShopID,HWorkShopName,HMaterID," + "HMaterName, HMaterModel, HJITMaterGroup, HJITSafeStock, HJITMaterDemand, HJITBatchQty, HDeliveryPeriod, " + "HLeadTime, HLeadTime_Sec, HDeliveryMode, HDeliveryDaysCtrl)values" + - $"({omdelMian.HInterID}, {(hentryid == -1 ? i : hentryid) }, '{oSub.HRemark}', {(oSub.HWorkShopID == null ? 0 : oSub.HWorkShopID)}, '{oSub.HWorkShopName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," + + $"({omdelMian.HInterID}, {i}, '{oSub.HRemark}', {(oSub.HWorkShopID == null ? 0 : oSub.HWorkShopID)}, '{oSub.HWorkShopName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," + $" '{oSub.HMaterName}', '{oSub.HMaterModel}', '{oSub.HJITMaterGroup}', {(oSub.HJITSafeStock == null ? 0 : oSub.HJITSafeStock)}, {(oSub.HJITMaterDemand == null ? 0 : oSub.HJITMaterDemand)},{(oSub.HJITBatchQty == null ? 0 : oSub.HJITBatchQty)},{(oSub.HDeliveryPeriod == null ? 0 : oSub.HDeliveryPeriod)}," + $" {(oSub.HLeadTime == null ? 0 : oSub.HLeadTime)}, {(oSub.HLeadTime_Sec == null ? 0 : oSub.HLeadTime_Sec)}, '{oSub.HDeliveryMode}', {(oSub.HDeliveryDaysCtrl == null ? 0 : oSub.HDeliveryDaysCtrl)}) "); i++; diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs" index 6d480b1..a178ff1 100644 --- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs" +++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs" @@ -35,7 +35,7 @@ return objJsonResult; } - ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_JIT_Sc_WorkBillSortBillList"); + ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1" + sWhere + "order by 鍗曟嵁鍙� desc ", "h_v_JIT_Sc_WorkBillSortBillList"); objJsonResult.code = "1"; objJsonResult.count = 1; @@ -87,9 +87,8 @@ string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); - int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d - int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 - string user = sArray[4].ToString(); + int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); try { if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user)) @@ -103,7 +102,11 @@ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(msg2); string BillType = "4610"; - + ds = ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where hmainid={omdelMian.HInterID} and 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList"); + if (ds.Tables[0].Rows.Count > 0) + { + OperationType = 3; + } if (OperationType == 1)//鏂板 { @@ -168,7 +171,7 @@ $", HHangUp='{(omdelMian.HHangUp == true ? 1 : 0)}' where HInterID={omdelMian.HInterID}"); } //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub(msg3, hentryid); + objJsonResult = AddBillSub(msg3); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -194,13 +197,10 @@ } } - public json AddBillSub(string msg3, int hentryid) + public json AddBillSub(string msg3) { - //鑾峰彇琛ㄦ牸鏁版嵁 - ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList"); - //鍒犻櫎瀛愯〃 - oCN.RunProc("delete from Sc_WorkBillSortBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); + oCN.RunProc("delete from Sc_WorkBillSortBillSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_WorkBillSortBillSub>>(msg3); int i = 1; @@ -211,7 +211,7 @@ ", HRptFinishQty, HTimes, HUseTimes, HBTimes, HETimes" + ", HDateSub, HCloseMan, HEntryCloseDate, HCloseTypeSub, HColumn" + ", HLockedSub, HComplete, HStatusTag, HIsHandModify)" + - $"values({omdelMian.HInterID}, {(hentryid == -1 ? i : omodelsub.Count==1? hentryid:i==1? hentryid:(i+ds.Tables[0].Rows.Count-1))}, '{oSub.HRemark}', '{oSub.HMasterDate}', {(oSub.HQty == null ? 0: oSub.HQty)}" + + $"values({omdelMian.HInterID}, {i}, '{oSub.HRemark}', '{oSub.HMasterDate}', {(oSub.HQty == null ? 0: oSub.HQty)}" + $", {(oSub.HRptFinishQty == null ? 0: oSub.HRptFinishQty)}, {(oSub.HTimes == null ? 0: oSub.HTimes)}, {(oSub.HUseTimes == null ? 0: oSub.HUseTimes)}, '{oSub.HBTimes}', '{oSub.HETimes}'" + $", '{oSub.HDateSub}', '{oSub.HCloseMan}', '{oSub.HEntryCloseDate}', {(oSub.HCloseTypeSub == true ? 1 : 0)}, '{oSub.HColumn}'" + $", '{(oSub.HLockedSub == true ? 1 : 0)}', '{oSub.HComplete}', '{(oSub.HStatusTag == true ? 1 : 0)}', '{(oSub.HIsHandModify == true ? 1 : 0)}')"); diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkDemandPlanBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkDemandPlanBillController.cs" index fce0d98..d9e3f4f 100644 --- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkDemandPlanBillController.cs" +++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkDemandPlanBillController.cs" @@ -87,10 +87,8 @@ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); - - int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d - int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 - string user = sArray[4].ToString(); + int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); try { if (!DBUtility.ClsPub.Security_Log("Cg_PODemandPlanBill_Edit", 1, false, user)) @@ -104,7 +102,11 @@ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<Sc_WorkDemandPlanBillMain>(msg2); string BillType = "4609"; - + ds = ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkDemandPlanBillList where hmainid={omdelMian.HInterID} and 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Sc_WorkDemandPlanBillList"); + if (ds.Tables[0].Rows.Count > 0) + { + OperationType = 3; + } if (OperationType == 1)//鏂板 { @@ -127,7 +129,7 @@ $" where HInterID={omdelMian.HInterID}"); } //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub(msg3, hentryid); + objJsonResult = AddBillSub(msg3); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -153,16 +155,10 @@ } } - public json AddBillSub(string msg3, int hentryid) + public json AddBillSub(string msg3) { - if (hentryid != -1) - { - //鑾峰彇琛ㄦ牸鏁版嵁 - ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkDemandPlanBillList where 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Sc_WorkDemandPlanBillList"); - //鍒犻櫎瀛愯〃 - oCN.RunProc("delete from Sc_WorkDemandPlanBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); - } - + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from Sc_WorkDemandPlanBillSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_WorkDemandPlanBillSub>>(msg3); int i = 1; @@ -177,7 +173,7 @@ ", HEntryCloseDate, HCloseTypeSub, HReciveQty, HCloseStatus, HRemoveQty" + ", HSeOrderBillNo, HUnReciveQty, HICMOBillDate, HICMOBillDeliveryDate, HICMOBillRemark" + ", HICMOBillNote,HICMOEmpID)" + - $"values({omdelMian.HInterID}, '{(hentryid == -1 ? i : omodelsub.Count == 1 ? hentryid : i == 1 ? hentryid : (i + ds.Tables[0].Rows.Count - 1))}', '{oSub.HLaterReason}', {(oSub.HMaterID==null?0: oSub.HMaterID)}, '{oSub.HMaterName}'" + + $"values({omdelMian.HInterID},'{i}','{oSub.HLaterReason}', {(oSub.HMaterID==null?0: oSub.HMaterID)}, '{oSub.HMaterName}'" + $", '{oSub.HMaterModel}',{(oSub.HUnitID == null ? 0: oSub.HUnitID)}, '{oSub.HErpClsID}',{(oSub.HQty == null ? 0: oSub.HQty)}, '{oSub.HRemark}'" + $",{(oSub.HProdORGID == null ? 0: oSub.HProdORGID)}, '{oSub.HStatus}',{(oSub.HFixleadTime == null ? 0: oSub.HFixleadTime)},{oSub.HSourceInterID}" + $",{oSub.HSourceEntryID}, '{oSub.HSourceBillNo}', '{oSub.HSourceBillType}','{oSub.HDayPlanDate}'" + @@ -262,7 +258,7 @@ } #endregion - #region 鎻愭枡璁″垝鍗� 鍏抽棴 + #region 瑕佹枡璁″垝鍗� 鍏抽棴 [Route("Sc_WorkDemandPlanBill/CloseWorkDemandPlanBillList")] [HttpGet] public object CloseWorkDemandPlanBillList(string HInterID, string User) -- Gitblit v1.9.1