|
|
@ -591,6 +591,47 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
//TempData["GetLockReasonTypeList"] = LockReasonType;
|
|
|
|
ViewBag.GetLockReasonTypeList = LockReasonType; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 生產單位
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task GetFactoryUnitList() |
|
|
|
{ |
|
|
|
var result = await _basApi.GetFactoryUnits(); |
|
|
|
|
|
|
|
var UnitItems = new List<SelectListItem>(); |
|
|
|
UnitItems.Add(new SelectListItem("請選擇", "")); |
|
|
|
for (int i = 0; i < result.Count; i++) |
|
|
|
{ |
|
|
|
UnitItems.Add(new SelectListItem(result[i].UnitName, result[i].UnitNo.ToString())); |
|
|
|
} |
|
|
|
ViewBag.FactoryUnit = UnitItems; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 組件資料
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task GetItems() |
|
|
|
{ |
|
|
|
var result = await _pcsApi.GetItems(); |
|
|
|
|
|
|
|
var ItemsList = new List<SelectListItem>(); |
|
|
|
ItemsList.Add(new SelectListItem("請選擇", "")); |
|
|
|
for (int i = 0; i < result.Count; i++) |
|
|
|
{ |
|
|
|
ItemsList.Add(new SelectListItem(result[i].ItemName, result[i].ItemNo.ToString())); |
|
|
|
} |
|
|
|
ViewBag.ItemsList = ItemsList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
[ResponseCache(Duration = 0)] |
|
|
@ -837,8 +878,6 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region PCS005 工單資料查詢
|
|
|
|
public IActionResult PCS005() |
|
|
|
{ |
|
|
@ -1257,6 +1296,121 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
return View(model); |
|
|
|
} |
|
|
|
|
|
|
|
#region PCS024組件资料维护相关
|
|
|
|
|
|
|
|
public async Task<IActionResult> PCS024() |
|
|
|
{ |
|
|
|
await GetFactoryUnitList(); |
|
|
|
return View(); |
|
|
|
} |
|
|
|
//新增頁面
|
|
|
|
public async Task<IActionResult> PCS024C(string id) |
|
|
|
{ |
|
|
|
var result = await _pcsApi.GetBarcodeInfoesByNo(id); |
|
|
|
var tt = result[0]; |
|
|
|
ViewBag.BarcodeID = tt.BarcodeID; |
|
|
|
ViewBag.WipID = tt.WipID; |
|
|
|
ViewBag.BarcodeNo = id; |
|
|
|
await GetFactoryUnitList(); |
|
|
|
//await GetStations();
|
|
|
|
await GetItems(); |
|
|
|
return View(); |
|
|
|
} |
|
|
|
|
|
|
|
//修改页面
|
|
|
|
[HttpGet] |
|
|
|
public async Task<IActionResult> PCS024UAsync(int id) |
|
|
|
{ |
|
|
|
await GetItems(); |
|
|
|
|
|
|
|
var result = await _pcsApi.GetBarcodeItem(id); |
|
|
|
|
|
|
|
if (result.Count == 0) |
|
|
|
{ |
|
|
|
return View(); |
|
|
|
} |
|
|
|
return View(result[0]); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<IActionResult> PCS024DAsync(int id) |
|
|
|
{ |
|
|
|
var result = await _pcsApi.DeleteBarcodeItem(id); |
|
|
|
return Json(new Result() { success = true, msg = "" }); |
|
|
|
} |
|
|
|
|
|
|
|
//頁面提交,id=0 添加,id>0 修改
|
|
|
|
[HttpPost] |
|
|
|
public async Task<IActionResult> PCS024CSaveAsync(BarcodeItem model) |
|
|
|
{ |
|
|
|
if (ModelState.IsValid) |
|
|
|
{ |
|
|
|
IResultModel result; |
|
|
|
result = await _pcsApi.PostBarcodeItem(JsonConvert.SerializeObject(model)); |
|
|
|
|
|
|
|
|
|
|
|
if (!result.Success) |
|
|
|
{ |
|
|
|
var _msg = "新增成功!"; |
|
|
|
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("PCS024C", model); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
[ResponseCache(Duration = 0)] |
|
|
|
[HttpGet] |
|
|
|
public async Task<IActionResult> GetBarcodeItemsAsync() |
|
|
|
{ |
|
|
|
var result = await _pcsApi.GetBarcodeItems(); |
|
|
|
|
|
|
|
if (result.Count > 0) |
|
|
|
{ |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); |
|
|
|
} |
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
|
} |
|
|
|
|
|
|
|
[ResponseCache(Duration = 0)] |
|
|
|
[HttpGet] |
|
|
|
public async Task<IActionResult> GetBarcodeItemByUnitAsync(string ID) |
|
|
|
{ |
|
|
|
string str, str1; |
|
|
|
var strA = ID.Split("="); |
|
|
|
str = strA[0]; |
|
|
|
str1 = strA[1]; |
|
|
|
//WO0002A10001
|
|
|
|
|
|
|
|
if (ID is null) |
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
|
|
|
|
|
var result = await _pcsApi.GetBItemByStr(str, str1); |
|
|
|
//var result = await _pcsApi.GetBarcodeItemByUnit(ID);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost] |
|
|
|
public JsonResult TestFunc(string number) |
|
|
|
{ |
|
|
|