llj
2025-08-07 177ae90dc5c8cc2a2942b2ec8b2e36aac0b16483
WebTM/views/³µ¼ä¹ÜÀí/²úÏß/MES_ProductionLinePackagingList.html
@@ -48,11 +48,18 @@
                                <div class="layui-inline">
                                    <label class="layui-form-label" id="BT_HBardcodeType">条码类型</label>
                                    <div class="layui-input-block">
                                        <!--<input type="text" class="layui-input" name="tmlx" id="tmlx">-->
                                        <select name=" tmlx" id="tmlx">
                                            <option value="">全部</option>
                                            <option value="流转卡号">流转卡号</option>
                                            <option value="镭雕条码">镭雕条码</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width: 85px;">组织名称</label>
                                    <div class="layui-input-block" style="margin-left: 120px; width: 185px;">
                                        <select name="HOrgID" id="HOrgID" lay-verify="HOrgID" class="ForFilteringSchemes">
                                            <!--动态渲染组织-->
                                        </select>
                                    </div>
                                </div>
@@ -62,50 +69,48 @@
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                                <div class="layui-colla-content">
                                    <div class="layui-inline">
                                    <div class="layui-row" style="margin-top: 5px; margin-left: 4%;">
                                        <div class="layui-inline">
                                            <span id="BT_QTTJ">其他条件></span>
                                            <label class="layui-form-label" id="BT_HBillNo">生产任务单</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label" id="BT_HBillNo">生产任务单</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label" id="BT_HMaker">制单人</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HMaker" id="HMaker">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label" id="BT_HICMOBillNo">条码</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HICMOBillNo" id="HICMOBillNo">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label" id="BT_HInitTimeCycle">日期间隔</label>
                                        <div class="layui-input-block">
                                            <select name="HInitTimeCycle" id="HInitTimeCycle" class="ForFilteringSchemes" lay-filter="HInitTimeCycle" style="width:190px;">
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-row" style="padding: 10px 0; margin-left: 4%;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" id="BT_HBeginDate">日期</label>
                                            <label class="layui-form-label" id="BT_HMaker">制单人</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" name="HMaker" id="HMaker">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" id="BT_HICMOBillNo">条码</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" name="HICMOBillNo" id="HICMOBillNo">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row" style="margin-top: 5px; margin-left: 4%;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" id="BT_HInitTimeCycle">日期间隔</label>
                                            <div class="layui-input-block">
                                                <select name="HInitTimeCycle" id="HInitTimeCycle" class="ForFilteringSchemes" lay-filter="HInitTimeCycle" style="width:190px;">
                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" id="BT_HBeginDate">开始日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="date" class="layui-input" lay-verify="HBeginDate" name="HBeginDate" id="HBeginDate" style="padding-left: 75px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label">-</label>
                                            <label class="layui-form-label">结束日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="date" class="layui-input" lay-verify="HEndDate" name="HEndDate" id="HEndDate" style="padding-left: 75px;">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row" style="margin-top: 5px; margin-left: 4%;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" id="BT_ColName">过滤</label>
@@ -189,32 +194,6 @@
                                        </div>
                                    </div>
                                </div>
                                <!--<div class="layui-colla-content">
                                    <div class="layui-inline">
                                        <div class="layui-inline">
                                            <span>其他条件></span>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">产品名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="hname" id="hname">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">产品代码</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="hnumber" id="hnumber">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">规格型号</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="hmodel" id="hmodel">
                                        </div>
                                    </div>
                                </div>-->
                            </div>
                        </div>
                        <table class="layui-form-item" id="mainTable" lay-filter="mainTable"></table>
