|  |  |  | 
|---|
|  |  |  | <!DOCTYPE html> | 
|---|
|  |  |  | <html> | 
|---|
|  |  |  | <head> | 
|---|
|  |  |  | <meta charset="utf-8"> | 
|---|
|  |  |  | <title>添加出库单</title> | 
|---|
|  |  |  | <meta name="renderer" content="webkit"> | 
|---|
|  |  |  | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|---|
|  |  |  | <meta name="viewport" | 
|---|
|  |  |  | content="width=device-width, initial-scale=1.0, minExum-scale=1.0, maxExum-scale=1.0, user-scalable=0"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all"> | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | <head> | 
|---|
|  |  |  | <meta charset="utf-8"> | 
|---|
|  |  |  | <title>添加出库单</title> | 
|---|
|  |  |  | <meta name="renderer" content="webkit"> | 
|---|
|  |  |  | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|---|
|  |  |  | <meta name="viewport" | 
|---|
|  |  |  | content="width=device-width, initial-scale=1.0, minExum-scale=1.0, maxExum-scale=1.0, user-scalable=0"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all"> | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | .isShow{ | 
|---|
|  |  |  | display: block; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | display: block; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .isNoShow{ | 
|---|
|  |  |  | display: none; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | </head> | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  | <div class="layui-form" lay-filter="layuiadmin-app-form-list" style="padding: 20px 0 0 0;"> | 
|---|
|  |  |  | <div class="layui-form-item" style="margin-bottom: 0px;"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label">单据类型</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="Type" id="Type" lay-filter="Type" lay-verify="required" lay-search> | 
|---|
|  |  |  | <!-- <option value=""></option> --> | 
|---|
|  |  |  | <!--JC26--> | 
|---|
|  |  |  | <option value="0">成品出库</option> | 
|---|
|  |  |  | <option value="1">领料出库</option> | 
|---|
|  |  |  | <option value="2">抽检出库</option> | 
|---|
|  |  |  | <option value="4">不合格品出库</option> | 
|---|
|  |  |  | <option value="7">其他出库</option> | 
|---|
|  |  |  | <option value="9">生产领料出库</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label">出库仓库</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="WarehouseId" id="WarehouseId" lay-filter="WarehouseId" lay-verify="required" lay-search> | 
|---|
|  |  |  | <option value=""></option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label" id="CustomerNamep">客户名称</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="CustomerNo" id="CustomerNo" lay-search> | 
|---|
|  |  |  | <option value=""></option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline " id="chengyunshang"> | 
|---|
|  |  |  | <label class="layui-form-label">承运商</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="LogisticsId" id="LogisticsId" lay-search> | 
|---|
|  |  |  | <option value=""></option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div style="padding-bottom: 2px;margin-left: 15px;"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layuiadmin-btn-list" data-type="add">添加明细</button> | 
|---|
|  |  |  | <button type="submit" class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit="" | 
|---|
|  |  |  | lay-filter="form1">立即提交</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | display: none; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | </head> | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  | <div class="layui-form" lay-filter="layuiadmin-app-form-list" style="padding: 20px 0 0 0;"> | 
|---|
|  |  |  | <div class="layui-form-item" style="margin-bottom: 0px;"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label">单据类型</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="Type" id="Type" lay-filter="Type" lay-verify="required" lay-search> | 
|---|
|  |  |  | <!-- <option value=""></option> --> | 
|---|
|  |  |  | <!--JC26--> | 
|---|
|  |  |  | <option value="0">成品出库</option> | 
|---|
|  |  |  | <option value="1">领料出库</option> | 
|---|
|  |  |  | <option value="2">抽检出库</option> | 
|---|
|  |  |  | <option value="4">不合格品出库</option> | 
|---|
|  |  |  | <option value="7">其他出库</option> | 
|---|
|  |  |  | <option value="9">生产领料出库</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <table id="LAY-app-content-list" name="LAY-app-content-list" lay-filter="LAY-app-content-list"></table> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- <script type="text/html" id="switchTpl"> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label">出库仓库</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="WarehouseId" id="WarehouseId" lay-filter="WarehouseId" lay-verify="required" | 
|---|
|  |  |  | lay-search> | 
|---|
|  |  |  | <option value=""></option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label" id="CustomerNamep">客户名称</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="CustomerNo" id="CustomerNo" lay-search> | 
|---|
|  |  |  | <option value=""></option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline " id="chengyunshang"> | 
|---|
|  |  |  | <label class="layui-form-label">承运商</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="LogisticsId" id="LogisticsId" lay-search> | 
|---|
|  |  |  | <option value=""></option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div style="padding-bottom: 2px;margin-left: 15px;"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layuiadmin-btn-list" data-type="add">添加明细</button> | 
|---|
|  |  |  | <button type="submit" class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit="" | 
|---|
|  |  |  | lay-filter="form1">立即提交</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <table id="LAY-app-content-list" name="LAY-app-content-list" lay-filter="LAY-app-content-list"></table> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- <script type="text/html" id="switchTpl"> | 
|---|
|  |  |  | <input type="checkbox" name="IsBale" value="{{d.LAY_TABLE_INDEX}}" lay-skin="switch" lay-text="是|否" lay-filter="IsBaleDemo" {{ d.IsBale == "1" ? 'checked' : '' }}> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <script type="text/html" id="checkboxTpl"> | 
|---|
|  |  |  | <input type="checkbox" name="IsBelt" value="{{d.LAY_TABLE_INDEX}}" lay-skin="switch" lay-text="是|否" lay-filter="IsBeltDemo" {{ d.IsBelt == "1" ? 'checked' : '' }}> | 
|---|
|  |  |  | </script>    --> | 
|---|
|  |  |  | <script type="text/html" id="table-content-list"> | 
|---|
|  |  |  | <script type="text/html" id="table-content-list"> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"> <i | 
|---|
|  |  |  | class="layui-icon layui-icon-delete"></i>删除</a> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script src="../../layuiadmin/layui/layui.js"></script> | 
|---|
|  |  |  | <script src="../../js/public.js"></script> | 
|---|
|  |  |  | <script src="../../js/jquery-3.5.1.min.js"></script> | 
|---|
|  |  |  | <script src="../../js/jquery.cookie.js"></script> | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: '../../layuiadmin/' //静态资源所在路径 | 
|---|
|  |  |  | }).extend({ | 
|---|
|  |  |  | index: 'lib/index' //主入口模块 | 
|---|
|  |  |  | }).use(['index', 'form', 'layer', 'laydate', 'table','jquery'], function() { | 
|---|
|  |  |  | var $ = layui.$, | 
|---|
|  |  |  | form = layui.form, | 
|---|
|  |  |  | table = layui.table, | 
|---|
|  |  |  | layer = layui.layer; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | getWareHouseList(); | 
|---|
|  |  |  | getCustomerList(); | 
|---|
|  |  |  | getLogisticsInfoList(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | window.success = function(data) { | 
|---|
|  |  |  | console.log(data); | 
|---|
|  |  |  | refreshTable(data); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | <script src="../../layuiadmin/layui/layui.js"></script> | 
|---|
|  |  |  | <script src="../../js/public.js"></script> | 
|---|
|  |  |  | <script src="../../js/jquery-3.5.1.min.js"></script> | 
|---|
|  |  |  | <script src="../../js/jquery.cookie.js"></script> | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: '../../layuiadmin/' //静态资源所在路径 | 
|---|
|  |  |  | }).extend({ | 
|---|
|  |  |  | index: 'lib/index' //主入口模块 | 
|---|
|  |  |  | }).use(['index', 'form', 'layer', 'laydate', 'table', 'jquery'], function () { | 
|---|
|  |  |  | var $ = layui.$, | 
|---|
|  |  |  | form = layui.form, | 
|---|
|  |  |  | table = layui.table, | 
|---|
|  |  |  | layer = layui.layer; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var arr = []; | 
|---|
|  |  |  | var TypeValue=$("#Type").val(); | 
|---|
|  |  |  | function refreshTable(data) { | 
|---|
|  |  |  | //table.clear(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (var i in data) { | 
|---|
|  |  |  | var isHave = false; | 
|---|
|  |  |  | data[i].ExQty = 0; | 
|---|
|  |  |  | data[i].IsBale="0"; | 
|---|
|  |  |  | data[i].IsBelt="0"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for(var j in arr){ | 
|---|
|  |  |  | if(arr[j].SkuNo == data[i].SkuNo && arr[j].LotNo == data[i].LotNo){ | 
|---|
|  |  |  | isHave = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | getWareHouseList(); | 
|---|
|  |  |  | getCustomerList(); | 
|---|
|  |  |  | getLogisticsInfoList(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | window.success = function (data) { | 
|---|
|  |  |  | console.log(data); | 
|---|
|  |  |  | refreshTable(data); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var arr = []; | 
|---|
|  |  |  | var TypeValue = $("#Type").val(); | 
|---|
|  |  |  | function refreshTable(data) { | 
|---|
|  |  |  | //table.clear(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (var i in data) { | 
|---|
|  |  |  | var isHave = false; | 
|---|
|  |  |  | data[i].ExQty = 0; | 
|---|
|  |  |  | data[i].IsBale = "0"; | 
|---|
|  |  |  | data[i].IsBelt = "0"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (var j in arr) { | 
|---|
|  |  |  | if (arr[j].SkuNo == data[i].SkuNo && arr[j].LotNo == data[i].LotNo) { | 
|---|
|  |  |  | isHave = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(isHave){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | arr.push(data[i]); //属性 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | $.extend(infoOptions, { | 
|---|
|  |  |  | data: arr | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | infoOptions.page = { | 
|---|
|  |  |  | curr: 1 | 
|---|
|  |  |  | if (isHave) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | table.render(infoOptions); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | arr.push(data[i]); //属性 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var infoOptions = { | 
|---|
|  |  |  | elem: '#LAY-app-content-list', | 
|---|
|  |  |  | height: 'full-160', | 
|---|
|  |  |  | id: 'LAY-app-content-list', | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | limit: pageCnt, | 
|---|
|  |  |  | limits: pageLimits, | 
|---|
|  |  |  | cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增 | 
|---|
|  |  |  | cols: [ | 
|---|
|  |  |  | [{ | 
|---|
|  |  |  | field: 'SkuNo', | 
|---|
|  |  |  | title: '物品编码', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | fixed: 'left', | 
|---|
|  |  |  | width:140, | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'SkuName', | 
|---|
|  |  |  | title: '物品名称', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | fixed: 'left', | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'LotNo', | 
|---|
|  |  |  | title: '批次', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | minWidth:140, | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'Standard', | 
|---|
|  |  |  | title: '物品规格', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'Qty', | 
|---|
|  |  |  | title: '库存数量', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | width:100, | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'ExQty', | 
|---|
|  |  |  | title: '出库数量', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | width:100, | 
|---|
|  |  |  | edit: 'number', | 
|---|
|  |  |  | event: 'dataNumber' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //    field:'IsBale', | 
|---|
|  |  |  | //    title:'是否裹包', | 
|---|
|  |  |  | //    width:90, | 
|---|
|  |  |  | //    templet: '#switchTpl', | 
|---|
|  |  |  | //    unresize: true //是否禁用拖拽列宽 | 
|---|
|  |  |  | // }, { | 
|---|
|  |  |  | //    field:'IsBelt', | 
|---|
|  |  |  | //    title:'是否打带', | 
|---|
|  |  |  | //    width:90, | 
|---|
|  |  |  | //    templet: '#checkboxTpl', | 
|---|
|  |  |  | //    unresize: true //是否禁用拖拽列宽 | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: '操作', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | width:90, | 
|---|
|  |  |  | templet: '#table-content-list', | 
|---|
|  |  |  | fixed: 'right', | 
|---|
|  |  |  | }] | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | // //监听裹包操作 | 
|---|
|  |  |  | // form.on('switch(IsBaleDemo)', function(obj){ | 
|---|
|  |  |  | //    if (obj.elem.checked) { | 
|---|
|  |  |  | //       for (var k in arr) { | 
|---|
|  |  |  | //          if (arr[k].LAY_TABLE_INDEX == obj.value) { | 
|---|
|  |  |  | //             arr[k].IsBale = "1"; | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    }else{ | 
|---|
|  |  |  | //       for (var k in arr) { | 
|---|
|  |  |  | //          if (arr[k].LAY_TABLE_INDEX == obj.value) { | 
|---|
|  |  |  | //             arr[k].IsBale = "0"; | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // //监听打带操作 | 
|---|
|  |  |  | // form.on('switch(IsBeltDemo)', function(obj){ | 
|---|
|  |  |  | //    if (obj.elem.checked) { | 
|---|
|  |  |  | //       for (var k in arr) { | 
|---|
|  |  |  | //          if (arr[k].LAY_TABLE_INDEX == obj.value) { | 
|---|
|  |  |  | //             arr[k].IsBelt = "1"; | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    }else{ | 
|---|
|  |  |  | //       for (var k in arr) { | 
|---|
|  |  |  | //          if (arr[k].LAY_TABLE_INDEX == obj.value) { | 
|---|
|  |  |  | //             arr[k].IsBelt = "0"; | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | //初始渲染 | 
|---|
|  |  |  | refreshTable(null); | 
|---|
|  |  |  | var $ = layui.$; | 
|---|
|  |  |  | var   active = { | 
|---|
|  |  |  | add: function() { | 
|---|
|  |  |  | if ($("#WarehouseId").val()== "") { | 
|---|
|  |  |  | layer.msg("请选择仓库!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | },function() {}); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ($("#Type").val()== "") { | 
|---|
|  |  |  | layer.msg("请选择单据类型!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | },function() {}); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if($("#Type").val()=='6'){ | 
|---|
|  |  |  | if($("#CustomerNo").val()==''){ | 
|---|
|  |  |  | layer.msg("代储单据请选择货主!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | console.log($("#WarehouseId").val()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '选择物品信息', | 
|---|
|  |  |  | content: 'ExportSelectSkuFrom.html?houseId='+$("#WarehouseId").val()+'&Type='+$("#Type").val()+'&OwnerNo='+$("#CustomerNo").val(), | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: ['950px', '90%'], | 
|---|
|  |  |  | fixed: false, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | $('.layui-btn.layuiadmin-btn-list').on('click', function() { | 
|---|
|  |  |  | var type = $(this).data('type'); | 
|---|
|  |  |  | active[type] ? active[type].call(this) : ''; | 
|---|
|  |  |  | $.extend(infoOptions, { | 
|---|
|  |  |  | data: arr | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | infoOptions.page = { | 
|---|
|  |  |  | curr: 1 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | table.render(infoOptions); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | table.on('tool(LAY-app-content-list)', function(obj) { | 
|---|
|  |  |  | var data = obj.data; | 
|---|
|  |  |  | if (obj.event === 'del') { | 
|---|
|  |  |  | var ii = -1; | 
|---|
|  |  |  | for (var j in arr) { | 
|---|
|  |  |  | if (obj.data.SkuNo == arr[j].SkuNo && arr[j].LotNo == obj.data.LotNo) { | 
|---|
|  |  |  | ii = j; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var infoOptions = { | 
|---|
|  |  |  | elem: '#LAY-app-content-list', | 
|---|
|  |  |  | height: 'full-160', | 
|---|
|  |  |  | id: 'LAY-app-content-list', | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | limit: pageCnt, | 
|---|
|  |  |  | limits: pageLimits, | 
|---|
|  |  |  | cellMinWidth: 60, | 
|---|
|  |  |  | cols: [ | 
|---|
|  |  |  | [{ | 
|---|
|  |  |  | field: 'SkuNo', | 
|---|
|  |  |  | title: '物品编码', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | fixed: 'left', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'SkuName', | 
|---|
|  |  |  | title: '物品名称', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | fixed: 'left', | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'LotNo', | 
|---|
|  |  |  | title: '批次', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | minWidth: 140, | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'Standard', | 
|---|
|  |  |  | title: '物品规格', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'Qty', | 
|---|
|  |  |  | title: '库存数量', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | width: 100, | 
|---|
|  |  |  | // 格式化库存数量显示为4位小数 | 
|---|
|  |  |  | templet: function (d) { | 
|---|
|  |  |  | return parseFloat(d.Qty).toFixed(4); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (ii > -1) { | 
|---|
|  |  |  | arr.splice(ii, 1); | 
|---|
|  |  |  | obj.del(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (obj.event === 'dataNumber') { | 
|---|
|  |  |  | $(".layui-input.layui-table-edit").attr("type", "number"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | field: 'ExQty', | 
|---|
|  |  |  | title: '出库数量', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | width: 100, | 
|---|
|  |  |  | edit: 'text', // 改为text支持小数输入 | 
|---|
|  |  |  | event: 'dataNumber' | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | title: '操作', | 
|---|
|  |  |  | align: 'center', | 
|---|
|  |  |  | width: 90, | 
|---|
|  |  |  | templet: '#table-content-list', | 
|---|
|  |  |  | fixed: 'right', | 
|---|
|  |  |  | }] | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //    field:'IsBale', | 
|---|
|  |  |  | //    title:'是否裹包', | 
|---|
|  |  |  | //    width:90, | 
|---|
|  |  |  | //    templet: '#switchTpl', | 
|---|
|  |  |  | //    unresize: true //是否禁用拖拽列宽 | 
|---|
|  |  |  | // }, { | 
|---|
|  |  |  | //    field:'IsBelt', | 
|---|
|  |  |  | //    title:'是否打带', | 
|---|
|  |  |  | //    width:90, | 
|---|
|  |  |  | //    templet: '#checkboxTpl', | 
|---|
|  |  |  | //    unresize: true //是否禁用拖拽列宽 | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | // //监听裹包操作 | 
|---|
|  |  |  | // form.on('switch(IsBaleDemo)', function(obj){ | 
|---|
|  |  |  | //    if (obj.elem.checked) { | 
|---|
|  |  |  | //       for (var k in arr) { | 
|---|
|  |  |  | //          if (arr[k].LAY_TABLE_INDEX == obj.value) { | 
|---|
|  |  |  | //             arr[k].IsBale = "1"; | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | form.verify({ | 
|---|
|  |  |  | emptyNo: function(value) { | 
|---|
|  |  |  | if (value == '') { | 
|---|
|  |  |  | return ''; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | var ver = /^[0-9]+$/; | 
|---|
|  |  |  | if (!ver.test(value)) { | 
|---|
|  |  |  | return '只能输入正整数'; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | var isrun = 0; | 
|---|
|  |  |  | form.on('submit(form1)', function(data) { | 
|---|
|  |  |  | if(isrun == 1){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | isrun = 1; | 
|---|
|  |  |  | if (infoOptions.data == 0) { | 
|---|
|  |  |  | layer.msg("请添加明细!", { | 
|---|
|  |  |  | //    }else{ | 
|---|
|  |  |  | //       for (var k in arr) { | 
|---|
|  |  |  | //          if (arr[k].LAY_TABLE_INDEX == obj.value) { | 
|---|
|  |  |  | //             arr[k].IsBale = "0"; | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // //监听打带操作 | 
|---|
|  |  |  | // form.on('switch(IsBeltDemo)', function(obj){ | 
|---|
|  |  |  | //    if (obj.elem.checked) { | 
|---|
|  |  |  | //       for (var k in arr) { | 
|---|
|  |  |  | //          if (arr[k].LAY_TABLE_INDEX == obj.value) { | 
|---|
|  |  |  | //             arr[k].IsBelt = "1"; | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    }else{ | 
|---|
|  |  |  | //       for (var k in arr) { | 
|---|
|  |  |  | //          if (arr[k].LAY_TABLE_INDEX == obj.value) { | 
|---|
|  |  |  | //             arr[k].IsBelt = "0"; | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //初始渲染 | 
|---|
|  |  |  | refreshTable(null); | 
|---|
|  |  |  | var $ = layui.$; | 
|---|
|  |  |  | var active = { | 
|---|
|  |  |  | add: function () { | 
|---|
|  |  |  | if ($("#WarehouseId").val() == "") { | 
|---|
|  |  |  | layer.msg("请选择仓库!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | }, function () { }); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var type= $("#Type").val(); | 
|---|
|  |  |  | if(type=='6'){ | 
|---|
|  |  |  | var CustomerNo=$("#CustomerNo").val(); | 
|---|
|  |  |  | if(CustomerNo==''){ | 
|---|
|  |  |  | if ($("#Type").val() == "") { | 
|---|
|  |  |  | layer.msg("请选择单据类型!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { }); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ($("#Type").val() == '6') { | 
|---|
|  |  |  | if ($("#CustomerNo").val() == '') { | 
|---|
|  |  |  | layer.msg("代储单据请选择货主!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var DataList = []; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (var i in infoOptions.data) { | 
|---|
|  |  |  | console.log(infoOptions.data[i].ExQty); | 
|---|
|  |  |  | if (infoOptions.data[i].ExQty == "") { | 
|---|
|  |  |  | layer.msg("请输入出库数量!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(infoOptions.data[i].ExQty.indexOf('.')>=0){ | 
|---|
|  |  |  | layer.msg("出库数量必须是大于0的整数", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(infoOptions.data[i].ExQty.indexOf('-')>=0){ | 
|---|
|  |  |  | layer.msg("出库数量必须是大于0的整数", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(infoOptions.data[i].ExQty.charAt(0)=='0'){ | 
|---|
|  |  |  | layer.msg("出库数量必须是大于0的整数", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (infoOptions.data[i].ExQty <= 0) { | 
|---|
|  |  |  | layer.msg("出库数量必须大于0!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (infoOptions.data[i].ExQty > infoOptions.data[i].Qty) { | 
|---|
|  |  |  | layer.msg("出库数量不能大于库存数量!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var item = { | 
|---|
|  |  |  | SkuNo: infoOptions.data[i].SkuNo, | 
|---|
|  |  |  | LotNo: infoOptions.data[i].LotNo, | 
|---|
|  |  |  | Qty: parseInt(infoOptions.data[i].ExQty), | 
|---|
|  |  |  | IsBale:infoOptions.data[i].IsBale, | 
|---|
|  |  |  | IsBelt:infoOptions.data[i].IsBelt, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | DataList.push(item); //属性 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var param = { | 
|---|
|  |  |  | Type: data.field.Type, | 
|---|
|  |  |  | CustomerNo: data.field.CustomerNo, | 
|---|
|  |  |  | WareHouseNo:data.field.WarehouseId, | 
|---|
|  |  |  | LogisticsId: parseInt(data.field.LogisticsId), | 
|---|
|  |  |  | Detail: DataList | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sendData(IP + "/BllSo/AddExportNotice", param, 'post', function(res) { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 1, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() { | 
|---|
|  |  |  | parent.location.reload(); | 
|---|
|  |  |  | parent.layer.close(layer.index); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | } else if(res.code == 1) { //不成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //下拉单据类型选中后事件 | 
|---|
|  |  |  | form.on('select(Type)', function(data) { | 
|---|
|  |  |  | var value = data.value; | 
|---|
|  |  |  | if(value!=TypeValue){ | 
|---|
|  |  |  | getCustomerList(); | 
|---|
|  |  |  | arr = []; | 
|---|
|  |  |  | // 渲染Table | 
|---|
|  |  |  | refreshTable(null); | 
|---|
|  |  |  | TypeValue=value; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | //获取仓库信息 | 
|---|
|  |  |  | function getWareHouseList(){ | 
|---|
|  |  |  | sendData(IP + "/Sys/GetWarehouseDic", {}, 'get', function(res) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | $("#WarehouseId").empty(); | 
|---|
|  |  |  | $("#WarehouseId").append('<option value =""></option>'); | 
|---|
|  |  |  | for (var i = 0; i < res.data.length; i++) { | 
|---|
|  |  |  | $("#WarehouseId").append('<option value =' + res.data[i].WareHouseNo + '>' + | 
|---|
|  |  |  | res.data[i].WareHouseName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //$("#WarehouseId option[value='W01']").attr("selected", "selected") | 
|---|
|  |  |  | form.render('select'); | 
|---|
|  |  |  | } else { //不成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | console.log($("#WarehouseId").val()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '选择物品信息', | 
|---|
|  |  |  | content: 'ExportSelectSkuFrom.html?houseId=' + $("#WarehouseId").val() + '&Type=' + $("#Type").val() + '&OwnerNo=' + $("#CustomerNo").val(), | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: ['950px', '90%'], | 
|---|
|  |  |  | fixed: false, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //获取客户下拉框信息 | 
|---|
|  |  |  | function getCustomerList() { | 
|---|
|  |  |  | sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function(res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | $("#CustomerNo").empty(); | 
|---|
|  |  |  | $("#CustomerNo").append('<option value =""></option>'); | 
|---|
|  |  |  | for (var i = 0; i < res.data.length; i++) { | 
|---|
|  |  |  | var TypeNum = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | switch($("#Type").val()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | case "0": //成品出库 | 
|---|
|  |  |  | TypeNum = 0; | 
|---|
|  |  |  | console.log(TypeNum) | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "1": //领料出库 | 
|---|
|  |  |  | case "2": //抽检出库 | 
|---|
|  |  |  | case "3": //物料取样出库 | 
|---|
|  |  |  | case "4": //不合格品出库 | 
|---|
|  |  |  | case "5": //中间品出库 | 
|---|
|  |  |  | case "6": //代储出库 | 
|---|
|  |  |  | case "7": //其他出库 | 
|---|
|  |  |  | case "8": //寄存出库 | 
|---|
|  |  |  | TypeNum = 2; | 
|---|
|  |  |  | console.log(TypeNum) | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //判断单据类型 | 
|---|
|  |  |  | if (TypeNum == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (res.data[i].Type == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | $("#CustomerNamep").html("客户"); | 
|---|
|  |  |  | $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' + | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | $('.layui-btn.layuiadmin-btn-list').on('click', function () { | 
|---|
|  |  |  | var type = $(this).data('type'); | 
|---|
|  |  |  | active[type] ? active[type].call(this) : ''; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | table.on('tool(LAY-app-content-list)', function (obj) { | 
|---|
|  |  |  | var data = obj.data; | 
|---|
|  |  |  | if (obj.event === 'del') { | 
|---|
|  |  |  | var ii = -1; | 
|---|
|  |  |  | for (var j in arr) { | 
|---|
|  |  |  | if (obj.data.SkuNo == arr[j].SkuNo && arr[j].LotNo == obj.data.LotNo) { | 
|---|
|  |  |  | ii = j; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (ii > -1) { | 
|---|
|  |  |  | arr.splice(ii, 1); | 
|---|
|  |  |  | obj.del(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (obj.event === 'dataNumber') { | 
|---|
|  |  |  | $(".layui-input.layui-table-edit").attr("type", "number"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | form.verify({ | 
|---|
|  |  |  | emptyNo: function (value) { | 
|---|
|  |  |  | if (value == '') { | 
|---|
|  |  |  | return ''; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | var ver = /^[0-9]+$/; | 
|---|
|  |  |  | if (!ver.test(value)) { | 
|---|
|  |  |  | return '只能输入正整数'; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | var isrun = 0; | 
|---|
|  |  |  | form.on('submit(form1)', function (data) { | 
|---|
|  |  |  | if (isrun == 1) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | isrun = 1; | 
|---|
|  |  |  | if (infoOptions.data == 0) { | 
|---|
|  |  |  | layer.msg("请添加明细!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var type = $("#Type").val(); | 
|---|
|  |  |  | if (type == '6') { | 
|---|
|  |  |  | var CustomerNo = $("#CustomerNo").val(); | 
|---|
|  |  |  | if (CustomerNo == '') { | 
|---|
|  |  |  | layer.msg("代储单据请选择货主!", { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var DataList = []; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 只保留一个验证循环,移除重复代码 | 
|---|
|  |  |  | for (var i in infoOptions.data) { | 
|---|
|  |  |  | const exqtyStr = (infoOptions.data[i].ExQty || '').trim(); | 
|---|
|  |  |  | const stockQty = parseFloat(infoOptions.data[i].Qty) || 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 验证是否为空 | 
|---|
|  |  |  | if (exqtyStr === "") { | 
|---|
|  |  |  | layer.msg("请输入出库数量!", { icon: 2, time: 2000 }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 验证数字格式(支持正数和最多4位小数) | 
|---|
|  |  |  | const decimalRegex = /^(0|[1-9]\d*)(\.\d{1,4})?$/; | 
|---|
|  |  |  | if (!decimalRegex.test(exqtyStr)) { | 
|---|
|  |  |  | layer.msg("出库数量必须是大于0的数字,且最多保留4位小数!", { icon: 2, time: 2000 }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 转换为浮点数并处理精度 | 
|---|
|  |  |  | const precision = 10000; | 
|---|
|  |  |  | const exqty = Math.round(parseFloat(exqtyStr) * precision) / precision; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 验证是否大于0 | 
|---|
|  |  |  | if (exqty < 0) { | 
|---|
|  |  |  | layer.msg("出库数量必须大于0!", { icon: 2, time: 2000 }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 验证不超过库存数量 | 
|---|
|  |  |  | if (exqty > stockQty) { | 
|---|
|  |  |  | layer.msg("出库数量不能大于库存数量!", { icon: 2, time: 2000 }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 格式化出库数量为4位小数 | 
|---|
|  |  |  | const formattedExQty = exqty.toFixed(4); | 
|---|
|  |  |  | infoOptions.data[i].ExQty = formattedExQty; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 构建数据对象 | 
|---|
|  |  |  | var item = { | 
|---|
|  |  |  | SkuNo: infoOptions.data[i].SkuNo, | 
|---|
|  |  |  | LotNo: infoOptions.data[i].LotNo, | 
|---|
|  |  |  | Qty: parseFloat(formattedExQty),//parseFloat(infoOptions.data[i].Qty), // 保留4位小数精度 | 
|---|
|  |  |  | IsBale: infoOptions.data[i].IsBale, | 
|---|
|  |  |  | IsBelt: infoOptions.data[i].IsBelt, | 
|---|
|  |  |  | //ExQty: parseFloat(formattedExQty), | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | DataList.push(item); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var param = { | 
|---|
|  |  |  | Type: data.field.Type, | 
|---|
|  |  |  | CustomerNo: data.field.CustomerNo, | 
|---|
|  |  |  | WareHouseNo: data.field.WarehouseId, | 
|---|
|  |  |  | LogisticsId: parseInt(data.field.LogisticsId), | 
|---|
|  |  |  | Detail: DataList | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sendData(IP + "/BllSo/AddExportNotice", param, 'post', function (res) { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 1, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { | 
|---|
|  |  |  | parent.location.reload(); | 
|---|
|  |  |  | parent.layer.close(layer.index); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | } else if (res.code == 1) { //不成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { }); | 
|---|
|  |  |  | isrun = 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //下拉单据类型选中后事件 | 
|---|
|  |  |  | form.on('select(Type)', function (data) { | 
|---|
|  |  |  | var value = data.value; | 
|---|
|  |  |  | if (value != TypeValue) { | 
|---|
|  |  |  | getCustomerList(); | 
|---|
|  |  |  | arr = []; | 
|---|
|  |  |  | // 渲染Table | 
|---|
|  |  |  | refreshTable(null); | 
|---|
|  |  |  | TypeValue = value; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | //获取仓库信息 | 
|---|
|  |  |  | function getWareHouseList() { | 
|---|
|  |  |  | sendData(IP + "/Sys/GetWarehouseDic", {}, 'get', function (res) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | $("#WarehouseId").empty(); | 
|---|
|  |  |  | $("#WarehouseId").append('<option value =""></option>'); | 
|---|
|  |  |  | for (var i = 0; i < res.data.length; i++) { | 
|---|
|  |  |  | $("#WarehouseId").append('<option value =' + res.data[i].WareHouseNo + '>' + | 
|---|
|  |  |  | res.data[i].WareHouseName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //$("#WarehouseId option[value='W01']").attr("selected", "selected") | 
|---|
|  |  |  | form.render('select'); | 
|---|
|  |  |  | } else { //不成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //获取客户下拉框信息 | 
|---|
|  |  |  | function getCustomerList() { | 
|---|
|  |  |  | sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function (res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | $("#CustomerNo").empty(); | 
|---|
|  |  |  | $("#CustomerNo").append('<option value =""></option>'); | 
|---|
|  |  |  | for (var i = 0; i < res.data.length; i++) { | 
|---|
|  |  |  | var TypeNum = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | switch ($("#Type").val()) { | 
|---|
|  |  |  | case "0": //成品出库 | 
|---|
|  |  |  | TypeNum = 0; | 
|---|
|  |  |  | console.log(TypeNum) | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "1": //领料出库 | 
|---|
|  |  |  | case "2": //抽检出库 | 
|---|
|  |  |  | case "3": //物料取样出库 | 
|---|
|  |  |  | case "4": //不合格品出库 | 
|---|
|  |  |  | case "5": //中间品出库 | 
|---|
|  |  |  | case "6": //代储出库 | 
|---|
|  |  |  | case "7": //其他出库 | 
|---|
|  |  |  | case "8": //寄存出库 | 
|---|
|  |  |  | TypeNum = 2; | 
|---|
|  |  |  | console.log(TypeNum) | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //判断单据类型 | 
|---|
|  |  |  | if (TypeNum == 0) { | 
|---|
|  |  |  | if (res.data[i].Type == 0) { | 
|---|
|  |  |  | $("#CustomerNamep").html("客户"); | 
|---|
|  |  |  | $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' + | 
|---|
|  |  |  | res.data[i].CustomerName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (TypeNum == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (res.data[i].Type == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | $("#CustomerNamep").html("供应商"); | 
|---|
|  |  |  | $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' + | 
|---|
|  |  |  | res.data[i].CustomerName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (TypeNum == 2) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (res.data[i].Type == 2) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | $("#CustomerNamep").html("货主"); | 
|---|
|  |  |  | $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' + | 
|---|
|  |  |  | res.data[i].CustomerName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | form.render('select'); | 
|---|
|  |  |  | } else { //不成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | else if (TypeNum == 1) { | 
|---|
|  |  |  | if (res.data[i].Type == 1) { | 
|---|
|  |  |  | $("#CustomerNamep").html("供应商"); | 
|---|
|  |  |  | $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' + | 
|---|
|  |  |  | res.data[i].CustomerName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (TypeNum == 2) { | 
|---|
|  |  |  | if (res.data[i].Type == 2) { | 
|---|
|  |  |  | $("#CustomerNamep").html("货主"); | 
|---|
|  |  |  | $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' + | 
|---|
|  |  |  | res.data[i].CustomerName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //获取物流承运商下拉框信息 | 
|---|
|  |  |  | function getLogisticsInfoList() { | 
|---|
|  |  |  | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function(res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | $("#LogisticsId").empty(); | 
|---|
|  |  |  | $("#LogisticsId").append('<option value =""></option>'); | 
|---|
|  |  |  | for (var i = 0; i < res.data.length; i++) { | 
|---|
|  |  |  | $("#LogisticsId").append('<option value =' + res.data[i].Id + '>' + | 
|---|
|  |  |  | res.data[i].CarrierName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | form.render('select'); | 
|---|
|  |  |  | } else { //不成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function() {}); | 
|---|
|  |  |  | form.render('select'); | 
|---|
|  |  |  | } else { //不成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //获取物流承运商下拉框信息 | 
|---|
|  |  |  | function getLogisticsInfoList() { | 
|---|
|  |  |  | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function (res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | $("#LogisticsId").empty(); | 
|---|
|  |  |  | $("#LogisticsId").append('<option value =""></option>'); | 
|---|
|  |  |  | for (var i = 0; i < res.data.length; i++) { | 
|---|
|  |  |  | $("#LogisticsId").append('<option value =' + res.data[i].Id + '>' + | 
|---|
|  |  |  | res.data[i].CarrierName + '</option>'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  | </html> | 
|---|
|  |  |  | form.render('select'); | 
|---|
|  |  |  | } else { //不成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </html> | 
|---|