diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs
index 1c9ae7a2..4c71bb46 100644
--- a/AMESCoreStudio.Web/Controllers/PCSController.cs
+++ b/AMESCoreStudio.Web/Controllers/PCSController.cs
@@ -5926,21 +5926,21 @@ namespace AMESCoreStudio.Web.Controllers
// 工單SOP
var wipSOP = await _pcsApi.GetWipSopByWipNo(model.WipNO);
// 標準SOP A
- //if (wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "A").Any())
- //{
- // var wipSOPTypeA = wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "A")
- // .OrderByDescending(w => w.UpdateTime).FirstOrDefault();
- // var Esop = await _pcsApi.GetDocEsopViewByNo(wipSOPTypeA.SOPName);
- // if (Esop.Count != 0)
- // {
- // model.Sops.Add(new PCS021ViewModel_SOP
- // {
- // SopName = "SOP文件",
- // SopPath = $@"/DocEsop/{Esop.FirstOrDefault().file_path}"
- // //SopPath = @$"\\qasrv-n\Web\ISOZone\{Esop.FirstOrDefault().file_path}"
- // });
- // }
- //}
+ if (wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "A").Any())
+ {
+ var wipSOPTypeA = wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "A")
+ .OrderByDescending(w => w.UpdateTime).FirstOrDefault();
+ var Esop = await _pcsApi.GetDocEsopViewByNo(wipSOPTypeA.SOPName);
+ if (Esop.Count != 0)
+ {
+ model.Sops.Add(new PCS021ViewModel_SOP
+ {
+ SopName = "SOP文件",
+ SopPath = $@"/DocEsop/{Esop.FirstOrDefault().file_path}"
+ //SopPath = @$"\\qasrv-n\Web\ISOZone\{Esop.FirstOrDefault().file_path}"
+ });
+ }
+ }
// 暫行SOP D
if (wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "D").Any())
{
@@ -7739,6 +7739,129 @@ namespace AMESCoreStudio.Web.Controllers
return View();
}
#endregion
+
+ #region PCS036 條碼解除出貨序號及箱號
+ ///
+ ///
+ ///
+ ///
+ public IActionResult PCS036()
+ {
+ return View();
+ }
+
+ [HttpPost]
+ public async Task PCS036Async(PCS036ViewModel model, string select)
+ {
+ IResultModel result;
+ var _msg = string.Empty;
+ // 內部條碼
+ if (select == "0")
+ {
+ if (string.IsNullOrWhiteSpace(model.BarCodeNo))
+ {
+ ModelState.AddModelError("error", "請輸入內部條碼");
+ return View(model);
+ }
+
+ var q = await _pcsApi.GetBarcodeInfoesByNo(model.BarCodeNo);
+ if (q.Count == 0)
+ {
+ ModelState.AddModelError("error", "內部序號【" + model.BarCodeNo + "】,找不到");
+ return View(model);
+ }
+
+ BarcodeInfo barcodeInfo = q.FirstOrDefault();
+ barcodeInfo.BoxNo = "";
+ barcodeInfo.ExtraBarcodeNo = "";
+ barcodeInfo.UpdateDate = DateTime.Now;
+ result = await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo));
+ if (result.Success)
+ {
+ _msg += "內部序號【" + model.BarCodeNo + "】解除綁定成功!";
+ }
+ else
+ {
+ _msg += "內部序號【" + model.BarCodeNo + "】解除綁定失敗!";
+ }
+ }
+
+ // 條碼區間
+ if (select == "1")
+ {
+ if (string.IsNullOrWhiteSpace(model.BarCodeNoStr) || string.IsNullOrWhiteSpace(model.BarCodeNoEnd))
+ {
+ ModelState.AddModelError("error", "請確定都有輸入條碼區間");
+ return View(model);
+ }
+
+ if (model.BarCodeNoStr.Length != model.BarCodeNoEnd.Length)
+ {
+ ModelState.AddModelError("error", "條碼區間起訖長度不相同");
+ return View(model);
+ }
+
+ // 流水碼預設長度
+ int NoLength = 4;
+ if (model.BarCodeNoStr.Length <= NoLength || model.BarCodeNoEnd.Length <= NoLength)
+ {
+ ModelState.AddModelError("error", "條碼區間號碼長度不能小於" + NoLength + 1);
+ return View(model);
+ }
+
+ if (model.BarCodeNoStr.Substring(0, model.BarCodeNoStr.Length - NoLength) !=
+ model.BarCodeNoEnd.Substring(0, model.BarCodeNoEnd.Length - NoLength))
+ {
+ ModelState.AddModelError("error", "條碼區間前置號碼不一樣");
+ return View(model);
+ }
+
+
+ if (!int.TryParse(model.BarCodeNoStr.Substring(model.BarCodeNoStr.Length - NoLength, NoLength), out _) ||
+ !int.TryParse(model.BarCodeNoEnd.Substring(model.BarCodeNoEnd.Length - NoLength, NoLength), out _))
+ {
+ ModelState.AddModelError("error", "條碼區間流水碼格式錯誤");
+ return View(model);
+ }
+
+ var NoStr = int.Parse(model.BarCodeNoStr.Substring(model.BarCodeNoStr.Length - NoLength, NoLength));
+ var NoEnd = int.Parse(model.BarCodeNoEnd.Substring(model.BarCodeNoEnd.Length - NoLength, NoLength));
+ if (NoStr > NoEnd)
+ {
+ ModelState.AddModelError("error", "條碼區間結束流水碼不可以小於條碼區間起始流水碼");
+ return View(model);
+ }
+
+ 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)
+ {
+ BarcodeInfo barcodeInfo = q_BarcodeInfo.FirstOrDefault();
+ barcodeInfo.BoxNo = "";
+ barcodeInfo.ExtraBarcodeNo = "";
+ barcodeInfo.UpdateDate = DateTime.Now;
+ result = await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo));
+ //if (result.Success)
+ //{
+ // _msg += "解除綁定成功";
+ //}
+ //else
+ //{
+ // _msg += "解除綁定失敗";
+ //}
+ }
+ _msg += "條碼區間解除綁定成功";
+ }
+ }
+ ModelState.AddModelError("error", _msg);
+ return View(model);
+ }
+ #endregion
}
public static class ObjectExtension
diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS036ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS036ViewModel.cs
new file mode 100644
index 00000000..57444387
--- /dev/null
+++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS036ViewModel.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using AMESCoreStudio.WebApi.Models.AMES;
+using AMESCoreStudio.WebApi.Models.BAS;
+using System.ComponentModel.DataAnnotations;
+
+namespace AMESCoreStudio.Web.ViewModels.PCS
+{
+ public class PCS036ViewModel
+ {
+ ///
+ /// 內部條碼
+ ///
+ public string BarCodeNo { get; set; }
+
+ ///
+ /// 工單號碼
+ ///
+ public string WipNo { get; set; }
+
+ ///
+ /// 鎖定條碼區間起
+ ///
+ public string BarCodeNoStr { get; set; }
+
+ ///
+ /// 鎖定條碼區間迄
+ ///
+ public string BarCodeNoEnd { get; set; }
+
+ }
+}
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS036.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS036.cshtml
new file mode 100644
index 00000000..0e57b5d1
--- /dev/null
+++ b/AMESCoreStudio.Web/Views/PCS/PCS036.cshtml
@@ -0,0 +1,70 @@
+@{ ViewData["Title"] = "解除綁定出貨序號、箱號";
+ Layout = "~/Views/Shared/_AMESLayout.cshtml";
+}
+@model AMESCoreStudio.Web.ViewModels.PCS.PCS036ViewModel
+
+
+@section Scripts {
+ @{ await Html.RenderPartialAsync("_ValidationScriptsPartial");
+ await Html.RenderPartialAsync("_FileinputScriptsPartial"); }
+
+
+}
+
diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs
index 6b854dd5..70e0f495 100644
--- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs
@@ -363,8 +363,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
var inputKPQty = barCodeCheckDto.inputItems.Where(w => !w.inputData.Contains("$")).Count();
// 已記錄組件數量
- var BarCodeItems = _context.BarcodeItems.Where(w => w.BarcodeID == barCodeCheckDto.barcodeID
- && w.WipID == barCodeCheckDto.wipID);
+ var BarCodeItems = _context.BarcodeItems.Where(w => w.BarcodeID == barCodeCheckDto.barcodeID);
var Stations = _context.Stationses.Where(w => w.UnitNo == station.Value.FirstOrDefault().UnitNo);
@@ -740,6 +739,8 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
barcodeInfo.RuleStatus = barCodeCheckDto.ruleStatus;
barcodeInfo.StatusNo = StatusNo;
barcodeInfo.WipID = barCodeCheckDto.wipID;
+ barcodeInfo.StatusID = 1;
+ barcodeInfo.BoxNo = "";
barcodeInfo.ExtraBarcodeNo = barCodeCheckDto.extNo;
if (CheckNextStopCloseStation(barCodeCheckDto.wipNo, barCodeCheckDto.unitNo, barCodeCheckDto.stationID).Result.Success)
{
@@ -1847,8 +1848,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
#region 判斷組件序號是否有紀錄
BarcodeItemsController barcodeItemsController = new BarcodeItemsController(_context);
var BarCodeItems = (await barcodeItemsController.GetBarcodeItemByBarCodeID(BarCodeID)).Value.ToList();
- BarCodeItems = BarCodeItems.Where(w => w.WipID == q.Value.FirstOrDefault().WipID
- && w.S.UnitNo == barcodeItemKPDto.ststionUnitNo).ToList();
+ BarCodeItems = BarCodeItems.Where(w => w.S.UnitNo == barcodeItemKPDto.ststionUnitNo).ToList();
#endregion
// 計算過站時刷的組件數量與已經存BarCodeItems