fix:普通废箔任务改造调试、自动巡航费箔任务开发调试

This commit is contained in:
ls
2025-01-11 16:06:22 +08:00
parent d055944be4
commit becdab82f9
14 changed files with 228 additions and 62 deletions

View File

@@ -595,11 +595,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
try {
manipulatorAgvStationDeviceDriver.writing(3);
} catch (Exception e) {
e.printStackTrace();
}
} else { } else {
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey); log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
@@ -1156,7 +1152,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//收卷锟行架 //收卷锟行架
if (linkDevice.getDeviceDriver() instanceof RollUpRollerManipulatorDeviceDriver) { if (linkDevice.getDeviceDriver() instanceof RollUpRollerManipulatorDeviceDriver) {
rollUpRollerManipulatorDeviceDriver = (RollUpRollerManipulatorDeviceDriver) linkDevice.getDeviceDriver(); rollUpRollerManipulatorDeviceDriver = (RollUpRollerManipulatorDeviceDriver) linkDevice.getDeviceDriver();
if ((manipulatorAgvStationDeviceDriver.getAction() == 6 && rollUpRollerManipulatorDeviceDriver.getMode() != 3 && rollUpRollerManipulatorDeviceDriver.getError() == 0 && rollUpRollerManipulatorDeviceDriver.getTask() == 0 && rollUpRollerManipulatorDeviceDriver.getError2() == 0 && manipulatorAgvStationDeviceDriver.getMove() == 1)) { if ((manipulatorAgvStationDeviceDriver.getAction() == 6 && rollUpRollerManipulatorDeviceDriver.getMode() != 3 && rollUpRollerManipulatorDeviceDriver.getError() == 0 && rollUpRollerManipulatorDeviceDriver.getTask() == 0 && rollUpRollerManipulatorDeviceDriver.getError2() == 0 && manipulatorAgvStationDeviceDriver.getMove() == 0)) {
// 查询缓存架点位状态 // 查询缓存架点位状态
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", device_code); param.put("device_code", device_code);
@@ -1278,31 +1274,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
String start_device_code2 = inst.getStart_device_code2(); String start_device_code2 = inst.getStart_device_code2();
String next_device_code2 = inst.getNext_device_code2(); String next_device_code2 = inst.getNext_device_code2();
//AGV取完收卷辊请求离开 //AGV取完收卷辊请求离开
if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code2)) { if (ObjectUtil.isNotEmpty(start_device_code) && (StrUtil.equals(device_code, start_device_code) || StrUtil.equals(device_code, start_device_code2))) {
if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
try { try {
manipulatorAgvStationDeviceDriver.writing(7); manipulatorAgvStationDeviceDriver.writing(3);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if (manipulatorAgvStationDeviceDriver.getAction() == 1) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "mode信号:" + manipulatorAgvStationDeviceDriver.getMode() + "光电信号:" + manipulatorAgvStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件";
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} }
} }

View File

@@ -1061,15 +1061,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String move = ""; String move = "";
String action = ""; String action = "";
String walk_y = ""; String walk_y = "";
if (this.getMode() == 0) { if (this.getMode() == 0) {
mode = LangProcess.msg("universal_off-line"); mode = LangProcess.msg("universal_off-line");
} else if (this.getMode() == 1) { } else if (this.getMode() == 1) {
mode = LangProcess.msg("universal_stand-alone"); mode = LangProcess.msg("universal_stand-alone");
} else if (this.getMode() == 2) { } else if (this.getMode() == 2) {
mode = LangProcess.msg("universal_standby"); mode = LangProcess.msg("universal_standby");
} else if (this.getMode() == 3) { } else if (this.getMode() == 3) {
mode = LangProcess.msg("universal_operation"); mode = LangProcess.msg("universal_operation");
} }
if (this.getMove() == 0) { if (this.getMove() == 0) {
move = LangProcess.msg("universal_no"); move = LangProcess.msg("universal_no");
@@ -1132,7 +1132,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.requireSucess = true; this.requireSucess = true;
} }
if (HXDJ4Device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { if (HXDJ4Device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) HXDJ4Device.getDeviceDriver();
if (StrUtil.equals(requireActionSucess, "0")) { if (StrUtil.equals(requireActionSucess, "0")) {
manipulatorAgvStationDeviceDriver.setOvenGantryTask(false); manipulatorAgvStationDeviceDriver.setOvenGantryTask(false);
} else if (StrUtil.equals(requireActionSucess, "1")) { } else if (StrUtil.equals(requireActionSucess, "1")) {

View File

@@ -21,6 +21,8 @@ import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.pipe_core_rack_cachebit.PipeCoreRackCachebitDeviceDriver;
import org.nl.acs.enums.PointErrorTypeEnum; import org.nl.acs.enums.PointErrorTypeEnum;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
@@ -540,6 +542,7 @@ public class PipeCoreRackManipulatorDeviceDriver extends AbstractOpcDeviceDriver
if (ObjectUtil.isEmpty(putDeviceCodeList)) { if (ObjectUtil.isEmpty(putDeviceCodeList)) {
putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
} }
PipeCoreRackCachebitDeviceDriver pipeCoreRackCachebitDeviceDriver;
//找终点为入库输送线工位任务类型为行架的任务 //找终点为入库输送线工位任务类型为行架的任务
for (int i = 0; i < getDeviceCodeList.size(); i++) { for (int i = 0; i < getDeviceCodeList.size(); i++) {
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
@@ -569,6 +572,14 @@ public class PipeCoreRackManipulatorDeviceDriver extends AbstractOpcDeviceDriver
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
} }
if (nextDevice.getDeviceDriver() instanceof PipeCoreRackCachebitDeviceDriver) {
pipeCoreRackCachebitDeviceDriver = (PipeCoreRackCachebitDeviceDriver) nextDevice.getDeviceDriver();
if (pipeCoreRackCachebitDeviceDriver.getMode() == 1 ) {
notCreateInstMessage = "缓存位已经放满 move "+ pipeCoreRackCachebitDeviceDriver.getMove();
return false;
}
}
Map<String, Object> map1 = new HashMap<>(); Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>(); Map<String, Object> map2 = new HashMap<>();
Map<String, Object> map3 = new HashMap<>(); Map<String, Object> map3 = new HashMap<>();
@@ -587,6 +598,7 @@ public class PipeCoreRackManipulatorDeviceDriver extends AbstractOpcDeviceDriver
} }
} else { } else {
TaskDto taskDto = taskserver.findByStartCodeAndReady(startDeviceCode); TaskDto taskDto = taskserver.findByStartCodeAndReady(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDto) && TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) { if (ObjectUtil.isNotEmpty(taskDto) && TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) {
String start_device_code = taskDto.getStart_device_code(); String start_device_code = taskDto.getStart_device_code();
String next_device_code = taskDto.getNext_device_code(); String next_device_code = taskDto.getNext_device_code();
@@ -605,6 +617,14 @@ public class PipeCoreRackManipulatorDeviceDriver extends AbstractOpcDeviceDriver
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
} }
if (nextDevice.getDeviceDriver() instanceof PipeCoreRackCachebitDeviceDriver) {
pipeCoreRackCachebitDeviceDriver = (PipeCoreRackCachebitDeviceDriver) nextDevice.getDeviceDriver();
if (pipeCoreRackCachebitDeviceDriver.getMode() == 1 ) {
notCreateInstMessage = "缓存位已经放满 move "+ pipeCoreRackCachebitDeviceDriver.getMove();
return false;
}
}
String interactionJson = taskDto.getInteraction_json(); String interactionJson = taskDto.getInteraction_json();
InteractionJsonDTO interactionJsonDTO = null; InteractionJsonDTO interactionJsonDTO = null;
if (StrUtil.isNotEmpty(interactionJson)) { if (StrUtil.isNotEmpty(interactionJson)) {

View File

@@ -539,8 +539,8 @@ public class RollUpRollerManipulatorDeviceDriver extends AbstractOpcDeviceDriver
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorAgvStationDeviceDriver.getMove() != 0) { if (manipulatorAgvStationDeviceDriver.getMove() == 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-收卷锟对接位:" + manipulatorAgvStationDeviceDriver.getMove() + "货,无法下发指令!任务号:" + instruction.getInstruction_code(); notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-收卷锟对接位:" + manipulatorAgvStationDeviceDriver.getMove() + "货,无法下发指令!任务号:" + instruction.getInstruction_code();
return false; return false;
} }
} }
@@ -611,8 +611,8 @@ public class RollUpRollerManipulatorDeviceDriver extends AbstractOpcDeviceDriver
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorAgvStationDeviceDriver.getMove() != 0) { if (manipulatorAgvStationDeviceDriver.getMove() == 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-收卷锟对接位:" + manipulatorAgvStationDeviceDriver.getMove() + "货,无法下发指令!" ; notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-收卷锟对接位:" + manipulatorAgvStationDeviceDriver.getMove() + "货,无法下发指令!" ;
return false; return false;
} }
} }

