opt: 上位下发取消任务接口 逻辑修改和反馈数据调整,反馈状态修改。
This commit is contained in:
@@ -459,6 +459,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
}
|
}
|
||||||
// "========================================================================请求放货================================================================================="
|
// "========================================================================请求放货================================================================================="
|
||||||
agv_status = 3;
|
agv_status = 3;
|
||||||
|
if (inst != null && !"3".equals(inst.getExecute_status())) {
|
||||||
|
inst.setExecute_status("3");
|
||||||
|
instructionService.update(inst);
|
||||||
|
}
|
||||||
//到达桁架1请求放货
|
//到达桁架1请求放货
|
||||||
if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
|
if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
|
||||||
hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
|
hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
|
||||||
@@ -534,10 +538,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
ssxDeviceDriver = (SsxDeviceDriver) device.getDeviceDriver();
|
ssxDeviceDriver = (SsxDeviceDriver) device.getDeviceDriver();
|
||||||
log.info("agv到达" + device_code + "放货点,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",准备执行放货");
|
log.info("agv到达" + device_code + "放货点,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",准备执行放货");
|
||||||
if (ssxDeviceDriver.getMove() == 0 & ssxDeviceDriver.getMode() == 1 & ssxDeviceDriver.getAction() == 1) {
|
if (ssxDeviceDriver.getMove() == 0 & ssxDeviceDriver.getMode() == 1 & ssxDeviceDriver.getAction() == 1) {
|
||||||
if (inst != null) {
|
// if (inst != null) {
|
||||||
inst.setExecute_status("3");
|
// inst.setExecute_status("3");
|
||||||
instructionService.update(inst);
|
// instructionService.update(inst);
|
||||||
}
|
// }
|
||||||
data = getData(data, index, inst, task);
|
data = getData(data, index, inst, task);
|
||||||
ssxDeviceDriver.setMessage("");
|
ssxDeviceDriver.setMessage("");
|
||||||
flag = true;
|
flag = true;
|
||||||
|
|||||||
@@ -78,39 +78,45 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||||
CancelTaskResponse response = new CancelTaskResponse();
|
CancelTaskResponse response = new CancelTaskResponse();
|
||||||
JSONArray errArr = new JSONArray();
|
JSONArray errArr = new JSONArray();
|
||||||
|
log.info("cancelFromWms--------------:输入参数:{}",reqs);
|
||||||
for (int i = 0; i < reqs.size(); i++) {
|
for (int i = 0; i < reqs.size(); i++) {
|
||||||
CancelTaskRequest request = reqs.get(i);
|
CancelTaskRequest request = reqs.get(i);
|
||||||
String task_code = request.getTask_code();
|
String task_code = request.getTask_code();
|
||||||
String vehicle_code = request.getVehicle_code();
|
String vehicle_code = request.getVehicle_code();
|
||||||
Map<String, String> params = request.getParams();
|
Map<String, String> params = request.getParams();
|
||||||
if (StrUtil.isEmpty(task_code)) {
|
if (StrUtil.isEmpty(task_code)) {
|
||||||
throw new BadRequestException("任务号不能为空");
|
throw new BadRequestException(HttpStatus.OK,"任务号不能为空");
|
||||||
}
|
}
|
||||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||||
String cancelTaskCheck = paramService.findByCode(AcsConfig.CANCELTASKCHECK).getValue();
|
if (ObjectUtil.isEmpty(taskDto)) {
|
||||||
//todo acs直接取消任务还是取消指令还是任务
|
throw new BadRequestException(HttpStatus.OK,"没有找到该任务");
|
||||||
if (StrUtil.equals(cancelTaskCheck, "1")) {
|
|
||||||
taskService.cancelNoSendWms(taskDto.getTask_id());
|
|
||||||
} else if (StrUtil.equals(cancelTaskCheck, "0")) {
|
|
||||||
Instruction inst = instructionService.findByTaskcode(task_code);
|
|
||||||
if (inst == null) {
|
|
||||||
taskService.cancelNoSendWms(taskDto.getTask_id());
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("指令正在执行中,操作失败!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//String cancelTaskCheck = paramService.findByCode(AcsConfig.CANCELTASKCHECK).getValue();
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
//todo acs直接取消任务还是取消指令还是任务
|
||||||
|
// if (StrUtil.equals(cancelTaskCheck, "1")) {
|
||||||
|
// taskService.cancelNoSendWms(taskDto.getTask_id());
|
||||||
|
// } else if (StrUtil.equals(cancelTaskCheck, "0")) {
|
||||||
|
Instruction inst = instructionService.findByTaskcode(task_code);
|
||||||
|
if (inst != null) {
|
||||||
|
if (!StrUtil.isEmpty(inst.getExecute_status()) && Integer.parseInt(inst.getExecute_status())>=3){
|
||||||
|
throw new BadRequestException(HttpStatus.OK,"请求放货后无法取消任务");
|
||||||
|
}
|
||||||
|
instructionService.cancel(inst.getInstruction_id());
|
||||||
|
}
|
||||||
|
taskService.cancelNoSendWms(taskDto.getTask_id());
|
||||||
|
// } else {
|
||||||
|
// throw new RuntimeException("指令正在执行中,操作失败!");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
response.setStatus(200);
|
||||||
if (ObjectUtil.isEmpty(errArr)) {
|
if (ObjectUtil.isEmpty(errArr)) {
|
||||||
response.setStatus(200);
|
response.setMessage("success");
|
||||||
} else {
|
|
||||||
response.setStatus(400);
|
|
||||||
}
|
}
|
||||||
response.setMessage("success");
|
|
||||||
response.setErrArr(errArr);
|
response.setErrArr(errArr);
|
||||||
log.info("cancelFromWms--------------:输出参数:" + response);
|
log.info("cancelFromWms--------------:输出参数:" + response);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import org.nl.system.service.param.ISysParamService;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -1020,12 +1021,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
public void cancelNoSendWms(String id) throws Exception {
|
public void cancelNoSendWms(String id) throws Exception {
|
||||||
TaskDto entity = this.findById(id);
|
TaskDto entity = this.findById(id);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
throw new BadRequestException(HttpStatus.OK,"被删除或无权限,操作失败!");
|
||||||
}
|
}
|
||||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
InstructionDto instdto = instructionservice.findByTaskid(id, "instruction_status <2 ");
|
InstructionDto instdto = instructionservice.findByTaskid(id, "instruction_status <2 ");
|
||||||
if (instdto != null) {
|
if (instdto != null) {
|
||||||
throw new BadRequestException("有指令未完成!");
|
throw new BadRequestException(HttpStatus.OK,"有指令未完成!");
|
||||||
}
|
}
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|||||||
Reference in New Issue
Block a user