YL
2022-03-08 a3dcaa61406d1f48b6d464b471fa3b5e4b94d6d5
WebTM/views/²Ö´æ¹ÜÀí/ÌõÂëÉú³É/Gy_BarCodeBill.html
@@ -2,7 +2,7 @@
<html>
<head>
    <meta charset="utf-8" />
    <title>新增/编辑器具采购入库单</title>
    <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, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
@@ -13,6 +13,7 @@
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <style type="text/css">
        /*begin æ­¤æ ·å¼ç”¨äºŽæ¶ˆé™¤è¡Œå…ƒç´ ä¸­å¸ƒå±€å®½åº¦ä¸å¤Ÿçš„问题*/
@@ -23,7 +24,11 @@
        }
        /*end*/
        .layui-table-cell .layui-form-checkbox[lay-skin="primary"] {
            margin-left:35%;
            margin-left: 35%;
        }
        .layui-input-block {
            margin-left: 0px;
        }
    </style>
</head>
@@ -34,17 +39,17 @@
                <div class="layui-card">
                    <form id="form0" class="layui-form" lay-filter="component-form-group" action="">
                        <div class="layui-card-header">
                            <div class="layui-btn-group">
                                <button type="button" id="copy-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Copy">复制</button>
                                <button type="button" id="addnew-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Add">新增</button>
                                <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">保存</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">退出</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="planview">预览</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="print">打印</button>
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn" id="ToolPrint" lay-submit="" lay-filter="ToolPrint">打印</button>
                                <button type="button" class="layui-btn" id="ToolPreView" lay-submit="" lay-filter="ToolPreView">预览</button>
                                <button type="button" class="layui-btn" id="ToolTryPrint" lay-submit="" lay-filter="ToolTryPrint">试打印</button>
                                <button type="button" class="layui-btn" id="ToolCreate" lay-submit="" lay-filter="ToolCreate">生成</button>
                                <button type="button" class="layui-btn" id="ToolReset" lay-submit="" lay-filter="ToolReset">重置</button>
                                <button type="button" class="layui-btn" id="ToolStock" lay-submit="" lay-filter="ToolStock">库存</button>
                                <button type="button" class="layui-btn" id="ToolSynch" lay-submit="" lay-filter="ToolSynch">同步资料</button>
                                <button type="button" class="layui-btn" id="ToolBatch" lay-submit="" lay-filter="ToolBatch">批次</button>
                                <button type="button" class="layui-btn" id="ToolExit" lay-submit="" lay-filter="ToolExit">退出</button>
                            </div>
                        </div>
                        <div class="layui-card-body">
@@ -57,7 +62,6 @@
                                                <label class="layui-form-label">组织</label>
                                                <div class="layui-input-inline">
                                                    <select name="HOrgID" id="HOrgID" lay-filter="HOrgID" class="layui-input" value="" style="float:left;width:150px">
                                                    </select>
                                                </div>
                                            </div>
@@ -65,7 +69,6 @@
                                                <label class="layui-form-label">工厂代码</label>
                                                <div class="layui-input-inline">
                                                    <select name="HWorksNumber" id="HWorksNumber" lay-filter="HWorksNumber" class="layui-input" value="" style="float:left;width:150px">
                                                    </select>
                                                </div>
                                            </div>
@@ -108,7 +111,6 @@
                                                <label class="layui-form-label">条码类型</label>
                                                <div class="layui-input-inline">
                                                    <select name="HBarCodeType" id="HBarCodeType" lay-filter="HBarCodeType" class="layui-input" value="" style="float:left;width:150px">
                                                    </select>
                                                </div>
                                            </div>
@@ -119,10 +121,11 @@
                            </div>
                        </div>
                        <div class="layui-tab layui-tab-card" lay-filter="TabTest">
                        <div class="layui-tab layui-tab-card" lay-filter="tab-TabTest">
                            <ul class="layui-tab-title">
                                <li class="layui-this">物料信息</li>
                                <li>条码信息</li>
                                <li lay-id="1" class="layui-this">物料信息</li>
                                <li lay-id="2">条码信息</li>
                                <li lay-id="3">档案列表</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
@@ -130,6 +133,9 @@
                                </div>
                                <div class="layui-tab-item">
                                    <table class="layui-hide" id="mainTable1" lay-filter="mainTable1"></table>
                                </div>
                                <div class="layui-tab-item">
                                    <table class="layui-hide" id="mainTable2" lay-filter="mainTable2"></table>
                                </div>
                            </div>
                        </div>
