psh 1 year ago
parent
commit
c9b0f495dd
  1. 10
      acs/hd/nladmin-system/pom.xml
  2. 94
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java
  3. 114
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java
  4. 2
      lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendmaterial/wql/PDA_SENDMATERIAL_01.wql

10
acs/hd/nladmin-system/pom.xml

@ -20,11 +20,11 @@
</properties> </properties>
<dependencies> <dependencies>
<!-- <dependency>--> <dependency>
<!-- <groupId>org.bouncycastle</groupId>--> <groupId>org.bouncycastle</groupId>
<!-- <artifactId>bcprov-jdk15on</artifactId>--> <artifactId>bcprov-jdk15on</artifactId>
<!-- <version>1.50</version>--> <version>1.50</version>
<!-- </dependency>--> </dependency>
<dependency> <dependency>
<groupId>net.logstash.logback</groupId> <groupId>net.logstash.logback</groupId>

94
acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java

@ -11,21 +11,18 @@ import java.util.List;
@Data @Data
public class ItemProtocol { public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_action = "action";
public static String item_ioaction = "ioaction";
public static String item_error = "error";
public static String item_task = "task";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
public static String item_weight = "weight"; public static String item_weight = "weight";
public static String item_product_code = "product_code"; public static String item_product_code = "product_code";
public static String item_batch_code = "batch_code"; public static String item_batch_code = "batch_code";
public static String item_product_specifications = "product_specifications"; public static String item_product_specifications = "product_specifications";
public static String item_time = "time"; public static String item_year = "year";
public static String item_month = "month";
public static String item_day = "day";
public static String item_hour = "hour";
public static String item_minute = "minute";
public static String item_second = "second";
private StandardInspectSiteSmartDeviceDriver driver; private StandardInspectSiteSmartDeviceDriver driver;
@ -33,30 +30,6 @@ public class ItemProtocol {
this.driver = driver; this.driver = driver;
} }
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getIoaction() {
return this.getOpcIntegerValue(item_ioaction);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public String getWeight() { public String getWeight() {
return this.getOpcStringValue(item_weight); return this.getOpcStringValue(item_weight);
} }
@ -73,23 +46,32 @@ public class ItemProtocol {
return this.getOpcStringValue(item_product_specifications); return this.getOpcStringValue(item_product_specifications);
} }
public String getTime() { public String getYear() {
return this.getOpcStringValue(item_time); return this.getOpcStringValue(item_year);
}
public String getMonth() {
return this.getOpcStringValue(item_month);
} }
public String getDay() {
return this.getOpcStringValue(item_day);
}
public int getToCommand() { public String getHour() {
return this.getOpcIntegerValue(item_to_command); return this.getOpcStringValue(item_hour);
} }
public int getToTarget() { public String getMinute() {
return this.getOpcIntegerValue(item_to_target); return this.getOpcStringValue(item_minute);
} }
public int getToTask() { public String getSecond() {
return this.getOpcIntegerValue(item_to_task); return this.getOpcStringValue(item_second);
} }
//是否有货 //是否有货
public int hasGoods(int move) { public int hasGoods(int move) {
return move; return move;
@ -123,25 +105,23 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() { public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "VW0")); list.add(new ItemDto(item_product_code, "产品名称", "VB3251 "));
list.add(new ItemDto(item_mode, "工作状态", "VW2", Boolean.valueOf(true))); list.add(new ItemDto(item_batch_code, "批次号", "VB3264"));
list.add(new ItemDto(item_move, "光电开关信号", "VW4")); list.add(new ItemDto(item_product_specifications, "产品规格", "VB3277"));
list.add(new ItemDto(item_action, "动作信号", "VW8")); list.add(new ItemDto(item_weight, "重量", "VD380"));
list.add(new ItemDto(item_error, "报警信号", "VW12")); list.add(new ItemDto(item_year, "年", "VB1056"));
list.add(new ItemDto(item_task, "任务号", "VD14")); list.add(new ItemDto(item_month, "月", "VB1057"));
list.add(new ItemDto(item_product_code, "产品名称", "VW18")); list.add(new ItemDto(item_day, "日", "VB1058"));
list.add(new ItemDto(item_batch_code, "批次号", "VW20", Boolean.valueOf(true))); list.add(new ItemDto(item_hour, "时", "VB1059"));
list.add(new ItemDto(item_product_specifications, "产品规格", "VW40")); list.add(new ItemDto(item_minute, "分", "VB1060"));
list.add(new ItemDto(item_weight, "重量", "VW50")); list.add(new ItemDto(item_second, "秒", "VB1061"));
list.add(new ItemDto(item_time, "时间", "VW60"));
return list; return list;
} }
public static List<ItemDto> getWriteableItemDtos() { public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "VW52", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_target, "目标站", "VW54"));
list.add(new ItemDto(item_to_task, "任务号", "VD58"));
return list; return list;
} }

114
acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java

@ -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);
} }

2
lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendmaterial/wql/PDA_SENDMATERIAL_01.wql

@ -90,7 +90,7 @@
ON ON
p.point_code = s.struct_code p.point_code = s.struct_code
WHERE WHERE
p.is_used = '1' p.is_used = '1' and p.is_delete = '0'
OPTION 输入.region_id <> "" OPTION 输入.region_id <> ""
p.region_id = 输入.region_id p.region_id = 输入.region_id
ENDOPTION ENDOPTION

Loading…
Cancel
Save