diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index bdcb785c..54abc820 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -2271,6 +2271,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS013Async(PCS013ViewModel model, string select) { IResultModel result; + var _msg = string.Empty; // 內部條碼 if (select == "0") { @@ -2307,7 +2308,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _pcsApi.PostBarcodeLock(JsonConvert.SerializeObject(barcodeLock)); if (result.Success) { - var _msg = "條碼鎖定成功!"; + _msg = "條碼鎖定成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); } else @@ -2335,7 +2336,7 @@ namespace AMESCoreStudio.Web.Controllers } var q1 = await _pcsApi.GetBarcodeInfoesByWipNo(model.WipNo); - var _msg = string.Empty; + foreach (var item in q1) { // 判斷是否有鎖定中 @@ -2418,39 +2419,46 @@ namespace AMESCoreStudio.Web.Controllers return View(model); } - var _msg = string.Empty; - //foreach (var item in q1) - //{ - // // 判斷是否有鎖定中 - // var q2 = await _pcsApi.GetBarcodeLockByBarCodeID(item.BarcodeID); - // if (q2.Where(w => w.LockStatus == 0).Any()) - // { - // _msg += "目前內部序號【" + item.BarcodeNo + "】尚未解鎖
"; - // } - // else - // { - // BarcodeLock barcodeLock = new BarcodeLock - // { - // BarcodeID = item.BarcodeID, - // WipID = item.WipID, - // StatusID = item.StatusID, - // LockStatus = 0, - // LockReason = model.LockReason, - // LockUserID = 0 - // }; - // result = await _pcsApi.PostBarcodeLock(JsonConvert.SerializeObject(barcodeLock)); - // if (result.Success) - // { - // _msg += "目前內部序號【" + model.BarCodeNo + "】條碼鎖定成功!
"; - - // } - // else - // { - // _msg += "目前內部序號【" + model.BarCodeNo + "】條碼鎖定失敗!
"; - // } - // } - //} + var BarCode = model.BarCodeNoEnd.Substring(0, model.BarCodeNoEnd.Length - NoLength); + + for (int i = NoStr; i <= NoEnd; i++) + { + var itemBarcodeNo = BarCode + i.ToString().PadLeft(NoLength, '0'); + var q_BarcodeInfo = await _pcsApi.GetBarcodeInfoesByNo(itemBarcodeNo); + + if (q_BarcodeInfo.Count != 0) + { + // 判斷是否有鎖定中 + var q2 = await _pcsApi.GetBarcodeLockByBarCodeID(q_BarcodeInfo.FirstOrDefault().BarcodeID); + if (q2.Where(w => w.LockStatus == 0).Any()) + { + _msg += "目前內部序號【" + itemBarcodeNo + "】尚未解鎖
"; + } + else + { + BarcodeLock barcodeLock = new BarcodeLock + { + BarcodeID = q_BarcodeInfo.FirstOrDefault().BarcodeID, + WipID = q_BarcodeInfo.FirstOrDefault().WipID, + StatusID = q_BarcodeInfo.FirstOrDefault().StatusID, + LockStatus = 0, + LockReason = model.LockReason, + LockUserID = 0 + }; + result = await _pcsApi.PostBarcodeLock(JsonConvert.SerializeObject(barcodeLock)); + if (result.Success) + { + _msg += "目前內部序號【" + itemBarcodeNo + "】條碼鎖定成功!
"; + + } + else + { + _msg += "目前內部序號【" + itemBarcodeNo + "】條碼鎖定失敗!
"; + } + } + } + } return RedirectToAction("Refresh", "Home", new { msg = _msg }); } return View(model); diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index a6ed2834..c54d782a 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -238,6 +238,13 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/WipBarcode/{id}")] ITask> GetWipBarcode(string id); + /// + /// 查詢工單資料Barcode By 條碼前置碼 + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipBarcode/BarcodeNo/{id}")] + ITask> GetWipBarcodeBarcodeNo(string id); + /// /// 刪除工單內部條碼區間 /// diff --git a/AMESCoreStudio.Web/Views/Home/Refresh.cshtml b/AMESCoreStudio.Web/Views/Home/Refresh.cshtml index 9ff7a636..feb77afe 100644 --- a/AMESCoreStudio.Web/Views/Home/Refresh.cshtml +++ b/AMESCoreStudio.Web/Views/Home/Refresh.cshtml @@ -8,7 +8,7 @@