View File

@@ -1716,14 +1716,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
ja.add(feed_jo); ja.add(feed_jo);
//TODO 有需要根据上位系统反馈的信息再做进一步处理 //TODO 有需要根据上位系统反馈的信息再做进一步处理
CompletableFuture.runAsync(() -> { acstowmsService.feedTaskStatus(ja);
acstowmsService.feedTaskStatus(ja); // CompletableFuture.runAsync(() -> {
// 异步更新任务状态 // // 异步更新任务状态
try { // try {
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
}); // });
} }
} }

View File

@@ -35,6 +35,13 @@ public class OtherPdaController {
public ResponseEntity<Object> resumeMoveWasteFoilV2(@RequestBody JSONObject param) { public ResponseEntity<Object> resumeMoveWasteFoilV2(@RequestBody JSONObject param) {
return new ResponseEntity<>(otherPdaService.resumeMoveWasteFoilV2(param), HttpStatus.OK); return new ResponseEntity<>(otherPdaService.resumeMoveWasteFoilV2(param), HttpStatus.OK);
} }
@PostMapping("/resumeAutoMoveWasteFoil")
@Log("继续自动巡航搬运废箔")
public ResponseEntity<Object> resumeAutoMoveWasteFoil(@RequestBody JSONObject param) {
return new ResponseEntity<>(otherPdaService.resumeAutoMoveWasteFoil(param), HttpStatus.OK);
}
@PostMapping("/startMoveWasteFoil") @PostMapping("/startMoveWasteFoil")
@Log("开始搬运废箔信息") @Log("开始搬运废箔信息")
public ResponseEntity<Object> startMoveWasteFoil(@RequestBody JSONObject param) { public ResponseEntity<Object> startMoveWasteFoil(@RequestBody JSONObject param) {

View File

@@ -63,4 +63,6 @@ public interface OtherPdaService {
* @return / * @return /
*/ */
JSONObject callAgvToSamplingVerify(JSONObject param); JSONObject callAgvToSamplingVerify(JSONObject param);
JSONObject resumeAutoMoveWasteFoil(JSONObject param);
} }

View File

@@ -1,5 +1,6 @@
package org.nl.wms.pda.st.service.impl; package org.nl.wms.pda.st.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
@@ -30,6 +31,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @Author: lyd * @Author: lyd
@@ -92,26 +94,17 @@ public class OtherPdaServiceImpl implements OtherPdaService {
String flag = param.getString("flag"); String flag = param.getString("flag");
// 判断是否能够搬运 // 判断是否能够搬运
String pointCode = param.getString("point_code"); String pointCode = param.getString("point_code");
// 校验是否二次创建任务 SchBaseTask task = checkTask(pointCode);
SchBaseTask schBaseTasks = taskService.getTaskByPointCodeX(pointCode, null, null, null);
if (ObjectUtil.isNotEmpty(schBaseTasks)) {
throw new BadRequestException("点位[" + pointCode + "]已经存在任务!");
}
// 查找执行中的任务
SchBaseTask task = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getPoint_code2, pointCode)
.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()));
if (ObjectUtil.isEmpty(task)) {
throw new BadRequestException("点位[" + pointCode + "]上一个任务不存在!");
}
JSONObject upTaskRequestObj = JSONObject.parseObject(task.getRequest_param()); JSONObject upTaskRequestObj = JSONObject.parseObject(task.getRequest_param());
// 获取下一条的任务 // 获取下一条的任务
List<SchBaseTask> waitTask = taskService.getTaskByConfigAndStatus(task.getConfig_code(), TaskStatus.SURE_END.getCode()); List<SchBaseTask> waitTask = taskService.getTaskByConfigAndStatus(task.getConfig_code(), TaskStatus.SURE_END.getCode());
// 结束或者没有任务后回废料起点
if (waitTask.size() == 0 || "2".equals(flag)) { if (waitTask.size() == 0 || "2".equals(flag)) {
// 最后一条任务, 创建去终点的任务 // 最后一条任务, 创建去终点的任务
// 获取一个废箔位置 // 获取一个废箔位置
List<SchBasePoint> fbPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-FB", List<SchBasePoint> fbPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-FB",
"2", null, null, null); "1", "1", null, null);
if (CollectionUtil.isEmpty(fbPoints)) { if (CollectionUtil.isEmpty(fbPoints)) {
throw new BadRequestException("找不到废箔点位,请稍后再试!"); throw new BadRequestException("找不到废箔点位,请稍后再试!");
} }
@@ -140,8 +133,60 @@ public class OtherPdaServiceImpl implements OtherPdaService {
taskService.updateById(nextTask); taskService.updateById(nextTask);
} }
// 通知ACS完成上一个任务 // 通知ACS完成上一个任务
// 通知ACS完成上一个任务
JSONArray acs = new JSONArray(); JSONArray acs = new JSONArray();
JSONObject result = new JSONObject();
JSONObject acsParam = new JSONObject(); JSONObject acsParam = new JSONObject();
noticeAcs(acsParam, task, pointCode, acs, result);
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject resumeAutoMoveWasteFoil(JSONObject param) {
// 判断是否能够搬运
String pointCode = param.getString("point_code");
// 校验是否二次创建任务
SchBaseTask task = checkTask(pointCode);
List<SchBasePoint> fbPoints = pointService.getAllBusinessTaskPoint("A1", "A1-FB",
"2", "1", null, null);
if (CollectionUtil.isEmpty(fbPoints)) {
throw new BadRequestException("找不到废箔点位,请稍后再试!");
}
JSONObject upTaskRequestObj = JSONObject.parseObject(task.getRequest_param());
// 自动巡航过滤下一个废箔点位
List<SchBasePoint> pointCodeCurrent = fbPoints.stream().filter(point -> point.getPoint_code().equals(pointCode)).collect(Collectors.toList());
if (CollUtil.isEmpty(pointCodeCurrent)) {
throw new BadRequestException("自动巡航废箔任务执行异常,当前点位不存在");
}
List<SchBasePoint> fbPointsFilter = fbPoints.stream()
.filter(point -> point.getSort()!= null)
.filter(point -> point.getSort().equals(pointCodeCurrent.get(0).getSort() + 1)).collect(Collectors.toList());
if (CollUtil.isEmpty(fbPointsFilter)) {
throw new BadRequestException("自动巡航废箔任务执行异常,已到达最后一个点位");
}
JSONObject taskParam = new JSONObject();
taskParam.put("point_code1", pointCode);
taskParam.put("point_code2", fbPointsFilter.get(0).getPoint_code());
taskParam.put("config_code", "SendWasteFoilAGVTask");
taskParam.put("create_mode", GeneralDefinition.PDA_CREATION);
taskParam.put("remark", "自动巡航");
taskParam.put("up_task_code", task.getTask_code());
taskParam.put("index_task", upTaskRequestObj.getInteger("index_task") + 1);
taskParam.put("carNo", task.getCar_no());
taskParam.put("task_status", TaskStatus.START_AND_POINT.getCode());
sendWasteFoilAGVTask.createTask(taskParam);
// 通知ACS完成上一个任务
JSONArray acs = new JSONArray();
JSONObject result = new JSONObject();
JSONObject acsParam = new JSONObject();
noticeAcs(acsParam, task, pointCode, acs, result);
return result;
}
private void noticeAcs(JSONObject acsParam, SchBaseTask task, String pointCode, JSONArray acs, JSONObject result) {
acsParam.put("task_code", task.getTask_code()); acsParam.put("task_code", task.getTask_code());
acsParam.put("device_code", pointCode); acsParam.put("device_code", pointCode);
acsParam.put("product_area", "A1"); acsParam.put("product_area", "A1");
@@ -150,10 +195,23 @@ public class OtherPdaServiceImpl implements OtherPdaService {
acs.add(acsParam); acs.add(acsParam);
JSONObject jsonObject = wmsToAcsService.updateTask(acs); JSONObject jsonObject = wmsToAcsService.updateTask(acs);
log.info("通知ACS完成上一个任务的反馈 - {}", jsonObject); log.info("通知ACS完成上一个任务的反馈 - {}", jsonObject);
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value()); result.put("status", HttpStatus.OK.value());
result.put("message", "废箔继续搬运请求成功!"); result.put("message", "废箔继续搬运请求成功!");
return result; }
private SchBaseTask checkTask(String pointCode) {
SchBaseTask schBaseTasks = taskService.getTaskByPointCodeX(pointCode, null, null, null);
if (ObjectUtil.isNotEmpty(schBaseTasks)) {
throw new BadRequestException("点位[" + pointCode + "]已经存在任务!");
}
// 查找执行中的任务
SchBaseTask task = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getPoint_code2, pointCode)
.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()));
if (ObjectUtil.isEmpty(task)) {
throw new BadRequestException("点位[" + pointCode + "]上一个任务不存在!");
}
return task;
} }
@Override @Override

