代码更新
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.nl.wms.sch.task.service.impl;
|
package org.nl.wms.sch.task.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -65,12 +66,21 @@ public class SchBaseTaskconfigServiceImpl extends ServiceImpl<SchBaseTaskconfigM
|
|||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
// 起点区域配置
|
if (ObjectUtil.isAllEmpty(entity.getStart_region_strs(), entity.getNext_region_strs()))
|
||||||
String startRegion = String.join(",", entity.getStart_region_strs());
|
throw new BadRequestException("起点区域和终点区域不能同时为空!");
|
||||||
entity.setStart_region_str(startRegion);
|
|
||||||
// 终点区域配置
|
if (ObjectUtil.isNotEmpty(entity.getStart_region_strs())) {
|
||||||
String nextRegion = String.join(",", entity.getNext_region_strs());
|
// 起点区域配置
|
||||||
entity.setNext_region_str(nextRegion);
|
String startRegion = String.join(",", entity.getStart_region_strs());
|
||||||
|
entity.setStart_region_str(startRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(entity.getNext_region_strs())) {
|
||||||
|
// 终点区域配置
|
||||||
|
String nextRegion = String.join(",", entity.getNext_region_strs());
|
||||||
|
entity.setNext_region_str(nextRegion);
|
||||||
|
}
|
||||||
|
|
||||||
entity.setCreate_id(currentUserId);
|
entity.setCreate_id(currentUserId);
|
||||||
entity.setCreate_name(nickName);
|
entity.setCreate_name(nickName);
|
||||||
entity.setCreate_time(now);
|
entity.setCreate_time(now);
|
||||||
@@ -84,13 +94,20 @@ public class SchBaseTaskconfigServiceImpl extends ServiceImpl<SchBaseTaskconfigM
|
|||||||
public void update(SchBaseTaskconfig entity) {
|
public void update(SchBaseTaskconfig entity) {
|
||||||
SchBaseTaskconfig dto = schBaseTaskconfigMapper.selectById(entity.getConfig_code());
|
SchBaseTaskconfig dto = schBaseTaskconfigMapper.selectById(entity.getConfig_code());
|
||||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
// 起点区域配置
|
if (ObjectUtil.isAllEmpty(entity.getStart_region_strs(), entity.getNext_region_strs()))
|
||||||
String startRegion = String.join(",", entity.getStart_region_strs());
|
throw new BadRequestException("起点区域和终点区域不能同时为空!");
|
||||||
entity.setStart_region_str(startRegion);
|
|
||||||
// 终点区域配置
|
|
||||||
String nextRegion = String.join(",", entity.getNext_region_strs());
|
|
||||||
entity.setNext_region_str(nextRegion);
|
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(entity.getStart_region_strs())) {
|
||||||
|
// 起点区域配置
|
||||||
|
String startRegion = String.join(",", entity.getStart_region_strs());
|
||||||
|
entity.setStart_region_str(startRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(entity.getNext_region_strs())) {
|
||||||
|
// 终点区域配置
|
||||||
|
String nextRegion = String.join(",", entity.getNext_region_strs());
|
||||||
|
entity.setNext_region_str(nextRegion);
|
||||||
|
}
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|||||||
@@ -24,13 +24,37 @@ public abstract class BaseTask {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISchBaseTaskService taskService;
|
private ISchBaseTaskService taskService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
*/
|
||||||
|
protected abstract void create(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发
|
||||||
|
*/
|
||||||
|
protected abstract void issue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务
|
||||||
|
*/
|
||||||
|
protected abstract void schedule();
|
||||||
|
|
||||||
|
protected abstract void updateStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寻找合适的点位
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected abstract List<Object> findPoints();
|
||||||
|
|
||||||
|
|
||||||
public void apply(JSONObject param) {
|
public void apply(JSONObject param) {
|
||||||
String point_code = "";
|
String point_code = "";
|
||||||
String config_code = "d";
|
String config_code = "HNMLTask";
|
||||||
//1、校验数据
|
//1、校验数据
|
||||||
SchBaseTaskconfig taskConfig = SpringContextHolder.getBean(SchBaseTaskconfigServiceImpl.class).getById(config_code);
|
SchBaseTaskconfig taskConfig = SpringContextHolder.getBean(SchBaseTaskconfigServiceImpl.class).getById(config_code);
|
||||||
Integer tcmn = taskConfig.getTask_create_max_num();
|
Integer tcmn = taskConfig.getTask_create_max_num();
|
||||||
|
|
||||||
SchBaseTaskServiceImpl taskService = SpringContextHolder.getBean(SchBaseTaskServiceImpl.class);
|
SchBaseTaskServiceImpl taskService = SpringContextHolder.getBean(SchBaseTaskServiceImpl.class);
|
||||||
List<SchBaseTask> unFinishTasksByTaskConfig = taskService.findUnFinishTasksByTaskConfig(taskConfig.getConfig_code());
|
List<SchBaseTask> unFinishTasksByTaskConfig = taskService.findUnFinishTasksByTaskConfig(taskConfig.getConfig_code());
|
||||||
|
|
||||||
@@ -54,4 +78,5 @@ public abstract class BaseTask {
|
|||||||
//校验
|
//校验
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
package org.nl.wms.sch.task_manage.task.core;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package org.nl.wms.sch.task_manage.task.core;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ldjun
|
|
||||||
* @version 1.0
|
|
||||||
* @date 2023年05月08日 13:35
|
|
||||||
* @desc desc
|
|
||||||
*/
|
|
||||||
public class BaseTaskDto {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
package org.nl.wms.sch.task_manage.task.core;
|
|
||||||
@@ -1 +1,23 @@
|
|||||||
package org.nl.wms.sch.task_manage.task.core;
|
package org.nl.wms.sch.task_manage.task.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务操作终端类型
|
||||||
|
*/
|
||||||
|
public enum TaskOperateType {
|
||||||
|
ACS("1", "ACS", "ACS"),
|
||||||
|
PC("2", "PC", "创建完成"),
|
||||||
|
MOBILE("3", "手持", "手持"),
|
||||||
|
QUARTZ("4", "定时任务", "定时任务"),
|
||||||
|
OTHER("5", "其它", "其它");
|
||||||
|
|
||||||
|
|
||||||
|
TaskOperateType(String code, String name, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private String desc;
|
||||||
|
}
|
||||||
@@ -1,12 +1,40 @@
|
|||||||
package org.nl.wms.sch.task_manage.task.tasks;
|
package org.nl.wms.sch.task_manage.task.tasks;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.wms.sch.task_manage.BaseTask;
|
import org.nl.wms.sch.task_manage.BaseTask;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ldjun
|
* @author ldjun 混碾满料任务
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @date 2023年05月16日 16:44
|
* @date 2023年05月16日 16:44
|
||||||
* @desc desc
|
* @desc desc
|
||||||
*/
|
*/
|
||||||
public class HNMLTask extends BaseTask {
|
public class HNMLTask extends BaseTask {
|
||||||
|
@Override
|
||||||
|
protected void updateStatus() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void create(JSONObject param) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void issue() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void schedule() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Object> findPoints() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user