From 0453b4eb54d41323068d568f41dff9e75ee2c075 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期二, 08 四月 2025 11:21:15 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs | 254 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 222 insertions(+), 32 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 1d7cd1a..f503793 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" @@ -580,35 +580,64 @@ } public json AddBillSub(string HInterID, string HBillNo, DateTime date, double HQTY, Dictionary<string, string> dic) - { + { + string sReturn = ""; + oSystemParameter.ShowBill(ref sReturn); + //鑾峰彇琛ㄦ牸鏁版嵁 ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBill_PC where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBill_PC"); int count = 0; if (ds.Tables[0].Rows.Count > 0) { - //鍒ゆ柇瀛愯〃鏄惁鏈夊綋鏃ョ殑鏃ユ湡浠ュ強鏃ユ湡鎵�瀵瑰簲鐨勬暟閲� - for (int i = 0; i < ds.Tables[0].Rows.Count; i++) + if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 { - if (DateTime.Parse(ds.Tables[0].Rows[i]["鏃ヨ鍒掔敓浜ф棩鏈�"].ToString()) == date) + //鍒ゆ柇瀛愯〃鏄惁鏈夊綋鏃ョ殑鏃ユ湡浠ュ強鏃ユ湡鎵�瀵瑰簲鐨勬暟閲� + for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { - 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; + if (DateTime.Parse(ds.Tables[0].Rows[i]["鏃ヨ鍒掔敓浜ф棩鏈�"].ToString()) == date) + { + 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; + } } } + else + { + //鍒ゆ柇瀛愯〃鏄惁鏈夊綋鏃ョ殑鏃ユ湡浠ュ強鏃ユ湡鎵�瀵瑰簲鐨勬暟閲� + for (int i = 0; i < ds.Tables[0].Rows.Count; i++) + { + if (DateTime.Parse(ds.Tables[0].Rows[i]["鏃ヨ鍒掔敓浜ф棩鏈�"].ToString()) == date) + { + 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; + } + } + } } 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.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())).ToString() == "闈炴暟瀛�" ? 0 : dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())) })"); + if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //鎻掑叆瀛愯〃 + oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," + + "HMasterDate,HQty,HUseTimes)" + + $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," + + $" '{date}', {HQTY},{ ((dic["浜х嚎鎬讳骇鑳�"] == "0.0000" ? 0 : dic["浜х嚎鎬讳骇鑳�"] == "0" ? 0 : HQTY / float.Parse(dic["浜х嚎鎬讳骇鑳�"].ToString())).ToString() == "闈炴暟瀛�" ? 0 : dic["浜х嚎鎬讳骇鑳�"] == "0.0000" ? 0 : dic["浜х嚎鎬讳骇鑳�"] == "0" ? 0 : HQTY / float.Parse(dic["浜х嚎鎬讳骇鑳�"].ToString())) })"); + } + else + { + //鎻掑叆瀛愯〃 + oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," + + "HMasterDate,HQty,HUseTimes)" + + $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," + + $" '{date}', {HQTY},{ ((dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())).ToString() == "闈炴暟瀛�" ? 0 : dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())) })"); + } } - string sReturn = ""; - oSystemParameter.ShowBill(ref sReturn); + if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 { //鎶婃帓浜ц鍗曞畬宸ユ棩鏈熷弽鍐欏埌閲戣澏閿�鍞鍗曚笂 @@ -961,9 +990,9 @@ } #endregion - [Route("JIT_DayPlanPlatFormBill/JIT_CompleteSetAnalysis")] - [HttpGet] - public object JIT_CompleteSetAnalysis(string sWhere, string user) + #region 榻愬鍒嗘瀽 鍘熻皟鐢ㄦ柟娉� + + public object JIT_CompleteSetAnalysis_Old(string sWhere, string user) { try { @@ -1410,6 +1439,103 @@ return objJsonResult; } } + + #endregion + + #region 榻愬鍒嗘瀽璋冪敤鏂规硶 20250402 + + [Route("JIT_DayPlanPlatFormBill/JIT_CompleteSetAnalysis")] + [HttpGet] + public object JIT_CompleteSetAnalysis(string sWhere, string user) + { + try + { + string sErrMsg = ""; + if (oSystemParameter.ShowBill(ref sErrMsg) == true) + { + if (oSystemParameter.omodel.WMS_CampanyName == "甯呭▉" + || oSystemParameter.omodel.WMS_CampanyName == "鍑礉濂堢壒" + || oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧" + || oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + objJsonResult = (json)JIT_CompleteSetAnalysis_Old(sWhere, user); + } + else + { + objJsonResult = (json)JIT_CompleteSetAnalysis_New(sWhere, user); + } + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + LogService.Write("榻愬鍒嗘瀽鎿嶄綔澶辫触锛�" + e.Message.ToString()); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 榻愬鍒嗘瀽 鏂拌皟鐢ㄦ柟娉� + /// </summary> + /// <returns></returns> + public object JIT_CompleteSetAnalysis_New(string sWhere, string user) + { + try + { + omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere); + string HWorkShopID = omdelMian.HWorkShopID.ToString(); + var HStockOrgID = omdelMian.HProdORGID; + + ds = oCN.RunProcReturn("exec h_p_JIT_CompleteSetAnalysis " + HWorkShopID.ToString() + ",'" + user + "'," + HStockOrgID.ToString(), "h_p_JIT_CompleteSetAnalysis"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "榻愬鍒嗘瀽鍙戠敓閿欒锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); //杩愮畻鎴愬姛 + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "榻愬鍒嗘瀽澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + #endregion #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鎻愭枡杩愮畻 @@ -1783,14 +1909,17 @@ if (oSystemParameter.omodel.WMS_CampanyName == "甯呭▉") { sqlName = "AIS20230129011339"; + WMS_CampanyName = "甯呭▉"; } else if (oSystemParameter.omodel.WMS_CampanyName == "鍑礉濂堢壒") { sqlName = "AIS20210820164804"; + WMS_CampanyName = "鍑礉濂堢壒"; } else if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") { sqlName = "AIS20240809105013"; + WMS_CampanyName = "娣诲悍绉戞妧"; } else if (oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐") { @@ -1801,22 +1930,37 @@ { sqlName = "AIS20210811135644"; } - } - if (WMS_CampanyName == "瀹濆伐") - { - objJsonResult = (json)JIT_MOMaterLack(fProWorkShopId, fPrdOrgId, user, sqlName); - } - else if (HTLType == "缂烘枡") - { - objJsonResult = (json)JIT_QL(fProWorkShopId, fPrdOrgId, user, sqlName); - } - else if (HTLType == "鐢熶骇鐢ㄦ枡娓呭崟") - { - objJsonResult=(json)JIT_PPBOM(fProWorkShopId, fPrdOrgId, user, sqlName); - } + if (WMS_CampanyName == "瀹濆伐") + { + objJsonResult = (json)JIT_MOMaterLack(fProWorkShopId, fPrdOrgId, user); + } + else if (HTLType == "缂烘枡") + { + if (WMS_CampanyName == "甯呭▉" || WMS_CampanyName == "鍑礉濂堢壒" || WMS_CampanyName == "娣诲悍绉戞妧") + { + objJsonResult = (json)JIT_QL(fProWorkShopId, fPrdOrgId, user, sqlName); + } + else + { + objJsonResult = (json)JIT_MOMaterReady(fProWorkShopId, fPrdOrgId, user); + } + } + else if (HTLType == "鐢熶骇鐢ㄦ枡娓呭崟") + { + objJsonResult = (json)JIT_PPBOM(fProWorkShopId, fPrdOrgId, user, sqlName); + } - return objJsonResult; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErr; + objJsonResult.data = null; + return objJsonResult; + } } catch (Exception e) { @@ -2743,11 +2887,55 @@ /// 閫氳繃娆犳枡琛� 绠楁彁鏂� 瀹濆伐 /// </summary> /// <returns></returns> - public object JIT_MOMaterLack(string HWorkShopID, int? HProdORGID, string user, string sqlName) + public object JIT_MOMaterLack(string HWorkShopID, int? HProdORGID, string user) { try { ds = oCN.RunProcReturn("exec h_p_JIT_PODemandPlanBill_MOMaterLack " + HWorkShopID.ToString() + ",'" + user + "'," + HProdORGID.ToString(), "h_p_JIT_PODemandPlanBill_MOMaterLack"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎻愭枡杩愮畻鍙戠敓閿欒锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); //杩愮畻鎴愬姛 + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎻愭枡杩愮畻澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 閫氳繃榻愬琛� 绠楁彁鏂� + /// </summary> + /// <returns></returns> + public object JIT_MOMaterReady(string HWorkShopID, int? HProdORGID, string user) + { + try + { + ds = oCN.RunProcReturn("exec h_p_JIT_PODemandPlanBill_MOMaterReady " + HWorkShopID.ToString() + ",'" + user + "'," + HProdORGID.ToString(), "h_p_JIT_PODemandPlanBill_MOMaterReady"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -3426,5 +3614,7 @@ } #endregion + + } } \ No newline at end of file -- Gitblit v1.9.1