fix: 分切行架任务就绪不下发

This commit is contained in:
yanps
2024-01-10 11:11:36 +08:00
parent e25dd57009
commit 6f7db9502c
4 changed files with 26 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ package org.nl.acs.device.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

View File

@@ -741,7 +741,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setDeviceStatus(form);
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
slitTwoManipulatorDeviceDriver.setDeviceStatus(form);

View File

@@ -11,7 +11,9 @@ import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver;
@@ -62,7 +64,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
@Autowired
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) {
apply_task();
} else {
if (!requireSucess) {
String remark = "";
if (mode != 2) {

View File

@@ -344,8 +344,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
continue;
}
if ((task.getStart_device_code().equals(start_device_code)
|| task.getStart_device_code2().equals(start_device_code))
&& StrUtil.equals(task.getTask_status(), "0")) {
|| (StrUtil.isNotEmpty(task.getStart_device_code2()) && task.getStart_device_code2().equals(start_device_code))
&& StrUtil.equals(task.getTask_status(), "0"))) {
list.add(task);
}
}
@@ -458,7 +458,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
continue;
}
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")) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
if (ObjectUtil.isNotEmpty(instruction)) {
@@ -505,7 +505,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Transactional(rollbackFor = Exception.class)
public void create(TaskDto dto) throws Exception {
dto = foramte(dto);
if(ObjectUtil.isNotEmpty(dto.getPaperArray())){
if (ObjectUtil.isNotEmpty(dto.getPaperArray())) {
dto.setPaper_array(dto.getPaperArray().toJSONString());
}
if (!StrUtil.isEmpty(dto.getVehicle_code())) {
@@ -578,11 +578,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
// tasks.add(dto);
// }
try{
try {
tasks.add(dto);
log.warn("任务添加到任务列表:"+dto.toString());
} catch (Exception e){
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
log.warn("任务添加到任务列表:" + dto.toString());
} catch (Exception e) {
log.warn("任务添加到任务列表异常:" + dto.toString() + e.getMessage());
}
}
@@ -734,11 +734,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
removeByCodeFromCache(entity.getTask_code());
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) {
try{
try {
tasks.add(dto);
log.warn("任务添加到任务列表:"+dto.toString());
} catch (Exception e){
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
log.warn("任务添加到任务列表:" + dto.toString());
} catch (Exception e) {
log.warn("任务添加到任务列表异常:" + dto.toString() + e.getMessage());
}
}
// 判断是否为WMS下发的任务如果是反馈任务状态给WMS
@@ -1203,16 +1203,16 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override
public boolean removeByCodeFromCache(String code) {
CopyOnWriteArrayList<TaskDto> taskDtos = (CopyOnWriteArrayList<TaskDto>) this.tasks;
try{
try {
taskDtos.removeIf((task) -> {
if(StrUtil.equals(task.getTask_code(),code)){
log.warn("任务移除任务列表成功:"+task.toString());
if (StrUtil.equals(task.getTask_code(), code)) {
log.warn("任务移除任务列表成功:" + task.toString());
}
return task.getTask_code().equals(code);
});
} catch (Exception e){
log.warn("指令移除任务列表异常:"+e.getMessage());
} catch (Exception e) {
log.warn("指令移除任务列表异常:" + e.getMessage());
}
return true;
@@ -1238,6 +1238,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
/**
* 根据任务号查询任务
*
* @param task_code
* @return
*/
@@ -1446,11 +1447,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override
public void updateByCodeFromCache(TaskDto dto) {
removeByCodeFromCache(dto.getTask_code());
try{
try {
tasks.add(dto);
log.warn("任务添加到任务列表:"+dto.toString());
} catch (Exception e){
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
log.warn("任务添加到任务列表:" + dto.toString());
} catch (Exception e) {
log.warn("任务添加到任务列表异常:" + dto.toString() + e.getMessage());
}
}