wtt
2024-10-04 79c247e42af02f1536043a79cd39980ffc840116
WebTM/views/Ä£Öξ߹ÜÀí/Ä£Öξ߹ÜÀí/Gy_BarCodeBillList.html
@@ -218,7 +218,8 @@
            var option = [];
            var ins;
            var titleData = ["单据ID", "HMaterID", "HDeptID", "HSupID"];//不需要显示的字段 å¯æ‰©å±•
            var page = 1;//分页数据
            var size = 50;
            //#region ã€è¿‡æ»¤æ–¹æ¡ˆã€‘
            //过滤条件的classç±»
@@ -318,6 +319,7 @@
                        $("#HMaterNumber").val("");
                        sWhere = "";
                        get_Display(sWhere);
                        break;
                    //作废按钮
                    case 'set_Drop': set_DropBill(0);
@@ -386,8 +388,11 @@
                $("#ColName2").val("0");
                $("#Comparator2").val("0");
                form.render('select');
                 if (page != 1) {
                    $("#page a:eq(1)").get(0).click();//点击分页栏第一页
                }
                sWhere = "";
                get_Display(sWhere);
                get_DisplayPage(sWhere);
            });
            //#endregion
@@ -412,19 +417,19 @@
                    var com = "";
                    switch (Comparator) {
                        case "7":
                            com = "like '%" + ColContent + "%'";
                            com = "like ''%" + ColContent + "%''";
                            break;
                        case "8":
                            com = "like '" + ColContent + "%'";
                            com = "like ''%" + ColContent + "''";
                            break;
                        case "9":
                            com = "like '%" + ColContent + "'";
                            com = "like''" + ColContent + "%''";
                            break;
                        case "10":
                            com = "not like '%" + ColContent + "%'";
                            com = "not like ''%" + ColContent + "%''";
                            break;
                        default:
                            com = "" + Comparator + "'" + ColContent + "'";
                            com = "" + Comparator + "''" + ColContent + "''";
                            break;
                    }
                    sWhere += " and " + ColName + " " + com;
