yusijie
2024-04-25 3de6a9eb5d6c00a756831fbab13da264c198ece7
WebTM/views/²Ö´æ¹ÜÀí/²Ö¿âµ÷²¦/Cc_LookingForBill.html
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>找货单</title>
<title>下架找货单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
@@ -21,13 +21,13 @@
                    <div class="layui-form-item" style="padding:15px;margin:0px">
                        <div class="layui-row">
                            <div class="layui-col-xs3">
                                <label class="layui-form-label" style="width:90px;padding-left:0px;">源单号</label>
                                <label class="layui-form-label" style="width:60px;padding-left:0px;">源单号</label>
                            </div>
                            <div class="layui-col-xs8">
                                <input type="text" name="HSourceBillNo" id="HSourceBillNo" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-col-xs3">
                                <label class="layui-form-label" style="width:90px;padding-left:0px;">实物条码</label>
                                <label class="layui-form-label" style="width:60px;padding-left:0px;">实物条码</label>
                            </div>
                            <div class="layui-col-xs8">
                                <input type="text" name="HBarCode" id="HBarCode" autocomplete="off" class="layui-input">
@@ -45,6 +45,7 @@
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li lay-id="1" style="padding:1px;display:none">表头信息</li>
                            <li lay-id="2" style="padding:1px;" class="layui-this">明细信息</li>
                            <li lay-id="3" style="padding:1px;">已扫信息</li>
                        </ul>
                        <div class="layui-tab-content">
                            <!--表头信息-->
@@ -121,6 +122,10 @@
                            <div class="layui-tab-item layui-show">
                                <table class="layui-hide" id="bzd-table" lay-filter="bzd-table"></table>
                            </div>
                            <!--已扫信息-->
                            <div class="layui-tab-item">
                                <table class="layui-hide" id="bzd-table2" lay-filter="bzd-table2"></table>
                            </div>
                        </div>
                    </div>
                    <div class="layer-footer" style="z-index: 10; position: fixed; text-align: center; bottom: 0; width:100%; height:50px">
@@ -159,7 +164,7 @@
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "user/login.html"; });
                }, function () { window.location.href = "../../user/login.html"; });
            }
            //初始基本信息赋值
@@ -173,6 +178,14 @@
            $("#HSource").val(sessionStorage["HSource"]);
            $("#HMakerID").val(sessionStorage["Czybm"]);
            $("#HMaker").val(sessionStorage["HUserName"]);
            //判断用户是否绑定班组和生产资源
            if ($("#HGroupID").val() == 0 || $("#HSourceID").val() == 0) {
                layer.confirm("该用户未绑定班组或生产资源!不允许找货!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['确认退出']
                }, function () { window.location.href = "../../index.html"; });
            }
            //获取最大单据号 new
            $("#HInterID").val("");
