| | |
| | | TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(workNo)); |
| | | if (taskWrk != null) { |
| | | taskWrk.setMemo(errMsg);//将错误码存入备注字段进行展示 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrkMapper.updateById(taskWrk); |
| | | } |
| | | continue; |
| | |
| | | ,true |
| | | ); |
| | | log.info("入库请求参数{}" + JSON.toJSONString(toWmsDTO)); |
| | | log.info("入库请求返回参数{}" + JSON.toJSONString(response)); |
| | | if (jsonObject.getInteger("code").equals(200) && !Cools.isEmpty(jsonObject.get("data").toString())) { |
| | | GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class); |
| | | try{ |
| | |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject1 = JSON.parseObject(response2); |
| | | apiLogService.save("wcs派发库位不为空上报wms" |
| | | apiLogService.save("wcs派发库位==》不为空《==上报wms" |
| | | ,wmsUrl+taskStatusFeedbackPath |
| | | ,null |
| | | ,"127.0.0.1" |
| | |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs派发库位不为空上报wms", getWmsDto.getWrkNo()); |
| | | throw new CoolException("wcs派发入库任务上报wms失败,异常信息:"+e); |
| | | log.error("wcs派发库位==》不为空《==上报wms", getWmsDto.getWrkNo()); |
| | | throw new CoolException("wcs派发入库任务上报wms失败,派发库位==》不为空《==,异常信息:"+e); |
| | | } |
| | | } |
| | | |
| | |
| | | TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(workNo)); |
| | | if (taskWrk != null) { |
| | | taskWrk.setMemo(errMsg);//将错误码存入备注字段进行展示 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrkMapper.updateById(taskWrk); |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | log.info("下发输送线任务:taskWrk:"+JSON.toJSONString(taskWrk)); |
| | | R r = siteController.siteDetlUpdate(Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getWrkNo().shortValue(), (short) 0, "Y", false, false); |
| | | JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(r)); |
| | | if (jsonObject.getInteger("code").equals(200)){ |
| | | // R r = siteController.siteDetlUpdate(Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getWrkNo().shortValue(), (short) 0, "Y", false, false); |
| | | staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(staDesc.getCrnStn().shortValue()); |
| | | boolean offer = false; |
| | | try{ |
| | | offer = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); |
| | | }catch (Exception e){ |
| | | log.error("下发输送线任务失败:异常:"+e); |
| | | log.error("下发输送线任务失败:异常:offer:"+offer); |
| | | } |
| | | // JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(r)); |
| | | if (offer){ |
| | | log.info("下发输送线任务成功:taskWrk:"+JSON.toJSONString(taskWrk)); |
| | | Date now = new Date(); |
| | | taskWrk.setStatus(5); |
| | | taskWrk.setWrkSts(14); |
| | | taskWrk.setModiTime(now); |
| | | taskWrk.setCompleteTime(now); |
| | | taskWrkService.updateById(taskWrk); |
| | | }else { |
| | | log.error("下发输送线任务失败:taskWrk:"+JSON.toJSONString(taskWrk)); |
| | | log.error("下发输送线任务失败:异常信息:"+JSON.toJSONString(r)); |
| | | // log.error("下发输送线任务失败:异常信息:"+JSON.toJSONString(r)); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | continue; |
| | | } |
| | | |
| | | // 库位移转 |
| | | this.locToLoc(crn, crnProtocol); |
| | | |
| | | // 只有当堆垛机空闲 并且 无任务时才继续执行 |
| | | if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO |
| | | && crnProtocol.getLoaded() == 0 && crnProtocol.getForkPos() == 0) { |
| | |
| | | } |
| | | } |
| | | } |
| | | // 库位移转 |
| | | this.locToLoc(crn, crnProtocol); |
| | | |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | int workNo = commonService.getWorkNo(WorkNoType.PAKIN.type);//获取入库工作号 |
| | | taskWrk.setWrkNo(workNo);//工作号 |
| | | // int workNo = commonService.getWorkNo(WorkNoType.PAKIN.type);//获取入库工作号 |
| | | // taskWrk.setWrkNo(workNo);//工作号 |
| | | Date now = new Date(); |
| | | taskWrk.setStatus(TaskStatusType.DISTRIBUTE.id);//派发状态 |
| | | taskWrk.setAssignTime(new Date());//派发时间 |
| | | // taskWrk.setAssignTime(now);//派发时间 |
| | | taskWrk.setExecuteTime(now); |
| | | taskWrk.setWrkSts(3);//工作状态 3.吊车入库 |
| | | taskWrk.setCrnNo(staDesc.getCrnNo());//堆垛机号 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrk.setModiTime(now); |
| | | taskWrk.setModiUser(9988L); |
| | | taskWrkService.updateById(taskWrk); |
| | | |
| | | // //取出命令 |
| | | // List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo()); |
| | |
| | | crnCommand.setDestinationPosX(Utils.getRowShort(taskWrk.getTargetPoint())); // 目标库位列 |
| | | crnCommand.setDestinationPosY(Utils.getBayShort(taskWrk.getTargetPoint())); // 目标库位层 |
| | | crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint())); // 目标库位排 |
| | | crnCommand.setCommand((short)1); |
| | | // crnCommand.setCommand((short)0); |
| | | if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand),false)) { |
| | | log.error("堆垛机命令生成失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | throw new CoolException("堆垛机命令生成失败"); |
| | | }else{ |
| | | try{ |
| | | taskWrkService.updateById(taskWrk); |
| | | }catch (Exception e){ |
| | | log.error("修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | log.error("修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,异常:"+e); |
| | | } |
| | | try{ |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("taskNo",taskWrk.getTaskNo()); |
| | |
| | | ,response |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs派发入库任务上报wms失败", taskWrk); |
| | | throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | } catch (Exception e){ |
| | | log.error("wcs派发入库任务上报wms失败", JSON.toJSONString(taskWrk)); |
| | | // throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | } |
| | | |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | |
| | | // 修改工作档状态 11.生成出库ID => 12.吊车出库中 |
| | | Date now = new Date(); |
| | | taskWrk.setWrkSts(12); |
| | | taskWrk.setStatus(2); |
| | | taskWrk.setModiTime(now); |
| | | if (taskWrkMapper.updateById(taskWrk) == 0) { |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | } |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(taskWrk.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo(taskWrk.getWrkNo().shortValue()); // 工作号 |
| | |
| | | throw new CoolException("堆垛机命令生成失败"); |
| | | }else{ |
| | | try{ |
| | | // 修改工作档状态 11.生成出库ID => 12.吊车出库中 |
| | | Date now = new Date(); |
| | | taskWrk.setWrkSts(12); |
| | | taskWrk.setStatus(2); |
| | | taskWrk.setModiTime(now); |
| | | taskWrk.setExecuteTime(now); |
| | | if (taskWrkMapper.updateById(taskWrk) == 0) { |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,异常:"+e); |
| | | } |
| | | try{ |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("taskNo",taskWrk.getTaskNo()); |
| | | headParam.put("status",taskWrk.getStatus()); |
| | |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcs派发入库任务上报wms" |
| | | apiLogService.save("wcs派发出库任务上报wms" |
| | | ,wmsUrl+taskStatusFeedbackPath |
| | | ,null |
| | | ,"127.0.0.1" |
| | |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs派发出库任务上报wms失败", taskWrk); |
| | | throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | log.error("wcs派发出库任务上报wms失败", JSON.toJSONString(taskWrk)); |
| | | // throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | // // 双深库位且浅库位有货,则需先对浅库位进行库位移转 |
| | | // if (Utils.isDeepLoc(slaveProperties, taskWrk.getStartPoint())) { |
| | | // |
| | | // taskWrkMapper.selectPakOutIoType(taskWrk.getCrnNo()); |
| | | // |
| | | // List<TaskWrk> taskWrks1 = taskWrkMapper.selectPakOutIoType(taskWrk.getCrnNo()); |
| | | // if (Cools.isEmpty(taskWrks1) && taskWrks1.size()!=0){ |
| | | // continue; |
| | | // } |
| | | // String shallowLocNo = Utils.getShallowLoc(slaveProperties, taskWrk.getStartPoint()); |
| | | // TaskWrk hallowLocNoTask = taskWrkMapper.selectByStartPoint(shallowLocNo); |
| | | // if (!Cools.isEmpty(hallowLocNoTask)){ |
| | | // continue; |
| | | // } |
| | | // } |
| | | // |
| | | // //取出命令 |
| | | // List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo()); |
| | | // Integer commandStep = taskWrk.getCommandStep(); |
| | | // if (commandInfos.isEmpty()) { |
| | | // continue;//命令空 |
| | | // } |
| | | // |
| | | // //判断末端命令是否执行 |
| | | // CommandInfo commandInfo2 = commandInfos.get(commandInfos.size() - 1); |
| | | // if (commandInfo2.getCommandStatus() != CommandStatusType.CREATE.id) { |
| | | // continue;//指令已执行 |
| | | // } |
| | | // |
| | | // CommandInfo commandInfo = commandInfos.get(commandStep); |
| | | // CommandPackage commandPackage = JSON.parseObject(commandInfo.getCommand(), CommandPackage.class);//取出命令报文 |
| | | // CrnCommand crnCommand = JSON.parseObject(commandPackage.getCommand().toString(), CrnCommand.class); |
| | | // |
| | | // if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) { |
| | | // log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | // } else { |
| | | // |
| | | // //开始运行 |
| | | // String response = CrnStartRunning(taskWrk); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | // |
| | | // }else { |
| | | // log.error("出库开始运行通讯失败,"+jsonObject.get("msg")); |
| | | // |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | List<TaskWrk> taskWrks = taskWrkMapper.selectList(new EntityWrapper<TaskWrk>() |
| | | .eq("crn_no",slave.getId()) |
| | | .eq("wrk_sts",11) |
| | | .eq("io_type",3)); |
| | | .eq("io_type",3) |
| | | .orderBy("io_pri",false)); |
| | | for (TaskWrk taskWrk : taskWrks){ |
| | | |
| | | // 双深库位且浅库位有货,则需先对浅库位进行库位移转 |
| | |
| | | taskWrk.setWrkSts(12); |
| | | taskWrk.setStatus(2); |
| | | taskWrk.setModiTime(now); |
| | | taskWrk.setExecuteTime(now); |
| | | if (taskWrkMapper.updateById(taskWrk) == 0) { |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | } |
| | |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs派发出库任务上报wms失败", taskWrk); |
| | | throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | log.error("wcs派发移库库任务上报wms失败", taskWrk); |
| | | // throw new CoolException("wcs派发移库库任务上报wms失败"); |
| | | } |
| | | |
| | | } |
| | |
| | | //确认完成信号 |
| | | CrnOperatorParam crnOperatorParam=new CrnOperatorParam(); |
| | | crnOperatorParam.setCrnNo(crn.getId()); |
| | | Date now = new Date(); |
| | | |
| | | crnController.crnTaskComplete(crnOperatorParam); |
| | | if(!Cools.isEmpty(taskWrk)){ |
| | |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | locMast.setLocSts("F");//F.在库 |
| | | locMast.setBarcode(taskWrk.getBarcode());//托盘码 |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | }else if(taskWrk.getIoType()==2&&taskWrk.getWrkSts()==12){ |
| | |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | locMast.setLocSts("O");//O.空库位 |
| | | locMast.setBarcode("");//托盘码 |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | }else if(taskWrk.getIoType()==3&&taskWrk.getWrkSts()==12){ |
| | |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | locMast.setLocSts("F");//F.在库 |
| | | locMast.setBarcode(taskWrk.getBarcode());//托盘码 |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | |
| | | LocMast locMast1 = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | locMast1.setLocSts("O");//O.空库位 |
| | | locMast1.setBarcode("");//托盘码 |
| | | locMast1.setModiTime(new Date()); |
| | | locMast1.setModiTime(now); |
| | | locMast1.setModiUser(9999L); |
| | | locMastService.updateById(locMast1); |
| | | } |
| | | taskWrk.setModiTime(now); |
| | | taskWrk.setCompleteTime(now); |
| | | taskWrkService.updateById(taskWrk); |
| | | |
| | | |
| | |
| | | taskWrk.setWrkNo(workNo1); |
| | | taskWrk.setStatus(TaskStatusType.RECEIVE.id);//任务状态:接收 |
| | | taskWrk.setCreateTime(now); |
| | | taskWrk.setAssignTime(now); |
| | | taskWrk.setModiTime(now); |
| | | taskWrk.setModiUser(5555L); |
| | | taskWrk.setIoType(1);//任务类型 |
| | | taskWrk.setIoPri(Cools.isEmpty(dto.getTaskPriority()) ? 300 : Integer.parseInt(dto.getTaskPriority()));//优先级 |
| | | taskWrk.setBarcode(barcode);//条码 |