| | |
| | | ,{field: 'memo', align: 'center',title: '备注', hide: false} |
| | | ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'} |
| | | ,{field: 'enableQty', align: 'center',title: '待出数量', style: 'font-weight: bold'} |
| | | ,{field: 'finishStatus', align: 'center', title: '是否完成', templet: function(d){ |
| | | if (d.qty === 0 && d.enableQty === 0) { |
| | | return '<span style="color:green;font-weight:bold;">完成</span>'; |
| | | } else { |
| | | return '<span style="color:red;">未完成</span>'; |
| | | } |
| | | }} |
| | | |
| | | |
| | | // ,{field: 'name', align: 'center',title: '名称'} |
| | | // ,{field: 'unit', align: 'center',title: '单位', hide: true} |
| | | // ,{field: 'barcode', align: 'center',title: '商品条码', hide: true} |
| | |
| | | limit: Number.MAX_VALUE, |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | // {type: 'checkbox', merge: ['orderNo']}, |
| | | {field: 'orderNo', title: '单据编号', merge: true, align: 'center'}, |
| | | // {type: 'checkbox', merge: ['brand'],width: 100}, |
| | | // {field: 'title', title: '商品', merge: true, align: 'center', width: 350}, |
| | | {field: 'unit', title: '箱号', align: 'center',hide:false}, |
| | | {field: 'model', title: '卷号', align: 'center', hide: false}, |
| | |
| | | } |
| | | modifySta(stoPreTabData); |
| | | }); |
| | | form.on('submit(checkModifySta)', function () { |
| | | if (!tableCache || tableCache.length === 0) { |
| | | layer.msg("没有可处理的数据", {icon: 7}); |
| | | return false; |
| | | } |
| | | |
| | | let updatedRows = []; |
| | | |
| | | for (let i = 0; i < tableCache.length; i++) { |
| | | let row = tableCache[i]; |
| | | let locNo = row.locNo; |
| | | if (!locNo || locNo.length < 2) continue; |
| | | |
| | | let rowPrefix = parseInt(locNo.substring(0, 2), 10); |
| | | let newStaNo; |
| | | |
| | | if (rowPrefix >= 17 && rowPrefix <= 24) { |
| | | newStaNo = 3092; |
| | | } else if (rowPrefix >= 9 && rowPrefix <= 16) { |
| | | newStaNo = 3102; |
| | | } else if (rowPrefix >= 1 && rowPrefix <= 8) { |
| | | newStaNo = 3095; |
| | | } |
| | | |
| | | if (newStaNo) { |
| | | row.staNo = newStaNo; |
| | | updatedRows.push({index: i, staNo: newStaNo}); |
| | | } |
| | | } |
| | | |
| | | // 重载表格数据 |
| | | stoPreTabIdx.reload({data: tableCache}); |
| | | |
| | | // 更新下拉框颜色和值 |
| | | updatedRows.forEach(item => { |
| | | $('div[lay-id=stoPreTab] tr[data-index="' + item.index + '"] .order-sta-select').val(item.staNo); |
| | | }); |
| | | layui.form.render('select'); |
| | | updatedRows.forEach(item => { |
| | | $('div[lay-id=stoPreTab] tr[data-index="' + item.index + '"] .layui-select-title input').css("color", "blue"); |
| | | }); |
| | | |
| | | layer.msg("出库站点均分已完成", {icon: 1}); |
| | | return false; |
| | | }); |
| | | |
| | | // 批量修改出库站 - 站点选择 |
| | | function modifySta(stoPreTabData) { |
| | | // 出库站取交集 |
| | |
| | | } |
| | | |
| | | } |
| | | ,yes: function(index, layero){ |
| | | //按钮【立即出库】的回调 |
| | | pakout(tableCache, index); |
| | | ,yes: function(layerIndex, layero){ |
| | | // 立即出库按钮点击 → 先请求下拉列表 |
| | | let loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/getMesOrder/auth", // 你提供的接口 |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | success: function(res){ |
| | | layer.close(loadIndex); |
| | | if(res.code === 200){ |
| | | // 弹出二次确认框 |
| | | layer.open({ |
| | | type: 1, |
| | | title: '请选择组货单号', |
| | | area: ['400px','200px'], |
| | | content: $('#staBatchSelectDialog').html(), |
| | | success: function(layero2, index2){ |
| | | // 渲染下拉框 |
| | | let select = $(layero2).find('#batchSelectStaBox'); |
| | | select.empty().append(`<option value="">请选择组货单号</option>`); |
| | | res.data.forEach(item => { |
| | | select.append(`<option value="${item}">${item}</option>`); |
| | | }); |
| | | // 注意这里 select 要加 lay-search 属性 |
| | | select.attr("lay-search", ""); |
| | | layui.form.render('select'); |
| | | |
| | | |
| | | |
| | | // 确认按钮 |
| | | form.on('submit(staBatchSelectConfirm)', function(obj){ |
| | | let selectedValue = obj.field.batchSta; |
| | | console.log(selectedValue) |
| | | layer.close(index2); |
| | | // 调用原来的出库函数,同时传下拉值 |
| | | pakout(tableCache, layerIndex, selectedValue); |
| | | return false; |
| | | }); |
| | | } |
| | | }); |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | ,btn2: function(index, layero){ |
| | | //按钮【稍后处理】的回调 |
| | | layer.close(index) |
| | |
| | | }) |
| | | } |
| | | |
| | | function pakout(tableCache, layerIndex) { |
| | | // let loadIndex = layer.load(2); |
| | | function pakout(tableCache, layerIndex, optionValue) { |
| | | // 可以把 optionValue 传给接口 |
| | | notice.msg('正在生成出库任务......', {icon: 4}); |
| | | $.ajax({ |
| | | url: baseUrl + "/out/pakout/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType: 'application/json;charset=UTF-8', |
| | | data: JSON.stringify(tableCache), |
| | | data: JSON.stringify({tableCache,optionValue}), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | notice.destroy(); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /* 删除订单 */ |
| | | function doDelSensor(obj) { |
| | | layer.confirm('确定要删除选中数据吗?', { |