|
@ -167,22 +167,42 @@ public abstract class AbstractTask { |
|
|
// 申请任务
|
|
|
// 申请任务
|
|
|
SchBaseTask task = new SchBaseTask(); // 任务实体
|
|
|
SchBaseTask task = new SchBaseTask(); // 任务实体
|
|
|
String apply_point_code = param.getString("device_code"); // 请求点
|
|
|
String apply_point_code = param.getString("device_code"); // 请求点
|
|
|
|
|
|
String next_point = param.getString("next_point"); // 目的点
|
|
|
String config_code = param.getString("config_code"); |
|
|
String config_code = param.getString("config_code"); |
|
|
// 1、校验数据
|
|
|
// 1、校验数据
|
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
|
.eq(SchBaseTaskconfig::getConfig_code, config_code)); |
|
|
.eq(SchBaseTaskconfig::getConfig_code, config_code)); |
|
|
Assert.notNull(taskConfig, "找不到配置文件,请确认[" + config_code + "]配置是否存在!"); |
|
|
Assert.notNull(taskConfig, "找不到配置文件,请确认[" + config_code + "]配置是否存在!"); |
|
|
// 最大任务数
|
|
|
//判断该申请点位是否存在起点或终点的未完成任务
|
|
|
|
|
|
List<SchBaseTask> apply_point_lists = taskService.findUnFinishTasksByPoint_code2("",apply_point_code); |
|
|
|
|
|
Assert.isFalse(apply_point_lists.size()>0, |
|
|
|
|
|
"该任务申请点位["+apply_point_code+"]已存在未完成的任务,无法申请任务!"); |
|
|
|
|
|
// 最大可创建任务数
|
|
|
Integer tcmn = taskConfig.getTask_create_max_num(); |
|
|
Integer tcmn = taskConfig.getTask_create_max_num(); |
|
|
// 获取执行中的任务
|
|
|
// 获取申请的任务
|
|
|
List<SchBaseTask> unFinishTasksByTaskConfig = taskService.findUnFinishTasksByTaskConfig( |
|
|
List<SchBaseTask> unFinishTasksByTaskConfig = taskService.findTasksByTaskStatus( |
|
|
taskConfig.getConfig_code(), apply_point_code, taskConfig.getTask_direction()); |
|
|
taskConfig.getConfig_code(), TaskStatus.APPLY); |
|
|
|
|
|
|
|
|
Assert.isFalse(unFinishTasksByTaskConfig.size() >= tcmn, |
|
|
Assert.isFalse(unFinishTasksByTaskConfig.size() >= tcmn, |
|
|
"该点位申请的任务未完成数已超过上限,无法申请任务"); |
|
|
"该任务类型["+taskConfig.getTask_name()+"]的任务最大可申请数已超过上限,无法申请任务"); |
|
|
// 获取对接位点位对象
|
|
|
// 获取对接位点位对象
|
|
|
SchBasePoint pointObj = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
SchBasePoint pointObj = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
.eq(SchBasePoint::getPoint_code, apply_point_code)); |
|
|
.eq(SchBasePoint::getPoint_code, apply_point_code)); |
|
|
|
|
|
//如果是点对点,判断目标点是否有载具
|
|
|
|
|
|
if("3".equals( taskConfig.getTask_direction())){ |
|
|
|
|
|
SchBasePoint nextSchBasePoint= pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
|
|
|
.eq(SchBasePoint::getPoint_code, next_point)); |
|
|
|
|
|
if(ObjectUtil.isEmpty(nextSchBasePoint)) { |
|
|
|
|
|
throw new BadRequestException(next_point+"点位信息异常,请检查输入的点位!" ); |
|
|
|
|
|
} |
|
|
|
|
|
if(!next_point.startsWith("DKT")){ |
|
|
|
|
|
if (nextSchBasePoint.getVehicle_qty() > 0 |
|
|
|
|
|
|| ObjectUtil.isNotEmpty(nextSchBasePoint.getVehicle_code2()) |
|
|
|
|
|
|| ObjectUtil.isNotEmpty(nextSchBasePoint.getIng_task_code())) { |
|
|
|
|
|
// 消息通知
|
|
|
|
|
|
throw new BadRequestException(next_point+"点位已存在载具或任务信息!" ); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// 判断是否校验工单
|
|
|
// 判断是否校验工单
|
|
|
if (taskConfig.getIs_check_workorder()) { |
|
|
if (taskConfig.getIs_check_workorder()) { |
|
|
//如果点位上没货
|
|
|
//如果点位上没货
|
|
@ -206,22 +226,6 @@ public abstract class AbstractTask { |
|
|
//更新对应载具工单状态为已生成任务,不可在工单页面取消
|
|
|
//更新对应载具工单状态为已生成任务,不可在工单页面取消
|
|
|
//pdm_bd_workorder_two任务生成时,status改为2
|
|
|
//pdm_bd_workorder_two任务生成时,status改为2
|
|
|
workorderService.updateByPda(pointObj.getVehicle_code2(),"2",param.getString("mode")); |
|
|
workorderService.updateByPda(pointObj.getVehicle_code2(),"2",param.getString("mode")); |
|
|
// 校验工单
|
|
|
|
|
|
// 根据对接位的父点位编码(设备)找到工单设备
|
|
|
|
|
|
/*SchBasePoint one = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
|
|
|
.eq(SchBasePoint::getPoint_code, pointObj.getParent_point_code())); |
|
|
|
|
|
// 查找当前设备、生产中
|
|
|
|
|
|
PdmBdWorkorder workorder = workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>() |
|
|
|
|
|
.eq(PdmBdWorkorder::getPoint_code, one.getPoint_code()) |
|
|
|
|
|
.eq(PdmBdWorkorder::getWorkorder_status, WorkOrderStatusEnum.PRODUCING.getCode())); |
|
|
|
|
|
if (ObjectUtil.isEmpty(workorder)) { |
|
|
|
|
|
throw new BadRequestException("设备" + one.getPoint_code() + "工单未生产!"); |
|
|
|
|
|
} |
|
|
|
|
|
MdBaseMaterial mdBaseMaterial=materialService.getOne(new LambdaQueryWrapper<MdBaseMaterial>() |
|
|
|
|
|
.eq(MdBaseMaterial::getMaterial_id,workorder.getMaterial_id())); |
|
|
|
|
|
param.put("workorder_code", workorder.getWorkorder_code()); // 静置时间
|
|
|
|
|
|
// 设置任务数据
|
|
|
|
|
|
task.setVehicle_type(workorder.getVehicle_type());*/ |
|
|
|
|
|
} |
|
|
} |
|
|
// 校验是否需要自动agv
|
|
|
// 校验是否需要自动agv
|
|
|
if (!pointObj.getIs_auto()) { |
|
|
if (!pointObj.getIs_auto()) { |
|
@ -259,7 +263,6 @@ public abstract class AbstractTask { |
|
|
task.setUpdate_id(currentUserId); |
|
|
task.setUpdate_id(currentUserId); |
|
|
task.setUpdate_name(nickName); |
|
|
task.setUpdate_name(nickName); |
|
|
taskService.create(task); |
|
|
taskService.create(task); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void updateTaskStatus(String task_code, TaskStatus status) { |
|
|
public void updateTaskStatus(String task_code, TaskStatus status) { |
|
|