wtt
2025-03-20 4c8e4d61ef06250b54a7cd0c7b14ca9ea3412b0f
WebTM/views/Éú²ú¹ÜÀí/Éú²ú¼Æ»®Æ½Ì¨/JIT_DayPlanPlatForm.html
@@ -30,6 +30,8 @@
                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnReady" id="btnReady">准备</button>
                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnProPC" id="btnProPC">排产</button>
                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnRoutEdit" id="btnRoutEdit">工艺路线</button>
                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnLockOrder" id="btnLockOrder">锁定工单</button>
                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnUnlockOrder" id="btnUnlockOrder">解锁工单</button>
                        </div>
                        <div class="layui-collapse resizable-container">
                            <div class="layui-colla-item">
@@ -784,6 +786,16 @@
            }
        })
        //锁定工单
        form.on('submit(btnLockOrder)', function (data) {
            get_btnLockOrder();
        })
        //解锁工单
        form.on('submit(btnUnlockOrder)', function (data) {
            get_btnUnlockOrder();
        })
        //#endregion
        //#region æœ¬é¡µé¢è¢«è°ƒç”¨çš„æ‰€æœ‰æ–¹æ³•
@@ -838,7 +850,7 @@
            var oneday = 1000 * 60 * 60 * 24;
            columns.push({ type: 'checkbox', fixed: 'left', sort: true });
            columns.push({ type: 'numbers', title: '序号', sort: true });
            columns.push({ type: 'numbers', field: '序号', title: '序号', sort: true });
            columns.push({ field: '单据号', title: '单据号', hide: true, sort: true });
            columns.push({ field: '销售订单号', title: '销售订单号', width: 150, sort: true });
            columns.push({ field: '生产订单号', title: '生产订单号', width: 150, style: 'background-color: #f9f9f9;', sort: true });
