From 0cb81b1f10b03d3dd9641a8cca7a8a446f6eb408 Mon Sep 17 00:00:00 2001 From: "vick_wang419@hotmail.com.tw" Date: Fri, 26 Jan 2024 01:14:03 +0800 Subject: [PATCH] =?UTF-8?q?PTD=20=E5=82=99=E8=B2=A8=E4=BD=9C=E6=A5=AD=20SN?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E5=8D=A1=E6=8E=A7=20&=20=E6=95=B4=E6=89=B9?= =?UTF-8?q?=E5=88=AA=E9=99=A4=E3=80=81=E5=8C=AF=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Views/PTD/PTD002.cshtml | 12 ++- AMESCoreStudio.Web/Views/PTD/PTD006.cshtml | 91 +++++++++++++++++++--- 2 files changed, 89 insertions(+), 14 deletions(-) diff --git a/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml index fa3368ff..b82fdd10 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml @@ -344,6 +344,10 @@ var material = document.getElementById('PartNumber'); var table = layui.table; var rowAmount = table.cache['query'].length; + if (SNData.value.trim() == "") { + hg.msg('SN不得為空!'); + return; + } var arr = SNData.value.split('\n'); $.each(arr, function (index, SN) { @@ -376,10 +380,10 @@ var tableData = layui.table.cache['query']; - if (customer === "") { - hg.msg('Customer不得為空!'); - return; // Do not add the row - } + //if (customer === "") { + // hg.msg('Customer不得為空!'); + // return; // Do not add the row + //} if (material === "") { hg.msg('料號不得為空!'); return; // Do not add the row diff --git a/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml index cc792b47..e3ee0943 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml @@ -158,6 +158,9 @@
+
+ +
@@ -285,11 +288,33 @@ var endSN = document.getElementById('endSN'); var frontSN = document.getElementById('frontSN'); - endSN.focus(); - endSN.select(); + if (frontSN.value.trim() == "") { + hg.msg('SN不得為空!'); + return; + } if (document.getElementById('PCSUnit').checked) { - endSN.value = frontSN.value; + var recordType = document.getElementById('recordType'); + var dnNo = document.getElementById('recordNumber'); + var lineNo = document.getElementById('lineNo'); + var material = document.getElementById('PartNumber'); + + var newRowData = { + recordType: recordType.value, + dnNo: dnNo.value, + lineNo: lineNo.value, + material: material.value, + sn: frontSN.value + }; + // Add the new row data to the table + hg.table.addRow('query', newRowData); + + frontSN.focus(); + frontSN.select(); + } + else { + endSN.focus(); + endSN.select(); } } @@ -336,8 +361,12 @@ var material = document.getElementById('PartNumber'); var table = layui.table; var rowAmount = table.cache['query'].length; - + if (SNData.value.trim() == "") { + hg.msg('SN不得為空!'); + return; + } var arr = SNData.value.split('\n'); + console.log(arr); $.each(arr, function (index, SN) { rowAmount++; var newRowData = { @@ -355,6 +384,49 @@ event.preventDefault(); } }); + $('#delAll').on('click', function () { + hg.confirm("請確認是否整批刪除?", function () { + var tableData = layui.table.cache['query']; + + $.each(tableData, function (index, data) { + $.ajax({ + url: '/PTD/PTD006D', + data: { sn: data.sn }, + type: 'POST', + success: function (res) { + if (res.success) { + if (index == (tableData.length - 1)) { + // 重新加载表格数据 + layui.table.reload('query', { + data: tableData, + page: false, + limit: 2000 + }); + calculateRowCount(tableData); + hg.msg('刪除成功'); + } + } + else { + hg.msg(res.msg); + + // 重新加载表格数据 + layui.table.reload('query', { + data: tableData, + page: false, + limit: 2000 + }); + calculateRowCount(tableData); + + } + }, + error: function () { + hg.msg("網路請求失敗!"); + } + }); + }); + + }); + }); function getItemDesc(itemNo) { $.ajax({ @@ -401,10 +473,10 @@ var rbu = document.getElementById('RBU').value; var customer = document.getElementById('Customer').value; //卡控material & customer不得為空 - if (customer === "") { - hg.msg('Customer不得為空!'); - return; // Do not add the row - } + //if (customer === "") { + // hg.msg('Customer不得為空!'); + // return; // Do not add the row + //} if (rowData.material === "") { hg.msg('料號不得為空!'); return; // Do not add the row @@ -461,7 +533,6 @@ hg.confirm("SN:" + obj.data.sn + ",確定要刪除嗎?", function () { // 获取表格数据 var tableData = layui.table.cache['query']; - // 找到要删除的行的索引 var rowIndex = tableData.findIndex(function (row) { return row.sn === obj.data.sn; @@ -588,7 +659,7 @@ } ]]; //基本数据表格 - var table = hg.table.datatable('query', '備貨資訊', '/PTD/PTD006Query', {}, tableCols, "", true, 'full-100', ['filter', 'print', 'exports']); + var table = hg.table.datatable('query', '備貨資訊', '/PTD/PTD006Query', {}, tableCols, toolbar, true, 'full-100', ['exports']); }