feat:PC 下发任务

This commit is contained in:
2026-07-24 16:23:19 +08:00
parent 4805e6482f
commit 62454c77c1
20 changed files with 687 additions and 330 deletions

View File

@@ -34,7 +34,7 @@ public class AcsUtil {
response = HttpUtils.post(url, headers(), JsonUtils.toJsonString(request));
} catch (RuntimeException ex) {
if (isNetworkException(ex)) {
throw new ServerException(500, "ACS服务网络不通");
throw new ServiceException(500, "ACS服务网络不通");
}
throw ex;
}

View File

@@ -0,0 +1,34 @@
package cn.code.nl.module.base.api.classstandard;
import cn.code.nl.framework.common.pojo.CommonResult;
import cn.code.nl.module.base.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* RPC 服务 - 基础数据分类标准
*
* @author zhouz
*/
@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - 基础数据分类标准")
public interface ClassStandardApi {
String PREFIX = ApiConstants.PREFIX + "/class-standard";
/**
* 根据分类编码获取该分类及所有子分类编码
*
* @param classCode 分类编码
* @return 分类编码列表
*/
@GetMapping(PREFIX + "/code-list-by-code")
@Operation(summary = "根据分类编码获取该分类及所有子分类编码")
CommonResult<List<String>> getClassStandardCodeListByCode(@RequestParam("classCode") String classCode);
}

View File

@@ -0,0 +1,46 @@
package cn.code.nl.module.base.api;
import cn.code.nl.framework.common.pojo.CommonResult;
import cn.code.nl.module.base.api.classstandard.ClassStandardApi;
import cn.code.nl.module.base.dal.dataobject.classstandard.ClassStandardDO;
import cn.code.nl.module.base.service.classstandard.ClassStandardService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static cn.code.nl.framework.common.pojo.CommonResult.success;
import static cn.code.nl.framework.common.util.collection.CollectionUtils.convertList;
/**
* RPC API - 基础数据分类标准(供其它模块 Feign 调用)
*
* @author zhouz
*/
@Tag(name = "RPC API - 基础数据分类标准")
@RestController
@RequestMapping("/rpc-api/base/class-standard")
@Validated
public class ClassStandardApiController implements ClassStandardApi {
@Resource
private ClassStandardService classStandardService;
/**
* 根据分类编码获取该分类及所有子分类编码
*/
@GetMapping("/code-list-by-code")
@Operation(summary = "根据分类编码获取该分类及所有子分类编码")
@Override
public CommonResult<List<String>> getClassStandardCodeListByCode(@RequestParam("classCode") String classCode) {
List<ClassStandardDO> list = classStandardService.getClassStandardListByCode(classCode);
return success(convertList(list, ClassStandardDO::getClassCode));
}
}

View File

@@ -15,6 +15,9 @@ public class ClassStandardSimpleRespVO {
@Schema(description = "分类标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long classId;
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "原材料")
private String classCode;
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "原材料")
private String className;

View File