@@ -147,11 +153,11 @@
                        </script>
                        <script type="text/html" id="switchTpl">
                            <!-- è¿™é‡Œçš„ checked çš„状态只是演示 -->
                            <input type="checkbox" name="checkbox" lay-skin="primary" lay-filter="HGiveAwayFlag">
                            <input type="checkbox" name="checkbox" value="{{d.HGiveAwayFlag}}" lay-skin="primary" lay-filter="HGiveAwayFlag" {{ d.HGiveAwayFlag == 1 ? 'checked' : '' }}>
                        </script>
                        <script type="text/html" id="switchTp2">
                            <!-- è¿™é‡Œçš„ checked çš„状态只是演示 -->
                            <input type="checkbox" name="checkbox" lay-skin="primary" lay-filter="HGiveAwayFlag">
                            <input type="checkbox" name="checkbox" lay-skin="primary" lay-filter="HGiveAwayFlag1">
                        </script>
                    </form>
                </div>
@@ -193,11 +199,11 @@
            //查询条件
            var option = [];
            var option1 = [];
            var option2 = [];
            var sWhere = "";
            var sBillType = "3801";
            //#endregion
            //#region è¿›å…¥é¡µé¢æ—¢åŠ è½½
            //初始化表单插件
            set_InitFrom();
