fix: 扫描补码、仙宫货叉调整

This commit is contained in:
2024-06-17 19:14:29 +08:00
parent 41fea50b24
commit 9b6291f146
8 changed files with 214 additions and 107 deletions

View File

@@ -4,6 +4,7 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.dto.InteractionJsonDTO;
import java.util.Map; import java.util.Map;
@@ -117,8 +118,10 @@ public interface XianGongAgvService {
/** /**
* 下发叉车运单 * 下发叉车运单
*
* @param dto * @param dto
* @param interactionJsonDTO
* @return * @return
*/ */
HttpResponse sendOrderSequencesToForklift(Instruction dto); HttpResponse sendOrderSequencesToForklift(Instruction dto, InteractionJsonDTO interactionJsonDTO);
} }

View File

@@ -14,13 +14,13 @@ import org.nl.acs.agv.AgvUtil;
import org.nl.acs.agv.AgvWaitUtil; import org.nl.acs.agv.AgvWaitUtil;
import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.angle.domain.AcsPointAngle;
import org.nl.acs.angle.service.IAcsPointAngleService; import org.nl.acs.angle.service.IAcsPointAngleService;
import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.InteractionJsonDTO;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device.enums.DeviceType;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
@@ -32,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -756,13 +755,13 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
} }
@Override @Override
public HttpResponse sendOrderSequencesToForklift(Instruction inst) { public HttpResponse sendOrderSequencesToForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) {
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
jo.put("id", inst.getInstruction_code()); jo.put("id", inst.getInstruction_code());
//运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块
jo.put("complete", true); jo.put("complete", true);
//动作块 //动作块
jo.put("blocks", createBlocksForklift(inst)); jo.put("blocks", createBlocksForklift(inst,interactionJsonDTO));
//运单优先级 //运单优先级
jo.put("priority", inst.getPriority()); jo.put("priority", inst.getPriority());
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
@@ -804,13 +803,17 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
* 叉车运单动作块 * 叉车运单动作块
* *
* @param inst * @param inst
* @param interactionJsonDTO
* @return * @return
*/ */
private JSONArray createBlocksForklift(Instruction inst) { private JSONArray createBlocksForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) {
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
//起点 //起点
Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code()); Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code());
String pointCode = inst.getStart_point_code(); String pointCode = inst.getStart_point_code();
//取货前等待 //取货前等待
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
//动作块id //动作块id
@@ -842,6 +845,42 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
jo1.put("binTask", "InForkHeight"); jo1.put("binTask", "InForkHeight");
ja.add(jo1); ja.add(jo1);
JSONObject jo3 = new JSONObject();
//动作块id
jo3.put("blockId", IdUtil.simpleUUID());
//目的地名称
jo3.put("location", pointCode + "INGET");
jo3.put("id", pointCode + "INGET");
//执行脚本
jo3.put("operation", "expand");
//通信脚本,动作前后与现场设备交互的场景
jo3.put("script_name", "Fork-expand.py");
JSONObject script_args2 = new JSONObject();
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) {
script_args2.put("expandWidth",interactionJsonDTO.getExpandWidthLength());
}
script_args2.put("operation", "expand");
jo3.put("script_args", script_args2);
ja.add(jo3);
JSONObject jo4 = new JSONObject();
//动作块id
jo4.put("blockId", IdUtil.simpleUUID());
//目的地名称
jo4.put("location", pointCode + "INGET");
jo4.put("id", pointCode + "INGET");
//执行脚本
jo4.put("operation", "stretch");
//通信脚本,动作前后与现场设备交互的场景
jo4.put("script_name", "Fork-expand.py");
JSONObject script_args1 = new JSONObject();
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) {
script_args2.put("stretchLength",interactionJsonDTO.getExpandWidthLength());
}
script_args1.put("operation", "stretch");
jo4.put("script_args", script_args1);
ja.add(jo4);
JSONObject jo6 = new JSONObject(); JSONObject jo6 = new JSONObject();
jo6.put("blockId", IdUtil.simpleUUID()); jo6.put("blockId", IdUtil.simpleUUID());
jo6.put("location", inst.getStart_point_code()); jo6.put("location", inst.getStart_point_code());
@@ -861,16 +900,16 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
jo2.put("operation", "script"); jo2.put("operation", "script");
jo2.put("id", pointCode + "OUTGET"); jo2.put("id", pointCode + "OUTGET");
jo2.put("script_name", "userpy/interact.py"); jo2.put("script_name", "userpy/interact.py");
JSONObject script_args2 = new JSONObject(); JSONObject script_args4 = new JSONObject();
script_args2.put("addr", addr); script_args4.put("addr", addr);
JSONObject data2 = new JSONObject(); JSONObject data2 = new JSONObject();
JSONObject reach2 = new JSONObject(); JSONObject reach2 = new JSONObject();
reach2.put("task_code", inst.getInstruction_code()); reach2.put("task_code", inst.getInstruction_code());
reach2.put("address", pointCode + "OUTGET"); reach2.put("address", pointCode + "OUTGET");
data2.put("reach", reach2); data2.put("reach", reach2);
script_args2.put("data", data2); script_args4.put("data", data2);
script_args2.put("protocol", "HTTP"); script_args4.put("protocol", "HTTP");
jo2.put("script_args", script_args2); jo2.put("script_args", script_args4);
ja.add(jo2); ja.add(jo2);

