diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 48d65116..250439ae 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -2691,26 +2691,7 @@ namespace AMESCoreStudio.Web.Controllers } // 組件清單 - var barcodeitems = await _pcsApi.GetBarcodeItemByBarCodeID(result_barcodeinfo.BarcodeID); - foreach (var barcodeitem in barcodeitems.OrderBy(o => o.CreateDate)) - { - result.BarCodeKPs.Add(new BarCodeKP - { - Station = barcodeitem.S.StationDesc, - KPPartNo = barcodeitem.PartNo, - KPItemNo = barcodeitem.KpItemNo, - InputDate = barcodeitem.CreateDate.ToString() - }); - } - var wipKp = await _pcsApi.GetWipKpByWipNo(result.WinInfos.FirstOrDefault().WipNo); - wipKp = wipKp.OrderBy(o => o.KpSeq).ToList(); - int i = 0; - foreach(var item in result.BarCodeKPs.OrderBy(o => o.InputDate)) - { - item.KPItemNo = wipKp[i].KpName; - item.No = wipKp[i].KpNoName; - i++; - } + result.BarCodeKPs = await _pcsApi.GetBarcodeItemByBarCodeIDPCS009(result_barcodeinfo.BarcodeID); // 治具清單 @@ -2726,18 +2707,8 @@ namespace AMESCoreStudio.Web.Controllers } // 組件變更 - var barcodeitemchanges = await _pcsApi.GetBarcodeItemChangesByBarCodeID(result_barcodeinfo.BarcodeID); - foreach (var barcodeitemchange in barcodeitemchanges.OrderBy(o => o.CreateDate)) - { - result.KPChanges.Add(new KPChange - { - KPPartNo = barcodeitemchange.PartNoOld, - KPItemNo = barcodeitemchange.ItemNo, - ChangeType = barcodeitemchange.ChangeType, - Date = barcodeitemchange.CreateDate.ToString(), - User = barcodeitemchange.CreateUserID.ToString() - }); - } + result.KPChanges = await _pcsApi.GetBarcodeItemChangesByBarCodeIDPCS009(result_barcodeinfo.BarcodeID); + return View(result); @@ -3506,11 +3477,10 @@ namespace AMESCoreStudio.Web.Controllers } } - //var wipsop = await _pcsApi.GetWipSop(q.FirstOrDefault().WipID); - //if (wipsop != null) - //{ - // ////model.SopPath = wipsop.GetMaterialSop.FilePath + wipsop.GetMaterialSop.NewName; - //} + // 工程工單備註 + var wipsystem = await _pcsApi.GetWipSystem(model.WipNO); + if (wipsystem != null) + model.SystemMemo = wipsystem.Memo; } diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index e23b8151..ed8763aa 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -316,7 +316,7 @@ namespace AMESCoreStudio.Web #endregion - #region BarcodeItem BarCode組件維護 PCS021 + #region BarcodeItem BarCode組件維護 PCS021 PCS009 /// /// 查詢組件序號 by BarCodeID /// @@ -324,6 +324,13 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/BarcodeItems/ByBarCodeID")] ITask> GetBarcodeItemByBarCodeID(int barcodeID); + /// + /// 查詢組件序號 by BarCodeID 生產履歷 + /// + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeItems/ByBarCodeIDPCS009")] + ITask> GetBarcodeItemByBarCodeIDPCS009(int barcodeID); + /// /// 查詢組件序號 by BarCode /// @@ -763,8 +770,8 @@ namespace AMESCoreStudio.Web /// BarcodeItemChanges By BarCodeID /// /// - [WebApiClient.Attributes.HttpGet("api/BarcodeItemChanges/{id}")] - ITask> GetBarcodeItemChangesByBarCodeID(int id); + [WebApiClient.Attributes.HttpGet("api/BarcodeItemChanges/ByBarCodeIDPCS009/{id}")] + ITask> GetBarcodeItemChangesByBarCodeIDPCS009(int id); #endregion diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs index c9faca86..dd23a132 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs @@ -15,8 +15,8 @@ namespace AMESCoreStudio.Web.ViewModels.PCS WinInfos = new List(); BarCodeLogs = new List(); BarCodeChanges = new List(); - BarCodeKPs = new List(); - KPChanges = new List(); + BarCodeKPs = new List(); + KPChanges = new List(); Outfits = new List(); } @@ -68,7 +68,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// /// 組件清單 /// - public List BarCodeKPs { get; set; } + public List BarCodeKPs { get; set; } /// /// 治具清單 @@ -83,7 +83,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// /// 組件變更 /// - public List KPChanges { get; set; } + public List KPChanges { get; set; } } /// @@ -178,36 +178,6 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public string InputDate { get; set; } } - /// - /// 組件清單 - /// - public class BarCodeKP - { - /// - /// 編號名稱 - /// - public string No { get; set; } - - /// - /// 站别 - /// - public string Station { get; set; } - - /// - /// 組件代碼 - /// - public string KPPartNo { get; set; } - - /// - /// 組件料號 - /// - public string KPItemNo { get; set; } - - /// - /// 過站日期 - /// - public string InputDate { get; set; } - } /// /// 治具清單 diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs index 5f719866..d1b12504 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs @@ -105,6 +105,12 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// 站別測試類別代碼 /// public string StationTestType { get; set; } + + /// + /// 工程備註 + /// + public string SystemMemo { get; set; } + /// /// inputs /// diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml index 4bf85148..d889676c 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml @@ -252,19 +252,19 @@ { - @index.Station + @index.StationName - @index.No + @index.ItemNoName - @index.KPPartNo + @index.PartNo - @index.KPItemNo + @index.KpItemNo - @index.InputDate + @index.CreateDate } @@ -316,6 +316,49 @@
組件變更
+ + + + + + + + + + + + @foreach (var index in Model.KPChanges) + { + + + + + + + + } + +
+ 站別名稱 + + 組件名稱 + + (舊)組件條碼 + + 替換人員 + + 替換時間 +
+ @index.StationName + + @index.ItemNoName + + @index.PartNoOld + + @index.CreateUser + + @index.CreateDate +
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml index e12b51d8..ace160b7 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml @@ -196,6 +196,12 @@
+
+ 工程備註 +
+ +
+
KeyParts
@@ -325,7 +331,16 @@ } else { $("#inputNo").hide(); - } + } + + + @if (!string.IsNullOrWhiteSpace(Model.SystemMemo)) + { + $("#Memo").show(); + } + else + { $("#Memo").hide(); } + }); // Jquery 將兩邊DIV設定同高度 diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemChangesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemChangesController.cs index 40ec1892..6378a94a 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemChangesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemChangesController.cs @@ -68,6 +68,35 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return barcodeItemChange; } + /// + /// 用barcodeID獲取資料 By生產履歷 + /// + /// barcodeID + /// + [HttpGet("ByBarCodeIDPCS009/{id}")] + public async Task>> GetBarcodeItemChangesByBarCodeIDPCS009(int id) + { + var q = from q1 in _context.BarcodeItemChanges.Where(w => w.BarcodeID == id) + join q2 in _context.Items on q1.ItemNo equals q2.ItemNo + join q3 in _context.RuleStations on q1.RuleStationID equals q3.RuleStationID + join q4 in _context.UserInfoes on q1.CreateUserID equals q4.UserID + select new BarcodeItemChangeDTO + { + BarcodeID = q1.BarcodeID, + WipID = q1.WipID, + PartNoOld = q1.PartNoOld, + KpItemNo = q1.KpItemNo, + ItemNoName = q2.ItemName, + StationName = q3.StationDesc, + RuleStationID = q1.RuleStationID, + CreateUser = q4.UserName, + CreateDate = q1.CreateDate, + ChangeType = q1.ChangeType + }; + + return await q.ToListAsync(); + } + /// /// 更新條碼资料 /// diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs index b46eb475..cf51fe21 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs @@ -242,6 +242,35 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return barcodeItem; } + /// + /// 用barcodeID獲取資料 By生產履歷 + /// + /// barcodeID + /// + [HttpGet("ByBarCodeIDPCS009")] + public async Task>> GetBarcodeItemByBarCodeIDPCS009(int barcodeID) + { + var q = from q1 in _context.BarcodeItems.Where(w => w.BarcodeID == barcodeID) + join q2 in _context.Items on q1.ItemNo equals q2.ItemNo + join q3 in _context.RuleStations on q1.RuleStationID equals q3.RuleStationID + join q4 in _context.UserInfoes on q1.CreateUserID equals q4.UserID + select new BarcodeItemDTO + { + BarcodeID = q1.BarcodeID, + WipID = q1.WipID, + PartNo = q1.PartNo, + KpItemNo = q1.KpItemNo, + ItemNoName = q2.ItemName, + StationName = q3.StationDesc, + RuleStationID = q1.RuleStationID, + CreateUser = q4.UserName, + CreateDate = q1.CreateDate, + SysType = q1.SysType + }; + + return await q.ToListAsync(); + } + /// /// 用barcode獲取資料 /// diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs index 4ad21d72..eb0935f2 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs @@ -62,6 +62,18 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return WipAtt.FirstOrDefault(); } + /// + /// 查詢工單資料Att By 料號 + /// + /// 料號 + /// + [HttpGet("ByItemNo/{id}")] + public async Task>> GetWipAttByItemNo(string id) + { + IQueryable q = _context.WipAtts.Where(p => p.ItemNO == id.Trim().ToUpper()); + return await q.ToListAsync(); + } + /// /// 新增工單資料Att /// diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs index 24a7ee52..e5a79d33 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs @@ -73,7 +73,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES KpNoName = q3.ItemName }; - return await q.ToListAsync(); + return await q.OrderBy(o => o.KpSeq).ToListAsync(); } /// diff --git a/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemChangDTO.cs b/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemChangDTO.cs new file mode 100644 index 00000000..c9a8ec15 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemChangDTO.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// + /// 條碼组件變更資料檔 DTO + /// + public class BarcodeItemChangeDTO + { + /// + /// 内部條碼ID + /// + public int BarcodeItemChangeID { get; set; } + + /// + /// 内部條碼ID + /// + public int BarcodeID { get; set; } + + /// + /// 组件條碼 + /// + + public string PartNoOld { get; set; } + + /// + /// 系统狀態 + /// + + public string ChangeType { get; set; } + + /// + /// 组件代碼 + /// + + public string ItemNo { get; set; } + + /// + /// 组件代碼Name + /// + public string ItemNoName { get; set; } + + /// + /// 流程站别ID + /// + + public int RuleStationID { get; set; } + + /// + /// 流程站名稱 + /// + public string StationName { get; set; } + + /// + /// 工單ID + /// + + public int WipID { get; set; } + + + /// + /// 组件料號 + /// + + public string KpItemNo { get; set; } + + /// + /// 建立者 + /// + + public string CreateUser { get; set; } + + /// + /// 建立時間 + /// + + public DateTime CreateDate { get; set; } + + /// + /// 修改時間 + /// + + public DateTime UpdateDate { get; set; } + + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemDto.cs new file mode 100644 index 00000000..9384a571 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemDto.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// + /// 條碼组件資料檔 DTO + /// + + public class BarcodeItemDTO + { + + /// + /// 内部條碼ID + /// + public int BarcodeID { get; set; } + + /// + /// 工單ID + /// + public int WipID { get; set; } + + /// + /// 流程站 + /// + public string StationName { get; set; } + + /// + /// 流程站ID + /// + public int RuleStationID { get; set; } + + /// + /// 组件代碼Name + /// + + public string ItemNoName { get; set; } + + /// + /// 组件條碼 + /// + public string PartNo { get; set; } + + /// + /// 系统狀態 + /// + public string SysType { get; set; } + + /// + /// 组件料號 + /// + + public string KpItemNo { get; set; } + + /// + /// 建立者Name + /// + + public string CreateUser { get; set; } + + /// + /// 建立時間 + /// + + public DateTime CreateDate { get; set; } + + /// + /// 修改時間 + /// + public DateTime UpdateDate { get; set; } + + } +}