Browse Source

add:增加自动门交互日志

master
龚宝雄 3 weeks ago
parent
commit
a7cdf38ff4
  1. 17
      acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  2. 45
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  3. 7
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutoDoorDeviceDriver.java
  4. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java
  5. 20
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

17
acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -195,11 +195,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//电梯开门
}else if (phase == 0x50 && (agvaddr == 2421 || agvaddr == 2422 || agvaddr == 2423)) {
if (SocketUtil.checkConnect(agvaddr, (byte) 0X0A)) {
log.info("agv车号为"+carno+"接收到电梯开门信号");
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
//电梯关门
}else if (phase == 0x51 && (agvaddr == 2421 || agvaddr == 2422 || agvaddr == 2423)) {
if (SocketUtil.checkConnect(agvaddr, (byte) 0X00)) {
log.info("agv车号为"+carno+"接收到电梯关门信号");
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
} else if (phase == 0x50) {//进入区域
@ -224,22 +226,25 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) {
StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver();
log.info("agv车号为"+carno+",进入自动门:"+device_code+"区域,请求开门中");
if (driver.getMode() != 0) {
flag = true;
} else {
String message = "自动门未联机,无法开门。";
driver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
log.error("agv车号为"+carno+",进入自动门区域:"+"自动门:"+device_code+"未联机,无法开门。");
}
if (flag) {
driver.writing(1);
driver.setMessage("");
log.info("agv车号为"+carno+",进入自动门区域"+"自动门:"+device_code+"已联机,允许开门。");
logServer.deviceExecuteLog(device_code, "", "", "允许开门。");
}
log.info("自动门:"+device_code+"开门的action的值此时为:"+driver.getAction()+"该值应为1");
if (driver.getAction() == 1) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("自动门:"+device_code+"返回开门到位,"+"agv车号为"+carno+",进入自动门。");
}
} else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) {
StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver();
@ -269,23 +274,25 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) {
StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver();
log.info("agv车号为"+carno+",准备离开自动门:"+device_code+"区域,请求关门中");
if (driver.getMode() != 0) {
flag = true;
} else {
String message = "自动门未联机,无法关门。";
log.error("agv车号为"+carno+",准备离开自动门区域:"+"自动门:"+device_code+"未联机,无法关门。");
driver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
log.info("自动门:"+device_code+"关门的action的值此时为:"+driver.getAction()+"该值应为0");
if (flag) {
driver.writing(2);
driver.setMessage("");
log.info("自动门:"+device_code+"工作模式正常,"+"agv车号为"+carno+",写入关门信号2,准备离开自动门。");
logServer.deviceExecuteLog(device_code, "", "", "允许关门。");
}
//百济没有2已关,0就当作已关门
if (driver.getAction() == 0) {
log.info("自动门:"+device_code+"接收到agv写入2信号,返回action信号为0,交互成功,"+"agv车号为"+carno+",离开自动门。");
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
} else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) {

45
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -169,10 +169,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
return;
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
StandardOrdinarySiteDeviceDriver driver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if ("true".equals(device.getExtraValue().get("wait"))
&& !inst.getTask_code().startsWith("-")
&& "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) {
@ -181,13 +179,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 1);
form.put("device_code", device_code);
form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,开始反馈wcs...");
JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{
add(form);
}});
if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs成功,运行取货");
wcsFlag = true;
} else {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs返回异常,不允许取货,返回信息:"+result);
String resultMessage = result.getString("message");
this.message = resultMessage;
String message = resultMessage + "不允许AGV取货。";
@ -206,13 +206,16 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 1);
form.put("device_code", device_code);
form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,开始反馈wcs...");
JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
add(form);
}});
if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs成功,运行取货");
wmsFlag = true;
} else {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs返回异常,不允许取货,返回信息:"+result);
String resultMessage = result.getString("message");
this.message = resultMessage;
String message = resultMessage + "不允许AGV取货。";
@ -245,12 +248,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("device_code", device_code);
form.put("task_code", inst.getTask_code());
JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
add(form);
}});
add(form);}
});
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,开始反馈wcs...");
if (20000 == result.getIntValue("code")) {
flag = true;
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs成功,运行取货");
} else {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs返回异常,不允许取货,返回信息:"+result);
String resultMessage = result.getString("message");
this.message = resultMessage;
String message = resultMessage + "不允许AGV取货。";
@ -384,23 +389,26 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 2);
form.put("device_code", device_code);
form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv取货完成,开始反馈wcs...");
JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{
add(form);
}});
if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv取货完成,反馈wcs成功");
wcsFlag = true;
} else {
log.info(device_code+":feedWcsAgvTaskStatus - agv取货完成,反馈wcs返回异常,不允许离开,返回信息:"+result);
String resultMessage = result.getString("message");
this.message = resultMessage;
String message = resultMessage + "不允许AGV取货后离开。";
log.info("agv到达取货点,不允许AGV取货后离开。");
driver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
} else {
wcsFlag = true;
}
// if ("true".equals(device.getExtraValue().get("reqWms"))
// && !inst.getTask_code().startsWith("-")
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) {
@ -425,7 +433,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
// } else {
wmsFlag = true;
// }
if (wcsFlag && wmsFlag) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
this.message = "";
@ -436,7 +443,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
// if (driver.getMode() != 0
// && driver.getMove() == 0) {
// if (!inst.getTask_code().startsWith("-")
@ -476,7 +482,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
// driver.setMessage(message);
// logServer.deviceExecuteLog(device_code, "", "", message);
// }
if (flag) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
this.message = "";
@ -548,6 +553,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
log.info(this.device_code+"agv地址参数有误,phase:" + phase);
return;
}
if (agvaddr != 0) {
@ -584,23 +590,24 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 3);
form.put("device_code", device_code);
form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv到达放货点,开始反馈wcs...");
JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{
add(form);
}});
if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达放货点,反馈wcs成功,运行放货");
wcsFlag = true;
} else {
String resultMessage = result.getString("message");
this.message = resultMessage;
String message = resultMessage + "不允许AGV放货。";
log.info(device_code+":feedWcsAgvTaskStatus - agv到达放货点,反馈wcs返回异常,不允许放货,返回信息:"+result);
driver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
} else {
wcsFlag = true;
}
// if ("true".equals(device.getExtraValue().get("reqWms"))
// && !inst.getTask_code().startsWith("-")
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) {
@ -625,7 +632,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
// } else {
wmsFlag = true;
// }
if (wcsFlag && wmsFlag) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
this.message = "";
@ -636,9 +642,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (driver.getMode() != 0
&& driver.getMove() == 0) {
if (driver.getMode() != 0 && driver.getMove() == 0) {
// if (!inst.getTask_code().startsWith("-")
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())
// && "true".equals(device.getExtraValue().get("reqWms"))) {
@ -667,9 +671,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
String message = "";
if (driver.getMode() == 0) {
message += "站点未联机,";
log.info(device_code+":站点未联机,不允许AGV放货。");
} else {
if (driver.getMove() != 0) {
message += "站点有货,";
log.info(device_code+":站点有货,不允许AGV放货。");
}
}
message += "不允许AGV放货。";
@ -776,23 +782,25 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 4);
form.put("device_code", device_code);
form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv放货完成,开始反馈wcs...");
JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{
add(form);
}});
if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv放货完成,反馈wcs成功,运行离开");
wcsFlag = true;
} else {
String resultMessage = result.getString("message");
this.message = resultMessage;
String message = resultMessage + "不允许AGV放货后离开。";
driver.setMessage(message);
log.info(device_code+":feedWcsAgvTaskStatus - agv放货完成,反馈wcs返回异常,不允许离开,返回信息:"+result);
logServer.deviceExecuteLog(device_code, "", "", message);
}
} else {
wcsFlag = true;
}
// if ("true".equals(device.getExtraValue().get("reqWms"))
// && !inst.getTask_code().startsWith("-")
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) {
@ -817,7 +825,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
// } else {
wmsFlag = true;
// }
if (wcsFlag && wmsFlag) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
this.message = "";
@ -828,7 +835,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (driver.getMode() != 0
&& driver.getMove() != 0) {
// if (!inst.getTask_code().startsWith("-")
@ -931,7 +937,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
wcsFlag = false;
}
}
if (flag) {
this.device_status = "IDLE";
this.inst = null;

7
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutoDoorDeviceDriver.java

@ -130,16 +130,13 @@ public class StandardAutoDoorDeviceDriver extends AbstractOpcDeviceDriver implem
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
server.disconnect();
log.info("下发PLC信号:{},{}", to_command, command);
System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
log.info("自动门"+devicecode+"下发PLC信号:"+to_command+"值为:"+command);
//System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
}
public synchronized void OpenOrClose(String type) {

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java

@ -74,7 +74,7 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
//log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + "信号量同步异常,读取不到该plc数据项!");
setIsonline(false);
} else {
setIsonline(true);

20
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -135,19 +135,23 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
hasGoods = this.itemProtocol.getMove();
if (devicecode.contains("F2TBJ")) {
if (move != last_move) {
log.info(this.devicecode + ",检测到货位信号的值由" + last_move + "->" + move);
log.info(this.devicecode + ",二楼检测到货位信号的值由" + last_move + "->" + move);
}
if (mode != last_mode) {
log.info(this.devicecode + ",检测到货位工作模式的值由" + last_mode + "->" + mode);
log.info(this.devicecode + ",二楼检测到工作模式的值由" + last_mode + "->" + mode);
}
}
if (move != last_move) {
this.requireSucess = false;
log.info(this.devicecode + ",检测到货位信号值由" + last_move + "->" + move);
}
if (mode != last_mode) {
log.info(this.devicecode + ",检测到工作模式的值由" + last_mode + "->" + mode);
}
} catch (Exception var17) {
log.error(this.devicecode +"mode:"+last_mode + "->" + mode + "move:"+last_move + "->" + move+"执行点位同步出现异常");
return;
}
if (!this.itemProtocol.getIsonline()) {
this.setIsonline(false);
this.setIserror(true);
@ -170,15 +174,15 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
return;
// case 1:
// log.debug("设备运转模式:等待工作");
// return;
case 2:
if (!requireSucess) {
JSONObject param = new JSONObject();
param.put("device_code", this.devicecode);
param.put("is_have", this.move);
log.info(this.devicecode + "检测到货位光电信号变动,开始反馈WMS");
log.info(this.devicecode + ",检测到货位信号的值由" + last_move + "->" + move+",开始反馈WMS...");
this.shipDeviceUpdate(param);
}
}
@ -342,7 +346,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
JSONObject response = acsToWmsService.shipDeviceUpdate(param);
// if (20000 == response.getIntValue("code")) {
this.requireSucess = true;
log.info(this.devicecode + "检测到货位光电信号变动,反馈WMS成功!");
log.info(this.devicecode + "反馈WMS光电信号成功!");
// }
}
}

Loading…
Cancel
Save