View File

@@ -127,8 +127,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
int last_container_type = 0; int last_container_type = 0;
//行架任务号 //行架任务号
int hj_task = 0; int hj_task = 0;
int last_hj_task = 0; int last_hj_task = 0;
@@ -243,16 +241,15 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} }
if (move != last_move && move == 0 && last_move == 1) {
if (move != last_move && move==0 && last_move==1) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }
if(move !=last_move){ if (move != last_move) {
if (ObjectUtil.isNotEmpty(inst)){ if (ObjectUtil.isNotEmpty(inst)) {
if (move==0){ if (move == 0) {
Thread.sleep(10000); Thread.sleep(10000);
led_message = clearMessage(); led_message = clearMessage();
List<String> deviceCodes = this.getExtraDeviceCodes("link_device_code"); List<String> deviceCodes = this.getExtraDeviceCodes("link_device_code");
@@ -263,7 +260,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (ObjectUtil.isEmpty(linkDevice)) { if (ObjectUtil.isEmpty(linkDevice)) {
throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!");
} }
if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver){ if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver) {
device = deviceCode; device = deviceCode;
} }
} }
@@ -297,27 +294,27 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
Instruction instruction = null; Instruction instruction = null;
List toInstructions; List toInstructions;
//木箱入库申请入库任务 //木箱入库申请入库任务
if (mode == 6 && !requireSucess){ if (mode == 6 && !requireSucess) {
if (StrUtil.isEmpty(barcode)){ if (StrUtil.isEmpty(barcode)) {
message = "托盘条码为空"; message = "托盘条码为空";
} }
applyIn(StorageTypeEnum.BOX_IN.getType(),mode); applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
} }
//子卷入库申请入库任务 //子卷入库申请入库任务
if (mode == 7 && move == 1 && !requireSucess){ if (mode == 7 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)){ if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空"; message = "托盘条码为空、或者子卷码为空";
} }
applyIn(StorageTypeEnum.STORAGE.getType(),mode); applyIn(StorageTypeEnum.STORAGE.getType(), mode);
} }
//申请空托盘入库 //申请空托盘入库
if (mode == 9 && move == 1 && !requireSucess){ if (mode == 9 && move == 1 && !requireSucess) {
if (container_type==0){ if (container_type == 0) {
message = "托盘类型为空"; message = "托盘类型为空";
} }
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
@@ -325,16 +322,16 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} }
//申请退货入库 //申请退货入库
if (mode == 18 && move == 1 && !requireSucess){ if (mode == 18 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode)){ if (StrUtil.isEmpty(barcode)) {
message = "托盘条码为空"; message = "托盘条码为空";
} }
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
} }
//申请高度 //申请高度
if (mode == 23 && !requireSucess){ if (mode == 23 && !requireSucess) {
if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)){ if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "条码为空"; message = "条码为空";
} }
applyErrorHeight(); applyErrorHeight();
@@ -342,7 +339,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} }
//申请入库指令、异常位指令 //申请入库指令、异常位指令
if (mode == 2 && move == 1 && !requireSucess) { if (mode == 2 && move == 1 && !requireSucess) {
boolean res = instruction_require(); boolean res = instruction_require();
if (res) { if (res) {
notCreateInstMessage = ""; notCreateInstMessage = "";
@@ -399,8 +396,18 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
try { try {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", device_code); param.put("device_code", device_code);
param.put("vehicle_code", barcode); if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("material_barcode", material_barcode); param.put("vehicle_code", hand_barcode);
}
if (StrUtil.isNotEmpty(barcode)) {
param.put("vehicle_code", barcode);
}
if (StrUtil.isNotEmpty(material_barcode)) {
param.put("material_barcode", material_barcode);
}
if (StrUtil.isNotEmpty(hand_material_barcode)) {
param.put("material_barcode", hand_material_barcode);
}
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请高度等级,参数:" + param) .content("申请高度等级,参数:" + param)
@@ -430,7 +437,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
map2.put("value", 23); map2.put("value", 23);
list2.add(map2); list2.add(map2);
this.writing(list2); this.writing(list2);
}else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请高度等级,返回参数:" + jo.getString("body")) .content("申请高度等级,返回参数:" + jo.getString("body"))
@@ -454,8 +461,18 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
try { try {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", device_code); param.put("device_code", device_code);
param.put("vehicle_code", barcode); if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("material_barcode", material_barcode); param.put("vehicle_code", hand_barcode);
}
if (StrUtil.isNotEmpty(barcode)) {
param.put("vehicle_code", barcode);
}
if (StrUtil.isNotEmpty(material_barcode)) {
param.put("material_barcode", material_barcode);
}
if (StrUtil.isNotEmpty(hand_material_barcode)) {
param.put("material_barcode", hand_material_barcode);
}
param.put("type", type); param.put("type", type);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
@@ -480,7 +497,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
list1.add(map); list1.add(map);
this.writing(list1); this.writing(list1);
this.requireSucess = true; this.requireSucess = true;
}else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请退货入库,返回参数:" + jo.getString("body")) .content("申请退货入库,返回参数:" + jo.getString("body"))
@@ -497,21 +514,21 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
public void clearWrite() { public void clearWrite() {
List list = new ArrayList<>(); List list = new ArrayList<>();
Map map = new HashMap<>(); Map map = new HashMap<>();
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","0"); map.put("value", "0");
list.add(map); list.add(map);
Map map2 = new HashMap<>(); Map map2 = new HashMap<>();
map2.put("code","to_task"); map2.put("code", "to_task");
map2.put("value","0"); map2.put("value", "0");
list.add(map2); list.add(map2);
Map map4 = new HashMap<>(); Map map4 = new HashMap<>();
map4.put("code","to_container_type"); map4.put("code", "to_container_type");
map4.put("value","0"); map4.put("value", "0");
list.add(map4); list.add(map4);
this.writing(list); this.writing(list);
message=null; message = null;
vehicle_code=null; vehicle_code = null;
} }
@@ -558,7 +575,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", device_code); param.put("device_code", device_code);
param.put("container_type", container_type); param.put("container_type", container_type);
param.put("vehicle_code", barcode); if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", hand_barcode);
}
if (StrUtil.isNotEmpty(barcode)) {
param.put("vehicle_code", barcode);
}
param.put("type", type); param.put("type", type);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
@@ -583,7 +605,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
list1.add(map); list1.add(map);
this.writing(list1); this.writing(list1);
this.requireSucess = true; this.requireSucess = true;
}else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请空托盘出入库,返回参数:" + jo.getString("body")) .content("申请空托盘出入库,返回参数:" + jo.getString("body"))
@@ -605,43 +627,52 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
return; return;
} else { } else {
try { try {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", device_code); param.put("device_code", device_code);
if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", hand_barcode);
}
if (StrUtil.isNotEmpty(barcode)) {
param.put("vehicle_code", barcode); param.put("vehicle_code", barcode);
}
if (StrUtil.isNotEmpty(material_barcode)) {
param.put("material_barcode", material_barcode); param.put("material_barcode", material_barcode);
param.put("type", type); }
LuceneLogDto logDto = LuceneLogDto.builder() if (StrUtil.isNotEmpty(hand_material_barcode)) {
.device_code(device_code) param.put("material_barcode", hand_material_barcode);
.content("木箱、子卷入库申请入库任务,参数:" + param) }
.build(); param.put("type", type);
logDto.setLog_level(4); LuceneLogDto logDto = LuceneLogDto.builder()
luceneExecuteLogService.deviceExecuteLog(logDto); .device_code(device_code)
String response = acsToWmsService.applyTwo(param); .content("木箱、子卷入库申请入库任务,参数:" + param)
JSONObject jo = JSON.parseObject(response); .build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
String response = acsToWmsService.applyTwo(param);
JSONObject jo = JSON.parseObject(response);
message = "木箱、子卷入库申请入库任务,返回参数:" + jo; message = "木箱、子卷入库申请入库任务,返回参数:" + jo;
if (jo.getInteger("status") == 200) { if (jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("木箱、子卷入库申请入库任务,参数,接口返回:" + jo) .content("木箱、子卷入库申请入库任务,参数,接口返回:" + jo)
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
List list1 = new ArrayList(); List list1 = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", mode); map.put("value", mode);
list1.add(map); list1.add(map);
this.writing(list1); this.writing(list1);
}else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("木箱、子卷入库申请入库任务,返回参数:" + jo.getString("body")) .content("木箱、子卷入库申请入库任务,返回参数:" + jo.getString("body"))
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
}
} }
catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -703,7 +734,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (!ObjectUtil.isEmpty(taskdto)) { if (!ObjectUtil.isEmpty(taskdto)) {
if (creatInstruction(taskdto)) return false; if (creatInstruction(taskdto)) return false;
} }
}else { } else {
if (StrUtil.isNotBlank(barcode)) { if (StrUtil.isNotBlank(barcode)) {
//根据载具号查找任务 //根据载具号查找任务
TaskDto taskdto = taskserver.findByVehicleCodeCodeAndReady(barcode); TaskDto taskdto = taskserver.findByVehicleCodeCodeAndReady(barcode);
@@ -726,13 +757,13 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
String containerType = ""; String containerType = "";
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) { if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
containerType = interactionJsonDTO.getContainerType(); containerType = interactionJsonDTO.getContainerType();
} }
if (TaskTypeEnum.AGV_Task.getIndex().equals(taskdto.getTask_type())){ if (TaskTypeEnum.AGV_Task.getIndex().equals(taskdto.getTask_type())) {
String route_plan_code = taskdto.getRoute_plan_code(); String route_plan_code = taskdto.getRoute_plan_code();
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(taskdto.getStart_device_code(), taskdto.getNext_device_code(), route_plan_code); List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(taskdto.getStart_device_code(), taskdto.getNext_device_code(), route_plan_code);
if (CollectionUtil.isEmpty(shortPathsList)){ if (CollectionUtil.isEmpty(shortPathsList)) {
return true; return true;
} }
RouteLineDto routeLineDto = shortPathsList.get(0); RouteLineDto routeLineDto = shortPathsList.get(0);
@@ -741,20 +772,20 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
List<String> pathlist = Arrays.asList(str); List<String> pathlist = Arrays.asList(str);
Integer start = 0; Integer start = 0;
String start_device_code = pathlist.get(start); String start_device_code = pathlist.get(start);
String next_device_code = pathlist.get(start+1); String next_device_code = pathlist.get(start + 1);
//判断有无出入库任务是相同路线 //判断有无出入库任务是相同路线
TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code()); TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code());
if (ObjectUtil.isNotEmpty(dto)){ if (ObjectUtil.isNotEmpty(dto)) {
requireSucess = false; requireSucess = false;
return true; return true;
} }
packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority,start_device_code,next_device_code,containerType); packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, start_device_code, next_device_code, containerType);
}else { } else {
packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, taskdto.getStart_device_code(), taskdto.getNext_device_code(),containerType); packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, taskdto.getStart_device_code(), taskdto.getNext_device_code(), containerType);
} }
try { try {
instructionService.create(instdto); instructionService.create(instdto);
@@ -799,7 +830,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (ObjectUtil.isEmpty(linkDevice)) { if (ObjectUtil.isEmpty(linkDevice)) {
throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!");
} }
if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver){ if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver) {
device = deviceCode; device = deviceCode;
} }
} }
@@ -809,7 +840,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, instdto.getInstruction_code())) { , instdto.getInstruction_code())) {
this.writing(list); this.writing(list);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号") .content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.build(); .build();
@@ -864,7 +895,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
return json; return json;
} }
private void packageInstrcutData(Instruction instdto, TaskDto taskdto, String taskid, String taskcode, String vehiclecode, String priority,String startCode, String endCode,String containerType) { private void packageInstrcutData(Instruction instdto, TaskDto taskdto, String taskid, String taskcode, String vehiclecode, String priority, String startCode, String endCode, String containerType) {
instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(taskdto.getRoute_plan_code()); instdto.setRoute_plan_code(taskdto.getRoute_plan_code());
instdto.setRemark(taskdto.getRemark()); instdto.setRemark(taskdto.getRemark());
@@ -919,6 +950,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} }
} }
public synchronized boolean finish_instruction() throws Exception { public synchronized boolean finish_instruction() throws Exception {
instructionService.finish(inst); instructionService.finish(inst);
return true; return true;
@@ -939,7 +971,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
mode = LangProcess.msg("universal_standby"); mode = LangProcess.msg("universal_standby");
} else if (this.getMode() == 3) { } else if (this.getMode() == 3) {
mode = LangProcess.msg("universal_operation"); mode = LangProcess.msg("universal_operation");
}else if (this.getMode() == 6) { } else if (this.getMode() == 6) {
mode = LangProcess.msg("one_mode1"); mode = LangProcess.msg("one_mode1");
} }
@@ -974,7 +1006,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
jo.put("isError", this.getIserror()); jo.put("isError", this.getIserror());
jo.put("message", message); jo.put("message", message);
jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage));
jo.put("driver_type", "conveyor_with_scanner_weight"); jo.put("driver_type", "conveyor_with_scanner_weight");
jo.put("is_click", true); jo.put("is_click", true);

