diff --git a/shkj-common/src/main/java/com/shkj/common/utils/MessageUtils.java b/shkj-common/src/main/java/com/shkj/common/utils/MessageUtils.java index 168bb5d..cc6dc54 100644 --- a/shkj-common/src/main/java/com/shkj/common/utils/MessageUtils.java +++ b/shkj-common/src/main/java/com/shkj/common/utils/MessageUtils.java @@ -24,13 +24,8 @@ public class MessageUtils { public static String message(String code, Object... args) { try { MessageSource messageSource = SpringUtils.getBean(MessageSource.class); - - //log.info("获取到的语言:"+LocaleContextHolder.getLocale()); - String message = messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); - //log.info("传入参数:"+code+"转换参数:"+message); return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); } catch (Exception e) { - // e.printStackTrace(); // log.error("国际化出错了 = {}", e.getMessage()); } return code; diff --git a/shkj-quartz/src/main/java/com/shkj/quartz/task/ThirdTask.java b/shkj-quartz/src/main/java/com/shkj/quartz/task/ThirdTask.java index 13c9705..32c5b3f 100644 --- a/shkj-quartz/src/main/java/com/shkj/quartz/task/ThirdTask.java +++ b/shkj-quartz/src/main/java/com/shkj/quartz/task/ThirdTask.java @@ -17,7 +17,6 @@ public class ThirdTask { public void doTask() { sysThirdExceptionRequestService.doTask(); - } } 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 65d59ad..5ff2f52 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 @@ -106,11 +106,11 @@ public class PlcEventTask { } for (WcsPlcConnectVo conn : plcList) { - if (conn.getPlcIp().equals("192.168.150.154")){ + if (conn.getPlcIp().contains("150.154")){ plcTask(plcInit.getPlcOperate_stk(), conn, conn.getPointTables()); } - if (conn.getPlcIp().equals("192.168.150.150")){ + if (conn.getPlcIp().contains("150.150")){ plcTask(plcInit.getPlcOperate_dps(), conn, conn.getPointTables()); } } @@ -124,7 +124,7 @@ public class PlcEventTask { PlcOperate plcOperate = plcInit.getPlcOperate_dps(); PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); Map readPointMap = new HashMap<>(); - String heartbeat="DB2.0"; + String heartbeat="DB320.0.1"; readPointMap.put(heartbeat,"Boolean"); Map pointMap = plcReadAndWrite.readPlcData(plcOperate, JsonUtil.toJSONString(readPointMap)); @@ -300,11 +300,9 @@ public class PlcEventTask { public void dpsRealTimeTask(List propertyList,Map pointMap, PLCReadAndWrite plcReadAndWrite,PlcOperate plcOperate ) { try { - // log.info("监听输送线的值:"+pointMap); - String requestAddress = "", writeTaskId = "", valueType = ""; - String heartbeat = "", hbValueType = "", autoAddress = ""; + String autoAddress = ""; Long taskId = 0L; //货物高度wms的值 String cargoHeight =""; @@ -340,10 +338,6 @@ public class PlcEventTask { } else if (wcsPlcProperty.getPointType().equals("6")) { writeTaskId = wcsPlcProperty.getAddress(); valueType = wcsPlcProperty.getValueType(); - } else if (wcsPlcProperty.getPointType().equals("9")) { - //心跳 - heartbeat = wcsPlcProperty.getAddress(); - hbValueType = wcsPlcProperty.getValueType(); } else if (wcsPlcProperty.getPointType().equals("10")) { autoAddress = wcsPlcProperty.getAddress(); } else if (wcsPlcProperty.getPointType().equals("7")) { @@ -373,34 +367,7 @@ public class PlcEventTask { wcsErrExitVT =wcsPlcProperty.getValueType(); } } -// -// //读取心跳,并判断是写入true还是false; -// Boolean heartbeatV = false; -// if (pointMap.containsKey(heartbeat)) { -// heartbeatV = Boolean.valueOf(pointMap.get(heartbeat).toString()); -// } -// -// heartbeatV = (heartbeatV == true) ? false : true; -// Map writeHbMap = new HashMap<>(1); -// writeHbMap.put(hbValueType, heartbeatV); -// Map allHbMap = new HashMap<>(1); -// allHbMap.put(heartbeat, writeHbMap); -// Boolean BooleanHeartbeat = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); -// if(!BooleanHeartbeat){ -// log.info("第一次写入心跳成功失败*****************"); -// new Thread(() -> { -// try { -// Thread.sleep(1000); -// log.error("第一次写入心跳失败!进行第二次写入"); -// Boolean bool = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); -// if(bool){ -// log.error("第二次写入心跳成功!"); -// } -// } catch (InterruptedException e) { -// log.error("第二次写入心跳失败!"); -// } -// }).start(); -// } + // 电柜状态是否是自动,如果是自动则继续流程 if (pointMap.containsKey(autoAddress) && Boolean.valueOf(pointMap.get(autoAddress).toString())) { //是否请求分配 diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/stacker/StkCallUtil.java b/shkj-wms/src/main/java/com/shkj/wcs/third/stacker/StkCallUtil.java index 191e5a6..029efaa 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/third/stacker/StkCallUtil.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/stacker/StkCallUtil.java @@ -67,17 +67,6 @@ public class StkCallUtil { * @return */ public Result outTask(STKMoveBo stkMoveBo) throws InterruptedException { - - /*//判断是否有出库任务没有执行,如果有先不下发 - Date nowDate = DateUtils.getNowDate(); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(SysThirdExceptionRequest::getStatus, ThirdApiStatusEnum.fail.getValue()) - .ne(SysThirdExceptionRequest::getCode,stkMoveBo.getTaskId()) - .and(wq->wq.lt(SysThirdExceptionRequest::getPlanTime, nowDate) - .or().isNull(SysThirdExceptionRequest::getPlanTime)) - .orderByAsc(SysThirdExceptionRequest::getCreateTime) - .last("limit 1 "); - SysThirdExceptionRequest one = sysThirdExceptionRequestService.getOne(wrapper);*/ //下发任务时,先查询是否有正在执行的入库任务,如果有,则不下发出库任务 Object taskInId = redisTemplate.opsForValue().get(RedisConstant.redisTaskIn); if (taskInId !=null ){ @@ -127,24 +116,49 @@ public class StkCallUtil { Map dpsPointMap = plcReadAndWrite.readPlcData(dpsOperate, dpsPointTables); List dpsPropertyList = iWcsPlcPropertyService.getWcsPlcPropertyByPlcId(dpsPlcId); - String dpsidle=""; - String dpsidleV=""; + String oneDpsidle=""; + String twoDpsidle=""; + String oneDpsidleV=""; + String twoDpsidleV=""; for (WcsPlcProperty dpsProperty : dpsPropertyList) { - //是否允许出库 - if (dpsProperty.getPointType().equals("100")) { - dpsidle = dpsProperty.getAddress(); + //1楼是否允许出库 + if (dpsProperty.getPointType().equals("oneOut")) { + oneDpsidle = dpsProperty.getAddress(); + } + + //2楼是否允许出库 + if (dpsProperty.getPointType().equals("twoOut")) { + twoDpsidle = dpsProperty.getAddress(); } } - if (dpsPointMap.containsKey(dpsidle)){ - dpsidleV = dpsPointMap.get(dpsidle).toString(); + if (dpsPointMap.containsKey(oneDpsidle)){ + oneDpsidleV = dpsPointMap.get(oneDpsidle).toString(); } - log.info("是否允许出库状态点位:"+dpsidle); - log.info("是否允许出库状态值:"+dpsidleV); - //false不允许出库 - if (!Boolean.valueOf(dpsidleV)){ - return Result.err().msg("输送线繁忙,不允许出库"); + if (dpsPointMap.containsKey(twoDpsidle)){ + twoDpsidleV = dpsPointMap.get(twoDpsidle).toString(); + } + + log.info("1楼是否允许出库::"+oneDpsidle+" 出库的值:"+oneDpsidleV); + log.info("2楼是否允许出库::"+twoDpsidle+" 出库的值:"+twoDpsidleV); + Integer layer = one.getLayer(); + if (layer==1){ + //false不允许出库 + if (!Boolean.valueOf(oneDpsidleV)){ + String msg ="出库楼层是1楼,输送线繁忙,不允许出库"; + log.info(msg); + return Result.err().msg(msg); + } + }else if(layer == 2){ + if (!Boolean.valueOf(twoDpsidleV)){ + String msg ="出库楼层是2楼,输送线繁忙,不允许出库"; + log.info(msg); + return Result.err().msg(msg); + } + }else { + log.info("未匹配到楼层"); + return Result.err().msg("未匹配到楼层,不允许出库"); } String plcTaskId = "",taskIdvalueType = "",plcToRow = "",toRowValueType = "",plcToColumn = "",toColumnValueType = "",plcToLayer = "",toLayerValueType = ""; @@ -215,51 +229,48 @@ public class StkCallUtil { Thread.sleep(2000); - Boolean stkAutoManualV= false; + Integer stkRunV = 0; + if (stkPointMap.containsKey(stkRun)) { + stkRunV = Integer.valueOf(stkPointMap.get(stkRun).toString()); + } + log.info("堆垛机运行状态:"+stkRunV); + if (stkRunV!=1){ + return Result.err().msg("堆垛机尚未运行"); + } + + + Integer stkAutoManualV=0; if (stkPointMap.containsKey(stkAutoManual)) { - stkAutoManualV = Boolean.valueOf(stkPointMap.get(stkAutoManual).toString()); + stkAutoManualV = Integer.valueOf(stkPointMap.get(stkAutoManual).toString()); } log.info("堆垛机自动状态:"+stkAutoManualV); + if(stkAutoManualV ==0 ){ + return Result.err().msg("堆垛机手动状态"); + } - Boolean stkGroundV= false; + Integer stkGroundV= 0; if (stkPointMap.containsKey(stkGround)) { - stkGroundV = Boolean.valueOf(stkPointMap.get(stkGround).toString()); + stkGroundV = Integer.valueOf(stkPointMap.get(stkGround).toString()); } log.info("地面柜自动状态:"+stkGroundV); - - Boolean stkidleV = false; - if (stkPointMap.containsKey(stkidle)) { - stkidleV = Boolean.valueOf(stkPointMap.get(stkidle).toString()); - } - log.info("堆垛机是状态:"+stkidleV.toString()); - - Boolean stkRunV = false; - if (stkPointMap.containsKey(stkRun)) { - stkRunV = Boolean.valueOf(stkPointMap.get(stkRun).toString()); - } - log.info("堆垛机运行状态:"+stkRunV); - /* //等于0 - if (!stkRunV){ - return Result.err().msg("堆垛机正在运行中"); - }*/ - - if(!stkGroundV){ + if(stkGroundV==0){ return Result.err().msg("堆垛机地面柜手动状态"); } - if(!stkAutoManualV){ - return Result.err().msg("堆垛机手动状态"); + Integer stkidleV = 0; + if (stkPointMap.containsKey(stkidle)) { + stkidleV = Integer.valueOf(stkPointMap.get(stkidle).toString()); } - - //等于0繁忙 false代表繁忙 - if(!stkidleV){ + log.info("堆垛机是状态:"+stkidleV); + //1空闲 0繁忙 + if(stkidleV==0){ return Result.err().msg("堆垛机繁忙"); } - if(!Boolean.valueOf(dpsidleV) && !stkidleV){ + if((!Boolean.valueOf(oneDpsidleV) || !Boolean.valueOf(twoDpsidleV)) && stkidleV == 0){ return Result.err().msg("出库状态与堆垛机的状态都不可出库"); }else{ - log.info("出库状态与堆垛机的状态可出库:"+Boolean.valueOf(dpsidleV)+"--"+stkidleV); + log.info("出库状态与堆垛机的状态可出库one: "+Boolean.valueOf(oneDpsidleV)+" two:"+twoDpsidleV+" --"+stkidleV); } //给堆垛机写命令 Map allMap = new HashMap<>(1); @@ -302,9 +313,9 @@ public class StkCallUtil { redisTemplate.opsForValue().set(RedisConstant.redisTaskOut,stkMoveBo.getTaskId()); return Result.ok(); } else { + log.info("堆垛机下发命令失败:"+one.getTaskId()); return Result.err(); } - // return plcReadAndWrite.execWrite(stkOperate, JsonUtil.toJSONString(allMap)) ? Result.ok() : Result.err(); } /** diff --git a/shkj-wms/src/main/java/com/shkj/wms/domain/SysThirdExceptionRequest.java b/shkj-wms/src/main/java/com/shkj/wms/domain/SysThirdExceptionRequest.java index fae6339..ebef1d9 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/domain/SysThirdExceptionRequest.java +++ b/shkj-wms/src/main/java/com/shkj/wms/domain/SysThirdExceptionRequest.java @@ -117,5 +117,9 @@ public class SysThirdExceptionRequest implements Serializable { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+7") private Date planTime; + /** + * 出入库楼层 + */ + private Integer layer; } diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/SysThirdExceptionRequestServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/SysThirdExceptionRequestServiceImpl.java index 3c6f075..b937685 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/SysThirdExceptionRequestServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/SysThirdExceptionRequestServiceImpl.java @@ -59,24 +59,6 @@ public class SysThirdExceptionRequestServiceImpl extends ServiceImpl() .eq(SysThirdExceptionRequest::getCode, taskCode) .eq(SysThirdExceptionRequest::getStatus, ThirdApiStatusEnum.fail.getValue()) @@ -125,7 +107,6 @@ public class SysThirdExceptionRequestServiceImpl extends ServiceImpl