From 7a8900b498f51045b67839b8111dfb15e8394658 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 23 Nov 2022 11:42:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E9=81=8E=E7=AB=99SOP=E5=88=A4=E6=96=B7=20?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=A8=99=E6=BA=96SOP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 38 +++++++++++++------ AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 10 ++++- .../Controllers/AMES/WipSopController.cs | 3 +- .../QASRV/DocEsopViewController.cs | 12 ++++++ AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs | 5 +++ 5 files changed, 55 insertions(+), 13 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 899bc60e..1583babc 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -5368,18 +5368,34 @@ namespace AMESCoreStudio.Web.Controllers model.KpItemName = string.Empty; // 工單SOP - model.Sops.Add(new PCS021ViewModel_SOP - { - SopName = "SOP文件", - SopPath = "/PDF/標準SOP.pdf" - }); - - model.Sops.Add(new PCS021ViewModel_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.SOPPath); + if (Esop.Count != 0) + { + model.Sops.Add(new PCS021ViewModel_SOP + { + SopName = "SOP文件", + SopPath = @$"\\qasrv-n\Web\ISOZone\{Esop.FirstOrDefault().file_path}" + }); + } + } + // 暫行SOP D + if (wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "D").Any()) { - SopName = "暫行文件", - SopPath = "/PDF/暫行SOP.pdf" - }); - + var wipSOPTypeD = wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "D") + .OrderByDescending(w => w.UpdateTime).FirstOrDefault(); + model.Sops.Add(new PCS021ViewModel_SOP + { + SopName = "暫行文件", + SopPath = "/PDF/暫行SOP.pdf" + }); + } + // 不二過 model.Sops.Add(new PCS021ViewModel_SOP { SopName = "不二過", diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index f951351c..916a8d37 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -8,6 +8,7 @@ using AMESCoreStudio.WebApi.Models.AMES; using AMESCoreStudio.WebApi.Models.BAS; using AMESCoreStudio.CommonTools.Result; using AMESCoreStudio.WebApi.DTO.AMES; +using AMESCoreStudio.WebApi.Models.QASRV; namespace AMESCoreStudio.Web { @@ -1266,7 +1267,6 @@ namespace AMESCoreStudio.Web ITask> PostWipReturn([FromBody, RawJsonContent] string model); #endregion - #region 取出貨序號 [WebApiClient.Attributes.HttpGet("api/SerialRules/ByQurey/{itemNo}/{lotNo}/{num}")] ITask> GetSerialRuleByQurey(string itemNo, string lotNo, int num); @@ -1359,5 +1359,13 @@ namespace AMESCoreStudio.Web #endregion //YIRU End ---------------------------------------------------------------------------------------- + + /// + /// 查詢標準SOP路徑 + /// + /// 編號 + /// + [WebApiClient.Attributes.HttpGet("api/DocEsopView/ByNo/{id}")] + ITask> GetDocEsopViewByNo(string id); } } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipSopController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipSopController.cs index 239bfac7..f9c9e18e 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipSopController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipSopController.cs @@ -78,7 +78,8 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES SOPPath = q1.SOPPath, SOPType = q1.SOPType, UnitNo = q1.UnitNo, - UnitNoName = q2.UnitName + UnitNoName = q2.UnitName, + UpdateTime = q1.UpdateDate }; var result = await q.ToListAsync(); diff --git a/AMESCoreStudio.WebApi/Controllers/QASRV/DocEsopViewController.cs b/AMESCoreStudio.WebApi/Controllers/QASRV/DocEsopViewController.cs index ce4bf4da..3f3186dc 100644 --- a/AMESCoreStudio.WebApi/Controllers/QASRV/DocEsopViewController.cs +++ b/AMESCoreStudio.WebApi/Controllers/QASRV/DocEsopViewController.cs @@ -39,5 +39,17 @@ namespace AMESCoreStudio.WebApi.Controllers.QASRV IQueryable q = _context.DocEsopViews; return await q.Take(100).ToListAsync(); } + + /// + /// Get標準SOP路徑 By documentNo + /// + /// 編號 + /// + [HttpGet("ByNo/{id}")] + public async Task>> GetDocEsopViewByNo(string id) + { + IQueryable q = _context.DocEsopViews.Where(w => w.document_no == id); + return await q.Take(100).ToListAsync(); + } } } diff --git a/AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs index 84401700..436c864f 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs @@ -64,5 +64,10 @@ namespace AMESCoreStudio.WebApi.DTO.AMES public string UnitNoName { get; set; } + /// + /// 更新時間 + /// + public DateTime? UpdateTime { get; set; } + } }