rev:堆叠机双向点位平均分配原则

This commit is contained in:
2024-01-11 19:39:40 +08:00
parent db4d0db124
commit 486cea7de8
8 changed files with 209 additions and 54 deletions

View File

@@ -154,8 +154,8 @@ public interface DeviceAssignedService extends CommonService<DeviceAssigned> {
/** /**
* queryAssignedBydevice * queryAssignedBydevice
* @param device_code * @param device_code
* @param task_nextdeice_code * @param task_nextDeice_code
* @return * @return
*/ */
List<DeviceAssignedDto> queryAssignedBydevice(String device_code, String task_nextdeice_code); List<DeviceAssignedDto> queryAssignedByDevice(String device_code, String task_nextDeice_code);
} }

View File

@@ -1,14 +1,11 @@
package org.nl.acs.device.service.impl; package org.nl.acs.device.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.common.base.CommonFinalParam;
@@ -20,8 +17,6 @@ import org.nl.acs.device.service.mapper.DeviceAssignedMapper;
import org.nl.acs.common.base.PageInfo; import org.nl.acs.common.base.PageInfo;
import org.nl.acs.common.base.QueryHelpMybatisPlus; import org.nl.acs.common.base.QueryHelpMybatisPlus;
import org.nl.acs.common.base.impl.CommonServiceImpl; import org.nl.acs.common.base.impl.CommonServiceImpl;
import org.nl.acs.storage_cell.domain.StorageCell;
import org.nl.acs.storage_cell.service.dto.StorageCellDto;
import org.nl.acs.utils.ConvertUtil; import org.nl.acs.utils.ConvertUtil;
import org.nl.common.utils.FileUtil; import org.nl.common.utils.FileUtil;
import org.nl.acs.utils.PageUtil; import org.nl.acs.utils.PageUtil;
@@ -98,8 +93,6 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
} }
@Override @Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) { public Map<String, Object> queryAll(Map whereJson, Pageable page) {
IPage<DeviceAssigned> queryPage = PageUtil.toMybatisPage(page); IPage<DeviceAssigned> queryPage = PageUtil.toMybatisPage(page);
@@ -137,7 +130,7 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("limit", limit); data.put("limit", limit);
data.put("scale", scale); data.put("scale", scale);
data.put("inOut",inOut); data.put("inOut", inOut);
jo.put(device, data); jo.put(device, data);
} }
String now = DateUtil.now(); String now = DateUtil.now();
@@ -164,7 +157,7 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
String task_nextdevice = String.join(",", (List<String>) whereJson.get("task_nextDevice_code")); String task_nextdevice = String.join(",", (List<String>) whereJson.get("task_nextDevice_code"));
String inst_nextdevice = String.join(",", (List<String>) whereJson.get("inst_nextDevice_code")); String inst_nextdevice = String.join(",", (List<String>) whereJson.get("inst_nextDevice_code"));
String assigned_id = whereJson.get("assigned_id").toString(); String assigned_id = whereJson.get("assigned_id").toString();
param.put("assigned_id",assigned_id); param.put("assigned_id", assigned_id);
param.put("device_code", device_code); param.put("device_code", device_code);
param.put("task_nextDevice_code", task_nextdevice.toString()); param.put("task_nextDevice_code", task_nextdevice.toString());
param.put("inst_nextDevice_code", inst_nextdevice.toString()); param.put("inst_nextDevice_code", inst_nextdevice.toString());
@@ -221,12 +214,29 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
} }
@Override @Override
public List<DeviceAssignedDto> queryAssignedBydevice(String device_code, String task_nextdeice_code) { public List<DeviceAssignedDto> queryAssignedByDevice(String device_code, String task_nextDeice_code) {
List<DeviceAssigned> oldList = new LambdaQueryChainWrapper<>(deviceAssignedMapper)
List<DeviceAssigned> list = new LambdaQueryChainWrapper<>(deviceAssignedMapper)
.eq(DeviceAssigned::getDevice_code, device_code) .eq(DeviceAssigned::getDevice_code, device_code)
.eq(DeviceAssigned::getTask_nextDevice_code, task_nextdeice_code)
.list(); .list();
return ConvertUtil.convertList(list, DeviceAssignedDto.class); List<DeviceAssigned> newList = new ArrayList<>();
Optional
.ofNullable(oldList)
.orElse(new ArrayList<>())
.stream()
.forEach(olDeviceAssigned -> {
Arrays.stream((olDeviceAssigned.getTask_nextDevice_code() == null ? "" : olDeviceAssigned.getTask_nextDevice_code()).split(","))
.forEach(task_code -> {
if (task_code.equals(task_nextDeice_code)) {
DeviceAssigned deviceAssigned = new DeviceAssigned();
deviceAssigned.setAssigned_id(olDeviceAssigned.getAssigned_id());
deviceAssigned.setDevice_code(olDeviceAssigned.getDevice_code());
deviceAssigned.setInst_nextDevice_code(olDeviceAssigned.getInst_nextDevice_code());
deviceAssigned.setTask_nextDevice_code(task_nextDeice_code);
deviceAssigned.setParam(olDeviceAssigned.getParam());
newList.add(deviceAssigned);
}
});
});
return ConvertUtil.convertList(newList, DeviceAssignedDto.class);
} }
} }

