From 6ea2a98c1d9b021c3216d3df6a156f9811781c46 Mon Sep 17 00:00:00 2001 From: yanps Date: Fri, 26 Apr 2024 09:18:59 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E5=86=85=E5=8C=85=E9=97=B4=E8=81=94?= =?UTF-8?q?=E8=B0=83=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acs/device_driver/rgv/ItemProtocol.java | 21 +- .../device_driver/rgv/RgvDeviceDriver.java | 14 +- .../plug_pull_device_site/ItemProtocol.java | 34 +-- .../PlugPullDeviceSiteDeviceDriver.java | 52 ++--- .../PullHeadManipulatorDeviceDriver.java | 202 +++++++----------- .../pull_tail_manipulator/ItemProtocol.java | 13 +- .../PullTailManipulatorDeviceDriver.java | 29 ++- .../wms/data/ApplyPlugPullSiteRequest.java | 9 + .../ApplyfeedbackSubVolumeWeightRequest.java | 18 ++ .../ApplyfeedbackSubVolumeWeightResponse.java | 13 ++ .../acs/ext/wms/service/AcsToWmsService.java | 7 + .../wms/service/impl/AcsToWmsServiceImpl.java | 38 +++- 12 files changed, 268 insertions(+), 182 deletions(-) create mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyfeedbackSubVolumeWeightRequest.java create mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyfeedbackSubVolumeWeightResponse.java diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/ItemProtocol.java index 50ae39e21..43faa8f6b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.rgv; +import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -17,7 +18,7 @@ ItemProtocol { //工作模式 public static String item_mode = "mode"; //光电信号 - public static String item_move = "move"; + public static String item_move = "move1"; //动作信号 public static String item_action = "action"; //行走列 @@ -68,8 +69,8 @@ ItemProtocol { return this.getOpcIntegerValue(item_error); } - public int getBarcode() { - return this.getOpcIntegerValue(item_barcode); + public String getBarcode() { + return this.getOpcStringValue(item_barcode); } public int getTask() { @@ -90,8 +91,8 @@ ItemProtocol { } - public int getTo_sub_volume_no(){ - return this.getOpcIntegerValue(item_to_sub_volume_no); + public String getTo_sub_volume_no(){ + return this.getOpcStringValue(item_to_sub_volume_no); } Boolean isonline; @@ -108,6 +109,16 @@ ItemProtocol { return 0; } + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isBlank(value)) { + + } else { + return value; + } + return "0"; + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java index c36d88afb..afd5e9bc6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java @@ -93,8 +93,8 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr int task = 0; int last_task = 0; //气涨轴条码 - int barcode = 0; - int last_barcode = 0; + String barcode; + String last_barcode; int heartbeat = 0; @@ -109,8 +109,8 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr int last_to_task = 0; - int to_sub_volume_no = 0; - int last_to_sub_volume_no = 0; + String to_sub_volume_no; + String last_to_sub_volume_no; Boolean isonline = true; int hasGoods = 0; @@ -264,10 +264,14 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr if (applyManipulatorActionResponse.getCode() == 200) { Map data = applyManipulatorActionResponse.getData(); String point_code2 = data.get("point_code2");//目标站点 + Device deviceByCode = deviceAppService.findDeviceByCode(point_code2); + String address = deviceByCode.getExtraValue().get("address").toString(); String material_code = data.get("material_code");//子卷号 - map.put("to_target", point_code2); + String to_is_labeling = data.get("to_is_labeling");//是否贴标 + map.put("to_target", address); map.put("to_sub_volume_no", material_code); map.put("to_command", "1"); + map.put("to_is_labeling",StrUtil.isNotEmpty(to_is_labeling)?"0":"1"); this.writing(map); logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyManipulatorActionResponse); message = "申请行架任务成功"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java index 8c39cabf1..54f2b9f8c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java @@ -42,9 +42,9 @@ public class ItemProtocol { public static String item_to_command = "to_command"; //气涨轴类型 public static String item_to_qzz_type = "to_qzz_type"; - //套管纸管1规格 + //套管纸管1编码 public static String item_to_material1 = "to_material1"; - //套管纸管2规格 + //套管纸管2编码 public static String item_to_material2 = "to_material2"; //套管纸管数量 public static String item_to_qty1 = "to_qty1"; @@ -52,9 +52,9 @@ public class ItemProtocol { public static String item_to_size1 = "to_size1"; //套管纸管2尺寸 public static String item_to_size2 = "to_size2"; - //拔轴纸管1规格 + //拔轴纸管1编码 public static String item_to_material3 = "to_material3"; - //拔轴纸管2规格 + //拔轴纸管2编码 public static String item_to_material4 = "to_material4"; //拔轴纸管数量 public static String item_to_qty2 = "to_qty2"; @@ -62,6 +62,12 @@ public class ItemProtocol { public static String item_to_size3 = "to_size3"; //拔轴纸管2尺寸 public static String item_to_size4 = "to_size4"; + //套轴纸管1规格 + public static String item_to_spec1 = "to_spec1"; + public static String item_to_spec2 = "to_spec2"; + public static String item_to_spec3 = "to_spec3"; + public static String item_to_spec4 = "to_spec4"; + private PlugPullDeviceSiteDeviceDriver driver; @@ -95,11 +101,11 @@ public class ItemProtocol { public String getBarcode(){ return this.getOpcStringValue(item_barcode);} - public int getWeight1(){ return this.getOpcIntegerValue(item_weight1);} + public Float getWeight1(){ return this.getOpcFloatValue(item_weight1);} public String getMaterial1(){ return this.getOpcStringValue(item_material1);} - public int getWeight2(){ return this.getOpcIntegerValue(item_weight2);} + public Float getWeight2(){ return this.getOpcFloatValue(item_weight2);} public int getSize(){ return this.getOpcIntegerValue(item_size);} @@ -217,17 +223,21 @@ public class ItemProtocol { public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_to_command, "下发命令", "DB10.W0")); - list.add(new ItemDto(item_to_material1, "套管纸管1规格", "DB10.String602.60")); - list.add(new ItemDto(item_to_material2, "套管纸管2规格", "DB10.String656.60")); + list.add(new ItemDto(item_to_material1, "套管纸管1编码", "DB10.String602.60")); + list.add(new ItemDto(item_to_material2, "套管纸管2编码", "DB10.String656.60")); list.add(new ItemDto(item_to_qty1, "套管纸管数量", "DB10.W6")); list.add(new ItemDto(item_to_qzz_type, "气胀轴类型", "DB10.W8")); list.add(new ItemDto(item_to_size1, "套管纸管1尺寸", "DB10.W10")); list.add(new ItemDto(item_to_size2, "套管纸管2尺寸", "DB10.W12")); - list.add(new ItemDto(item_to_material1, "拔轴纸管1规格", "DB10.String602.60")); - list.add(new ItemDto(item_to_material2, "拔轴纸管2规格", "DB10.String656.60")); + list.add(new ItemDto(item_to_material1, "拔轴纸管1编码", "DB10.String602.60")); + list.add(new ItemDto(item_to_material2, "拔轴纸管2编码", "DB10.String656.60")); list.add(new ItemDto(item_to_qty2, "拔轴纸管数量", "DB10.W6")); - list.add(new ItemDto(item_to_size1, "拔轴纸管1尺寸", "DB10.W10")); - list.add(new ItemDto(item_to_size2, "下发纸管2尺寸", "DB10.W12")); + list.add(new ItemDto(item_to_size3, "拔轴纸管1尺寸", "DB10.W10")); + list.add(new ItemDto(item_to_size4, "拔轴纸管2尺寸", "DB10.W12")); + list.add(new ItemDto(item_to_spec1, "套轴纸管1规格", "DB10.W12")); + list.add(new ItemDto(item_to_spec2, "套轴纸管2规格", "DB10.W12")); + list.add(new ItemDto(item_to_spec3, "拔轴纸管1规格", "DB10.W12")); + list.add(new ItemDto(item_to_spec4, "拔轴纸管2规格", "DB10.W12")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java index 064997d96..eae811986 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java @@ -98,14 +98,14 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl String barcode = null; String lastBarcode = null; //纸管1重量 - int weight1 = 0; - int lastWeight1 = 0; + Float weight1 = 0.0F; + Float lastWeight1 = 0.0F; //纸管1规格 String material1 = null; String lastMaterial1 = null; //纸管2重量 - int weight2 = 0; - int lastWeight2 = 0; + Float weight2 = 0.0F; + Float lastWeight2 = 0.0F; //纸管2规格 String material2 = null; String lastMaterial2 = null; @@ -160,7 +160,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl */ int flag; - String deviceCode; + String device_code; String message = null; @@ -177,7 +177,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl @Override public void execute() throws Exception { - deviceCode = this.getDeviceCode(); + device_code = this.getDeviceCode(); mode = this.itemProtocol.getMode(); move = this.itemProtocol.getMove(); action = this.itemProtocol.getAction(); @@ -298,7 +298,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl private synchronized void apply_casing(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(deviceCode); + applyPlugPullSiteRequest.setDevice_code(device_code); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_ONE); //气涨轴尺寸 applyPlugPullSiteRequest.setSize(String.valueOf(size)); @@ -336,7 +336,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl map.put("to_qty1", number); this.writing(map); requireSucess = true; - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); message = "申请套管成功"; } else { message = applyPlugPullSitResponse.getMessage(); @@ -345,7 +345,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl this.writing(map); requireSucess = true; message = "申请套管失败"; - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); } } @@ -355,7 +355,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl private synchronized void bushingSucess(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(deviceCode); + applyPlugPullSiteRequest.setDevice_code(device_code); //上报规格和重量 applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1)); applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1)); @@ -365,7 +365,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { this.writeSignal(mode); - logServer.deviceExecuteLog(this.deviceCode, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); message = "套管完成成功"; } else { message = applyPlugPullSitResponse.getMessage(); @@ -374,7 +374,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl this.writing(map); requireSucess = true; message = "申请套管失败"; - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); } } @@ -385,7 +385,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl private synchronized void pullShaftSucess(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(deviceCode); + applyPlugPullSiteRequest.setDevice_code(device_code); applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode)); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); @@ -394,7 +394,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl map.put("to_command", mode); this.writing(map); requireSucess = true; - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); message = "拔轴完成成功"; } else { message = applyPlugPullSitResponse.getMessage(); @@ -403,7 +403,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl this.writing(map); requireSucess = true; message = "拔轴完成失败"; - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); } } @@ -413,8 +413,8 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl private synchronized void applyPullShaft(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(deviceCode); - applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode)); + applyPlugPullSiteRequest.setDevice_code(device_code); + applyPlugPullSiteRequest.setQzz_no(String.valueOf(barcode)); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { @@ -450,7 +450,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl map.put("to_command", mode); this.writing(map); requireSucess = true; - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); message = "申请拔轴成功"; } else { message = applyPlugPullSitResponse.getMessage(); @@ -459,7 +459,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl this.writing(map); requireSucess = true; message = "申请拔轴失败"; - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); } } @@ -469,7 +469,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl private synchronized void applyTask(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(deviceCode); + applyPlugPullSiteRequest.setDevice_code(device_code); applyPlugPullSiteRequest.setSize(String.valueOf(size)); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); @@ -477,14 +477,14 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl Map map = new LinkedHashMap<>(); map.put("to_command", mode); this.writing(map); - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); message = "生成行架任务成功"; requireSucess = true; } else { message = applyPlugPullSitResponse.getMessage(); requireSucess = true; message = "申请行架任务失败"; - logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); } } @@ -519,9 +519,9 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl itemMap.put(to_param, json.getString("value")); } } - logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号:" + itemMap); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(deviceCode) + .device_code(device_code) .content("下发多个电气信号" + itemMap) .build(); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -540,7 +540,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl this.checkcontrol(itemMap); logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(deviceCode) + .device_code(device_code) .content("下发多个电气信号" + itemMap) .build(); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -634,7 +634,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl // itemMap.put(to_param, Integer.parseInt(value)); this.control(itemMap); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(deviceCode) + .device_code(device_code) .content("下发多个电气信号" + itemMap) .build(); luceneExecuteLogService.deviceExecuteLog(logDto); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java index f266482b0..b88b6b359 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceExtraService; @@ -224,7 +225,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp try { TaskDto dto = taskserver.findByCode(inst.getTask_code()); Map map = new LinkedHashMap<>(); - if (ObjectUtil.isNotEmpty(dto)){ + /*if (ObjectUtil.isNotEmpty(dto)){ String interaction_json = dto.getInteraction_json(); if (ObjectUtil.isNotEmpty(interaction_json)){ JSONObject jsonObject = (JSONObject) JSONObject.toJSON(interaction_json); @@ -233,7 +234,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp map.put("to_size", jsonObject.getString("qzz_size")); map.put("to_barcode", jsonObject.getString("qzz_no")); } - } + }*/ map.put("to_command", "5"); this.writing(map); finish_instruction(inst); @@ -361,68 +362,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp String startAddr = startDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString(); String interaction_json = taskDto.getInteraction_json(); - JSONObject jsonObject = JSONObject.parseObject(interaction_json); - //套管1物料 - Object to_material1 = jsonObject.get("left"); - //套管2物料 - Object to_material2 = jsonObject.get("right"); - //套管1规格 - Object to_spec1 = jsonObject.get("leftSpec"); - //套管2规格 - Object to_spec2 = jsonObject.get("rightSpec"); - //套管1尺寸 - Object to_size1 = jsonObject.get("leftSize"); - //套管2尺寸 - Object to_size2 = jsonObject.get("rightSize"); - //拔管1物料 - Object to_material3 = jsonObject.get("currentLeft"); - //拔管2物料 - Object to_material4 = jsonObject.get("currentRight"); - //拔管1尺寸 - Object to_size3 = jsonObject.get("currentLeftSize"); - //拔管2尺寸 - Object to_size4 = jsonObject.get("currentRightSize"); - //拔管1规格 - Object to_spec3 = jsonObject.get("currentLeftSpec"); - //拔管2规格 - Object to_spec4 = jsonObject.get("currentRightSpec"); - - //套管数量 - Object to_qty1 = jsonObject.get("casingCount"); - //拔管数量 - Object to_qty2 = jsonObject.get("pullCount"); - Map map = new LinkedHashMap<>(); - map.put("to_command", CommonFinalParam.ONE); - map.put("to_onset", startAddr); - map.put("to_task", instruction.getInstruction_code()); - map.put("to_target", nextAddr); - //toTranscription(taskDto,map); - map.put("to_material1", to_material1); - if (ObjectUtil.isNotEmpty(to_material2)) { - map.put("to_material2", to_material2); - } - map.put("to_spec1", to_spec1); - if (ObjectUtil.isNotEmpty(to_spec2)) { - map.put("to_spec2", to_spec2); - } - map.put("to_size1", to_size1); - if (ObjectUtil.isNotEmpty(to_size2)) { - map.put("to_size2", to_size2); - } - map.put("to_material3", to_material3); - if (ObjectUtil.isNotEmpty(to_material4)) { - map.put("to_material4", to_material4); - } - map.put("to_size3", to_size3); - if (ObjectUtil.isNotEmpty(to_size4)) { - map.put("to_size4", to_size4); - } - map.put("to_spec3", to_spec3); - if (ObjectUtil.isNotEmpty(to_spec4)) { - map.put("to_spec4", to_spec4); - } - map.put("to_qty1", to_qty1); - map.put("to_qty2", to_qty2); + Map map = toStringObjectMap(instruction, startAddr, nextAddr, interaction_json); this.writing(map); this.setRequireSucess(true); return true; @@ -500,68 +440,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp String startAddr = startDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString(); String interaction_json = task.getInteraction_json(); - JSONObject jsonObject = JSONObject.parseObject(interaction_json); - //套管1物料 - Object to_material1 = jsonObject.get("left"); - //套管2物料 - Object to_material2 = jsonObject.get("right"); - //套管1规格 - Object to_spec1 = jsonObject.get("leftSpec"); - //套管2规格 - Object to_spec2 = jsonObject.get("rightSpec"); - //套管1尺寸 - Object to_size1 = jsonObject.get("leftSize"); - //套管2尺寸 - Object to_size2 = jsonObject.get("rightSize"); - //拔管1物料 - Object to_material3 = jsonObject.get("currentLeft"); - //拔管2物料 - Object to_material4 = jsonObject.get("currentRight"); - //拔管1尺寸 - Object to_size3 = jsonObject.get("currentLeftSize"); - //拔管2尺寸 - Object to_size4 = jsonObject.get("currentRightSize"); - //拔管1规格 - Object to_spec3 = jsonObject.get("currentLeftSpec"); - //拔管2规格 - Object to_spec4 = jsonObject.get("currentRightSpec"); - - //套管数量 - Object to_qty1 = jsonObject.get("casingCount"); - //拔管数量 - Object to_qty2 = jsonObject.get("pullCount"); - Map map = new LinkedHashMap<>(); - map.put("to_command", CommonFinalParam.ONE); - map.put("to_onset", startAddr); - map.put("to_task", instdto.getInstruction_code()); - map.put("to_target", nextAddr); - //toTranscription(taskDto,map); - map.put("to_material1", to_material1); - if (ObjectUtil.isNotEmpty(to_material2)) { - map.put("to_material2", to_material2); - } - map.put("to_spec1", to_spec1); - if (ObjectUtil.isNotEmpty(to_spec2)) { - map.put("to_spec2", to_spec2); - } - map.put("to_size1", to_size1); - if (ObjectUtil.isNotEmpty(to_size2)) { - map.put("to_size2", to_size2); - } - map.put("to_material3", to_material3); - if (ObjectUtil.isNotEmpty(to_material4)) { - map.put("to_material4", to_material4); - } - map.put("to_size3", to_size3); - if (ObjectUtil.isNotEmpty(to_size4)) { - map.put("to_size4", to_size4); - } - map.put("to_spec3", to_spec3); - if (ObjectUtil.isNotEmpty(to_spec4)) { - map.put("to_spec4", to_spec4); - } - map.put("to_qty1", to_qty1); - map.put("to_qty2", to_qty2); + Map map = toStringObjectMap(instdto, startAddr, nextAddr, interaction_json); this.writing(map); this.setRequireSucess(true); notCreateInstMessage = ""; @@ -573,6 +452,77 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } } + @NotNull + private Map toStringObjectMap(Instruction instdto, String startAddr, String nextAddr, String interaction_json) { + JSONObject jsonObject = JSONObject.parseObject(interaction_json); + //套管1物料 + Object to_material1 = jsonObject.get("left"); + //套管2物料 + Object to_material2 = jsonObject.get("right"); + //套管1规格 + Object to_spec1 = jsonObject.get("leftSpec"); + //套管2规格 + Object to_spec2 = jsonObject.get("rightSpec"); + //套管1尺寸 + Object to_size1 = jsonObject.get("leftSize"); + //套管2尺寸 + Object to_size2 = jsonObject.get("rightSize"); + //拔管1物料 + Object to_material3 = jsonObject.get("currentLeft"); + //拔管2物料 + Object to_material4 = jsonObject.get("currentRight"); + //拔管1尺寸 + Object to_size3 = jsonObject.get("currentLeftSize"); + //拔管2尺寸 + Object to_size4 = jsonObject.get("currentRightSize"); + //拔管1规格 + Object to_spec3 = jsonObject.get("currentLeftSpec"); + //拔管2规格 + Object to_spec4 = jsonObject.get("currentRightSpec"); + + //套管数量 + Object to_qty1 = jsonObject.get("casingCount"); + //拔管数量 + Object to_qty2 = jsonObject.get("pullCount"); + Map map = new LinkedHashMap<>(); + map.put("to_pull", jsonObject.getString("is_pulling")); + map.put("is_bushing", jsonObject.getString("is_bushing")); + map.put("to_size", jsonObject.getString("qzz_size")); + map.put("to_barcode", jsonObject.getString("qzz_no")); + map.put("to_command", CommonFinalParam.ONE); + map.put("to_onset", startAddr); + map.put("to_task", instdto.getInstruction_code()); + map.put("to_target", nextAddr); + //toTranscription(taskDto,map); + map.put("to_material1", to_material1); + if (ObjectUtil.isNotEmpty(to_material2)) { + map.put("to_material2", to_material2); + } + map.put("to_spec1", to_spec1); + if (ObjectUtil.isNotEmpty(to_spec2)) { + map.put("to_spec2", to_spec2); + } + map.put("to_size1", to_size1); + if (ObjectUtil.isNotEmpty(to_size2)) { + map.put("to_size2", to_size2); + } + map.put("to_material3", to_material3); + if (ObjectUtil.isNotEmpty(to_material4)) { + map.put("to_material4", to_material4); + } + map.put("to_size3", to_size3); + if (ObjectUtil.isNotEmpty(to_size4)) { + map.put("to_size4", to_size4); + } + map.put("to_spec3", to_spec3); + if (ObjectUtil.isNotEmpty(to_spec4)) { + map.put("to_spec4", to_spec4); + } + map.put("to_qty1", to_qty1); + map.put("to_qty2", to_qty2); + return map; + } + private void toTranscription(TaskDto taskDto,Map map){ String interactionJson = taskDto.getInteraction_json(); InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/ItemProtocol.java index 9ded71d24..020d30dbe 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/ItemProtocol.java @@ -27,11 +27,15 @@ public class ItemProtocol { //报警 public static String item_error = "error"; //x轴坐标 - public static String item_x_position = "x_position"; + public static String item_x_position = "x"; //y轴坐标 - public static String item_y_position = "y_position"; + public static String item_y_position = "y"; //重量 public static String item_weight = "weight"; + /** + * 子卷号 + */ + public static String item_sub_volume_no = "sub_volume_no"; //下发命令 public static String item_to_command = "to_command"; @@ -60,6 +64,10 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_move); } + public String getSub_volume_no() { + return this.getOpcStringValue(item_sub_volume_no); + } + public int getAction() { return this.getOpcIntegerValue(item_action); } @@ -156,6 +164,7 @@ public class ItemProtocol { list.add(new ItemDto(item_walk_y, "行走列", "DB13.B4")); list.add(new ItemDto(item_error, "报警信号", "DB13.B5")); list.add(new ItemDto(item_task, "任务号", "DB13.D6")); + list.add(new ItemDto(item_sub_volume_no, "子卷号", "DB13.D6")); list.add(new ItemDto(item_x_position, "x坐标", "DB13.REAL10")); list.add(new ItemDto(item_y_position, "y坐标", "DB13.REAL14")); list.add(new ItemDto(item_weight, "重量", "DB13.REAL16")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java index 63ecfe979..a85f2f027 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java @@ -19,6 +19,12 @@ 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.device_driver.one_manipulator.box_storage_manipulator.InteractionJsonDTO; +import org.nl.acs.ext.wms.data.ApplyPlugPullSitResponse; +import org.nl.acs.ext.wms.data.ApplyPlugPullSiteRequest; +import org.nl.acs.ext.wms.data.ApplyfeedbackSubVolumeWeightRequest; +import org.nl.acs.ext.wms.data.ApplyfeedbackSubVolumeWeightResponse; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; @@ -69,6 +75,8 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); @Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); //工作模式 int mode = 0; @@ -99,6 +107,8 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp float weight = 0; float last_weight = 0; + String sub_volume_no; + int heartbeat = 0; int last_heartbeat = 0; int to_command = 0; @@ -165,6 +175,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp move = this.itemProtocol.getMove(); action = this.itemProtocol.getAction(); walk_y = this.itemProtocol.getWalk_y(); + sub_volume_no = this.itemProtocol.getSub_volume_no(); error = this.itemProtocol.getError(); task = this.itemProtocol.getTask(); heartbeat = this.itemProtocol.getHeartbeat(); @@ -203,16 +214,24 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } //反馈重量 - if (mode == 3 && action == 5 && move == 0 && task > 0 && !requireSucess) { - Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); - if (ObjectUtil.isNotEmpty(inst2)) { + if (mode == 3 && action == 5 && move == 0 && StrUtil.isNotEmpty(sub_volume_no) && !requireSucess) { + ApplyfeedbackSubVolumeWeightRequest applyfeedbackSubVolumeWeightRequest = new ApplyfeedbackSubVolumeWeightRequest(); + ApplyfeedbackSubVolumeWeightResponse applyPlugPullSitResponse; + applyfeedbackSubVolumeWeightRequest.setSub_volume(sub_volume_no); + applyfeedbackSubVolumeWeightRequest.setWeight1(String.valueOf(weight)); + applyPlugPullSitResponse = acsToWmsService.applyfeedbackSubVolumeWeight(applyfeedbackSubVolumeWeightRequest); + if(applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN){ Map map = new LinkedHashMap<>(); //todo:反馈重量 map.put("to_command", "5"); this.writing(map); this.requireSucess = true; - } else { - logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许取货(now_steps_type!=3)"); + }else{ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("反馈LMS子卷重量失败:"+ applyPlugPullSitResponse.getMessage()) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { feedMessage = "行架机械手:"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyPlugPullSiteRequest.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyPlugPullSiteRequest.java index 7dd89696e..0ee36fc0b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyPlugPullSiteRequest.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyPlugPullSiteRequest.java @@ -50,4 +50,13 @@ public class ApplyPlugPullSiteRequest extends BaseRequest { * 尺寸 3,6寸 */ private String size; + /** + * 气胀轴条码 + */ + private String qzz_no; + /** + * 子卷号 + */ + private String sub_volume; + } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyfeedbackSubVolumeWeightRequest.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyfeedbackSubVolumeWeightRequest.java new file mode 100644 index 000000000..5d7568911 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyfeedbackSubVolumeWeightRequest.java @@ -0,0 +1,18 @@ +package org.nl.acs.ext.wms.data; + +import lombok.Data; + +@Data +public class ApplyfeedbackSubVolumeWeightRequest { + + /** + * 子卷号 + */ + private String sub_volume; + + /** + * 子卷重量 + */ + private String weight1; + +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyfeedbackSubVolumeWeightResponse.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyfeedbackSubVolumeWeightResponse.java new file mode 100644 index 000000000..c4ea3a967 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyfeedbackSubVolumeWeightResponse.java @@ -0,0 +1,13 @@ +package org.nl.acs.ext.wms.data; + +import lombok.Data; + +import java.util.HashMap; +import java.util.Map; + +@Data +public class ApplyfeedbackSubVolumeWeightResponse extends BaseResponse { + + private Map data = new HashMap(); + +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index 13097c791..f4d083aa8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -164,6 +164,13 @@ public interface AcsToWmsService { */ ApplyPlugPullSitResponse applyPlugPullSiteRequest(ApplyPlugPullSiteRequest param); + /** + * 向LMS反馈子卷重量 + * @param param + * @return + */ + ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeight(ApplyfeedbackSubVolumeWeightRequest param); + /** * 查询站点有无货状态 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index be040d076..d820d2429 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -485,6 +485,42 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } + @Override + public ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeight(ApplyfeedbackSubVolumeWeightRequest param) { + log.info("向LMS申请反馈,请求参数{}",param); + try { + MDC.put(log_file_type, log_type); + ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeightResponse = new ApplyfeedbackSubVolumeWeightResponse(); + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("applyfeedbackSubVolumeWeightRequest"); + String methods_url = addressDto.getMethods_url(); + String url = wmsUrl + methods_url; + log.info("applyfeedbackSubVolumeWeightRequest----请求参数:{}", JSONObject.toJSONString(param)); + try { +// String result = ""; + String result = HttpRequest.post(url) + .body(JSON.toJSONString(param)) + .execute().body(); + JSONObject jsonObject = JSONObject.parseObject(result); + log.info("applyfeedbackSubVolumeWeightRequest----返回参数{}", result); + applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class); + } catch (Exception e) { + JSONObject map = new JSONObject(); + map.put("status", 400); + map.put("message", e.getMessage()); + return JSONObject.toJavaObject(map, ApplyfeedbackSubVolumeWeightResponse.class); + } + LuceneLogDto luceneLogDto = new LuceneLogDto("applyfeedbackSubVolumeWeightRequest", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()), + JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS向LMS申请套管"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + } + return applyfeedbackSubVolumeWeightResponse; + } finally { + MDC.remove(log_file_type); + } + } + @Override public ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param) { log.info("向LMS申请反馈,请求参数{}", param); @@ -512,7 +548,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return JSONObject.toJavaObject(map, ApplyManipulatorActionResponse.class); } LuceneLogDto luceneLogDto = new LuceneLogDto("ApplyManipulatorActionRequest", String.valueOf(applyManipulatorActionResponse.getCode()), - JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈"); + JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈子卷重量"); luceneLogService.interfaceExecuteLog(luceneLogDto); } return applyManipulatorActionResponse;