diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 7dd7c4cd..d3621bee 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1092,6 +1092,34 @@ namespace AMESCoreStudio.Web.Controllers return Json(new { data = result.MaterialFlowRemark }); } + + /// + /// 目前已刷數量 + /// + /// 工單號碼 + /// 生產單位 + /// 作業站 + /// + [HttpPost] + public async Task getBarcodeStationByInputQty(string wipNo, string unitNo, int ststionID) + { + var q = await _pcsApi.GetWipInfoByWipNO(wipNo); + var q1 = q.Where(w => w.UnitNO == unitNo).FirstOrDefault(); + if (q1 != null) + { + + // 工單流程ID 取站別 + var ruleStations = await GetRuleStationByFlowRuleID(q1.FlowRuleID); + var rulestationID = ruleStations.Where(w => w.StationID == ststionID).FirstOrDefault().RuleStationID; + + // 工單已刷數量 + int InputQTY = await _pcsApi.GetBarcodeStationByInputQty(q1.WipID, rulestationID); + + //将数据Json化并传到前台视图 + return Json(new { data = InputQTY }); + } + return Json(new { data = 0 }); + } #endregion [ResponseCache(Duration = 0)] @@ -1587,11 +1615,15 @@ namespace AMESCoreStudio.Web.Controllers var q = await _pcsApi.GetWipInfo(id); if (q.Count != 0) { + // 判斷工單號碼是否已經投入 + if (await _pcsApi.GetWipInfoCheckStart(q.FirstOrDefault().WipNO) == "Y") + { + var _msg = "工單號碼【" + q.FirstOrDefault().WipNO + "】,工單已開始投入,不可修改!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + // 判斷工單號碼是否已經開線 - var resultLineInfo = await _basApi.GetLineInfoes(); - var resultWipNo = await _pcsApi.GetWipInfoByWipNO(q.FirstOrDefault().WipNO); - var WipIDs = resultWipNo.Select(s => s.WipID); - if (resultLineInfo.Where(w => WipIDs.Contains(w.WipNo)).Any()) + if (await _pcsApi.GetWipInfoCheckStartLine(q.FirstOrDefault().WipNO) == "Y") { var _msg = "工單號碼【" + q.FirstOrDefault().WipNO + "】,工單已開線,不可修改!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -2006,8 +2038,11 @@ namespace AMESCoreStudio.Web.Controllers /// public string CheckMACData(WipDataViewModel model) { - string StartNO = model.wipMAC.StartNO.ToString(); - string EndNO = model.wipMAC.EndNO.ToString(); + if (model.wipMAC == null) + return ""; + + string StartNO = model.wipMAC.StartNO ?? ""; + string EndNO = model.wipMAC.EndNO ?? ""; // 資料為空 if (string.IsNullOrWhiteSpace(StartNO) && string.IsNullOrWhiteSpace(EndNO)) return ""; @@ -2287,6 +2322,31 @@ namespace AMESCoreStudio.Web.Controllers } return Json(new Table() { count = 0, data = null }); } + + /// + /// PCS005 刪除 + /// + /// 工單號碼 + /// + public async Task PCS005DAsync(string id) + { + // 判斷工單號碼是否已經投入 + if (await _pcsApi.GetWipInfoCheckStart(id) == "Y") + { + var _msg = "工單號碼【" + id + "】,工單已開始投入,不可刪除!"; + return Json(new Result() { success = false, msg = _msg }); + } + + // 判斷工單號碼是否已經開線 + if (await _pcsApi.GetWipInfoCheckStartLine(id) == "Y") + { + var _msg = "工單號碼【" + id + "】,工單已開線,不可刪除!"; + return Json(new Result() { success = false, msg = _msg }); + } + + var result = await _pcsApi.DeleteWipinfo(id); + return Json(new Result() { success = true, msg = "刪除成功" }); + } #endregion #region PCS006 工單開線收線作業 @@ -3193,6 +3253,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS021_GetWip(PCS021ViewModel model) { await GetFactoryUnit(); + await GetItemsList(); //await GetLineInfo(); if (string.IsNullOrWhiteSpace(model.WipNO)) @@ -3230,6 +3291,7 @@ namespace AMESCoreStudio.Web.Controllers model.UnitNO = q.FirstOrDefault().UnitNO; model.FlowRuleID = q.FirstOrDefault().FlowRuleID; model.ItemNO = (await _pcsApi.GetWipAtt(model.WipNO)).ItemNO; + // 判斷工單狀態 var BarCodeWip = await _pcsApi.CheckBarCodeWip(model.WipNO, model.UnitNO, model.LineID, model.FlowRuleID); if (!BarCodeWip.Success) @@ -3249,6 +3311,9 @@ namespace AMESCoreStudio.Web.Controllers model.RuleStation = ruleStations.FirstOrDefault().RuleStationID; } + // 工單已刷數量 + model.InputQTY = await _pcsApi.GetBarcodeStationByInputQty(model.WipID, model.RuleStation); + // 工單KeyParts model.WipKps = await _pcsApi.GetWipKpByWipNo(model.WipNO); model.WipKps = model.WipKps.Where(w => w.UnitNo == model.UnitNO).OrderBy(o => o.KpSeq).ToList(); @@ -3447,8 +3512,6 @@ namespace AMESCoreStudio.Web.Controllers } - - #region 判斷下一站為完工站 var NextStopCloseStation = await _pcsApi.CheckNextStopCloseStation(model.WipNO, model.UnitNO, model.Station); #endregion diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index f324e375..b183c20f 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -114,11 +114,23 @@ namespace AMESCoreStudio.Web /// 查詢工單基本資料-WipNO /// /// - //[WebApiClient.Attributes.HttpGet("api/WipInfos/{id}")] - //ITask> GetWipInfoByUnitNO(string id); [WebApiClient.Attributes.HttpGet("api/WipInfos/WipInfoByWipNo/{wipno}")] ITask> GetWipInfoByWipNO(string wipno); + /// + /// 查詢工單是否已投入 + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipInfos/CheckStart/{wipno}")] + ITask GetWipInfoCheckStart(string wipno); + + /// + /// 查詢工單是否已開線 + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipInfos/CheckStartLine/{wipno}")] + ITask GetWipInfoCheckStartLine(string wipno); + /// /// 更新工單資料 /// @@ -126,6 +138,14 @@ namespace AMESCoreStudio.Web /// [WebApiClient.Attributes.HttpPut("api/WipInfos")] ITask> PutWipInfo([FromBody, RawJsonContent] string model); + + /// + /// 刪除工單相關資料 + /// + /// + /// + [WebApiClient.Attributes.HttpDelete("api/WipInfos/{id}")] + ITask> DeleteWipinfo(string id); #endregion #region WinAtt 工單基本資料-屬性 PCS001 @@ -285,6 +305,9 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/BarcodeStation/GetBarcodeStationByKey")] ITask GetBarcodeStationByKey(string id); + [WebApiClient.Attributes.HttpGet("api/BarcodeStation/InputQty/{wipID}/{ruleStationID}")] + ITask GetBarcodeStationByInputQty(int wipID, int ruleStationID); + [WebApiClient.Attributes.HttpPost("api/BarcodeStation")] ITask> PostBarcodeStation([FromBody, RawJsonContent] string model); diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs index 42d6ee84..c93572c9 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs @@ -30,6 +30,11 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// public int PlanQTY { get; set; } = 0; + /// + /// 已刷數 + /// + public int InputQTY { get; set; } = 0; + /// /// 線別 /// diff --git a/AMESCoreStudio.Web/Views/PCS/PCS005.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS005.cshtml index e562949f..a228ffb3 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS005.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS005.cshtml @@ -2,7 +2,14 @@ ViewData["Title"] = "工單資料查詢"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; } - +
@@ -51,15 +58,28 @@
-
+
@section Scripts{ } \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml index 5abe1750..55f3658f 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml @@ -57,7 +57,7 @@
-
+
  • 過站資料
  • @@ -113,7 +113,7 @@
    - +
    @@ -123,7 +123,7 @@
    - +
    @*@Html.ValidationMessage("error")*@ @@ -217,7 +217,7 @@ - + @@ -278,7 +278,7 @@
-
+
@@ -302,7 +302,6 @@ jQuery(function ($) { $('.element').responsiveEqualHeightGrid(); getUnitLineList($("#unit").val()); - //getRuleStationList($("#unit").val()); }); function getUnitLineList(data) @@ -330,30 +329,6 @@ }); }; - @*function getRuleStationList(data) - { - $.ajax( - { - url: "@Url.Action("GetRuleStationByTypeJson", "PCS")", - dataType: 'json', - data: { "unit_no": $("#unit").val()}, - type: 'post', - success: function (result) - { - $("#stations").empty();//清空下拉框的值 - $.each(result.data, function (index, item) { - $("#stations").append($("