View File

@@ -50,6 +50,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 根据ID查询 * 根据ID查询
*
* @param id * @param id
* @return * @return
*/ */
@@ -57,6 +58,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 根据ID更新 * 根据ID更新
*
* @param resources * @param resources
* @return * @return
*/ */
@@ -97,6 +99,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 查询数据分页 * 查询数据分页
*
* @param whereJson * @param whereJson
* @param page * @param page
* @return * @return
@@ -166,6 +169,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 根据任务id查询 * 根据任务id查询
*
* @param id * @param id
* @param wherecase * @param wherecase
* @return * @return
@@ -174,6 +178,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 创建 * 创建
*
* @param dto * @param dto
* @throws Exception * @throws Exception
*/ */
@@ -181,6 +186,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 创建2 * 创建2
*
* @param dto * @param dto
* @throws Exception * @throws Exception
*/ */
@@ -203,6 +209,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 多选删除 * 多选删除
*
* @param ids * @param ids
* @throws Exception * @throws Exception
*/ */
@@ -219,6 +226,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 完成指令 * 完成指令
*
* @param id * @param id
* @throws Exception * @throws Exception
*/ */
@@ -226,6 +234,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 完成指令 * 完成指令
*
* @param dto * @param dto
* @throws Exception * @throws Exception
*/ */
@@ -234,6 +243,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 完成并创建下一条指令 * 完成并创建下一条指令
*
* @param dto * @param dto
* @throws Exception * @throws Exception
*/ */
@@ -242,6 +252,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 取消指令 * 取消指令
*
* @param id * @param id
* @throws Exception * @throws Exception
*/ */
@@ -249,6 +260,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 取消指令 * 取消指令
*
* @param id * @param id
* @throws Exception * @throws Exception
*/ */
@@ -256,6 +268,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 取消指令不下发agv * 取消指令不下发agv
*
* @param id * @param id
* @throws Exception * @throws Exception
*/ */
@@ -271,6 +284,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 根据编码查询 * 根据编码查询
*
* @param code * @param code
* @return * @return
*/ */
@@ -318,6 +332,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 格式化 * 格式化
*
* @param inst * @param inst
* @return * @return
*/ */
@@ -364,6 +379,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 根据编码删除 * 根据编码删除
*
* @param code * @param code
* @return * @return
*/ */
@@ -371,6 +387,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 创建关联指令 * 创建关联指令
*
* @param type * @param type
* @param inst * @param inst
* @return * @return
@@ -379,12 +396,14 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 初始化指令 * 初始化指令
*
* @param id * @param id
*/ */
void init(String id); void init(String id);
/** /**
* 根据指令某个参数查找指令集合 * 根据指令某个参数查找指令集合
*
* @param instruction1 * @param instruction1
* @param flay * @param flay
* @return * @return
@@ -394,6 +413,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 根据条件查询指令 * 根据条件查询指令
*
* @param whereJson * @param whereJson
* @return * @return
*/ */
@@ -401,14 +421,27 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/** /**
* 导出指令记录 * 导出指令记录
*
* @param instList * @param instList
* @param response * @param response
* @throws IOException * @throws IOException
*/ */
void downloadInstLogging(List<JSONObject> instList, HttpServletResponse response) throws IOException; void downloadInstLogging(List<JSONObject> instList, HttpServletResponse response) throws IOException;
/** /**
* 只完成指令 * 查询是否有相同终点的指令,但是是入库的指令,即指令起点设备类型不是货架
* @param inst2 *
* @param nextDeviceCode
* @return
*/ */
Boolean querySameNextDeviceCodeInstByIn(String nextDeviceCode);
/**
* 查询是否有相同终点的指令,但是是出库的指令,即指令起点设备类型是货架
*
* @param nextDeviceCode
* @return
*/
Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode);
} }

