This commit is contained in:
2023-05-16 18:54:27 +08:00
36 changed files with 268 additions and 140 deletions

View File

@@ -29,8 +29,7 @@ public class PdmBdWorkorder implements Serializable {
@ApiModelProperty(value = "工单编号")
private String workorder_code;
@ApiModelProperty(value = "生产日期")
private String produce_date;
@ApiModelProperty(value = "计划数量")
private BigDecimal plan_qty;

View File

@@ -18,8 +18,6 @@ public class PdmBdWorkorderDto implements Serializable {
/** 工单编号 */
private String workorder_code;
/** 生产日期 */
private String produce_date;
/** 计划数量 */
private BigDecimal plan_qty;

View File

@@ -10,10 +10,10 @@ import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @description /
* @author lyd
* @date 2023-05-15
**/
* @description /
* @author lyd
* @date 2023-05-16
**/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sch_base_region")
@@ -61,4 +61,7 @@ public class SchBaseRegion implements Serializable {
@ApiModelProperty(value = "修改时间")
private String update_time;
@ApiModelProperty(value = "顺和号")
private Integer order_seq;
}

View File

@@ -4,10 +4,10 @@ import lombok.Data;
import java.io.Serializable;
/**
* @description /
* @author lyd
* @date 2023-05-15
**/
* @description /
* @author lyd
* @date 2023-05-16
**/
@Data
public class SchBaseRegionDto implements Serializable {
@@ -24,7 +24,7 @@ public class SchBaseRegionDto implements Serializable {
private String point_status_explain;
/** 是否创建工单 */
private String is_has_workder;
private Boolean is_has_workder;
/** 车间编码 */
private String workshop_code;
@@ -33,7 +33,7 @@ public class SchBaseRegionDto implements Serializable {
private String remark;
/** 创建人 */
private Long create_id;
private String create_id;
/** 创建人 */
private String create_name;
@@ -42,11 +42,14 @@ public class SchBaseRegionDto implements Serializable {
private String create_time;
/** 修改人 */
private Long update_id;
private String update_id;
/** 修改人 */
private String update_name;
/** 修改时间 */
private String update_time;
/** 顺和号 */
private Integer order_seq;
}

View File

@@ -46,7 +46,8 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
lam.eq(ObjectUtil.isNotEmpty(workshop_code), SchBaseRegion::getWorkshop_code, workshop_code)
.eq(ObjectUtil.isNotEmpty(is_has_workder), SchBaseRegion::getIs_has_workder, is_has_workder)
.like(ObjectUtil.isNotEmpty(blurry), SchBaseRegion::getRegion_code, blurry)
.or(ObjectUtil.isNotEmpty(blurry), la -> la.like(SchBaseRegion::getRegion_name, blurry));
.or(ObjectUtil.isNotEmpty(blurry), la -> la.like(SchBaseRegion::getRegion_name, blurry))
.orderByAsc(SchBaseRegion::getOrder_seq);
IPage<SchBaseRegion> pages = new Page<>(page.getPage() + 1, page.getSize());
schBaseRegionMapper.selectPage(pages, lam);
return pages;

View File

@@ -1,5 +1,8 @@
package org.nl.wms.sch.task.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -13,6 +16,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import sun.security.krb5.internal.PAData;
import java.util.Map;
import java.util.Set;
@@ -63,4 +67,15 @@ public class SchBaseTaskController {
schBaseTaskService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/apply")
@Log("新增任务管理")
@ApiOperation("新增任务管理")
//@SaCheckPermission("@el.check('schBaseTask:add')")
@SaIgnore
public ResponseEntity<Object> apply(@RequestBody Map param){
schBaseTaskService.apply(JSONObject.parseObject(JSON.toJSONString(param)));
return new ResponseEntity<>(HttpStatus.CREATED);
}
}

View File

@@ -1 +0,0 @@
package org.nl.wms.sch.task.core.task;

View File

@@ -1 +0,0 @@
package org.nl.wms.sch.task.core.task.core;

View File

@@ -1 +0,0 @@
package org.nl.wms.sch.task.core.task.core;

View File

@@ -1 +0,0 @@
package org.nl.wms.sch.task.core.task.core;

View File

@@ -1 +0,0 @@
package org.nl.wms.sch.task.core.task.core;

View File

@@ -1 +0,0 @@
package org.nl.wms.sch.task.core.task.core;

View File

@@ -1 +0,0 @@
package org.nl.wms.sch.task.core.task.tasks;

View File

@@ -1,43 +1,66 @@
package org.nl.wms.sch.task.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.nl.common.domain.query.PageQuery;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @description 服务接口
* @author lyd
* @date 2023-05-15
**/
* @author lyd
* @description 服务接口
* @date 2023-05-15
**/
public interface ISchBaseTaskService extends IService<SchBaseTask> {
/**
* 查询数据分页
* @param whereJson 条件
* @param pageable 分页参数
* @return IPage<SchBaseTask>
*/
* 查询数据分页
*
* @param whereJson 条件
* @param pageable 分页参数
* @return IPage<SchBaseTask>
*/
IPage<SchBaseTask> queryAll(Map whereJson, PageQuery pageable);
/**
* 创建
* @param entity /
*/
* 创建
*
* @param entity /
*/
void create(SchBaseTask entity);
/**
* 编辑
* @param entity /
*/
* 编辑
*
* @param entity /
*/
void update(SchBaseTask entity);
/**
* 多选删除
* @param ids /
*/
* 多选删除
*
* @param ids /
*/
void deleteAll(Set<String> ids);
/**
* 根据任务配置查询为完成的任务数
*
* @param config_code 任务配置编码
* @return 未完成任务列表
*/
List<SchBaseTask> findUnFishedTasksByTaskConfig(String config_code);
/**
* 任务申请
*
* @param param /
*/
void apply(JSONObject param);
}

View File

@@ -26,8 +26,6 @@ public class SchBaseTask implements Serializable {
@ApiModelProperty(value = "任务编码")
private String task_code;
@ApiModelProperty(value = "任务分类")
private String task_class_id;
@ApiModelProperty(value = "任务状态")
private String task_status;
@@ -56,11 +54,6 @@ public class SchBaseTask implements Serializable {
@ApiModelProperty(value = "载具编码")
private String vehicle_code;
@ApiModelProperty(value = "优先级")
private String priority;
@ApiModelProperty(value = "处理类")
private String handle_class;
@ApiModelProperty(value = "处理状态")
private String handle_status;
@@ -68,8 +61,6 @@ public class SchBaseTask implements Serializable {
@ApiModelProperty(value = "车号")
private String car_no;
@ApiModelProperty(value = "是否自动下发")
private Boolean is_auto_issue;
@ApiModelProperty(value = "任务组标识")
private Long task_group_id;

View File

@@ -47,10 +47,10 @@ public class SchBaseTaskconfig implements Serializable {
private String priority;
@ApiModelProperty(value = "允许最大任务生成数")
private BigDecimal task_create_num;
private Integer task_create_max_num;
@ApiModelProperty(value = "允许最大任务下发数")
private BigDecimal task_issue_num;
private Integer task_issue_max_num;
@ApiModelProperty(value = "是否自动下发")
private Boolean is_auto_issue;

View File

@@ -15,8 +15,6 @@ public class SchBaseTaskDto implements Serializable {
/** 任务编码 */
private String task_code;
/** 任务分类 */
private String task_class_id;
/** 任务状态 */
private String task_status;
@@ -45,20 +43,12 @@ public class SchBaseTaskDto implements Serializable {
/** 载具编码 */
private String vehicle_code;
/** 优先级 */
private String priority;
/** 处理类 */
private String handle_class;
/** 处理状态 */
private String handle_status;
/** 车号 */
private String car_no;
/** 是否自动下发 */
private Boolean is_auto_issue;
/** 任务组标识 */
private Long task_group_id;

View File

@@ -34,10 +34,10 @@ public class SchBaseTaskconfigDto implements Serializable {
private String priority;
/** 允许最大任务生成数 */
private BigDecimal task_create_num;
private Integer task_create_max_num;
/** 允许最大任务下发数 */
private BigDecimal task_issue_num;
private Integer task_issue_max_num;
/** 是否自动下发 */
private Boolean is_auto_issue;

View File

@@ -1,12 +1,14 @@
package org.nl.wms.sch.task.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException;
@@ -14,17 +16,20 @@ import org.nl.common.utils.SecurityUtils;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.dao.mapper.SchBaseTaskMapper;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task_manage.BaseTask;
import org.nl.wms.sch.task_manage.task.TaskFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @description 服务实现
* @author lyd
* @date 2023-05-15
**/
* @author lyd
* @description 服务实现
* @date 2023-05-15
**/
@Slf4j
@Service
public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBaseTask> implements ISchBaseTaskService {
@@ -33,28 +38,14 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
private SchBaseTaskMapper schBaseTaskMapper;
@Override
public IPage<SchBaseTask> queryAll(Map whereJson, PageQuery page){
public IPage<SchBaseTask> queryAll(Map whereJson, PageQuery page) {
LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
IPage<SchBaseTask> pages = new Page<>(page.getPage() + 1, page.getSize());
schBaseTaskMapper.selectPage(pages, lam);
return pages;
}
@Override
public void create(SchBaseTask entity) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
entity.setTask_code(IdUtil.getSnowflake(1, 1).nextIdStr());
entity.setCreate_id(currentUserId);
entity.setCreate_name(nickName);
entity.setCreate_time(now);
entity.setUpdate_id(currentUserId);
entity.setUpdate_name(nickName);
entity.setUpdate_time(now);
schBaseTaskMapper.insert(entity);
}
@Override
public void update(SchBaseTask entity) {
@@ -77,4 +68,43 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
schBaseTaskMapper.deleteBatchIds(ids);
}
@Override
public List<SchBaseTask> findUnFishedTasksByTaskConfig(String config_code) {
return null;
}
@Override
public void create(SchBaseTask entity) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
// if (ObjectUtil.isEmpty(entity.getTask_status())) throw new BadRequestException("任务状态不能为空!");
Assert.notNull(entity.getTask_status(),"任务状态不能为空!");
entity.setTask_code(IdUtil.getSnowflake(1, 1).nextIdStr());
entity.setCreate_id(currentUserId);
entity.setCreate_name(nickName);
entity.setCreate_time(now);
entity.setUpdate_id(currentUserId);
entity.setUpdate_name(nickName);
entity.setUpdate_time(now);
schBaseTaskMapper.insert(entity);
}
@Override
public void apply(JSONObject param) {
String device_code = "123";
String type = "123";
String vehicle_code = "123";
//1、如果是送料检测载具状态
//2、送空载具
//3、叫料
//4、叫空载具
TaskFactory taskFactory = new TaskFactory();
BaseTask task = taskFactory.getTask("HNMLTask");
task.apply(param);
}
}

View File

@@ -0,0 +1,48 @@
package org.nl.wms.sch.task_manage;
import com.alibaba.fastjson.JSONObject;
import org.nl.config.SpringContextHolder;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
import org.nl.wms.sch.task.service.impl.SchBaseTaskServiceImpl;
import org.nl.wms.sch.task.service.impl.SchBaseTaskconfigServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author ldjun
* @version 1.0
* @date 2023年05月16日 16:42
* @desc desc
*/
public abstract class BaseTask {
@Autowired
private ISchBaseTaskService taskService;
public void apply(JSONObject param) {
//1、校验数据
SchBaseTaskconfig taskConfig = SpringContextHolder.getBean(SchBaseTaskconfigServiceImpl.class).getById(null);
Integer tcmn = taskConfig.getTask_create_max_num();
SpringContextHolder.getBean(SchBaseTaskServiceImpl.class);
SchBaseTask task = new SchBaseTask();
task.setAcs_trace_id("");
task.setConfig_code("");
task.setCreate_id("");
task.setCreate_mode("");
task.setPoint_code1("");
task.setVehicle_code("");
// task.setTask_status("01");
SpringContextHolder.getBean(SchBaseTaskServiceImpl.class).create(task);
//1、如果是送料检测载具状态
//2、送空载具
//3、叫料
//4、叫空载具
//校验
}
}

View File

@@ -0,0 +1,23 @@
package org.nl.wms.sch.task_manage.task;
import org.nl.wms.sch.task_manage.BaseTask;
import org.nl.wms.sch.task_manage.task.tasks.HNMLTask;
/**
* @author ldjun
* @version 1.0
* @date 2023年05月16日 16:42
* @desc desc
*/
public class TaskFactory {
//使用 getShape 方法获取形状类型的对象
public BaseTask getTask(String taskType) {
if (taskType == null) {
return null;
}
if (taskType.equalsIgnoreCase("HNMLTask")) {
return new HNMLTask();
}
return null;
}
}

View File

@@ -0,0 +1 @@
package org.nl.wms.sch.task_manage.task;

View File

@@ -1,4 +1,4 @@
package org.nl.wms.sch.task.core.task;
package org.nl.wms.sch.task_manage.task;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSONObject;

View File

@@ -0,0 +1 @@
package org.nl.wms.sch.task_manage.task.core;

View File

@@ -1,4 +1,4 @@
package org.nl.wms.sch.task.core.task.core;
package org.nl.wms.sch.task_manage.task.core;
/**
* @author ldjun

View File

@@ -0,0 +1 @@
package org.nl.wms.sch.task_manage.task.core;

View File

@@ -1,4 +1,4 @@
package org.nl.wms.sch.task.core.task.core;
package org.nl.wms.sch.task_manage.task.core;
/**
* @author ldjun

View File

@@ -1,4 +1,4 @@
package org.nl.wms.sch.task.core.task.core;
package org.nl.wms.sch.task_manage.task.core;
/**
* @author ldjun

View File

@@ -0,0 +1 @@
package org.nl.wms.sch.task_manage.task.core;

View File

@@ -0,0 +1 @@
package org.nl.wms.sch.task_manage.task.core;

View File

@@ -0,0 +1 @@
package org.nl.wms.sch.task_manage.task.core;

View File

@@ -0,0 +1,12 @@
package org.nl.wms.sch.task_manage.task.tasks;
import org.nl.wms.sch.task_manage.BaseTask;
/**
* @author ldjun
* @version 1.0
* @date 2023年05月16日 16:44
* @desc desc
*/
public class HNMLTask extends BaseTask {
}