|  |  | 
 |  |  |             {type: 'checkbox'} | 
 |  |  |             ,{type: 'numbers', title: '#'} | 
 |  |  |             ,{field: 'orderNo', align: 'center',title: '单据编号', templet: '#orderNoTpl', width: 160} | 
 |  |  |             ,{field: 'matnr', align: 'center',title: '商品编码', width: 160} | 
 |  |  |             ,{field: 'maktx', align: 'center',title: '商品名称', width: 200} | 
 |  |  |             ,{field: 'matnr', align: 'center',title: '物料号', width: 160} | 
 |  |  |             ,{field: 'maktx', align: 'center',title: '物料名称', width: 200} | 
 |  |  |             ,{field: 'batch', align: 'center',title: '序列码'} | 
 |  |  |             ,{field: 'specs', align: 'center',title: '规格'} | 
 |  |  |             // ,{field: 'anfme', align: 'center',title: '数量'} | 
 |  |  |             // ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'} | 
 |  |  |             ,{field: 'enableQty', align: 'center',title: '待出数量', style: 'font-weight: bold'} | 
 |  |  |             ,{field: 'color', align: 'center',title: '销售订单号'} | 
 |  |  |             ,{field: 'origin', align: 'center',title: '销售订单行号'} | 
 |  |  |             // ,{field: 'name', align: 'center',title: '名称'} | 
 |  |  |             // ,{field: 'model', align: 'center',title: '型号'} | 
 |  |  |             // ,{field: 'model', align: 'center',title: '通用型号'} | 
 |  |  |             ,{field: 'unit', align: 'center',title: '单位', hide: true} | 
 |  |  |             ,{field: 'barcode', align: 'center',title: '商品条码', hide: true} | 
 |  |  |             // ,{field: 'supplier', align: 'center',title: '供应商'} | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     function pakoutPreviewDialog(data) { | 
 |  |  |         for(var i=0; i<data.length; i++){ | 
 |  |  |             if(!data[i].staNos){ | 
 |  |  |                 data[i].staNos = data[i].agvStaNos; | 
 |  |  |                 data[i].staNo = data[i].agvStaNo; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         var tableCache; | 
 |  |  |         layer.open({ | 
 |  |  |             type: 1 | 
 |  |  | 
 |  |  |                         {field: 'title', title: '商品', merge: true, align: 'center', width: 350}, | 
 |  |  |                         {field: 'batch', title: '序列码', align: 'center'}, | 
 |  |  |                         {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, | 
 |  |  |                         {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'}, | 
 |  |  |                         {field: 'locNo', title: '货位', align: 'center', templet: '#locNoTpl'}, | 
 |  |  |                         {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'}, | 
 |  |  |                         // {type: 'checkbox', merge: ['locNo']}, | 
 |  |  |                     ]], | 
 |  |  |                     //cols: getCol(data), | 
 |  |  |                     done: function (res) { | 
 |  |  |                         tableMerge.render(this); | 
 |  |  |                         $('.layui-table-body.layui-table-main').css("overflow", "auto"); | 
 |  |  | 
 |  |  |                     let data = tableCache[index]; | 
 |  |  |                     for (let i = 0; i<tableCache.length; i++) { | 
 |  |  |                         if (tableCache[i].locNo === data.locNo) { | 
 |  |  |                             tableCache[i]['staNo'] = Number(obj.elem.value); | 
 |  |  |                             //tableCache[i]['staNo'] = Number(obj.elem.value); | 
 |  |  |                             tableCache[i]['staNo'] = obj.elem.value; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     obj.othis.children().find("input").css("color", "blue"); | 
 |  |  | 
 |  |  |                             // 确认 | 
 |  |  |                             form.on('submit(staBatchSelectConfirm)', function (obj) { | 
 |  |  |                                 let loadIdx = layer.load(2); | 
 |  |  |                                 let batchSta = Number(obj.field.batchSta); | 
 |  |  |                                 //let batchSta = Number(obj.field.batchSta); | 
 |  |  |                                 let batchSta = obj.field.batchSta; | 
 |  |  |                                 let arr = []; | 
 |  |  |                                 for (let i = 0; i<tableCache.length; i++) { | 
 |  |  |                                     tableCache[i]['staNo'] = batchSta; | 
 |  |  | 
 |  |  |  | 
 |  |  |     function pakout(tableCache, layerIndex) { | 
 |  |  |         // let loadIndex = layer.load(2); | 
 |  |  |         for(var i=0; i<tableCache.length; i++){ | 
 |  |  |             if(tableCache[i].agvStaNos){ | 
 |  |  |                 tableCache[i].agvStaNo = tableCache[i].staNo; | 
 |  |  |                 tableCache[i].staNos = null; | 
 |  |  |                 tableCache[i].staNo = null; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         notice.msg('正在生成出库任务......', {icon: 4}); | 
 |  |  |         $.ajax({ | 
 |  |  |             url: baseUrl + "/out/pakout/auth", | 
 |  |  | 
 |  |  |                                 cellMinWidth: 100, | 
 |  |  |                                 cols: [[ | 
 |  |  |                                     {type: 'checkbox'}, | 
 |  |  |                                     {field: 'matnr', title: '商品编码', align: 'center', width: 350}, | 
 |  |  |                                     {field: 'maktx', title: '商品名称', align: 'center'}, | 
 |  |  |                                     {field: 'matnr', title: '物料号', align: 'center', width: 350}, | 
 |  |  |                                     {field: 'maktx', title: '物料名称', align: 'center'}, | 
 |  |  |                                     {field: 'specs', title: '规格', align: 'center'}, | 
 |  |  |                                     {field: 'batch', title: '批号', align: 'center'}, | 
 |  |  |                                     {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, | 
 |  |  | 
 |  |  |                                 success: function (res) { | 
 |  |  |                                     layer.close(loadIndex); | 
 |  |  |                                     if (res.code === 200){ | 
 |  |  |                                         console.log(res.data) | 
 |  |  |                                         // pakoutPreviewMergeDialog(res.data) | 
 |  |  |                                         layer.close(index) | 
 |  |  |                                         pakoutPreviewMergeDialog(res.data) | 
 |  |  |                                     } else if (res.code === 403){ | 
 |  |  |                                         top.location.href = baseUrl+"/"; | 
 |  |  |                                     } else { | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     function pakoutPreviewMergeDialog(data) { | 
 |  |  |         for(var i=0; i<data.length; i++){ | 
 |  |  |             if(!data[i].staNos){ | 
 |  |  |                 data[i].staNos = data[i].agvStaNos; | 
 |  |  |                 data[i].staNo = data[i].agvStaNo; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         var mergeTabCache; | 
 |  |  |         layer.open({ | 
 |  |  |             type: 1 | 
 |  |  | 
 |  |  |             ,moveType: 1 //拖拽模式,0或者1 | 
 |  |  |             ,content: $('#pakoutPreviewMergeBox').html() | 
 |  |  |             ,success: function(layero, index){ | 
 |  |  |                 stoPreTabIdx = table.render({ | 
 |  |  |                 stoPreTabMergeIdx = table.render({ | 
 |  |  |                     elem: '#stoPreTabMerge', | 
 |  |  |                     data: data, | 
 |  |  |                     height: 520, | 
 |  |  | 
 |  |  |                     cellMinWidth: 100, | 
 |  |  |                     cols: [[ | 
 |  |  |                         // {type: 'checkbox', merge: ['orderNo']}, | 
 |  |  |                         {field: 'orderNo', title: '单据编号', merge: true, align: 'center'}, | 
 |  |  |                         {field: 'title', title: '商品', merge: true, align: 'center', width: 350}, | 
 |  |  |                         {field: 'specs', title: '规格', align: 'center'}, | 
 |  |  |                         {field: 'batch', title: '序列码', align: 'center'}, | 
 |  |  |                         {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, | 
 |  |  |                         {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'}, | 
 |  |  |                         {field: 'locNo', title: '货位', align: 'center', templet: '#locNoTpl'}, | 
 |  |  |                         {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'}, | 
 |  |  |                         // {type: 'checkbox', merge: ['locNo']}, | 
 |  |  |                     ]], | 
 |  |  | 
 |  |  |                 // 修改出库站 | 
 |  |  |                 form.on('select(tbBasicTbStaNos)', function (obj) { | 
 |  |  |                     let index  = obj.othis.parents('tr').attr("data-index"); | 
 |  |  |                     let data = tableCache[index]; | 
 |  |  |                     for (let i = 0; i<tableCache.length; i++) { | 
 |  |  |                         if (tableCache[i].locNo === data.locNo) { | 
 |  |  |                             tableCache[i]['staNo'] = Number(obj.elem.value); | 
 |  |  |                     let data = mergeTabCache[index]; | 
 |  |  |                     for (let i = 0; i<mergeTabCache.length; i++) { | 
 |  |  |                         if (mergeTabCache[i].locNo === data.locNo) { | 
 |  |  |                             //mergeTabCache[i]['staNo'] = Number(obj.elem.value); | 
 |  |  |                             mergeTabCache[i]['staNo'] = obj.elem.value; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     obj.othis.children().find("input").css("color", "blue"); | 
 |  |  | 
 |  |  |                 function modifySta() { | 
 |  |  |                     // 出库站取交集 | 
 |  |  |                     let staBatchSelectVal = []; | 
 |  |  |                     for(let i = 0; i<tableCache.length; i++) { | 
 |  |  |                         let staNos = tableCache[i].staNos; | 
 |  |  |                     for(let i = 0; i<mergeTabCache.length; i++) { | 
 |  |  |                         let staNos = mergeTabCache[i].staNos; | 
 |  |  |                         if (staNos !== null) { | 
 |  |  |                             if (staBatchSelectVal.length === 0) { | 
 |  |  |                                 staBatchSelectVal = staNos; | 
 |  |  | 
 |  |  |                             // 确认 | 
 |  |  |                             form.on('submit(staBatchSelectConfirm)', function (obj) { | 
 |  |  |                                 let loadIdx = layer.load(2); | 
 |  |  |                                 let batchSta = Number(obj.field.batchSta); | 
 |  |  |                                 //let batchSta = Number(obj.field.batchSta); | 
 |  |  |                                 let batchSta = obj.field.batchSta; | 
 |  |  |                                 let arr = []; | 
 |  |  |                                 for (let i = 0; i<tableCache.length; i++) { | 
 |  |  |                                     tableCache[i]['staNo'] = batchSta; | 
 |  |  |                                 for (let i = 0; i<mergeTabCache.length; i++) { | 
 |  |  |                                     mergeTabCache[i]['staNo'] = batchSta; | 
 |  |  |                                     arr.push(i); | 
 |  |  |                                 } | 
 |  |  |                                 stoPreTabIdx.reload({data: tableCache}); | 
 |  |  |                                 console.log(mergeTabCache) | 
 |  |  |                                 stoPreTabMergeIdx.reload({data: mergeTabCache}); | 
 |  |  |                                 arr.forEach(item => { | 
 |  |  |                                     $('div[lay-id=stoPreTab] tr[data-index="' + item + '"] .order-sta-select').val(batchSta); | 
 |  |  |                                     $('div[lay-id=stoPreTabMerge] tr[data-index="' + item + '"] .order-sta-select').val(batchSta); | 
 |  |  |                                 }); | 
 |  |  |                                 layui.form.render('select'); | 
 |  |  |                                 arr.forEach(item => { | 
 |  |  |                                     $('div[lay-id=stoPreTab] tr[data-index="' + item + '"] .layui-select-title').find("input").css("color", "blue"); | 
 |  |  |                                     $('div[lay-id=stoPreTabMerge] tr[data-index="' + item + '"] .layui-select-title').find("input").css("color", "blue"); | 
 |  |  |                                 }); | 
 |  |  |                                 layer.close(loadIdx); layer.close(ddIndex); | 
 |  |  |                                 return false; | 
 |  |  | 
 |  |  |             } | 
 |  |  |             ,yes: function(index, layero){ | 
 |  |  |                 //按钮【立即出库】的回调 | 
 |  |  |                 pakout(tableCache, index); | 
 |  |  |                 pakout(mergeTabCache, index); | 
 |  |  |             } | 
 |  |  |             ,btn2: function(index, layero){ | 
 |  |  |                 //按钮【稍后处理】的回调 |