Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -2,6 +2,7 @@ package org.nl.acs.custompolicy.server.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -44,11 +45,24 @@ public class CustomPolicyServiceImpl extends CommonServiceImpl<CustomPolicyMappe
|
||||
List<DeviceStrategy> instructionStrategys;
|
||||
|
||||
private final CustomPolicyMapper customPolicyMapper;
|
||||
private final HashMap<String,List<CustomPolicyPlantDTO>> customPolicyPlantDTOMap;
|
||||
|
||||
/**
|
||||
* 初始化策略
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void autoInitial() throws Exception {
|
||||
|
||||
|
||||
LambdaQueryWrapper<CustomPolicy> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CustomPolicy::getIs_delete,0) ;
|
||||
List<CustomPolicy> customPolicyList = customPolicyMapper.selectList(wrapper);
|
||||
if (CollectionUtil.isNotEmpty(customPolicyList)){
|
||||
List<CustomPolicy> customPolicies = customPolicyList.stream().filter(item -> item.getKey_value() != null).collect(Collectors.toList());
|
||||
customPolicies.forEach(item -> {
|
||||
CustomPolicyPlantVO customPolicyPlantVO = JSON.parseObject(item.getKey_value(), CustomPolicyPlantVO.class);
|
||||
customPolicyPlantDTOMap.put(item.getUnit_code(),customPolicyPlantVO.getPlans());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +114,14 @@ public class CustomPolicyServiceImpl extends CommonServiceImpl<CustomPolicyMappe
|
||||
customPolicy.setId(customPolicyPlantVO.getId());
|
||||
customPolicy.setUpdate_user(currentUsername);
|
||||
customPolicy.setUpdate_time(now);
|
||||
customPolicy.setKey_value(JSON.toJSONString(customPolicyPlantVO));
|
||||
if (CollectionUtil.isNotEmpty(customPolicyPlantVO.getPlans())) {
|
||||
for (int i = 0; i < customPolicyPlantVO.getPlans().size(); i++) {
|
||||
customPolicyPlantVO.getPlans().get(i).setSort(i);
|
||||
}
|
||||
customPolicy.setKey_value(JSON.toJSONString(customPolicyPlantVO));
|
||||
}else {
|
||||
customPolicy.setKey_value(null);
|
||||
}
|
||||
customPolicyMapper.updateById(customPolicy);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,21 @@ public class Device implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String device_type_name;
|
||||
|
||||
/**
|
||||
* 排
|
||||
*/
|
||||
private String x;
|
||||
|
||||
/**
|
||||
* 列
|
||||
*/
|
||||
private String y;
|
||||
|
||||
/**
|
||||
* 层
|
||||
*/
|
||||
private String z;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String region_name;
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
break;
|
||||
case 2:
|
||||
//申请任务
|
||||
if (task == 0 && !requireSucess) {
|
||||
if (move == 1 && !requireSucess) {
|
||||
instruction_require();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.belt_conveyor.BeltConveyorDeviceDriver;
|
||||
@@ -386,9 +387,30 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
} else if (error != 0) {
|
||||
message = "有报警";
|
||||
//指定库位满入
|
||||
if(error == 5){
|
||||
|
||||
}
|
||||
//空出
|
||||
if(error == 6){
|
||||
|
||||
}
|
||||
//浅货位有货
|
||||
if(error == 16){
|
||||
//放货
|
||||
if(cargoMove==1){
|
||||
|
||||
}else if(cargoMove==0){
|
||||
//取货
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
HashMap map = new HashMap();
|
||||
Instruction instruction = checkInst();
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
switch (command) {
|
||||
case 0:
|
||||
if (task == 0) {
|
||||
@@ -400,6 +422,21 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
break;
|
||||
case 2:
|
||||
message = "取货完成";
|
||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||
map.put("to_z", nextDevice.getZ());
|
||||
map.put("to_x", nextDevice.getX());
|
||||
map.put("to_y", nextDevice.getY());
|
||||
}
|
||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())) {
|
||||
map.put("to_z", inst.getTo_z());
|
||||
if (inst.getTo_x().length() > 1) {
|
||||
String substring = inst.getTo_x().substring(1);
|
||||
map.put("to_x", substring);
|
||||
} else {
|
||||
map.put("to_x", inst.getTo_x());
|
||||
}
|
||||
map.put("to_y", inst.getTo_y());
|
||||
}
|
||||
map.put("to_command", 2);
|
||||
break;
|
||||
case 3:
|
||||
@@ -407,14 +444,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
break;
|
||||
case 4:
|
||||
message = "请求卸货(申请卸货)";
|
||||
Instruction instruction = checkInst();
|
||||
if (ObjectUtil.isNotNull(instruction)) {
|
||||
//指令为执行
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device startDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getMode() != 2 || siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + siemensConveyorDeviceDriver.getDevice_code() +
|
||||
"有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
|
||||
@@ -560,14 +594,23 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
map.put("to_command", 1);
|
||||
// map.put("to_type", inst.getMaterial());
|
||||
map.put("to_task", inst.getInstruction_code());
|
||||
map.put("to_z", inst.getTo_z());
|
||||
if(inst.getTo_x().length()>1){
|
||||
String substring = inst.getTo_x().substring(1);
|
||||
map.put("to_x", substring);
|
||||
}else {
|
||||
map.put("to_x", inst.getTo_x());
|
||||
|
||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||
map.put("to_z", startDevice.getZ());
|
||||
map.put("to_x", startDevice.getX());
|
||||
map.put("to_y", startDevice.getY());
|
||||
}
|
||||
map.put("to_y", inst.getTo_y());
|
||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
|
||||
map.put("to_z", inst.getFrom_z());
|
||||
if (inst.getFrom_x().length() > 1) {
|
||||
String substring = inst.getFrom_x().substring(1);
|
||||
map.put("to_x", substring);
|
||||
} else {
|
||||
map.put("to_x", inst.getFrom_x());
|
||||
}
|
||||
map.put("to_y", inst.getFrom_y());
|
||||
}
|
||||
|
||||
this.writing(map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
@@ -914,6 +915,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
for (int m = 0; m < pathlist.size(); m++) {
|
||||
if (pathlist.get(m).equals(dto.getNext_device_code())) {
|
||||
index = m + 1;
|
||||
if(StrUtil.equals(deviceAppService.findDeviceTypeByCode(pathlist.get(index)), DeviceType.stacker.name())) {
|
||||
index += 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
|
||||
|
||||
while (var3.hasNext()) {
|
||||
Device device = (Device) var3.next();
|
||||
if (ObjectUtil.equal(device.getDevice_code(), deviceCode)&&BeanUtil.isNotEmpty(device.getDeviceDriverDefination())) {
|
||||
if (ObjectUtil.equal(device.getDevice_code(), deviceCode)&&ObjectUtil.isNotEmpty(device.getDeviceDriverDefination())) {
|
||||
return device.getDeviceDriverDefination().getFitDeviceTypes().get(0).name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ public class TaskController {
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
// return new ResponseEntity<>(taskService.queryAllByCache(whereJson, page), HttpStatus.OK);
|
||||
if(ObjectUtil.isEmpty(whereJson.get("status"))) {
|
||||
/*if(ObjectUtil.isEmpty(whereJson.get("status"))) {
|
||||
whereJson.put("status", "1");
|
||||
}
|
||||
}*/
|
||||
return new ResponseEntity<>(taskService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user