Browse Source

1. 生產工程編號流程維護 => 選單能依照生產單位顯示流程

2. 工單修改 => 新增複製工單功能,複製工單備註、機種名稱、連板數、BOM日期、SMD投產優先面、條碼備註、板卡資訊/工程資訊
master
Sai 4 weeks ago
parent
commit
c6c8ef87d1
  1. 11
      AMESCoreStudio.Web/Controllers/BASController.cs
  2. 281
      AMESCoreStudio.Web/Controllers/PCSController.cs
  3. 3
      AMESCoreStudio.Web/Views/BAS/BAS012.cshtml
  4. 121
      AMESCoreStudio.Web/Views/BAS/BAS012C.cshtml
  5. 112
      AMESCoreStudio.Web/Views/BAS/BAS012U.cshtml
  6. 28
      AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml
  7. 127
      AMESCoreStudio.Web/Views/PCS/PCS003.cshtml
  8. 1
      AMESCoreStudio.Web/Views/PCS/PCS021.cshtml
  9. 246
      AMESCoreStudio.Web/Views/PCS/PCS034.cshtml

11
AMESCoreStudio.Web/Controllers/BASController.cs

@ -162,7 +162,8 @@ namespace AMESCoreStudio.Web.Controllers
ViewBag.FlowRuleList = FlowRuleItems;
}
private async Task GetFlowRuleListByUnit(string unit_no)
[HttpPost]
public async Task<JsonResult> GetFlowRuleListByUnit(string unit_no)
{
var result = await _basApi.GetFlowRulesByUnit(unit_no);
@ -172,6 +173,7 @@ namespace AMESCoreStudio.Web.Controllers
FlowRuleItems.Add(new SelectListItem(result[i].UnitNo + result[i].FlowRuleName, result[i].FlowRuleID.ToString()));
}
ViewBag.FlowRuleList = FlowRuleItems;
return Json(new { data = FlowRuleItems });
}
private async Task GetStationList()
@ -2014,17 +2016,20 @@ namespace AMESCoreStudio.Web.Controllers
public async Task<IActionResult> BAS012UAsync(string id)
{
await GetUnitList();
await GetFlowRuleList();
var aStr = id.Split("=");
var iID = int.Parse(aStr[0]);
ViewBag.item = aStr[1];
var result = await _basApi.GetMaterialFlow(iID);
if (result.Count == 0)
{
await GetFlowRuleList();
return View();
}
await GetFlowRuleListByUnit(result[0].UnitNo);
return View(result[0]);
}
@ -2058,7 +2063,7 @@ namespace AMESCoreStudio.Web.Controllers
}
else
{
if (result.Errors.Count > 0)
if (result.Errors != null && result.Errors.Count > 0)
{
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg);
}

281
AMESCoreStudio.Web/Controllers/PCSController.cs

