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().eq("wrk_sts", 15)); if(!Cools.isEmpty(wrkMast)){ return; } //找到出库任务 //将任务档状态从30转15 WrkMast wrkMast1 =wrkMastService.selectOne(new EntityWrapper().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); } } } } }