opt:
1.任务完成,取消,指令创建,指令完成,取消,自动创建指令,各源头异常记录。 2.修改RGV下发指令失败,指令取消未对接成功处理及日志记录
This commit is contained in:
@@ -108,13 +108,12 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
|||||||
agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||||
|
|
||||||
agvurl = agvurl + ":" + agvport + "/transportOrders/query";
|
agvurl = agvurl + ":" + agvport + "/transportOrders/query";
|
||||||
log.info("下发agv查询状态请求:{}内容为:{}", agvurl);
|
//log.info("下发agv查询状态请求:{}内容为:{}", agvurl);
|
||||||
HttpResponse result = HttpRequest.post(agvurl)
|
HttpResponse result = HttpRequest.post(agvurl)
|
||||||
.body(String.valueOf(new JSONObject()))//表单内容
|
.body(String.valueOf(new JSONObject()))//表单内容
|
||||||
.timeout(20000)//超时,毫秒
|
.timeout(20000)//超时,毫秒
|
||||||
.execute();
|
.execute();
|
||||||
log.info("查询agv指令数据:" + result.body());
|
log.info("查询agv指令数据:" + result.body());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@@ -133,7 +132,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
|||||||
agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||||
|
|
||||||
agvurl = agvurl + ":" + agvport + "/vehicles";
|
agvurl = agvurl + ":" + agvport + "/vehicles";
|
||||||
log.info("下发agv查询设备状态请求:{}内容为:{}", agvurl);
|
//log.info("下发agv查询设备状态请求:{}内容为:{}", agvurl);
|
||||||
HttpResponse result = HttpRequest.post(agvurl)
|
HttpResponse result = HttpRequest.post(agvurl)
|
||||||
.body(String.valueOf(new JSONObject()))//表单内容
|
.body(String.valueOf(new JSONObject()))//表单内容
|
||||||
.timeout(20000)//超时,毫秒
|
.timeout(20000)//超时,毫秒
|
||||||
@@ -462,7 +461,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
|||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||||
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
||||||
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||||
Instruction instruction = instructionService.findByCode(instCode);
|
//Instruction instruction = instructionService.findByCode(instCode);
|
||||||
agvurl = agvurl + ":" + agvport + "/transportOrders/" + instCode + "/withdrawal";
|
agvurl = agvurl + ":" + agvport + "/transportOrders/" + instCode + "/withdrawal";
|
||||||
log.info("删除agv指令请求agvurl:{}", agvurl);
|
log.info("删除agv指令请求agvurl:{}", agvurl);
|
||||||
HttpResponse result = HttpRequest.post(agvurl)
|
HttpResponse result = HttpRequest.post(agvurl)
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
String message = null;
|
String message = null;
|
||||||
try {
|
try {
|
||||||
//todo 错误码转换
|
|
||||||
devicecode = this.getDeviceCode();
|
devicecode = this.getDeviceCode();
|
||||||
VW7010 = this.itemProtocol.getVW7010();
|
VW7010 = this.itemProtocol.getVW7010();
|
||||||
VW7012 = this.itemProtocol.getVW7012();
|
VW7012 = this.itemProtocol.getVW7012();
|
||||||
@@ -120,9 +119,6 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
VW7016 = this.itemProtocol.getVW7016();
|
VW7016 = this.itemProtocol.getVW7016();
|
||||||
VW7018 = this.itemProtocol.getVW7018();
|
VW7018 = this.itemProtocol.getVW7018();
|
||||||
VW7020 = this.itemProtocol.getVW7020();
|
VW7020 = this.itemProtocol.getVW7020();
|
||||||
if("GHS01".equals(devicecode)){
|
|
||||||
log.info("123");
|
|
||||||
}
|
|
||||||
VW7022 = this.itemProtocol.getVW7022();
|
VW7022 = this.itemProtocol.getVW7022();
|
||||||
VW7024 = this.itemProtocol.getVW7024();
|
VW7024 = this.itemProtocol.getVW7024();
|
||||||
VW7026 = this.itemProtocol.getVW7026();
|
VW7026 = this.itemProtocol.getVW7026();
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class InstructionController {
|
|||||||
@ApiOperation("完成指令")
|
@ApiOperation("完成指令")
|
||||||
@PostMapping(value = "/finish/{id}")
|
@PostMapping(value = "/finish/{id}")
|
||||||
public ResponseEntity<Object> finish(@RequestBody String id) throws Exception {
|
public ResponseEntity<Object> finish(@RequestBody String id) throws Exception {
|
||||||
instructionService.finish(id);
|
instructionService.finish(id, "1");
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,8 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
*/
|
*/
|
||||||
void finish(String id) throws Exception;
|
void finish(String id) throws Exception;
|
||||||
|
|
||||||
|
void finish(String id,String operationType)throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成指令
|
* 完成指令
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import org.nl.acs.agv.server.MagicAgvService;
|
|||||||
import org.nl.acs.agv.server.NDCAgvService;
|
import org.nl.acs.agv.server.NDCAgvService;
|
||||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||||
|
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.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||||
@@ -30,9 +33,12 @@ import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanne
|
|||||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.liKuData.*;
|
import org.nl.acs.ext.wms.liKuData.*;
|
||||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||||
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
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.instruction.service.dto.InstructionDto;
|
||||||
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
||||||
|
import org.nl.acs.instruction.service.mapper.InstructionMapper;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
@@ -42,30 +48,20 @@ import org.nl.acs.task.TaskInstructionLock;
|
|||||||
import org.nl.acs.task.domain.Task;
|
import org.nl.acs.task.domain.Task;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
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.mapper.TaskMapper;
|
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||||
import org.nl.common.exception.BadRequestException;
|
|
||||||
import org.nl.acs.utils.ConvertUtil;
|
import org.nl.acs.utils.ConvertUtil;
|
||||||
import org.nl.common.utils.FileUtil;
|
|
||||||
import org.nl.acs.utils.PageUtil;
|
import org.nl.acs.utils.PageUtil;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
|
||||||
import org.nl.acs.instruction.service.mapper.InstructionMapper;
|
|
||||||
import org.nl.common.utils.SecurityUtils;
|
|
||||||
import org.nl.system.service.param.ISysParamService;
|
|
||||||
import org.nl.common.utils.CodeUtil;
|
import org.nl.common.utils.CodeUtil;
|
||||||
|
import org.nl.common.utils.FileUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
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;
|
||||||
// 默认不使用缓存
|
|
||||||
//import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
//import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
//import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -354,9 +350,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(InstructionMybatis::getTask_id, id);
|
wrapper.eq(InstructionMybatis::getTask_id, id);
|
||||||
wrapper.apply(StringUtils.isNotBlank(wherecaluse), wherecaluse);
|
wrapper.apply(StringUtils.isNotBlank(wherecaluse), wherecaluse);
|
||||||
InstructionMybatis ins = instructionMapper.selectOne(wrapper);
|
List<InstructionMybatis> insList = instructionMapper.selectList(wrapper);
|
||||||
if (ObjectUtil.isNotEmpty(ins)) {
|
if (ObjectUtil.isNotEmpty(insList)) {
|
||||||
return ConvertUtil.convert(ins, Instruction.class);
|
return ConvertUtil.convert(insList.get(0), Instruction.class);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -395,7 +391,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// } else {
|
// } else {
|
||||||
// dto.setInstruction_type("3");
|
// dto.setInstruction_type("3");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 查询是否存在相同指令号
|
// 查询是否存在相同指令号
|
||||||
// if (!StrUtil.isEmpty(dto.getVehicle_code() )) {
|
// if (!StrUtil.isEmpty(dto.getVehicle_code() )) {
|
||||||
// Instruction inst_dto = findByContainer(dto.getVehicle_code());
|
// Instruction inst_dto = findByContainer(dto.getVehicle_code());
|
||||||
@@ -412,7 +407,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
dto.setCompound_inst_data(task.getCompound_task_data());
|
dto.setCompound_inst_data(task.getCompound_task_data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//todo 增加lms任务id
|
|
||||||
dto.setExt_task_id(task.getExt_task_id());
|
dto.setExt_task_id(task.getExt_task_id());
|
||||||
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||||
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||||
@@ -461,21 +455,34 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
JSONObject jo = JSON.parseObject(result.body());
|
JSONObject jo = JSON.parseObject(result.body());
|
||||||
if (jo.getInteger("status") != 200) {
|
if (jo.getInteger("status") != 200) {
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
|
dto.setRemark("失败原因:"+jo.getString("message"));
|
||||||
|
log.error("创建指令,下发AGV/RGV任务失败!任务id为:{},指令号为:{},失败原因{}", task.getTask_id(), dto.getInstruction_code(), jo.getString("message"));
|
||||||
|
if (task != null) {
|
||||||
|
task.setRemark("创建指令,下发AGV/RGV任务失败!失败原因{}" + jo.getString("message"));
|
||||||
|
taskService.update(task);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dto.setSend_status("1");
|
dto.setSend_status("1");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
|
dto.setRemark("失败原因:AGV/RGV未响应!");
|
||||||
|
log.error("创建指令,下发AGV/RGV任务失败!任务id为:{},指令号为:{},失败原因{}", task.getTask_id(), dto.getInstruction_code(), "AGV/RGV未响应!");
|
||||||
|
if (task != null) {
|
||||||
|
task.setRemark("创建指令,下发AGV/RGV任务失败!失败原因: AGV/RGV未响应!");
|
||||||
|
taskService.update(task);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
e.printStackTrace();
|
dto.setRemark("失败原因:"+ e.getMessage());
|
||||||
log.error("");
|
log.error("创建指令失败,任务id为:" + task.getTask_id(), "失败原因:" + e.getMessage());
|
||||||
|
if (task != null) {
|
||||||
|
task.setRemark("自动创建指令失败,失败原因:"+ e.getMessage());
|
||||||
|
taskService.update(task);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
|
||||||
// wo.insert(json);
|
|
||||||
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||||
instructionMapper.insert(entity);
|
instructionMapper.insert(entity);
|
||||||
instructions.add(dto);
|
instructions.add(dto);
|
||||||
@@ -578,18 +585,30 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
JSONObject jo = JSON.parseObject(result.body());
|
JSONObject jo = JSON.parseObject(result.body());
|
||||||
if (jo.getInteger("status") != 200) {
|
if (jo.getInteger("status") != 200) {
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
|
dto.setRemark("失败原因:"+jo.getString("message"));
|
||||||
|
log.error("创建指令,下发AGV/RGV任务失败!任务id为:{},指令号为:{},失败原因{}", task.getTask_id(), dto.getInstruction_code(), jo.getString("message"));
|
||||||
|
if (task != null) {
|
||||||
|
task.setRemark("创建指令,下发AGV/RGV任务失败!失败原因{}" + jo.getString("message"));
|
||||||
|
taskService.update(task);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dto.setSend_status("1");
|
dto.setSend_status("1");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
|
dto.setRemark("失败原因:AGV/RGV未响应!");
|
||||||
|
log.error("创建指令,下发AGV/RGV任务失败!任务id为:{},指令号为:{},失败原因{}", task.getTask_id(), dto.getInstruction_code(), "AGV/RGV未响应!");
|
||||||
|
if (task != null) {
|
||||||
|
task.setRemark("创建指令,下发AGV/RGV任务失败!失败原因: AGV/RGV未响应!");
|
||||||
|
taskService.update(task);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
dto.setRemark("失败原因:"+e.getMessage());
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
e.printStackTrace();
|
log.error("创建指令失败,下发AGV/RGV任务失败!任务id为:{},指令号为:{},失败原因{}", task.getTask_id(), dto.getInstruction_code(), e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||||
instructionMapper.insert(entity);
|
instructionMapper.insert(entity);
|
||||||
instructions.add(dto);
|
instructions.add(dto);
|
||||||
@@ -599,7 +618,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
public void createAgain(Instruction dto) throws Exception {
|
public void createAgain(Instruction dto) throws Exception {
|
||||||
String task_code = dto.getTask_code();
|
String task_code = dto.getTask_code();
|
||||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||||
// WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||||
@@ -619,19 +638,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
}
|
}
|
||||||
String type = shortPathsList.get(0).getType();
|
String type = shortPathsList.get(0).getType();
|
||||||
if (!StrUtil.equals(type, "0")) {
|
if (!StrUtil.equals(type, "0")) {
|
||||||
// JSONObject instcheckjson =
|
|
||||||
// instwo
|
|
||||||
// .query(
|
|
||||||
// " instruction_status <3 and next_point_code= '"
|
|
||||||
// + dto.getNext_point_code()
|
|
||||||
// + "'"
|
|
||||||
// + " and start_point_code = '"
|
|
||||||
// + dto.getStart_point_code()
|
|
||||||
// + "'"
|
|
||||||
// + " and task_id = '"
|
|
||||||
// + dto.getTask_id()
|
|
||||||
// + "'")
|
|
||||||
// .uniqueResult(0);
|
|
||||||
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.lt(InstructionMybatis::getInstruction_status, 3)
|
.lt(InstructionMybatis::getInstruction_status, 3)
|
||||||
.eq(InstructionMybatis::getNext_point_code, dto.getNext_point_code())
|
.eq(InstructionMybatis::getNext_point_code, dto.getNext_point_code())
|
||||||
@@ -656,11 +663,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
|
||||||
//
|
|
||||||
// wo.insert(json);
|
|
||||||
|
|
||||||
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||||
instructionMapper.insert(entity);
|
instructionMapper.insert(entity);
|
||||||
|
|
||||||
@@ -756,6 +758,17 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finish(String id,String operationType) {
|
||||||
|
finish(id);
|
||||||
|
InstructionDto entity = this.findById(id);
|
||||||
|
entity.setRemark("指令被PC端手动完成");
|
||||||
|
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||||
|
instructionMapper.updateById(ins);
|
||||||
|
log.error("指令被PC端手动完成,任务号:{}", entity.getTask_code());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void finish(String id) {
|
public void finish(String id) {
|
||||||
@@ -771,7 +784,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
entity.setInstruction_status("2");
|
entity.setInstruction_status("2");
|
||||||
String instnextdevice = entity.getNext_device_code();
|
String instnextdevice = entity.getNext_device_code();
|
||||||
String insttaskid = entity.getTask_id();
|
String insttaskid = entity.getTask_id();
|
||||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
Device startdevice = appService.findDeviceByCode(entity.getStart_device_code());
|
Device startdevice = appService.findDeviceByCode(entity.getStart_device_code());
|
||||||
if (ObjectUtils.isEmpty(startdevice)) {
|
if (ObjectUtils.isEmpty(startdevice)) {
|
||||||
@@ -823,15 +835,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
jo.put("islock", "0");
|
jo.put("islock", "0");
|
||||||
deviceService.changeDeviceStatus(jo);
|
deviceService.changeDeviceStatus(jo);
|
||||||
|
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
|
||||||
// wo.update(json);
|
|
||||||
|
|
||||||
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
|
|
||||||
// JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
|
|
||||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
|
||||||
|
|
||||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id, insttaskid)
|
.eq(Task::getTask_id, insttaskid)
|
||||||
@@ -839,12 +846,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// =0 则不用再次请求
|
// =0 则不用再次请求
|
||||||
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
||||||
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
||||||
taskService.finish(task.getTask_id());
|
taskService.finish(task.getTask_id(),"0");
|
||||||
} else {
|
} else {
|
||||||
finishAndCreateNextInst(new Instruction(entity));
|
finishAndCreateNextInst(new Instruction(entity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeByCodeFromCache(entity.getInstruction_code());
|
removeByCodeFromCache(entity.getInstruction_code());
|
||||||
// this.reload();
|
// this.reload();
|
||||||
}
|
}
|
||||||
@@ -852,21 +858,17 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void finish(Instruction dto) {
|
public void finish(Instruction dto) {
|
||||||
String now = DateUtil.now();
|
|
||||||
|
try {
|
||||||
|
|
||||||
dto.setInstruction_status("2");
|
dto.setInstruction_status("2");
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
|
||||||
//
|
|
||||||
// wo.update(json);
|
|
||||||
|
|
||||||
InstructionMybatis ins = ConvertUtil.convert(dto, InstructionMybatis.class);
|
InstructionMybatis ins = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
|
|
||||||
String instnextdevice = dto.getNext_device_code();
|
String instnextdevice = dto.getNext_device_code();
|
||||||
String insttaskid = dto.getTask_id();
|
String insttaskid = dto.getTask_id();
|
||||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
|
||||||
// JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
|
|
||||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
|
||||||
|
|
||||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id, insttaskid)
|
.eq(Task::getTask_id, insttaskid)
|
||||||
@@ -874,7 +876,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// =0 则不用再次请求
|
// =0 则不用再次请求
|
||||||
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
||||||
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
|
||||||
taskService.finish(task.getTask_id());
|
taskService.finish(task.getTask_id(),"1");
|
||||||
} else {
|
} else {
|
||||||
finishAndCreateNextInst(dto);
|
finishAndCreateNextInst(dto);
|
||||||
}
|
}
|
||||||
@@ -909,8 +911,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
jo1.put("material_type", dto.getMaterial());
|
jo1.put("material_type", dto.getMaterial());
|
||||||
jo1.put("batch", dto.getBatch());
|
jo1.put("batch", dto.getBatch());
|
||||||
deviceService.changeDeviceStatus(jo1);
|
deviceService.changeDeviceStatus(jo1);
|
||||||
|
|
||||||
removeByCodeFromCache(dto.getInstruction_code());
|
removeByCodeFromCache(dto.getInstruction_code());
|
||||||
|
log.info("RGV反馈任务完成成功!指令号:{}", ins.getInstruction_code());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("RGV反馈任务失败!任务id为:{},指令号为:{}", dto.getInstruction_code(), e.getMessage());
|
||||||
|
}
|
||||||
// this.reload();
|
// this.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -919,9 +924,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
public void finishAndCreateNextInst(Instruction dto) {
|
public void finishAndCreateNextInst(Instruction dto) {
|
||||||
dto = foramte(dto);
|
dto = foramte(dto);
|
||||||
String device_code = dto.getNext_device_code();
|
String device_code = dto.getNext_device_code();
|
||||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
|
||||||
// JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0);
|
|
||||||
// TaskDto acsTask = taskjson.toJavaObject(TaskDto.class);
|
|
||||||
Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
|
Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id, dto.getTask_id())
|
.eq(Task::getTask_id, dto.getTask_id())
|
||||||
.one();
|
.one();
|
||||||
@@ -1010,14 +1013,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
if (StrUtil.isEmpty(entity.getRoute_plan_code())) {
|
if (StrUtil.isEmpty(entity.getRoute_plan_code())) {
|
||||||
entity.setRoute_plan_code(task.getRoute_plan_code());
|
entity.setRoute_plan_code(task.getRoute_plan_code());
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
// != 0 为agv任务 1=magic 2=NDC 3=XZ,4=ZHEDA
|
// != 0 为agv任务 1=magic 2=NDC 3=XZ,4=ZHEDA
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "1")
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "1")
|
||||||
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
||||||
MagicAgvService magicAgvService = SpringContextHolder.getBean(MagicAgvService.class);
|
MagicAgvService magicAgvService = SpringContextHolder.getBean(MagicAgvService.class);
|
||||||
magicAgvService.deleteAgvInst(entity.getInstruction_code());
|
magicAgvService.deleteAgvInst(entity.getInstruction_code());
|
||||||
flag = true;
|
flag = true;
|
||||||
|
|
||||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
||||||
// NDC agv指令不当场取消指令,需要等agv上报
|
// NDC agv指令不当场取消指令,需要等agv上报
|
||||||
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
||||||
@@ -1029,28 +1031,31 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
} else {
|
} else {
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
flag = true;
|
||||||
if (StrUtil.equals(entity.getInstruction_type(), "4") ||
|
if (StrUtil.equals(entity.getInstruction_type(), "4") ||
|
||||||
StrUtil.equals(entity.getInstruction_type(), "3")) {
|
StrUtil.equals(entity.getInstruction_type(), "3")) {
|
||||||
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
||||||
zheDaAgvService.deleteZDAgvInst(entity.getInstruction_code());
|
HttpResponse result = zheDaAgvService.deleteZDAgvInst(entity.getInstruction_code());
|
||||||
|
if (result.getStatus() == 200) {
|
||||||
flag = true;
|
flag = true;
|
||||||
|
} else {
|
||||||
|
log.error("下发rgv取消指令动作失败,下发AGV/RGV任务失败!任务id为:{},指令号为:{},失败原因{}", task.getTask_id(), entity.getInstruction_code(), "AGV/RGV未响应!");
|
||||||
|
if (task != null) {
|
||||||
|
task.setRemark("下发rgv取消指令动作失败!失败原因: 连接AGV/RGV未响应!");
|
||||||
|
taskService.update(task);
|
||||||
|
}
|
||||||
|
flag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
entity.setUpdate_time(now);
|
entity.setUpdate_time(now);
|
||||||
entity.setUpdate_by(currentUsername);
|
entity.setUpdate_by(currentUsername);
|
||||||
entity.setInstruction_status("3");
|
entity.setInstruction_status("3");
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
|
||||||
// wo.update(json);
|
|
||||||
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||||
|
|
||||||
// 如果是无光电的设备 指令完成变更起点、终点状态
|
// 如果是无光电的设备 指令完成变更起点、终点状态
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("device_code", entity.getStart_device_code());
|
jo.put("device_code", entity.getStart_device_code());
|
||||||
@@ -1066,7 +1071,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
jo.put("batch", entity.getBatch());
|
jo.put("batch", entity.getBatch());
|
||||||
jo.put("islock", "false");
|
jo.put("islock", "false");
|
||||||
deviceService.changeDeviceStatus(jo);
|
deviceService.changeDeviceStatus(jo);
|
||||||
|
|
||||||
JSONObject jo1 = new JSONObject();
|
JSONObject jo1 = new JSONObject();
|
||||||
jo1.put("device_code", entity.getNext_device_code());
|
jo1.put("device_code", entity.getNext_device_code());
|
||||||
jo.put("hasGoodStatus", "0");
|
jo.put("hasGoodStatus", "0");
|
||||||
@@ -1082,10 +1086,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removeByCodeFromCache(entity.getInstruction_code());
|
removeByCodeFromCache(entity.getInstruction_code());
|
||||||
// taskService.cancel(entity.getTask_id());
|
|
||||||
}
|
}
|
||||||
// this.reload();
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("指令取消失败!失败原因:{}", e.getMessage());
|
||||||
|
throw new BadRequestException("指令取消失败!失败原因:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forceCancel(String id) throws Exception {
|
public void forceCancel(String id) throws Exception {
|
||||||
@@ -1104,9 +1112,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
entity.setUpdate_time(now);
|
entity.setUpdate_time(now);
|
||||||
entity.setUpdate_by(currentUsername);
|
entity.setUpdate_by(currentUsername);
|
||||||
entity.setInstruction_status("3");
|
entity.setInstruction_status("3");
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
entity.setRemark("指令被PC端手动取消");
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
|
||||||
// wo.update(json);
|
|
||||||
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
@@ -1142,6 +1148,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removeByCodeFromCache(entity.getInstruction_code());
|
removeByCodeFromCache(entity.getInstruction_code());
|
||||||
|
log.error("指令被PC端手动取消,指令号:{},任务号:{}", entity.getInstruction_code(),entity.getTask_code());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class TaskController {
|
|||||||
@ApiOperation("完成任务")
|
@ApiOperation("完成任务")
|
||||||
@PostMapping(value = "/finish/{id}")
|
@PostMapping(value = "/finish/{id}")
|
||||||
public ResponseEntity<Object> finish(@RequestBody String id) {
|
public ResponseEntity<Object> finish(@RequestBody String id) {
|
||||||
taskService.finish(id);
|
taskService.finish(id, "2");
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,8 +215,9 @@ public interface TaskService extends CommonService<Task> {
|
|||||||
* 完成任务
|
* 完成任务
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
|
* @param operationType
|
||||||
*/
|
*/
|
||||||
void finish(String ids);
|
void finish(String ids,String operationType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消任务
|
* 取消任务
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import cn.hutool.core.map.MapUtil;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpResponse;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -16,6 +15,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.nl.acs.AcsConfig;
|
import org.nl.acs.AcsConfig;
|
||||||
import org.nl.acs.agv.server.XianGongAgvService;
|
import org.nl.acs.agv.server.XianGongAgvService;
|
||||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||||
|
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.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
import org.nl.acs.device.enums.DeviceType;
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
import org.nl.acs.device.service.DeviceAssignedService;
|
import org.nl.acs.device.service.DeviceAssignedService;
|
||||||
@@ -36,35 +38,27 @@ import org.nl.acs.route.service.dto.RouteLineDto;
|
|||||||
import org.nl.acs.route.service.mapper.RoutePlanMapper;
|
import org.nl.acs.route.service.mapper.RoutePlanMapper;
|
||||||
import org.nl.acs.storage_cell.service.StorageCellService;
|
import org.nl.acs.storage_cell.service.StorageCellService;
|
||||||
import org.nl.acs.task.TaskInstructionLock;
|
import org.nl.acs.task.TaskInstructionLock;
|
||||||
import org.nl.acs.task.service.TaskFeedbackService;
|
|
||||||
import org.nl.acs.task.service.dto.TaskFeedbackDto;
|
|
||||||
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.common.exception.BadRequestException;
|
|
||||||
import org.nl.acs.utils.ConvertUtil;
|
|
||||||
import org.nl.common.utils.FileUtil;
|
|
||||||
import org.nl.acs.utils.PageUtil;
|
|
||||||
import org.nl.acs.task.domain.Task;
|
import org.nl.acs.task.domain.Task;
|
||||||
|
import org.nl.acs.task.service.TaskFeedbackService;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.task.service.dto.TaskFeedbackDto;
|
||||||
import org.nl.acs.task.service.dto.TaskQueryParam;
|
import org.nl.acs.task.service.dto.TaskQueryParam;
|
||||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.acs.utils.ConvertUtil;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.acs.utils.PageUtil;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.common.utils.CodeUtil;
|
import org.nl.common.utils.CodeUtil;
|
||||||
|
import org.nl.common.utils.FileUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
|
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.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;
|
||||||
// 默认不使用缓存
|
|
||||||
//import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
//import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
//import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -899,9 +893,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* operationType 1自动完成 2手动完成 3手持完成
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void finish(String id) {
|
public void finish(String id, String operationType) {
|
||||||
TaskDto entity = this.findById(id);
|
TaskDto entity = this.findById(id);
|
||||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
@@ -912,10 +909,15 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
entity.setUpdate_time(now);
|
entity.setUpdate_time(now);
|
||||||
entity.setUpdate_by(currentUsername);
|
entity.setUpdate_by(currentUsername);
|
||||||
entity.setTask_status("2");
|
entity.setTask_status("2");
|
||||||
|
if ("2".equals(operationType)) {
|
||||||
|
log.error("任务被PC端手动完成,任务号:{}", entity.getTask_code());
|
||||||
|
entity.setRemark("任务被PC端手动完成");
|
||||||
|
} else if ("3".equals(operationType)) {
|
||||||
|
log.error("任务被手持端手动完成,任务号:{}", entity.getTask_code());
|
||||||
|
entity.setRemark("任务被手持端手动完成");
|
||||||
|
}
|
||||||
Task task = ConvertUtil.convert(entity, Task.class);
|
Task task = ConvertUtil.convert(entity, Task.class);
|
||||||
taskMapper.updateById(task);
|
taskMapper.updateById(task);
|
||||||
|
|
||||||
removeByCodeFromCache(entity.getTask_code());
|
removeByCodeFromCache(entity.getTask_code());
|
||||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||||
@@ -926,17 +928,17 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
request.setTask_status(entity.getTask_status());
|
request.setTask_status(entity.getTask_status());
|
||||||
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
||||||
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
||||||
boolean flag = false;
|
|
||||||
String resp = null;
|
String resp = null;
|
||||||
try {
|
try {
|
||||||
resp = acstowmsService.feedTaskStatus(request);
|
resp = acstowmsService.feedTaskStatus(request);
|
||||||
|
JSONObject result = JSONObject.parseObject(resp);
|
||||||
|
if (result.getString("code").equals("200")) {
|
||||||
log.info("任务号:{},反馈wms任务状态完成成功,响应信息:{}!", entity.getTask_code(), resp);
|
log.info("任务号:{},反馈wms任务状态完成成功,响应信息:{}!", entity.getTask_code(), resp);
|
||||||
|
} else {
|
||||||
|
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), result.getString("message"));
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), e.getMessage());
|
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), e.getMessage());
|
||||||
flag = true;
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果属于先知AGV,关闭运单序列
|
// 如果属于先知AGV,关闭运单序列
|
||||||
@@ -966,10 +968,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
entity.setUpdate_time(now);
|
entity.setUpdate_time(now);
|
||||||
entity.setUpdate_by(currentUsername);
|
entity.setUpdate_by(currentUsername);
|
||||||
entity.setTask_status("3");
|
entity.setTask_status("3");
|
||||||
|
entity.setRemark("任务被PC端手动取消");
|
||||||
Task task = ConvertUtil.convert(entity, Task.class);
|
Task task = ConvertUtil.convert(entity, Task.class);
|
||||||
taskMapper.updateById(task);
|
taskMapper.updateById(task);
|
||||||
|
log.error("任务被手动取消,任务号:{}", entity.getTask_code());
|
||||||
|
|
||||||
// synchronized (TaskServiceImpl.class){
|
// synchronized (TaskServiceImpl.class){
|
||||||
// Iterator<TaskDto> it = tasks.iterator();
|
// Iterator<TaskDto> it = tasks.iterator();
|
||||||
@@ -999,8 +1001,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
log.info("任务号:{},反馈wms任务状态完成成功,响应信息:{}!", entity.getTask_code(), resp);
|
log.info("任务号:{},反馈wms任务状态完成成功,响应信息:{}!", entity.getTask_code(), resp);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), e.getMessage());
|
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), e.getMessage());
|
||||||
} finally {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<RouteLineDto> shortPathsList =
|
List<RouteLineDto> shortPathsList =
|
||||||
@@ -1203,13 +1203,16 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
if (acsTask == null) {
|
if (acsTask == null) {
|
||||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
}
|
}
|
||||||
|
//只有执行中的任务才能创建指令
|
||||||
|
if (!"1".equals(acsTask.getTask_status())) {
|
||||||
|
throw new BadRequestException("任务未执行,不能创建指令!");
|
||||||
|
}
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 ");
|
InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 ");
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
throw new BadRequestException("有指令未完成!");
|
throw new BadRequestException("有指令未完成!");
|
||||||
}
|
}
|
||||||
|
|
||||||
String taskid = acsTask.getTask_id();
|
String taskid = acsTask.getTask_id();
|
||||||
String taskcode = acsTask.getTask_code();
|
String taskcode = acsTask.getTask_code();
|
||||||
String vehiclecode = acsTask.getVehicle_code();
|
String vehiclecode = acsTask.getVehicle_code();
|
||||||
@@ -1255,7 +1258,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
} else {
|
} else {
|
||||||
next_point_code = next_device_code;
|
next_point_code = next_device_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instruction instdto = new Instruction();
|
Instruction instdto = new Instruction();
|
||||||
instdto.setInstruction_type(task_type);
|
instdto.setInstruction_type(task_type);
|
||||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
@@ -1284,10 +1286,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
instdto.setAgv_system_type(agv_system_type);
|
instdto.setAgv_system_type(agv_system_type);
|
||||||
instdto.setAgv_inst_type("1");
|
instdto.setAgv_inst_type("1");
|
||||||
instdto.setExt_task_id(acsTask.getExt_task_id());
|
instdto.setExt_task_id(acsTask.getExt_task_id());
|
||||||
|
try {
|
||||||
instructionservice.create2(instdto);
|
instructionservice.create2(instdto);
|
||||||
|
log.info("手动创建指令成功!任务id为:{},指令号为:{}", acsTask.getTask_id(), instdto.getInstruction_code());
|
||||||
// acsTask.setTask_status("1");
|
} catch (Exception e) {
|
||||||
// this.update(acsTask);
|
log.error("手动创建指令失败!任务id为:{},指令号为:{},失败原因{}", acsTask.getTask_id(), instdto.getInstruction_code(), e.getMessage());
|
||||||
|
}
|
||||||
return instdto;
|
return instdto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ public class HandServiceImpl implements HandService {
|
|||||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||||
taskIdAndStatusDTO.setTask_id(task_uuid);
|
taskIdAndStatusDTO.setTask_id(task_uuid);
|
||||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||||
taskserver.finish(task_uuid);
|
taskserver.finish(task_uuid,"3");
|
||||||
}
|
}
|
||||||
resultJson.put("message", "操作成功");
|
resultJson.put("message", "操作成功");
|
||||||
resultJson.put("data", data);
|
resultJson.put("data", data);
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ public class AutoCreateInst {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始平均分解校验
|
* 开始平均分解校验
|
||||||
*/
|
*/
|
||||||
@@ -202,6 +200,8 @@ public class AutoCreateInst {
|
|||||||
instructionService.create(instdto);
|
instructionService.create(instdto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
acsTask.setRemark(e.getMessage());
|
acsTask.setRemark(e.getMessage());
|
||||||
|
//自动创建指令失败,保存失败原因
|
||||||
|
taskserver.update(acsTask);
|
||||||
taskserver.updateByCodeFromCache(acsTask);
|
taskserver.updateByCodeFromCache(acsTask);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,6 @@ public class AutoCreateInst {
|
|||||||
//创建指令后修改任务状态
|
//创建指令后修改任务状态
|
||||||
acsTask.setTask_status("1");
|
acsTask.setTask_status("1");
|
||||||
taskserver.update(acsTask);
|
taskserver.update(acsTask);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ public class QueryZDAgvTaskStatus {
|
|||||||
HttpResponse response2 = agvService.queryAgvInstStatus("1");
|
HttpResponse response2 = agvService.queryAgvInstStatus("1");
|
||||||
//查询AGV指令列表
|
//查询AGV指令列表
|
||||||
JSONArray inst_rows2 = JSONArray.parseArray(response2.body());
|
JSONArray inst_rows2 = JSONArray.parseArray(response2.body());
|
||||||
// JSONArray inst_rows2 = JSONArray.parseArray("");
|
|
||||||
for (int i = 0; i < inst_rows2.size(); i++) {
|
for (int i = 0; i < inst_rows2.size(); i++) {
|
||||||
JSONObject inst_jo = inst_rows2.getJSONObject(i);
|
JSONObject inst_jo = inst_rows2.getJSONObject(i);
|
||||||
String inst_code = inst_jo.getString("task_code");
|
String inst_code = inst_jo.getString("task_code");
|
||||||
@@ -51,7 +50,6 @@ public class QueryZDAgvTaskStatus {
|
|||||||
}
|
}
|
||||||
//反馈结果状态
|
//反馈结果状态
|
||||||
log.info("instcode:" + inst_code + "," + inst_jo.toString());
|
log.info("instcode:" + inst_code + "," + inst_jo.toString());
|
||||||
|
|
||||||
String status = inst_jo.getString("status");
|
String status = inst_jo.getString("status");
|
||||||
String vehicle = "";
|
String vehicle = "";
|
||||||
//正在执行指令agv车号
|
//正在执行指令agv车号
|
||||||
@@ -67,7 +65,6 @@ public class QueryZDAgvTaskStatus {
|
|||||||
// FINISHED:业务订单已完成
|
// FINISHED:业务订单已完成
|
||||||
// FAILED:业务订单已失败
|
// FAILED:业务订单已失败
|
||||||
// UNROUTABLE:无法规划该业务订单的执行路线
|
// UNROUTABLE:无法规划该业务订单的执行路线
|
||||||
|
|
||||||
//执行中
|
//执行中
|
||||||
if ("BEING_PdROCESSED".equals(status) || "ACTIVE".equals(status)) {
|
if ("BEING_PdROCESSED".equals(status) || "ACTIVE".equals(status)) {
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
@@ -88,18 +85,20 @@ public class QueryZDAgvTaskStatus {
|
|||||||
siteDeviceDriver.writing(10);
|
siteDeviceDriver.writing(10);
|
||||||
siteDeviceDriver.writing(10);
|
siteDeviceDriver.writing(10);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
log.error("写入信号失败:{}{}",e,e.getMessage());
|
log.error("RGV反馈任务完成,写入检测站点驱动信号失败:{}{}",e,e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inst.setInstruction_status("2");
|
inst.setInstruction_status("2");
|
||||||
instructionService.finish(inst);
|
instructionService.finish(inst);
|
||||||
|
log.info("RGV反馈任务完成成功!指令号:{}",inst_code);
|
||||||
}
|
}
|
||||||
} else if ("WITHDRAWN".equals(status) || "FAILED".equals(status)) {
|
} else if ("WITHDRAWN".equals(status) || "FAILED".equals(status)) {
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
inst.setInstruction_status("3");
|
inst.setInstruction_status("3");
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
instructionService.removeByCodeFromCache(inst_jo.getString("task_code"));
|
instructionService.removeByCodeFromCache(inst_jo.getString("task_code"));
|
||||||
|
log.info("RGV反馈任务撤销成功!指令号:{}",inst_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONArray ja = inst_jo.getJSONArray("destinations");
|
JSONArray ja = inst_jo.getJSONArray("destinations");
|
||||||
@@ -120,7 +119,7 @@ public class QueryZDAgvTaskStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
|
log.error("自动线程开始查询浙大AGV任务状态失败!失败原因:{}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import javax.annotation.Resource;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,12 +61,12 @@ public class SyncDeviceStatus {
|
|||||||
JSONArray jsonArray = JSONArray.parseArray(response.body());
|
JSONArray jsonArray = JSONArray.parseArray(response.body());
|
||||||
//查询RGV指令列表
|
//查询RGV指令列表
|
||||||
Map<String, String> taskCodeToTaskIdMap = new HashMap<>();
|
Map<String, String> taskCodeToTaskIdMap = new HashMap<>();
|
||||||
List<String> task_codes = jsonArray.stream()
|
List<String> taskCodes = jsonArray.stream()
|
||||||
.map(r -> ((JSONObject) r).getString("task_code"))
|
.map(r -> ((JSONObject) r).getString("task_code"))
|
||||||
.filter(task_code -> task_code != null && !task_code.isEmpty())
|
.filter(r -> r != null && !r.isEmpty())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (ObjectUtil.isNotEmpty(task_codes)) {
|
if (ObjectUtil.isNotEmpty(taskCodes)) {
|
||||||
List<InstructionMybatis> instructionList = instructionService.list(new LambdaQueryWrapper<InstructionMybatis>().in(InstructionMybatis::getInstruction_code, task_codes));
|
List<InstructionMybatis> instructionList = instructionService.list(new LambdaQueryWrapper<InstructionMybatis>().in(InstructionMybatis::getInstruction_code, taskCodes));
|
||||||
taskCodeToTaskIdMap = instructionList.stream()
|
taskCodeToTaskIdMap = instructionList.stream()
|
||||||
.filter(instruction -> StringUtils.isNotBlank(instruction.getExt_task_id()))
|
.filter(instruction -> StringUtils.isNotBlank(instruction.getExt_task_id()))
|
||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
@@ -89,7 +90,7 @@ public class SyncDeviceStatus {
|
|||||||
});
|
});
|
||||||
redisUtils.set("RGV", jsonArray);
|
redisUtils.set("RGV", jsonArray);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("自动上报驱动状态,查询浙大RGV设备状态失败{}{}", e, e.getMessage());
|
// log.error("自动上报驱动状态,查询浙大RGV设备状态失败{}{}", e, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ public class SyncDeviceStatus {
|
|||||||
JSONArray guhuashi = new JSONArray();
|
JSONArray guhuashi = new JSONArray();
|
||||||
JSONArray site = new JSONArray();
|
JSONArray site = new JSONArray();
|
||||||
JSONArray agv = new JSONArray();
|
JSONArray agv = new JSONArray();
|
||||||
log.info("自动线程开始查询agv设备状态");
|
//log.info("自动线程开始查询agv设备状态");
|
||||||
List<Device> deviceList = deviceAppService.findAllDevice();
|
List<Device> deviceList = deviceAppService.findAllDevice();
|
||||||
for (Device device : deviceList) {
|
for (Device device : deviceList) {
|
||||||
if (device.getDeviceDriver() instanceof BaoshijianSiteDeviceDriver) {
|
if (device.getDeviceDriver() instanceof BaoshijianSiteDeviceDriver) {
|
||||||
@@ -187,8 +188,13 @@ public class SyncDeviceStatus {
|
|||||||
List<String> deviceCodes = agv.stream()
|
List<String> deviceCodes = agv.stream()
|
||||||
.map(r -> {
|
.map(r -> {
|
||||||
String deviceCode = ((JSONObject) r).getString("device_code");
|
String deviceCode = ((JSONObject) r).getString("device_code");
|
||||||
|
if (StringUtils.isNotBlank(deviceCode)) {
|
||||||
return deviceCode.substring(deviceCode.length() - 1);
|
return deviceCode.substring(deviceCode.length() - 1);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (ObjectUtil.isNotEmpty(deviceCodes)) {
|
if (ObjectUtil.isNotEmpty(deviceCodes)) {
|
||||||
List<InstructionMybatis> instructionList = instructionService.list(new LambdaQueryWrapper<InstructionMybatis>().in(InstructionMybatis::getCarno, deviceCodes).lt(InstructionMybatis::getInstruction_status, 2).eq(InstructionMybatis::getIs_delete, 0));
|
List<InstructionMybatis> instructionList = instructionService.list(new LambdaQueryWrapper<InstructionMybatis>().in(InstructionMybatis::getCarno, deviceCodes).lt(InstructionMybatis::getInstruction_status, 2).eq(InstructionMybatis::getIs_delete, 0));
|
||||||
@@ -212,9 +218,9 @@ public class SyncDeviceStatus {
|
|||||||
|
|
||||||
}
|
}
|
||||||
redisUtils.set("agv", agv);
|
redisUtils.set("agv", agv);
|
||||||
log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
|
// log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("自动线程开始查询AGV设备,自动上报驱动状态失败{}{}", e, e.getMessage());
|
//log.error("自动线程开始查询AGV设备,自动上报驱动状态失败{}{}", e, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,36 +71,46 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
<!--添加loki-->
|
<!--添加loki-->
|
||||||
<!--开发环境:打印控制台-->
|
<!--开发环境:打印控制台-->
|
||||||
<springProfile name="dev">
|
<springProfile name="dev">
|
||||||
<root level="info">
|
<root level="debug">
|
||||||
<appender-ref ref="asyncLuceneAppender"/>
|
<appender-ref ref="asyncLuceneAppender"/>
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</root>
|
</root>
|
||||||
<logger name="jdbc" level="ERROR" additivity="true">
|
<logger name="jdbc" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.springframework" level="ERROR" additivity="true">
|
<logger name="org.springframework" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.hibernate" level="ERROR" additivity="true">
|
<logger name="org.hibernate" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.quartz" level="ERROR" additivity="true">
|
<logger name="org.quartz" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="com.google" level="ERROR" additivity="true">
|
<logger name="com.google" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.redisson" level="ERROR" additivity="true">
|
<logger name="org.redisson" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.nl.modules.wql" level="ERROR" additivity="true">
|
<logger name="org.nl.modules.wql" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.springframework.data" level="ERROR" additivity="true">
|
<logger name="org.springframework.data" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.jinterop" level="ERROR" additivity="true">
|
<logger name="org.jinterop" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
<!--测试环境:打印控制台-->
|
<!--测试环境:打印控制台-->
|
||||||
|
|||||||
@@ -156,20 +156,20 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
//今日生产任务
|
//今日生产任务
|
||||||
CompletableFuture<List<Map<String, Object>>> task7 = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<List<Map<String, Object>>> task7 = CompletableFuture.supplyAsync(() -> {
|
||||||
List<Map<String, Object>> result =cockpitMapper.getTdWorkmsg();
|
List<Map<String, Object>> result =cockpitMapper.getTdWorkmsg();
|
||||||
List<Map<String, Object>> today_work = new ArrayList<>();
|
// List<Map<String, Object>> today_work = new ArrayList<>();
|
||||||
if (ObjectUtil.isEmpty(result)) {
|
// if (ObjectUtil.isEmpty(result)) {
|
||||||
//测试数据,上线后删除
|
// //测试数据,上线后删除
|
||||||
Map<String, Object> item1 = new HashMap<>();
|
// Map<String, Object> item1 = new HashMap<>();
|
||||||
item1.put("workorder_code", "240918001");
|
// item1.put("workorder_code", "240918001");
|
||||||
item1.put("material_name", "TS_12Z中负");
|
// item1.put("material_name", "TS_12Z中负");
|
||||||
item1.put("plan_qty", "100");
|
// item1.put("plan_qty", "100");
|
||||||
item1.put("real_qty", "0");
|
// item1.put("real_qty", "0");
|
||||||
item1.put("point_name", "普涂线01");
|
// item1.put("point_name", "普涂线01");
|
||||||
item1.put("device_code", "LTX01");
|
// item1.put("device_code", "LTX01");
|
||||||
item1.put("workorder_status", "生产中");
|
// item1.put("workorder_status", "生产中");
|
||||||
today_work.add(item1);
|
// today_work.add(item1);
|
||||||
}
|
// }
|
||||||
getHomeInfo.put("today_work", today_work);
|
getHomeInfo.put("today_work", result);
|
||||||
return null;
|
return null;
|
||||||
}, pool);
|
}, pool);
|
||||||
task7.exceptionally((e) -> {
|
task7.exceptionally((e) -> {
|
||||||
@@ -207,7 +207,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
CompletableFuture<List<Map<String, Object>>> task10 = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<List<Map<String, Object>>> task10 = CompletableFuture.supplyAsync(() -> {
|
||||||
List<Map<String, Object>> result =cockpitMapper.faultAlarm();
|
List<Map<String, Object>> result =cockpitMapper.faultAlarm();
|
||||||
//测试数据,上线后删除
|
//测试数据,上线后删除
|
||||||
faultAlarmDefault(result, "GHS01");
|
//faultAlarmDefault(result, "GHS01");
|
||||||
getHomeInfo.put("fault_alarm", result);
|
getHomeInfo.put("fault_alarm", result);
|
||||||
return null;
|
return null;
|
||||||
}, pool);
|
}, pool);
|
||||||
@@ -219,7 +219,6 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
//近30日故障统计
|
//近30日故障统计
|
||||||
CompletableFuture<JSONArray> task11 = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<JSONArray> task11 = CompletableFuture.supplyAsync(() -> {
|
||||||
JSONArray result=cockpitMapper.monthlyFaultStatistics();
|
JSONArray result=cockpitMapper.monthlyFaultStatistics();
|
||||||
//测试数据,上线后删除
|
|
||||||
getHomeInfo.put("monthly_fault_statistics", result);
|
getHomeInfo.put("monthly_fault_statistics", result);
|
||||||
return null;
|
return null;
|
||||||
}, pool);
|
}, pool);
|
||||||
@@ -321,11 +320,11 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
//实时故障告警
|
//实时故障告警
|
||||||
List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("TBX");
|
List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("TBX");
|
||||||
//测试数据,上线后删除
|
//测试数据,上线后删除
|
||||||
faultAlarmDefault(fault_alarm, "LTX01");
|
//faultAlarmDefault(fault_alarm, "LTX01");
|
||||||
//近30日故障统计
|
//近30日故障统计
|
||||||
JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("TBX");
|
JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("TBX");
|
||||||
//测试数据,上线后删除
|
//测试数据,上线后删除
|
||||||
monthlyFaultStatisticsDefault(monthly_fault_statistics, "LTX01");
|
//monthlyFaultStatisticsDefault(monthly_fault_statistics, "LTX01");
|
||||||
List<Map<String, Object>> monthly_produce_statistics = cockpitMapper.getTbxMonthlyStatistics();
|
List<Map<String, Object>> monthly_produce_statistics = cockpitMapper.getTbxMonthlyStatistics();
|
||||||
List<Map<String, Object>> tbxMonthlyStatistics = new ArrayList<>();
|
List<Map<String, Object>> tbxMonthlyStatistics = new ArrayList<>();
|
||||||
for (int i = 0; i < 30; i++) {
|
for (int i = 0; i < 30; i++) {
|
||||||
@@ -410,7 +409,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
//今日固化任务
|
//今日固化任务
|
||||||
List<Map<String, Object>> gh_material_summary = new ArrayList<>();
|
List<Map<String, Object>> gh_material_summary = new ArrayList<>();
|
||||||
List<TaskInfo> taskInfos = getTasks(RegionCodeConstant.CURING_ZONE);
|
List<TaskInfo> taskInfos = getTasks(RegionCodeConstant.CURING_ZONE);
|
||||||
if (ObjectUtil.isNotEmpty(taskInfos)) {
|
// if (ObjectUtil.isNotEmpty(taskInfos)) {
|
||||||
taskInfos.forEach(r -> {
|
taskInfos.forEach(r -> {
|
||||||
Map<String, Object> item = new HashMap<>();
|
Map<String, Object> item = new HashMap<>();
|
||||||
item.put("material_name", r.getMaterial_name());
|
item.put("material_name", r.getMaterial_name());
|
||||||
@@ -419,21 +418,21 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
item.put("type", r.getType());
|
item.put("type", r.getType());
|
||||||
gh_material_summary.add(item);
|
gh_material_summary.add(item);
|
||||||
});
|
});
|
||||||
} else {
|
// } else {
|
||||||
//测试数据,上线后删除
|
// //测试数据,上线后删除
|
||||||
Map<String, Object> item1 = new HashMap<>();
|
// Map<String, Object> item1 = new HashMap<>();
|
||||||
item1.put("material_name", "TS_1.9A正");
|
// item1.put("material_name", "TS_1.9A正");
|
||||||
item1.put("material_spec", "正涂片极板/1.9A/大片");
|
// item1.put("material_spec", "正涂片极板/1.9A/大片");
|
||||||
item1.put("qty", "100");
|
// item1.put("qty", "100");
|
||||||
item1.put("type", "入库");
|
// item1.put("type", "入库");
|
||||||
Map<String, Object> item2 = new HashMap<>();
|
// Map<String, Object> item2 = new HashMap<>();
|
||||||
item2.put("material_name", "TS_15A负");
|
// item2.put("material_name", "TS_15A负");
|
||||||
item2.put("material_spec", "负涂片极板/15A/大片");
|
// item2.put("material_spec", "负涂片极板/15A/大片");
|
||||||
item2.put("qty", "100");
|
// item2.put("qty", "100");
|
||||||
item2.put("type", "出库");
|
// item2.put("type", "出库");
|
||||||
gh_material_summary.add(item1);
|
// gh_material_summary.add(item1);
|
||||||
gh_material_summary.add(item2);
|
// gh_material_summary.add(item2);
|
||||||
}
|
// }
|
||||||
stopWatch2.stop();
|
stopWatch2.stop();
|
||||||
System.out.println("今日固化任务统计花费时间---= totalTime = " + stopWatch2.getTotalTimeMillis());
|
System.out.println("今日固化任务统计花费时间---= totalTime = " + stopWatch2.getTotalTimeMillis());
|
||||||
|
|
||||||
@@ -442,7 +441,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
stopWatch3.start();
|
stopWatch3.start();
|
||||||
//实时故障告警
|
//实时故障告警
|
||||||
List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("GH");
|
List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("GH");
|
||||||
faultAlarmDefault(fault_alarm, "GHS01");
|
//faultAlarmDefault(fault_alarm, "GHS01");
|
||||||
stopWatch3.stop();
|
stopWatch3.stop();
|
||||||
System.out.println("查询实时故障告警花费时间---= totalTime = " + stopWatch3.getTotalTimeMillis());
|
System.out.println("查询实时故障告警花费时间---= totalTime = " + stopWatch3.getTotalTimeMillis());
|
||||||
|
|
||||||
@@ -452,11 +451,9 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
//近30日故障统计
|
//近30日故障统计
|
||||||
JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("GH");
|
JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("GH");
|
||||||
//测试数据,上线后删除
|
//测试数据,上线后删除
|
||||||
monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS01");
|
//monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS01");
|
||||||
stopWatch4.stop();
|
stopWatch4.stop();
|
||||||
System.out.println("查询近30日故障统计花费时间---= totalTime = " + stopWatch4.getTotalTimeMillis());
|
System.out.println("查询近30日故障统计花费时间---= totalTime = " + stopWatch4.getTotalTimeMillis());
|
||||||
|
|
||||||
|
|
||||||
getGhsInfo.put("curing_summary", curing_summary);
|
getGhsInfo.put("curing_summary", curing_summary);
|
||||||
getGhsInfo.put("monthly_gh_qty", monthly_gh_qty_default);
|
getGhsInfo.put("monthly_gh_qty", monthly_gh_qty_default);
|
||||||
getGhsInfo.put("gh_material_summary", gh_material_summary);
|
getGhsInfo.put("gh_material_summary", gh_material_summary);
|
||||||
@@ -550,12 +547,12 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
//近30日故障统计
|
//近30日故障统计
|
||||||
JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics();
|
JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics();
|
||||||
//测试数据,上线后删除
|
//测试数据,上线后删除
|
||||||
if (ObjectUtil.isEmpty(monthly_fault_statistics)) {
|
// if (ObjectUtil.isEmpty(monthly_fault_statistics)) {
|
||||||
JSONObject item = new JSONObject();
|
// JSONObject item = new JSONObject();
|
||||||
item.put("region_name", "GHS");
|
// item.put("region_name", "GHS");
|
||||||
item.put("alarm_qty", "1");
|
// item.put("alarm_qty", "1");
|
||||||
monthly_fault_statistics.add(item);
|
// monthly_fault_statistics.add(item);
|
||||||
}
|
// }
|
||||||
getHandlingInfo.put("device_status", device_status);
|
getHandlingInfo.put("device_status", device_status);
|
||||||
getHandlingInfo.put("fault_alarm", fault_alarm);
|
getHandlingInfo.put("fault_alarm", fault_alarm);
|
||||||
getHandlingInfo.put("monthly_fault_statistics", monthly_fault_statistics);
|
getHandlingInfo.put("monthly_fault_statistics", monthly_fault_statistics);
|
||||||
|
|||||||
@@ -485,17 +485,17 @@
|
|||||||
) g ON g.workorder_code = w.workorder_code
|
) g ON g.workorder_code = w.workorder_code
|
||||||
WHERE
|
WHERE
|
||||||
w.point_code = #{deviceCode}
|
w.point_code = #{deviceCode}
|
||||||
<!-- AND <choose>-->
|
AND <choose>
|
||||||
<!-- <when test="dateType == 1">-->
|
<when test="dateType == 1">
|
||||||
<!-- w.create_time BETWEEN CONCAT(DATE(NOW()), ' 07:00:00') AND CONCAT(DATE(NOW()), ' 18:00:00')-->
|
w.create_time BETWEEN CONCAT(DATE(NOW()), ' 07:00:00') AND CONCAT(DATE(NOW()), ' 18:00:00')
|
||||||
<!-- </when>-->
|
</when>
|
||||||
<!-- <when test="dateType == 2">-->
|
<when test="dateType == 2">
|
||||||
<!-- w.create_time BETWEEN CONCAT(DATE(NOW()), ' 18:30:00') AND CONCAT(DATE_ADD(DATE(NOW()), INTERVAL 1 DAY), ' 06:30:00')-->
|
w.create_time BETWEEN CONCAT(DATE(NOW()), ' 18:30:00') AND CONCAT(DATE_ADD(DATE(NOW()), INTERVAL 1 DAY), ' 06:30:00')
|
||||||
<!-- </when>-->
|
</when>
|
||||||
<!-- <otherwise>-->
|
<otherwise>
|
||||||
<!-- 1 = 1-->
|
1 = 1
|
||||||
<!-- </otherwise>-->
|
</otherwise>
|
||||||
<!-- </choose>-->
|
</choose>
|
||||||
</select>
|
</select>
|
||||||
<select id="ltProduction" resultType="com.alibaba.fastjson.JSONObject">
|
<select id="ltProduction" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
SELECT
|
SELECT
|
||||||
@@ -692,7 +692,7 @@ GROUP BY
|
|||||||
'网络超时'
|
'网络超时'
|
||||||
WHEN '512' THEN
|
WHEN '512' THEN
|
||||||
'信号丢失'
|
'信号丢失'
|
||||||
ELSE ''
|
ELSE '其他'
|
||||||
END AS fault_cause,
|
END AS fault_cause,
|
||||||
d.device_code AS device_name,
|
d.device_code AS device_name,
|
||||||
d.failure_time AS alarm_time
|
d.failure_time AS alarm_time
|
||||||
|
|||||||
Reference in New Issue
Block a user