自动化立体仓库 - WMS系统
zwl
2 天以前 757f103f37d83dfb55bb49b3df0b805cb520d4f7
src/main/java/com/zy/asrs/task/NewWay/AutomaticallyAssignOutTasksToRCSScheduler.java
@@ -4,16 +4,23 @@
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.controller.MobileController;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.service.impl.BasDevpServiceImpl;
import com.zy.asrs.service.impl.LocMastServiceImpl;
import com.zy.asrs.service.impl.WaitPakinServiceImpl;
import com.zy.asrs.task.handler.WorkMastHandler;
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.Date;
/**
 * Created by vincent on 2020/7/7
@@ -27,27 +34,55 @@
    private WrkMastService wrkMastService;
    @Autowired
    private MobileController mobileController;
    @Autowired
    private LocMastServiceImpl locMastService;
    @Autowired
    private BasDevpServiceImpl basDevpService;
    @Autowired
    private ConfigService configService;
    /**
     * 自动派发入库任务给RCS
     * 自动派发出库任务给RCS
     */
    @Scheduled(cron = "0/3 * * * * ? ")
    private synchronized void execute(){
        Config config = configService.selectOne(new EntityWrapper<Config>()
                .eq("code", "Instatus")
                .eq("value", "N"));
        if(Cools.isEmpty(config)){
            return;
        }
        //查看是否有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);
            String sourceSite="6002";
            if (wrkMast1.getStaNo()==102){
                sourceSite="6001";
            }
            BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("autoing","Y").eq("loading","Y").gt("wrk_no",0));
            if(Cools.isEmpty(basDevp)){
                return;
            }
            log.info("给AGV下发ioType={}出库任务,源站点={},目标站点={}",wrkMast1.getIoType(),sourceSite,wrkMast1.getMemo());
            R r=mobileController.AGVMove(sourceSite,wrkMast1.getMemo(),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 工作号
//                R r1=mobileController.AGVMove("6002",wrkMast1.getMemo(),4);
                if (r.get("code").equals(200)){
                    if(wrkMast1.getIoType()==110){
                        wrkMast1.setWrkSts(41L);//下发agv搬运任务完成--》产线补空板
                        wrkMast1.setPacked(r.get("msg")+"");//RCS 工作号
                        config.setValue("Y");//Y是空板出库库后切换成组托入库
                        configService.insert(config);
                    }else{
                        wrkMast1.setWrkSts(31L);//下发给agv搬运任务完成-->出库到分拣区
                    }
                    wrkMast1.setModiTime(new Date());
                    wrkMastService.updateById(wrkMast1);
                }
            }