From 478675e83689f8a72aa0c3c2e3b6866ee915fd17 Mon Sep 17 00:00:00 2001 From: Yiru Date: Sun, 4 Feb 2024 21:07:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3LAB002?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LABController.cs | 17 ++- AMESCoreStudio.Web/Views/LAB/LAB001.cshtml | 2 +- AMESCoreStudio.Web/Views/LAB/LAB002.cshtml | 4 +- AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml | 122 ++++++++++-------- AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml | 95 +++++++++++--- AMESCoreStudio.Web/Views/LAB/LAB002V.cshtml | 2 +- .../AMES/LabelTemplateMasterController.cs | 2 +- .../Models/AMES/LabelTemplateMaster.cs | 1 + 8 files changed, 163 insertions(+), 82 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/LABController.cs b/AMESCoreStudio.Web/Controllers/LABController.cs index 14c71279..4e36e627 100644 --- a/AMESCoreStudio.Web/Controllers/LABController.cs +++ b/AMESCoreStudio.Web/Controllers/LABController.cs @@ -218,13 +218,17 @@ namespace AMESCoreStudio.Web.Controllers if (PlmMeterial.Count > 0) { - return Json(new Table() { code = 0, msg = "", data = PlmMeterial, count = 1 }); + var Master = await _labApi.LabelTemplatebyMatnr(LabelMatnr,0,10); + if (Master.DataTotal > 0) + return Json(new Table() { count = 0, msg = "料號已存在", data = null }); + else + return Json(new Table() { code = 0, msg = "", data = PlmMeterial, count = 1 }); } else return Json(new Table() { count = 0, msg = "料號不存在", data = null }); } else - return Json(new Table() { count = 0, msg = "料號不存在", data = null }); + return Json(new Table() { count = 0, msg = "請輸入Label料號", data = null }); } @@ -263,13 +267,8 @@ namespace AMESCoreStudio.Web.Controllers } } - return Json(new Result() { success = false, msg = "資料有誤!!" }); - //else - //{ - - // ModelState.AddModelError("error", "缺少必填資料"); - // return View("LAB002C", model); - //} + return Json(new Result() { success = false, msg = "缺少必填資料!!" }); + } public async Task DeleteLabelTemplateDetailAsync(int id) diff --git a/AMESCoreStudio.Web/Views/LAB/LAB001.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB001.cshtml index 2ad9a170..fdc216f9 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB001.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB001.cshtml @@ -49,7 +49,7 @@ title: '操作', fixed: 'right', templet: function (d) { - return '修改' + return '修改 ' } }] ]; diff --git a/AMESCoreStudio.Web/Views/LAB/LAB002.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB002.cshtml index de4b1ad0..b4c20560 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB002.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB002.cshtml @@ -93,10 +93,10 @@ title: '備註說明' }, { - field: 'updatE_Date', + field: 'updatE_DATE', title: '更新時間', width: 160, - templet: '
{{ layui.util.toDateString(d.updateDate, "yyyy/MM/dd HH:mm:ss") }}
' + templet: '
{{ layui.util.toDateString(d.updatE_DATE, "yyyy/MM/dd HH:mm:ss") }}
' }, { field: 'imagE_NAME', diff --git a/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml index 3e2d2455..fa6f534a 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml @@ -55,10 +55,10 @@
+
-
@@ -76,45 +76,40 @@
+
- @*
- - -
*@ - @*
- - -
*@ -
- -
- - +
+ +
+ + +
+
+
+
+
+
+
-
-
-
- @Html.ValidationMessage("error") - -
+
+ +
+
+
+ @Html.ValidationMessage("error") +
+
+
@@ -147,34 +142,40 @@ }; function CheckMatnr(Matnr) { + var data = $("#LABEL_MATNR").val(); + if (data) { + $.ajax({ + url: '/LAB/CheckLabelMatnr?LabelMatnr=' + Matnr, + dataType: 'json', + contentType: "application/json", + type: 'get', + success: function (result) { + if (!result.data) { + // alert("查無此Label料號:" + Matnr); + alert(Matnr +result.msg); + } + else { + insertMaster2("T"); + } - $.ajax({ - url: '/LAB/CheckLabelMatnr?LabelMatnr=' + Matnr, - dataType: 'json', - contentType: "application/json", - type: 'get', - success: function (result) { - if (!result.data) { - alert("查無此Label料號:" + Matnr); - } - else { - - insertMaster2("T"); } + }); + } + else { - - } - }); + alert("請輸入Label料號!" ); + } }; function insertMaster2(status) { - var data = $("#LABEL_MATNR").val(); - if (data) { - var labelFile = $("#LABEL_FILE").val(); + + var labelFile = $("#LABEL_FILE").val(); + if (labelFile) { + var data = $("#LABEL_MATNR").val(); var remark = $("#REMARK").val(); var imageName = $("#IMAGE_NAME").val(); - var statusNo = $("#STATUS_NO").val(); + var statusNo = $("input[name='STATUS_NO']:checked").val(); var templateID = $("#TEMPLATE_ID").val(); var CreateUserID = $("#CREATE_USERID").val(); var UpdateUserID = $("#UPDATE_USERID").val(); @@ -198,15 +199,25 @@ console.log("master:data.success"); insertList(data.msg); } + else { + var errorMSG = document.getElementById('errorMSG'); + errorMSG.innerHTML = data.msg; + + } }).success(function () { //alert("second success"); }) - .error(function () { //alert("error"); + .error(function () { + alert("error"); }) .complete(function () { //alert("complete"); }); } + else { + + alert("請選擇標籤檔案!"); + } } function insertList(id) { @@ -221,11 +232,11 @@ var UpdateUserID = $("#UPDATE_USERID").val(); var CreateDate = $("#CREATE_DATE").val(); var UpdateDate = $("#UPDATE_DATE").val(); - + var Finish = 'N'; for (var i = 0; i < modeltable.length - 1; i++) { if (modeltable[i].value == 0) { - + Finish = 'Y'; Template = id; LabelFileID = modeltable[i - 1].value; $.post("/LAB/LAB002CListSave", @@ -245,10 +256,15 @@ var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index); } - }); + } + ); } } + if (Finish == 'N') { + alert("至少需勾選一項欄位名稱!"); + + } } } @@ -283,7 +299,7 @@ // 检查文件后缀名是否在允许的列表中 if (!allowedExtensions.includes(fileExtension.toLowerCase())) { - errorContainer.innerHTML = '只允许上传 ' + allowedExtensions.join(', ') + ' 格式的文件。'; + errorContainer.innerHTML = '只允許上傳 ' + allowedExtensions.join(', ') + ' 格式的文件。'; // 清空文件选择框的值 fileInput.value = ''; } else { @@ -307,7 +323,7 @@ // 检查文件后缀名是否在允许的列表中 if (!allowedExtensions.includes(fileExtension.toLowerCase())) { - errorContainer.innerHTML = '只允许上传 ' + allowedExtensions.join(', ') + ' 格式的文件。'; + errorContainer.innerHTML = '只允許上傳 ' + allowedExtensions.join(', ') + ' 格式的文件。'; // 清空文件选择框的值 fileInput.value = ''; } else { diff --git a/AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml index 22460621..c50dffc9 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml @@ -52,6 +52,13 @@
+
+
+ + +
+
+
@@ -66,20 +73,29 @@
+
+
+ + +
+
+ +
- +
- -
- - 上架中 -
- -
- - 未上架 + + +
+
+
+
+
+
+
+
@@ -133,7 +149,7 @@ var labelFile = $("#LABEL_FILE").val(); var remark = $("#REMARK").val(); var imageName = $("#IMAGE_NAME").val(); - var statusNo = $("#STATUS_NO").val(); + var statusNo = $("input[name='STATUS_NO']:checked").val(); var templateID = $("#TEMPLATE_ID").val(); var CreateUserID = $("#CREATE_USERID").val(); var UpdateUserID = $("#UPDATE_USERID").val(); @@ -156,7 +172,6 @@ function (data) { if (data.success) { console.log("master:data.success"); - // insertList(templateID); DeleteList(templateID); } }).success(function () { //alert("second success"); @@ -205,10 +220,10 @@ var UpdateUserID = $("#UpdateUserID").val(); var CreateDate = $("#CreateDate").val(); var UpdateDate = $("#UpdateDate").val(); - + var Finish = 'N'; for (var i = 0; i < modeltable.length - 1; i++) { if (modeltable[i].value == 0 || modeltable[i].value == 1) { - + Finish = 'Y'; Template = id; LabelFileID = modeltable[i - 1].value; $.post("/LAB/LAB002UListSave", @@ -222,7 +237,7 @@ }, function (data) { if (i = modeltable.length - 2) { - parent.hg.msg("新增成功!"); + parent.hg.msg("修改成功!"); window.parent.location.reload(); //parent.layer.table.render(); var index = parent.layer.getFrameIndex(window.name); @@ -232,9 +247,59 @@ } } + if (Finish == 'N') { + alert("至少需勾選一項欄位名稱!"); + + } + } + } + function validateFileExtensionbtw() { + var fileInput = document.getElementById('fileInput'); + var errorContainer = document.getElementById('errorContainer1'); + + // 允许的文件后缀名 + var allowedExtensions = ['.btw']; + + // 获取文件名 + var fileName = fileInput.value.split('\\').pop(); + + // 获取文件后缀名 + var fileExtension = '.' + fileName.split('.').pop(); + + // 检查文件后缀名是否在允许的列表中 + if (!allowedExtensions.includes(fileExtension.toLowerCase())) { + errorContainer.innerHTML = '只允許上傳 ' + allowedExtensions.join(', ') + ' 格式的文件。'; + // 清空文件选择框的值 + fileInput.value = ''; + } else { + $("#LABEL_FILE").val(fileName); + errorContainer.innerHTML = ''; } } + function validateFileExtensionPIC() { + var fileInput = document.getElementById('fileInputimage'); + var errorContainer = document.getElementById('errorContainer'); + + // 允许的文件后缀名 + var allowedExtensions = ['.jpg', '.jpeg', '.png', '.bmp']; + + // 获取文件名 + var fileName = fileInput.value.split('\\').pop(); + + // 获取文件后缀名 + var fileExtension = '.' + fileName.split('.').pop(); + + // 检查文件后缀名是否在允许的列表中 + if (!allowedExtensions.includes(fileExtension.toLowerCase())) { + errorContainer.innerHTML = '只允許上傳 ' + allowedExtensions.join(', ') + ' 格式的文件。'; + // 清空文件选择框的值 + fileInput.value = ''; + } else { + $("#IMAGE_NAME").val(fileName); + errorContainer.innerHTML = ''; + } + } layui.use(['form', 'layer', 'table', 'laytpl', 'laydate'], function () { var layer = layui.layer, diff --git a/AMESCoreStudio.Web/Views/LAB/LAB002V.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB002V.cshtml index 348b1d6b..144b3134 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB002V.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB002V.cshtml @@ -2,7 +2,7 @@ @{ - ViewData["Title"] = "Label料號參數修改"; + ViewData["Title"] = "Label料號參數檢視"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; }