|
|
@ -229,7 +229,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
@Override |
|
|
|
public Instruction findByCode(String code) { |
|
|
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction"); |
|
|
|
JSONObject json = wo.query("instruction_code ='" + code + "'").uniqueResult(0); |
|
|
|
JSONObject json = wo.query("instruction_code ='" + code + "'", "create_time").uniqueResult(0); |
|
|
|
if (ObjectUtil.isEmpty(json)) { |
|
|
|
return null; |
|
|
|
} |
|
|
@ -247,15 +247,15 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
|
|
|
|
@Override |
|
|
|
public Instruction findByTaskcodeAndStatus(String code) { |
|
|
|
Iterator var3 = instructions.iterator(); |
|
|
|
while (var3.hasNext()) { |
|
|
|
Instruction instruction = (Instruction) var3.next(); |
|
|
|
if (StrUtil.equals(instruction.getTask_code(), code) |
|
|
|
&& StrUtil.equals(instruction.getInstruction_status(), "0")) { |
|
|
|
return instruction; |
|
|
|
} |
|
|
|
Iterator var3 = instructions.iterator(); |
|
|
|
while (var3.hasNext()) { |
|
|
|
Instruction instruction = (Instruction) var3.next(); |
|
|
|
if (StrUtil.equals(instruction.getTask_code(), code) |
|
|
|
&& StrUtil.equals(instruction.getInstruction_status(), "0")) { |
|
|
|
return instruction; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -299,7 +299,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
} |
|
|
|
dto.setInstruction_type("1"); |
|
|
|
|
|
|
|
// 查询是否存在相同指令号
|
|
|
|
// 查询是否存在相同指令号
|
|
|
|
// if (!StrUtil.isEmpty(dto.getVehicle_code() )) {
|
|
|
|
// Instruction inst_dto = findByContainer(dto.getVehicle_code());
|
|
|
|
// if (inst_dto != null) {
|
|
|
@ -945,8 +945,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
return; |
|
|
|
} |
|
|
|
removeByCodeFromCache(entity.getInstruction_code()); |
|
|
|
TaskDto taskDto = taskService.findByCodeFromCache(entity.getTask_code()); |
|
|
|
if (taskDto != null) { |
|
|
|
taskService.cancel(taskDto.getTask_id()); |
|
|
|
} |
|
|
|
} |
|
|
|
// this.reload();
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -1002,6 +1005,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
return; |
|
|
|
} |
|
|
|
removeByCodeFromCache(entity.getInstruction_code()); |
|
|
|
TaskDto taskDto = taskService.findByCodeFromCache(entity.getTask_code()); |
|
|
|
if (taskDto != null) { |
|
|
|
taskService.cancel(taskDto.getTask_id()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -1059,81 +1066,85 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
} |
|
|
|
|
|
|
|
removeByCodeFromCache(entity.getInstruction_code()); |
|
|
|
TaskDto taskDto = taskService.findByCodeFromCache(entity.getTask_code()); |
|
|
|
if (taskDto != null) { |
|
|
|
taskService.cancel(taskDto.getTask_id()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Instruction findByLinkNumSend(String code) { |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "1")) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "1")) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Instruction> findByLinkNum(String code) { |
|
|
|
List<Instruction> list = new ArrayList<>(); |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "0")) { |
|
|
|
list.add(inst); |
|
|
|
} |
|
|
|
List<Instruction> list = new ArrayList<>(); |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "0")) { |
|
|
|
list.add(inst); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Instruction findByLinkNumNoSend(String code) { |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "0")) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "0")) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Instruction findByCodeFromCache(String code) { |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(code, inst.getInstruction_code())) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(code, inst.getInstruction_code())) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Instruction findByBarcodeFromCache(String barcode) { |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(barcode, inst.getVehicle_code())) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(barcode, inst.getVehicle_code())) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Instruction findByIdFromCache(String id) { |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(id, inst.getInstruction_id())) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(id, inst.getInstruction_id())) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -1209,23 +1220,23 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
|
|
|
|
@Override |
|
|
|
public Instruction findByDeviceCodeFromCache(String devicecode) { |
|
|
|
List<Instruction> instructionList = instructions; |
|
|
|
ListUtil.sort( |
|
|
|
instructionList, |
|
|
|
new Comparator<Instruction>() { |
|
|
|
@Override |
|
|
|
public int compare(Instruction o1, Instruction o2) { |
|
|
|
return o1.getCreate_time().compareTo(o2.getCreate_time()); |
|
|
|
} |
|
|
|
}); |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(devicecode, inst.getStart_device_code()) |
|
|
|
&& inst.getInstruction_status().equals("0")) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
List<Instruction> instructionList = instructions; |
|
|
|
ListUtil.sort( |
|
|
|
instructionList, |
|
|
|
new Comparator<Instruction>() { |
|
|
|
@Override |
|
|
|
public int compare(Instruction o1, Instruction o2) { |
|
|
|
return o1.getCreate_time().compareTo(o2.getCreate_time()); |
|
|
|
} |
|
|
|
}); |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(devicecode, inst.getStart_device_code()) |
|
|
|
&& inst.getInstruction_status().equals("0")) { |
|
|
|
return inst; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
@ -1237,52 +1248,52 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer querySameDestinationInst(String devicecode) { |
|
|
|
int num = 0; |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
// 处理空盘位站点
|
|
|
|
String next_code = inst.getNext_point_code(); |
|
|
|
if (next_code.indexOf(".") != -1) { |
|
|
|
next_code = next_code.substring(0, next_code.indexOf(".")); |
|
|
|
} |
|
|
|
if (StrUtil.equals(devicecode, next_code)) { |
|
|
|
num = num + 1; |
|
|
|
} |
|
|
|
int num = 0; |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
// 处理空盘位站点
|
|
|
|
String next_code = inst.getNext_point_code(); |
|
|
|
if (next_code.indexOf(".") != -1) { |
|
|
|
next_code = next_code.substring(0, next_code.indexOf(".")); |
|
|
|
} |
|
|
|
if (StrUtil.equals(devicecode, next_code)) { |
|
|
|
num = num + 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return num; |
|
|
|
return num; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer querySameInstType(String inst_type) { |
|
|
|
int num = 0; |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(inst.getInstruction_type(), inst_type)) { |
|
|
|
num = num + 1; |
|
|
|
} |
|
|
|
int num = 0; |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
if (StrUtil.equals(inst.getInstruction_type(), inst_type)) { |
|
|
|
num = num + 1; |
|
|
|
} |
|
|
|
return num; |
|
|
|
} |
|
|
|
return num; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer querySameOriginInst(String devicecode) { |
|
|
|
int num = 0; |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
// 处理空盘位站点
|
|
|
|
String start_code = inst.getStart_point_code(); |
|
|
|
if (start_code.indexOf(".") != -1) { |
|
|
|
start_code = start_code.substring(0, start_code.indexOf(".")); |
|
|
|
} |
|
|
|
if (StrUtil.equals(devicecode, start_code)) { |
|
|
|
num = num + 1; |
|
|
|
} |
|
|
|
int num = 0; |
|
|
|
Iterator<Instruction> it = instructions.iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Instruction inst = it.next(); |
|
|
|
// 处理空盘位站点
|
|
|
|
String start_code = inst.getStart_point_code(); |
|
|
|
if (start_code.indexOf(".") != -1) { |
|
|
|
start_code = start_code.substring(0, start_code.indexOf(".")); |
|
|
|
} |
|
|
|
return num; |
|
|
|
if (StrUtil.equals(devicecode, start_code)) { |
|
|
|
num = num + 1; |
|
|
|
} |
|
|
|
} |
|
|
|
return num; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|