| | |
| | | map.put("J-1109",118);map.put("J-1110",117); |
| | | map.put("J-1111",122);map.put("J-1112",121); |
| | | map.put("H-1102",300);map.put("H-1101",305); |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_desc", param.getWharfCode())); |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("stn_desc", param.getWharfCode())); |
| | | |
| | | if (Cools.isEmpty(staDesc)){ |
| | | return R.error("程序报错,未查询到站点"); |
| | |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | wrapper.orderDesc(Collections.singleton("create_time")); |
| | | return R.ok(taskWrkLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | |
| | | StaDesc queryCrnStn(Integer typeNo, Integer crnNo, Integer stnNo); |
| | | |
| | | StaDesc queryCrn(Integer typeNo, Integer stnNo); |
| | | StaDesc queryCrn(Integer typeNo, Integer stnNo,Integer crnNo); |
| | | |
| | | } |
| | |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | } |
| | | } |
| | | return; |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | crnCommand.setTaskNo(taskWrk.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX(Utils.getRowShort(taskWrk.getStartPoint())); // 源库位排 |
| | | crnCommand.setSourcePosY(Utils.getBayShort(taskWrk.getStartPoint())); // 源库位列 |
| | | crnCommand.setSourcePosZ(Utils.getLevShort(taskWrk.getStartPoint())); // 源库位层 |
| | | crnCommand.setDestinationPosX(Utils.getRowShort(taskWrk.getTargetPoint())); // 目标库位排 |
| | | crnCommand.setDestinationPosY(Utils.getBayShort(taskWrk.getTargetPoint())); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint())); // 目标库位层 |
| | | crnCommand.setSourcePosZ(Utils.getRowShort(taskWrk.getStartPoint())); // 源库位排 |
| | | crnCommand.setSourcePosX(Utils.getBayShort(taskWrk.getStartPoint())); // 源库位列 |
| | | crnCommand.setSourcePosY(Utils.getLevShort(taskWrk.getStartPoint())); // 源库位层 |
| | | crnCommand.setDestinationPosZ(Utils.getRowShort(taskWrk.getTargetPoint())); // 目标库位排 |
| | | crnCommand.setDestinationPosX(Utils.getBayShort(taskWrk.getTargetPoint())); // 目标库位列 |
| | | crnCommand.setDestinationPosY(Utils.getLevShort(taskWrk.getTargetPoint())); // 目标库位层 |
| | | crnCommand.setCommand((short) 1); |
| | | if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | public ArrayList<String> wharfCode1 = new ArrayList<String>(){{ |
| | | add("J-1101"); add("J-1103"); add("J-1105"); add("J-1107"); add("J-1109"); add("J-1111"); |
| | | add("J-1101"); add("J-1103"); add("J-1105"); add("J-1107"); add("J-1109"); add("J-1111");add("H-1101"); |
| | | add("G-1101"); |
| | | }}; |
| | | |
| | | |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Short workNo = staProtocol.getWorkNo(); |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | if (inSta.getBackSta().equals(staDesc.getStnNo())){ |
| | | if (wharfCode1.contains(param.getWharfCode())){ |
| | | if (!staProtocol.isLoading() && !staProtocol.isCar()){ |
| | | //AGV出库完成以后 |
| | | } |
| | | if (wharfCode1.contains(param.getWharfCode())){ |
| | | if (!staProtocol.isLoading() && !staProtocol.isCar() && staProtocol.getWorkNo() >0){ |
| | | //AGV出库完成以后 |
| | | staProtocol.setWorkNo((short) 0); |
| | | staProtocol.setStaNo((short)0); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); |
| | | if (result) { |
| | | |
| | | }else { |
| | | } else { |
| | | throw new RuntimeException("agv返回完成后,命令下发失败"); |
| | | } |
| | | } |
| | | }else { |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | if (inSta.getBackSta().equals(staDesc.getStnNo())){ |
| | | |
| | | if (staProtocol.isLoading() && !staProtocol.isCar() && workNo == 0){ |
| | | //AGV入库完成以后 |
| | | staProtocol.setWorkNo((short) 9999); |
| | |
| | | throw new RuntimeException("agv返回完成后,命令下发失败"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public StaDesc queryCrn(Integer typeNo, Integer stnNo) { |
| | | public StaDesc queryCrn(Integer typeNo, Integer stnNo,Integer crnNo) { |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", typeNo) |
| | | .eq("stn_no", stnNo); |
| | | .eq("stn_no", stnNo) |
| | | .eq("crn_no",crnNo); |
| | | StaDesc staDesc = this.selectOne(wrapper); |
| | | if (staDesc == null) { |
| | | return null; |
| | |
| | | @Override |
| | | public void startup(TaskWrk taskWrk, Long userId) { |
| | | //入库任务派发 |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getStartPoint())); |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getStartPoint()), taskWrk.getCrnNo()); |
| | | if (staDesc == null) { |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | |
| | | @Override |
| | | public void stockOut(TaskWrk taskWrk, Long userId) { |
| | | //出库任务派发 |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint())); |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint()), taskWrk.getCrnNo()); |
| | | if (staDesc == null) { |
| | | return;//不存在路径 |
| | | } |
| | |
| | | @Override |
| | | public void locMove(TaskWrk taskWrk, Long userId) { |
| | | //库格移载任务派发 |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint())); |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint()), taskWrk.getCrnNo()); |
| | | if (staDesc == null) { |
| | | return;//不存在路径 |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.entity.StaDesc; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.entity.param.TaskOverToWms; |
| | | import com.zy.asrs.entity.param.TaskStatusFeedbackParam; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.CommandInfoService; |
| | | import com.zy.asrs.service.StaDescService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.PostMesDataUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private CommandInfoService commandInfoService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | |
| | | taskOverToWms.setTaskNo(taskWrk.getTaskNo()); //任务号 |
| | | taskOverToWms.setTaskType(taskStatusFeedbackParam.getTaskType()); // 任务类型 |
| | | taskOverToWms.setContainerCode(taskWrk.getBarcode()); // 容器编码 |
| | | //区分入出库 |
| | | if (taskWrk.getIoType() ==1 ){ |
| | | taskOverToWms.setEquipmentCode(String.valueOf(taskWrk.getCrnNo())); //设备编码 |
| | | taskOverToWms.setTargetLocationCode(taskWrk.getOriginTargetPoint()); //目标库位 |
| | | }else if (taskWrk.getIoType() ==2){ |
| | | Map<Integer,String> map1 = new HashMap<>(); |
| | | map1.put(102,"J-1101"); |
| | | map1.put(106,"J-1103"); |
| | | map1.put(110,"J-1105"); |
| | | map1.put(114,"J-1107"); |
| | | map1.put(118,"J-1109"); |
| | | map1.put(122,"J-1111"); |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_no", taskWrk.getTargetPoint())); |
| | | StaDesc staDesc = staDescService.queryCrn(2, Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getCrnNo()); |
| | | taskOverToWms.setEquipmentCode(staDesc.getStnDesc()); //设备编码 |
| | | taskOverToWms.setSourceLocationCode(taskWrk.getOriginStartPoint()); //源库位 |
| | | //判断托盘是否走到出库站 |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", taskWrk.getTargetPoint())); |
| | | if (!basDevp.getWrkNo().equals(taskWrk.getWrkNo())){ |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | taskOverToWms.setTaskStatus("done"); //任务状态 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //更新命令日志 |
| | | CommandInfoLogService commandInfoLogService = SpringUtils.getBean(CommandInfoLogService.class); |
| | | CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class); |
| | | CommandInfo commandInfo = commandInfoService.selectById(command.getCommandId()); |
| | | CommandInfoLog commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class); |
| | | commandInfoLog.setId(null); |
| | | |
| | | if (result.IsSuccess) { |
| | | log.warn("堆垛机命令下发[id:{},时间:{}] >>>>> {}", slave.getId(), DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F), JSON.toJSON(command)); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |
| | | |
| | | //更新指令日志 |
| | | commandInfoLog.setDeviceLog("指令下发成功"); |
| | | commandInfoLogService.insert(commandInfoLog); |
| | | |
| | | //更新任务步序 |
| | | TaskWrkService taskWrkService = SpringUtils.getBean(TaskWrkService.class); |
| | | TaskWrk taskWrk = taskWrkService.selectByWrkNo(command.getTaskNo().intValue()); |
| | | if (taskWrk != null) { |
| | | taskWrk.setCommandStep(taskWrk.getCommandStep() + 1);//更新指令步序 |
| | | taskWrkService.updateById(taskWrk); |
| | | } |
| | | |
| | | return true; |
| | | } else { |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | log.error("写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | |
| | | //更新指令日志 |
| | | commandInfoLog.setDeviceLog("指令下发失败"); |
| | | commandInfoLogService.insert(commandInfoLog); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | <select id="selectToBeHistoryData" resultMap="BaseResultMap"> |
| | | select * from dbo.wcs_task_wrk |
| | | where 1=1 |
| | | and (status=5 or status=4) |
| | | and ((wrk_sts=14 and status=5) or status=4 or (wrk_sts=4 and status=5)) |
| | | order by io_pri desc,create_time,wrk_no ASC |
| | | </select> |
| | | |