diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index df864fa0..e646815d 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -2694,232 +2694,12 @@ namespace AMESCoreStudio.Web.Controllers 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; - // model.wipLabel.CreateUserID = UserID; - // model.wipLabel.UpdateUserID = UserID; - // await _pcsApi.PutWipLabel(JsonConvert.SerializeObject(model.wipLabel)); - - // // 安勤統一執行WIP_SYSTEM - // if (ViewBag.WipSpecial == "Y") - // { - // if (string.IsNullOrWhiteSpace(CheckWipInfoInsert_WipSystem(model.wipSystem))) - // { - // model.wipSystem.ItemNo = model.wipAtt.ItemNO; - // model.wipSystem.WipNo = model.wipInfo.WipNO; - // model.wipSystem.CreateUserID = UserID; - // model.wipSystem.UpdateUserID = UserID; - // await _pcsApi.PutWipSystem(JsonConvert.SerializeObject(model.wipSystem)); - // } - // } - // else - // { - // // 系統 - // if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "P" || model.wipInfo.UnitNO == "T") - // { - // if (string.IsNullOrWhiteSpace(CheckWipInfoInsert_WipSystem(model.wipSystem))) - // { - // model.wipSystem.ItemNo = model.wipAtt.ItemNO; - // model.wipSystem.WipNo = model.wipInfo.WipNO; - // model.wipSystem.CreateUserID = UserID; - // model.wipSystem.UpdateUserID = UserID; - // await _pcsApi.PutWipSystem(JsonConvert.SerializeObject(model.wipSystem)); - // } - // } - // else - // // 板卡 - // { - // 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; - // model.wipBoard.CreateUserID = UserID; - // model.wipBoard.UpdateUserID = UserID; - // await _pcsApi.PutWipBoard(JsonConvert.SerializeObject(model.wipBoard)); - // } - // } - // } - - // // 內部條碼 - // if (!string.IsNullOrWhiteSpace(model.wipBarcode.Remarks)) - // { - // model.wipBarcode.WipID = model.wipInfo.WipID; - // model.wipBarcode.WipNO = model.wipInfo.WipNO; - // model.wipBarcode.UnitNO = model.wipInfo.UnitNO; - // model.wipBarcode.CreateUserID = UserID; - // result = await _pcsApi.PutWipBarcode(JsonConvert.SerializeObject(model.wipBarcode)); - // } - - // // MAC - // if (!string.IsNullOrWhiteSpace(model.wipMAC.StartNO) && !string.IsNullOrWhiteSpace(model.wipMAC.EndNO)) - // { - // if (model.wipMAC.StartNO.Length == 12) - // { - // model.wipMAC.Title = model.wipMAC.StartNO.Substring(0, 6).ToUpper(); - // model.wipMAC.StartNO = model.wipMAC.StartNO.Substring(model.wipMAC.StartNO.Length - 6, 6).ToUpper(); - // model.wipMAC.EndNO = model.wipMAC.EndNO.Substring(model.wipMAC.EndNO.Length - 6, 6).ToUpper(); - - // // 確認MAC Table是否有料號資料 - // var mACInfo = await _pcsApi.GetMACInfo(model.wipAtt.ItemNO); - // if (mACInfo != null) - // { - // model.wipMAC.ClassGroup = mACInfo.ClassGroup; - // } - - // if (!string.IsNullOrWhiteSpace(model.wipMAC.WipNO)) - // result = await _pcsApi.PutWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - // else - // { - // model.wipMAC.WipNO = model.wipInfo.WipNO; - // model.wipMAC.CreateUserID = UserID; - // result = await _pcsApi.PostWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - // } - // } - // } - - // // KeyParts - // // 判斷料號KP有資料 沒有資料時 一起新增到料號KP - // // 2022.10.12 取消判斷 刪除料號KP,在逐一新增 - // var materialItem = await _pcsApi.GetMaterialItemByItemNO(model.wipAtt.ItemNO); - // if (materialItem != null) - // { - // await _pcsApi.DeleteMaterialKpByItem(materialItem.ItemID); - // } - - // // 先比對新舊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.Where(w => w.WipKpID != -1)) - // { - // item.WipNo = model.wipInfo.WipNO; - // item.ItemNo = model.wipAtt.ItemNO; - // item.CreateUserID = UserID; - // item.UpdateUserID = UserID; - // if (item.WipKpID == 0) - // await _pcsApi.PostWipKp(JsonConvert.SerializeObject(item)); - // else - // await _pcsApi.PutWipKp(JsonConvert.SerializeObject(item)); - - // // 新增到料號KP檔 - // await _pcsApi.PostMaterialKp(JsonConvert.SerializeObject(new MaterialKp - // { - // ItemID = materialItem.ItemID, - // KpName = item.KpName, - // KpNo = item.KpNo, - // KpSeq = Convert.ToInt32(item.KpSeq), - // Length = item.Length, - // StationType = item.UnitNo, - // IsRepeat = "N", - // Title = item.Title, - // CreateUserID = UserID, - // UpdateUserID = UserID - // })); - // } - // model.WipKps = model.WipKps.Where(w => w.WipKpID != -1).ToList(); - - // // 治具 - // // 先比對新舊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.Where(w => w.WipOutfitID != -1)) - // { - // item.WipNo = model.wipInfo.WipNO; - // item.ItemNo = model.wipAtt.ItemNO; - // item.UpdateUserID = UserID; - // item.CreateUserID = UserID; - // item.OutfitNo = "."; - // if (item.WipOutfitID == 0) - // await _pcsApi.PostWipOutfit(JsonConvert.SerializeObject(item)); - // else - // await _pcsApi.PutWipOutfit(JsonConvert.SerializeObject(item)); - // } - // model.WipOutfits = model.WipOutfits.Where(w => w.WipOutfitID != -1); - - // // 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.Where(w => w.WipSOPID != -1)) - // { - // item.WipNo = model.wipInfo.WipNO; - // item.ItemNo = model.wipAtt.ItemNO; - // item.CreateUserID = UserID; - // item.UpdateUserID = UserID; - // if (item.WipSOPID == 0) - // await _pcsApi.PostWipSop(JsonConvert.SerializeObject(item)); - // else - // await _pcsApi.PutWipSop(JsonConvert.SerializeObject(item)); - // } - // model.WipSops = model.WipSops.Where(w => w.WipSOPID != -1); - - // // 檔案上傳 - // string FileName = string.Empty; - // string NewName = string.Empty; - // string FilePath = string.Empty; - - // if (formFile != null) - // { - // if (formFile.Length > 0) - // { - // //取得使用者上傳檔案的原始檔名 - // FileName = Path.GetFileName(formFile.FileName); - // //取原始檔名中的副檔名 - // //var fileExt = Path.GetExtension(FileName); - // //為避免使用者上傳的檔案名稱發生重複,重新給一個亂數名稱 - // //NewName = Path.GetRandomFileName() + fileExt; - // //指定要寫入的路徑、檔名和副檔名 - // FilePath = $@"{_env.WebRootPath}\UploadFolder\{model.wipInfo.WipNO}"; - // var path = $@"{FilePath}\{FileName}"; - - // if (!System.IO.Directory.Exists(FilePath)) - // { - // System.IO.Directory.CreateDirectory(FilePath); - // } - - // using (var stream = new FileStream(path, FileMode.Create)) - // { - // await formFile.CopyToAsync(stream); - // } - - // model.wipInfoBlob.WipNo = model.wipInfo.WipNO; - // model.wipInfoBlob.ImageName = FileName; - // model.wipInfoBlob.Filepath = $@"\UploadFolder\{model.wipInfo.WipNO}\"; - // model.wipInfoBlob.CreateUserID = UserID; - // model.wipInfoBlob.UpdateUserID = UserID; - // result = await _pcsApi.PostWipInfoBlob(JsonConvert.SerializeObject(model.wipInfoBlob)); - // } - // } - //} - WipCheck wipCheck = new WipCheck { WipNo = model.wipInfo.WipNO }; - if (action == "生管確認") + + if (action == "通知PE") { wipCheck.PMCUserID = UserID; await CheckPCS003ToMail(model.wipInfo.WipNO, model.wipAtt.ItemNO, model.wipInfo.UnitNO, model.wipInfo.WipScheduleDate.ToString(), action); @@ -2937,6 +2717,10 @@ namespace AMESCoreStudio.Web.Controllers await _pcsApi.PutWipCheckByMF(JsonConvert.SerializeObject(wipCheck)); } + // 儲存後將最新資料都回前端 + model.wipMACs = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); + model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO); + var _msg = "修改成功!"; ModelState.AddModelError("error", _msg); return View("PCS003", model); @@ -3251,7 +3035,7 @@ namespace AMESCoreStudio.Web.Controllers { WipNo = model.wipInfo.WipNO }; - if (action == "生管確認") + if (action == "通知PE") { wipCheck.PMCUserID = UserID; await CheckPCS003ToMail(model.wipInfo.WipNO, model.wipAtt.ItemNO, model.wipInfo.UnitNO, model.wipInfo.WipScheduleDate.ToString(), action); @@ -3269,6 +3053,10 @@ namespace AMESCoreStudio.Web.Controllers await _pcsApi.PutWipCheckByMF(JsonConvert.SerializeObject(wipCheck)); } + // 儲存後將最新資料都回前端 + model.wipMACs = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); + model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO); + var _msg = "修改成功!"; ModelState.AddModelError("error", _msg); return View("PCS034", model); @@ -3298,15 +3086,16 @@ namespace AMESCoreStudio.Web.Controllers //工單Review,工程確認,完成後通知製造,mail群組名稱,請建立為[WOVIEW_MF] string MailGroup = string.Empty; string SubjectGroup = "製造單位"; - if (ReviewType == "生管確認") + if (ReviewType == "通知PE") { SubjectGroup = "工程單位"; MailGroup = "WOVIEW_PE"; + ReviewType = "生管單位"; } else { - MailGroup = "WOVIEW_MF"; SubjectGroup = "製造單位"; + MailGroup = "WOVIEW_MF"; } var result = await _basApi.GetFactoryUnits(); @@ -3318,7 +3107,7 @@ namespace AMESCoreStudio.Web.Controllers 生產料號:{Material}
所屬製程:{Process}
預計開工日:{StrDate}
-
{ReviewType}單位,已review完畢,請接續生產參數之確認"; +
{ReviewType},已review完畢,請接續生產參數之確認"; await _bllApi.PostToMail(Subject, Body, MailGroup, "", false); diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml index 64032b57..6fd0c628 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -198,6 +198,7 @@ +
@@ -249,14 +250,14 @@ @foreach (var index in Model.wipBarcodes) { - - - @index.StartNO - - - @index.EndNO - - + + + @index.StartNO + + + @index.EndNO + + } @@ -308,14 +309,14 @@ @foreach (var index in Model.wipMACs) { - - - @index.Title@index.StartNO - - - @index.Title@index.EndNO - - + + + @index.Title@index.StartNO + + + @index.Title@index.EndNO + + } @@ -380,30 +381,30 @@ @foreach (var index in Model.WipKps) { - - - - - - - - - - - - - - - - - - - - - - 刪除 - - + + + + + + + + + + + + + + + + + + + + + + 刪除 + + k++; } @@ -454,11 +455,11 @@ @if (!string.IsNullOrWhiteSpace(Model.itemNoCT1)) { - 有維護標準工時 + 有維護標準工時 } else { - **無維護標準工時** + **無維護標準工時** }
@@ -501,18 +502,9 @@
- - - + + +
@@ -528,10 +520,7 @@
- +
@@ -552,10 +541,7 @@
- +
@@ -568,10 +554,7 @@
- +
@@ -587,10 +570,7 @@
- +
@@ -720,11 +700,11 @@ @if (!string.IsNullOrWhiteSpace(Model.itemNoCT1)) { - 有維護標準工時 + 有維護標準工時 } else { - **無維護標準工時** + **無維護標準工時** }
@@ -896,10 +876,7 @@
- +
@@ -973,23 +950,23 @@ @foreach (var index in Model.WipOutfits) { - - - - - - - - - + - - - - - 刪除 - - + + + + + + + + + + + + + 刪除 + + l++; } @@ -1010,8 +987,8 @@ SOP文件敘述 @* - 檔案路徑 - *@ + 檔案路徑 + *@ SOP類型 @@ -1026,24 +1003,24 @@ @foreach (var index in Model.WipSops) { - - - - - - @* - - *@ - - - - - - - - 刪除 - - + + + + + + @* + + *@ + + + + + + + + 刪除 + + i++; } @@ -1106,7 +1083,6 @@ - Remark @@ -1116,23 +1092,23 @@ @foreach (var index in Model.wipInfoBlobs) { - - - - + + + - - + + + }
檔案名稱 檔案路徑 備註
- @index.ImageName - - @index.Filepath - - @index.Remark +
+ @index.ImageName + + @index.Filepath + + @index.Remark - - 預覽 - 下載 - 刪除 -
+ 預覽 + 下載 + 刪除 +
@@ -1146,6 +1122,12 @@ +
+ +
+ +
+
@@ -1364,7 +1346,7 @@ else { var contactdiv = '' + `${data.mix} - ${data.max}`; + ${data.max}`; $('#MACTable').append(contactdiv); } }, @@ -1492,13 +1474,13 @@ // 檔案刪除 function deleteFile(obj) { - layer.confirm('確定是否要刪除該筆檔案?', { + var FileName = $(obj).closest("TR").find('span[id*=FileName]').text(); + layer.confirm(`確定是否要刪除【${FileName}】檔案?`, { btn: ['確定', '取消'] }, function () { layer.closeAll('dialog'); - var FileName = $(obj).closest("TR").find('span[id*=FileName]').text(); $.ajax({ - url: '@Url.Action("DeleteWipInfoBlobByFileName", "PCS")', + url: '@Url.Action("DeleteWipInfoBlob", "PCS")', dataType: 'json', data: { "wipNo": '@Model.wipInfo.WipNO', "fileName": FileName }, cache: false, @@ -1509,8 +1491,8 @@ parent.hg.msg(result.msg); } else { - $("#wipBarcodeOther_StartNO").val(''); - $("#wipBarcodeOther_EndNO").val(''); + var row = $(obj).closest("TR"); + row.hide(); } }, error: function (jqXHR, textStatus, errorThrown) { @@ -1518,10 +1500,6 @@ } }); }) - var Path = $(obj).closest("TR").find('span[id*=Filepath]').text(); - var FileName = $(obj).closest("TR").find('span[id*=FileName]').text(); - filePath = `/PCS/FileDownload?Path=${Path}&FileName=${FileName}`; - $(obj).attr("href", filePath); } function getFlowRuleList(data) { @@ -1960,7 +1938,6 @@ }); }); - // 更新ECN or ECR function GetPLM_ECN() { $.ajax({ @@ -1970,14 +1947,19 @@ success: function (result) { if (result.success) { var result_msg = result.msg; - if ('@Model.wipAtt.ItemNO') + console.log(result_msg); + console.log('@Model.wipAtt.ECN'); + if ('@Model.wipAtt.ECN' != result_msg) { layer.confirm('比對與PLM ECN/ECR不一樣,確定更新ECN/ECR嗎?', { btn: ['確定', '取消'] - }, + }, function () { + layer.closeAll('dialog'); $("#wipAtt_ECN").val(result_msg); - } - else { - parent.hg.msg(result.msg); + }) + } + else { + parent.hg.msg(result.msg); + } } }, error: function (result) { diff --git a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml index 4c168345..e71df14b 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml @@ -205,7 +205,10 @@
- + + + +
@@ -482,9 +485,18 @@
- - - + + +
@@ -500,7 +512,10 @@
- +
@@ -521,7 +536,10 @@
- +
@@ -534,7 +552,10 @@
- +
@@ -550,7 +571,10 @@
- +
@@ -854,7 +878,10 @@
- +
@@ -965,8 +992,8 @@ SOP文件敘述 @* - 檔案路徑 - *@ + 檔案路徑 + *@ SOP類型 @@ -987,8 +1014,8 @@ @* - - *@ + + *@ @@ -1061,10 +1088,10 @@ - - - - + + + + @@ -1078,10 +1105,13 @@ @index.Filepath } @@ -1097,6 +1127,12 @@ +
+ +
+ +
+
@@ -1214,7 +1250,7 @@ }); // 產生MAC - $("#GetMAC").click(function (event) { + $("#GetMAC").click(function (event) { var wipNO = $('#wipAtt_ItemNO').val(); var planQTY = $('#wipInfo_PlanQTY').val(); if (wipNO == '' || !wipNO) { @@ -1228,7 +1264,7 @@ $.ajax({ url: '@Url.Action("GetMAC", "PCS")', dataType: 'json', - data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val() ,"planQTY": $('#wipInfo_PlanQTY').val() }, + data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val(), "planQTY": $('#wipInfo_PlanQTY').val() }, cache: false, type: "POST", success: function (data, textStatus, jqXHR) { @@ -1238,7 +1274,7 @@ else { var contactdiv = '' + ` - `; + `; $('#MACTable').append(contactdiv); } }, @@ -1352,6 +1388,36 @@ $(obj).attr("href", filePath); }; + // 檔案刪除 + function deleteFile(obj) { + var FileName = $(obj).closest("TR").find('span[id*=FileName]').text(); + layer.confirm(`確定是否要刪除【${FileName}】檔案?`, { + btn: ['確定', '取消'] + }, function () { + layer.closeAll('dialog'); + $.ajax({ + url: '@Url.Action("DeleteWipInfoBlob", "PCS")', + dataType: 'json', + data: { "wipNo": '@Model.wipInfo.WipNO', "fileName": FileName }, + cache: false, + type: "POST", + success: function (result) { + // 錯誤訊息 + if (!result.success) { + parent.hg.msg(result.msg); + } + else { + var row = $(obj).closest("TR"); + row.hide(); + } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert("檔案刪除失敗,請洽系統管理員!!"); + } + }); + }) + } + function getFlowRuleList(data) { $.ajax( { @@ -1708,6 +1774,36 @@ }); return b; } + + // 更新ECN or ECR + function GetPLM_ECN() { + $.ajax({ + url: "@Url.Action("FQC007GetPLMECN", "FQC")", + type: "Post", + data: { "ItemNo": '@Model.wipAtt.ItemNO' }, + success: function (result) { + if (result.success) { + var result_msg = result.msg; + console.log(result_msg); + console.log('@Model.wipAtt.ECN'); + if ('@Model.wipAtt.ECN' != result_msg) { + layer.confirm('比對與PLM ECN/ECR不一樣,確定更新ECN/ECR嗎?', { + btn: ['確定', '取消'] + }, function () { + layer.closeAll('dialog'); + $("#wipAtt_ECN").val(result_msg); + }) + } + else { + parent.hg.msg(result.msg); + } + } + }, + error: function (result) { + parent.hg.msg(`呼叫API失敗`); + } + }); + } } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfoBlobController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfoBlobController.cs index 6b31b862..f09b2359 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfoBlobController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfoBlobController.cs @@ -137,7 +137,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES public async Task> DeleteWipInfoBlobByFileName(string wipNo, string fileName) { ResultModel result = new ResultModel(); - if (!string.IsNullOrWhiteSpace(wipNo) && !string.IsNullOrWhiteSpace(fileName)) + if (string.IsNullOrWhiteSpace(wipNo) || string.IsNullOrWhiteSpace(fileName)) { result.Success = false; result.Msg = "請輸入要刪除的資料"; @@ -160,7 +160,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { result.Success = false; result.Msg = ex.InnerException.Message; - } } }
檔案名稱檔案路徑預覽下載檔案名稱檔案路徑備註
- 預覽 + @index.Remark + + 預覽 下載 + 刪除
${data.mix}${data.max}
${data.max}