diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index b1356c9d..163afeee 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -18,6 +18,8 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using AMESCoreStudio.WebApi.Enum; +using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Configuration; namespace AMESCoreStudio.Web.Controllers { @@ -35,9 +37,12 @@ namespace AMESCoreStudio.Web.Controllers public readonly IKCS _kcsApi; public readonly IFileServerProvider _fileServerProvider; private readonly IWebHostEnvironment _env; + private readonly IStringLocalizer _sharedLocalizer; + private readonly IConfiguration _configuration; public PCSController(ILogger logger, ILogger log, ISYS sysApi, IPCS pcsApi, IBAS basApi, IPPS ppsApi, IFQC fqcApi - , IFileServerProvider fileServerProvider, IWebHostEnvironment env, IKCS kcsApi) + , IFileServerProvider fileServerProvider, IWebHostEnvironment env, IKCS kcsApi, IStringLocalizer sharedLocalizer + , IConfiguration configuration) { _logger = logger; _log = log; @@ -49,6 +54,9 @@ namespace AMESCoreStudio.Web.Controllers _kcsApi = kcsApi; _fileServerProvider = fileServerProvider; _env = env; + _sharedLocalizer = sharedLocalizer; + _configuration = configuration; + } #region Funcion BLL @@ -77,17 +85,24 @@ namespace AMESCoreStudio.Web.Controllers // 序號編碼sheet - - // 系統 - if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "P" || model.wipInfo.UnitNO == "T") + // 安勤統一執行WIP_SYSTEM + if (ViewBag.WipSpecial == "Y") { - Msg += CheckWipInfoInsert_WipSystem(model.wipSystem); } - // 板卡 else { - Msg += CheckWipInfoInsert_WipBoard(model.wipBoard); + // 系統 + if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "P" || model.wipInfo.UnitNO == "T") + { + + Msg += CheckWipInfoInsert_WipSystem(model.wipSystem); + } + // 板卡 + else + { + Msg += CheckWipInfoInsert_WipBoard(model.wipBoard); + } } // 內部條碼 @@ -732,6 +747,48 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.GetWipSystemDMITypeSelect = q; } + /// + /// 工單資訊 燒機溫度 + /// + /// + private void GetWipBITemperatuerSelect(string SelectedValue = null) + { + List values = new List(); + if (SelectedValue != null) + { + values = SelectedValue.Split(',').ToList(); + } + var q = Enum.GetValues(typeof(EnumPCS.EnumWipBITemperatuer)).Cast() + .Select(s => new SelectListItem + { + Text = EnumPCS.GetDisplayName(s).ToString(), + Value = s.ToString() + }).ToList(); + + ViewBag.GetWipBITemperatuerSelect = q; + } + + /// + /// 工單資訊 燒機軟體 + /// + /// + private void GetWipBI_OSSelect(string SelectedValue = null) + { + List values = new List(); + if (SelectedValue != null) + { + values = SelectedValue.Split(',').ToList(); + } + var q = Enum.GetValues(typeof(EnumPCS.EnumWipBI_OS)).Cast() + .Select(s => new SelectListItem + { + Text = EnumPCS.GetDisplayName(s).ToString(), + Value = s.ToString() + }).ToList(); + + ViewBag.GetWipBI_OSSelect = q; + } + /// /// SOP_Type /// @@ -1747,6 +1804,8 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS001R(int id) { + // 針對安勤 工單基本資料統一打開工程資訊 + ViewBag.WipSpecial = _configuration["WipSpecial"]; WipDataViewModel model = new WipDataViewModel(); var q = await _pcsApi.GetWipInfo(id); @@ -1769,6 +1828,8 @@ namespace AMESCoreStudio.Web.Controllers var UserInof = _sysApi.GetUserInfoByUserNo(model.wipBoard.Engineer).InvokeAsync().Result; if (UserInof != null) model.wipBoard.Engineer_Name = UserInof.UserName; + + } } @@ -1781,6 +1842,22 @@ namespace AMESCoreStudio.Web.Controllers if (UserInof != null) model.wipSystem.Engineer_Name = UserInof.UserName; } + + var Ec_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Ec).InvokeAsync().Result; + var Fw_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw).InvokeAsync().Result; + var Fw1_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw1).InvokeAsync().Result; + var Fw2_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw2).InvokeAsync().Result; + var Bios_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Bios).InvokeAsync().Result; + var Os_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.OsVer).InvokeAsync().Result; + var PowerMode_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.PowerMode).InvokeAsync().Result; + + model.wipSystem.Ec_Desc = Ec_Desc == null ? "" : Ec_Desc.MeterialDesc; + model.wipSystem.Fw_Desc = Fw_Desc == null ? "" : Fw_Desc.MeterialDesc; + model.wipSystem.Fw1_Desc = Fw1_Desc == null ? "" : Fw1_Desc.MeterialDesc; + model.wipSystem.Fw2_Desc = Fw2_Desc == null ? "" : Fw2_Desc.MeterialDesc; + model.wipSystem.Bios_Desc = Bios_Desc == null ? "" : Bios_Desc.MeterialDesc; + model.wipSystem.OsVer_Desc = Os_Desc == null ? "" : Os_Desc.MeterialDesc; + model.wipSystem.PowerMode_Desc = PowerMode_Desc == null ? "" : PowerMode_Desc.ProductionMemo; } model.wipMAC = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); @@ -1804,7 +1881,9 @@ namespace AMESCoreStudio.Web.Controllers model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO); } - + + await WipDataSelectAll(model.wipAtt.WipNO, model.wipAtt.ItemNO, model.wipInfo.UnitNO); + GetCheckboxApproveLogo(model.wipLabel != null ? model.wipLabel.ApproveLogo : null); GetCheckboxCompanyLogo(model.wipLabel != null ? model.wipLabel.CompanyLogo : null); GetCheckboxPrintMode(model.wipLabel != null ? model.wipLabel.PrintMode : null); @@ -1818,6 +1897,9 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS003(int id) { + // 針對安勤 工單基本資料統一打開工程資訊 + ViewBag.WipSpecial = _configuration["WipSpecial"]; + WipDataViewModel model = new WipDataViewModel(); var q = await _pcsApi.GetWipInfo(id); if (q.Count != 0) @@ -1858,6 +1940,22 @@ namespace AMESCoreStudio.Web.Controllers model.wipSystem = await _pcsApi.GetWipSystem(model.wipInfo.WipNO); if (model.wipSystem != null) { + var Ec_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Ec).InvokeAsync().Result; + var Fw_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw).InvokeAsync().Result; + var Fw1_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw1).InvokeAsync().Result; + var Fw2_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw2).InvokeAsync().Result; + var Bios_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Bios).InvokeAsync().Result; + var Os_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.OsVer).InvokeAsync().Result; + var PowerMode_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.PowerMode).InvokeAsync().Result; + + model.wipSystem.Ec_Desc = Ec_Desc == null ? "" : Ec_Desc.MeterialDesc; + model.wipSystem.Fw_Desc = Fw_Desc == null ? "" : Fw_Desc.MeterialDesc; + model.wipSystem.Fw1_Desc = Fw1_Desc == null ? "" : Fw1_Desc.MeterialDesc; + model.wipSystem.Fw2_Desc = Fw2_Desc == null ? "" : Fw2_Desc.MeterialDesc; + model.wipSystem.Bios_Desc = Bios_Desc == null ? "" : Bios_Desc.MeterialDesc; + model.wipSystem.OsVer_Desc = Os_Desc == null ? "" : Os_Desc.MeterialDesc; + model.wipSystem.PowerMode_Desc = PowerMode_Desc == null ? "" : PowerMode_Desc.ProductionMemo; + if (!string.IsNullOrWhiteSpace(model.wipSystem.Engineer)) { var UserInof = _sysApi.GetUserInfoByUserNo(model.wipSystem.Engineer).InvokeAsync().Result; @@ -1897,16 +1995,24 @@ namespace AMESCoreStudio.Web.Controllers GetCheckboxSMDSolderMa(model.wipBoard != null ? model.wipBoard.SmdSolderMask : null); return View(model); } + [HttpPost] public async Task PCS003Async(WipDataViewModel model, string action, IFormFile formFile) { + // 針對安勤 工單基本資料統一打開工程資訊 + ViewBag.WipSpecial = _configuration["WipSpecial"]; try { - #region 選單 - - + await WipDataSelectAll(model.wipAtt.WipNO, model.wipAtt.ItemNO, model.wipInfo.UnitNO); + 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); + GetCheckboxDIP(model.wipBoard != null ? model.wipBoard.DipSide : null); + GetCheckboxSMD(model.wipBoard != null ? model.wipBoard.Smd : null); + GetCheckboxSMDSolderMa(model.wipBoard != null ? model.wipBoard.SmdSolderMask : null); #endregion model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO); @@ -2004,8 +2110,8 @@ namespace AMESCoreStudio.Web.Controllers 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") + // 安勤統一執行WIP_SYSTEM + if (ViewBag.WipSpecial == "Y") { if (string.IsNullOrWhiteSpace(CheckWipInfoInsert_WipSystem(model.wipSystem))) { @@ -2018,18 +2124,34 @@ namespace AMESCoreStudio.Web.Controllers } } else - // 板卡 { - if (string.IsNullOrWhiteSpace(CheckWipInfoInsert_WipBoard(model.wipBoard))) + // 系統 + 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(model.wipBoard.BiTemperature)) + if (string.IsNullOrWhiteSpace(CheckWipInfoInsert_WipBoard(model.wipBoard))) { - model.wipBoard.Smd = model.wipBoard.SMDs == null ? null : string.Join(',', model.wipBoard.SMDs); - model.wipBoard.SmdSolderMask = model.wipBoard.SmdSolderMasks == null ? null : string.Join(',', model.wipBoard.SmdSolderMasks); - model.wipBoard.DipSide = model.wipBoard.DipSides == null ? null : string.Join(',', model.wipBoard.DipSides); - model.wipBoard.ItemNo = model.wipAtt.ItemNO; - model.wipBoard.WipNo = model.wipInfo.WipNO; - await _pcsApi.PutWipBoard(JsonConvert.SerializeObject(model.wipBoard)); + if (!string.IsNullOrWhiteSpace(model.wipBoard.BiTemperature)) + { + model.wipBoard.Smd = model.wipBoard.SMDs == null ? null : string.Join(',', model.wipBoard.SMDs); + model.wipBoard.SmdSolderMask = model.wipBoard.SmdSolderMasks == null ? null : string.Join(',', model.wipBoard.SmdSolderMasks); + model.wipBoard.DipSide = model.wipBoard.DipSides == null ? null : string.Join(',', model.wipBoard.DipSides); + model.wipBoard.ItemNo = model.wipAtt.ItemNO; + model.wipBoard.WipNo = model.wipInfo.WipNO; + await _pcsApi.PutWipBoard(JsonConvert.SerializeObject(model.wipBoard)); + } } } } @@ -2194,14 +2316,17 @@ namespace AMESCoreStudio.Web.Controllers }; if (action == "生管確認") { + wipCheck.PMCUserID = UserID; await _pcsApi.PutWipCheckByPMC(JsonConvert.SerializeObject(wipCheck)); } else if (action == "工程確認") { + wipCheck.PEUserID = UserID; await _pcsApi.PutWipCheckByPE(JsonConvert.SerializeObject(wipCheck)); } else if (action == "製造確認") { + wipCheck.MFUserID = UserID; await _pcsApi.PutWipCheckByMF(JsonConvert.SerializeObject(wipCheck)); } @@ -2237,7 +2362,7 @@ namespace AMESCoreStudio.Web.Controllers /// 工單料號 /// 生產單位 /// - public async Task WipDataSelectAll(string WipNo = null , string ItemNo = null , string UnitNo=null) + public async Task WipDataSelectAll(string WipNo = null, string ItemNo = null, string UnitNo = null) { // KP Items await GetItemsList(); @@ -2281,6 +2406,10 @@ namespace AMESCoreStudio.Web.Controllers GetWipSystemTypeSelect(); // 工程資訊 Power Model GetWipSystemPMTypeSelect(); + // 燒機溫度 + GetWipBITemperatuerSelect(); + // 燒機軟體 + GetWipBI_OSSelect(); // SOP Type GetSOPTypeSelect(); diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml index 45dd0ddb..3eb484c0 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml @@ -1,10 +1,12 @@ @model AMESCoreStudio.Web.ViewModels.PCS.WipDataViewModel - +@using Microsoft.AspNetCore.Mvc.Localization @{ ViewData["Title"] = "PCS001C"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; } +@inject IHtmlLocalizer sharedLocalizer +