GX
This commit is contained in:
@@ -4,7 +4,6 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
@@ -118,7 +117,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
if (mode != last_mode) {
|
||||
if (mode == 2){
|
||||
if (mode == 2) {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||
@@ -156,8 +155,8 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
TaskDto taskDto = taskserver.findByCode(inst1.getTask_code());
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("task_id",taskDto.getExt_task_id());
|
||||
map.put("task_status","1");
|
||||
map.put("task_id", taskDto.getExt_task_id());
|
||||
map.put("task_status", "1");
|
||||
array.add(map);
|
||||
acsToWmsService.feedbackTaskStatusToWms(array);
|
||||
}
|
||||
@@ -167,13 +166,13 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
//申请取货 判断取货位是否有货 有货就下发允许取货命令
|
||||
if (mode == 3 && action == 1 && move == 0 && task > 0) {
|
||||
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (ObjectUtil.isNotEmpty(inst2)){
|
||||
if (ObjectUtil.isNotEmpty(inst2)) {
|
||||
String start_device_code = inst2.getStart_device_code();
|
||||
Device device = appService.findDeviceByCode(start_device_code);
|
||||
HfStationDeviceDriver hfStationDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HfStationDeviceDriver){
|
||||
if (device.getDeviceDriver() instanceof HfStationDeviceDriver) {
|
||||
hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver();
|
||||
if (hfStationDeviceDriver.getMove() == 1){
|
||||
if (hfStationDeviceDriver.getMove() == 1) {
|
||||
this.writing("to_command", "2");
|
||||
}
|
||||
}
|
||||
@@ -182,23 +181,8 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
//行架机械手取货时校验条码 校验失败,取消任务
|
||||
if (mode == 4 && action == 1 && move == 0 && task > 0) {
|
||||
try {
|
||||
Instruction instructionDto = instructionService.findByCode(String.valueOf(task));
|
||||
if (ObjectUtil.isNotEmpty(instructionDto)) {
|
||||
// TODO 校验失败我是取消指令还是完成指令
|
||||
instructionService.cancel(instructionDto.getInstruction_id());
|
||||
//taskserver.cancel(instructionDto.getTask_id());
|
||||
// TaskDto taskDto = taskserver.findByCode(instructionDto.getTask_code());
|
||||
// JSONArray array = new JSONArray();
|
||||
// JSONObject map = new JSONObject();
|
||||
// map.put("task_id",taskDto.getExt_task_id());
|
||||
// map.put("task_status","3");
|
||||
// array.add(map);
|
||||
// acsToWmsService.feedbackTaskStatusToWms(array);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Instruction instructionDto = instructionService.findByCode(String.valueOf(task));
|
||||
instructionService.cancel(instructionDto.getInstruction_id());
|
||||
this.writing("to_command", "4");
|
||||
this.writing("to_onset", "0");
|
||||
this.writing("to_target", "0");
|
||||
@@ -236,15 +220,15 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
Device device = appService.findDeviceByCode(next_device_code);
|
||||
HfStationDeviceDriver hfStationDeviceDriver;
|
||||
String current_num = "";
|
||||
if (device.getDeviceDriver() instanceof HfStationDeviceDriver){
|
||||
if (device.getDeviceDriver() instanceof HfStationDeviceDriver) {
|
||||
hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver();
|
||||
current_num = String.valueOf(hfStationDeviceDriver.getCurrent_order_num());
|
||||
}
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("task_id",taskDto.getExt_task_id());
|
||||
map.put("task_status","2");
|
||||
map.put("material_num",current_num);
|
||||
map.put("task_id", taskDto.getExt_task_id());
|
||||
map.put("task_status", "2");
|
||||
map.put("material_num", current_num);
|
||||
array.add(map);
|
||||
acsToWmsService.feedbackTaskStatusToWms(array);
|
||||
this.writing("to_command2", "0");
|
||||
@@ -316,11 +300,28 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
TaskDto task = null;
|
||||
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||
String startDeviceCode = getDeviceCodeList.get(i);
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
task = taskDtoList.get(0);
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtos)){
|
||||
TaskDto taskDto = taskDtos.get(0);
|
||||
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
|
||||
instruction.setInstruction_status("1");
|
||||
instruction.setUpdate_time(DateUtil.now());
|
||||
instructionService.update(instruction);
|
||||
int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
|
||||
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
|
||||
writing("to_onset", String.valueOf(start_addrIndex));
|
||||
writing("to_target", String.valueOf(next_addrIndex));
|
||||
writing("to_task", instruction.getInstruction_code());
|
||||
writing("to_command", "1");
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
}else {
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
task = taskDtoList.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
String taskid = task.getTask_id();
|
||||
@@ -350,7 +351,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status("1");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
|
||||
try {
|
||||
|
||||
@@ -99,22 +99,22 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "DB1.B2"));
|
||||
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB2.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB2.B1"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "DB2.B2"));
|
||||
list.add(new ItemDto(item_action, "动作信号", "DB2.B3"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB2.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB2.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB2.D6"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0"));
|
||||
list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2"));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4"));
|
||||
list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6"));
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB3.W0"));
|
||||
list.add(new ItemDto(item_to_onset, "下发起始站", "DB3.W2"));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB3.W4"));
|
||||
list.add(new ItemDto(item_to_task, "下发任务号", "DB3.D6"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,9 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
//条码
|
||||
String barcode = "0";
|
||||
String last_barcode = "0";
|
||||
//重量
|
||||
int weight = 0;
|
||||
int last_weight = 0;
|
||||
|
||||
|
||||
Boolean isonline = true;
|
||||
@@ -178,6 +181,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
status = this.itemProtocol.getStatus();
|
||||
current_order_num = this.itemProtocol.getCurrent_order_num();
|
||||
barcode = this.itemProtocol.getBarcode();
|
||||
weight = this.itemProtocol.getWeight();
|
||||
material_code = this.itemProtocol.getMaterial_code();
|
||||
order = this.itemProtocol.getOrder();
|
||||
|
||||
@@ -220,6 +224,10 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
logServer.deviceItemValue(this.device_code, "current_order_num", String.valueOf(current_order_num));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号current_order_num: " + last_current_order_num + "->" + current_order_num);
|
||||
}
|
||||
if (weight != last_weight) {
|
||||
logServer.deviceItemValue(this.device_code, "weight", String.valueOf(weight));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号weight: " + last_weight + "->" + weight);
|
||||
}
|
||||
if (!order.equals(last_order)) {
|
||||
logServer.deviceItemValue(this.device_code, "order", order);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order:" + last_order + "->" + order);
|
||||
@@ -324,7 +332,8 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
last_current_order_num = current_order_num;
|
||||
last_order = order;
|
||||
last_barcode = barcode;
|
||||
last_material_code = material_code;
|
||||
last_weight = weight;
|
||||
// last_material_code = material_code;
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +352,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findByCode(order);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", device_code);
|
||||
json.put("material_code", material_code);
|
||||
json.put("material_code", dto.getMaterial_code());
|
||||
json.put("ext_order_id", dto.getExt_order_id());
|
||||
json.put("order_code", order);
|
||||
HttpResponse result = acsToWmsService.orderConfirm(json);
|
||||
@@ -438,7 +447,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", device_code);
|
||||
json.put("barcode", barcode);
|
||||
json.put("material_code", material_code);
|
||||
json.put("weight", weight);
|
||||
json.put("create_mode", "2");
|
||||
json.put("is_auto_issue", "0");
|
||||
json.put("type", "2");
|
||||
|
||||
@@ -36,6 +36,8 @@ public class ItemProtocol {
|
||||
public static String item_material_code = "material_code";
|
||||
//条码
|
||||
public static String item_barcode = "barcode";
|
||||
//重量
|
||||
public static String item_weight = "weight";
|
||||
|
||||
|
||||
//下发命令
|
||||
@@ -106,6 +108,10 @@ public class ItemProtocol {
|
||||
return this.getOpcStringValue(item_barcode);
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return this.getOpcIntegerValue(item_weight);
|
||||
}
|
||||
|
||||
public String getMaterial_code() {
|
||||
return this.getOpcStringValue(item_material_code);
|
||||
}
|
||||
@@ -140,30 +146,31 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB4.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB4.B1"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "DB4.B2"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB4.B3"));
|
||||
list.add(new ItemDto(item_ioaction, "进出信号", "DB4.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB4.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB4.D6"));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB4.D7"));
|
||||
list.add(new ItemDto(item_current_order_num, "当前工单数量", "DB4.D8"));
|
||||
list.add(new ItemDto(item_material_code, "产品编号", "DB4.S6"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB4.S7"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB4.S8"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB2.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB2.B1"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "DB2.B2"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB2.B3"));
|
||||
list.add(new ItemDto(item_ioaction, "进出信号", "DB2.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB2.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB2.D6"));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB2.B10"));
|
||||
list.add(new ItemDto(item_current_order_num, "当前工单数量", "DB2.D12"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB2.S16"));
|
||||
list.add(new ItemDto(item_weight, "重量", "DB2.D272"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB2.W276"));
|
||||
list.add(new ItemDto(item_material_code, "产品编号", "DB2.S278"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB5.W0"));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB5.W2"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB5.D4"));
|
||||
list.add(new ItemDto(item_to_error, "故障代码", "DB5.W6"));
|
||||
list.add(new ItemDto(item_to_order_num, "工单数量", "DB5.W8"));
|
||||
list.add(new ItemDto(item_to_product_number, "产品编号", "DB5.S10"));
|
||||
list.add(new ItemDto(item_to_order, "工单号", "DB5.S12"));
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB3.W0"));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB3.W2"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB3.D4"));
|
||||
list.add(new ItemDto(item_to_error, "故障代码", "DB3.B8"));
|
||||
list.add(new ItemDto(item_to_order_num, "工单数量", "DB3.D10"));
|
||||
list.add(new ItemDto(item_to_product_number, "产品编号", "DB3.S14"));
|
||||
list.add(new ItemDto(item_to_order, "工单号", "DB3.S270"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -409,11 +409,28 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
TaskDto task = null;
|
||||
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||
String startDeviceCode = getDeviceCodeList.get(i);
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
task = taskDtoList.get(0);
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtos)){
|
||||
TaskDto taskDto = taskDtos.get(0);
|
||||
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
|
||||
instruction.setInstruction_status("1");
|
||||
instruction.setUpdate_time(DateUtil.now());
|
||||
instructionService.update(instruction);
|
||||
int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
|
||||
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
|
||||
this.writing("to_onset1", String.valueOf(start_addrIndex));
|
||||
this.writing("to_target1", String.valueOf(next_addrIndex));
|
||||
this.writing("to_task1", instruction.getInstruction_code());
|
||||
this.writing("to_command1", "1");
|
||||
requireHeadSucess = true;
|
||||
return true;
|
||||
}else {
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
task = taskDtoList.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
@@ -444,7 +461,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status("1");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
|
||||
try {
|
||||
@@ -488,11 +505,28 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
TaskDto task = null;
|
||||
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||
String startDeviceCode = getDeviceCodeList.get(i);
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
task = taskDtoList.get(0);
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtos)){
|
||||
TaskDto taskDto = taskDtos.get(0);
|
||||
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
|
||||
instruction.setInstruction_status("1");
|
||||
instruction.setUpdate_time(DateUtil.now());
|
||||
instructionService.update(instruction);
|
||||
int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
|
||||
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
|
||||
this.writing("to_onset1", String.valueOf(start_addrIndex));
|
||||
this.writing("to_target1", String.valueOf(next_addrIndex));
|
||||
this.writing("to_task1", instruction.getInstruction_code());
|
||||
this.writing("to_command1", "1");
|
||||
requireHeadSucess = true;
|
||||
return true;
|
||||
}else {
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
task = taskDtoList.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
@@ -523,7 +557,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status("1");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
|
||||
try {
|
||||
|
||||
@@ -137,30 +137,30 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB1.B2"));
|
||||
list.add(new ItemDto(item_move1, "前工位光电信号", "DB1.B3"));
|
||||
list.add(new ItemDto(item_move2, "后工位光电信号", "DB1.B4"));
|
||||
list.add(new ItemDto(item_action1, "前工位动作信号", "DB1.B5"));
|
||||
list.add(new ItemDto(item_action2, "后工位动作信号", "DB1.B6"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B7"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.B8"));
|
||||
list.add(new ItemDto(item_task1, "前工位任务号", "DB1.D10"));
|
||||
list.add(new ItemDto(item_task2, "后工位任务号", "DB1.D14"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB2.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB2.B1"));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB2.B2"));
|
||||
list.add(new ItemDto(item_move1, "前工位光电信号", "DB2.B3"));
|
||||
list.add(new ItemDto(item_move2, "后工位光电信号", "DB2.B4"));
|
||||
list.add(new ItemDto(item_action1, "前工位动作信号", "DB2.B5"));
|
||||
list.add(new ItemDto(item_action2, "后工位动作信号", "DB2.B6"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB2.B7"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB2.B8"));
|
||||
list.add(new ItemDto(item_task1, "前工位任务号", "DB2.D10"));
|
||||
list.add(new ItemDto(item_task2, "后工位任务号", "DB2.D14"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command1, "前工位下发命令", "DB2.W0"));
|
||||
list.add(new ItemDto(item_to_onset1, "前工位下发起始站", "DB2.W2"));
|
||||
list.add(new ItemDto(item_to_target1, "前工位下发目标站", "DB2.W4"));
|
||||
list.add(new ItemDto(item_to_task1, "前工位下发任务号", "DB2.D6"));
|
||||
list.add(new ItemDto(item_to_command2, "后工位下发命令", "DB2.W10"));
|
||||
list.add(new ItemDto(item_to_onset2, "后工位下发起始站", "DB2.W12"));
|
||||
list.add(new ItemDto(item_to_target2, "后工位下发目标站", "DB2.W14"));
|
||||
list.add(new ItemDto(item_to_task2, "后工位下发任务号", "DB2.D16"));
|
||||
list.add(new ItemDto(item_to_command1, "前工位下发命令", "DB3.W0"));
|
||||
list.add(new ItemDto(item_to_onset1, "前工位下发起始站", "DB3.W2"));
|
||||
list.add(new ItemDto(item_to_target1, "前工位下发目标站", "DB3.W4"));
|
||||
list.add(new ItemDto(item_to_task1, "前工位下发任务号", "DB3.D6"));
|
||||
list.add(new ItemDto(item_to_command2, "后工位下发命令", "DB3.W10"));
|
||||
list.add(new ItemDto(item_to_onset2, "后工位下发起始站", "DB3.W12"));
|
||||
list.add(new ItemDto(item_to_target2, "后工位下发目标站", "DB3.W14"));
|
||||
list.add(new ItemDto(item_to_task2, "后工位下发任务号", "DB3.D16"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ public interface InstructionService {
|
||||
*/
|
||||
Instruction findByTaskcode(String code);
|
||||
|
||||
Instruction findByTaskcodeAndStatus(String code);
|
||||
|
||||
/**
|
||||
* 根据任务id查询
|
||||
*
|
||||
|
||||
@@ -228,6 +228,17 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findByTaskcodeAndStatus(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = wo.query("task_code ='" + code + "' and instruction_status = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
return obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findByTaskid(String id, String wherecaluse) {
|
||||
if (!StrUtil.isEmpty(wherecaluse)) {
|
||||
|
||||
@@ -104,6 +104,13 @@ public interface TaskService {
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCode(String device_code);
|
||||
|
||||
/**
|
||||
* 根据设备号和任务状态查询
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
||||
|
||||
/**
|
||||
* 根据关联编号查询非立刻下发的关联任务
|
||||
*/
|
||||
|
||||
@@ -277,6 +277,22 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code) {
|
||||
List<TaskDto> list = new ArrayList<>();
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (task.getStart_device_code().equals(device_code) && StrUtil.equals(task.getTask_status(), "1")) {
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)){
|
||||
list.add(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDto queryTaskByLinkNum(String link_num) {
|
||||
return null;
|
||||
|
||||
@@ -34,63 +34,101 @@ public class TestServiceImpl implements TestService
|
||||
String now = DateUtil.now();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
// for (int i = 1; i <= 12; i++) {
|
||||
// String device_code = "KLZHC";
|
||||
// if (i < 10){
|
||||
// device_code = device_code + "0" + i;
|
||||
// } else {
|
||||
// device_code = device_code + i;
|
||||
// }
|
||||
// DeviceDto dto = new DeviceDto();
|
||||
// dto.setDevice_id(IdUtil.simpleUUID());
|
||||
// dto.setDevice_code(device_code);
|
||||
// dto.setDevice_name(device_code);
|
||||
// dto.setDevice_type("conveyor");
|
||||
// dto.setCreate_by(currentUsername);
|
||||
// dto.setUpdate_by(currentUsername);
|
||||
// dto.setUpdate_time(now);
|
||||
// dto.setCreate_time(now);
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
// wo.insert(json);
|
||||
// }
|
||||
// for (int i = 1; i <= 25; i++) {
|
||||
// String device_code = "KLZC";
|
||||
// if (i < 10){
|
||||
// device_code = device_code + "0" + i;
|
||||
// } else {
|
||||
// device_code = device_code + i;
|
||||
// }
|
||||
// DeviceDto dto = new DeviceDto();
|
||||
// dto.setDevice_id(IdUtil.simpleUUID());
|
||||
// dto.setDevice_code(device_code);
|
||||
// dto.setDevice_name(device_code);
|
||||
// dto.setDevice_type("conveyor");
|
||||
// dto.setCreate_by(currentUsername);
|
||||
// dto.setUpdate_by(currentUsername);
|
||||
// dto.setUpdate_time(now);
|
||||
// dto.setCreate_time(now);
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
// wo.insert(json);
|
||||
// }
|
||||
// for (int i = 1; i <= 25; i++) {
|
||||
// String device_code = "MLZHC";
|
||||
// if (i < 10){
|
||||
// device_code = device_code + "0" + i;
|
||||
// } else {
|
||||
// device_code = device_code + i;
|
||||
// }
|
||||
// DeviceDto dto = new DeviceDto();
|
||||
// dto.setDevice_id(IdUtil.simpleUUID());
|
||||
// dto.setDevice_code(device_code);
|
||||
// dto.setDevice_name(device_code);
|
||||
// dto.setDevice_type("conveyor");
|
||||
// dto.setCreate_by(currentUsername);
|
||||
// dto.setUpdate_by(currentUsername);
|
||||
// dto.setUpdate_time(now);
|
||||
// dto.setCreate_time(now);
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
// wo.insert(json);
|
||||
// }
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
String device_code = "KLZHC";
|
||||
if (i < 10){
|
||||
device_code = device_code + "0" + i;
|
||||
} else {
|
||||
device_code = device_code + i;
|
||||
}
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_id(IdUtil.simpleUUID());
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setDevice_name(device_code);
|
||||
dto.setDevice_type("conveyor");
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
}
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
String device_code = "YLJ";
|
||||
if (i < 10){
|
||||
device_code = device_code + "0" + i;
|
||||
} else {
|
||||
device_code = device_code + i;
|
||||
}
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_id(IdUtil.simpleUUID());
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setDevice_name(device_code);
|
||||
dto.setDevice_type("conveyor");
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
}
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
String device_code = "HNJ";
|
||||
if (i < 10){
|
||||
device_code = device_code + "0" + i;
|
||||
} else {
|
||||
device_code = device_code + i;
|
||||
}
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_id(IdUtil.simpleUUID());
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setDevice_name(device_code);
|
||||
dto.setDevice_type("conveyor");
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
}
|
||||
for (int i = 1; i <= 26; i++) {
|
||||
String device_code = "KLZC";
|
||||
if (i < 10){
|
||||
device_code = device_code + "0" + i;
|
||||
} else {
|
||||
device_code = device_code + i;
|
||||
}
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_id(IdUtil.simpleUUID());
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setDevice_name(device_code);
|
||||
dto.setDevice_type("conveyor");
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
}
|
||||
for (int i = 1; i <= 26; i++) {
|
||||
String device_code = "MLZHC";
|
||||
if (i < 10){
|
||||
device_code = device_code + "0" + i;
|
||||
} else {
|
||||
device_code = device_code + i;
|
||||
}
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_id(IdUtil.simpleUUID());
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setDevice_name(device_code);
|
||||
dto.setDevice_type("conveyor");
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.nl.hand.amb.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -32,6 +33,7 @@ public class HFHandController {
|
||||
@PostMapping("/area")
|
||||
@Log("查询区域")
|
||||
@ApiOperation("查询区域")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> query() {
|
||||
return new ResponseEntity<>(HandService.queryArea(null), HttpStatus.OK);
|
||||
@@ -40,6 +42,7 @@ public class HFHandController {
|
||||
@PostMapping("/point")
|
||||
@Log("查询设备编号及状态")
|
||||
@ApiOperation("查询设备编号及状态")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
//@RequestBody JSONObject json
|
||||
public ResponseEntity<Object> queryPoint(@RequestBody Map<String, String> whereJson) {
|
||||
@@ -50,6 +53,7 @@ public class HFHandController {
|
||||
@PostMapping("/point/storage")
|
||||
@Log("查询设备扩展属性")
|
||||
@ApiOperation("查询设备扩展属性")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
//@RequestBody JSONObject json
|
||||
public ResponseEntity<Object> queryDeviceAugmentabilityByCode(@RequestBody Map<String, String> whereJson) {
|
||||
@@ -59,6 +63,7 @@ public class HFHandController {
|
||||
@PostMapping("/task_type")
|
||||
@Log("查询任务类型")
|
||||
@ApiOperation("查询任务类型")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
//@RequestBody JSONObject json
|
||||
public ResponseEntity<Object> queryTaskType() {
|
||||
@@ -68,15 +73,16 @@ public class HFHandController {
|
||||
@PostMapping("/tasks")
|
||||
@Log("查询任务")
|
||||
@ApiOperation("查询任务")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryTask(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
return new ResponseEntity<>(HandService.queryTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/insts")
|
||||
@Log("查询指令")
|
||||
@ApiOperation("查询指令")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryInst(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
@@ -86,6 +92,7 @@ public class HFHandController {
|
||||
@PostMapping("/routeplan_type")
|
||||
@Log("查询路由类型")
|
||||
@ApiOperation("查询路由类型")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryRouteplanType() {
|
||||
return new ResponseEntity<>(HandService.queryRouteplanType(), HttpStatus.OK);
|
||||
@@ -94,6 +101,7 @@ public class HFHandController {
|
||||
@PostMapping("/task")
|
||||
@Log("创建任务")
|
||||
@ApiOperation("创建任务")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> createTask(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.createTask(whereJson), HttpStatus.OK);
|
||||
@@ -102,6 +110,7 @@ public class HFHandController {
|
||||
@PostMapping("/inst")
|
||||
@Log("指令操作")
|
||||
@ApiOperation("指令操作")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> Instoperation(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.Instoperation(whereJson), HttpStatus.OK);
|
||||
@@ -110,6 +119,7 @@ public class HFHandController {
|
||||
@PostMapping("/taskoperation")
|
||||
@Log("任务操作")
|
||||
@ApiOperation("任务操作")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> Taskoperation(@RequestBody Map<String, String> whereJson) throws Exception {
|
||||
return new ResponseEntity<>(HandService.Taskoperation(whereJson), HttpStatus.OK);
|
||||
@@ -118,6 +128,7 @@ public class HFHandController {
|
||||
@PostMapping("/deviceStatus")
|
||||
@Log("修改设备状态")
|
||||
@ApiOperation("修改设备状态")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> updateDeviceStatus(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
@@ -127,6 +138,7 @@ public class HFHandController {
|
||||
@PostMapping("/handlogin")
|
||||
@Log("手持登陆验证")
|
||||
@ApiOperation("手持登陆验证")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> handlogin(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
@@ -136,6 +148,7 @@ public class HFHandController {
|
||||
@PostMapping("/matrial")
|
||||
@Log("查询物料信息")
|
||||
@ApiOperation("查询物料信息")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryMaterial() {
|
||||
return new ResponseEntity<>(HandService.queryMaterial(), HttpStatus.OK);
|
||||
@@ -144,6 +157,7 @@ public class HFHandController {
|
||||
@PostMapping("/task2")
|
||||
@Log("创建任务")
|
||||
@ApiOperation("创建任务")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> createTask2(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.createTask2(whereJson), HttpStatus.OK);
|
||||
|
||||
@@ -641,7 +641,7 @@ public class HFHandServiceImpl implements HFHandService {
|
||||
instdto.setInstruction_status("0");
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject instcheckjson = instwo.query(" instruction_status <2 and next_point_code= '" + next_point_code + "'" + " and start_point_code = '" + start_point_code + "'" + " and task_id = '" + task_id + "'").uniqueResult(0);
|
||||
JSONObject instcheckjson = instwo.query(" instruction_status < 2 and next_point_code= '" + next_point_code + "'" + " and start_point_code = '" + start_point_code + "'" + " and task_id = '" + task_id + "'").uniqueResult(0);
|
||||
if (instcheckjson != null) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", "操作失败");
|
||||
|
||||
Reference in New Issue
Block a user