zzr99
2022-05-29 fc71ee8c3873c099ee9cce2b2db6ec97aa6e793e
WebTM/views/Éú²ú¹ÜÀí/Éú²ú¼Æ»®Æ½Ì¨/JIT_DayPlanPlatForm.html
@@ -177,6 +177,35 @@
        //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
         //行内鼠标离开事件
        table.on('edit(mainTable)', function (obj) {
            var myDate = new Date();
            var yyyy = myDate.getFullYear();
            var MM = myDate.getMonth() + 1;
            var dd = myDate.getDate();
            var SumMonth = 31; //动态两月之差 new Date(yyyy, MM, 0).getDate()
            var dateHQty = 0;
            for (var i = 0; i <= (SumMonth - dd); i++) {
                if (obj.field == "生产资源") {
                    return;
                }
                if (obj.data[Format(yyyy + '/' + MM + '/' + (dd + i), 'yyyy-MM-dd')] != null) {
                    dateHQty += parseInt(obj.data[Format(yyyy + '/' + MM + '/' + (dd + i), 'yyyy-MM-dd')]);
                }
            }
            for (var i = 1; i < dd; i++) {
                if (obj.data[Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd')] != null) {
                    dateHQty += parseInt(obj.data[Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd')]);
                }
            }
            console.log(dateHQty)
            //修改数据
            obj.update({
                "日计划数量总量": dateHQty
            });
        })
        //头工具栏事件
        table.on('toolbar(mainTable)', function (obj) {
            var checkStatus = table.checkStatus('mainTable')
@@ -194,7 +223,7 @@
                    }
                    else {
                        data[0]["生产资源"] = "";
                        data[0]["HSourceID"] = 0;
                        data[0]["HSourceID"] = "";
                        data[0]["hmainid"] = "";
                        data[0]["单据号"] = "";
                        var copydata = JSON.stringify(data);
@@ -238,6 +267,10 @@
            set_ClearQuery();
        });
        //行内事件
        table.on('tool(mainTable)', function (obj) {
            set_GridCellCheck(obj); //行内快捷键筛选
        });
        //#endregion
        //#region æœ¬é¡µé¢è¢«è°ƒç”¨çš„æ‰€æœ‰æ–¹æ³•
@@ -258,17 +291,18 @@
        //获取组织
        function Organ() {
            //获取登录页组织列
            var Organization = '<option  style="color:blue;" value="0">组织</option>';
            $.ajax({
                type: "get",
                url: GetWEBURL() + "/Web/GetOrganizations",
                success: function (result) {
                    var Organization = "";
                    if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        var data = result.data;
                        for (var i = 0; i < data.length; i++) {
                            Organization += '<option  style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
                        }
                        $("#HProdORGID").append(Organization);
                        $("#HProdORGID").val(sessionStorage["OrganizationID"])
                        form.render('select');
                    }
                    layer.closeAll("loading");
@@ -286,7 +320,6 @@
            var SumMonth = 31; //动态两月之差 new Date(yyyy, MM, 0).getDate()
            columns.push({ type: 'checkbox', fixed: 'left' });
            columns.push({ field: 'hmainid', title: 'hmainid', hide: true });
            columns.push({ field: '单据号', title: '单据号', hide: true });
            columns.push({ field: '销售订单号', title: '销售订单号', width:150 });
            columns.push({ field: '生产订单号', title: '生产订单号', width:150 });
@@ -302,7 +335,7 @@
            columns.push({ field: 'HUnitID', title: 'HUnitID', hide: true});
            columns.push({ field: '计量单位', title: '计量单位', width:150 });
            columns.push({ field: '销售订单数量', title: '销售订单数量', width:150 });//0
            columns.push({ field: '订单需求数量', title: '生产订单数量', width: 150 });//0
            columns.push({ field: '计划数量', title: '生产订单数量', width: 150 });//0
            columns.push({ field: '订单可排数量', title: '订单可排数量', width:150 });
            columns.push({ field: '未入库数量', title: '未入库数量', width: 150 });//0
            columns.push({ field: '拆单数量', title: '拆单数量', width: 150 });//0
@@ -310,16 +343,16 @@
            columns.push({ field: '今日之前日计划数量', title: '今日之前日计划数量', width: 150 });//0
            columns.push({ field: '计划开始日期', title: '预计开工日期', width:150 });
            columns.push({ field: 'HWorkShopID', title: 'HWorkShopID', hide: true });
            columns.push({ field: '生产车间', title: '生产车间', width:150 });
            columns.push({ field: '生产车间', title: '生产车间', width: 150});
            columns.push({ field: 'HSourceID', title: 'HSourceID', hide:true });
            columns.push({ field: '生产资源', title: '生产资源', width:150 });
            columns.push({ field: '生产资源', title: '生产资源', width: 150, edit: 'text', event: "HSourceID"  });
            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), 'yyyy-MM-dd'), edit: 'text',width:120 })//0
                columns.push({ field: Format(yyyy + '/' + MM + '/' + (dd + i), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (dd + i), 'MM.dd'), edit: 'text', width: 70 })//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, 'yyyy-MM-dd'), edit: 'text',width: 120 })//0
                columns.push({ field: Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd'), title: Format(yyyy + '/' + (MM + 1) + '/' + i, 'MM.dd'), edit: 'text', width: 70 })//0
            }
            columns.push({ field: 'T31', title: 'T31', width: 150 });//0
            columns.push({ field: 'T31', title: 'T31', width: 70 });//0
            columns.push({ field: '订单类型', title: '订单类型', width: 150 });
            columns.push({ field: '生产订单单据类型', title: '源单订单单据类型', width: 150 });
            columns.push({ field: '业务状态', title: '业务状态', width: 150 });
@@ -329,7 +362,7 @@
            columns.push({ field: '交货日期', title: '交货日期', width: 150 });
            columns.push({ field: '源单主内码', title: '源单主内码', width: 150 });
            columns.push({ field: '源单子内码', title: '源单子内码', width: 150 });
            columns.push({ field: '日计划工单主码', title: '日计划工单主码', width: 150 });
            columns.push({ field: 'hmainid', title: '日计划工单主码', width: 150 });
            option = {
                elem: '#mainTable'
@@ -516,6 +549,47 @@
                }
            });
        }
        //行内快捷键
        function set_GridCellCheck(obj) {
            $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
                if (event.key == "F7") {
                    //生产资源
                    if (obj.event == "HSourceID") {
                        layer.open({
                            type: 2
                            , skin: "layui-layer-rim" //加上边框
                            , title: "生产资源列表"  //标题
                            , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                            , shift: 2 //弹出动画
                            , area: ["90%", "90%"] //窗体大小
                            , maxmin: true //设置最大最小按钮是否显示
                            , content: ["../../基础资料/生产基础资料/Gy_Source.html", "yes"]
                            , btn: ["确定", "取消"]
                            , btn1: function (index, laero) {
                                //按钮一  çš„回调
                                var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                                var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                                if (checkStatus.data.length != 1) {
                                    return layer.msg("请选择一条数据");
                                }
                                //更新表格缓存的数据
                                obj.update({
                                    "HSourceID": checkStatus.data[0].HItemID
                                    , "生产资源": checkStatus.data[0].生产资源名称
                                })
                                layer.close(index);//关闭弹窗
                            }
                        })
                    }
                    obj.event = "";
                    return false;
                }
            })
        }
        //#endregion
        //以上是layui模块
    });