|
|
|
@ -1,7 +1,5 @@ |
|
|
|
package com.shkj.wcs.plc; |
|
|
|
package com.shkj.wcs.plc; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
|
|
|
|
import com.shkj.common.constant.RedisConstant; |
|
|
|
import com.shkj.common.constant.RedisConstant; |
|
|
|
import com.shkj.common.core.domain.Result; |
|
|
|
import com.shkj.common.core.domain.Result; |
|
|
|
import com.shkj.common.enums.BusinessType; |
|
|
|
import com.shkj.common.enums.BusinessType; |
|
|
|
@ -15,10 +13,8 @@ import com.shkj.wcs.service.IWcsPlcConnectService; |
|
|
|
import com.shkj.wcs.service.IWcsPlcPropertyService; |
|
|
|
import com.shkj.wcs.service.IWcsPlcPropertyService; |
|
|
|
import com.shkj.wcs.third.rcs.RCSUtil; |
|
|
|
import com.shkj.wcs.third.rcs.RCSUtil; |
|
|
|
import com.shkj.wcs.third.workbinWcs.WCSUtil; |
|
|
|
import com.shkj.wcs.third.workbinWcs.WCSUtil; |
|
|
|
import com.shkj.wcs.third.workbinWcs.dto.WCSQueryAreaStatusBody; |
|
|
|
|
|
|
|
import com.shkj.wcs.third.workbinWcs.dto.WCSQueryTaskStatusBody; |
|
|
|
import com.shkj.wcs.third.workbinWcs.dto.WCSQueryTaskStatusBody; |
|
|
|
import com.shkj.wcs.third.workbinWcs.dto.WcsIncomingTaskRequestBody; |
|
|
|
import com.shkj.wcs.third.workbinWcs.dto.WcsIncomingTaskRequestBody; |
|
|
|
import com.shkj.wcs.third.workbinWcs.dto.WcsIncomingTrayCheckBody; |
|
|
|
|
|
|
|
import com.shkj.wcs.vo.TaskStatusBody; |
|
|
|
import com.shkj.wcs.vo.TaskStatusBody; |
|
|
|
import com.shkj.wcs.vo.WcsPlcConnectVo; |
|
|
|
import com.shkj.wcs.vo.WcsPlcConnectVo; |
|
|
|
import com.shkj.wcs.vo.WcsResponseVo; |
|
|
|
import com.shkj.wcs.vo.WcsResponseVo; |
|
|
|
@ -70,67 +66,64 @@ public class PlcEventTask { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
WCSUtil wcsUtil; |
|
|
|
WCSUtil wcsUtil; |
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(fixedDelay = 5000) |
|
|
|
@Scheduled(fixedDelay = 5000) |
|
|
|
public void init() { |
|
|
|
public void init() { |
|
|
|
//查询需要连接的PLC,初始化连接对象
|
|
|
|
//查询需要连接的PLC,初始化连接对象
|
|
|
|
List<WcsPlcConnectVo> plcList = (List<WcsPlcConnectVo>) redisTemplate.opsForValue().get(RedisConstant.redisPlcListConnect); |
|
|
|
List<WcsPlcConnectVo> plcList =(List<WcsPlcConnectVo>) redisTemplate.opsForValue().get(RedisConstant.redisPlcListConnect); |
|
|
|
if (plcList == null || plcList.size() == 0) { |
|
|
|
if (plcList == null || plcList.size()==0) { |
|
|
|
plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1")); |
|
|
|
plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1")); |
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisPlcListConnect, plcList); |
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisPlcListConnect,plcList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (WcsPlcConnectVo conn : plcList) { |
|
|
|
for (WcsPlcConnectVo conn : plcList) { |
|
|
|
if (conn.getPlcIp().contains("99.151")) { |
|
|
|
if (conn.getPlcIp().contains("155.180")) { |
|
|
|
plcTask(plcInit.getPlcOperate_dps(), conn, conn.getPointTables()); |
|
|
|
plcTask(plcInit.getPlcOperate_stk(), conn, conn.getPointTables()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (conn.getPlcIp().contains("99.172")) { |
|
|
|
if (conn.getPlcIp().contains("155.170")) { |
|
|
|
plcTask(plcInit.getPlcOperate_dpj(), conn, conn.getPointTables()); |
|
|
|
plcTask(plcInit.getPlcOperate_dps(), conn, conn.getPointTables()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//输送线心跳
|
|
|
|
//输送线心跳
|
|
|
|
@Scheduled(fixedDelay = 2000) |
|
|
|
@Scheduled(fixedDelay = 4000) |
|
|
|
public void writePlcheartbeatDps() { |
|
|
|
public void writePlcheartbeatDps() { |
|
|
|
|
|
|
|
//根据连接的plcId获取属性
|
|
|
|
PlcOperate plcOperate = plcInit.getPlcOperate_dps(); |
|
|
|
PlcOperate plcOperate = plcInit.getPlcOperate_dps(); |
|
|
|
if (plcOperate != null) { |
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
//根据连接的plcId获取属性
|
|
|
|
Map<String, Object> readPointMap = new HashMap<>(); |
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
String heartbeat = "DB5100"; |
|
|
|
Map<String, Object> readPointMap = new HashMap<>(); |
|
|
|
readPointMap.put(heartbeat, "Boolean"); |
|
|
|
String heartbeat = "DB5100.0.0"; |
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, JsonUtil.toJSONString(readPointMap)); |
|
|
|
readPointMap.put(heartbeat, "Boolean"); |
|
|
|
|
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, JsonUtil.toJSONString(readPointMap)); |
|
|
|
//读取心跳,并判断是写入true还是false;
|
|
|
|
|
|
|
|
Boolean heartbeatV = false; |
|
|
|
//读取心跳,并判断是写入true还是false;
|
|
|
|
|
|
|
|
Boolean heartbeatV = false; |
|
|
|
if (pointMap.containsKey(heartbeat)) { |
|
|
|
|
|
|
|
heartbeatV = Boolean.valueOf(pointMap.get(heartbeat).toString()); |
|
|
|
if (pointMap.containsKey(heartbeat)) { |
|
|
|
} |
|
|
|
heartbeatV = Boolean.valueOf(pointMap.get(heartbeat).toString()); |
|
|
|
heartbeatV = (heartbeatV == true) ? false : true; |
|
|
|
} |
|
|
|
Map<String, Object> writeHbMap = new HashMap<>(1); |
|
|
|
//heartbeatV = (heartbeatV == true) ? false : true;
|
|
|
|
writeHbMap.put("Boolean", heartbeatV); |
|
|
|
Map<String, Object> writeHbMap = new HashMap<>(1); |
|
|
|
Map<String, Object> allHbMap = new HashMap<>(1); |
|
|
|
writeHbMap.put("Boolean", heartbeatV); |
|
|
|
allHbMap.put(heartbeat, writeHbMap); |
|
|
|
Map<String, Object> allHbMap = new HashMap<>(1); |
|
|
|
Boolean heartType = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); |
|
|
|
allHbMap.put("DB5110.0.0", writeHbMap); |
|
|
|
if (!heartType) { |
|
|
|
Boolean heartType = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); |
|
|
|
log.info("dps心跳写入失败,重连服务器"); |
|
|
|
if (!heartType) { |
|
|
|
plcInit.connect(); |
|
|
|
log.info("dps心跳写入失败,重连服务器"); |
|
|
|
|
|
|
|
plcInit.connect(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//叠盘机心跳
|
|
|
|
//堆垛机心跳
|
|
|
|
@Scheduled(fixedDelay = 2000) |
|
|
|
//@Scheduled(fixedDelay = 4000)
|
|
|
|
public void writePlcheartbeatStk() { |
|
|
|
public void writePlcheartbeatStk() { |
|
|
|
//根据连接的plcId获取属性
|
|
|
|
//根据连接的plcId获取属性
|
|
|
|
PlcOperate plcOperate = plcInit.getPlcOperate_dpj(); |
|
|
|
PlcOperate plcOperate = plcInit.getPlcOperate_stk(); |
|
|
|
if (plcOperate != null) { |
|
|
|
|
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
Map<String, Object> readPointMap = new HashMap<>(); |
|
|
|
Map<String, Object> readPointMap = new HashMap<>(); |
|
|
|
String heartbeat = "DB5100.0.0"; |
|
|
|
String heartbeat = "DB20.0.4"; |
|
|
|
readPointMap.put(heartbeat, "Boolean"); |
|
|
|
readPointMap.put(heartbeat, "Boolean"); |
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, JsonUtil.toJSONString(readPointMap)); |
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, JsonUtil.toJSONString(readPointMap)); |
|
|
|
|
|
|
|
|
|
|
|
@ -144,13 +137,12 @@ public class PlcEventTask { |
|
|
|
Map<String, Object> writeHbMap = new HashMap<>(1); |
|
|
|
Map<String, Object> writeHbMap = new HashMap<>(1); |
|
|
|
writeHbMap.put("Boolean", heartbeatV); |
|
|
|
writeHbMap.put("Boolean", heartbeatV); |
|
|
|
Map<String, Object> allHbMap = new HashMap<>(1); |
|
|
|
Map<String, Object> allHbMap = new HashMap<>(1); |
|
|
|
allHbMap.put("DB5110.0.0", writeHbMap); |
|
|
|
allHbMap.put(heartbeat, writeHbMap); |
|
|
|
Boolean heartType = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); |
|
|
|
Boolean heartType = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); |
|
|
|
if (!heartType) { |
|
|
|
if (!heartType) { |
|
|
|
log.info("stk心跳写入失败,重连服务器"); |
|
|
|
log.info("stk心跳写入失败,重连服务器"); |
|
|
|
plcInit.connect(); |
|
|
|
plcInit.connect(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void plcTask(PlcOperate plcOperate, WcsPlcConnectVo conn, String pointTables) { |
|
|
|
public void plcTask(PlcOperate plcOperate, WcsPlcConnectVo conn, String pointTables) { |
|
|
|
@ -159,7 +151,7 @@ public class PlcEventTask { |
|
|
|
//根据连接的plcId获取属性
|
|
|
|
//根据连接的plcId获取属性
|
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, pointTables); |
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, pointTables); |
|
|
|
log.info("连接的IP:"+conn.getPlcIp()+":设备:"+conn.getConnectName()+" 读取的点位内容:"+pointMap); |
|
|
|
// log.info("连接的IP:"+conn.getPlcIp()+":设备:"+conn.getConnectName()+" 读取的点位内容:"+pointMap);
|
|
|
|
|
|
|
|
|
|
|
|
List<WcsPlcProperty> propertyList = (List<WcsPlcProperty>) redisTemplate.opsForValue().get(RedisConstant.redisPlcProperty + plcId); |
|
|
|
List<WcsPlcProperty> propertyList = (List<WcsPlcProperty>) redisTemplate.opsForValue().get(RedisConstant.redisPlcProperty + plcId); |
|
|
|
if (propertyList == null || propertyList.size() == 0) { |
|
|
|
if (propertyList == null || propertyList.size() == 0) { |
|
|
|
@ -169,17 +161,13 @@ public class PlcEventTask { |
|
|
|
// 设备类型:2输送线 1 堆垛机
|
|
|
|
// 设备类型:2输送线 1 堆垛机
|
|
|
|
switch (conn.getDevType()) { |
|
|
|
switch (conn.getDevType()) { |
|
|
|
//输送线
|
|
|
|
//输送线
|
|
|
|
case "1": |
|
|
|
|
|
|
|
dpsRealTimeTask(propertyList, pointMap, plcReadAndWrite, plcOperate); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "2": |
|
|
|
case "2": |
|
|
|
dpjRealTimeTask(propertyList, pointMap, plcReadAndWrite, plcOperate); |
|
|
|
dpsRealTimeTask(propertyList, pointMap, plcReadAndWrite, plcOperate); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
log.info("无匹配的设备类型"); |
|
|
|
log.info("无匹配的设备类型"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void dpsRealTimeTask(List<WcsPlcProperty> propertyList, Map<String, Object> pointMap, PLCReadAndWrite plcReadAndWrite, PlcOperate plcOperate) { |
|
|
|
public void dpsRealTimeTask(List<WcsPlcProperty> propertyList, Map<String, Object> pointMap, PLCReadAndWrite plcReadAndWrite, PlcOperate plcOperate) { |
|
|
|
@ -202,12 +190,12 @@ public class PlcEventTask { |
|
|
|
String reqInCfmSeriaVt = ""; |
|
|
|
String reqInCfmSeriaVt = ""; |
|
|
|
|
|
|
|
|
|
|
|
//请求入库返回条码
|
|
|
|
//请求入库返回条码
|
|
|
|
String reqInCfmBarcod = ""; |
|
|
|
String reqInCfmBarcod= ""; |
|
|
|
String reqInCfmBarcodVt = ""; |
|
|
|
String reqInCfmBarcodVt= ""; |
|
|
|
|
|
|
|
|
|
|
|
//返回去向
|
|
|
|
//返回去向
|
|
|
|
String reqInDest = ""; |
|
|
|
String reqInDest = ""; |
|
|
|
String reqInDestVt = ""; |
|
|
|
String reqInDestVt= ""; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 空托 |
|
|
|
* 空托 |
|
|
|
@ -233,33 +221,12 @@ public class PlcEventTask { |
|
|
|
String rptOutCfmSeriaVt = ""; |
|
|
|
String rptOutCfmSeriaVt = ""; |
|
|
|
|
|
|
|
|
|
|
|
//出口上报条码确认
|
|
|
|
//出口上报条码确认
|
|
|
|
String rptOutCfmBarcod = ""; |
|
|
|
String rptOutCfmBarcod= ""; |
|
|
|
String rptOutCfmBarcodVt = ""; |
|
|
|
String rptOutCfmBarcodVt= ""; |
|
|
|
|
|
|
|
|
|
|
|
//出口上报返回信息
|
|
|
|
//出口上报返回信息
|
|
|
|
String retOut = ""; |
|
|
|
String retOut = ""; |
|
|
|
String retOutVt = ""; |
|
|
|
String retOutVt= ""; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 出口上报 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
//出口上报请求序列号
|
|
|
|
|
|
|
|
String rptOutSeria1 = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//出口上报条码
|
|
|
|
|
|
|
|
String rptOutBarcod1 = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//出口上报确认序列号
|
|
|
|
|
|
|
|
String rptOutCfmSeria1 = ""; |
|
|
|
|
|
|
|
String rptOutCfmSeriaVt1 = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//出口上报条码确认
|
|
|
|
|
|
|
|
String rptOutCfmBarcod1 = ""; |
|
|
|
|
|
|
|
String rptOutCfmBarcodVt1 = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//出口上报返回信息
|
|
|
|
|
|
|
|
String retOut1 = ""; |
|
|
|
|
|
|
|
String retOutVt1 = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 出入库切换 |
|
|
|
* 出入库切换 |
|
|
|
@ -271,7 +238,15 @@ public class PlcEventTask { |
|
|
|
String retInOutSwit = ""; |
|
|
|
String retInOutSwit = ""; |
|
|
|
String retInOutSwitVt = ""; |
|
|
|
String retInOutSwitVt = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 叠盘机 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
//叠盘机完成
|
|
|
|
|
|
|
|
String stk = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//叠盘机返回
|
|
|
|
|
|
|
|
String retStk = ""; |
|
|
|
|
|
|
|
String retStkVt = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (WcsPlcProperty plcProperty : propertyList) { |
|
|
|
for (WcsPlcProperty plcProperty : propertyList) { |
|
|
|
@ -279,91 +254,79 @@ public class PlcEventTask { |
|
|
|
//请求分配
|
|
|
|
//请求分配
|
|
|
|
if (pointType.equals("reqInSeria")) { |
|
|
|
if (pointType.equals("reqInSeria")) { |
|
|
|
reqInSeria = plcProperty.getAddress(); |
|
|
|
reqInSeria = plcProperty.getAddress(); |
|
|
|
} else if (pointType.equals("reqInBarcod")) { |
|
|
|
} else if (pointType.equals("reqInBarcod")) { |
|
|
|
reqInBarcod = plcProperty.getAddress(); |
|
|
|
reqInBarcod = plcProperty.getAddress(); |
|
|
|
} else if (pointType.equals("reqInLength")) { |
|
|
|
} else if (pointType.equals("reqInLength")) { |
|
|
|
//外形检测
|
|
|
|
|
|
|
|
reqInLength = plcProperty.getAddress(); |
|
|
|
reqInLength = plcProperty.getAddress(); |
|
|
|
reqInLength = plcProperty.getValueType(); |
|
|
|
reqInLength = plcProperty.getPointType(); |
|
|
|
} else if (pointType.equals("reqInCfmSeria")) { |
|
|
|
} else if (pointType.equals("reqInCfmSeria")) { |
|
|
|
reqInCfmSeria = plcProperty.getAddress(); |
|
|
|
reqInCfmSeria = plcProperty.getAddress(); |
|
|
|
reqInCfmSeriaVt = plcProperty.getValueType(); |
|
|
|
reqInCfmSeriaVt = plcProperty.getPointType(); |
|
|
|
} else if (pointType.equals("reqInCfmBarcod")) { |
|
|
|
} else if (pointType.equals("reqInCfmBarcod")) { |
|
|
|
reqInCfmBarcod = plcProperty.getAddress(); |
|
|
|
reqInCfmBarcod = plcProperty.getAddress(); |
|
|
|
reqInCfmBarcodVt = plcProperty.getValueType(); |
|
|
|
reqInCfmBarcodVt = plcProperty.getPointType(); |
|
|
|
} else if (pointType.equals("reqInDest")) { |
|
|
|
} else if (pointType.equals("reqInDest")) { |
|
|
|
reqInDest = plcProperty.getAddress(); |
|
|
|
reqInDest = plcProperty.getAddress(); |
|
|
|
reqInDestVt = plcProperty.getValueType(); |
|
|
|
reqInDestVt = plcProperty.getPointType(); |
|
|
|
|
|
|
|
|
|
|
|
} else if (pointType.equals("reqEmpty")) { |
|
|
|
} else if (pointType.equals("reqEmpty")) { |
|
|
|
reqEmpty = plcProperty.getAddress(); |
|
|
|
reqEmpty = plcProperty.getAddress(); |
|
|
|
} else if (pointType.equals("reqCfm")) { |
|
|
|
} else if (pointType.equals("reqCfm")) { |
|
|
|
reqCfm = plcProperty.getAddress(); |
|
|
|
reqCfm = plcProperty.getAddress(); |
|
|
|
reqCfmVt = plcProperty.getValueType(); |
|
|
|
reqCfmVt = plcProperty.getPointType(); |
|
|
|
} else if (pointType.equals("rptOutSeria")) { |
|
|
|
} else if (pointType.equals("rptOutSeria")) { |
|
|
|
rptOutSeria = plcProperty.getAddress(); |
|
|
|
rptOutSeria = plcProperty.getAddress(); |
|
|
|
} else if (pointType.equals("rptOutBarcod")) { |
|
|
|
} else if (pointType.equals("rptOutBarcod")) { |
|
|
|
rptOutBarcod = plcProperty.getAddress(); |
|
|
|
rptOutBarcod = plcProperty.getAddress(); |
|
|
|
} else if (pointType.equals("rptOutCfmSeria")) { |
|
|
|
} else if (pointType.equals("rptOutCfmSeria")) { |
|
|
|
rptOutCfmSeria = plcProperty.getAddress(); |
|
|
|
rptOutCfmSeria = plcProperty.getAddress(); |
|
|
|
rptOutCfmSeriaVt = plcProperty.getValueType(); |
|
|
|
rptOutCfmSeriaVt = plcProperty.getPointType(); |
|
|
|
} else if (pointType.equals("rptOutCfmBarcod")) { |
|
|
|
} else if (pointType.equals("rptOutCfmBarcod")) { |
|
|
|
rptOutCfmBarcod = plcProperty.getAddress(); |
|
|
|
rptOutCfmBarcod = plcProperty.getAddress(); |
|
|
|
rptOutCfmBarcodVt = plcProperty.getValueType(); |
|
|
|
rptOutCfmBarcodVt = plcProperty.getPointType(); |
|
|
|
} else if (pointType.equals("retOut")) { |
|
|
|
} else if (pointType.equals("retOut")) { |
|
|
|
retOut = plcProperty.getAddress(); |
|
|
|
retOut = plcProperty.getAddress(); |
|
|
|
retOutVt = plcProperty.getValueType(); |
|
|
|
retOutVt = plcProperty.getPointType(); |
|
|
|
} else if (pointType.equals("inOutSwit")) { |
|
|
|
} else if (pointType.equals("inOutSwit")) { |
|
|
|
inOutSwit = plcProperty.getAddress(); |
|
|
|
inOutSwit = plcProperty.getAddress(); |
|
|
|
} else if (pointType.equals("retInOutSwit")) { |
|
|
|
} else if (pointType.equals("retInOutSwit")) { |
|
|
|
retInOutSwit = plcProperty.getAddress(); |
|
|
|
retInOutSwit = plcProperty.getAddress(); |
|
|
|
retInOutSwitVt = plcProperty.getValueType(); |
|
|
|
retInOutSwitVt = plcProperty.getPointType(); |
|
|
|
} else if (pointType.equals("rptOutSeria1")) { |
|
|
|
} else if (pointType.equals("stk")) { |
|
|
|
rptOutSeria1 = plcProperty.getAddress(); |
|
|
|
stk = plcProperty.getAddress(); |
|
|
|
} else if (pointType.equals("rptOutBarcod1")) { |
|
|
|
} else if (pointType.equals("retStk")) { |
|
|
|
rptOutBarcod1 = plcProperty.getAddress(); |
|
|
|
retStk = plcProperty.getAddress(); |
|
|
|
} else if (pointType.equals("rptOutCfmSeria1")) { |
|
|
|
retStkVt = plcProperty.getPointType(); |
|
|
|
rptOutCfmSeria1 = plcProperty.getAddress(); |
|
|
|
|
|
|
|
rptOutCfmSeriaVt1 = plcProperty.getValueType(); |
|
|
|
|
|
|
|
} else if (pointType.equals("rptOutCfmBarcod1")) { |
|
|
|
|
|
|
|
rptOutCfmBarcod1 = plcProperty.getAddress(); |
|
|
|
|
|
|
|
rptOutCfmBarcodVt1 = plcProperty.getValueType(); |
|
|
|
|
|
|
|
} else if (pointType.equals("retOut1")) { |
|
|
|
|
|
|
|
retOut1 = plcProperty.getAddress(); |
|
|
|
|
|
|
|
retOutVt1 = plcProperty.getValueType(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//扫码处入库申请
|
|
|
|
//扫码处入库申请
|
|
|
|
//&& Boolean.valueOf(pointMap.get(reqInSeria).toString())
|
|
|
|
if (pointMap.containsKey(reqInSeria) && Boolean.valueOf(pointMap.get(reqInSeria).toString())) { |
|
|
|
if (pointMap.containsKey(reqInSeria) && !pointMap.get(reqInSeria).equals("0")) { |
|
|
|
|
|
|
|
//读取请求序列号内容
|
|
|
|
//读取请求序列号内容
|
|
|
|
String bCR01SeriaV1 = Objects.toString(pointMap.get(reqInSeria), ""); |
|
|
|
Integer bCR01SeriaV = (Integer) pointMap.get(reqInSeria); |
|
|
|
Integer bCR01SeriaV = 0; |
|
|
|
|
|
|
|
if(!bCR01SeriaV1.isEmpty()){ |
|
|
|
|
|
|
|
bCR01SeriaV = Integer.parseInt(bCR01SeriaV1.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//读取托盘条码内容
|
|
|
|
//读取托盘条码内容
|
|
|
|
String barcodeValueOne = Objects.toString(pointMap.get(reqInBarcod), ""); |
|
|
|
String barcodeValueOne = pointMap.get(reqInBarcod).toString(); |
|
|
|
String s = barcodeValueOne.replaceAll("[^A-Za-z0-9]", ""); |
|
|
|
log.info("扫码处入库申请时,读取的条码内容:" + barcodeValueOne); |
|
|
|
log.info("扫码处入库申请时,读取的条码内容:" + s); |
|
|
|
|
|
|
|
//根据托盘条码返回正在执行的任务号
|
|
|
|
//根据托盘条码返回正在执行的任务号
|
|
|
|
WcsIncomingTrayCheckBody body = new WcsIncomingTrayCheckBody(); |
|
|
|
WcsIncomingTaskRequestBody body = new WcsIncomingTaskRequestBody(); |
|
|
|
body.setStation("SC-G1-00-00-1001"); |
|
|
|
body.setStation(""); |
|
|
|
body.setTaskType(TaskTypeEnum.In.getValue()); |
|
|
|
body.setTaskType(TaskTypeEnum.In.getValue()); |
|
|
|
body.setBussinessType(BusinTaskTypeEnum.trayCheck.getValue()); |
|
|
|
body.setBussinessType(BusinTaskTypeEnum.stockIn.getValue()); |
|
|
|
body.setTrayCode(s); |
|
|
|
body.setTrayCode(barcodeValueOne); |
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTrayCheck(body); |
|
|
|
//调用agv接口查询库区状态
|
|
|
|
|
|
|
|
Object[] areaStatus = {}; |
|
|
|
|
|
|
|
body.setAreaStatus(areaStatus); |
|
|
|
|
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(body); |
|
|
|
log.info("扫码处入库申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
log.info("扫码处入库申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> seriaMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> seriaMap = new HashMap<>(1); |
|
|
|
seriaMap.put(reqInCfmSeriaVt, bCR01SeriaV); |
|
|
|
seriaMap.put(reqInCfmSeriaVt,bCR01SeriaV ); |
|
|
|
allMap.put(reqInCfmSeria, seriaMap); |
|
|
|
allMap.put(reqInCfmSeria, seriaMap); |
|
|
|
|
|
|
|
|
|
|
|
// Map<String, String> barcodMap = new HashMap<>(1);
|
|
|
|
Map<String, String> barcodMap = new HashMap<>(1); |
|
|
|
// barcodMap.put(reqInCfmBarcod00000Vt, s1);
|
|
|
|
barcodMap.put(reqInCfmBarcodVt, barcodeValueOne); |
|
|
|
// allMap.put(reqInCfmBarcod, barcodMap);
|
|
|
|
allMap.put(reqInCfmBarcod, barcodMap); |
|
|
|
//成功直行 失败回退
|
|
|
|
//成功直行 失败回退
|
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
Map<String, Integer> destMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> destMap = new HashMap<>(1); |
|
|
|
@ -371,40 +334,23 @@ public class PlcEventTask { |
|
|
|
allMap.put(reqInDest, destMap); |
|
|
|
allMap.put(reqInDest, destMap); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Map<String, Integer> destMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> destMap = new HashMap<>(1); |
|
|
|
destMap.put(reqInDestVt, 1); |
|
|
|
destMap.put(reqInDestVt, 2); |
|
|
|
allMap.put(reqInDest, destMap); |
|
|
|
allMap.put(reqInDest, destMap); |
|
|
|
} |
|
|
|
} |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
log.info("扫码处入库申请时,给输送线写命令数据:{}", allMapJson); |
|
|
|
log.info("扫码处入库申请时,给输送线写命令数据:{}",allMapJson); |
|
|
|
Boolean reqInBoolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
Boolean reqInBoolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
log.info("扫码处入库申请时,写入的命令返回结果:" + reqInBoolean.toString()); |
|
|
|
log.info("扫码处入库申请时,写入的命令返回结果:"+reqInBoolean.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
//空托盘申请
|
|
|
|
//空托盘申请
|
|
|
|
if (pointMap.containsKey(reqEmpty) && !pointMap.get(reqEmpty).equals("0")) { |
|
|
|
if (pointMap.containsKey(reqEmpty) && Boolean.valueOf(pointMap.get(reqEmpty).toString())) { |
|
|
|
WcsIncomingTaskRequestBody body = new WcsIncomingTaskRequestBody(); |
|
|
|
WcsIncomingTaskRequestBody body = new WcsIncomingTaskRequestBody(); |
|
|
|
body.setStation("SC-G1-00-00-1002"); |
|
|
|
body.setStation("空托处"); |
|
|
|
body.setTaskType(TaskTypeEnum.Out.getValue()); |
|
|
|
body.setTaskType(TaskTypeEnum.Out.getValue()); |
|
|
|
body.setBussinessType(BusinTaskTypeEnum.stockOut.getValue()); |
|
|
|
body.setBussinessType(BusinTaskTypeEnum.stockOut.getValue()); |
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
//调用agv接口查询库区状态
|
|
|
|
//调用agv接口查询库区状态
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
Object[] areaStatus = {}; |
|
|
|
map1.put("areaInLocation", "SC-A2"); |
|
|
|
|
|
|
|
map1.put("status", 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
|
|
|
map2.put("areaInLocation", "SC-B2"); |
|
|
|
|
|
|
|
map2.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map3 = new HashMap<>(); |
|
|
|
|
|
|
|
map1.put("areaInLocation", "SC-C2"); |
|
|
|
|
|
|
|
map1.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map4 = new HashMap<>(); |
|
|
|
|
|
|
|
map2.put("areaInLocation", "SC-D2"); |
|
|
|
|
|
|
|
map2.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object[] areaStatus = new Object[] { map1,map2,map3,map4}; |
|
|
|
|
|
|
|
log.info("每个库区的状态:"+Arrays.toString(areaStatus)); |
|
|
|
|
|
|
|
body.setAreaStatus(areaStatus); |
|
|
|
body.setAreaStatus(areaStatus); |
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(body); |
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(body); |
|
|
|
log.info("空托申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
log.info("空托申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
@ -412,251 +358,110 @@ public class PlcEventTask { |
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
|
|
|
|
|
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
reqMap.put(reqCfmVt, 1); |
|
|
|
reqMap.put(retOutVt,1); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
reqMap.put(reqCfmVt, 2); |
|
|
|
reqMap.put(retOutVt,0); |
|
|
|
} |
|
|
|
} |
|
|
|
allMap.put(reqCfm, reqMap); |
|
|
|
allMap.put(retOut, reqMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
log.info("空托申请时,给输送线写命令数据:{}", allMapJson); |
|
|
|
log.info("空托申请时,给输送线写命令数据:{}",allMapJson); |
|
|
|
Boolean bCR01Boolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
Boolean bCR01Boolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
log.info("空托申请时,写入的命令返回结果:" + bCR01Boolean.toString()); |
|
|
|
log.info("空托申请时,写入的命令返回结果:"+bCR01Boolean.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//实盘出口上报
|
|
|
|
//实盘出口上报
|
|
|
|
if (pointMap.containsKey(rptOutSeria) && !pointMap.get(rptOutSeria).equals("0")) { |
|
|
|
if (pointMap.containsKey(rptOutSeria) && Boolean.valueOf(pointMap.get(rptOutSeria).toString())) { |
|
|
|
//读取序列号
|
|
|
|
//读取序列号
|
|
|
|
String IntegeroutSeria = Objects.toString(pointMap.get(rptOutSeria), ""); |
|
|
|
Integer outSeria = (Integer) pointMap.get(rptOutSeria); |
|
|
|
Integer outSeria = 0; |
|
|
|
|
|
|
|
if(!IntegeroutSeria.isEmpty()){ |
|
|
|
|
|
|
|
outSeria = Integer.parseInt(IntegeroutSeria.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//读取托盘条码内容
|
|
|
|
//读取托盘条码内容
|
|
|
|
String barcodeValueOne = Objects.toString(pointMap.get(rptOutBarcod), ""); |
|
|
|
String barcodeValueOne = pointMap.get(rptOutBarcod).toString(); |
|
|
|
String s = barcodeValueOne.replaceAll("[^A-Za-z0-9]", ""); |
|
|
|
log.info("实盘出口上报时,读取的条码内容:" + barcodeValueOne); |
|
|
|
log.info("实盘出口上报时,读取的条码内容:" + s); |
|
|
|
|
|
|
|
//调用wz-wcs接口
|
|
|
|
//调用wz-wcs接口
|
|
|
|
WcsIncomingTaskRequestBody body = new WcsIncomingTaskRequestBody(); |
|
|
|
WcsIncomingTaskRequestBody body = new WcsIncomingTaskRequestBody(); |
|
|
|
body.setStation("SC-G2-00-00-2002"); |
|
|
|
body.setStation("出口上报处"); |
|
|
|
body.setTaskType(TaskTypeEnum.In.getValue()); |
|
|
|
body.setTaskType(TaskTypeEnum.In.getValue()); |
|
|
|
body.setBussinessType(BusinTaskTypeEnum.stockIn.getValue()); |
|
|
|
body.setBussinessType(BusinTaskTypeEnum.stockIn.getValue()); |
|
|
|
body.setTrayCode(s); |
|
|
|
body.setTrayCode(barcodeValueOne); |
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
//调用agv接口查询库区状态
|
|
|
|
//调用agv接口查询库区状态
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
Object[] areaStatus = {}; |
|
|
|
map1.put("areaInLocation", "SC-A2"); |
|
|
|
|
|
|
|
map1.put("status", 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
|
|
|
map2.put("areaInLocation", "SC-B2"); |
|
|
|
|
|
|
|
map2.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map3 = new HashMap<>(); |
|
|
|
|
|
|
|
map3.put("areaInLocation", "SC-C2"); |
|
|
|
|
|
|
|
map3.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map4 = new HashMap<>(); |
|
|
|
|
|
|
|
map4.put("areaInLocation", "SC-D2"); |
|
|
|
|
|
|
|
map4.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object[] areaStatus = new Object[] { map1,map2,map3,map4}; |
|
|
|
|
|
|
|
log.info("每个库区的状态:"+Arrays.toString(areaStatus)); |
|
|
|
|
|
|
|
body.setAreaStatus(areaStatus); |
|
|
|
body.setAreaStatus(areaStatus); |
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(body); |
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(body); |
|
|
|
log.info("agv扫码处申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
log.info("agv扫码处申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> seriaMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> seriaMap = new HashMap<>(1); |
|
|
|
seriaMap.put(rptOutCfmSeriaVt, outSeria); |
|
|
|
seriaMap.put(rptOutCfmSeriaVt,outSeria ); |
|
|
|
allMap.put(rptOutCfmSeria, seriaMap); |
|
|
|
allMap.put(rptOutCfmSeria, seriaMap); |
|
|
|
|
|
|
|
|
|
|
|
// Map<String, String> barcodMap = new HashMap<>(1);
|
|
|
|
Map<String, String> barcodMap = new HashMap<>(1); |
|
|
|
// barcodMap.put(rptOutCfmBarcodVt, barcodeValueOne);
|
|
|
|
barcodMap.put(rptOutCfmBarcodVt, barcodeValueOne); |
|
|
|
// allMap.put(rptOutCfmBarcod, barcodMap);
|
|
|
|
allMap.put(rptOutCfmBarcod, barcodMap); |
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
|
|
|
|
|
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
reqMap.put(retOutVt, 1); |
|
|
|
reqMap.put(reqCfmVt,1); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
reqMap.put(retOutVt, 1); |
|
|
|
reqMap.put(reqCfmVt,0); |
|
|
|
} |
|
|
|
} |
|
|
|
allMap.put(retOut, reqMap); |
|
|
|
allMap.put(reqCfm, reqMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
|
|
|
|
log.info("出口上报时,给输送线写命令数据:{}", allMapJson); |
|
|
|
|
|
|
|
Boolean rptOutBoolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
|
|
|
|
log.info("出口上报时,写入的命令返回结果:" + rptOutBoolean.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//实盘出口上报
|
|
|
|
|
|
|
|
if (pointMap.containsKey(rptOutSeria1) && !pointMap.get(rptOutSeria1).equals("0")) { |
|
|
|
|
|
|
|
//读取序列号
|
|
|
|
|
|
|
|
String IntegeroutSeria = Objects.toString(pointMap.get(rptOutSeria1), ""); |
|
|
|
|
|
|
|
Integer outSeria = 0; |
|
|
|
|
|
|
|
if(!IntegeroutSeria.isEmpty()){ |
|
|
|
|
|
|
|
outSeria = Integer.parseInt(IntegeroutSeria); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//读取托盘条码内容
|
|
|
|
|
|
|
|
String barcodeValueOne = Objects.toString(pointMap.get(rptOutBarcod1), ""); |
|
|
|
|
|
|
|
String s = barcodeValueOne.replaceAll("[^A-Za-z0-9]", ""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("实盘出口上报时,读取的条码内容:" + s); |
|
|
|
|
|
|
|
//调用wz-wcs接口
|
|
|
|
|
|
|
|
WcsIncomingTaskRequestBody body = new WcsIncomingTaskRequestBody(); |
|
|
|
|
|
|
|
body.setStation("SC-G2-00-00-2001"); |
|
|
|
|
|
|
|
body.setTaskType(TaskTypeEnum.In.getValue()); |
|
|
|
|
|
|
|
body.setBussinessType(BusinTaskTypeEnum.stockIn.getValue()); |
|
|
|
|
|
|
|
body.setTrayCode(s); |
|
|
|
|
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
|
|
|
|
//调用agv接口查询库区状态
|
|
|
|
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
|
|
|
|
map1.put("areaInLocation", "SC-A2"); |
|
|
|
|
|
|
|
map1.put("status", 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
|
|
|
map2.put("areaInLocation", "SC-B2"); |
|
|
|
|
|
|
|
map2.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map3 = new HashMap<>(); |
|
|
|
|
|
|
|
map3.put("areaInLocation", "SC-C2"); |
|
|
|
|
|
|
|
map3.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map4 = new HashMap<>(); |
|
|
|
|
|
|
|
map4.put("areaInLocation", "SC-D2"); |
|
|
|
|
|
|
|
map4.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object[] areaStatus = new Object[] { map1,map2,map3,map4}; |
|
|
|
|
|
|
|
log.info("每个库区的状态:"+Arrays.toString(areaStatus)); |
|
|
|
|
|
|
|
body.setAreaStatus(areaStatus); |
|
|
|
|
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(body); |
|
|
|
|
|
|
|
log.info("agv扫码处申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
|
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
|
|
|
|
Map<String, Integer> seriaMap = new HashMap<>(1); |
|
|
|
|
|
|
|
seriaMap.put(rptOutCfmSeriaVt1, outSeria); |
|
|
|
|
|
|
|
allMap.put(rptOutCfmSeria1, seriaMap); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Map<String, String> barcodMap = new HashMap<>(1);
|
|
|
|
|
|
|
|
// barcodMap.put(rptOutCfmBarcodVt1, s);
|
|
|
|
|
|
|
|
// allMap.put(rptOutCfmBarcod1, barcodMap);
|
|
|
|
|
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
|
|
|
|
reqMap.put(retOutVt1, 1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
reqMap.put(retOutVt1, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
allMap.put(retOut1, reqMap); |
|
|
|
|
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
log.info("出口上报时,给输送线写命令数据:{}", allMapJson); |
|
|
|
log.info("出口上报时,给输送线写命令数据:{}",allMapJson); |
|
|
|
Boolean rptOutBoolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
Boolean rptOutBoolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
log.info("出口上报时,写入的命令返回结果:" + rptOutBoolean.toString()); |
|
|
|
log.info("出口上报时,写入的命令返回结果:"+rptOutBoolean.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//出入库切换
|
|
|
|
//出入库切换
|
|
|
|
if (pointMap.containsKey(inOutSwit) && !pointMap.get(inOutSwit).equals("0")) { |
|
|
|
if (pointMap.containsKey(inOutSwit) && Boolean.valueOf(pointMap.get(inOutSwit).toString())) { |
|
|
|
WCSQueryTaskStatusBody body = new WCSQueryTaskStatusBody(); |
|
|
|
WCSQueryTaskStatusBody body = new WCSQueryTaskStatusBody(); |
|
|
|
body.setDestination("SC-G1-00-00-1002"); |
|
|
|
body.setDestination("出入库切换点位"); |
|
|
|
body.setTaskType("1"); |
|
|
|
body.setTaskType("1"); |
|
|
|
body.setTrayType("2"); |
|
|
|
body.setTrayType("2"); |
|
|
|
WcsResponseVo<TaskStatusBody> vo = JSON.parseObject( |
|
|
|
WcsResponseVo<TaskStatusBody> vo = wcsUtil.queryTaskStatus(body); |
|
|
|
JSON.toJSONString(wcsUtil.queryTaskStatus(body)), |
|
|
|
log.info("出入库切换时申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
new TypeReference<WcsResponseVo<TaskStatusBody>>() {} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
Integer taskCount = vo.getBody().get(0).getTaskCount(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
if (taskCount == 0) { |
|
|
|
int taskCount = vo.getBody().get(0).getTaskCount(); |
|
|
|
reqMap.put(retInOutSwitVt, 2); |
|
|
|
if (taskCount == 0){ |
|
|
|
} else { |
|
|
|
reqMap.put(retInOutSwitVt,2); |
|
|
|
reqMap.put(retInOutSwitVt, 1); |
|
|
|
}else { |
|
|
|
|
|
|
|
reqMap.put(retInOutSwitVt,1); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
reqMap.put(retInOutSwitVt, 1); |
|
|
|
reqMap.put(retInOutSwitVt,1); |
|
|
|
} |
|
|
|
} |
|
|
|
allMap.put(retInOutSwit, reqMap); |
|
|
|
allMap.put(retInOutSwit, reqMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
log.info("出入库切换时,给输送线写命令数据:{}", allMapJson); |
|
|
|
log.info("出入库切换时,给输送线写命令数据:{}",allMapJson); |
|
|
|
Boolean inOutSwitBoolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
Boolean inOutSwitBoolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
log.info("出入库切换时,写入的命令返回结果:" + inOutSwitBoolean.toString()); |
|
|
|
log.info("出入库切换时,写入的命令返回结果:"+inOutSwitBoolean.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("dpsRealTimeTask:" + e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void dpjRealTimeTask(List<WcsPlcProperty> propertyList, Map<String, Object> pointMap, PLCReadAndWrite plcReadAndWrite, PlcOperate plcOperate) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 叠盘机 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
//叠盘机完成
|
|
|
|
|
|
|
|
String dpj = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//叠盘机返回
|
|
|
|
|
|
|
|
String retDpj = ""; |
|
|
|
|
|
|
|
String retDpjVt = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (WcsPlcProperty plcProperty : propertyList) { |
|
|
|
|
|
|
|
String pointType = plcProperty.getPointType(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pointType.equals("dpj")) { |
|
|
|
|
|
|
|
dpj = plcProperty.getAddress(); |
|
|
|
|
|
|
|
} else if (pointType.equals("retDpj")) { |
|
|
|
|
|
|
|
retDpj = plcProperty.getAddress(); |
|
|
|
|
|
|
|
retDpjVt = plcProperty.getValueType(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//叠盘机
|
|
|
|
//叠盘机
|
|
|
|
if (pointMap.containsKey(dpj) && !pointMap.get(dpj).equals("0")) { |
|
|
|
if (pointMap.containsKey(stk) && Boolean.valueOf(pointMap.get(stk).toString())) { |
|
|
|
WcsIncomingTaskRequestBody body = new WcsIncomingTaskRequestBody(); |
|
|
|
WcsIncomingTaskRequestBody body = new WcsIncomingTaskRequestBody(); |
|
|
|
body.setStation("SC-G2-00-00-2003"); |
|
|
|
body.setStation("叠盘机点位"); |
|
|
|
body.setTaskType(TaskTypeEnum.In.getValue()); |
|
|
|
body.setTaskType(TaskTypeEnum.In.getValue()); |
|
|
|
body.setTrayCode("TP4077566601"); |
|
|
|
|
|
|
|
body.setBussinessType(BusinTaskTypeEnum.stockIn.getValue()); |
|
|
|
body.setBussinessType(BusinTaskTypeEnum.stockIn.getValue()); |
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
body.setCreateDt(new Date().toString()); |
|
|
|
//调用agv接口查询库区状态
|
|
|
|
//调用agv接口查询库区状态
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
Object[] areaStatus = {}; |
|
|
|
map1.put("areaInLocation", "SC-A2"); |
|
|
|
|
|
|
|
map1.put("status", 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
|
|
|
map2.put("areaInLocation", "SC-B2"); |
|
|
|
|
|
|
|
map2.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map3 = new HashMap<>(); |
|
|
|
|
|
|
|
map1.put("areaInLocation", "SC-C2"); |
|
|
|
|
|
|
|
map1.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map4 = new HashMap<>(); |
|
|
|
|
|
|
|
map2.put("areaInLocation", "SC-D2"); |
|
|
|
|
|
|
|
map2.put("status", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object[] areaStatus = new Object[] { map1,map2,map3,map4}; |
|
|
|
|
|
|
|
log.info("每个库区的状态:"+Arrays.toString(areaStatus)); |
|
|
|
|
|
|
|
body.setAreaStatus(areaStatus); |
|
|
|
body.setAreaStatus(areaStatus); |
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(body); |
|
|
|
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(body); |
|
|
|
log.info("叠盘机满入库任务申请WZ-WCS返回:" + vo.getHeader()); |
|
|
|
log.info("空托申请wz-wcs返回:" + vo.getHeader()); |
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
|
|
|
|
|
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
if (Result.isOk(vo.getHeader().getMsgCode())) { |
|
|
|
reqMap.put(retDpjVt, 1); |
|
|
|
reqMap.put(retStkVt,1); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
reqMap.put(retDpjVt, 2); |
|
|
|
reqMap.put(retStkVt,0); |
|
|
|
} |
|
|
|
} |
|
|
|
allMap.put(retDpj, reqMap); |
|
|
|
allMap.put(retStk, reqMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
log.info("叠盘机叠满上报时,给输送线写命令数据:{}", allMapJson); |
|
|
|
log.info("叠盘机叠满上报时,给输送线写命令数据:{}",allMapJson); |
|
|
|
Boolean bCR01Boolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
Boolean bCR01Boolean = plcReadAndWrite.execWrite(plcOperate, allMapJson); |
|
|
|
log.info("叠盘机叠满上报时,写入的命令返回结果:" + bCR01Boolean.toString()); |
|
|
|
log.info("叠盘机叠满上报时,写入的命令返回结果:"+bCR01Boolean.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
@ -666,31 +471,4 @@ public class PlcEventTask { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 单个的plc写入 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public Boolean plcExecWrite(Integer stk) { |
|
|
|
|
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
|
|
|
|
List<WcsPlcProperty> propertyList = new ArrayList<>(); |
|
|
|
|
|
|
|
propertyList = iWcsPlcPropertyService.getWcsPlcPropertyByPlcId(51L); |
|
|
|
|
|
|
|
if (!propertyList.isEmpty()) { |
|
|
|
|
|
|
|
for (WcsPlcProperty wcsPlcProperty : propertyList) { |
|
|
|
|
|
|
|
if (wcsPlcProperty.getPointType().equals("retStk")) { |
|
|
|
|
|
|
|
String valueType = wcsPlcProperty.getValueType(); |
|
|
|
|
|
|
|
String address = wcsPlcProperty.getAddress(); |
|
|
|
|
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
|
|
|
|
Map<String, Integer> reqMap = new HashMap<>(1); |
|
|
|
|
|
|
|
reqMap.put(valueType, stk); |
|
|
|
|
|
|
|
allMap.put(address, reqMap); |
|
|
|
|
|
|
|
String allMapJson = JsonUtil.toJSONString(allMap); |
|
|
|
|
|
|
|
log.info("叠盘机叠满上报时,给输送线写命令数据:{}", allMapJson); |
|
|
|
|
|
|
|
Boolean bCR01Boolean = plcReadAndWrite.execWrite(plcInit.getPlcOperate_dps(), allMapJson); |
|
|
|
|
|
|
|
log.info("叠盘机叠满上报时,写入的命令返回结果:" + bCR01Boolean.toString()); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|