View File

@@ -0,0 +1,55 @@
package org.nl.wms.quartz;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.pda.st.service.OtherPdaService;
import org.nl.wms.pda.st.service.impl.OtherPdaServiceImpl;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.point.service.dao.mapper.SchBasePointMapper;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task_manage.TaskStatus;
import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/**
* 自动巡航废箔任务,起点到第一个生箔位
* @Author: lyd
* @Date: 2024/8/27
*/
@Slf4j
@Component
public class AutoMoveWasteFoilAGVTask {
@Autowired
private OtherPdaService otherPdaService;
@Autowired
private ISchBasePointService pointService;
public void run() {
log.info("自动巡航废箔任务开始执行...");
JSONObject jsonObject = new JSONObject();
List<SchBasePoint> fbPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-FB",
"2", "1", null, null);
// 筛选一号位
List<SchBasePoint> fbPointsFilter = fbPoints.stream()
.filter(point -> point.getSort()!= null)
.filter(point -> point.getSort() .equals(1)).collect(Collectors.toList());
if (CollUtil.isEmpty(fbPointsFilter)) {
log.info("自动巡航废箔任务执行异常,无废箔位");
return;
}
jsonObject.put("point_code", fbPointsFilter.get(0).getPoint_code());
otherPdaService.startMoveWasteFoilV2(jsonObject);
}
}

