更新
This commit is contained in:
@@ -53,6 +53,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -68,12 +69,18 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
|
||||
List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
|
||||
@Autowired DeviceAppService deviceAppService;
|
||||
@Autowired NDCAgvService ndcAgvService;
|
||||
@Autowired ParamService paramService;
|
||||
@Autowired RouteLineService routeLineService;
|
||||
@Autowired TaskService taskService;
|
||||
@Autowired AcsToLiKuService acsToLiKuService;
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
NDCAgvService ndcAgvService;
|
||||
@Autowired
|
||||
ParamService paramService;
|
||||
@Autowired
|
||||
RouteLineService routeLineService;
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
@Autowired
|
||||
AcsToLiKuService acsToLiKuService;
|
||||
|
||||
@Override
|
||||
public void autoInitial() {
|
||||
@@ -82,9 +89,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
|
||||
@Override
|
||||
public synchronized void reload() {
|
||||
synchronized (TaskInstructionLock.class) {
|
||||
this.instructions = this.queryAll("instruction_status <2 and is_delete =0");
|
||||
}
|
||||
List list = this.queryAll("instruction_status <2 and is_delete =0");
|
||||
this.instructions = new CopyOnWriteArrayList<>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1337,15 +1343,19 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
@Override
|
||||
public boolean removeByCodeFromCache(String code) {
|
||||
synchronized (InstructionServiceImpl.class) {
|
||||
Iterator<Instruction> iterator = instructions.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Instruction instruction = iterator.next();
|
||||
if (instruction.getInstruction_code().equals(code)) {
|
||||
iterator.remove();
|
||||
CopyOnWriteArrayList<Instruction> instructions = (CopyOnWriteArrayList<Instruction>) this.instructions;
|
||||
instructions.removeIf((instruction) -> {
|
||||
instruction.getInstruction_code().equals(code);
|
||||
return true;
|
||||
});
|
||||
// while (iterator.hasNext()) {
|
||||
// Instruction instruction = iterator.next();
|
||||
// if (instruction.getInstruction_code().equals(code)) {
|
||||
// iterator.remove();
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Synchronized;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
@@ -88,7 +89,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
public synchronized void reload() {
|
||||
this.tasks = this.queryAll("task_status <2 and is_delete =0 order by create_time");
|
||||
List list = this.queryAll("task_status <2 and is_delete =0 order by create_time");
|
||||
|
||||
tasks = new CopyOnWriteArrayList<>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -533,8 +536,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
synchronized(TaskServiceImpl.class){
|
||||
tasks.add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 常规任务保存
|
||||
@@ -804,6 +809,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
|
||||
System.out.println(feefbackdto == null);
|
||||
JSONObject feed_jo = new JSONObject();
|
||||
feed_jo.put("task_id", entity.getTask_id());
|
||||
feed_jo.put("task_code", entity.getTask_code());
|
||||
|
||||
Reference in New Issue
Block a user