From 555aad5a15d93bdeb3d0064fdaac83a954087ed1 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 16 Dec 2021 05:10:17 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=9B=B4=E6=96=B0Model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 22 +++--- .../ViewModels/PCS/PCS021ViewModel.cs | 78 ++++++++++++------- AMESCoreStudio.Web/Views/PCS/PCS021.cshtml | 4 +- .../Views/Shared/PCS/_SOPPartial.cshtml | 4 +- .../Models/AMES/MaterialItem.cs | 13 ++-- .../Models/AMES/MaterialKp.cs | 2 + .../Models/AMES/MaterialOutfit.cs | 8 +- .../Models/AMES/MaterialStationsItem.cs | 5 ++ AMESCoreStudio.WebApi/Models/AMES/WipSop.cs | 2 + 9 files changed, 88 insertions(+), 50 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 9e71c9cb..0f7c2f08 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1545,16 +1545,18 @@ namespace AMESCoreStudio.Web.Controllers { await GetFactoryUnit(); await GetLineInfo(); - model.WipInfo.WipNO = "WO0001A1"; - var q = await _pcsApi.GetWipInfoByWipNO(model.WipInfo.WipNO); - if (q.Count() != 0) - { - model.WipInfo = q.Where(w => w.UnitNO == model.WipInfo.UnitNO).FirstOrDefault(); - model.wipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); - model.WipSopLog = await _pcsApi.GetWipSopLog(model.WipInfo.WipID); - model.wipSop = await _pcsApi.GetWipSop(model.WipSopLog.WipSopID); - model.materialKpDto = await _pcsApi.GetMaterialKpQuery(model.wipAtt.ItemNO, model.WipInfo.UnitNO); - } + model.WipNO = "WO0001A1"; + var q = await _pcsApi.GetWipInfoByWipNO(model.WipNO); + //if (q.Count() != 0) + //{ + // model.ItemNO = _pcsApi.GetWipAtt(model.WipNO) + + // model.WipInfo = q.Where(w => w.UnitNO == model.WipInfo.UnitNO).FirstOrDefault(); + // model.wipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); + // model.WipSopLog = await _pcsApi.GetWipSopLog(model.WipInfo.WipID); + // model.wipSop = await _pcsApi.GetWipSop(model.WipSopLog.WipSopID); + // model.materialKpDto = await _pcsApi.GetMaterialKpQuery(model.wipAtt.ItemNO, model.WipInfo.UnitNO); + //} //var a = _pcsApi.GetWipInfoByWipNO() //try //{ diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs index c978726b..c861d850 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs @@ -10,36 +10,56 @@ namespace AMESCoreStudio.Web.ViewModels.PCS { public class PCS021ViewModel { + /// + /// 供單號碼 + /// + public string WipNO { get; set; } + + /// + /// 工單數 + /// + public int PlanQTY { get; set; } = 0; + + /// + /// 線別 + /// + public int? LineID { get; set; } + + /// + /// 生產單位 + /// + public string UnitNO { get; set; } + + /// + /// 作業暫 + /// + public string Station { get; set; } + + /// + /// SOP路徑 + /// + public string SopPath { get; set; } = ""; + + /// + /// 料號 + /// + public string ItemNO { get; set; } + + /// + /// input + /// + public string Input { get; set; } + + /// + /// input + /// + public List Inputs { get; set; } + + /// + /// 料號相關資料 治具 工項 keyparts + /// + public MaterialItem MaterialItem { get; set; } - //public string WipNO { get; set; } - //public int PlanQTY { get; set; } = 0; - - //public int? LineID { get; set; } - - //public string UnitNO { get; set; } = "1"; - - //public string itemNO - - // public string input - - // public IEnumerable materialStations - - // public IEnumerable materialOutfits - - public WipInfo WipInfo { get; set; } - - public WipAtt wipAtt { get; set; } - - public WipSop wipSop { get; set; } - - public WipSopLog WipSopLog {get;set;} - - public IEnumerable materialKpDto { get; set; } - - - public IEnumerable WipBarcodes { get; set; } - - public IEnumerable RuleStation { get; set; } } } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml index 900c8c6a..53b360e4 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml @@ -1,4 +1,4 @@ -@model AMESCoreStudio.Web.ViewModels.PCS.PCS021ViewModel +@*@model AMESCoreStudio.Web.ViewModels.PCS.PCS021ViewModel @{ ViewData["Title"] = "過站作業"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; @@ -295,4 +295,4 @@ }); -} +}*@ diff --git a/AMESCoreStudio.Web/Views/Shared/PCS/_SOPPartial.cshtml b/AMESCoreStudio.Web/Views/Shared/PCS/_SOPPartial.cshtml index 731f8a0b..cbd91ed6 100644 --- a/AMESCoreStudio.Web/Views/Shared/PCS/_SOPPartial.cshtml +++ b/AMESCoreStudio.Web/Views/Shared/PCS/_SOPPartial.cshtml @@ -6,7 +6,7 @@

