Browse Source

PTD 備貨作業 SN空白卡控 & 整批刪除、匯出功能

PTD
vick_wang419@hotmail.com.tw 1 year ago
parent
commit
0cb81b1f10
  1. 12
      AMESCoreStudio.Web/Views/PTD/PTD002.cshtml
  2. 91
      AMESCoreStudio.Web/Views/PTD/PTD006.cshtml

12
AMESCoreStudio.Web/Views/PTD/PTD002.cshtml

@ -344,6 +344,10 @@
var material = document.getElementById('PartNumber'); var material = document.getElementById('PartNumber');
var table = layui.table; var table = layui.table;
var rowAmount = table.cache['query'].length; var rowAmount = table.cache['query'].length;
if (SNData.value.trim() == "") {
hg.msg('SN不得為空!');
return;
}
var arr = SNData.value.split('\n'); var arr = SNData.value.split('\n');
$.each(arr, function (index, SN) { $.each(arr, function (index, SN) {
@ -376,10 +380,10 @@
var tableData = layui.table.cache['query']; var tableData = layui.table.cache['query'];
if (customer === "") { //if (customer === "") {
hg.msg('Customer不得為空!'); // hg.msg('Customer不得為空!');
return; // Do not add the row // return; // Do not add the row
} //}
if (material === "") { if (material === "") {
hg.msg('料號不得為空!'); hg.msg('料號不得為空!');
return; // Do not add the row return; // Do not add the row

91
AMESCoreStudio.Web/Views/PTD/PTD006.cshtml

@ -158,6 +158,9 @@
</div> </div>
<div class="layui-inline" style="flex: 1; width: 100%; text-align: right;"> <div class="layui-inline" style="flex: 1; width: 100%; text-align: right;">
<label id="rowCount" class="layui-inline layui-form-label" style="width: 50%; color: red; text-align: left;">應出貨數量: 0 pcs,目前刷入數量: 0 pcs</label> <label id="rowCount" class="layui-inline layui-form-label" style="width: 50%; color: red; text-align: left;">應出貨數量: 0 pcs,目前刷入數量: 0 pcs</label>
<div class="layui-input-inline" style="width:100px">
<input type="submit" id="delAll" value="整批刪除" class="layui-btn" />
</div>
</div> </div>
<table class="layui-hide" id="query" lay-filter="query"></table> <table class="layui-hide" id="query" lay-filter="query"></table>
</div> </div>
@ -285,11 +288,33 @@
var endSN = document.getElementById('endSN'); var endSN = document.getElementById('endSN');
var frontSN = document.getElementById('frontSN'); var frontSN = document.getElementById('frontSN');
endSN.focus(); if (frontSN.value.trim() == "") {
endSN.select(); hg.msg('SN不得為空!');
return;
}
if (document.getElementById('PCSUnit').checked) { 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 material = document.getElementById('PartNumber');
var table = layui.table; var table = layui.table;
var rowAmount = table.cache['query'].length; var rowAmount = table.cache['query'].length;
if (SNData.value.trim() == "") {
hg.msg('SN不得為空!');
return;
}
var arr = SNData.value.split('\n'); var arr = SNData.value.split('\n');
console.log(arr);
$.each(arr, function (index, SN) { $.each(arr, function (index, SN) {
rowAmount++; rowAmount++;
var newRowData = { var newRowData = {
@ -355,6 +384,49 @@
event.preventDefault(); 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) { function getItemDesc(itemNo) {
$.ajax({ $.ajax({
@ -401,10 +473,10 @@
var rbu = document.getElementById('RBU').value; var rbu = document.getElementById('RBU').value;
var customer = document.getElementById('Customer').value; var customer = document.getElementById('Customer').value;
//卡控material & customer不得為空 //卡控material & customer不得為空
if (customer === "") { //if (customer === "") {
hg.msg('Customer不得為空!'); // hg.msg('Customer不得為空!');
return; // Do not add the row // return; // Do not add the row
} //}
if (rowData.material === "") { if (rowData.material === "") {
hg.msg('料號不得為空!'); hg.msg('料號不得為空!');
return; // Do not add the row return; // Do not add the row
@ -461,7 +533,6 @@
hg.confirm("SN:" + obj.data.sn + ",確定要刪除嗎?", function () { hg.confirm("SN:" + obj.data.sn + ",確定要刪除嗎?", function () {
// 获取表格数据 // 获取表格数据
var tableData = layui.table.cache['query']; var tableData = layui.table.cache['query'];
// 找到要删除的行的索引 // 找到要删除的行的索引
var rowIndex = tableData.findIndex(function (row) { var rowIndex = tableData.findIndex(function (row) {
return row.sn === obj.data.sn; 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']);
</script> </script>
} }

Loading…
Cancel
Save