opt:优化acs代码
This commit is contained in:
@@ -37,9 +37,6 @@ public class InstructionController {
|
||||
@ApiOperation("查询指令")
|
||||
//@PreAuthorize("@el.check('instruction:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
if(ObjectUtil.isEmpty(whereJson.get("status"))) {
|
||||
whereJson.put("status", "1");
|
||||
}
|
||||
return new ResponseEntity<>(instructionService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
@Autowired
|
||||
TaskMapper taskMapper;
|
||||
List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
// List<InstructionMybatis> instructions_mybatis = new CopyOnWriteArrayList();
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
@@ -196,6 +195,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
wrapper.eq(StringUtils.isNotBlank(status),InstructionMybatis::getInstruction_status,status);
|
||||
wrapper.and(StringUtils.isNotBlank(point_code),instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code));
|
||||
wrapper.eq(StringUtils.isNotBlank(instruction_type),InstructionMybatis::getInstruction_type,instruction_type);
|
||||
wrapper.le(InstructionMybatis::getInstruction_status, 1);
|
||||
if (!StrUtil.isEmpty(is_over)) {
|
||||
if (StrUtil.equals(is_over,"1")){
|
||||
wrapper.ge(InstructionMybatis::getInstruction_status,2);
|
||||
@@ -203,6 +203,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
wrapper.lt(InstructionMybatis::getInstruction_status,2);
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(InstructionMybatis::getCreate_time);
|
||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage,wrapper);
|
||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
|
||||
return json;
|
||||
@@ -311,10 +312,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findByTaskcode(String code) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
// return obj;
|
||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.eq(InstructionMybatis::getTask_code, code)
|
||||
.one();
|
||||
@@ -339,15 +336,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findByTaskid(String id, String wherecaluse) {
|
||||
// if (!StrUtil.isEmpty(wherecaluse)) {
|
||||
// wherecaluse = " and " + wherecaluse;
|
||||
// }
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = wo.query("task_id ='" + id + "'" + wherecaluse).uniqueResult(0);
|
||||
// if (ObjectUtil.isNotEmpty(json)) {
|
||||
// return json.toJavaObject(Instruction.class);
|
||||
// }
|
||||
// return null;
|
||||
|
||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InstructionMybatis::getTask_id,id);
|
||||
@@ -456,9 +444,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
e.printStackTrace();
|
||||
log.error("");
|
||||
}
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
// wo.insert(json);
|
||||
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||
instructionMapper.insert(entity);
|
||||
instructions.add(dto);
|
||||
@@ -470,7 +455,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
String task_code = dto.getTask_code();
|
||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||
|
||||
// WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||
@@ -626,10 +610,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
dto.setUpdate_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);
|
||||
instructionMapper.insert(entity);
|
||||
@@ -821,19 +801,12 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
public void finish(Instruction dto) {
|
||||
String now = DateUtil.now();
|
||||
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);
|
||||
instructionMapper.updateById(ins);
|
||||
|
||||
String instnextdevice = dto.getNext_device_code();
|
||||
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)
|
||||
.eq(Task::getTask_id,insttaskid)
|
||||
@@ -990,14 +963,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
||||
ndcAgvService.deleteAgvInstToNDC(new Instruction(entity));
|
||||
}
|
||||
// } else {
|
||||
flag = true;
|
||||
// }
|
||||
// } else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
|
||||
// && !StrUtil.equals(entity.getSend_status(), "2")) {
|
||||
// XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
|
||||
// xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
|
||||
// flag = true;
|
||||
flag = true;
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
@@ -1032,9 +998,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
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);
|
||||
instructionMapper.updateById(ins);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
@@ -1072,7 +1035,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
removeByCodeFromCache(entity.getInstruction_code());
|
||||
}
|
||||
// this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1092,9 +1054,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
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);
|
||||
instructionMapper.updateById(ins);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
|
||||
@@ -106,13 +106,6 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
List<TaskDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param task_id ID
|
||||
* @return AcsTask
|
||||
*/
|
||||
// TaskDto findById(String task_id);
|
||||
|
||||
/**
|
||||
* 查询所有未完成任务
|
||||
|
||||
@@ -165,87 +165,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
return this.removeByIds(set);
|
||||
}
|
||||
|
||||
/*
|
||||
private void delCaches(String id) {
|
||||
redisUtils.delByKey(CACHE_KEY + "::id:", id);
|
||||
}
|
||||
|
||||
private void delCaches(Set<String> ids) {
|
||||
for (String id: ids) {
|
||||
delCaches(id);
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void download(List<TaskDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TaskDto task : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("任务外部标识", task.getExtTaskId());
|
||||
map.put("任务号", task.getTaskCode());
|
||||
map.put("载具号", task.getVehicleCode());
|
||||
map.put("载具类型", task.getVehicleType());
|
||||
map.put("任务类型", task.getTaskType());
|
||||
map.put("任务状态", task.getTaskStatus());
|
||||
map.put("复合任务", task.getCompoundTask());
|
||||
map.put("复合任务数据", task.getCompoundTaskData());
|
||||
map.put("再次请求", task.getRequestAgain());
|
||||
map.put("再次请求成功", task.getRequestAgainSuccess());
|
||||
map.put("关联编号", task.getLinkNum());
|
||||
map.put("是否下发", task.getIsSend());
|
||||
map.put("物料类型", task.getMaterial());
|
||||
map.put("物料数量", task.getQuantity());
|
||||
map.put("任务优先级", task.getPriority());
|
||||
map.put("创建类型", task.getCreateType());
|
||||
map.put("完成类型", task.getFinishType());
|
||||
map.put("执行描述编码", task.getExecuteCode());
|
||||
map.put("执行描述信息", task.getExecuteMessage());
|
||||
map.put("起始点位编码", task.getStartPointCode());
|
||||
map.put("起始设备编码", task.getStartDeviceCode());
|
||||
map.put("放货点位编码", task.getPutPointCode());
|
||||
map.put("放货设备编码", task.getPutDeviceCode());
|
||||
map.put("起始点位编码2", task.getStartPointCode2());
|
||||
map.put("起始设备编码2", task.getStartDeviceCode2());
|
||||
map.put("目标点位编码", task.getNextPointCode());
|
||||
map.put("目标设备编码", task.getNextDeviceCode());
|
||||
map.put("目标点位编码2", task.getNextPointCode2());
|
||||
map.put("目标设备编码2", task.getNextDeviceCode2());
|
||||
map.put("排", task.getFromX());
|
||||
map.put("列", task.getFromY());
|
||||
map.put("层", task.getFromZ());
|
||||
map.put("排", task.getPutX());
|
||||
map.put("列", task.getPutY());
|
||||
map.put("层", task.getPutZ());
|
||||
map.put("排", task.getToX());
|
||||
map.put("列", task.getToY());
|
||||
map.put("层", task.getToZ());
|
||||
map.put("排2", task.getFromX2());
|
||||
map.put("列2", task.getFromY2());
|
||||
map.put("层2", task.getFromZ2());
|
||||
map.put("排2", task.getToX2());
|
||||
map.put("列2", task.getToY2());
|
||||
map.put("层2", task.getToZ2());
|
||||
map.put("路由方案名称", task.getRoutePlanName());
|
||||
map.put("路由方案编码", task.getRoutePlanCode());
|
||||
map.put("是否需要反馈上位系统", task.getIsNeedfeedback());
|
||||
map.put("空盘数量", task.getEmptypalletNum());
|
||||
map.put("备注", task.getRemark());
|
||||
map.put("是否启用", task.getIsActive());
|
||||
map.put("是否删除", task.getIsDelete());
|
||||
map.put("创建者", task.getCreateBy());
|
||||
map.put("创建时间", task.getCreateTime());
|
||||
map.put("修改者", task.getUpdateBy());
|
||||
map.put("修改时间", task.getUpdateTime());
|
||||
map.put("重量", task.getWeight());
|
||||
map.put("agv系统类型", task.getAgvSystemType());
|
||||
map.put("立库任务类型", task.getStorageTaskType());
|
||||
map.put("温度", task.getTemperature());
|
||||
map.put("时间", task.getOvenTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 获取未完成任务
|
||||
@@ -441,20 +360,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public TaskDto findById(String task_id) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject json = wo.query("task_id ='" + task_id + "'").uniqueResult(0);
|
||||
// final TaskDto obj = json.toJavaObject(TaskDto.class);
|
||||
// return obj;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryAllUnfinished(Map whereJson) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONArray arr = wo.query("task_status < 2 ").getResultJSONArray(0);
|
||||
// List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
||||
// return list;
|
||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.lt(Task::getTask_status,"2")
|
||||
.list();
|
||||
@@ -463,10 +370,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
|
||||
@Override
|
||||
public TaskDto findByCode(String code) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||
// final TaskDto obj = json.toJavaObject(TaskDto.class);
|
||||
// return obj;
|
||||
Task task= new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_code,code)
|
||||
.one();
|
||||
@@ -849,15 +752,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
Task task = ConvertUtil.convert(dto, Task.class);
|
||||
taskMapper.updateById(task);
|
||||
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
// while (iterator.hasNext()) {
|
||||
// TaskDto task = iterator.next();
|
||||
// if (task.getTask_code().equals(dto.getTask_code())) {
|
||||
// iterator.remove();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
|
||||
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) {
|
||||
|
||||
@@ -17,8 +17,10 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -69,7 +71,12 @@ public class AutoCreateInst {
|
||||
continue;
|
||||
}
|
||||
List<Instruction> instructions = instructionService.queryAll("instruction_status < 2");
|
||||
String maxInstnumber = acsConfigService.findByCode(AcsConfig.MAXINSTNUMBER).getValue();
|
||||
Param maxInstNumber_param = acsConfigService.findByCode(AcsConfig.MAXINSTNUMBER);
|
||||
if(ObjectUtils.isEmpty(maxInstNumber_param)){
|
||||
log.info("未查询到系统参数"+AcsConfig.MAXINSTNUMBER+"相关配置,请检查相关设置!");
|
||||
throw new BadRequestException("未查询到系统参数"+AcsConfig.MAXINSTNUMBER+"相关配置,请检查相关设置!");
|
||||
}
|
||||
String maxInstnumber = maxInstNumber_param.getValue();
|
||||
if (ObjectUtils.isNotEmpty(maxInstnumber)) {
|
||||
if (instructions.size() >= Integer.parseInt(maxInstnumber)) {
|
||||
log.info("已达到系统参数配置的最大指令数 [" + maxInstnumber + "] ,无法生成指令。");
|
||||
@@ -77,6 +84,9 @@ public class AutoCreateInst {
|
||||
taskserver.updateByCodeFromCache(acsTask);
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
log.info("系统参数"+AcsConfig.MAXINSTNUMBER+"相关配置异常,请检查相关设置!");
|
||||
throw new BadRequestException("系统参数"+AcsConfig.MAXINSTNUMBER+"相关配置异常,请检查相关设置!");
|
||||
}
|
||||
|
||||
|
||||
@@ -147,8 +157,12 @@ public class AutoCreateInst {
|
||||
// StandardEmptyPalletSiteDeviceDriver standardEmptsyPalletSiteDeviceDriver;
|
||||
// LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||
// LnshFoldDiscSiteDeviceDriver lnshFoldDiscSiteDeviceDriver;
|
||||
|
||||
String createTaskCheck = acsConfigService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
|
||||
Param createTaskCheck_param = acsConfigService.findByCode(AcsConfig.CREATETASKCHECK);
|
||||
if(ObjectUtils.isEmpty(createTaskCheck_param)){
|
||||
log.info("未查询到系统参数"+AcsConfig.CREATETASKCHECK+"相关配置,请检查相关设置!");
|
||||
throw new BadRequestException("未查询到系统参数"+AcsConfig.CREATETASKCHECK+"相关配置,请检查相关设置!");
|
||||
}
|
||||
String createTaskCheck = createTaskCheck_param.getValue();
|
||||
|
||||
if (StrUtil.equals(createTaskCheck, "1")) {
|
||||
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
|
||||
Reference in New Issue
Block a user