diff --git a/AMESCoreStudio.Web/Controllers/BASController.cs b/AMESCoreStudio.Web/Controllers/BASController.cs index ab7de55b..7f3315a5 100644 --- a/AMESCoreStudio.Web/Controllers/BASController.cs +++ b/AMESCoreStudio.Web/Controllers/BASController.cs @@ -192,6 +192,48 @@ namespace AMESCoreStudio.Web.Controllers return Json(new { data = item }); } + [HttpPost] + public async Task GetUnitLineJson(string unit_no) + { + var result = await _basApi.GetLineInfoByUnit(unit_no); + + var item = new List(); + + for (int i = 0; i < result.Count; i++) + { + item.Add(new SelectListItem(result[i].LineDesc, result[i].LineID.ToString())); + } + + if (item.Count == 0) + { + item.Add(new SelectListItem("N/A", "")); + } + + //将数据Json化并传到前台视图 + return Json(new { data = item }); + } + + [HttpPost] + public async Task GetStationsJson(string unit_no) + { + var result = await _basApi.GetStationsByUnit(unit_no); + + var item = new List(); + + for (int i = 0; i < result.Count; i++) + { + item.Add(new SelectListItem(result[i].StationName, result[i].StationID.ToString())); + } + + if (item.Count == 0) + { + item.Add(new SelectListItem("N/A", "")); + } + + //将数据Json化并传到前台视图 + return Json(new { data = item }); + } + #endregion #region BAS001工廠资料维护相关 diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 317f74c3..845c6897 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -51,6 +51,12 @@ namespace AMESCoreStudio.Web.Controllers { ProductTypes.Add(new SelectListItem(result[i].ProductTypeNO + "-" + result[i].ProductTypeName, result[i].ProductTypeID.ToString())); } + + if (ProductTypes.Count == 0) + { + ProductTypes.Add(new SelectListItem("N/A", null)); + } + ViewBag.ProductTypesList = ProductTypes; } @@ -67,6 +73,12 @@ namespace AMESCoreStudio.Web.Controllers { LineInfo.Add(new SelectListItem(result[i].LineID + "-" + result[i].LineDesc, result[i].LineID.ToString())); } + + if (LineInfo.Count == 0) + { + LineInfo.Add(new SelectListItem("N/A", null)); + } + ViewBag.LineInfoList = LineInfo; } @@ -83,6 +95,12 @@ namespace AMESCoreStudio.Web.Controllers { FactoryInfo.Add(new SelectListItem(result[i].FactoryNo + "-" + result[i].FactoryNameCh, result[i].FactoryID.ToString())); } + + if (FactoryInfo.Count == 0) + { + FactoryInfo.Add(new SelectListItem("N/A", null)); + } + ViewBag.FactoryInfoList = FactoryInfo; } @@ -92,13 +110,19 @@ namespace AMESCoreStudio.Web.Controllers /// private async Task GetFactoryUnit() { - var result = await _pcsApi.GetFactoryUnit(); + var result = await _basApi.GetFactoryUnits(); var FactoryUnit = new List(); for (int i = 0; i < result.Count; i++) { FactoryUnit.Add(new SelectListItem(result[i].UnitName, result[i].UnitNo.ToString())); } + + if (FactoryUnit.Count == 0) + { + FactoryUnit.Add(new SelectListItem("N/A", null)); + } + ViewBag.FactoryUnitList = FactoryUnit; } @@ -115,6 +139,12 @@ namespace AMESCoreStudio.Web.Controllers { MFGType.Add(new SelectListItem(result[i].MFGTypeName, result[i].MFGTypeNO.ToString())); } + + if (MFGType.Count == 0) + { + MFGType.Add(new SelectListItem("N/A", null)); + } + ViewBag.MFGTypeList = MFGType; } @@ -131,6 +161,12 @@ namespace AMESCoreStudio.Web.Controllers { ProcessType.Add(new SelectListItem(result[i].ProcessTypeName, result[i].ProcessTypeNO.ToString())); } + + if (ProcessType.Count == 0) + { + ProcessType.Add(new SelectListItem("N/A", null)); + } + ViewBag.ProcessTypeList = ProcessType; } @@ -161,6 +197,12 @@ namespace AMESCoreStudio.Web.Controllers { Stations.Add(new SelectListItem(result[i].StationName, result[i].StationID.ToString())); } + + if (Stations.Count == 0) + { + Stations.Add(new SelectListItem("N/A", null)); + } + ViewBag.GetStationsList = Stations; } @@ -173,11 +215,16 @@ namespace AMESCoreStudio.Web.Controllers var result = await _basApi.GetFlowRules(); var FlowRuleItems = new List(); - FlowRuleItems.Add(new SelectListItem("N/A", "0")); for (int i = 0; i < result.Count; i++) { FlowRuleItems.Add(new SelectListItem(result[i].UnitNo + result[i].FlowRuleName, result[i].FlowRuleID.ToString())); } + + if (FlowRuleItems.Count == 0) + { + FlowRuleItems.Add(new SelectListItem("N/A", null)); + } + ViewBag.FlowRuleList = FlowRuleItems; } @@ -560,7 +607,7 @@ namespace AMESCoreStudio.Web.Controllers #region PCS001 工單資料維護 - public async Task PCS001() + public async Task PCS001(WipAllViewModel model = null) { await GetProductType(); await GetFactoryInfo(); @@ -584,12 +631,12 @@ namespace AMESCoreStudio.Web.Controllers //var result = new WipAllViewModel(); //return View(result); - return View(); + return View(model); } //頁面提交,id=0 添加,id>0 修改 [HttpPost] - public async Task PCS001SaveAsync(WipAllViewModel model) + public async Task PCS001Async(WipAllViewModel model) { IResultModel result; // Checkbox轉換 @@ -621,28 +668,23 @@ namespace AMESCoreStudio.Web.Controllers result = await _pcsApi.PostWipInfo(JsonConvert.SerializeObject(model.WipInfo)); } - //if (!result.Success) - //{ - // var _msg = model.WipInfo.WipID == 0 ? "添加成功!" : "修改成功!"; - // return RedirectToAction("Refresh", "Home", new { msg = _msg }); - //} - //else - //{ - // if (result.Errors.Count > 0) - // { - // ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); - // } - // else - // { - // ModelState.AddModelError("error", result.Msg); - // } - //} - //} - if (model.WipInfo.WipID == 0) + if (!result.Success) { - return View("PCS001", model); + var _msg = model.WipInfo.WipID == 0 ? "添加成功!" : "修改成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + if (result.Errors.Count > 0) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } } - return View("PCS001", model); + return View(); } public async Task PCS001R(string id) @@ -702,11 +744,11 @@ namespace AMESCoreStudio.Web.Controllers /// public async Task PCS004QueryAsync(string unitno, string wipno) { - var result = await _pcsApi.GetWipInfoSelectParameter(unitno, wipno); - - if (result.Count > 0) + IResultModel result = await _pcsApi.GetWipInfoSelectParameter(unitno, wipno); + var aa = Json(new Table() { code = 0, msg = "", data = result.Data, count = 0 }); + if (result.Data != null) { - return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); + return Json(new Table() { code = 0, msg = "", data = result.Data, count = 0 }); } return Json(new Table() { count = 0, data = null }); } @@ -802,17 +844,17 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS006QueryAsync() { // 工單基本資料 - var result_Info = await _pcsApi.GetWipInfoSelectParameter(); + IResultModel result = await _pcsApi.GetWipInfoSelectParameter(); // 工單狀態 var result_StatusType = await _ppsApi.GetWipStatus(); - List result = new List(); - foreach (var item in result_Info) + List result_dy = new List(); + foreach (var item in result.Data) { // 判斷是否開線資料 var result_LineInfo = await _pcsApi.GetLineInfoByWipID(item.WipID); // 用工單ID抓最新一筆Log紀錄 var result_Log = await _pcsApi.GetWipLog(item.WipID); - result.Add(new + result_dy.Add(new { item.WipID, item.WipNO, @@ -826,9 +868,9 @@ namespace AMESCoreStudio.Web.Controllers } - if (result.Count > 0) + if (result_dy.Count > 0) { - return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); + return Json(new Table() { code = 0, msg = "", data = result, count = result_dy.Count }); } return Json(new Table() { count = 0, data = null }); } @@ -935,6 +977,18 @@ namespace AMESCoreStudio.Web.Controllers } #endregion + + #region PCS021 條碼輸入作業 + [ResponseCache(Duration = 0)] + [HttpGet] + public async Task PCS021() + { + await GetFactoryUnit(); + await GetLineInfo(); + return View(); + } + #endregion + [HttpPost] public JsonResult TestFunc(string number) { diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 13f47464..a12b5710 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using WebApiClient; using WebApiClient.Attributes; using AMESCoreStudio.WebApi; @@ -63,7 +64,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpPost("api/WipInfos")] - ITask> PostWipInfo([FromBody, RawJsonContent] string model); + ITask> PostWipInfo([FromBody, RawJsonContent] string model); /// /// 查詢工單基本資料 @@ -79,7 +80,8 @@ namespace AMESCoreStudio.Web /// 工單號碼 /// [WebApiClient.Attributes.HttpGet("api/WipInfos/GetWipInfoSelectParameter")] - ITask> GetWipInfoSelectParameter(string unitno = null, string wipno = null); + ITask> GetWipInfoSelectParameter(string unitno = null, string wipno = null, int lineid = 0 + , string itemno = null, DateTime? date_str = null, DateTime? date_end = null); /// /// 查詢工單基本資料-WipID diff --git a/AMESCoreStudio.Web/ViewModels/WipAllViewModel.cs b/AMESCoreStudio.Web/ViewModels/WipAllViewModel.cs index 3b37a2bf..3bbc4237 100644 --- a/AMESCoreStudio.Web/ViewModels/WipAllViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/WipAllViewModel.cs @@ -14,5 +14,9 @@ namespace AMESCoreStudio.Web.ViewModels public WipBarcode WipBarcode { get; set; } + public LineInfo LineInfo { get; set; } + + public FactoryUnit FactoryUnit { get; set; } + } } diff --git a/AMESCoreStudio.Web/Views/Home/Framework.cshtml b/AMESCoreStudio.Web/Views/Home/Framework.cshtml index 2c1a7573..7ed11c55 100644 --- a/AMESCoreStudio.Web/Views/Home/Framework.cshtml +++ b/AMESCoreStudio.Web/Views/Home/Framework.cshtml @@ -208,6 +208,9 @@
  • 工單對應站別鎖定
  • +
  • + 條碼輸入作業 +
  • diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml index 4df07d3e..689521a0 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml @@ -16,7 +16,7 @@
    -
    +
    @@ -91,12 +91,18 @@
    - +
    +
    - + +
    + + +
    @@ -216,8 +222,9 @@
    - +
    +
    @@ -781,6 +788,56 @@ await Html.RenderPartialAsync("_FileinputScriptsPartial"); }