zzr99
2022-08-09 9516754b628c8a7a0f91a105347d0881420ef0f2
WebTM/views/ÑéÊÕÈë¿â/²úÆ·Èë¿â/Kf_ProductInBackBill.html
@@ -46,7 +46,7 @@
                                        </div>
                                        <div class="layui-col-xs8">
                                            <select name=" HBillType" id="HBillType">
                                               <!-- <option value="3710">生产任务单-退库</option>-->
                                                <!-- <option value="3710">生产任务单-退库</option>-->
                                                <option value="1202">产品入库单-蓝字</option>
                                            </select>
                                            <!--<input type="text" name="cmbSourceType" id="cmbSourceType" lay-verify="cmbSourceType" autocomplete="off" class="layui-input">-->
@@ -207,484 +207,460 @@
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        var $ = layui.$
        , admin = layui.admin
        , layer = layui.layer
        , table = layui.table
        , form = layui.form
        , element = layui.element;
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element;
        //表头初始化赋值(根据登录用户获取 é»˜è®¤ä»“库、部门、验收、保管、金蝶用户) new
        $("#HWHID").val(sessionStorage["HWHID"]);
        $("#HWHNAME").val(sessionStorage["HWHName"]);
        $("#HStockPlaceID").val(sessionStorage["HSPID"]);
        $("#HStockPlaceName").val(sessionStorage["HSPName"]);
        //$("#HSupID").val(sessionStorage["HSupID"]);
        //$("#HSupName").val(sessionStorage["HSupName"]);
        $("#HDeptID").val(sessionStorage["HDeptID"]);
        $("#HDeptName").val(sessionStorage["HDept"]);
        $("#HSecManagerID").val(sessionStorage["HSecManagerID"]);
        $("#HSecManager").val(sessionStorage["HSecManager"]);
        $("#HKeeperID").val(sessionStorage["HKeeperID"]);
        $("#HKeeper").val(sessionStorage["HKeeper"]);
        $("#HMaker").val(sessionStorage["HUserName"]);
        $("#HMaker").hide();
        $("#HMakerID").hide();
        $("#HBillerID").val(sessionStorage["HBillerID"]);
        $("#HBillerID").hide();
            //表头初始化赋值(根据登录用户获取 é»˜è®¤ä»“库、部门、验收、保管、金蝶用户) new
            $("#HWHID").val(sessionStorage["HWHID"]);
            $("#HWHNAME").val(sessionStorage["HWHName"]);
            $("#HStockPlaceID").val(sessionStorage["HSPID"]);
            $("#HStockPlaceName").val(sessionStorage["HSPName"]);
            //$("#HSupID").val(sessionStorage["HSupID"]);
            //$("#HSupName").val(sessionStorage["HSupName"]);
            $("#HDeptID").val(sessionStorage["HDeptID"]);
            $("#HDeptName").val(sessionStorage["HDept"]);
            $("#HSecManagerID").val(sessionStorage["HSecManagerID"]);
            $("#HSecManager").val(sessionStorage["HSecManager"]);
            $("#HKeeperID").val(sessionStorage["HKeeperID"]);
            $("#HKeeper").val(sessionStorage["HKeeper"]);
            $("#HMaker").val(sessionStorage["HUserName"]);
            $("#HMaker").hide();
            $("#HMakerID").hide();
            $("#HBillerID").val(sessionStorage["HBillerID"]);
            $("#HBillerID").hide();
        //默认带入的仓库,如果启用仓位则仓位有效,如果没有启用则仓位灰度 new
            //默认带入的仓库,如果启用仓位则仓位有效,如果没有启用则仓位灰度 new
        //获取参数
        function getUrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
        var params = getUrlVars();
        var linterid = params[params[0]]; //从参数中获取 å•据内码
        var lSourceBillType = params[params[2]];  //从单据获取 æºå•类型
        function  RoadBillMain(linterid)//加载表头
        {
            $.ajax({
                url: GetWEBURL() + "/Web/GetPonderationBill",
                type: "GET",
                data: { "HInterID": linterid },
                success: function (d) {
                    // console.log(d.data);
                    $("#HInterID").val(d.data[0].HInterID);
                    $("#HBillNo").val(d.data[0].HBillNo);
                    $("#HBillType").val(d.data[0].HSourceBillType);
                    $("#HSourceBillNo").val(d.data[0].HSourceBillNo);
                    //$("#HWHID").val(d.data[0].HWhID);
                    //$("#HKeeperID").val(d.data[0].HKeeperID);
                    //$("#HSecManagerID").val(d.data[0].HSecManagerID);
                    //$("#HDeptID").val(d.data[0].HDeptID);
                    //$("#HBarCode").val(d.data[0].HBarCode);
                    //$("#HQty").val(d.data[0].HQty);
            //获取参数
            function getUrlVars() {
                var vars = [], hash;
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
                for (var i = 0; i < hashes.length; i++) {
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
            })
        }
                return vars;
            }
            var params = getUrlVars();
            var linterid = params[params[0]]; //从参数中获取 å•据内码
            var lSourceBillType = params[params[2]];  //从单据获取 æºå•类型
            function RoadBillMain(linterid)//加载表头
            {
                $.ajax({
                    url: GetWEBURL() + "/Web/GetPonderationBill",
                    type: "GET",
                    data: { "HInterID": linterid },
                    success: function (d) {
                        // console.log(d.data);
                        $("#HInterID").val(d.data[0].HInterID);
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HBillType").val(d.data[0].HSourceBillType);
                        $("#HSourceBillNo").val(d.data[0].HSourceBillNo);
                        //$("#HWHID").val(d.data[0].HWhID);
                        //$("#HKeeperID").val(d.data[0].HKeeperID);
                        //$("#HSecManagerID").val(d.data[0].HSecManagerID);
                        //$("#HDeptID").val(d.data[0].HDeptID);
                        //$("#HBarCode").val(d.data[0].HBarCode);
                        //$("#HQty").val(d.data[0].HQty);
                    }
                })
            }
        function RoadBillSub(linterid)//加载表体
        {
            table.render({
                elem: '#wl-table'
            function RoadBillSub(linterid)//加载表体
            {
                table.render({
                    elem: '#wl-table'
                    , url: GetWEBURL() + '/ProductIn/DisBillEntryList_Webs_Json'
                    , toolbar: '#toolbarDemo'
                    , where: { HBillID: linterid, HBillType: '1245', sWhere: '' }
                    , cols: [[
                         { type: 'radio' }
                    , { field: 'HQty', title: '数量', width: 150 }
                    , { field: 'HQtyMust', title: '应收数量', width: 150 }
                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                    , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                    , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                    , { field: 'HBatchNo', title: '批次', width: 150 }
                        { type: 'radio' }
                        , { field: 'HQty', title: '数量', width: 150 }
                        , { field: 'HQtyMust', title: '应收数量', width: 150 }
                        , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                        , { field: 'HMaterName', title: '物料名称', width: 150 }
                        , { field: 'HMaterModel', title: '规格型号', width: 150 }
                        , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                        , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                        , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                        , { field: 'HBatchNo', title: '批次', width: 150 }
                    ]]
                    , height: 500
                    , done: function () {
                        layer.closeAll("loading");
                    }
            });
        }
        //动态加载源单类型列表 new
                });
            }
        //判断是否新增
        if (linterid == null || linterid == 0) {
            //获取最大单据号 new
            $("#HInterID").val("");
            $("#HBillNo").val("");
            $.ajax({
                url: GetWEBURL() + "/Web/GetMAXNumPDA",
                type: "GET",
                data: { "HBillType": '1245' },
                success: function (d) {
                    //console.log(d.data);
                    $("#HInterID").val(d.data[0].HInterID);
                    $("#HBillNo").val(d.data[0].HBillNo);
                }
            });
        }
        else {//如果修改则走下面 new
            RoadBillMain(linterid);
            RoadBillSub(linterid);
        }
            //动态加载源单类型列表 new
        form.on('submit(HWHID-BT)', function () {//选择仓库
            layer.open({
                type: 2
                , area: ['100%', '100%']
                , title: '仓库列表'
                , shade: 0.6 //遮罩透明度
                , maxmin: true //允许全屏最小化
                , anim: 0 //0-6的动画形式,-1不开启
                , content: ['../../../views/Baseset/基础资料/Gy_WarehouseList.html?Type=HWHID', 'yes']
                , resize: false
                , cancel: function () {
                    //$(".layui-btn").removeClass("layui-btn-disabled");
                }
            })
        });
        form.on('submit(HSpID-BT)', function () {//选择仓位
            layer.open({
                type: 2
                , area: ['100%', '100%']
                , title: '仓位列表'
                , shade: 0.6 //遮罩透明度
                , maxmin: true //允许全屏最小化
                , anim: 0 //0-6的动画形式,-1不开启
                , content: ['../../../views/Baseset/基础资料/Gy_StockPlaceList.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID', 'yes']
                , resize: false
                , cancel: function () {
                    //$(".layui-btn").removeClass("layui-btn-disabled");
                }
            })
        });
        form.on('submit(HSupID-BT)', function () {//选择供应商
            layer.open({
                type: 2
                , area: ['100%', '100%']
                , title: '供应商列表'
                , shade: 0.6 //遮罩透明度
                , maxmin: true //允许全屏最小化
                , anim: 0 //0-6的动画形式,-1不开启
                , content: ['../../../views/Baseset/基础资料/Gy_SupplierList.html', 'yes']
                , resize: false
                , cancel: function () {
                    //$(".layui-btn").removeClass("layui-btn-disabled");
                }
            })
        });
        //form.on('submit(HKeeperID-BT)', function () {//选择保管
        //    layer.open({
        //        type: 2
        //        , area: ['100%', '100%']
        //        , title: '保管列表'
        //        , shade: 0.6 //遮罩透明度
        //        , maxmin: true //允许全屏最小化
        //        , anim: 0 //0-6的动画形式,-1不开启
        //        , content: ['../../../views/Baseset/基础资料/Gy_EmployeeList.html?Type=HKeeper', 'yes']
        //        , resize: false
        //        , cancel: function () {
        //            //$(".layui-btn").removeClass("layui-btn-disabled");
        //        }
        //    })
        //});
        form.on('submit(HKeeperID-BT)', function () {//选择保管
            layer.open({
                type: 2//弹窗类型
                , skin: 'layui-layer-rim' //加上边框
                , area: ['90%', '90%']//大小
                , title: '职员列表'//标题
                , shift: 2//弹出动画
                , content: ['../../PublicPage/UserInformation.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('请选择数据');
                    }
                    $("#HKeeper").val(checkStatus.data[0].HName);
                    $("#HKeeperID").val(checkStatus.data[0].HItemID);
                    layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                }
                , btn2: function (index, layero) { }
            })
        });
        form.on('submit(HSecManagerID-BT)', function (data) {//选择验收
            layer.open({
                type: 2//弹窗类型
                , skin: 'layui-layer-rim' //加上边框
                , area: ['90%', '90%']//大小
                , title: '职员列表'//标题
                , shift: 2//弹出动画
                , content: ['../../PublicPage/UserInformation.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('请选择数据');
                    }
                    $("#HSecManager").val(checkStatus.data[0].HName);
                    $("#HSecManagerID").val(checkStatus.data[0].HItemID);
                    layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                }
                , btn2: function (index, layero) { }
            })
        });
        form.on('submit(HDeptID-BT)', function () {//选择部门
            layer.open({
                type: 2
                , area: ['100%', '100%']
                , title: '部门列表'
                , shade: 0.6 //遮罩透明度
                , maxmin: true //允许全屏最小化
                , anim: 0 //0-6的动画形式,-1不开启
                , content: ['../../../views/Baseset/基础资料/Gy_DepartmentList.html', 'yes']
                , resize: false
                , cancel: function () {
                    //$(".layui-btn").removeClass("layui-btn-disabled");
                }
            })
        });
        form.on('submit(cmdDelete)', function () {//删除
            var checkStatus = table.checkStatus('wl-table')
            , data = checkStatus.data;
            var sInterID = $('#HInterID').val()
            var sMaterID = data[0].HMaterID
            var sBillType = '1245'
            var sAuxPropID = data[0].HAuxPropID
            //var sMTONo = data[0].HMTONo
            var sMTONo = ''
            var sSourceInterID = data[0].HSourceInterID
            var sSourceEntryID = data[0].HSourceEntryID
            $.ajax(
               {
                   type: "Get",
                   url: GetWEBURL() + "/ProductIn/Delete_Json",
                   async: true,
                   data: { "HInterID": sInterID, "HMaterID": sMaterID, "HAuxPropID": sAuxPropID, "HMTONo": sMTONo, "HSourceInterID": sSourceInterID, "HSourceEntryID": sSourceEntryID, "sHBillType": sBillType, },
                   dataType: "json",
                   success: function (data) {
                       if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                           //layer.msg(data.Message, { icon: 1 });
                           table.render({
                               elem: '#wl-table'
                         , url: GetWEBURL() + '/ProductIn/DisBillEntryList_Webs_Json'
                          , toolbar: '#toolbarDemo'
                          , where: { HBillID: sInterID, HBillType: '1245', sWhere: '' }
                          , cols: [[
                                  { type: 'radio' }
                            , { field: 'HQty', title: '数量', width: 150 }
                            , { field: 'HQtyMust', title: '应收数量', width: 150 }
                            , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                            , { field: 'HMaterName', title: '物料名称', width: 150 }
                            , { field: 'HMaterModel', title: '规格型号', width: 150 }
                            , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                            , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                            , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                            , { field: 'HBatchNo', title: '批次', width: 150 }
                          ]]
                         , height: 500
                           })
                       }
                       else {
                           layer.msg(data.Message, { icon: 2 });
                       }
                   },
                   error: function (err) {
                       layer.msg('错误' + err, {
                           icon: 5,
                           time: 20000
                       }, function () {
                           //do something
                       });
                   }
               });
        });
        form.on('submit(Cancel)', function () {
            sessionStorage["SourceFlag"] = false;
            //parent.location.href = "../../../views/index.html"
            //window.close();//关闭当前页
            layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                window.close();
            });
        })
        form.on('submit(Saver)', function (data) {//提交
            //debugger;
            var sMainStr = JSON.stringify(data.field);
            var sSubStr = table.cache['wl-table'];
            var sSourceType = $("#HBillType").val();
            if (AllowLoadData(sSubStr) != false)//非空验证
            {
                layer.load(3);
                $.ajax(
                {
                    type: "POST",
                    url: GetWEBURL() + "/ProductInBack/set_SaveProductInBackBill_Json",
                    async: true,
                    data: { "oMain": sMainStr },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            layer.msg(data.Message + $("#HBillNo").val(), { icon: 1 });
                        }
                        else {
                            layer.msg(data.Message, { icon: 5 });
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        layer.msg("错误:" + err, { icon: 5 });
            //判断是否新增
            if (linterid == null || linterid == 0) {
                //获取最大单据号 new
                $("#HInterID").val("");
                $("#HBillNo").val("");
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNumPDA",
                    type: "GET",
                    data: { "HBillType": '1245' },
                    success: function (d) {
                        //console.log(d.data);
                        $("#HInterID").val(d.data[0].HInterID);
                        $("#HBillNo").val(d.data[0].HBillNo);
                    }
                });
                return false;
            }
        });
            else {//如果修改则走下面 new
                RoadBillMain(linterid);
                RoadBillSub(linterid);
            }
        //监听提交
        form.verify({
            numberOrEmpty: function (value, item) {
                // if (value != '') {
                if (!/^\d+$/.test(value)) {
                    return '不能为空或数字或者0';
                }
                //}
            }
        });
        $('#HBarCode').on('keydown', function (event) {  //扫条码
            var sSubStr = table.cache['wl-table'];
            var sBarCode = $('#HBarCode').val()
            var sInterID = $("#HInterID").val()
            var sBillNo = $("#HBillNo").val()
            var sQty = $("#HQty").val()
            var sHBillType = $("#HBillType").val()
            var sHWHID = $("#HWHID").val()
            var sHSPID = $("#HStockPlaceID").val()
            var sSourceBillNo = $("#HSourceBillNo").val()
            var sBillType = '1245'
            if (sQty == "") {
                sQty = 0;
            }
            //if ($("#HSourceBillNo").val() == '') {
            //    layer.msg("请先扫源单!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HDeptName").val() == '') {
            //    layer.msg("部门没有选择!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HSecManager").val() == '') {
            //    layer.msg("发料人没有选择!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HKeeper").val() == '') {
            //    layer.msg("领料人没有选择!", { icon: 5 });
            //}
            //if ($("#HSupName").val() == '') {
            //    return false;
            //    layer.msg("供应商没有选择!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HWHNAME").val() == '') {
            //    layer.msg("仓库没有选择!", { icon: 5 });
            //    return false;
            //}
            if (event.keyCode == 13) {
                if (sBarCode == '') {
                    layer.msg("条码为空,不能扫描!", { icon: 5, btn: ['确定'], time: 100000, offset: 't' });
                    return false;
                }
                if (sBarCode != "") {
                    $('#HBarCode').val("");
                }
                if (sQty != "") {
                    $('#HQty').val("");
                }
                //if (AllowLoadData(sSubStr, 'HBarCode') != false) {//非空验证
                $.ajax({
                    //url: "http://61.130.49.162:9090/WMSAPI///ProductIn/get_CheckTypeByBarCode_All_Json",
                    url: GetWEBURL() + "/ProductInBack/get_CheckTypeByBarCode_All_Json",
                    type: "GET",
                    data: { "sCode": sBarCode, "sInterID": sInterID, "HBillType": sBillType, "sBillNo": sBillNo, "sMaker": sessionStorage["HUserName"], "WhID": sHWHID, "SPID": sHSPID, "sQty": sQty, "sRedBlue": true, "SourceFlag": sessionStorage["SourceFlag"], "sSourceBillNo": sSourceBillNo, "sSourceType": sHBillType, "HOWNERID": sessionStorage["OrganizationID"], "sExpressNumber": ""},
                    success: function (result) {
                        if (result.count == 1) {
                            if (result.data.HBarType == '仓库条码') {
                                $("#HWHNAME").val(result.data.HWhName);
                                $("#HWHID").val(result.data.HWhID);
                                $("#HStockPlaceName").val("");
                                $("#HNote").val(";一键扫码仓库条码");
                                element.tabChange('tab-ProductlnBackBill', '2');  //跳转页签
                            }
                            else if (result.data.HBarType == '仓位条码') {
                                $("#HStockPlaceName").val(result.data.HSPName);
                                $("#HStockPlaceID").val(result.data.HSPID);
                                $("#HWHNAME").val(result.data.HWhName);
                                $("#HWHID").val(result.data.HWhID);
                                $("#HNote").val(";一键扫码仓位条码");
                                element.tabChange('tab-ProductlnBackBill', '2');//跳转页签
                            }
                            else if (result.data.HBarType == '部门条码') {
                                $("#HDeptName").val(result.data.HDeptName);
                                $("#HDeptID").val(result.data.HDeptID);
                                $("#HNote").val(";一键扫码部门条码");
                                element.tabChange('tab-ProductlnBackBill', '2');//跳转页签
                            }
                            else if (result.data.HBarType == '源单条码') {
                                $("#HSupName").val(result.data.HSupName);
                                $("#HSupID").val(result.data.HSupID);
                                $("#HDeptName").val(result.data.HDeptName);
                                $("#HDeptID").val(result.data.HDeptID);
                                $("#HSourceBillNo").val(result.data.HSourceBillNo);
                                sessionStorage["SourceFlag"] = true;
                                //获取源单类型、源单单号
                                if (result.data.HSourceBillType == "3710") {
                                    $("#HBillType").val("3710");
                                }
                                else if (result.data.HSourceBillType == "1202") {
                                    $("#HBillType").val("1202");
                                }
                                else {
                                    $("#HBillType").val("手工录入");
                                }
                                $("#HNote").val(";一键扫码源单条码");
                                element.tabChange('tab-ProductlnBackBill', '3');
            form.on('submit(HWHID-BT)', function () {//选择仓库
                layer.open({
                    type: 2
                    , area: ['100%', '100%']
                    , title: '仓库列表'
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../../views/Baseset/基础资料/Gy_WarehouseList.html?Type=HWHID', 'yes']
                    , resize: false
                    , cancel: function () {
                        //$(".layui-btn").removeClass("layui-btn-disabled");
                    }
                })
            });
            form.on('submit(HSpID-BT)', function () {//选择仓位
                layer.open({
                    type: 2
                    , area: ['100%', '100%']
                    , title: '仓位列表'
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../../views/Baseset/基础资料/Gy_StockPlaceList.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID', 'yes']
                    , resize: false
                    , cancel: function () {
                        //$(".layui-btn").removeClass("layui-btn-disabled");
                    }
                })
            });
            form.on('submit(HSupID-BT)', function () {//选择供应商
                layer.open({
                    type: 2
                    , area: ['100%', '100%']
                    , title: '供应商列表'
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../../views/Baseset/基础资料/Gy_SupplierList.html', 'yes']
                    , resize: false
                    , cancel: function () {
                        //$(".layui-btn").removeClass("layui-btn-disabled");
                    }
                })
            });
            //form.on('submit(HKeeperID-BT)', function () {//选择保管
            //    layer.open({
            //        type: 2
            //        , area: ['100%', '100%']
            //        , title: '保管列表'
            //        , shade: 0.6 //遮罩透明度
            //        , maxmin: true //允许全屏最小化
            //        , anim: 0 //0-6的动画形式,-1不开启
            //        , content: ['../../../views/Baseset/基础资料/Gy_EmployeeList.html?Type=HKeeper', 'yes']
            //        , resize: false
            //        , cancel: function () {
            //            //$(".layui-btn").removeClass("layui-btn-disabled");
            //        }
            //    })
            //});
            form.on('submit(HKeeperID-BT)', function () {//选择保管
                layer.open({
                    type: 2//弹窗类型
                    , skin: 'layui-layer-rim' //加上边框
                    , area: ['90%', '90%']//大小
                    , title: '职员列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../PublicPage/UserInformation.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('请选择数据');
                        }
                        $("#HKeeper").val(checkStatus.data[0].HName);
                        $("#HKeeperID").val(checkStatus.data[0].HItemID);
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                })
            });
            form.on('submit(HSecManagerID-BT)', function (data) {//选择验收
                layer.open({
                    type: 2//弹窗类型
                    , skin: 'layui-layer-rim' //加上边框
                    , area: ['90%', '90%']//大小
                    , title: '职员列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../PublicPage/UserInformation.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('请选择数据');
                        }
                        $("#HSecManager").val(checkStatus.data[0].HName);
                        $("#HSecManagerID").val(checkStatus.data[0].HItemID);
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                })
            });
            form.on('submit(HDeptID-BT)', function () {//选择部门
                layer.open({
                    type: 2
                    , area: ['100%', '100%']
                    , title: '部门列表'
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../../views/Baseset/基础资料/Gy_DepartmentList.html', 'yes']
                    , resize: false
                    , cancel: function () {
                        //$(".layui-btn").removeClass("layui-btn-disabled");
                    }
                })
            });
            form.on('submit(cmdDelete)', function () {//删除
                var checkStatus = table.checkStatus('wl-table')
                    , data = checkStatus.data;
                var sInterID = $('#HInterID').val()
                var sMaterID = data[0].HMaterID
                var sBillType = '1245'
                var sAuxPropID = data[0].HAuxPropID
                //var sMTONo = data[0].HMTONo
                var sMTONo = ''
                var sSourceInterID = data[0].HSourceInterID
                var sSourceEntryID = data[0].HSourceEntryID
                $.ajax(
                    {
                        type: "Get",
                        url: GetWEBURL() + "/ProductIn/Delete_Json",
                        async: true,
                        data: { "HInterID": sInterID, "HMaterID": sMaterID, "HAuxPropID": sAuxPropID, "HMTONo": sMTONo, "HSourceInterID": sSourceInterID, "HSourceEntryID": sSourceEntryID, "sHBillType": sBillType, },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                //layer.msg(data.Message, { icon: 1 });
                                table.render({
                                    elem: '#wl-table'
                                    , url: GetWEBURL() + '/ProductIn/DisBillEntryList_Webs_Json'
                                    , toolbar: '#toolbarDemo'
                                    , where: { HBillID: sInterID, HBillType: '1245', sWhere: '' }
                                    , cols: [[
                                        { type: 'radio' }
                                        , { field: 'HQty', title: '数量', width: 150 }
                                        , { field: 'HQtyMust', title: '应收数量', width: 150 }
                                        , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                                        , { field: 'HMaterName', title: '物料名称', width: 150 }
                                        , { field: 'HMaterModel', title: '规格型号', width: 150 }
                                        , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                                        , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                                        , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                                        , { field: 'HBatchNo', title: '批次', width: 150 }
                                    ]]
                                    , height: 500
                                })
                            }
                            else {
                                if (sessionStorage["SourceFlag"] == "true") {
                                    element.tabChange('tab-ProductlnBackBill', '3');
                                layer.msg(data.Message, { icon: 2 });
                            }
                        },
                        error: function (err) {
                            layer.msg('错误' + err, {
                                icon: 5,
                                time: 20000
                            }, function () {
                                //do something
                            });
                        }
                    });
            });
            form.on('submit(Cancel)', function () {
                sessionStorage["SourceFlag"] = false;
                //parent.location.href = "../../../views/index.html"
                //window.close();//关闭当前页
                layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                    window.close();
                });
            })
            form.on('submit(Saver)', function (data) {//提交
                //debugger;
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = table.cache['wl-table'];
                var sSourceType = $("#HBillType").val();
                if (AllowLoadData(sSubStr) != false)//非空验证
                {
                    layer.load(3);
                    $.ajax(
                        {
                            type: "POST",
                            url: GetWEBURL() + "/ProductInBack/set_SaveProductInBackBill_Json",
                            async: true,
                            data: { "oMain": sMainStr },
                            dataType: "json",
                            success: function (data) {
                                if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                    layer.msg(data.Message + $("#HBillNo").val(), { icon: 1 });
                                }
                                else {
                                    layer.msg(data.Message, { icon: 5 });
                                }
                                layer.closeAll("loading");
                            },
                            error: function (err) {
                                layer.msg("错误:" + err, { icon: 5 });
                            }
                        });
                    return false;
                }
            });
            //监听提交
            form.verify({
                numberOrEmpty: function (value, item) {
                    // if (value != '') {
                    if (!/^\d+$/.test(value)) {
                        return '不能为空或数字或者0';
                    }
                    //}
                }
            });
            $('#HBarCode').on('keydown', function (event) {  //扫条码
                var sSubStr = table.cache['wl-table'];
                var sBarCode = $('#HBarCode').val()
                var sInterID = $("#HInterID").val()
                var sBillNo = $("#HBillNo").val()
                var sQty = $("#HQty").val()
                var sHBillType = $("#HBillType").val()
                var sHWHID = $("#HWHID").val()
                var sHSPID = $("#HStockPlaceID").val()
                var sSourceBillNo = $("#HSourceBillNo").val()
                var sBillType = '1245'
                if (sQty == "") {
                    sQty = 0;
                }
                //if ($("#HSourceBillNo").val() == '') {
                //    layer.msg("请先扫源单!", { icon: 5 });
                //    return false;
                //}
                //if ($("#HDeptName").val() == '') {
                //    layer.msg("部门没有选择!", { icon: 5 });
                //    return false;
                //}
                //if ($("#HSecManager").val() == '') {
                //    layer.msg("发料人没有选择!", { icon: 5 });
                //    return false;
                //}
                //if ($("#HKeeper").val() == '') {
                //    layer.msg("领料人没有选择!", { icon: 5 });
                //}
                //if ($("#HSupName").val() == '') {
                //    return false;
                //    layer.msg("供应商没有选择!", { icon: 5 });
                //    return false;
                //}
                //if ($("#HWHNAME").val() == '') {
                //    layer.msg("仓库没有选择!", { icon: 5 });
                //    return false;
                //}
                if (event.keyCode == 13) {
                    if (sBarCode == '') {
                        layer.msg("条码为空,不能扫描!", { icon: 5, btn: ['确定'], time: 100000, offset: 't' });
                        return false;
                    }
                    if (sBarCode != "") {
                        $('#HBarCode').val("");
                    }
                    if (sQty != "") {
                        $('#HQty').val("");
                    }
                    //if (AllowLoadData(sSubStr, 'HBarCode') != false) {//非空验证
                    $.ajax({
                        //url: "http://61.130.49.162:9090/WMSAPI///ProductIn/get_CheckTypeByBarCode_All_Json",
                        url: GetWEBURL() + "/ProductInBack/get_CheckTypeByBarCode_All_Json",
                        type: "GET",
                        data: { "sCode": sBarCode, "sInterID": sInterID, "HBillType": sBillType, "sBillNo": sBillNo, "sMaker": sessionStorage["HUserName"], "WhID": sHWHID, "SPID": sHSPID, "sQty": sQty, "sRedBlue": true, "SourceFlag": sessionStorage["SourceFlag"], "sSourceBillNo": sSourceBillNo, "sSourceType": sHBillType, "HOWNERID": sessionStorage["OrganizationID"], "sExpressNumber": "" },
                        success: function (result) {
                            if (result.count == 1) {
                                if (result.data.HBarType == '仓库条码') {
                                    $("#HWHNAME").val(result.data.HWhName);
                                    $("#HWHID").val(result.data.HWhID);
                                    $("#HStockPlaceName").val("");
                                    $("#HNote").val(";一键扫码仓库条码");
                                    element.tabChange('tab-ProductlnBackBill', '2');  //跳转页签
                                }
                                else if (result.data.HBarType == '仓位条码') {
                                    $("#HStockPlaceName").val(result.data.HSPName);
                                    $("#HStockPlaceID").val(result.data.HSPID);
                                    $("#HWHNAME").val(result.data.HWhName);
                                    $("#HWHID").val(result.data.HWhID);
                                    $("#HNote").val(";一键扫码仓位条码");
                                    element.tabChange('tab-ProductlnBackBill', '2');//跳转页签
                                }
                                else if (result.data.HBarType == '部门条码') {
                                    $("#HDeptName").val(result.data.HDeptName);
                                    $("#HDeptID").val(result.data.HDeptID);
                                    $("#HNote").val(";一键扫码部门条码");
                                    element.tabChange('tab-ProductlnBackBill', '2');//跳转页签
                                }
                                else if (result.data.HBarType == '源单条码') {
                                    $("#HSupName").val(result.data.HSupName);
                                    $("#HSupID").val(result.data.HSupID);
                                    //$("#HDeptName").val(result.data.HDeptName);
                                    //$("#HDeptID").val(result.data.HDeptID);
                                    //$("#HSourceBillNo").val(result.data.HSourceBillNo);
                                    $("#HDeptName").val(result.data.HDeptName);
                                    $("#HDeptID").val(result.data.HDeptID);
                                    $("#HSourceBillNo").val(result.data.HSourceBillNo);
                                    sessionStorage["SourceFlag"] = true;
                                    //获取源单类型、源单单号
                                    if (result.data.HSourceBillType == "3710") {
@@ -696,238 +672,264 @@
                                    else {
                                        $("#HBillType").val("手工录入");
                                    }
                                    $("#HNote").val(";物料条码");
                                    $("#HNote").val(";一键扫码源单条码");
                                    element.tabChange('tab-ProductlnBackBill', '3');
                                }
                            }
                            layer.load(3)
                            table.render({
                                elem: '#wl-table'
                                  , url: GetWEBURL() + '/ProductIn/DisBillEntryList_Webs_Json'
                                , toolbar: '#toolbarDemo'
                                , totalRow: true
                                  , where: { HBillID: sInterID, HBillType: '1245', sWhere: '' }
                                  , cols: [[
                                else {
                                    if (sessionStorage["SourceFlag"] == "true") {
                                        element.tabChange('tab-ProductlnBackBill', '3');
                                    }
                                    else {
                                        $("#HSupName").val(result.data.HSupName);
                                        $("#HSupID").val(result.data.HSupID);
                                        //$("#HDeptName").val(result.data.HDeptName);
                                        //$("#HDeptID").val(result.data.HDeptID);
                                        //$("#HSourceBillNo").val(result.data.HSourceBillNo);
                                        sessionStorage["SourceFlag"] = true;
                                        //获取源单类型、源单单号
                                        if (result.data.HSourceBillType == "3710") {
                                            $("#HBillType").val("3710");
                                        }
                                        else if (result.data.HSourceBillType == "1202") {
                                            $("#HBillType").val("1202");
                                        }
                                        else {
                                            $("#HBillType").val("手工录入");
                                        }
                                        $("#HNote").val(";物料条码");
                                        element.tabChange('tab-ProductlnBackBill', '3');
                                    }
                                }
                                layer.load(3)
                                table.render({
                                    elem: '#wl-table'
                                    , url: GetWEBURL() + '/ProductIn/DisBillEntryList_Webs_Json'
                                    , toolbar: '#toolbarDemo'
                                    , totalRow: true
                                    , where: { HBillID: sInterID, HBillType: '1245', sWhere: '' }
                                    , cols: [[
                                        { type: 'radio' }
                                      , { field: 'HQty', title: '数量', width: 150, totalRow: true}
                                      , { field: 'HQtyMust', title: '应收数量', width: 150, totalRow: true}
                                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                                    , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                                    , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                                    , { field: 'HBatchNo', title: '批次', width: 150 }
                                  ]]
                                  , height: 500
                                  , done: function () {
                                      layer.closeAll("loading");
                                  }
                            });
                                        , { field: 'HQty', title: '数量', width: 150, totalRow: true }
                                        , { field: 'HQtyMust', title: '应收数量', width: 150, totalRow: true }
                                        , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                                        , { field: 'HMaterName', title: '物料名称', width: 150 }
                                        , { field: 'HMaterModel', title: '规格型号', width: 150 }
                                        , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                                        , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                                        , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                                        , { field: 'HBatchNo', title: '批次', width: 150 }
                                    ]]
                                    , height: 500
                                    , done: function () {
                                        layer.closeAll("loading");
                                    }
                                });
                            }
                            else {
                                // $("#verifycode").click();
                                //layer.msg(result.Message, { icon: 5 });
                                layer.msg(result.Message, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            }
                            layer.closeAll("loading");
                        }
                        else {
                            // $("#verifycode").click();
                            //layer.msg(result.Message, { icon: 5 });
                            layer.msg(result.Message, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    });
                }
                //else
                //{
                //    layer.msg(result.Message, { icon: 5 });
                //}
                //layer.closeAll("loading");
                //}
            });
            $('#HSourceBillNo').on('keydown', function (event) {
                var HSourceBillNo = $('#HSourceBillNo').val()
                var sInterID = $("#HInterID").val()
                var sBillNo = $("#HBillNo").val()
                var HSourceBillType = $("#HBillType").val()
                if (event.keyCode == 13) {
                    $.ajax({
                        url: GetWEBURL() + "/ProductInBackBill/set_SavePonderationBillMain_Temp_Source_Fast_Json",
                        type: "GET",
                        data: { "HSourceBillType": HSourceBillType, "HSourceBillNo": HSourceBillNo, "sInterID": sInterID, "sBillNo": sBillNo },
                        success: function (result) {
                            if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                sessionStorage["SourceFlag"] = true;
                                layer.load(3)
                                element.tabChange('tab-ProductlnBackBill', '2');
                                table.render({
                                    elem: '#wl-table'
                                    , totalRow: true
                                    //, url: 'http://61.130.49.162:9090/WMSAPI///ProductIn/DisBillEntryList_Webs_Json'
                                    , url: GetWEBURL() + '/ProductInBackBill/DisBillEntryList_Webs_Json'
                                    , toolbar: '#toolbarDemo'
                                    , where: { HBillID: sInterID, HBillType: '1245', sWhere: '' }
                                    , cols: [[
                                        { type: 'radio' }
                                        , { field: 'HQty', title: '数量', width: 150, totalRow: true }
                                        , { field: 'HQtyMust', title: '应收数量', width: 150, totalRow: true }
                                        , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                                        , { field: 'HMaterName', title: '物料名称', width: 150 }
                                        , { field: 'HMaterModel', title: '规格型号', width: 150 }
                                        , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                                        , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                                        , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                                        , { field: 'HBatchNo', title: '批次', width: 150 }
                                    ]]
                                    // , data: [linterid]
                                    // , page: true
                                    , height: 500
                                    , done: function () {
                                        layer.closeAll("loading");
                                    }
                                });
                            }
                            else {
                                // $("#verifycode").click();
                                //layer.msg(result.Message, { icon: 5 });
                                layer.msg(result.Message, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            }
                            layer.closeAll("loading");
                        }
                        layer.closeAll("loading");
                    }
                });
            }
            //else
            //{
            //    layer.msg(result.Message, { icon: 5 });
            //}
            //layer.closeAll("loading");
            //}
        });
        $('#HSourceBillNo').on('keydown', function (event) {
            var HSourceBillNo = $('#HSourceBillNo').val()
            var sInterID = $("#HInterID").val()
            var sBillNo = $("#HBillNo").val()
            var HSourceBillType = $("#HBillType").val()
            if (event.keyCode == 13) {
                $.ajax({
                    url: GetWEBURL() + "/ProductInBackBill/set_SavePonderationBillMain_Temp_Source_Fast_Json",
                    type: "GET",
                    data: { "HSourceBillType": HSourceBillType, "HSourceBillNo": HSourceBillNo, "sInterID": sInterID, "sBillNo": sBillNo },
                    success: function (result) {
                        if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            sessionStorage["SourceFlag"] = true;
                            layer.load(3)
                            element.tabChange('tab-ProductlnBackBill', '2');
                            table.render({
                                elem: '#wl-table'
                                , totalRow: true
                                //, url: 'http://61.130.49.162:9090/WMSAPI///ProductIn/DisBillEntryList_Webs_Json'
                              , url: GetWEBURL() + '/ProductInBackBill/DisBillEntryList_Webs_Json'
                              , toolbar: '#toolbarDemo'
                              , where: { HBillID: sInterID, HBillType: '1245', sWhere: '' }
                              , cols: [[
                                  { type: 'radio' }
                                  , { field: 'HQty', title: '数量', width: 150, totalRow: true}
                                  , { field: 'HQtyMust', title: '应收数量', width: 150, totalRow: true}
                                , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                                , { field: 'HMaterName', title: '物料名称', width: 150 }
                                , { field: 'HMaterModel', title: '规格型号', width: 150 }
                                , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                                , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                                , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                                , { field: 'HBatchNo', title: '批次', width: 150 }
                              ]]
                                // , data: [linterid]
                                // , page: true
                              , height: 500
                              , done: function () {
                                  layer.closeAll("loading");
                              }
                            });
                        }
                        else {
                            // $("#verifycode").click();
                            //layer.msg(result.Message, { icon: 5 });
                            layer.msg(result.Message, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                        layer.closeAll("loading");
                    }
                });
                // layer.msg($('#HSourceBillNo').val(), { icon: 1 });
            }
        });
                    });
                    // layer.msg($('#HSourceBillNo').val(), { icon: 1 });
                }
            });
        //layer.load(3)
        table.render({
            elem: '#wl-table'
            // , url: 'http://localhost:8083/Web/GetHBarCodeShowBillSub'
            , toolbar: '#toolbarDemo'
            //  , where: { sMsg: linterid, sMsg2: lentryid }
              , cols: [[
               // , { field: 'HMTONO', title: '计划跟踪单号', width: 100,, sort: true, fixed: true edit: 'text', hide: true }
                  { field: 'HQty', title: '数量', width: 150 }
                , { field: 'HQtyMust', title: '应收数量', width: 150 }
                , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                , { field: 'HMaterName', title: '物料名称', width: 150 }
                , { field: 'HMaterModel', title: '规格型号', width: 150 }
                , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                , { field: 'HBatchNo', title: '批次', width: 150 }
                //, { field: 'HPieceQty', title: '本次支付金额', width: 150 }
              ]]
            // , data: [linterid]
          , text: {
              none:'暂无相关数据'
          }
          , page: true
          , height: 500
          , done: function () {
              //layer.closeAll("loading");
          }
        });
        table.render({
            elem: '#mx-table'
            // , url: 'http://localhost:8083/Web/GetHBarCodeShowBillSub'
            //, toolbar: '#toolbarDemo'
            // , where: { sMsg: linterid, sMsg2: lentryid }
         , cols: [[
          // , { field: 'HMTONO', title: '计划跟踪单号', width: 100,, sort: true, fixed: true edit: 'text', hide: true }
           , { field: 'HMaterID', title: '物料ID', width: 100, hide: true }
         ]]
            // , data: [linterid]
         , page: true
         , height: 500
         , done: function () {
             //layer.closeAll("loading");
         }
        });
    });
    function GetHWHValue(obj)  //返回仓库
    {
        $("#HWHNAME").val(obj[0].HName);
        //sessionStorage["HWHID"] = obj[0].HItemID;
        $("#HWHID").val(obj[0].HItemID);
    }
    function GetHSpValue(obj) {  //返回调入仓位
        $("#HStockPlaceName").val(obj[0].HName);
        $("#HStockPlaceID").val(obj[0].HItemID);
    }
    function GetHSupValue(obj) {  //返回供应商
        $("#HSupName").val(obj[0].HName);
        $("#HSupID").val(obj[0].HItemID);
    }
    function GetHKeeperValue(obj) {  //返回保管
        $("#HKeeper").val(obj[0].HName);
        $("#HKeeperID").val(obj[0].HItemID);
    }
    function GetHSecManagerValue(obj) {  //返回验收
        $("#HSecManager").val(obj[0].HName);
        $("#HSecManagerID").val(obj[0].HItemID);
    }
    function GetHDeptNameValue(obj) {   //返回部门
        $("#HDeptName").val(obj[0].HName);
        $("#HDeptID").val(obj[0].HItemID);
    }
    function AllowLoadData(sSubStr) {  //非空验证
        //if ($("#HSourceBillNo").val() == '') {
        //    layer.msg("请先扫源单!", { icon: 5 });
        //    return false;
        //}
        //if ($("#HDeptName").val() == '') {
        //    layer.msg("部门没有选择!", { icon: 5 });
        //    return false;
        //}
        //if ($("#HSecManager").val() == '') {
        //    layer.msg("验收人没有选择!", { icon: 5 });
        //    return false;
        //}
        //if ($("#HKeeper").val() == '') {
        //    layer.msg("保管人没有选择!", { icon: 5 });
        //    return false;
        //}
        //if ($("#HSupName").val() == '') {
        //    layer.msg("供应商没有选择!", { icon: 5 });
        //    return false;
        //}
        //if ($("#HWHNAME").val() == '') {
        //    layer.msg("仓库没有选择!", { icon: 5 });
        //    return false;
        //}
        if ($("#HBillNo").val() == '') {
            layer.msg("错误的单据号!", { icon: 5 });
            return false;
        }
        if ($("#HInterID").val() == '') {
            layer.msg("错误的内码!", { icon: 5 });
            return false;
        }
        if (sSubStr == '') {
            layer.msg("没有物料明细记录!", { icon: 5 });
            return false;
        }
        if (sSubStr != '') {
            for (var i = 0; i <= sSubStr.length - 1; i++) {  //判断扫码数量不能大于应收数量
                if (parseFloat(sSubStr[i].HQtyMust) > 0) {
                    if (parseFloat(sSubStr[i].HQty) > parseFloat(sSubStr[i].HQtyMust)) {
                        layer.msg("数量不能大于应收数量!", { icon: 5 });
                        return false;
                    }
            //layer.load(3)
            table.render({
                elem: '#wl-table'
                // , url: 'http://localhost:8083/Web/GetHBarCodeShowBillSub'
                , toolbar: '#toolbarDemo'
                //  , where: { sMsg: linterid, sMsg2: lentryid }
                , cols: [[
                    // , { field: 'HMTONO', title: '计划跟踪单号', width: 100,, sort: true, fixed: true edit: 'text', hide: true }
                    { field: 'HQty', title: '数量', width: 150 }
                    , { field: 'HQtyMust', title: '应收数量', width: 150 }
                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                    , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                    , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                    , { field: 'HBatchNo', title: '批次', width: 150 }
                    //, { field: 'HPieceQty', title: '本次支付金额', width: 150 }
                ]]
                // , data: [linterid]
                , text: {
                    none: '暂无相关数据'
                }
            }
            for (var i = 0; i <= sSubStr.length - 1; i++) {   //判断扫码数量不能为0
                if (parseFloat(sSubStr[i].HQty) > 0) {
                    s = 1;
                , page: true
                , height: 500
                , done: function () {
                    //layer.closeAll("loading");
                }
            }
            if (s == 0) {
                layer.msg("产品退库记录未扫码!", { icon: 5 });
            });
            table.render({
                elem: '#mx-table'
                // , url: 'http://localhost:8083/Web/GetHBarCodeShowBillSub'
                //, toolbar: '#toolbarDemo'
                // , where: { sMsg: linterid, sMsg2: lentryid }
                , cols: [[
                    // , { field: 'HMTONO', title: '计划跟踪单号', width: 100,, sort: true, fixed: true edit: 'text', hide: true }
                    , { field: 'HMaterID', title: '物料ID', width: 100, hide: true }
                ]]
                // , data: [linterid]
                , page: true
                , height: 500
                , done: function () {
                    //layer.closeAll("loading");
                }
            });
        });
        function GetHWHValue(obj)  //返回仓库
        {
            $("#HWHNAME").val(obj[0].HName);
            //sessionStorage["HWHID"] = obj[0].HItemID;
            $("#HWHID").val(obj[0].HItemID);
        }
        function GetHSpValue(obj) {  //返回调入仓位
            $("#HStockPlaceName").val(obj[0].HName);
            $("#HStockPlaceID").val(obj[0].HItemID);
            $("#HWHNAME").val(obj[0].HWhName);
            $("#HWHID").val(obj[0].HWHID);
        }
        function GetHSupValue(obj) {  //返回供应商
            $("#HSupName").val(obj[0].HName);
            $("#HSupID").val(obj[0].HItemID);
        }
        function GetHKeeperValue(obj) {  //返回保管
            $("#HKeeper").val(obj[0].HName);
            $("#HKeeperID").val(obj[0].HItemID);
        }
        function GetHSecManagerValue(obj) {  //返回验收
            $("#HSecManager").val(obj[0].HName);
            $("#HSecManagerID").val(obj[0].HItemID);
        }
        function GetHDeptNameValue(obj) {   //返回部门
            $("#HDeptName").val(obj[0].HName);
            $("#HDeptID").val(obj[0].HItemID);
        }
        function AllowLoadData(sSubStr) {  //非空验证
            //if ($("#HSourceBillNo").val() == '') {
            //    layer.msg("请先扫源单!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HDeptName").val() == '') {
            //    layer.msg("部门没有选择!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HSecManager").val() == '') {
            //    layer.msg("验收人没有选择!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HKeeper").val() == '') {
            //    layer.msg("保管人没有选择!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HSupName").val() == '') {
            //    layer.msg("供应商没有选择!", { icon: 5 });
            //    return false;
            //}
            //if ($("#HWHNAME").val() == '') {
            //    layer.msg("仓库没有选择!", { icon: 5 });
            //    return false;
            //}
            if ($("#HBillNo").val() == '') {
                layer.msg("错误的单据号!", { icon: 5 });
                return false;
            }
            if ($("#HInterID").val() == '') {
                layer.msg("错误的内码!", { icon: 5 });
                return false;
            }
            if (sSubStr == '') {
                layer.msg("没有物料明细记录!", { icon: 5 });
                return false;
            }
            if (sSubStr != '') {
                for (var i = 0; i <= sSubStr.length - 1; i++) {  //判断扫码数量不能大于应收数量
                    if (parseFloat(sSubStr[i].HQtyMust) > 0) {
                        if (parseFloat(sSubStr[i].HQty) > parseFloat(sSubStr[i].HQtyMust)) {
                            layer.msg("数量不能大于应收数量!", { icon: 5 });
                            return false;
                        }
                    }
                }
                for (var i = 0; i <= sSubStr.length - 1; i++) {   //判断扫码数量不能为0
                    if (parseFloat(sSubStr[i].HQty) > 0) {
                        s = 1;
                    }
                }
                if (s == 0) {
                    layer.msg("产品退库记录未扫码!", { icon: 5 });
                    return false;
                }
            }
            else {
                return true;
            }
        }
        else {
            return true;
        }
    }
    </script>
</body>