@@ -434,19 +439,19 @@
                if (ColName1 != 0 && Comparator1 != 0) {
                    switch (Comparator1) {
                        case "7":
                            com1 = "like '%" + ColContent1 + "%'";
                            com1 = "like ''%" + ColContent1 + "%''";
                            break;
                        case "8":
                            com = "like '" + ColContent1 + "%'";
                            com1 = "like ''%" + ColContent1 + "''";
                            break;
                        case "9":
                            com = "like '%" + ColContent1 + "'";
                            com1 = "like''" + ColContent1 + "%''";
                            break;
                        case "10":
                            com1 = "not like '%" + ColContent1 + "%'";
                            com1 = "not like''%" + ColContent1 + "%''";
                            break;
                        default:
                            com1 = "" + Comparator1 + "'" + ColContent1 + "'";
                            com1 = "" + Comparator1 + "''" + ColContent1 + "''";
                            break;
                    }
                    sWhere += " and " + ColName1 + " " + com1;
@@ -456,49 +461,51 @@
                if (ColName2 != 0 && Comparator2 != 0) {
                    switch (Comparator) {
                        case "7":
                            com2 = "like '%" + ColContent2 + "%'";
                            com2 = "like ''%" + ColContent2 + "%''";
                            break;
                        case "8":
                            com = "like '" + ColContent2 + "%'";
                            com2 = "like''%" + ColContent2 + "''";
                            break;
                        case "9":
                            com = "like '%" + ColContent2 + "'";
                            com2 = "like ''" + ColContent2 + "%''";
                            break;
                        case "10":
                            com2 = "not like '%" + ColContent2 + "%'";
                            com2 = "not like ''%" + ColContent2 + "%''";
                            break;
                        default:
                            com2 = "" + Comparator2 + "'" + ColContent2 + "'";
                            com2 = "" + Comparator2 + "''" + ColContent2 + "''";
                            break;
                    }
                    sWhere += " and " + ColName2 + " " + com2;
                }
                if (HBeginDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HBeginDate + "'";
                    sWhere += " and CONVERT(varchar(100),日期, 23) >= ''" + HBeginDate + "''";
                }
                if (HEndDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + HEndDate + "'";
                    sWhere += " and CONVERT(varchar(100),日期, 23) <= ''" + HEndDate + "''";
                }
                if (HBarCode) {
                    sWhere += " and æ¡ç ç¼–号 like '%" + HBarCode + "%'";
                    sWhere += " and æ¡ç ç¼–号 like ''%" + HBarCode + "%''";
                }
                if (HMaterName) {
                    sWhere += " and ç‰©æ–™åç§° like'%" + HMaterName + "%'";
                    sWhere += " and ç‰©æ–™åç§° like''%" + HMaterName + "%''";
                }
                if (HMaterNumber) {
                    sWhere += " and ç‰©æ–™ä»£ç  like'%" + HMaterNumber + "%'";
                    sWhere += " and ç‰©æ–™ä»£ç  like''%" + HMaterNumber + "%''";
                }                
                if (HSourceBillNo) {
                    sWhere += " and æºå•单号 like '%" + HSourceBillNo + "%'";
                    sWhere += " and æºå•单号 like ''%" + HSourceBillNo + "%''";
                }
                get_Display(sWhere);
                get_DisplayPage(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            });
            //#endregion
            //#region åˆå§‹åŒ–界面
            function set_ClearBill() {
                //初始化表格
                set_InitGrid();
                //初始化日期间隔、开始日期、结束日期
                setSelect_HInitTimeCycle();
                //若日期间隔不为 ä»»æ„é—´éš”,则禁用开始日期与结束日期的选择
@@ -514,10 +521,9 @@
                //根据日期间隔设置开始时间与结束时间
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                //初始化表格
                set_InitGrid();
                //查询
                get_Display(sWhere);
                get_DisplayPage(sWhere);
                //任意字段过滤下拉框初始化
                ColFilter();
@@ -525,68 +531,153 @@
                get_DefaultModule();
            }
            function set_InitGrid() {
                 option = {
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , height: 'full-50'
                     , page: true
                     , totalRow: true
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limits: [50, 500, 5000, 20000]
                     , limit: 50
                     , done: function (res, curr, count) {
                         soulTable.render(this);
                     }
                     , cols: [[
                         { type: 'checkbox', fixed: 'left' }
                         , { field: 'hmainid', title: '单据ID', hide: true, sort: true }
                         , { field: '条码类型', title: '条码类型', width: 160, sort: true }
                         , { field: '条码编号', title: '条码编号', width: 160, sort: true }
                         , { field: 'HMaterID', title: 'HMaterID', width: 160, hide: true, sort: true }
                         , { field: '物料代码', title: '物料代码', width: 200, sort: true }
                         , { field: '物料名称', title: '物料名称', width: 250, sort: true }
                         , { field: '规格型号', title: '规格型号', width: 250, sort: true }
                         , { field: '计量单位代码', title: '计量单位代码', width: 200, sort: true }
                         , { field: '计量单位', title: '计量单位', width: 200, sort: true }
                         , { field: '炉号', title: '炉号', width: 200, sort: true }
                         , { field: '钢卷号', title: '钢卷号', width: 200, sort: true }
                         , { field: '条码状态', title: '条码状态', width: 200, sort: true }
                         , { field: '厂商', title: '厂商', width: 200, sort: true }
                         , { field: '捆包号', title: '捆包号', width: 200, sort: true }
                         , { field: '生产日期', title: '生产日期', width: 200, templet: "<div>{{d.生产日期 ==null ?'':layui.util.toDateString(d.生产日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                         , { field: '保质期至', title: '保质期至', width: 200, templet: "<div>{{d.保质期至 ==null ?'':layui.util.toDateString(d.保质期至, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                         , { field: 'HAuxPropID', title: 'HAuxPropID', width: 200, sort: true }
                         , { field: '辅助属性代码', title: '辅助属性代码', width: 160, sort: true }
                         , { field: '辅助属性', title: '辅助属性', width: 160, sort: true }
                         , { field: '批号', title: '批号', width: 160, sort: true }
                         , { field: '数量', title: '数量', width: 200, sort: true, totalRow: true}
                         , { field: '计划跟踪号', title: '计划跟踪号', width: 200, sort: true }
                         , { field: '源单单号', title: '源单单号', width: 200, sort: true }
                         , { field: 'HSupID', title: 'HSupID', width: 200, hide: true, sort: true }
                         , { field: '供应商代码', title: '供应商代码', width: 200, sort: true }
                         , { field: '供应商', title: '供应商', width: 200, sort: true }
                         , { field: '进料日期', title: '进料日期', width: 200, sort: true }
                         , { field: '进料日期周', title: '进料日期周', width: 115, sort: true }
                         , { field: '客户型号', title: '客户型号', width: 115, sort: true }
                         , { field: '往来单位', title: '往来单位', width: 200, sort: true }
                         , { field: 'HDeptID', title: 'HDeptID', width: 200, hide: true, sort: true }
                         , { field: '车间', title: '车间', width: 115, sort: true }
                         , { field: '计划完工日期', title: '计划完工日期', width: 200, sort: true }
                         , { field: '拖号', title: '拖号', width: 200, sort: true }
                         , { field: '总托数', title: '总托数', width: 200, sort: true, totalRow: true }
                         , { field: '备注', title: '备注', width: 200, sort: true }
                         , { field: '制作人', title: '制作人', width: 115, sort: true }
                         , { field: '日期', title: '日期', width: 200, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                         , { field: '打印次数', title: '打印次数', width: 200, sort: true }
                         , { field: '作废标记', title: '作废标记', width: 200, sort: true }
                         , { field: '作废人', title: '作废人', width: 115, sort: true }
                         , { field: '生产入库日期', title: '生产入库日期', width: 200, templet: "<div>{{d.生产入库日期 ==null ?'':layui.util.toDateString(d.生产入库日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                         , { field: '销售出库日期', title: '销售出库日期', width: 200, templet: "<div>{{d.销售出库日期 ==null ?'':layui.util.toDateString(d.销售出库日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                     ]]
                    , limit: 50
                    , done: function (res, curr, count) {
                        soulTable.render(this);
                    }
                    , cols: [[
                        { type: 'checkbox', fixed: 'left' }
                        , { field: 'hmainid', title: '单据ID', hide: true, sort: true }
                        , { field: '条码类型', title: '条码类型', width: 160, sort: true }
                        , { field: '条码编号', title: '条码编号', width: 160, sort: true }
                        , { field: 'HMaterID', title: 'HMaterID', width: 160, hide: true, sort: true }
                        , { field: '物料代码', title: '物料代码', width: 200, sort: true }
                        , { field: '物料名称', title: '物料名称', width: 250, sort: true }
                        , { field: '规格型号', title: '规格型号', width: 250, sort: true }
                        , { field: '计量单位代码', title: '计量单位代码', width: 200, sort: true }
                        , { field: '计量单位', title: '计量单位', width: 200, sort: true }
                        , { field: '炉号', title: '炉号', width: 200, sort: true }
                        , { field: '钢卷号', title: '钢卷号', width: 200, sort: true }
                        , { field: '条码状态', title: '条码状态', width: 200, sort: true }
                        , { field: '厂商', title: '厂商', width: 200, sort: true }
                        , { field: '捆包号', title: '捆包号', width: 200, sort: true }
                        , { field: '生产日期', title: '生产日期', width: 200, templet: "<div>{{d.生产日期 ==null ?'':layui.util.toDateString(d.生产日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                        , { field: '保质期至', title: '保质期至', width: 200, templet: "<div>{{d.保质期至 ==null ?'':layui.util.toDateString(d.保质期至, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                        , { field: 'HAuxPropID', title: 'HAuxPropID', width: 200, sort: true }
                        , { field: '辅助属性代码', title: '辅助属性代码', width: 160, sort: true }
                        , { field: '辅助属性', title: '辅助属性', width: 160, sort: true }
                        , { field: '批号', title: '批号', width: 160, sort: true }
                        , { field: '数量', title: '数量', width: 200, sort: true, totalRow: true }
                        , { field: '计划跟踪号', title: '计划跟踪号', width: 200, sort: true }
                        , { field: '源单单号', title: '源单单号', width: 200, sort: true }
                        , { field: 'HSupID', title: 'HSupID', width: 200, hide: true, sort: true }
                        , { field: '供应商代码', title: '供应商代码', width: 200, sort: true }
                        , { field: '供应商', title: '供应商', width: 200, sort: true }
                        , { field: '进料日期', title: '进料日期', width: 200, sort: true }
                        , { field: '进料日期周', title: '进料日期周', width: 115, sort: true }
                        , { field: '客户型号', title: '客户型号', width: 115, sort: true }
                        , { field: '往来单位', title: '往来单位', width: 200, sort: true }
                        , { field: 'HDeptID', title: 'HDeptID', width: 200, hide: true, sort: true }
                        , { field: '车间', title: '车间', width: 115, sort: true }
                        , { field: '计划完工日期', title: '计划完工日期', width: 200, sort: true }
                        , { field: '拖号', title: '拖号', width: 200, sort: true }
                        , { field: '总托数', title: '总托数', width: 200, sort: true, totalRow: true }
                        , { field: '备注', title: '备注', width: 200, sort: true }
                        , { field: '制作人', title: '制作人', width: 115, sort: true }
                        , { field: '日期', title: '日期', width: 200, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                        , { field: '打印次数', title: '打印次数', width: 200, sort: true }
                        , { field: '作废标记', title: '作废标记', width: 200, sort: true }
                        , { field: '作废人', title: '作废人', width: 115, sort: true }
                        , { field: '生产入库日期', title: '生产入库日期', width: 200, templet: "<div>{{d.生产入库日期 ==null ?'':layui.util.toDateString(d.生产入库日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                        , { field: '销售出库日期', title: '销售出库日期', width: 200, templet: "<div>{{d.销售出库日期 ==null ?'':layui.util.toDateString(d.销售出库日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                    ]]
                };
                optionPage = {
                    elem: 'page', //注意,这里的 page æ˜¯ ID,不用加 # å·
                    count: 10000, //数据总数,从服务端得到
                    limit: 50,
                    limits: [50, 500, 5000, 50000],
                    layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
                    jump: function (obj, first) {
                        //console.log(obj)
                        //obj包含了当前分页的所有参数,比如:
                        //console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
                        //console.log(obj.limit); //得到每页显示的条数
                        //首次不执行
                        if (!first) {
                            //do something
                            page = obj.curr;
                            size = obj.limit;
                            get_FastQuery();
                        }
                    }
                }
                laypage.render(optionPage);
            }
            //#region åˆ†é¡µæŸ¥è¯¢
            function get_DisplayPage(sWhere) {
                var wait = layer.load();//遮罩
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Gy_BarCodeBillList/page',
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "page": page, "size": size },
                    success: function (data1) {
                        option.limit = size;//改变表格页大小
                        if (data1.code == 1) {
                            optionPage.count = data1.count;//改变列表数据总数
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left' });
                            for (var i = 0; i < data.length; i++) {
                                // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                if ($.inArray(data[i].name, titleData) > -1) {
                                    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: 120 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
                                    }
                                }
                            }
                            option.cols = [col];
                            option.data = data1.data;
                            ins = table.render(option);
                            laypage.render(optionPage);
                            //刷新表格数据
                            DisPlay_HideColumn();
                            layer.close(ajaxLoad);
                            if ($("#ColName option").length < 1) {
                                ColFilter();
                            }
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            option.data = [[]]
                            table.render(option);
                            layer.close(ajaxLoad);
                            /*layer.alert(data1.code + data1.Message, { icon: 5 });*/
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
             //#endregion
            //进入页面显示的缓存列表
            function get_Display(sWhere) {
@@ -696,6 +787,70 @@
                else {
                    layer.msg('请选择一行数据作废!');
                }
            }
            //#endregion
            //#region åˆ†é¡µæŸ¥è¯¢
            function get_DisplayPage(sWhere) {
                var wait = layer.load();//遮罩
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Gy_BarCodeBillList/page',
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "page": page, "size": size },
                    success: function (data1) {
                        option.limit = size;//改变表格页大小
                        if (data1.code == 1) {
                            optionPage.count = data1.count;//改变列表数据总数
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left' });
                            for (var i = 0; i < data.length; i++) {
                                // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                if ($.inArray(data[i].name, titleData) > -1) {
                                    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: 120 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
                                    }
                                }
                            }
                            option.cols = [col];
                            option.data = data1.data;
                            ins = table.render(option);
                            laypage.render(optionPage);
                            //刷新表格数据
                            DisPlay_HideColumn();
                            layer.close(ajaxLoad);
                            if ($("#ColName option").length < 1) {
                                ColFilter();
                            }
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            option.data = [[]]
                            table.render(option);
                            layer.close(ajaxLoad);
                            /*layer.alert(data1.code + data1.Message, { icon: 5 });*/
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
@@ -880,7 +1035,7 @@
                var Organization = '<option  value="0" selected="selected" ></option>';
                for (var i = 1; i < option.cols[0].length; i++) {
                    if (option.cols[0][i].hide != true) {
                        Organization += '<option  style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].field + '</option>';
                        Organization += '<option  style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].title + '</option>';
                    }
                }
                $("#ColName").empty();