| | |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#basArmMast', |
| | | elem: '#basArmMastExp', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/basArmMast/list/auth', |
| | | page: true, |
| | |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | , |
| | | {field: 'id', align: 'center',title: 'ID',hide: true} |
| | | ,{field: 'armNo', align: 'center',title: '机械臂编号',hide: false} |
| | | ,{field: 'orderNo', align: 'center',title: '订单号',hide: false} |
| | | ,{field: 'armDirection', align: 'center',title: '操作方向',hide: true} |
| | | ,{field: 'staNo', align: 'center',title: '终点',hide: false} |
| | | ,{field: 'sortingLine', align: 'center',title: '起点',hide: false} |
| | | ,{field: 'matnr', align: 'center',title: '商品编号',hide: false} |
| | | ,{field: 'sku', align: 'center',title: 'sku',hide: true} |
| | | // ,{field: 'po', align: 'center',title: 'po',hide: false} |
| | | // ,{field: 'upc', align: 'center',title: 'upc',hide: false} |
| | | // ,{field: 'status', align: 'center',title: '作业状态',hide: true} |
| | | // ,{field: 'status$', align: 'center',title: '作业状态',hide: false} |
| | | // ,{field: 'bindingTags', align: 'center',title: '分拣绑定标记',hide: false} |
| | | // ,{field: 'priority', align: 'center',title: '优先级',hide: true} |
| | | // ,{field: 'supplier', align: 'center',title: '货源',hide: false} |
| | | ,{field: 'ctns', align: 'center',title: '总箱数',hide: true} |
| | | // ,{field: 'createTime', align: 'center',title: '时间戳',hide: true} |
| | | // ,{field: 'barcode', align: 'center',title: '托盘码',hide: false} |
| | | // ,{field: 'armError', align: 'center',title: '异常代码',hide: true} |
| | | // ,{field: 'armMsg', align: 'center',title: '异常信息',hide: true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | {type: 'checkbox'}, |
| | | {field: 'armNo', align: 'center', title: '机械臂编号'}, |
| | | {field: 'orderNo', align: 'center', title: '订单号'}, |
| | | {field: 'matnr', align: 'center', title: '商品编号'}, |
| | | {field: 'po', align: 'center', title: 'PO'}, |
| | | {field: 'upc', align: 'center', title: 'UPC'}, |
| | | {field: 'sortingLine', align: 'center', title: '起点'}, |
| | | {field: 'status', align: 'center', title: '作业状态', templet: function(d){ |
| | | return '2.单码完成等待托盘完成'; // 因为现在只显示状态2,固定显示 |
| | | }}, |
| | | {field: 'barcode', align: 'center', title: '托盘码'}, |
| | | {field: 'supplier', align: 'center', title: '货源'}, |
| | | {field: 'quantity', align: 'center', title: '数量', sort: true, style: 'background-color: #fffbe6; font-weight: bold;'}, // 高亮显示数量 |
| | | // {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 120} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | if (res.code !== 200) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': 0, |
| | | 'data': [] |
| | | }; |
| | | } |
| | | |
| | | var records = res.data.records || []; |
| | | var groupMap = new Map(); // 用来汇总状态为2的数据 |
| | | |
| | | records.forEach(function(item) { |
| | | // 只处理状态为2的记录,其他状态直接忽略(隐藏) |
| | | if (String(item.status) === '2') { |
| | | // 生成唯一标识(5个字段组合) |
| | | var key = [ |
| | | item.armNo || '', |
| | | item.sortingLine || '', |
| | | item.barcode || '', |
| | | item.matnr || '', |
| | | item.orderNo || '' |
| | | ].join('|||||'); // 用多个|分隔,避免字段值冲突 |
| | | |
| | | if (groupMap.has(key)) { |
| | | // 已存在相同组合,数量+1 |
| | | groupMap.get(key).quantity += 1; |
| | | } else { |
| | | // 新组合,创建一条汇总记录 |
| | | groupMap.set(key, { |
| | | armNo: item.armNo, |
| | | orderNo: item.orderNo, |
| | | matnr: item.matnr, |
| | | po: item.po || '', |
| | | upc: item.upc || '', |
| | | sortingLine: item.sortingLine, |
| | | barcode: item.barcode, |
| | | supplier: item.supplier || '', |
| | | status: '2', // 固定显示为2 |
| | | quantity: 1 // 初始数量1 |
| | | }); |
| | | } |
| | | } |
| | | // 状态不为2的记录直接跳过,不加入任何数据 |
| | | }); |
| | | |
| | | // 转换为数组 |
| | | var finalData = Array.from(groupMap.values()); |
| | | |
| | | return { |
| | | 'code': 200, |
| | | 'msg': res.msg, |
| | | 'count': finalData.length, // 分页总数 = 合并后的行数 |
| | | 'data': finalData |
| | | }; |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(basArmMast)', function (obj) { |
| | | var searchData = {}; |
| | |
| | | page: {curr: 1} |
| | | }); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(basArmMast)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id).data; |
| | |
| | | showEditModel(); |
| | | break; |
| | | case 'deleteData': |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | break; |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | break; |
| | | case 'exportData': |
| | | admin.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(basArmMast)', function(obj){ |
| | | var data = obj.data; |
| | |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 搜索 |
| | | form.on('submit(search)', function (data) { |
| | | pageCurr = 1; |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 重置 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | | clearFormVal($('#search-box')); |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 时间选择器 |
| | | function layDateRender(data) { |
| | | setTimeout(function () { |
| | |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | }); |
| | | |
| | | }, 300); |
| | | } |
| | | layDateRender(); |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } |
| | | }); |
| | | } |