diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs
index d17b0b2f..ba0eaf64 100644
--- a/AMESCoreStudio.Web/Controllers/PCSController.cs
+++ b/AMESCoreStudio.Web/Controllers/PCSController.cs
@@ -39,6 +39,7 @@ namespace AMESCoreStudio.Web.Controllers
///
private async Task GetProductType()
{
+
var result = await _pcsApi.GetProductTypes();
var ProductTypes = new List();
@@ -159,6 +160,23 @@ namespace AMESCoreStudio.Web.Controllers
ViewBag.GetStationsList = Stations;
}
+ ///
+ /// 流程ID選單
+ ///
+ ///
+ private async Task GetFlowRuleList()
+ {
+ 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()));
+ }
+ ViewBag.FlowRuleList = FlowRuleItems;
+ }
+
///
/// 工單狀態
///
@@ -185,6 +203,8 @@ namespace AMESCoreStudio.Web.Controllers
ViewBag.GetWipTypeList = WipType;
}
+
+
///
/// 客戶類別
///
@@ -278,7 +298,6 @@ namespace AMESCoreStudio.Web.Controllers
ViewBag.GetDIPTypeList = DIPType;
}
-
///
/// 燒錄
///
@@ -545,6 +564,7 @@ namespace AMESCoreStudio.Web.Controllers
await GetLineInfo();
await GetMFGType();
await GetProcessTypes();
+ await GetFlowRuleList();
GetSMDType();
GetDIPType();
GetWipSEQType();
@@ -624,6 +644,7 @@ namespace AMESCoreStudio.Web.Controllers
await GetLineInfo();
await GetMFGType();
await GetProcessTypes();
+ await GetFlowRuleList();
GetSMDType();
GetDIPType();
GetWipSEQType();
@@ -644,7 +665,7 @@ namespace AMESCoreStudio.Web.Controllers
model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO);
model.WipBarcode = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO);
model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID);
- model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
+ model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
}
if (model.WipInfo != null)
{
@@ -656,27 +677,91 @@ namespace AMESCoreStudio.Web.Controllers
#endregion
#region PCS004 工單條碼區間設定
+ [ResponseCache(Duration = 0)]
+ [HttpGet]
public async Task PCS004()
{
await GetFactoryUnit();
return View();
}
- [ResponseCache(Duration = 0)]
- [HttpGet]
- public async Task GetPCS004Async(string roleID)
+
+
+ public async Task PCS004SAsync(string unitno ,string wipno)
{
- var result = await _pcsApi.GetWipInfoByUnitNO(roleID);
+ var result = await _pcsApi.GetWipInfoSelectParameter(unitno,wipno);
if (result.Count > 0)
{
return Json(new Table() { code = 0, msg = "", data = result, count = result.Count });
}
+ return Json(new Table() { count = 0, data = null });
+ }
+
+ //頁面提交,id=0 添加,id>0 修改
+ [HttpPost]
+ public async Task PCS004SaveAsync(PCS004CViewModel model)
+ {
+ IResultModel result;
+ model.WipBarcode.WipNO = model.WipInfo.WipNO;
+ model.WipBarcode.WipID = model.WipInfo.WipID;
+ model.WipBarcode.UnitNO = model.WipInfo.UnitNO;
+
+ result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.WipBarcode));
+
+ if (!result.Success)
+ {
+ var _msg = "新增成功!";
+ return RedirectToAction("PCS004C", "PCS", new { id = model.WipInfo.WipID , 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 RedirectToAction("PCS004C", "PCS", new { id = model.WipInfo.WipID });
+ }
+
+ [ResponseCache(Duration = 0)]
+ [HttpPost]
+ public async Task GetPCS004Async(string WipNO, int WipID, string UnitNO, string StartNO, string End)
+ {
+ var result = await _pcsApi.GetWipInfoByUnitNO(WipNO);
+
+ //if (result.Count > 0)
+ //{
+ // return Json(new Table() { code = 0, msg = "", data = result, count = result.Count });
+ //}
return Json(new Table() { count = 0, data = null });
}
#endregion
+ public async Task PCS004C(string id , string msg = null)
+ {
+ ViewBag.Msg = msg;
+ await GetLineInfo();
+ await GetFlowRuleList();
+ PCS004CViewModel model = new PCS004CViewModel();
+ var q = await _pcsApi.GetWipInfo(decimal.Parse(id));
+ if (q.Count != 0)
+ {
+ model.WipInfo = q.FirstOrDefault();
+ model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO);
+ model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO);
+ model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID);
+ model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
+ }
+ return View(model);
+ }
+
#region PCS005 工單資料查詢
public IActionResult PCS005()
{
diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
index 075c94b3..a3e6a9e9 100644
--- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
+++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
@@ -71,6 +71,15 @@ namespace AMESCoreStudio.Web
[WebApiClient.Attributes.HttpGet("api/WipInfos")]
ITask> GetWipInfo();
+ ///
+ /// 查詢工單基本資料
+ ///
+ /// 生產單位
+ /// 工單號碼
+ ///
+ [WebApiClient.Attributes.HttpGet("api/WipInfos/GetWipInfoSelectParameter")]
+ ITask> GetWipInfoSelectParameter(string unitno = null, string wipno = null);
+
///
/// 查詢工單基本資料-WipID
///
diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs
new file mode 100644
index 00000000..5532edef
--- /dev/null
+++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using AMESCoreStudio.WebApi.Models.AMES;
+using AMESCoreStudio.WebApi.Models.BAS;
+
+namespace AMESCoreStudio.Web.ViewModels.PCS
+{
+ public class PCS004CViewModel
+ {
+ public WipInfo WipInfo { get; set; }
+
+ public WipAtt WipAtt { get; set; }
+
+ public WipBarcode WipBarcode { get; set; }
+
+ public IEnumerable WipBarcodes { get; set; }
+
+ public IEnumerable RuleStation { get; set; }
+
+ }
+}
diff --git a/AMESCoreStudio.Web/Views/Home/Framework.cshtml b/AMESCoreStudio.Web/Views/Home/Framework.cshtml
index ea4e2a09..c4059de7 100644
--- a/AMESCoreStudio.Web/Views/Home/Framework.cshtml
+++ b/AMESCoreStudio.Web/Views/Home/Framework.cshtml
@@ -187,9 +187,6 @@
製程控管模組