View File

@@ -124,4 +124,7 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
* @return * @return
*/ */
List<SchBasePoint> getGxPointNotLock(); List<SchBasePoint> getGxPointNotLock();
List<SchBasePoint> getAllBusinessTaskPoint(String area, String region, String pointType,
String pointStatus, String vehicleType, String vehicleCode);
} }

View File

@@ -38,6 +38,9 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType, String pointStatus, List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType, String pointStatus,
String vehicleType, String vehicleCode); String vehicleType, String vehicleCode);
List<SchBasePoint> getAllBusinessTaskPoint(String area, String region, String pointType, String pointStatus,
String vehicleType, String vehicleCode);
/** /**
* 获取收卷没任务、生箔机指定的收卷的点位 * 获取收卷没任务、生箔机指定的收卷的点位
* @param code / * @param code /

View File

@@ -66,6 +66,31 @@
OR t.point_code4 = p.point_code)) OR t.point_code4 = p.point_code))
ORDER BY p.update_time ORDER BY p.update_time
</select> </select>
<select id="getAllBusinessTaskPoint" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
SELECT p.*
FROM sch_base_point p
WHERE p.is_used = TRUE
<if test="region != null">
AND p.region_code = #{region}
</if>
<if test="pointType != null">
AND p.point_type = #{pointType}
</if>
<if test="area != null">
AND p.product_area = #{area}
</if>
<if test="pointStatus != null">
AND p.point_status = #{pointStatus}
</if>
<if test="vehicleType != null">
AND p.vehicle_type = #{vehicleType}
</if>
<if test="vehicleCode != null">
AND p.vehicle_code = #{vehicleCode}
</if>
</select>
<select id="getWindRollConformRawNotTaskPoints" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint"> <select id="getWindRollConformRawNotTaskPoints" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
SELECT SELECT
p.* p.*

View File

@@ -239,6 +239,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
return pointMapper.getAllBusinessNotTaskPoint(area, region, pointType, pointStatus, vehicleType, vehicleCode); return pointMapper.getAllBusinessNotTaskPoint(area, region, pointType, pointStatus, vehicleType, vehicleCode);
} }
@Override
public List<SchBasePoint> getAllBusinessTaskPoint(String area, String region, String pointType,
String pointStatus, String vehicleType, String vehicleCode) {
return pointMapper.getAllBusinessTaskPoint(area, region, pointType, pointStatus, vehicleType, vehicleCode);
}
@Override @Override
public List<SchBasePoint> getWindRollConformRawNotTaskPoints(String code) { public List<SchBasePoint> getWindRollConformRawNotTaskPoints(String code) {
return pointMapper.getWindRollConformRawNotTaskPoints(code); return pointMapper.getWindRollConformRawNotTaskPoints(code);

View File

@@ -75,11 +75,19 @@ public class SendWasteFoilAGVTask extends AbstractTask {
checkTaskOptionStatus(taskObj); checkTaskOptionStatus(taskObj);
// 如果是废箔起点,需要吧点位置空 // 如果是废箔起点,需要吧点位置空
String startPointCode = taskObj.getPoint_code1(); String startPointCode = taskObj.getPoint_code1();
String startPointCode2 = taskObj.getPoint_code2();
SchBasePoint startPoint = pointService.getById(startPointCode); SchBasePoint startPoint = pointService.getById(startPointCode);
SchBasePoint startPoint2 = pointService.getById(startPointCode2);
if ("A1-FB".equals(startPoint.getRegion_code())) { if ("A1-FB".equals(startPoint.getRegion_code())) {
// 清空 // 清空
PointUtils.clearPoint(startPoint, taskFinishedType); PointUtils.clearPoint(startPoint, taskFinishedType);
} }
// 如果任务终点是废箔起点,将起点改成有载具
if ("A1-FB".equals(startPoint.getRegion_code())) {
// 清空
startPoint2.setPoint_status("2");
pointService.updateById(startPoint2);
}
// 任务完成 // 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setFinished_type(taskFinishedType.getCode()); taskObj.setFinished_type(taskFinishedType.getCode());