From 87521b276a779fbd2ce23cfdf610f188c55f061f Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 22 Mar 2022 19:19:37 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=AD=A3WIPSOP=E7=9B=B8=E9=97=9C?= =?UTF-8?q?=E5=8F=83=E6=95=B8=202.=20=E5=B7=A5=E5=96=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=B2=BB=E5=85=B7=E5=8F=8ASOP=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=AA=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 214 ++++++++--- AMESCoreStudio.Web/Enums/EnumPCS.cs | 25 ++ AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 90 ++++- .../ViewModels/PCS/WipViewModel.cs | 17 +- AMESCoreStudio.Web/Views/PCS/PCS001.cshtml | 361 +++++++++--------- AMESCoreStudio.Web/Views/PCS/PCS003.cshtml | 338 +++++++++------- .../AMES/PlmMeterialInfoeController.cs | 2 +- .../Controllers/AMES/WipKpsController.cs | 38 +- .../Controllers/AMES/WipOutfitController.cs | 171 +++++++++ .../Controllers/AMES/WipSopController.cs | 193 +++++----- .../DTO/AMES/WipOutfitDto.cs | 55 +++ AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs | 61 +++ .../Models/AMES/WipOutfit.cs | 107 ++++++ AMESCoreStudio.WebApi/Models/AMES/WipSop.cs | 74 ++-- .../Models/AMES/WipSystem.cs | 2 +- AMESCoreStudio.WebApi/Models/AMESContext.cs | 6 +- 16 files changed, 1222 insertions(+), 532 deletions(-) create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/WipOutfitController.cs create mode 100644 AMESCoreStudio.WebApi/DTO/AMES/WipOutfitDto.cs create mode 100644 AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/WipOutfit.cs diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index b24b5d73..c0b322bd 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -121,6 +121,7 @@ namespace AMESCoreStudio.Web.Controllers !string.IsNullOrWhiteSpace(model.Checksum) || !string.IsNullOrWhiteSpace(model.Cpu) || !string.IsNullOrWhiteSpace(model.DmiBi) || + !string.IsNullOrWhiteSpace(model.Bios) || !string.IsNullOrWhiteSpace(model.Ec) || !string.IsNullOrWhiteSpace(model.Fw) || !string.IsNullOrWhiteSpace(model.Fw) || @@ -147,6 +148,9 @@ namespace AMESCoreStudio.Web.Controllers if (string.IsNullOrWhiteSpace(model.Ram)) Msg += model.GetAttributeFrom(nameof(model.Ram)).Name + ","; + if (string.IsNullOrWhiteSpace(model.Bios)) + Msg += model.GetAttributeFrom(nameof(model.Bios)).Name + ","; + } return Msg; @@ -734,7 +738,6 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.GetWipSystemPMTypeSelect = q; } - /// /// 工單資訊 系統工程資訊 Type /// @@ -757,33 +760,24 @@ namespace AMESCoreStudio.Web.Controllers } /// - /// PCS List1 共用 BIOS/Checksum + /// SOP_Type /// - private void GetPCSList1() + /// + private void GetSOPTypeSelect(string SelectedValue = null) { - var PCSList1 = new List(){ - new SelectListItem() { - Text = "NA", - Value = "NA", - }, - new SelectListItem - { - Text = "Check", - Value = "Check", - }, - new SelectListItem - { - Text = "Program", - Value = "Program", - }, - new SelectListItem - { - Text = "備註說明", - Value = "備註說明", - } - }; + List values = new List(); + if (SelectedValue != null) + { + values = SelectedValue.Split(',').ToList(); + } + var q = Enum.GetValues(typeof(Enums.EnumWipSopType)).Cast() + .Select(s => new SelectListItem + { + Text = Enums.GetDisplayName(s).ToString(), + Value = s.ToString() + }).ToList(); - ViewBag.PCSList1 = PCSList1; + ViewBag.GetSOPTypeSelect = q; } /// @@ -958,7 +952,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion - #region JSON + #region resut Ajax JSON /// /// 生產單位 /// @@ -1010,6 +1004,19 @@ namespace AMESCoreStudio.Web.Controllers return Json(new { data = item }); } + [HttpPost] + public JsonResult GetSOPTypeJson(string id, string search) + { + var q = Enum.GetValues(typeof(Enums.EnumWipSopType)).Cast() + .Select(s => new SelectListItem + { + Text = Enums.GetDisplayName(s).ToString(), + Value = s.ToString() + }).ToList(); + + return Json(new { data = q }); + } + /// /// 回傳PLM料號品名 /// @@ -1109,9 +1116,10 @@ namespace AMESCoreStudio.Web.Controllers GetSolderPaste(); GetWipType(); GetCustomerType(); - GetPCSList1(); GetPCSOPList(); - + GetSOPTypeSelect(); + GetWipSystemTypeSelect(); + GetWipSystemPMTypeSelect(); GetCheckboxApproveLogo(); GetCheckboxCompanyLogo(); GetCheckboxPrintMode(); @@ -1143,8 +1151,10 @@ namespace AMESCoreStudio.Web.Controllers GetSolderPaste(); GetWipType(); GetCustomerType(); - GetPCSList1(); GetPCSOPList(); + GetSOPTypeSelect(); + GetWipSystemTypeSelect(); + GetWipSystemPMTypeSelect(); GetCheckboxApproveLogo(); GetCheckboxCompanyLogo(); GetCheckboxPrintMode(); @@ -1247,8 +1257,8 @@ namespace AMESCoreStudio.Web.Controllers var q = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO, unitNo: model.wipInfo.UnitNO, state: "Y"); if (q.Data.Count() != 0) { - model.wipSop.MaterialSopID = q.Data.FirstOrDefault().MaterialSopID; - await _pcsApi.PostWipSop(JsonConvert.SerializeObject(model.wipSop)); + ////model.wipSop.MaterialSopID = q.Data.FirstOrDefault().MaterialSopID; + ////await _pcsApi.PostWipSop(JsonConvert.SerializeObject(model.wipSop)); } // 內部條碼 @@ -1338,6 +1348,60 @@ namespace AMESCoreStudio.Web.Controllers return View(); } + [HttpPost] + public async Task PCS001CreateWipNo(WipDataViewModel model) + { + //await GetUnitList(); + await GetProductType(); + await GetFactoryInfo(); + await GetFactoryUnit(); + await GetLineInfo(); + await GetMFGType(); + await GetProcessTypes(); + await GetFlowRuleList(); + GetSMDType(); + GetDIPType(); + GetWipSEQType(); + GetBurnType(); + GetPartsBakeType(); + GetPCBBakeType(); + GetPCBWorkingType(); + GetSolderPaste(); + GetWipType(); + GetCustomerType(); + GetPCSOPList(); + GetSOPTypeSelect(); + GetWipSystemTypeSelect(); + GetWipSystemPMTypeSelect(); + GetCheckboxApproveLogo(); + GetCheckboxCompanyLogo(); + GetCheckboxPrintMode(); + GetCheckboxWipAttr(); + + model.wipAtt = await _pcsApi.GetWipAtt(model.wipInfo.WipNO); + model.wipBarcodes = await _pcsApi.GetWipBarcode(model.wipInfo.WipNO); + model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO); + + var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO); + model.materialSops = q1.Data; + + model.WipKps = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); + + model.wipBoard = await _pcsApi.GetWipBoard(model.wipInfo.WipNO); + + model.wipSystem = await _pcsApi.GetWipSystem(model.wipInfo.WipNO); + + model.wipMAC = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); + + model.wipLabel = await _pcsApi.GetWipLabel(model.wipInfo.WipNO); + + model.wipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.wipInfo.WipNO); + + model.Outfits = await _pcsApi.GetMaterialOutfitByItemNo(model.wipAtt.ItemNO); + + return View("PCS001", model); + } + public async Task PCS001R(int id) { @@ -1384,8 +1448,9 @@ namespace AMESCoreStudio.Web.Controllers GetSolderPaste(); GetWipType(); GetCustomerType(); - GetPCSList1(); GetPCSOPList(); + GetWipSystemTypeSelect(); + GetWipSystemPMTypeSelect(); GetCheckboxApproveLogo(model.wipLabel != null ? model.wipLabel.ApproveLogo : null); GetCheckboxCompanyLogo(model.wipLabel != null ? model.wipLabel.CompanyLogo : null); GetCheckboxPrintMode(model.wipLabel != null ? model.wipLabel.PrintMode : null); @@ -1415,11 +1480,8 @@ namespace AMESCoreStudio.Web.Controllers model.wipBarcodes = await _pcsApi.GetWipBarcode(model.wipInfo.WipNO); model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO); - var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO); - model.materialSops = q1.Data; - - model.WipKps = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); - + //var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO); + //model.materialSops = q1.Data; model.wipBoard = await _pcsApi.GetWipBoard(model.wipInfo.WipNO); model.wipSystem = await _pcsApi.GetWipSystem(model.wipInfo.WipNO); @@ -1430,7 +1492,11 @@ namespace AMESCoreStudio.Web.Controllers model.wipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.wipInfo.WipNO); - model.Outfits = await _pcsApi.GetMaterialOutfitByItemNo(model.wipAtt.ItemNO); + model.WipKps = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); + + model.WipOutfits = await _pcsApi.GetWipOutfitByWipNo(model.wipInfo.WipNO); + + model.WipSops = await _pcsApi.GetWipSopByWipNo(model.wipInfo.WipNO); } await GetProductType(); await GetFactoryInfo(); @@ -1451,8 +1517,8 @@ namespace AMESCoreStudio.Web.Controllers GetWipSystemTypeSelect(); GetWipSystemPMTypeSelect(); GetCustomerType(); - GetPCSList1(); GetPCSOPList(); + GetSOPTypeSelect(); GetCheckboxApproveLogo(model.wipLabel != null ? model.wipLabel.ApproveLogo : null); GetCheckboxCompanyLogo(model.wipLabel != null ? model.wipLabel.CompanyLogo : null); GetCheckboxPrintMode(model.wipLabel != null ? model.wipLabel.PrintMode : null); @@ -1481,8 +1547,8 @@ namespace AMESCoreStudio.Web.Controllers GetWipType(); GetWipSystemTypeSelect(); GetCustomerType(); - GetPCSList1(); GetPCSOPList(); + GetSOPTypeSelect(); GetCheckboxApproveLogo(); GetCheckboxCompanyLogo(); GetCheckboxPrintMode(); @@ -1491,9 +1557,6 @@ namespace AMESCoreStudio.Web.Controllers model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO); model.wipBarcodes = await _pcsApi.GetWipBarcode(model.wipInfo.WipNO); - var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO); - model.materialSops = q1.Data; - model.Outfits = await _pcsApi.GetMaterialOutfitByItemNo(model.wipAtt.ItemNO); IResultModel result; // Checkbox轉換 @@ -1517,13 +1580,6 @@ namespace AMESCoreStudio.Web.Controllers wipDataViewModel.wipBarcodeOther = model.wipBarcodeOther; var Msg = CheckWipInfoInsert(wipDataViewModel); - // KeyParts 判斷 - foreach (var item in model.WipKps) - { - item.WipNo = model.wipInfo.WipNO; - item.ItemNo = model.wipAtt.ItemNO; - } - if (!string.IsNullOrWhiteSpace(Msg)) { //model.wipInfo.ECNCheck = model.wipInfo.ECNCheck == "Y" ? "true" : "false"; @@ -1630,15 +1686,59 @@ namespace AMESCoreStudio.Web.Controllers result = await _pcsApi.PutMACInfoByClassGroup(mACInfo.ClassGroup, model.wipMAC.EndNO); } } - // KeyParts + // 先比對新舊ID 當舊ID有 新的沒有代表已刪除 + var resultOld_WipKp = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); + var delete_WipKpID = resultOld_WipKp.Select(s => s.WipKpID).Except(model.WipKps.Select(s => s.WipKpID)); + foreach(var id in delete_WipKpID) + { + await _pcsApi.DeleteWipKp(id); + } foreach (var item in model.WipKps) { + item.WipNo = model.wipInfo.WipNO; + item.ItemNo = model.wipAtt.ItemNO; if (item.WipKpID == 0) await _pcsApi.PostWipKp(JsonConvert.SerializeObject(item)); else await _pcsApi.PutWipKp(JsonConvert.SerializeObject(item)); } + + // 治具 + // 先比對新舊ID 當舊ID有 新的沒有代表已刪除 + var resultOld_WipOutfit = await _pcsApi.GetWipOutfitByWipNo(model.wipInfo.WipNO); + var delete_WipOutfit = resultOld_WipOutfit.Select(s => s.WipOutfitID).Except(model.WipOutfits.Select(s => s.WipOutfitID)); + foreach (var id in delete_WipOutfit) + { + await _pcsApi.DeleteWipOutfit(id); + } + foreach (var item in model.WipOutfits) + { + item.WipNo = model.wipInfo.WipNO; + item.ItemNo = model.wipAtt.ItemNO; + if (item.WipOutfitID == 0) + await _pcsApi.PostWipOutfit(JsonConvert.SerializeObject(item)); + else + await _pcsApi.PutWipOutfit(JsonConvert.SerializeObject(item)); + } + + // SOP + // 先比對新舊ID 當舊ID有 新的沒有代表已刪除 + var resultOld_WipSop = await _pcsApi.GetWipSopByWipNo(model.wipInfo.WipNO); + var delete_WipSop = resultOld_WipSop.Select(s => s.WipSOPID).Except(model.WipSops.Select(s => s.WipSOPID)); + foreach (var id in delete_WipSop) + { + await _pcsApi.DeleteWipSop(id); + } + foreach (var item in model.WipSops) + { + item.WipNo = model.wipInfo.WipNO; + item.ItemNo = model.wipAtt.ItemNO; + if (item.WipSOPID == 0) + await _pcsApi.PostWipSop(JsonConvert.SerializeObject(item)); + else + await _pcsApi.PutWipSop(JsonConvert.SerializeObject(item)); + } } WipCheck wipCheck = new WipCheck @@ -2001,8 +2101,6 @@ namespace AMESCoreStudio.Web.Controllers [HttpPost] public async Task PCS006ActiveStopAsync(int wipID, string statusNO, int LineID) { - IActionResult result; - WipLog wipLog = new WipLog(); wipLog.WipID = wipID; wipLog.WipDesc = "."; @@ -2922,11 +3020,11 @@ namespace AMESCoreStudio.Web.Controllers } } - var wipsop = await _pcsApi.GetWipSop(q.FirstOrDefault().WipID); - if (wipsop != null) - { - model.SopPath = wipsop.GetMaterialSop.FilePath + wipsop.GetMaterialSop.NewName; - } + //var wipsop = await _pcsApi.GetWipSop(q.FirstOrDefault().WipID); + //if (wipsop != null) + //{ + // ////model.SopPath = wipsop.GetMaterialSop.FilePath + wipsop.GetMaterialSop.NewName; + //} } diff --git a/AMESCoreStudio.Web/Enums/EnumPCS.cs b/AMESCoreStudio.Web/Enums/EnumPCS.cs index 36aa0b37..a7ee079f 100644 --- a/AMESCoreStudio.Web/Enums/EnumPCS.cs +++ b/AMESCoreStudio.Web/Enums/EnumPCS.cs @@ -173,6 +173,31 @@ namespace AMESCoreStudio.Web D = 4, } + /// + /// SOP Type + /// + public enum EnumWipSopType + { + /// + /// 參考 + /// + [Display(Name = "參考")] + 參考 = 1, + + /// + /// 正式 + /// + [Display(Name = "正式")] + 正式 = 2, + + /// + /// 發行 + /// + [Display(Name = "發行")] + 發行 = 3, + + } + /// /// Get Enum Display /// diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index c18eaddf..f992ce18 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -609,23 +609,6 @@ namespace AMESCoreStudio.Web ITask> PutMaterialSop(int id, string state); #endregion - #region WipSop 工單對應SOP - /// - /// 查詢工單對應SOP log - /// - /// - /// - [WebApiClient.Attributes.HttpGet("api/WipSop/{id}")] - ITask GetWipSop(int id); - - /// - /// 新增工單對應SOP - /// - /// - [WebApiClient.Attributes.HttpPost("api/WipSop")] - ITask> PostWipSop([FromBody, RawJsonContent] string model); - #endregion - #region PCS024組件維護相關 /// @@ -845,18 +828,87 @@ namespace AMESCoreStudio.Web ITask> GetWipKpByWipNo(string id); /// - /// 新增工單對應SOP + /// 新增工單KP資訊資料檔 /// /// [WebApiClient.Attributes.HttpPost("api/WipKps")] ITask> PostWipKp([FromBody, RawJsonContent] string model); /// - /// 新增工單對應SOP + /// 更新工單KP資訊資料檔 /// /// [WebApiClient.Attributes.HttpPut("api/WipKps")] ITask> PutWipKp([FromBody, RawJsonContent] string model); + + /// + /// 刪除工單KP資訊資料檔 + /// + /// + [WebApiClient.Attributes.HttpDelete("api/WipKps/{id}")] + ITask> DeleteWipKp(int id); + #endregion + + #region WipOutfit 工單治具資料檔 + /// + /// 查詢工單號碼 對應 WipOutfit + /// + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipOutfit/ByWipNo/{id}")] + ITask> GetWipOutfitByWipNo(string id); + + /// + /// 新增工單治具資料檔 + /// + /// + [WebApiClient.Attributes.HttpPost("api/WipOutfit")] + ITask> PostWipOutfit([FromBody, RawJsonContent] string model); + + /// + /// 更新工單治具資料檔 + /// + /// + [WebApiClient.Attributes.HttpPut("api/WipOutfit")] + ITask> PutWipOutfit([FromBody, RawJsonContent] string model); + + /// + /// 刪除工單治具資料檔 + /// + /// + [WebApiClient.Attributes.HttpDelete("api/WipOutfit/{id}")] + ITask> DeleteWipOutfit(int id); + #endregion + + #region WipSop 工單對應SOP + /// + /// 查詢工單號碼 對應 SOP + /// + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipSop/ByWipNo/{id}")] + ITask> GetWipSopByWipNo(string id); + + /// + /// 新增工單對應SOP + /// + /// + [WebApiClient.Attributes.HttpPost("api/WipSop")] + ITask> PostWipSop([FromBody, RawJsonContent] string model); + + /// + /// 更新工單對應SOP + /// + /// + [WebApiClient.Attributes.HttpPut("api/WipSop")] + ITask> PutWipSop([FromBody, RawJsonContent] string model); + + /// + /// 刪除工單對應SOP + /// + /// + [WebApiClient.Attributes.HttpDelete("api/WipSop/{id}")] + ITask>DeleteWipSop(int id); #endregion #region RuleStation 流程站別資料維護 diff --git a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs index 73a33eed..2352a86a 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs @@ -10,6 +10,17 @@ namespace AMESCoreStudio.Web.ViewModels.PCS { public class WipNoDetailViewModel { + public WipNoDetailViewModel() + { + wipBarcodes = new List(); + ruleStations = new List(); + materialSops = new List(); + WipKps = new List(); + Outfits = new List(); + WipSops = new List(); + WipOutfits = new List(); + } + /// /// 工單屬性 /// @@ -38,6 +49,10 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public IEnumerable WipKps { get; set; } + public IEnumerable WipOutfits { get; set; } + + public IEnumerable WipSops { get; set; } + public IEnumerable Outfits { get; set; } /// @@ -61,7 +76,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public WipBarcodeOther wipBarcodeOther { get; set; } } - public class WipDataViewModel: WipNoDetailViewModel + public class WipDataViewModel : WipNoDetailViewModel { /// diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml index b2b01104..2ec7c857 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml @@ -19,7 +19,7 @@
- + @**@
@@ -30,8 +30,10 @@
- + + +
@@ -39,7 +41,7 @@
- +
@@ -147,13 +149,14 @@
  • 工單屬性
  • -
  • 生產流程
  • 序號編碼
  • Keypart組合
  • +
  • 生產流程
  • 板卡-工程資訊
  • 系統-工程資訊
  • -
  • 標籤選項
  • +
  • 治具組合
  • SOP文件
  • +
  • 標籤選項
