diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index a9c3d2d0..e29bed68 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -3046,6 +3046,10 @@ namespace AMESCoreStudio.Web.Controllers #endregion + #region PCS008 未結工單查詢 + + #endregion + #region PCS009 條碼生產歷程查詢 public IActionResult PCS009() { @@ -4362,6 +4366,59 @@ namespace AMESCoreStudio.Web.Controllers } #endregion + #region PCS023 條碼置換 + public ActionResult PCS023() + { + return View(); + } + + //頁面提交,id=0 添加,id>0 修改 + [HttpPost] + public async Task PCS023Async(PCS023ViewModel model) + { + // 查內部條碼 + var result_barcodeInfo = await _pcsApi.GetBarcodeInfoesByNo(model.BarCodeNoOld); + + if (result_barcodeInfo.Count == 0) + { + ModelState.AddModelError("error", "找不到內部條碼【" + model.BarCodeNoOld + "】 ,請確認"); + return View(model); + } + + // 確認新條碼不再barcodeInfo 有資料 + var result_CheckbarcodeInfo = await _pcsApi.GetBarcodeInfoesByNo(model.BarCodeNoNew); + if (result_CheckbarcodeInfo.Count != 0) + { + ModelState.AddModelError("error", "新內部條碼【" + model.BarCodeNoNew + "】,已在使用中"); + return View(model); + } + + var barcodeInfo = result_barcodeInfo.FirstOrDefault(); + BarcodeChange barcodeChange = new BarcodeChange + { + BarcodeID = barcodeInfo.BarcodeID, + BarcodeNOOld = model.BarCodeNoOld, + Memo = model.Memo, + CreateUserID = GetLogInUserID() + }; + + var result = await _pcsApi.PostBarcodeChange(JsonConvert.SerializeObject(barcodeChange)); + if (result.Success) + { + barcodeInfo.BarcodeNo = model.BarCodeNoNew; + await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo)); + ModelState.AddModelError("error", "變更成功!"); + return View(); + } + else + { + ModelState.AddModelError("error", "變更失敗,錯誤原因:" + result.Msg); + return View(model); + } + } + + #endregion + #region PCS024條碼組件维护相关 public async Task PCS024(string id) diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 463b6aa4..565d279e 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -569,6 +569,15 @@ namespace AMESCoreStudio.Web ITask> PutBarcodeLock([FromBody, RawJsonContent] string model); #endregion + #region BarCodeChange 條碼變更資料表 PCS023 + /// + /// 新增條碼變更資料表 + /// + /// + [WebApiClient.Attributes.HttpPost("api/BarcodeChange")] + ITask> PostBarcodeChange([FromBody, RawJsonContent] string model); + #endregion + #region MaterialItem 料號基本資料檔 /// /// MaterialItem 料號基本資料檔 diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS023ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS023ViewModel.cs new file mode 100644 index 00000000..0a89f9a0 --- /dev/null +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS023ViewModel.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 PCS023ViewModel + { + /// + /// 舊內部條碼 + /// + [Required(ErrorMessage = "{0},不能空白")] + [Display(Name = "舊內部條碼")] + public string BarCodeNoOld { get; set; } + + /// + /// 新內部條碼 + /// + [Required(ErrorMessage = "{0},不能空白")] + [Display(Name = "新內部條碼")] + public string BarCodeNoNew { get; set; } + + /// + /// 備註 + /// + public string Memo { get; set; } + + + } +} diff --git a/AMESCoreStudio.Web/Views/PCS/PCS008.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS008.cshtml new file mode 100644 index 00000000..cfbcdded --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS008.cshtml @@ -0,0 +1,162 @@ +@model AMESCoreStudio.Web.ViewModels.PCS.PCS009ViewModel + +@{ + ViewData["Title"] = "未結工單查詢"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+ + @**@ +
+
+
+
+
+
+
+
+
+
+ +@section Scripts{ + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS008F.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS008F.cshtml new file mode 100644 index 00000000..931d5750 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS008F.cshtml @@ -0,0 +1,53 @@ +@{ + ViewData["Title"] = "在製分布圖-過站FAIL條碼資料"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+ + +
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS008P.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS008P.cshtml new file mode 100644 index 00000000..588705c6 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS008P.cshtml @@ -0,0 +1,53 @@ +@{ + ViewData["Title"] = "在製分布圖-過站PASS條碼資料"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+ + +
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS008V.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS008V.cshtml new file mode 100644 index 00000000..370be687 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS008V.cshtml @@ -0,0 +1,18 @@ +@{ + ViewData["Title"] = "在製分布圖"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+
+
+
@ViewBag.Title
+
+
+
+ +
+ @Html.Raw(ViewData["WipDataList"]) +
+
\ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS008W.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS008W.cshtml new file mode 100644 index 00000000..57cff918 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS008W.cshtml @@ -0,0 +1,53 @@ +@{ + ViewData["Title"] = "在製分布圖-在製條碼資料"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+ + +
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS023.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS023.cshtml index f9c704ad..e484dc75 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS023.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS023.cshtml @@ -1,7 +1,7 @@ -@model AMESCoreStudio.WebApi.Models.AMES.WipLock +@model AMESCoreStudio.Web.ViewModels.PCS.PCS023ViewModel -@{ ViewData["Title"] = "PCS010"; +@{ ViewData["Title"] = "條碼置換"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; } @@ -9,68 +9,60 @@ .control-label { justify-content: flex-end !important; } - -
-
-
-
+ .layui-input { + height: 30px; + } -
-
- -
- -
-
-
+ /* layui-input 默认太高了,这里固定高度*/ + label.required:after { /* 给红色的必填项打红色星号(文字后)如果打前面用before*/ + content: ' *'; + color: red; + } + +
+ +
+
-
- -
- - -
-
+
@ViewBag.Title
- +
+
- +
- + +
-
- +
- + +
-
-
- -
- - -
+ +
+
@Html.ValidationMessage("error")
-
+
- -
+
+
@section Scripts { @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeChangeController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeChangeController.cs index 82caf7ff..8f0060f0 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeChangeController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeChangeController.cs @@ -11,6 +11,9 @@ using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.AMES { + /// + /// 條碼變更資料表 + /// [Route("api/[controller]")] [ApiController] public class BarcodeChangeController : ControllerBase @@ -66,21 +69,22 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES public async Task> PostBarcodeChange([FromBody] BarcodeChange barcodeChange) { ResultModel result = new ResultModel(); - + Helper helper = new Helper(_context); + barcodeChange.BarcodeChangeID = helper.GetIDKey("BARCODE_CHANGE_ID").Result; _context.BarcodeChanges.Add(barcodeChange); try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } catch (DbUpdateException ex) { result.Success = false; result.Msg = ex.InnerException.Message; - return result; } - result.Success = true; - result.Msg = "OK"; + return result; } diff --git a/AMESCoreStudio.WebApi/Models/AMES/BarcodeChange.cs b/AMESCoreStudio.WebApi/Models/AMES/BarcodeChange.cs index a64679cd..05af2e09 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/BarcodeChange.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/BarcodeChange.cs @@ -13,9 +13,18 @@ namespace AMESCoreStudio.WebApi.Models.AMES public class BarcodeChange { /// - /// 條碼ID + /// 條碼置換ID /// + [Column("BARCODE_CHANGE_ID")] + [DataMember] + [Display(Name = "條碼置換ID")] [Key] + + public int BarcodeChangeID { get; set; } + + /// + /// 條碼ID + /// [Column("BARCODE_ID")] [DataMember] [Display(Name = "條碼ID")] @@ -49,14 +58,14 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "建立時間")] public DateTime CreateDate { get; set; } = DateTime.Now; + /// - /// 修改時間 + /// 備註 /// - [Column("UPDATE_DATE")] + [Column("MEMO")] [DataMember] - [Required(ErrorMessage = "{0},不能空白")] - [Display(Name = "修改時間")] - public DateTime UpdateDate { get; set; } = DateTime.Now; + [Display(Name = "備註")] + public string Memo { get; set; } } }