opt: agv偏移实现两个点位调整,设备信号优化

This commit is contained in:
yanps
2024-05-31 16:58:01 +08:00
parent dddfe51684
commit 5c1aadb43c
11 changed files with 272 additions and 199 deletions

View File

@@ -121,4 +121,16 @@ public interface AcsConfig {
* 日志级别
*/
String LOGLEVEL = "log_level";
/**
* AGV偏移量A点
*/
String OFFSET_A = "offSet_A";
/**
* AGV偏移量B点
*/
String OFFSET_B = "offSet_B";
/**
* 选择A点还是B点
*/
String CHOOSE = "choose";
}

View File

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun;
import org.nl.acs.common.base.CommonFinalParam;
@@ -39,6 +40,7 @@ import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.enums.LogTypeEnum;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
@@ -310,6 +312,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) {
rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver();
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
String choose = paramService.findByCode(AcsConfig.CHOOSE).getValue();
String length1 = rangingStationsDeviceDriver.getLength1();
String length2 = rangingStationsDeviceDriver.getLength2();
Float len1 = 0.0F;
@@ -318,6 +322,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
len1 = Float.parseFloat(length1);
len2 = Float.parseFloat(length2);
}
if("A".equals(choose)){
String offSet_A = paramService.findByCode(AcsConfig.OFFSET_A).getValue();
if(ObjectUtil.isNotEmpty(offSet_A) && !"null".equals(offSet_A)){
Integer integer = Integer.valueOf(offSet_A);
len1 = len1 - integer;
}
}else if("B".equals(choose)){
String offSet_B = paramService.findByCode(AcsConfig.OFFSET_B).getValue();
if(ObjectUtil.isNotEmpty(offSet_B) && !"null".equals(offSet_B)){
Integer integer = Integer.valueOf(offSet_B);
len1 = integer + len1;
}
}
if(len1 * len2 < 1 ){
int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0;
if (roundedNumber == 0) {

View File

@@ -20,8 +20,8 @@ public class ItemProtocol {
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
public static String item_weight = "weight";
public static String item_material_type = "material_type";
public static String item_barcode = "barcode";
/*public static String item_material_type = "material_type";
public static String item_barcode = "barcode";*/
private StandardInspectSiteDeviceDriver driver;
@@ -50,13 +50,13 @@ public class ItemProtocol {
}
public int getMaterialType() {
/*public int getMaterialType() {
return this.getOpcIntegerValue(item_material_type);
}
public int getBarcode() {
return this.getOpcIntegerValue(item_barcode);
}
}*/
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
@@ -98,9 +98,9 @@ public class ItemProtocol {
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(item_action, "取放信号", "DB600.B4"));
list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));
/*list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));*/
list.add(new ItemDto(item_error, "报警信号", "DB600.B7"));
list.add(new ItemDto(item_barcode, "条码", "DB600.D8"));
/*list.add(new ItemDto(item_barcode, "条码", "DB600.D8"));*/
return list;
}

View File

@@ -178,8 +178,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
move = this.itemProtocol.getMove();
hasGoods = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
material_type = this.itemProtocol.getMaterialType();
barcode = this.itemProtocol.getBarcode();
/*material_type = this.itemProtocol.getMaterialType();
barcode = this.itemProtocol.getBarcode();*/
if (mode != last_mode) {
this.setRequireSucess(false);
if (mode == 2) {

View File

@@ -27,9 +27,9 @@ public class ItemProtocol {
//报警
public static String item_error = "error";
//x轴坐标
public static String item_x_position = "x_position";
public static String item_x_position = "x";
//y轴坐标
public static String item_y_position = "y_position";
public static String item_y_position = "y";
//下发命令
public static String item_to_command = "to_command";

View File

@@ -18,9 +18,9 @@ public class ItemProtocol {
//工作模式
public static String item_mode = "mode";
//光电信号
public static String item_move = "move";
public static String item_move = "move1";
//动作信号
public static String item_action = "action";
public static String item_action = "action1";
//任务号
public static String item_task = "task";
//报警

View File

@@ -164,6 +164,8 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
String device_code;
String message = null;
private Date instruction_require_time = new Date();
private int instruction_require_time_out = 3000;
@Override
public Device getDevice() {
@@ -300,6 +302,11 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
* 申请套管
*/
private synchronized void apply_casing(int mode) throws Exception {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
applyPlugPullSiteRequest.setDevice_code(device_code);
@@ -326,10 +333,10 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
map.put("to_material1", to_material1);
map.put("to_material2", to_material2);
if (StrUtil.isNotEmpty(leftSize)){
if (StrUtil.isNotEmpty(leftSize)) {
map.put("to_size1", leftSize);
}
if (StrUtil.isNotEmpty(rightSize)){
if (StrUtil.isNotEmpty(rightSize)) {
map.put("to_size2", rightSize);
}
map.put("to_spec1", to_spec1);
@@ -352,11 +359,17 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
}
/**
* 套管完成
*/
private synchronized void bushingSucess(int mode) throws Exception {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
applyPlugPullSiteRequest.setDevice_code(device_code);
@@ -380,6 +393,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
message = "申请套管失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
}
@@ -387,6 +401,11 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
* 拔轴完成
*/
private synchronized void pullShaftSucess(int mode) throws Exception {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
applyPlugPullSiteRequest.setDevice_code(device_code);
@@ -410,11 +429,17 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
}
/**
* 申请拔轴
*/
private synchronized void applyPullShaft(int mode) throws Exception {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
applyPlugPullSiteRequest.setDevice_code(device_code);
@@ -466,11 +491,17 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
}
/**
* 缓存线已满,生成行架任务
*/
private synchronized void applyTask(int mode) throws Exception {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
applyPlugPullSiteRequest.setDevice_code(device_code);
@@ -491,6 +522,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
}
/**
* 下发电气信号
@@ -632,7 +664,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
jo.put("mode", mode);
jo.put("move", move);
/*jo.put("action", action);*/
jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError())));
jo.put("error", ErrorUtil.getDictDetail("cbj_error_type", String.valueOf(this.getError())));
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
jo.put("message", message);

View File

@@ -27,9 +27,9 @@ public class ItemProtocol {
//报警
public static String item_error = "error";
//x轴坐标
public static String item_x_position = "x_position";
public static String item_x_position = "x";
//y轴坐标
public static String item_y_position = "y_position";
public static String item_y_position = "y";
//下发命令
public static String item_to_command = "to_command";
@@ -42,7 +42,7 @@ public class ItemProtocol {
//是否拔轴
public static String item_to_pull = "to_pull";
//是否套轴
public static String item_to_sleeve = "to_sleeve";
public static String item_to_sleeve = "is_bushing";
//尺寸
public static String item_to_size = "to_size";

View File

@@ -32,9 +32,9 @@ public class ItemProtocol {
*/
public static String item_walk_y = "walk_y";
//x坐标
public static String item_x_position = "x_position";
public static String item_x_position = "x";
//动作信号
public static String item_y_position = "y_position";
public static String item_y_position = "y";
/**
* 报警
*/

View File

@@ -224,6 +224,11 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl
* 取消称重
*/
public synchronized void cancelWeight() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest();
GetWasteFoilWeightResponse getWasteFoilWeightResponse;
getWasteFoilWeightRequest.setDevice_code(device_code);
@@ -232,32 +237,39 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl
getWasteFoilWeightRequest.setCurrentWeight(String.valueOf(weight));
getWasteFoilWeightRequest.setWeightGap(String.valueOf(gap_weight));
getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest);
if (getWasteFoilWeightResponse.getstatus()==200){
if (getWasteFoilWeightResponse.getstatus() == 200) {
feedbackSucess = true;
message = "取消称重成功...";
}else {
} else {
feedbackSucess = false;
message = "取消称重失败";
}
}
}
/**
* 申请任务
*/
public synchronized void applyTask() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest();
GetWasteFoilWeightResponse getWasteFoilWeightResponse;
getWasteFoilWeightRequest.setDevice_code(device_code);
getWasteFoilWeightRequest.setType("4");
getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest);
if (getWasteFoilWeightResponse.getstatus()==200){
if (getWasteFoilWeightResponse.getstatus() == 200) {
feedbackSucess = true;
message = "申请任务成功...";
}else {
} else {
feedbackSucess = false;
message = "申请任务失败";
}
}
}

View File

@@ -264,7 +264,7 @@ public class OnlineUserService {
String tokenValue = StpUtil.getTokenValue();
SaCookieConfig cfg = SaManager.getConfig().getCookie();
SaCookie cookie = new SaCookie()
.setName(StpUtil.getTokenValue())
.setName("Authorization")
.setValue(tokenValue)
.setMaxAge(-1)
.setDomain(cfg.getDomain())