From f21494a7048cbfeba5a34e5a7fd1445aa427878c Mon Sep 17 00:00:00 2001 From: judy <278197488@qq.com> Date: Sat, 11 Jan 2025 15:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E6=97=B6=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E8=B4=A7=E4=BD=8D=E7=B1=BB=E5=9E=8B=20=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E8=B6=85=E9=AB=98=E8=B6=85=E5=AE=BD=E4=BF=A1=E6=81=AF=20?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shkj/wcs/plc/PlcEventTask.java | 104 ++++++++---------- .../com/shkj/wms/domain/BusinPlcStatus.java | 96 ++++++++-------- .../shkj/wms/enums/LocationPlanTypeEnum.java | 17 ++- .../service/IBusinPlcExceptionService.java | 2 +- .../wms/service/ISysStockDetailService.java | 10 -- .../impl/BusinPlcExceptionServiceImpl.java | 27 +---- .../impl/SysStockDetailServiceImpl.java | 55 --------- 7 files changed, 112 insertions(+), 199 deletions(-) diff --git a/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java b/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java index 5631460..a8fb493 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java @@ -207,8 +207,6 @@ public class PlcEventTask { log.info("无匹配的设备类型"); break; } - - } @@ -261,65 +259,57 @@ public class PlcEventTask { BusinPlcStatus businPlcStatus = new BusinPlcStatus(); for (WcsPlcProperty property : propertyList) { plcId = property.getPlcId(); - String pointType = property.getPointType(); String address = property.getAddress(); - String devCode = property.getRelPoint(); - if (pointType.equals("run")){ - if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){ - if (devCode.equals("dps")){ - businPlcStatus.setDpsRun(pointMap.get(address).toString()); - }else if (devCode.equals("stk")){ - businPlcStatus.setStkRun(pointMap.get(address).toString()); - }else if (devCode.equals("dts")){ - businPlcStatus.setDtsRun(pointMap.get(address).toString()); - } - } - } - - if (pointType.equals("wait")){ - if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){ - if (devCode.equals("dps")){ - businPlcStatus.setDpsWait(pointMap.get(address).toString()); - }else if (devCode.equals("stk")){ - businPlcStatus.setStkWait(pointMap.get(address).toString()); - }else if (devCode.equals("dts")){ - businPlcStatus.setDtsWait(pointMap.get(address).toString()); - } - } - } - - if (pointType.equals("pause")){ - if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){ - if (devCode.equals("dps")){ - businPlcStatus.setDpsPause(pointMap.get(address).toString()); - }else if (devCode.equals("stk")){ - businPlcStatus.setStkPause(pointMap.get(address).toString()); - }else if (devCode.equals("dts")){ - businPlcStatus.setDtsPause(pointMap.get(address).toString()); - } - } - } - - if (pointType.equals("fault")){ - if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){ - if (devCode.equals("dps")){ - businPlcStatus.setDpsFault(pointMap.get(address).toString()); - }else if (devCode.equals("stk")){ - businPlcStatus.setStkFault(pointMap.get(address).toString()); - }else if (devCode.equals("dts")){ - businPlcStatus.setDtsFault(pointMap.get(address).toString()); - } - } + switch (pointType) { + case "stkRun": + businPlcStatus.setStkRun(pointMap.get(address).toString()); + break; + case "stkWait": + businPlcStatus.setStkWait(pointMap.get(address).toString()); + break; + case "stkStop": + businPlcStatus.setStkStop(pointMap.get(address).toString()); + break; + case "stkFault": + businPlcStatus.setStkFault(pointMap.get(address).toString()); + break; + case "stkPowerOn": + businPlcStatus.setStkPowerOn(pointMap.get(address).toString()); + break; + case "oneDpsRun": + businPlcStatus.setOneDpsRun(pointMap.get(address).toString()); + break; + case "oneDpsWait": + businPlcStatus.setOneDpsWait(pointMap.get(address).toString()); + break; + case "oneDpsStop": + businPlcStatus.setOneDpsStop(pointMap.get(address).toString()); + break; + case "oneDpsFault": + businPlcStatus.setOneDpsFault(pointMap.get(address).toString()); + break; + case "oneDpsPowerOn": + businPlcStatus.setOneDpsPowerOn(pointMap.get(address).toString()); + break; + case "twoDpsRun": + businPlcStatus.setTwoDpsRun(pointMap.get(address).toString()); + break; + case "twoDpsWait": + businPlcStatus.setTwoDpsWait(pointMap.get(address).toString()); + break; + case "twoDpsStop": + businPlcStatus.setTwoDpsStop(pointMap.get(address).toString()); + break; + case "twoDpsFault": + businPlcStatus.setTwoDpsFault(pointMap.get(address).toString()); + break; + case "twoDpsPowerOn": + businPlcStatus.setTwoDpsPowerOn(pointMap.get(address).toString()); + break; } } - //log.info("处理设备状态的Id:"+plcId); - if (plcId.toString().equals("48")){ - redisTemplate.opsForValue().set(RedisConstant.redisStkStatus,businPlcStatus ); - }else { - redisTemplate.opsForValue().set(RedisConstant.redisPlcStatus,businPlcStatus ); - } - + redisTemplate.opsForValue().set(RedisConstant.redisPlcStatus,businPlcStatus,30,TimeUnit.SECONDS ); }catch (Exception e ){ log.error("处理设备状态{}"+e.getMessage()); } diff --git a/shkj-wms/src/main/java/com/shkj/wms/domain/BusinPlcStatus.java b/shkj-wms/src/main/java/com/shkj/wms/domain/BusinPlcStatus.java index b5a414a..9df3c7c 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/domain/BusinPlcStatus.java +++ b/shkj-wms/src/main/java/com/shkj/wms/domain/BusinPlcStatus.java @@ -39,54 +39,62 @@ public class BusinPlcStatus implements Serializable /** 堆垛机-暂停 */ @Excel(name = "堆垛机-暂停") - private String stkPause; + private String stkStop; /** 堆垛机-故障 */ @Excel(name = "堆垛机-故障") private String stkFault; - /** 堆垛机-停机或通讯异常 */ - @Excel(name = "堆垛机-停机或通讯异常") - private String stkStop; - - /** 输送线-运行 */ - @Excel(name = "输送线-运行") - private String dpsRun; - - /** 输送线-等待 */ - @Excel(name = "输送线-等待") - private String dpsWait; - - /** 输送线-暂停 */ - @Excel(name = "输送线-暂停") - private String dpsPause; - - /** 输送线-故障 */ - @Excel(name = "输送线-故障") - private String dpsFault; - - /** 输送线-停机或通讯异常 */ - @Excel(name = "输送线-停机或通讯异常") - private String dpsStop; - - /** 提升机-运行 */ - @Excel(name = "提升机-运行") - private String dtsRun; - - /** 提升机-等待 */ - @Excel(name = "提升机-等待") - private String dtsWait; - - /** 提升机-暂停 */ - @Excel(name = "提升机-暂停") - private String dtsPause; - - /** 提升机-故障 */ - @Excel(name = "提升机-故障") - private String dtsFault; - - /** 提升机-停机或通讯异常 */ - @Excel(name = "提升机-停机或通讯异常") - private String dtsStop; + /** 堆垛机-上电 */ + @Excel(name = "堆垛机-上电") + private String stkPowerOn; + + /** + * 输送运行 (1楼) + * 输送待机 (1楼) + * 输送停止(1楼) + * 输送故障(1楼) + * 输送上电 (1楼) + */ + /** 输送线1F-运行 */ + @Excel(name = "输送线1F-运行") + private String oneDpsRun; + + /** 输送线1F-待机 */ + @Excel(name = "输送线1F-等待") + private String oneDpsWait; + + /** 输送线1F-停止 */ + @Excel(name = "输送线1F-暂停") + private String oneDpsStop; + + /** 输送线1F-故障 */ + @Excel(name = "输送线1F-故障") + private String oneDpsFault; + + /** 输送线1F-上电 */ + @Excel(name = "输送线1F-停机或通讯异常") + private String oneDpsPowerOn; + + + /** 输送线2F-运行 */ + @Excel(name = "输送线2F-运行") + private String twoDpsRun; + + /** 输送线2F-待机 */ + @Excel(name = "输送线2F-等待") + private String twoDpsWait; + + /** 输送线2F-停止 */ + @Excel(name = "输送线2F-暂停") + private String twoDpsStop; + + /** 输送线2F-故障 */ + @Excel(name = "输送线2F-故障") + private String twoDpsFault; + + /** 输送线2F-上电 */ + @Excel(name = "输送线2F-停机或通讯异常") + private String twoDpsPowerOn; } diff --git a/shkj-wms/src/main/java/com/shkj/wms/enums/LocationPlanTypeEnum.java b/shkj-wms/src/main/java/com/shkj/wms/enums/LocationPlanTypeEnum.java index c8f8f4e..732897b 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/enums/LocationPlanTypeEnum.java +++ b/shkj-wms/src/main/java/com/shkj/wms/enums/LocationPlanTypeEnum.java @@ -11,18 +11,23 @@ import lombok.Getter; public enum LocationPlanTypeEnum { /** - * 1空托盘,2矮货位,3高货位 + * 0空托盘,1 1-9层 2 10层 10-1是550货位; 3 11层 */ - EMPTY("1", "空托盘"), + EMPTY("0", "空托盘"), /** - * 矮货位 + * 1-19层 */ - LOW("2", "矮货位"), + ONE("1", "低货位"), /** - * 高货位 + * 10层 */ - HEIGHT("3", "高货位"), + TWO("2", "中货位"), + + /** + * 11层 + */ + THREE("3", "高货位"), ; diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/IBusinPlcExceptionService.java b/shkj-wms/src/main/java/com/shkj/wms/service/IBusinPlcExceptionService.java index b901eab..675df1b 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/IBusinPlcExceptionService.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/IBusinPlcExceptionService.java @@ -74,7 +74,7 @@ public interface IBusinPlcExceptionService extends IService * 获取设备状态 * @return */ - public BusinPlcStatus getPlcStatusFromRedis(); + public BusinPlcStatus getPlcStatusFromRedis(); } diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/ISysStockDetailService.java b/shkj-wms/src/main/java/com/shkj/wms/service/ISysStockDetailService.java index 0884f39..ecc277e 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/ISysStockDetailService.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/ISysStockDetailService.java @@ -87,16 +87,6 @@ public interface ISysStockDetailService extends IService { List StockInquiry(SysStockDetailQueryBo bo); List StockInquiryPda(SysStockDetailQueryBo bo) ; - /** - * 找到位置 - * - * @param containerId 容器id - * @param baseMoldBarcodeList 基模具条码列表中 - * @param currentBranchId 当前分支id - * @param isHigh - * @return {@link StockDetailLocationVo} - */ - StockDetailLocationVo findLocation(Long containerId, List baseMoldBarcodeList, Long currentBranchId, boolean isHigh); StockDetailLocationVo findLocationByContainer(String findLocationByContainer, Long currentBranchId); diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPlcExceptionServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPlcExceptionServiceImpl.java index e7f3faf..07f3e83 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPlcExceptionServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPlcExceptionServiceImpl.java @@ -134,34 +134,9 @@ public class BusinPlcExceptionServiceImpl extends ServiceImpl baseMoldBarcodeList, Long branchId, boolean isHigh) { - log.info("findLocation = {}", containerId); - //入库根据托盘上模具最大长宽高尺寸来限定能存放的货位,在能存放的货位里按拣货顺序从小到大依次存放。 - List locationVoList = this.baseMapper.findLocation(branchId); - // 这里只能找新货位或者跟当前托盘相同的货位 - - locationVoList = locationVoList.stream() - .filter(x -> CollectionUtils.isEmpty(x.getStockDetailList()) || - x.getStockDetailList().stream().allMatch(y -> Objects.equals(y.getId(), null)) || - x.getStockDetailList().stream().allMatch(y -> Objects.equals(y.getContainerId(), containerId)) - ) - .collect(Collectors.toList()); - - if (isHigh){ - locationVoList = locationVoList.stream().filter(y -> Objects.equals(y.getType(), LocationPlanTypeEnum.HEIGHT.getValue())) .collect(Collectors.toList()); - } - if (CollectionUtils.isEmpty(locationVoList)) { - return null; - } - List baseMolds = baseMoldService.listByIds(baseMoldBarcodeList.stream().map(BaseMold::getId).collect(Collectors.toList())); - // 计算当前要入库的总长宽高 修改为最大的长宽高 - BigDecimal inLength = baseMolds.stream().map(BaseMold::getLength).max(Comparator.comparing(x -> x)).orElse(BigDecimal.ZERO); - BigDecimal inWidth = baseMolds.stream().map(BaseMold::getWidth).max(Comparator.comparing(x -> x)).orElse(BigDecimal.ZERO); - BigDecimal inHeight = baseMolds.stream().map(BaseMold::getHeight).max(Comparator.comparing(x -> x)).orElse(BigDecimal.ZERO); - log.info("入库的长宽高为{} {} {}", inLength, inWidth, inHeight); - //计算每一个货位对应的总长宽高 - for (StockDetailLocationVo vo : locationVoList) { - List stockDetailList = vo.getStockDetailList(); - if (stockDetailList.stream().allMatch(y -> Objects.equals(y.getContainerId(), containerId))) { - log.info("找到原货位了 不需要判断模具的体积 = {}", stockDetailList); - return vo; - } - // 只需要计算货位的长宽高大于入库磨具最大的长宽高即可 - BigDecimal remainLength = vo.getLength(); - BigDecimal remainWidth = vo.getWidth(); - BigDecimal remainHeight = vo.getHeight(); - log.info("货位{} 剩下的长宽高为{} {} {}", vo.getLocationCode(), remainLength, remainWidth, remainHeight); - if (inLength.compareTo(remainLength) < 1 && inWidth.compareTo(remainWidth) < 1 && inHeight.compareTo(remainHeight) < 1) { - log.info("货位{}满足入库条件", vo.getLocationCode()); - return vo; - } - } - return null; - } @Override @Transactional(rollbackFor = Exception.class)