|  |  |  | 
|---|
|  |  |  | <select name="Type" id="Type" lay-filter="Type" lay-search> | 
|---|
|  |  |  | <option value="0">成品入库</option> | 
|---|
|  |  |  | <option value="1">采购入库</option> | 
|---|
|  |  |  | <option value="2">中间品入库</option> | 
|---|
|  |  |  | <option value="3">退货入库</option> | 
|---|
|  |  |  | <option value="4">余料退回入库</option> | 
|---|
|  |  |  | <option value="8">生产退料入库</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | {{ GetBtn(d) }} | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="templetLotNo"> | 
|---|
|  |  |  | {{# function GetBtn1(d){ | 
|---|
|  |  |  | var html = ''; | 
|---|
|  |  |  | var TypeValue = $("#Type").val(); | 
|---|
|  |  |  | if(TypeValue=='1' || TypeValue=='5' || TypeValue=='6' || TypeValue=='7'){ | 
|---|
|  |  |  | if(d.LotNo==null || d.LotNo==undefined || d.LotNo==''){ | 
|---|
|  |  |  | html+= '<input type="text" class="input-dis" value="" disabled>'; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | html+= '<input type="text" class="input-dis" value="'+d.LotNo+'" disabled>'; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return html; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | if(d.LotNo!=null && d.LotNo!=undefined && d.LotNo!=''){ | 
|---|
|  |  |  | return d.LotNo; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return ''; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | {{ GetBtn1(d) }} | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- #endregion --> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | { field: 'Id', title: '入库单明细ID', width: 120, align: 'center', fixed: 'left', hide: true, "disabled": true }, | 
|---|
|  |  |  | { field: 'SkuNo', title: '物料编码', minWidth: 100, align: 'center', fixed: 'left', "disabled": true }, | 
|---|
|  |  |  | { field: 'SkuName', title: '物料名称', minWidth: 180, align: 'center', fixed: 'left', "disabled": true }, | 
|---|
|  |  |  | { field: 'LotNo', title: '批次号', align: 'center', edit: 'text', minWidth: 130, fixed: 'left', templet: '#templetLotNo', "disabled": true }, | 
|---|
|  |  |  | { field: 'SupplierLot', title: '供货批次', width: 130, edit: 'text', event: 'setSign', fixed: 'left', "disabled": true }, | 
|---|
|  |  |  | { field: 'LotNo', title: '批次号', align: 'center', edit: 'text', event: 'setlot', width: 130, fixed: 'left', "disabled": true }, | 
|---|
|  |  |  | { field: 'SupplierLot', title: '供货批次', align: 'center', width: 130, edit: 'text', event: 'setSign', fixed: 'left', "disabled": true }, | 
|---|
|  |  |  | { field: 'Qty', title: '数量', align: 'center', width: 80, edit: 'number', event: 'dataNumber', fixed: 'left', "disabled": true }, | 
|---|
|  |  |  | { field: 'UnitName', title: '计量单位', align: 'center', width: 70 }, | 
|---|
|  |  |  | { field: 'Standard', title: '规格', width: 160, align: 'center' }, | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | colsJson = TotalColsArr | 
|---|
|  |  |  | } | 
|---|
|  |  |  | console.log(colsJson); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | infoOptions = { | 
|---|
|  |  |  | elem: '#LAY-app-content-list', | 
|---|
|  |  |  | height: 'full-110', | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else { | 
|---|
|  |  |  | // 添加的时候移除‘采购入库’项 | 
|---|
|  |  |  | $('select[lay-filter="Type"]').find('option[value="1"]').remove(); | 
|---|
|  |  |  | form.render('select'); // 更新layui的select渲染 | 
|---|
|  |  |  | // $('select[lay-filter="Type"]').find('option[value="1"]').remove(); | 
|---|
|  |  |  | // form.render('select'); // 更新layui的select渲染 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 采购入库、其它入库 | 
|---|
|  |  |  | 1、5 | 
|---|
|  |  |  | 2:货主 | 
|---|
|  |  |  | 成品入库、中间品入库、车间余料入库、代储入库 | 
|---|
|  |  |  | 0、2、4、6 | 
|---|
|  |  |  | 成品入库、中间品入库、车间余料入库、代储入库 生产退料入库 | 
|---|
|  |  |  | 0、2、4、6 8 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function (res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | 
|---|
|  |  |  | case "7": //寄存入库 | 
|---|
|  |  |  | TypeNum = 2; | 
|---|
|  |  |  | console.log(TypeNum) | 
|---|
|  |  |  | case "8": //生产退料入库 | 
|---|
|  |  |  | TypeNum = 2; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | for (var i in data) { | 
|---|
|  |  |  | var isHave = false; | 
|---|
|  |  |  | for (var j in arr) { | 
|---|
|  |  |  | if (arr[j].SkuNo == data[i].SkuNo | 
|---|
|  |  |  | // 注释 liudl 若存在同一物料不同批次物料 放开此注释,后端已验证是否重复 | 
|---|
|  |  |  | //&& arr[j].LotNo == data[i].LotNo | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if (arr[j].SkuNo == data[i].SkuNo) | 
|---|
|  |  |  | // 注释 liudl 若存在同一物料不同批次物料 放开此注释,后端已验证是否重复 | 
|---|
|  |  |  | //&& arr[j].LotNo == data[i].LotNo | 
|---|
|  |  |  | { | 
|---|
|  |  |  | isHave = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 1, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { | 
|---|
|  |  |  | parent.location.reload(); | 
|---|
|  |  |  | parent.layer.close(layer.index); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | switch ($("#Type").val()) { | 
|---|
|  |  |  | //1:采购入库 2:中间品入库 5:其它入库 6:代储入库 7:寄存入库 | 
|---|
|  |  |  | case "1": | 
|---|
|  |  |  |  | 
|---|
|  |  |  | case "2": | 
|---|
|  |  |  | case "5": | 
|---|
|  |  |  | case "6": | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | console.log(TypeNum) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (TypeNum == 0) { | 
|---|
|  |  |  | layer.msg("请输入批次!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return -1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // if (TypeNum == 0) { | 
|---|
|  |  |  | //    layer.msg("请输入批次!", { | 
|---|
|  |  |  | //       icon: 2, | 
|---|
|  |  |  | //       time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | //    }); | 
|---|
|  |  |  | //    return -1; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!reg.test(arr[i].Qty)) { | 
|---|
|  |  |  | layer.msg("入库数量必须是大于0的整数", { | 
|---|
|  |  |  | var qtyValue = arr[i].Qty; | 
|---|
|  |  |  | // 尝试将值转换为数字 | 
|---|
|  |  |  | var num = Number(qtyValue); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 验证规则:必须是有效数字、大于0、小数位数不超过4位 | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | isNaN(num) ||  // 不是有效数字   T2500009   地码 B010109 | 
|---|
|  |  |  | num <= 0 ||    // 小于等于0 | 
|---|
|  |  |  | // 检查小数位数(先转为字符串处理) | 
|---|
|  |  |  | (qtyValue.toString().indexOf('.') !== -1 && | 
|---|
|  |  |  | qtyValue.toString().split('.')[1].length > 4) | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | layer.msg("入库数量必须是大于0的数", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | time: 2000 | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return -1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var item = { | 
|---|
|  |  |  | Id: arr[i].Id, | 
|---|
|  |  |  | 
|---|
|  |  |  | Standard: arr[i].Standard, | 
|---|
|  |  |  | LotNo: arr[i].LotNo, | 
|---|
|  |  |  | LotText: arr[i].LotText, | 
|---|
|  |  |  | Qty: parseInt(arr[i].Qty), | 
|---|
|  |  |  | Qty: Number(qtyValue),////decimal | 
|---|
|  |  |  | PackagNo: arr[i].PackagNo, | 
|---|
|  |  |  | Price: arr[i].Price, | 
|---|
|  |  |  | IsBale: arr[i].IsBale, | 
|---|