From 6b218973dcf03a3601373ebe13fddd7a8896d68f Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期二, 25 二月 2025 12:51:01 +0800
Subject: [PATCH] 聚乳酸-出库作业,可以多牌号一起出,冻结状态从后台查
---
src/main/webapp/static/js/order/order.js | 227 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 216 insertions(+), 11 deletions(-)
diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js
index a80ce12..3b085f1 100644
--- a/src/main/webapp/static/js/order/order.js
+++ b/src/main/webapp/static/js/order/order.js
@@ -1,4 +1,8 @@
var insTbCount = 0;
+var printMatCodeNos = [];
+var selectedData = [];
+var selectType = 'one';
+var queryWhere = {};
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
}).use(['layer', 'form', 'table', 'util', 'admin', 'xmSelect', 'laydate'], function () {
@@ -40,14 +44,18 @@
page: true,
cellMinWidth: 100,
cols: [[
- {type: 'numbers'},
+ {type: 'checkbox'},
+ {type: 'numbers', title: '搴忓彿'},
{field: 'orderNo', title: '鍗曟嵁缂栧彿'},
{field: 'docType$', align: 'center', title: '绫诲瀷', minWidth: 160, width: 160},
{align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 160, width: 160},
{field: 'createTime$', title: '鍒涘缓鏃堕棿', minWidth: 200, width: 200},
{field: 'settle$', align: 'center', title: '鐘舵��', templet: '#settleTpl', minWidth: 160, width: 160},
+ {field: 'cstmrName', align: 'center',title: '瀹㈡埛鍚嶇О'},
+ {field: 'itemName', align: 'center',title: '璋冩嫧鍒�'},
{field: 'memo', align: 'center',title: '澶囨敞', hide: true},
- {align: 'center', title: '鎿嶄綔', toolbar: '#operate', width: 180}
+ {field: 'createBy$', align: 'center', title: '鎿嶄綔鍛�', minWidth: 160, width: 160},
+ {align: 'center', title: '鎿嶄綔', toolbar: '#operate', width: 260}
]],
request: {
pageName: 'curr',
@@ -69,30 +77,173 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+
+ var selectedOrderNos = selectedData.map(item => item.orderNo);
+ var indexArr = []
+
+ res.data.forEach(function (item,index) {
+ if (selectedOrderNos.includes(item.orderNo)) {
+ indexArr.push(index)
+ }
+ })
+ // 閲嶆柊娓叉煋
+ table.setRowChecked('order',{
+ index: indexArr
+ });
insTbCount = count;
+ }
+ });
+
+ table.on('checkbox(order)', function (obj) {
+ if (obj.type === 'all' && obj.checked) {
+ selectType = 'all'
+ } else if (obj.type === 'one' && obj.checked) {
+ selectType = 'one'
+ selectedData.push(obj.data); // 閫変腑鏃朵繚瀛樻暟鎹�
+ } else if (obj.type === 'one' && !obj.checked && obj.index !== undefined) {
+ selectType = 'one'
+ selectedData = selectedData.filter(item => item.orderNo !== obj.data.orderNo); // 鍙栨秷鏃剁Щ闄ゆ暟鎹�
+ } else if (obj.type === 'all' && !obj.checked && obj.index === undefined) {
+ selectType = 'one'
+ selectedData = [];
}
});
// 鎼滅储
form.on('submit(tbSearch)', function (data) {
insTb.reload({where: data.field, page: {curr: 1}});
+ queryWhere = data.field
+ });
+
+ // 瀵煎嚭
+ form.on('submit(exportAll)', function (data) {
+ layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function () {
+ layer.closeAll();
+ layer.load(1, {shade: [0.1, '#fff']});
+ var reqData = {};
+ reqData.type = selectType;
+ if (reqData.type === 'one') {
+ reqData.orderNoList = selectedData.map(item => item.orderNo);
+ } else {
+ if (Object.keys(queryWhere).length === 0) {
+ reqData.queryWhere = {
+ create_time: "",
+ cstmr_name: "",
+ doc_type: "",
+ oper_memb: "",
+ order_no: "",
+ settle: ""
+ }
+ } else {
+ reqData.queryWhere = queryWhere
+ }
+ }
+ $.ajax({
+ url: baseUrl + "/order/definedExcelExport/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify(reqData),
+ contentType: 'application/json;charset=UTF-8',
+ method: 'POST',
+ xhrFields: {
+ responseType: 'blob' // 澶勭悊杩斿洖鐨勬枃浠舵祦
+ },
+ success: function (res) {
+ var link = document.createElement('a');
+ link.href = URL.createObjectURL(res); // 浣跨敤 Blob 瀵硅薄鐢熸垚涓存椂 URL
+ link.download = new Date().getTime() + '.xlsx'; // 璁剧疆涓嬭浇鐨勬枃浠跺悕
+ document.body.appendChild(link);
+ link.click(); // 瑙﹀彂涓嬭浇
+ document.body.removeChild(link);
+ }
+ });
+ layer.closeAll('loading');
+ });
});
// 娣诲姞
$("#orderAddBtn").click(function () {
showEditModel();
});
+ function btnPrint(id, orderNo, number) {
+ printMatCodeNos.push(orderNo)
+ var templateNo = 3;
+ $.ajax({
+ url: baseUrl+"/order/print/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: {param: printMatCodeNos},
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ layer.closeAll();
+ console.log(res);
+ for (let i=0;i<res.data.length;i++){
+ var templateDom = $("#templatePreview"+templateNo);
+ var className = templateDom.attr("class");
+ if (className === 'template-barcode') {
+ res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1¶m="+res.data[i].orderNo+
+ ";"+res.data[i].matnr+";"+res.data[i].batch;
+ } else {
+ res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m="+res.data[i].orderNo+
+ ";"+res.data[i].matnr+";"+res.data[i].batch;
+ }
+ }
+ var tpl = templateDom.html();
+ var template = Handlebars.compile(tpl);
+ var html = template(res);
+ var box = $("#box");
+ box.html(html);box.show();
+ box.print({mediaPrint:true});
+ box.hide();
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ }
+ function addPakOut(expTpe) {
+ $.ajax({
+ url: baseUrl+"/pakout/add/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify({
+ docType: Number(20),
+ orderNo: expTpe,
+ }),
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ layer.msg("鐢熸垚鎷h揣鍗曪細ok");
+ } else if (res.code === 403){
+ layer.msg("鐢熸垚鎷h揣鍗曞け璐ワ細403");
+ }else {
+ layer.msg("鐢熸垚鎷h揣鍗曞け璐ワ細鏈煡寮傚父");
+ }
+
+ }
+ })
+ }
+
// 宸ュ叿鏉$偣鍑讳簨浠�
table.on('tool(order)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
+
+
+
if (layEvent === 'edit') {
showEditModel(data);
} else if (layEvent === 'del') {
doDel(data.id);
+ }else if (layEvent === 'btnPrint') {
+ btnPrint(data.id, data.orderNo, 4);
} else if (layEvent === 'complete') {
doModify(data.id, data.orderNo, 4);
+ }else if (layEvent === 'manPrint') {
+ addPakOut(data.orderNo);
} else if (layEvent === 'look') {
var $a = $(obj.tr).find('a[lay-event="look"]');
var offset = $a.offset();
@@ -121,9 +272,10 @@
{type: 'numbers'},
{field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160},
{field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 160},
+
{field: 'batch', title: '鎵瑰彿'},
{field: 'anfme', title: '鏁伴噺'},
- // {field: 'workQty', title: '浣滀笟鏁伴噺'},
+ {field: 'workQty', title: '浣滀笟鏁伴噺'},
{field: 'qty', title: '瀹屾垚鏁伴噺', style: 'font-weight: bold'},
// {field: 'unit', title: '鍗曚綅'},
// {
@@ -133,7 +285,7 @@
// },
// {field: 'inQty', title: '宸插叆搴撻噺'},
// {field: 'color', title: '棰滆壊'},
- {field: 'specs', title: '瑙勬牸'}
+ // {field: 'specs', title: '瑙勬牸'},
]],
request: {
pageName: 'curr',
@@ -157,6 +309,9 @@
});
}
});
+ }
+ else if (layEvent === 'printExcel'){
+ printExcel(data);
}
});
@@ -182,18 +337,23 @@
layer.tips('璇锋坊鍔犲崟鎹槑缁�', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
return false;
}
- console.log(data)
let nList = admin.util.deepClone(xxDataList);
+ console.log(nList);
for (let xi = 0; xi < nList.length; xi++) {
if (nList[xi].anfme <= 0){
- layer.msg('鏄庣粏淇敼鏁伴噺涓嶅悎娉�', {icon: 2});
+ layer.msg('鏄庣粏鏁伴噺涓嶅悎娉�', {icon: 2});
return false;
}
+ // if (nList[xi].batch == null || nList[xi].batch == ""){
+ // layer.msg('鎵规涓嶅悎娉�', {icon: 2});
+ // return false;
+ // }
if (nList[xi].anfme < nList[xi].workQty){
layer.msg('鏁伴噺涓嶈兘灏忎簬宸蹭綔涓氭暟閲�', {icon: 2});
return false;
}
}
+
layer.load(2);
$.ajax({
url: baseUrl+"/order/form/" + (isExpAdd?"add":"modify") + "/auth",
@@ -202,6 +362,11 @@
orderId: Number(data.field.id),
docType: Number(data.field.docType),
orderNo: data.field.orderNo,
+ cstmr: data.field.cstmr,
+ cstmrName: data.field.cstmrName,
+ tel: data.field.tel,
+ number: data.field.number,
+ itemName: data.field.itemName,
orderDetlList: nList
}),
contentType:'application/json;charset=UTF-8',
@@ -234,19 +399,43 @@
{type: 'numbers', title: '#'},
{field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160},
{field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 200},
- {field: 'batch', title: '鎵瑰彿', edit: true},
{field: 'specs', title: '瑙勬牸'},
- {field: 'anfme', title: '鏁伴噺(淇敼)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
- {field: 'qty', title: '浣滀笟鏁伴噺', minWidth: 100, width: 100},
+ {field: 'batch', title: '鎵规', edit: true},
+ {field: 'anfme', title: '鏁伴噺(淇敼)kg', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
+
+ // {field: 'payment', title: '璐х墿鐘舵��',align: 'center', templet: '#payment'},
+ {field: 'qty', title: '浣滀笟鏁伴噺kg', minWidth: 100, width: 100},
// {field: 'unit', title: '鍗曚綅', width: 80},
{field: 'memo', title: '澶囨敞' , edit: true},
{align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
]],
- done: function (res) {
+ done: function (res, curr, count) {
$(layero).find('.layui-table-view').css('margin', '0');
+ var options = this;
+
+ // 鑾峰彇褰撳墠琛屾暟鎹�
+ table.getRowData = function(elem){
+ var index = $(elem).closest('tr').data('index');
+ return table.cache[options.id][index] || {};
+ };
+
+ $('.select-primary').on('change', function(){
+ var value = this.value; // 鑾峰彇閫変腑椤� value
+ var data = table.getRowData(this);
+ console.log(value);
+ xxDataList.forEach(res => {
+ if (data.id === res.id){
+ console.log(res)
+ res.payment = value;
+ }
+ })
+
+
+ });
},
size: ''
};
+
if (!isExpAdd) {
$.ajax({
url: baseUrl+"/order/detl/all/auth?orderId=" + expTpe.id,
@@ -317,7 +506,7 @@
}
}
data[obj.field] = obj.value;
- insTbSSXM.reload({data: xxDataList});
+ insTbSSXM.reloadData({data: xxDataList,scrollPos: true});
});
$('#matAddBtnComment').click(function () {
@@ -399,7 +588,11 @@
}
});
+
+
}
+
+
// 鍒犻櫎鍗曟嵁
function doDel(orderId) {
@@ -478,4 +671,16 @@
,type: 'datetime'
,range: true
});
+
+ function printExcel(data){
+ layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ layer.closeAll();
+ layer.load(1, {shade: [0.1,'#fff']});
+ location.href = baseUrl+"/order/printExport/auth?orderNo="+data.orderNo;
+ layer.closeAll('loading');
+ });
+ }
+
+
+
});
--
Gitblit v1.9.1