fix: 强制完成
This commit is contained in:
@@ -51,11 +51,13 @@ 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.domain.Task;
|
||||
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.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.QueryHelpMybatisPlus;
|
||||
import org.nl.acs.common.base.impl.CommonServiceImpl;
|
||||
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
@@ -880,7 +882,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
//中转为空
|
||||
if (StrUtil.isEmpty(task.getPut_device_code())) {
|
||||
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(task.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
} else {
|
||||
finishAndCreateNextInst(ConvertUtil.convert(entity, Instruction.class));
|
||||
}
|
||||
@@ -888,13 +893,19 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
||||
finishAndCreateHXInst(ConvertUtil.convert(entity, Instruction.class));
|
||||
} else if (StrUtil.equals(task.getPut_device_code(), instnextdevice)) {
|
||||
taskService.finish(task.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(task.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
} else {
|
||||
finishAndCreateNextInst(ConvertUtil.convert(entity, Instruction.class));
|
||||
}
|
||||
@@ -926,7 +937,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
//中转为空
|
||||
if (StrUtil.isEmpty(task.getPut_device_code())) {
|
||||
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(task.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
} else {
|
||||
finishAndCreateNextInst(ConvertUtil.convert(ins, Instruction.class));
|
||||
}
|
||||
@@ -934,13 +948,19 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
||||
finishAndCreateHXInst(ConvertUtil.convert(ins, Instruction.class));
|
||||
} else if (StrUtil.equals(task.getPut_device_code(), instnextdevice)) {
|
||||
taskService.finish(task.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(task.getTask_id());
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task.getTask_id());
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskService.finish(taskIdAndStatusDTO);
|
||||
} else {
|
||||
finishAndCreateNextInst(ConvertUtil.convert(ins, Instruction.class));
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public enum TaskStatusEnum {
|
||||
BUSY("1", "BUSY", "执行中"),
|
||||
FINISHED("2", "FINISHED", "完成"),
|
||||
CANCEL("3", "CANCEL", "取消"),
|
||||
FORCED_COMPLETION("4", "", "强制完成"),
|
||||
ERROR("99", "ERROR", "异常");
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.common.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -87,9 +88,9 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.CommonService;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.acs.task.service.dto.TaskQueryParam;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -291,7 +292,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void finish(String ids);
|
||||
void finish(TaskIdAndStatusDTO ids);
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package org.nl.acs.task.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -12,7 +11,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
@@ -48,6 +46,7 @@ import org.nl.acs.task.service.TaskFeedbackService;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.QueryHelpMybatisPlus;
|
||||
import org.nl.acs.common.base.impl.CommonServiceImpl;
|
||||
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
@@ -806,13 +805,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
|
||||
@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(LangProcess.msg("error_sysAuth"));
|
||||
}
|
||||
|
||||
InstructionDto instdto = instructionService.findByTaskid(id, "instruction_status <2 ");
|
||||
InstructionDto instdto = instructionService.findByTaskid(taskIdAndStatus.getTask_id(), "instruction_status <2 ");
|
||||
if (instdto != null) {
|
||||
throw new BadRequestException(LangProcess.msg("task_insHas"));
|
||||
}
|
||||
@@ -821,7 +820,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
entity.setTask_status(taskIdAndStatus.getTask_status());
|
||||
|
||||
Task task = ConvertUtil.convert(entity, Task.class);
|
||||
taskMapper.updateById(task);
|
||||
|
||||
@@ -25,8 +25,10 @@ import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
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.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.hand.dto.HeadDto;
|
||||
@@ -425,7 +427,10 @@ public class HandServiceImpl implements HandService {
|
||||
resultJson.put("data", data);
|
||||
return resultJson;
|
||||
}
|
||||
taskserver.finish(task_uuid);
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task_uuid);
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskserver.finish(taskIdAndStatusDTO);
|
||||
}
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", data);
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ export default {
|
||||
'Ready': 'Ready',
|
||||
'In_progress': 'In Progress',
|
||||
'Completed': 'Completed',
|
||||
'Forced_Completed': 'Forced Completed',
|
||||
'Pickup_point': 'Pickup Point',
|
||||
'Delivery_point': 'Delivery Point',
|
||||
'Remark': 'Remark',
|
||||
|
||||
@@ -35,6 +35,7 @@ export default {
|
||||
'Ready': 'Siap',
|
||||
'In_progress': 'Sedang Berlangsung',
|
||||
'Completed': 'Selesai',
|
||||
'Forced_Completed': 'Penyelesaian wajib',
|
||||
'Pickup_point': 'Titik Pengambilan',
|
||||
'Delivery_point': 'Titik Pengiriman',
|
||||
'Remark': 'Catatan',
|
||||
|
||||
@@ -35,6 +35,7 @@ export default {
|
||||
'Ready': '就绪',
|
||||
'In_progress': '执行中',
|
||||
'Completed': '完成',
|
||||
'Forced_Completed': '强制完成',
|
||||
'Pickup_point': '取货点',
|
||||
'Delivery_point': '放货点',
|
||||
'Remark': '备注',
|
||||
|
||||
@@ -559,6 +559,15 @@
|
||||
{{ $t('task.select.Create_command') }}
|
||||
</el-button>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-finished"
|
||||
@click="handleCommand(scope.$index, scope.row,'d')"
|
||||
>
|
||||
{{ $t('task.select.Forced_Completed') }}
|
||||
</el-button>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -695,6 +704,10 @@ export default {
|
||||
agv_system_type: '',
|
||||
interactionJson: null
|
||||
},
|
||||
taskStatus: {
|
||||
task_status: '',
|
||||
task_id: null
|
||||
},
|
||||
extension: [{
|
||||
name: '',
|
||||
value: ''
|
||||
@@ -790,7 +803,9 @@ export default {
|
||||
return true
|
||||
},
|
||||
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 => {
|
||||
@@ -831,7 +846,7 @@ export default {
|
||||
handleCommand(index, row, command) {
|
||||
switch (command) {
|
||||
case 'a':// 完成
|
||||
this.finish(index, row)
|
||||
this.finish('3', row)
|
||||
break
|
||||
case 'b':// 取消
|
||||
this.cancel(index, row)
|
||||
@@ -839,6 +854,9 @@ export default {
|
||||
case 'c':// 创建指令
|
||||
this.createInst(index, row)
|
||||
break
|
||||
case 'd':// 完成
|
||||
this.finish('4', row)
|
||||
break
|
||||
}
|
||||
},
|
||||
showStartStorage(val) {
|
||||
|
||||
Reference in New Issue
Block a user