| | |
| | | return util.toDateString(d.createTime); |
| | | }, width: 180 |
| | | }, |
| | | {field: 'outqty', title: '已出库量'}, |
| | | {field: 'inQty', title: '已入库量'}, |
| | | {field: 'color', title: '颜色'}, |
| | | {field: 'specs', title: '规格'} |
| | | ]], |
| | |
| | | |
| | | // 显示表单弹窗 |
| | | function showEditModel(expTpe) { |
| | | var mlist=null |
| | | var inQtys=[] |
| | | admin.open({ |
| | | type: 1, |
| | | title: (expTpe ? '修改' : '添加') + '单据', |
| | |
| | | var param = []; |
| | | var nList = admin.util.deepClone(xxDataList); |
| | | for (var xi = 0; xi < nList.length; xi++) { |
| | | if (nList[xi].qty > 0) { |
| | | // console.log('已入库:'+nList[xi].inQty) |
| | | // console.log('旧数量:'+inQtys[xi]) |
| | | // console.log('数量:'+nList[xi].qty) |
| | | if (nList[xi].inQty > 0 && inQtys[xi]!=nList[xi].qty) { |
| | | layer.msg("已入库无法修改", {icon: 2}) |
| | | return false; |
| | | } else if (nList[xi].qty > 0) { |
| | | param.push({ |
| | | billNo: data.field.billNo, |
| | | billType: data.field.billType, |
| | |
| | | memo: nList[xi].memo, |
| | | unit: nList[xi].unit, |
| | | qty: nList[xi].qty, |
| | | inQty: nList[xi].inQty, |
| | | }) |
| | | }else if (nList[xi].qty == 0){ |
| | | layer.msg('明细修改数量不合法', {icon: 2}); |
| | | return false; |
| | | } |
| | | } |
| | | if (param.length === 0) { |
| | |
| | | {field: 'specs', title: '规格', width: 160}, |
| | | {field: 'color', title: '颜色', width: 160}, |
| | | {field: 'size', title: '尺寸', width: 160}, |
| | | {field: 'qty', title: '修改数量', style: 'color: blue;font-weight: bold', edit: true, minWidth: 100, width: 100}, |
| | | {field: 'inQty', title: '已入库量', minWidth: 100, width: 100}, |
| | | {field: 'unit', title: '单位', width: 160}, |
| | | {field: 'memo', title: '备注' , edit: true, width: 160}, |
| | | {field: 'qty', title: '修改数量', style: 'color: blue;font-weight: bold', edit: true, minWidth: 100, width: 100}, |
| | | {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80} |
| | | ]], |
| | | done: function (res) { |
| | | mlist= res.data |
| | | for (let i = 0; i < mlist.length; i++) { |
| | | var waitIn=mlist[i] |
| | | inQtys.push(waitIn.qty) |
| | | } |
| | | $(layero).find('.layui-table-view').css('margin', '0'); |
| | | }, |
| | | size: '' |
| | |
| | | table.on('tool(waitMatout)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | console.log(obj) |
| | | var checkStatus = table.checkStatus(obj.config); |
| | | if (layEvent === 'edit') { |
| | | showEditModel(data); |
| | | } else if (layEvent === 'del') { |
| | |
| | | // 显示表单弹窗 |
| | | function showEditModel(expTpe) { |
| | | |
| | | //matOut ajax |
| | | // var DataList = []; |
| | | // $.ajax({ |
| | | // url: baseUrl+"/waitMatout/list/auth2?billNo=" + expTpe.billNo, |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // contentType:'application/json;charset=UTF-8', |
| | | // method: 'POST', |
| | | // success: function (res) { |
| | | // console.log(res) |
| | | // var list=res.data.records; |
| | | // for (let i = 0; i < list.length; i++) { |
| | | // DataList.push(list[i]); |
| | | // } |
| | | // } |
| | | // }) |
| | | // console.log(DataList) |
| | | |
| | | var mlist=null |
| | | var oldQtys=[] |
| | | admin.open({ |
| | | type: 1, |
| | | title: (expTpe ? '修改' : '添加') + '单据', |
| | |
| | | } |
| | | // 表单提交事件 |
| | | form.on('submit(waitMatoutEditSubmit)', function (data) { |
| | | console.log(data) |
| | | // 组装数据 |
| | | if (xxDataList.length <= 0) { |
| | | layer.tips('请添加单据明细', '#matAddBtnComment', {tips: [1, '#ff4c4c']}); |
| | |
| | | } |
| | | var param = []; |
| | | var nList = admin.util.deepClone(xxDataList); |
| | | console.log(nList) |
| | | for (var xi = 0; xi < nList.length; xi++) { |
| | | if (nList[xi].outQty > 0 ) { |
| | | |
| | | // console.log('已出库:'+nList[xi].outQty) |
| | | // console.log('旧数量:'+oldQtys[xi]) |
| | | // console.log('数量:'+nList[xi].qty) |
| | | if (nList[xi].outQty > 0 && oldQtys[xi]!=nList[xi].qty) { |
| | | layer.msg("已出库无法修改", {icon: 2}) |
| | | return false; |
| | | } else if (nList[xi].qty > 0) { |
| | | param.push({ |
| | | billNo: data.field.billNo, |
| | |
| | | outQty: nList[xi].outQty, |
| | | qty: nList[xi].qty, |
| | | }) |
| | | }else if (nList[xi].qty == 0){ |
| | | layer.msg('明细修改数量不合法', {icon: 2}); |
| | | return false; |
| | | } |
| | | } |
| | | if (param.length === 0) { |
| | |
| | | {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80} |
| | | ]], |
| | | done: function (res) { |
| | | var list= res.data |
| | | mlist= res.data |
| | | for (let i = 0; i < mlist.length; i++) { |
| | | var waitOut=mlist[i] |
| | | oldQtys.push(waitOut.qty) |
| | | } |
| | | $(layero).find('.layui-table-view').css('margin', '0'); |
| | | }, |
| | | size: '' |
| | |
| | | }); |
| | | // 数量修改 |
| | | table.on('edit(formSSXMTable)', function (obj) { |
| | | debugger; |
| | | if (obj.field=='memo'){ |
| | | let vle = obj.value; |
| | | for (var i=0;i<xxDataList.length;i++) { |
| | |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | var mat = res.data; |
| | | console.log(mat) |
| | | xxDataList.push({ |
| | | matNo: mat.matNo, |
| | | matName: mat.matName, |