|
@ -43,15 +43,15 @@ import java.util.Map; |
|
|
@RequiredArgsConstructor |
|
|
@RequiredArgsConstructor |
|
|
public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { |
|
|
public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { |
|
|
protected ItemProtocol itemProtocol = new ItemProtocol(this); |
|
|
protected ItemProtocol itemProtocol = new ItemProtocol(this); |
|
|
@Autowired |
|
|
|
|
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); |
|
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); |
|
|
@Autowired |
|
|
|
|
|
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); |
|
|
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); |
|
|
@Autowired |
|
|
|
|
|
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); |
|
|
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); |
|
|
@Autowired |
|
|
|
|
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); |
|
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); |
|
|
@Autowired |
|
|
|
|
|
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); |
|
|
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); |
|
|
String container; |
|
|
String container; |
|
|
String container_type_desc; |
|
|
String container_type_desc; |
|
@ -160,9 +160,22 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive |
|
|
private String last_product_specifications; |
|
|
private String last_product_specifications; |
|
|
|
|
|
|
|
|
// 时间
|
|
|
// 时间
|
|
|
|
|
|
private String year; |
|
|
|
|
|
private String last_year; |
|
|
|
|
|
private String month; |
|
|
|
|
|
private String last_month; |
|
|
|
|
|
private String day; |
|
|
|
|
|
private String last_day; |
|
|
|
|
|
private String hour; |
|
|
|
|
|
private String last_hour; |
|
|
|
|
|
private String minute; |
|
|
|
|
|
private String last_minute; |
|
|
|
|
|
private String second; |
|
|
|
|
|
private String last_second; |
|
|
private String time; |
|
|
private String time; |
|
|
private String last_time; |
|
|
private String last_time; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Device getDevice() { |
|
|
public Device getDevice() { |
|
|
return this.device; |
|
|
return this.device; |
|
@ -174,16 +187,18 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive |
|
|
String message = null; |
|
|
String message = null; |
|
|
try { |
|
|
try { |
|
|
String device_code = this.getDeviceCode(); |
|
|
String device_code = this.getDeviceCode(); |
|
|
mode = this.itemProtocol.getMode(); |
|
|
|
|
|
error = this.itemProtocol.getError(); |
|
|
|
|
|
move = this.itemProtocol.getMove(); |
|
|
|
|
|
task = this.itemProtocol.getTask(); |
|
|
|
|
|
hasGoods = this.itemProtocol.getMove(); |
|
|
|
|
|
weight = this.itemProtocol.getWeight(); |
|
|
weight = this.itemProtocol.getWeight(); |
|
|
product_code = this.itemProtocol.getProductCode(); |
|
|
product_code = this.itemProtocol.getProductCode(); |
|
|
batch_code = this.itemProtocol.getBatchCode(); |
|
|
batch_code = this.itemProtocol.getBatchCode(); |
|
|
product_specifications = this.itemProtocol.getProductSpecifications(); |
|
|
product_specifications = this.itemProtocol.getProductSpecifications(); |
|
|
time = this.itemProtocol.getTime(); |
|
|
year = this.itemProtocol.getYear(); |
|
|
|
|
|
month = this.itemProtocol.getMonth(); |
|
|
|
|
|
day = this.itemProtocol.getDay(); |
|
|
|
|
|
hour = this.itemProtocol.getHour(); |
|
|
|
|
|
minute = this.itemProtocol.getMinute(); |
|
|
|
|
|
second = this.itemProtocol.getSecond(); |
|
|
|
|
|
time= new StringBuilder().append(year).append(month).append(day) |
|
|
|
|
|
.append(hour).append(minute).append(second).toString(); |
|
|
|
|
|
|
|
|
if (mode != last_mode) { |
|
|
if (mode != last_mode) { |
|
|
if (mode == 5) { |
|
|
if (mode == 5) { |
|
@ -342,17 +357,6 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
switch (flag) { |
|
|
|
|
|
//取货完成
|
|
|
|
|
|
case 1: |
|
|
|
|
|
writing(2); |
|
|
|
|
|
return; |
|
|
|
|
|
//放货完成
|
|
|
|
|
|
case 2: |
|
|
|
|
|
writing(3); |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
last_mode = mode; |
|
|
last_mode = mode; |
|
@ -363,8 +367,15 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive |
|
|
last_product_code = product_code; |
|
|
last_product_code = product_code; |
|
|
last_product_specifications = product_specifications; |
|
|
last_product_specifications = product_specifications; |
|
|
last_batch_code = batch_code; |
|
|
last_batch_code = batch_code; |
|
|
|
|
|
last_year = year; |
|
|
|
|
|
last_month = month; |
|
|
|
|
|
last_day = day; |
|
|
|
|
|
last_hour = hour; |
|
|
|
|
|
last_minute = minute; |
|
|
|
|
|
last_second = second; |
|
|
last_time = time; |
|
|
last_time = time; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -397,70 +408,11 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected void executing(Instruction instruction) { |
|
|
|
|
|
this.executing(1, instruction, ""); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void executing(int command, Instruction instruction, String appendMessage) { |
|
|
|
|
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() |
|
|
|
|
|
+ "." + ItemProtocol.item_to_command; |
|
|
|
|
|
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() |
|
|
|
|
|
+ "." + ItemProtocol.item_to_target; |
|
|
|
|
|
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() |
|
|
|
|
|
+ "." + ItemProtocol.item_to_task; |
|
|
|
|
|
if (appendMessage == null) { |
|
|
|
|
|
appendMessage = ""; |
|
|
|
|
|
} |
|
|
|
|
|
if (instruction != null) { |
|
|
|
|
|
instruction_num = Integer.parseInt(instruction.getInstruction_code()); |
|
|
|
|
|
} |
|
|
|
|
|
String opcservcerid = this.getDevice().getOpc_server_id(); |
|
|
|
|
|
Server server = ReadUtil.getServer(opcservcerid); |
|
|
|
|
|
Map<String, Object> itemMap = new HashMap<String, Object>(); |
|
|
|
|
|
itemMap.put(to_command, 1); |
|
|
|
|
|
itemMap.put(to_task, instruction_num); |
|
|
|
|
|
ReadUtil.write(itemMap, server); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void executing(Server server, Map<String, Object> itemMap) { |
|
|
public void executing(Server server, Map<String, Object> itemMap) { |
|
|
ReadUtil.write(itemMap, server); |
|
|
ReadUtil.write(itemMap, server); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void writing(int type, int command) { |
|
|
|
|
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() |
|
|
|
|
|
+ "." + ItemProtocol.item_to_command; |
|
|
|
|
|
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() |
|
|
|
|
|
+ "." + ItemProtocol.item_to_target; |
|
|
|
|
|
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() |
|
|
|
|
|
+ "." + ItemProtocol.item_to_task; |
|
|
|
|
|
String opcservcerid = this.getDevice().getOpc_server_id(); |
|
|
|
|
|
Server server = ReadUtil.getServer(opcservcerid); |
|
|
|
|
|
Map<String, Object> itemMap = new HashMap<String, Object>(); |
|
|
|
|
|
if (type == 1) { |
|
|
|
|
|
itemMap.put(to_command, command); |
|
|
|
|
|
} else if (type == 2) { |
|
|
|
|
|
itemMap.put(to_target, command); |
|
|
|
|
|
|
|
|
|
|
|
} else if (type == 3) { |
|
|
|
|
|
itemMap.put(to_task, command); |
|
|
|
|
|
} |
|
|
|
|
|
ReadUtil.write(itemMap, server); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean instruction_require(String container_code) { |
|
|
public boolean instruction_require(String container_code) { |
|
|
return instruction_require(container_code, WcsConfig.task_container_type_default_desc); |
|
|
return instruction_require(container_code, WcsConfig.task_container_type_default_desc); |
|
|
} |
|
|
} |
|
|