tjx
昨天 a53e6872c70ba7c6c870627007ece21df9bcedbc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package com.hk.NumericalCollection.task;
 
 
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.hk.NumericalCollection.entity.DevMacBycl;
import com.hk.NumericalCollection.entity.DevMachine;
import com.hk.NumericalCollection.entity.MesOrderSelect;
import com.hk.NumericalCollection.entity.Womdaa;
import com.hk.NumericalCollection.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
@Component
@RequiredArgsConstructor
public class ScheduledTasks {
 
//    private final INumericalService numericalService;
//
//    private final DevMachineService devMachineService;
//
//    private final DevMacByclService devMacByclService;
//
//    private final WomdaaService womdaaService;
//
//    private final MesOrderSelectService orderSelectService;
//
//    private final MesNumericalService mesNumericalService;
//
//
//    /**
//     * 每天0点执行一次
//     * 同步设备信息
//     *
//     * @return void
//     * @author tjx
//     * @description TODO
//     * @date 2024/9/27 21:48
//     */
//    @Scheduled(cron = "0 0 0 * * SUN")
//    public void SoDeviceList() {
//        mesNumericalService.cleanWeekAgoData();
//    }
//
//    //0 0 1 * * ? *
//    @Scheduled(cron = "0 0 1 1/1 * ?")
//    public void GetMinusDaa001() {
//        String format = DateUtil.format(new Date(), "yyyy-MM-dd");
//        List<Womdaa> minusDaa001 = womdaaService.getMinusDaa001(format);
//        List<MesOrderSelect> list = new ArrayList<>();
//
//        minusDaa001.forEach(womdaa -> {
//            MesOrderSelect womdaaSelect = new MesOrderSelect();
//            womdaaSelect.setOrderId(womdaa.getId());
//            womdaaSelect.setOrderNo(womdaa.getDaa001());
//            womdaaSelect.setEditDate(format);
//            womdaaSelect.setMachineNo(womdaa.getMachineNo());
//            womdaaSelect.setIsShow(0);
//            womdaaSelect.setTjCount(0);
//            womdaaSelect.setTjTime(0.0);
//            list.add(womdaaSelect);
//        });
//
//        orderSelectService.saveBatch(list);
//    }
//
//    @Scheduled(cron = "0 0 2 1/1 * ?")
//    public void getDeviceDayCount() {
//        DateTime oneWeekAgo = DateUtil.offsetDay(DateUtil.date(), -1);
//        String format = DateUtil.format(oneWeekAgo, "yyyy-MM-dd");
//        try {
//            List<DevMachine> list = devMachineService.list();
//            for (DevMachine s : list) {
//                numericalService.getDeviceDayCount(s.getDevNo(), format);
//            }
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        }
//    }
//
//
//    /**
//     * 每五分钟执行一次
//     * 获取设备最近的一条记录
//     *
//     * @return void
//     * @author tjx
//     * @description TODO
//     * @date 2024/9/27 21:48
//     */
//    @Scheduled(cron = "0 0/2 * * * ?")
//    public void getDeviceRealTimeData() {
//        List<DevMachine> list = devMachineService.list();
//        list.forEach(s -> {
//            try {
//                numericalService.getDeviceRealTimeData(s.getDevNo());
//            } catch (Exception e) {
//                throw new RuntimeException(e);
//            }
//        });
//    }
//
//    /**
//     * 每五分钟执行一次(与主任务错开一分钟)
//     * 获取设备最近的一条记录写入BYCL表
//     */
//    @Scheduled(cron = "30 0/2 * * * ?")
//    public void getDeviceRealTimeDataBycl() {
//        List<DevMacBycl> list = devMacByclService.list();
//        list.forEach(s -> {
//            try {
//                numericalService.getDeviceRealTimeDataBycl(s.getDevNo());
//            } catch (Exception e) {
//                throw new RuntimeException(e);
//            }
//        });
//    }
}