@@ -210,10 +216,14 @@
            //初始化表格
            set_InitGrid();
            set_CountGrid();
            set_InitGrid2();
            //判断操作类型
            if (OperationType == 1) {//无源新增
                //初始基本信息赋值
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));      //单据日期
                set_AddFNew();
                set_AddFNew1();
                set_AddFNew2();
            }
            else if (OperationType == 3) {//编辑
                set_EditFromGrid(linterid);
@@ -229,7 +239,7 @@
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;;
                var AddRow = table.cache['mainTable'];
                var NewRow = { "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HBatchNo": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HQty": 0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "" };
                var NewRow = { "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HBatchNo": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HQty": 0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "" };
                console.log(NewRow);
                switch (obj.event) {
                    //新增一行
@@ -245,6 +255,60 @@
                set_GridDelete(obj);   //行内删除
                set_GridCellCheck(obj); //行内快捷键筛选
            });
            //监听单元格编辑  å•元格编辑后 å˜æ›´
            table.on('edit(mainTable)', function (obj) {
                // å•元格编辑之前的值
                var oldText = $(this).prev().text();
                var value = obj.value //得到修改后的值
                    , data = obj.data //得到所在行所有键值
                    , field = obj.field; //得到字段
                //layer.msg('[ID: ' + data.id + '] ' + field + ' å­—段更改为:' + value);
                switch (field) {
                    case "HQty":  //数量
                        value = isNaN(value) ? 0 : value;
                        var HMinQty = isNaN(data.HMinQty) ? 0 : data.HMinQty;
                        if (HMinQty == 0) {
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HQty: value,                                   //数量
                                HBQty: 0,                                      //箱数=数量/最小包装数量
                            });
                        }
                        else
                        {
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HQty: value,                                   //数量
                                HBQty: Math.ceil(value / HMinQty),             //箱数=数量/最小包装数量
                            });
                        }
                        break;
                    case "HMinQty":  //最小包装数量
                        value = isNaN(value) ? 0 : value;
                        var HQty = isNaN(data.HQty) ? 0 : data.HQty;
                        if (HQty == 0) //除数为0
                        {
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HMinQty: value,                                //最小包装数量
                                HBQty: 0,                                      //箱数=数量/最小包装数量
                            });
                        }
                        else {
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HMinQty: value,                                //最小包装数量
                                HBQty: Math.ceil(HQty / value),                //箱数=数量/最小包装数量
                            });
                        }
                        break;
                    default:
                }
            });
            //下拉框事件选择触发
            form.on('select(HSourceBillType)', function (data) {
                $("#HSourceBillNo").val("");
@@ -268,26 +332,9 @@
                    case '5':
                        return "委外订单";
                        break;
                    case '6':
                        return "退货通知单";
                        break;
                    case '7':
                        return "其他入库单";
                        break;
                    case '8':
                        return "直接调拨单";
                        break;
                    case '9':
                        return "采购退料单";
                        break;
                    case '10':
                        return "生产退料单";
                        break;
                    case '11':
                        return "组装拆卸单";
                        break;
                }
            }
            //表头信息源单信息弹窗
            form.on('submit(HSourceBillNoList)', function () {
                if ($("#HSourceBillType").val() == 0 || $("#HSourceBillType").val() == null) {
@@ -302,7 +349,7 @@
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '' + getSupType()+'列表',
                    title: '' + getSupType() + '列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['95%', '80%'],
@@ -310,8 +357,54 @@
                    content: [url, 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('layTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择单据数据');
                        }
                        var list = [];
                        var BillSelect = [];
                        for (var i = 0; i < checkStatus.data.length; i++) {
                            if (checkStatus.data[i].部门 != "" && checkStatus.data[i].部门 != null) {
                                list.push(checkStatus.data[i].部门)
                            }
                            BillSelect.push({ BillType: checkStatus.data[i].HBillType, BillTitle: getSupType(), BillNo: checkStatus.data[i].单据号, "BillMainID": checkStatus.data[i].HMainID, "BillSubID": checkStatus.data[i].HSubID, "SPID": 0, "BatchNo": "", "HAuxPropID": 0 });
                        }
                        if (isAllEqual(list))  //不允许选择不同部门
                        {
                            //获取选中数据
                            var GrdSelectData = JSON.stringify(BillSelect);
                            //获取选择的源单类型
                            var HSourceBillType = $("#HSourceBillType").find("option:selected").html();
                            //获取选择的条码类型
                            var HBarCodeType = $("#HBarCodeType").find("option:selected").html();
                            //获取当前登录人员
                            var UserName = sessionStorage["HUserName"];
                            var Str = GrdSelectData + ";" + HSourceBillType + ";" + HBarCodeType + ";" + UserName;
                            //通过选择的源单主子内码查找详细信息
                            $.ajax({
                                type: "post",
                                url: GetWEBURL() + "/Sc_BarCode/SelectReportFromBillList",
                                //contentType: 'application/json',
                                async: true,
                                dataType: "json",
                                data: { "msg": Str },
                                //traditional: true,
                                success: function (result) {
                                    if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                        table.reload('mainTable', {
                                            data: result.list // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                                        });
                                        //关闭当前frame
                                        layer.close(index);
                                    }
                                }
                            })
                        }
                        else {
                            layer.msg("不允许选择不同的部门数据!", { time: 1 * 2000, icon: 5 });
                        }
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
@@ -325,7 +418,56 @@
                    }
                });
            });
            function isAllEqual(array) {
                if (array.length > 0) {
                    return !array.some(function (value, index) {
                        return value !== array[0];
                    });
                } else {
                    return true;
                }
            }
            //条码生成
            form.on('submit(ToolCreate)', function (data) {
                var sSubStr = JSON.stringify(table.cache['mainTable']);
                //物料明细信息不为空判断
                if (!AllowLoadData(sSubStr))//数据验证
                {
                    return false;
                }
                //获取选择的组织
                var HOrgType = $("#HOrgID").find("option:selected").html();
                //获取选择的工厂代码
                var CampanyName = $("#HWorksNumber").find("option:selected").html();
                if (CampanyName == "" || CampanyName == null)
                {
                    CampanyName = "xxx";
                }
                //获取选择的源单类型
                var HSourceBillType = $("#HSourceBillType").find("option:selected").html();
                //获取选择的条码类型
                var HSelectBarCodeType = $("#HBarCodeType").find("option:selected").html();
                //获取当前登录人员
                //var UserName = sessionStorage["HUserName"];
                var UserName = "Admin";
                var sMainSub = sSubStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' + CampanyName + ';' + UserName;
                SaveBarCodeCreate(sMainSub);
            })
            //退出
            form.on('submit(ToolExit)', function (data) {
                if (linterid == undefined) {
                    //关闭页签
                    Pub_Close(2);
                }
                else {
                    //关闭页签
                    Pub_Close(1);
                }
            });
            //#endregion
            //#region æ­¤é¡µé¢æ‰€æœ‰æ–¹æ³•
