yangle
2024-10-27 f6d6a3c0c65103cb4a58e4f929ed7a1c8da21b9a
WebTM/views/³µ¼ä¹ÜÀí/±¨±í·ÖÎö/Kf_ProdProcessSumReport_DyeColor_third.html
@@ -331,196 +331,29 @@
            //初始化表格
            function set_InitGrid() {
                var HBeginDate = Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 1).setHours(8, 0, 0, 0), "yyyy-MM-dd hh") + ":00:00";//下达日期 å¼€å§‹æ—¥æœŸ
                var HEndDate = Format(new Date(new Date()).setHours(8, 0, 0, 0), "yyyy-MM-dd hh") + ":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 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 + ")";
                }
                var com1 = "";
                if (ColName1 != 0 && Comparator1 != 0) {
                    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;
                    }
                    com1 = " and (" + ColName1 + " " + com1 + ")";
                }
                var com2 = "";
                if (ColName2 != 0 && Comparator2 != 0) {
                    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 = "" + Comparator2 + "''" + ColContent2 + "''";
                            break;
                    }
                    com2 = " and (" + ColName2 + " " + com2 + ")";
                }
                com = com + com1 + com2;
                //根据用户过滤用户关联客户的记录
                var OtherSearch = getSWhereByHUser();
                sWhere = {
                    HBeginDate: HBeginDate
                    , HEndDate: HEndDate
                    , HMaterNumber: HMaterNumber
                    , HBillNo: HBillNo
                    , HProductName: HProductName
                    , HProductModel: HProductModel
                    , RandomSearch: com
                    , OtherSearch: (OtherSearch == null || OtherSearch == "undefine") ? " and 1=1 " : OtherSearch
                }
                sWhere = JSON.stringify(sWhere);
                //动态列-缓存列表
                $.ajax({
                    url: GetWEBURL() + "/ProdProcessSumReport/ProdProcessSumReport_DyeColor_third",
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere, "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
                        });
                    }
                })
                };
            }
            //列明显示下拉框