diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index d9b37f10..b6457ba5 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -5662,6 +5662,11 @@ namespace AMESCoreStudio.Web.Controllers /// public async Task PCS022QueryAsync(string wipNo, string productNo, string unit, string type, int lineID = 0, int page = 0, int limit = 10) { + if (type == "W") + productNo = string.Empty; + else + wipNo = string.Empty; + IResultModel result = await _pcsApi.GetBarcodeInfoesByPCS022Query(wipNo: wipNo, itemNo: productNo, unit: unit, lineID, page: page, limit: limit); @@ -5681,7 +5686,7 @@ namespace AMESCoreStudio.Web.Controllers } [HttpGet] - public async Task PCS022VQuery(int wipID, int ruleStationID,int page = 0, int limit = 10) + public async Task PCS022VQuery(int wipID, int ruleStationID, int page = 0, int limit = 10) { var result = await _pcsApi.GetWipStationBarcodeByPCS022(wipID, ruleStationID, page, limit); @@ -5692,6 +5697,65 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } + + [HttpPost] + public async Task PCS022U(int wipID, int ruleStationID) + { + var result = await _pcsApi.GetBarcodeInfoesByWipID(wipID); + result = result.Where(w => w.RuleStationID == ruleStationID && w.RuleStatus == "P").ToList(); + + var FlowRule = result.FirstOrDefault().GetWipInfo.FlowRuleID; + var result_RuleStation = await _basApi.GetRuleStationsByFlow(FlowRule, 0); + // 只抓標準站 & 排除完工站 + result_RuleStation = result_RuleStation.Where(w => w.StationType == "M" && w.StationID != 1000).OrderBy(o => o.Sequence).ToList(); + // 當站 + var NowSequence = result_RuleStation.Where(w => w.RuleStationID == ruleStationID).FirstOrDefault().Sequence; + var NextStationID = 0; + // 排除當站為最後一站 + if (result_RuleStation.Count != NowSequence + 1) + NextStationID = result_RuleStation.Where(w => w.Sequence == NowSequence + 1).FirstOrDefault().StationID; + + if (NextStationID != 0) + { + var resultMsg = string.Empty; + foreach (var item in result) + { + //自動過站 + var barCode = new BarCodeCheckDto + { + wipNo = item.GetWipInfo.WipNO, + barcode = item.BarcodeNo, + barcodeType = "M", + station = NextStationID, + line = item.GetWipInfo.LineID ?? 0, + unitNo = item.GetWipInfo.UnitNO, + inputItems = null, + userID = GetLogInUserID() + }; + + try + { + var barcode_result = await _pcsApi.PassIngByCheck(JsonConvert.SerializeObject(barCode)); + + + if (barcode_result.Success) + { + resultMsg += $"{item.BarcodeNo} 內部條碼:資料過站成功!!!" + "
"; + } + else + { + resultMsg += $"{item.BarcodeNo} 內部條碼:資料過站失敗!!!原因:" + barcode_result.Msg + "
"; + } + return Json(new Result() { success = true, msg = resultMsg }); + } + catch(Exception ex) { + return Json(new Result() { success = false, msg = ex.Message }); + } + } + return Json(new Result() { success = true, msg = resultMsg }); + } + return Json(new Result() { success = true, msg = "該站為最後一站,無法執行過站" }); + } #endregion #region PCS023 條碼置換 diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 55b0a7e0..3474824a 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -312,6 +312,9 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/BarcodeInfoes/ByWipNo/{id}")] ITask> GetBarcodeInfoesByWipNo(string id); + [WebApiClient.Attributes.HttpGet("api/BarcodeInfoes/ByWipID/{id}")] + ITask> GetBarcodeInfoesByWipID(int id); + [WebApiClient.Attributes.HttpPost("api/BarcodeInfoes")] ITask> PostBarcodeInfoes([FromBody, RawJsonContent] string model); diff --git a/AMESCoreStudio.Web/Views/PCS/PCS022.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS022.cshtml index 9333c527..ca41c5f9 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS022.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS022.cshtml @@ -153,7 +153,7 @@ //通过行tool檢視,lay-event="detail" function detail(obj) { if (obj.data.wipID) { - hg.open('過站條碼資料', '/PCS/PCS022V?wipID=' + obj.data.wipID + '&ruleStationID=' + obj.data.ruleStationID, '800', '600', false); + hg.open('過站條碼資料', '/PCS/PCS022V?wipID=' + obj.data.wipID + '&ruleStationID=' + obj.data.ruleStationID, '800', '500', false); } } //基本数据表格 diff --git a/AMESCoreStudio.Web/Views/PCS/PCS022V.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS022V.cshtml index fef37009..2fc39c9f 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS022V.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS022V.cshtml @@ -47,6 +47,39 @@ }] ]; + var toolbar = [{ + text: '整批過站', + layuiicon: '', + class: 'layui-btn', + handler: function () { + let trArr = $(".layui-table-body.layui-table-main tr");// 行数据 + if (trArr.length == 0) { + hg.msg("請確認是否有查詢資料!"); + return; + } + + hg.confirm("確定要整批過下一站嗎?", function () { + $.ajax({ + url: '/PCS/PCS022U', + data: { wipID: $("#wip_id").val(), ruleStationID: $("#rule_station_id").val()}, + type: 'POST', + success: function (data) { + if (data.success) { + hg.msg(data.msg); + hg.close(); + parent.table; + } + else { + hg.msg(data.msg); + } + }, + error: function () { + hg.msg("網路請求失败!"); + } + }); + }); + } + }]; //基本数据表格 var table = hg.table.datatable('test', '過站條碼資料', '/PCS/PCS022VQuery?wipID=' + wip_id.value +'&ruleStationID='+rule_station_id.value, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs index 2b3738f0..a2aeab3b 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs @@ -247,7 +247,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES barcodeInfos = await _context.BarcodeInfoes.Where(w => wipID.Contains(w.WipID)).ToListAsync(); } - var q = from q1 in barcodeInfos.Where(w => w.RuleStatus != "S" && w.GetRuleStation.StationID != 1000) + var q = from q1 in barcodeInfos.Where(w => w.RuleStatus != "S" && w.RuleStatus != "F" && w.GetRuleStation.StationID != 1000) join q2 in _context.RuleStations on q1.RuleStationID equals q2.RuleStationID join q3 in _context.WipInfos on q1.WipID equals q3.WipID join q4 in _context.LineInfoes on q3.LineID equals q4.LineID diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeStationController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeStationController.cs index 7ac21dc7..df7cc45d 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeStationController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeStationController.cs @@ -176,7 +176,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES q4.UserName }; - q = q.Where(w => w.WipID == wipID && w.RuleStationID == ruleStationID); + q = q.Where(w => w.WipID == wipID && w.RuleStationID == ruleStationID && w.RuleStatus != "F"); //紀錄筆數 diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs index 9851e5cf..3fc7fa55 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs @@ -842,7 +842,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// BurnInfo-燒入資料檔 /// - /// + /// /// private async Task> Table_BurnInfo(BarCodeCheckDto model) { @@ -1200,8 +1200,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return Ok(result.Result); } - - /// /// 內部序號查詢工單號碼 ///