fix: 分切行架任务就绪不下发
This commit is contained in:
@@ -4,6 +4,7 @@ package org.nl.acs.device.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
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;
|
||||||
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|||||||
@@ -741,7 +741,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
|||||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||||
standardInspectSiteDeviceDriver.setDeviceStatus(form);
|
standardInspectSiteDeviceDriver.setDeviceStatus(form);
|
||||||
|
|
||||||
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
|
||||||
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
|
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
|
||||||
slitTwoManipulatorDeviceDriver.setDeviceStatus(form);
|
slitTwoManipulatorDeviceDriver.setDeviceStatus(form);
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import lombok.Data;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||||
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
@@ -62,7 +64,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||||
@Autowired
|
@Autowired
|
||||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
@Autowired
|
@Autowired
|
||||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
@@ -359,9 +360,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
//申请任务
|
//申请任务
|
||||||
if (mode == 2 && move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) {
|
if (mode == 2 && move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) {
|
||||||
apply_task();
|
apply_task();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!requireSucess) {
|
if (!requireSucess) {
|
||||||
String remark = "";
|
String remark = "";
|
||||||
if (mode != 2) {
|
if (mode != 2) {
|
||||||
|
|||||||
@@ -344,8 +344,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((task.getStart_device_code().equals(start_device_code)
|
if ((task.getStart_device_code().equals(start_device_code)
|
||||||
|| task.getStart_device_code2().equals(start_device_code))
|
|| (StrUtil.isNotEmpty(task.getStart_device_code2()) && task.getStart_device_code2().equals(start_device_code))
|
||||||
&& StrUtil.equals(task.getTask_status(), "0")) {
|
&& StrUtil.equals(task.getTask_status(), "0"))) {
|
||||||
list.add(task);
|
list.add(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,7 +458,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((task.getStart_device_code().equals(head_start_device_code)
|
if ((task.getStart_device_code().equals(head_start_device_code)
|
||||||
|| task.getStart_device_code2().equals(head_start_device_code))
|
|| (StrUtil.isNotEmpty(task.getStart_device_code2()) && task.getStart_device_code2().equals(head_start_device_code)))
|
||||||
&& StrUtil.equals(task.getTask_status(), "1")) {
|
&& StrUtil.equals(task.getTask_status(), "1")) {
|
||||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||||
@@ -505,7 +505,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(TaskDto dto) throws Exception {
|
public void create(TaskDto dto) throws Exception {
|
||||||
dto = foramte(dto);
|
dto = foramte(dto);
|
||||||
if(ObjectUtil.isNotEmpty(dto.getPaperArray())){
|
if (ObjectUtil.isNotEmpty(dto.getPaperArray())) {
|
||||||
dto.setPaper_array(dto.getPaperArray().toJSONString());
|
dto.setPaper_array(dto.getPaperArray().toJSONString());
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(dto.getVehicle_code())) {
|
if (!StrUtil.isEmpty(dto.getVehicle_code())) {
|
||||||
@@ -578,11 +578,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
// tasks.add(dto);
|
// tasks.add(dto);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
try{
|
try {
|
||||||
tasks.add(dto);
|
tasks.add(dto);
|
||||||
log.warn("任务添加到任务列表:"+dto.toString());
|
log.warn("任务添加到任务列表:" + dto.toString());
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
|
log.warn("任务添加到任务列表异常:" + dto.toString() + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,11 +734,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
removeByCodeFromCache(entity.getTask_code());
|
removeByCodeFromCache(entity.getTask_code());
|
||||||
|
|
||||||
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")) {
|
||||||
try{
|
try {
|
||||||
tasks.add(dto);
|
tasks.add(dto);
|
||||||
log.warn("任务添加到任务列表:"+dto.toString());
|
log.warn("任务添加到任务列表:" + dto.toString());
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
|
log.warn("任务添加到任务列表异常:" + dto.toString() + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||||
@@ -1203,16 +1203,16 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
@Override
|
@Override
|
||||||
public boolean removeByCodeFromCache(String code) {
|
public boolean removeByCodeFromCache(String code) {
|
||||||
CopyOnWriteArrayList<TaskDto> taskDtos = (CopyOnWriteArrayList<TaskDto>) this.tasks;
|
CopyOnWriteArrayList<TaskDto> taskDtos = (CopyOnWriteArrayList<TaskDto>) this.tasks;
|
||||||
try{
|
try {
|
||||||
|
|
||||||
taskDtos.removeIf((task) -> {
|
taskDtos.removeIf((task) -> {
|
||||||
if(StrUtil.equals(task.getTask_code(),code)){
|
if (StrUtil.equals(task.getTask_code(), code)) {
|
||||||
log.warn("任务移除任务列表成功:"+task.toString());
|
log.warn("任务移除任务列表成功:" + task.toString());
|
||||||
}
|
}
|
||||||
return task.getTask_code().equals(code);
|
return task.getTask_code().equals(code);
|
||||||
});
|
});
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.warn("指令移除任务列表异常:"+e.getMessage());
|
log.warn("指令移除任务列表异常:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1238,6 +1238,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据任务号查询任务
|
* 根据任务号查询任务
|
||||||
|
*
|
||||||
* @param task_code
|
* @param task_code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -1446,11 +1447,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
@Override
|
@Override
|
||||||
public void updateByCodeFromCache(TaskDto dto) {
|
public void updateByCodeFromCache(TaskDto dto) {
|
||||||
removeByCodeFromCache(dto.getTask_code());
|
removeByCodeFromCache(dto.getTask_code());
|
||||||
try{
|
try {
|
||||||
tasks.add(dto);
|
tasks.add(dto);
|
||||||
log.warn("任务添加到任务列表:"+dto.toString());
|
log.warn("任务添加到任务列表:" + dto.toString());
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
|
log.warn("任务添加到任务列表异常:" + dto.toString() + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user