From 901c4aa46a44e4b27f93530da00d84d46a0b8181 Mon Sep 17 00:00:00 2001 From: "BB.Wang" Date: Wed, 2 Aug 2023 23:12:23 +0800 Subject: [PATCH] =?UTF-8?q?Yiru=20=E6=9B=B4=E6=96=B0=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AE=89=E5=8B=A4=E5=AE=8C=E5=B7=A5=E5=85=A5=E5=BA=AB=E6=98=B6?= =?UTF-8?q?=E4=BA=A8=E8=B3=87=E6=96=99=E6=99=82=E9=8C=AF=E8=AA=A4=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=20=E5=A2=9E=E5=8A=A0=E5=87=BA=E8=B2=A8=E5=BA=8F?= =?UTF-8?q?=E8=99=9F=E9=87=8D=E5=8F=96=20PCS040?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 636 +++++++++++++++++- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 47 +- .../ViewModels/PCS/PCS040RViewModel.cs | 42 ++ AMESCoreStudio.Web/Views/PCS/PCS040.cshtml | 212 ++++++ AMESCoreStudio.Web/Views/PCS/PCS040C.cshtml | 91 +++ AMESCoreStudio.Web/Views/PCS/PCS040R.cshtml | 116 ++++ .../AMES/FqcInhouseMasterController.cs | 114 ++++ .../Controllers/AMES/SerialRulesController.cs | 2 +- .../AMES/WipBarcodeOthersController.cs | 57 ++ .../DTO/AMES/WipBarcodeOtherDto.cs | 81 +++ .../Models/AMES/FqcInhouseDetail.cs | 2 +- .../Models/AMES/FqcInhouseMaster.cs | 2 +- .../Models/AMES/FqcResultMaster.cs | 2 +- .../Models/AMES/WareHouseing.cs | 6 +- .../Models/AMES/WipBarcodeOther.cs | 14 +- 15 files changed, 1406 insertions(+), 18 deletions(-) create mode 100644 AMESCoreStudio.Web/ViewModels/PCS/PCS040RViewModel.cs create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS040.cshtml create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS040C.cshtml create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS040R.cshtml create mode 100644 AMESCoreStudio.WebApi/DTO/AMES/WipBarcodeOtherDto.cs diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 9619e54c..7632a71d 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1422,6 +1422,9 @@ namespace AMESCoreStudio.Web.Controllers if (result.Success) { + int serialruledetailid = int.Parse(result.Msg.Split(':')[1]); //先取得ID + result.Msg = result.Msg.Split(':')[0]; + StartNO = result.Msg.Split('~')[0]; EndNO = result.Msg.Split('~').Count() == 1 ? result.Msg.Split('~')[0] : result.Msg.Split('~')[1]; @@ -1437,6 +1440,7 @@ namespace AMESCoreStudio.Web.Controllers wipBarcodeOther.EndNO = EndNO; wipBarcodeOther.UpdateDate = DateTime.Now; wipBarcodeOther.UpdateUserID = GetLogInUserID(); + wipBarcodeOther.SerialRuleDetailID = serialruledetailid; await _pcsApi.PutWipBarcodeOther(JsonConvert.SerializeObject(wipBarcodeOther)); } else @@ -1448,6 +1452,7 @@ namespace AMESCoreStudio.Web.Controllers wipBarcodeOther.EndNO = EndNO; wipBarcodeOther.CreateUserID = GetLogInUserID(); wipBarcodeOther.UpdateUserID = GetLogInUserID(); + wipBarcodeOther.SerialRuleDetailID = serialruledetailid; await _pcsApi.PostWipBarcodeOther(JsonConvert.SerializeObject(wipBarcodeOther)); } } @@ -7533,6 +7538,8 @@ namespace AMESCoreStudio.Web.Controllers * 4.若有序號不可入庫 => 畫面顯示不可入之序號 * 5.所有序號可入庫 = > */ + string _msgTmp = string.Empty; + var result1 = new List(); if (factorityID == "1") { @@ -7540,6 +7547,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"GetWareHouseing_EVER {InhouseNo} {seq}
"; result1 = await _pcsApi.GetWareHouseing_EVER(inhouseNo: InhouseNo, seq: seq); } @@ -7558,6 +7566,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"GetBarcodeInfoesByBoxNo_EVER {boxNo}
"; result = await _pcsApi.GetBarcodeInfoesByBoxNo_EVER(boxNo: boxNo); } @@ -7623,6 +7632,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"GetFlowRulesByUnit_EVER W
"; FlowRules_result = await _pcsApi.GetFlowRulesByUnit_EVER("W"); } @@ -7636,6 +7646,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"GetRuleStationByFlowRuleID_EVER {FlowRuleID}
"; ruleStations_result = await GetRuleStationByFlowRuleID_EVER(FlowRuleID); } @@ -7650,6 +7661,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"GetWipInfo_EVER {result.Select(s => s.WipID).First()}
"; Wipinfo_result = await _pcsApi.GetWipInfo_EVER(result.Select(s => s.WipID).First()); } @@ -7661,6 +7673,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"GetWipAtt_EVER {Wipinfo_result.Select(s => s.WipNO).First()} < br>"; WipAtt_result = await _pcsApi.GetWipAtt_EVER(Wipinfo_result.Select(s => s.WipNO).First()); //料號 } var Userinfo_result = new List(); @@ -7670,7 +7683,14 @@ namespace AMESCoreStudio.Web.Controllers } else { - Userinfo_result = await _pcsApi.GetUserInfo_EVER(GetLogInUserID()); + int UserID = GetLogInUserID(); //需用安勤帳號查昶亨的帳號 再轉換成ID + var Userinfo = await _sysApi.GetUserInfo(UserID); + _msgTmp += $"GetUserInfoByUserNo_EVER {Userinfo.Select(s => s.UserNo).FirstOrDefault()} < br>"; + var Userinfo_EVER = await _pcsApi.GetUserInfoByUserNo_EVER(Userinfo.Select(s => s.UserNo).FirstOrDefault()); + if (Userinfo_EVER.UserNo != null ) + _msgTmp += $"GetUserInfo_EVER {Userinfo_EVER.UserID} < br>"; + Userinfo_result = await _pcsApi.GetUserInfo_EVER(Userinfo_EVER.UserID); + } @@ -7682,6 +7702,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"GetFqcInhouseMaster_EVER {InhouseNo} {seq} < br>"; fqcInhouseMaster = await _pcsApi.GetFqcInhouseMaster_EVER(InhouseNo, seq); } fqcInhouseMaster.LocationNo = locationNo; @@ -7694,6 +7715,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"PutFqcInhouseMaster_EVER {JsonConvert.SerializeObject(fqcInhouseMaster)} < br>"; result_FQC = await _pcsApi.PutFqcInhouseMaster_EVER(JsonConvert.SerializeObject(fqcInhouseMaster)); } @@ -7724,8 +7746,17 @@ namespace AMESCoreStudio.Web.Controllers }; + var resultPutBInfo = new ResultModel(); + if (factorityID == "1") + { + resultPutBInfo = await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo)); + } + else + { + _msgTmp += $"PutBarcodeInfoes_EVER {JsonConvert.SerializeObject(barcodeInfo)} < br>"; + resultPutBInfo = await _pcsApi.PutBarcodeInfoes_EVER(JsonConvert.SerializeObject(barcodeInfo)); + } - var resultPutBInfo = await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo)); if (!resultPutBInfo.Success) { _msg = resultPutBInfo.Msg; @@ -7757,7 +7788,16 @@ namespace AMESCoreStudio.Web.Controllers } }; - var resultPoutBStation = await _pcsApi.PostBarcodeStation(JsonConvert.SerializeObject(barcodeStations)); + var resultPoutBStation = new ResultModel(); + if (factorityID == "1") + { + resultPoutBStation = await _pcsApi.PostBarcodeStation(JsonConvert.SerializeObject(barcodeStations)); + } + else + { + _msgTmp += $"PostBarcodeStation_EVER {JsonConvert.SerializeObject(barcodeStations)} < br>"; + resultPoutBStation = await _pcsApi.PostBarcodeStation_EVER(JsonConvert.SerializeObject(barcodeStations)); + } if (!resultPoutBStation.Success) { _msg = resultPoutBStation.Msg; @@ -7800,6 +7840,7 @@ namespace AMESCoreStudio.Web.Controllers } else { + _msgTmp += $"PostWareHouseing_EVER {JsonConvert.SerializeObject(Warehouseing)} < br>"; resultPostWH = await _pcsApi.PostWareHouseing_EVER(JsonConvert.SerializeObject(Warehouseing)); } @@ -7831,18 +7872,18 @@ namespace AMESCoreStudio.Web.Controllers } else { - return new Result() { success = false, msg = _msg }; + return new Result() { success = false, msg = _msg + "1 "+_msgTmp }; } } else { - return new Result() { success = false, msg = _msg }; + return new Result() { success = false, msg = _msg + "2_"+ _msgTmp }; } } catch (Exception ex) { _msg = ex.ToString(); - return new Result() { success = false, msg = _msg }; + return new Result() { success = false, msg = _msg + "3_"+ _msgTmp }; } } @@ -7979,6 +8020,15 @@ namespace AMESCoreStudio.Web.Controllers else { result = await _pcsApi.GetBarcodeInfoesByBoxNoPCS031Q_EVER(boxNo: id, page: page, limit: limit); + + foreach (var item in result.Data) + { + var wipresult = await _pcsApi.GetWipInfoByWipNO_EVER(wipno: item.WipNO); //查對應安勤工單&料號 + + item.WipNO = wipresult.Select(s => s.RelatedWONO).FirstOrDefault(); + + } + } if (result.Data.Count() != 0) { @@ -8943,6 +8993,580 @@ namespace AMESCoreStudio.Web.Controllers } } + + + #region PCS040 工單設定 + public async Task PCS040(string id) + { + if (id != null) + { + await GetFactoryUnit(id); + ViewBag.UnitNo = id; + } + else + { + await GetFactoryUnit(); + } + + //await GetFactoryUnit(); + return View(); + } + + /// + /// PCS040 Query + /// + /// 生產單位 + /// 工單號碼 + /// 料號 + /// + public async Task PCS040QueryAsync(string wipNo, int page = 0, int limit = 10) + { + if (string.IsNullOrEmpty(wipNo)) + { + return Json(new Table() { code = 0, msg = "無資料", data = "", count = 0 }); + } + + + var wipbarcode = await _pcsApi.GetWipBarcodeOther(wipNo); + + string BegnBarcode = string.Empty; + int snLength = 0; + int SerialRuleDetailID = 0; + if (wipbarcode != null) + { + BegnBarcode = wipbarcode.StartNO; + snLength = BegnBarcode.Length; + SerialRuleDetailID = wipbarcode.SerialRuleDetailID; + } + else + { + return Json(new Table() { code = 0, msg = "查不到工單出貨序號區間值", data = "", count = 0 }); + } + + // if (SerialRuleDetailID == null) + // return Json(new Table() { code = 0, msg = "查不到工單出貨序號區間值", data = "", count = 0 }); + // else + { + var SerialRule = await _pcsApi.GetSerialRuleDetail(SerialRuleDetailID); + var result = await _pcsApi.GetWipBarcodeOtherByItemNo(WipNo: wipNo, ItemNo: SerialRule.Select(s=>s.ItemNo).FirstOrDefault()); + //判斷工單已開線 + foreach (var item in result.Data) + { + if (await _pcsApi.GetWipInfoCheckStart(item.WipNo) == "Y") + item.Status = "已投入"; + else if (await _pcsApi.GetWipInfoCheckStartLine(item.WipNo) == "Y") + item.Status = "已開線"; + else + item.Status = "未投產"; + } + result.Data = result.Data.OrderBy(o => o.StartNo); + return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + } + } + + /// + /// PCS040 刪除 + /// + /// 工單號碼 + /// + public async Task PCS040DAsync(string id) + { + //// 判斷工單號碼是否已經投入 + //if (await _pcsApi.GetWipInfoCheckStart(id) == "Y") + //{ + // var _msg = "工單號碼【" + id + "】,工單已開始投入,不可刪除!"; + // return Json(new Result() { success = false, msg = _msg }); + //} + + //// 判斷工單號碼是否已經開線 + //if (await _pcsApi.GetWipInfoCheckStartLine(id) == "Y") + //{ + // var _msg = "工單號碼【" + id + "】,工單已開線,不可刪除!"; + // return Json(new Result() { success = false, msg = _msg }); + //} + var result = await _pcsApi.GetWipBarcodeOther(id); + var result1 = await _pcsApi.GetSerialRuleDetail(result.SerialRuleDetailID); + //判斷工單結束序號流水號號碼 + string GetCoderesult = await GetSerialCode_SerialLen(result1.Select(s => s.Rule).FirstOrDefault()); + int SNStart = int.Parse(GetCoderesult.Split('-')[0]); //流水號開始 + int SNLen = int.Parse(GetCoderesult.Split('-')[1]); //流水號長度 + int EndNO = int.Parse(result.EndNO.Substring(SNStart, SNLen)); + int StartNO = int.Parse(result.StartNO.Substring(SNStart, SNLen)); + //判斷是否有比此工單流水號更大的號碼 + + if (result1.Select(s => s.SnNum).FirstOrDefault() > EndNO) + { + return Json(new Result() { success = false, msg = "工單序號不為目前最大號,請先刪除其他工單" }); + } + else + { + + + SerialRuleDetail model = new SerialRuleDetail + { + SerialRuleDetailID = result1.Select(s => s.SerialRuleDetailID).FirstOrDefault(), + ItemNo = result1.Select(s => s.ItemNo).FirstOrDefault(), + Rule = result1.Select(s => s.Rule).FirstOrDefault(), + YNum = result1.Select(s => s.YNum).FirstOrDefault(), + MNum = result1.Select(s => s.MNum).FirstOrDefault(), + WNum = result1.Select(s => s.WNum).FirstOrDefault(), + LotNum = result1.Select(s => s.LotNum).FirstOrDefault(), + SnNum = StartNO - 1 + }; + var resultPut = await _pcsApi.PutSerialRuleDetail(result1.Select(s => s.SerialRuleDetailID).FirstOrDefault(), JsonConvert.SerializeObject(model)); + + // var resultDelete = await _pcsApi.DeleteWipBarcodeOther(id); + + if (result != null) + { + result.StartNO = " "; + result.EndNO = " "; + result.UpdateDate = DateTime.Now; + result.UpdateUserID = GetLogInUserID(); + + await _pcsApi.PutWipBarcodeOther(JsonConvert.SerializeObject(result)); + } + return Json(new Result() { success = true, msg = "刪除成功" }); + } + + + + } + + [HttpPost] + public async Task PCS040RAsync(PCS040RViewModel model) + { + if (string.IsNullOrWhiteSpace(model.BarcodeNo)) + { + ModelState.AddModelError("error", "請輸入數量"); + return View(model); + } + int NoLength = 4; + int QTY = 0; + bool conversionSuccessful = int.TryParse(model.BarcodeNo, out QTY); + if (!conversionSuccessful) + { + ModelState.AddModelError("error", "請輸入數量"); + return View(model); + } + + + + string Rule = model.WipAtt.ModelNO; + #region 計算流水號位置 + string NewRule = Rule; + //計算流水號位置 + if (Rule.Contains("[YYYY]")) + { + NewRule = NewRule.Replace("[YYYY]", "****"); + } + if (Rule.Contains("[YY]")) + { + NewRule = NewRule.Replace("[YY]", "**"); + } + if (Rule.Contains("WW]")) + { + NewRule = NewRule.Replace("[WW]", "**"); + } + if (Rule.Contains("MM]")) + { + NewRule = NewRule.Replace("[MM]", "**"); + } + if (Rule.Contains("LOT3]")) + { + NewRule = NewRule.Replace("[LOT3]", "***"); + } + if (Rule.Contains("LOT4]")) + { + NewRule = NewRule.Replace("[LOT4]", "****"); + } + if (Rule.Contains("SN4]")) + { + NewRule = NewRule.Replace("[SN4]", "0000"); + } + if (Rule.Contains("SN5]")) + { + NewRule = NewRule.Replace("[SN5]", "00000"); + } + if (Rule.Contains("SN6]")) + { + NewRule = NewRule.Replace("[SN6]", "000000"); + } + if (Rule.Contains("SS]")) + { + NewRule = NewRule.Replace("[SS]", "**"); + } + + int SNStart = NewRule.IndexOf('0'); //流水號開始 + int SNLen = NewRule.Count(c => c == '0'); //流水號長度 + #endregion + + // 流水碼預設長度 + string _msg = string.Empty; + int WipQty = model.WipInfo.PlanQTY; + + string InputStartNo = model.WipBarcodeOther.StartNO.Trim(); + string InputEndNo = model.WipBarcodeOther.EndNO.Trim(); + + + if (InputStartNo.Length <= NoLength || InputEndNo.Length <= NoLength) + { + _msg += "條碼區間號碼長度不能小於" + (NoLength + 1); + ModelState.AddModelError("error", _msg); + return View(model); + } + + + if (InputStartNo.Length != InputEndNo.Length) + { + _msg += "起始條碼與結束條碼字串長度不一致"; + ModelState.AddModelError("error", _msg); + return View(model); + } + + if (InputStartNo.Length != NewRule.Length || InputEndNo.Length != NewRule.Length) + { + _msg += "起始條碼或結束條碼長度與規則: " + Rule + " 長度不一致"; + ModelState.AddModelError("error", _msg); + return View(model); + } + + //if (InputStartNo.Substring(0, InputStartNo.Length - NoLength) != + // InputEndNo.Substring(0, InputEndNo.Length - NoLength)) + //{ + // _msg += "條碼區間前置號碼不一樣"; + // ModelState.AddModelError("error", _msg); + // return View(model); + //} + + + if (!int.TryParse(InputStartNo.Substring(SNStart, SNLen), out _) || + !int.TryParse(InputEndNo.Substring(SNStart, SNLen), out _)) + { + _msg += "條碼區間流水碼格式錯誤"; + ModelState.AddModelError("error", _msg); + return View(model); + } + + // 計算設定條碼區間是否有大於工單數 + int sum = 0; + // 起始流水碼 + int InputStrNoQty = int.Parse(InputStartNo.Substring(SNStart, SNLen)); + // 結束流水碼 + int InputEndNoQty = int.Parse(InputEndNo.Substring(SNStart, SNLen)); + + if (model.Type == "del") + { + InputEndNoQty -= QTY; + } + else if (model.Type == "add") + { + InputEndNoQty += QTY; + } + + // InputEndNo + + + if (InputEndNoQty < InputStrNoQty) + { + _msg += "結束流水碼不可以小於起始流水碼"; + ModelState.AddModelError("error", _msg); + return View(model); + } + string EndNO = model.WipBarcodeOther.EndNO.Substring(0, SNStart) + InputEndNoQty.ToString().PadLeft(SNLen, '0') + model.WipBarcodeOther.EndNO.Substring(SNStart + SNLen); + //判斷結束序號是否有重覆在其他區間 + var CheckRepeat = await CheckWipBarcodeOtherRepeat(model.WipInfo.WipNO,model.SerialRuleItem,model.WipBarcodeOther.StartNO,EndNO, SNStart , SNLen); + if (!CheckRepeat.Success) + { + _msg = CheckRepeat.Msg; + // ModelState.AddModelError("error", CheckRepeat.Msg); + + } + else + { + // 判斷是否需要同步更新 + var result1 = await _pcsApi.GetSerialRuleDetail(model.WipBarcodeOther.SerialRuleDetailID); + //判斷工單結束序號流水號號碼 + int modelEndNO = int.Parse(model.WipBarcodeOther.EndNO.Substring(SNStart, SNLen)); + + //判斷是否有比此工單流水號更大的號碼 + + if (result1.Select(s => s.SnNum).FirstOrDefault() <= modelEndNO) + { + + SerialRuleDetail model1 = new SerialRuleDetail + { + SerialRuleDetailID = result1.Select(s => s.SerialRuleDetailID).FirstOrDefault(), + ItemNo = result1.Select(s => s.ItemNo).FirstOrDefault(), + Rule = result1.Select(s => s.Rule).FirstOrDefault(), + YNum = result1.Select(s => s.YNum).FirstOrDefault(), + MNum = result1.Select(s => s.MNum).FirstOrDefault(), + WNum = result1.Select(s => s.WNum).FirstOrDefault(), + LotNum = result1.Select(s => s.LotNum).FirstOrDefault(), + SnNum = InputEndNoQty + }; + var resultPut = await _pcsApi.PutSerialRuleDetail(result1.Select(s => s.SerialRuleDetailID).FirstOrDefault(), JsonConvert.SerializeObject(model1)); + } + + //if (WipQty < (InputEndNoQty - InputStrNoQty + 1)) + //// if (WipQty < sum + (InputEndNoQty - InputStrNoQty + 1)) + //{ + // _msg += "工單號碼【" + model.WipInfo.WipNO + "】 設定條碼區間數量已超過工單數量,請確認!"; + // ModelState.AddModelError("error", _msg); + // return View(model); + //} + + IResultModel result; + model.WipBarcodeOther.WipNO = model.WipInfo.WipNO; + model.WipBarcodeOther.CreateUserID = GetLogInUserID(); + model.WipBarcodeOther.EndNO = EndNO; + + //model.WipBarcode.WipID = model.WipInfo.WipID; + //model.WipBarcode.UnitNO = model.WipInfo.UnitNO; + + result = await _pcsApi.PutWipBarcodeOther(JsonConvert.SerializeObject(model.WipBarcodeOther)); + + if (result.Success) + { + _msg = "修改成功!"; + // return RedirectToAction("PCS040", "PCS", new { wipNo = model.WipInfo.WipNO, msg = _msg }); + return RedirectToAction("Refresh", "Home", new { wipNo = model.WipInfo.WipNO, msg = _msg }); + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + return Json(new Result() { success = true, msg = _msg }); + } + else + { + _msg = result.Msg; + ModelState.AddModelError("error", result.Msg); + //if (result.Errors.Count > 0) + //{ + // ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + //} + //else + //{ + // ModelState.AddModelError("error", result.Msg); + //} + } + } + + return RedirectToAction("Refresh", "Home", new { wipNo = model.WipInfo.WipNO, msg = _msg }); + // return RedirectToAction("PCS040R", "PCS", new { id = model.WipInfo.WipID, msg = _msg }); + // return RedirectToAction("Refresh", "Home", new { wipNo = model.WipInfo.WipNO, msg = _msg }); + } + + public async Task PCS040R(string id, string rule,string serialRuleitem, string msg = null) + { + ViewBag.Msg = msg; + + PCS040RViewModel model = new PCS040RViewModel(); + var q = await _pcsApi.GetWipInfoByWipNO(id); + if (q.Count != 0) + { + model.WipInfo = q.FirstOrDefault(); + model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); + model.WipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.WipInfo.WipNO); + model.WipAtt.ModelNO = rule; + model.SerialRuleItem = serialRuleitem; + + //model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence); + } + return View(model); + } + + public async Task PCS040CSave(PCS040RViewModel model) + { + string _msg; + if (string.IsNullOrWhiteSpace(model.LotNo)) + { + model.LotNo = model.WipInfo.WerksNO.Substring(2, 2).ToUpper(); + } + + var result = await GetBarcodeOther(model.WipAtt.ItemNO, model.LotNo, model.WipInfo.PlanQTY, model.WipInfo.WipNO, model.WipInfo.WipScheduleDate.ToString("yyyy-MM-dd")); + + + //if (result.Success) + //{ + _msg = "產生成功!"; + // return RedirectToAction("PCS040R", "PCS", new { id = model.WipInfo.WipID, msg = _msg }); + //} + //else + //{ + // _msg = result.Msg; + // ModelState.AddModelError("error", result.Msg); + + //} + + + // return RedirectToAction("PCS040C", "PCS", new { id = model.WipInfo.WipID, msg = _msg }); + return RedirectToAction("Refresh", "Home", new { id = model.WipInfo.WipNO, msg = _msg }); + } + + public async Task PCS040C(string id, string rule, string serialRuleitem, string msg = null) + { + ViewBag.Msg = msg; + + PCS040RViewModel model = new PCS040RViewModel(); + var q = await _pcsApi.GetWipInfoByWipNO(id); + if (q.Count != 0) + { + model.WipInfo = q.FirstOrDefault(); + model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); + // model.WipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.WipInfo.WipNO); + model.WipAtt.ModelNO = rule; + model.SerialRuleItem = serialRuleitem; + + //model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence); + } + return View(model); + } + + public async Task> CheckWipBarcodeOtherRepeat(string Wip_NO,string ItemNO,string WipStartNO,string WipEndNO, int StartSN, int SNLen) + { + var resultGetWipBarcode = await _pcsApi.GetWipBarcodeOtherByItemNo(WipNo: Wip_NO, ItemNo: ItemNO); + // var result_Wip_NO = resultGetWipBarcode.Data.Where(w => w.WipNo == Wip_NO).FirstOrDefault(); + ResultModel result = new ResultModel(); + + + if (resultGetWipBarcode.DataTotal > 0) + { + + foreach (var item in resultGetWipBarcode.Data) + { + if (item.WipNo != Wip_NO && item.StartNo.Length > 4) + { + SerialRange range1 = ParseSerialRange(WipStartNO, WipEndNO, StartSN, SNLen); + SerialRange range2 = ParseSerialRange(item.StartNo, item.EndNo, StartSN, SNLen); + + if (range1.Prefix == range2.Prefix && range1.Serial == range2.Serial) + { + // 判斷兩個序號區間是否有重疊 + bool isNotOverlapping = ( + // range1.EndNumber >= range2.StartNumber || + // range2.EndNumber >= range1.StartNumber + range1.EndNumber < range2.StartNumber || + range2.EndNumber < range1.StartNumber + ); + + if (isNotOverlapping) + { + // MessageBox.Show("兩個區間沒有重疊。"); + } + else + { + result.Success = false; + result.Msg = "出貨序號區間已與工單 " + item.WipNo + " 重覆,請先刪除重覆工單"; + return result; + } + + } + } + } + result.Success = true; + result.Msg = "OK"; + + return result; + } + else + { + result.Success = true; + result.Msg = "OK"; + + return result; + } + } + public SerialRange ParseSerialRange(string startSerial, string endSerial, int StartSN, int SNLen) + { + // StartSN 流水號起始位置 + // EndSN 流水號結束位置 + + // string[] parts = SN.Split('~'); + // string startSerial = parts[0]; + // string endSerial = parts[1]; + + string prefix = startSerial.Substring(0, startSerial.Length - StartSN +1); + int startNumber = int.Parse(startSerial.Substring(startSerial.Length - StartSN +1, SNLen)); + int endNumber = int.Parse(endSerial.Substring(endSerial.Length - StartSN +1, SNLen)); + string serial = ""; + if (startSerial.Length != StartSN + SNLen) + startSerial.Substring(StartSN + SNLen ,startSerial.Length - StartSN - SNLen); + + return new SerialRange + { + Prefix = prefix, + StartNumber = startNumber, + EndNumber = endNumber, + Serial = serial + }; + } + + public class SerialRange + { + public string Prefix { get; set; } + public int StartNumber { get; set; } + public int EndNumber { get; set; } + public string Serial { get; set; } + } + + /// + /// 判斷出貨序號規則的流水號起始位置&流水號碼長 + /// + public async Task GetSerialCode_SerialLen(string Rule) + { + + + //計算流水號位置 + if (Rule.Contains("[YYYY]")) + { + Rule = Rule.Replace("[YYYY]", "****"); + } + if (Rule.Contains("[YY]")) + { + Rule = Rule.Replace("[YY]", "**"); + } + if (Rule.Contains("WW]")) + { + Rule = Rule.Replace("[WW]", "**"); + } + if (Rule.Contains("MM]")) + { + Rule = Rule.Replace("[MM]", "**"); + } + if (Rule.Contains("LOT3]")) + { + Rule = Rule.Replace("[LOT3]", "***"); + } + if (Rule.Contains("LOT4]")) + { + Rule = Rule.Replace("[LOT4]", "****"); + } + if (Rule.Contains("SN4]")) + { + Rule = Rule.Replace("[SN4]", "0000"); + } + if (Rule.Contains("SN5]")) + { + Rule = Rule.Replace("[SN5]", "00000"); + } + if (Rule.Contains("SN6]")) + { + Rule = Rule.Replace("[SN6]", "000000"); + } + if (Rule.Contains("SS]")) + { + Rule = Rule.Replace("[SS]", "**"); + } + + int SNStart = Rule.IndexOf('0'); //流水號開始 + int SNLen = Rule.Count(c => c == '0'); //流水號長度 + return SNStart.ToString() + "-" + SNLen.ToString(); + + } + + + + + #endregion + #endregion } diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index b1459653..183b0e5f 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -1677,8 +1677,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpPost("http://192.168.4.109:5088/api/WareHouseing")] - ITask> PostWareHouseing_EVER([FromBody, RawJsonContent] string model); - + ITask> PostWareHouseing_EVER([FromBody, RawJsonContent] string model); /// /// FQC抽驗資料 /// @@ -1738,10 +1737,54 @@ namespace AMESCoreStudio.Web ITask> GetWipInfoByWipNO_EVER(string wipno); + [WebApiClient.Attributes.HttpPut("http://192.168.4.109:5088/api/BarcodeInfoes")] + ITask> PutBarcodeInfoes_EVER([FromBody, RawJsonContent] string model); + + [WebApiClient.Attributes.HttpPost("http://192.168.4.109:5088/api/BarcodeStation")] + ITask> PostBarcodeStation_EVER([FromBody, RawJsonContent] string model); + /// + /// 用UserNo 查詢 + /// + /// UserNo + /// + [WebApiClient.Attributes.HttpGet("http://192.168.4.109:5088/api/UserInfoes/ByUserNo/{id}")] + ITask GetUserInfoByUserNo_EVER(string id); + + //YIRU End ---------------------------------------------------------------------------------------- #endregion + #region PCS040 出貨序號重取 + [WebApiClient.Attributes.HttpGet("api/WipBarcodeOther/WipBarcodeOtherByItemNo")] + ITask> GetWipBarcodeOtherByItemNo(string WipNo, string ItemNo); + + /// + /// + /// + /// + /// + [WebApiClient.Attributes.HttpGet("api/SerialRules/ByItemNo/{id}")] + ITask> GetSerialRuleByItemNo(string id); + + /// + /// 查詢SerialRuleDetail + /// + /// 編號 + /// + [WebApiClient.Attributes.HttpGet("api/SerialRuleDetails/{id}")] + ITask> GetSerialRuleDetail(int id); + + + /// + /// 查詢SerialRuleDetail + /// + /// 編號 + /// + [WebApiClient.Attributes.HttpPut("api/SerialRuleDetails/{id}")] + ITask> PutSerialRuleDetail(int id, [FromBody, RawJsonContent] string model); + #endregion + #region OutfitInfoes 設備資料檔 /// diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS040RViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS040RViewModel.cs new file mode 100644 index 00000000..9b99f841 --- /dev/null +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS040RViewModel.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.Models.BAS; + +namespace AMESCoreStudio.Web.ViewModels.PCS +{ + public class PCS040RViewModel + { + public WipInfo WipInfo { get; set; } + + public WipAtt WipAtt { get; set; } + + public WipBarcode WipBarcode { get; set; } + + public WipBarcodeOther WipBarcodeOther { get; set; } + + public IEnumerable WipBarcodes { get; set; } + + public IEnumerable RuleStation { get; set; } + + public IEnumerable WipBarcodeOthers { get; set; } + + // 序號綁定 Type SN:內部序號 SSN:出貨序號 + public string Type { get; set; } + + // 內部條碼綁定類型 Type1 LIMIT:設定區間 SOLO:單一條碼 + public string Type1 { get; set; } + + // 綁定條碼 + public string BarcodeNo { get; set; } + + /// + /// 序號規則使用的item + /// + public string SerialRuleItem { get; set; } + + public string LotNo { get; set; } + } +} diff --git a/AMESCoreStudio.Web/Views/PCS/PCS040.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS040.cshtml new file mode 100644 index 00000000..88b4e357 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS040.cshtml @@ -0,0 +1,212 @@ + +@{ + ViewData["Title"] = "出貨序號重取"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} +@using Microsoft.AspNetCore.Mvc.Localization +@inject IHtmlLocalizer sharedLocalizer + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+ + + +
+
+
+
+
+
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS040C.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS040C.cshtml new file mode 100644 index 00000000..79b7514f --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS040C.cshtml @@ -0,0 +1,91 @@ +@model AMESCoreStudio.Web.ViewModels.PCS.PCS040RViewModel + + +@{ + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + +
+
+
+ + + + + + + + + + + + + + +
+ 出貨序號資料 +
+
+
+ +
+ +
+
-
+
+ +
+
+ +
+ +
+ +
+
+
+
+ + +
+ + @Html.ValidationMessage("error") +
+
+ +
+
+ +
+
+ +@section Scripts { + + + +} + diff --git a/AMESCoreStudio.Web/Views/PCS/PCS040R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS040R.cshtml new file mode 100644 index 00000000..b25e21d2 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS040R.cshtml @@ -0,0 +1,116 @@ +@model AMESCoreStudio.Web.ViewModels.PCS.PCS040RViewModel + + +@{ + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + +
+
+
+ + + + + + + + + + +
+ 出貨序號資料 +
+
+ +
+ + @**@ +
+ +
+ + @**@ +
+
+
+ +
+ +
+ + +
+ + + +
+ +
+ + + +
+
+ + @Html.ValidationMessage("error") +
+ +
+
+
+ +@section Scripts { + + + +} + diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs index d60830bf..acdc740d 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs @@ -628,8 +628,122 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + /// + /// FQC查詢 by 安勤 + /// + /// 內部序號 + /// 工單號碼 + /// 外箱號碼 + /// 入庫單號碼 + /// 入庫時間起 + /// 入庫時間迄 + /// 是否已入庫Y/N/ALL + /// 頁數 + /// 筆數 + /// + [HttpGet("FqcInhouseMasterMultiQuery_Avalue")] + public async Task> GetFqcInhouseMasteMultiQuery_Avalue(string barcodeNo, string wipNo, string boxNo + , string inhouseNo, string date_str, string date_end, string status, int page = 0, int limit = 10) + { + + IQueryable q = from q1 in _context.FqcInhouseMasters + join q2 in _context.FqcInhouseDetails on new { q1.InhouseNo, q1.SeqID } equals new { q2.InhouseNo, q2.SeqID } + join q3 in _context.FqcResultMasters on q1.InhouseNo equals q3.InhouseNo + join q4 in _context.WareHouseings on new { q2.InhouseNo, q2.SeqID, q2.SerialNo } equals new { q4.InhouseNo, q4.SeqID, q4.SerialNo } into q2q4 + from q402 in q2q4.DefaultIfEmpty() + select new FqcInhouseMaster_WareDto + { + InhouseNo = q1.InhouseNo, + SeqID = q1.SeqID, + WipNo = q1.WipNo, + ItemNo = q1.ItemNo, + ModelNo = q1.ModelNo, + SerialNo = q2.SerialNo, + StatusName = q1.Status, + ProTypeName = q1.ProType, + CreateDate = q1.CreateDate, + EndTime = q3.EndTime, + RecordNumber = q402.RecordNumber, + RecordDate = q402.Create_Date, + LocationNo = q1.LocationNo, + }; + //q1.Status == "P" ? "允收" : q1.Status == "R" ? "批退" : "未驗收完成", + //IQueryable q1 = _context.FqcInhouseDetails; + if (!string.IsNullOrWhiteSpace(inhouseNo)) + q = q.Where(w => w.RecordNumber == inhouseNo); + + if (!string.IsNullOrWhiteSpace(wipNo)) + { + var wip_NOresult = _context.WipInfos.Where(w => w.RelatedWONO == wipNo); //先抓安勤的工單 再查昶享的工單 + q = q.Where(w => wip_NOresult.Any(a => a.WipNO == w.WipNo)); + + } + + if (!string.IsNullOrWhiteSpace(status) || status != "ALL") + // q = q.Where(w => w.StatusName == status); + { + if (status == "N") + q = q.Where(w => w.RecordNumber == null); + else if (status == "Y") + q = q.Where(w => w.RecordNumber != null); + } + // 優先用內部序號取出包裝序號 + if (!string.IsNullOrWhiteSpace(barcodeNo)) + { + BarcodeInfoesController barcodeInfoesController = new BarcodeInfoesController(_context); + var q1 = await barcodeInfoesController.GetBarcodeInfoesByNo(barcodeNo); + if (q1.Value.Count() != 0) + { + boxNo = q1.Value.FirstOrDefault().BoxNo; + } + } + + if (!string.IsNullOrWhiteSpace(boxNo)) + { + q = q.Where(w => w.SerialNo == boxNo); + } + + if (DateTime.TryParse(date_str, out _)) + { + q = q.Where(w => w.RecordDate >= DateTime.Parse(date_str)); + } + + if (DateTime.TryParse(date_end, out _)) + { + q = q.Where(w => w.RecordDate <= DateTime.Parse(date_end)); + } + q = q.Where(w => w.StatusName == "P"); + q = q.Where(w => w.ItemNo.StartsWith("EV")); + ResultModel result = new ResultModel(); + + // 紀錄筆數 + result.DataTotal = q.Count(); + + // Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit); + } + result.Data = await q.ToListAsync(); + + + + + // 判斷結束時間 + result.Data = result.Data.Select(s => { s.EndTime = s.StatusName == "A" ? null : s.EndTime; return s; }) + .ToList(); + + // 修改狀態名稱 + result.Data = result.Data.Select(s => { s.StatusName = s.StatusName == "P" ? "允收" : s.StatusName == "R" ? "批退" : "未驗收完成"; return s; }) + .ToList(); + + result.Data = result.Data.Select(s => { s.BoxQty = _context.BarcodeInfoes.Where(w => w.BoxNo == s.SerialNo).Count().ToString(); return s; }).ToList(); + + return result; + } + //YIRU End ----------------------------------------------------------------------------------------------------------------------------------------------- private bool FqcInhouseMasterExists(string id) diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SerialRulesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SerialRulesController.cs index 0319c043..9658b1ed 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/SerialRulesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SerialRulesController.cs @@ -889,7 +889,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { await _context.SaveChangesAsync(); result.Success = true; - result.Msg = serial; + result.Msg = serial+ ":"+ SerialRuleDetail.SerialRuleDetailID.ToString(); } catch (Exception ex) diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs index ee3d6db1..355f3677 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs @@ -88,6 +88,63 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return wipBarcodeOther; } + /// + /// + /// + /// + /// + /// + [HttpGet("WipBarcodeOtherByItemNo")] + public async Task> GetWipBarcodeOtherByItemNo(string WipNo,string ItemNo) + { + var SerialRule = _context.SerialRuleDetails.Where(W => W.ItemNo == ItemNo) ;//.Select(s =>s.SerialRuleDetailID.ToString()).ToList(); + + var wipBarcodeOther = _context.WipBarcodeOthers.Where(W => W.WipNO == WipNo); + + //查工單預計開工日 + var wipinfo = _context.WipInfos.Where(w => w.WipNO == WipNo).OrderBy(o => o.WipScheduleDate).Select(s => s.WipScheduleDate).FirstOrDefault(); + + var q = from O in _context.WipBarcodeOthers + join W in _context.WipInfos.Where(w => w.WipScheduleDate >= wipinfo) on O.WipNO equals W.WipNO + join A in _context.WipAtts on O.WipNO equals A.WipNO + join D in _context.SerialRuleDetails on O.SerialRuleDetailID equals D.SerialRuleDetailID + where D.Rule == SerialRule.Select(s=>s.Rule).FirstOrDefault() + + select new WipBarcodeOtherDto + { + WipNo = O.WipNO, + ItemNo = A.ItemNO, + PlanQTY = W.PlanQTY, + StartNo = O.StartNO, + EndNo = O.EndNO, + CreateDate = O.CreateDate, + Rule = D.Rule, + ItemRule = D.ItemNo, + WipScheduleDate = W.WipScheduleDate, + SerialRuleDetailID = O.SerialRuleDetailID + + }; + + q = q.Distinct().OrderBy(o => o.CreateDate); + + + + + ResultModel result = new ResultModel(); + + result.Data = await q.ToListAsync(); + + // result.Data = result.Data.Select(s => { s.Status = s.Status == "Y" ? "已投產" : s.Status == "N" ? "未投產" : "末知"; return s; }) + // .ToList(); + result.DataTotal = result.Data.Count(); + + // 紀錄筆數 + + + + return result; + } + /// /// 新增工單出貨條碼區間設定檔 /// diff --git a/AMESCoreStudio.WebApi/DTO/AMES/WipBarcodeOtherDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/WipBarcodeOtherDto.cs new file mode 100644 index 00000000..fbfff30d --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/WipBarcodeOtherDto.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// + /// 條碼資料 DTO + /// + + public class WipBarcodeOtherDto + { + + /// + /// 工單 + /// + public string WipNo { get; set; } + + + /// + /// 料號 + /// + public string ItemNo { get; set; } + + + /// + /// 計畫產量 已投產/未投產 + /// + public int PlanQTY { get; set; } + /// + /// 預計開工日 + /// + public DateTime WipScheduleDate { get; set; } + + /// + /// 狀態已投產/未投產 + /// + public string Status { get; set; } + + /// + /// 規則 + /// + public string Rule { get; set; } + + /// + /// 規則ITEM + /// + public string ItemRule { get; set; } + + /// + ///出貨序號起 + /// + public string StartNo { get; set; } + + /// + /// 出貨序號迄 + /// + + public string EndNo { get; set; } + + /// + /// 出貨序號建立日期 + /// + public DateTime CreateDate { get; set; } + + /// + /// 工單廠別 + /// + public string Werks { get; set; } + + /// + /// 廠別NO + /// + public string FactoryNo { get; set; } + + public int? SerialRuleDetailID { get; set; } + + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseDetail.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseDetail.cs index 5f2f8ee9..a1296d95 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseDetail.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseDetail.cs @@ -26,7 +26,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "入庫單號碼")] [Required] [Column("INHOUSE_NO")] - [StringLength(13)] + [StringLength(20)] public string InhouseNo { get; set; } /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseMaster.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseMaster.cs index 1601f0d6..0eb5c106 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseMaster.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseMaster.cs @@ -28,7 +28,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "入庫單號碼")] [Required(ErrorMessage = "{0},不能空白")] [Column("INHOUSE_NO")] - [StringLength(15)] + [StringLength(20)] public string InhouseNo { get; set; } /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcResultMaster.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcResultMaster.cs index 62271d60..fbf60329 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/FqcResultMaster.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/FqcResultMaster.cs @@ -32,7 +32,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "入庫單號碼")] [Required(ErrorMessage = "{0},不能空白")] [Column("INHOUSE_NO")] - [StringLength(15)] + [StringLength(20)] public string InhouseNo { get; set; } /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/WareHouseing.cs b/AMESCoreStudio.WebApi/Models/AMES/WareHouseing.cs index a27c4858..6363cf23 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WareHouseing.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WareHouseing.cs @@ -20,7 +20,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "入庫單號碼")] [Required] [Column("INHOUSE_NO")] - [StringLength(13)] + [StringLength(20)] public string InhouseNo { get; set; } /// @@ -66,7 +66,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Column("CREATE_USERID")] [DataMember] [Display(Name = "建立者")] - public decimal Create_UserID { get; set; } + public int Create_UserID { get; set; } /// @@ -91,7 +91,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Column("RECORD_DATE")] [DataMember] [Display(Name = "RECORDDATE")] - public DateTime Record_Date { get; set; } + public DateTime Record_Date { get; set; } = DateTime.Now; } } diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipBarcodeOther.cs b/AMESCoreStudio.WebApi/Models/AMES/WipBarcodeOther.cs index 45824720..249b1868 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipBarcodeOther.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipBarcodeOther.cs @@ -34,8 +34,8 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// [Column("START_NO")] [DataMember] - [Required(ErrorMessage = "{0},不能空白")] - [Display(Name = "開始條碼")] + // [Required(ErrorMessage = "{0},不能空白")] + [Display(Name = "開始條碼")] public string StartNO { get; set; } /// @@ -43,7 +43,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// [Column("END_NO")] [DataMember] - [Required(ErrorMessage = "{0},不能空白")] + // [Required(ErrorMessage = "{0},不能空白")] [Display(Name = "結束條碼")] public string EndNO { get; set; } @@ -96,5 +96,13 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "更新者ID")] public int UpdateUserID { get; set; } = 0; + /// + /// 更新者ID + /// + [Column("SERIAL_RULE_DETAIL_ID")] + [DataMember] + [Display(Name = "規則明細ID")] + public int SerialRuleDetailID { get; set; } = 0; + } }