@@ -359,8 +501,7 @@
                })
            }
            //获取工厂代码
            function set_HWorksNumber()
            {
            function set_HWorksNumber() {
                //获取工厂代码
                var Organization = '';
                $.ajax({
@@ -374,8 +515,7 @@
                            }
                            $("#HWorksNumber").append(Organization);
                            form.render('select');
                            if (result.list[0] != "" && result.list[0] != null)
                            {
                            if (result.list[0] != "" && result.list[0] != null) {
                                $('#HWorksNumber').find("option[value=" + result.list[0] + "]").attr("selected", true);
                                form.render('select') //再次渲染
                            }
@@ -385,8 +525,7 @@
                })
            }
            //获取条码类型
            function set_HBarCodeType()
            {
            function set_HBarCodeType() {
                //获取条码类型代码
                var Organization = '';
                $.ajax({
@@ -396,12 +535,12 @@
                        if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.list;
                            for (var i = 0; i < data.length; i++) {
                                Organization += '<option  style="color:blue;" value="' + i+ '">' + data[i] + '</option>';
                                Organization += '<option  style="color:blue;" value="' + i + '">' + data[i] + '</option>';
                            }
                            $("#HBarCodeType").append(Organization);
                            form.render('select');
                        }
                        $('#HBarCodeType').find("option[value=" + result.list[0]+ "]").attr("selected", true);
                        $('#HBarCodeType').find("option[value=" + result.list[0] + "]").attr("selected", true);
                        form.render('select') //再次渲染
                        layer.closeAll("loading");
                    }
@@ -413,29 +552,29 @@
                columns = [
                    { type: 'checkbox', fixed: 'left' }
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", width: 100 }
                    , { field: 'HSourceInterID', title: '源单主内码', edit: 'text', width: 100, hide: true }
                    , { field: 'HSourceEntryID', title: '源单子内码', edit: 'text', width: 100, hide: true }
                    , { field: 'HSourceBillNo', title: '源单单号', edit: 'text', event: 'HMaterCode', width: 100 }
                    , { field: 'HMaterID', title: '物料ID', edit: 'text', width: 100, hide: true }
                    , { field: 'HMaterNumber', title: '物料代码', edit: 'text', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', edit: 'text', width: 100 }
                    , { field: 'HMaterModel', title: '规格型号', edit: 'text', width: 100 }
                    , { field: 'HAuxPropID', title: '辅助属性ID', edit: 'text', width: 100, hide: true }
                    , { field: 'HAuxPropNumber', title: '辅助属性代码', edit: 'text', event: 'HUnitCode', width: 100 }
                    , { field: 'HAuxPropName', title: '辅助属性名称', edit: 'text', width: 100 }
                    , { field: 'HUnitID', title: '计量单位ID', edit: 'text', width: 100, hide: true }
                    , { field: 'HUnitCode', title: '计量单位代码', edit: 'text', event: 'HUnitCode', width: 100 }
                    , { field: 'HUnitName', title: '计量单位', edit: 'text', width: 100 }
                    , { field: 'HMainID', title: '源单主内码',  width: 100, hide: true }
                    , { field: 'HSubID', title: '源单子内码',  width: 100, hide: true }
                    , { field: 'HBillNo', title: '源单单号', width: 200 }
                    , { field: 'HMaterID', title: '物料ID',  width: 100, hide: true }
                    , { field: 'HMaterNumber', title: '物料代码', edit: 'text', event: 'HMaterNumber', width: 200 }
                    , { field: 'HMaterName', title: '物料名称',  width: 200 }
                    , { field: 'HMaterModel', title: '规格型号', width: 200 }
                    , { field: 'HAuxPropID', title: '辅助属性ID',  width: 100, hide: true }
                    , { field: 'HAuxPropNumber', title: '辅助属性代码', edit: 'text', event: 'HAuxPropNumber', width: 100 }
                    , { field: 'HAuxPropName', title: '辅助属性名称',  width: 100 }
                    , { field: 'HUnitID', title: '计量单位ID', width: 100, hide: true }
                    , { field: 'HUnitNumber', title: '计量单位代码', edit: 'text', event: 'HUnitNumber', width: 100 }
                    , { field: 'HUnitName', title: '计量单位',width: 100 }
                    , { field: 'HBatchNo', title: '批号', edit: 'text', width: 100 }
                    , { field: 'HGiveAwayFlag', title: '是否赠品', width: 100, templet: '#switchTpl', unresize: false }
                    , { field: 'HQty', title: '数量', edit: 'text', width: 100 }
                    , { field: 'HMinQty', title: '最小包装数', edit: 'text', width: 100 }
                    , { field: 'HBQty', title: '箱数', edit: 'text', width: 100 }
                    , { field: 'HBQty', title: '箱数', width: 100 }
                    , { field: 'HPackQty', title: '外箱数', edit: 'text', width: 100 }
                    , { field: 'HDate', title: '进料日期', edit: 'text', width: 100 }
                    , { field: 'HCusID', title: '客户ID', edit: 'text', width: 100, hide: true }
                    , { field: 'HCusNumber', title: '客户代码', edit: 'text', event: 'HWHCode', width: 120 }
                    , { field: 'HCusName', title: '客户名称', edit: 'text', width: 120 }
                    , { field: 'HDate', title: '进料日期',  width: 100 }
                    , { field: 'HCusID', title: '客户ID',  width: 100, hide: true }
                    , { field: 'HCusNumber', title: '客户代码', edit: 'text', event: 'HCusNumber', width: 120 }
                    , { field: 'HCusName', title: '客户名称', width: 120 }
                    , { field: 'HSeOrderBillNo', title: '销售订单号', width: 200 }
                    , { field: 'HRemark', title: '备注', edit: 'text', width: 100 }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
@@ -459,27 +598,26 @@
                columns = [
                    { type: 'checkbox', fixed: 'left' }
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", width: 100 }
                    , { field: '选择', title: '选择', width: 100 }
                    , { field: 'HBarCode', title: '条码编号',  width: 100 }
                    , { field: 'HMaterNumber', title: '物料代码', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', width: 100 }
                    , { field: 'HMaterModel', title: '规格型号', width: 100 }
                    , { field: 'HAuxPropNumber', title: '辅助属性代码', width: 100 }
                    , { field: 'HAuxPropName', title: '辅助属性', event: 'HWHCode', width: 120 }
                    , { field: 'HGiveAwayFlag', title: '是否赠品', width: 120, templet: '#switchTpl', unresize: false }
                    , { field: 'HUnitCode', title: '计量单位代码', width: 120 }
                    , { field: 'HUnitName', title: '计量单位', width: 120 }
                    , { field: 'HQty', title: '数量', width: 120 }
                    , { field: 'HDate', title: '进料日期', width: 120 }
                    , { field: 'HCusNumber', title: '客户代码', width: 120 }
                    , { field: 'HCusName', title: '客户', width: 120 }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 120 }
                    , { field: 'HSeOrderBillNo', title: '销售订单号', width: 120 }
                    , { field: 'HRemark', title: '备注', width: 120 }
                    , { field: 'HMTONo', title: '计划跟踪号', width: 120 }
                    , { field: 'HShowDate', title: '日期', width: 100 }
                    , { field: 'HInnerBillNo', title: '内部采购订单号', width: 100 }
                    , { field: 'HMaker', title: '制单人', width: 100 }
                    , { field: 'HBarCode2', title: '条码编号', width: 100 }
                    , { field: 'HMaterNumber2', title: '物料代码', width: 100 }
                    , { field: 'HMaterName2', title: '物料名称', width: 100 }
                    , { field: 'HMaterModel2', title: '规格型号', width: 100 }
                    , { field: 'HAuxPropNumber2', title: '辅助属性代码', width: 100 }
                    , { field: 'HAuxPropName2', title: '辅助属性', event: 'HWHCode', width: 120 }
                    , { field: 'HGiveAwayFlag2', title: '是否赠品', width: 120, templet: '#switchTpl', unresize: false }
                    , { field: 'HUnitCode2', title: '计量单位代码', width: 120 }
                    , { field: 'HUnitName2', title: '计量单位', width: 120 }
                    , { field: 'HQty2', title: '数量', width: 120 }
                    , { field: 'HDate2', title: '进料日期', width: 120 }
                    , { field: 'HCusNumber2', title: '客户代码', width: 120 }
                    , { field: 'HCusName2', title: '客户', width: 120 }
                    , { field: 'HSourceBillNo2', title: '源单单号', width: 120 }
                    , { field: 'HSeOrderBillNo2', title: '销售订单号', width: 120 }
                    , { field: 'HRemark2', title: '备注', width: 120 }
                    , { field: 'HMTONo2', title: '计划跟踪号', width: 120 }
                    , { field: 'HShowDate2', title: '日期', width: 100 }
                    , { field: 'HInnerBillNo2', title: '内部采购订单号', width: 100 }
                    , { field: 'HMaker2', title: '制单人', width: 100 }
                ];
                option1 = {
                    id: 'mainTable1'
@@ -494,12 +632,80 @@
                    }
                };
            }
            //初始化档案列表信息表格
            function set_InitGrid2() {
                //表头
                columns = [
                    { type: 'checkbox', fixed: 'left' }
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", width: 100 }
                    , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
                    , { field: 'hmainid', title: 'hmainid', width: 100, hide: true }
                    , { field: 'hsubid', title: 'hsubid', width: 100, hide: true }
                    , { field: 'HinterID', title: 'HinterID', width: 100, hide: true }
                    , { field: '条码类型', title: '条码类型', width: 100 }
                    , { field: '条码编号', title: '条码编号', width: 120 }
                    , { field: 'HMaterID', title: '物料ID', width: 100, hide: true }
                    , { field: '物料代码', title: '物料代码', width: 120 }
                    , { field: '物料名称', title: '物料名称', width: 120 }
                    , { field: '规格型号', title: '规格型号', width: 120 }
                    , { field: 'HUnitID', title: '计量单位ID', width: 100, hide: true }
                    , { field: '计量单位代码', title: '计量单位代码', width: 120 }
                    , { field: '计量单位', title: '计量单位', width: 120 }
                    , { field: 'HAuxPropID', title: '辅助属性ID', width: 100, hide: true }
                    , { field: '辅助属性代码', title: '辅助属性代码', width: 120 }
                    , { field: '辅助属性', title: '辅助属性', width: 120 }
                    , { field: '批号', title: '批号', width: 120 }
                    , { field: '数量', title: '数量', width: 100 }
                    , { field: '源单单号', title: '源单单号', width: 120 }
                    , { field: '计划跟踪号', title: '计划跟踪号', width: 120 }
                    , { field: '是否赠品', title: '是否赠品', width: 100 }
                    , { field: 'DeptID', title: '车间ID', width: 100, hide: true }
                    , { field: '车间', title: '车间', width: 120 }
                    , { field: 'HSupID', title: '供应商ID', width: 100, hide: true }
                    , { field: '供应商代码', title: '供应商代码', width: 120 }
                    , { field: '供应商', title: '供应商', width: 120 }
                    , { field: '客户条码编号', title: '客户条码编号', width: 120 }
                    , { field: '客户型号', title: '客户型号', width: 120 }
                    , { field: '往来单位', title: '往来单位', width: 120 }
                    , { field: '销售订单号', title: '销售订单号', width: 120 }
                    , { field: '销售订单行号', title: '销售订单行号', width: 120 }
                    , { field: '托号', title: '托号', width: 120 }
                    , { field: '总托数', title: '总托数', width: 100 }
                    , { field: '条码日期', title: '条码日期', width: 120 }
                    , { field: '生产入库日期', title: '生产入库日期', width: 120 }
                    , { field: '生产入库单号', title: '生产入库单号', width: 120 }
                    , { field: '生产入库次数', title: '生产入库次数', width: 100 }
                    , { field: '销售出库日期', title: '销售出库日期', width: 120 }
                    , { field: '销售出库单号', title: '销售出库单号', width: 120 }
                    , { field: '销售出库次数', title: '销售出库次数', width: 100 }
                    , { field: '作废标记', title: '作废标记', width: 100 }
                    , { field: '作废人', title: '作废人', width: 100 }
                    , { field: '备注', title: '备注', width: 120 }
                    , { field: '制作人', title: '制作人', width: 100 }
                    , { field: '日期', title: '日期', width: 120 }
                    , { field: '计划完工日期', title: '计划完工日期', width: 120 }
                    , { field: '打印次数', title: '打印次数', width: 100 }
                    , { field: 'HSTOCKORGID', title: 'HSTOCKORGID', width: 100, hide: true }
                    , { field: '生成组织', title: '生成组织', width: 120 }
                ];
                option2 = {
                    id: 'mainTable2'
                    , elem: '#mainTable2'
                    , height: 500
                    , page: false
                    , limit: 500
                    , cellMinWidth: 120
                    , height: 650
                    , cols: [columns]
                    , done: function (res, curr, count) {
                    }
                };
            }
            //无源单新增
            function set_AddFNew() {
                option.data = [{
                    "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "", "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HMaterModel": ""
                    , "HAuxPropID": 0, "HAuxPropNumber": "", "HAuxPropName": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HBatchNo": "", "HGiveAwayFlag": 0
                    "HMainID": 0, "HSubID": 0, "HBillNo": "", "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HMaterModel": ""
                    , "HAuxPropID": 0, "HAuxPropNumber": "", "HAuxPropName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HBatchNo": "", "HGiveAwayFlag": 0
                    , "HQty": 0, "HMinQty": 0, "HBQty": 0, "HPackQty": 0, "HDate": "", "HCusID": 0, "HCusNumber": "", "HCusName": "", "HSeOrderBillNo": "", "HRemark": ""
                }];
                table.render(option);
@@ -513,6 +719,12 @@
                }];
                table.render(option1);
            }
            function set_AddFNew2() {
                option2.data = [];
                table.render(option2);
            }
            //日期格式化
            function formatDate(date) {
                var d = new Date(date),
@@ -585,18 +797,18 @@
                $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
                    if (event.key == "F7") {
                        //模具信息  å¦‚果在模具代码列 æŒ‰F7
                        if (obj.event === 'HMaterCode')  //模具信息  å¦‚果在模具代码列 æŒ‰F7
                        if (obj.event === 'HMaterNumber')  //模具信息  å¦‚果在模具代码列 æŒ‰F7
                        {
                            //页面层-自定义  //F7选择模具
                            layer.open({
                                type: 2,
                                skin: 'layui-layer-rim', //加上边框
                                title: '器具列表',
                                title: '物料列表',
                                closeBtn: 1,
                                shift: 2,
                                area: ['80%', '80%'],
                                maxmin: true,
                                content: ['../../PublicPage/MouldInformation.html', 'yes'],
                                content: ['../../PublicPage/PartInformation.html', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -610,14 +822,9 @@
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HMaterID: checkStatus.data[0].HItemID,
                                        HMaterCode: checkStatus.data[0].HNumber,
                                        HMaterNumber: checkStatus.data[0].HNumber,
                                        HMaterName: checkStatus.data[0].HName,
                                        HMaterSpec: checkStatus.data[0].HModel,
                                        HDesignLife: 0,  //设计寿命
                                        HLeaveLife: 0,   //剩余寿命
                                        HQty: 1,         //实收数量
                                        HMoney: 0,       //金额
                                        HMaterModel: checkStatus.data[0].HModel
                                    });
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
@@ -632,7 +839,7 @@
                            });
                        }
                        //辅助属性信息
                        if (obj.event === 'HPropertyCode')  //辅助属性信息
                        if (obj.event === 'HAuxPropNumber')  //辅助属性信息
                        {
                            //页面层-自定义
                            layer.open({
@@ -656,9 +863,9 @@
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HPropertyID: checkStatus.data[0].HItemID,
                                        HPropertyCode: checkStatus.data[0].HNumber,
                                        HPropertyName: checkStatus.data[0].HName,
                                        HAuxPropID: checkStatus.data[0].HItemID,
                                        HAuxPropNumber: checkStatus.data[0].HNumber,
                                        HAuxPropName: checkStatus.data[0].HName,
                                    });
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
@@ -674,7 +881,7 @@
                        }
                        //计量单位代码
                        if (obj.event === 'HUnitCode')  //计量单位代码
                        if (obj.event === 'HUnitNumber')  //计量单位代码
                        {
                            //页面层-自定义
                            layer.open({
@@ -699,7 +906,7 @@
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HUnitID: checkStatus.data[0].HItemID,
                                        HUnitCode: checkStatus.data[0].HNumber,
                                        HUnitNumber: checkStatus.data[0].HNumber,
                                        HUnitName: checkStatus.data[0].HName,
                                    });
@@ -714,19 +921,19 @@
                                }
                            });
                        }
                        //仓库代码
                        if (obj.event === 'HWHCode')  //仓库代码
                        //客户代码
                        if (obj.event === 'HCusNumber')  //客户代码
                        {
                            //页面层-自定义
                            layer.open({
                                type: 2,
                                skin: 'layui-layer-rim', //加上边框
                                title: '仓库列表',
                                title: '客户列表',
                                closeBtn: 1,
                                shift: 2,
                                area: ['80%', '80%'],
                                maxmin: true,
                                content: ['../../PublicPage/WareHouseInformation.html', 'yes'],
                                content: ['../../PublicPage/CustomerInformation.html', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -739,60 +946,10 @@
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HWHID: checkStatus.data[0].HItemID,
                                        HWHCode: checkStatus.data[0].HNumber,
                                        HWHName: checkStatus.data[0].HName,
                                        HSPID: "",
                                        HSPCode: "",
                                        HSPName: "",
                                        HCusID: checkStatus.data[0].HItemID,
                                        HCusNumber: checkStatus.data[0].HNumber,
                                        HCusName: checkStatus.data[0].HName
                                    });
                                    ////表头仓库为空时 ç»‘定明细行仓库信息
                                    //if ($("#HWHID").val() == '' || $("#HWHID").val() == null) {
                                    //    $("#HWHName").val(checkStatus.data[0].HName);
                                    //    $("#HWHID").val(checkStatus.data[0].HItemID);
                                    //}
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
                                , btn2: function (index, layero) {
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                }
                            });
                        }
                        //仓位代码
                        if (obj.event === 'HSPCode')  //仓位代码
                        {
                            //页面层-自定义
                            layer.open({
                                type: 2,
                                skin: 'layui-layer-rim', //加上边框
                                title: '仓位列表',
                                closeBtn: 1,
                                shift: 2,
                                area: ['80%', '80%'],
                                maxmin: true,
                                content: ['../../PublicPage/WareLocationInformation.html', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
                                    //按钮【按钮一】的回调
                                    var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                                    if (checkStatus.data.length === 0) {
                                        return layer.msg('请选择数据');
                                    }
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HSPID: checkStatus.data[0].HItemID,
                                        HSPCode: checkStatus.data[0].HNumber,
                                        HSPName: checkStatus.data[0].HName,
                                    });
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
                                , btn2: function (index, layero) {
@@ -814,47 +971,63 @@
                layer.alert(sMsg, { icon: 5 });
            }
            //条码生成
            function SaveBarCodeCreate(sMainSub, CampanyName) {
                $.ajax(
                    {
                        type: "POST",
                        url: GetWEBURL() + "/Sc_BarCode/Sub_SaveBill", //方法所在页面和方法名
                        async: true,
                        data: { "msg": sMainSub, "CampanyName": CampanyName },
                        dataType: "json",
                        success: function (result) {
                            if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                table.reload('mainTable1', {
                                    data: result.list // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                                });
                                //生成成功跳转到条码信息标签页
                                element.tabChange('tab-TabTest', '2');
                                //加载档案列表
                                table.reload('mainTable2', {
                                    data: result.data // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                                });
                            }
                            else {
                                layer.alert(result.Message, { icon: 5 });
                            }
                            layer.closeAll("loading");
                        },
                        error: function (err) {
                            layer.alert(err.Message, { icon: 5 });
                        }
                    });
            }
            //非空验证
            function AllowLoadData(sSubStr) {
                var Result = true;
                if ($("#HWHID").val() == '' || $("#HWHID").val() == null) {
                    layer.msg("仓库不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return Result = false;
                }
                if ($("#HSecManagerID").val() == '' || $("#HSecManagerID").val() == null) {
                    layer.msg("验收员不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return Result = false;
                }
                if ($("#HKeeperID").val() == '' || $("#HKeeperID").val() == null) {
                    layer.msg("保管员不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return Result = false;
                }
                if ($("#HDeptID").val() == '' || $("#HDeptID").val() == null) {
                    layer.msg("部门不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return Result = false;
                }
                if (typeof (sSubStr) == "undefined" || sSubStr == "") {
                    layer.msg("没有物料明细记录", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return Result = false;
                }
                if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") {
                    sSubStr = JSON.parse(sSubStr);
                    for (var i = 0; i < sSubStr.length; i++) {
                        if (sSubStr[i].HMaterID == "") {
                            layer.msg("明细记录第" + (i + 1) + "行,器具信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return Result = false;
                        }
                        if (sSubStr[i].HUnitID == "") {
                            layer.msg("明细记录第" + (i + 1) + "行,计量单位为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return Result = false;
                        }
                        if (sSubStr[i].HWHID == "") {
                            layer.msg("明细记录第" + (i + 1) + "行,收料仓库为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return Result = false;
                        }
                    }
                }
                //if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") {
                //    sSubStr = JSON.parse(sSubStr);
                //    for (var i = 0; i < sSubStr.length; i++) {
                //        if (sSubStr[i].HMaterID == "") {
                //            layer.msg("明细记录第" + (i + 1) + "行,器具信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //            return Result = false;
                //        }
                //        if (sSubStr[i].HUnitID == "") {
                //            layer.msg("明细记录第" + (i + 1) + "行,计量单位为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //            return Result = false;
                //        }
                //        if (sSubStr[i].HWHID == "") {
                //            layer.msg("明细记录第" + (i + 1) + "行,收料仓库为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //            return Result = false;
                //        }
                //    }
                //}
                else {
                    return Result = true;
                }