自动化立体仓库 - WMS系统
野心家
2025-06-21 288e45a990a5abf4ab50f820ed4e870e8314468e
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
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.WaitPakin;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.service.impl.WaitPakinServiceImpl;
import com.zy.asrs.task.handler.WorkMastHandler;
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;
 
/**
 * Created by vincent on 2020/7/7
 */
@Component
public class AutomaticallyAssignOutTasksToRCSScheduler {
 
    private static final Logger log = LoggerFactory.getLogger(AutomaticallyAssignOutTasksToRCSScheduler.class);
 
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private MobileController mobileController;
 
    /**
     * 自动派发入库任务给RCS
     */
    @Scheduled(cron = "0/3 * * * * ? ")
    private synchronized void execute(){
        //查看是否有agv在做的任务
        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_sts", 15));
        if(!Cools.isEmpty(wrkMast)){
            return;
        }
        //找到出库任务
        //将任务档状态从30转15
        WrkMast wrkMast1 =wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_sts", 30));
        if(wrkMast1!=null){
            R r=mobileController.AGVMove(wrkMast1.getMemo()+"","6002",3);
            if (r.get("code").equals(200)){
                R r1=mobileController.AGVMove("6002",wrkMast1.getMemo()+"",4);
                if (r1.get("code").equals(200)){
                    wrkMast1.setWrkSts(15L);
                    wrkMast1.setPacked(r.get("msg")+"");//RCS 工作号
                    wrkMastService.updateById(wrkMast1);
                }
            }
        }
    }
}