From 3b9843bbd6d5ca015d9501c33ae5252ac4296e50 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Mon, 20 Jul 2026 19:04:28 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E6=8B=BC=E5=8D=95=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/impl/XianGongAgvServiceImpl.java | 3 +- .../HongXiangConveyorDeviceDriver.java | 44 ++++++++++++++++++- .../ManipulatorAgvStationDeviceDriver.java | 12 +++-- .../slit_two_manipulator/ItemProtocol.java | 6 +++ .../SlitTwoManipulatorDeviceDriver.java | 25 +++++++++++ .../service/impl/InstructionServiceImpl.java | 22 ++++++---- .../src/main/resources/config/application.yml | 8 ++-- 7 files changed, 102 insertions(+), 18 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index a5b9db269..bf5e7b118 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -1083,7 +1083,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { private void updataTask(Instruction instructionDto, String newPoint) { - TaskDto taskUpdate = new TaskDto(); + //TaskDto taskUpdate = new TaskDto(); + TaskDto taskUpdate = taskserver.findByCodeFromCache(instructionDto.getTask_code()); if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { instructionDto.setStart_point_code(newPoint); taskUpdate.setStart_point_code(newPoint); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_device/HongXiangConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_device/HongXiangConveyorDeviceDriver.java index 8a6b07d20..b227929f0 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_device/HongXiangConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_device/HongXiangConveyorDeviceDriver.java @@ -2,7 +2,9 @@ package org.nl.acs.device_driver.two_conveyor.hongxiang_device; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -14,6 +16,8 @@ import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest; +import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; @@ -25,6 +29,8 @@ import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.storage_cell.domain.StorageCell; +import org.nl.acs.storage_cell.service.StorageCellService; import org.nl.acs.task.service.TaskService; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; @@ -64,6 +70,9 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple @Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + @Autowired + private StorageCellService storageCellService = SpringContextHolder.getBean(StorageCellService.class); + private String error_type = "hx_error_type"; private Date instruction_require_time = new Date(); @@ -211,7 +220,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple if (finish == 1 && !requireSucess) { //烘箱完成反馈LMS -// apply_finish(); + apply_finish(); } } @@ -237,6 +246,39 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple last_currentC = currentC; } + public synchronized boolean apply_finish() { + Date date = new Date(); + if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_apply_time = date; + message = "烘箱完成反馈LMS..."; + ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = new ApplyLabelingAndBindingRequest(); + //JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0); + StorageCell storageCell = storageCellService.getOne(new LambdaQueryWrapper() + .eq(StorageCell::getStorage_code, this.device_code)); + String start_point_code = null; + if (!ObjectUtil.isEmpty(storageCell)) { + //start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code"); + start_point_code = storageCell.getParent_storage_code() == null ? this.device_code : storageCell.getParent_storage_code(); + } + applyLabelingAndBindingRequest.setDevice_code(start_point_code); + applyLabelingAndBindingRequest.setType("3"); + ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); + logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成,请求参数:" + JSON.toJSONString(applyLabelingAndBindingRequest)); + if (applyLabelingAndBindingResponse.getstatus() == 200) { + requireSucess = true; + message = "烘箱完成反馈LMS成功..."; + logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成请求成功,响应参数:" + JSON.toJSONString(applyLabelingAndBindingResponse)); + } else { + requireSucess = true; + message = "烘箱完成反馈LMS失败," + String.valueOf(applyLabelingAndBindingResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成请求失败,响应参数:" + JSON.toJSONString(applyLabelingAndBindingResponse)); + } + return true; + } + } protected void thingToNothing() { //this.setRequireSucess(false); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java index fe3a2ad84..b8385ffb7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java @@ -119,9 +119,9 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i iserror = this.itemProtocol.isError; - if (mode != last_mode) { - this.setRequireSucess(false); - } +// if (mode != last_mode) { +// this.setRequireSucess(false); +// } } catch (Exception var17) { this.message = "universal_message14"; LuceneLogDto logDto = LuceneLogDto.builder() @@ -130,6 +130,12 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(device_code) + .content(this.device_code + "逻辑异常消息:" + var17.getMessage()) + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); } if (!this.itemProtocol.getIsonline()) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/ItemProtocol.java index 0fa3a318f..06646f343 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/ItemProtocol.java @@ -60,6 +60,10 @@ public class ItemProtocol { public static String item_to_empty_shaft_site = "to_empty_shaft_site"; //下发任务类型 public static String item_to_type = "to_type"; + //下发分支任务1轴类型 + public static String item_to_Task1_Axis_Type = "to_Task1_Axis_Type"; + //下发分支任务2轴类型 + public static String item_to_Task2_Axis_Type = "to_Task2_Axis_Type"; private SlitTwoManipulatorDeviceDriver driver; @@ -185,6 +189,8 @@ public class ItemProtocol { list.add(new ItemDto(item_to_target2, "下发目标站2", "DB16.W14")); list.add(new ItemDto(item_to_empty_shaft_site, "下发空轴位", "DB16.W16")); list.add(new ItemDto(item_to_type, "下发任务类型", "DB16.W20")); + list.add(new ItemDto(item_to_Task1_Axis_Type, "下发分支任务1轴类型", "DB16.W24")); + list.add(new ItemDto(item_to_Task2_Axis_Type, "下发分支任务2轴类型", "DB16.W28")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 5db7c8b23..cbf4ea8df 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -493,6 +493,19 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl map.put("to_type", taskDto.getTruss_type()); map.put("to_empty_shaft_site", taskDto.getEmpty_site()); + String interactionJson = taskDto.getInteraction_json(); + if (StrUtil.isNotEmpty(interactionJson)){ + JSONObject jsonObject = JSONObject.parseObject(interactionJson); + String to_Task1_Axis_Type = jsonObject.getString("to_Task1_Axis_Type"); + if (StrUtil.isNotEmpty(to_Task1_Axis_Type)){ + map.put("to_Task1_Axis_Type",to_Task1_Axis_Type); + } + String to_Task2_Axis_Type = jsonObject.getString("to_Task2_Axis_Type"); + if (StrUtil.isNotEmpty(to_Task2_Axis_Type)){ + map.put("to_Task2_Axis_Type",to_Task2_Axis_Type); + } + } + if (StrUtil.isNotEmpty(start_device_code2)) { Device startDevice2 = deviceAppservice.findDeviceByCode(start_device_code2); Device nextDevice2 = deviceAppservice.findDeviceByCode(next_device_code2); @@ -595,6 +608,18 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl map.put("to_onset2", start_addr2); map.put("to_target2", next_addr2); } + String interactionJson = taskDto.getInteraction_json(); + if (StrUtil.isNotEmpty(interactionJson)){ + JSONObject jsonObject = JSONObject.parseObject(interactionJson); + String to_Task1_Axis_Type = jsonObject.getString("to_Task1_Axis_Type"); + if (StrUtil.isNotEmpty(to_Task1_Axis_Type)){ + map.put("to_Task1_Axis_Type",to_Task1_Axis_Type); + } + String to_Task2_Axis_Type = jsonObject.getString("to_Task2_Axis_Type"); + if (StrUtil.isNotEmpty(to_Task2_Axis_Type)){ + map.put("to_Task2_Axis_Type",to_Task2_Axis_Type); + } + } try { instructionService.create(instdto); } catch (Exception e) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index b6f6acec0..c004cfe9c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -1075,11 +1075,14 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) +// .eq(Task::getTask_id, insttaskid) +// .one(); + + TaskDto task = taskService.findByCodeFromCache(dto.getTask_code()); - Task task = new LambdaQueryChainWrapper<>(taskMapper) - .eq(Task::getTask_id, insttaskid) - .one(); // =0 则不用再次请求 if (StrUtil.equals(task.getRequest_again(), "0")) { if (StrUtil.equals(task.getTask_type(), "8")) { @@ -1133,10 +1136,11 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) - .eq(Task::getTask_id, dto.getTask_id()) - .one(); +// String device_code = dto.getNext_device_code(); +// Task acsTask = new LambdaQueryChainWrapper<>(taskMapper) +// .eq(Task::getTask_id, dto.getTask_id()) +// .one(); + TaskDto acsTask = taskService.findByCodeFromCache(dto.getTask_code()); RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class); List list = @@ -1191,7 +1195,7 @@ public class InstructionServiceImpl extends CommonServiceImpl