From f15fc03ca32b86960eb03a5b6ce07da2f63fa47d Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 19 Apr 2022 11:38:12 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E9=81=8E=E7=AB=99?= =?UTF-8?q?=E5=B7=B2=E5=88=B7=E6=95=B8=E9=87=8F=E5=88=A4=E6=96=B7=EF=BC=8C?= =?UTF-8?q?=E6=B2=BB=E5=85=B7=E8=B3=87=E6=96=99=E6=94=B9=E6=8A=93WIP?= =?UTF-8?q?=E6=B2=BB=E5=85=B7=EF=BC=8C=E6=8C=96=E7=95=B0=E5=B8=B8=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E6=AC=84=E4=BD=8D=202.=20=E9=81=8E=E7=AB=99=E5=88=A4?= =?UTF-8?q?=E6=96=B7=E5=8A=A0=E5=85=A5=E6=B2=BB=E5=85=B7=E3=80=81=E7=87=92?= =?UTF-8?q?=E6=A9=9F=E5=88=A4=E6=96=B7=203.=20=E5=B7=A5=E5=96=AE=E8=B3=87?= =?UTF-8?q?=E6=96=99=E4=BF=AE=E6=AD=A3=20KeyParts=E3=80=81=E6=B2=BB?= =?UTF-8?q?=E5=85=B7=E3=80=81SOP=E6=96=87=E4=BB=B6=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=88=AA=E9=99=A4bug=204.=20=E5=B7=A5=E5=96=AE=E8=B3=87?= =?UTF-8?q?=E6=96=99=E6=B2=BB=E5=85=B7=20=E5=8A=A0=E5=85=A5=E4=BD=9C?= =?UTF-8?q?=E6=A5=AD=E7=AB=99=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 169 ++++++++++-- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 13 + .../ViewModels/PCS/PCS021ViewModel.cs | 28 +- AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml | 30 ++- AMESCoreStudio.Web/Views/PCS/PCS003.cshtml | 106 ++++++-- AMESCoreStudio.Web/Views/PCS/PCS021.cshtml | 72 +++-- .../AMES/BarcodeItemsController.cs | 28 +- .../AMES/BarcodeOutfitController.cs | 5 +- .../AMES/BarcodeStationController.cs | 4 +- .../Controllers/AMES/BurnInfoeController.cs | 133 ++++++++++ .../AMES/OutfitInfoesController.cs | 17 +- .../AMES/WipBarcodeOthersController.cs | 4 +- .../Controllers/AMES/WipBoardController.cs | 34 ++- .../Controllers/AMES/WipOutfitController.cs | 12 +- .../Controllers/AMES/WipSystemController.cs | 31 +++ .../Controllers/BLL/BarCodeCheckController.cs | 249 ++++++++++++++---- .../DTO/AMES/WipOutfitDto.cs | 18 ++ .../Models/AMES/BarcodeOutfit.cs | 14 +- AMESCoreStudio.WebApi/Models/AMES/BurnInfo.cs | 145 ++++++++++ AMESCoreStudio.WebApi/Models/AMES/WipKp.cs | 1 - .../Models/AMES/WipOutfit.cs | 7 + AMESCoreStudio.WebApi/Models/AMESContext.cs | 6 +- 22 files changed, 960 insertions(+), 166 deletions(-) create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/BurnInfoeController.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/BurnInfo.cs diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 057cbe0a..c9558b12 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -940,6 +940,33 @@ namespace AMESCoreStudio.Web.Controllers return Json(new { data = FactoryUnit }); } + /// + /// 生產單位 Json By WipNp + /// + /// + [HttpPost] + public async Task GetFactoryUnitByWipNoJson(string wipNo) + { + var result = await _basApi.GetFactoryUnits(); + var result_wipNo = await _pcsApi.GetWipInfoByWipNO(wipNo); + + result = result.Where(w => result_wipNo.Select(s => s.UnitNO).Contains(w.UnitNo)).ToList(); + var Item = new List(); + for (int i = 0; i < result.Count; i++) + { + Item.Add(new SelectListItem(result[i].UnitName, result[i].UnitNo.ToString())); + } + + if (Item.Count == 0) + { + Item.Add(new SelectListItem("N/A", null)); + } + + ViewBag.FactoryUnitByWipNo = Item; + //将数据Json化并传到前台视图 + return Json(new { data = Item }); + } + [HttpPost] public async Task GetStationsJson(string unit_no) { @@ -1075,6 +1102,28 @@ namespace AMESCoreStudio.Web.Controllers return Json(new { data = item }); } + /// + /// 治具種類 + /// + /// + [HttpPost] + public async Task GetOutfitCommodityInfoJson() + { + var result = await _pcsApi.GetOutfitCommodityInfo(); + + var item = new List(); + //item.Add(new SelectListItem("全部", "0")); + result = result.Where(w => w.Status == "A").ToList(); + for (int i = 0; i < result.Count; i++) + { + item.Add(new SelectListItem(result[i].CommodityName, result[i].CommodityNo)); + } + + ViewBag.OutfitCommodityInfo = item; + //将数据Json化并传到前台视图 + return Json(new { data = item }); + } + /// /// 回傳料號流程_備註 /// @@ -1122,6 +1171,48 @@ namespace AMESCoreStudio.Web.Controllers } return Json(new { data = 0 }); } + + /// + /// 用工單號碼查詢綁定作業站 + /// + /// RuleStation + [HttpPost] + public async Task GetRuleStationByWipNoUnitNoJson(string wipNo) + { + + var result_wipNo = await _pcsApi.GetWipInfoByWipNO(wipNo); + + var items = new List(); + var flowRuleIDs = result_wipNo.Select(s => s.FlowRuleID).Distinct(); + items.Add(new SelectListItem("N/A", null)); + + + foreach (var flowRuleID in flowRuleIDs) + { + var group = new SelectListGroup + { + Name = result_wipNo.Where(w => w.FlowRuleID == flowRuleID) + .FirstOrDefault().GetFactoryUnit.UnitName + }; + var result = await _pcsApi.GetRuleStationByFlow(flowRuleID); + + for (int i = 0; i < result.Count; i++) + { + items.Add(new SelectListItem() + { + Text = result[i].StationDesc, + Value = result[i].RuleStationID.ToString(), + Group = group + }); + } + } + + // 排除完工站 + items = items.Where(w => w.Value != "1000").ToList(); + + ViewBag.RuleStationByWipNoUnitNoList = items; + return Json(new { data = items }); + } #endregion [ResponseCache(Duration = 0)] @@ -1610,6 +1701,9 @@ namespace AMESCoreStudio.Web.Controllers await GetMFGType(); await GetProcessTypes(); await GetMaterialFlowRuleJson(model.wipAtt.ItemNO, model.wipInfo.UnitNO); + await GetOutfitCommodityInfoJson(); + await GetFactoryUnitByWipNoJson(model.wipInfo.WipNO); + await GetRuleStationByWipNoUnitNoJson(model.wipInfo.WipNO); GetWipSEQType(); GetBurnType(); GetPartsBakeType(); @@ -1707,6 +1801,9 @@ namespace AMESCoreStudio.Web.Controllers await GetMFGType(); await GetProcessTypes(); await GetMaterialFlowRuleJson(model.wipAtt.ItemNO, model.wipInfo.UnitNO); + await GetOutfitCommodityInfoJson(); + await GetFactoryUnitByWipNoJson(model.wipInfo.WipNO); + await GetRuleStationByWipNoUnitNoJson(model.wipInfo.WipNO); GetWipSEQType(); GetBurnType(); GetPartsBakeType(); @@ -1730,6 +1827,8 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS003Async(WipDataViewModel model, string action, IFormFile formFile) { + + #region 選單 await GetItemsList(); await GetProductType(); @@ -1739,6 +1838,10 @@ namespace AMESCoreStudio.Web.Controllers await GetMFGType(); await GetProcessTypes(); await GetFlowRuleList(); + await GetFactoryUnitByWipNoJson(model.wipInfo.WipNO); + await GetMaterialFlowRuleJson(model.wipAtt.ItemNO, model.wipInfo.UnitNO); + await GetOutfitCommodityInfoJson(); + await GetRuleStationByWipNoUnitNoJson(model.wipInfo.WipNO); GetWipSEQType(); GetBurnType(); GetPartsBakeType(); @@ -1821,6 +1924,23 @@ namespace AMESCoreStudio.Web.Controllers return View("PCS003", model); } + // 判斷治具中生產單位與作業站吻合 + var result_wipNo = await _pcsApi.GetWipInfoByWipNO(model.wipInfo.WipNO); + foreach (var item in result_wipNo) + { + foreach (var Outfits in model.WipOutfits.Where(w => w.RuleStationID != null && w.UnitNo == item.UnitNO)) + { + var RuleStation = await _pcsApi.GetRuleStationByFlow(item.FlowRuleID); + + if (!RuleStation.Where(w => Outfits.RuleStationID == w.RuleStationID).Any()) + { + ModelState.AddModelError("error", "治具組合中生產單位與作業站不匹配"); + return View("PCS003", model); + } + + } + } + result = await _pcsApi.PutWipInfo(JsonConvert.SerializeObject(model.wipInfo)); if (result.Success) { @@ -1938,7 +2058,7 @@ namespace AMESCoreStudio.Web.Controllers { await _pcsApi.DeleteWipKp(id); } - foreach (var item in model.WipKps) + foreach (var item in model.WipKps.Where(w => w.WipKpID != -1)) { item.WipNo = model.wipInfo.WipNO; item.ItemNo = model.wipAtt.ItemNO; @@ -1956,7 +2076,7 @@ namespace AMESCoreStudio.Web.Controllers { await _pcsApi.DeleteWipOutfit(id); } - foreach (var item in model.WipOutfits) + foreach (var item in model.WipOutfits.Where(w => w.WipOutfitID != -1)) { item.WipNo = model.wipInfo.WipNO; item.ItemNo = model.wipAtt.ItemNO; @@ -1974,7 +2094,7 @@ namespace AMESCoreStudio.Web.Controllers { await _pcsApi.DeleteWipSop(id); } - foreach (var item in model.WipSops) + foreach (var item in model.WipSops.Where(w => w.WipSOPID != -1)) { item.WipNo = model.wipInfo.WipNO; item.ItemNo = model.wipAtt.ItemNO; @@ -2119,8 +2239,8 @@ namespace AMESCoreStudio.Web.Controllers var x = new { - mix = Entire.DecHex(Mix.ToString(), "DecToHex").ToUpper(), - max = Entire.DecHex(Max.ToString(), "DecToHex").ToUpper(), + mix = q.Title + Entire.DecHex(Mix.ToString(), "DecToHex").ToUpper(), + max = q.Title + Entire.DecHex(Max.ToString(), "DecToHex").ToUpper(), }; return Json(x); } @@ -3312,6 +3432,7 @@ namespace AMESCoreStudio.Web.Controllers model.UnitNO = q.FirstOrDefault().UnitNO; model.FlowRuleID = q.FirstOrDefault().FlowRuleID; model.ItemNO = (await _pcsApi.GetWipAtt(model.WipNO)).ItemNO; + // 判斷工單狀態 var BarCodeWip = await _pcsApi.CheckBarCodeWip(model.WipNO, model.UnitNO, model.LineID, model.FlowRuleID); @@ -3326,10 +3447,12 @@ namespace AMESCoreStudio.Web.Controllers if (model.Station != 0) { model.RuleStation = ruleStations.Where(w => w.StationID == model.Station).FirstOrDefault().RuleStationID; + model.StationTypeNo = ruleStations.Where(w => w.StationID == model.Station).FirstOrDefault().Station.TypeNo; } else { model.RuleStation = ruleStations.FirstOrDefault().RuleStationID; + model.StationTypeNo = ruleStations.FirstOrDefault().Station.TypeNo; } // 工單已刷數量 @@ -3351,15 +3474,19 @@ namespace AMESCoreStudio.Web.Controllers ModelState.AddModelError("error", "找不到該站別作業工項"); } - var q1 = await _pcsApi.GetMaterialOutfitByItemID(model.MaterialItem.ItemID); - model.MaterialOutfits.Clear(); - foreach (var item in q1.Where(w => w.RuleStationID == ruleStations.FirstOrDefault().RuleStationID)) + // 治具 + var q1 = await _pcsApi.GetWipOutfitByWipNo(model.WipNO); + q1 = q1.Where(w => (w.UnitNo == model.UnitNO && w.RuleStationID == null) || + (w.UnitNo == model.UnitNO && w.RuleStationID == model.RuleStation)).ToList(); + model.wipOutfits.Clear(); + foreach (var item in q1) { - model.MaterialOutfits.Add(new MaterialOutfits + model.wipOutfits.Add(new WipOutfitDtos { - ItemID = item.ItemID, - MaterialOutfitID = item.MaterialOutfitID, - OutfitNo = item.OutfitNo + OutfitNo = item.OutfitNo, + PartNo = item.PartNo, + StationName = item.StationName, + UnitNoName = item.UnitNoName } ); } @@ -3390,7 +3517,8 @@ namespace AMESCoreStudio.Web.Controllers if (model.WipID == 0) Msg += "請確認是否有輸入工單相關訊息
"; - if (model.MaterialOutfits.Where(w => string.IsNullOrWhiteSpace(w.Inputs)).Any()) + // 當有作業站就必須要填治具編號 + if (model.wipOutfits.Where(w => !string.IsNullOrWhiteSpace(w.StationName) && string.IsNullOrWhiteSpace(w.Inputs)).Any()) Msg += "請刷入治具編號
"; if (model.Station == 0) @@ -3410,7 +3538,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion - var Kp = model.Inputs.Where(w => !w.Contains("$")).ToList(); // 撈非不良代碼 = 組件序號 + var Kp = model.Inputs.Where(w => !w.Input.Contains("$")).ToList(); // 撈非不良代碼 = 組件序號 var q = await _pcsApi.GetBarCodeFromWip(model.Input); // 判斷是否用內部序號有對應到工單號碼,沒對應到視為組件或不良代碼 if (q.Success) @@ -3441,7 +3569,7 @@ namespace AMESCoreStudio.Web.Controllers model.StationSEQ = RuleStations.Where(w => w.StationID == model.Station).Select(s => s.Sequence).FirstOrDefault(); } // 判斷是否有$符號,代表有不良代碼 - if (model.Inputs.Where(w => w.Contains("$")).Any()) + if (model.Inputs.Where(w => w.Input.Contains("$")).Any()) { model.BarcodeNG = true; // 判斷是否為投入站,投入站不能刷不良 @@ -3490,16 +3618,18 @@ namespace AMESCoreStudio.Web.Controllers } keyParts.Add(new BarCodeCheckDto.inputItem { - inputType = KeyPartItem.Contains("$") ? "NG" : model.WipKps[i + KpItemQty].KpNo, - inputData = KeyPartItem + inputType = KeyPartItem.Input.Contains("$") ? "NG" : model.WipKps[i + KpItemQty].KpNo, + inputData = KeyPartItem.Input, + oldInputData = KeyPartItem.InputNo }); - if (!KeyPartItem.Contains("$")) + if (!KeyPartItem.Input.Contains("$")) i += 1; } + // 治具 var outfit = new List(); - foreach (var outfitItem in model.MaterialOutfits) + foreach (var outfitItem in model.wipOutfits) { outfit.Add(new BarCodeCheckDto.Outfit { @@ -3507,7 +3637,6 @@ namespace AMESCoreStudio.Web.Controllers }); } - var x = new BarCodeCheckDto { wipNo = model.WipNO, diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index b183c20f..54406b4a 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -998,6 +998,14 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/RuleStations/WipNo/{id}")] ITask> GetRuleStationByWipNo(string id , int flowRuleIDNew =0 , int flowRuleIDOld =0); + + /// + /// By FlowID 對應 RuleStation + /// + /// + /// + [WebApiClient.Attributes.HttpGet("api/RuleStations/Flow/{id}")] + ITask> GetRuleStationByFlow(int id); #endregion #region BarcodeOutfit 內部序號對應的治具序號明細 @@ -1050,5 +1058,10 @@ namespace AMESCoreStudio.Web ITask> GetWipInfoBlob(string id); #endregion + #region OutfitCommodityInfo 治具種類資料檔 + [WebApiClient.Attributes.HttpGet("api/OutfitCommodityInfoes")] + ITask> GetOutfitCommodityInfo(); + #endregion + } } diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs index c93572c9..5f719866 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs @@ -60,6 +60,11 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// public int Station { get; set; } + /// + /// 工作站類別 + /// + public string StationTypeNo { get; set; } + /// /// SOP路徑 @@ -76,6 +81,10 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// public string Input { get; set; } + /// + /// inputNo (異常代碼) + /// + public string InputNo { get; set; } /// /// 過站順序 @@ -100,7 +109,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// inputs /// - public List Inputs { get; set; } = new List(); + public List Inputs { get; set; } = new List(); /// /// 料號相關資料 @@ -115,7 +124,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// /// 料號治具資訊 /// - public List MaterialOutfits { get; set; } = new List(); + public List wipOutfits { get; set; } = new List(); /// /// 站別工項資料檔 @@ -123,8 +132,21 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public List MaterialStationsItems { get; set; } = new List(); } - public class MaterialOutfits : MaterialOutfit + public class WipOutfitDtos : WipOutfitDto { public string Inputs { get; set; } } + + public class Inputs + { + /// + /// 不良代號 || KeyPart + /// + public string Input { get; set; } + + /// + /// 異常欄位 + /// + public string InputNo { get; set; } + } } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml index 7b3693c1..5f87cdb7 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml @@ -830,23 +830,29 @@ 生產單位 + + 作業站 + @foreach (var index in Model.WipOutfits) { - - - - @index.OutfitNo - - - @index.PartNo - - - @index.UnitNoName - - + + + + @index.OutfitNo + + + @index.PartNoName + + + @index.UnitNoName + + + @index.StationName + + j++; } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml index 3e61c246..2c0ac021 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -106,7 +106,7 @@
- +
@@ -364,7 +364,7 @@ - + 刪除 @@ -906,6 +906,9 @@ 生產單位 + + 流程站別 + @@ -920,10 +923,14 @@ - + - + + + + + 刪除 @@ -975,7 +982,7 @@ - + 刪除 @@ -1223,6 +1230,7 @@ form.on('select(flow)', function (data) { RuleStation(data.value); }); + }); function getFlowRuleList(data) @@ -1295,7 +1303,7 @@ }); }; - // RuleStation + // RuleStation 備註 function RuleStation(NewID) { $.ajax( { @@ -1361,7 +1369,7 @@ $('#KPTableAdd').click(); $('#KPTableAdd').on('click', function () { let No = parseInt($('#WipKpCount').val()); - var FactoryUnit = getFactoryUnitList(); + var FactoryUnit = getFactoryUnitByWipNoList(); var Select = ""; $.each(FactoryUnit, function (index, item) { Select += ''; }); Select += ''; + + var OutfitCommodity = getOutfitCommodityList(); + var SelectPartNo = "'; + + var RuleStation = getRuleStationByFlowID(); + var SelectStation = "'; + + var contactdiv = '' + '' + '' + - '' + + '' + SelectPartNo+'' + '' + Select + '' + + '' + SelectStation + '' + '刪除' + ''; $('#OutfitTable').append(contactdiv); @@ -1417,7 +1442,7 @@ $('#SopTableAdd').click(); $('#SopTableAdd').on('click', function () { let No = parseInt($('#WipSopCount').val()); - var FactoryUnit = getFactoryUnitList(); + var FactoryUnit = getFactoryUnitByWipNoList(); var SOPType = getSOPType(); var Select = " +
@@ -122,6 +123,10 @@
+
+ +
@@ -205,7 +210,7 @@ 長度 - 站(前段) + 生產單位 @@ -214,19 +219,19 @@ { - + - + - + - + @index.UnitNoName @@ -245,28 +250,42 @@ - 治具NO + 設備編碼 + + + 設備名稱 + + + 生產單位 - 站(前段) + 作業站 - 序號 + 刷入治具條碼 - @foreach (var index in Model.MaterialOutfits) + @foreach (var index in Model.wipOutfits) { + + + + + + + + - @index.OutfitNo + - @index.StationType + - + k++; @@ -291,11 +310,19 @@ await Html.RenderPartialAsync("_FileinputScriptsPartial"); }