add:任务管理,任务配置
This commit is contained in:
@@ -82,4 +82,10 @@ public class ClassStandardController {
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.getClassName(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getClass")
|
||||
@Log("根据编码查询基础类型")
|
||||
public ResponseEntity<Object> queryClassBycode(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.queryClassBycode(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,4 +71,11 @@ public interface IMdPbClassstandardService extends IService<MdPbClassstandard> {
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getClassName();
|
||||
|
||||
/**
|
||||
* 根据编码查询基础类型
|
||||
* @param whereJson 入参
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject queryClassBycode(Map whereJson);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package org.nl.wms.basedata_manage.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sun.xml.bind.v2.model.core.ID;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.PageUtil;
|
||||
@@ -324,6 +326,61 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryClassBycode(Map whereJson) {
|
||||
// 判断父节点是否存在
|
||||
String parent_class_code = MapUtil.getStr(whereJson, "parent_class_code");
|
||||
ClassstandardDto classstandardDto = null;
|
||||
if (ObjectUtil.isNotEmpty(parent_class_code)) {
|
||||
MdPbClassstandard classDao = this.getOne(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getClass_code, parent_class_code)
|
||||
);
|
||||
classstandardDto = JSONObject.parseObject(JSONObject.toJSONString(classDao),ClassstandardDto.class);
|
||||
if (classstandardDto == null) {
|
||||
throw new BadRequestException("请输入正确的父节点编号!");
|
||||
}
|
||||
}
|
||||
|
||||
// 查询
|
||||
String class_code = MapUtil.getStr(whereJson, "class_code");
|
||||
LambdaQueryWrapper<MdPbClassstandard> lambda = new QueryWrapper<MdPbClassstandard>().lambda();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(parent_class_code)) {
|
||||
lambda.eq(MdPbClassstandard::getClass_id, classstandardDto.getClass_id())
|
||||
.orderByAsc(MdPbClassstandard::getClass_id);
|
||||
} else if (ObjectUtil.isNotEmpty(class_code)) {
|
||||
lambda.in(MdPbClassstandard::getClass_code, class_code)
|
||||
.orderByAsc(MdPbClassstandard::getClass_id);
|
||||
} else if (ObjectUtil.isEmpty(parent_class_code) || parent_class_code.equals(BaseDataEnum.IS_YES_NOT.code("否"))) {
|
||||
lambda.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, null));
|
||||
lambda.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
lambda.orderByAsc(MdPbClassstandard::getClass_id);
|
||||
}
|
||||
List<ClassstandardDto> classDtoList = this.list(lambda).stream()
|
||||
.map(row -> JSONObject.parseObject(JSONObject.toJSONString(row), ClassstandardDto.class))
|
||||
.collect(Collectors.toList());
|
||||
// 格式化数据
|
||||
classDtoList.forEach(row -> {
|
||||
if (Integer.parseInt(row.getSub_count()) > 0) {
|
||||
row.setHasChildren(true);
|
||||
row.setLeaf(false);
|
||||
} else {
|
||||
row.setHasChildren(false);
|
||||
row.setLeaf(true);
|
||||
}
|
||||
row.setId(row.getClass_id());
|
||||
row.setLabel(row.getClass_name());
|
||||
row.setCreate_user_name(row.getCreate_name());
|
||||
row.setUpdate_user_name(row.getUpdate_optname());
|
||||
});
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("content", classDtoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新节点
|
||||
* @param parent_class_id 父级id
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.ext.service.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.Data;
|
||||
import org.nl.wms.ext.util.BaseResponse;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 下发acs的反馈数据*new
|
||||
* @Date: 2025/05/19
|
||||
*/
|
||||
@Data
|
||||
public class AcsResponse extends BaseResponse {
|
||||
private JSONArray errArr = new JSONArray();
|
||||
private JSONArray data = new JSONArray();
|
||||
|
||||
public static AcsResponse requestRefuse(String message) {
|
||||
AcsResponse result = new AcsResponse();
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
result.setResponseDate(DateUtil.now());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static AcsResponse requestOk() {
|
||||
AcsResponse result = new AcsResponse();
|
||||
result.setCode(HttpStatus.HTTP_OK);
|
||||
result.setMessage("请求成功");
|
||||
result.setResponseDate(DateUtil.now());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.nl.wms.ext.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: ACS 响应的基础实体
|
||||
* @Date: 2025/05/19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseResponse implements Serializable {
|
||||
|
||||
/**
|
||||
* 请求号
|
||||
*/
|
||||
private String requestNo;
|
||||
|
||||
/**
|
||||
* 响应时间
|
||||
*/
|
||||
private String responseDate;
|
||||
|
||||
/**
|
||||
* 结果 200成功
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 扩展信息
|
||||
*/
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
|
||||
public static BaseResponse build(String requestNo) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
response.setMessage("请求成功");
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse responseOk(String requestNo) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
response.setMessage("请求成功");
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse responseOk(String requestNo, String message) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
response.setMessage(message);
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse responseOk(String requestNo, HashMap<String, String> parameters) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
response.setMessage("请求成功");
|
||||
response.setResponseDate(DateUtil.now());
|
||||
response.setParameters(parameters);
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse responseError(String requestNo, String message) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
response.setMessage(message);
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse responseError(String requestNo, int code, String message) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(code);
|
||||
response.setMessage(message);
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.sch_manage.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.dto.SchBaseTaskQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2025-05-19
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
||||
@RequestMapping("/api/schBaseTask")
|
||||
public class SchBaseTaskController {
|
||||
|
||||
@Autowired
|
||||
private ISchBaseTaskService schBaseTaskService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询任务管理")
|
||||
public ResponseEntity<Object> query(SchBaseTaskQuery whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBaseTaskService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增任务管理")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SchBaseTask entity) {
|
||||
schBaseTaskService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改任务管理")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SchBaseTask entity) {
|
||||
schBaseTaskService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除任务管理")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
schBaseTaskService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/taskStatusList")
|
||||
@Log("任务状态下拉框")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getTaskStatusList() {
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBaseTaskService.getTaskStatusList()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/operation")
|
||||
@Log("任务操作")
|
||||
public ResponseEntity<Object> update(@RequestBody Map<String, Object> map) {
|
||||
schBaseTaskService.operation(map);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.wms.sch_manage.controller;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTaskconfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2025-05-19
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
||||
@RequestMapping("/api/schBaseTaskconfig")
|
||||
public class SchBaseTaskconfigController {
|
||||
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService schBaseTaskconfigService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询任务配置")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBaseTaskconfigService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增任务配置")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SchBaseTaskconfig entity) {
|
||||
schBaseTaskconfigService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改任务配置")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SchBaseTaskconfig entity) {
|
||||
schBaseTaskconfigService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除任务配置")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
schBaseTaskconfigService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getTaskConfigList")
|
||||
@Log("获取下拉框")
|
||||
public ResponseEntity<Object> getTaskConfigList() {
|
||||
return new ResponseEntity<>(schBaseTaskconfigService.getTaskConfigList(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package org.nl.wms.sch_manage.enums;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 任务枚举
|
||||
* @Date: 2025/05/19
|
||||
*/
|
||||
public enum TaskStatus {
|
||||
/**
|
||||
* 申请
|
||||
*/
|
||||
CREATE("0", "生成", "生成"),
|
||||
/**
|
||||
* 申请
|
||||
*/
|
||||
APPLY("1", "申请", "申请"),
|
||||
/**
|
||||
* 创建完成
|
||||
*/
|
||||
CREATED("2", "创建完成", "创建完成"),
|
||||
/**
|
||||
* 下发
|
||||
*/
|
||||
ISSUED("3", "下发", "下发"),
|
||||
/**
|
||||
* 执行中
|
||||
*/
|
||||
EXECUTING("4", "执行中", "执行中"),
|
||||
/**
|
||||
* 完成
|
||||
*/
|
||||
FINISHED("5", "完成", "完成"),
|
||||
/**
|
||||
* 已取消
|
||||
*/
|
||||
CANCELED("6", "已取消", "已取消"),
|
||||
/**
|
||||
* 未完成
|
||||
*/
|
||||
UNFINISHED("7", "未完成", "未完成");
|
||||
|
||||
|
||||
TaskStatus(String code, String name, String desc) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
private String code;
|
||||
private String name;
|
||||
private String desc;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.nl.wms.sch_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.dto.SchBaseTaskQuery;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2025-05-19
|
||||
**/
|
||||
public interface ISchBaseTaskService extends IService<SchBaseTask> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBaseTask>
|
||||
*/
|
||||
IPage<SchBaseTask> queryAll(SchBaseTaskQuery whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity /
|
||||
*/
|
||||
void create(SchBaseTask entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param entity /
|
||||
*/
|
||||
void update(SchBaseTask entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 获取任务状态下拉框
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
JSONArray getTaskStatusList();
|
||||
|
||||
/**
|
||||
* 任务操作
|
||||
*
|
||||
* @param param 参数
|
||||
*/
|
||||
void operation(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 获取任务数据
|
||||
*
|
||||
* @param taskCode 任务编码
|
||||
* @return /
|
||||
*/
|
||||
SchBaseTask getByCode(String taskCode);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.nl.wms.sch_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTaskconfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2025-05-19
|
||||
**/
|
||||
public interface ISchBaseTaskconfigService extends IService<SchBaseTaskconfig> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBaseTaskconfig>
|
||||
*/
|
||||
IPage<SchBaseTaskconfig> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity /
|
||||
*/
|
||||
void create(SchBaseTaskconfig entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param entity /
|
||||
*/
|
||||
void update(SchBaseTaskconfig entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 获取下拉框
|
||||
* @return List<SchBaseTaskconfig>
|
||||
*/
|
||||
List<SchBaseTaskconfig> getTaskConfigList();
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package org.nl.wms.sch_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description /
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sch_base_task")
|
||||
public class SchBaseTask implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "task_id")
|
||||
private String task_id;
|
||||
|
||||
|
||||
private String task_code;
|
||||
|
||||
|
||||
private String task_status;
|
||||
|
||||
|
||||
private String config_code;
|
||||
|
||||
|
||||
private String point_code1;
|
||||
|
||||
|
||||
private String point_code2;
|
||||
|
||||
|
||||
private String point_code3;
|
||||
|
||||
|
||||
private String point_code4;
|
||||
|
||||
|
||||
private String group_id;
|
||||
|
||||
|
||||
private String vehicle_type;
|
||||
|
||||
|
||||
private Integer vehicle_qty;
|
||||
|
||||
|
||||
private String vehicle_code;
|
||||
|
||||
|
||||
private String vehicle_code2;
|
||||
|
||||
|
||||
private String handle_status;
|
||||
|
||||
|
||||
private String car_no;
|
||||
|
||||
|
||||
private String task_group_id;
|
||||
|
||||
|
||||
private BigDecimal task_group_seq;
|
||||
|
||||
|
||||
private String finished_type;
|
||||
|
||||
|
||||
private String create_mode;
|
||||
|
||||
|
||||
private String acs_trace_id;
|
||||
|
||||
|
||||
private String request_param;
|
||||
|
||||
|
||||
private String response_param;
|
||||
|
||||
|
||||
private String workshop_code;
|
||||
|
||||
|
||||
private String ext_group_data;
|
||||
|
||||
|
||||
private String remark;
|
||||
|
||||
|
||||
private Boolean is_delete;
|
||||
|
||||
|
||||
private String create_id;
|
||||
|
||||
|
||||
private String priority;
|
||||
|
||||
|
||||
private String create_name;
|
||||
|
||||
|
||||
private String create_time;
|
||||
|
||||
|
||||
private String update_id;
|
||||
|
||||
|
||||
private String update_name;
|
||||
|
||||
private String update_time;
|
||||
@TableField(exist = false)
|
||||
private String config_name;
|
||||
@TableField(exist = false)
|
||||
private String task_name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package org.nl.wms.sch_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description /
|
||||
* @date 2025-05-19
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sch_base_taskconfig")
|
||||
public class SchBaseTaskconfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "config_id")
|
||||
|
||||
private String config_id;
|
||||
|
||||
|
||||
private String config_code;
|
||||
|
||||
|
||||
private String config_name;
|
||||
|
||||
|
||||
private String route_plan_code;
|
||||
|
||||
|
||||
private String task_qf_type;
|
||||
|
||||
|
||||
private String acs_task_type;
|
||||
|
||||
|
||||
private String task_name;
|
||||
|
||||
|
||||
private String task_type;
|
||||
|
||||
|
||||
private String task_direction;
|
||||
|
||||
|
||||
private String priority;
|
||||
|
||||
|
||||
private Integer task_create_max_num;
|
||||
|
||||
|
||||
private Integer task_issue_max_num;
|
||||
|
||||
|
||||
private Boolean is_auto_issue;
|
||||
|
||||
|
||||
private String start_region_str;
|
||||
|
||||
|
||||
private String next_region_str;
|
||||
|
||||
|
||||
private String start_point_pre;
|
||||
|
||||
|
||||
private String next_region_pre;
|
||||
|
||||
|
||||
private Boolean is_check_workorder;
|
||||
|
||||
|
||||
private Boolean is_check_start_lock;
|
||||
|
||||
|
||||
private Boolean is_immediate_create;
|
||||
|
||||
|
||||
private Boolean is_check_next_lock;
|
||||
|
||||
|
||||
private Boolean is_start_auto;
|
||||
|
||||
|
||||
private Boolean is_next_auto;
|
||||
|
||||
|
||||
private Boolean is_lock_start;
|
||||
|
||||
|
||||
private Boolean is_lock_next;
|
||||
|
||||
|
||||
private String request_param;
|
||||
|
||||
|
||||
private String response_param;
|
||||
|
||||
|
||||
private Boolean is_group_congrol_issue_seq;
|
||||
|
||||
|
||||
private BigDecimal unfinish_notify_time;
|
||||
|
||||
|
||||
private String sql_param;
|
||||
|
||||
|
||||
private String workshop_code;
|
||||
|
||||
|
||||
private String remark;
|
||||
|
||||
|
||||
private Boolean is_used;
|
||||
|
||||
|
||||
private Boolean is_delete;
|
||||
|
||||
|
||||
private String create_id;
|
||||
|
||||
|
||||
private String create_name;
|
||||
|
||||
|
||||
private String create_time;
|
||||
|
||||
|
||||
private String update_id;
|
||||
|
||||
|
||||
private String update_name;
|
||||
|
||||
|
||||
private String update_time;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> start_region_strs;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> next_region_strs;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.wms.sch_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.dto.SchBaseTaskQuery;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> {
|
||||
|
||||
int getEmptyVehicleCarryingByDevice(String deviceCode);
|
||||
|
||||
BigDecimal getCallMaterialCarryingByDevice(String deviceCode);
|
||||
|
||||
int getCarryingByDevice(String deviceCode, String taskConfig);
|
||||
|
||||
IPage<SchBaseTask> selectPageLeftJoin(IPage<SchBaseTask> pages, SchBaseTaskQuery whereJson, List<String> collect);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.sch_manage.service.dao.mapper.SchBaseTaskMapper">
|
||||
|
||||
<select id="getEmptyVehicleCarryingByDevice" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM `sch_base_task` t
|
||||
LEFT JOIN sch_base_point p1 ON p1.point_code = t.point_code4
|
||||
LEFT JOIN sch_base_point p2 ON p2.point_code = #{deviceCode}
|
||||
WHERE t.config_code = 'FJMLTask'
|
||||
AND t.point_code4 IS NOT NULL
|
||||
AND t.task_status IN ('1', '2', '3', '4')
|
||||
AND p1.parent_point_code = p2.parent_point_code
|
||||
</select>
|
||||
<select id="getCarryingByDevice" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM `sch_base_task` t
|
||||
LEFT JOIN sch_base_point p1 ON p1.point_code = t.point_code4
|
||||
LEFT JOIN sch_base_point p2 ON p2.point_code = #{deviceCode}
|
||||
WHERE t.config_code = #{taskConfig}
|
||||
AND t.point_code4 IS NOT NULL
|
||||
AND t.task_status IN ('1', '2', '3', '4')
|
||||
AND p1.parent_point_code = p2.parent_point_code
|
||||
</select>
|
||||
<select id="getCallMaterialCarryingByDevice" resultType="java.math.BigDecimal">
|
||||
SELECT COALESCE(SUM(vg.material_qty), 0) AS total_material_qty
|
||||
FROM `sch_base_task` t
|
||||
LEFT JOIN sch_base_point p1 ON p1.point_code = t.point_code2
|
||||
LEFT JOIN sch_base_point p2 ON p2.point_code = #{deviceCode}
|
||||
LEFT JOIN sch_base_vehiclematerialgroup vg ON vg.group_id = t.group_id
|
||||
WHERE t.config_code = 'FJQLTask'
|
||||
AND t.point_code2 IS NOT NULL
|
||||
AND t.task_status IN ('1', '2', '3', '4')
|
||||
AND p1.parent_point_code = p2.parent_point_code
|
||||
</select>
|
||||
<select id="selectPageLeftJoin" resultType="org.nl.wms.sch_manage.service.dao.SchBaseTask">
|
||||
SELECT
|
||||
t.*,
|
||||
tc.config_name,
|
||||
tc.task_name
|
||||
FROM
|
||||
`sch_base_task` t
|
||||
LEFT JOIN sch_base_taskconfig tc ON tc.config_code = t.config_code
|
||||
<where>
|
||||
<if test="whereJson.task_code != null">
|
||||
AND t.task_code = #{whereJson.task_code}
|
||||
</if>
|
||||
<if test="whereJson.config_code != null">
|
||||
AND t.config_code = #{whereJson.config_code}
|
||||
</if>
|
||||
<if test="whereJson.point_code != null">
|
||||
AND (t.point_code1 LIKE '%${whereJson.point_code}%'
|
||||
OR t.point_code2 LIKE '%${whereJson.point_code}%')
|
||||
</if>
|
||||
<if test="whereJson.unFinished != null">
|
||||
AND t.task_status <![CDATA[<=]]> #{whereJson.unFinished}
|
||||
</if>
|
||||
<if test="whereJson.vehicle_code != null">
|
||||
AND t.vehicle_code = #{whereJson.vehicle_code}
|
||||
</if>
|
||||
<if test="whereJson.end_time != null">
|
||||
AND t.create_time <![CDATA[<=]]> #{whereJson.end_time}
|
||||
</if>
|
||||
<if test="whereJson.begin_time != null">
|
||||
AND t.create_time <![CDATA[>=]]> #{whereJson.begin_time}
|
||||
</if>
|
||||
<if test="collect != null and collect != ''">
|
||||
AND t.task_status IN
|
||||
<foreach collection="collect" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.sch_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTaskconfig;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2025-05-19
|
||||
**/
|
||||
public interface SchBaseTaskconfigMapper extends BaseMapper<SchBaseTaskconfig> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.sch_manage.service.dao.mapper.SchBaseTaskconfigMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.sch_manage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2025-05-19
|
||||
* **/
|
||||
@Data
|
||||
public class SchBaseTaskQuery implements Serializable {
|
||||
private String task_code;
|
||||
private String vehicle_code;
|
||||
private String point_code;
|
||||
private String begin_time;
|
||||
private String end_time;
|
||||
private String more_task_status;
|
||||
private String unFinished;
|
||||
|
||||
private String config_code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package org.nl.wms.sch_manage.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.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.dao.mapper.SchBaseTaskMapper;
|
||||
import org.nl.wms.sch_manage.service.dto.SchBaseTaskQuery;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.TaskFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2025-05-19
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBaseTask> implements ISchBaseTaskService {
|
||||
|
||||
@Autowired
|
||||
private SchBaseTaskMapper schBaseTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
|
||||
@Override
|
||||
public IPage<SchBaseTask> queryAll(SchBaseTaskQuery whereJson, PageQuery page) {
|
||||
List<String> collect = ObjectUtil.isNotEmpty(whereJson.getMore_task_status())
|
||||
? Arrays.stream(whereJson.getMore_task_status().split(",")).collect(Collectors.toList()) : null;
|
||||
if (collect != null) {
|
||||
if (collect.contains(TaskStatus.UNFINISHED.getCode())) {
|
||||
collect = null;
|
||||
whereJson.setUnFinished(TaskStatus.EXECUTING.getCode());
|
||||
}
|
||||
}
|
||||
IPage<SchBaseTask> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pages = schBaseTaskMapper.selectPageLeftJoin(pages, whereJson, collect);
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(SchBaseTask entity) {
|
||||
SchBaseTask dto = schBaseTaskMapper.selectById(entity.getTask_code());
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
schBaseTaskMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
schBaseTaskMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(SchBaseTask entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
Assert.notNull(entity.getTask_status(), "任务状态不能为空!");
|
||||
|
||||
entity.setTask_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
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 JSONArray getTaskStatusList() {
|
||||
TaskStatus[] values = TaskStatus.values();
|
||||
JSONArray arr = new JSONArray();
|
||||
for (TaskStatus value : values) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", value.getCode());
|
||||
json.put("name", value.getName());
|
||||
arr.add(json);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operation(Map<String, Object> param) {
|
||||
String task_code = ObjectUtil.isNotEmpty(param.get("task_code")) ? param.get("task_code").toString() : null;
|
||||
String method_name = ObjectUtil.isNotEmpty(param.get("method_name")) ? param.get("method_name").toString() : null;
|
||||
String config_code = ObjectUtil.isNotEmpty(param.get("config_code")) ? param.get("config_code").toString() : null;
|
||||
if (ObjectUtil.isEmpty(task_code) || ObjectUtil.isEmpty(method_name) || ObjectUtil.isEmpty(config_code)) {
|
||||
throw new BadRequestException("操作失败");
|
||||
}
|
||||
// 根据配置去工厂类获得类对象
|
||||
String processing_class = config_code;
|
||||
String message = "";
|
||||
// 根据任务类型获取对应的任务操作类
|
||||
AbstractTask abstractTask = taskFactory.getTask(processing_class);
|
||||
// 调用每个任务类的method_name()强制结束方法
|
||||
JSONObject result;
|
||||
switch (method_name) {
|
||||
case "immediateNotifyAcs":
|
||||
//
|
||||
break;
|
||||
// 强制完成
|
||||
case "forceFinish":
|
||||
abstractTask.forceFinish(task_code);
|
||||
break;
|
||||
case "cancel":
|
||||
abstractTask.cancel(task_code);
|
||||
break;
|
||||
case "back":
|
||||
abstractTask.backMes(task_code);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBaseTask getByCode(String taskCode) {
|
||||
LambdaQueryWrapper<SchBaseTask> lam = new QueryWrapper<SchBaseTask>().lambda();
|
||||
lam.eq(SchBaseTask::getTask_code, taskCode);
|
||||
lam.eq(SchBaseTask::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
return this.getOne(lam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package org.nl.wms.sch_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch_manage.service.dao.mapper.SchBaseTaskconfigMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2025-05-19
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SchBaseTaskconfigServiceImpl extends ServiceImpl<SchBaseTaskconfigMapper, SchBaseTaskconfig> implements ISchBaseTaskconfigService {
|
||||
|
||||
@Autowired
|
||||
private SchBaseTaskconfigMapper schBaseTaskconfigMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SchBaseTaskconfig> queryAll(Map whereJson, PageQuery page) {
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null;
|
||||
String workshop_code = ObjectUtil.isNotEmpty(whereJson.get("workshop_code")) ? whereJson.get("workshop_code").toString() : null;
|
||||
LambdaQueryWrapper<SchBaseTaskconfig> lam = new LambdaQueryWrapper<>();
|
||||
lam.like(ObjectUtil.isNotEmpty(blurry), SchBaseTaskconfig::getConfig_name, blurry)
|
||||
.or(ObjectUtil.isNotEmpty(blurry), la -> la.like( SchBaseTaskconfig::getConfig_code, blurry))
|
||||
.eq(ObjectUtil.isNotEmpty(workshop_code), SchBaseTaskconfig::getWorkshop_code, workshop_code);
|
||||
IPage<SchBaseTaskconfig> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
schBaseTaskconfigMapper.selectPage(pages, lam);
|
||||
pages.getRecords().forEach(config -> {
|
||||
if (ObjectUtil.isNotEmpty(config.getStart_region_str())) {
|
||||
config.setStart_region_strs(Arrays.asList(config.getStart_region_str().split(",")));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(config.getNext_region_str())) {
|
||||
config.setNext_region_strs(Arrays.asList(config.getNext_region_str().split(",")));
|
||||
}
|
||||
});
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(SchBaseTaskconfig entity) {
|
||||
SchBaseTaskconfig schBaseTaskconfig = schBaseTaskconfigMapper.selectOne(new LambdaQueryWrapper<SchBaseTaskconfig>().eq(SchBaseTaskconfig::getConfig_code, entity.getConfig_code()));
|
||||
if (ObjectUtil.isNotEmpty(schBaseTaskconfig)) {
|
||||
throw new BadRequestException("任务配置【" + entity.getConfig_code() + "】已存在!");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
if (ObjectUtil.isAllEmpty(entity.getStart_region_strs(), entity.getNext_region_strs())) {
|
||||
throw new BadRequestException("起点区域和终点区域不能同时为空!");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
entity.setConfig_id(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);
|
||||
schBaseTaskconfigMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(SchBaseTaskconfig entity) {
|
||||
SchBaseTaskconfig dto = schBaseTaskconfigMapper.selectById(entity.getConfig_id());
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
if (ObjectUtil.isAllEmpty(entity.getStart_region_strs(), entity.getNext_region_strs())) {
|
||||
throw new BadRequestException("起点区域和终点区域不能同时为空!");
|
||||
}
|
||||
|
||||
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 nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
schBaseTaskconfigMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
schBaseTaskconfigMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBaseTaskconfig> getTaskConfigList() {
|
||||
return this.list();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext.service.util.AcsResponse;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTaskconfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @version 1.0
|
||||
* @date 2025年05月19日
|
||||
* @desc 任务抽象父类,申请任务的相关率先判断以及生成,接着到子类执行任务的创建,最后统一通过定时任务去下发到ACS
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public abstract class AbstractTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
/* @Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;*/
|
||||
|
||||
/**
|
||||
* 任务创建
|
||||
* 根据配置生成任务
|
||||
*/
|
||||
public abstract String create(JSONObject json);
|
||||
|
||||
/**
|
||||
* 下发acs前参数整理
|
||||
* @param taskId
|
||||
*/
|
||||
public abstract AcsTaskDto sendAcsParam(String taskId);
|
||||
|
||||
/**
|
||||
* @return WCS的任务集合
|
||||
* @discription 重新下发给wcs任务
|
||||
* @author ldjun
|
||||
* @created 2020年6月12日 下午5:52:28
|
||||
*/
|
||||
protected AcsResponse renotifyAcs(SchBaseTask task) {
|
||||
Assert.notNull(task);
|
||||
List<SchBaseTask> taskList = new ArrayList<>();
|
||||
taskList.add(task);
|
||||
return this.renotifyAcs(taskList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WCS的任务集合
|
||||
* @discription 重新下发给wcs任务
|
||||
* @author ldjun
|
||||
* @created 2020年6月12日 下午5:52:28
|
||||
*/
|
||||
@SneakyThrows
|
||||
protected AcsResponse renotifyAcs(List<SchBaseTask> taskList) {
|
||||
AcsResponse resultForAcs = AcsResponse.requestOk();
|
||||
//1、获取任务
|
||||
//2、根据任务配置补全任务
|
||||
//3、下发
|
||||
List<AcsTaskDto> list = new ArrayList<>();
|
||||
for (SchBaseTask task : taskList) {
|
||||
AcsTaskDto taskDto = new AcsTaskDto();
|
||||
String responseParam = task.getResponse_param();
|
||||
if (ObjectUtil.isNotEmpty(responseParam)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(responseParam);
|
||||
taskDto.setDirection(jsonObject.getString("direction"));
|
||||
taskDto.setPut_device_code(jsonObject.getString("fmj_device"));
|
||||
}
|
||||
taskDto.setExt_task_uuid(task.getTask_id());
|
||||
taskDto.setTask_code(task.getTask_code());
|
||||
taskDto.setRoute_plan_code("normal");
|
||||
taskDto.setVehicle_code(task.getVehicle_code());
|
||||
taskDto.setVehicle_code2(task.getVehicle_code2());
|
||||
this.setTask(task.getConfig_code(), taskDto);
|
||||
list.add(taskDto);
|
||||
}
|
||||
try {
|
||||
// 创建下发对象
|
||||
// TODO resultForAcs = wmsToAcsService.renotifyAcs(list);
|
||||
} catch (Exception e) {
|
||||
log.error("任务下发异常: {}", e.getMessage());
|
||||
resultForAcs.setResponseDate(DateUtil.now());
|
||||
resultForAcs.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
resultForAcs.setMessage(e.getMessage());
|
||||
}
|
||||
// 如果下发完毕,就修改状态
|
||||
if (resultForAcs.getCode() == HttpStatus.HTTP_OK) {
|
||||
// 解析
|
||||
JSONArray errArr = resultForAcs.getErrArr();
|
||||
for (SchBaseTask schBaseTask : taskList) {
|
||||
schBaseTask.setTask_status(TaskStatus.ISSUED.getCode());
|
||||
// 判断是否是出错的任务
|
||||
for (int i = 0; ObjectUtil.isNotEmpty(errArr) && i < errArr.size(); i++) {
|
||||
JSONObject errObj = errArr.getJSONObject(i);
|
||||
String taskCode = errObj.getString("task_code");
|
||||
if (taskCode.equals(schBaseTask.getTask_code())) {
|
||||
// 出错的任务就设置出错信息为备注,不是出错就设置下发
|
||||
schBaseTask.setTask_status(TaskStatus.CREATED.getCode());
|
||||
schBaseTask.setRemark(errObj.getString("message"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
taskService.updateBatchById(taskList);
|
||||
}
|
||||
return resultForAcs;
|
||||
}
|
||||
|
||||
private AcsTaskDto setTask(String configCode, AcsTaskDto taskDto) {
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, configCode));
|
||||
taskDto.setPriority(taskConfig.getPriority());
|
||||
taskDto.setTask_type(taskConfig.getAcs_task_type());
|
||||
taskDto.setRoute_plan_code(taskConfig.getRoute_plan_code());
|
||||
return taskDto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
*/
|
||||
public void schedule() {
|
||||
this.autoCreate();
|
||||
// 下发
|
||||
this.getAllFinishTask();
|
||||
}
|
||||
|
||||
public void getAllFinishTask() {
|
||||
List<SchBaseTask> list = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.CREATED.getCode()));
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
// 下发
|
||||
this.renotifyAcs(list);
|
||||
}
|
||||
|
||||
public void updateTaskStatus(String taskCode, TaskStatus status) {
|
||||
this.updateStatus(taskCode, status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 自动生成任务
|
||||
*/
|
||||
protected void autoCreate() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 以下改为public会出现自动注入类出现问题
|
||||
*
|
||||
* @param task_code
|
||||
* @param status
|
||||
*/
|
||||
protected abstract void updateStatus(String task_code, TaskStatus status);
|
||||
|
||||
|
||||
/**
|
||||
* 首先组盘在下发任务
|
||||
*
|
||||
* @param param 具体参数
|
||||
*/
|
||||
public String setGroupPlate(JSONObject param) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制结束完成任务
|
||||
*
|
||||
* @param task_code
|
||||
*/
|
||||
public abstract void forceFinish(String task_code);
|
||||
|
||||
/**
|
||||
* 取消任务,货物搬回原点
|
||||
*
|
||||
* @param task_code
|
||||
*/
|
||||
public abstract void cancel(String task_code);
|
||||
|
||||
/**
|
||||
* 申请任务
|
||||
*
|
||||
* @param param
|
||||
* @throws BadRequestException
|
||||
*/
|
||||
public void apply(JSONObject param) throws BadRequestException {
|
||||
}
|
||||
|
||||
public abstract void backMes(String task_code);
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 任务Dto
|
||||
* @Date: 2025/05/19
|
||||
*/
|
||||
@Data
|
||||
public class AcsTaskDto {
|
||||
/**
|
||||
* 任务标识
|
||||
*/
|
||||
private String ext_task_uuid;
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
private String task_code;
|
||||
|
||||
|
||||
/**
|
||||
* 取货点1
|
||||
*/
|
||||
String start_device_code;
|
||||
|
||||
/**
|
||||
* 放货点1
|
||||
*/
|
||||
String next_device_code;
|
||||
|
||||
/**
|
||||
* 取货点2
|
||||
*/
|
||||
String start_device_code2;
|
||||
|
||||
/**
|
||||
* 放货点2
|
||||
*/
|
||||
String next_device_code2;
|
||||
|
||||
/**
|
||||
* 对接位
|
||||
*/
|
||||
String put_device_code;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
String priority;
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
String vehicle_code;
|
||||
|
||||
/**
|
||||
* 载具号2
|
||||
*/
|
||||
String vehicle_code2;
|
||||
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
String vehicle_type;
|
||||
|
||||
/**
|
||||
* 路由方案
|
||||
*/
|
||||
String route_plan_code;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
String task_type;
|
||||
|
||||
/**
|
||||
* 立库任务类型
|
||||
*/
|
||||
String dtl_type;
|
||||
|
||||
/**
|
||||
* Agv系统类型
|
||||
* 1:1楼叉车系统
|
||||
* 2:2楼1区域AGV系统
|
||||
* 3:2楼2区域AGV系统
|
||||
*/
|
||||
String agv_system_type;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String remark;
|
||||
|
||||
/**
|
||||
* 烘箱时间
|
||||
*/
|
||||
String oven_time;
|
||||
|
||||
/**
|
||||
* 烘箱温度
|
||||
*/
|
||||
String temperature;
|
||||
|
||||
/**
|
||||
* agv取货高度
|
||||
*/
|
||||
private String start_height;
|
||||
|
||||
/**
|
||||
* agv放货高度
|
||||
*/
|
||||
private String next_height;
|
||||
|
||||
/**
|
||||
* 方向 1往左 2往右
|
||||
*/
|
||||
private String direction;
|
||||
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
Map<String, String> params;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuyx
|
||||
* @version 3.0
|
||||
* @date 2025年05月19日
|
||||
* @desc 2.0 采用获取注解来标识任务类型,并通过扫描和反射的方式来获取任务实例
|
||||
* 3.0 采用获取所有bean对象判断是否为AbstractTask
|
||||
*/
|
||||
@Component
|
||||
public class TaskFactory implements BeanPostProcessor {
|
||||
private final Map<String, AbstractTask> taskMap;
|
||||
|
||||
@Autowired
|
||||
public TaskFactory() {
|
||||
taskMap = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof AbstractTask) {
|
||||
taskMap.put(beanName, (AbstractTask) bean);
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
public AbstractTask getTask(String taskType) {
|
||||
if (taskType == null) {
|
||||
return null;
|
||||
}
|
||||
return taskMap.get(taskType);
|
||||
}
|
||||
}
|
||||
400
wms/nladmin-ui/src/views/wms/sch/task/index.vue
Normal file
400
wms/nladmin-ui/src/views/wms/sch/task/index.vue
Normal file
@@ -0,0 +1,400 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="任务号">
|
||||
<label slot="label">任 务 号:</label>
|
||||
<el-input
|
||||
v-model="query.task_code"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
placeholder="任务号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="载具号">
|
||||
<label slot="label">载 具 号:</label>
|
||||
<el-input
|
||||
v-model="query.vehicle_code"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
placeholder="载具号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务名称">
|
||||
<label slot="label">任务名称:</label>
|
||||
<el-select v-model="query.config_code" placeholder="请选择" style="width: 240px" @change="crud.toQuery" clearable>
|
||||
<el-option
|
||||
v-for="item in taskConfigList"
|
||||
:key="item.config_id"
|
||||
:label="item.task_name"
|
||||
:value="item.config_code">
|
||||
<span style="float: left">{{ item.config_code }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.task_name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="点位编码">
|
||||
<el-input
|
||||
v-model="query.point_code"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
placeholder="起点"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="datetimerange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
@change="crud.toQuery">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务状态">
|
||||
<el-select
|
||||
v-model="query.task_status"
|
||||
multiple
|
||||
style="width: 360px"
|
||||
placeholder="任务状态"
|
||||
class="filter-item"
|
||||
clearable
|
||||
@change="handTaskStatus"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in taskStatusList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="800px">
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="115px" label-suffix=":">
|
||||
<el-form-item label="任务编码">
|
||||
<el-input v-model="form.task_code" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务分类">
|
||||
<el-input v-model="form.task_class_id" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务状态">
|
||||
<el-input v-model="form.task_status" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配置编码">
|
||||
<el-input v-model="form.config_code" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位1">
|
||||
<el-input v-model="form.point_code1" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位2">
|
||||
<el-input v-model="form.point_code2" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位3">
|
||||
<el-input v-model="form.point_code3" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位4">
|
||||
<el-input v-model="form.point_code4" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="载具类型">
|
||||
<el-input v-model="form.vehicle_type" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="载具数量">
|
||||
<el-input v-model="form.vehicle_qty" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="载具编码">
|
||||
<el-input v-model="form.vehicle_code" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="优先级">-->
|
||||
<!-- <el-input v-model="form.priority" style="width: 240px;" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item v-if="false" label="处理类">
|
||||
<el-input v-model="form.handle_class" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="处理状态">
|
||||
<el-input v-model="form.handle_status" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车号">
|
||||
<el-input v-model="form.car_no" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务组标识">
|
||||
<el-input v-model="form.task_group_id" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务组顺序号">
|
||||
<el-input v-model="form.task_group_seq" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务完成类型">
|
||||
<el-input v-model="form.finished_type" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生成方式">
|
||||
<el-input v-model="form.create_mode" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="链路标识">
|
||||
<el-input v-model="form.acs_trace_id" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="false" label="生成任务的请求参数">
|
||||
<el-input v-model="form.request_param" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下发任务的请求参数">
|
||||
<el-input v-model="form.response_param" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车间编码">
|
||||
<el-input v-model="form.workshop_code" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="额外组盘信息">
|
||||
<el-input v-model="form.ext_group_data" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="task_code" label="任务编码" :min-width="flexWidth('task_code',crud.data,'任务编码')" />
|
||||
<el-table-column prop="vehicle_code" label="载具编码1" :min-width="flexWidth('vehicle_code',crud.data,'载具编码1')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.vehicle_code ? scope.row.vehicle_code : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="vehicle_code2" label="载具编码2" :min-width="flexWidth('vehicle_code2',crud.data,'载具编码2')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.vehicle_code2 ? scope.row.vehicle_code2 : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="task_class_id" label="任务分类" :min-width="flexWidth('task_class_id',crud.data,'任务分类')" />-->
|
||||
<el-table-column prop="task_status" label="任务状态" :min-width="flexWidth('task_status',crud.data,'任务状态')">
|
||||
<template slot-scope="scope">
|
||||
{{ getStatusName(scope.row.task_status) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="提示信息" :min-width="flexWidth('remark',crud.data,'提示信息')" />
|
||||
<el-table-column prop="config_code" label="配置编码" :min-width="flexWidth('config_code',crud.data,'配置编码')" />
|
||||
<el-table-column prop="task_name" label="配置名称" :min-width="flexWidth('task_name',crud.data,'任务名称')" />
|
||||
<el-table-column prop="point_code1" label="起点1" :min-width="flexWidth('point_code1',crud.data,'点位1')" />
|
||||
<el-table-column prop="point_code2" label="终点1" :min-width="flexWidth('point_code2',crud.data,'点位2')" />
|
||||
<el-table-column prop="point_code3" label="起点2" :min-width="flexWidth('point_code3',crud.data,'点位3')" />
|
||||
<el-table-column prop="point_code4" label="终点2" :min-width="flexWidth('point_code4',crud.data,'点位4')" />
|
||||
<el-table-column prop="vehicle_type" label="载具类型" :min-width="flexWidth('vehicle_type',crud.data,'载具类型', 20)">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="vehicle_qty" label="载具数量" :min-width="flexWidth('vehicle_qty',crud.data,'载具数量')" />
|
||||
<el-table-column v-if="false" prop="priority" label="优先级" :min-width="flexWidth('priority',crud.data,'优先级')" />
|
||||
<el-table-column v-if="false" prop="handle_class" label="处理类" :min-width="flexWidth('handle_class',crud.data,'处理类')" />
|
||||
<el-table-column v-if="false" prop="handle_status" label="处理状态" :min-width="flexWidth('handle_status',crud.data,'处理状态')" />
|
||||
<el-table-column prop="car_no" label="车号" :min-width="flexWidth('car_no',crud.data,'车号')" />
|
||||
<el-table-column prop="task_group_id" label="任务组标识" :min-width="flexWidth('task_group_id',crud.data,'任务组标识')" />
|
||||
<el-table-column prop="task_group_seq" label="任务组顺序号" :min-width="flexWidth('task_group_seq',crud.data,'任务组顺序号')" />
|
||||
<el-table-column prop="finished_type" label="任务完成类型" :min-width="flexWidth('finished_type',crud.data,'任务完成类型')">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.finished_type[scope.row.finished_type]?dict.label.finished_type[scope.row.finished_type]:'未完成' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_mode" label="生成方式" :min-width="flexWidth('create_mode',crud.data,'生成方式')" >
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.create_mode[scope.row.create_mode] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="acs_trace_id" label="链路标识" :min-width="flexWidth('acs_trace_id',crud.data,'链路标识')" />
|
||||
<el-table-column prop="request_param" label="生成任务的请求参数" :min-width="flexWidth('request_param',crud.data,'生成任务的请求参数')" />
|
||||
<el-table-column prop="response_param" label="下发任务的请求参数" :min-width="flexWidth('response_param',crud.data,'下发任务的请求参数')" />
|
||||
<el-table-column prop="workshop_code" label="车间编码" :min-width="flexWidth('workshop_code',crud.data,'车间编码')" />
|
||||
<el-table-column prop="ext_group_data" label="额外组盘信息" :min-width="flexWidth('ext_group_data',crud.data,'额外组盘信息')" />
|
||||
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
<el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
|
||||
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
|
||||
<el-table-column v-permission="[]" label="操作" width="160px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-upload"-->
|
||||
<!-- @click="doOperate(scope.row, 'c')"-->
|
||||
<!-- >下发</el-button>-->
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-success"
|
||||
@click="doOperate(scope.row, 'a')"
|
||||
:disabled="scope.row.task_status==='5' || scope.row.task_status==='6'"
|
||||
>完成</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-error"
|
||||
@click="doOperate(scope.row, 'b')"
|
||||
:disabled="scope.row.task_status==='5' || scope.row.task_status==='6'"
|
||||
>取消</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudSchBaseTask from '@/views/wms/sch/task/task'
|
||||
import crudSchBaseTaskconfig from '@/views/wms/sch/taskconfig/taskconfig'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = {
|
||||
task_id: null,
|
||||
task_code: null,
|
||||
task_class_id: null,
|
||||
task_status: null,
|
||||
config_code: null,
|
||||
point_code1: null,
|
||||
point_code2: null,
|
||||
point_code3: null,
|
||||
point_code4: null,
|
||||
vehicle_type: null,
|
||||
vehicle_qty: null,
|
||||
vehicle_code: null,
|
||||
vehicle_code2: null,
|
||||
priority: null,
|
||||
handle_class: null,
|
||||
handle_status: null,
|
||||
car_no: null,
|
||||
task_group_id: null,
|
||||
task_group_seq: null,
|
||||
finished_type: null,
|
||||
create_mode: null,
|
||||
acs_trace_id: null,
|
||||
request_param: null,
|
||||
response_param: null,
|
||||
workshop_code: null,
|
||||
ext_group_data: null,
|
||||
remark: null,
|
||||
is_delete: false
|
||||
}
|
||||
export default {
|
||||
name: 'Task',
|
||||
dicts: ['vehicle_type', 'create_mode', 'finished_type'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '任务管理',
|
||||
url: 'api/schBaseTask',
|
||||
idField: 'task_id',
|
||||
sort: 'task_code,desc',
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
},
|
||||
crudMethod: { ...crudSchBaseTask }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
},
|
||||
taskStatusList: [],
|
||||
taskConfigList: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTaskStatusList()
|
||||
this.getTaskConfigList()
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
getTaskConfigList() {
|
||||
crudSchBaseTaskconfig.getTaskConfigList().then(res => {
|
||||
this.taskConfigList = res
|
||||
})
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
handTaskStatus(value) {
|
||||
this.crud.query.more_task_status = null
|
||||
if (value) {
|
||||
this.crud.query.more_task_status = value.toString()
|
||||
}
|
||||
this.crud.toQuery()
|
||||
},
|
||||
getTaskStatusList() {
|
||||
crudSchBaseTask.getTaskStatusList().then(res => {
|
||||
this.taskStatusList = res.content
|
||||
})
|
||||
},
|
||||
getStatusName(code) {
|
||||
const status = this.taskStatusList.find(item => item.code === code)
|
||||
return status ? status.name : '-'
|
||||
},
|
||||
doOperate(row, command) {
|
||||
let method_name = ''
|
||||
switch (command) {
|
||||
case 'a':// 完成
|
||||
method_name = 'forceFinish'
|
||||
break
|
||||
case 'b':// 取消
|
||||
method_name = 'cancel'
|
||||
break
|
||||
case 'c':// 下发
|
||||
method_name = 'immediateNotifyAcs'
|
||||
break
|
||||
case 'd':// 详情
|
||||
method_name = 'view'
|
||||
break
|
||||
}
|
||||
if (method_name === 'view') {
|
||||
// this.view(row)
|
||||
return
|
||||
}
|
||||
const data = {
|
||||
task_code: row.task_code,
|
||||
method_name: method_name,
|
||||
config_code: row.config_code
|
||||
}
|
||||
crudSchBaseTask.operation(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
42
wms/nladmin-ui/src/views/wms/sch/task/task.js
Normal file
42
wms/nladmin-ui/src/views/wms/sch/task/task.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/schBaseTask',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/schBaseTask/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/schBaseTask',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getTaskStatusList() {
|
||||
return request({
|
||||
url: 'api/schBaseTask/taskStatusList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function operation(data) {
|
||||
return request({
|
||||
url: 'api/schBaseTask/operation',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getTaskStatusList, operation}
|
||||
509
wms/nladmin-ui/src/views/wms/sch/taskconfig/index.vue
Normal file
509
wms/nladmin-ui/src/views/wms/sch/taskconfig/index.vue
Normal file
@@ -0,0 +1,509 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="所属车间">
|
||||
<el-select
|
||||
v-model="query.workshop_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="所属车间"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in workShopList"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模糊搜索">
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="编码名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="820px">
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="135px" label-suffix=":">
|
||||
<el-form-item label="所属车间">
|
||||
<el-select
|
||||
v-model="form.workshop_code"
|
||||
placeholder="请选择"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in workShopList"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="配置编码" prop="config_code">
|
||||
<el-input v-model="form.config_code" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配置名称">
|
||||
<el-input v-model="form.config_name" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务取放类型">
|
||||
<el-select
|
||||
v-model="form.task_qf_type"
|
||||
size="mini"
|
||||
placeholder="任务取放类型"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.task_qf_type"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="acs任务类型" prop="acs_task_type">
|
||||
<el-select
|
||||
v-model="form.acs_task_type"
|
||||
size="mini"
|
||||
placeholder="acs任务类型"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.acs_task_type"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务名字">
|
||||
<el-input v-model="form.task_name" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务类型">
|
||||
<el-select
|
||||
v-model="form.task_type"
|
||||
size="mini"
|
||||
placeholder="任务类型"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.task_type"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="优先级" pro="priority">
|
||||
<el-input-number
|
||||
v-model.number="form.priority"
|
||||
:min="1"
|
||||
:max="999"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务生成数上限" prop="task_create_max_num">
|
||||
<el-input-number
|
||||
v-model.number="form.task_create_max_num"
|
||||
:min="1"
|
||||
:max="999"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否自动下发">
|
||||
<el-radio-group v-model="form.is_auto_issue" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务下发数上限" prop="task_issue_max_num">
|
||||
<el-input-number
|
||||
v-model.number="form.task_issue_max_num"
|
||||
:min="1"
|
||||
:max="999"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="起点区域">
|
||||
<el-select v-model="form.start_region_strs" multiple placeholder="请选择" style="width: 240px;">
|
||||
<el-option
|
||||
v-for="item in regionList"
|
||||
:key="item.region_code"
|
||||
:label="item.region_name"
|
||||
:value="item.region_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="终点区域">
|
||||
<el-select v-model="form.next_region_strs" multiple placeholder="请选择" style="width: 240px;">
|
||||
<el-option
|
||||
v-for="item in regionList"
|
||||
:key="item.region_code"
|
||||
:label="item.region_name"
|
||||
:value="item.region_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="起点前缀">
|
||||
<el-input v-model="form.start_point_pre" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="终点前缀">
|
||||
<el-input v-model="form.next_region_pre" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务方向" prop="task_direction">
|
||||
<el-select
|
||||
v-model="form.task_direction"
|
||||
size="mini"
|
||||
placeholder="任务方向"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.task_direction"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否校验工单">
|
||||
<el-radio-group v-model="form.is_check_workorder" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否判断起点锁">
|
||||
<el-radio-group v-model="form.is_check_start_lock" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否立即创建">
|
||||
<el-radio-group v-model="form.is_immediate_create" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否判断终点锁">
|
||||
<el-radio-group v-model="form.is_check_next_lock" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否起点自动">
|
||||
<el-radio-group v-model="form.is_start_auto" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否终点自动">
|
||||
<el-radio-group v-model="form.is_next_auto" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否锁定起点">
|
||||
<el-radio-group v-model="form.is_lock_start" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否锁定终点">
|
||||
<el-radio-group v-model="form.is_lock_next" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="false" label="生成任务的请求参数">
|
||||
<el-input v-model="form.request_param" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="false" label="下发任务的请求参数">
|
||||
<el-input v-model="form.response_param" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="false" label="是否按组控制下发顺序">
|
||||
<el-radio-group v-model="form.is_group_congrol_issue_seq" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="路由编码" prop="route_plan_code">
|
||||
<el-input v-model="form.route_plan_code" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="未完成通知时间" prop="unfinish_notify_time">
|
||||
<el-input-number
|
||||
v-model.number="form.unfinish_notify_time"
|
||||
:min="0"
|
||||
:max="999"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="false" label="sql配置">
|
||||
<el-input v-model="form.sql_param" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="false" label="车间编码">
|
||||
<el-input v-model="form.workshop_code" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
<el-input v-model.trim="form.remark" style="width: 480px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="config_code" label="配置编码" :min-width="flexWidth('config_code',crud.data,'配置编码')" />
|
||||
<el-table-column prop="config_name" label="配置名称" :min-width="flexWidth('config_name',crud.data,'配置名称')" />
|
||||
<el-table-column prop="task_qf_type" label="任务取放类型" :min-width="flexWidth('task_qf_type',crud.data,'任务取放类型')">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.task_qf_type[scope.row.task_qf_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="acs_task_type" label="acs任务类型" :min-width="flexWidth('acs_task_type',crud.data,'acs任务类型')">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.acs_task_type[scope.row.acs_task_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="task_name" label="任务名字" :min-width="flexWidth('task_name',crud.data,'任务名字')" />
|
||||
<el-table-column prop="task_type" label="任务类型" :min-width="flexWidth('task_type',crud.data,'任务类型', 20)" >
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.task_type[scope.row.task_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="priority" label="优先级" :min-width="flexWidth('priority',crud.data,'优先级')" />
|
||||
<el-table-column prop="task_create_max_num" label="任务生成数上限" :min-width="flexWidth('task_create_max_num',crud.data,'任务生成数上限')" />
|
||||
<el-table-column prop="task_issue_max_num" label="任务下发数上限" :min-width="flexWidth('task_issue_max_num',crud.data,'任务下发数上限')" />
|
||||
<el-table-column prop="is_auto_issue" label="是否自动下发" :min-width="flexWidth('is_auto_issue',crud.data,'是否自动下发')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_auto_issue?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="start_region_str" label="起点区域" :min-width="flexWidth('start_region_str',crud.data,'起点区域')">
|
||||
<template slot-scope="scope">
|
||||
{{ getRegionNames(scope.row.start_region_str) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="next_region_str" label="终点区域" :min-width="flexWidth('next_region_str',crud.data,'终点区域')">
|
||||
<template slot-scope="scope">
|
||||
{{ getRegionNames(scope.row.next_region_str) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="start_point_pre" label="起点前缀" :min-width="flexWidth('start_point_pre',crud.data,'起点前缀')" />
|
||||
<el-table-column prop="next_region_pre" label="终点前缀" :min-width="flexWidth('next_region_pre',crud.data,'终点前缀')" />
|
||||
<el-table-column prop="route_plan_code" label="路由编码" :min-width="flexWidth('route_plan_code',crud.data,'终点前缀')" />
|
||||
<el-table-column prop="task_direction" label="任务方向" :min-width="flexWidth('task_direction',crud.data,'终点前缀')" >
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.task_direction[scope.row.task_direction] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_check_workorder" label="是否校验工单" :min-width="flexWidth('is_check_workorder',crud.data,'是否校验工单')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_check_workorder?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_check_start_lock" label="是否判断起点锁" :min-width="flexWidth('is_check_start_lock',crud.data,'是否判断起点锁')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_check_start_lock?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_immediate_create" label="是否立即创建" :min-width="flexWidth('is_immediate_create',crud.data,'是否立即创建')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_immediate_create?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_check_next_lock" label="是否判断终点锁" :min-width="flexWidth('is_check_next_lock',crud.data,'是否判断终点锁')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_check_next_lock?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_start_auto" label="是否起点自动" :min-width="flexWidth('is_start_auto',crud.data,'是否起点自动')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_start_auto?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_next_auto" label="是否终点自动" :min-width="flexWidth('is_next_auto',crud.data,'是否终点自动')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_next_auto?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_lock_start" label="是否锁定起点" :min-width="flexWidth('is_lock_start',crud.data,'是否锁定起点')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_lock_start?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_lock_next" label="是否锁定终点" :min-width="flexWidth('is_lock_next',crud.data,'是否锁定终点')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_lock_next?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="false" prop="request_param" label="生成任务的请求参数" :min-width="flexWidth('request_param',crud.data,'生成任务的请求参数')" />
|
||||
<el-table-column v-if="false" prop="response_param" label="下发任务的请求参数" :min-width="flexWidth('response_param',crud.data,'下发任务的请求参数')" />
|
||||
<el-table-column v-if="false" prop="is_group_congrol_issue_seq" label="是否按组控制下发顺序" :min-width="flexWidth('is_group_congrol_issue_seq',crud.data,'是否按组控制下发顺序')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_group_congrol_issue_seq?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unfinish_notify_time" label="未完成通知时间" :min-width="flexWidth('unfinish_notify_time',crud.data,'未完成通知时间')" />
|
||||
<el-table-column v-if="false" prop="sql_param" label="sql配置" :min-width="flexWidth('sql_param',crud.data,'sql配置')" />
|
||||
<el-table-column prop="workshop_code" label="车间编码" :min-width="flexWidth('workshop_code',crud.data,'车间编码')" />
|
||||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
|
||||
<!-- <el-table-column prop="is_used" label="是否启用" :min-width="flexWidth('is_used',crud.data,'是否启用')"/>-->
|
||||
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
<el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
|
||||
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudSchBaseTaskconfig from '@/views/wms/sch/taskconfig/taskconfig'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation.vue'
|
||||
import crudOperation from '@crud/CRUD.operation.vue'
|
||||
import udOperation from '@crud/UD.operation.vue'
|
||||
import pagination from '@crud/Pagination.vue'
|
||||
|
||||
const defaultForm = {
|
||||
config_id: null,
|
||||
config_code: null,
|
||||
config_name: null,
|
||||
task_qf_type: null,
|
||||
acs_task_type: null,
|
||||
task_name: null,
|
||||
task_type: null,
|
||||
priority: null,
|
||||
task_create_max_num: null,
|
||||
task_issue_max_num: null,
|
||||
is_auto_issue: true,
|
||||
start_region_str: null,
|
||||
next_region_str: null,
|
||||
start_point_pre: null,
|
||||
next_region_pre: null,
|
||||
is_check_workorder: true,
|
||||
is_check_start_lock: false,
|
||||
is_immediate_create: true,
|
||||
is_check_next_lock: false,
|
||||
is_start_auto: true,
|
||||
is_next_auto: true,
|
||||
is_lock_start: false,
|
||||
is_lock_next: false,
|
||||
request_param: null,
|
||||
response_param: null,
|
||||
is_group_congrol_issue_seq: false,
|
||||
unfinish_notify_time: null,
|
||||
sql_param: null,
|
||||
route_plan_code: null,
|
||||
workshop_code: null,
|
||||
task_direction: null,
|
||||
remark: null,
|
||||
is_used: true,
|
||||
is_delete: false,
|
||||
start_region_strs: null,
|
||||
next_region_strs: null
|
||||
}
|
||||
export default {
|
||||
name: 'TaskConfig',
|
||||
dicts: ['task_qf_type', 'acs_task_type', 'task_direction', 'task_type'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '任务配置',
|
||||
url: 'api/schBaseTaskconfig',
|
||||
idField: 'config_id',
|
||||
sort: 'config_code,desc',
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: false,
|
||||
del: true,
|
||||
download: false,
|
||||
reset: true
|
||||
},
|
||||
crudMethod: { ...crudSchBaseTaskconfig }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
config_code: [
|
||||
{ required: true, message: '请输入配置编码', trigger: 'blur' }
|
||||
],
|
||||
acs_task_type: [
|
||||
{ required: true, message: '请输入acs类型', trigger: 'blur' }
|
||||
],
|
||||
task_create_max_num: [
|
||||
{ required: true, message: '请输入最大任务生成数', trigger: 'blur' }
|
||||
],
|
||||
task_issue_max_num: [
|
||||
{ required: true, message: '请输入最大任务下发数', trigger: 'blur' }
|
||||
],
|
||||
unfinish_notify_time: [
|
||||
{ required: true, message: '请输入任务未完成通知时间数', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
workShopList: [
|
||||
{ 'name': '第一车间', 'code': 'A1' }
|
||||
],
|
||||
regionList: [
|
||||
{ 'region_name': '区域A', 'region_code': 'A2' }
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getRegionNames() {
|
||||
return (nextRegionStr) => {
|
||||
if (!nextRegionStr) {
|
||||
return '-'
|
||||
}
|
||||
const regionCodes = nextRegionStr.split(',').map(code => code.trim())
|
||||
const regionNames = regionCodes
|
||||
.map(code => {
|
||||
const region = this.regionList.find(item => item.region_code === code)
|
||||
return region ? region.region_name : ''
|
||||
})
|
||||
.filter(name => name !== '')
|
||||
|
||||
return regionNames.join('、')
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
33
wms/nladmin-ui/src/views/wms/sch/taskconfig/taskconfig.js
Normal file
33
wms/nladmin-ui/src/views/wms/sch/taskconfig/taskconfig.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/schBaseTaskconfig',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function getTaskConfigList() {
|
||||
return request({
|
||||
url: 'api/schBaseTaskconfig/getTaskConfigList',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/schBaseTaskconfig/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/schBaseTaskconfig',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getTaskConfigList }
|
||||
Reference in New Issue
Block a user