| | |
| | | crnCommand.setCommand((short) 0); // 任务完成确认位 |
| | | // 延时发送 |
| | | Thread.sleep(1000L); |
| | | if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(5, crnCommand), false)) { |
| | | if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(5, crnCommand))) { |
| | | return R.ok(); |
| | | } else { |
| | | throw new CoolException("命令下发失败"); |
| | |
| | | } |
| | | // 空闲判断 |
| | | // if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) { |
| | | if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(4, command), false)) { |
| | | if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(4, command))) { |
| | | return true; |
| | | } else { |
| | | throw new CoolException("命令下发失败"); |
| | |
| | | } |
| | | // 空闲判断 |
| | | // if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) { |
| | | if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(2, command), false)) { |
| | | if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, command))) { |
| | | return true; |
| | | } else { |
| | | throw new CoolException("命令下发失败"); |
| | |
| | | staProtocol.setWorkNo(0); |
| | | staProtocol.setStaNo(0); |
| | | basDevpService.updateById(basDevp); |
| | | boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); |
| | | if (result) { |
| | | return R.ok(); |
| | | } else { |
| | |
| | | } |
| | | staProtocol.setWorkNo( 9999); |
| | | staProtocol.setStaNo(inSta.getStaNo()); |
| | | boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); |
| | | if (result) { |
| | | return R.ok(); |
| | | } else { |
| | |
| | | */ |
| | | public enum WorkNoType { |
| | | |
| | | PAKIN(0), |
| | | PICK(1), |
| | | PAKIN(1), |
| | | PICK(3), |
| | | PAKOUT(2), |
| | | OTHER(3), |
| | | OTHER(4), |
| | | ; |
| | | |
| | | public Integer type; |
| | |
| | | crnCommand.setDestinationPosY(Utils.getBayShort(taskWrk.getTargetPoint())); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint())); // 目标库位层 |
| | | crnCommand.setCommand((short) 1); |
| | | if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand), false)) { |
| | | if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | | // 修改工作档状态 11.生成出库ID => 12.吊车出库中 |
| | |
| | | } |
| | | |
| | | // 状态:等待确认 并且 任务完成位 = 1 |
| | | if (!Cools.isEmpty(crnProtocol.getTaskFinish()) && crnProtocol.getTaskFinish() == 0 && crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.getTaskNo() != 0) { |
| | | if (crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.getTaskNo() != 0) { |
| | | //获取入库待确认工作档 |
| | | TaskWrk taskWrk = taskWrkMapper.selectCrnNoInWorking(crnProtocol.getLaneNo(), crnProtocol.getTaskNo().intValue()); |
| | | if (Cools.isEmpty(taskWrk) && crnProtocol.getTaskNo() != 999) { |
| | | log.error("堆垛机处于等待确认且任务完成状态,但未找到工作档。堆垛机号={},巷道号={},工作号={}", crn.getId(), crnProtocol.getLaneNo(), crnProtocol.getTaskNo()); |
| | | continue; |
| | | } |
| | | Thread.sleep(300); |
| | | // Thread.sleep(300); |
| | | //确认完成信号 |
| | | CrnOperatorParam crnOperatorParam = new CrnOperatorParam(); |
| | | crnOperatorParam.setCrnNo(crn.getId()); |
| | |
| | | taskWrk = new TaskWrk(); |
| | | int workNo1 = 0;//获取入库工作号 |
| | | if (param.getIoType() .equals(1)){ |
| | | workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type); |
| | | } else if (param.getIoType() .equals(2)){ |
| | | workNo1 = commonService.getWorkNo(WorkNoType.PAKOUT.type); |
| | | } else { |
| | | workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type); |
| | | workNo1 = commonService.getWorkNo(WorkNoType.PICK.type); |
| | | } |
| | | taskWrk.setTaskNo(param.getTaskNo());//任务号 |
| | | taskWrk.setWrkNo(workNo1); |
| | |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.CrnTaskModeType; |
| | | import com.zy.core.enums.SlaveType; |
| | |
| | | crnCommand.setDestinationPosY(Utils.getBayShort(taskWrk.getTargetPoint())); // 目标库位层 |
| | | crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint())); // 目标库位排 |
| | | crnCommand.setCommand((short)1); |
| | | if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand),false)) { |
| | | if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) { |
| | | log.error("堆垛机命令生成失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | throw new CoolException("堆垛机命令生成失败"); |
| | | }else{ |
| | |
| | | crnCommand.setDestinationPosY(crnStn.getLev().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(crnStn.getRow().shortValue()); // 目标库位层 |
| | | crnCommand.setCommand((short)1); |
| | | if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) { |
| | | if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) { |
| | | log.error("堆垛机命令生成失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | throw new CoolException("堆垛机命令生成失败"); |
| | | } |
| | |
| | | StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()).clone(); |
| | | staProtocol.setWorkNo(taskWrk.getWrkNo()); |
| | | staProtocol.setStaNo(Integer.parseInt(taskWrk.getTargetPoint())); |
| | | if (!CommandUtils.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(3, staProtocol))) { |
| | | if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(3, staProtocol))) { |
| | | log.error("输送线命令生成失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | throw new CoolException("输送线命令生成失败"); |
| | | } |
| | |
| | | screen.turnOn(); |
| | | } catch (Exception ignore) { |
| | | } |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | if (connRes) { |
| | | log.info("led连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | deviceErrorService.deleteDeviceError("led", slave.getId()); |
| | | } else { |
| | | log.error("led连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | deviceErrorService.addDeviceError("led", slave.getId(), "led连接失败"); |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | if (connRes) { |
| | | log.info("led连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | deviceErrorService.deleteDeviceError("led", slave.getId()); |
| | | } else { |
| | | log.error("led连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | deviceErrorService.addDeviceError("led", slave.getId(), "led连接失败"); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("e:"+e.getMessage()); |
| | | } |
| | | |
| | | return connRes; |
| | | } |
| | | |
| | |
| | | dataOutputStream = new DataOutputStream(socket.getOutputStream()); |
| | | dataInputStream = new DataInputStream(socket.getInputStream()); |
| | | // log.info("条码扫描仪连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | // DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | // deviceErrorService.deleteDeviceError("scale", slave.getId()); |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.deleteDeviceError("devp", slave.getId()); |
| | | } catch (Exception e){ |
| | | log.error("e:"+e.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | socket = null; |
| | | log.error("磅秤连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | // DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | // deviceErrorService.addDeviceError("scale", slave.getId(), "磅秤连接失败"); |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.deleteDeviceError("devp", slave.getId()); |
| | | } catch (Exception e1){ |
| | | log.error("e:"+e1.getMessage()); |
| | | } |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | } |
| | | |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | try{ |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("e:"+e.getMessage()); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】更新数据库数据失败 ===>> [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("更新数据库数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | } |
| | | |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.deleteDeviceError("devp", slave.getId()); |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.deleteDeviceError("devp", slave.getId()); |
| | | } catch (Exception e){ |
| | | log.error("e:"+e.getMessage()); |
| | | } |
| | | } else { |
| | | OutputQueue.DEVP.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()); |
| | |
| | | <div style="width: 100%;"> |
| | | <el-table ref="singleTable" :data="tableData" highlight-current-row @row-click="handleRowClick" |
| | | max-height="450" style="width: 100%"> |
| | | <el-table-column property="devNo" label="站号"> |
| | | <el-table-column property="devNo" label="小车号"> |
| | | </el-table-column> |
| | | <el-table-column property="workNo" label="工作号"> |
| | | </el-table-column> |