From 168d11a3b58ac34d3094cbee3d16e87ee79231e9 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 14 Jan 2022 16:47:02 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=AD=A3=E9=81=8E=E7=AB=99?= =?UTF-8?q?=E7=A8=8B=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/FQCController.cs | 17 ++ .../Controllers/PCSController.cs | 4 +- AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs | 3 +- .../ViewModels/FQC/FQC008ViewModel.cs | 22 +++ AMESCoreStudio.Web/Views/FQC/FQC008.cshtml | 178 ++++++++++++++++++ .../AMES/FqcInhouseMasterController.cs | 103 +++++----- .../Controllers/AMES/StatusTypeController.cs | 4 +- .../Models/AMES/FqcInhouseMaster.cs | 1 + AMESCoreStudio.WebApi/Models/AMES/NgInfo.cs | 32 ++-- AMESCoreStudio.WebApi/Models/AMESContext.cs | 1 + 10 files changed, 300 insertions(+), 65 deletions(-) create mode 100644 AMESCoreStudio.Web/ViewModels/FQC/FQC008ViewModel.cs create mode 100644 AMESCoreStudio.Web/Views/FQC/FQC008.cshtml diff --git a/AMESCoreStudio.Web/Controllers/FQCController.cs b/AMESCoreStudio.Web/Controllers/FQCController.cs index 9a0d21fc..c290e4f5 100644 --- a/AMESCoreStudio.Web/Controllers/FQCController.cs +++ b/AMESCoreStudio.Web/Controllers/FQCController.cs @@ -565,7 +565,24 @@ namespace AMESCoreStudio.Web.Controllers #endregion #region FQC008 FQC查詢 + public IActionResult FQC008() + { + return View(); + } + //public async Task PCS030QueryAsync(string barcodeNo, string wipNo + // , string boxNo, string inhouseNo, string date_str, string date_end) + //{ + // return IResultModel(); + // //IResultModel result = await _pcsApi.GetWipSopQuery(itemNo: itemNo, unitNo: unitNo + // //, fileName: fileName, state: state, date_str: date_str, date_end: date_end); + // // + // //if (result.Data.Count() != 0) + // //{ + // // return Json(new Table() { code = 0, msg = "", data = result.Data, count = 0 }); + // //} + // //return Json(new Table() { count = 0, data = null }); + //} #endregion } } diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 63f936be..aacef80c 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -2312,11 +2312,13 @@ namespace AMESCoreStudio.Web.Controllers // 新增 NgInfo 不良時新增 判斷有不良代碼 if (model.BarcodeNG) { + var FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray()); NgInfo ngInfo = new NgInfo { + TypeNo = model.StationTestType, OperatorID = 0, - FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray()), + FixtureNo = string.IsNullOrWhiteSpace(FixtureNo) ? "-1" : FixtureNo, BarcodeID = model.BarCodeID, ProgramNo = "N/A", MachineNo = "N/A", diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs index 011addb2..583ef318 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs @@ -268,7 +268,8 @@ namespace AMESCoreStudio.Web #endregion #region FQC008 FQC查詢 - + //[WebApiClient.Attributes.HttpGet("api/StatusType/{id}")] + //ITask> GetStatusTypeQuery(int page = 1, int limit = 10); #endregion } diff --git a/AMESCoreStudio.Web/ViewModels/FQC/FQC008ViewModel.cs b/AMESCoreStudio.Web/ViewModels/FQC/FQC008ViewModel.cs new file mode 100644 index 00000000..32276df2 --- /dev/null +++ b/AMESCoreStudio.Web/ViewModels/FQC/FQC008ViewModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.WebApi.DTO.AMES; + +namespace AMESCoreStudio.Web.ViewModels +{ + public class FQC008ViewModel + { + public NgInfo ngInfo { get; set; } + + public NgComponent ngComponent { get; set; } + + public RepairRecord repairRecord { get; set; } + + public NgRepair ngRepair { get; set; } + + } +} diff --git a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml new file mode 100644 index 00000000..49511d6f --- /dev/null +++ b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml @@ -0,0 +1,178 @@ +@{ + ViewData["Title"] = "FQC查詢"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +@section Scripts{ + +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs index f49cbbe4..b629bebb 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.AMES { @@ -45,78 +46,90 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return fqcInhouseMaster; } - // PUT: api/FqcInhouseMaster/5 - // To protect from overposting attacks, enable the specific properties you want to bind to, for - // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. - [HttpPut("{id}")] - public async Task PutFqcInhouseMaster(string id, FqcInhouseMaster fqcInhouseMaster) + /// + /// 更新入庫單 + /// + /// + /// + [HttpPut] + public async Task> PutFqcInhouseMaster(FqcInhouseMaster fqcInhouseMaster) { - if (id != fqcInhouseMaster.InhouseNo) - { - return BadRequest(); - } - + ResultModel result = new ResultModel(); _context.Entry(fqcInhouseMaster).State = EntityState.Modified; + fqcInhouseMaster.UpdateDate = DateTime.Now; + fqcInhouseMaster.UpdateUserID = 0; try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!FqcInhouseMasterExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.Message; } - - return NoContent(); + return result; } - // POST: api/FqcInhouseMaster - // To protect from overposting attacks, enable the specific properties you want to bind to, for - // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. + /// + /// 新增入庫單 + /// + /// + /// [HttpPost] - public async Task> PostFqcInhouseMaster(FqcInhouseMaster fqcInhouseMaster) + public async Task> PostFqcInhouseMaster(FqcInhouseMaster fqcInhouseMaster) { + ResultModel result = new ResultModel(); _context.FqcInhouseMasters.Add(fqcInhouseMaster); try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.Message; } - catch (DbUpdateException) + return result; + } + + /// + /// 刪除入庫單 + /// + /// 入庫單號 + /// 順序 + /// + [HttpDelete("{no}/{seq}")] + public async Task> DeleteFqcInhouseMaster(string no, int seq) + { + ResultModel result = new ResultModel(); + var fqcInhouseMaster = await _context.FqcInhouseMasters.FindAsync(no, seq); + + try { - if (FqcInhouseMasterExists(fqcInhouseMaster.InhouseNo)) + if (fqcInhouseMaster == null) { - return Conflict(); + result.Success = false; + result.Msg = "找不到要刪除資料"; } else { - throw; + _context.FqcInhouseMasters.Remove(fqcInhouseMaster); + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } } - - return CreatedAtAction("GetFqcInhouseMaster", new { id = fqcInhouseMaster.InhouseNo }, fqcInhouseMaster); - } - - // DELETE: api/FqcInhouseMaster/5 - [HttpDelete("{id}")] - public async Task> DeleteFqcInhouseMaster(string id) - { - var fqcInhouseMaster = await _context.FqcInhouseMasters.FindAsync(id); - if (fqcInhouseMaster == null) + catch (Exception ex) { - return NotFound(); + result.Success = false; + result.Msg = ex.Message; } - - _context.FqcInhouseMasters.Remove(fqcInhouseMaster); - await _context.SaveChangesAsync(); - - return fqcInhouseMaster; + return result; } private bool FqcInhouseMasterExists(string id) diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/StatusTypeController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/StatusTypeController.cs index a7af0a0e..5edd579b 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/StatusTypeController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/StatusTypeController.cs @@ -86,7 +86,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES catch (Exception ex) { result.Success = false; - result.Msg = "更新失敗!,錯誤訊息:" + ex.InnerException.Message; + result.Msg = "更新失敗!,代碼已重複使用"; } return result; } @@ -111,7 +111,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { result.Success = false; //result.Msg = ex.Message; - result.Msg = "新增失敗!,錯誤訊息:" + ex.InnerException.Message; + result.Msg = "新增失敗!,代碼已重複使用"; } return result; } diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseMaster.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseMaster.cs index e2dcc2ef..91c7c740 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseMaster.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/FqcInhouseMaster.cs @@ -201,5 +201,6 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Column("UPDATE_DATE")] [DataMember] public DateTime? UpdateDate { get; set; } = DateTime.Now; + } } diff --git a/AMESCoreStudio.WebApi/Models/AMES/NgInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/NgInfo.cs index 57a7e536..8f924254 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/NgInfo.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/NgInfo.cs @@ -17,11 +17,11 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// 測試不良ID /// [Key] - [Column("NG_ID", TypeName = "NUMBER")] + [Column("NG_ID")] [DataMember] [Display(Name = "測試不良ID")] [Required] - public decimal NgID { get; set; } + public int NgID { get; set; } /// /// 測試種類代碼 @@ -36,7 +36,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 測試員代號 /// - [Column("OPERATOR_ID", TypeName = "NUMBER")] + [Column("OPERATOR_ID")] [Display(Name = "測試員代號")] [DataMember] public int OperatorID { get; set; } @@ -74,18 +74,18 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 測試總點數 /// - [Column("TEST_QTY", TypeName = "NUMBER")] + [Column("TEST_QTY")] [Display(Name = "測試總點數")] [DataMember] - public decimal TestQty { get; set; } = 0; + public int TestQty { get; set; } = 0; /// /// 不良總點數 /// - [Column("NG_QTY", TypeName = "NUMBER")] + [Column("NG_QTY")] [Display(Name = "不良總點數")] [DataMember] - public decimal NgQty { get; set; } = 0; + public int NgQty { get; set; } = 0; /// /// 開始測試時間 @@ -116,7 +116,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 內部條碼ID /// - [Column("BARCODE_ID", TypeName = "NUMBER")] + [Column("BARCODE_ID")] [Display(Name = "內部條碼ID")] [DataMember] public int BarcodeID { get; set; } @@ -124,7 +124,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 流程站別ID /// - [Column("RULE_STATION_ID", TypeName = "NUMBER")] + [Column("RULE_STATION_ID")] [Display(Name = "流程站別ID")] [DataMember] public int RuleStationId { get; set; } @@ -132,7 +132,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 工單ID /// - [Column("WIP_ID", TypeName = "NUMBER")] + [Column("WIP_ID")] [Display(Name = "工單ID")] [DataMember] public int WipId { get; set; } @@ -140,10 +140,10 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 處理狀態(0:尚未維修處理, 1:已維修處理, 2:誤判) /// - [Column("STATUS", TypeName = "NUMBER")] + [Column("STATUS")] [Display(Name = "處理狀態")] [DataMember] - public decimal Status { get; set; } = 0; + public int Status { get; set; } = 0; /// /// 不良現象原因代碼 @@ -157,18 +157,18 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 不良代碼指向的下一站ID /// - [Column("NEXT_STATION_ID", TypeName = "NUMBER")] + [Column("NEXT_STATION_ID")] [Display(Name = "不良代碼指向的下一站ID")] [DataMember] - public decimal NextStationId { get; set; } = -1; + public int NextStationId { get; set; } = -1; /// /// 不良時的組件數量 /// - [Column("ITEM_QTY", TypeName = "NUMBER")] + [Column("ITEM_QTY")] [Display(Name = "不良時的組件數量")] [DataMember] - public decimal ItemQty { get; set; } = -1; + public int ItemQty { get; set; } = -1; /// /// 不良備註 diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index 404257de..bb6079b2 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -610,6 +610,7 @@ namespace AMESCoreStudio.WebApi /// public DbSet NgRepairBlobs { get; set; } + /// /// 過站狀態檔 /// public virtual DbSet StatusTypes { get; set; }