diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java index acaeaf4..7a84edb 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java @@ -14,7 +14,15 @@ import com.shkj.common.utils.DateUtils; import com.shkj.common.utils.SecurityUtils; import com.shkj.common.utils.StringUtils; import com.shkj.common.utils.bean.BeanUtils; +import com.shkj.plc.sdk.device.PLCReadAndWrite; +import com.shkj.plc.sdk.device.PlcOperate; import com.shkj.system.service.ISysParameterService; +import com.shkj.wcs.domain.WcsPlcConnect; +import com.shkj.wcs.domain.WcsPlcProperty; +import com.shkj.wcs.plc.PlcInit; +import com.shkj.wcs.service.IWcsPlcConnectService; +import com.shkj.wcs.service.IWcsPlcPropertyService; +import com.shkj.wcs.vo.WcsPlcConnectVo; import com.shkj.wms.bo.*; import com.shkj.wms.constants.ParameterConstants; import com.shkj.wms.constants.RedisLockConstants; @@ -99,6 +107,11 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl queryList(BusinOutInPlanQueryBo bo) { @@ -506,42 +519,6 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl updList = new ArrayList<>(); for (BusinOutPlanConfirmBo bo : bos) { @@ -569,12 +547,12 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl in = new LambdaQueryWrapper() @@ -633,6 +611,8 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl propertyList = (List) redisTemplate.opsForValue().get(RedisConstant.redisPlcProperty + plcId); + if (propertyList == null || propertyList.size() == 0) { + propertyList = iWcsPlcPropertyService.getWcsPlcPropertyByPlcId(plcId); + } + if (propertyList !=null && propertyList.size()>0){ + String oneWcsErrExit = "", twoWcsErrExit = "",oneWcsExitOutExit="",twoWcsExitOutExit=""; + String oneWcsErrExitVt = "", twoWcsErrExitVt = "",oneWcsExitOutExitVt="",twoWcsExitOutExitVt=""; + for (WcsPlcProperty plcProperty : propertyList) { + String pointType = plcProperty.getPointType(); + //请求分配 + if (pointType.equals("ontExit")) { + oneWcsErrExit = plcProperty.getAddress(); + oneWcsErrExitVt = plcProperty.getValueType(); + } else if (pointType.equals("twoExit")) { + twoWcsErrExit = plcProperty.getAddress(); + twoWcsErrExitVt = plcProperty.getValueType(); + } else if (pointType.equals("oneExitOut")) { + oneWcsExitOutExit = plcProperty.getAddress(); + oneWcsExitOutExitVt= plcProperty.getValueType(); + } else if (pointType.equals("twoExitOut")) { + twoWcsExitOutExit = plcProperty.getAddress(); + twoWcsExitOutExitVt = plcProperty.getValueType(); + } + Map allMap = new HashMap<>(1); + if (layer ==1){ + //出库拣货尚未拣货时写入异常给plc + Map oneWcsErrExitMap = new HashMap<>(1); + oneWcsErrExitMap.put(oneWcsErrExitVt, 0); + allMap.put(oneWcsErrExit, oneWcsErrExitMap); + + Map oneWcsExitOutExitMap = new HashMap<>(1); + oneWcsExitOutExitMap.put(oneWcsExitOutExitVt, 0); + allMap.put(oneWcsExitOutExit, oneWcsExitOutExitMap); + + Boolean errBoolean = plcReadAndWrite.execWrite(plcOperate_dps, JsonUtil.toJSONString(allMap)); + if (errBoolean) { + log.info("1楼出库确认后消除报警信息,写入点位成功{}", allMap); + } else { + log.info("1楼出库确认后消除报警信息,写入点位失败{}", allMap); + } + }else if (layer == 2){ + //2楼出库尚未拣货时,写入异常给plc + Map twoWcsErrExitMap = new HashMap<>(1); + twoWcsErrExitMap.put(twoWcsErrExitVt, 0); + allMap.put(twoWcsErrExit, twoWcsErrExitMap); + + Map twoWcsErrExitOutMap = new HashMap<>(1); + twoWcsErrExitOutMap.put(twoWcsExitOutExitVt, 0); + allMap.put(twoWcsExitOutExit, twoWcsErrExitOutMap); + + Boolean errBoolean = plcReadAndWrite.execWrite(plcOperate_dps, JsonUtil.toJSONString(allMap)); + if (errBoolean) { + log.info("2楼出库确认后消除报警信息,写入点位成功{}", allMap); + } else { + log.info("2楼出库确认后消除报警信息,写入点位失败{}", allMap); + } + } + } + } + + } + /** * 下发出库任务 *