View File

@@ -368,8 +368,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
message = "one_message7"; message = "one_message7";
} else { } else {
if (error != 0) { if (error != 0) {
//满入空出或者浅货位阻挡 Date date = new Date();
erroBlock(); if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
} else {
//满入空出或者浅货位阻挡
erroBlock();
}
} }
List list = new ArrayList(); List list = new ArrayList();
switch (command) { switch (command) {
@@ -477,7 +482,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
finish_instruction(inst); finish_instruction(inst);
errorInst = null; errorInst = null;
}else { } else {
finish_instruction(inst); finish_instruction(inst);
} }
} catch (Exception e) { } catch (Exception e) {
@@ -521,6 +526,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
} }
last_heartbeat = heartbeat; last_heartbeat = heartbeat;
last_item_deviceCode = item_deviceCode; last_item_deviceCode = item_deviceCode;
last_mode = mode; last_mode = mode;
@@ -976,7 +982,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
private void pakagePlc(Instruction inst, List list) { private void pakagePlc(Instruction inst, List list) {
HashMap map4 = new HashMap(); HashMap map4 = new HashMap();
map4.put("code", "to_y"); map4.put("code", "to_y");
map4.put("value", inst.getFrom_z()); map4.put("value", inst.getFrom_z());

View File

@@ -0,0 +1,13 @@
package org.nl.acs.instruction.service.dto;
import lombok.Data;
@Data
public class InteractionJsonDTO {
/**
* agv叉车调整长宽
*/
private Double expandWidthLength;
}

View File

@@ -42,6 +42,7 @@ import org.nl.acs.instruction.domain.InstructionMybatis;
import org.nl.acs.instruction.enums.InstructionStatusEnum; import org.nl.acs.instruction.enums.InstructionStatusEnum;
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.dto.InteractionJsonDTO;
import org.nl.acs.limit_regional.server.LimitRegionalService; import org.nl.acs.limit_regional.server.LimitRegionalService;
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto; import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
@@ -514,8 +515,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
// //
// } else // } else
if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) {
String interactionJson = task.getInteraction_json();
if (StrUtil.isNotEmpty(interactionJson)){
throw new BadRequestException("agv叉车调整长宽参数为空");
}
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
//仙工叉车 //仙工叉车
HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto); HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto,interactionJsonDTO);
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
dto.setSend_status("2"); dto.setSend_status("2");
} else { } else {

View File

@@ -28,6 +28,8 @@ import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.dto.DeviceAssignedDto; import org.nl.acs.device.service.dto.DeviceAssignedDto;
import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.DeviceDriverDefination; import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.domain.InstructionMybatis; import org.nl.acs.instruction.domain.InstructionMybatis;
@@ -906,6 +908,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
List<RouteLineDto> shortPathsList = List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines( routeLineService.getShortPathLines(
start_device_code, acsTask.getNext_device_code(), route_plan_code); start_device_code, acsTask.getNext_device_code(), route_plan_code);
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
RouteLineDto routeLineDto = shortPathsList.get(0); RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath(); String path = routeLineDto.getPath();
String type = routeLineDto.getType(); String type = routeLineDto.getType();
@@ -914,7 +917,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
int index = 0; int index = 0;
for (int m = 0; m < pathlist.size(); m++) { for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) { if (pathlist.get(m).equals(start_device_code)) {
index = m + 1; //起点为货架跳过堆垛机
if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
index = m + 2;
}else {
index = m + 1;
}
break; break;
} }
} }

