代码更新
This commit is contained in:
@@ -5,27 +5,25 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpResponse;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.nl.acs.AcsConfig;
|
import org.nl.acs.AcsConfig;
|
||||||
import org.nl.acs.agv.server.*;
|
import org.nl.acs.agv.server.MagicAgvService;
|
||||||
|
import org.nl.acs.agv.server.NDCAgvService;
|
||||||
|
import org.nl.acs.agv.server.XianGongAgvService;
|
||||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
|
||||||
import org.nl.acs.ext.wms.liKuData.*;
|
import org.nl.acs.ext.wms.liKuData.*;
|
||||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
import org.nl.acs.opc.Device;
|
import org.nl.acs.opc.Device;
|
||||||
@@ -84,7 +82,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void reload() {
|
public synchronized void reload() {
|
||||||
Class var1 = TaskInstructionLock.class;
|
|
||||||
synchronized (TaskInstructionLock.class) {
|
synchronized (TaskInstructionLock.class) {
|
||||||
this.instructions = this.queryAll("instruction_status <2 and is_delete =0");
|
this.instructions = this.queryAll("instruction_status <2 and is_delete =0");
|
||||||
}
|
}
|
||||||
@@ -92,10 +89,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
/*WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "instruction_status < 2 and is_delete =0 ", "update_time desc");
|
|
||||||
*/
|
|
||||||
// this.reload();
|
|
||||||
HashMap<String, String> map = new HashMap<>();
|
HashMap<String, String> map = new HashMap<>();
|
||||||
map.put("flag", "1");
|
map.put("flag", "1");
|
||||||
String code = (String) whereJson.get("code");
|
String code = (String) whereJson.get("code");
|
||||||
@@ -214,7 +207,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
@Override
|
@Override
|
||||||
public List queryAll(String whereJson) {
|
public List queryAll(String whereJson) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||||
JSONArray arr = wo.query(whereJson).getResultJSONArray(0);
|
JSONArray arr = wo.query(whereJson, "create_time").getResultJSONArray(0);
|
||||||
List<Instruction> list = arr.toJavaList(Instruction.class);
|
List<Instruction> list = arr.toJavaList(Instruction.class);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -251,7 +244,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByTaskcodeAndStatus(String code) {
|
public Instruction findByTaskcodeAndStatus(String code) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
Iterator var3 = instructions.iterator();
|
Iterator var3 = instructions.iterator();
|
||||||
while (var3.hasNext()) {
|
while (var3.hasNext()) {
|
||||||
Instruction instruction = (Instruction) var3.next();
|
Instruction instruction = (Instruction) var3.next();
|
||||||
@@ -262,7 +255,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -280,13 +272,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(Instruction dto) {
|
public void create(Instruction dto) {
|
||||||
Class var2 = TaskInstructionLock.class;
|
|
||||||
synchronized (TaskInstructionLock.class) {
|
|
||||||
dto = foramte(dto);
|
dto = foramte(dto);
|
||||||
String task_code = dto.getTask_code();
|
String task_code = dto.getTask_code();
|
||||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||||
|
|
||||||
WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||||
@@ -345,14 +334,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
|
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
|
||||||
Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code());
|
|
||||||
|
|
||||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||||
|
|
||||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver =
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||||
(HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
|
||||||
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,8 +348,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
String next_device_code = dto.getNext_device_code();
|
String next_device_code = dto.getNext_device_code();
|
||||||
String route_plan_code = task.getRoute_plan_code();
|
String route_plan_code = task.getRoute_plan_code();
|
||||||
List<RouteLineDto> shortPathsList =
|
List<RouteLineDto> shortPathsList =
|
||||||
routeLineService.getShortPathLines(
|
routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||||
start_device_code, next_device_code, route_plan_code);
|
|
||||||
RouteLineDto route = null;
|
RouteLineDto route = null;
|
||||||
for (int i = 0; i < shortPathsList.size(); i++) {
|
for (int i = 0; i < shortPathsList.size(); i++) {
|
||||||
RouteLineDto routeLineDto = shortPathsList.get(i);
|
RouteLineDto routeLineDto = shortPathsList.get(i);
|
||||||
@@ -405,12 +391,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
wo.insert(json);
|
wo.insert(json);
|
||||||
instructions.add(dto);
|
instructions.add(dto);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create2(Instruction dto) throws Exception {
|
public void create2(Instruction dto) throws Exception {
|
||||||
Class var2 = TaskInstructionLock.class;
|
|
||||||
synchronized (TaskInstructionLock.class) {
|
|
||||||
dto = foramte(dto);
|
dto = foramte(dto);
|
||||||
String task_code = dto.getTask_code();
|
String task_code = dto.getTask_code();
|
||||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||||
@@ -472,8 +455,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||||
|
|
||||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
hongXiangConveyorDeviceDriver =
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||||
(HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
|
||||||
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,8 +464,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
String next_device_code = dto.getNext_device_code();
|
String next_device_code = dto.getNext_device_code();
|
||||||
String route_plan_code = task.getRoute_plan_code();
|
String route_plan_code = task.getRoute_plan_code();
|
||||||
List<RouteLineDto> shortPathsList =
|
List<RouteLineDto> shortPathsList =
|
||||||
routeLineService.getShortPathLines(
|
routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||||
start_device_code, next_device_code, route_plan_code);
|
|
||||||
RouteLineDto route = null;
|
RouteLineDto route = null;
|
||||||
for (int i = 0; i < shortPathsList.size(); i++) {
|
for (int i = 0; i < shortPathsList.size(); i++) {
|
||||||
RouteLineDto routeLineDto = shortPathsList.get(i);
|
RouteLineDto routeLineDto = shortPathsList.get(i);
|
||||||
@@ -519,12 +500,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
wo.insert(json);
|
wo.insert(json);
|
||||||
instructions.add(dto);
|
instructions.add(dto);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createAgain(Instruction dto) throws Exception {
|
public void createAgain(Instruction dto) throws Exception {
|
||||||
Class var2 = TaskInstructionLock.class;
|
|
||||||
synchronized (TaskInstructionLock.class) {
|
|
||||||
String task_code = dto.getTask_code();
|
String task_code = dto.getTask_code();
|
||||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||||
WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
||||||
@@ -608,12 +586,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
// }
|
// }
|
||||||
instructions.add(dto);
|
instructions.add(dto);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(Instruction dto) {
|
public void update(Instruction dto) {
|
||||||
synchronized (TaskInstructionLock.class) {
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
@@ -625,7 +601,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -762,8 +737,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void finish(Instruction dto) {
|
public void finish(Instruction dto) {
|
||||||
Class var2 = TaskInstructionLock.class;
|
|
||||||
synchronized (TaskInstructionLock.class) {
|
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
dto.setInstruction_status("2");
|
dto.setInstruction_status("2");
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||||
@@ -817,7 +790,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
removeByCodeFromCache(dto.getInstruction_code());
|
removeByCodeFromCache(dto.getInstruction_code());
|
||||||
// this.reload();
|
// this.reload();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -901,8 +873,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cancel(String id) throws Exception {
|
public void cancel(String id) throws Exception {
|
||||||
Class var2 = TaskInstructionLock.class;
|
|
||||||
synchronized (TaskInstructionLock.class) {
|
|
||||||
// flag= true时取消指令
|
// flag= true时取消指令
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
Instruction entity = this.findById(id);
|
Instruction entity = this.findById(id);
|
||||||
@@ -930,8 +900,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
|
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
|
||||||
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
||||||
XianGongAgvService xianGongAgvService =
|
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
|
||||||
SpringContextHolder.getBean(XianGongAgvService.class);
|
|
||||||
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
|
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
|
||||||
flag = true;
|
flag = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -1008,12 +977,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forceCancel(String id) throws Exception {
|
public void forceCancel(String id) throws Exception {
|
||||||
Class var2 = TaskInstructionLock.class;
|
|
||||||
synchronized (TaskInstructionLock.class) {
|
|
||||||
// flag= true时取消指令
|
// flag= true时取消指令
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
Instruction entity = this.findById(id);
|
Instruction entity = this.findById(id);
|
||||||
@@ -1066,12 +1032,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
removeByCodeFromCache(entity.getInstruction_code());
|
removeByCodeFromCache(entity.getInstruction_code());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cancelNOSendAgv(String id) throws Exception {
|
public void cancelNOSendAgv(String id) throws Exception {
|
||||||
Class var2 = TaskInstructionLock.class;
|
|
||||||
synchronized (TaskInstructionLock.class) {
|
|
||||||
// flag= true时取消指令
|
// flag= true时取消指令
|
||||||
Instruction entity = this.findById(id);
|
Instruction entity = this.findById(id);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
@@ -1126,7 +1089,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
removeByCodeFromCache(entity.getInstruction_code());
|
removeByCodeFromCache(entity.getInstruction_code());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByLinkNumSend(String code) {
|
public Instruction findByLinkNumSend(String code) {
|
||||||
@@ -1145,7 +1107,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Instruction> findByLinkNum(String code) {
|
public List<Instruction> findByLinkNum(String code) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
List<Instruction> list = new ArrayList<>();
|
List<Instruction> list = new ArrayList<>();
|
||||||
Iterator<Instruction> it = instructions.iterator();
|
Iterator<Instruction> it = instructions.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
@@ -1156,13 +1118,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByLinkNumNoSend(String code) {
|
public Instruction findByLinkNumNoSend(String code) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
Iterator<Instruction> it = instructions.iterator();
|
Iterator<Instruction> it = instructions.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Instruction inst = it.next();
|
Instruction inst = it.next();
|
||||||
@@ -1173,12 +1133,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByCodeFromCache(String code) {
|
public Instruction findByCodeFromCache(String code) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
Iterator<Instruction> it = instructions.iterator();
|
Iterator<Instruction> it = instructions.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Instruction inst = it.next();
|
Instruction inst = it.next();
|
||||||
@@ -1188,13 +1147,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByBarcodeFromCache(String barcode) {
|
public Instruction findByBarcodeFromCache(String barcode) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
Iterator<Instruction> it = instructions.iterator();
|
Iterator<Instruction> it = instructions.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Instruction inst = it.next();
|
Instruction inst = it.next();
|
||||||
@@ -1208,7 +1165,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByIdFromCache(String id) {
|
public Instruction findByIdFromCache(String id) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
Iterator<Instruction> it = instructions.iterator();
|
Iterator<Instruction> it = instructions.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Instruction inst = it.next();
|
Instruction inst = it.next();
|
||||||
@@ -1344,7 +1301,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer querySameInstType(String inst_type) {
|
public Integer querySameInstType(String inst_type) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
Iterator<Instruction> it = instructions.iterator();
|
Iterator<Instruction> it = instructions.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
@@ -1355,12 +1312,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer querySameOriginInst(String devicecode) {
|
public Integer querySameOriginInst(String devicecode) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
Iterator<Instruction> it = instructions.iterator();
|
Iterator<Instruction> it = instructions.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
@@ -1376,13 +1332,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeByCodeFromCache(String code) {
|
public boolean removeByCodeFromCache(String code) {
|
||||||
synchronized (InstructionServiceImpl.class){
|
synchronized (InstructionServiceImpl.class) {
|
||||||
Iterator<Instruction> iterator = instructions.iterator();
|
Iterator<Instruction> iterator = instructions.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Instruction instruction = iterator.next();
|
Instruction instruction = iterator.next();
|
||||||
@@ -1392,10 +1346,8 @@ synchronized (InstructionServiceImpl.class){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createLkInst(String type, Instruction dto) {
|
public boolean createLkInst(String type, Instruction dto) {
|
||||||
|
|||||||
@@ -202,8 +202,10 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception var30) {
|
} catch (Exception var30) {
|
||||||
|
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
try {
|
try {
|
||||||
|
group.getServer().dispose();
|
||||||
group.clear();
|
group.clear();
|
||||||
group.remove();
|
group.remove();
|
||||||
} catch (Exception var6) {
|
} catch (Exception var6) {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) {
|
public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) {
|
||||||
synchronized (TaskServiceImpl.class){
|
|
||||||
|
|
||||||
|
|
||||||
this.reload();
|
this.reload();
|
||||||
@@ -151,6 +151,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
String task_type = (String) whereJson.get("task_type");
|
String task_type = (String) whereJson.get("task_type");
|
||||||
List<TaskDto> taskList = new ArrayList();
|
List<TaskDto> taskList = new ArrayList();
|
||||||
|
|
||||||
|
synchronized (TaskServiceImpl.class){
|
||||||
Iterator<TaskDto> it = tasks.iterator();
|
Iterator<TaskDto> it = tasks.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
TaskDto task = it.next();
|
TaskDto task = it.next();
|
||||||
@@ -193,6 +194,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
DateUtil.parse(task2.getCreate_time())))
|
DateUtil.parse(task2.getCreate_time())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Integer currentPageNumber = page.getPageNumber() + 1;
|
Integer currentPageNumber = page.getPageNumber() + 1;
|
||||||
Integer pageMaxSize = page.getPageSize();
|
Integer pageMaxSize = page.getPageSize();
|
||||||
List<TaskDto> taskDtoList =
|
List<TaskDto> taskDtoList =
|
||||||
@@ -204,7 +207,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
jo.put("content", taskDtoList);
|
jo.put("content", taskDtoList);
|
||||||
jo.put("totalElements", taskList.size());
|
jo.put("totalElements", taskList.size());
|
||||||
return jo;
|
return jo;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -653,7 +656,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(TaskDto dto) {
|
public void update(TaskDto dto) {
|
||||||
synchronized (TaskServiceImpl.class) {
|
|
||||||
TaskDto entity = this.findById(dto.getTask_id());
|
TaskDto entity = this.findById(dto.getTask_id());
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
@@ -669,6 +672,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
|
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
|
|
||||||
|
synchronized (TaskServiceImpl.class) {
|
||||||
Iterator<TaskDto> iterator = tasks.iterator();
|
Iterator<TaskDto> iterator = tasks.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
TaskDto task = iterator.next();
|
TaskDto task = iterator.next();
|
||||||
@@ -679,6 +683,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) {
|
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) {
|
||||||
tasks.add(dto);
|
tasks.add(dto);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||||
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||||
@@ -767,7 +772,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -916,7 +921,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
|
|
||||||
try {
|
synchronized (TaskServiceImpl.class){
|
||||||
Iterator<TaskDto> it = tasks.iterator();
|
Iterator<TaskDto> it = tasks.iterator();
|
||||||
// 清理缓存
|
// 清理缓存
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
@@ -924,10 +929,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
if (taskDto.getTask_id().equals(id)) {
|
if (taskDto.getTask_id().equals(id)) {
|
||||||
tasks.remove(taskDto);
|
tasks.remove(taskDto);
|
||||||
}
|
}
|
||||||
}
|
}}
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||||
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||||
@@ -1089,7 +1092,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
if (acsTask == null) {
|
if (acsTask == null) {
|
||||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
}
|
}
|
||||||
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 ");
|
InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 ");
|
||||||
|
|||||||
Reference in New Issue
Block a user