diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 2197dc16..50abf365 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -82,9 +82,12 @@ namespace AMESCoreStudio.Web.Controllers } // 內部條碼 - if (string.IsNullOrWhiteSpace(model.wipBarcode.StartNO) != string.IsNullOrWhiteSpace(model.wipBarcode.EndNO)) + if (model.wipBarcode != null) { - Msg += ",內部序號未填完整"; + if (string.IsNullOrWhiteSpace(model.wipBarcode.StartNO) != string.IsNullOrWhiteSpace(model.wipBarcode.EndNO)) + { + Msg += ",內部序號未填完整"; + } } // 出貨序號 @@ -923,7 +926,19 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } + [ResponseCache(Duration = 0)] + [HttpGet] + public async Task GetRuleStationByWipNoAsync(string wipNo, int newID, int oldID) + { + var result = await _pcsApi.GetRuleStationByWipNo(wipNo, newID, oldID); + if (result.Count > 0) + { + return Json(new Table() { code = 0, msg = "", data = result, count = 0 }); + } + + return Json(new Table() { count = 0, data = null }); + } #region PCS001 工單資料維護 public async Task PCS001(WipDataViewModel model = null) @@ -1156,20 +1171,19 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS001R(int id) { - PCS001RViewModel model = new PCS001RViewModel(); + WipDataViewModelNew model = new WipDataViewModelNew(); var q = await _pcsApi.GetWipInfo(id); if (q.Count != 0) { model.wipInfo = q.FirstOrDefault(); model.wipAtt = await _pcsApi.GetWipAtt(model.wipInfo.WipNO); - model.wipBarcode = await _pcsApi.GetWipBarcode(model.wipInfo.WipNO); - model.ruleStation = await _basApi.GetRuleStationsByFlow(model.wipInfo.FlowRuleID); - model.ruleStation = model.ruleStation.OrderBy(o => o.Sequence); + 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.materialSop = q1.Data; + model.materialSops = q1.Data; - model.materialKp = await _pcsApi.GetMaterialKpQuery(itemno: model.wipAtt.ItemNO); + model.WipKps = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); model.wipBoard = await _pcsApi.GetWipBoard(model.wipInfo.WipNO); @@ -1181,6 +1195,7 @@ namespace AMESCoreStudio.Web.Controllers model.wipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.wipInfo.WipNO); + model.Outfits = await _pcsApi.GetMaterialOutfitByItemNo(model.wipAtt.ItemNO); } await GetProductType(); await GetFactoryInfo(); @@ -1209,6 +1224,253 @@ namespace AMESCoreStudio.Web.Controllers } + public async Task PCS003(int id) + { + WipDataViewModelNew model = new WipDataViewModelNew(); + var q = await _pcsApi.GetWipInfo(id); + if (q.Count != 0) + { + model.wipInfo = q.FirstOrDefault(); + 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); + } + await GetProductType(); + await GetFactoryInfo(); + await GetFactoryUnit(); + await GetLineInfo(); + await GetMFGType(); + await GetProcessTypes(); + await GetFlowRuleList(); + GetSMDType(); + GetDIPType(); + GetWipSEQType(); + GetBurnType(); + GetPartsBakeType(); + GetPCBBakeType(); + GetPCBWorkingType(); + GetSolderPaste(); + GetWipType(); + GetCustomerType(); + GetPCSList1(); + GetPCSOPList(); + GetCheckboxApproveLogo(model.wipLabel != null ? model.wipLabel.ApproveLogo : null); + GetCheckboxCompanyLogo(model.wipLabel != null ? model.wipLabel.CompanyLogo : null); + GetCheckboxPrintMode(model.wipLabel != null ? model.wipLabel.PrintMode : null); + GetCheckboxWipAttr(model.wipLabel != null ? model.wipLabel.WipAttr : null); + return View(model); + } + [HttpPost] + public async Task PCS003Async(WipDataViewModelNew model) + { + #region 選單 + await GetProductType(); + await GetFactoryInfo(); + await GetFactoryUnit(); + await GetLineInfo(); + await GetMFGType(); + await GetProcessTypes(); + await GetFlowRuleList(); + GetSMDType(); + GetDIPType(); + GetWipSEQType(); + GetBurnType(); + GetPartsBakeType(); + GetPCBBakeType(); + GetPCBWorkingType(); + GetSolderPaste(); + GetWipType(); + GetCustomerType(); + GetPCSList1(); + GetPCSOPList(); + GetCheckboxApproveLogo(); + GetCheckboxCompanyLogo(); + GetCheckboxPrintMode(); + GetCheckboxWipAttr(); + #endregion + + 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轉換 + model.wipInfo.ECNCheck = model.wipInfo.ECNCheck == "true" ? "Y" : "N"; + model.wipInfo.ModelCheck = model.wipInfo.ModelCheck == "true" ? "Y" : "N"; + model.wipInfo.InputFlag = model.wipInfo.InputFlag == "true" ? "Y" : "N"; + model.wipInfo.Priority = model.wipInfo.Priority == "true" ? "Y" : "N"; + //板卡 + model.wipBoard.DipCarrier = model.wipBoard.DipCarrier == "true" ? "Y" : "N"; + model.wipBoard.DipTape = model.wipBoard.DipTape == "true" ? "Y" : "N"; + model.wipBoard.Burn = model.wipBoard.Burn == "true" ? "Y" : "N"; + //系統 + model.wipSystem.FinePackage = model.wipSystem.FinePackage == "true" ? "Y" : "N"; + + // 判斷資料填寫 + WipDataViewModel wipDataViewModel = new WipDataViewModel(); + wipDataViewModel.wipInfo = model.wipInfo; + wipDataViewModel.wipSystem = model.wipSystem; + wipDataViewModel.wipBoard = model.wipBoard; + wipDataViewModel.wipMAC = model.wipMAC; + wipDataViewModel.wipBarcodeOther = model.wipBarcodeOther; + var Msg = CheckWipInfoInsert(wipDataViewModel); + + // KeyParts 判斷 + foreach(var item in model.WipKps) + { + item.ItemNo = model.wipAtt.ItemNO; + item.Status = item.Status == "on" ? "A" : "S"; + } + + if (!string.IsNullOrWhiteSpace(Msg)) + { + model.wipInfo.ECNCheck = model.wipInfo.ECNCheck == "Y" ? "true" : "false"; + model.wipInfo.ModelCheck = model.wipInfo.ModelCheck == "Y" ? "true" : "false"; + model.wipInfo.InputFlag = model.wipInfo.InputFlag == "Y" ? "true" : "false"; + model.wipInfo.Priority = model.wipInfo.Priority == "Y" ? "true" : "false"; + //板卡 + model.wipBoard.DipCarrier = model.wipBoard.DipCarrier == "Y" ? "true" : "false"; + model.wipBoard.DipTape = model.wipBoard.DipTape == "Y" ? "true" : "false"; + model.wipBoard.Burn = model.wipBoard.Burn == "Y" ? "true" : "false"; + //系統 + model.wipSystem.FinePackage = model.wipSystem.FinePackage == "Y" ? "true" : "false"; + ModelState.AddModelError("error", Msg); + + return View("PCS003", model); + } + + result = await _pcsApi.PutWipInfo(JsonConvert.SerializeObject(model.wipInfo)); + if (result.Success) + { + // 工單屬性 + model.wipAtt.WipNO = model.wipInfo.WipNO; + await _pcsApi.PutWipAtt(JsonConvert.SerializeObject(model.wipAtt)); + + // 標籤 + model.wipLabel.ApproveLogo = model.wipLabel.ApproveLogos == null ? null : string.Join(',', model.wipLabel.ApproveLogos); + model.wipLabel.WipNO = model.wipInfo.WipNO; + await _pcsApi.PutWipLabel(JsonConvert.SerializeObject(model.wipLabel)); + + // 系統 + if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "P" || model.wipInfo.UnitNO == "T") + { + if (string.IsNullOrWhiteSpace(CheckWipInfoInsert_WipSystem(model.wipSystem))) + { + if (!string.IsNullOrWhiteSpace(model.wipSystem.BiTemperature)) + { + model.wipSystem.ItemNo = model.wipAtt.ItemNO; + model.wipSystem.WipNo = model.wipInfo.WipNO; + await _pcsApi.PutWipSystem(JsonConvert.SerializeObject(model.wipSystem)); + } + } + } + else + // 板卡 + { + if (string.IsNullOrWhiteSpace(CheckWipInfoInsert_WipBoard(model.wipBoard))) + { + if (!string.IsNullOrWhiteSpace(model.wipBoard.BiTemperature)) + { + model.wipBoard.ItemNo = model.wipAtt.ItemNO; + model.wipBoard.WipNo = model.wipInfo.WipNO; + await _pcsApi.PutWipBoard(JsonConvert.SerializeObject(model.wipBoard)); + } + } + } + + //// 工單對應SOP + //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)); + //} + + //// 內部條碼 + //if (!string.IsNullOrWhiteSpace(model.wipBarcode.StartNO) && !string.IsNullOrWhiteSpace(model.wipBarcode.EndNO)) + //{ + // model.wipBarcode.WipID = wipID; + // model.wipBarcode.WipNO = model.wipInfo.WipNO; + // model.wipBarcode.UnitNO = model.wipInfo.UnitNO; + // result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.wipBarcode)); + + // // 工單條碼規則設定文件檔 + // WipRule wipRule = new WipRule(); + // wipRule.WipNO = model.wipInfo.WipNO; + // wipRule.KeyNo = "00"; + // wipRule.BarcodeLen = 14; + // wipRule.BarcodeFormat = model.wipInfo.UnitNO; + // result = await _pcsApi.PostWipRule(JsonConvert.SerializeObject(wipRule)); + //} + + // 出貨序號 + if (!string.IsNullOrWhiteSpace(model.wipBarcodeOther.StartNO) && !string.IsNullOrWhiteSpace(model.wipBarcodeOther.EndNO)) + { + var type_no = await _pcsApi.GetBarcodeTypeByTypeName("客戶條碼區間"); + if (type_no != null) + { + model.wipBarcodeOther.WipNO = model.wipInfo.WipNO; + model.wipBarcodeOther.TypeNO = type_no.TypeNo; + result = await _pcsApi.PutWipBarcodeOther(JsonConvert.SerializeObject(model.wipBarcodeOther)); + } + } + + // MAC + if (!string.IsNullOrWhiteSpace(model.wipMAC.StartNO) && !string.IsNullOrWhiteSpace(model.wipMAC.EndNO)) + { + var mACInfo = await _pcsApi.GetMACInfo(model.wipAtt.ItemNO); + if (mACInfo != null) + { + model.wipMAC.WipNO = model.wipInfo.WipNO; + model.wipMAC.Title = mACInfo.Title; + model.wipMAC.ClassGroup = mACInfo.ClassGroup; + result = await _pcsApi.PutWipMAC(JsonConvert.SerializeObject(model.wipMAC)); + result = await _pcsApi.PutMACInfoByClassGroup(mACInfo.ClassGroup, model.wipMAC.EndNO); + } + } + } + + + + if (result.Success) + { + var _msg = "修改成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + if (result.Errors != null) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } + return View(); + } + + public async Task GetMAC(string itemno, int planQTY) { var q = await _pcsApi.GetMACInfo(itemno); diff --git a/AMESCoreStudio.Web/Enums/EnumPCS.cs b/AMESCoreStudio.Web/Enums/EnumPCS.cs index c5bb086e..adad0d6c 100644 --- a/AMESCoreStudio.Web/Enums/EnumPCS.cs +++ b/AMESCoreStudio.Web/Enums/EnumPCS.cs @@ -39,6 +39,12 @@ namespace AMESCoreStudio.Web [Display(Name = "CE")] CE, + /// + /// KCC + /// + [Display(Name = "KCC")] + KCC, + /// /// FCC /// @@ -57,6 +63,18 @@ namespace AMESCoreStudio.Web [Display(Name = "UL")] UL, + /// + /// WEEE + /// + [Display(Name = "WEEE")] + WEEE, + + /// + /// MADE IN + /// + [Display(Name = "MADE IN")] + MADE_IN, + /// /// 皆無 /// diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 24cc5fed..e5ca1c7e 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -136,6 +136,12 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpPost("api/WipAtts")] ITask> PostWipAtt([FromBody, RawJsonContent] string model); + /// + /// 新增工單基本資料-屬性 + /// + /// + [WebApiClient.Attributes.HttpPut("api/WipAtts")] + ITask> PutWipAtt([FromBody, RawJsonContent] string model); /// /// 查詢工單基本資料-WipID @@ -149,16 +155,42 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/WipBoard/{id}")] ITask GetWipBoard(string id); + /// + /// 新增 + /// + /// + /// [WebApiClient.Attributes.HttpPost("api/WipBoard")] ITask> PostWipBoard([FromBody, RawJsonContent] string model); + + /// + /// 更新 + /// + /// + /// + [WebApiClient.Attributes.HttpPut("api/WipBoard")] + ITask> PutWipBoard([FromBody, RawJsonContent] string model); #endregion #region WipSystem 工單基本資料-系統組裝資訊 PCS001 [WebApiClient.Attributes.HttpGet("api/WipSystem/{id}")] ITask GetWipSystem(string id); + /// + /// 新增 + /// + /// + /// [WebApiClient.Attributes.HttpPost("api/WipSystem")] ITask> PostWipSystem([FromBody, RawJsonContent] string model); + + /// + /// 更新 + /// + /// + /// + [WebApiClient.Attributes.HttpPut("api/WipSystem")] + ITask> PutWipSystem([FromBody, RawJsonContent] string model); #endregion #region WipLabel 工單基本資料-標籤 PCS001 @@ -167,6 +199,9 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpPost("api/WipLabel")] ITask> PostWipLabel([FromBody, RawJsonContent] string model); + + [WebApiClient.Attributes.HttpPut("api/WipLabel")] + ITask> PutWipLabel([FromBody, RawJsonContent] string model); #endregion #region WipMAC 工單MAC資料檔 PCS001 @@ -175,6 +210,9 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpPost("api/WipMAC")] ITask> PostWipMAC([FromBody, RawJsonContent] string model); + + [WebApiClient.Attributes.HttpPut("api/WipMAC")] + ITask> PutWipMAC([FromBody, RawJsonContent] string model); #endregion #region WipRule 工單條碼規則設定文件檔 PCS001 @@ -214,6 +252,9 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpPost("api/WipBarcodeOther")] ITask> PostWipBarcodeOther([FromBody, RawJsonContent] string model); + + [WebApiClient.Attributes.HttpPut("api/WipBarcodeOther")] + ITask> PutWipBarcodeOther([FromBody, RawJsonContent] string model); #endregion #region BarCodeInfo 條碼資料檔 PCS021 @@ -500,6 +541,14 @@ namespace AMESCoreStudio.Web /// 料號ID [WebApiClient.Attributes.HttpGet("api/MaterialOutfit/ByItemID/{id}")] ITask> GetMaterialOutfitByItemID(int id); + + /// + /// 料號治具資訊資料檔 ByItemNo + /// + /// 料號 + [WebApiClient.Attributes.HttpGet("api/MaterialOutfit/ByItemNO/{id}")] + ITask> GetMaterialOutfitByItemNo(string id); + #endregion #region MaterialOutfit 料號站別工項資料檔 @@ -762,11 +811,34 @@ namespace AMESCoreStudio.Web #endregion + #region WipKp 工單KP資訊資料檔 + /// + /// 查詢工單號碼 對應 WipKp + /// + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipKps/ByWipNo/{id}")] + ITask> GetWipKpByWipNo(string id); + /// + /// 新增工單對應SOP + /// + /// + [WebApiClient.Attributes.HttpPost("api/WipKps")] + ITask> PostWipKp([FromBody, RawJsonContent] string model); + #endregion + #region RuleStation 流程站別資料維護 + /// + /// 查詢工單號碼 對應 RuleStation + /// + /// + /// + [WebApiClient.Attributes.HttpGet("api/RuleStations/WipNo/{id}")] + ITask> GetRuleStationByWipNo(string id , int flowRuleIDNew =0 , int flowRuleIDOld =0); - + #endregion diff --git a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModelNew.cs b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModelNew.cs new file mode 100644 index 00000000..b787ef34 --- /dev/null +++ b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModelNew.cs @@ -0,0 +1,72 @@ +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.PCS +{ + public class WipDataViewModelNew + { + + /// + /// 工單資料 + /// + public WipInfo wipInfo { get; set; } + + + /// + /// 工單屬性 + /// + public WipAtt wipAtt { get; set; } + + /// + /// 生產序號 + /// + public WipBarcode wipBarcode { get; set; } + + /// + /// 板卡資訊 + /// + public WipBoard wipBoard { get; set; } + + /// + /// 系統組裝 + /// + public WipSystem wipSystem { get; set; } + + public IEnumerable wipBarcodes { get; set; } + + public IEnumerable ruleStations { get; set; } + + public IEnumerable materialSops { get; set; } + + public IEnumerable WipKps { get; set; } + + public IEnumerable Outfits { get; set; } + + /// + /// + /// + public WipSop wipSop { get; set; } + + /// + /// 標籤 + /// + public WipLabel wipLabel { get; set; } + + /// + /// MAC + /// + public WipMAC wipMAC { get; set; } + + /// + /// 條碼區間設定 + /// + public WipBarcodeOther wipBarcodeOther { get; set; } + + + } +} diff --git a/AMESCoreStudio.Web/Views/FQC/FQC001.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC001.cshtml index e93e73b3..fb3565ef 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC001.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC001.cshtml @@ -39,7 +39,7 @@ title: '操作', fixed: 'right', templet: function (d) { - return '修改 删除' + return '修改 删除' } }] ]; diff --git a/AMESCoreStudio.Web/Views/FQC/FQC002.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC002.cshtml index 12e0c03b..dede20e5 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC002.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC002.cshtml @@ -71,7 +71,7 @@ title: '操作', fixed: 'right', templet: function (d) { - return '修改 删除' + return '修改 删除' } }] ]; diff --git a/AMESCoreStudio.Web/Views/FQC/FQC003.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC003.cshtml index ffeab2e2..b41b4048 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC003.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC003.cshtml @@ -49,7 +49,7 @@ title: '操作', fixed: 'right', templet: function (d) { - return '修改 删除' + return '修改 删除' } }] ]; diff --git a/AMESCoreStudio.Web/Views/FQC/FQC004.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC004.cshtml index 1d746efa..18fdf5f2 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC004.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC004.cshtml @@ -44,7 +44,7 @@ title: '操作', fixed: 'right', templet: function (d) { - return '修改 删除' + return '修改 删除' } }] ]; diff --git a/AMESCoreStudio.Web/Views/FQC/FQC005.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC005.cshtml index 59f44749..f087db36 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC005.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC005.cshtml @@ -86,7 +86,7 @@ title: '操作', fixed: 'right', templet: function (d) { - return '修改 删除' + return '修改 删除' } }] ]; diff --git a/AMESCoreStudio.Web/Views/FQC/FQC006.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC006.cshtml index 8874c0bb..c3603028 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC006.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC006.cshtml @@ -39,7 +39,7 @@ title: '操作', fixed: 'right', templet: function (d) { - return '修改 删除' + return '修改 删除' } }] ]; diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml index 43f92039..4723bc47 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml @@ -314,7 +314,7 @@
- +
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml index 914b3a80..0125cad6 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml @@ -1,4 +1,4 @@ -@model AMESCoreStudio.Web.ViewModels.PCS.PCS001RViewModel +@model AMESCoreStudio.Web.ViewModels.PCS.WipDataViewModelNew @{ ViewData["Title"] = "PCS001C"; @@ -22,253 +22,266 @@
-
- -
+
+ +
-
-
- -
- - -
- -
- -
- -
- - -
- -
- - -
+
+
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+
-
-
- -
- -
- -
- -
- -
- -
- -
- - -
- +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ + +
+
+
-
-
- -
- -
- -
- - -
- -
- -
- -
- -
+
+
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+
+
-
-
- -
- -
- - -
- - -
- - +
+
+ +
+ +
+ + +
+ + +
- -
- - -
+ - -
- -
+ +
+ +
-
-
- -
- + +
+
+
-
- -
- -
+
+ +
+
+
-
- - - +
+ +
+
+
-
-
    -
  • 工單屬性
  • -
  • 生產流程
  • -
  • 序號編碼
  • -
  • Keypart組合
  • -
  • 板卡-工程資訊
  • -
  • 系統-工程資訊
  • -
  • 標籤選項
  • -
  • SOP文件
  • -
-
- @* 工單屬性sheet *@ -
-
-
- -
- -
- -
- -
- -
- -
+
+ + + +
+
+
    +
  • 工單屬性
  • +
  • 生產流程
  • +
  • 序號編碼
  • +
  • Keypart組合
  • +
  • 治具組合
  • +
  • 板卡-工程資訊
  • +
  • 系統-工程資訊
  • +
  • 標籤選項
  • +
  • SOP文件
  • +
+
+ @* 工單屬性sheet *@ +
+
+
+ +
+ +
+ +
+ +
+ +
+
+
+
-
-
- -
- - -
- -
- - -
+
+
+ +
+ + +
+ +
+ +
+
-
-
- -
- -
- -
- -
+
+
+ +
+ +
+ +
+
+
-
-
- -
- - -
- -
- - -
+
+
+ +
+ + +
+ +
+ +
-
- @* 生產流程sheet *@ -
-
-
- -
- -
- -
-
- +
+ + @* 生產流程sheet *@ +
+
+
+ +
+
- - + + +
+ +
+
+ + + + + + + + + + + @foreach (var index in Model.ruleStations) + { - + + + - - - @foreach (var index in Model.ruleStation) - { - - - - - - } - -
+ 生產單位 + + 流程名稱 + + 站別描述 + + 站別順序 + + 站別類型 +
- 站別描述 + @index.UnitNoName - 站別順序 - - 站別類型 + @index.FlowRuleName + @index.StationDesc + + @index.Sequence + + @index.StationType +
- @index.StationDesc - - @index.Sequence - - @index.StationType -
-
+ } + +
+
- @* 序號編碼sheet *@ + @* 序號編碼sheet *@
@@ -284,7 +297,7 @@ - @foreach (var index in Model.wipBarcode) + @foreach (var index in Model.wipBarcodes) { +
@@ -325,389 +338,555 @@ - @* Keypart組合sheet *@ -
-
- - + @* Keypart組合sheet *@ +
+
+ @{ int i = 0;} + + + + + + + + + + + + + + @foreach (var index in Model.WipKps) + { - - - - - - - + + + + + + + + - - - @foreach (var index in Model.materialKp) - { - - - - - - - - - - } - -
+ 料號 + + KP料號名稱 + + KP料號NO + + 順序 + + 前置碼 + + 長度 + + 生產單位 + + 狀態 +
- 料號 - - KP料號名稱 - - KP料號NO - - 順序 - - 前置碼 - - 長度 - - 站(前段) - + @index.ItemNo + + + @index.KpName + + + @index.KpNo + + + @index.KpSeq + + + @index.Title + + + @index.Length + + + @index.UnitNoName + + +
- @index.ItemName - - @index.KpName - - @index.KpNo - - @index.KpSeq - - @index.Title - - @index.Length - - @index.Station -
+ i++; + } +
+
+ + @* 治具組合sheet *@ +
+ + @{ int j = 0;} + + + + + + + + + @foreach (var index in Model.Outfits) + { + + + + + + j++; + } + +
+ 治具NO + + 治具名稱 + + 流程名稱ID +
+ + @index.OutfitNo + + @index.StationType + + @index.RuleStationID +
+
+ + @* 板卡-工程資訊sheet *@ +
+
+
+ +
+ + +
+ + +
+ + +
+
- @* 板卡-工程資訊sheet *@ -
-
+ @*
- +
- +
+
+
*@ - -
- - + + @*
+ +
+ +
+
*@ + +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+ + +
+
+ +
+
+ +
+ +
+
+ +
+
+
+
- @*
-
- -
- - -
-
-
*@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
- @*
- -
- -
-
*@ +
+
+ +
+ +
+
+
-
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+ + +
+ +
+ + +
+
+
+ + @*
- +
- + +
- +
- + +
- -
- +
- + +
+
+
*@ + + @*
+
+
- -
- -
+ +
+
+
*@ + + + @*
+ +
+ +
+
*@ +
+ + @* 系統-工程資訊sheet *@ +
+
+
+ +
+ + +
+ +
+ +
+
-
-
- -
- +
+
+ +
+ + +
+
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+
-
- +
+
- +
+
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+ + +
+ +
+
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+
-
-
- -
- -
-
-
- -
- -
+
+
+ +
+
+
-
-
- -
- -
+
+
+ +
+
+
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
+
+
+ +
+
+
-
-
- -
- - -
- -
- - -
+
+
+ +
+
+
- @*
-
- -
- - -
-
-
- -
-
- -
- - -
-
-
- -
-
- -
- - -
-
-
*@ - @*
-
- -
- - -
-
-
*@ +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
- @*
- -
- -
-
*@ +
+
+ +
+ +
+
- @* 系統-工程資訊sheet *@ -
-
+ @*
- +
- - +
-
- +
-
-
-
-
-
- +
-
- -
- -
-
-
+
- -
- -
-
-
- -
- -
-
-
- -
- -
-
- -
- +
-
-
-
-
-
- + +
-
- + +
- +
- +
- +
- + +
- +
- + +
- +
- +
-
-
-
-
-
- + +
-
-
-
-
-
- + +
+
- +
- + +
@@ -715,199 +894,84 @@
- +
- + +
-
-
- -
-
- +
- + + +
+ +
+ +
- +
- +
-
- - @*
-
- -
- -
- -
- - -
- -
- - -
-
-
- -
-
- -
- -
- -
- - -
- -
- - -
-
-
- -
-
- -
- -
- -
- - -
- -
- - -
-
-
- -
-
- -
- -
- -
- - -
- -
- - -
-
-
- - -
-
- -
- - -
-
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
-
-
+
*@ -
-
- -
- -
-
-
*@ - -
- -
- -
+
+ +
+
+
- @* 標籤選項sheet *@ -
-
- - -
+ @* 標籤選項sheet *@ +
+
+ + +
-
- -
- -
-
+
+ +
+
+
+
-
- -
- -
+
+ +
+
-
- -
- +
+
+ +
+ -
-
-
- -
- -
- - @* SOP文件 sheet *@ -
-
+
+ +
+ +
+
+ @* SOP文件 sheet *@ +
+
+
+
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml new file mode 100644 index 00000000..7abd48b0 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -0,0 +1,1038 @@ +@model AMESCoreStudio.Web.ViewModels.PCS.WipDataViewModelNew + + +@{ ViewData["Title"] = "PCS003"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + + + +
+
+
+
+ + + + +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ + +
+
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+
+ +
+
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ +
+
+
+ +
+
+ +
+ +
+ + +
+ + +
+ + + + +
+ + +
+ + +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ + + +
+ +
+
    +
  • 工單屬性
  • +
  • 生產流程
  • +
  • 序號編碼
  • +
  • Keypart組合
  • +
  • 治具組合
  • +
  • 板卡-工程資訊
  • +
  • 系統-工程資訊
  • +
  • 標籤選項
  • +
  • SOP文件
  • +
+
+ @* 工單屬性sheet *@ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ + +
+ +
+ + +
+
+
+ +
+
+ +
+ +
+ +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+ + +
+
+
+ +
+ + @* 生產流程sheet *@ +
+
+
+ +
+ +
+ +
+
+ +
+
+ + + + + + + + + + + + @foreach (var index in Model.ruleStations) + { + + + + + + + + } + +
+ 生產單位 + + 流程名稱 + + 站別描述 + + 站別順序 + + 站別類型 +
+ @index.UnitNoName + + @index.FlowRuleName + + @index.StationDesc + + @index.Sequence + + @index.StationType +
+
+
+ + @* 序號編碼sheet *@ +
+ + + + + + + + + + + @foreach (var index in Model.wipBarcodes) + { + + + + + } + +
+ 起始生產序號 + + 結束生產序號 +
+ @index.StartNO + + @index.EndNO +
+ +
+
+ +
+ +
+
-
+
+ +
+
+
+ +
+
+ +
+ +
+
-
+
+ +
+
+
+
+ + @* Keypart組合sheet *@ +
+ + @{ int i = 0;} + + + + + + + + + + + + + + @foreach (var index in Model.WipKps) + { + + + + + + + + + + + i++; + } + +
+ 料號 + + KP料號名稱 + + KP料號NO + + 順序 + + 前置碼 + + 長度 + + 生產單位 + + 狀態 +
+ + + + @index.ItemNo + + + @index.KpName + + + @index.KpNo + + + @index.KpSeq + + + @index.Title + + + @index.Length + + + @index.UnitNoName + + +
+
+ + @* 治具組合sheet *@ +
+ + @{ int j = 0;} + + + + + + + + + @foreach (var index in Model.Outfits) + { + + + + + + j++; + } + +
+ 治具NO + + 治具名稱 + + 流程名稱ID +
+ + @index.OutfitNo + + @index.StationType + + @index.RuleStationID +
+
+ + @* 板卡-工程資訊sheet *@ +
+
+
+ +
+ + +
+ + +
+ + +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+ + +
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+ + +
+ +
+ + +
+
+
+ +
+ + @* 系統-工程資訊sheet *@ +
+
+
+ +
+ + +
+ + +
+ + +
+
+
+ +
+
+ +
+ + +
+
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+ + +
+ +
+
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ + +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+ + @* 標籤選項sheet *@ +
+
+ + +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+ + @* SOP文件 sheet *@ +
+
+
+ +
+
+ + @Html.ValidationMessage("error") +
+
+ +
+
+
+
+
+@section Scripts { + + + + +} + diff --git a/AMESCoreStudio.Web/Views/PCS/PCS004.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS004.cshtml index b01e012c..f618e9dd 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS004.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS004.cshtml @@ -129,7 +129,7 @@ title: '操作', fixed: 'right', templet: function (d) { - return '修改 檢視' + return '修改 檢視' } }] ]; diff --git a/AMESCoreStudio.Web/Views/PCS/PCS005.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS005.cshtml index 77695c82..0ba0fe9f 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS005.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS005.cshtml @@ -96,12 +96,14 @@ title: '操作', fixed: 'right', templet: function (d) { - return '檢視' + return '修改檢視' /* < a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay - event="edit" > 修改 '*/ } } ] ]; + + //通过行tool檢視,lay-event="detail" function detail(obj) { if (obj.data.wipID) { @@ -109,12 +111,12 @@ } } - ////通过行tool编辑,lay-event="edit" - //function edit(obj) { - // if (obj.data.wipID) { - // hg.open('修改工單資料', '/PCS/PCS001U/' + obj.data.wipID, '', '', true); - // } - //} + //通过行tool编辑,lay-event="edit" + function edit(obj) { + if (obj.data.wipID) { + hg.open('修改工單資料', '/PCS/PCS003/' + obj.data.wipID, '', '', true); + } + } var toolbar = [{ text: '新增', diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialOutfitController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialOutfitController.cs index f61f1fe1..c51138b7 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialOutfitController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialOutfitController.cs @@ -70,6 +70,25 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + /// + /// 料號基本資料檔 to ItemNo + /// + /// 料號 + /// + [HttpGet("ByItemNo/{id}")] + public async Task> GetMaterialOutfitByItemNo(string id) + { + MaterialItemController materialItemController = new MaterialItemController(_context); + var result_Item = materialItemController.GetMaterialItemByItemNO(id); + int ItemID = 0; + + if (result_Item != null) + ItemID = result_Item.Result.ItemID; + + IQueryable q = _context.MaterialOutfits.Where(w => w.ItemID == ItemID); + return await q.ToListAsync(); + } + // PUT: api/MaterialOutfits/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. diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs index 35d84c9c..528a08db 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs @@ -76,9 +76,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES ///
/// /// - // POST: api/WipAtts - // 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> PostWipAtt([FromBody] WipAtt wipatt) { @@ -99,5 +96,31 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } return result; } + + /// + /// 更新工單資料Att + /// + /// + /// + [HttpPut] + public async Task> PutWipAtt(WipAtt wipatt) + { + ResultModel result = new ResultModel(); + _context.Entry(wipatt).State = EntityState.Modified; + wipatt.UpdateDate = DateTime.Now; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } } } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs index d1710dca..065a23f6 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs @@ -108,5 +108,46 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + /// + /// 更新檢驗结果維護 + /// + /// + /// + [HttpPut] + public async Task> PutWipBarcodeOther(WipBarcodeOther wipBarcodeOther) + { + ResultModel result = new ResultModel(); + + var getWipBarcodeOther = GetWipBarcodeOtherByWipNo(wipBarcodeOther.WipNO).Result.Value; + + if (getWipBarcodeOther != null) + { + _context.Entry(getWipBarcodeOther).State = EntityState.Modified; + getWipBarcodeOther.StartNO = wipBarcodeOther.StartNO; + getWipBarcodeOther.EndNO = wipBarcodeOther.EndNO; + getWipBarcodeOther.Title = wipBarcodeOther.Title; + getWipBarcodeOther.TypeNO = wipBarcodeOther.TypeNO; + getWipBarcodeOther.UpdateDate = DateTime.Now; + getWipBarcodeOther.UpdateUserID = 0; + } + else + { + _context.WipBarcodeOthers.Add(wipBarcodeOther); + } + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + } } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipBoardController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipBoardController.cs index deaf3f51..0ec381ef 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipBoardController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipBoardController.cs @@ -80,15 +80,37 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// [HttpPut] - public async Task> PutWipLock([FromBody] WipBoard wipBoard) + public async Task> PutWipBoard([FromBody] WipBoard wipBoard) { ResultModel result = new ResultModel(); - _context.Attach(wipBoard); - //wipSystem.LockStatus = "1"; - //wipSystem.UnLockUserID = 0; - //wipSystem.UnLockDate = DateTime.Now; - // 指定更新某個欄位 - _context.Entry(wipBoard).Property(p => p.PcbBake).IsModified = true; + + var getWipBoard = GetWipBoard(wipBoard.WipNo).Result.Value; + + if (getWipBoard != null) + { + _context.Entry(getWipBoard).State = EntityState.Modified; + getWipBoard.BiosVer = wipBoard.BiosVer; + getWipBoard.BiRatio = wipBoard.BiRatio; + getWipBoard.BiTemperature = wipBoard.BiTemperature; + getWipBoard.BiTime = wipBoard.BiTime; + getWipBoard.Burn = wipBoard.Burn; + getWipBoard.BurnLocation = wipBoard.BurnLocation; + getWipBoard.Checksum = wipBoard.Checksum; + getWipBoard.DipCarrier = wipBoard.DipCarrier; + getWipBoard.DipSide = wipBoard.DipSide; + getWipBoard.DipTape = wipBoard.DipTape; + getWipBoard.PartsBake = wipBoard.PartsBake; + getWipBoard.PartsBakeTime = wipBoard.PartsBakeTime; + getWipBoard.PcbBake = wipBoard.PcbBake; + getWipBoard.Smd = wipBoard.Smd; + getWipBoard.SolderPaste = wipBoard.SolderPaste; + getWipBoard.UpdateDate = DateTime.Now; + getWipBoard.UpdateUserID = 0; + } + else + { + _context.WipBoards.Add(wipBoard); + } try { diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs index 6868ceef..0e3f4efb 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipKpsController.cs @@ -7,6 +7,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.DTO.AMES; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.AMES { @@ -45,6 +47,36 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return wipKp; } + /// + /// ByWipNo + /// + /// 工單號碼 + /// + [HttpGet("ByWipNo/{id}")] + public async Task>> GetWipKpByWipNo(string id) + { + WipInfosController wipInfosController = new WipInfosController(_context); + var wipIDs = wipInfosController.GetWipInfoByWipNo(id).Result.Value.Select(s => s.WipID).ToList(); + + var q = from q1 in _context.WipKps.Where(w => wipIDs.Contains(w.WipID)) + join q2 in _context.FactoryUnits on q1.UnitNo equals q2.UnitNo + select new WipKpDto + { + WipKpID = q1.WipKpID, + WipID = q1.WipID, + ItemNo = q1.ItemNo, + KpName = q1.KpName, + KpNo = q1.KpNo, + KpSeq = q1.KpSeq, + Length = q1.Length, + Status = q1.Status, + Title = q1.Title, + UnitNoName = q2.UnitName + }; + + return await q.ToListAsync(); + } + // PUT: api/WipKps/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. diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipLabelController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipLabelController.cs index e908f9ad..aff081f8 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipLabelController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipLabelController.cs @@ -134,23 +134,33 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } - // PUT api//5 - [HttpPut("{id}")] - public async Task> PutWipLabel(string id) + /// + /// 更新工單標籤 + /// + /// + /// + [HttpPut] + public async Task> PutWipLabel(WipLabel wipLabel) { ResultModel result = new ResultModel(); - var WipLabel = new WipLabel { - WipNO = id, - UpdateUserID = 1, - UpdateDate = System.DateTime.Now - - }; - _context.Attach(WipLabel); - - // 指定更新某個欄位 - _context.Entry(WipLabel).Property(p => p.UpdateUserID).IsModified = true; - - _context.Entry(WipLabel).Property(p => p.UpdateDate).IsModified = true; + + var getwipLabel = GetWipLabel(wipLabel.WipNO).Result.Value; + + if (getwipLabel != null) + { + _context.Entry(getwipLabel).State = EntityState.Modified; + getwipLabel.ApproveLogo = wipLabel.ApproveLogo; + getwipLabel.CompanyLogo = wipLabel.CompanyLogo; + getwipLabel.PrintMode = wipLabel.PrintMode; + getwipLabel.PrintPage = wipLabel.PrintPage; + getwipLabel.WipAttr = wipLabel.WipAttr; + getwipLabel.UpdateDate = DateTime.Now; + getwipLabel.UpdateUserID = 0; + } + else + { + _context.WipLabels.Add(wipLabel); + } try { diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipMACController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipMACController.cs index 56b76e3e..1c96c70b 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipMACController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipMACController.cs @@ -135,20 +135,26 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } // PUT api//5 - [HttpPut("{id}")] - public async Task> PutWipMAC(string id) + [HttpPut] + public async Task> PutWipMAC(WipMAC wipMAC) { ResultModel result = new ResultModel(); - var WipMAC = new WipMAC { - WipNO = id - - }; - _context.Attach(WipMAC); - // 指定更新某個欄位 - - _context.Entry(WipMAC).Property(p => p.UpdateDate).IsModified = true; + var getWipMAC = GetWipMAC(wipMAC.WipNO).Result.Value; + if (getWipMAC != null) + { + _context.Entry(getWipMAC).State = EntityState.Modified; + getWipMAC.ClassGroup = wipMAC.ClassGroup; + getWipMAC.StartNO = wipMAC.StartNO; + getWipMAC.EndNO = wipMAC.EndNO; + getWipMAC.Title = wipMAC.Title; + getWipMAC.UpdateDate = DateTime.Now; + } + else + { + _context.WipMACs.Add(wipMAC); + } try { await _context.SaveChangesAsync(); diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipSystemController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipSystemController.cs index 898ec052..e1d69792 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipSystemController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipSystemController.cs @@ -76,15 +76,39 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// [HttpPut] - public async Task> PutWipLock([FromBody] WipSystem wipSystem) + public async Task> PutWipSystem([FromBody] WipSystem wipSystem) { ResultModel result = new ResultModel(); - _context.Attach(wipSystem); - //wipSystem.LockStatus = "1"; - //wipSystem.UnLockUserID = 0; - //wipSystem.UnLockDate = DateTime.Now; - // 指定更新某個欄位 - _context.Entry(wipSystem).Property(p => p.Memo).IsModified = true; + + var getwipSystem = GetWipSystem(wipSystem.WipNo).Result.Value; + if (getwipSystem != null) + { + _context.Entry(getwipSystem).State = EntityState.Modified; + getwipSystem.BiMemo = wipSystem.BiMemo; + getwipSystem.BiosVer = wipSystem.BiosVer; + getwipSystem.BiRatio = wipSystem.BiRatio; + getwipSystem.BiTemperature = wipSystem.BiTemperature; + getwipSystem.BiTime = wipSystem.BiTime; + getwipSystem.Checksum = wipSystem.Checksum; + getwipSystem.Cpu = wipSystem.Cpu; + getwipSystem.DmiBi = wipSystem.DmiBi; + getwipSystem.Ec = wipSystem.Ec; + getwipSystem.FinePackage = wipSystem.FinePackage; + getwipSystem.Fw = wipSystem.Fw; + getwipSystem.Fw1 = wipSystem.Fw1; + getwipSystem.Fw2 = wipSystem.Fw2; + getwipSystem.Jumper = wipSystem.Jumper; + getwipSystem.Memo = wipSystem.Memo; + getwipSystem.OsVer = wipSystem.OsVer; + getwipSystem.PowerMode = wipSystem.PowerMode; + getwipSystem.Ram = wipSystem.Ram; + getwipSystem.UpdateDate = DateTime.Now; + getwipSystem.UpdateUserID = 0; + } + else + { + _context.WipSystems.Add(wipSystem); + } try { diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs index b070a8c1..1dc66660 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs @@ -7,6 +7,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.WebApi.DTO.AMES; +using AMESCoreStudio.WebApi.Controllers.AMES; namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -104,7 +106,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS return NotFound(); - + } /// @@ -130,6 +132,44 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS return ruleStation; } + /// + /// ByWipNo 取流程別 + /// + /// 工單號碼 + /// 變更後ID + /// 變更前ID + /// + [HttpGet("WipNo/{id}")] + public async Task>> GetRuleStationByWipNo(string id, int flowRuleIDNew = 0, int flowRuleIDOld = 0) + { + WipInfosController wipInfosController = new WipInfosController(_context); + var FlowRuleIDs = wipInfosController.GetWipInfoByWipNo(id).Result.Value.Select(s => s.FlowRuleID).ToList(); + + // 工單修改有變更流程ID,就顯示變更流程 + if (flowRuleIDNew != 0 && flowRuleIDOld != 0) + { + FlowRuleIDs.Remove(flowRuleIDOld); + FlowRuleIDs.Add(flowRuleIDNew); + } + + var q = from q1 in _context.RuleStations.Where(w => FlowRuleIDs.Contains(w.FlowRuleID)) + join q2 in _context.FlowRules on q1.FlowRuleID equals q2.FlowRuleID + join q3 in _context.FactoryUnits on q2.UnitNo equals q3.UnitNo + select new RuleStationDto + { + RuleStationID = q1.RuleStationID, + FlowRuleID = q1.FlowRuleID, + FlowRuleName = q2.FlowRuleName, + StationID = q1.StationID, + StationDesc = q1.StationDesc, + Sequence = q1.Sequence, + StationType = q1.StationType, + UnitNoName = q3.UnitName + }; + + return await q.OrderBy(o => o.FlowRuleID).ThenBy(o => o.Sequence).ToListAsync(); + } + /// /// 根據製程單位獲取指定單一資料 /// diff --git a/AMESCoreStudio.WebApi/DTO/AMES/RuleStationDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/RuleStationDto.cs new file mode 100644 index 00000000..d36cf48f --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/RuleStationDto.cs @@ -0,0 +1,63 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// + /// 流程站別資料 + /// + + public class RuleStationDto + { + /// + /// 流程站別編號 + /// + public int RuleStationID { get; set; } + + /// + /// 流程編號 + /// + + public int FlowRuleID { get; set; } + + + /// + /// 流程名稱 + /// + + public string FlowRuleName { get; set; } + + /// + /// 站別編號 + /// + + public int StationID { get; set; } + + /// + /// 站別描述 + /// + + public string StationDesc { get; set; } + + /// + /// 站別順序 + /// + + public int Sequence { get; set; } + + /// + /// 站別類型 + /// + + public string StationType { get; set; } + + + /// + /// 生產單位名稱 + /// + [ForeignKey("StationID")] + public string UnitNoName { get; set; } + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/WipKpDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/WipKpDto.cs new file mode 100644 index 00000000..f12f75a6 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/WipKpDto.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +#nullable disable + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// + /// 工單KP資訊資料檔 DTO + /// + public partial class WipKpDto + { + /// + /// 工單KP_ID + /// + public int WipKpID { get; set; } + + /// + /// 工單ID + /// + public int WipID { get; set; } + + /// + /// 料號 + /// + public string ItemNo { get; set; } + + /// + /// KP料號名稱 + /// + + public string KpName { get; set; } + + /// + /// KP料號NO + /// + + public string KpNo { get; set; } + + /// + /// 順序 + /// + + public int? KpSeq { get; set; } + + /// + /// 前置碼 + /// + + public string Title { get; set; } + + /// + /// 長度 + /// + + public int? Length { get; set; } + + /// + /// 生產單位代號 + /// + + public string UnitNoName { get; set; } + + /// + /// 狀態 A:啟用 S:停用 + /// + + public string Status { get; set; } = "A"; + + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipKp.cs b/AMESCoreStudio.WebApi/Models/AMES/WipKp.cs index a7ce5a31..e3820cc6 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipKp.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipKp.cs @@ -91,6 +91,15 @@ namespace AMESCoreStudio.WebApi.Models.AMES [StringLength(4)] public string UnitNo { get; set; } + /// + /// 狀態 A:啟用 S:停用 + /// + [Required] + [DataMember] + [Column("STATUS")] + [StringLength(1)] + public string Status { get; set; } = "A"; + /// /// 建立UserID ///