@@ -195,17 +208,18 @@
                , page: true
                //, height: 256
                , cellMinWidth: 90
                , limit: 500
                , cols: [[
                    { type: 'numbers', title: '序号' }
                    , { field: 'HIsStatus', title: '是否扫码' }
                    , { field: 'HSourceInterID', title: '源单ID', hide: true }
                    , { field: 'HSourceBillNo', title: '源单号', width: 110 }
                    , { field: 'HMTONo', title: '批号', width: 180 }
                    , { field: 'HSPID', title: '仓位ID', hide: true }
                    , { field: 'HSPName', title: '仓位', hide: true }
                    , { field: 'HStatus', title: '在库状态', width: 165 }
                    , { field: 'HWhID', title: '仓库ID', hide: true }
                    , { field: 'HWhName', title: '仓库' }
                    , { field: 'HSPID', title: '仓位ID', hide: true }
                    , { field: 'HSPName', title: '仓位' }
                    , { field: 'HWhName', title: '仓库', width: 130, hide: true }
                    , { field: 'HSourceInterID', title: '源单ID', hide: true }
                    , { field: 'HSourceBillNo', title: '源单号', width: 110 }
                    , { field: 'HGroupID', title: '班组ID', hide: true }
                    , { field: 'HGroup', title: '班组' }
                    , { field: 'HSourceID', title: '生产资源ID', hide: true }
@@ -217,20 +231,64 @@
                    , { field: 'HMaterModel', title: '规格型号' }
                    , { field: '即时库存', title: '即时库存' }
                    , { field: 'HBarCode', title: '条码编号', hide: true }
                    , { field: 'HInterID', title: '单据ID' }
                    , { field: 'HInterID', title: '单据ID', hide: true }
                    , { field: 'HBillNo', title: '单据号' }
                    , { field: 'HMakerID', title: '制单人ID' }
                    , { field: 'HMakerID', title: '制单人ID', hide: true }
                    , { field: 'HMaker', title: '制单人' }
                    , { field: 'HBillType', title: 'HBillType' }
                    , { field: 'HBillType', title: 'HBillType', hide: true }
                ]]
                , text: {
                    none: '暂无相关数据,请先扫描源单号!' //默认:无数据。注:该属性为 layui 2.2.5 å¼€å§‹æ–°å¢ž
                }
            };
            //主表列表-已扫信息
            var option2 = {
                elem: '#bzd-table2'
                //, toolbar: '#toolbarDemo'
                , page: true
                //, height: 256
                , cellMinWidth: 90
                , limit: 500
                , cols: [[
                    { type: 'numbers', title: '序号' }
                    , { field: 'HIsStatus', title: '是否扫码' }
                    , { field: 'HMTONo', title: '批号', width: 180 }
                    , { field: 'HSPID', title: '仓位ID', hide: true }
                    , { field: 'HSPName', title: '仓位', hide: true }
                    , { field: 'HStatus', title: '在库状态', width: 165 }
                    , { field: 'HWhID', title: '仓库ID', hide: true }
                    , { field: 'HWhName', title: '仓库', width: 130, hide: true }
                    , { field: 'HSourceInterID', title: '源单ID', hide: true }
                    , { field: 'HSourceBillNo', title: '源单号', width: 110 }
                    , { field: 'HGroupID', title: '班组ID', hide: true }
                    , { field: 'HGroup', title: '班组' }
                    , { field: 'HSourceID', title: '生产资源ID', hide: true }
                    , { field: 'HSource', title: '生产资源', width: 115, templet: '#sexTpl' }
                    , { field: 'HQty', title: '数量' }
                    , { field: 'HMaterID', title: '物料ID', hide: true }
                    , { field: 'HMaterName', title: '物料名称', width: 120 }
                    , { field: 'HMaterNumber', title: '物料编码' }
                    , { field: 'HMaterModel', title: '规格型号' }
                    , { field: '即时库存', title: '即时库存' }
                    , { field: 'HBarCode', title: '条码编号', hide: true }
                    , { field: 'HInterID', title: '单据ID', hide: true }
                    , { field: 'HBillNo', title: '单据号' }
                    , { field: 'HMakerID', title: '制单人ID', hide: true }
                    , { field: 'HMaker', title: '制单人' }
                    , { field: 'HBillType', title: 'HBillType', hide: true }
                ]]
                , text: {
                    none: '暂无相关数据,请先扫描实物条码!' //默认:无数据。注:该属性为 layui 2.2.5 å¼€å§‹æ–°å¢ž
                }
            };
            //初始加载表格
            option.data = [];
            table.render(option);
            option2.data = [];
            table.render(option2);
            //进入页面默认光标在源单号上
            $("#HSourceBillNo").focus();
