|
@ -51,6 +51,12 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
{ |
|
|
{ |
|
|
ProductTypes.Add(new SelectListItem(result[i].ProductTypeNO + "-" + result[i].ProductTypeName, result[i].ProductTypeID.ToString())); |
|
|
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; |
|
|
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())); |
|
|
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; |
|
|
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())); |
|
|
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; |
|
|
ViewBag.FactoryInfoList = FactoryInfo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -92,13 +110,19 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
private async Task GetFactoryUnit() |
|
|
private async Task GetFactoryUnit() |
|
|
{ |
|
|
{ |
|
|
var result = await _pcsApi.GetFactoryUnit(); |
|
|
var result = await _basApi.GetFactoryUnits(); |
|
|
|
|
|
|
|
|
var FactoryUnit = new List<SelectListItem>(); |
|
|
var FactoryUnit = new List<SelectListItem>(); |
|
|
for (int i = 0; i < result.Count; i++) |
|
|
for (int i = 0; i < result.Count; i++) |
|
|
{ |
|
|
{ |
|
|
FactoryUnit.Add(new SelectListItem(result[i].UnitName, result[i].UnitNo.ToString())); |
|
|
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; |
|
|
ViewBag.FactoryUnitList = FactoryUnit; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -115,6 +139,12 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
{ |
|
|
{ |
|
|
MFGType.Add(new SelectListItem(result[i].MFGTypeName, result[i].MFGTypeNO.ToString())); |
|
|
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; |
|
|
ViewBag.MFGTypeList = MFGType; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -131,6 +161,12 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
{ |
|
|
{ |
|
|
ProcessType.Add(new SelectListItem(result[i].ProcessTypeName, result[i].ProcessTypeNO.ToString())); |
|
|
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; |
|
|
ViewBag.ProcessTypeList = ProcessType; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -161,6 +197,12 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
{ |
|
|
{ |
|
|
Stations.Add(new SelectListItem(result[i].StationName, result[i].StationID.ToString())); |
|
|
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; |
|
|
ViewBag.GetStationsList = Stations; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -173,11 +215,16 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
var result = await _basApi.GetFlowRules(); |
|
|
var result = await _basApi.GetFlowRules(); |
|
|
|
|
|
|
|
|
var FlowRuleItems = new List<SelectListItem>(); |
|
|
var FlowRuleItems = new List<SelectListItem>(); |
|
|
FlowRuleItems.Add(new SelectListItem("N/A", "0")); |
|
|
|
|
|
for (int i = 0; i < result.Count; i++) |
|
|
for (int i = 0; i < result.Count; i++) |
|
|
{ |
|
|
{ |
|
|
FlowRuleItems.Add(new SelectListItem(result[i].UnitNo + result[i].FlowRuleName, result[i].FlowRuleID.ToString())); |
|
|
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; |
|
|
ViewBag.FlowRuleList = FlowRuleItems; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -560,7 +607,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region PCS001 工單資料維護
|
|
|
#region PCS001 工單資料維護
|
|
|
public async Task<IActionResult> PCS001() |
|
|
public async Task<IActionResult> PCS001(WipAllViewModel model = null) |
|
|
{ |
|
|
{ |
|
|
await GetProductType(); |
|
|
await GetProductType(); |
|
|
await GetFactoryInfo(); |
|
|
await GetFactoryInfo(); |
|
@ -584,12 +631,12 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
|
|
|
|
|
//var result = new WipAllViewModel();
|
|
|
//var result = new WipAllViewModel();
|
|
|
//return View(result);
|
|
|
//return View(result);
|
|
|
return View(); |
|
|
return View(model); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//頁面提交,id=0 添加,id>0 修改
|
|
|
//頁面提交,id=0 添加,id>0 修改
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<IActionResult> PCS001SaveAsync(WipAllViewModel model) |
|
|
public async Task<IActionResult> PCS001Async(WipAllViewModel model) |
|
|
{ |
|
|
{ |
|
|
IResultModel result; |
|
|
IResultModel result; |
|
|
// Checkbox轉換
|
|
|
// Checkbox轉換
|
|
@ -621,28 +668,23 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
result = await _pcsApi.PostWipInfo(JsonConvert.SerializeObject(model.WipInfo)); |
|
|
result = await _pcsApi.PostWipInfo(JsonConvert.SerializeObject(model.WipInfo)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//if (!result.Success)
|
|
|
if (!result.Success) |
|
|
//{
|
|
|
{ |
|
|
// var _msg = model.WipInfo.WipID == 0 ? "添加成功!" : "修改成功!";
|
|
|
var _msg = model.WipInfo.WipID == 0 ? "添加成功!" : "修改成功!"; |
|
|
// return RedirectToAction("Refresh", "Home", new { msg = _msg });
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
//}
|
|
|
} |
|
|
//else
|
|
|
else |
|
|
//{
|
|
|
{ |
|
|
// if (result.Errors.Count > 0)
|
|
|
if (result.Errors.Count > 0) |
|
|
// {
|
|
|
{ |
|
|
// ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg);
|
|
|
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); |
|
|
// }
|
|
|
} |
|
|
// else
|
|
|
else |
|
|
// {
|
|
|
|
|
|
// ModelState.AddModelError("error", result.Msg);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//}
|
|
|
|
|
|
if (model.WipInfo.WipID == 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
return View("PCS001", model); |
|
|
ModelState.AddModelError("error", result.Msg); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return View("PCS001", model); |
|
|
return View(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<IActionResult> PCS001R(string id) |
|
|
public async Task<IActionResult> PCS001R(string id) |
|
@ -702,11 +744,11 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
public async Task<IActionResult> PCS004QueryAsync(string unitno, string wipno) |
|
|
public async Task<IActionResult> PCS004QueryAsync(string unitno, string wipno) |
|
|
{ |
|
|
{ |
|
|
var result = await _pcsApi.GetWipInfoSelectParameter(unitno, wipno); |
|
|
IResultModel<dynamic> result = await _pcsApi.GetWipInfoSelectParameter(unitno, wipno); |
|
|
|
|
|
var aa = Json(new Table() { code = 0, msg = "", data = result.Data, count = 0 }); |
|
|
if (result.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 }); |
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
} |
|
|
} |
|
@ -802,17 +844,17 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
public async Task<IActionResult> PCS006QueryAsync() |
|
|
public async Task<IActionResult> PCS006QueryAsync() |
|
|
{ |
|
|
{ |
|
|
// 工單基本資料
|
|
|
// 工單基本資料
|
|
|
var result_Info = await _pcsApi.GetWipInfoSelectParameter(); |
|
|
IResultModel<dynamic> result = await _pcsApi.GetWipInfoSelectParameter(); |
|
|
// 工單狀態
|
|
|
// 工單狀態
|
|
|
var result_StatusType = await _ppsApi.GetWipStatus(); |
|
|
var result_StatusType = await _ppsApi.GetWipStatus(); |
|
|
List<dynamic> result = new List<dynamic>(); |
|
|
List<dynamic> result_dy = new List<dynamic>(); |
|
|
foreach (var item in result_Info) |
|
|
foreach (var item in result.Data) |
|
|
{ |
|
|
{ |
|
|
// 判斷是否開線資料
|
|
|
// 判斷是否開線資料
|
|
|
var result_LineInfo = await _pcsApi.GetLineInfoByWipID(item.WipID); |
|
|
var result_LineInfo = await _pcsApi.GetLineInfoByWipID(item.WipID); |
|
|
// 用工單ID抓最新一筆Log紀錄
|
|
|
// 用工單ID抓最新一筆Log紀錄
|
|
|
var result_Log = await _pcsApi.GetWipLog(item.WipID); |
|
|
var result_Log = await _pcsApi.GetWipLog(item.WipID); |
|
|
result.Add(new |
|
|
result_dy.Add(new |
|
|
{ |
|
|
{ |
|
|
item.WipID, |
|
|
item.WipID, |
|
|
item.WipNO, |
|
|
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 }); |
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
} |
|
|
} |
|
@ -935,6 +977,18 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region PCS021 條碼輸入作業
|
|
|
|
|
|
[ResponseCache(Duration = 0)] |
|
|
|
|
|
[HttpGet] |
|
|
|
|
|
public async Task<IActionResult> PCS021() |
|
|
|
|
|
{ |
|
|
|
|
|
await GetFactoryUnit(); |
|
|
|
|
|
await GetLineInfo(); |
|
|
|
|
|
return View(); |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public JsonResult TestFunc(string number) |
|
|
public JsonResult TestFunc(string number) |
|
|
{ |
|
|
{ |
|
|