zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/MainProcess.java
@@ -54,7 +54,7 @@ // 解析小车移动工作档 mainService.analyzeMoveTask(); // 出库 ===>> 工作档信息写入led显示器 // mainService.ledExecute(); mainService.ledExecute(); // 其他 ===>> LED显示器复位,显示默认信息 mainService.ledReset(); // 穿梭车 ===>> 小车电量检测充电 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -930,7 +930,7 @@ .eq(BasLed::getDeviceId, ledDevice.getId())); List<Integer> staArr = JSON.parseArray(led.getSta(), Integer.class); BasConveyor basConveyor = basConveyorService.getById(new LambdaQueryWrapper<BasConveyor>() BasConveyor basConveyor = basConveyorService.getOne(new LambdaQueryWrapper<BasConveyor>() .eq(BasConveyor::getDeviceId, led.getConveyorId().intValue())); if (basConveyor == null) { continue; @@ -945,27 +945,24 @@ for (Integer staNo : staArr) { // 获取叉车站点 StaProtocol staProtocol = devpThread.getStation().get(staNo); if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) { if (null == staProtocol || null == staProtocol.getWorkNo()) { continue; } else { staProtocol = staProtocol.clone(); } if (!staProtocol.isOutEnable()){ continue; } String taskNo = "0"; if (0 != staProtocol.getWorkNo()){ Motion motion = motionService.getOne(new LambdaQueryWrapper<Motion>().eq(Motion::getMotionCtg, 9).eq(Motion::getTemp, staProtocol.getWorkNo())); // 获取工作档数据 Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskNo, staProtocol.getWorkNo())); Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskNo, motion.getTaskNo())); if (null == task) { continue; } tasks.add(task); // 组装命令 LedCommand ledCommand = new LedCommand(); ledCommand.setWorkNo(task.getTaskNo()); ledCommand.setIoType(task.getTaskCtg().intValue()); ledCommand.setTitle(task.getTaskCtg$()); ledCommand.setSourceLocNo(task.getOriginLoc()); ledCommand.setLocNo(task.getDestLoc()); ledCommand.setStaNo(Integer.parseInt(task.getDestSite())); taskNo = task.getWmsTaskNo(); } try { //获取WMS地址 Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "WMS_URL").eq(Dict::getStatus, 1)); @@ -973,32 +970,23 @@ String wmsUrl = dict.getValue(); HashMap<String, Object> param = new HashMap<>(); param.put("taskNo", task.getTaskNo()); param.put("taskNo", taskNo); param.put("sta",staNo); String response = new HttpHandler.Builder() .setUri(wmsUrl) .setPath("/queryTask") .setPath("/rpc/led/getTask") .setJson(JSON.toJSONString(param)) .build() .doPost(); JSONObject jsonObject = JSON.parseObject(response); Integer code = jsonObject.getInteger("code"); if (code.equals(200)) { List<MatDto> matDtos = JSON.parseArray(jsonObject.getString("data"), MatDto.class); ledCommand.setMatDtos(matDtos); } } } catch (Exception e) { e.printStackTrace(); } commands.add(ledCommand); } // 获取LED线程 LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, ledDevice.getId().intValue()); // 命令下发 ------------------------------------------------------------------------------- if (!commands.isEmpty()) { ledThread.write(commands); ledThread.setLedMk(false); } } } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/TaskTimer.java
@@ -35,6 +35,8 @@ private LocService locService; @Autowired private DictService dictService; @Autowired private BasConveyorStaService basConveyorStaService; @Scheduled(cron = "0/1 * * * * ? ") @Transactional @@ -79,6 +81,11 @@ .eq(Task::getStatus, 1) .in(Task::getTaskSts, taskSts)); for (Task task : tasks) { Motion motion = motionService.getOne(new LambdaQueryWrapper<Motion>().eq(Motion::getMotionCtg, 9).eq(Motion::getTaskNo, task.getTaskNo())); List<BasConveyorSta> conveyorStas = basConveyorStaService.list(new LambdaQueryWrapper<BasConveyorSta>().in(BasConveyorSta::getTaskNo, motion.getTemp())); if (!conveyorStas.isEmpty()) { continue; } if (reportWms != null && reportWms.getValue().equals("true")) { //获取WMS地址 Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "WMS_URL").eq(Dict::getStatus, 1)); zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/JxgtDevpThread.java
@@ -269,20 +269,39 @@ OperateResult write1 = null; // 工作号 OperateResult write2 = null; // 目标站 // write1 = siemensS7Net.Write(workNoAddress, workNo); // 工作号 // write2 = siemensS7Net.Write(staNoAddress, staNo); // 目标站 //任务下发次数 int writeCount = 0; do { write1 = siemensS7Net.Write(workNoAddress, (int) workNo); // 工作号 write2 = siemensS7Net.Write(staNoAddress, (int) staNo); // 目标站 write2 = siemensS7Net.Write(staNoAddress, (int) staNo); if ((write1.IsSuccess && write2.IsSuccess)) { log.info("写入输送线命令后返回成功,并且回读成功。输送线plc编号={},{},{}", siteId, JSON.toJSON(workNo), JSON.toJSON(staNo)); OperateResultExOne<byte[]> readResult = siemensS7Net.Read(staNoAddress, (short) 8); if (readResult.IsSuccess) { int staNo2 = siemensS7Net.getByteTransform().TransInt32(readResult.Content, 0); int workNo2 = siemensS7Net.getByteTransform().TransInt32(readResult.Content, 4); if (workNo == workNo2 && staNo == staNo2) { //任务命令写入成功 log.info("写入输送线命令后返回成功,并且回读成功。输送线plc编号={},{},{},写入次数={}", siteId, JSON.toJSON(workNo), JSON.toJSON(staNo), writeCount); return true; } else {//返回结果是成功了,但是真实值不相同 writeCount++; log.error("写入输送线命令后返回成功,但是读取任务值不一致。输送线plc编号={},{},{},写入次数={}", siteId, JSON.toJSON(workNo), JSON.toJSON(staNo), writeCount); } }else { writeCount++; log.error("写入输送线命令后读取失败。输送线plc编号={},站点数据={},{},写入次数={}", siteId, JSON.toJSON(workNo), JSON.toJSON(staNo), writeCount); } }else { writeCount++; } }while (writeCount < 5) ; // StaProtocol staProtocol = station.get(siteId); // if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) { // staProtocol.setPakMk(true); // } OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线站点数据失败。输送线plc编号={1},站点数据={2}", device.getId(), JSON.toJSON(array))); log.error("写入输送线站点数据失败。输送线plc编号={},站点数据={}", device.getId(), JSON.toJSON(array)); return false; } } @Override