From f47d0d2d6c2896ec7aae74a428cd084ffefc1dca Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期二, 25 三月 2025 08:45:46 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs | 515 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 479 insertions(+), 36 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 d88b974..a25a6e1 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" @@ -237,6 +237,8 @@ var HPlanQty = list[i]["璁″垝鏁伴噺"].ToString(); var HEmpID = list[i]["HEmpID"].ToString(); var HWorkQty = list[i]["灏忔椂浜ц兘"].ToString(); + var HSourceName = list[i]["鐢熶骇璧勬簮"].ToString(); + var HWorkQty_ProdLine = list[i]["浜х嚎鎬讳骇鑳�"].ToString(); LogService.CustomWriteLog("2.05:" + i, DateTime.Now.ToString("yyyy-MM-dd")); @@ -274,7 +276,7 @@ " HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," + "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," + "HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty" + - ",HICMOInterID,HICMOEntryID,HPlanEndDate,HEmpID,HWorkQty)values" + + ",HICMOInterID,HICMOEntryID,HPlanEndDate,HEmpID,HWorkQty,HSourceName,HWorkQty_ProdLine)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)}," + @@ -282,7 +284,7 @@ $" 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},'{HPlanEndDate}','{HEmpID}','{HWorkQty}')"; + $"{HMainSourceInterID},{HMainSourceEntryID},'{HPlanEndDate}','{HEmpID}','{HWorkQty}','{HSourceName}','{HWorkQty_ProdLine}')"; //LogService.Write("sql:" + sql); //涓昏〃 @@ -308,6 +310,26 @@ var HOrderCommitDate = list[i]["璁㈠崟浜よ揣鏈�"].ToString(); var HPlanEndDate = list[i]["璁″垝缁撴潫鏃ユ湡"].ToString(); var HSplitQty = list[i]["鎷嗗崟鏁伴噺"].ToString(); + var HSourceName = list[i]["鐢熶骇璧勬簮"].ToString(); + var HWorkQty_ProdLine = list[i]["浜х嚎鎬讳骇鑳�"].ToString(); + + var HOrderType = list[i]["璁㈠崟绫诲瀷"].ToString(); + var HWorkShopID = list[i]["HWorkShopID"].ToString(); + var HProdORGID = list[i]["HProdORGID"].ToString(); + var HMaterID = list[i]["HMaterID"].ToString(); + var HMaterName = list[i]["鐗╂枡鍚嶇О"].ToString(); + var HMaterModel = list[i]["瑙勬牸鍨嬪彿"].ToString().Replace("'", "''"); + var HUnitID = list[i]["HUnitID"].ToString(); + var HSeOrderBillQty = list[i]["閿�鍞鍗曟暟閲�"].ToString(); + var HDayPlanSumQty = list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString(); + var HPlanBeginDate = list[i]["璁″垝寮�濮嬫棩鏈�"].ToString(); + var HSeOrderBillNo = list[i]["閿�鍞鍗曞彿"].ToString(); + var HICMOBillType = list[i]["鐢熶骇璁㈠崟鍗曟嵁绫诲瀷"].ToString(); + var HSourceStockInQty = list[i]["浜х嚎鍏ュ簱鏁伴噺"].ToString(); + var HLeftPlanQty = list[i]["鏈帓鏁伴噺"].ToString(); + var HOrderLev = list[i]["璁㈠崟绛夌骇"].ToString(); + var HPlanQty = list[i]["璁″垝鏁伴噺"].ToString(); + var HEmpID = list[i]["HEmpID"].ToString(); LogService.CustomWriteLog("2.1:"+i, DateTime.Now.ToString("yyyy-MM-dd")); @@ -333,26 +355,141 @@ return objJsonResult; } - ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" + - $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain"); - - if (ds.Tables[0].Rows.Count > 1) + if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 { - 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}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!"; - objJsonResult.data = null; - return objJsonResult; - } - LogService.CustomWriteLog("2.2:" + i, DateTime.Now.ToString("yyyy-MM-dd")); + //鐪嬫湁鍑犲彴鐢熶骇璧勬簮鍗忓悓鐢熶骇 + string[] HSourceNameArr = HSourceName.Split(new char[]{'&'}); - 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}',HPlanEndDate='{HPlanEndDate}',HSplitQty={HSplitQty}" + - $" where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'"); + if (HSourceNameArr.Length >= 2) + { + for (int s = 0; s < HSourceNameArr.Length; s++) + { + if (s == 0) + { + ds = oCN.RunProcReturn("select HItemID from Gy_Source with(nolock) where HName = '" + HSourceNameArr[s] + "'", "Gy_Source"); + + var HSourceID_Child = ds.Tables[0].Rows[0]["HItemID"]; + + oCN.RunProc($"update Sc_WorkBillSortBillMain set HSourceID={(HSourceID_Child == "" ? 0.ToString() : HSourceID_Child)}" + + $",HYX={HYX},HWorkQty={HWorkQty},HProdTimes={HProdTimes},HReadyTimes={HReadyTimes},HLastBeginDate='{HLastBeginDate}'" + + $",HLastEndDate='{HLastEndDate}',HOrderNeedQty={HOrderNeedQty},HOrderCommitDate='{HOrderCommitDate}'" + + $",HPlanEndDate='{HPlanEndDate}',HSplitQty={HSplitQty},HSourceName='{HSourceName}',HWorkQty_ProdLine={HWorkQty_ProdLine}" + + $" where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'"); + } + else + { + ds = oCN.RunProcReturn("select HItemID from Gy_Source with(nolock) where HName = '" + HSourceNameArr[s] + "'", "Gy_Source"); + + var HSourceID_Child = ds.Tables[0].Rows[0]["HItemID"]; + + //鏂板鍗忓悓鐢熶骇璧勬簮鐨勬帓浜ц褰� + ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" + + $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID_Child}", "Sc_WorkBillSortBillMain"); + + if (ds.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!"; + objJsonResult.data = null; + return objJsonResult; + } + + //鏂板鍗曟嵁鍙� id + var HBillNo_New = DBUtility.ClsPub.CreateBillCode_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);//鑾峰緱涓�涓柊鐨勫崟鎹彿 + var HInterID_New = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);//鑾峰緱涓�涓柊鐨刬d + + string sql = $"insert into Sc_WorkBillSortBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType," + + "HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HICMOBillNo,HOrderType," + + "HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HProdORGID," + + " HMaterID, HMaterName, HMaterModel, HUnitID, HSeOrderBillQty," + + " HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," + + "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," + + "HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty" + + ",HICMOInterID,HICMOEntryID,HPlanEndDate,HEmpID,HWorkQty,HSourceName,HWorkQty_ProdLine,HRemark)values" + + $"({HInterID_New},'{HBillNo_New}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," + + $"'{BillType}',GETDATE(),1,'{user}',getdate(),'{HICMOBillNo}','{HOrderType}'," + + $"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID_Child == "" ? 0.ToString() : HSourceID_Child)}, {(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},'{HPlanEndDate}','{HEmpID}','{HWorkQty}','{HSourceName}','{HWorkQty_ProdLine}','{"鍗忓悓鐢熶骇"}')"; + + //LogService.Write("sql:" + sql); + //涓昏〃 + oCN.RunProc(sql); + + //鎻掑叆瀛愯〃鏁版嵁 + for (int j = 0; j < 180; j++) + { + //涓昏〃鏈夋暟鎹� 瀛愯〃鏃犳暟鎹� + //if (j == 180 - 1 && SumCount == 0 && HInterID_New != 0 && HBillNo_New != "") + //{ + // objJsonResult = AddBillSub(HInterID_New.ToString(), HBillNo_New, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0, list[i]); + //} + + + if (list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString() != "") + { + ////淇濆瓨瀛愯〃 + objJsonResult = AddBillSub(HInterID_New == 0 ? list[i]["hmainid"].ToString() : HInterID_New.ToString() + , HBillNo_New == "" ? list[i]["鍗曟嵁鍙�"].ToString() : HBillNo_New + , DateTime.Parse(DateTime.Now.AddDays(j).ToString("yyyy-MM-dd").ToString()) + , 0 + , list[i]); + } + } + } + } + } + else + { + ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" + + $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain"); + + 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}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!"; + objJsonResult.data = null; + return objJsonResult; + } + LogService.CustomWriteLog("2.2:" + i, DateTime.Now.ToString("yyyy-MM-dd")); + + 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}',HPlanEndDate='{HPlanEndDate}',HSplitQty={HSplitQty},HSourceName='{HSourceName}',HWorkQty_ProdLine={HWorkQty_ProdLine}" + + $" where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'"); + } + } + else + { + ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" + + $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain"); + + 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}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!"; + objJsonResult.data = null; + return objJsonResult; + } + LogService.CustomWriteLog("2.2:" + i, DateTime.Now.ToString("yyyy-MM-dd")); + + 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}',HPlanEndDate='{HPlanEndDate}',HSplitQty={HSplitQty},HSourceName='{HSourceName}',HWorkQty_ProdLine={HWorkQty_ProdLine}" + + $" 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)}'"); @@ -443,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 == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 { //鎶婃帓浜ц鍗曞畬宸ユ棩鏈熷弽鍐欏埌閲戣澏閿�鍞鍗曚笂 @@ -1638,6 +1804,7 @@ string fProWorkShopId = omdelMian.HWorkShopID.ToString(); var fPrdOrgId = omdelMian.HProdORGID; string sqlName = "";//AIS20210811135644 + string WMS_CampanyName = ""; //瀹㈡埛鍚嶇О //瀹㈡埛鍒跺畾 string sErr = ""; if (oSystemParameter.ShowBill(ref sErr)) @@ -1657,6 +1824,7 @@ else if (oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐") { sqlName = "AIS20250102123554"; + WMS_CampanyName = "瀹濆伐"; } else { @@ -1664,8 +1832,11 @@ } } - - if (HTLType == "缂烘枡") + if (WMS_CampanyName == "瀹濆伐") + { + objJsonResult = (json)JIT_MOMaterLack(fProWorkShopId, fPrdOrgId, user, sqlName); + } + else if (HTLType == "缂烘枡") { objJsonResult = (json)JIT_QL(fProWorkShopId, fPrdOrgId, user, sqlName); } @@ -2596,6 +2767,51 @@ return objJsonResult; } } + + /// <summary> + /// 閫氳繃娆犳枡琛� 绠楁彁鏂� 瀹濆伐 + /// </summary> + /// <returns></returns> + public object JIT_MOMaterLack(string HWorkShopID, int? HProdORGID, string user, string sqlName) + { + 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; + } + } + #endregion #region 鐢熶骇鏃ヨ鍒掑钩鍙� 閿佸畾 @@ -3055,5 +3271,232 @@ } #endregion + #region 閫氳繃鐗╂枡鍖归厤浜у搧鍣ㄥ叿娓呭崟 + [Route("JIT_DayPlanPlatFormBill/GetMouldByMater")] + [HttpGet] + public object GetMouldByMater(string HMaterID,string HSourceID,string HPCDate) + { + try + { + ds = oCN.RunProcReturn("exec h_p_Gy_MaterialMouldByMater " + HMaterID + "," + HSourceID + ",'" + HPCDate + "'", "h_p_Gy_MaterialMouldByMater"); + + 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 + + #region 閫氳繃璧勬簮鍖归厤璧勬簮鍣ㄥ叿娓呭崟 + [Route("JIT_DayPlanPlatFormBill/GetMouldBySource")] + [HttpGet] + public object GetMouldBySource(string HSourceID, string HMouldID) + { + try + { + ds = oCN.RunProcReturn("select * from h_v_Gy_SourceMouldBillMainList where HSourceID = " + HSourceID + " and HMouldID = " + HMouldID, "h_v_Gy_SourceMouldBillMainList"); + + 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 + + #region 鎺掍骇鍚庡皢鍣ㄥ叿鍗犵敤鏃堕棿鍐欏叆鏁版嵁搴� + [Route("JIT_DayPlanPlatFormBill/AddMouldOccupancyTime")] + [HttpGet] + public object AddMouldOccupancyTime(string HMouldID, string HSourceID, string HICMOInterID, string HICMOEntryID, string HICMOBillNo, string HMouldPCTime) + { + try + { + ds = oCN.RunProcReturn("exec h_p_JIT_AddMouldOccupancyTime " + HMouldID + "," + HSourceID + "," + HICMOInterID + "," + HICMOEntryID + ",'" + HICMOBillNo + "','" + HMouldPCTime + "'", "h_p_JIT_AddMouldOccupancyTime"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ""; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閫氳繃涓昏祫婧愬尮閰嶅瓙璧勬簮 + [Route("JIT_DayPlanPlatFormBill/GetChildSource")] + [HttpGet] + public object GetChildSource(string HSourceID) + { + try + { + ds = oCN.RunProcReturn("select HItemID 瀛愯祫婧怚D,HNumber 瀛愯祫婧愪唬鐮�,HName 瀛愯祫婧愬悕绉�,HCubicleQty 瀛愯祫婧愬伐浣嶆暟 from Gy_Source with(nolock) where HParentID = " + HSourceID + " order by HName asc", "Gy_Source"); + + 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 + + #region 鍒ゆ柇鐗╂枡鏄惁鍙互鏀惧湪鍚屼竴璧勬簮涓婁竴璧风敓浜� + [Route("JIT_DayPlanPlatFormBill/GetSourceByMater")] + [HttpGet] + public object GetSourceByMater(string HMaterID) + { + try + { + ds = oCN.RunProcReturn("exec h_p_Sc_ICMOGetWorkSource_TK " + HMaterID + ",'',''", "h_p_Sc_ICMOGetWorkSource_TK"); + + 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 + + #region 宸ュ簭璐熻嵎鍒嗘瀽姹囨�绘姤琛� 鏌ヨ + /// <summary> + /// 杩斿洖椤圭洰闃舵鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("JIT_DayPlanPlatFormBill/JIT_FuHeFenXiReport")] + [HttpGet] + public object JIT_FuHeFenXiReport(string sWhere, string user) + { + try + { + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("JIT_FuHeFenXiReport", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + List<object> columnNameList = new List<object>(); + string sql = "exec h_p_JIT_FuHeFenXiReport '" + sWhere + "','" + user + "'"; + + ds = oCN.RunProcReturn(sql, "h_p_JIT_FuHeFenXiReport"); + + //娣诲姞鍒楀悕 + 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; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ュ簭璐熻嵎鍒嗘瀽姹囨�绘姤琛� 鏌ヨ + /// <summary> + /// 杩斿洖椤圭洰闃舵鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + //[Route("JIT_DayPlanPlatFormBill/JIT_FuHeFenXiReport")] + //[HttpGet] + //public object JIT_FuHeFenXiReport(string sWhere, string user) + //{ + // try + // { + // List<object> columnNameList = new List<object>(); + // string sql = "exec h_p_JIT_FuHeFenXiReport '" + sWhere + "','" + user + "'"; + + // ds = oCN.RunProcReturn(sql, "h_p_JIT_FuHeFenXiReport"); + + // //娣诲姞鍒楀悕 + // 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; + // 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