rev:堆叠机双向点位平均分配原则
This commit is contained in:
@@ -154,8 +154,8 @@ public interface DeviceAssignedService extends CommonService<DeviceAssigned> {
|
||||
/**
|
||||
* queryAssignedBydevice
|
||||
* @param device_code
|
||||
* @param task_nextdeice_code
|
||||
* @param task_nextDeice_code
|
||||
* @return
|
||||
*/
|
||||
List<DeviceAssignedDto> queryAssignedBydevice(String device_code, String task_nextdeice_code);
|
||||
List<DeviceAssignedDto> queryAssignedByDevice(String device_code, String task_nextDeice_code);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package org.nl.acs.device.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
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.QueryHelpMybatisPlus;
|
||||
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.common.utils.FileUtil;
|
||||
import org.nl.acs.utils.PageUtil;
|
||||
@@ -98,8 +93,6 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
IPage<DeviceAssigned> queryPage = PageUtil.toMybatisPage(page);
|
||||
@@ -137,7 +130,7 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("limit", limit);
|
||||
data.put("scale", scale);
|
||||
data.put("inOut",inOut);
|
||||
data.put("inOut", inOut);
|
||||
jo.put(device, data);
|
||||
}
|
||||
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 inst_nextdevice = String.join(",", (List<String>) whereJson.get("inst_nextDevice_code"));
|
||||
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("task_nextDevice_code", task_nextdevice.toString());
|
||||
param.put("inst_nextDevice_code", inst_nextdevice.toString());
|
||||
@@ -221,12 +214,29 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceAssignedDto> queryAssignedBydevice(String device_code, String task_nextdeice_code) {
|
||||
|
||||
List<DeviceAssigned> list = new LambdaQueryChainWrapper<>(deviceAssignedMapper)
|
||||
public List<DeviceAssignedDto> queryAssignedByDevice(String device_code, String task_nextDeice_code) {
|
||||
List<DeviceAssigned> oldList = new LambdaQueryChainWrapper<>(deviceAssignedMapper)
|
||||
.eq(DeviceAssigned::getDevice_code, device_code)
|
||||
.eq(DeviceAssigned::getTask_nextDevice_code, task_nextdeice_code)
|
||||
.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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@@ -57,6 +58,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 根据ID更新
|
||||
*
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@@ -97,6 +99,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
@@ -166,6 +169,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 根据任务id查询
|
||||
*
|
||||
* @param id
|
||||
* @param wherecase
|
||||
* @return
|
||||
@@ -174,6 +178,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -181,6 +186,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 创建2
|
||||
*
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -203,6 +209,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -219,6 +226,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 完成指令
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -226,6 +234,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 完成指令
|
||||
*
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -234,6 +243,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 完成并创建下一条指令
|
||||
*
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -242,6 +252,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 取消指令
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -249,6 +260,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 取消指令
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -256,6 +268,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 取消指令不下发agv
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -271,6 +284,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@@ -318,6 +332,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 格式化
|
||||
*
|
||||
* @param inst
|
||||
* @return
|
||||
*/
|
||||
@@ -364,6 +379,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 根据编码删除
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@@ -371,6 +387,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 创建关联指令
|
||||
*
|
||||
* @param type
|
||||
* @param inst
|
||||
* @return
|
||||
@@ -379,12 +396,14 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 初始化指令
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void init(String id);
|
||||
|
||||
/**
|
||||
* 根据指令某个参数查找指令集合
|
||||
*
|
||||
* @param instruction1
|
||||
* @param flay
|
||||
* @return
|
||||
@@ -394,6 +413,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 根据条件查询指令
|
||||
*
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
@@ -401,14 +421,27 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 导出指令记录
|
||||
*
|
||||
* @param instList
|
||||
* @param 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);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author jiaolm
|
||||
@@ -85,22 +86,24 @@ import java.util.regex.Pattern;
|
||||
public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, InstructionMybatis> implements InstructionService, ApplicationAutoInitial {
|
||||
|
||||
@Autowired
|
||||
InstructionMapper instructionMapper;
|
||||
private InstructionMapper instructionMapper;
|
||||
@Autowired
|
||||
TaskMapper taskMapper;
|
||||
List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
private TaskMapper taskMapper;
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
private DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
NDCAgvService ndcAgvService;
|
||||
private NDCAgvService ndcAgvService;
|
||||
@Autowired
|
||||
ISysParamService paramService;
|
||||
private ISysParamService paramService;
|
||||
@Autowired
|
||||
RouteLineService routeLineService;
|
||||
private RouteLineService routeLineService;
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
AcsToLiKuService acsToLiKuService;
|
||||
private AcsToLiKuService acsToLiKuService;
|
||||
|
||||
private List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<InstructionDto> queryAll(InstructionQueryParam query, Pageable pageable) {
|
||||
@@ -1321,22 +1324,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer querySameDestinationInst(String devicecode) {
|
||||
int num = 0;
|
||||
Iterator<Instruction> it = instructions.iterator();
|
||||
while (it.hasNext()) {
|
||||
Instruction inst = it.next();
|
||||
// 处理空盘位站点
|
||||
String next_code = inst.getNext_point_code();
|
||||
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;
|
||||
public Integer querySameDestinationInst(String deviceCode) {
|
||||
return (int) Optional
|
||||
.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.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()))
|
||||
.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1579,7 +1573,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
List<InstructionMybatis> instructionMybatis = instructionMapper.selectList(wrapper);
|
||||
List<JSONObject> array = new ArrayList<>();
|
||||
if(instructionMybatis.size() > 0){
|
||||
if (instructionMybatis.size() > 0) {
|
||||
for (InstructionMybatis inst : instructionMybatis) {
|
||||
JSONObject ins = new JSONObject();
|
||||
ins.put("instruction_code", inst.getInstruction_code());
|
||||
@@ -1624,5 +1618,29 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@@ -65,6 +66,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据id修改数据
|
||||
*
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@@ -72,6 +74,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据id删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@@ -79,6 +82,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 批量删除数据
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@@ -183,6 +187,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据设备号查询未执行的任务
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
@@ -190,6 +195,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据设备号查询未执行的任务
|
||||
*
|
||||
* @param start_device_code
|
||||
* @return List<TaskDto>
|
||||
*/
|
||||
@@ -197,6 +203,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据设备号查询未执行的任务
|
||||
*
|
||||
* @param back_start_device_code
|
||||
* @return List<TaskDto></TaskDto>
|
||||
*/
|
||||
@@ -229,6 +236,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据关联编号查询非立刻下发的关联任务
|
||||
*
|
||||
* @param link_num
|
||||
* @return TaskDto
|
||||
*/
|
||||
@@ -236,6 +244,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -243,6 +252,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 常规任务保存
|
||||
*
|
||||
* @param json
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -250,6 +260,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 特殊任务保存
|
||||
*
|
||||
* @param json
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -264,6 +275,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -278,6 +290,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
*
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -286,6 +299,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
*
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -293,6 +307,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 手动创建指令
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
* @throws Exception
|
||||
@@ -301,6 +316,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 手动创建指令
|
||||
*
|
||||
* @param inst
|
||||
* @return
|
||||
* @throws Exception
|
||||
@@ -308,8 +324,10 @@ public interface TaskService extends CommonService<Task> {
|
||||
Instruction createInst(Instruction inst) throws Exception;
|
||||
|
||||
|
||||
/**'
|
||||
* 创建指令
|
||||
/**
|
||||
* '
|
||||
* 创建指令
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@@ -335,6 +353,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 检查是否允许创建任务
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@@ -342,6 +361,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 从缓存中删除任务
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@@ -349,6 +369,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据容器编号查询任务
|
||||
*
|
||||
* @param container_code
|
||||
* @return
|
||||
*/
|
||||
@@ -356,6 +377,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据任务编号查询任务
|
||||
*
|
||||
* @param task_code
|
||||
* @return
|
||||
*/
|
||||
@@ -472,6 +494,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 查询相同起终任务的数量
|
||||
*
|
||||
* @param start_device
|
||||
* @param next_device
|
||||
* @param status
|
||||
@@ -480,9 +503,9 @@ public interface TaskService extends CommonService<Task> {
|
||||
Integer querySameDeviceReadyTask(String start_device, String next_device, String status);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 条件查询任务和指令
|
||||
*
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
@@ -490,6 +513,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 导出任务树形记录
|
||||
*
|
||||
* @param list
|
||||
* @param response
|
||||
* @throws IOException
|
||||
@@ -498,6 +522,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 导出任务记录
|
||||
*
|
||||
* @param all
|
||||
* @param response
|
||||
* @throws IOException
|
||||
@@ -506,10 +531,23 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 查询任务
|
||||
*
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> getTaskList(Map whereJson);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1554,7 +1554,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
@Override
|
||||
public String queryAssignedByDevice(String device_code, String task_nextdeice_code) {
|
||||
List<DeviceAssignedDto> list =
|
||||
deviceAssignedService.queryAssignedBydevice(device_code, task_nextdeice_code);
|
||||
deviceAssignedService.queryAssignedByDevice(device_code, task_nextdeice_code);
|
||||
int flag1 = 0;
|
||||
String flag2 = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@@ -1816,4 +1816,60 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
RouteLineDto routeLineDto1 = shortPathsList.get(0);
|
||||
|
||||
Reference in New Issue
Block a user