自动化立体仓库 - WMS系统
#
zwl
12 小时以前 60f504b1f7308bcf8d1079a25d0db6922926ebae
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
package com.zy.asrs.task;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.WorkOutErpReportHandler;
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.util.List;
 
@Slf4j
@Component
public class WorkOutErpReportScheduler {
 
    @Autowired
    private WrkMastService wrkMastService;
 
    @Autowired
    private WorkOutErpReportHandler workOutErpReportHandler;
 
    @Scheduled(cron = "0/10 * * * * ? ")
    private void execute() {
        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
                .eq("wrk_sts", WorkOutErpReportHandler.ERP_REPORT_PENDING_WRK_STS)
                .orderBy("io_time", true)
                .orderBy("wrk_no", true));
        if (wrkMasts.isEmpty()) {
            return;
        }
        for (WrkMast wrkMast : wrkMasts) {
            ReturnT<String> result = workOutErpReportHandler.start(wrkMast);
            if (!result.isSuccess()) {
                log.error("workNo={} outbound erp report failed: {}", wrkMast.getWrkNo(), result.getMsg());
            }
        }
    }
}