| | |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'defNumber', align: 'center', title: '操作系统号', hide: false, width: 120}, |
| | | {field: '操作单据', align: 'center', title: '操作单据', hide: true}, |
| | | {field: '操作类型', align: 'center', title: '操作类型', hide: true}, |
| | | {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl'}, |
| | | {field: 'itemName', align: 'center', title: '核算主体'}, |
| | | //{field: 'itemName', align: 'center', title: '核算主体'}, |
| | | {field: 'docType$', align: 'center', title: '单据类型'}, |
| | | {field: 'defNumber', align: 'center', title: '业务类型'}, |
| | | //{field: 'defNumber', align: 'center', title: '业务类型'}, |
| | | //{field: 'postFee', align: 'center', title: '总数量', minWidth: 130, width: 130}, |
| | | {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160}, |
| | | {field: 'createTime$', title: '创建时间'}, |
| | | {field: 'createTime$', title: '创建时间', hide: true}, |
| | | {field: 'orderTime', align: 'center',title: '单据日期'}, |
| | | {field: 'shipCode', align: 'center',title: '制单人', hide: false}, |
| | | {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 160, width: 160}, |
| | | {field: 'memo', align: 'center',title: '备注', hide: true}, |
| | | {field: 'orderTime', align: 'center',title: '单据日期', hide: true}, |
| | | {field: 'cstmrName', align: 'center',title: '供应商/客户编码', hide: true}, |
| | | {field: 'tel', align: 'center',title: '仓库', hide: true}, |
| | | {field: 'operMemb', align: 'center',title: '出入库类别', hide: true}, |
| | | {field: 'salesman', align: 'center',title: '部门', hide: true}, |
| | | {field: 'shipCode', align: 'center',title: '制单人', hide: true}, |
| | | //{align: 'center', title: '操作', toolbar: '#operate', width: 180} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | page: true, |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'matnr', title: '商品编码', width: 160}, |
| | | {field: 'maktx', title: '商品名称', width: 160}, |
| | | //{type: 'numbers'}, |
| | | {field: 'matnr', title: '商品编码', width: 140}, |
| | | {field: 'maktx', title: '商品名称', width: 150}, |
| | | {field: 'batch', title: '批号'}, |
| | | {field: 'anfme', title: '数量'}, |
| | | {field: 'qty', title: '作业数量', style: 'font-weight: bold'}, |
| | |
| | | // }, |
| | | // {field: 'inQty', title: '已入库量'}, |
| | | // {field: 'color', title: '颜色'}, |
| | | {field: 'specs', title: '规格型号'}, |
| | | //{field: 'specs', title: '规格型号'}, |
| | | {field: 'unit', title: '计量单位'}, |
| | | {field: 'manu', title: '行号'}, |
| | | {field: 'threeCode', title: '销售订单号'}, |
| | | {field: 'deadTime', title: '销售订单行号'}, |
| | | {field: 'itemNum', title: '行唯一标识'} |
| | | //{field: 'manu', title: '行号'}, |
| | | {field: 'threeCode', title: '销售单号'}, |
| | | //{field: 'deadTime', title: '自由项'}, |
| | | {field: 'processSts$', title: '工序'}, |
| | | //{field: 'specs', title: '规格'}, |
| | | {field: 'reportQty', title: '上报数量'}, |
| | | //{field: 'itemNum', title: '行唯一标识'} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | } |
| | | }); |
| | | |
| | | // 显示表单弹窗 |
| | | function showEditModel(expTpe) { |
| | | admin.open({ |
| | | type: 1, |
| | | title: (expTpe ? '修改' : '添加') + '单据', |
| | | content: $('#editDialog').html(), |
| | | area: '1300px', |
| | | success: function (layero, dIndex) { |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | var isExpAdd = !expTpe; |
| | | // 回显数据 |
| | | form.val('editForm', expTpe); |
| | | if (expTpe) { |
| | | $('#orderNo').attr("disabled", "disabled"); |
| | | } |
| | | // 表单提交事件 |
| | | form.on('submit(orderEditSubmit)', function (data) { |
| | | // 组装数据 |
| | | if (xxDataList.length <= 0) { |
| | | layer.tips('请添加单据明细', '#matAddBtnComment', {tips: [1, '#ff4c4c']}); |
| | | return false; |
| | | } |
| | | let nList = admin.util.deepClone(xxDataList); |
| | | for (let xi = 0; xi < nList.length; xi++) { |
| | | if (nList[xi].anfme <= 0){ |
| | | layer.msg('明细修改数量不合法', {icon: 2}); |
| | | return false; |
| | | } |
| | | } |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/orderLog/form/" + (isExpAdd?"add":"modify") + "/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | orderId: Number(data.field.id), |
| | | docType: Number(data.field.docType), |
| | | orderNo: data.field.orderNo, |
| | | orderDetlList: nList |
| | | }), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | // 明细表格 |
| | | var xxDataList = []; |
| | | var tbOptions = { |
| | | elem: '#formSSXMTable', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | data: xxDataList, |
| | | page: true, |
| | | height: '350px;', |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {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: 'threeCode', title: '销售订单号(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110}, |
| | | {field: 'deadTime', title: '销售订单行号(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110}, |
| | | // {field: 'inQty', title: '已入库量', 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) { |
| | | $(layero).find('.layui-table-view').css('margin', '0'); |
| | | }, |
| | | size: '' |
| | | }; |
| | | if (!isExpAdd) { |
| | | $.ajax({ |
| | | url: baseUrl+"/orderLog/detl/all/auth?orderId=" + expTpe.id, |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'GET', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | xxDataList = res.data; |
| | | tbOptions.data = xxDataList; |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | var insTbSSXM = table.render(tbOptions); |
| | | // 工具条点击事件 |
| | | table.on('tool(formSSXMTable)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | if (layEvent === 'edit') { |
| | | showEditModel2(data); |
| | | } else if (layEvent === 'del') { |
| | | layer.confirm('确定要删除吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | | }, function (i) { |
| | | layer.close(i); |
| | | for (var j = 0; j < xxDataList.length; j++) { |
| | | if (xxDataList[j].matnr === data.matnr && xxDataList[j].batch === data.batch) { |
| | | xxDataList.splice(j, 1); |
| | | break; |
| | | } |
| | | } |
| | | insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); |
| | | }); |
| | | } |
| | | }); |
| | | // 明细数据修改 |
| | | table.on('edit(formSSXMTable)', function (obj) { |
| | | let index = obj.tr.attr("data-index"); |
| | | let data = xxDataList[index]; |
| | | if (obj.field === 'anfme'){ |
| | | let vle = Number(obj.value); |
| | | if (isNaN(vle)) { |
| | | layer.msg("请输入数字", {icon: 2}); |
| | | return false; |
| | | } else { |
| | | if (vle <= 0) { |
| | | layer.msg("数量必须大于零", {icon: 2}); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | data[obj.field] = obj.value; |
| | | insTbSSXM.reload({data: xxDataList}); |
| | | }); |
| | | |
| | | $('#matAddBtnComment').click(function () { |
| | | showEditModel2(); |
| | | }); |
| | | |
| | | // 显示添加明细表单弹窗 |
| | | function showEditModel2(exp) { |
| | | admin.open({ |
| | | type: 1, |
| | | offset: '150px', |
| | | area: '680px', |
| | | title: (exp ? '修改' : '添加') + '明细', |
| | | content: $('#matEditDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | // 回显数据 |
| | | form.val('matEditForm', exp); |
| | | // 表单提交事件 |
| | | form.on('submit(matEditSubmit)', function (data) { |
| | | let selectList = matXmSelect.getValue(); |
| | | for (let i = 0; i<selectList.length; i++) { |
| | | let item = selectList[i]; |
| | | // 查询物料详情 |
| | | $.ajax({ |
| | | url: baseUrl+"/mat/covert/"+item.value+"/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'GET', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | xxDataList.push(res.data); |
| | | insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | layer.close(dIndex); |
| | | return false; |
| | | }); |
| | | // 渲染物料选择 |
| | | var matXmSelect = xmSelect.render({ |
| | | el: '#mat', |
| | | style: { |
| | | width: '340px', |
| | | }, |
| | | autoRow: true, |
| | | toolbar: { show: true }, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | remoteMethod: function(val, cb, show){ |
| | | $.ajax({ |
| | | url: baseUrl+"/mat/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | // 弹窗不出现滚动条 |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 删除单据 |
| | | function doDel(orderId) { |
| | | layer.confirm('确定要删除吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | | }, function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/orderLog/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | orderId: orderId |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | if (insTbCount === 0) { |
| | | insTb.reload({page: {curr: 1}}); |
| | | } else { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 上传审核单据 |
| | | function doReport(orderId) { |
| | | layer.confirm('确定要上传单据吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | | }, function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/orderLog/report/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | orderId: orderId |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | if (insTbCount === 0) { |
| | | insTb.reload({page: {curr: 1}}); |
| | | } else { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 修改订单状态 |
| | | function doModify(orderId, settle) { |
| | | layer.confirm('确定要手动完结吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | | }, function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | console.log(orderId); |
| | | console.log(settle); |
| | | $.ajax({ |
| | | url: baseUrl+"/orderLog/update/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | id: orderId, |
| | | settle: settle |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | if (insTbCount === 0) { |
| | | insTb.reload({page: {curr: 1}}); |
| | | } else { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 任务追溯 |
| | | function showWrkTrace(orderId) { |