| | |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.mes.TransTask; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.entity.rcs.RcsReturn; |
| | | import com.zy.asrs.entity.rcs.RcsTaskSubmit; |
| | | import com.zy.asrs.entity.rcs.RcsTaskTargetRoute; |
| | | import com.zy.asrs.enums.CommonEnum; |
| | | import com.zy.asrs.enums.LocStsType; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.MesCombParam; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | |
| | | private BasStationService basStationService; |
| | | @Autowired |
| | | private BasContainerService basContainerService; |
| | | |
| | | @Resource |
| | | private RcsService rcsService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R djReturn(String djNo) { |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>().eq("barcode", djNo)); |
| | | if(task == null) { |
| | | log.error("刀架号:{},不存在任务!",djNo); |
| | | return R.parse("刀架号:"+djNo+"不存在任务"); |
| | | } else if(task.getWrkSts() == 305) { |
| | | task.setWrkSts(301L); |
| | | task.setModiTime(new Date()); |
| | | task.setTaskNo(task.getTaskNo()+"-1"); // 更新任务号 |
| | | String sourceStaNo = task.getSourceStaNo(); |
| | | task.setSourceStaNo(task.getStaNo()); |
| | | task.setStaNo(sourceStaNo); |
| | | |
| | | TransTask transTask = JSONObject.parseObject(task.getMemo(), TransTask.class); |
| | | transTask.setTaskno(task.getTaskNo()); |
| | | transTask.setCurStationId(sourceStaNo); |
| | | transTask.setNextStationId(task.getStaNo()); |
| | | if(transTask.getTransType().equals("06")) { |
| | | transTask.setTransType("01"); |
| | | } else if(transTask.getTransType().equals("02")) { |
| | | transTask.setTransType("05"); |
| | | } else{ |
| | | log.error("刀架号:{},运输类型有误:{}",djNo,transTask.getTransType()); |
| | | return R.parse("刀架号:"+djNo+",运输类型有误:" + transTask.getTransType()); |
| | | } |
| | | // 更新备注 |
| | | task.setMemo(JSONObject.toJSONString(transTask)); |
| | | |
| | | // 下发给RCS |
| | | RcsTaskSubmit rcsTaskSubmit = new RcsTaskSubmit(); |
| | | // 模板名 |
| | | rcsTaskSubmit.setTaskType("CS"); |
| | | rcsTaskSubmit.setRobotTaskCode(transTask.getTaskno()); |
| | | rcsTaskSubmit.setInitPriority(10); //默认10 |
| | | List<RcsTaskTargetRoute> targetRouteList = new ArrayList<>(); |
| | | RcsTaskTargetRoute startRoute = new RcsTaskTargetRoute(); |
| | | startRoute.setSeq(0); |
| | | startRoute.setCode(transTask.getCurStationId()); |
| | | startRoute.setOperation("COLLECT"); |
| | | targetRouteList.add(startRoute); |
| | | RcsTaskTargetRoute endRoute = new RcsTaskTargetRoute(); |
| | | endRoute.setSeq(1); |
| | | endRoute.setCode(transTask.getNextStationId()); |
| | | endRoute.setOperation("DELIVERY"); |
| | | targetRouteList.add(endRoute); |
| | | rcsTaskSubmit.setTargetRoute(targetRouteList); |
| | | |
| | | // 转发给海康或华晓RCS |
| | | RcsReturn rcsReturn = rcsService.submitTask(rcsTaskSubmit, transTask.getAgvFactory()); |
| | | if (rcsReturn.getCode().equals("SUCCESS")) { |
| | | // 更新agv任务记录 |
| | | taskService.updateById(task); |
| | | |
| | | // 更新接驳位状态 |
| | | BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", task.getSourceStaNo())); |
| | | if(station.getLocSts().equals("F")) { |
| | | station.setLocSts("R"); |
| | | station.setModiTime(new Date()); |
| | | basStationService.updateById(station); |
| | | } else { |
| | | log.error("agv回调end,接驳点状态不为F,agv任务号:{},状态:{}",task.getTaskNo(),task.getWrkSts()); |
| | | } |
| | | } else { |
| | | log.error("下发rcs搬运命令失败:{}",rcsReturn); |
| | | return R.parse("下发rcs失败:" + rcsReturn.getMessage()); |
| | | } |
| | | |
| | | return R.ok("RCS命令下发成功!"); |
| | | }else { |
| | | log.error("刀架号:{},任务状态不对:{}",djNo,task.getWrkSts()); |
| | | return R.parse("刀架号:"+djNo+",任务状态不对:" + task.getWrkSts()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | if (mat.getUpQty().compareTo(detlDto.getAnfme()) < 0) { |
| | | throw new CoolException("物料:" + detlDto.getMatnr() + "单次最大组托上限为:" + mat.getUpQty()); |
| | | } |
| | | // if (mat.getUpQty().compareTo(detlDto.getAnfme()) < 0) { |
| | | // throw new CoolException("物料:" + detlDto.getMatnr() + "单次最大组托上限为:" + mat.getUpQty()); |
| | | // } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | BeanUtils.copyProperties(mat, waitPakin); |
| | | waitPakin.setMemo(""); |
| | | waitPakin.setBatch(detlDto.getBatch()); |
| | | waitPakin.setZpallet(param.getBarcode()); |
| | | waitPakin.setIoStatus("N"); |