rev:新增lms接口,新增表处行架4点任务下发以及设备监控界面优化

This commit is contained in:
2024-04-22 17:08:20 +08:00
parent fcc6cad7d3
commit 5a1d840f60
5 changed files with 273 additions and 76 deletions

View File

@@ -238,10 +238,36 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
instruction_require(); instruction_require();
} }
break; break;
case 5:
//申请贴标
applyLabeling(mode);
break;
case 10: case 10:
//申请捆轧贴标信息 //申请捆轧贴标信息
if (move > 0 && !requireSucess) { if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(); applyLaStrangulationAndLabeling(mode);
}
break;
case 12:
//申请贴标(未贴标)
applyLabeling(mode);
break;
case 13:
//申请捆轧贴标信息(未捆扎)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
break;
case 14:
//申请捆轧贴标信息(未贴标)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
break;
case 16:
//申请捆轧贴标信息(未贴标,未捆扎)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
} }
break; break;
} }
@@ -261,7 +287,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
last_to_height = to_height; last_to_height = to_height;
} }
private void applyLaStrangulationAndLabeling() { private void applyLaStrangulationAndLabeling(int mode) {
Date date = new Date(); Date date = new Date();
if (date.getTime() - this.require_apply_strangulation_time.getTime() < (long) this.instruction_require_time_out) { if (date.getTime() - this.require_apply_strangulation_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
@@ -288,7 +314,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
.build(); .build();
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
// Map datas = applyLabelingAndBindingResponse.getData(); // Map datas = applyLabelingAndBindingResponse.getData();
packagePLCData(jo.getString("data")); packagePLCData(jo.getString("data"), mode);
requireSucess = true; requireSucess = true;
} else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
@@ -302,7 +328,57 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
} }
private void packagePLCData(String datas) { // 申请贴标
public synchronized void applyLabeling(int mode) {
Date date = new Date();
if (date.getTime() - this.require_apply_strangulation_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
this.require_apply_strangulation_time = date;
// String vehicle_code = "";
//
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (StrUtil.isEmpty(inst.getVehicle_code())) {
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
return;
}
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("vehicle_code", inst.getVehicle_code());
param.put("type", AcsToLmsApplyTaskTypeEnum.LABEL.getType());
String response = acsToWmsService.deviceApplyTwo(param);
JSONObject jo = JSON.parseObject(response);
if (jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请贴标成功:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
List list = new ArrayList();
Map map5 = new HashMap();
map5.put("code", "to_command");
map5.put("value", mode);
list.add(map5);
try {
this.writing(list);
} catch (Exception e) {
message = "universal_write_erro";
}
// Map datas = applyLabelingAndBindingResponse.getData();
requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请贴标失败,接口返回:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
private void packagePLCData(String datas, int mode) {
JSONObject jo = JSON.parseObject(datas); JSONObject jo = JSON.parseObject(datas);
String length = jo.get("length").toString(); String length = jo.get("length").toString();
@@ -317,54 +393,112 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
String bundleTimes = jo.get("bundleTimes").toString(); String bundleTimes = jo.get("bundleTimes").toString();
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); if (mode == 10 || mode == 16) {
map.put("code", "to_length"); Map map = new HashMap();
map.put("value", length); map.put("code", "to_length");
list.add(map); map.put("value", length);
Map map2 = new HashMap(); list.add(map);
map2.put("code", "to_weight"); Map map2 = new HashMap();
map2.put("value", weight); map2.put("code", "to_weight");
list.add(map2); map2.put("value", weight);
Map map3 = new HashMap(); list.add(map2);
map3.put("code", "to_height"); Map map3 = new HashMap();
map3.put("value", height); map3.put("code", "to_height");
list.add(map3); map3.put("value", height);
Map map4 = new HashMap(); list.add(map3);
map4.put("code", "to_is_binding"); Map map4 = new HashMap();
map4.put("value", isBinding); map4.put("code", "to_is_binding");
list.add(map4); map4.put("value", isBinding);
Map map5 = new HashMap(); list.add(map4);
map5.put("code", "to_command"); Map map5 = new HashMap();
map5.put("value", 10); map5.put("code", "to_command");
list.add(map5); map5.put("value", mode);
Map map6 = new HashMap(); list.add(map5);
map6.put("code", "to_is_labeling"); Map map6 = new HashMap();
map6.put("value", isLabeling); map6.put("code", "to_is_labeling");
list.add(map6); map6.put("value", isLabeling);
Map map7 = new HashMap(); list.add(map6);
map7.put("code", "to_print_qty"); Map map7 = new HashMap();
map7.put("value", printQty); map7.put("code", "to_print_qty");
list.add(map7); map7.put("value", printQty);
Map map8 = new HashMap(); list.add(map7);
map8.put("code", "to_print_qty"); Map map8 = new HashMap();
map8.put("value", printQty); map8.put("code", "to_print_qty");
list.add(map8); map8.put("value", printQty);
Map map9 = new HashMap(); list.add(map8);
map9.put("code", "to_print_device"); Map map9 = new HashMap();
map9.put("value", printDevice); map9.put("code", "to_print_device");
list.add(map9); map9.put("value", printDevice);
Map map10 = new HashMap(); list.add(map9);
map10.put("code", "to_binding_template"); Map map10 = new HashMap();
map10.put("value", bindingTemplate); map10.put("code", "to_binding_template");
list.add(map10); map10.put("value", bindingTemplate);
Map map11 = new HashMap(); list.add(map10);
map11.put("code", "to_binding_times"); Map map11 = new HashMap();
map11.put("value", bundleTimes); map11.put("code", "to_binding_times");
list.add(map11); map11.put("value", bundleTimes);
Map map12 = new HashMap(); list.add(map11);
map12.put("code", "to_labeling_template"); Map map12 = new HashMap();
map12.put("value", labelingTemplate); map12.put("code", "to_labeling_template");
list.add(map12); map12.put("value", labelingTemplate);
list.add(map12);
}
if (mode == 13) {
Map map = new HashMap();
map.put("code", "to_length");
map.put("value", length);
list.add(map);
Map map2 = new HashMap();
map2.put("code", "to_weight");
map2.put("value", weight);
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_height");
map3.put("value", height);
list.add(map3);
Map map5 = new HashMap();
map5.put("code", "to_command");
map5.put("value", mode);
list.add(map5);
Map map11 = new HashMap();
map11.put("code", "to_binding_times");
map11.put("value", bundleTimes);
list.add(map11);
}
if (mode == 14) {
Map map4 = new HashMap();
map4.put("code", "to_is_binding");
map4.put("value", isBinding);
list.add(map4);
Map map5 = new HashMap();
map5.put("code", "to_command");
map5.put("value", mode);
list.add(map5);
Map map6 = new HashMap();
map6.put("code", "to_is_labeling");
map6.put("value", isLabeling);
list.add(map6);
Map map7 = new HashMap();
map7.put("code", "to_print_qty");
map7.put("value", printQty);
list.add(map7);
Map map8 = new HashMap();
map8.put("code", "to_print_qty");
map8.put("value", printQty);
list.add(map8);
Map map9 = new HashMap();
map9.put("code", "to_print_device");
map9.put("value", printDevice);
list.add(map9);
Map map10 = new HashMap();
map10.put("code", "to_binding_template");
map10.put("value", bindingTemplate);
list.add(map10);
Map map12 = new HashMap();
map12.put("code", "to_labeling_template");
map12.put("value", labelingTemplate);
list.add(map12);
}
try { try {
this.writing(list); this.writing(list);
} catch (Exception e) { } catch (Exception e) {

View File

@@ -139,6 +139,12 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
int to_onset = 0; int to_onset = 0;
int last_to_onset = 0; int last_to_onset = 0;
int to_onset2 = 0;
int last_to_onset2 = 0;
int to_target2 = 0;
int last_to_target2 = 0;
Boolean isonline = true; Boolean isonline = true;
int hasGoods = 0; int hasGoods = 0;
String message = null; String message = null;
@@ -226,6 +232,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
if (StrUtil.equals(inst.getInstruction_status(), CommonFinalParam.ZERO)) { if (StrUtil.equals(inst.getInstruction_status(), CommonFinalParam.ZERO)) {
inst.setInstruction_status(CommonFinalParam.ONE); inst.setInstruction_status(CommonFinalParam.ONE);
inst.setExecute_device_code(this.device_code); inst.setExecute_device_code(this.device_code);
inst.setUpdate_time(DateUtil.now());
instructionService.update(inst); instructionService.update(inst);
} }
} }
@@ -387,6 +394,8 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
last_to_command = to_command; last_to_command = to_command;
last_to_target = to_target; last_to_target = to_target;
last_to_onset = to_onset; last_to_onset = to_onset;
last_to_target2 = to_target2;
last_to_onset2 = to_onset2;
last_weight = weight; last_weight = weight;
last_barcode = barcode; last_barcode = barcode;
} }
@@ -417,9 +426,8 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
String startCode = instruction.getStart_device_code(); String startCode = instruction.getStart_device_code();
String nextCode = instruction.getNext_device_code(); String nextCode = instruction.getNext_device_code();
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); String startCode2 = instruction.getStart_device_code2();
instruction.setUpdate_time(DateUtil.now()); String nextCode2 = instruction.getNext_device_code2();
instructionService.update(instruction);
Device startDevice = deviceAppService.findDeviceByCode(startCode); Device startDevice = deviceAppService.findDeviceByCode(startCode);
Device nextDevice = deviceAppService.findDeviceByCode(nextCode); Device nextDevice = deviceAppService.findDeviceByCode(nextCode);
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
@@ -431,10 +439,25 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
String startAddr = startDevice.getExtraValue().get("address").toString(); String startAddr = startDevice.getExtraValue().get("address").toString();
String nextAddr = nextDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", startAddr); map.put("to_onset", startAddr);
map.put("to_task", instruction.getInstruction_code()); map.put("to_task", instruction.getInstruction_code());
map.put("to_target", nextAddr); map.put("to_target", nextAddr);
map.put("to_command", CommonFinalParam.ONE);
if (StrUtil.isNotEmpty(startCode2)){
Device startDevice2 = deviceAppService.findDeviceByCode(startCode2);
Device nextDevice2 = deviceAppService.findDeviceByCode(nextCode2);
if (ObjectUtil.isEmpty(startDevice2.getExtraValue().get("address"))) {
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
}
if (ObjectUtil.isEmpty(nextDevice2.getExtraValue().get("address"))) {
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
}
String start_addr2 = startDevice2.getExtraValue().get("address").toString();
String next_addr2 = nextDevice2.getExtraValue().get("address").toString();
map.put("to_onset2", start_addr2);
map.put("to_target2", next_addr2);
}
this.writing(map); this.writing(map);
this.setRequireSucess(true); this.setRequireSucess(true);
return true; return true;
@@ -460,6 +483,8 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
String routePlanCode = task.getRoute_plan_code(); String routePlanCode = task.getRoute_plan_code();
String nextPointCode = task.getNext_point_code(); String nextPointCode = task.getNext_point_code();
String nextDeviceCode = task.getNext_device_code(); String nextDeviceCode = task.getNext_device_code();
String startDeviceCode2 = task.getStart_device_code2();
String nextDeviceCode2 = task.getNext_device_code2();
Instruction instdto = new Instruction(); Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setInstruction_id(IdUtil.simpleUUID());
@@ -481,22 +506,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(startPointCode); instdto.setExecute_device_code(startPointCode);
try { Map<String, Object> map = new LinkedHashMap<>();
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(LangProcess.msg("universal_message9") + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
//创建指令后修改任务状态
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
task.setUpdate_time(DateUtil.now());
taskserver.update(task);
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
@@ -520,11 +530,46 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
} }
String startAddr = startDevice.getExtraValue().get("address").toString(); String startAddr = startDevice.getExtraValue().get("address").toString();
String nextAddr = nextDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", CommonFinalParam.ONE); map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", startAddr); map.put("to_onset", startAddr);
map.put("to_task", instdto.getInstruction_code()); map.put("to_task", instdto.getInstruction_code());
map.put("to_target", nextAddr); map.put("to_target", nextAddr);
if (StrUtil.isNotEmpty(startDeviceCode2)){
//判断任务点位是否配置电气信号
Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2);
Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2);
if (ObjectUtil.isEmpty(startDevice2.getExtraValue().get("address"))) {
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice2.getDevice_code()));
}
if (ObjectUtil.isEmpty(nextDevice2.getExtraValue().get("address"))) {
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice2.getDevice_code()));
}
String start_addr2 = startDevice2.getExtraValue().get("address").toString();
String next_addr2 = nextDevice2.getExtraValue().get("address").toString();
instdto.setStart_device_code2(startDeviceCode2);
instdto.setNext_device_code2(nextDeviceCode2);
instdto.setStart_point_code2(startDeviceCode2);
instdto.setNext_point_code2(nextDeviceCode2);
map.put("to_onset2", start_addr2);
map.put("to_target2", next_addr2);
}
try {
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(LangProcess.msg("universal_message9") + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
//创建指令后修改任务状态
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
task.setUpdate_time(DateUtil.now());
taskserver.update(task);
this.writing(map); this.writing(map);
this.setRequireSucess(true); this.setRequireSucess(true);
notCreateInstMessage = ""; notCreateInstMessage = "";

View File

@@ -38,6 +38,10 @@ public class ItemProtocol {
public static String item_to_onset = "to_onset"; public static String item_to_onset = "to_onset";
//下发目标站 //下发目标站
public static String item_to_target = "to_target"; public static String item_to_target = "to_target";
//下发起始站
public static String item_to_onset2 = "to_onset2";
//下发目标站
public static String item_to_target2 = "to_target2";
//下发任务号 //下发任务号
public static String item_to_task = "to_task"; public static String item_to_task = "to_task";
@@ -99,6 +103,14 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_target); return this.getOpcIntegerValue(item_to_target);
} }
public int getTo_onset2() {
return this.getOpcIntegerValue(item_to_onset2);
}
public int getTo_target2() {
return this.getOpcIntegerValue(item_to_target2);
}
Boolean isonline; Boolean isonline;
Boolean isError; Boolean isError;
@@ -149,6 +161,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0")); list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0"));
list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2")); list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2"));
list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4")); list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4"));
list.add(new ItemDto(item_to_onset2, "下发起始站2", "DB2.W3"));
list.add(new ItemDto(item_to_target2, "下发目标站2", "DB2.W5"));
list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6")); list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6"));
return list; return list;
} }

View File

@@ -6,9 +6,13 @@ import lombok.Getter;
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum AcsToLmsApplyTaskTypeEnum { public enum AcsToLmsApplyTaskTypeEnum {
LABEL_BIND("1", "捆轧贴标"), LABEL_BIND("1", "申请捆轧贴标信息"),
AGV("2", "AGV任务"),
LABEL("3", "申请贴标");
AGV("2", "AGV任务");
/** /**
* 索引 * 索引
*/ */

View File

@@ -281,7 +281,7 @@ export default {
dialogFormVisible9: false, dialogFormVisible9: false,
dialogFormVisible10: false, dialogFormVisible10: false,
Stages: [], Stages: [],
stage_code: '', stage_code: 'stage_code',
form: { form: {
device_code: '', device_code: '',
hasGoodStatus: null, hasGoodStatus: null,