| | |
| | | |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wms/taskCreate", 1, "wms任务下发,任务数:"+params.size()); |
| | | deviceErrorService.addDeviceError("wms下发任务", 1, "wms任务下发,任务数:"+params.size()); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if (Cools.isEmpty(param)){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "参数为空,param:"+JSON.toJSONString(param)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "参数为空,param:"+JSON.toJSONString(param)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | } else if (Cools.isEmpty(param.getTaskNo())){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "任务号为空,taskNo:"+JSON.toJSONString(param)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "任务号为空,taskNo:"+JSON.toJSONString(param)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | } else if (Cools.isEmpty(param.getIoType())){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "任务类型为空,ioType:"+JSON.toJSONString(param)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "任务类型为空,ioType:"+JSON.toJSONString(param)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if (Cools.isEmpty(param.getStartPoint()) || Cools.isEmpty(param.getTargetPoint())){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "初始目标或者目标位为空,Point:"+JSON.toJSONString(param)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "初始目标或者目标位为空,Point:"+JSON.toJSONString(param)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if(Cools.isEmpty(locMast)){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "初始库位无法找到,locNo:"+JSON.toJSONString(locNo)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "初始库位无法找到,locNo:"+JSON.toJSONString(locNo)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if(Cools.isEmpty(staDesc)){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "入库路劲不存在,param:"+JSON.toJSONString(param)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "入库路劲不存在,param:"+JSON.toJSONString(param)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if(Cools.isEmpty(staDesc)){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "出库路劲不存在,param:"+JSON.toJSONString(param)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "出库路劲不存在,param:"+JSON.toJSONString(param)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if(Cools.isEmpty(locMast2)){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "目标库位无法找到,locNo:"+JSON.toJSONString(param.getTargetPoint())); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "目标库位无法找到,locNo:"+JSON.toJSONString(param.getTargetPoint())); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if (!locMast2.getCrnNo().equals(locMast.getCrnNo())){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "起始库位与目标库位不再同一巷道,param:"+JSON.toJSONString(param)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "起始库位与目标库位不再同一巷道,param:"+JSON.toJSONString(param)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | } |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | | return taskWrk; |
| | | } |
| | |
| | | if (taskWrk != null) { |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "任务已存在,请勿重复提交,taskWrk:"+JSON.toJSONString(taskWrk)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "任务已存在,请勿重复提交,taskWrk:"+JSON.toJSONString(taskWrk)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if (param.getIoType().equals(0)){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "生成任务失败,任务类型不存在!,iotype:"+JSON.toJSONString(param.getIoType())); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "生成任务失败,任务类型不存在!,iotype:"+JSON.toJSONString(param.getIoType())); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | if (!taskWrkService.insert(taskWrk)) { |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("wmsErr", 1, "创建任务失败!,param:"+JSON.toJSONString(param)); |
| | | deviceErrorService.addDeviceError("wms下发任务异常", 1, "创建任务失败!,param:"+JSON.toJSONString(param)); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | |
| | | deviceErrorService.addDeviceError("crnWrite", slave.getId(), "巷道号"+command.getLaneNo()+";堆垛机指令下发:"+JSON.toJSONString(command.getNowTask())); |
| | | } catch (Exception e2){ |
| | | } |
| | | try{ |
| | | BasErrLogService basErrLogService = SpringUtils.getBean(BasErrLogService.class); |
| | | BasErrLog basErrLog = new BasErrLog(command,"","任务下发记录"); |
| | | if (!basErrLogService.insert(basErrLog)) { |
| | | log.error("堆垛机plc异常记录失败 ===>> [id:{}] [error:{}]", slave.getId(), "任务下发记录失败"); |
| | | } |
| | | } catch (Exception e3){ |
| | | } |
| | | // try{ |
| | | // BasErrLogService basErrLogService = SpringUtils.getBean(BasErrLogService.class); |
| | | // BasErrLog basErrLog = new BasErrLog(command,"","任务下发记录"); |
| | | // if (!basErrLogService.insert(basErrLog)) { |
| | | // log.error("堆垛机plc异常记录失败 ===>> [id:{}] [error:{}]", slave.getId(), "任务下发记录失败"); |
| | | // } |
| | | // } catch (Exception e3){ |
| | | // } |
| | | // convertRow(command); |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[10]; |
| | |
| | | array[6] = command.getDestinationPosX(); |
| | | array[7] = command.getDestinationPosY(); |
| | | array[8] = command.getDestinationPosZ(); |
| | | array[9] = command.getCommand(); |
| | | // array[9] = command.getCommand(); |
| | | array[9] = (short)0; |
| | | OperateResult result18 = siemensNet.Write("DB100.18", (short)0); |
| | | try{ |
| | | Thread.sleep(50L); |
| | |
| | | try{ |
| | | Thread.sleep(100L); |
| | | } catch (Exception e){} |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB101.0", (short) 4); |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20); |
| | | if (resultRead.IsSuccess) { |
| | | CrnCommand one = new CrnCommand(); |
| | | one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2)); |
| | | one.setTaskMode(siemensNet.getByteTransform().TransInt16(resultRead.Content, 4)); |
| | | one.setSourcePosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 6)); |
| | | one.setSourcePosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 8)); |
| | | one.setSourcePosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 10)); |
| | | one.setDestinationPosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 12)); |
| | | one.setDestinationPosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 14)); |
| | | one.setDestinationPosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 16)); |
| | | if (!command.getTaskNo().equals(one.getTaskNo()) |
| | | || !command.getTaskMode().equals(one.getTaskMode()) |
| | | || !command.getSourcePosX().equals(one.getSourcePosX()) |
| | | || !command.getSourcePosY().equals(one.getSourcePosY()) |
| | | || !command.getSourcePosZ().equals(one.getSourcePosZ()) |
| | | || !command.getDestinationPosX().equals(one.getDestinationPosX()) |
| | | || !command.getDestinationPosY().equals(one.getDestinationPosY()) |
| | | || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) |
| | | ){ |
| | | i++; |
| | | CrnErrCache.updateCrnErr(slave.getId(), "堆垛机命令地址写入后回读失败"); |
| | |
| | | |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("crnErr", slave.getId(), "巷道号"+command.getLaneNo()+";写入次数"+i+";堆垛机命令地址写入后回读失败:"+JSON.toJSONString(command.getNowTask())); |
| | | deviceErrorService.addDeviceError("CrnErr", slave.getId(), "巷道号"+command.getLaneNo()+";写入次数"+i+";堆垛机命令地址写入后回读失败:"+JSON.toJSONString(command.getNowTask())); |
| | | } catch (Exception e2){ |
| | | } |
| | | try{ |
| | |
| | | CrnErrCache.updateCrnErr(slave.getId(), "下发DB100.18 回读失败"); |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("crnErr", slave.getId(), "巷道号"+command.getLaneNo()+";写入次数"+signFinish+";下发DB100.18 回读失败:"+JSON.toJSONString(command.getNowTask())); |
| | | deviceErrorService.addDeviceError("CrnErr", slave.getId(), "巷道号"+command.getLaneNo()+";写入次数"+signFinish+";下发DB100.18 回读失败:"+JSON.toJSONString(command.getNowTask())); |
| | | } catch (Exception e2){ |
| | | } |
| | | try{ |