1
zrg
2024-12-20 ce55a815c12b79a9048ce8cfc95994441994169e
WebTM/views/Éú²ú¹ÜÀí/Éú²ú¼Æ»®Æ½Ì¨/JIT_DayPlanPlatFormImport.html
@@ -11,37 +11,6 @@
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <style>
        .main-btn { /*头部主按钮*/
            padding: 0 2px; /*调整按钮左右空隙大小*/
            height: 30px;
            line-height: 30px;
        }
        .btn-title {
            font-size: 16px;
        }
        /* é˜²æ­¢ä¸‹æ‹‰æ¡†çš„下拉列表被隐藏---必须设置--- */
        .layui-table-cell {
            overflow: visible !important;
        }
        /* ä½¿å¾—下拉框与单元格刚好合适 */
        td .layui-form-select {
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
        }
        .layui-form-item .layui-inline {
            margin-top: 5px;
            margin-bottom: 5px;
            margin-right: 0px;
        }
        .layui-form-label {
            width: 25%;
        }
    </style>
</head>
<body>
    <div class="layui-fluid" style="padding: 0;">
@@ -213,39 +182,63 @@
            var dd = myDate.getDate();
            var SumMonth = 31; //动态两月之差 new Date(yyyy, MM, 0).getDate()
            var columns = [];
            var HBEGINDATE = new Date(new Date($("#HDate").val())).getDate(); //获取开始日期天数
            columns.push({ type: 'checkbox', fixed: 'left' });
            columns.push({ field: 'hmainid', title: 'hmainid', width: 200, hide: true });
            columns.push({ field: '单据号', title: '单据号', width: 200 });
            columns.push({ field: '生产订单号*', title: '生产订单号' });
            columns.push({ field: '生产订单号*', title: '生产订单号', width: 150 });
            columns.push({ field: '生产订单明细行号*', title: '生产订单明细行号', width: 200 });
            columns.push({ field: '组织编码*', title: '组织编码' });
            columns.push({ field: '组织编码*', title: '组织编码', width: 150});
            columns.push({ field: 'HWorkShopID', title: 'HWorkShopID', hide: true });
            columns.push({ field: '生产车间编码*', title: '生产车间' });
            columns.push({ field: '生产车间编码*', title: '生产车间', width: 150});
            columns.push({ field: 'HSourceID', title: 'HSourceID', hide: true });
            columns.push({ field: '生产资源编码*', title: '生产资源', edit: 'text', event: "HSourceID"   });
            columns.push({ field: '优先级', title: '优先级' });
            columns.push({ field: 'HEmpID', title: 'HEmpID', hide: true });
            columns.push({ field: '员工', title: '员工' });
            columns.push({ field: '员工编码', title: '员工编码' });
            columns.push({ field: '员工', title: '员工', width: 150 });
            columns.push({ field: '员工编码', title: '员工编码', width: 150 });
            columns.push({ field: 'HMaterID', title: '物料ID', hide: true });
            columns.push({ field: '物料编码*', title: '物料编码' });
            columns.push({ field: '物料编码*', title: '物料编码', width: 150 });
            columns.push({ field: '物料名称', title: '物料名称', width: 200 });
            columns.push({ field: '规格型号', title: '规格型号' });
            columns.push({ field: '规格型号', title: '规格型号', width: 150});
            columns.push({ field: 'HUnitID', title: 'HUnitID', hide: true });
            columns.push({ field: '计量单位', title: '计量单位' });
            columns.push({ field: '批次号', title: '批次' });
            columns.push({ field: '计量单位', title: '计量单位', width: 150});
            columns.push({ field: '批次号', title: '批次', width: 150});
            columns.push({ field: '销售订单数量', title: '销售订单数量', width: 200 });
            columns.push({ field: '生产订单数量', title: '生产订单数量', width: 200 });
            columns.push({ field: '总齐套数量', title: '总齐套数量', width: 200 });
            columns.push({ field: 'ICMOBillHInterID', title: 'ICMOBillHInterID', hide: true});
            columns.push({ field: 'ICMOBillHEntryID', title: 'ICMOBillHEntryID', hide: true });
            for (var i = 0; i <= (SumMonth - dd); i++) {
                columns.push({ field: Format(yyyy + '/' + MM + '/' + (dd + i), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (dd + i), 'MM.dd'), edit: 'text', width:60 })
            columns.push({ field: 'HProdORGID', title: 'HProdORGID', hide: true });
            var k = 0;//收集循环次数
            var Days = 45;
            for (var j = 0; j <= (Days - k); j++) {
                columns.push({ field: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'MM.dd'), width: 70, totalRow: true })
                //跨年的话 ä¼šä»Žä¸€æœˆä¸€å·å¼€å§‹
                if (MM == 12 && (HBEGINDATE + j) == 31) {
                    yyyy += 1;
                    MM = 1;
                    SumMonth = new Date(yyyy, MM, 0).getDate();
                    HBEGINDATE = 0;
                    k += j;
                    j = 0;
                } else if ((HBEGINDATE + j) == SumMonth) { //跨月 æœˆæ•°åР䏀  å¤©æ•°ä»Žä¸€å¼€å§‹
                    HBEGINDATE = 0;
                    MM += 1;
                    SumMonth = new Date(yyyy, MM, 0).getDate();
                    k += j;
                    j = 0;
                }
            }
            for (var i = 1; i < dd; i++) {
                columns.push({ field: Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd'), title: Format(yyyy + '/' + (MM + 1) + '/' + i, 'MM.dd'), edit: 'text', width: 60 })
            }
            //for (var i = 0; i <= (SumMonth - dd); i++) {
            //    columns.push({ field: Format(yyyy + '/' + MM + '/' + (dd + i), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (dd + i), 'MM.dd'), edit: 'text', width:80 })
            //}
            //for (var i = 1; i <= dd; i++) {
            //    columns.push({ field: Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd'), title: Format(yyyy + '/' + (MM + 1) + '/' + i, 'MM.dd'), edit: 'text', width: 80 })
            //}
            columns.push({ fixed: 'right', title: '操作', toolbar: '#barDemo' });
            option = {
@@ -262,7 +255,7 @@
            //渲染页面
            table.render(option);
        }
        }
        //导入(保存)
        function set_AddNew(data) {
@@ -271,36 +264,61 @@
            for (var i = 0; i < table.cache["mainTable"].length; i++) {
                if (table.cache["mainTable"][i] != "") {
                    table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
                    if (table.cache["mainTable"][i].物料名称.indexOf("\"") != -1 || table.cache["mainTable"][i].物料名称.indexOf(";") != -1) {
                        table.cache["mainTable"][i].物料名称 = table.cache["mainTable"][i].物料名称.replaceAll("\"", "”").replaceAll(";", ";")
                    }
                    if (table.cache["mainTable"][i].规格型号.indexOf("\"") != -1 || table.cache["mainTable"][i].规格型号.indexOf(";") != -1) {
                        table.cache["mainTable"][i].规格型号 = table.cache["mainTable"][i].规格型号.replaceAll("\"", "”").replaceAll(";", ";")
                    }
                    num.push(table.cache["mainTable"][i])
                }
            }
            data.field.HPRDORGID = sessionStorage["OrganizationID"];//组织
            var sMainStr = JSON.stringify(data.field);
            var sSubStr = JSON.stringify(num);
            var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
            var index = layer.load();
            $.ajax({
                type: "POST",
                url: GetWEBURL() + "/JIT_DayPlanPlatFormImport/JIT_DayPlanPlatFormImport_btnSave",
                async: true,
                data: { "sMainSub": sMainSub },
                dataType: "json",
                success: function (data) {
                    if (data.count == 1) {
                        layer.close(index);
                        layer.msg("提交成功");
                    }
                    else {
                        layer.close(index);
                        layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                },
                error: function (err) {
                    layer.close(index);
                    layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
            for (var i = 0; i < option.data.length; i++) {
                if (option.data[i].物料名称.indexOf("\"") != -1 || option.data[i].物料名称.indexOf(";") != -1) {
                    option.data[i].物料名称 = option.data[i].物料名称.replaceAll("\"", "”").replaceAll(";", ";")
                }
            });
                if (option.data[i].规格型号.indexOf("\"") != -1 || option.data[i].规格型号.indexOf(";") != -1) {
                    option.data[i].规格型号 = option.data[i].规格型号.replaceAll("\"", "”").replaceAll(";", ";")
                }
            }
            var HDataSub = [];
            //JIT导入计划,每次导入100行数据,可修改i的自增值决定每次循环导入的行数
            for (var i = 0; i < option.data.length; i += 100) {
                HDataSub = option.data.slice(i, i + 100)
                data.field.HPRDORGID = sessionStorage["OrganizationID"];//组织
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(HDataSub);
                var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
                var index = layer.load();
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "/JIT_DayPlanPlatFormImport/JIT_DayPlanPlatFormImport_btnSave",
                    async: false,
                    data: { "sMainSub": sMainSub },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) {
                            layer.close(index);
                            layer.msg("提交成功");
                        }
                        else {
                            layer.close(index);
                            layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                    },
                    error: function (err) {
                        layer.close(index);
                        layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                });
            }
        }
        //行内删除