@ -102,23 +102,15 @@ namespace AMESCoreStudio.Web.Controllers
// 工單新增不用判斷
if (action != "New")
{
// 安勤統一執行WIP_SYSTEM
if (ViewBag.WipSpecial == "Y")
// 系統 昶亨 組立:B 測試:T 包裝:O
if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "T" || model.wipInfo.UnitNO == "O")
{
Msg += CheckWipInfoInsert_WipSystem(model.wipSystem);
}
// 板卡
else
{
// 系統 昶亨 組立:B 測試:T 包裝:O
if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "T" || model.wipInfo.UnitNO == "O")
{
Msg += CheckWipInfoInsert_WipSystem(model.wipSystem);
}
// 板卡
else
{
Msg += CheckWipInfoInsert_WipBoard(model.wipBoard);
}
Msg += CheckWipInfoInsert_WipBoard(model.wipBoard);
}
}
@ -2071,9 +2063,6 @@ namespace AMESCoreStudio.Web.Controllers
public async Task<IActionResult> PCS001R(int id)
{
// 針對安勤 工單基本資料統一打開工程資訊
ViewBag.WipSpecial = _configuration["WipSpecial"];
WipDataViewModel model = new WipDataViewModel();
var q = await _pcsApi.GetWipInfo(id);
if (q.Count != 0)
@ -2195,9 +2184,6 @@ namespace AMESCoreStudio.Web.Controllers
public async Task<IActionResult> PCS003(int id)
{
// 針對安勤 工單基本資料統一打開工程資訊
ViewBag.WipSpecial = _configuration["WipSpecial"];
WipDataViewModel model = new WipDataViewModel();
var q = await _pcsApi.GetWipInfo(id);
if (q.Count != 0)
@ -2353,12 +2339,203 @@ namespace AMESCoreStudio.Web.Controllers
return View(model);
}
[HttpGet]
public async Task<IActionResult> PCS003GetData(int id, string copyWipNo, bool success = false)
{
WipDataViewModel model = new WipDataViewModel();
var q = await _pcsApi.GetWipInfo(id);
if (q.Count != 0)
{
// 判斷工單號碼是否已經投入
if (await _pcsApi.GetWipInfoCheckStart(q.FirstOrDefault().WipNO, q.FirstOrDefault().UnitNO, q.FirstOrDefault().LineID) == "Y")
{
var _msg = _sharedLocalizer["Error_WorkOrder_InProgress", q.FirstOrDefault().WipNO];
return RedirectToAction("Refresh", "Home", new { msg = _msg });
}
// 判斷工單號碼是否已經開線
if (await _pcsApi.GetWipInfoCheckStartLine(q.FirstOrDefault().WipNO, q.FirstOrDefault().UnitNO, q.FirstOrDefault().LineID) == "Y")
{
var _msg = _sharedLocalizer["Error_WorkOrder_LineStarted", q.FirstOrDefault().WipNO];
return RedirectToAction("Refresh", "Home", new { msg = _msg });
}
// 判斷是否完工
if (q.Where(w => w.StatusNO == "E").Any())
{
var _msg = _sharedLocalizer["Error_WorkOrder_Completed", q.FirstOrDefault().WipNO];
return RedirectToAction("Refresh", "Home", new { msg = _msg });
}
// 判斷是否刪除
if (q.Where(w => w.StatusNO == "C").Any())
{
var _msg = _sharedLocalizer["Error_WorkOrder_Deleted", q.FirstOrDefault().WipNO];
return RedirectToAction("Refresh", "Home", new { msg = _msg });
}
// 原先工單資料
model.wipInfo = q.FirstOrDefault();
model.wipAtt = await _pcsApi.GetWipAtt(model.wipInfo.WipNO);
model.wipBarcodes = await _pcsApi.GetWipBarcode(model.wipInfo.WipNO);
model.wipBarcode = model.wipBarcodes.FirstOrDefault() ?? new WipBarcode();
model.wipMACs = await _pcsApi.GetWipMAC(model.wipInfo.WipNO);
model.wipLabel = await _pcsApi.GetWipLabel(model.wipInfo.WipNO);
model.wipBarcodeOthers = await _pcsApi.GetWipBarcodeOthers(model.wipInfo.WipNO);
model.WipKps = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO);
model.WipOutfits = await _pcsApi.GetWipOutfitByWipNo(model.wipInfo.WipNO);
model.WipSops = await _pcsApi.GetWipSopByWipNo(model.wipInfo.WipNO);
model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO);
#region 複製工單資料
// 板卡資訊-ALL
model.wipBoard = await _pcsApi.GetWipBoard(copyWipNo);
// 工程資訊-ALL
model.wipSystem = await _pcsApi.GetWipSystem(copyWipNo);
var copyWipAtt = await _pcsApi.GetWipAtt(copyWipNo);
var copyWipBarcode = await _pcsApi.GetWipBarcode(copyWipNo);
var copyWipInfo = await _pcsApi.GetWipInfoByWipNO(copyWipNo);
// 工單基本資料-工單備註
if (copyWipInfo.Any())
{
model.wipInfo.Remarks = copyWipInfo.FirstOrDefault().Remarks;
}
// 工單屬性-連板數、機種名稱、BOM日期、SMD投產優先
if (copyWipAtt != null)
{
model.wipAtt.BomDate = copyWipAtt.BomDate;
model.wipAtt.ModelNO = copyWipAtt.ModelNO;
model.wipAtt.Boards = copyWipAtt.Boards;
model.wipAtt.Side = copyWipAtt.Side;
}
// 生產條碼-條碼備註
if (copyWipBarcode.Any())
{
model.wipBarcode.Remarks = copyWipBarcode.FirstOrDefault().Remarks;
}
#endregion
if (model.wipBoard != null)
{
if (!string.IsNullOrWhiteSpace(model.wipBoard.Engineer))
{
var UserInof = _sysApi.GetUserInfoByUserNo(model.wipBoard.Engineer).InvokeAsync().Result;
if (UserInof != null)
model.wipBoard.Engineer_Name = UserInof.UserName;
}
// 判斷是否是零件烘烤-其他溫度
var PartsBake = model.wipBoard.PartsBake;
if (PartsBake != 125 && PartsBake != 100 && PartsBake != 80 && PartsBake != 60 && PartsBake != 45 && PartsBake != 0)
model.wipBoard.PartsBakeOther = PartsBake;
}
if (model.wipSystem != null)
{
if (!string.IsNullOrWhiteSpace(model.wipSystem.Ec))
{
var Ec_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Ec).InvokeAsync().Result;
model.wipSystem.Ec_Desc = Ec_Desc.Count == 0 ? "" : Ec_Desc.FirstOrDefault().MeterialDesc;
}
if (!string.IsNullOrWhiteSpace(model.wipSystem.Fw))
{
var Fw_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw).InvokeAsync().Result;
model.wipSystem.Fw_Desc = Fw_Desc.Count == 0 ? "" : Fw_Desc.FirstOrDefault().MeterialDesc;
}
if (!string.IsNullOrWhiteSpace(model.wipSystem.Fw1))
{
var Fw1_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw1).InvokeAsync().Result;
model.wipSystem.Fw1_Desc = Fw1_Desc.Count == 0 ? "" : Fw1_Desc.FirstOrDefault().MeterialDesc;
}
if (!string.IsNullOrWhiteSpace(model.wipSystem.Fw2))
{
var Fw2_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw2).InvokeAsync().Result;
model.wipSystem.Fw2_Desc = Fw2_Desc.Count == 0 ? "" : Fw2_Desc.FirstOrDefault().MeterialDesc;
}
if (!string.IsNullOrWhiteSpace(model.wipSystem.Bios))
{
var Bios_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Bios).InvokeAsync().Result;
model.wipSystem.Bios_Desc = Bios_Desc.Count == 0 ? "" : Bios_Desc.FirstOrDefault().MeterialDesc;
}
if (!string.IsNullOrWhiteSpace(model.wipSystem.OsVer))
{
var Os_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.OsVer).InvokeAsync().Result;
model.wipSystem.OsVer_Desc = Os_Desc.Count == 0 ? "" : Os_Desc.FirstOrDefault().MeterialDesc;
}
if (!string.IsNullOrWhiteSpace(model.wipSystem.PowerMode))
{
var PowerMode_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.PowerMode).InvokeAsync().Result;
model.wipSystem.PowerMode_Desc = PowerMode_Desc.Count == 0 ? "" : PowerMode_Desc.FirstOrDefault().ProductionMemo;
}
if (!string.IsNullOrWhiteSpace(model.wipSystem.Engineer))
{
var UserInof = _sysApi.GetUserInfoByUserNo(model.wipSystem.Engineer).InvokeAsync().Result;
if (UserInof != null)
model.wipSystem.Engineer_Name = UserInof.UserName;
}
}
// 取料號對應工時
var standardWorkTimes = await _pcsApi.GetStandardWorkTimeByItemNo(model.wipAtt.ItemNO);
if (standardWorkTimes.Count != 0)
model.itemNoCT1 = standardWorkTimes.Sum(m => m.TotalCT).ToString();
// 確認是否已通知
var wipCheck = await _pcsApi.GetWipCheck(model.wipInfo.WipNO);
if (wipCheck == null)
{
model.wipCheck = "N";
}
else if (wipCheck.PEUserID != null)
{
model.wipCheck = "Y";
}
}
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 : "");
GetCheckboxSMD(model.wipBoard != null ? model.wipBoard.Smd : "");
GetCheckboxSMDSolderMa(model.wipBoard != null ? model.wipBoard.SmdSolderMask : "");
return View("PCS003", model);
}
[HttpPost]
public async Task<IActionResult> PCS003Async(WipDataViewModel model, string action, IFormFile formFile)
public async Task<IActionResult> CheckWipNoData(string wipNo)
{
// 針對安勤 工單基本資料統一打開工程資訊 不判斷製程
ViewBag.WipSpecial = _configuration["WipSpecial"];
try
{
// 檢查是否有資料
var hasData = await _pcsApi.GetWipInfoByWipNO(wipNo.Trim().ToUpper());
return Json(hasData);
}
catch (Exception ex)
{
return Json(new List<object>());
}
}
[HttpPost]
public async Task<IActionResult> PCS003Async(WipDataViewModel model, string action, IFormFile formFile)
{
try
{
// 登入UserID
@ -2575,9 +2752,6 @@ namespace AMESCoreStudio.Web.Controllers
#region PCS034 工單投產可修改
public async Task<IActionResult> PCS034(int id)
{
// 針對安勤 工單基本資料統一打開工程資訊
ViewBag.WipSpecial = _configuration["WipSpecial"];
WipDataViewModel model = new WipDataViewModel();
var q = await _pcsApi.GetWipInfo(id);
if (q.Count != 0)
@ -2705,9 +2879,6 @@ namespace AMESCoreStudio.Web.Controllers
[HttpPost]
public async Task<IActionResult> PCS034Async(WipDataViewModel model, string action, IFormFile formFile)
{
// 針對安勤 工單基本資料統一打開工程資訊 不判斷製程
ViewBag.WipSpecial = _configuration["WipSpecial"];
try
{
// 登入UserID
@ -7944,8 +8115,8 @@ namespace AMESCoreStudio.Web.Controllers
Msg += result.Msg;
}
// 安勤統一執行WipSystem
if (ViewBag.WipSpecial == "Y")
// 系統WipSystem
if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "O" || model.wipInfo.UnitNO == "T")
{
// 測試備註空白 帶工單描述
if (string.IsNullOrWhiteSpace(model.wipSystem.TestMemo))
@ -7964,46 +8135,24 @@ namespace AMESCoreStudio.Web.Controllers
}
}
else
// 板卡 WipBoard
{
// 系統WipSystem
if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "O" || model.wipInfo.UnitNO == "T")
{
// 測試備註空白 帶工單描述
if (string.IsNullOrWhiteSpace(model.wipSystem.TestMemo))
{
model.wipSystem.TestMemo = model.wipInfo.Description;
}
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;
model.wipSystem.ItemNo = model.wipAtt.ItemNO;
model.wipSystem.WipNo = model.wipInfo.WipNO;
model.wipSystem.CreateUserID = UserID;
model.wipSystem.UpdateUserID = UserID;
result = await _pcsApi.PutWipSystem(JsonConvert.SerializeObject(model.wipSystem));
if (!result.Success)
{
Msg += result.Msg;
}
}
else
// 板卡 WipBoard
// 零件烘烤-其他時間
if (model.wipBoard.PartsBake == 999)
model.wipBoard.PartsBake = (int)model.wipBoard.PartsBakeOther;
result = await _pcsApi.PutWipBoard(JsonConvert.SerializeObject(model.wipBoard));
if (!result.Success)
{
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;
// 零件烘烤-其他時間
if (model.wipBoard.PartsBake == 999)
model.wipBoard.PartsBake = (int)model.wipBoard.PartsBakeOther;
result = await _pcsApi.PutWipBoard(JsonConvert.SerializeObject(model.wipBoard));
if (!result.Success)
{
Msg += result.Msg;
}
Msg += result.Msg;
}
}

3
AMESCoreStudio.Web/Views/BAS/BAS012.cshtml

@ -51,7 +51,7 @@
var tableCols = [[
{
field: 'mfid',
//width: 80,
width: 80,
title: '#',
sort: true
},
@ -59,6 +59,7 @@
field: 'itemNo',
title: '工程編號',
sort: true,
width: 200,
templet: function (d) {
var tt;
if (d.materialItem)

121
AMESCoreStudio.Web/Views/BAS/BAS012C.cshtml

@ -1,8 +1,10 @@
@model AMESCoreStudio.WebApi.Models.BAS.MaterialFlow
@{ ViewData["Title"] = "BAS012C";
Layout = "~/Views/Shared/_FormLayout.cshtml"; }
@{
ViewData["Title"] = "BAS012C";
Layout = "~/Views/Shared/_FormLayout.cshtml";
}
<style>
@ -60,52 +62,83 @@
</div>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial"); }
<script type="text/javascript">
$(document).ready(function () {
var error = '@Html.ValidationMessage("error")';
if ($(error).text() != '') {
parent.hg.msg(error);
}
});
$("#ItemNo").blur(function () {
var data = $("#ItemNo").val();
console.log(data);
getItemID(data);
//$("input").css("background-color", "#D6D6FF");
});
function getItemID(itemNo) {
$.ajax({
url: "/BAS/GetMaterialItemByItemNO",
data: { id: itemNo},
dataType: 'json',
contentType: "application/json",
type: 'get',
success: function (result) {
if (result.data) {
console.info(result.data);
$("#ItemID").val(result.data.itemID);
}
else {
alert('請確認工程編號是否正確!!!');
}
@{
await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial");
}
<script type="text/javascript">
$(document).ready(function () {
var error = '@Html.ValidationMessage("error")';
if ($(error).text() != '') {
parent.hg.msg(error);
}
// 當 UnitNo 的選擇改變時
$('#UnitNo').change(function () {
var selectedUnitNo = $(this).val();
getFlowRuleList(selectedUnitNo);
});
$('#UnitNo').change();
});
};
$("#FlowSEQ").blur(function () {
var data = $("#FlowSEQ").val();
if (data > 9 || data < 0)
{
alert('請輸入正確SEQUENCE!!!');
$("#FlowSEQ").val("");
}
});
</script>
$("#ItemNo").blur(function () {
var data = $("#ItemNo").val();
console.log(data);
getItemID(data);
//$("input").css("background-color", "#D6D6FF");
});
function getItemID(itemNo) {
$.ajax({
url: "/BAS/GetMaterialItemByItemNO",
data: { id: itemNo },
dataType: 'json',
contentType: "application/json",
type: 'get',
success: function (result) {
if (result.data) {
console.info(result.data);
$("#ItemID").val(result.data.itemID);
}
else {
alert('請確認工程編號是否正確!!!');
}
}
});
};
$("#FlowSEQ").blur(function () {
var data = $("#FlowSEQ").val();
if (data > 9 || data < 0) {
alert('請輸入正確SEQUENCE!!!');
$("#FlowSEQ").val("");
}
});
function getFlowRuleList(unitNo) {
$.ajax({
url: '@Url.Action("GetFlowRuleListByUnit", "BAS")',
dataType: 'json',
data: { "unit_no": unitNo },
type: 'post',
success: function (result) {
console.info(result.data);
var i = 0;
$("#FlowRuleID").empty(); // 清空下拉框的值
$.each(result.data, function (index, item) {
$("#FlowRuleID").append($("<option>").text(item.text).val(item.value));
i++;
});
//$('#FlowRuleID').change();
},
error: function (result) {
alert('獲取流程規則失敗,請稍後再試。');
}
});
}
</script>
}

112
AMESCoreStudio.Web/Views/BAS/BAS012U.cshtml

@ -1,8 +1,10 @@
@model AMESCoreStudio.WebApi.Models.BAS.MaterialFlow
@{ ViewData["Title"] = "BAS015U";
Layout = "~/Views/Shared/_FormLayout.cshtml"; }
@{
ViewData["Title"] = "BAS015U";
Layout = "~/Views/Shared/_FormLayout.cshtml";
}
<style>
@ -21,6 +23,7 @@
<input type="hidden" asp-for="UpdateUserID" value="0" />
<input type="hidden" asp-for="UpdateDate" value="@System.DateTime.Now" />
<input type="hidden" id="ItemID" asp-for="ItemID" />
<input type="hidden" id="hflowRuleid" value="@Model.FlowRuleID" />
<input type="hidden" asp-for="MaterialFlowStatus" />
<div class="form-group form-inline my-sm-1">
@ -41,7 +44,7 @@
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="MaterialFlowRemark" class="control-label col-sm-3"></label>
<input asp-for="MaterialFlowRemark" class="form-control col-sm-9"/>
<input asp-for="MaterialFlowRemark" class="form-control col-sm-9" />
<span asp-validation-for="MaterialFlowRemark" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
@ -60,43 +63,52 @@
</div>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial"); }
@{
await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial");
}
<script type="text/javascript">
$(document).ready(function () {
var error = '@Html.ValidationMessage("error")';
if ($(error).text() != '') {
parent.hg.msg(error);
}
});
$("#ItemNo").blur(function () {
var data = $("#ItemNo").val();
console.log(data);
getItemID(data);
//$("input").css("background-color", "#D6D6FF");
});
function getItemID(itemNo) {
$.ajax({
url: "/BAS/GetMaterialItemByItemNO",
data: { id: itemNo},
dataType: 'json',
contentType: "application/json",
type: 'get',
success: function (result) {
if (result.data) {
console.info(result.data);
$("#ItemID").val(result.data.itemID);
}
else {
alert('請確認工程編號是否正確!!!');
}
$(document).ready(function () {
var error = '@Html.ValidationMessage("error")';
if ($(error).text() != '') {
parent.hg.msg(error);
}
$('#UnitNo').change(function () {
var selectedUnitNo = $(this).val();
getFlowRuleList(selectedUnitNo);
});
$('#UnitNo').change();
});
};
$("#FlowSEQ").blur(function () {
$("#ItemNo").blur(function () {
var data = $("#ItemNo").val();
console.log(data);
getItemID(data);
//$("input").css("background-color", "#D6D6FF");
});
function getItemID(itemNo) {
$.ajax({
url: "/BAS/GetMaterialItemByItemNO",
data: { id: itemNo },
dataType: 'json',
contentType: "application/json",
type: 'get',
success: function (result) {
if (result.data) {
console.info(result.data);
$("#ItemID").val(result.data.itemID);
}
else {
alert('請確認工程編號是否正確!!!');
}
}
});
};
$("#FlowSEQ").blur(function () {
var data = $("#FlowSEQ").val();
if (data > 9 || data < 0) {
alert('請輸入正確SEQUENCE!!!');
@ -104,7 +116,33 @@
}
});
function getFlowRuleList(unitNo) {
$.ajax({
url: '@Url.Action("GetFlowRuleListByUnit", "BAS")',
dataType: 'json',
data: { "unit_no": unitNo },
type: 'post',
success: function (result) {
console.info(result.data);
var i = 0;
$("#FlowRuleID").empty(); // 清空下拉框的值
$.each(result.data, function (index, item) {
$("#FlowRuleID").append($("<option>").text(item.text).val(item.value));
i++;
});
var data = $("#hflowRuleid").val();
if (data.length !== 0)
{
$('#FlowRuleID').val(data);
$("#hflowRuleid").val('');
}
//$('#FlowRuleID').change();
},
error: function (result) {
alert('獲取流程規則失敗,請稍後再試。');
}
});
}
</script>

28
AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml

@ -1167,19 +1167,14 @@
<script type="text/javascript">
$(document).ready(function () {
// 安勤統一只Show工程資訊
$("#system").show();
$("#board").hide();
if ("@ViewBag.WipSpecial" == "N") {
if ($("#unitNo").val() == "B" || $("#unitNo").val() == "O" || $("#unitNo").val() == "T") {
$("#system").show();
$("#board").hide();
}
else {
$("#system").hide();
$("#board").show();
}
// 判斷工單製程切換工程資訊或板卡資訊
if ($("#unitNo").val() == "B" || $("#unitNo").val() == "O" || $("#unitNo").val() == "T") {
$("#system").show();
$("#board").hide();
}
else {
$("#system").hide();
$("#board").show();
}
$(":input").attr("disabled", "disabled");
@ -1211,13 +1206,6 @@
alert("TAB");
table && table.reload(data);
});
////转换静态表格
//table.init('demo', {
// height: 315 //设置高度
// , limit: 10 //注意:請务必確保 limit 参数(默认:10)是与你服务端限定的資料条数一致
// //支持所有基础参数
//});
});
//通过行tool編輯,lay-event="show"

127
AMESCoreStudio.Web/Views/PCS/PCS003.cshtml

@ -7,6 +7,7 @@
Layout = "~/Views/Shared/_AMESLayout.cshtml";
}
<style>
.control-label {
justify-content: flex-end !important;
@ -19,10 +20,30 @@
.my-read-only-class {
cursor: not-allowed;
}
#dataDialog .layui-form-label {
font-weight: bold;
font-size: 16px;
}
#dataDialog .layui-input-inline input {
font-size: 16px;
height: 38px;
}
</style>
<div class="layui-card">
<div class="col-sm-12">
<!-- 彈出複製工單視窗 -->
<div id="dataDialog" style="display:none;">
<div class="layui-form-item" style="margin-top: 30px;">
<label class="layui-form-label" style="width: 90px;">工單號碼</label>
<div class="layui-input-inline" style="width: 250px;">
<input type="text" name="keyWipNo" required lay-verify="required" placeholder="請輸入工單號碼" class="layui-input">
</div>
</div>
</div>
<form id="formPCS003" enctype="multipart/form-data" method="post" asp-action="PCS003" class="layui-form">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="wipInfo.WipID" type="hidden" value="@Model.wipInfo.WipID" />
@ -41,8 +62,10 @@
<div class="layui-inline">
<label class="layui-form-label">@Localizer["WipNo"]</label>
<div class="layui-input-inline">
<input asp-for="wipInfo.WipNO" class="layui-input" autocomplete="off" disabled />
<span asp-validation-for="wipInfo.WipNO" class="layui-bg-red"></span>
<input asp-for="wipInfo.WipNO" style="width: 150px; display: initial" class="layui-input" autocomplete="off" disabled />
<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" style="padding: 0 5px;" onclick="openDataDialog()">
<i class="layui-icon layui-icon-sm">&#xe669;</i>
</button>
</div>
<label class="layui-form-label">@Localizer["WipSeq"]</label>
<div class="layui-input-inline">
@ -61,6 +84,16 @@
</div>
</div>
@*
<div id="dataDialog" style="display:none;">
<div class="layui-form-item">
<label class="layui-form-label">工單號碼</label>
<div class="layui-input-block">
<input type="text" name="keyWipNo" required lay-verify="required" placeholder="請輸入工單號碼" class="layui-input">
</div>
</div>
</div> *@
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">@Localizer["WipType"]</label>
@ -1243,7 +1276,11 @@
</div>
</form>
</div>
</div>
<!-- 新增彈出視窗 -->
@section Scripts {
<script type="text/javascript">
@ -1262,23 +1299,27 @@
parent.hg.msg(error);
}
RuleStation($("#flowId").val());
// 安勤統一只Show工程資訊
$("#system").show();
$("#board").hide();
$('#dataDialog').hide();
// 清除可能殘留的 Layui 遮罩,以防萬一
$('.layui-layer-shade').remove();
if ("@ViewBag.WipSpecial" == "N") {
if ($("#unitNo").val() == "B" || $("#unitNo").val() == "O" || $("#unitNo").val() == "T") {
$("#system").show();
$("#board").hide();
}
else {
$("#system").hide();
$("#board").show();
}
// 檢查URL參數是否有success=true,複製工單成功
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('success') === 'true') {
layer.msg('工單複製資料更新成功');
}
RuleStation($("#flowId").val());
// 判斷製程顯示 工程資訊或板卡資訊
if ($("#unitNo").val() == "B" || $("#unitNo").val() == "O" || $("#unitNo").val() == "T") {
$("#system").show();
$("#board").hide();
}
else {
$("#system").hide();
$("#board").show();
}
// DIV keyPartsExcel
@if (Model.wipInfo.WipNO.StartsWith("981"))
@ -1640,9 +1681,9 @@
SelectKPNo += '</select>';
var SelectIsRepeat = `<select name=WipKps[${No}].IsRepeat>
<option value="N">否</option>
<option value="Y">是</option>
</select>`;
<option value="N">否</option>
<option value="Y">是</option>
</select>`;
var contactdiv = '<tr>' +
'<td><input type="hidden" value="" name="WipKps[' + No + '].WipKpID" />' +
@ -2035,5 +2076,53 @@
}
});
};
// 複製工單視窗
function openDataDialog() {
$('#dataDialog').hide();
var $dialog = $('#dataDialog').clone();
$dialog.find('input[name="keyWipNo"]').val(''); // 清空彈窗內 input 的值
$dialog.show(); // 確保複製出來的元素是可見的
layer.open({
type: 1,
title: '複製工單資料',
area: ['400px', '220px'],
content: $('#dataDialog'),
btn: ['確定'],
btnAlign: 'c', // 按鈕置中
yes: function (index, layero) {
var keyWipNo = $('input[name="keyWipNo"]').val();
// 驗證輸入值
if (!keyWipNo || keyWipNo.trim() === '') {
layer.msg('請輸入工單號碼');
return;
}
// 先檢查是否有資料
$.ajax({
url: '/PCS/CheckWipNoData',
type: 'POST',
data: { wipNo: keyWipNo },
success: function (result) {
if (result && result.length >= 1) {
console.log(result);
var wipId = '@Model.wipInfo.WipID ';
// 使用Controller重新載入頁面
window.location.href = `/PCS/PCS003GetData?id=${wipId}&copyWipNo=${keyWipNo}&success=true`;
} else {
layer.msg('查無工單資料資料');
}
},
error: function () {
layer.msg('系統錯誤,請稍後再試');
}
});
},
cancel: function (index, layero, that) {
$('#dataDialog').hide();
}
});
}
</script>
}

1
AMESCoreStudio.Web/Views/PCS/PCS021.cshtml

@ -1,4 +1,5 @@
@model AMESCoreStudio.Web.ViewModels.PCS.PCS021ViewModel
@{
ViewData["Title"] = "過站作業";
Layout = "~/Views/Shared/_AMESLayout.cshtml";

246
AMESCoreStudio.Web/Views/PCS/PCS034.cshtml

@ -211,8 +211,8 @@
<div class="layui-input-inline">
<input asp-for="wipAtt.ECN" class="layui-input" maxlength="20" />
@*<a onclick="GetPLM_ECN();" class="layui-btn layui-btn-sm layui-btn-normal" style="padding: 0 5px;" title="更新ECN/ECR">
<i class="layui-icon layui-icon-sm">&#xe669;</i>
</a>*@
<i class="layui-icon layui-icon-sm">&#xe669;</i>
</a>*@
</div>
<label asp-for="wipAtt.EAN" class="layui-form-label"></label>
<div class="layui-input-inline">
@ -280,14 +280,14 @@
<input asp-for="wipBarcodeOther.EndNO" class="layui-input" readonly="readonly" />
</div>
@*<div id="barcodeOtherDiv" style="display:inline;">
<label class="layui-form-label">lotNo</label>
<div class="layui-input-inline" style="width:100px;">
<input id="lotNo" class="layui-input" style="width:100px;" type="text" />
</div>
<div class="layui-input-inline">
<input id="GetBarcodeOther" class="layui-btn layui-btn-primary layui-border-blue layui-btn-sm" type="button" value="產生出貨序號" />
</div>
</div>*@
<label class="layui-form-label">lotNo</label>
<div class="layui-input-inline" style="width:100px;">
<input id="lotNo" class="layui-input" style="width:100px;" type="text" />
</div>
<div class="layui-input-inline">
<input id="GetBarcodeOther" class="layui-btn layui-btn-primary layui-border-blue layui-btn-sm" type="button" value="產生出貨序號" />
</div>
</div>*@
</div>
</div>
<div class="layui-form-item">
@ -397,8 +397,8 @@
}
</tbody>
</table>
@* <div style="text-align: right">
<input type="submit" value="通知PE" name="action" class="layui-btn" />
@* <div style="text-align: right">
<input type="submit" value="通知PE" name="action" class="layui-btn" />
</div> *@
</div>
@ -489,9 +489,18 @@
<label class="layui-form-label">DIP</label>
<div class="layui-input-block">
<cl-checkbox asp-items="@ViewBag.GetCheckboxDIP" asp-for="wipBoard.DipSides" asp-skin="defult"></cl-checkbox>
<input @if (Model.wipBoard != null) { @(Model.wipBoard.DipCarrier == "Y" ? "checked" : "") } type="checkbox" title="CARRIER" name="wipBoard.DipCarrier" />
<input @if (Model.wipBoard != null) { @(Model.wipBoard.DipTape == "Y" ? "checked" : "") } type="checkbox" title="貼付膠帶" name="wipBoard.DipTape" />
<input @if (Model.wipBoard != null) { @(Model.wipBoard.DipSolderMask == "Y" ? "checked" : "") } type="checkbox" title="點防焊膠" name="wipBoard.DipSolderMask" />
<input @if (Model.wipBoard != null)
{
@(Model.wipBoard.DipCarrier == "Y" ? "checked" : "")
} type="checkbox" title="CARRIER" name="wipBoard.DipCarrier" />
<input @if (Model.wipBoard != null)
{
@(Model.wipBoard.DipTape == "Y" ? "checked" : "")
} type="checkbox" title="貼付膠帶" name="wipBoard.DipTape" />
<input @if (Model.wipBoard != null)
{
@(Model.wipBoard.DipSolderMask == "Y" ? "checked" : "")
} type="checkbox" title="點防焊膠" name="wipBoard.DipSolderMask" />
</div>
</div>
</div>
@ -507,7 +516,10 @@
<div class="layui-inline">
<label class="layui-form-label">燒錄</label>
<div class="layui-input-inline">
<input @if (Model.wipBoard != null) { @(Model.wipBoard.Burn == "Y" ? "checked" : "") } type="checkbox" title="是否燒入" name="wipBoard.Burn" />
<input @if (Model.wipBoard != null)
{
@(Model.wipBoard.Burn == "Y" ? "checked" : "")
} type="checkbox" title="是否燒入" name="wipBoard.Burn" />
</div>
<label class="layui-form-label">燒機位置</label>
@ -528,7 +540,10 @@
<div class="layui-inline">
<label class="layui-form-label">零件烘烤</label>
<div class="layui-input-inline">
<input @if (Model.wipBoard != null) { @(Model.wipBoard.ISPartsBake == "Y" ? "checked" : "") } type="checkbox" title="零件是否需要烘烤" name="wipBoard.ISPartsBake" />
<input @if (Model.wipBoard != null)
{
@(Model.wipBoard.ISPartsBake == "Y" ? "checked" : "")
} type="checkbox" title="零件是否需要烘烤" name="wipBoard.ISPartsBake" />
</div>
<label class="layui-form-label">零件烘烤溫度</label>
<div class="layui-input-inline" style="width:100px">
@ -541,7 +556,10 @@
</div>
<div class="layui-input-inline">
<input @if (Model.wipBoard != null) { @(Model.wipBoard.PartsBakeOvertime == "Y" ? "checked" : "") } type="checkbox" title="零件烘烤超過48hrs" name="wipBoard.PartsBakeOvertime" />
<input @if (Model.wipBoard != null)
{
@(Model.wipBoard.PartsBakeOvertime == "Y" ? "checked" : "")
} type="checkbox" title="零件烘烤超過48hrs" name="wipBoard.PartsBakeOvertime" />
</div>
</div>
</div>
@ -557,7 +575,10 @@
<div class="layui-inline">
<label class="layui-form-label">PCB烘烤</label>
<div class="layui-input-inline">
<input @if (Model.wipBoard != null) { @(Model.wipBoard.ISPcbBake == "Y" ? "checked" : "") } type="checkbox" title="PCB是否需要烘烤" name="wipBoard.ISPcbBake" />
<input @if (Model.wipBoard != null)
{
@(Model.wipBoard.ISPcbBake == "Y" ? "checked" : "")
} type="checkbox" title="PCB是否需要烘烤" name="wipBoard.ISPcbBake" />
</div>
<div class="layui-input-inline">
<select asp-items="@ViewBag.GetPCBBakeTypeSelect" asp-for="wipBoard.PcbBake" class=""></select>
@ -865,7 +886,10 @@
<div class="layui-inline">
<label class="layui-form-label">FINE_PACKAGE</label>
<div class="layui-input-inline">
<input @if (Model.wipSystem != null) { @(Model.wipSystem.FinePackage == "Y" ? "checked" : "") } type="checkbox" title="是否為精裝" name="wipSystem.FinePackage" />
<input @if (Model.wipSystem != null)
{
@(Model.wipSystem.FinePackage == "Y" ? "checked" : "")
} type="checkbox" title="是否為精裝" name="wipSystem.FinePackage" />
</div>
</div>
</div>
@ -976,8 +1000,8 @@
SOP文件敘述
</th>
@*<th>
檔案路徑
</th>*@
檔案路徑
</th>*@
<th>
SOP類型
</th>
@ -1001,8 +1025,8 @@
<input onkeypress="if( event.keyCode == 13 ) { return false; }" class="layui-input" asp-for="@index.SOPName" name="WipSops[@i].SOPName" />
</td>
@*<td>
<input onkeypress="if( event.keyCode == 13 ) { return false; }" class="layui-input" asp-for="@index.SOPPath" name="WipSops[@i].SOPPath" />
</td>*@
<input onkeypress="if( event.keyCode == 13 ) { return false; }" class="layui-input" asp-for="@index.SOPPath" name="WipSops[@i].SOPPath" />
</td>*@
<td>
<select asp-for="@index.SOPType" name="WipSops[@i].SOPType" asp-items="@ViewBag.GetSOPTypeSelect" class=""></select>
</td>
@ -1020,8 +1044,8 @@
}
</tbody>
</table>
@* <div style="text-align: right">
<input type="submit" value="工程確認" name="action" class="layui-btn" />
@* <div style="text-align: right">
<input type="submit" value="工程確認" name="action" class="layui-btn" />
</div> *@
</div>
@ -1155,25 +1179,15 @@
}
RuleStation($("#flowId").val());
// 安勤統一只Show工程資訊
$("#system").show();
$("#board").hide();
if ("@ViewBag.WipSpecial" == "N") {
if ($("#unitNo").val() == "B" || $("#unitNo").val() == "P" || $("#unitNo").val() == "T") {
$("#system").show();
$("#board").hide();
}
else {
$("#system").hide();
$("#board").show();
}
// 判斷工單製程切換工程資訊或板卡資訊
if ($("#unitNo").val() == "B" || $("#unitNo").val() == "P" || $("#unitNo").val() == "T") {
$("#system").show();
$("#board").hide();
}
else {
$("#system").hide();
$("#board").show();
}
//// DIV 出貨序號
//if ($('#wipBarcodeOther_StartNO').val() != "" && $('#wipBarcodeOther_EndNO').val() != "") {
// $("#barcodeOtherDiv").hide();
//}
getLineInfoList($("#unitNo").val());
@ -1194,86 +1208,86 @@
});
@*// 產生出貨序號
@*// 產生出貨序號
$("#GetBarcodeOther").click(function (event) {
var itemNo = $('#wipAtt_ItemNO').val();
var planQTY = $('#wipInfo_PlanQTY').val();
var lotNo = $('#lotNo').val();
var wipShcDate = $('#wipInfo_WipScheduleDate').val().replace(/\//g, '-');
if (itemNo == '' || !itemNo) {
parent.hg.msg("請輸入工程編號");
return;
}
if (planQTY == '' || !planQTY || planQTY == 0) {
parent.hg.msg("請確認計畫數量");
return;
}
if (wipShcDate == '') {
parent.hg.msg("請確認預計開工日期有填寫");
return;
}
if (lotNo == '' || !lotNo) {
lotNo = getLotNo();
}
var itemNo = $('#wipAtt_ItemNO').val();
var planQTY = $('#wipInfo_PlanQTY').val();
var lotNo = $('#lotNo').val();
var wipShcDate = $('#wipInfo_WipScheduleDate').val().replace(/\//g, '-');
if (itemNo == '' || !itemNo) {
parent.hg.msg("請輸入工程編號");
return;
}
if (planQTY == '' || !planQTY || planQTY == 0) {
parent.hg.msg("請確認計畫數量");
return;
}
if (wipShcDate == '') {
parent.hg.msg("請確認預計開工日期有填寫");
return;
}
if (lotNo == '' || !lotNo) {
lotNo = getLotNo();
}
$.ajax({
url: '@Url.Action("GetBarcodeOther", "PCS")',
dataType: 'json',
data: { "itemNo": itemNo, "lotNo": lotNo, "num": planQTY, "wipNo": '@Model.wipInfo.WipNO', "wipShcDate": wipShcDate },
cache: false,
type: "POST",
success: function (result) {
// 錯誤訊息
if (!result.success) {
parent.hg.msg(result.msg);
}
else {
$("#wipBarcodeOther_StartNO").val(result.data.startNO);
$("#wipBarcodeOther_EndNO").val(result.data.endNO);
$("#barcodeOtherDiv").hide();
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("Found error when using Ajax!!");
}
});
$.ajax({
url: '@Url.Action("GetBarcodeOther", "PCS")',
dataType: 'json',
data: { "itemNo": itemNo, "lotNo": lotNo, "num": planQTY, "wipNo": '@Model.wipInfo.WipNO', "wipShcDate": wipShcDate },
cache: false,
type: "POST",
success: function (result) {
// 錯誤訊息
if (!result.success) {
parent.hg.msg(result.msg);
}
else {
$("#wipBarcodeOther_StartNO").val(result.data.startNO);
$("#wipBarcodeOther_EndNO").val(result.data.endNO);
$("#barcodeOtherDiv").hide();
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("Found error when using Ajax!!");
}
});
});*@
// 產生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(), "wipNo": $('#wipInfo_WipNO').val(), "planQTY": $('#wipInfo_PlanQTY').val() },
cache: false,
type: "POST",
success: function (result, textStatus, jqXHR) {
if (result.success) {
var contactdiv = `<tr><td>${result.data.mix}</td><td>${result.data.max}</td></tr>`;
$('#MACTable').append(contactdiv);
if (result.msg.length != 0) {
// 產生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(), "wipNo": $('#wipInfo_WipNO').val(), "planQTY": $('#wipInfo_PlanQTY').val() },
cache: false,
type: "POST",
success: function (result, textStatus, jqXHR) {
if (result.success) {
var contactdiv = `<tr><td>${result.data.mix}</td><td>${result.data.max}</td></tr>`;
$('#MACTable').append(contactdiv);
if (result.msg.length != 0) {
parent.hg.msg(result.msg);
}
}
else {
parent.hg.msg(result.msg);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("Found error when using Ajax!!");
}
else {
parent.hg.msg(result.msg);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("Found error when using Ajax!!");
}
});
});
});
function PrefixInteger(num, length) {
return (Array(length).join('0') + num).slice(-length);

Loading…
Cancel
Save