zzr99
2022-07-25 9a22bf08accac05100ad03b8fda3b6e5402b7839
WebTM/views/²Ö´æ¹ÜÀí/ÌõÂë¿â´æ/KF_ICInventoryByMaterID.html
@@ -30,12 +30,11 @@
                    </div>
                    <div class="layui-tab layui-col-xs12" lay-filter="tab-ProductlnBill">
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li lay-id="1" style="padding:1px;" class="layui-this">仓库信息</li>
                            <li lay-id="1" style="padding:1px;" >仓库信息</li>
                            <li lay-id="2" style="padding:1px;">库存信息</li>
                            <!--<li lay-id="5">日志</li>-->
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item">
                            <div class="layui-tab-item   layui-show">
                                <div class="layui-form-item" style="padding:0px;margin:0px">
                                    <div class="layui-row">
                                        <div class="layui-col-xs3">
@@ -60,48 +59,19 @@
                                            <input type="hidden" name="HStockPlaceID" id="HStockPlaceID" lay-verify="HStockPlaceID" value="0" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-col-xs3">
                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" style="display:none">...</button>
                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" >...</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-tab-item">
                                <table class="layui-hide" id="wl-table" lay-filter="wl-table"></table>
                            </div>
                            <div class="layui-tab-item">
                                <table class="layui-hide" id="mx-table" lay-filter="mx-table"></table>
                                <table class="" id="wl-table" lay-filter="wl-table"></table>
                            </div>
                        </div>
                        <!--<div class="layui-form-item" style="margin-bottom: 20px;">
                            <div class="layui-row">
                                <div class="layui-col-xs3">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="Saver">提交</button>
                                </div>
                                <div class="layui-col-xs3">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdModify">编辑</button>
                                </div>
                                <div class="layui-col-xs3">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdDelete">删除</button>
                                </div>
                                <div class="layui-col-xs3">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="Cancel">退出</button>
                                </div>
                            </div>
                        </div>-->
                    </div>
                    <div class="layer-footer" style="z-index: 10; position: fixed; text-align: center; bottom: 0; width:100%; height:50px">
                        <button type="button" lay-submit="" class="layui-btn" lay-filter="Saver">查询</button>
                        <button type="button" lay-submit="" class="layui-btn" lay-filter="Cancel">退出</button>
                    </div>
                    <div id="" style="display:none;">
                        <audio id="cs" hidden controls>
                            <source src="../../video/jingbao.wav" type="audio/ogg">
                        </audio>
                    </div>
                    <div id="" style="display:none;">
                        <audio id="cs2" hidden controls>
                            <source src="../../video/success.wav" type="audio/ogg">
                        </audio>
                    </div>
                </form>
            </div>
