diff --git a/AMESCoreStudio.Web/Controllers/WHSController.cs b/AMESCoreStudio.Web/Controllers/WHSController.cs index f65c7162..0b2ea861 100644 --- a/AMESCoreStudio.Web/Controllers/WHSController.cs +++ b/AMESCoreStudio.Web/Controllers/WHSController.cs @@ -2777,7 +2777,6 @@ namespace AMESCoreStudio.Web.Controllers public async Task 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() diff --git a/AMESCoreStudio.Web/Views/WHS/WHS024C.cshtml b/AMESCoreStudio.Web/Views/WHS/WHS024C.cshtml index d8d65c1d..10cd7a2e 100644 --- a/AMESCoreStudio.Web/Views/WHS/WHS024C.cshtml +++ b/AMESCoreStudio.Web/Views/WHS/WHS024C.cshtml @@ -36,6 +36,19 @@ +
+
+ +
+ +
+ +
+ +
+
+
+
@@ -50,19 +63,6 @@
-
-
- -
- -
- -
- -
-
-
-
@@ -141,7 +141,7 @@ { url: "@Url.Action("WHS024CQuery", "WHS")", dataType: 'json', - data: { "wipNo": wipNo}, + data: { "wipNo": wipNo }, type: 'post', success: function (result) { console.log(result); diff --git a/AMESCoreStudio.Web/Views/WHS/WHS024U.cshtml b/AMESCoreStudio.Web/Views/WHS/WHS024U.cshtml index d4f2a98b..8f751005 100644 --- a/AMESCoreStudio.Web/Views/WHS/WHS024U.cshtml +++ b/AMESCoreStudio.Web/Views/WHS/WHS024U.cshtml @@ -35,6 +35,19 @@
+
+
+ +
+ +
+ +
+ +
+
+
+
@@ -50,19 +63,6 @@
-
-
- -
- -
- -
- -
-
-
-
diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheck2025Controller.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheck2025Controller.cs index 2e2272a6..06ef3589 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheck2025Controller.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheck2025Controller.cs @@ -641,9 +641,9 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES var CheckBarcodeStation = await _context.BarcodeStation.Where(w => w.BarcodeID == data.barcodeID && w.WipID == data.wipID) .ToListAsync(); - if (CheckBarcodeStation.Count() == 1) + if (CheckBarcodeStation.Count() == 0) { - // 有資料加1 後續判斷第一次過站 + // 沒有資料加1 後續判斷第一次過站 string updateSql = $@" UPDATE JHAMES.WIP_INFO SET COMPLETE_QTY = COMPLETE_QTY + 1 WHERE WIP_ID = {data.wipID}"; // 執行原生 SQL