-
+ @*
編號
@Model.wipSop.NewName
屬性
@@ -15,7 +15,7 @@
名稱
@Model.wipSop.NewName
-
+
*@
diff --git a/AMESCoreStudio.WebApi/Models/AMES/MaterialItem.cs b/AMESCoreStudio.WebApi/Models/AMES/MaterialItem.cs index c40bfdfd..bbe20099 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/MaterialItem.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/MaterialItem.cs @@ -2,6 +2,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; +using System.Collections.Generic; #nullable disable @@ -81,19 +82,19 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 料號治具資訊資料檔 /// - [ForeignKey("ItemID")] - public virtual IEquatable materialOutfits { get; set; } + + public virtual List MaterialOutfits { get; set; } /// /// 料號治具資訊資料檔 /// - [ForeignKey("ItemID")] - public virtual IEquatable materialKps { get; set; } + + public virtual List MaterialKps { get; set; } /// /// 料號站別工項資料檔 /// - [ForeignKey("ItemID")] - public virtual IEquatable materialStationsItems { get; set; } + + public virtual List MaterialStationsItems { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Models/AMES/MaterialKp.cs b/AMESCoreStudio.WebApi/Models/AMES/MaterialKp.cs index af9e74ca..45bffb31 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/MaterialKp.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/MaterialKp.cs @@ -20,6 +20,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Key] [Column("MATERIAL_KP_ID")] [DataMember] + [Required] public int MaterialKpID { get; set; } /// @@ -28,6 +29,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Column("ITEM_ID")] [Display(Name = "料號ID")] [DataMember] + [Required] public int ItemID { get; set; } /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/MaterialOutfit.cs b/AMESCoreStudio.WebApi/Models/AMES/MaterialOutfit.cs index e35510f1..a1a90fd0 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/MaterialOutfit.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/MaterialOutfit.cs @@ -29,7 +29,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Required(ErrorMessage = "{0},不能空白")] [Display(Name = "料號ID")] [Column("ITEM_ID")] - public int ItemId { get; set; } + public int ItemID { get; set; } /// /// 治具NO @@ -83,5 +83,11 @@ namespace AMESCoreStudio.WebApi.Models.AMES [DataMember] [Required] public DateTime? UpdateDate { get; set; } + + /// + /// 料號主檔 + /// + [ForeignKey("ItemID")] + public virtual MaterialItem MaterialItem { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Models/AMES/MaterialStationsItem.cs b/AMESCoreStudio.WebApi/Models/AMES/MaterialStationsItem.cs index 117c67bb..461d8e42 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/MaterialStationsItem.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/MaterialStationsItem.cs @@ -113,5 +113,10 @@ namespace AMESCoreStudio.WebApi.Models.AMES public DateTime? UpdateDate { get; set; } + /// + /// 料號主檔 + /// + [ForeignKey("ItemID")] + public virtual MaterialItem MaterialItem { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipSop.cs b/AMESCoreStudio.WebApi/Models/AMES/WipSop.cs index 4c62486c..a30a06c7 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipSop.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipSop.cs @@ -117,5 +117,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// [ForeignKey("UnitNo")] public virtual AMESCoreStudio.WebApi.Models.BAS.FactoryUnit FactoryUnit { get; set; } + + public virtual List WipSopLogs { get; set; } } }