Compare commits
13 Commits
agv_twoFlo
...
acs_dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 33f9d153a4 | |||
| 0b5d4c1df6 | |||
| 60e61f1d99 | |||
| 04de617a12 | |||
| d1fb8af637 | |||
| 78baf3be4f | |||
| d7cd0bed54 | |||
| 6443056757 | |||
| ee83f434b8 | |||
| 1919e0f5f7 | |||
| 6bb12efd46 | |||
| 1f91405a40 | |||
| 45422b6939 |
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.agv.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.domain.TwoFloorAgvStatus;
|
||||
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -15,6 +16,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 二楼AGV状态管理服务
|
||||
* 负责管理和更新AGV状态,通过HTTP接口提供状态查询
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TwoFloorAgvStatusService {
|
||||
|
||||
@@ -110,31 +112,35 @@ public class TwoFloorAgvStatusService {
|
||||
* 清除AGV错误信息
|
||||
*/
|
||||
public void clearAgvError(int carno) {
|
||||
String vehicleCode = String.format("AGV%02d", carno);
|
||||
TwoFloorAgvStatus agvStatus = agvStatusMap.get(vehicleCode);
|
||||
if (agvStatus != null) {
|
||||
agvStatus.setIs_error(false);
|
||||
agvStatus.setError_code(null);
|
||||
agvStatus.setError_message(null);
|
||||
agvStatus.setError_action(null);
|
||||
agvStatus.setError_mode(null);
|
||||
// 设置错误信息
|
||||
agvStatus.setDriver(null);
|
||||
agvStatus.setIs_error(false);
|
||||
agvStatus.setError_message(null);
|
||||
agvStatus.setDevice_code(null);
|
||||
agvStatus.setError_action(null);
|
||||
agvStatus.setError_mode(null);
|
||||
agvStatus.setError_move(null);
|
||||
agvStatus.setError_error(null);
|
||||
agvStatus.setExp_action(null);
|
||||
agvStatus.setExp_mode(null);
|
||||
agvStatus.setExp_move(null);
|
||||
agvStatus.setExp_error(null);
|
||||
if ("error".equals(agvStatus.getStatus())) {
|
||||
agvStatus.setStatus("idle");
|
||||
agvStatus.setStatus_text("空闲");
|
||||
try {
|
||||
String vehicleCode = String.format("AGV%02d", carno);
|
||||
TwoFloorAgvStatus agvStatus = agvStatusMap.get(vehicleCode);
|
||||
if (agvStatus != null) {
|
||||
agvStatus.setIs_error(false);
|
||||
agvStatus.setError_code(null);
|
||||
agvStatus.setError_message(null);
|
||||
agvStatus.setError_action(null);
|
||||
agvStatus.setError_mode(null);
|
||||
// 设置错误信息
|
||||
agvStatus.setDriver(null);
|
||||
agvStatus.setIs_error(false);
|
||||
agvStatus.setError_message(null);
|
||||
agvStatus.setDevice_code(null);
|
||||
agvStatus.setError_action(null);
|
||||
agvStatus.setError_mode(null);
|
||||
agvStatus.setError_move(null);
|
||||
agvStatus.setError_error(null);
|
||||
agvStatus.setExp_action(null);
|
||||
agvStatus.setExp_mode(null);
|
||||
agvStatus.setExp_move(null);
|
||||
agvStatus.setExp_error(null);
|
||||
if ("error".equals(agvStatus.getStatus())) {
|
||||
agvStatus.setStatus("idle");
|
||||
agvStatus.setStatus_text("空闲");
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
log.error("清空agv异常状态有异常,异常原因={}",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,29 +345,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
log.info(device_code + "对应设备号为空!");
|
||||
}
|
||||
} else if (phase == 0x64) {
|
||||
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}", agvaddr, station);
|
||||
Dict dict = dictService.getDictByName3("station", String.valueOf(agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
dict.setValue("1");
|
||||
dict.setPara2(String.valueOf(agvaddr));
|
||||
dict.setPara3("下发成功");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
//充电成功
|
||||
} else if (phase == 0x65) {
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}", agvaddr, station);
|
||||
//充电取消上报
|
||||
} else if (phase == 0x66) {
|
||||
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}", agvaddr, station);
|
||||
Dict dict = dictService.getDictByName3("station", String.valueOf(agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
dict.setValue("0");
|
||||
dict.setPara2("");
|
||||
dict.setPara3("充电桩空闲");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
|
||||
|
||||
@@ -510,7 +510,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
//查找有没有对应的指令
|
||||
Instruction inst = instructionService.findByStartCodeAndReady(this.device_code);
|
||||
Instruction inst;
|
||||
if ("RK1032".equals(this.device_code)||"RK1034".equals(this.device_code)||"RK1035".equals(this.device_code)){
|
||||
inst = instructionService.findByStartCodeAndReady2(this.device_code);
|
||||
}else {
|
||||
inst = instructionService.findByStartCodeAndReady(this.device_code);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(inst)) {
|
||||
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(this.device_code);
|
||||
if (routeLineDtos.size() < 1) {
|
||||
@@ -796,7 +801,15 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
List list = new ArrayList();
|
||||
writeData(next_addr, list, instdto, containerType);
|
||||
// led_message = getLedMessage(instdto);
|
||||
requireSucess = true;
|
||||
//写完信号to_task写成功后更新指令为执行中
|
||||
inst = checkInst();
|
||||
to_task = this.itemProtocol.getTo_task();
|
||||
if (Integer.parseInt(to_task)>0 && to_task.equals(inst.getInstruction_code())) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
requireSucess = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,10 +218,10 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
||||
int var18 = itemValues.length;
|
||||
|
||||
for (int var19 = 0; var19 < var18; ++var19) {
|
||||
ItemValue itemValue = var17[var19];
|
||||
String code = itemValue.getItem_code();
|
||||
Object value = itemValue.getItem_value();
|
||||
opcValueAccessor.setValue(code, value);
|
||||
//ItemValue itemValue = var17[var19];
|
||||
//String code = itemValue.getItem_code();
|
||||
//Object value = itemValue.getItem_value();
|
||||
//opcValueAccessor.setValue(code, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,10 +274,10 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
||||
int var18 = itemValues.length;
|
||||
|
||||
for (int var19 = 0; var19 < var18; ++var19) {
|
||||
ItemValue itemValue = var17[var19];
|
||||
String code = itemValue.getItem_code();
|
||||
Object value = itemValue.getItem_value();
|
||||
opcValueAccessor.setValue(code, value);
|
||||
//ItemValue itemValue = var17[var19];
|
||||
//String code = itemValue.getItem_code();
|
||||
//Object value = itemValue.getItem_value();
|
||||
//opcValueAccessor.setValue(code, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
private Date require_apply_zjrk_time = new Date();
|
||||
//退货入库申请时间
|
||||
private Date require_apply_thrk_time = new Date();
|
||||
//入库申请时间
|
||||
private Date require_apply_in_time = new Date();
|
||||
|
||||
private int instruction_update_time_out = 1000;
|
||||
Integer heartbeat_tag;
|
||||
private Date instruction_require_time = new Date();
|
||||
@@ -187,6 +190,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
private int require_apply_tprk_time_out = 4000;
|
||||
private int require_apply_zjrk_time_out = 4000;
|
||||
private int require_apply_thrk_time_out = 4000;
|
||||
private int require_apply_in_time_out = 4000;
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
|
||||
@@ -694,6 +698,13 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
}
|
||||
|
||||
private void applyIn(String type, int mode) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_in_time.getTime()
|
||||
< (long) this.require_apply_in_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.require_apply_in_time_out);
|
||||
return;
|
||||
}
|
||||
this.require_apply_in_time = date;
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
|
||||
@@ -202,7 +202,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
|
||||
//空箱出库开盖位,申请开盖
|
||||
if (mode == 15 && move == 1 && task > 0) {
|
||||
if (mode == 15 && move == 1 && task > 0 && !requireSucess) {
|
||||
Instruction instruction = instructionService.findByCode(String.valueOf(task));
|
||||
//不允许开盖,完成出库任务,自动去扫码位
|
||||
if (instruction == null || StrUtil.isEmpty(instruction.getVehicle_code())) {
|
||||
|
||||
@@ -424,14 +424,16 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
|
||||
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
|
||||
boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
if (boxSubvolumesConveyorDeviceDriver.getMove() != 1) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage2";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//效率提升屏蔽光电判断
|
||||
|
||||
// BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
|
||||
// if (nextDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
|
||||
// boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
// if (boxSubvolumesConveyorDeviceDriver.getMove() != 1) {
|
||||
// notCreateInstMessage = "universal_notCreateInstMessage2";
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver;
|
||||
if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
|
||||
@@ -553,11 +555,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
map12.put("value", interactionJsonDTO.getFrpModel());
|
||||
list.add(map12);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getIsHave())) {
|
||||
map13.put("code", "to_have_or_not");
|
||||
map13.put("value", interactionJsonDTO.getIsHave());
|
||||
list.add(map13);
|
||||
}
|
||||
// if (ObjectUtil.isNotEmpty(interactionJsonDTO.getIsHave())) {
|
||||
// map13.put("code", "to_have_or_not");
|
||||
// map13.put("value", interactionJsonDTO.getIsHave());
|
||||
// list.add(map13);
|
||||
// }
|
||||
}
|
||||
this.writing(list);
|
||||
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||
|
||||
@@ -132,8 +132,11 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
private int instruction_update_time_out = 1000;
|
||||
Integer heartbeat_tag;
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date apply_feedback_require_time = new Date();
|
||||
|
||||
private int instruction_require_time_out = 3000;
|
||||
private int apply_feedback_require_time_out = 3000;
|
||||
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
|
||||
@@ -230,6 +233,12 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
//反馈重量
|
||||
if (mode == 3 && action == 5 && move == 0 && weight > 0 && StrUtil.isNotEmpty(sub_volume_no) && !requireSucess) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.apply_feedback_require_time.getTime() < (long) this.apply_feedback_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.apply_feedback_require_time_out);
|
||||
return ;
|
||||
}
|
||||
this.apply_feedback_require_time = date;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈重量");
|
||||
ApplyfeedbackSubVolumeWeightRequest applyfeedbackSubVolumeWeightRequest = new ApplyfeedbackSubVolumeWeightRequest();
|
||||
ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeightResponse;
|
||||
|
||||
@@ -348,6 +348,14 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findByStartCodeAndReady(String device_code);
|
||||
|
||||
|
||||
/**
|
||||
* 找最新的指令
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
Instruction findByStartCodeAndReady2(String device_code);
|
||||
|
||||
/**
|
||||
* 根据起点设备编号查询当前是否有运行的指令
|
||||
*
|
||||
|
||||
@@ -1935,6 +1935,15 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Instruction findByStartCodeAndReady2(String device_code) {
|
||||
Optional<Instruction> optionalInstruction = instructions.stream()
|
||||
.filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), device_code)
|
||||
&& StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && !instruction.getInstruction_type().equals(TaskTypeEnum.Mxddhj_Task.getIndex())).max(Comparator.comparing(Instruction::getCreate_time));
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay) {
|
||||
List<Instruction> instructionList = new ArrayList<>();
|
||||
|
||||
@@ -47,9 +47,9 @@ public class OpcUtl {
|
||||
Map<Item, Integer> e = null;
|
||||
try {
|
||||
e = group.write(requests);
|
||||
log.info("Group返回下发信号结果:" + String.valueOf(e));
|
||||
// group.write(requests);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
throw new BadRequestException("下发信号失败:" + e1.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,7 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -116,6 +113,30 @@ public class CreateDDJInst {
|
||||
|
||||
String start_height = taskDto.getStart_height();
|
||||
String next_height = taskDto.getNext_height();
|
||||
|
||||
//如果是换标任务判断终点1003,和1002点位的有无货判断
|
||||
if (StrUtil.isNotEmpty(taskDto.getStorage_task_type())&& Objects.equals(taskDto.getStorage_task_type(), "1")){
|
||||
//关联站点判断
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
//判断对接位和关联站点光电信号
|
||||
List<String> getDeviceCodeList = beltConveyorDeviceDriver.getExtraDeviceCodes("link_device_code");
|
||||
if (CollUtil.isNotEmpty(getDeviceCodeList)) {
|
||||
String linkDeviceCode = getDeviceCodeList.get(0);
|
||||
Device linkDevice = appService.findDeviceByCode(linkDeviceCode);
|
||||
BeltConveyorDeviceDriver linkDeviceDriver;
|
||||
if (linkDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
linkDeviceDriver = (BeltConveyorDeviceDriver) linkDevice.getDeviceDriver();
|
||||
if ((beltConveyorDeviceDriver.getMode() == 0 || beltConveyorDeviceDriver.getMove() == 1) || (linkDeviceDriver.getMode() == 0 || linkDeviceDriver.getMove() == 1)) {
|
||||
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("无法创建堆垛机指令的原因:换标位" + next_device_code + "条件不满足!");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//同排的货位移库任务
|
||||
if (StrUtil.equals(taskDto.getStart_device_code(), taskDto.getNext_device_code())) {
|
||||
//通过起点找路由
|
||||
@@ -385,33 +406,6 @@ public class CreateDDJInst {
|
||||
instdto.setTo_z(taskDto.getTo_z());
|
||||
instdto.setTo_y(taskDto.getTo_y());
|
||||
}
|
||||
//判断agv系统
|
||||
//1、1楼叉车系统
|
||||
//2、2楼1区域AGV系统
|
||||
//3、2楼2区域AGV系统 -已废弃
|
||||
if (!StrUtil.equals(agv_system_type, CommonFinalParam.ONE)) {
|
||||
// task_type
|
||||
//1、生箔; Itype=1:取空,取满,放空,放满;
|
||||
//2、分切 Itype=3取满、取空、放满、放空;
|
||||
//3、普通任务 Itype=2:取货、放货;
|
||||
//4、叉车任务
|
||||
//5、输送任务
|
||||
//6、行架
|
||||
//7、立库
|
||||
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) {
|
||||
instdto.setAgv_inst_type(CommonFinalParam.ONE);
|
||||
} else if (StrUtil.equals(task_type, "3")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else if (StrUtil.equals(task_type, "2")) {
|
||||
instdto.setAgv_inst_type("3");
|
||||
} else if (StrUtil.equals(task_type, "8")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else {
|
||||
log.info("未找到对应的AGV指令类型,任务号:" + taskDto.getTask_code() + ",task_type:" + taskDto.getTask_type());
|
||||
}
|
||||
} else {
|
||||
instdto.setAgv_inst_type("4");
|
||||
}
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -172,6 +172,7 @@
|
||||
<el-table-column prop="start_point_code" :label="$t('task.select.Start_point')" :min-width="flexWidth('start_point_code',crud.data,$t('task.select.Start_point'))" />
|
||||
<el-table-column prop="next_point_code" :label="$t('task.select.Destination')" :min-width="flexWidth('next_point_code',crud.data,$t('task.select.Destination'))" />
|
||||
<el-table-column prop="matarial" :label="$t('TaskRecord.table.Material')" :min-width="flexWidth('matarial',crud.data,$t('TaskRecord.table.Material'))" />
|
||||
<el-table-column prop="carno" :label="$t('Inst.table.carno')" :min-width="flexWidth('carno',crud.data,$t('Inst.table.carno'))"/>
|
||||
<el-table-column prop="quantity" :label="$t('TaskRecord.table.Quantity')" :min-width="flexWidth('quantity',crud.data,$t('TaskRecord.table.Quantity'))" />
|
||||
<el-table-column prop="weight" label="重量" :min-width="flexWidth('weight',crud.data,'重量')" />
|
||||
<el-table-column prop="remark" :label="$t('task.select.Remark')" :min-width="flexWidth('remark',crud.data,$t('task.select.Remark'))" />
|
||||
|
||||
Reference in New Issue
Block a user