View File

@@ -73,6 +73,7 @@ import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
/** /**
* @author jiaolm * @author jiaolm
@@ -85,22 +86,24 @@ import java.util.regex.Pattern;
public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, InstructionMybatis> implements InstructionService, ApplicationAutoInitial { public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, InstructionMybatis> implements InstructionService, ApplicationAutoInitial {
@Autowired @Autowired
InstructionMapper instructionMapper; private InstructionMapper instructionMapper;
@Autowired @Autowired
TaskMapper taskMapper; private TaskMapper taskMapper;
List<Instruction> instructions = new CopyOnWriteArrayList();
@Autowired @Autowired
DeviceAppService deviceAppService; private DeviceAppService deviceAppService;
@Autowired @Autowired
NDCAgvService ndcAgvService; private NDCAgvService ndcAgvService;
@Autowired @Autowired
ISysParamService paramService; private ISysParamService paramService;
@Autowired @Autowired
RouteLineService routeLineService; private RouteLineService routeLineService;
@Autowired @Autowired
TaskService taskService; private TaskService taskService;
@Autowired @Autowired
AcsToLiKuService acsToLiKuService; private AcsToLiKuService acsToLiKuService;
private List<Instruction> instructions = new CopyOnWriteArrayList();
@Override @Override
public PageInfo<InstructionDto> queryAll(InstructionQueryParam query, Pageable pageable) { public PageInfo<InstructionDto> queryAll(InstructionQueryParam query, Pageable pageable) {
@@ -1321,22 +1324,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} }
@Override @Override
public Integer querySameDestinationInst(String devicecode) { public Integer querySameDestinationInst(String deviceCode) {
int num = 0; return (int) Optional
Iterator<Instruction> it = instructions.iterator(); .ofNullable(this.instructions)
while (it.hasNext()) { .orElse(new CopyOnWriteArrayList<>())
Instruction inst = it.next(); .stream()
// 处理空盘位站点 .filter(instruction -> deviceCode.equals(instruction.getNext_point_code().indexOf(".") != -1 ? instruction.getNext_point_code().substring(0, instruction.getNext_point_code().indexOf(".")) : instruction.getNext_point_code()))
String next_code = inst.getNext_point_code(); .count();
if (next_code.indexOf(".") != -1) {
next_code = next_code.substring(0, next_code.indexOf("."));
}
if (StrUtil.equals(devicecode, next_code)) {
num = num + 1;
}
}
return num;
} }
@Override @Override
@@ -1579,7 +1573,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} }
List<InstructionMybatis> instructionMybatis = instructionMapper.selectList(wrapper); List<InstructionMybatis> instructionMybatis = instructionMapper.selectList(wrapper);
List<JSONObject> array = new ArrayList<>(); List<JSONObject> array = new ArrayList<>();
if(instructionMybatis.size() > 0){ if (instructionMybatis.size() > 0) {
for (InstructionMybatis inst : instructionMybatis) { for (InstructionMybatis inst : instructionMybatis) {
JSONObject ins = new JSONObject(); JSONObject ins = new JSONObject();
ins.put("instruction_code", inst.getInstruction_code()); ins.put("instruction_code", inst.getInstruction_code());
@@ -1624,5 +1618,29 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
FileUtil.downloadExcel(list, response); FileUtil.downloadExcel(list, response);
} }
@Override
public Boolean querySameNextDeviceCodeInstByIn(String nextDeviceCode) {
return Optional
.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(instruction -> instruction.getNext_device_code().equals(nextDeviceCode)
&& !deviceAppService.findDeviceByCode(instruction.getStart_device_code()).getDevice_type().equals(DeviceType.storage.toString()))
.collect(Collectors.toList())
.isEmpty();
}
@Override
public Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode) {
return Optional
.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(instruction -> instruction.getNext_device_code().equals(nextDeviceCode)
&& deviceAppService.findDeviceByCode(instruction.getStart_device_code()).getDevice_type().equals(DeviceType.storage.toString()))
.collect(Collectors.toList())
.isEmpty();
}
} }

View File

@@ -58,6 +58,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 新增数据 * 新增数据
*
* @param resources * @param resources
* @return * @return
*/ */
@@ -65,6 +66,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 根据id修改数据 * 根据id修改数据
*
* @param resources * @param resources
* @return * @return
*/ */
@@ -72,6 +74,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 根据id删除数据 * 根据id删除数据
*
* @param id * @param id
* @return * @return
*/ */
@@ -79,6 +82,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 批量删除数据 * 批量删除数据
*
* @param ids * @param ids
* @return * @return
*/ */
@@ -183,6 +187,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 根据设备号查询未执行的任务 * 根据设备号查询未执行的任务
*
* @param device_code * @param device_code
* @return * @return
*/ */
@@ -190,6 +195,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 根据设备号查询未执行的任务 * 根据设备号查询未执行的任务
*
* @param start_device_code * @param start_device_code
* @return List<TaskDto> * @return List<TaskDto>
*/ */
@@ -197,6 +203,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 根据设备号查询未执行的任务 * 根据设备号查询未执行的任务
*
* @param back_start_device_code * @param back_start_device_code
* @return List<TaskDto></TaskDto> * @return List<TaskDto></TaskDto>
*/ */
@@ -229,6 +236,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 根据关联编号查询非立刻下发的关联任务 * 根据关联编号查询非立刻下发的关联任务
*
* @param link_num * @param link_num
* @return TaskDto * @return TaskDto
*/ */
@@ -236,6 +244,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 创建 * 创建
*
* @param dto * @param dto
* @throws Exception * @throws Exception
*/ */
@@ -243,6 +252,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 常规任务保存 * 常规任务保存
*
* @param json * @param json
* @throws Exception * @throws Exception
*/ */
@@ -250,6 +260,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 特殊任务保存 * 特殊任务保存
*
* @param json * @param json
* @throws Exception * @throws Exception
*/ */
@@ -264,6 +275,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 多选删除 * 多选删除
*
* @param ids * @param ids
* @throws Exception * @throws Exception
*/ */
@@ -278,6 +290,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 取消任务 * 取消任务
*
* @param ids * @param ids
* @throws Exception * @throws Exception
*/ */
@@ -286,6 +299,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 取消任务 * 取消任务
*
* @param ids * @param ids
* @throws Exception * @throws Exception
*/ */
@@ -293,6 +307,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 手动创建指令 * 手动创建指令
*
* @param ids * @param ids
* @return * @return
* @throws Exception * @throws Exception
@@ -301,6 +316,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 手动创建指令 * 手动创建指令
*
* @param inst * @param inst
* @return * @return
* @throws Exception * @throws Exception
@@ -308,8 +324,10 @@ public interface TaskService extends CommonService<Task> {
Instruction createInst(Instruction inst) throws Exception; Instruction createInst(Instruction inst) throws Exception;
/**' /**
* 创建指令 * '
* 创建指令
*
* @param dto * @param dto
* @return * @return
*/ */
@@ -335,6 +353,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 检查是否允许创建任务 * 检查是否允许创建任务
*
* @param code * @param code
* @return * @return
*/ */
@@ -342,6 +361,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 从缓存中删除任务 * 从缓存中删除任务
*
* @param code * @param code
* @return * @return
*/ */
@@ -349,6 +369,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 根据容器编号查询任务 * 根据容器编号查询任务
*
* @param container_code * @param container_code
* @return * @return
*/ */
@@ -356,6 +377,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 根据任务编号查询任务 * 根据任务编号查询任务
*
* @param task_code * @param task_code
* @return * @return
*/ */
@@ -472,6 +494,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 查询相同起终任务的数量 * 查询相同起终任务的数量
*
* @param start_device * @param start_device
* @param next_device * @param next_device
* @param status * @param status
@@ -480,9 +503,9 @@ public interface TaskService extends CommonService<Task> {
Integer querySameDeviceReadyTask(String start_device, String next_device, String status); Integer querySameDeviceReadyTask(String start_device, String next_device, String status);
/** /**
* 条件查询任务和指令 * 条件查询任务和指令
*
* @param whereJson * @param whereJson
* @return * @return
*/ */
@@ -490,6 +513,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 导出任务树形记录 * 导出任务树形记录
*
* @param list * @param list
* @param response * @param response
* @throws IOException * @throws IOException
@@ -498,6 +522,7 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 导出任务记录 * 导出任务记录
*
* @param all * @param all
* @param response * @param response
* @throws IOException * @throws IOException
@@ -506,10 +531,23 @@ public interface TaskService extends CommonService<Task> {
/** /**
* 查询任务 * 查询任务
*
* @param whereJson * @param whereJson
* @return * @return
*/ */
List<JSONObject> getTaskList(Map whereJson); List<JSONObject> getTaskList(Map whereJson);
List<TaskDto> findByStartCodeAndBusy(String deviceCode); List<TaskDto> findByStartCodeAndBusy(String deviceCode);
/**
* 任务平均分配原则 根据任务起点和终点去找对应的指令终点
* 除了包含之前的分配原则外
* 新增了立库堆叠机双向点位出入库点位分配的逻辑
* 即任务信息A->C,则拆分成指令信息为A->B,B->C
*
* @param device_code A
* @param task_nextDeice_code C
* @return 指令终点 B
*/
String queryAssignedByDeviceCode(String device_code, String task_nextDeice_code);
} }

View File

@@ -1554,7 +1554,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
@Override @Override
public String queryAssignedByDevice(String device_code, String task_nextdeice_code) { public String queryAssignedByDevice(String device_code, String task_nextdeice_code) {
List<DeviceAssignedDto> list = List<DeviceAssignedDto> list =
deviceAssignedService.queryAssignedBydevice(device_code, task_nextdeice_code); deviceAssignedService.queryAssignedByDevice(device_code, task_nextdeice_code);
int flag1 = 0; int flag1 = 0;
String flag2 = null; String flag2 = null;
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
@@ -1816,4 +1816,60 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return num; return num;
} }
@Override
public String queryAssignedByDeviceCode(String device_code, String task_nextDeice_code) {
List<DeviceAssignedDto> list =
deviceAssignedService.queryAssignedByDevice(device_code, task_nextDeice_code);
for (int i = 0; i < list.size(); i++) {
DeviceAssignedDto dto = list.get(i);
String deviceCode = dto.getDevice_code();
String inst_nextDevice_code = dto.getInst_nextDevice_code();
JSONObject param = JSON.parseObject(dto.getParam());
List<String> pathList = this.getPathList(inst_nextDevice_code);
for (int j = 0; j < pathList.size(); j++) {
String inst_next_device_code = pathList.get(i);
String limit = param.getString("limit");
Boolean inOut = param.getBoolean("inOut");
if (inOut) {
Device device = deviceAppService.findDeviceByCode(deviceCode);
if (device != null) {
if (StrUtil.equals(device.getDevice_type(), DeviceType.storage.toString())) {
if (instructionService.querySameNextDeviceCodeInstByIn(inst_next_device_code)) {
return inst_next_device_code;
}
} else {
if (instructionService.querySameNextDeviceCodeInstByOut(inst_next_device_code)) {
return inst_next_device_code;
}
}
}
} else {
Integer sameInstNum = instructionService.querySameDestinationInst(inst_next_device_code);
if (sameInstNum >= Integer.parseInt(limit)) {
continue;
} else {
return inst_next_device_code;
}
}
}
}
return null;
}
/**
* 把多个字符串拼接的inst_nextDevice_code解析成集合
*
* @param inst_nextDevice_code
* @return
*/
private List<String> getPathList(String inst_nextDevice_code) {
String regEx = "[`~!@#$%^&*()+=|{}':;'\\[\\].<>/?~@#¥%……&*()——+|{}【】':”“’。、?]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(inst_nextDevice_code);
String toSpeechText = m.replaceAll("").trim();
String[] str = toSpeechText.split(",");
List<String> pathList = Arrays.asList(str);
return pathList;
}
} }

