|
|
@ -2777,7 +2777,6 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
public async Task<IActionResult> WHS024Query(string wipNo = null, string status = null, string dateStr = null, string dateEnd = null, int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
var result = await _whsApi.GetWorkStationLogByQuery(wipNo, status, dateStr, dateEnd, page, limit); |
|
|
|
|
|
|
|
if (result.Data.Count() != 0) |
|
|
|
{ |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); |
|
|
@ -2872,7 +2871,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
} |
|
|
|
|
|
|
|
// 確認日期格式正確
|
|
|
|
if (model.startTime.Value.Date > model.endTime.Value.Date) |
|
|
|
if (model.startTime.Value > model.endTime.Value) |
|
|
|
{ |
|
|
|
_msg += "結束時間早於開始時間,請在確認"; |
|
|
|
} |
|
|
@ -2891,37 +2890,39 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
// 無效工時、異常工時
|
|
|
|
else |
|
|
|
{ |
|
|
|
if (string.IsNullOrWhiteSpace(model.remarks) || string.IsNullOrWhiteSpace(model.exceptionCode)) |
|
|
|
_msg += "請填寫異常代碼跟備註"; |
|
|
|
if (string.IsNullOrWhiteSpace(model.remarks)) |
|
|
|
_msg += "請填寫備註"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(_msg)) |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", _msg); |
|
|
|
if (model.workStationid == 0) |
|
|
|
return View("WHS024C", model); |
|
|
|
else |
|
|
|
return View("WHS024U", model); |
|
|
|
} |
|
|
|
|
|
|
|
model.CreateUserID = GetLogInUserID(); |
|
|
|
model.UpdateUserID = GetLogInUserID(); |
|
|
|
if (model.workStationid == 0) |
|
|
|
{ |
|
|
|
result = await _whsApi.PostWorkStationLog(JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
model.CreateUserID = GetLogInUserID(); |
|
|
|
model.UpdateUserID = GetLogInUserID(); |
|
|
|
if (model.workStationid == 0) |
|
|
|
{ |
|
|
|
result = await _whsApi.PostWorkStationLog(JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
result = await _whsApi.PutWorkStationLog(JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
result = await _whsApi.PutWorkStationLog(JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
|
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
_msg = model.workStationid == 0 ? "新增成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", result.Msg); |
|
|
|
} |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
_msg = model.workStationid == 0 ? "新增成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", result.Msg); |
|
|
|
} |
|
|
|
|
|
|
|
var result_Wip = await _pcsApi.GetWipInfoByWipNO(model.wipNo); |
|
|
@ -2950,6 +2951,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
public void GetUserID() |
|
|
|