View File

@@ -59,7 +59,7 @@ public class CreateDDJInst {
//判断有无出入库任务是相同路线 //判断有无出入库任务是相同路线
TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code); TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code);
if (ObjectUtil.isNotEmpty(dto)) { if (ObjectUtil.isNotEmpty(dto)) {
return; continue;
} }
if (startDevice.getDevice_type().equals(DeviceType.storage.name()) && if (startDevice.getDevice_type().equals(DeviceType.storage.name()) &&
(nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) { (nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) {
@@ -115,7 +115,7 @@ public class CreateDDJInst {
deviceByCode = appService.findDeviceByCode(pathlist.get(1)); deviceByCode = appService.findDeviceByCode(pathlist.get(1));
if (ObjectUtils.isEmpty(deviceByCode)) { if (ObjectUtils.isEmpty(deviceByCode)) {
log.error("没有找到DDJ设备"); log.error("没有找到DDJ设备");
return; continue;
} }
StandardStackerDeviceDriver standardStackerDeviceDriver; StandardStackerDeviceDriver standardStackerDeviceDriver;
if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
@@ -123,7 +123,7 @@ public class CreateDDJInst {
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0) { if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0) {
log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code()); log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code());
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中");
return; continue;
} }
} }
next_device_code = start_device_code; next_device_code = start_device_code;
@@ -142,7 +142,7 @@ public class CreateDDJInst {
if (ObjectUtils.isEmpty(deviceByCode)) { if (ObjectUtils.isEmpty(deviceByCode)) {
log.error("没有找到DDJ设备"); log.error("没有找到DDJ设备");
return; continue;
} }
StandardStackerDeviceDriver standardStackerDeviceDriver; StandardStackerDeviceDriver standardStackerDeviceDriver;
if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
@@ -150,7 +150,7 @@ public class CreateDDJInst {
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0 || standardStackerDeviceDriver.getError() != 0) { if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0 || standardStackerDeviceDriver.getError() != 0) {
log.error("堆垛机,{}未联机或者在执行中或者有异常", deviceByCode.getDevice_code()); log.error("堆垛机,{}未联机或者在执行中或者有异常", deviceByCode.getDevice_code());
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中");
return; continue;
} }
} }
@@ -205,7 +205,7 @@ public class CreateDDJInst {
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) { if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) {
log.error("输送机,{}未联机或执行中", next_device_code); log.error("输送机,{}未联机或执行中", next_device_code);
((BeltConveyorDeviceDriver) nextDevice.getDeviceDriver()).setNotCreateInstMessage("one_message7"); ((BeltConveyorDeviceDriver) nextDevice.getDeviceDriver()).setNotCreateInstMessage("one_message7");
return; continue;
} }
} }
@@ -219,7 +219,7 @@ public class CreateDDJInst {
List<Instruction> byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code); List<Instruction> byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code);
if (CollUtil.isNotEmpty(byCodeAndExcute)){ if (CollUtil.isNotEmpty(byCodeAndExcute)){
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位出入库的指令"); ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位出入库的指令");
return; continue;
} }
instdto.setInstruction_type(task_type); instdto.setInstruction_type(task_type);
instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setInstruction_id(IdUtil.simpleUUID());