This commit is contained in:
USER-20220102CG\noblelift
2023-02-04 22:19:36 +08:00
parent e19622efc3
commit 343e1d7e88
3 changed files with 109 additions and 50 deletions

View File

@@ -209,10 +209,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
finish_instruction(); finish_instruction();
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task); logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task);
} else { } else {
if (!StrUtil.equals(inst.getExecute_code(), this.device_code)) { // if (!StrUtil.equals(inst.getExecute_code(), this.device_code)) {
inst.setExecute_device_code(this.device_code); // inst.setExecute_device_code(this.device_code);
instructionService.update(inst); // instructionService.update(inst);
} // }
} }
} }
@@ -777,41 +777,80 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
this.require_apply_strangulation_time = date; this.require_apply_strangulation_time = date;
String vehicle_code = ""; String vehicle_code = "";
if (task > 0) { // if (task > 0) {
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); // Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
if(ObjectUtil.isEmpty(instruction)){ // if(ObjectUtil.isEmpty(instruction)){
message = "申请捆扎电气设备任务号:" + task + "未找到对应指令"; // message = "申请捆扎电气设备任务号:" + task + "未找到对应指令";
throw new RuntimeException("该电气任务号未找到对应指令!"); // throw new RuntimeException("该电气任务号未找到对应指令!");
} // }
vehicle_code = instruction.getVehicle_code(); // vehicle_code = instruction.getVehicle_code();
} else { // } else {
logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "异常"); // logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "异常");
message = "申请捆扎电气设备任务号:" + task + "异常"; // message = "申请捆扎电气设备任务号:" + task + "异常";
throw new RuntimeException("任务号为空!"); // throw new RuntimeException("任务号为空!");
} // }
if (StrUtil.isEmpty(vehicle_code)) { // if (StrUtil.isEmpty(vehicle_code)) {
logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "未找到载具号"); // logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "未找到载具号");
message = "申请捆扎电气设备任务号:" + task + "未找到载具号"; // message = "申请捆扎电气设备任务号:" + task + "未找到载具号";
throw new RuntimeException("载具号为空!"); // throw new RuntimeException("载具号为空!");
} // }
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = // ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
new ApplyLabelingAndBindingRequest(); // new ApplyLabelingAndBindingRequest();
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0); // JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0);
String start_point_code = null; // String start_point_code = null;
if (!ObjectUtil.isEmpty(device_json)) { // if (!ObjectUtil.isEmpty(device_json)) {
start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code"); // start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code");
} // }
applyLabelingAndBindingRequest.setDevice_code(start_point_code); // applyLabelingAndBindingRequest.setDevice_code(start_point_code);
applyLabelingAndBindingRequest.setType("2"); // applyLabelingAndBindingRequest.setType("2");
applyLabelingAndBindingRequest.setVehicle_code(vehicle_code); // applyLabelingAndBindingRequest.setVehicle_code(vehicle_code);
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); // ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
if (applyLabelingAndBindingResponse.getstatus() == 200) { // if (applyLabelingAndBindingResponse.getstatus() == 200) {
if (ObjectUtil.isNotEmpty(applyLabelingAndBindingResponse.getData())) { // if (ObjectUtil.isNotEmpty(applyLabelingAndBindingResponse.getData())) {
Map datas = applyLabelingAndBindingResponse.getData(); // Map datas = applyLabelingAndBindingResponse.getData();
String length = datas.get("box_length").toString(); // String length = datas.get("box_length").toString();
String width = datas.get("box_width").toString(); // String width = datas.get("box_width").toString();
String box_high = datas.get("box_high").toString(); // String box_high = datas.get("box_high").toString();
String bundle_times = datas.get("bundle_times").toString(); // String bundle_times = datas.get("bundle_times").toString();
//
// List list = new ArrayList();
// 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", width);
// list.add(map2);
// Map map3 = new HashMap();
// map3.put("code", "to_height");
// map3.put("value", box_high);
// list.add(map3);
// Map map4 = new HashMap();
// map4.put("code", "to_strap_times");
// map4.put("value", bundle_times);
// list.add(map4);
// Map map5 = new HashMap();
// map5.put("code", "to_command");
// map5.put("value", "4");
// list.add(map5);
// this.writing(list);
//// this.writing(list);
//
// message = "申请捆扎成功";
// requireSucess = true;
// } else {
// message = "未返回尺寸信息";
// }
//
// } else {
// message = applyLabelingAndBindingResponse.getMessage();
// }
Thread.sleep(10000);
String length = "1280";
String width = "800";
String box_high = "400";
String bundle_times = "2";
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
@@ -838,14 +877,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
// this.writing(list); // this.writing(list);
message = "申请捆扎成功"; message = "申请捆扎成功";
requireSucess = true;
} else {
message = "未返回尺寸信息";
}
} else {
message = applyLabelingAndBindingResponse.getMessage();
}
} }
} }
@@ -860,6 +891,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
message = "申请空盘入库任务中..."; message = "申请空盘入库任务中...";
if(taskserver.querySameOriginTask(this.device_code) > 0 ){
message = "已存在空盘出库任务不再请求";
return;
}
JSONObject apply = new JSONObject(); JSONObject apply = new JSONObject();
apply.put("device_code", device_code); apply.put("device_code", device_code);
apply.put("type", "2"); apply.put("type", "2");
@@ -927,6 +964,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
this.require_empty_out_time = date; this.require_empty_out_time = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
if(taskserver.querySameDestinationTask(this.device_code) > 0 ){
message = "已存在空盘出库任务不再请求";
return;
}
message = "申请空盘出库任务中..."; message = "申请空盘出库任务中...";
JSONObject apply = new JSONObject(); JSONObject apply = new JSONObject();
apply.put("device_code", device_code); apply.put("device_code", device_code);

View File

@@ -298,7 +298,7 @@ public interface TaskService {
Integer querySameOriginTask(String code); Integer querySameOriginTask(String code);
/** /**
* 查询相同终任务的数量 * 查询相同终任务的数量
* *
* @param code * @param code
* @return * @return

View File

@@ -1567,11 +1567,29 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override @Override
public Integer querySameOriginTask(String code) { public Integer querySameOriginTask(String code) {
return null; int num = 0;
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (StrUtil.equals(task.getStart_device_code(),code)) {
num++;
}
}
return num;
} }
@Override @Override
public Integer querySameDestinationTask(String code) { public Integer querySameDestinationTask(String code) {
return null; int num = 0;
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (StrUtil.equals(task.getNext_device_code(),code)) {
num++;
}
}
return num;
} }
} }