add:强制完成添加
This commit is contained in:
@@ -33,8 +33,10 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||
import org.nl.acs.task.TaskInstructionLock;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
@@ -988,7 +990,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
//中转为空
|
||||
if(StrUtil.isEmpty(obj.getPut_device_code())){
|
||||
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(obj.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(obj.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(String.valueOf(TaskStatusEnum.FINISHED.getIndex()));
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
} else {
|
||||
finishAndCreateNextInst(entity);
|
||||
}
|
||||
@@ -996,13 +1001,19 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
||||
finishAndCreateHXInst(entity);
|
||||
} else if (StrUtil.equals(obj.getPut_device_code(), instnextdevice)) {
|
||||
taskService.finish(obj.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(obj.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(String.valueOf(TaskStatusEnum.FINISHED.getIndex()));
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(obj.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(obj.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(String.valueOf(TaskStatusEnum.FINISHED.getIndex()));
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
} else {
|
||||
finishAndCreateNextInst(entity);
|
||||
}
|
||||
@@ -1035,7 +1046,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
//中转为空
|
||||
if(StrUtil.isEmpty(obj.getPut_device_code())){
|
||||
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(obj.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(obj.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(String.valueOf(TaskStatusEnum.FINISHED.getIndex()));
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
} else {
|
||||
finishAndCreateNextInst(dto);
|
||||
}
|
||||
@@ -1043,13 +1057,19 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
||||
finishAndCreateHXInst(dto);
|
||||
} else if (StrUtil.equals(obj.getPut_device_code(), instnextdevice)) {
|
||||
taskService.finish(obj.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(obj.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(String.valueOf(TaskStatusEnum.FINISHED.getIndex()));
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(obj.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(obj.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(String.valueOf(TaskStatusEnum.FINISHED.getIndex()));
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
} else {
|
||||
finishAndCreateNextInst(dto);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ import com.alibaba.fastjson.JSONObject;
|
||||
public enum TaskStatusEnum {
|
||||
READY(1, "READY", "就绪"),
|
||||
BUSY(2, "BUSY", "执行中"),
|
||||
FINISHED(3, "FINISHED", "完成");
|
||||
FINISHED(3, "FINISHED", "完成"),
|
||||
FORCED_COMPLETION(4, "FORCED_COMPLETION", "强制完成");
|
||||
|
||||
|
||||
|
||||
//索引
|
||||
|
||||
@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -38,7 +39,7 @@ public class TaskController {
|
||||
|
||||
@GetMapping
|
||||
@Log("查询任务")
|
||||
|
||||
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(taskService.queryAllByCache(whereJson, page), HttpStatus.OK);
|
||||
@@ -46,7 +47,7 @@ public class TaskController {
|
||||
|
||||
@GetMapping("/reload")
|
||||
@Log("数据同步")
|
||||
|
||||
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public ResponseEntity<Object> reload() {
|
||||
@@ -56,14 +57,14 @@ public class TaskController {
|
||||
|
||||
@GetMapping("/getAll")
|
||||
@Log("历史查询任务")
|
||||
|
||||
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public ResponseEntity<Object> get(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(taskService.getAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出历史任务")
|
||||
|
||||
|
||||
@GetMapping(value = "/getAll/download")
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public void getAllDownload(HttpServletResponse response, Map whereJson) throws IOException {
|
||||
@@ -72,7 +73,7 @@ public class TaskController {
|
||||
|
||||
@PostMapping
|
||||
@Log("新增任务")
|
||||
|
||||
|
||||
//@PreAuthorize("@el.check('task:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody TaskDto dto) throws Exception {
|
||||
taskService.create(dto);
|
||||
@@ -81,7 +82,7 @@ public class TaskController {
|
||||
|
||||
@PostMapping(value = "/adds")
|
||||
@Log("常规任务保存")
|
||||
|
||||
|
||||
//@PreAuthorize("@el.check('task:add')")
|
||||
public ResponseEntity<Object> ordinaryTaskCreate(@RequestBody JSONObject json) throws Exception {
|
||||
|
||||
@@ -91,7 +92,7 @@ public class TaskController {
|
||||
|
||||
@PostMapping(value = "/addes")
|
||||
@Log("特殊任务保存")
|
||||
|
||||
|
||||
public ResponseEntity<Object> specialTaskCreate(@RequestBody JSONObject json) throws Exception {
|
||||
taskService.specialTaskCreate(json);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -99,7 +100,7 @@ public class TaskController {
|
||||
|
||||
@PutMapping
|
||||
@Log("修改任务")
|
||||
|
||||
|
||||
//@PreAuthorize("@el.check('task:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody TaskDto dto) {
|
||||
taskService.update(dto);
|
||||
@@ -107,7 +108,7 @@ public class TaskController {
|
||||
}
|
||||
|
||||
@Log("删除任务")
|
||||
|
||||
|
||||
//@PreAuthorize("@el.check('task:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) throws Exception {
|
||||
@@ -116,15 +117,14 @@ public class TaskController {
|
||||
}
|
||||
|
||||
@Log("完成任务")
|
||||
|
||||
@PostMapping(value = "/finish/{id}")
|
||||
public ResponseEntity<Object> finish(@RequestBody String id) {
|
||||
taskService.finish(id);
|
||||
@PostMapping(value = "/finish")
|
||||
public ResponseEntity<Object> finish(@RequestBody TaskIdAndStatusDTO taskIdAndStatus) {
|
||||
taskService.finish(taskIdAndStatus);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("取消任务")
|
||||
|
||||
|
||||
@PostMapping(value = "/cancel/{id}")
|
||||
public ResponseEntity<Object> cancel(@RequestBody String id) throws Exception {
|
||||
taskService.cancel(id);
|
||||
@@ -132,7 +132,7 @@ public class TaskController {
|
||||
}
|
||||
|
||||
@Log("手动创建指令")
|
||||
|
||||
|
||||
@PostMapping(value = "/createInst/{id}")
|
||||
public ResponseEntity<Object> createInst(@RequestBody String id) throws Exception {
|
||||
taskService.createInst(id);
|
||||
@@ -140,7 +140,7 @@ public class TaskController {
|
||||
}
|
||||
|
||||
@Log("导出任务")
|
||||
|
||||
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public void download(HttpServletResponse response, Map whereJson) throws IOException {
|
||||
@@ -148,7 +148,7 @@ public class TaskController {
|
||||
}
|
||||
|
||||
@Log("一体机触发任务")
|
||||
|
||||
|
||||
@PostMapping("/createTaskByClick")
|
||||
//@PreAuthorize("@el.check('task:add')")
|
||||
public ResponseEntity<Object> createTaskByClick(@RequestBody JSONObject json) {
|
||||
@@ -158,7 +158,7 @@ public class TaskController {
|
||||
|
||||
@SaIgnore
|
||||
@Log("查询缓存所有任务")
|
||||
|
||||
|
||||
@PostMapping(value = "/findAllTaskFromCache")
|
||||
public ResponseEntity<Object> findAllTaskFromCache() {
|
||||
return new ResponseEntity<>(taskService.findAllTaskFromCache(), HttpStatus.OK);
|
||||
|
||||
@@ -5,6 +5,7 @@ package org.nl.acs.task.service;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -200,9 +201,9 @@ public interface TaskService {
|
||||
/**
|
||||
* 完成任务
|
||||
*
|
||||
* @param ids
|
||||
* @param taskIdAndStatus
|
||||
*/
|
||||
void finish(String ids);
|
||||
void finish(TaskIdAndStatusDTO taskIdAndStatus);
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.nl.acs.task.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TaskIdAndStatusDTO {
|
||||
private String task_id;
|
||||
|
||||
private String task_status;
|
||||
}
|
||||
@@ -1,20 +1,16 @@
|
||||
package org.nl.acs.task.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.InternalJSONUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Synchronized;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
@@ -39,7 +35,7 @@ import org.nl.acs.task.TaskInstructionLock;
|
||||
import org.nl.acs.task.service.TaskFeedbackService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.dto.TaskFeedbackDto;
|
||||
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
@@ -60,7 +56,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -808,11 +803,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finish(String id) {
|
||||
TaskDto entity = this.findById(id);
|
||||
public void finish(TaskIdAndStatusDTO taskIdAndStatus) {
|
||||
TaskDto entity = this.findById(taskIdAndStatus.getTask_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(id, "instruction_status <2 ");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(taskIdAndStatus.getTask_id(), "instruction_status <2 ");
|
||||
if (instdto != null) throw new BadRequestException("有指令未完成!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
@@ -24,11 +24,11 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function finish(task_id) {
|
||||
export function finish(data) {
|
||||
return request({
|
||||
url: 'api/task/finish/' + task_id,
|
||||
url: 'api/task/finish',
|
||||
method: 'post',
|
||||
data: task_id
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -411,14 +411,14 @@
|
||||
<el-table-column type="selection" width="50" />
|
||||
<el-table-column v-if="false" prop="task_id" label="任务标识" :min-width="flexWidth('task_id',crud.data,'任务标识')" />
|
||||
<el-table-column prop="task_code" label="任务号" :min-width="flexWidth('task_code',crud.data,'任务号')" />
|
||||
<el-table-column prop="task_type" label="任务类型" width="120px" >
|
||||
<el-table-column prop="task_type" label="任务类型" width="120px">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.task_type[scope.row.task_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="link_num" label="关联编号" />-->
|
||||
<el-table-column prop="vehicle_code" label="载具号" :min-width="flexWidth('vehicle_code',crud.data,'载具号')" />
|
||||
<el-table-column prop="task_status" label="任务状态" :min-width="flexWidth('task_status',crud.data,'任务状态')" >
|
||||
<el-table-column prop="task_status" label="任务状态" :min-width="flexWidth('task_status',crud.data,'任务状态')">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.task_status[scope.row.task_status] }}
|
||||
</template>
|
||||
@@ -429,12 +429,12 @@
|
||||
<el-table-column prop="start_point_code2" label="取货点2" :min-width="flexWidth('start_point_code2',crud.data,'取货点2')" />
|
||||
<el-table-column prop="next_point_code2" label="放货点2" :min-width="flexWidth('next_point_code2',crud.data,'放货点2')" />
|
||||
<el-table-column prop="put_point_code" label="中转点" :min-width="flexWidth('put_point_code',crud.data,'中转点')" />
|
||||
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px" >
|
||||
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.agv_system_type[scope.row.agv_system_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="storage_task_type" label="立库任务类型" :min-width="flexWidth('storage_task_type',crud.data,'立库任务类型')" >
|
||||
<el-table-column prop="storage_task_type" label="立库任务类型" :min-width="flexWidth('storage_task_type',crud.data,'立库任务类型')">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.storage_task_type[scope.row.storage_task_type] }}
|
||||
</template>
|
||||
@@ -497,6 +497,13 @@
|
||||
>
|
||||
创建指令
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-finished"
|
||||
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'd' })"
|
||||
>
|
||||
强制完成
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -638,6 +645,10 @@ export default {
|
||||
device_code: null,
|
||||
qty: null
|
||||
},
|
||||
taskStatus: {
|
||||
task_status: '',
|
||||
task_id: null
|
||||
},
|
||||
rules: {
|
||||
start_height: [
|
||||
{ required: true, message: '起点高度不能为空', trigger: 'change' }
|
||||
@@ -708,7 +719,9 @@ export default {
|
||||
console.log(this.form.paperArray)
|
||||
},
|
||||
finish(index, row) {
|
||||
crudTask.finish(row.task_id).then(res => {
|
||||
this.taskStatus.task_id = row.task_id
|
||||
this.taskStatus.task_status = index
|
||||
crudTask.finish(this.taskStatus).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('完成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
@@ -751,7 +764,7 @@ export default {
|
||||
console.log(command.command)
|
||||
switch (command.command) {
|
||||
case 'a':// 完成
|
||||
this.finish(command.index, command.row)
|
||||
this.finish('3', command.row)
|
||||
break
|
||||
case 'b':// 取消
|
||||
this.cancel(command.index, command.row)
|
||||
@@ -759,6 +772,9 @@ export default {
|
||||
case 'c':// 创建指令
|
||||
this.createInst(command.index, command.row)
|
||||
break
|
||||
case 'd':// 完成
|
||||
this.finish('4', command.row)
|
||||
break
|
||||
}
|
||||
},
|
||||
showStartStorage(val) {
|
||||
|
||||
Reference in New Issue
Block a user