From 8a40def0bbac7e492843aaf9b46b4e0288c5a79e Mon Sep 17 00:00:00 2001 From: psh Date: Thu, 18 Apr 2024 09:44:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=A0=E7=9B=98=E6=9C=BA=E6=B5=8B=E9=AB=98?= =?UTF-8?q?=E5=B7=B2=E5=8F=AF=E7=94=A8=EF=BC=8C=E6=94=B9=E4=B8=BA=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FoldDiscSiteDeviceDriver.java | 5 ++ .../ssx_site/SsxSiteDeviceDriver.java | 64 ++++++++++++++----- .../nl/wms/board/service/dao/dto/RkDto.java | 13 ++++ .../nl/wms/board/service/dao/dto/SckbDto.java | 11 ++++ .../board/service/impl/BoardServiceImpl.java | 31 ++++----- .../ext/service/impl/AcsToWmsServiceImpl.java | 15 ++++- .../sch/task_manage/task/tasks/POINTTask.java | 4 +- 7 files changed, 104 insertions(+), 39 deletions(-) create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/dao/dto/RkDto.java create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/dao/dto/SckbDto.java diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDeviceDriver.java index d656a25..9c56974 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -112,6 +112,11 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements if (number != last_number) { int max_emptypalletnum = Integer.parseInt(this.getDevice().getExtraValue().get("max_emptypalletnum").toString()); + JSONObject json = new JSONObject(); + json.put("number", number); + json.put("device_code",device_code); + json.put("type",1); + acsToWmsService.notify(json); if (number == max_emptypalletnum) { this.requireSucess = false; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDeviceDriver.java index 4f0a74a..0d7a7c5 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDeviceDriver.java @@ -95,7 +95,7 @@ public class SsxSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devi private Date instruction_require_time = new Date(); private Date instruction_finished_time = new Date(); - private int instruction_require_time_out; + private int instruction_require_time_out = 3000; boolean requireSucess = false; boolean resultSucess = false; @@ -173,51 +173,85 @@ public class SsxSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devi if (error != last_error) { } - if (move != last_move) { + if (move != last_move && "SSX04".equals(this.devicecode)) { JSONObject json = new JSONObject(); - json.put("point_qty", move); + json.put("point_qty", move==0?"无货":"有货"); + json.put("type",2); acsToWmsService.notify(json); } - if (!Objects.equals(mother_tray, last_mother_tray)) { + if (!Objects.equals(mother_tray, last_mother_tray)&& "SSX04".equals(this.devicecode)) { JSONObject json = new JSONObject(); json.put("mother_tray", mother_tray); + json.put("type",2); acsToWmsService.notify(json); } - if (!Objects.equals(sub_tray, last_sub_tray)) { + if (!Objects.equals(sub_tray, last_sub_tray)&& "SSX04".equals(this.devicecode)) { JSONObject json = new JSONObject(); json.put("sub_tray", sub_tray); + json.put("type",2); acsToWmsService.notify(json); } - if (device_type != last_device_type) { + if (device_type != last_device_type && "SSX04".equals(this.devicecode)) { JSONObject json = new JSONObject(); - json.put("device_type", device_type); + json.put("device_type", device_type==0?"正常":"异常"); + json.put("type",2); acsToWmsService.notify(json); } - if (frame_type != last_frame_type) { + if (frame_type != last_frame_type && "SSX04".equals(this.devicecode)) { JSONObject json = new JSONObject(); - json.put("frame_type", frame_type); + json.put("frame_type", frame_type==0?"正常":"异常"); + json.put("type",2); acsToWmsService.notify(json); } - if (mother_type != last_mother_type) { + if (mother_type != last_mother_type && "SSX04".equals(this.devicecode)) { JSONObject json = new JSONObject(); - json.put("sub_type", sub_type); + json.put("sub_type", sub_type==0?"正常":"异常"); + json.put("type",2); acsToWmsService.notify(json); } - if (sub_type != last_sub_type) { + if (sub_type != last_sub_type && "SSX04".equals(this.devicecode)) { JSONObject json = new JSONObject(); - json.put("sub_type", sub_type); + json.put("sub_type", sub_type==0?"正常":"异常"); + json.put("type",2); acsToWmsService.notify(json); } - if (error_code != last_error_code) { + if (error_code != last_error_code && "SSX04".equals(this.devicecode)) { JSONObject json = new JSONObject(); - json.put("error", error_code); + String errorCode=""; + switch (error_code){ + case 0: + errorCode="无报警"; + break; + case 1: + errorCode="超高"; + break; + case 10: + errorCode="左超宽"; + break; + case 100: + errorCode="右超宽"; + break; + case 1000: + errorCode="前超长"; + break; + case 10000: + errorCode="后超长"; + break; + case 100000: + errorCode="超重"; + break; + default: + break; + } + json.put("error", errorCode); + json.put("type",2); acsToWmsService.notify(json); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/dao/dto/RkDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/dao/dto/RkDto.java new file mode 100644 index 0000000..b011fa0 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/dao/dto/RkDto.java @@ -0,0 +1,13 @@ +package org.nl.wms.board.service.dao.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class RkDto { + private KcDto kc; + private HwDto hw; + private List kn; + private List wrk; +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/dao/dto/SckbDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/dao/dto/SckbDto.java new file mode 100644 index 0000000..56a1177 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/dao/dto/SckbDto.java @@ -0,0 +1,11 @@ +package org.nl.wms.board.service.dao.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class SckbDto { + private List pt; + private List ks; +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/impl/BoardServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/impl/BoardServiceImpl.java index 87112db..6c76c41 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/impl/BoardServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/board/service/impl/BoardServiceImpl.java @@ -2,6 +2,7 @@ package org.nl.wms.board.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; import lombok.extern.slf4j.Slf4j; import org.nl.common.utils.RedisUtils; import org.nl.wms.board.service.BoardService; @@ -26,14 +27,6 @@ public class BoardServiceImpl implements BoardService { if (czDto == null) { czDto = new CzDto(); } - redisUtils.set("mother_tray",0); - redisUtils.set("sub_tray",0); - redisUtils.set("device_type",0); - redisUtils.set("frame_type",0); - redisUtils.set("mother_type",0); - redisUtils.set("sub_type",0); - redisUtils.set("point_qty",0); - czDto.setMother_tray(String.valueOf(redisUtils.get("mother_tray"))); czDto.setPoint_qty(String.valueOf(redisUtils.get("point_qty"))); czDto.setDevice_type((Integer) redisUtils.get("device_type")); @@ -41,7 +34,7 @@ public class BoardServiceImpl implements BoardService { czDto.setMother_type((Integer) redisUtils.get("mother_type")); czDto.setSub_type((Integer) redisUtils.get("sub_type")); czDto.setError((Integer) redisUtils.get("error")); - return JSONObject.parseObject(JSON.toJSONString(czDto)); + return JSONObject.parseObject(JSON.toJSONString(czDto, SerializerFeature.WriteNullStringAsEmpty)); } public JSONObject rk() { @@ -50,18 +43,18 @@ public class BoardServiceImpl implements BoardService { HwDto hwDto = boardMapper.hw(); List knList = boardMapper.kn(); List wrkList = boardMapper.wrk(); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("kc", kcDto); - jsonObject.put("hw", hwDto); - jsonObject.put("kn", knList); - jsonObject.put("wrk", wrkList); - return jsonObject; + RkDto rkDto = new RkDto(); + rkDto.setKc(kcDto); + rkDto.setHw(hwDto); + rkDto.setKn(knList); + rkDto.setWrk(wrkList); + return JSONObject.parseObject(JSON.toJSONString(rkDto, SerializerFeature.WriteNullStringAsEmpty)); } public JSONObject sc() { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("pt", boardMapper.sc("HW")); - jsonObject.put("ks", boardMapper.sc("HWK")); - return jsonObject; + SckbDto sckbDto = new SckbDto(); + sckbDto.setPt(boardMapper.sc("HW")); + sckbDto.setKs(boardMapper.sc("HWK")); + return JSONObject.parseObject(JSON.toJSONString(sckbDto, SerializerFeature.WriteNullStringAsEmpty)); } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java index 4b02429..996788c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java @@ -23,6 +23,7 @@ import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.dao.SchBasePoint; +import org.nl.wms.sch.point.service.impl.SchBasePointServiceImpl; import org.nl.wms.sch.task.service.ISchBaseTaskService; import org.nl.wms.sch.task.service.dao.SchBaseTask; import org.nl.wms.sch.task_manage.AbstractTask; @@ -170,9 +171,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { public BaseResponse notify(JSONObject param) { String requestNo = param.getString("requestNo"); log.info("notifyAcs - 请求参数 {}", param); - // 遍历所有键 - for(String key:param.keySet()){ - redisUtils.set(key,param.getString(key)); + if(param.getInteger("type")==1){ + //叠盘机高度同步 + SchBasePoint schBasePoint= pointService.getOne(new LambdaQueryWrapper() + .eq(SchBasePoint::getPoint_code, param.getString("device_code"))); + schBasePoint.setVehicle_qty(param.getInteger("number")); + pointService.update(schBasePoint); + }else if(param.getInteger("type")==2) { + // 输送线看板展示字段同步 + for (String key : param.keySet()) { + redisUtils.set(key, param.getString(key)); + } } return BaseResponse.responseOk(requestNo, "反馈成功!"); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java index 2aba17d..29af301 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java @@ -80,7 +80,6 @@ public class POINTTask extends AbstractTask { .eq(SchBasePoint::getPoint_code, task.getPoint_code2())); //如果是叠盘位,根据当前数量+1为目标地址 int qty=nextSchBasePoint.getVehicle_qty()+1; - log.info("当前叠盘位完成任务次数为"); task.setPoint_code2(task.getPoint_code2().substring(0,task.getPoint_code2().length()-1)+qty); } task.setVehicle_code(schBasePoint.getVehicle_code()); @@ -175,7 +174,8 @@ public class POINTTask extends AbstractTask { endPointObj.setVehicle_code(taskObj.getVehicle_code()); endPointObj.setVehicle_code2(taskObj.getVehicle_code2()); if(endPointObj.getPoint_code().startsWith("DKT")){ - endPointObj.setVehicle_qty(endPointObj.getVehicle_qty()+1); + //叠盘机数量由acs同步,无需维护 +// endPointObj.setVehicle_qty(endPointObj.getVehicle_qty()+1); }else { endPointObj.setVehicle_qty(1); }