自动化立体仓库 - WMS系统
zwl
昨天 757f103f37d83dfb55bb49b3df0b805cb520d4f7
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
package com.zy.asrs.task.NewWay;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.controller.MobileController;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.entity.param.EmptyPlateOutParam;
import com.zy.asrs.service.WorkService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.service.impl.LocMastServiceImpl;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * Created by vincent on 2020/7/7
 */
@Component
public class AutoEmptyOutTaskscheduler {
 
    private static final Logger log = LoggerFactory.getLogger(AutoEmptyOutTaskscheduler.class);
 
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private MobileController mobileController;
    @Autowired
    private LocMastServiceImpl locMastService;
    @Autowired
    private WorkService workService;
    @Autowired
    private ConfigService configService;
 
    /**
     * 自动生成空板出库任务给RCS
     */
    @Scheduled(cron = "0/3 * * * * ? ")
    private synchronized void execute(){
        List<WrkMast> wrkMastsEmpty = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("io_type",110));
        if (!Cools.isEmpty(wrkMastsEmpty)){
            return;
        }
        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 1).ge("wrk_sts", 3));
        if (!Cools.isEmpty(wrkMast)){
            //生成空板出库任务
            EmptyPlateOutParam  emptyPlateOutParam = new EmptyPlateOutParam();
            emptyPlateOutParam.setOutSite(102);
            List<String> strings= new ArrayList<>();
 
            //查看空板
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").orderBy("row1",true));
            if (Cools.isEmpty(locMasts)){
                log.error("中转库没有空板!!!!");
                return;
            }
            //获取空栈板库位
            strings.add(locMasts.get(0).getLocNo());
            emptyPlateOutParam.setLocNos(strings);
            emptyPlateOutParam.setOutSite(Integer.valueOf(wrkMast.getMemo()));
            workService.emptyPlateOut(wrkMast.getMemo(),emptyPlateOutParam, 9955L);
        }
    }
}