| | |
| | | using Newtonsoft.Json.Linq; |
| | | using System.Diagnostics; |
| | | using System.Threading; |
| | | |
| | | using System.Globalization; |
| | | namespace WebAPI.Controllers.SCGL.æ¥è®¡å管ç |
| | | { |
| | | public class JIT_DayPlanPlatFormBillController : ApiController |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®ç¹å»è¡æ 颿¶é´æ¥è¯¢ç¼ºæåæ |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <param name="user"></param> |
| | | /// <returns></returns> |
| | | [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHDateTimeList")] |
| | | [HttpGet] |
| | | public object JIT_DayPlanPlatFormBillHDateTimeList(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | MaterialShorAnalysis Report = JsonConvert.DeserializeObject<MaterialShorAnalysis>(sWhere); |
| | | |
| | | ds = oCN.RunProcReturn($"exec h_p_JIT_MaterialShorAnalysisReportList {Report.HORGID},'{Report.HBEGINDATE}','{Report.HENDDATE}' ", "h_p_JIT_PODemandPlanBill_ReportList"); |
| | | |
| | | |
| | | 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 ç产æ¥è®¡åå¹³å° ä¿å |
| | |
| | | |
| | | public json AddBillMain(string msg1) |
| | | { |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string[] sArray = msg1.Split(new string[] { "&å" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string user = sArray[1].ToString(); |
| | | |
| | | try |
| | | { |
| | | Stopwatch sw = new Stopwatch();//计æ¶å¨ |
| | | sw.Start();//å¼å§è®¡æ¶ |
| | | |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | LogService.CustomWriteLog("1:"+msg2, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | //JSONåºåå转æ¢åå
¸éå |
| | | List<Dictionary<string, string>> list = new List<Dictionary<string, string>>(); |
| | | List<object> jb = JsonConvert.DeserializeObject<List<object>>(msg2); |
| | |
| | | list.Add(dic); |
| | | } |
| | | |
| | | 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")); |
| | | |
| | | string sReturn = ""; |
| | | oSystemParameter.ShowBill(ref sReturn); |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | { |
| | | TrueCount = 0; |
| | | SumCount = 0; |
| | | long HInterID = 0; |
| | | var HBillNo = ""; |
| | | if (list[i]["åæ®å·"].ToString() == "" && list[i]["hmainid"].ToString() == "") |
| | | { |
| | | LogService.CustomWriteLog("2.01:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | var HICMOBillNo = list[i]["ç产订åå·"].ToString(); |
| | | var HOrderType = list[i]["订åç±»å"].ToString(); |
| | | var HICMOEntrySEQ = list[i]["ç产订åæç»è¡å·"].ToString(); |
| | |
| | | var HProdORGID = list[i]["HProdORGID"].ToString(); |
| | | var HMaterID = list[i]["HMaterID"].ToString(); |
| | | var HMaterName = list[i]["ç©æåç§°"].ToString(); |
| | | var HMaterModel = list[i]["è§æ ¼åå·"].ToString(); |
| | | var HMaterModel = list[i]["è§æ ¼åå·"].ToString().Replace("'", "''"); |
| | | var HUnitID = list[i]["HUnitID"].ToString(); |
| | | var HSeOrderBillQty = list[i]["éå®è®¢åæ°é"].ToString(); |
| | | //var HOrderNeedQty = list[i]["订åéæ±æ°é"].ToString(); |
| | | var HSplitQty = list[i]["æåæ°é"].ToString(); |
| | | var HDayPlanSumQty = list[i]["æ¥è®¡åæ°éæ»é"].ToString(); |
| | | var HPlanBeginDate = list[i]["计åå¼å§æ¥æ"].ToString(); |
| | | var HPlanEndDate = list[i]["计åç»ææ¥æ"].ToString(); |
| | | var HSeOrderBillNo = list[i]["éå®è®¢åå·"].ToString(); |
| | | var HICMOBillType = list[i]["ç产订ååæ®ç±»å"].ToString(); |
| | | var HSourceStockInQty = list[i]["产线å
¥åºæ°é"].ToString(); |
| | |
| | | var HMainSourceInterID = list[i]["æºå主å
ç "].ToString(); |
| | | var HMainSourceEntryID = list[i]["æºååå
ç "].ToString(); |
| | | 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(); |
| | | |
| | | if (HSourceID == ""|| HSourceID == "0") |
| | | LogService.CustomWriteLog("2.05:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName != "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | if (HSourceID == "" || HSourceID == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | 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} and ISNULL(HDeleteMan,'')=''", "Sc_WorkBillSortBillMain"); |
| | | |
| | | 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) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | " HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," + |
| | | "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," + |
| | | "HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty" + |
| | | ",HICMOInterID,HICMOEntryID)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)}," + |
| | |
| | | $" 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})"; |
| | | $"{HMainSourceInterID},{HMainSourceEntryID},'{HPlanEndDate}','{HEmpID}','{HWorkQty}','{HSourceName}','{HWorkQty_ProdLine}')"; |
| | | |
| | | //LogService.Write("sql:" + sql); |
| | | //主表 |
| | |
| | | } |
| | | else |
| | | { |
| | | LogService.CustomWriteLog("2.0:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | HBillNo = list[i]["åæ®å·"].ToString(); |
| | | HInterID = int.Parse(list[i]["hmainid"].ToString()); |
| | | var HMainSourceInterID = list[i]["æºå主å
ç "].ToString(); |
| | | var HMainSourceEntryID = list[i]["æºååå
ç "].ToString(); |
| | | var HICMOBillNo = list[i]["ç产订åå·"].ToString(); |
| | |
| | | var HLastEndDate = list[i]["æè¿å®å·¥æ¥æ"].ToString(); |
| | | var HOrderNeedQty = list[i]["订åéæ±æ°é"].ToString(); |
| | | 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(); |
| | | |
| | | if (HSourceID == "" || HSourceID == "0") |
| | | 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")); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName != "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | if (HSourceID == "" || HSourceID == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | var str = 0; |
| | | if (!int.TryParse(HYX, out str)) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | 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 > 1) |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºæéå¤,请修æ¹!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //çæå å°çäº§èµæºååç产 |
| | | 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}'" + |
| | | $" 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);//è·å¾ä¸ä¸ªæ°çid |
| | | |
| | | 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} and ISNULL(HDeleteMan,'') = ''", "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} and ISNULL(HDeleteMan,'')=''", 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)}'"); |
| | | |
| | | int SumDay = 31; //卿䏤æä¹å·® DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days; |
| | | int SumDay = 0; //卿䏤æä¹å·® DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days; |
| | | |
| | | // ç»è®¡æ»å¤©æ° |
| | | HashSet<DateTime> uniqueDates = new HashSet<DateTime>(); |
| | | |
| | | foreach (var key in list[i].Keys) |
| | | { |
| | | if (DateTime.TryParseExact(key, "yyyy-M-d", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date)) |
| | | { |
| | | uniqueDates.Add(date); |
| | | } |
| | | } |
| | | |
| | | SumDay = uniqueDates.Count; |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | SumDay = 180; |
| | | } |
| | | |
| | | LogService.CustomWriteLog("2.3:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | for (int j = 0; j < SumDay; j++) |
| | | { |
| | | //主表åè¡¨é½ææ°æ® |
| | |
| | | { |
| | | SumCount += 1; |
| | | ////ä¿åå表 |
| | | |
| | | 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) |
| | | { |
| | | TrueCount += 1; |
| | | } |
| | | } |
| | | //ä¸»è¡¨ææ°æ® åè¡¨æ æ°æ® |
| | | if (j == 30 && SumCount == 0 && HInterID != 0 && HBillNo != "") |
| | | if (j == SumDay-1 && SumCount == 0 && HInterID != 0 && HBillNo != "") |
| | | { |
| | | objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0); |
| | | //LogService.CustomWriteLog("3:"+ HInterID+","+ HBillNo, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0, list[i]); |
| | | } |
| | | } |
| | | |
| | | LogService.CustomWriteLog("2.4:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | if (TrueCount != SumCount) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | if (TrueCount != SumCount) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.CustomWriteLog("2.5:", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | //忥æ¥è®¡åå·¥å |
| | | oCN.RunProc("exec REALESE_SC_ICMOBILLSTATUS_TMP"); |
| | | |
| | | LogService.CustomWriteLog("2.6:", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | sw.Stop();//ç»æè®¡æ¶ |
| | | LogService.Write($"========================1.æäº§è®¢åæ»ç¨æ¶ï¼" + sw.Elapsed); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | } |
| | | |
| | | public json AddBillSub(string HInterID, string HBillNo, DateTime date, int HQTY) |
| | | 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"); |
| | | 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}" + |
| | | $" 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)" + |
| | | $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," + |
| | | $" '{date}', {HQTY})"); |
| | | 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())) })"); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | //ææäº§è®¢åå®å·¥æ¥æååå°éè¶éå®è®¢åä¸ |
| | | string sql = "exec h_p_JIT_UpdateEndDateToERP " + HInterID + ",'" + HBillNo + "'"; |
| | | oCN.RunProc(sql); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | |
| | | } |
| | | #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 |
| | | { |
| | |
| | | omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere); |
| | | string sql = $"exec JIT_qtfx {omdelMian.HProdORGID},{omdelMian.HWorkShopID},'{user}' "; |
| | | ds = oCN.RunProcReturn(sql, "JIT_qtfx"); |
| | | LogService.Write("é½å¥åæsql:" + sql); |
| | | //LogService.Write("é½å¥åæsql:" + sql); |
| | | List<PRD_PPBOM> BomList = new List<PRD_PPBOM>(); |
| | | DataTable resulTable = ds.Tables[0]; |
| | | |
| | | if (ds.Tables[0].Rows.Count < 1 || ds == null) |
| | | { |
| | | //éæ¾é½å¥æä½ é¿å
å¤äººåæ¶è¿è¡é½å¥åæ |
| | | oCN.RunProc($"update T_PRD_QTFX set FSTATUS = 0 where FPRDORGID ={omdelMian.HProdORGID} and FSTATUS = 1 "); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "没æéè¦è¿è¡é½å¥åæçæ°æ®"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (resulTable.Rows[0][0].ToString().Contains("失败")) |
| | | { |
| | | //éæ¾é½å¥æä½ é¿å
å¤äººåæ¶è¿è¡é½å¥åæ |
| | |
| | | fDayPlanFids = string.Join(",", fidList); |
| | | fDayPlanFEntryids = string.Join(",", fentryidList); |
| | | } |
| | | LogService.Write("æ¥è®¡åå·¥åids" + fDayPlanFids); |
| | | //LogService.Write("æ¥è®¡åå·¥åids" + fDayPlanFids); |
| | | |
| | | sw.Start();//å¼å§è®¡æ¶ |
| | | |
| | | //è·åå½å峿¶åºå åºåæ°é+åºåç»ç»+ç©æ+货主+ä»åº |
| | | //åæ¥è¯¢å³æ¶åºåæ¹å¼ï¼select * from h_v_jit_InventoryList |
| | | ds = oCN.RunProcReturn(@" |
| | | select * from h_v_jit_InventoryList |
| | | ", "h_v_jit_InventoryList"); |
| | | exec h_p_jit_Inventory_UsableList |
| | | ", "h_p_jit_Inventory_UsableList"); |
| | | ListInventory = ds.ToModelList<PRD_Inventory>(); |
| | | //è½¦é´ ä»åºå¯¹ç
§å表 |
| | | ds = oCN.RunProcReturn(@" |
| | |
| | | //ååºåæ°é FMustQty ä¸è¦åå¼éæ±æ°éFNeedQty é¢ææ°æ® |
| | | string LLsql = string.Format(@"exec h_p_jit_PPBOMList '{0}'", fDayPlanFids); |
| | | List<DayPlanPickedModel> DayPlanPickedModel = new List<DayPlanPickedModel>(); |
| | | LogService.Write("LLsql:" + LLsql); |
| | | //LogService.Write("LLsql:" + LLsql); |
| | | ds = oCN.RunProcReturn(LLsql, "SC_WORKBILLSORTBILLMAIN"); |
| | | LogService.Write(JsonConvert.SerializeObject(ds)); |
| | | //LogService.Write(JsonConvert.SerializeObject(ds)); |
| | | DayPlanPickedModel = ds.ToModelList<DayPlanPickedModel>(); |
| | | LogService.Write(JsonConvert.SerializeObject(DayPlanPickedModel)); |
| | | //LogService.Write(JsonConvert.SerializeObject(DayPlanPickedModel)); |
| | | //CompleteAnalysisTempModel ç¨äºåå¨ä¸´æ¶éè¦æå
¥æ°æ® |
| | | List<CompleteAnalysisTempModel> completeAnalysisTempModel = new List<CompleteAnalysisTempModel>(); |
| | | //å建åå
¸ ç¨äºå¨åç©æ + å ç¨æ°é |
| | | Dictionary<string, decimal> occupyDic = new Dictionary<string, decimal>(); |
| | | LogService.Write($"é½å¥åæï¼æ°æ®åå¤é¶æ®µï¼ç¨æ¶" + sw.Elapsed + "æ»è¡æ°ï¼" + BomList.Count); |
| | | LogService.Write($"é½å¥åæï¼æ°æ®åå¤é¶æ®µï¼ç¨æ¶" + sw.Elapsed + "æ»éè¦å¾ªç¯çbomæ°éï¼" + DatePlanList.Count); |
| | | //LogService.Write($"é½å¥åæï¼æ°æ®åå¤é¶æ®µï¼ç¨æ¶" + sw.Elapsed + "æ»è¡æ°ï¼" + BomList.Count); |
| | | //LogService.Write($"é½å¥åæï¼æ°æ®åå¤é¶æ®µï¼ç¨æ¶" + sw.Elapsed + "æ»éè¦å¾ªç¯çbomæ°éï¼" + DatePlanList.Count); |
| | | |
| | | //第ä¸ä¸ªå¾ªç¯ æ¥è®¡åå·¥åæç» ä¸å¤©+ä¸ä¸ªå·¥å ä¸ä¸ªå¾ªç¯ |
| | | int o = 0; |
| | | foreach (var item in DatePlanList) |
| | | { |
| | | o++; |
| | | LogService.Write("循ç¯:" + o); |
| | | //LogService.Write("循ç¯:" + o); |
| | | //æ¥è®¡åç¨ææ¸
åæç» æ¯ä¸å¤©çå®é
ç¨ææ
åµ |
| | | var _BomList = BomList.Where(x => x.HMasterDate == item.HMasterDate && x.HICMOEntryID_Sec == item.HICMOEntryID_Sec).ToList(); |
| | | //æ¯ä¸ä¸ªç©æè¿è¡åºåè®¡ç® |
| | |
| | | }); |
| | | //æ£é¤å©ä½å¯ç¨é¢ææ°é |
| | | _DayPlanPickedModel.FRemainPickedQty -= need; |
| | | LogService.Write($"h" + need); |
| | | //LogService.Write($"h" + need); |
| | | //循ç¯ä¸ä¸ä¸ªç©æ |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | LogService.Write($"kxs" + need); |
| | | //LogService.Write($"kxs" + need); |
| | | need -= _DayPlanPickedModel.FRemainPickedQty; //å©ä½éæ±æ°é |
| | | LogService.Write($"i1" + need); |
| | | //LogService.Write($"i1" + need); |
| | | FOccupyPickedCount = _DayPlanPickedModel.FRemainPickedQty; |
| | | _DayPlanPickedModel.FRemainPickedQty = 0; |
| | | LogService.Write($"i" + need); |
| | | //LogService.Write($"i" + need); |
| | | } |
| | | if (_pRD_WorkHouseCompar.Count > 0) |
| | | { |
| | | //ç¼ºææ°é éæ±æ°é - å®é
åºå >0 ? ä¸ä¸ªç©æä¸ç®¡å ç¨å¤å°æ¡ åºå+货主 æ°æ® ç¼ºææ°éæ¯åä¸ä¸ªæ°é |
| | | decimal _fLackCount = need > jskcQty ? (need - jskcQty) : 0; |
| | | LogService.Write($"j" + _fLackCount); |
| | | //LogService.Write($"j" + _fLackCount); |
| | | //LogHelper.Info("ç»ç»ï¼" + _item.FStockOrgId + " ,åæ¶åºå" + jskcQty); |
| | | //æ»åºå为0äº ç´æ¥ç»åº ç¼ºææ°é |
| | | if (jskcQty == 0) |
| | |
| | | continue; |
| | | } |
| | | |
| | | LogService.Write($"k" + 2); |
| | | //LogService.Write($"k" + 2); |
| | | foreach (var WorkHouse in _pRD_WorkHouseCompar) |
| | | { |
| | | //åºåæ°æ®å¹é
|
| | |
| | | //Thread.Sleep(6000); |
| | | i++; |
| | | } |
| | | LogService.Write($"é½å¥åæï¼æ°æ®åå¤å®æï¼ä¿åå°Modelå®ä½ï¼æ»è¡æ°ï¼{completeAnalysisTempModel.Count}ï¼èæ¶ï¼" + sw.Elapsed); |
| | | //LogService.Write($"é½å¥åæï¼æ°æ®åå¤å®æï¼ä¿åå°Modelå®ä½ï¼æ»è¡æ°ï¼{completeAnalysisTempModel.Count}ï¼èæ¶ï¼" + sw.Elapsed); |
| | | List<string> sqlList = new List<string>(); |
| | | DataTable insertDT = new DataTable(); |
| | | insertDT.TableName = "JIT_MOMaterReadysBill"; |
| | |
| | | $", {item["FCOMPLETECOUNT1"].ToString()}, {item["FERPCLSID"].ToString()}, {item["FWORKSHOPID"].ToString()}, {item["FSTOCKID"].ToString()}, {item["FOCCUPYPICKEDCOUNT"].ToString()}, '{item["HMainICMOBillNo"].ToString()}'" + |
| | | $",{item["HLOT"].ToString()},'{item["HInventoryFID"].ToString()}')"); |
| | | } |
| | | LogService.Write("æ¹éæå
¥å°æ°æ®åºç¨æ¶ï¼" + sw.Elapsed); |
| | | //LogService.Write("æ¹éæå
¥å°æ°æ®åºç¨æ¶ï¼" + sw.Elapsed); |
| | | //æ§è¡å®æå æ´æ°æ¥è®¡åå·¥åç¶æ |
| | | string updatesql = string.Format(@" |
| | | update Sc_WorkBillSortBillSub set HComplete = 'æªé½å¥' where HEntryID IN |
| | |
| | | //éæ¾é½å¥æä½ é¿å
å¤äººåæ¶è¿è¡é½å¥åæ |
| | | oCN.RunProc($"update T_PRD_QTFX set FSTATUS = 0 where FPRDORGID ={omdelMian.HProdORGID} and FSTATUS = 1 "); |
| | | sw.Stop();//ç»æè®¡æ¶ |
| | | LogService.Write("é½å¥åæè¿è¡æ»æ¶é¿ï¼" + sw.Elapsed); |
| | | //LogService.Write("é½å¥åæè¿è¡æ»æ¶é¿ï¼" + sw.Elapsed); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | 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 ç产æ¥è®¡åå¹³å° ææè¿ç® |
| | |
| | | string fProWorkShopId = omdelMian.HWorkShopID.ToString(); |
| | | var fPrdOrgId = omdelMian.HProdORGID; |
| | | string sqlName = "";//AIS20210811135644 |
| | | string WMS_CampanyName = ""; //客æ·åç§° |
| | | //客æ·å¶å® |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | |
| | | 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 == "å®å·¥") |
| | | { |
| | | sqlName = "AIS20250102123554"; |
| | | WMS_CampanyName = "å®å·¥"; |
| | | } |
| | | else |
| | | { |
| | | sqlName = "AIS20210811135644"; |
| | | } |
| | | } |
| | | |
| | | 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) |
| | | { |
| | |
| | | //sqléå æ´æ°éè´è®¢åå ç¨çææè®¡åæ°é |
| | | List<string> sqlList = new List<string>(); |
| | | |
| | | LogService.Write("1"); |
| | | //LogService.Write("1"); |
| | | string Error = ""; |
| | | foreach (var item in MaterialIDList) |
| | | { |
| | |
| | | continue; |
| | | } |
| | | |
| | | LogService.Write("1.1"); |
| | | //LogService.Write("1.1"); |
| | | |
| | | ////LogHelper.Info(item.FMATERIALID.ToString()); |
| | | //å½åç©æååºåç»ç»å¯¹åºçéè¿è¡ææè®¡åçæ°æ® |
| | |
| | | int i = 0; |
| | | //è®°å½å¨æå°éè´ééæ±ä¸çæ¥è®¡åæç»FentyrID |
| | | |
| | | LogService.Write("1.2"); |
| | | //LogService.Write("1.2"); |
| | | |
| | | List<int> FEntryIdList = new List<int>(); |
| | | foreach (var _item in _DayPlanPpbom) |
| | |
| | | break; |
| | | } |
| | | |
| | | LogService.Write("1.2.1"); |
| | | //LogService.Write("1.2.1"); |
| | | |
| | | if (NeedQty == 0) |
| | | { |
| | |
| | | continue; |
| | | } |
| | | |
| | | LogService.Write("1.2.2"); |
| | | //LogService.Write("1.2.2"); |
| | | |
| | | foreach (var Purchase in _PurchaseInventory) |
| | | { |
| | |
| | | F_QIMB_NOTE = Purchase.F_QIMB_NOTE, |
| | | FNOTE = Purchase.FNOTE, |
| | | FPURCHASEQTY = Purchase.FPURCHASEQTY, |
| | | FJOINQTY = Purchase.FJOINQTY |
| | | FJOINQTY = Purchase.FJOINQTY, |
| | | FDAYPLANBILLNO = _item.FDAYPLANBILLNO |
| | | }); |
| | | //æ£é¤æ¥è®¡åæç»å·²è¢«åé
çæ°é |
| | | DayPlanPpbomls.NeedQty = 0; |
| | | } |
| | | |
| | | LogService.Write("1.2.3"); |
| | | //LogService.Write("1.2.3"); |
| | | |
| | | FEntryIdList.Clear(); |
| | | //æ´æ°éè´è®¢å |
| | |
| | | F_QIMB_NOTE = Purchase.F_QIMB_NOTE, |
| | | FNOTE = Purchase.FNOTE, |
| | | FPURCHASEQTY = Purchase.FPURCHASEQTY, |
| | | FJOINQTY = Purchase.FJOINQTY |
| | | FJOINQTY = Purchase.FJOINQTY, |
| | | FDAYPLANBILLNO = _item.FDAYPLANBILLNO |
| | | }); |
| | | //æ´æ°è®¡åæ°éï¼å©ä½éè¦æçï¼ ç»§ç»å»è®¡ç®ä¸ä¸ä¸ªéè´è®¢å |
| | | DayPlanPpbomls.NeedQty -= Qty; |
| | |
| | | } |
| | | } |
| | | |
| | | LogService.Write("1.2.4"); |
| | | //LogService.Write("1.2.4"); |
| | | |
| | | NeedQty = 0; |
| | | |
| | |
| | | int tlmmm = 0; |
| | | JArray FinalyResult = new JArray(); |
| | | |
| | | LogService.Write("2"); |
| | | //LogService.Write("2"); |
| | | |
| | | foreach (var item in PODemandPlanList) |
| | | { |
| | |
| | | // tlmmm++; |
| | | } |
| | | |
| | | LogService.Write("3"); |
| | | //LogService.Write("3"); |
| | | if (Error != "") |
| | | { |
| | | oCN.Commit(); |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿æ¬ æè¡¨ ç®ææ å®å·¥ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | 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"; |
| | | 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 ç产æ¥è®¡åå¹³å° éå® |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° éå®å·¥å |
| | | [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHLockedOrder")] |
| | | [HttpGet] |
| | | public object JIT_DayPlanPlatFormBillHLockedOrder(string HInterIDs) |
| | | { |
| | | try |
| | | { |
| | | oCN.RunProc($"update Sc_WorkBillSortBillMain set HLockOrder = 1 where HInterID in ({HInterIDs})"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = null; |
| | | 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/JIT_DayPlanPlatFormBillHUnlockOrder")] |
| | | [HttpGet] |
| | | public object JIT_DayPlanPlatFormBillHUnlockOrder(string HInterIDs) |
| | | { |
| | | try |
| | | { |
| | | oCN.RunProc($"update Sc_WorkBillSortBillMain set HLockOrder = 0 where HInterID in ({HInterIDs})"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = null; |
| | | 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/JIT_ICMOBillList")] |
| | | [HttpGet] |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç产æç»è¡éå¤,éå¤çç产订åå·:" + ds.Tables[0].Rows[i]["ç产订åå·"].ToString() + ",æç»è¡å·:" + ds.Tables[0].Rows[i]["ç产订åæç»è¡å·"].ToString(); |
| | | objJsonResult.Message = "ç产æç»è¡éå¤,éå¤çç产订åå·:" + dt.Tables[0].Rows[i]["ç产订åå·"].ToString() + ",æç»è¡å·:" + dt.Tables[0].Rows[i]["ç产订åæç»è¡å·"].ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | #region ç产æ¥è®¡åå¹³å° æ°æ®åå¤ è®¾ç½®ä»»å¡åç¸å
³ä¿¡æ¯ |
| | | [Route("JIT_DayPlanPlatFormBill/ReadyData")] |
| | | [HttpGet] |
| | | public object ReadyData(string HICOMNum) |
| | | public object ReadyData(string SWhere) |
| | | { |
| | | try |
| | | { |
| | | var list = HICOMNum.Split(','); |
| | | var list = SWhere.Split(','); |
| | | DataTable dt = new DataTable("date"); |
| | | dt.Columns.Add("HICMOInterID", typeof(string)); |
| | | dt.Columns.Add("HICMOEntryID", typeof(string)); |
| | |
| | | { |
| | | string HICMOInterID = list[i].Split(';')[0].ToString(); |
| | | string HICMOEntryID = list[i].Split(';')[1].ToString(); |
| | | string HSourceID = list[i].Split(';')[2].ToString(); |
| | | |
| | | Thread.Sleep(100); |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_GetInfoByICMOBillNo " + HICMOInterID+","+ HICMOEntryID, "h_p_Sc_GetInfoByICMOBillNo"); |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_GetInfoByICMOBillNo " + HICMOInterID+","+ HICMOEntryID+","+ HSourceID, "h_p_Sc_GetInfoByICMOBillNo"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 缺æåææ¥è¡¨ |
| | | public class MaterialShorAnalysis |
| | | { |
| | | public int? HORGID; |
| | | public DateTime HBEGINDATE; |
| | | public DateTime HENDDATE; |
| | | } |
| | | [Route("JIT_DayPlanPlatFormBill/MaterialShorAnalysisReport")] |
| | | [HttpGet] |
| | | public object MaterialShorAnalysisReport(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | MaterialShorAnalysis Report = JsonConvert.DeserializeObject<MaterialShorAnalysis>(sWhere); |
| | | |
| | | ds = oCN.RunProcReturn($"exec h_p_JIT_MaterialShorAnalysisReportList {Report.HORGID},'{Report.HBEGINDATE}','{Report.HENDDATE}' ", "h_p_JIT_PODemandPlanBill_ReportList"); |
| | | |
| | | 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 æ ¹æ®ç©æ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));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | 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 |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° æ ¹æ®è½¦é´æ·»å æªæäº§ç产订å |
| | | [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillListByDept")] |
| | | [HttpGet] |
| | | public object JIT_ICMOBillListByDept(string HDeptID) |
| | | { |
| | | try |
| | | { |
| | | //è·åæ¾ç¤ºç³»ç»åæ° |
| | | string sReturn = ""; |
| | | oSystemParameter.ShowBill(ref sReturn); |
| | | |
| | | //æ¥è¯¢éæ©è½¦é´ä¸æªæäº§è¿çç产订åä¿¡æ¯ï¼æ·»åº·ç§æ--ç产订åç¶æä¸ºä¸è¾¾ï¼ |
| | | ds = oCN.RunProcReturn($"exec h_p_JIT_ICMOBillListByDept '{HDeptID}'", "h_p_JIT_ICMOBillListByDept"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0 && ds != null) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | //æ°æ®è¡¨æ ¼æ·»å å¨ææ¥æ |
| | | for (int j = 1; j <= 180; j++) |
| | | { |
| | | ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®è¡¨æ ¼æ·»å å¨ææ¥æ |
| | | for (int j = 1; j <= 31; j++) |
| | | { |
| | | ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32)); |
| | | } |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥æ æ°æ®ï¼å½åæé车é´ä¸ææ æªæäº§ä¸è®¢åç¶æä¸ºä¸è¾¾çç产订åä¿¡æ¯ï¼"; |
| | | 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/GetICMOCompletionDate")] |
| | | [HttpGet] |
| | | public object GetICMOCompletionDate(string HDeptID) |
| | | { |
| | | try |
| | | { |
| | | //æ´æ°æ¥è®¡åå·¥åçå®å·¥æ¥æ |
| | | oCN.RunProc($"exec h_p_JIT_GetICMOCompletionDate '{HDeptID}'"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "è·åå®å·¥æ¥ææåï¼"; |
| | | objJsonResult.data = null; |
| | | 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/GetICMOEarlyDate")] |
| | | [HttpGet] |
| | | public object GetICMOEarlyDate(string HDeptID) |
| | | { |
| | | try |
| | | { |
| | | //æ´æ°ç产订åçææ©å¼å·¥æ¥æ |
| | | oCN.RunProc($"exec h_p_JIT_GetICMOEarlyDate '{HDeptID}'"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "è·åææ©å¼å·¥æ¥ææåï¼"; |
| | | objJsonResult.data = null; |
| | | 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/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 åèµæºID,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> |
| | | /// è¿å项ç®é¶æ®µå表 |
| | | ///åæ°ï¼string 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));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | 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 |
| | | |
| | | |
| | | |
| | | } |
| | | } |