package com.zy.asrs.task.NewWay; import com.baomidou.mybatisplus.mapper.EntityWrapper; 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.core.ReturnT; 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; import java.util.Date; import java.util.List; /** * Created by vincent on 2020/7/7 */ @Component public class AutomaticallyAssignInTasksToRCSScheduler { private static final Logger log = LoggerFactory.getLogger(AutomaticallyAssignInTasksToRCSScheduler.class); @Autowired private WrkMastService wrkMastService; @Autowired private WorkMastHandler workMastHandler; @Autowired private WaitPakinServiceImpl waitPakinService; @Autowired private MobileController mobileController; /** * 自动派发入库任务给RCS */ @Scheduled(cron = "0/3 * * * * ? ") private synchronized void execute(){ //查看是否有agv在做的任务 WaitPakin waitPakin1=waitPakinService.selectOne(new EntityWrapper().eq("be_batch",1)); if(waitPakin1!=null){ return; } //找到正在等待的组托数据 //该数据进行0转1 WaitPakin waitPakin=waitPakinService.selectOne(new EntityWrapper().eq("be_batch",0)); if(waitPakin!=null){ R r=mobileController.AGVMove(waitPakin.getMemo(),6001+"",1); if (r.get("code").equals(200)){ R r1=mobileController.AGVMove(6001+"",waitPakin.getMemo(),2); if (r1.get("code").equals(200)){ waitPakin.setItemNum(r.get("msg")+""); waitPakin.setBeBatch(1);//0转1 waitPakinService.update(waitPakin,new EntityWrapper().eq("manu",waitPakin.getManu())); } } } } }