1
yusijie
2024-10-28 2ad9e8d66d1632d8ca0a80fff647cf9c808735d6
WebTM/views/³µ¼ä¹ÜÀí/±¨±í·ÖÎö/Kf_ProdProcessEntryReport_DyeColor.html
@@ -291,7 +291,9 @@
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                var ajaxLoad1 = layer.load();
                get_FastQuery();
                layer.close(ajaxLoad1);
            });
            //行监听事件-单击
@@ -349,190 +351,29 @@
            //初始化表格
            function set_InitGrid() {
                var HBeginDate = Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 1).setHours(8, 0, 0, 0), "yyyy-MM-dd") + " 00:00:00";//下达日期 å¼€å§‹æ—¥æœŸ
                var HEndDate = Format(new Date(new Date()).setHours(8, 0, 0, 0), "yyyy-MM-dd") + " 00:00:00";//结束日期
                var HMaterNumber = $("#HMaterNumber").val();//物料代码
                var HBillNo = $("#HBillNo").val();          //单据号
                var HProductName = $("#HProductName").val();//产品名称
                var HProductModel = $("#HProductModel").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();
                var sProcessNo = $("#sProcessNo").val();   //流转卡号
                //拼接任一字段过滤查询条件
                var com = "";
                if (ColName != 0 && Comparator != 0) {
                    switch (Comparator) {
                        case "7":
                            com = "like ''%" + ColContent + "%''";
                            break;
                        case "8":
                            com = "like ''%" + ColContent + "''";
                            break;
                        case "9":
                            com = "like ''" + ColContent + "%''";
                            break;
                        case "10":
                            com = "not like ''%" + ColContent + "%''";
                            break;
                        default:
                            com = "" + Comparator + " ''" + ColContent + "''";
                            break;
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , cellMinWidth: 120
                    , limit: Number.MAX_VALUE // æ•°æ®è¡¨æ ¼é»˜è®¤å…¨éƒ¨æ˜¾ç¤º
                    , totalRow: true
                    , height: 'full-70'
                    , cols: [[
                        { type: 'checkbox', fixed: 'left', totalRowText: '合计' }
                        , { field: '日期', title: '日期', width: 160 }
                        , { field: '单据号', title: '单据号', width: 160 }
                        , { field: '产品代码', title: '产品代码', width: 160 }
                        , { field: '产品名称', title: '产品名称', width: 160 }
                        , { field: '规格型号', title: '规格型号', width: 160 }
                        , { field: '业务员', title: '业务员', width: 160 }
                        , { field: '客户', title: '客户', width: 160 }
                        , { field: '生产任务单数量', title: '生产任务单数量', totalRow: true, width: 200 }
                        , { field: '白坯发布', title: '白坯发布', width: 160, totalRow: true }
                        , { field: '是否下推生成流转卡', title: '是否下推生成流转卡', width: 160 }
                    ]]
                    , done: function (res) {
                    }
                    com = " and (" + ColName + " " + com + ")";
                }
                if (ColName1 != 0 && Comparator1 != 0) {
                    var com1 = "";
                    switch (Comparator1) {
                        case "7":
                            com1 = "like'%" + ColContent1 + "%'";
                            break;
                        case "8":
                            com1 = "like'%" + ColContent1 + "'";
                            break;
                        case "9":
                            com1 = "like'" + ColContent1 + "%'";
                            break;
                        case "10":
                            com1 = "not like'%" + ColContent1 + "%'";
                            break;
                        default:
                            com1 = "" + Comparator1 + "'" + ColContent1 + "'";
                            break;
                    }
                    sWhere += " and " + ColName1 + " " + com1;
                }
                if (ColName2 != 0 && Comparator2 != 0) {
                    var com2 = "";
                    switch (Comparator2) {
                        case "7":
                            com2 = "like'%" + ColContent2 + "%'";
                            break;
                        case "8":
                            com2 = "like'%" + ColContent2 + "'";
                            break;
                        case "9":
                            com2 = "like'" + ColContent2 + "%'";
                            break;
                        case "10":
                            com2 = "not like'%" + ColContent2 + "%'";
                            break;
                        default:
                            com2 = "" + Comparator + "'" + ColContent + "'";
                            break;
                    }
                    sWhere += " and " + ColName2 + " " + com2;
                }
                com = com + com1 + com2;
                sWhere = {
                    HBeginDate: HBeginDate
                    , HEndDate: HEndDate
                    , HMaterNumber: HMaterNumber
                    , HBillNo: HBillNo
                    , HProductName: HProductName
                    , HProductModel: HProductModel
                    , RandomSearch: com
                }
                sWhere = JSON.stringify(sWhere);
                //动态列-缓存列表
                $.ajax({
                    url: GetWEBURL() + "/ProdProcessEntryReport/ProdProcessEntryReport_DyeColor",
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere, "sProcessNo": '', "user": sessionStorage["HUserName"] },
                    //async: false,
                    success: function (data1) {
                        if (data1.count == 1) {
                            var totalArray = ["生产任务单数量", "白坯发布"];
                            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 ($.inArray(data[i].name, "") > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else if ($.inArray(data[i].name, totalArray) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
                                }
                                else if (data[i].ColName == '白坯发布') {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true });
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
                                    }
                                }
                            }
                            option = {
                                elem: '#mainTable'
                                , toolbar: '#toolbarDemo'
                                , cellMinWidth: 120
                                , limit: Number.MAX_VALUE // æ•°æ®è¡¨æ ¼é»˜è®¤å…¨éƒ¨æ˜¾ç¤º
                                , totalRow: true
                                , height: 'full-70'
                                , cols: [col]
                                , data: data1.data
                            };
                            ins = table.render(option);
                        } else {
                            option = {
                                elem: '#mainTable'
                                , toolbar: '#toolbarDemo'
                                , cellMinWidth: 120
                                , limit: Number.MAX_VALUE // æ•°æ®è¡¨æ ¼é»˜è®¤å…¨éƒ¨æ˜¾ç¤º
                                , totalRow: true
                                , height: 'full-70'
                                , cols: [[
                                    { type: 'checkbox', fixed: 'left', totalRowText: '合计' }
                                    , { field: '日期', title: '日期', width: 160 }
                                    , { field: '单据号', title: '单据号', width: 160 }
                                    , { field: '产品代码', title: '产品代码', width: 160 }
                                    , { field: '产品名称', title: '产品名称', width: 160 }
                                    , { field: '规格型号', title: '规格型号', width: 160 }
                                    , { field: '业务员', title: '业务员', width: 160 }
                                    , { field: '客户', title: '客户', width: 160 }
                                    , { field: '生产任务单数量', title: '生产任务单数量', totalRow: true,width: 200 }
                                    , { field: '白坯发布', title: '白坯发布', width: 160, totalRow: true }
                                    , { field: '是否下推生成流转卡', title: '是否下推生成流转卡', width: 160 }
                                ]]
                                , done: function (res) {
                                }
                            };
                            ins = table.render(option);
                        }
                    },
                    error: function (err) {
                        layer.msg('错误' + err, {
                            icon: 5,
                            time: 20000
                        }, function () {
                            //do something
                        });
                    }
                })
                };
            }
            //列明显示下拉框
@@ -553,7 +394,7 @@
            //加载网格
            function get_Display(sWhere,sProcessNo) {
                var wait = layer.load();//遮罩
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/ProdProcessEntryReport/ProdProcessEntryReport_DyeColor',
                    async: false,
@@ -647,15 +488,15 @@
                            var sumCompare = sumHMaterOutQty - sumDyeColorOut;
                            $("#SumCompare").val(sumCompare);
                            layer.close(wait);
                            layer.close(ajaxLoad);
                        } else {
                            $("#SumHMaterOutQty").val("");
                            layer.close(wait);
                            layer.close(ajaxLoad);
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        $("#SumHMaterOutQty").val("");
                        layer.close(wait);
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
@@ -900,6 +741,7 @@
            //显示列数据
            function DisPlay_HideColumn() {
                var ajaxLoad = layer.load();
                ColFilter();
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
@@ -976,8 +818,9 @@
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
                layer.close(ajaxLoad);
            }
            //#endregion
        });