@@ -285,9 +343,9 @@
                                        rowFlage += i + 1 + ",";
                                    }
                                }
                                if (rowFlage) {
                                    layer.msg("第" + rowFlage + "行数据无条码,请先生成条码!", { icon: 5, btn: ['我已知晓'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                }
                                //if (rowFlage) {
                                //    layer.msg("第" + rowFlage + "行数据无条码,请先生成条码!", { icon: 5, btn: ['我已知晓'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                //}
                                $("#HSourceBillNo").attr("readonly", "readonly");//源单号只读
                                $("#HSourceBillNo").css("background-color", "#efefef4d");
                                element.tabChange('tab-LookingForBill', '2');  //跳转页签
@@ -305,6 +363,7 @@
                }
            });
            var data = new Object();
            //扫实物条码
            $('#HBarCode').on('keydown', function (event) {
                var HBarCode = $('#HBarCode').val()
@@ -319,10 +378,14 @@
                                layer.close(index);
                                $('#HBarCode').val("");
                                layer.msg("该实物已扫码,请勿重复扫码", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            } else if (sSubStr[i].HStatus != null && sSubStr[i].HStatus != "" && sSubStr[i].HStatus != "在库") {
                                layer.close(index);
                                layer.msg("该实物在裁切中,不允许扫码", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            } else {
                            }
                            //else if (sSubStr[i].HStatus != null && sSubStr[i].HStatus != "" && sSubStr[i].HStatus != "在库")
                            //{
                            //    layer.close(index);
                            //    layer.msg("该实物在" + sSubStr[i].HSource+"裁切中,不允许扫码", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            //}
                            else
                            {
                                sSubStr[i].HIsStatus = "是";
                                sSubStr[i].HSourceID = $("#HSourceID").val();
                                sSubStr[i].HSource = $("#HSource").val();
@@ -334,15 +397,20 @@
                                sSubStr[i].HMaker = $("#HMaker").val();
                                option.data = table.cache["bzd-table"];
                                table.render(option);
                                layer.close(index);
                                $('#HBarCode').val("");
                                //动态获取已扫码记录并添加到已扫信息中
                                table.cache["bzd-table2"].push(sSubStr[i]);
                                option2.data = table.cache["bzd-table2"];
                                table.render(option2);
                                element.tabChange('tab-LookingForBill', '3');//跳转页签
                                layer.close(index);
                                layer.msg("扫码成功!", { icon: 1, time: 1000 });
                            }
                        }
                    }
                    if (rowCount == 0) {
                        layer.close(index);
                        layer.msg("无效条码!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        layer.msg("您扫的条码不在找货清单中!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
@@ -425,18 +493,18 @@
            form.on('submit(Saver)', function (data) {//提交
                //debugger;
                //var sMainStr = JSON.stringify(data.field);
                var tableData = table.cache['bzd-table'];
                for (var i = 0; i < tableData.length; i++) {
                    if (tableData[i].HIsStatus == "是" ) {
                var tableData = table.cache['bzd-table2'];
                //for (var i = 0; i < tableData.length; i++) {
                //    if (tableData[i].HIsStatus == "是" ) {
                    } else {
                        //移除当前行
                        tableData.splice(i, 1);
                        i--;
                        option.data = tableData;
                        table.render(option);
                    }
                }
                //    } else {
                //        //移除当前行
                //        tableData.splice(i, 1);
                //        i--;
                //        option.data = tableData;
                //        table.render(option);
                //    }
                //}
                var sSubStr = JSON.stringify(tableData);
                sSubStr = "{\"oSub\": " + sSubStr + "}";
                //sSubStr = JSON.stringify(sSubStr);
@@ -452,15 +520,15 @@
                        async: true,
                        data: { "oMain": sSubStr },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1) {
                                layer.confirm(data.Message, {
                                    icon: 1, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['新增'],
                                    btn2: function () {
                                        //parent.layui.admin.events.closeThisTabs();关闭页签
                                        //window.close();//关闭页面,浏览器有效,PDA无效
                                        parent.location.href = "../../../views/index.html"
                                    }//关闭
                        success: function (result) {
                            if (result.count == 1) {
                                layer.confirm(result.Message, {
                                icon: 1, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['新增'],
                                btn2: function () {
                                    //parent.layui.admin.events.closeThisTabs();关闭页签
                                    //window.close();//关闭页面,浏览器有效,PDA无效
                                    parent.location.href = "../../../views/index.html"
                                }//关闭
                                }, function () { window.location.reload(); });//新增
                            }
                            else {