View File

@@ -131,7 +131,7 @@ public class CreateDDJInst {
/** /**
* 开始平均分配 * 开始平均分配
*/ */
String this_coevice_code = taskserver.queryAssignedByDevice(start_device_code, next_device_code); String this_coevice_code = taskserver.queryAssignedByDeviceCode(start_device_code, next_device_code);
if (StrUtil.isEmpty(this_coevice_code)) { if (StrUtil.isEmpty(this_coevice_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
RouteLineDto routeLineDto1 = shortPathsList.get(0); RouteLineDto routeLineDto1 = shortPathsList.get(0);

View File

@@ -116,10 +116,10 @@
<!-- <el-table-column type="selection" width="55" />--> <!-- <el-table-column type="selection" width="55" />-->
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="assigned_id" label="任务标识" /> <el-table-column v-if="false" prop="assigned_id" label="任务标识" />
<el-table-column prop="device_code" :label="$t('config.table.device_code')" /> <el-table-column prop="device_code" :label="$t('config.table.device_code')" show-overflow-tooltip />
<el-table-column prop="task_nextDevice_code" :label="$t('config.table.destination_device')" /> <el-table-column prop="task_nextDevice_code" :label="$t('config.table.destination_device')" show-overflow-tooltip />
<el-table-column prop="inst_nextDevice_code" :label="$t('config.table.inst_nextdevice_code')" /> <el-table-column prop="inst_nextDevice_code" :label="$t('config.table.inst_nextdevice_code')" show-overflow-tooltip />
<el-table-column prop="param" :label="$t('config.table.destination_configuration')" :formatter="paramFormate" /> <el-table-column prop="param" :label="$t('config.table.destination_configuration')" :formatter="paramFormate" min-width show-overflow-tooltip />
<el-table-column <el-table-column
v-permission="['admin','AcsDeviceAssigned:edit','AcsDeviceAssigned:del']" v-permission="['admin','AcsDeviceAssigned:edit','AcsDeviceAssigned:del']"
:label="$t('config.table.operation')" :label="$t('config.table.operation')"
@@ -227,7 +227,7 @@ export default {
return true return true
}, },
paramFormate(row, index) { paramFormate(row, index) {
return JSON.stringify(row.param) return JSON.parse(JSON.stringify(row.param))
}, },
getStatus() { getStatus() {
if (this.crud.status.edit === 0) { if (this.crud.status.edit === 0) {