@* 工單屬性sheet *@ @@ -221,23 +224,6 @@
- @* 生產流程sheet *@ -
-
-
- -
- -
- -
-
- -
-
-
-
- @* 序號編碼sheet *@
@@ -292,6 +278,23 @@
+ @* 生產流程sheet *@ +
+
+
+ +
+ +
+ +
+
+ +
+
+
+
+ @* 板卡-工程資訊sheet *@
@@ -434,7 +437,7 @@
- +
@@ -450,7 +453,10 @@
- + +
+
+
@@ -459,7 +465,7 @@
- +
@@ -469,21 +475,18 @@
-
-
-
@@ -495,81 +498,120 @@
- + +
+ +
+ +
+
+ +
+ +
-
+ +
+ +
+
+
- +
+
+
- - + +
+
+ +
+
+
- +
- - +
-
- - +
-
- +
- +
- + +
+
+ +
+
+
- + +
+ +
+
+ +
- +
- + +
+ +
- + +
+
+
- + +
+ +
+
- +
-
- +
@@ -592,131 +634,58 @@
- @*
-
- -
- -
- -
- - -
- -
- - -
-
-
- -
-
- -
- -
- -
- - -
- -
- - -
-
-
- -
-
- -
- -
- -
- - -
- -
- - -
-
-
- -
-
- -
- -
- -
- - -
- -
- - -
-
-
- - -
-
- -
- - -
-
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
-
-
- -
-
- -
- -
-
-
*@ -
- +
+ @* 治具組合sheet *@ +
+ + @{ int j = 0;} + + + + + + + + + @foreach (var index in Model.Outfits) + { + + + + + + j++; + } + +
+ 治具NO + + 治具名稱 + + 流程名稱ID +
+ + @index.OutfitNo + + @index.StationType + + @index.RuleStationID +
+
+ + @* SOP文件 sheet *@ +
+ 刷新 +
+
+ @* 標籤選項sheet *@
@@ -752,11 +721,7 @@
- @* SOP文件 sheet *@ -
- 刷新 -
-
+
@@ -773,7 +738,7 @@ @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); await Html.RenderPartialAsync("_FileinputScriptsPartial"); } - + } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml index 32e99cb1..13695867 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -279,6 +279,9 @@
+
+ +
@@ -701,7 +704,7 @@
- +
@@ -755,50 +758,105 @@ @* 治具組合sheet *@ -
- - @{ int j = 0;} - +
+ 新增 + +
+ @{int l = 0;} + + + + + + + + + + @foreach (var index in Model.WipOutfits) + { - - - + + + + - - - @foreach (var index in Model.Outfits) - { - - - - - - j++; - } - -
+ 設備編碼 + + 設備名稱 + + 生產單位 + + +
- 治具NO - - 治具名稱 - - 流程名稱ID - + + + + + + + + 刪除 +
- - @index.OutfitNo - - @index.StationType - - @index.RuleStationID -
-
+ l++; + } + + + @* SOP文件 sheet *@ -
-
-
- -
+
+ 新增 + + + @{int i = 0;} + + + + + + + + + + + @foreach (var index in Model.WipSops) + { + + + + + + + + i++; + } + +
+ SOP檔案名稱 + + SOP路徑 + + SOP類型 + + 生產單位 + + +
+ + + + + + + + + + 刪除 +
+
+
+
@* 標籤選項sheet *@
@@ -880,7 +938,6 @@ element = layui.element, table = layui.table; - laydate.render({ elem: '#wipInfo_WipScheduleDate' , trigger: 'click' @@ -895,7 +952,7 @@ , theme: 'grid' }); - // 關鍵字 + // PLM料號關鍵字 $(".autocomplete").each(function () { layui.autocomplete({ element: this, @@ -907,16 +964,11 @@ query: {}, resArray: 'data', done: function (item) { - $(this.element).closest('div.layui-inline').find('input[id*=' + this.element.id + '_Desc]').val(item.meterialDesc); + $(this.element).closest('div.layui-inline').find('input[id*=' + this.element.id + '_Desc]').val(item.productionMemo); } }); }) - element.on('tab(test2)', function (data) { - alert("TAB"); - table && table.reload(data); - }); - form.on('select(flow)', function (data) { RuleStation(data.value); }); @@ -973,89 +1025,6 @@ }); }; - //PLM料號 - @*function getPLMMeterial(val) { - $.ajax( - { - url: "@Url.Action("getPLMMeterial", "PCS")", - dataType: 'json', - data: { "value": val.value}, - type: 'post', - success: function (result) - { - $(val).closest('div.layui-inline').find('input[id*=' + val.id + '_Desc]').val(result.data); - }, - error: function (result) - { - alert(result); - } - }); - };*@ - - var tableCols = [[ - { - field: 'itemNo', - width: 150, - title: '料號', - sort: true - }, - { - field: 'unitName', - title: '生產單位', - width: 200, - sort: true - }, - { - field: 'fileName', - title: '檔案名稱', - sort: true - }, - { - field: 'state', - title: '狀態', - width: 100, - sort: true - }, - { - field: 'createDate', - title: '建立日期', - width: 150, - templet: '
{{ layui.util.toDateString(d.createDate, "yyyy/MM/dd") }}
' - }, - { - field: 'updateDate', - title: '更新日期', - width: 150, - templet: '
{{ layui.util.toDateString(d.updateDate, "yyyy/MM/dd") }}
' - }, - { - field: 'right', - width: 80, - title: '操作', - align: 'center', - fixed: 'right', - templet: function (d) { - return '預覽' - } - }] - ]; - //通过行tool编辑,lay-event="show" - function show(obj) { - layui.use('layer', function () { - var layer = layui.layer; - layer.open({ - type: 2, - area: ['900px', '650px'], - fixed: false, //不固定 - maxmin: true, - content: obj.data.filePath + obj.data.newName - }); - }); - }; - - //基本数据表格 - var table = hg.table.datatable('query', 'SOP文件查詢維護', '/PCS/PCS030Query?itemNo=' + "@Model.wipAtt.ItemNO", {}, tableCols, false, 'full-100'); - // RuleStation function RuleStation(NewID) { if (NewID == null) { @@ -1125,15 +1094,66 @@ layui.form.render("select");//重新渲染 固定写法 }); + + // OutfitTableAdd + $('#OutfitTableAdd').click(); + $('#OutfitTableAdd').on('click', function () { + let No = parseInt($('#WipOutfitCount').val()); + var FactoryUnit = getFactoryUnitList(); + var Select = "'; + var contactdiv = '' + + '' + + '' + + '' + Select + '' + + '刪除' + + ''; + $('#OutfitTable').append(contactdiv); + $('#WipOutfitCount').val(No + 1); + + layui.form.render("select");//重新渲染 固定写法 + }); + + // SopTableAdd + $('#SopTableAdd').click(); + $('#SopTableAdd').on('click', function () { + let No = parseInt($('#WipSopCount').val()); + var FactoryUnit = getFactoryUnitList(); + var SOPType = getSOPType(); + var Select = "'; + var SelectSOPType = "'; + var contactdiv = '' + + '' + + '' + + '' + SelectSOPType + '' + + '' + Select + '' + + '刪除' + + ''; + $('#SopTable').append(contactdiv); + $('#WipSopCount').val(No + 1); + layui.form.render("select");//重新渲染 固定写法 + }); + // Table 刪除 function Remove(button) { //Determine the reference of the Row using the Button. var row = $(button).closest("TR"); - var table = $("#KPTable")[0]; + var table = $(button).closest("TABLE")[0]; //$("#KPTable")[0]; table.deleteRow(row[0].rowIndex); }; - // KPTable 生產單位選單 + //生產單位選單 function getFactoryUnitList() { var a; @@ -1155,6 +1175,58 @@ }); return a; }; + //SOPType + function getSOPType() { + var a; + $.ajax( + { + url: "@Url.Action("GetSOPTypeJson", "PCS")", + dataType: 'json', + data: {}, + async:false, + type: 'post', + success: function (result) + { + a = result.data; + }, + error: function (result) + { + alert(result); + } + }); + return a; + } + + // 產生MAC + $("#GetMAC").click(function (event) { + var wipNO = $('#wipAtt_ItemNO').val(); + var planQTY = $('#wipInfo_PlanQTY').val(); + if (wipNO == '' || !wipNO) { + parent.hg.msg("請輸入料號"); + return; + } + if (planQTY == '' || !planQTY || planQTY == 0) { + parent.hg.msg("請確認計畫數量"); + return; + } + $.ajax({ + url: '@Url.Action("GetMAC", "PCS")', + dataType:'json', + data: { "itemno": $("#wipAtt_ItemNO").val(), "planQTY": $('#wipInfo_PlanQTY').val()}, + cache: false, + type: "POST", + success: function (data, textStatus, jqXHR) { + if (data._msg != undefined) { + parent.hg.msg(data._msg); + } + $("#wipMAC_StartNO").val(data.mix); + $("#wipMAC_EndNO").val(data.max); + }, + error: function (jqXHR, textStatus, errorThrown) { + alert("Found error when using Ajax!!"); + } + }); + }); diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs index 818df101..d7e647d0 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs @@ -52,7 +52,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES [HttpGet("AutoComplete/{id}")] public async Task>> GetPlmMeterialInfoAutoComplete(string id) { - var plmMeterialInfo = await _context.PlmMeterialInfos.Where(w => w.MeterialNo.ToUpper().Contains(id.ToUpper())).ToListAsync(); + var plmMeterialInfo = await _context.PlmMeterialInfos.Where(w => w.MeterialNo.ToUpper().Contains(id.ToUpper())).Take(20).ToListAsync(); return plmMeterialInfo; } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs index efd67ffd..951e896b 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs @@ -145,7 +145,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { ResultModel result = new ResultModel(); Helper helper = new Helper(_context); - wipKp.WipKpID= helper.GetIDKey("WIP_KP_ID").Result; + wipKp.WipKpID = helper.GetIDKey("WIP_KP_ID").Result; //wipKp.UpdateDate = DateTime.Now; //wipKp.UpdateUserID = 0; //wipKp.UpdateDate = DateTime.Now; @@ -165,20 +165,38 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } - // DELETE: api/WipKps/5 + /// + /// 刪除工單KP資訊資料檔 + /// + /// + /// [HttpDelete("{id}")] - public async Task> DeleteWipKp(int id) + public async Task> DeleteWipKp(int id) { + ResultModel result = new ResultModel(); var wipKp = await _context.WipKps.FindAsync(id); - if (wipKp == null) + + try { - return NotFound(); + if (wipKp != null) + { + _context.WipKps.Remove(wipKp); + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + else + { + result.Success = true; + result.Msg = "找不到資料刪除"; + } } - - _context.WipKps.Remove(wipKp); - await _context.SaveChangesAsync(); - - return wipKp; + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } private bool WipKpExists(int id) diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipOutfitController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipOutfitController.cs new file mode 100644 index 00000000..5571663c --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipOutfitController.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using AMESCoreStudio.WebApi; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.CommonTools.Result; +using AMESCoreStudio.WebApi.DTO.AMES; + +namespace AMESCoreStudio.WebApi.Controllers.AMES +{ + /// + /// 工單治具資料檔 + /// + [Route("api/[controller]")] + [ApiController] + public class WipOutfitController : ControllerBase + { + private readonly AMESContext _context; + + public WipOutfitController(AMESContext context) + { + _context = context; + } + + // GET: api/WipOutfit + [HttpGet] + public async Task>> GetWipOutfits() + { + return await _context.WipOutfits.ToListAsync(); + } + + // GET: api/WipOutfit/5 + [HttpGet("{id}")] + public async Task> GetWipOutfit(int id) + { + var wipOutfit = await _context.WipOutfits.FindAsync(id); + + if (wipOutfit == null) + { + return NotFound(); + } + + return wipOutfit; + } + + /// + /// ByWipNo + /// + /// 工單號碼 + /// + [HttpGet("ByWipNo/{id}")] + public async Task>> GetWipOutfitByWipNo(string id) + { + var q = from q1 in _context.WipOutfits.Where(w => w.WipNo.Contains(id)) + join q2 in _context.FactoryUnits on q1.UnitNo equals q2.UnitNo + select new WipOutfitDto + { + WipOutfitID = q1.WipOutfitID, + WipNo = q1.WipNo, + ItemNo = q1.ItemNo, + OutfitNo = q1.OutfitNo, + PartNo = q1.PartNo, + UnitNo = q1.UnitNo, + UnitNoName = q2.UnitName + }; + + return await q.ToListAsync(); + } + + /// + /// 更新工單治具資料檔 + /// + /// + /// + [HttpPut] + public async Task> PutWipOutfit(WipOutfit wipOutfit) + { + ResultModel result = new ResultModel(); + _context.Entry(wipOutfit).State = EntityState.Modified; + //設置容器空間某一個模型的某一個欄位 不提交到資料庫 + //DbContent.Entry是要更新到資料庫的整個對象 + _context.Entry(wipOutfit).Property("CreateDate").IsModified = false; + _context.Entry(wipOutfit).Property("CreateUserID").IsModified = false; + wipOutfit.UpdateDate = DateTime.Now; + wipOutfit.UpdateUserID = 0; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + + } + return result; + } + + /// + /// 新增工單治具資料檔 + /// + /// + /// + [HttpPost] + public async Task> PostWipOutfit(WipOutfit wipOutfit) + { + ResultModel result = new ResultModel(); + Helper helper = new Helper(_context); + wipOutfit.WipOutfitID = helper.GetIDKey("WIP_OUTFIT_ID").Result; + _context.WipOutfits.Add(wipOutfit); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + /// + /// 刪除工單治具資料檔 + /// + /// + /// + [HttpDelete("{id}")] + public async Task> DeleteWipOutfit(int id) + { + ResultModel result = new ResultModel(); + var wipOutfit = await _context.WipOutfits.FindAsync(id); + + try + { + if (wipOutfit != null) + { + _context.WipOutfits.Remove(wipOutfit); + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + else + { + result.Success = true; + result.Msg = "找不到資料刪除"; + } + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + private bool WipOutfitExists(int id) + { + return _context.WipOutfits.Any(e => e.WipOutfitID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipSopController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipSopController.cs index 710e49ae..ef631a01 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipSopController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipSopController.cs @@ -8,10 +8,13 @@ using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi.Models.AMES; using AMESCoreStudio.CommonTools.Result; using AMESCoreStudio.WebApi.DTO.AMES; -// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 + namespace AMESCoreStudio.WebApi.Controllers.AMES { + /// + /// 工單製程對應SOP資料檔 + /// [Route("api/[controller]")] [ApiController] public class WipSopController : ControllerBase @@ -35,7 +38,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES public async Task>> GetWipSop() { IQueryable q = _context.WipSops; - q = q.OrderBy(p => p.MaterialSopID); + ////q = q.OrderBy(p => p.MaterialSopID); var WipSop = await q.ToListAsync(); return WipSop; } @@ -45,7 +48,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { IQueryable q = _context.WipSops; - var WipSop = await q.Where(p => p.WipID == id).FirstOrDefaultAsync(); + var WipSop = await q.Where(p => p.WipSOPID == id).FirstOrDefaultAsync(); //if (WipSopLog == null) //{ @@ -55,75 +58,44 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return WipSop; } + /// - /// SOP文件查詢 + /// ByWipNo /// - /// 料號 - /// 生產單位 - /// 檔案名稱 - /// 狀態 - /// 建立日期起 - /// 建立日期迄 + /// 工單號碼 /// - //[Route("[action]")] - //[HttpGet] - //public async Task> GetWipSopLogQuery(string itemNo = null, string unitNo = null - // , string fileName = null, string state = null, string date_str = null, string date_end = null) - //{ - // IQueryable q = _context.WipSopLogs; - - // if (!string.IsNullOrWhiteSpace(itemNo)) - // q = q.Where(w => w.ItemNo == itemNo); - - // if (!string.IsNullOrWhiteSpace(unitNo)) - // q = q.Where(w => w.UnitNo == unitNo); - - // if (!string.IsNullOrWhiteSpace(fileName)) - // q = q.Where(w => w.FileName.Contains(fileName)); - - // if (!string.IsNullOrWhiteSpace(state)) - // q = q.Where(w => w.State == state); - - - // DateTime dateValue; - // if (DateTime.TryParse(date_str, out dateValue)) - // { - // q = q.Where(w => w.CreateDate >= DateTime.Parse(date_str)); - // } - - // if (DateTime.TryParse(date_end, out dateValue)) - // { - // q = q.Where(w => w.CreateDate <= DateTime.Parse(date_end)); - // } - - // ResultModel result = new ResultModel(); - // result.Data = await q.Select(s => new WipSopLogDto - // { - // WipSopLogID = s.WipSopLogID, - // ItemNo = s.ItemNo, - // UnitName = s.FactoryUnit.UnitName, - // FileName = s.FileName, - // FilePath = s.FilePath, - // State = s.State == "Y" ? "使用中" : "停用", - // NewName = s.NewName, - // CreateDate = s.CreateDate, - // CreateUserID = s.CreateUserID, - // UpdateDate = s.UpdateDate, - // UpdateUserID = s.UpdateUserID - // }).ToListAsync(); - - // return result; - //} + [HttpGet("ByWipNo/{id}")] + public async Task>> GetWipSopByWipNo(string id) + { + var q = from q1 in _context.WipSops.Where(w => w.WipNo == id) + join q2 in _context.FactoryUnits on q1.UnitNo equals q2.UnitNo + select new WipSopDto + { + WipSOPID = q1.WipSOPID, + WipNo = q1.WipNo, + ItemNo = q1.ItemNo, + SOPName = q1.SOPName, + SOPPath = q1.SOPPath, + SOPType = q1.SOPType, + UnitNo = q1.UnitNo, + UnitNoName = q2.UnitName + }; + + return await q.ToListAsync(); + } + /// + /// 新增工單製程對應SOP資料檔 + /// + /// + /// [HttpPost] public async Task> PostWipSop([FromBody] WipSop wipSop) { ResultModel result = new ResultModel(); Helper helper = new Helper(_context); - wipSop.WipID = helper.GetIDKeyNoPost("WIP_ID").Result; - wipSop.Status = "Y"; - //wipLog.WipSopLogID = wipLog.WipID == 0 ? helper.GetIDKeyNoPost("WIP_ID").Result : wipLog.WipID; + wipSop.WipSOPID = helper.GetIDKey("WIP_SOP_ID").Result; _context.WipSops.Add(wipSop); try { @@ -139,43 +111,70 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } - //// PUT api//5 - //[HttpPut("{id}/{state}")] - //public async Task> PutWipSopLog(int id, string state) - //{ - // ResultModel result = new ResultModel(); - // var WipSopLog = new WipSopLog { - // WipSopLogID = id, - // State = state, - // UpdateUserID = 1, - // UpdateDate = System.DateTime.Now - - // }; - // _context.Attach(WipSopLog); - - // // 指定更新某個欄位 - // _context.Entry(WipSopLog).Property(p => p.State).IsModified = true; - // _context.Entry(WipSopLog).Property(p => p.UpdateUserID).IsModified = true; - // _context.Entry(WipSopLog).Property(p => p.UpdateDate).IsModified = true; - - // try - // { - // await _context.SaveChangesAsync(); - // result.Success = true; - // result.Msg = "OK"; - // } - // catch (Exception ex) - // { - // result.Success = false; - // result.Msg = ex.InnerException.Message; - // } - // return result; - //} - - // DELETE api//5 + /// + /// 更新工單製程對應SOP資料檔 + /// + /// + /// + [HttpPut] + public async Task> PutWipSop(WipSop wipSop) + { + ResultModel result = new ResultModel(); + _context.Entry(wipSop).State = EntityState.Modified; + //設置容器空間某一個模型的某一個欄位 不提交到資料庫 + //DbContent.Entry是要更新到資料庫的整個對象 + _context.Entry(wipSop).Property("CreateDate").IsModified = false; + _context.Entry(wipSop).Property("CreateUserID").IsModified = false; + wipSop.UpdateDate = DateTime.Now; + wipSop.UpdateUserID = 0; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + + } + return result; + } + + /// + /// 刪除工單製程對應SOP資料檔 + /// + /// + /// [HttpDelete("{id}")] - public void Delete(int id) + public async Task> DeleteWipSop(int id) { + ResultModel result = new ResultModel(); + var wipSop = await _context.WipSops.FindAsync(id); + + try + { + if (wipSop != null) + { + _context.WipSops.Remove(wipSop); + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + else + { + result.Success = true; + result.Msg = "找不到資料刪除"; + } + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } } } diff --git a/AMESCoreStudio.WebApi/DTO/AMES/WipOutfitDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/WipOutfitDto.cs new file mode 100644 index 00000000..395b2fa1 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/WipOutfitDto.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +#nullable disable + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// + /// 工單治具資料檔 DTO + /// + public partial class WipOutfitDto + { + /// + /// 工單治具ID + /// + public int WipOutfitID { get; set; } + + /// + /// 工單號碼 + /// + public string WipNo { get; set; } + + /// + /// 料號 + /// + public string ItemNo { get; set; } + + /// + /// 設備編碼 + /// + + public string OutfitNo { get; set; } + + /// + /// 設備名稱 + /// + + public string PartNo { get; set; } + + /// + /// 生產單位代號 + /// + + public string UnitNo { get; set; } + + /// + /// 生產單位 + /// + + public string UnitNoName { get; set; } + + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs new file mode 100644 index 00000000..af28defc --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/WipSopDto.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +#nullable disable + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// + /// 工單製程對應SOP資料檔 DTO + /// + public partial class WipSopDto + { + /// + /// 工單SOP_ID + /// + public int WipSOPID { get; set; } + + /// + /// 工單號碼 + /// + public string WipNo { get; set; } + + /// + /// 料號 + /// + public string ItemNo { get; set; } + + /// + /// SOP檔案名稱 + /// + + public string SOPName { get; set; } + + /// + /// SOP路徑 + /// + + public string SOPPath { get; set; } + + /// + /// SOP類型 + /// + + public string SOPType { get; set; } + + /// + /// 生產單位代號 + /// + + public string UnitNo { get; set; } + + /// + /// 生產單位 + /// + + public string UnitNoName { get; set; } + + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipOutfit.cs b/AMESCoreStudio.WebApi/Models/AMES/WipOutfit.cs new file mode 100644 index 00000000..8e03e0be --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/WipOutfit.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using System.Runtime.Serialization; +#nullable disable + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// + /// 工單治具資料檔 + /// + [Table("WIP_OUTFIT", Schema = "JHAMES")] + public partial class WipOutfit + { + /// + /// 工單治具ID + /// + [Key] + [Column("WIP_OUTFIT_ID")] + [DataMember] + public int WipOutfitID { get; set; } + + /// + /// 工單號碼 + /// + [Required] + [Column("WIP_NO")] + [StringLength(30)] + [DataMember] + public string WipNo { get; set; } + + /// + /// 料號 + /// + [Required] + [Column("ITEM_NO")] + [StringLength(20)] + [DataMember] + public string ItemNo { get; set; } + + /// + /// 設備編碼 + /// + [Required] + [Column("OUTFIT_NO")] + [StringLength(15)] + [DataMember] + public string OutfitNo { get; set; } + + /// + /// 設備名稱 + /// + [Required] + [Column("PART_NO")] + [StringLength(50)] + [DataMember] + public string PartNo { get; set; } + + /// + /// 生產單位代號 + /// + [Required] + [Column("UNIT_NO")] + [StringLength(4)] + [DataMember] + public string UnitNo { get; set; } + + /// + /// 建立UserID + /// + [Column("CREATE_USERID")] + [Required] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// + /// 建立日期 + /// + [Required] + [Column("CREATE_DATE")] + [DataMember] + public DateTime CreateDate { get; set; } = DateTime.Now; + + /// + /// 更新UserID + /// + [Column("UPDATE_USERID")] + [DataMember] + public int UpdateUserID { get; set; } = 0; + + /// + /// 更新日期 + /// + [Column("UPDATE_DATE")] + [DataMember] + public DateTime? UpdateDate { get; set; } = DateTime.Now; + + ///// + ///// Unit + ///// + //[ForeignKey("UnitNo")] + //[DataMember] + //public virtual BAS.FactoryUnit GetFactoryUnit { get; set; } + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipSop.cs b/AMESCoreStudio.WebApi/Models/AMES/WipSop.cs index c375c3cb..3dbb3750 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipSop.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipSop.cs @@ -10,34 +10,67 @@ using System.Runtime.Serialization; namespace AMESCoreStudio.WebApi.Models.AMES { /// - /// 工單對應SOP文件紀錄 + /// 工單製程對應SOP資料檔 /// [Table("WIP_SOP", Schema = "JHAMES")] [DataContract] public partial class WipSop { /// - /// WIP_ID + /// 工單SOP_ID /// [Key] - [Column("WIP_ID")] + [Column("WIP_SOP_ID")] [DataMember] - public int WipID { get; set; } + public int WipSOPID { get; set; } /// - /// MATERIAL_SOP_ID + /// 工單號碼 /// - [Key] - [Column("MATERIAL_SOP_ID")] + [Column("WIP_NO")] + [DataMember] + [StringLength(30)] + public string WipNo { get; set; } + + /// + /// 料號 + /// + [Column("ITEM_NO")] + [DataMember] + [StringLength(20)] + public string ItemNo { get; set; } + + /// + /// SOP檔案名稱 + /// + [Column("SOP_NAME")] + [DataMember] + [StringLength(60)] + public string SOPName { get; set; } + + /// + /// SOP路徑 + /// + [Column("SOP_PATH")] + [DataMember] + [StringLength(100)] + public string SOPPath { get; set; } + + /// + /// SOP類型 + /// + [Column("SOP_TYPE")] [DataMember] - public int MaterialSopID { get; set; } + [StringLength(10)] + public string SOPType { get; set; } /// - /// 狀態 + /// 生產單位ID /// - [Column("STATUS")] + [Column("UNIT_NO")] [DataMember] - public string Status { get; set; } + [StringLength(10)] + public string UnitNo { get; set; } /// /// 建立UserID @@ -69,18 +102,11 @@ namespace AMESCoreStudio.WebApi.Models.AMES [DataMember] public DateTime? UpdateDate { get; set; } = DateTime.Now; - /// - /// 工單資料 - /// - [ForeignKey("WipID")] - [DataMember] - public virtual WipInfo GetWipInfo { get; set; } - - /// - /// SOP資料 - /// - [ForeignKey("MaterialSopID")] - [DataMember] - public virtual MaterialSop GetMaterialSop { get; set; } + ///// + ///// Unit + ///// + //[ForeignKey("UnitNo")] + //[DataMember] + //public virtual BAS.FactoryUnit GetFactoryUnit { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs b/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs index aee74081..a5b35ca4 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs @@ -335,6 +335,6 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// [NotMapped] [DataMember] - public string Os_Desc { get; set; } + public string OsVer_Desc { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index bd26a1d6..7dc1f7de 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -40,7 +40,6 @@ namespace AMESCoreStudio.WebApi modelBuilder.Entity().HasKey(c => new { c.WipNO, c.StartNO, c.EndNO }); modelBuilder.Entity().HasKey(c => new { c.WipID, c.CreateDate }); modelBuilder.Entity().HasKey(c => new { c.CorpSN }); - modelBuilder.Entity().HasKey(c => new { c.WipID, c.MaterialSopID }); modelBuilder.Entity().HasKey(c => new { c.WipID, c.BarcodeID }); modelBuilder.Entity().HasKey(c => new { c.BarcodeID ,c.WipID, c.RuleStationID ,c.RuleStatus ,c.InputDate }); modelBuilder.Entity().HasKey(c => new { c.BarcodeNo, c.WipNo, c.OutfitNo}); @@ -759,6 +758,11 @@ namespace AMESCoreStudio.WebApi /// 工單資訊確認 ///
public virtual DbSet WipChecks { get; set; } + + /// + /// 工單治具資料檔 + /// + public virtual DbSet WipOutfits { get; set; } } }