@@ -1048,6 +1060,7 @@
            columns.push({ field: 'HProdORGID', title: 'HProdORGID', hide: true });
            columns.push({ field: 'HEmpID', title: 'HEmpID', hide: true });
            columns.push({ field: '拆单汇报数量', title: '拆单汇报数量', width: 150, edit: 'text', sort: true });
            columns.push({ field: '锁定工单', title: '锁定工单', width: 150, sort: true, filter: true });//0
            columns.push({ fixed: 'right', title: '操作', toolbar: '#barDemo' });
            option_columns = columns;
            option = {
@@ -1899,6 +1912,7 @@
                }
                HinterID_S.push(option.data[i]["hmainid"]);
            }
            //获取计划锁定的天数
            $.ajax({
                url: GetWEBURL() + '/JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHinterIDList',
                type: "GET",
@@ -1917,7 +1931,7 @@
            });
            //根据车间删除没有锁定的数据
            var sql = "delete from Sc_WorkBillSortBillSub  where  HMasterDate>=convert(varchar(10) ,DATEADD(DAY," + HPlanDay + ",GETDATE()),20)  and HInterID in(select  HInterID  from Sc_WorkBillSortBillMain where HWorkShopID=" + HWorkShopID + ")";
            var sql = "delete from Sc_WorkBillSortBillSub where HMasterDate>=convert(varchar(10) ,DATEADD(DAY," + HPlanDay + ",GETDATE()),20) and HInterID in(select  HInterID from Sc_WorkBillSortBillMain where HWorkShopID=" + HWorkShopID + " and HLockOrder != 1 )";
            $.ajax({
                url: GetWEBURL() + '/Gy_SOPBillList/UpDelSQL',
                type: "GET",
@@ -1933,10 +1947,11 @@
                    layer.alert("接口请求失败!", { icon: 5 });
                }
            });
            //将表格数据加载到TableData里面
            get_HFData(0, 0);
            //初始化表格数据
            //清空锁定日期以外的数据
            for (var i = 0; i < option.data.length; i++) {
                for (var j = (22 + HPlanDay); j < 53; j++) {
                    if (option.data[i][option.cols[0][j].field] != null) {
@@ -1972,9 +1987,9 @@
                sWorkQty = option.data[i]["小时产能"];
                sYX = option.data[i]["优先级"];
                HReportQty = option.data[i]["拆单汇报数量"];
                //拆单数量减去汇报数量锁定数量
                if (SDSum > 0) {
                    sPlanQty = sPlanQty - SDSum - HReportQty;
                    sPlanQty = sPlanQty - SDSum;
                }
                //剩余需求工时
                iLeftQty = sPlanQty - HReportQty;
@@ -3051,6 +3066,80 @@
            }
        }
        //锁定工单
        function get_btnLockOrder() {
            var checkStatus = table.checkStatus('mainTable')
                , data = checkStatus.data;
            if (data.length > 0) {
                var HInterIDArr = [];
                for (var i = 0; i < data.length; i++) {
                    HInterIDArr.push(data[i].hmainid);
                }
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHLockedOrder',
                    type: "GET",
                    data: { "HInterIDs": HInterIDArr.toString() },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.msg("工单已锁定");
                            get_FastQuery(2);
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            } else {
                layer.msg('请选择你要锁定的工单!');
            }
        }
        //解锁工单
        function get_btnUnlockOrder() {
            var checkStatus = table.checkStatus('mainTable')
                , data = checkStatus.data;
            if (data.length > 0) {
                var HInterIDArr = [];
                for (var i = 0; i < data.length; i++) {
                    HInterIDArr.push(data[i].hmainid);
                }
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHUnlockOrder',
                    type: "GET",
                    data: { "HInterIDs": HInterIDArr.toString() },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.msg("工单已解锁");
                            get_FastQuery(2);
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            } else {
                layer.msg('请选择你要解锁的工单!');
            }
        }
        //查询未排产的生产订单
        function get_Display2(sWhere_ICMO) {
            var ajaxLoad = layer.load();
@@ -3311,8 +3400,8 @@
        function get_HideColumn() {
            var colName = "";
            var contentUrl = "";
            for (var i = 1; i < option.cols[0].length - 1; i++) {
                colName += option.cols[0][i]["title"] + ",";
            for (var i = 1; i < option.cols[0].length; i++) {
                colName += option.cols[0][i]["field"] + ",";
            }
            var urlStr = window.document.location.pathname;//获取文件路径
            var urlLen = urlStr.split('/');
@@ -3321,7 +3410,7 @@
            }
            colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
            contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName;
            contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide_New.html?HModName=' + HModName + '&colName=' + colName;
            layer.open({
                type: 2
@@ -3350,71 +3439,82 @@
                data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                success: function (data1) {
                    if (data1.data.length != 0) {
                        titleData = [];
                        var dataCol = [];//数据库查询出的列数据
                        var titleData = ["单据号", "HProdORGID", "HMaterID", "HUnitID", "HWorkShopID", "HSourceID"];//不需要显示的字段 å¯æ‰©å±•
                        var newCols = [[]];//对应数据库列顺序col
                        newCols[0].push(option.cols[0][0]);//放入第一个checkbox
                        dataCol = data1.data[0].HGridString.split(',');
                        for (var i = 0; i < option.cols[0].length - 2; i++) {
                            if (dataCol[i]) {
                                var dataCols = dataCol[i].split('|');
                            }
                            //隐藏列
                            if (dataCols[1] == 1) {
                                option.cols[0][i + 1]["hide"] = true;
                            }
                            //设置列宽
                            if (dataCols[3] > 0) {
                                option.cols[0][i + 1]["width"] = dataCols[3];
                            }
                            //设置内容字体大小
                            if (data1.data[0].HFontSize != 0) {
                                option.cols[0][i + 1]["style"] += ";font-size:" + data1.data[0].HFontSize + "px;";
                            } else {
                                option.cols[0][i + 1]["style"] += ";font-size:100%";
                            }
                            //设置列宽
                            //if (data1.data[0].HColumnWidth != 0) {
                            //    option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;";
                            //} else {
                            //    option.cols[0][i + 1]["width"] = "";
                            //}
                            //显示列
                            if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                option.cols[0][i + 1]["hide"] = false;
                            }
                            //字体所在位置(å·¦ å±…中 å³)
                            switch (dataCols[2]) {
                                case "L":
                                    option.cols[0][i + 1]["align"] = "left";
                                    break;
                                case "M":
                                    option.cols[0][i + 1]["align"] = "center";
                                    break;
                                case "R":
                                    option.cols[0][i + 1]["align"] = "right";
                                    break;
                            }
                        }
                        //取消冻结列
                        for (var i = 1; i < option.cols[0].length - 1; i++) {
                            if (option.cols[0][i]["fixed"] != null) {
                                option.cols[0][i]["fixed"] = null;
                            }
                            else {
                                break;
                            }
                        }
                        //冻结列
                        if (data1.data[0].HFixCols != 0) {
                            for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                    data1.data[0].HFixCols += 1;
                        //列设置列数与页面列数是否一致
                        if (dataCol.length == option.cols[0].length - 1) {
                            //遍历寻找列设置对应列按顺序插入
                            for (var j = 0; j < option.cols[0].length - 1; j++) {
                                for (var i = 0; i < option.cols[0].length - 1; i++) {
                                    var dataCols = dataCol[j].split('|');
                                    //选择与datacols相应列进行修改
                                    if (option.cols[0][i + 1]["field"] == dataCols[5]) {
                                        //隐藏列
                                        if (dataCols[1] == 1) {
                                            option.cols[0][i + 1]["hide"] = true;
                                        }
                                        //设置列宽
                                        if (dataCols[3] > 0) {
                                            option.cols[0][i + 1]["width"] = dataCols[3];
                                        }
                                        //设置内容字体大小
                                        if (data1.data[0].HFontSize != 0) {
                                            option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                                        } else {
                                            option.cols[0][i + 1]["style"] = "font-size:100%";
                                        }
                                        //显示列
                                        if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                            option.cols[0][i + 1]["hide"] = false;
                                        }
                                        //统计列
                                        if (dataCols[6] == 1) {
                                            option.cols[0][i + 1]["totalRow"] = true;
                                        }
                                        //字体所在位置(å·¦ å±…中 å³)
                                        switch (dataCols[2]) {
                                            case "L":
                                                option.cols[0][i + 1]["align"] = "left";
                                                break;
                                            case "M":
                                                option.cols[0][i + 1]["align"] = "center";
                                                break;
                                            case "R":
                                                option.cols[0][i + 1]["align"] = "right";
                                                break;
                                        }
                                        //设置表格title属性显示别名
                                        if (dataCols[4] != null && dataCols[4] != "") {
                                            option.cols[0][i + 1]["title"] = dataCols[4];
                                        }
                                        newCols[0].push(option.cols[0][i + 1]);
                                    }
                                }
                                option.cols[0][i + 1]["fixed"] = "left";
                            }
                            //遍历循环后判断对应列数是否一致
                            if (dataCol.length == newCols[0].length - 1) {
                                option.cols = newCols;
                                //取消冻结列
                                for (var i = 1; i < option.cols[0].length - 1; i++) {
                                    if (option.cols[0][i]["fixed"] != null) {
                                        option.cols[0][i]["fixed"] = null;
                                    }
                                    else {
                                        break;
                                    }
                                }
                                //冻结列
                                if (data1.data[0].HFixCols != 0) {
                                    for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                        if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                            data1.data[0].HFixCols += 1;
                                        }
                                        option.cols[0][i + 1]["fixed"] = "left";
                                    }
                                }
                            }
                        }
                        table.render(option);