自动化立体仓库 - WMS系统
pang.jiabao
2024-09-24 0329286b3ba1ddbdcad4769b9ccd4d5b3f5d1e64
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
package com.zy.asrs.task;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.mapper.OrderMapper;
import com.zy.asrs.mapper.WrkMastMapper;
import com.zy.asrs.task.handler.GhjtHandler;
import com.zy.system.entity.Config;
import com.zy.system.mapper.ConfigMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * @author pang.jiabao
 * @description 冠鸿江铜相关定时任务
 * @createDate 2024/7/3 9:07
 */
@Slf4j
@Component
public class GhjtScheduler {
 
    @Resource
    private GhjtHandler ghjtHandler;
 
    @Resource
    private WrkMastMapper wrkMastMapper;
 
    @Resource
    private OrderMapper orderMapper;
 
    @Resource
    private ConfigMapper configMapper;
 
    // 自动备货(根据出库单,把要出的货提前放到靠近出库口位置)
    // 定时任务获取待备货订单明细->获取堆垛机对应的源库位,获取备货区库位->生成移库任务11->
    // 执行移库任务12->入库完成4->更新工作档定时任务中更新订单备货状态和订单明细备货状态5->转储历史
    @Scheduled(cron = "0/10 * * * * ?")
    public synchronized void autoStockUp() {
        // 查询自动备货配置
        Config config = configMapper.selectConfigByCode("auto_stock_up");
        if (config == null || config.getStatus() == 0) {
            return;
        }
        // 查询出库申请单中没有备货的订单明细的包装组号
        List<String> list = orderMapper.selectStockUpOrderDetl();
        if (list.isEmpty()) {
            return;
        }
 
        ghjtHandler.autoStockUpHandler(list, Integer.parseInt(config.getValue()));
 
    }
 
    // 下发出库任务给GWCS(从出库码头到出库口)
    @Scheduled(cron = "0/2 * * * * ? ")
    public void ckrwPushGwcs() {
        // 查询状态为13的工作档
        List<WrkMast> wrkMasts = wrkMastMapper.selectList(new EntityWrapper<WrkMast>().in("io_type", 101,103,107,110,3).eq("wrk_sts", 13));
        for (WrkMast wrkMast : wrkMasts) {
            try {
                ghjtHandler.startCkrwPushGwcs(wrkMast);
            } catch (Exception e) {
                log.error("下发出库任务给GWCS(从出库码头到出库口)失败,异常信息:" + e);
            }
        }
    }
 
    // 空闲理货
    @Scheduled(cron = "0/5 * * * * ? ")
    public void autoTallyGoods() {
        // 系统配置界面启用
        Config config = configMapper.selectConfigByCode("auto_tally_goods");
        if (config == null || config.getStatus() == 0) {
            return;
        }
        // 四个换盘点,两个组盘点
        // 先查任务目标站为 3045/3044和3041/3040的换盘组 如果有为空的组则可以出,有一个或两个都不能出
        // todo 需新增两个入库路径 3046/3042
        // 寻找两个能组盘的库位,库位状态为F,满足组盘条件
        // 出库怎么出,才能把组好的盘一次出出去
        // gwcs怎么保证两个都拆完了才请求组盘完成
 
 
    }
 
}