@@ -124,49 +94,67 @@
                , form = layui.form
                , element = layui.element;
            var option = [];
            var col = [];
            //判断是否登录 æœªç™»å½•则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "../../user/login.html"; });
            }
            var params = getUrlVars();
            var linterid = params[params[0]]; //从参数中获取 å•据内码
            var lSourceBillType = params[params[2]];  //从单据获取 æºå•类型
            //获取参数
            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;
            }
            //清空界面  new
            //表头初始化赋值(根据登录用户获取 é»˜è®¤ä»“库、部门、验收、保管、金蝶用户) 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();
            //var HSourceFlag = sessionStorage["SourceFlag"];
            //默认带入的仓库,如果启用仓位则仓位有效,如果没有启用则仓位灰度 new
            $("#HWHID").val(sessionStorage["HWHID"]);
            $("#HWHNAME").val(sessionStorage["HWHName"]);
            $("#HStockPlaceID").val(sessionStorage["HSPID"]);
            $("#HStockPlaceName").val(sessionStorage["HSPName"]);
            $("#HBarCode").focus();
            //判断是否新增
            if (linterid == null || linterid == 0) {
                    set_InitGrid();
            }
            else {//如果修改则走下面 new
            }
            //初始化明细表格
            function set_InitGrid() {
                columns = [
                    { type: 'checkbox', fixed: 'left' }
                    , { field: 'HQty', title: '数量', width: 150 }
                    , { field: 'HMaterID', title: '物料ID', width: 150, hide: true }
                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                    , { field: 'HMaterID', title: '物料ID', width: 150, hide: true }
                    , { field: 'HBatchNo', title: '批次', width: 150 }
                    , { field: 'HAuxPropName', title: '辅助属性', width: 150 }
                    , { field: 'HPackNum', title: '箱数', width: 150 }
                    , { field: 'HSPackNum', title: '托数', width: 150 }
                    , { field: 'HAuxPropID', title: 'HAuxPropID', width: 150, hide: true }
                    , { field: 'HAuxPropName', title: '辅助属性', width: 150 }
                    , { field: 'HWHName', title: '仓库', width: 150}
                    , { field: 'HWhID', title: 'HWhID', width: 150, hide: true }
                    , { field: 'HSPName', title: '仓位', width: 150 }
@@ -187,119 +175,6 @@
                };
            }
            //获取参数
            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;
            }
            //判断是否登录 æœªç™»å½•则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "../../user/login.html"; });
            }
            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);
            //            //$("#HStockPlaceID").val(d.data[0].HSPID);
            //            //$("#HKeeperID").val(d.data[0].HKeeperID);
            //            //$("#HSecManagerID").val(d.data[0].HSecManagerID);
            //            HSourceFlag = true;
            //        }
            //    })
            //}
            //function RoadBillSub(linterid)//加载表体
            //{
            //    $("#HInterID").val(linterid);//修改时主表ID
            //    //编辑加载数据
            //    var sInterID = $("#HInterID").val();
            //    table.render({
            //        elem: '#wl-table'
            //        //, url: 'http://61.130.49.162:9090/WMSAPI///ProductIn/DisBillEntryList_Webs_Json'
            //        , url: GetWEBURL() + '/ProductIn/DisBillEntryList_Webs_Json'
            //        , toolbar: '#toolbarDemo'
            //        , defaultToolbar: []
            //        , where: { HBillID: sInterID, HBillType: '1202', 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 }
            //        ]]
            //        // , data: [linterid]
            //        // , page: true
            //        , height: 500
            //        , done: function () {
            //            layer.closeAll("loading");
            //        }
            //    });
            //}
            //动态加载源单类型列表 new
            //判断是否新增
            if (linterid == null || linterid == 0) {
                set_InitGrid();
            }
            else {//如果修改则走下面 new
            }
            //进入物料明细页签、条码框 å…‰æ ‡ç„¦ç‚¹   new
            //if (1 == 2)
            //{
            //    element.tabChange('tab-ProductlnBill', '3');
            //    var pFocus = $("#HBarCode");
            //    pFocus.focus();
            //    pFocus.select();
            //}
            //else
            //{
            //    element.tabChange('tab-ProductlnBill', '1');
            //    var pFocus = $("#HSourceBillNo");
            //    pFocus.focus();
            //    pFocus.select();
            //}
            //
            //
            //选择仓库
            form.on('submit(HWHID-BT)', function () {//选择仓库
@@ -312,8 +187,27 @@
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../../views/Baseset/基础资料/Gy_WarehouseList.html?Type=HWHID', 'yes']
                    , resize: false
                    , cancel: function () {
                        //$(".layui-btn").removeClass("layui-btn-disabled");
                    ,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('请选择数据');
                        }
                        $("#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 () {
                    },
                    success: function (layero, index) {
                    }
                })
            });
@@ -329,8 +223,27 @@
                    , 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");
                    , 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('请选择数据');
                        }
                        $("#HStockPlaceName").val(checkStatus.data[0].HName);
                        $("#HStockPlaceID").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                })
            });
