diff --git a/AMESCoreStudio.Web/Controllers/FQCController.cs b/AMESCoreStudio.Web/Controllers/FQCController.cs index 280b5645..cc98044c 100644 --- a/AMESCoreStudio.Web/Controllers/FQCController.cs +++ b/AMESCoreStudio.Web/Controllers/FQCController.cs @@ -80,6 +80,45 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.QcQuotSelect = QcQuotList; } + + /// + /// FQC狀態維護 Select + /// + /// + private async Task GetStatusTypeSelect() + { + var result = await _fqcApi.GetStatusType(); + + var StatusTypetList = new List(); + result = result.OrderByDescending(o => o.StatusNo).ToList(); + for (int i = 0; i < result.Count; i++) + { + StatusTypetList.Add(new SelectListItem(result[i].StatusName, result[i].StatusNo.ToString())); + } + + if (StatusTypetList.Count == 0) + { + StatusTypetList.Add(new SelectListItem("N/A", null)); + } + + ViewBag.StatusTypeSelect = StatusTypetList; + } + + /// + /// 不良狀態 Select + /// + /// + private async Task GetNGReasonSelect() + { + var result = await _fqcApi.GetNGReasons(); + + var NGReasonList = new List(); + for (int i = 0; i < result.Count; i++) + { + NGReasonList.Add(new SelectListItem(result[i].NGReasonDesc, result[i].NGReasonNo.ToString())); + } + ViewBag.NGReasonSelect = NGReasonList; + } #endregion #region FQC001 檢驗類別維護 @@ -593,8 +632,46 @@ namespace AMESCoreStudio.Web.Controllers return View("FQC007", model); } - public async Task FQC007C() + [HttpGet] + public async Task FQC007C(string inhouseNo, int seq) + { + await GetStatusTypeSelect(); + await GetNGReasonSelect(); + return View(); + } + + [HttpPost] + public async Task FQC007CAsync(FqcResultDetail model) { + await GetStatusTypeSelect(); + await GetNGReasonSelect(); + if (string.IsNullOrWhiteSpace(model.BarcodeNo) && + string.IsNullOrWhiteSpace(model.BoxNo) && + string.IsNullOrWhiteSpace(model.ExtraBarcodeNo)) + { + ModelState.AddModelError("error", "請輸入要抽驗的相關序號"); + return View("FQC007C", model); + } + + + if (ModelState.IsValid) + { + IResultModel result; + + result = await _fqcApi.PostStatusType(JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "新增成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } + + return View("FQC006C", model); return View(); } #endregion diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs index ce2e30d5..ced4092c 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs @@ -254,7 +254,7 @@ namespace AMESCoreStudio.Web ITask> DeleteStatusType(string id); /// - /// 查詢過站狀態檔 + /// 查詢過站狀態檔 Query /// /// 頁數 /// @@ -268,6 +268,20 @@ namespace AMESCoreStudio.Web /// [WebApiClient.Attributes.HttpGet("api/StatusType/{id}")] ITask GetStatusType(string id); + + /// + /// 過站狀態檔-List + /// + /// + [WebApiClient.Attributes.HttpGet("api/StatusType")] + ITask> GetStatusType(); + + /// + /// 不良現象-List + /// + /// + [WebApiClient.Attributes.HttpGet("api/NGReasons")] + ITask> GetNGReasons(); #endregion #region FQC007 FQC抽驗作業 diff --git a/AMESCoreStudio.Web/Views/FQC/FQC007.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC007.cshtml index 38b17a4b..730a04b8 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC007.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC007.cshtml @@ -213,7 +213,58 @@ 結果判定 - + @**@ + + @{ int i = 0;} + + + + 箱號 + + + 總數量 + + + 已抽數量 + + + 抽驗PASS數量 + + + 抽驗FAIL數量 + + + 檢視 + + + + + @foreach (var index in Model.fqcDetails) + { + + + @index.SerialNo + + + @index.Qty + + + @index.HasQty + + + @index.PassQty + + + @index.FailQty + + + + + i++; + } + + + @@ -228,7 +279,7 @@ }); function edit() { - hg.open('抽驗', '/FQC/FQC007C/', 600, 600); + hg.open('抽驗', '/FQC/FQC007C?inhouseNo=@Model.InhouseNo"&seq="@Model.SeqID', 600, 600); }; diff --git a/AMESCoreStudio.Web/Views/FQC/FQC007C.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC007C.cshtml index 827c821d..a8aa1636 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC007C.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC007C.cshtml @@ -13,7 +13,7 @@ - + @@ -43,15 +43,17 @@ - - + + - + + N/A + diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs index 483a0dcc..71f9107c 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs @@ -187,7 +187,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES result.Data = query; foreach (var item in result.Data) { - item.fqcDetails = FqcDetail; + item.fqcDetails = FqcDetail.OrderBy(o => o.SerialNo).ToList(); } return result; } diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcResultDetail.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcResultDetail.cs index 8edf53d3..ddf09c28 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/FqcResultDetail.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/FqcResultDetail.cs @@ -68,14 +68,13 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Required(ErrorMessage = "{0},不能空白")] [Column("STATUS_NO")] [StringLength(2)] - public string StatusNo { get; set; } + public string StatusNo { get; set; } = "P"; /// /// 不良代碼 /// [DataMember] [Display(Name = "不良代碼")] - [Required(ErrorMessage = "{0},不能空白")] [Column("NG_REASON_NO")] [StringLength(6)] public string NgReasonNo { get; set; }