|  |  | 
 |  |  |  | 
 |  |  | import com.zy.asrs.domain.param.RobotReportActionStatusParam; | 
 |  |  | import com.zy.asrs.domain.param.ReportExceptionParam; | 
 |  |  | import com.zy.asrs.entity.WrkMast; | 
 |  |  | import com.zy.asrs.mapper.WrkMastMapper; | 
 |  |  | import com.zy.common.utils.RobotUtils; | 
 |  |  | import com.zy.core.DevpThread; | 
 |  |  | import com.zy.core.cache.MessageQueue; | 
 |  |  | import com.zy.core.cache.SlaveConnection; | 
 |  |  | import com.zy.core.enums.SlaveType; | 
 |  |  | import com.zy.core.model.DevpSlave; | 
 |  |  | import com.zy.core.model.Task; | 
 |  |  | import com.zy.core.model.protocol.StaProtocol; | 
 |  |  | import com.zy.core.properties.SlaveProperties; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
 |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  | 
 |  |  | @RestController | 
 |  |  | public class RobotController { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private WrkMastMapper wrkMastMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private SlaveProperties slaveProperties; | 
 |  |  |  | 
 |  |  |     //机械手向WCS回报任务结果完成 | 
 |  |  |     @PostMapping("/request/wcs/single_class_depal_task/report_action_status") | 
 |  |  |     @PostMapping("/request/wcs/report_task_status") | 
 |  |  |     public HashMap<String,Object> reportActionStatus(@RequestBody RobotReportActionStatusParam param) { | 
 |  |  |         HashMap<String, Object> map = new HashMap<>(); | 
 |  |  |         String taskId = param.getTask_id(); | 
 |  |  | 
 |  |  |         Integer pickNum = param.getPick_num(); | 
 |  |  |         Integer targetNum = param.getTarget_num(); | 
 |  |  |         String message = param.getMessage(); | 
 |  |  |         Integer staNo = param.getFrom_ws();//目标站 | 
 |  |  |  | 
 |  |  |         //给目标站写入出库站344 | 
 |  |  |         for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |             // 获取入库站信息 | 
 |  |  |             DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); | 
 |  |  |             StaProtocol staProtocol = devpThread.getStation().get(staNo);//机械手臂拣料站 | 
 |  |  |             staProtocol = staProtocol.clone(); | 
 |  |  |             staProtocol.setStaNo((short) 344);//空托盘出库站 | 
 |  |  |             boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  |  | 
 |  |  |             //更新工作档 => 29.出库完成 | 
 |  |  |             WrkMast wrkMast = wrkMastMapper.selectByWorkNo(Integer.valueOf(taskId)); | 
 |  |  |             if (wrkMast != null && wrkMast.getWrkSts() == 25) { | 
 |  |  |                 wrkMast.setWrkSts(29L); | 
 |  |  |                 wrkMastMapper.updateById(wrkMast); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         System.out.println(param); | 
 |  |  |         map.put("error", 0); | 
 |  |  |         map.put("error_message", "success"); | 
 |  |  |         return map; | 
 |  |  | 
 |  |  |         String msg = param.getMsg(); | 
 |  |  |         String tip = param.getTip(); | 
 |  |  |  | 
 |  |  |         System.out.println(param); | 
 |  |  |         map.put("error", 0); | 
 |  |  |         map.put("error_message", "success"); | 
 |  |  |         return map; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @GetMapping("/test") | 
 |  |  |     public void test() { | 
 |  |  |         boolean systemStatus = RobotUtils.getSystemStatus(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @GetMapping("/test2") | 
 |  |  |     public void test2() { | 
 |  |  |         RobotUtils.sendTask("9994", 4, "317"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |