|
|
@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.Getter; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@ -38,9 +39,13 @@ import org.nl.config.lucene.service.dto.LuceneLogDto; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.locks.Lock; |
|
|
|
import java.util.concurrent.locks.ReentrantLock; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 1、适用于单/双堆垛机;2、默认优先执行移库任务;3、其次按照堆垛机设置的策略(入库优先(含拣选出库)策略、出库优先策略、时间顺序策略)执行;4、除移库任务是从任务列表中查找,其余任务都是从指令列表中查找就绪状态下的信息 |
|
|
|
* @Description 1、适用于单/双堆垛机; |
|
|
|
* 2、默认优先执行移库任务; |
|
|
|
* 3、其次按照堆垛机设置的策略(入库优先(含拣选出库)策略、出库优先策略、时间顺序策略、一进一出策略)执行; |
|
|
|
* 4、除移库任务是从任务列表中查找,其余任务都是从指令列表中查找就绪状态下的信息 |
|
|
|
* @Author Gengby |
|
|
|
* @Date 2024/6/26 |
|
|
|
*/ |
|
|
@ -249,6 +254,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
*/ |
|
|
|
private int to_back_task = 0; |
|
|
|
private int lastTo_back_task = 0; |
|
|
|
|
|
|
|
/** |
|
|
|
* 当前设备编号 |
|
|
|
*/ |
|
|
@ -320,6 +326,42 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
*/ |
|
|
|
private static final List<String> No_SET_LOG_KEYS = Arrays.asList(ItemProtocol.HEARTBEAT.getKey()); |
|
|
|
|
|
|
|
/** |
|
|
|
* 默认一楼优先、其次二楼、最后三楼 |
|
|
|
*/ |
|
|
|
private String[] floorPriorities = {"1", "2", "3"}; |
|
|
|
|
|
|
|
/** |
|
|
|
* 堆垛机在出入库对接点时前叉行走的排列层 |
|
|
|
*/ |
|
|
|
private List<String> originPoint; |
|
|
|
|
|
|
|
/** |
|
|
|
* 楼层映射出入库对接点 |
|
|
|
*/ |
|
|
|
private Map<String, Map<String, List<String>>> floorMappingPoint; |
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Map<String, List<String>>> createFloorMappingPoint() { |
|
|
|
List<JSONObject> floorPoint = this.getExtraListValue("floorPoint"); |
|
|
|
Map<String, Map<String, List<String>>> floorMappingPoint = new HashMap<>(); |
|
|
|
for (JSONObject jsonObject : floorPoint) { |
|
|
|
if (jsonObject == null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
Map<String, List<String>> map = new HashMap<>(); |
|
|
|
String floor = jsonObject.getString("floor"); |
|
|
|
JSONArray inPoints = jsonObject.getJSONArray("inPoints"); |
|
|
|
List<String> inPointsList = inPoints != null ? inPoints.toJavaList(String.class) : new ArrayList<>(); |
|
|
|
map.put("in", inPointsList); |
|
|
|
JSONArray outPoints = jsonObject.getJSONArray("outPoints"); |
|
|
|
List<String> outPointsList = outPoints != null ? outPoints.toJavaList(String.class) : new ArrayList<>(); |
|
|
|
map.put("out", outPointsList); |
|
|
|
floorMappingPoint.put(floor, map); |
|
|
|
} |
|
|
|
return floorMappingPoint; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Device getDevice() { |
|
|
|
return this.device; |
|
|
@ -431,17 +473,18 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
@Override |
|
|
|
public void executeLogic() { |
|
|
|
this.stackerNum = Optional.ofNullable(this.getExtraValue().get("stackerNum")).map(Object::toString).map(Integer::parseInt).orElse(1); |
|
|
|
this.floorPriorities = Optional.ofNullable(this.getExtraValue().get("floorPriority")).map(Object::toString).orElse("1,2,3").split(","); |
|
|
|
this.originPoint = Arrays.stream(Optional.ofNullable(this.getExtraValue().get("originPoint")).map(Object::toString).orElse("000").split(",")).collect(Collectors.toList()); |
|
|
|
this.floorMappingPoint = this.createFloorMappingPoint(); |
|
|
|
|
|
|
|
if (this.back_command != this.lastBack_command || this.front_command != this.lastFront_command) { |
|
|
|
this.requireSuccess = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.front_Zerror != this.lastFront_Zerror || this.back_Zerror != this.lastBack_Zerror) { |
|
|
|
if (AGAIN_ERROR.contains(this.front_Zerror) || AGAIN_ERROR.contains(this.back_Zerror)) { |
|
|
|
this.againRequireSuccess = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.front_Zerror == ErrorEnum.MR.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.mR(this.front_task, ForkTypeEnum.FRONT.getCode()); |
|
|
@ -453,7 +496,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.front_Zerror == ErrorEnum.KC.getCode() && this.back_Zerror == ErrorEnum.KC.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.kC(this.front_task); |
|
|
@ -479,9 +521,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.front_Zerror == ErrorEnum.ZD.getCode() && this.back_Zerror == ErrorEnum.ZD.getCode() |
|
|
|
&& this.front_forkCargo == 0 && this.back_forkCargo == 0 |
|
|
|
&& this.front_command == CommandEnum.PICKUP.getStatus() && this.back_command == CommandEnum.PICKUP.getStatus() |
|
|
|
) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.getzD(this.front_task); |
|
|
@ -489,26 +530,26 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
} else if (this.front_Zerror == ErrorEnum.ZD.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
if (this.front_forkCargo == 0) { |
|
|
|
if (this.front_command == CommandEnum.PICKUP.getStatus()) { |
|
|
|
this.getzD(this.front_task); |
|
|
|
Instruction back_inst = instructionService.findByCodeFromCache(String.valueOf(this.back_task)); |
|
|
|
if (ObjectUtil.isNotEmpty(back_inst)) { |
|
|
|
this.backWrite(back_inst); |
|
|
|
} |
|
|
|
} else if (this.front_forkCargo == 2) { |
|
|
|
} else if (this.front_command == CommandEnum.RELEASE.getStatus()) { |
|
|
|
this.putzD(this.front_task, ForkTypeEnum.FRONT.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
} else if (this.back_Zerror == ErrorEnum.ZD.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
if (this.back_forkCargo == 0) { |
|
|
|
if (this.back_command == CommandEnum.PICKUP.getStatus()) { |
|
|
|
this.getzD(this.back_task); |
|
|
|
Instruction front_inst = instructionService.findByCodeFromCache(String.valueOf(this.front_task)); |
|
|
|
if (ObjectUtil.isNotEmpty(front_inst)) { |
|
|
|
this.frontWrite(front_inst); |
|
|
|
} |
|
|
|
} else if (this.back_forkCargo == 2) { |
|
|
|
} else if (this.back_command == CommandEnum.RELEASE.getStatus()) { |
|
|
|
this.putzD(this.back_task, ForkTypeEnum.BACK.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
@ -522,10 +563,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} else if (this.mode != ModeEnum.MODE_3.getNum()) { |
|
|
|
this.message = "设备未联机"; |
|
|
|
} else if (this.front_Zerror != 0) { |
|
|
|
this.message = "设备前叉报警"; |
|
|
|
this.message = "设备前叉报警, " + ErrorEnum.getDesc(this.front_Zerror); |
|
|
|
this.isError = true; |
|
|
|
} else if (this.back_Zerror != 0) { |
|
|
|
this.message = "设备后叉报警"; |
|
|
|
this.message = "设备后叉报警," + ErrorEnum.getDesc(this.back_Zerror); |
|
|
|
this.isError = true; |
|
|
|
} else { |
|
|
|
this.message = ""; |
|
|
@ -546,142 +587,181 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
this.applyTask(); |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机工作模式:" + this.mode + ", 前叉作业状态:" + this.front_command + ", 前叉任务号:" + this.front_task + "前叉任务是否为空:" + ObjectUtil.isEmpty(frontInst) + ", 前叉探货信号:" + this.front_forkCargo)); |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机工作模式:" + this.mode + ", 后叉作业状态:" + this.back_command + ", 后叉任务号:" + this.back_task + "后叉任务是否为空:" + ObjectUtil.isEmpty(backInst) + ", 后叉探货信号:" + this.back_forkCargo)); |
|
|
|
if (this.front_forkCargo == 0 && this.back_forkCargo == 0 && ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.sendGetInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (this.front_forkCargo == 0 && this.back_forkCargo == 0 && ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isEmpty(backInst)) { |
|
|
|
this.sendGetInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (this.front_forkCargo == 0 && this.back_forkCargo == 0 && ObjectUtil.isEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.sendGetInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (this.front_forkCargo != 0 && this.back_forkCargo == 0 && ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.sendGetInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (this.front_forkCargo == 0 && this.back_forkCargo != 0 && ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.sendGetInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (this.front_forkCargo != 0 && this.back_forkCargo != 0 && ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (this.front_forkCargo == 0 && this.back_forkCargo != 0 && ObjectUtil.isEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (this.front_forkCargo != 0 && this.back_forkCargo == 0 && ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isEmpty(backInst)) { |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} |
|
|
|
this.requireSuccess = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//取货中
|
|
|
|
else if (mode == ModeEnum.MODE_3.getNum() && this.isPickup() && !this.requireSuccess) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货中, 前叉作业状态:" + this.front_command + ", 后叉作业状态:" + this.back_command)); |
|
|
|
this.clearInfoToPlc(); |
|
|
|
} |
|
|
|
//取货完成
|
|
|
|
else if (mode == ModeEnum.MODE_3.getNum() && this.isPickupComplete() && !requireSuccess) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态:" + this.front_command + ", 后叉作业状态:" + this.back_command)); |
|
|
|
Instruction frontInst = instructionService.findByCodeFromCache(String.valueOf(this.front_task)); |
|
|
|
Instruction backInst = instructionService.findByCodeFromCache(String.valueOf(this.back_task)); |
|
|
|
if (this.front_command == CommandEnum.PICKUP_COMPLETE.getStatus() && this.back_command == CommandEnum.PICKUP_COMPLETE.getStatus()) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉和后叉作业状态都是取货完成,下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} else if (this.front_command == CommandEnum.PICKUP_COMPLETE.getStatus()) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成")); |
|
|
|
String front_start_device_code = frontInst.getStart_device_code(); |
|
|
|
String front_next_device_code = frontInst.getNext_device_code(); |
|
|
|
Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code); |
|
|
|
Device front_next_device = deviceAppService.findDeviceByCode(front_next_device_code); |
|
|
|
//入库
|
|
|
|
if (instanceAppearance(front_start_device) && instanceStorage(front_next_device)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是入库任务")); |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(front_start_device, "getLinkDeviceCode"); |
|
|
|
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY"); |
|
|
|
if (ObjectUtil.isEmpty(backInst)) { |
|
|
|
backInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, backNoY); |
|
|
|
if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是入库任务, 查询出后叉任务, 下发后叉取货信息")); |
|
|
|
String back_start_device_code = backInst.getStart_device_code(); |
|
|
|
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code); |
|
|
|
this.backWrite(back_start_device, backInst); |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是入库任务, 未查询出后叉任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是入库任务, 已存在后叉任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} |
|
|
|
//出库
|
|
|
|
else if (instanceStorage(front_start_device) && instanceAppearance(front_next_device)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是出库任务")); |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode"); |
|
|
|
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY"); |
|
|
|
if (ObjectUtil.isEmpty(backInst)) { |
|
|
|
backInst = instructionService.findReadyInstByLinkDeviceCodeAndNextDeviceCode(getLinkDeviceCode, backNoY); |
|
|
|
if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是出库任务, 查询出后叉任务, 下发后叉取货信息")); |
|
|
|
this.backWrite(backInst); |
|
|
|
} else { |
|
|
|
//下发前叉放货信息
|
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是出库任务, 未查询出后叉任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是出库任务, 已存在后叉任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} else if (instanceAppearance(front_start_device) && instanceAppearance(front_next_device)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是特殊任务输送线到输送线")); |
|
|
|
if (ObjectUtil.isEmpty(backInst)) { |
|
|
|
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); |
|
|
|
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice"); |
|
|
|
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice"); |
|
|
|
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, front_start_device_code); |
|
|
|
if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是特殊任务输送线到输送线,查询到特殊任务后叉任务,下发后叉取货信息")); |
|
|
|
String back_start_device_code = backInst.getStart_device_code(); |
|
|
|
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code); |
|
|
|
this.backWrite(back_start_device, backInst); |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是特殊任务输送线到输送线,未查询到特殊任务后叉任务,下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
//下发前叉放货信息
|
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉作业状态是取货完成, 是移库任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} else if (this.back_command == CommandEnum.PICKUP_COMPLETE.getStatus()) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成")); |
|
|
|
String back_start_device_code = backInst.getStart_device_code(); |
|
|
|
String back_next_device_code = backInst.getNext_device_code(); |
|
|
|
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code); |
|
|
|
Device back_next_device = deviceAppService.findDeviceByCode(back_next_device_code); |
|
|
|
//入库
|
|
|
|
if (instanceAppearance(back_start_device) && instanceStorage(back_next_device)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是入库任务")); |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(back_start_device, "getLinkDeviceCode"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
if (ObjectUtil.isEmpty(frontInst)) { |
|
|
|
frontInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, frontNoY); |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是入库任务, 查询出前叉任务, 下发前叉取货信息")); |
|
|
|
String front_start_device_code = frontInst.getStart_device_code(); |
|
|
|
Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code); |
|
|
|
this.frontWrite(front_start_device, frontInst); |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是入库任务, 未查询出前叉任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是入库任务, 已存在前叉任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} |
|
|
|
//出库
|
|
|
|
else if (instanceStorage(back_start_device) && instanceAppearance(back_next_device)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是出库任务")); |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(back_next_device, "getLinkDeviceCode"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
if (ObjectUtil.isEmpty(frontInst)) { |
|
|
|
frontInst = instructionService.findReadyInstByLinkDeviceCodeAndNextDeviceCode(getLinkDeviceCode, frontNoY); |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是出库任务, 查询出前叉任务, 下发前叉取货信息")); |
|
|
|
this.frontWrite(frontInst); |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是出库任务, 未查询出前叉任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是出库任务, 已存在前叉任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} else if (instanceAppearance(back_start_device) && instanceAppearance(back_next_device)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是特殊任务输送线到输送线")); |
|
|
|
if (ObjectUtil.isEmpty(backInst)) { |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice"); |
|
|
|
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice"); |
|
|
|
frontInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getFrontDeviceCodeList, specialGetDevice, specialPutDevice, back_start_device_code); |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是特殊任务输送线到输送线,查询到特殊任务前叉任务,下发前叉取货信息")); |
|
|
|
String front_start_device_code = frontInst.getStart_device_code(); |
|
|
|
Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code); |
|
|
|
this.frontWrite(front_start_device, frontInst); |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是特殊任务输送线到输送线,未查询到特殊任务前叉任务,下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉作业状态是取货完成, 是移库任务, 下发放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
} |
|
|
|
} |
|
|
@ -689,6 +769,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
//放货中
|
|
|
|
else if (mode == ModeEnum.MODE_3.getNum() && this.isRelease() && !this.requireSuccess) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报放货中, 前叉作业状态:" + this.front_command + ", 后叉作业状态:" + this.back_command)); |
|
|
|
if (this.lastBack_command != CommandEnum.UNLOAD.getStatus() && this.lastFront_command != CommandEnum.UNLOAD.getStatus()) { |
|
|
|
this.clearInfoToPlc(); |
|
|
|
} else if (this.lastBack_command != CommandEnum.UNLOAD.getStatus() && this.back_command != CommandEnum.STANDY.getStatus()) { |
|
|
@ -701,25 +782,32 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
//请求卸货
|
|
|
|
else if (mode == ModeEnum.MODE_3.getNum() && this.isUnload() && !requireSuccess) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报请求卸货, 前叉作业状态:" + this.front_command + ", 后叉作业状态:" + this.back_command)); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_THREE.getSignalNum()); |
|
|
|
this.requireSuccess = true; |
|
|
|
} |
|
|
|
//卸货完成
|
|
|
|
else if (mode == ModeEnum.MODE_3.getNum() && this.isUnloadComplete() && !requireSuccess) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报卸货完成, 前叉作业状态:" + this.front_command + ", 后叉作业状态:" + this.back_command)); |
|
|
|
if (this.front_command == CommandEnum.UNLOAD_COMPLETE.getStatus() && this.back_command == CommandEnum.UNLOAD_COMPLETE.getStatus()) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报卸货完成, 前叉和后叉作业状态都是卸货完成,反馈确认卸货完成")); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_ELEVEN.getSignalNum()); |
|
|
|
} else if (this.front_command == CommandEnum.UNLOAD_COMPLETE.getStatus()) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报卸货完成, 前叉作业状态是卸货完成,反馈确认卸货完成")); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_ELEVEN.getSignalNum()); |
|
|
|
//根据后叉指令号,查询后叉指令,下发后叉放货指令信息
|
|
|
|
Instruction backTask = instructionService.findByCodeFromCache(String.valueOf(back_task)); |
|
|
|
if (ObjectUtil.isNotEmpty(backTask)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报卸货完成, 前叉作业状态是卸货完成,查询到后叉信息还存在, 下发后叉放货信息")); |
|
|
|
this.sendPutInfoToPlc(null, backTask); |
|
|
|
} |
|
|
|
} else if (this.back_command == CommandEnum.UNLOAD_COMPLETE.getStatus()) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报卸货完成, 后叉作业状态是卸货完成,反馈确认卸货完成")); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_ELEVEN.getSignalNum()); |
|
|
|
//根据前叉指令号,查询前叉指令,下发前叉放货指令信息
|
|
|
|
Instruction frontTask = instructionService.findByCodeFromCache(String.valueOf(front_task)); |
|
|
|
if (ObjectUtil.isNotEmpty(frontTask)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报卸货完成, 后叉作业状态是卸货完成,查询到前叉信息还存在, 下发前叉放货信息")); |
|
|
|
this.sendPutInfoToPlc(frontTask, null); |
|
|
|
} |
|
|
|
} |
|
|
@ -884,6 +972,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
case "3": |
|
|
|
this.applyTaskByTime(); |
|
|
|
break; |
|
|
|
case "4": |
|
|
|
this.applyTaskOneInOneOut(); |
|
|
|
break; |
|
|
|
default: |
|
|
|
this.applyInTask(); |
|
|
|
break; |
|
|
@ -1167,6 +1258,189 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 一进一出策略 |
|
|
|
* 根据楼层优先级 |
|
|
|
*/ |
|
|
|
private void applyTaskOneInOneOut() { |
|
|
|
if (!prohibitInWarehouse) { |
|
|
|
String currentXYZ = this.front_z + "" + this.front_x + this.front_y; |
|
|
|
if (this.originPoint.contains(currentXYZ)) { |
|
|
|
this.applyTaskOneIn(); |
|
|
|
} else { |
|
|
|
this.applyTaskOneOut(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void applyTaskOneIn() { |
|
|
|
String currentXYZ = this.front_z + "" + this.front_x + this.front_y; |
|
|
|
boolean flag = this.applySpecialTask(); |
|
|
|
if (flag) { |
|
|
|
this.unExecutedMessage = null; |
|
|
|
return; |
|
|
|
} |
|
|
|
Instruction frontInst = null; |
|
|
|
Instruction backInst = null; |
|
|
|
Device front_start_device = null; |
|
|
|
Device back_start_device = null; |
|
|
|
for (int i = 0; i < this.floorPriorities.length; i++) { |
|
|
|
String floorPriority = this.floorPriorities[i]; |
|
|
|
Map<String, List<String>> floorPoint = this.floorMappingPoint.get(floorPriority); |
|
|
|
if (ObjectUtil.isEmpty(floorPoint)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
List<String> points = floorPoint.get("in"); |
|
|
|
if (CollectionUtil.isEmpty(points)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); |
|
|
|
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY"); |
|
|
|
List<Instruction> frontInsts = instructionService.findReadyInstByStartDeviceCode(getFrontDeviceCodeList, frontNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(frontInsts)) { |
|
|
|
for (int j = 0; j < frontInsts.size(); j++) { |
|
|
|
Instruction instruction = frontInsts.get(j); |
|
|
|
if (points.contains(instruction.getStart_device_code())) { |
|
|
|
frontInst = instruction; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
String front_start_device_code = frontInst.getStart_device_code(); |
|
|
|
front_start_device = deviceAppService.findDeviceByCode(front_start_device_code); |
|
|
|
if (front_start_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(front_start_device, "getLinkDeviceCode"); |
|
|
|
backInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, backNoY); |
|
|
|
if (ObjectUtil.isEmpty(backInst)) { |
|
|
|
Instruction inst = instructionService.findBusyInstByNextDeviceCode(getLinkDeviceCode); |
|
|
|
if (ObjectUtil.isNotEmpty(inst)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (this.stackerNum == 2) { |
|
|
|
List<Instruction> backInsts = instructionService.findReadyInstByStartDeviceCode(getBackDeviceCodeList, backNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(backInsts)) { |
|
|
|
for (int k = 0; k < backInsts.size(); k++) { |
|
|
|
Instruction instruction = backInsts.get(k); |
|
|
|
if (points.contains(instruction.getStart_device_code())) { |
|
|
|
backInst = instruction; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
String back_start_device_code = backInst.getStart_device_code(); |
|
|
|
back_start_device = deviceAppService.findDeviceByCode(back_start_device_code); |
|
|
|
if (back_start_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(back_start_device, "getLinkDeviceCode"); |
|
|
|
frontInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, frontNoY); |
|
|
|
if (ObjectUtil.isEmpty(frontInst)) { |
|
|
|
Instruction inst = instructionService.findBusyInstByNextDeviceCode(getLinkDeviceCode); |
|
|
|
if (ObjectUtil.isNotEmpty(inst)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) || ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.FBWrite(front_start_device, frontInst, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
this.frontWrite(front_start_device, frontInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.backWrite(back_start_device, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
if (this.originPoint.contains(currentXYZ)) { |
|
|
|
this.applyTaskOneOut(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void applyTaskOneOut() { |
|
|
|
String currentXYZ = this.front_z + "" + this.front_x + this.front_y; |
|
|
|
Instruction frontInst = null; |
|
|
|
Instruction backInst = null; |
|
|
|
for (int i = 0; i < this.floorPriorities.length; i++) { |
|
|
|
String floorPriority = this.floorPriorities[i]; |
|
|
|
Map<String, List<String>> floorPoint = this.floorMappingPoint.get(floorPriority); |
|
|
|
if (ObjectUtil.isEmpty(floorPoint)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
List<String> points = floorPoint.get("out"); |
|
|
|
if (CollectionUtil.isEmpty(points)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY"); |
|
|
|
List<Instruction> frontInsts = instructionService.findReadyInstByNextDeviceCode(getFrontDeviceCodeList, frontNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(frontInsts)) { |
|
|
|
for (int j = 0; j < frontInsts.size(); j++) { |
|
|
|
Instruction instruction = frontInsts.get(j); |
|
|
|
if (points.contains(instruction.getNext_device_code())) { |
|
|
|
frontInst = instruction; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && this.stackerNum == 2) { |
|
|
|
String front_next_device_code = frontInst.getNext_device_code(); |
|
|
|
Device front_next_device = deviceAppService.findDeviceByCode(front_next_device_code); |
|
|
|
if (front_next_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode"); |
|
|
|
backInst = instructionService.findReadyInstByNextDeviceCode(frontInst, getLinkDeviceCode, backNoY); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (this.stackerNum == 2) { |
|
|
|
List<Instruction> backInsts = instructionService.findReadyInstByNextDeviceCode(getBackDeviceCodeList, backNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(backInsts)) { |
|
|
|
for (int k = 0; k < backInsts.size(); k++) { |
|
|
|
Instruction instruction = backInsts.get(k); |
|
|
|
if (points.contains(instruction.getNext_device_code())) { |
|
|
|
backInst = instruction; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.FBWrite(frontInst, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
this.frontWrite(frontInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.backWrite(backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
if (!this.originPoint.contains(currentXYZ)) { |
|
|
|
this.applyTaskOneIn(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 下发前叉取货信息(取货位是输送线) |
|
|
|
* |
|
|
@ -1355,6 +1629,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
private void sendGetInfoToPlc(Instruction frontInst, Instruction backInst) { |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
if (this.front_forkCargo == 0 && this.back_forkCargo == 0 && isBindGet(frontInst, backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机待机状态下, 前叉和后叉任务都存在,并且前工位和后工位原位都无货, 可以绑定双任务,下发取货信息")); |
|
|
|
String start_device_code = frontInst.getStart_device_code(); |
|
|
|
Device start_device = deviceAppService.findDeviceByCode(start_device_code); |
|
|
|
if (start_device != null && start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1366,6 +1641,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getFBKeys(), Arrays.asList(x, y, z, frontInst.getInstruction_code(), backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_THREE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum())); |
|
|
|
} |
|
|
|
} else if (this.front_forkCargo == 0) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机待机状态下, 前叉和后叉任务都存在,并且前工位原位无货,下发取货信息")); |
|
|
|
String start_device_code = frontInst.getStart_device_code(); |
|
|
|
Device start_device = deviceAppService.findDeviceByCode(start_device_code); |
|
|
|
if (start_device != null && start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1377,6 +1653,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getFBKeys(), Arrays.asList(x, y, z, frontInst.getInstruction_code(), backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum())); |
|
|
|
} |
|
|
|
} else if (this.back_forkCargo == 0) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机待机状态下, 前叉和后叉任务都存在,并且后工位原位无货,下发取货信息")); |
|
|
|
String start_device_code = backInst.getStart_device_code(); |
|
|
|
Device start_device = deviceAppService.findDeviceByCode(start_device_code); |
|
|
|
if (start_device != null && start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1389,6 +1666,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (ObjectUtil.isNotEmpty(frontInst) && !isBindGet(frontInst, backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机待机状态下, 前叉任务存在,下发取货信息")); |
|
|
|
String start_device_code = frontInst.getStart_device_code(); |
|
|
|
Device start_device = deviceAppService.findDeviceByCode(start_device_code); |
|
|
|
if (start_device != null && start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1400,6 +1678,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getFrontKeys(), Arrays.asList(x, y, z, frontInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum())); |
|
|
|
} |
|
|
|
} else if (ObjectUtil.isNotEmpty(backInst) && !isBindGet(frontInst, backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机待机状态下, 后叉任务存在,下发取货信息")); |
|
|
|
String start_device_code = backInst.getStart_device_code(); |
|
|
|
Device start_device = deviceAppService.findDeviceByCode(start_device_code); |
|
|
|
if (start_device != null && start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1411,6 +1690,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getBackKeys(), Arrays.asList(x, y, z, backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum())); |
|
|
|
} |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉和后叉任务都不存在,不下发取货信息")); |
|
|
|
this.unExecutedMessage = "未执行放货原因, 堆垛机上报任务号不存在"; |
|
|
|
} |
|
|
|
} |
|
|
@ -1432,21 +1712,24 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
String back_from_y = backInst.getFrom_y(); |
|
|
|
String back_from_z = backInst.getFrom_z(); |
|
|
|
boolean flagX = StrUtil.equals(front_from_x, back_from_x); |
|
|
|
// TODO 需要验证规则是否生效
|
|
|
|
boolean flagY = ((Integer.parseInt(front_from_y) - 1) / 4 == (Integer.parseInt(back_from_y) - 1) / 4) && (((Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(back_from_y) % 4) == 2) || (Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(back_from_z) % 4) == 4); |
|
|
|
boolean flagZ = StrUtil.equals(front_from_z, back_from_z); |
|
|
|
if (flagX && flagY && flagZ) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上待机状态下,前叉任务号:" + frontInst.getInstruction_code() + ", 后叉任务号:" + backInst.getInstruction_code() + ", 能组成双叉取货任务")); |
|
|
|
return true; |
|
|
|
} |
|
|
|
} else if (StrUtil.equals(back_start_device_code, back_device_code)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上待机状态下,前叉任务号:" + frontInst.getInstruction_code() + ", 后叉任务号:" + backInst.getInstruction_code() + ", 能组成双叉取货任务")); |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上待机状态下,前叉任务号:" + frontInst.getInstruction_code() + ", 后叉任务号:" + backInst.getInstruction_code() + ", 不能组成双叉取货任务")); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
private void sendPutInfoToPlc(Instruction frontInst, Instruction backInst) { |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst) && isBindPut(frontInst, backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉和后叉任务都存在,并且可以绑定双任务,下发放货信息")); |
|
|
|
String next_device_code = frontInst.getNext_device_code(); |
|
|
|
Device next_device = deviceAppService.findDeviceByCode(next_device_code); |
|
|
|
if (next_device != null && next_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1458,6 +1741,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getFBKeys(), Arrays.asList(x, y, z, frontInst.getInstruction_code(), backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_THREE.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum())); |
|
|
|
} |
|
|
|
} else if (ObjectUtil.isNotEmpty(frontInst) && !isBindPut(frontInst, backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉任务存在,不可以绑定双任务,下发放货信息")); |
|
|
|
String next_device_code = frontInst.getNext_device_code(); |
|
|
|
Device next_device = deviceAppService.findDeviceByCode(next_device_code); |
|
|
|
if (next_device != null && next_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1469,6 +1753,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getFrontKeys(), Arrays.asList(x, y, z, frontInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum())); |
|
|
|
} |
|
|
|
} else if (ObjectUtil.isNotEmpty(backInst) && !isBindPut(frontInst, backInst)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 后叉任务存在,不可以绑定双任务,下发放货信息")); |
|
|
|
String next_device_code = backInst.getNext_device_code(); |
|
|
|
Device next_device = deviceAppService.findDeviceByCode(next_device_code); |
|
|
|
if (next_device != null && next_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1480,6 +1765,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getBackKeys(), Arrays.asList(x, y, z, backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum())); |
|
|
|
} |
|
|
|
} else { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成, 前叉和后叉任务都不存在,不下发放货信息")); |
|
|
|
this.unExecutedMessage = "未执行放货原因, 堆垛机上报任务号不存在"; |
|
|
|
} |
|
|
|
} |
|
|
@ -1506,12 +1792,15 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
boolean flagY = ((Integer.parseInt(front_to_y) - 1) / 4 == (Integer.parseInt(back_to_y) - 1) / 4) && (((Integer.parseInt(front_to_y) % 4) + (Integer.parseInt(back_to_y) % 4) == 2) || (Integer.parseInt(front_to_y) % 4) + (Integer.parseInt(back_to_z) % 4) == 4); |
|
|
|
boolean flagZ = StrUtil.equals(front_to_z, back_to_z); |
|
|
|
if (flagX && flagY && flagZ) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成,前叉任务号:" + frontInst.getInstruction_code() + ", 后叉任务号:" + backInst.getInstruction_code() + ", 能组成双叉放货任务")); |
|
|
|
return true; |
|
|
|
} |
|
|
|
} else if (StrUtil.equals(back_next_device_code, back_device_code)) { |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成,前叉任务号:" + frontInst.getInstruction_code() + ", 后叉任务号:" + backInst.getInstruction_code() + ", 能组成双叉放货任务")); |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "堆垛机上报取货完成,前叉任务号:" + frontInst.getInstruction_code() + ", 后叉任务号:" + backInst.getInstruction_code() + ", 不能组成双叉放货任务")); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|