@@ -242,7 +221,7 @@
            </div>
        </div>
    </div>
    <!--<script src="../../../layuiadmin/layui/layui.js"></script>-->
    <script>
        layui.config({
@@ -261,19 +240,22 @@
            , util = layui.util;
            //var sWhere = " äº§å“ä»£ç  = 'BX0002'";
            var sWhere = "";
            var HModName = "MES_ProductionLinePackagingList";
            initFunction(1, HModName, sessionStorage["HTranSlate"]);
            form.render('select');
            var option = {
                elem: '#mainTable'
                , toolbar: '#toolbarDemo'
                ,height: 'full-50'
                , height: 'full-50'
                , page: true
                , limit: 50
                , limits: [50, 500, 5000, 20000]
                , cols: [[
                    {type:'radio'}
                    { type: 'radio' }
                    , { field: 'HInterID', title: 'ID', sort: true, width: 100 }
                    , { field: '项目号', title: '项目号', sort: true, width: 100 }
                    ,{ field: '唯一条码', title: '唯一条码', sort: true, width: 170 }
                    , { field: '唯一条码', title: '唯一条码', sort: true, width: 170 }
                    //, { field: '扫码日期', title: '扫码日期', sort: true, width: 200, templet: "<div>{{layui.util.toDateString(this.扫码日期, 'yyyy-MM-dd')}}</div> " }
                    , {
                        field: '扫码日期', title: '包装日期', sort: true, width: 110, templet: function (d) {
@@ -313,85 +295,22 @@
                }
            };
            table.render(option);
            //进入页面显示的缓存列表
            layer.load(3);
            $.ajax({
                //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                url: GetWEBURL1() + '/LEMS/MES_ProductionLinePackagingList_Json',
                type: "GET",
                async: false,
                data: { "sWhere": sWhere },
                success: function (data1) {
                    if (data1.count == 1) {
                        option.data = data1.data;
                        table.render(option);
                        if ($("#HInitTimeCycle").val() == 0 && $("#HInitTimeCycle").val() == "") {
                            setSelect_HInitTimeCycle();
                        }
            set_ClearBill();
                        if ($("#Comparator").val() == 0 && $("#ColContent").val() == "") {
                            ColFilter();
                        }
                        layer.closeAll("loading");
                    } else {
                        layer.closeAll("loading");
                        layer.alert(get_MessageError(data1.code + data1.Message, sessionStorage["HTranSlate"]), { icon: 5 });
                    }
                }, error: function () {
                    layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
                }
            });
            var HModName = "MES_ProductionLinePackagingList";
            initFunction(1, HModName, sessionStorage["HTranSlate"]);
            form.render('select');
            //日期间隔下拉列表监听
            form.on('select(HInitTimeCycle)', function (data) {
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                //若日期间隔不为 ä»»æ„é—´éš”,则禁用开始日期与结束日期的选择
                if (HInitTimeCycle != -1) {
                    $('#HBeginDate').prop('disabled', true);
                    $('#HEndDate').prop('disabled', true);
            // åˆå§‹åŒ–界面
            function set_ClearBill() {
                //初始化组织
                Organ();
                //查询
                get_FastQuery();
            }
                    $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
                    $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                    //执行查询方法
                    $("#btnSearch").click;
                } else {
                    $('#HBeginDate').prop('disabled', false);
                    $('#HEndDate').prop('disabled', false);
                }
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));//开始日期
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));//结束日期
                $("#HBarCode_Pack").val("");//唯一条码
                $("#HICMOBillNo").val("");//条码
                $("#tmlx").val("");//条码类型
                $("#HBillNo").val("");//生产任务单单号
                $("#HMaker").val("");//数量制单人
                $("#单据号").val("");//单据号
                $("#ColContent").val("");
                $("#ColName").val("0");
                $("#Comparator").val("0");
                $("#ColContent1").val("");
                $("#ColName1").val("0");
                $("#Comparator1").val("0");
                $("#ColContent2").val("");
                $("#ColName2").val("0");
                $("#Comparator2").val("0");
                form.render('select');
                $("#btnSearch").click();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {//选择仓位
            //快速查询
            function get_FastQuery() {
                var HBarCode_Pack = $("#HBarCode_Pack").val();//唯一条码
                var HICMOBillNo = $("#HICMOBillNo").val();//条码
                var tmlx = $("#tmlx").val();//条码类型
@@ -400,16 +319,17 @@
                var å•据号 = $("#单据号").val();//数量制单人
                var HBeginDate = $("#HBeginDate").val();//开始日期
                var HEndDate = $("#HEndDate").val();//结束日期
                var ColName = $("#ColName").val();//复选框
                var Comparator = $("#Comparator").val()
                var ColContent = $("#ColContent").val();
                var ColName1 = $("#ColName1").val();//复选框
                var Comparator1 = $("#Comparator1").val()
                var ColContent1 = $("#ColContent1").val();
                var ColName2 = $("#ColName2").val();//复选框
                var Comparator2 = $("#Comparator2").val()
                var ColContent2 = $("#ColContent2").val();
                if (ColName != 0 && Comparator != 0) {
                    var com = "";
                    switch (Comparator) {
@@ -430,7 +350,8 @@
                            break;
                    }
                    sWhere += " and " + ColName + " " + com;
                } if (ColName1 != 0 && Comparator1 != 0) {
                }
                if (ColName1 != 0 && Comparator1 != 0) {
                    var com1 = "";
                    switch (Comparator1) {
                        case "7":
@@ -497,8 +418,15 @@
                if (HEndDate != "") {
                    sWhere += " and åˆ¶å•日期 <= '" + HEndDate + "'";
                }
                sWhere += getOrgIDByUser();//用户关联组织查询过滤
                get_Display(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
            function get_Display(sWhere) {
                $.ajax({
                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                    url: GetWEBURL1() + '/LEMS/MES_ProductionLinePackagingList_Json',
                    type: "GET",
                    async: false,
@@ -521,8 +449,60 @@
                        layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
                    }
                });
                sWhere = "";//调用接口后清空sWhere缓存
                initFunction(1, HModName, sessionStorage["HTranSlate"]);
            }
            //日期间隔下拉列表监听
            form.on('select(HInitTimeCycle)', function (data) {
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                //若日期间隔不为 ä»»æ„é—´éš”,则禁用开始日期与结束日期的选择
                if (HInitTimeCycle != -1) {
                    $('#HBeginDate').prop('disabled', true);
                    $('#HEndDate').prop('disabled', true);
                    $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
                    $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                    //执行查询方法
                    $("#btnSearch").click;
                } else {
                    $('#HBeginDate').prop('disabled', false);
                    $('#HEndDate').prop('disabled', false);
                }
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                $("#HOrgID").val(sessionStorage["Organization"])
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));//开始日期
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));//结束日期
                $("#HBarCode_Pack").val("");//唯一条码
                $("#HICMOBillNo").val("");//条码
                $("#tmlx").val("");//条码类型
                $("#HBillNo").val("");//生产任务单单号
                $("#HMaker").val("");//数量制单人
                $("#单据号").val("");//单据号
                $("#ColContent").val("");
                $("#ColName").val("0");
                $("#Comparator").val("0");
                $("#ColContent1").val("");
                $("#ColName1").val("0");
                $("#Comparator1").val("0");
                $("#ColContent2").val("");
                $("#ColName2").val("0");
                $("#Comparator2").val("0");
                form.render('select');
                $("#btnSearch").click();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {//选择仓位
                get_FastQuery();
            });
            //获取选中行数据
            table.on('row(mainTable)', function (obj) {
@@ -530,7 +510,7 @@
                obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
            });
            //打印
            //#region æ‰“印
            //form.on('submit(Print)', function (obj) {//退出
            //    var checkStatus = table.checkStatus("mainTable"); //获取选中行状态
            //    var linterid = checkStatus.data[0].HInterID;
@@ -590,6 +570,7 @@
            //    })
            //});
            //#endregion
            //白标生成保存
            form.on('submit(WhiteSave)', function (obj) {//退出
@@ -735,6 +716,8 @@
                    layer.msg(get_MessageError('[0000-1-020]请选择一行数据更新!', sessionStorage["HTranSlate"]));
                }
            });
            //#region åˆå§‹æ—¥æœŸé—´éš” ä¸‹æ‹‰åˆ—表
            function setSelect_HInitTimeCycle() {
                var valueList = [0, 1, 2, 3, 4, 5, 6, 29]; //valuelist数组包含与时间相关的整数值
@@ -752,6 +735,7 @@
                $("#HInitTimeCycle").val("29");   //使用jQuery的val()方法将下拉列表的选中值设置为"29   ï¼Œä¸”显示《近三時天》
            }
            //#endregion
            //#region åˆ—明显示下拉框
            function ColFilter() {
                var Organization = '<option  value="0" selected="selected" ></option>';
@@ -769,13 +753,55 @@
                form.render('select');
            }
        //#endregion
            //laydate.render({
            //    elem: '#HDate'
            //    , type: 'datetime'
            //    , trigger: 'click'
            //    , format:'yyyy-MM-dd HH:mm'
            //});
            //获取组织
            function Organ() {
                //获取登录页组织列
                $.ajax({
                    type: "get",
                    async: false,
                    url: GetWEBURlLanguage() + "/Web/GetOrganizations",
                    success: function (result) {
                        var Organization = "";
                        if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data;
                            for (var i = 0; i < data.length; i++) {
                                Organization += '<option  style="color:blue;" value="' + data[i].Name + '">' + data[i].Name + '</option>';
                            }
                            $("#HOrgID").append(Organization);
                            $("#HOrgID").val(sessionStorage["Organization"])
                            form.render('select');
                        }
                        layer.closeAll("loading");
                    }
                })
            }
            //#region æ ¹æ®ç”¨æˆ·èŽ·å–ç”¨æˆ·å…³è”ç»„ç»‡çš„è¿‡æ»¤æ¡ä»¶
            function getOrgIDByUser() {
                var res = "";
                $.ajax({
                    type: "GET",
                    async: false,
                    url: GetWEBURlLanguage() + "/Xt_User/getOrgIDListByUser", //方法所在页面和方法名       ä¼ å‚ ç»„织必须是列表头部查询的组织  ä¸èƒ½ä½¿ç”¨ç”¨æˆ·é»˜è®¤
                    data: { "UserID": sessionStorage["Czybm"], "UserName": sessionStorage["HUserName"], HOrgID: $("#HOrgID").val() },
                    success: function (result) {
                        if (result.count == 1) {
                            if (result.data[0].sWhere == "1") {
                                res = " and ç”Ÿäº§ç»„织 = '" + $("#HOrgID").val() + "'";
                            } else {
                                res = result.data[0].sWhere;
                            }
                        }
                    }, error: function (err) {
                        res = " and 1 = 0";
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                return res;
            }
        //#endregion
            //以上是layui模块
        });