@@ -348,36 +261,55 @@
            //查询
            form.on('submit(Saver)', function (data) {//查询
                var sHWHID = $("#HWHID").val()
                var sHSPID = $("#HStockPlaceID").val()
                layer.load(3)
                table.render({
                    elem: '#wl-table'
                    , url: GetWEBURL() + '/KF_ICInventoryByMaterID/GetBillEntry_TmpList_Pack'
                    , toolbar: '#toolbarDemo'
                    , defaultToolbar: []
                    , where: { HBarCode: '', sHWHID: sHWHID, sHSPID: sHSPID, HOWNERID: sessionStorage["OrganizationID"], sWhere: '' }
                    , cols: [[
                        { type: 'radio' }
                        , { field: 'HQty', title: '数量', width: 150 }
                        , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                        , { field: 'HMaterName', title: '物料名称', width: 150 }
                        , { field: 'HMaterModel', title: '规格型号', width: 150 }
                        , { field: 'HMaterID', title: '物料ID', width: 150, hide: true }
                        , { field: 'HBatchNo', title: '批次', width: 150 }
                        , { field: 'HAuxPropName', title: '辅助属性', width: 150 }
                        , { field: 'HAuxPropID', title: 'HAuxPropID', width: 150, hide: true }
                        , { field: 'HWHName', title: '仓库', width: 150 }
                        , { field: 'HWhID', title: 'HWhID', width: 150, hide: true }
                        , { field: 'HSPName', title: '仓位', width: 150 }
                        , { field: 'HSPID', title: 'HSPID', width: 150, hide: true }
                        , { field: 'HOWNERName', title: '组织', width: 150 }
                    ]]
                    // , data: [linterid]
                    // , page: true
                    , height: 500
                    , done: function () {
                        layer.closeAll("loading");
                var sHWHID = $("#HWHID").val();
                var sHSPID = $("#HStockPlaceID").val();
                layer.load(3);
                $.ajax({
                    url: GetWEBURL() + '/KF_ICInventoryByMaterID/GetBillEntry_TmpList_Pack1',
                    type: "GET",
                    data: { "HBarCode": '', "sHWHID": sHWHID, "sHSPID": sHSPID, "HOWNERID": sessionStorage["OrganizationID"], "sWhere": '' },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var data = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            for (var i = 0; i < data.length; i++) {
                                if (data[i].name == '物料ID' || data[i].name == '辅助属性ID' || data[i].name == '仓库ID' || data[i].name == '仓位ID') {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                                    }
                                }
                            }
                            //动态显示列名
                            table.render({
                                elem: '#wl-table'
                                , cols: [col]
                                , data: data1.data
                                , height: 550
                                , page: true
                                , cellMinWidth: 90
                                , limit: 50
                                , limits: [50, 500, 5000, 20000]
                            });
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                layer.closeAll("loading");
@@ -396,9 +328,9 @@
            //查询条码库存
            $('#HBarCode').on('keydown', function (event) {  //查询条码库存
                var HBarCode = $('#HBarCode').val()
                var sHWHID = $("#HWHID").val()
                var sHSPID = $("#HStockPlaceID").val()
                var HBarCode = $('#HBarCode').val();
                var sHWHID = $("#HWHID").val();
                var sHSPID = $("#HStockPlaceID").val();
                if (event.keyCode == 13) {
                    var HBarCode = $('#HBarCode').val()
                    //var Flag = sessionStorage["SourceFlag"];
@@ -411,59 +343,70 @@
                    if (HBarCode != "") {
                        $('#HBarCode').val("");
                    }
                    layer.load(3)
                    table.render({
                        elem: '#wl-table'
                        , url: GetWEBURL() + '/KF_ICInventoryByMaterID/GetBillEntry_TmpList_Pack'
                        , toolbar: '#toolbarDemo'
                        , defaultToolbar: []
                        , where: { HBarCode: HBarCode, sHWHID: sHWHID, sHSPID: sHSPID, HOWNERID: sessionStorage["OrganizationID"], sWhere: '' }
                        , cols: [[
                            { type: 'radio' }
                            , { field: 'HQty', title: '数量', width: 150 }
                            , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                            , { field: 'HMaterName', title: '物料名称', width: 150 }
                            , { field: 'HMaterModel', title: '规格型号', width: 150 }
                            , { field: 'HMaterID', title: '物料ID', width: 150, hide: true }
                            , { field: 'HBatchNo', title: '批次', width: 150 }
                            , { field: 'HAuxPropName', title: '辅助属性', width: 150 }
                            , { field: 'HAuxPropID', title: 'HAuxPropID', width: 150, hide: true }
                            , { field: 'HWHName', title: '仓库', width: 150 }
                            , { field: 'HWhID', title: 'HWhID', width: 150, hide: true }
                            , { field: 'HSPName', title: '仓位', width: 150 }
                            , { field: 'HSPID', title: 'HSPID', width: 150, hide: true }
                            , { field: 'HOWNERName', title: '组织', width: 150 }
                        ]]
                        // , data: [linterid]
                        // , page: true
                        , height: 500
                        , done: function () {
                            layer.closeAll("loading");
                    layer.load(3);
                    $.ajax({
                        url: GetWEBURL() + '/KF_ICInventoryByMaterID/GetBillEntry_TmpList_Pack1',
                        type: "GET",
                        data: { "HBarCode": HBarCode, "sHWHID": sHWHID, "sHSPID": sHSPID, "HOWNERID": sessionStorage["OrganizationID"], "sWhere": '' },
                        success: function (data1) {
                            if (data1.count == 1) {
                                var data = [];
                                //给空的数组赋值
                                for (var key in data1.list) {
                                    data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                                }
                                for (var i = 0; i < data.length; i++) {
                                    if (data[i].name == '物料ID' || data[i].name == '辅助属性ID' || data[i].name == '仓库ID' || data[i].name == '仓位ID') {
                                        col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                    }
                                    else {
                                        switch (data[i].Type) {
                                            //int
                                            case 'DateTime':
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
                                                break;
                                            default:
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                                        }
                                    }
                                }
                                //动态显示列名
                                table.render({
                                    elem: '#wl-table'
                                    , cols: [col]
                                    , data: data1.data
                                    , height: 550
                                    , page: true
                                    , cellMinWidth: 90
                                    , limit: 50
                                    , limits: [50, 500, 5000, 20000]
                                });
                                //layer.alert("查询成功", { icon: 1 });
                            } else {
                                layer.alert(data1.code + data1.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                    layer.closeAll("loading");
                }
            });
            function playSound() {
                console.log("playSound");
                //var audio = document.getElementById("cs");
                //$("appendAut").html("");
                //if (audio == null)
                //$("appendAut").append('<audio id="cs" hidden controls> <source src = "../../video/jingbao.wav" type = "audio/ogg"> </audio >');
                //$("appendAut").attr("src","../../video/jingbao.wav")
                var audio = document.getElementById("cs");
                audio.play();
            }
            function playSound1() {
                console.log("playSound1");
                //var audio = document.getElementById("cs");
                //$("appendAut").html("");
                //if (audio == null)
                //$("appendAut").append('<audio id="cs" hidden controls> <source src = "../../video/success.wav" type = "audio/ogg"> </audio >');
                //$("appendAut").attr("src", "../../video/success.wav")
                var audio = document.getElementById("cs2");
                audio.play();
            }