@@ -34,6 +34,10 @@ public interface TransportTaskApi {
@Operation(summary = "接收 LMS/WMS 业务处理结果")
CommonResult<Boolean> receiveCallbackResult(@Valid @RequestBody TaskCallbackResultReqDTO reqDTO);
@PostMapping(PREFIX + "/issue")
@Operation(summary = "根据 taskId 下发搬运任务")
CommonResult<Boolean> issueTransportTask(@RequestParam("taskId") Long taskId);
@GetMapping(PREFIX + "/getTaskById")
@Operation(summary = "根据 taskId 查询任务")
CommonResult<TaskInfoDTO> getTaskById(@RequestParam("taskId") Long taskId);

View File

@@ -16,5 +16,6 @@ public interface ErrorCodeConstants {
ErrorCode TRANSPORT_TASK_RUNNING_ALREADY_EXIST = new ErrorCode(5005, "已存在运行中的任务");
ErrorCode TRANSPORT_TASK_OPERATION_NOT_SUPPORTED = new ErrorCode(5006, "不支持的任务操作类型");
ErrorCode TRANSPORT_TASK_ALREADY_FINAL = new ErrorCode(5007, "任务已处于终态,不允许操作");
ErrorCode TRANSPORT_TASK_AUTO_ISSUE_NOT_ALLOW_MANUAL = new ErrorCode(5008, "自动任务不允许手动下发");
}

View File

@@ -0,0 +1,22 @@
package cn.code.nl.module.task.enums;
import lombok.Getter;
/**
*
* @Author: liyongde
* @Date: 2026/7/24 16:13
*/
@Getter
public enum TaskCreateModelEnum {
AUTO("1", "自动创建"),
MANUAL("0", "创建人工");
private final String code;
private final String name;
TaskCreateModelEnum(String code, String name) {
this.code = code;
this.name = name;
}
}

View File

@@ -42,6 +42,11 @@
<artifactId>nl-module-task-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.nl.cloud</groupId>
<artifactId>nl-module-base-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>
@@ -164,4 +169,4 @@
</plugins>
</build>
</project>
</project>

View File

@@ -36,6 +36,12 @@ public class TransportTaskApiImpl implements TransportTaskApi {
return success(true);
}
@Override
public CommonResult<Boolean> issueTransportTask(Long taskId) {
transportTaskService.issueTransportTask(taskId);
return success(true);
}
@Override
public CommonResult<TaskInfoDTO> getTaskById(Long taskId) {
return success(transportTaskService.getTaskInfoById(taskId));

View File

@@ -1,112 +1,121 @@
package cn.code.nl.module.task.controller.admin.transporttask;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.code.nl.framework.common.pojo.PageParam;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.pojo.CommonResult;
import cn.code.nl.framework.common.util.object.BeanUtils;
import static cn.code.nl.framework.common.pojo.CommonResult.success;
import cn.code.nl.framework.excel.core.util.ExcelUtils;
import cn.code.nl.framework.apilog.core.annotation.ApiAccessLog;
import static cn.code.nl.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.code.nl.module.task.controller.admin.transporttask.vo.*;
import cn.code.nl.module.task.dal.dataobject.transporttask.TransportTaskDO;
import cn.code.nl.module.task.service.transporttask.TransportTaskService;
@Tag(name = "管理后台 - 搬运任务")
@RestController
@RequestMapping("/task/transport-task")
@Validated
public class TransportTaskController {
@Resource
private TransportTaskService transportTaskService;
@PostMapping("/create")
@Operation(summary = "创建搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:create')")
public CommonResult<Long> createTransportTask(@Valid @RequestBody TransportTaskSaveReqVO createReqVO) {
return success(transportTaskService.createTransportTask(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:update')")
public CommonResult<Boolean> updateTransportTask(@Valid @RequestBody TransportTaskSaveReqVO updateReqVO) {
transportTaskService.updateTransportTask(updateReqVO);
return success(true);
}
@PostMapping("/operate")
@Operation(summary = "PC 端操作搬运任务(完成/取消/强制完成)")
@PreAuthorize("@ss.hasPermission('task:transport-task:operate')")
public CommonResult<Boolean> operateTransportTask(@Valid @RequestBody TransportTaskOperateReqVO reqVO) {
transportTaskService.operateTransportTask(reqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除搬运任务")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('task:transport-task:delete')")
public CommonResult<Boolean> deleteTransportTask(@RequestParam("id") Long id) {
transportTaskService.deleteTransportTask(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:delete')")
public CommonResult<Boolean> deleteTransportTaskList(@RequestParam("ids") List<Long> ids) {
transportTaskService.deleteTransportTaskListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得搬运任务")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('task:transport-task:query')")
public CommonResult<TransportTaskRespVO> getTransportTask(@RequestParam("id") Long id) {
TransportTaskDO transportTask = transportTaskService.getTransportTask(id);
return success(BeanUtils.toBean(transportTask, TransportTaskRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得搬运任务分页")
@PreAuthorize("@ss.hasPermission('task:transport-task:query')")
public CommonResult<PageResult<TransportTaskRespVO>> getTransportTaskPage(@Valid TransportTaskPageReqVO pageReqVO) {
PageResult<TransportTaskDO> pageResult = transportTaskService.getTransportTaskPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, TransportTaskRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出搬运任务 Excel")
@PreAuthorize("@ss.hasPermission('task:transport-task:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportTransportTaskExcel(@Valid TransportTaskPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<TransportTaskDO> list = transportTaskService.getTransportTaskPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "搬运任务.xls", "数据", TransportTaskRespVO.class,
BeanUtils.toBean(list, TransportTaskRespVO.class));
}
}
package cn.code.nl.module.task.controller.admin.transporttask;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.code.nl.framework.common.pojo.PageParam;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.pojo.CommonResult;
import cn.code.nl.framework.common.util.object.BeanUtils;
import static cn.code.nl.framework.common.pojo.CommonResult.success;
import cn.code.nl.framework.excel.core.util.ExcelUtils;
import cn.code.nl.framework.apilog.core.annotation.ApiAccessLog;
import static cn.code.nl.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.code.nl.module.task.controller.admin.transporttask.vo.*;
import cn.code.nl.module.task.dal.dataobject.transporttask.TransportTaskDO;
import cn.code.nl.module.task.service.transporttask.TransportTaskService;
@Tag(name = "管理后台 - 搬运任务")
@RestController
@RequestMapping("/task/transport-task")
@Validated
public class TransportTaskController {
@Resource
private TransportTaskService transportTaskService;
@PostMapping("/create")
@Operation(summary = "创建搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:create')")
public CommonResult<Long> createTransportTask(@Valid @RequestBody TransportTaskSaveReqVO createReqVO) {
return success(transportTaskService.createTransportTask(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:update')")
public CommonResult<Boolean> updateTransportTask(@Valid @RequestBody TransportTaskSaveReqVO updateReqVO) {
transportTaskService.updateTransportTask(updateReqVO);
return success(true);
}
@PostMapping("/operate")
@Operation(summary = "PC 端操作搬运任务(完成/取消/强制完成)")
@PreAuthorize("@ss.hasPermission('task:transport-task:operate')")
public CommonResult<Boolean> operateTransportTask(@Valid @RequestBody TransportTaskOperateReqVO reqVO) {
transportTaskService.operateTransportTask(reqVO);
return success(true);
}
@PostMapping("/issue")
@Operation(summary = "PC 端下发搬运任务到 ACS")
@Parameter(name = "taskId", description = "任务ID", required = true)
@PreAuthorize("@ss.hasPermission('task:transport-task:issue')")
public CommonResult<Boolean> issueTransportTask(@RequestParam("taskId") Long taskId) {
transportTaskService.issueTransportTask(taskId);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除搬运任务")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('task:transport-task:delete')")
public CommonResult<Boolean> deleteTransportTask(@RequestParam("id") Long id) {
transportTaskService.deleteTransportTask(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:delete')")
public CommonResult<Boolean> deleteTransportTaskList(@RequestParam("ids") List<Long> ids) {
transportTaskService.deleteTransportTaskListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得搬运任务")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('task:transport-task:query')")
public CommonResult<TransportTaskRespVO> getTransportTask(@RequestParam("id") Long id) {
TransportTaskDO transportTask = transportTaskService.getTransportTask(id);
return success(BeanUtils.toBean(transportTask, TransportTaskRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得搬运任务分页")
@PreAuthorize("@ss.hasPermission('task:transport-task:query')")
public CommonResult<PageResult<TransportTaskRespVO>> getTransportTaskPage(@Valid TransportTaskPageReqVO pageReqVO) {
PageResult<TransportTaskDO> pageResult = transportTaskService.getTransportTaskPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, TransportTaskRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出搬运任务 Excel")
@PreAuthorize("@ss.hasPermission('task:transport-task:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportTransportTaskExcel(@Valid TransportTaskPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<TransportTaskDO> list = transportTaskService.getTransportTaskPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "搬运任务.xls", "数据", TransportTaskRespVO.class,
BeanUtils.toBean(list, TransportTaskRespVO.class));
}
}

View File

@@ -34,6 +34,9 @@ public class TransportTaskPageReqVO extends PageParam {
@Schema(description = "任务类型", example = "2")
private String taskType;
@Schema(description = "任务类型及子类型编码列表", hidden = true)
private List<String> taskTypeList;
@Schema(description = "任务状态(支持多选)", example = "[\"10\", \"50\"]")
private List<String> taskStatus;
@@ -119,4 +122,4 @@ public class TransportTaskPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
}

View File

@@ -1,162 +1,162 @@
package cn.code.nl.module.task.controller.admin.transporttask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
import cn.code.nl.framework.excel.core.annotations.DictFormat;
import cn.code.nl.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 搬运任务 Response VO")
@Data
@ExcelIgnoreUnannotated
public class TransportTaskRespVO {
@Schema(description = "任务标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "11528")
@ExcelProperty("任务标识")
private Long taskId;
@Schema(description = "任务编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("任务编码")
private String taskCode;
@Schema(description = "任务名称", example = "张三")
@ExcelProperty("任务名称")
private String taskName;
@Schema(description = "业务归属服务LMS/WMS用于完成取消事件一级路由", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("业务归属服务LMS/WMS用于完成取消事件一级路由")
private String ownerService;
@Schema(description = "业务类型", example = "2")
@ExcelProperty("业务类型")
private String bizType;
@Schema(description = "业务侧标识", example = "31008")
@ExcelProperty("业务侧标识")
private String bizId;
@Schema(description = "业务回调处理器编码")
@ExcelProperty("业务回调处理器编码")
private String handleCode;
@Schema(description = "任务类型", example = "2")
@ExcelProperty("任务类型")
private String taskType;
@Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("任务状态")
private String taskStatus;
@Schema(description = "ACS任务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("ACS任务类型")
private String acsTaskType;
@Schema(description = "AGV系统类型", example = "1")
@ExcelProperty("AGV系统类型")
private String agvSystemType;
@Schema(description = "ACS外部任务号")
@ExcelProperty("ACS外部任务号")
private String externalTaskNo;
@Schema(description = "取货点1")
@ExcelProperty("取货点1")
private String pointCode1;
@Schema(description = "放货点1")
@ExcelProperty("放货点1")
private String pointCode2;
@Schema(description = "取货点2")
@ExcelProperty("取货点2")
private String pointCode3;
@Schema(description = "放货点2")
@ExcelProperty("放货点2")
private String pointCode4;
@Schema(description = "载具类型", example = "2")
@ExcelProperty("载具类型")
private String vehicleType;
@Schema(description = "载具数量", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("载具数量")
private Long vehicleQty;
@Schema(description = "载具编码")
@ExcelProperty("载具编码")
private String vehicleCode;
@Schema(description = "载具编码2")
@ExcelProperty("载具编码2")
private String vehicleCode2;
@Schema(description = "车号")
@ExcelProperty("车号")
private String carNo;
@Schema(description = "优先级", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("优先级")
private String priority;
@Schema(description = "生产区域")
@ExcelProperty("生产区域")
private String productArea;
@Schema(description = "是否自动下发", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否自动下发")
private String isAutoIssue;
@Schema(description = "任务组标识", example = "21169")
@ExcelProperty("任务组标识")
private Long taskGroupId;
@Schema(description = "任务组顺序号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("任务组顺序号")
private Long sortSeq;
@Schema(description = "任务完成类型", example = "1")
@ExcelProperty("任务完成类型")
private String finishedType;
@Schema(description = "业务回调状态PENDING/SUCCESS/FAILED", example = "2")
@ExcelProperty("业务回调状态PENDING/SUCCESS/FAILED")
private String callbackStatus;
@Schema(description = "业务回调重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2146")
@ExcelProperty("业务回调重试次数")
private Integer callbackRetryCount;
@Schema(description = "业务回调失败原因")
@ExcelProperty("业务回调失败原因")
private String callbackErrorMsg;
@Schema(description = "生成方式", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "生成方式", converter = DictConvert.class)
@DictFormat("user_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String createMode;
@Schema(description = "创建任务请求参数")
@ExcelProperty("创建任务请求参数")
private String requestParam;
@Schema(description = "下发ACS的AcsTaskDto扩展报文")
@ExcelProperty("下发ACS的AcsTaskDto扩展报文")
private String dispatchParam;
@Schema(description = "ACS反馈参数")
@ExcelProperty("ACS反馈参数")
private String resultParam;
@Schema(description = "备注", example = "你说的对")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
package cn.code.nl.module.task.controller.admin.transporttask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
import cn.code.nl.framework.excel.core.annotations.DictFormat;
import cn.code.nl.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 搬运任务 Response VO")
@Data
@ExcelIgnoreUnannotated
public class TransportTaskRespVO {
@Schema(description = "任务标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "11528")
@ExcelProperty("任务标识")
private Long taskId;
@Schema(description = "任务编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("任务编码")
private String taskCode;
@Schema(description = "任务名称", example = "张三")
@ExcelProperty("任务名称")
private String taskName;
@Schema(description = "业务归属服务LMS/WMS用于完成取消事件一级路由", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("业务归属服务LMS/WMS用于完成取消事件一级路由")
private String ownerService;
@Schema(description = "业务类型", example = "2")
@ExcelProperty("业务类型")
private String bizType;
@Schema(description = "业务侧标识", example = "31008")
@ExcelProperty("业务侧标识")
private String bizId;
@Schema(description = "业务回调处理器编码")
@ExcelProperty("业务回调处理器编码")
private String handleCode;
@Schema(description = "任务类型", example = "2")
@ExcelProperty("任务类型")
private String taskType;
@Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("任务状态")
private String taskStatus;
@Schema(description = "ACS任务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("ACS任务类型")
private String acsTaskType;
@Schema(description = "AGV系统类型", example = "1")
@ExcelProperty("AGV系统类型")
private String agvSystemType;
@Schema(description = "ACS外部任务号")
@ExcelProperty("ACS外部任务号")
private String externalTaskNo;
@Schema(description = "取货点1")
@ExcelProperty("取货点1")
private String pointCode1;
@Schema(description = "放货点1")
@ExcelProperty("放货点1")
private String pointCode2;
@Schema(description = "取货点2")
@ExcelProperty("取货点2")
private String pointCode3;
@Schema(description = "放货点2")
@ExcelProperty("放货点2")
private String pointCode4;
@Schema(description = "载具类型", example = "2")
@ExcelProperty("载具类型")
private String vehicleType;
@Schema(description = "载具数量", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("载具数量")
private Long vehicleQty;
@Schema(description = "载具编码")
@ExcelProperty("载具编码")
private String vehicleCode;
@Schema(description = "载具编码2")
@ExcelProperty("载具编码2")
private String vehicleCode2;
@Schema(description = "车号")
@ExcelProperty("车号")
private String carNo;
@Schema(description = "优先级", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("优先级")
private String priority;
@Schema(description = "生产区域")
@ExcelProperty("生产区域")
private String productArea;
@Schema(description = "是否自动下发", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否自动下发")
private String isAutoIssue;
@Schema(description = "任务组标识", example = "21169")
@ExcelProperty("任务组标识")
private Long taskGroupId;
@Schema(description = "任务组顺序号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("任务组顺序号")
private Long sortSeq;
@Schema(description = "任务完成类型", example = "1")
@ExcelProperty("任务完成类型")
private String finishedType;
@Schema(description = "业务回调状态PENDING/SUCCESS/FAILED", example = "2")
@ExcelProperty("业务回调状态PENDING/SUCCESS/FAILED")
private String callbackStatus;
@Schema(description = "业务回调重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2146")
@ExcelProperty("业务回调重试次数")
private Integer callbackRetryCount;
@Schema(description = "业务回调失败原因")
@ExcelProperty("业务回调失败原因")
private String callbackErrorMsg;
@Schema(description = "生成方式", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "生成方式", converter = DictConvert.class)
@DictFormat("task_create_mode")
private String createMode;
@Schema(description = "创建任务请求参数")
@ExcelProperty("创建任务请求参数")
private String requestParam;
@Schema(description = "下发ACS的AcsTaskDto扩展报文")
@ExcelProperty("下发ACS的AcsTaskDto扩展报文")
private String dispatchParam;
@Schema(description = "ACS反馈参数")
@ExcelProperty("ACS反馈参数")
private String resultParam;
@Schema(description = "备注", example = "你说的对")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -27,7 +27,7 @@ public interface TransportTaskMapper extends BaseMapperX<TransportTaskDO> {
.eqIfPresent(TransportTaskDO::getBizType, reqVO.getBizType())
.eqIfPresent(TransportTaskDO::getBizId, reqVO.getBizId())
.eqIfPresent(TransportTaskDO::getHandleCode, reqVO.getHandleCode())
.eqIfPresent(TransportTaskDO::getTaskType, reqVO.getTaskType())
.inIfPresent(TransportTaskDO::getTaskType, reqVO.getTaskTypeList())
.inIfPresent(TransportTaskDO::getTaskStatus, reqVO.getTaskStatus())
.eqIfPresent(TransportTaskDO::getAcsTaskType, reqVO.getAcsTaskType())
.eqIfPresent(TransportTaskDO::getAgvSystemType, reqVO.getAgvSystemType())

View File

@@ -76,6 +76,13 @@ public interface TransportTaskService {
*/
void operateTransportTask(@Valid TransportTaskOperateReqVO reqVO);
/**
* 根据任务ID下发搬运任务到 ACS
*
* @param taskId 任务ID
*/
void issueTransportTask(Long taskId);
/**
* 根据 taskId 查询任务全量信息RPC 用,自动过滤逻辑删除,查不到返回 null
*

View File

@@ -2,6 +2,7 @@ package cn.code.nl.module.task.service.transporttask;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.util.object.BeanUtils;
import cn.code.nl.module.base.api.classstandard.ClassStandardApi;
import cn.code.nl.module.task.controller.admin.transporttask.vo.TransportTaskOperateReqVO;
import cn.code.nl.module.task.controller.admin.transporttask.vo.TransportTaskPageReqVO;
import cn.code.nl.module.task.controller.admin.transporttask.vo.TransportTaskSaveReqVO;
@@ -19,6 +20,7 @@ import cn.code.nl.module.task.manage.TransportTaskIssueManager;
import cn.code.nl.module.task.manage.TransportTaskOperateCheckManager;
import cn.code.nl.module.task.manage.TransportTaskOperationManager;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -29,8 +31,10 @@ import java.util.List;
import static cn.code.nl.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.code.nl.module.task.enums.ErrorCodeConstants.TRANSPORT_TASK_ALREADY_FINAL;
import static cn.code.nl.module.task.enums.ErrorCodeConstants.TRANSPORT_TASK_AUTO_ISSUE_NOT_ALLOW_MANUAL;
import static cn.code.nl.module.task.enums.ErrorCodeConstants.TRANSPORT_TASK_NOT_EXISTS;
import static cn.code.nl.module.task.enums.ErrorCodeConstants.TRANSPORT_TASK_OPERATION_NOT_SUPPORTED;
import static cn.code.nl.module.task.enums.ErrorCodeConstants.TRANSPORT_TASK_STATUS_NOT_ALLOW;
/**
* 搬运任务 Service 实现类
@@ -54,6 +58,9 @@ public class TransportTaskServiceImpl implements TransportTaskService {
@Resource
private TransportTaskOperateCheckManager transportTaskOperateCheckManager;
@Resource
private ClassStandardApi classStandardApi;
@Override
public Long createTransportTask(TransportTaskSaveReqVO createReqVO) {
TransportTaskDO transportTask = BeanUtils.toBean(createReqVO, TransportTaskDO.class);
@@ -111,6 +118,10 @@ public class TransportTaskServiceImpl implements TransportTaskService {
@Override
public PageResult<TransportTaskDO> getTransportTaskPage(TransportTaskPageReqVO pageReqVO) {
if (StrUtil.isNotBlank(pageReqVO.getTaskType())) {
List<String> taskTypeList = classStandardApi.getClassStandardCodeListByCode(pageReqVO.getTaskType()).getCheckedData();
pageReqVO.setTaskTypeList(CollUtil.isNotEmpty(taskTypeList) ? taskTypeList : List.of(pageReqVO.getTaskType()));
}
return transportTaskMapper.selectPage(pageReqVO);
}
@@ -148,6 +159,23 @@ public class TransportTaskServiceImpl implements TransportTaskService {
transportTaskOperationManager.dispatchOperation(task, type, reqDTO);
}
/**
* 根据任务ID手动下发任务到 ACS复用自动下发的数组接口逻辑
*
* @param taskId 任务ID
*/
@Override
public void issueTransportTask(Long taskId) {
TransportTaskDO task = transportTaskMapper.selectById(taskId);
if (task == null) {
throw exception(TRANSPORT_TASK_NOT_EXISTS);
}
if ("1".equals(task.getIsAutoIssue())) {
throw exception(TRANSPORT_TASK_AUTO_ISSUE_NOT_ALLOW_MANUAL);
}
transportTaskIssueManager.issueTasks(List.of(task));
}
@Override
public TaskInfoDTO getTaskInfoById(Long taskId) {
TransportTaskDO task = transportTaskMapper.selectById(taskId);

View File

@@ -93,4 +93,8 @@ export function operateTransportTask(data: {
return requestClient.post('/task/transport-task/operate', data);
}
/** PC 端下发搬运任务到 ACS */
export function issueTransportTask(taskId: number | string) {
return requestClient.post(`/task/transport-task/issue?taskId=${taskId}`);
}

View File

@@ -1,12 +1,12 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { BaseMaterialBaseApi } from '#/api/base/materialbase';
import type {VbenFormSchema} from '#/adapter/form';
import type {VxeTableGridOptions} from '#/adapter/vxe-table';
import type {BaseMaterialBaseApi} from '#/api/base/materialbase';
import { handleTree } from '@vben/utils';
import {handleTree} from '@vben/utils';
import { getClassStandardList, getClassStandardListByCode } from '#/api/base/classstandard';
import { getSimpleMeasureUnitList } from '#/api/base/measureunit';
import { getRangePickerDefaultProps } from '#/utils';
import {getClassStandardList, getClassStandardListByCode} from '#/api/base/classstandard';
import {getSimpleMeasureUnitList} from '#/api/base/measureunit';
import {getRangePickerDefaultProps} from '#/utils';
// ========== 分类映射classId → className ==========
const classNameMap: Record<number, string> = {};
@@ -46,102 +46,218 @@ async function loadMeasureUnitList() {
// ========== 新增/修改的表单 ==========
export function useFormSchema(): VbenFormSchema[] {
return [
{ fieldName: 'materialId', component: 'Input', dependencies: { triggerFields: [''], show: () => false } },
{ fieldName: 'materialCode', label: '物料编码', rules: 'required', component: 'Input', componentProps: { placeholder: '请输入物料编码' } },
{ fieldName: 'materialName', label: '物料名称', rules: 'required', component: 'Input', componentProps: { placeholder: '请输入物料名称' } },
{ fieldName: 'materialSpec', label: '规格', component: 'Input', componentProps: { placeholder: '请输入规格' } },
{ fieldName: 'materialModel', label: '型号', component: 'Input', componentProps: { placeholder: '请输入型号' } },
{ fieldName: 'englishName', label: '外文名称', component: 'Input', componentProps: { placeholder: '请输入外文名称' } },
{
fieldName: 'materialId',
component: 'Input',
dependencies: {triggerFields: [''], show: () => false}
},
{
fieldName: 'materialCode',
label: '物料编码',
rules: 'required',
component: 'Input',
componentProps: {placeholder: '请输入物料编码'}
},
{
fieldName: 'materialName',
label: '物料名称',
rules: 'required',
component: 'Input',
componentProps: {placeholder: '请输入物料名称'}
},
{
fieldName: 'materialSpec',
label: '规格',
component: 'Input',
componentProps: {placeholder: '请输入规格'}
},
{
fieldName: 'materialModel',
label: '型号',
component: 'Input',
componentProps: {placeholder: '请输入型号'}
},
{
fieldName: 'englishName',
label: '外文名称',
component: 'Input',
componentProps: {placeholder: '请输入外文名称'}
},
{
fieldName: 'materialTypeId', label: '物料分类',
component: 'ApiTreeSelect',
componentProps: { api: loadMaterialTypeTree, labelField: 'className', valueField: 'classId', childrenField: 'children', placeholder: '请选择物料分类', allowClear: true, treeDefaultExpandAll: true },
componentProps: {
api: loadMaterialTypeTree,
labelField: 'className',
valueField: 'classId',
childrenField: 'children',
placeholder: '请选择物料分类',
allowClear: true,
treeDefaultExpandAll: true
},
},
{
fieldName: 'baseUnitId', label: '基本计量单位', rules: 'required',
component: 'ApiSelect',
componentProps: { api: loadMeasureUnitList, labelField: 'unitCode', valueField: 'measureUnitId', placeholder: '请选择基本计量单位', allowClear: true },
componentProps: {
api: loadMeasureUnitList,
labelField: 'unitCode',
valueField: 'measureUnitId',
placeholder: '请选择基本计量单位',
allowClear: true
},
},
{
fieldName: 'assUnitId', label: '辅助计量单位',
component: 'ApiSelect',
componentProps: { api: loadMeasureUnitList, labelField: 'unitCode', valueField: 'measureUnitId', placeholder: '请选择辅助计量单位', allowClear: true },
componentProps: {
api: loadMeasureUnitList,
labelField: 'unitCode',
valueField: 'measureUnitId',
placeholder: '请选择辅助计量单位',
allowClear: true
},
},
{
fieldName: 'lenUnitId', label: '长度单位',
component: 'ApiSelect',
componentProps: { api: loadMeasureUnitList, labelField: 'unitCode', valueField: 'measureUnitId', placeholder: '请选择长度单位', allowClear: true },
componentProps: {
api: loadMeasureUnitList,
labelField: 'unitCode',
valueField: 'measureUnitId',
placeholder: '请选择长度单位',
allowClear: true
},
},
{
fieldName: 'weightUnitId', label: '重量单位',
component: 'ApiSelect',
componentProps: { api: loadMeasureUnitList, labelField: 'unitCode', valueField: 'measureUnitId', placeholder: '请选择重量单位', allowClear: true },
componentProps: {
api: loadMeasureUnitList,
labelField: 'unitCode',
valueField: 'measureUnitId',
placeholder: '请选择重量单位',
allowClear: true
},
},
{
fieldName: 'cubageUnitId', label: '体积单位',
component: 'ApiSelect',
componentProps: { api: loadMeasureUnitList, labelField: 'unitCode', valueField: 'measureUnitId', placeholder: '请选择体积单位', allowClear: true },
componentProps: {
api: loadMeasureUnitList,
labelField: 'unitCode',
valueField: 'measureUnitId',
placeholder: '请选择体积单位',
allowClear: true
},
},
{
fieldName: 'isUsed', label: '是否启用', rules: 'required',
component: 'RadioGroup',
componentProps: { options: [{ label: '是', value: '1' }, { label: '否', value: '0' }], buttonStyle: 'solid', optionType: 'button' },
componentProps: {
options: [{label: '是', value: '1'}, {label: '否', value: '0'}],
buttonStyle: 'solid',
optionType: 'button'
},
},
{
fieldName: 'extId',
label: '外部标识',
component: 'Input',
componentProps: {placeholder: '请输入外部标识'}
},
{ fieldName: 'extId', label: '外部标识', component: 'Input', componentProps: { placeholder: '请输入外部标识' } },
];
}
// ========== 列表的搜索表单 ==========
export function useGridFormSchema(): VbenFormSchema[] {
return [
{ fieldName: 'materialCode', label: '物料编码', component: 'Input', componentProps: { allowClear: true, placeholder: '请输入物料编码' } },
{ fieldName: 'materialName', label: '物料名称', component: 'Input', componentProps: { allowClear: true, placeholder: '请输入物料名称' } },
{
fieldName: 'materialCode',
label: '物料编码',
component: 'Input',
componentProps: {allowClear: true, placeholder: '请输入物料编码'}
},
{
fieldName: 'materialName',
label: '物料名称',
component: 'Input',
componentProps: {allowClear: true, placeholder: '请输入物料名称'}
},
{
fieldName: 'materialTypeId', label: '物料分类',
component: 'ApiTreeSelect',
componentProps: { api: loadMaterialTypeTree, labelField: 'className', valueField: 'classId', childrenField: 'children', placeholder: '请选择物料分类', allowClear: true },
componentProps: {
api: loadMaterialTypeTree,
labelField: 'className',
valueField: 'classId',
childrenField: 'children',
placeholder: '请选择物料分类',
allowClear: true
},
},
{
fieldName: 'createTime',
label: '创建时间',
component: 'RangePicker',
componentProps: {...getRangePickerDefaultProps(), allowClear: true}
},
{
fieldName: 'isUsed',
label: '是否启用',
component: 'Select',
componentProps: {
allowClear: true,
placeholder: '请选择',
options: [{label: '是', value: '1'}, {label: '否', value: '0'}]
}
},
{ fieldName: 'createTime', label: '创建时间', component: 'RangePicker', componentProps: { ...getRangePickerDefaultProps(), allowClear: true } },
{ fieldName: 'isUsed', label: '是否启用', component: 'Select', componentProps: { allowClear: true, placeholder: '请选择', options: [{ label: '是', value: '1' }, { label: '否', value: '0' }] } },
];
}
// ========== 列表的字段 ==========
export function useGridColumns(): VxeTableGridOptions<BaseMaterialBaseApi.MaterialBase>['columns'] {
return [
{ type: 'checkbox', width: 40 },
{ field: 'materialCode', title: '物料编码', minWidth: 120 },
{ field: 'materialName', title: '物料名称', minWidth: 200 },
{ field: 'materialSpec', title: '规格', minWidth: 120 },
{ field: 'materialModel', title: '型号', minWidth: 120 },
{ field: 'englishName', title: '外文名称', minWidth: 120 },
{type: 'checkbox', width: 40},
{field: 'materialCode', title: '物料编码', minWidth: 120},
{field: 'materialName', title: '物料名称', minWidth: 200},
{field: 'materialSpec', title: '规格', minWidth: 120},
{field: 'materialModel', title: '型号', minWidth: 120},
{field: 'englishName', title: '外文名称', minWidth: 120},
{
field: 'materialTypeId', title: '物料分类', minWidth: 150,
formatter: ({ cellValue }: { cellValue: number }) => classNameMap[cellValue] || cellValue || '-',
formatter: ({cellValue}: {
cellValue: number
}) => classNameMap[cellValue] || cellValue || '-',
},
{
field: 'baseUnitId', title: '基本计量单位', minWidth: 120,
formatter: ({ cellValue }: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
formatter: ({cellValue}: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
},
{
field: 'assUnitId', title: '辅助计量单位', minWidth: 120,
formatter: ({ cellValue }: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
formatter: ({cellValue}: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
},
{
field: 'lenUnitId', title: '长度单位', minWidth: 120,
formatter: ({ cellValue }: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
formatter: ({cellValue}: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
},
{
field: 'weightUnitId', title: '重量单位', minWidth: 120,
formatter: ({ cellValue }: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
formatter: ({cellValue}: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
},
{
field: 'cubageUnitId', title: '体积单位', minWidth: 120,
formatter: ({ cellValue }: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
formatter: ({cellValue}: { cellValue: number }) => unitCodeMap[cellValue] || cellValue || '-',
},
{ field: 'createTime', title: '创建时间', minWidth: 180, formatter: 'formatDateTime' },
{ field: 'isUsed', title: '是否启用', minWidth: 100, formatter: ({ cellValue }: { cellValue: string }) => (cellValue === '1' ? '是' : '否') },
{ field: 'extId', title: '外部标识', minWidth: 120 },
{ title: '操作', width: 200, fixed: 'right', slots: { default: 'actions' } },
{field: 'createTime', title: '创建时间', minWidth: 180, formatter: 'formatDateTime'},
{
field: 'isUsed',
title: '是否启用',
minWidth: 100,
formatter: ({cellValue}: { cellValue: string }) => (cellValue === '1' ? '是' : '否')
},
{field: 'extId', title: '外部标识', minWidth: 120},
{title: '操作', width: 200, fixed: 'right', slots: {default: 'actions'}},
];
}

View File

@@ -4,12 +4,31 @@ import type { TaskTransportTaskApi } from '#/api/task/transporttask';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { handleTree } from '@vben/utils';
import dayjs from 'dayjs';
import { getClassStandardListByCode } from '#/api/base/classstandard';
import { getRangePickerDefaultProps } from '#/utils';
const taskTypeNameMap: Record<string, string> = {};
async function loadTaskTypeTree() {
const data = await getClassStandardListByCode('0002');
if (!data || data.length === 0) return [];
return handleTree(data, 'classId', 'parentClassId');
}
/** 新增/修改的表单 */
export async function loadAllLookupData() {
const taskTypeData = await getClassStandardListByCode('0002');
taskTypeData?.forEach((item) => {
if (item.classCode) {
taskTypeNameMap[item.classCode] = item.className;
}
});
}
export function useFormSchema(): VbenFormSchema[] {
return [
{
@@ -369,11 +388,15 @@ export function useGridFormSchema(): VbenFormSchema[] {
{
fieldName: 'taskType',
label: '任务类型',
component: 'Select',
component: 'ApiTreeSelect',
componentProps: {
allowClear: true,
options: [],
api: loadTaskTypeTree,
childrenField: 'children',
labelField: 'className',
placeholder: '请选择任务类型',
treeDefaultExpandAll: true,
valueField: 'classCode',
},
},
{
@@ -588,6 +611,8 @@ export function useGridColumns(): VxeTableGridOptions<TaskTransportTaskApi.Trans
field: 'taskType',
title: '任务类型',
minWidth: 120,
formatter: ({ cellValue }: { cellValue: string }) =>
taskTypeNameMap[cellValue] || cellValue || '-',
},
{
field: 'acsTaskType',
@@ -608,6 +633,10 @@ export function useGridColumns(): VxeTableGridOptions<TaskTransportTaskApi.Trans
field: 'vehicleType',
title: '载具类型',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.WMS_VEHICLE_TYPE },
},
},
{
field: 'vehicleQty',
@@ -632,6 +661,10 @@ export function useGridColumns(): VxeTableGridOptions<TaskTransportTaskApi.Trans
field: 'isAutoIssue',
title: '是否自动下发',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_IS_NO },
},
},
{
field: 'taskGroupId',
@@ -671,6 +704,10 @@ export function useGridColumns(): VxeTableGridOptions<TaskTransportTaskApi.Trans
field: 'createMode',
title: '生成方式',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.TASK_CREATE_MODE },
},
},
{
field: 'requestParam',
@@ -706,10 +743,9 @@ export function useGridColumns(): VxeTableGridOptions<TaskTransportTaskApi.Trans
},
{
title: '操作',
width: 300,
width: 350,
fixed: 'right',
slots: { default: 'actions' },
},
];
}

View File

@@ -2,7 +2,7 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { TaskTransportTaskApi } from '#/api/task/transporttask';
import { ref } from 'vue';
import { onMounted, ref } from 'vue';
import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
@@ -15,13 +15,20 @@ import {
deleteTransportTaskList,
exportTransportTask,
getTransportTaskPage,
issueTransportTask,
operateTransportTask,
} from '#/api/task/transporttask';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import { loadAllLookupData, useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const ready = ref(false);
onMounted(async () => {
await loadAllLookupData();
ready.value = true;
});
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
@@ -57,6 +64,22 @@ async function handleOperate(
}
}
/** PC 端下发搬运任务到 ACS */
async function handleIssue(row: TaskTransportTaskApi.TransportTask) {
await confirm(`确认要下发【${row.taskCode}】到 ACS 吗?`);
const hideLoading = message.loading({
content: '正在下发...',
duration: 0,
});
try {
await issueTransportTask(row.taskId!);
message.success('下发成功');
handleRefresh();
} finally {
hideLoading();
}
}
/** 删除搬运任务 */
async function handleDelete(row: TaskTransportTaskApi.TransportTask) {
const hideLoading = message.loading({
@@ -141,7 +164,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
</script>
<template>
<Page auto-content-height>
<Page v-if="ready" auto-content-height>
<FormModal @success="handleRefresh" />
<Grid table-title="搬运任务列表">
<template #toolbar-tools>
@@ -170,7 +193,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
<TableAction
:actions="[
{
label: '完成任务',
label: '下发',
type: 'link',
icon: ACTION_ICON.SEND,
auth: ['task:transport-task:issue'],
disabled: row.taskStatus !== '40',
onClick: handleIssue.bind(null, row),
},
{
label: '完成',
type: 'link',
icon: ACTION_ICON.SEND,
auth: ['task:transport-task:finish'],
@@ -178,7 +209,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
onClick: handleOperate.bind(null, row, 'FINISHED', '完成任务'),
},
{
label: '取消任务',
label: '取消',
type: 'link',
icon: ACTION_ICON.CANCEL,
auth: ['task:transport-task:cancel'],
@@ -186,7 +217,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
onClick: handleOperate.bind(null, row, 'CANCELLED', '取消任务'),
},
{
label: '强制完成任务',
label: '强制完成',
type: 'link',
icon: ACTION_ICON.CANCEL,
auth: ['task:transport-task:cancel'],

View File

@@ -6,6 +6,7 @@ const COMMON_DICT = {
DATE_INTERVAL: 'date_interval', // 数据间隔
PRODUCT_AREA: 'product_area',
COMMON_TRUE_FALSE: 'common_true_false',
COMMON_IS_NO: 'common_is_no',
} as const;
/** ========== SYSTEM - 系统模块 ========== */
@@ -298,6 +299,7 @@ const TASK_DICT = {
TASK_FINISH_TYPE: 'task_finish_type',
TASK_STATUS: 'task_status', // 任务状态
TASK_ACS_TASK_TYPE: 'task_acs_task_type', // 任务状态
TASK_CREATE_MODE: 'task_create_mode', // 任务创建方式
} as const;
/** 字典类型枚举 - 统一导出 */