fix 信号写入

This commit is contained in:
USER-20220102CG\noblelift
2023-05-29 09:12:08 +08:00
parent 697df0c844
commit 8fe8c27929
5 changed files with 47 additions and 9 deletions

View File

@@ -27,6 +27,7 @@ import org.nl.acs.opc.DeviceType;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@@ -40,6 +41,7 @@ import java.util.Map;
public class MagicAgvServiceImpl implements MagicAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
@Lazy
private final AcsToWmsService acsToWmsService;

View File

@@ -28,6 +28,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@@ -41,6 +42,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
@Lazy
private final AcsToWmsService acsToWmsService;
private final DeviceExecuteLogService logServer;

View File

@@ -21,6 +21,7 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceType;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@@ -34,6 +35,7 @@ import java.util.Map;
public class XianGongAgvServiceImpl implements XianGongAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
@Lazy
private final AcsToWmsService acsToWmsService;
Map<String, AgvDto> AGVDeviceStatus = new HashMap();

View File

@@ -17,6 +17,7 @@ import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver;
@@ -334,7 +335,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
if (move > 0 && !requireSucess) {
instruction_require();
}
break;
case 4:
//申请捆扎
@@ -748,6 +748,16 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
map3.put("value", "1");
list.add(map3);
this.writing(list);
while(!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer()+"."+this.getOpcPlc()+"."+this.getDevice_code()+".task").toString()
,instdto.getInstruction_code())){
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list);
// message = "重新下发电气信号";
@@ -780,10 +790,20 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
map3.put("value", "1");
list.add(map3);
this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) {
while(!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer()+"."+this.getOpcPlc()+"."+this.getDevice_code()+".task").toString()
,inst.getInstruction_code())){
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list);
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
// }
}
return true;
}

View File

@@ -340,10 +340,10 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
map.put("code", "to_target");
map.put("value", "0");
list.add(map);
Map map2 = new HashMap();
map2.put("code", "to_task");
map2.put("value", "0");
list.add(map2);
// Map map2 = new HashMap();
// map2.put("code", "to_task");
// map2.put("value", "0");
// list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_command");
map3.put("value", "0");
@@ -648,12 +648,16 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
list.add(map);
Map map2 = new HashMap();
map2.put("code", "to_task");
map2.put("value", inst.getInstruction_code());
map2.put("value", "0");
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_command");
map3.put("value", "1");
list.add(map3);
Map map4 = new HashMap();
map2.put("code", "to_task");
map2.put("value", inst.getInstruction_code());
list.add(map4);
this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) {
this.writing(list);
@@ -755,12 +759,16 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
list.add(map);
Map map2 = new HashMap();
map2.put("code", "to_task");
map2.put("value", instdto.getInstruction_code());
map2.put("value", "0");
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_command");
map3.put("value", "1");
list.add(map3);
Map map4 = new HashMap();
map2.put("code", "to_task");
map2.put("value", inst.getInstruction_code());
list.add(map4);
this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) {
this.writing(list);
@@ -784,12 +792,16 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
list.add(map);
Map map2 = new HashMap();
map2.put("code", "to_task");
map2.put("value", inst.getInstruction_code());
map2.put("value", "0");
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_command");
map3.put("value", "1");
list.add(map3);
Map map4 = new HashMap();
map2.put("code", "to_task");
map2.put("value", inst.getInstruction_code());
list.add(map4);
this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) {
this.writing(list);