自动化立体仓库 - WMS系统
zyx
2023-10-12 ed7af72bc1858a69f53533b852904ccf81d362f3
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
package com.zy.asrs.task;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.Cools;
import com.zy.asrs.entity.AgvWrkMast;
import com.zy.asrs.service.AgvWrkMastService;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.AgvWrkMastHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.io.IOException;
import java.util.List;
 
/**
 * 任务类型:
 *  putaway:上架。
 *  carry:搬运,统指出库、移库、点到点搬运等。
 *  scan:扫描盘点。
 *  weight:称重盘点。
 *  rfid:rfid盘点。
 */
@Slf4j
@Component
public class AgvWrkMastScheduler {
 
    @Autowired
    AgvWrkMastHandler agvWrkMastHandler;
    @Autowired
    AgvWrkMastService agvWrkMastService;
 
 
    /*
    定时处理AGV工作档中工作状态为205.工作完成 且 (1.入库 || 53,拣料入库 || 57.盘点入库 || 10.空板入库 || 11.库格移载)的数据
     */
    @Scheduled(cron = "0/5 * * * * ? ")
    public void excutePutwayWrk(){
        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
                .eq("wrk_sts", 205)
                .andNew().eq("io_type",53)
                .or().eq("io_type",1)
                .or().eq("io_type",57)
                .or().eq("io_type",10)
                .or().eq("io_type",11));
        if(!Cools.isEmpty(agvWrkMastList)){
            agvWrkMastList.stream().forEach(agvWrkMast -> {
                agvWrkMastHandler.completedPutWayWrk(agvWrkMast);
            });
        }
    }
 
    /*
    定时处理AGV工作档中工作状态为206.容器离场完成 且 (101.出库 || 110.空板出库)
     */
    @Scheduled(cron = "0/5 * * * * ? ")
    public void excuteCarryWrk(){
        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
                .eq("wrk_sts", 206)
                .andNew().eq("io_type",110)
                .or().eq("io_type",101));
        if(!Cools.isEmpty(agvWrkMastList)){
            agvWrkMastList.stream().forEach(agvWrkMast -> {
                ReturnT<String> returnT = agvWrkMastHandler.completedCarryWrk(agvWrkMast);
            });
        }
    }
 
    /*
    putaway:上架
    定时处理AGV工作档中工作状态为201.生成入库任务ID 且(出库类型为 53.拣料再入库 || 1.入库 || 10.空板入库栽 || 57.盘点再入库)的数据
     */
    @Scheduled(cron = "0/5 * * * * ? ")
    public void startPutwayWrk(){
        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50)
                ,new EntityWrapper<AgvWrkMast>()
                .eq("wrk_sts", 201)
                .andNew().eq("io_type", 53)
                .or().eq("io_type", 1)
                .or().eq("io_type", 10)
                .or().eq("io_type", 57)).getRecords();
 
        if(!Cools.isEmpty(agvWrkMastList)){
            try {
                ReturnT<String> returnT = agvWrkMastHandler.startPutWayWrk(agvWrkMastList);
            } catch (IOException e) {
                log.error(e.getMessage());
            }
        }
    }
 
    /*
    carry:搬运,统指出库、移库、点到点搬运等
    定时处理AGV工作档中工作状态为21.生成出库任务 且(出库类型为 101.出库 || 103.拣料出库 || 11.库格移栽 || 110.空板出库 || 107.盘点出库)的数据
     */
    @Scheduled(cron = "0/5 * * * * ? ")
    public void startCarryWrk(){
        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50)
                ,new EntityWrapper<AgvWrkMast>()
                        .eq("wrk_sts", 21)
                        .andNew().eq("io_type", 101)
                        .or().eq("io_type", 103)
                        .or().eq("io_type", 11)
                        .or().eq("io_type", 110)
                        .or().eq("io_type", 107)).getRecords();
 
        if(!Cools.isEmpty(agvWrkMastList)){
            try {
                ReturnT<String> returnT = agvWrkMastHandler.startCarryWrk(agvWrkMastList);
            } catch (IOException e) {
                log.error(e.getMessage());
            }
        }
    }
}