更新指令
This commit is contained in:
@@ -108,6 +108,14 @@ public class InstructionController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("强制取消指令")
|
||||
@ApiOperation("强制取消指令")
|
||||
@PostMapping(value = "/forceCancel/{id}")
|
||||
public ResponseEntity<Object> forceCancel(@RequestBody String id) throws Exception {
|
||||
instructionService.forceCancel(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出指令")
|
||||
@ApiOperation("导出指令")
|
||||
@GetMapping(value = "/download")
|
||||
|
||||
@@ -162,6 +162,13 @@ public interface InstructionService {
|
||||
*/
|
||||
void cancel(String id) throws Exception;
|
||||
|
||||
/**
|
||||
* 强制取消指令
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void forceCancel(String id) throws Exception;
|
||||
|
||||
/**
|
||||
* 取消指令不下发agv
|
||||
*
|
||||
|
||||
@@ -950,6 +950,48 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceCancel(String id) throws Exception {
|
||||
//flag= true时取消指令
|
||||
boolean flag = false;
|
||||
Instruction entity = this.findById(id);
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
TaskDto task = taskService.findByCodeFromCache(entity.getTask_code());
|
||||
if (StrUtil.isEmpty(entity.getRoute_plan_code())) {
|
||||
entity.setRoute_plan_code(task.getRoute_plan_code());
|
||||
}
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status("3");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = JSONObject.fromObject(entity);
|
||||
wo.update(json);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
|
||||
String instnextdevice = entity.getNext_device_code();
|
||||
Device device = appService.findDeviceByCode(instnextdevice);
|
||||
if (device == null) {
|
||||
log.debug("地址对应设备未找到");
|
||||
return;
|
||||
}
|
||||
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||
//变更三色灯状态
|
||||
if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) {
|
||||
String lamd_device = device.getExtraValue().get("link_three_lamp").toString();
|
||||
Device lamddevice = appService.findDeviceByCode(lamd_device);
|
||||
if (lamddevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
|
||||
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lamddevice.getDeviceDriver();
|
||||
lampThreecolorDeviceDriver.writing(0);
|
||||
}
|
||||
}
|
||||
removeByCodeFromCache(entity.getInstruction_code());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelNOSendAgv(String id) throws Exception {
|
||||
//flag= true时取消指令
|
||||
|
||||
@@ -1,11 +1,36 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<div id="app" @mousemove="moveEvent" @click="moveEvent">
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'App'
|
||||
name: 'App',
|
||||
data() {
|
||||
return {
|
||||
timmer: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
moveEvent: function() {
|
||||
const path = ['/login']
|
||||
if (!path.includes(this.$route.path)) {
|
||||
clearTimeout(this.timmer)
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
this.timmer = setTimeout(() => {
|
||||
sessionStorage.clear()
|
||||
this.logout()
|
||||
}, 1000 * 60 * 15) // 15分钟 https://blog.csdn.net/qq_42345108/article/details/103496456
|
||||
},
|
||||
logout() {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.reload()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -41,6 +41,14 @@ export function cancel(instruction_id) {
|
||||
})
|
||||
}
|
||||
|
||||
export function forceCancel(instruction_id) {
|
||||
return request({
|
||||
url: 'api/instruction/forceCancel/' + instruction_id,
|
||||
method: 'post',
|
||||
data: instruction_id
|
||||
})
|
||||
}
|
||||
|
||||
export function queryUnFinish() {
|
||||
return request({
|
||||
url: 'api/instruction/unfinish/',
|
||||
@@ -63,4 +71,4 @@ export function reload() {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, finish, cancel, queryUnFinish, queryByTaskId,reload }
|
||||
export default { add, edit, del, finish, cancel, forceCancel, queryUnFinish, queryByTaskId,reload }
|
||||
|
||||
@@ -159,6 +159,7 @@
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">完成</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">取消</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'c')">强制取消</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
@@ -291,6 +292,14 @@ export default {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
forceCancel(index, row) {
|
||||
crudInstruction.forceCancel(row.instruction_id).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('取消成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
reload() {
|
||||
crudInstruction.reload().then(res => {
|
||||
this.crud.toQuery()
|
||||
@@ -314,6 +323,9 @@ export default {
|
||||
case 'b':// 取消
|
||||
this.cancel(command.index, command.row)
|
||||
break
|
||||
case 'c':// 取消
|
||||
this.forceCancel(command.index, command.row)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user