From 594d8265b0192192ca7a5535d2eba15d1f73ea72 Mon Sep 17 00:00:00 2001 From: yanps Date: Thu, 28 Nov 2024 17:03:58 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E5=B0=86=E7=89=A9=E6=96=99PDF=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=BD=AC=E6=8D=A2=E6=88=90=E5=9B=BE=E7=89=87=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plc_to_agv/PlcToAgvDeviceDriver.java | 13 +++- lms/nladmin-system/nlsso-server/pom.xml | 18 +++++ .../wms/ext/fab/controller/FabController.java | 7 +- .../ext/fab/service/dto/SendVehicleVo.java | 4 ++ ...chBaseVehiclematerialgroupServiceImpl.java | 70 +++++++++++-------- .../sch/task_manage/AutoQueryFilePath.java | 22 +++--- 6 files changed, 88 insertions(+), 46 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java index e1393bd..4e17e33 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -111,7 +112,12 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev AGVSetOutReqLower = this.itemProtocol.getAGVSetOutReqLower(); heartbeat = this.itemProtocol.getHeartbeat(); if (heartbeat == 1) { - writing("heartbeat", writing_heartbeat); + List list = new ArrayList<>(); + Map map = new HashMap(); + map.put("code", "heartbeat"); + map.put("value", writing_heartbeat); + list.add(map); + writing(list); } } catch (Exception var17) { log.info("读取信号失败,失败原因:{}", var17.getMessage()); @@ -121,11 +127,10 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev } public void writing(String param, String value) { - if (!"heartbeat".equals(param)) { String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - Map itemMap = new HashMap(); + Map itemMap = new HashMap<>(); itemMap.put(to_param, Integer.parseInt(value)); try { @@ -134,6 +139,7 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev } catch (Exception e) { e.printStackTrace(); } + if (!"heartbeat".equals(param)) { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("下发多个电气信号" + itemMap) @@ -154,6 +160,7 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev itemMap.put(to_param, json.getString("value")); } } + LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("下发电气信号:" + itemMap) diff --git a/lms/nladmin-system/nlsso-server/pom.xml b/lms/nladmin-system/nlsso-server/pom.xml index 86f3b85..ee11851 100644 --- a/lms/nladmin-system/nlsso-server/pom.xml +++ b/lms/nladmin-system/nlsso-server/pom.xml @@ -34,6 +34,24 @@ + + org.apache.pdfbox + fontbox + 2.0.9 + + + + org.apache.pdfbox + pdfbox + 2.0.9 + + + + commons-logging + commons-logging + 1.2 + + com.google.code.gson gson diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java index 3c40f08..c0ca794 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java @@ -222,7 +222,7 @@ public class FabController { public ResponseEntity sendMater(@RequestBody SendMaterVo materInfo) { JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo); //TODO:待确定 - if("1".equals(materInfo.getPoint_code())){ + if ("1".equals(materInfo.getPoint_code())) { List mater = materInfo.getMater(); if (CollUtil.isEmpty(mater)) throw new BadRequestException("物料信息为空,请确认!"); JSONObject json = new JSONObject(); @@ -260,8 +260,11 @@ public class FabController { toJSON.put("material_info", materiales); toJSON.put("vehicle_code", schBasePoint.getVehicle_code()); toJSON.put("region_code", StrUtil.isNotEmpty(mater.get(0).getRegion_code()) ? mater.get(0).getRegion_code() : schBasePoint.getRegion_code()); - }else{ + } else { if ("2".equals(materInfo.getPoint_code())) { + List mater = materInfo.getMater(); + if (CollUtil.isEmpty(mater)) throw new BadRequestException("物料信息为空,请确认!"); + toJSON.put("material_info", mater); toJSON.put("region_code", RegionEnum.NBJG.getRegion_code()); } else if ("3".equals(materInfo.getPoint_code())) { toJSON.put("region_code", RegionEnum.WXJG.getRegion_code()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/dto/SendVehicleVo.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/dto/SendVehicleVo.java index 5c7dc40..6ac4036 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/dto/SendVehicleVo.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/dto/SendVehicleVo.java @@ -31,6 +31,10 @@ public class SendVehicleVo { * 载具号 */ private String vehicle_code; + /** + * 物料id + */ + private String material_id; /** * 优先级 */ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java index 22c4bf4..a524178 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java @@ -15,6 +15,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.rendering.PDFRenderer; import org.nl.common.domain.query.PageQuery; import org.nl.common.enums.GoodsEnum; import org.nl.common.exception.BadRequestException; @@ -35,11 +37,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import sun.misc.BASE64Encoder; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; +import javax.imageio.ImageIO; +import javax.imageio.stream.ImageInputStream; +import javax.servlet.ServletOutputStream; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; import java.util.*; +import java.util.List; import java.util.stream.Collectors; /** @@ -235,35 +240,38 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl