This commit is contained in:
USER-20220102CG\noblelift
2023-09-01 17:52:55 +08:00
parent 04d1ae0527
commit 5c02ba12aa
11 changed files with 147 additions and 87 deletions

View File

@@ -812,9 +812,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
conveyorBarcodeDeviceDriver = (ConveyorBarcodeDeviceDriver) device.getDeviceDriver();
conveyorBarcodeDeviceDriver.writing(4);
if (conveyorBarcodeDeviceDriver.getMode() != 0
&& conveyorBarcodeDeviceDriver.getMove() == 0
&& (conveyorBarcodeDeviceDriver.getIo_action() == 1 || conveyorBarcodeDeviceDriver.getIo_action() == 3)
&& (conveyorBarcodeDeviceDriver.getAction() == 2 || conveyorBarcodeDeviceDriver.getAction() == 3)) {
&& conveyorBarcodeDeviceDriver.getMove() == 0){
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
@@ -828,12 +826,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (conveyorBarcodeDeviceDriver.getMove() != 0) {
message += "站点有货,";
}
if (conveyorBarcodeDeviceDriver.getIo_action() != 1 && conveyorBarcodeDeviceDriver.getIo_action() != 3) {
message += "站点不允许进入,";
}
if (conveyorBarcodeDeviceDriver.getAction() != 2 && conveyorBarcodeDeviceDriver.getAction() != 3) {
message += "站点不允许放货,";
}
}
message += "不允许AGV放货。";
conveyorBarcodeDeviceDriver.setMessage(message);
@@ -1054,8 +1046,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof ConveyorBarcodeDeviceDriver) {
conveyorBarcodeDeviceDriver = (ConveyorBarcodeDeviceDriver) device.getDeviceDriver();
if (conveyorBarcodeDeviceDriver.getMode() != 0
&& conveyorBarcodeDeviceDriver.getMove() != 0
&& (conveyorBarcodeDeviceDriver.getIo_action() == 2 || conveyorBarcodeDeviceDriver.getIo_action() == 3)) {
&& conveyorBarcodeDeviceDriver.getMove() != 0){
inst.setExecute_status("6");
instructionService.update(inst);
conveyorBarcodeDeviceDriver.writing(5);
@@ -1063,7 +1054,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
TaskDto task=taskService.findByCode(inst.getTask_code());
String material=task.getDirection();
conveyorBarcodeDeviceDriver.setMessage("");
conveyorBarcodeDeviceDriver.setMaterial(material);ss
conveyorBarcodeDeviceDriver.setMaterial(material);
flag = true;
} else {
String message = "";

View File

@@ -69,6 +69,15 @@ public interface OpcDeviceDriver extends DeviceDriver {
return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
default Float getFloatValue(String protocol) {
return (Float) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
default Double getDoubleValue(String protocol) {
return (Double) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
default Object getValue(String protocol) {
return this.getOpcValueAccessor().getValue(this.getItem(protocol));
}

View File

@@ -18,6 +18,8 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver;
import org.nl.acs.ext.wms.data.AcsToWmsData.applySignalStaus.ApplySignalStatusRequest;
import org.nl.acs.ext.wms.data.AcsToWmsData.applySignalStaus.ApplySignalStatusResponse;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse;
import org.nl.acs.ext.wms.data.Resp;
@@ -152,6 +154,22 @@ public class ConveyorBarcodeDeviceDriver extends AbstractOpcDeviceDriver impleme
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + " -> " + move);
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
ApplySignalStatusRequest request = new ApplySignalStatusRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(RequestMethodEnum.real_time_set_point.getCode());
request.setRequest_medthod_name(RequestMethodEnum.real_time_set_point.getName());
request.setMove(String.valueOf(move));
ApplySignalStatusResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplySignalStatusResponse.class);
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求成功" + resp.getMessage();;
} else {
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();;
}
}
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
@@ -162,6 +180,22 @@ public class ConveyorBarcodeDeviceDriver extends AbstractOpcDeviceDriver impleme
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + " -> " + task);
}
if (action != last_action) {
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
ApplySignalStatusRequest request = new ApplySignalStatusRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(RequestMethodEnum.real_time_set_point.getCode());
request.setRequest_medthod_name(RequestMethodEnum.real_time_set_point.getName());
request.setAction(String.valueOf(action));
ApplySignalStatusResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplySignalStatusResponse.class);
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求成功" + resp.getMessage();;
} else {
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();;
}
}
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + " -> " + action);
}

View File

@@ -43,6 +43,8 @@ public class ItemProtocol {
public static String item_flatness = "flatness";
public static String item_unqualified_qty = "unqualified_qty";
public static String item_weight = "weight";
public static String item_to_command = "to_command";
public static String item_to_error = "to_error";
public static String item_to_order_No = "to_order_No";
@@ -129,44 +131,48 @@ public class ItemProtocol {
return this.getOpcStringValue(item_grinding_number);
}
public int getHeight1() {
return this.getOpcIntegerValue(item_height1);
public float getHeight1() {
return this.getOpcFloatValue(item_height1);
}
public int getHeight2() {
return this.getOpcIntegerValue(item_height2);
public float getHeight2() {
return this.getOpcFloatValue(item_height2);
}
public int getHeight3() {
return this.getOpcIntegerValue(item_height3);
public float getHeight3() {
return this.getOpcFloatValue(item_height3);
}
public int getHeight4() {
return this.getOpcIntegerValue(item_height4);
public float getHeight4() {
return this.getOpcFloatValue(item_height4);
}
public int getWidth1() {
return this.getOpcIntegerValue(item_width1);
public float getWidth1() {
return this.getOpcFloatValue(item_width1);
}
public int getWidth2() {
return this.getOpcIntegerValue(item_width2);
public float getWidth2() {
return this.getOpcFloatValue(item_width2);
}
public int getLen() {
return this.getOpcIntegerValue(item_len);
public float getLen() {
return this.getOpcFloatValue(item_len);
}
public int getVolume() {
return this.getOpcIntegerValue(item_volume);
public float getVolume() {
return this.getOpcFloatValue(item_volume);
}
public int getFlatness() {
return this.getOpcIntegerValue(item_flatness);
public float getFlatness() {
return this.getOpcFloatValue(item_flatness);
}
public int getUnqualified_qty() {
return this.getOpcIntegerValue(item_unqualified_qty);
public float getUnqualified_qty() {
return this.getOpcFloatValue(item_unqualified_qty);
}
public Float getWeight() {
return this.getOpcFloatValue(item_weight);
}
Boolean isonline;
@@ -194,6 +200,16 @@ public class ItemProtocol {
return "0";
}
public Float getOpcFloatValue(String protocol) {
Float value = this.driver.getFloatValue(protocol);
if (ObjectUtil.isEmpty(value)) {
// log.error("读取错误!");
} else {
return value;
}
return 0f;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB112.B0"));
@@ -220,6 +236,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_volume, "体积", "DB112.REAL206"));
list.add(new ItemDto(item_flatness, "平面度", "DB112.REAL210"));
list.add(new ItemDto(item_unqualified_qty, "缺陷个数", "DB112.REAL214"));
list.add(new ItemDto(item_weight, "重量", "DB112.REAL218"));
return list;
}

View File

@@ -71,7 +71,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
int mode = 0;
int move = 0;
int weight = 0;
Float weight = 0f;
String material_code="";
int error = 0;
int action = 0;
@@ -106,16 +106,16 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
int last_status = 0;
String last_laser_marking_code="";
String last_grinding_number="";
int last_height1=0;
int last_height2=0;
int last_height3=0;
int last_height4=0;
int last_width1=0;
int last_width2=0;
int last_len=0;
int last_volume=0;
int last_flatness=0;
int last_unqualified_qty=0;
Float last_height1=0f;
Float last_height2=0f;
Float last_height3=0f;
Float last_height4=0f;
Float last_width1=0f;
Float last_width2=0f;
Float last_len=0f;
Float last_volume=0f;
Float last_flatness=0f;
Float last_unqualified_qty=0f;
//开机时间
String open_time = "0";
String last_open_time = "0";
@@ -137,17 +137,17 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
int last_is_qualified=0;
String laser_marking_code ="";
String grinding_number ="";
int height1 = 0;
int height2 = 0;
int height3 = 0;
int height4 = 0;
int width1 = 0;
int width2 = 0;
int len = 0;
int volume = 0;
int flatness =0;
Float height1 = 0f;
Float height2 = 0f;
Float height3 = 0f;
Float height4 = 0f;
Float width1 = 0f;
Float width2 = 0f;
Float len = 0f;
Float volume = 0f;
Float flatness =0f;
int unqualified_qty=0;
Float unqualified_qty=0f;
@Override
@@ -185,7 +185,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
volume = this.itemProtocol.getVolume();
flatness = this.itemProtocol.getFlatness();
unqualified_qty = this.itemProtocol.getUnqualified_qty();
weight = this.itemProtocol.getWeight();
if (mode != last_mode) {
this.setRequireSucess(false);
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
@@ -386,6 +386,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
request.setHeight4(String.valueOf(height4));
request.setWidth1(String.valueOf(width1));
request.setWidth2(String.valueOf(width2));
request.setWeight(String.valueOf(weight));
request.setLen(String.valueOf(len));
request.setVolume(String.valueOf(volume));
request.setFlatness(String.valueOf(flatness));

View File

@@ -799,7 +799,6 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
request.setWeight(String.valueOf(weight));
request.setVehicle_code(String.valueOf(barcode));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
@@ -835,30 +834,37 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
request.setWeight(String.valueOf(weight));
request.setVehicle_code(String.valueOf(barcode));
List<ApplyDeviceDto> listDto = new ArrayList<>();
if(ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))){
Device device = deviceAppService.findDeviceByCode(this.getDevice().getExtraValue().get("link_device_code").toString());
if(ObjectUtil.isNotEmpty(device)){
LnshMixingMillDeviceDriver lnshMixingMillDeviceDriver;
if(device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver){
lnshMixingMillDeviceDriver = (LnshMixingMillDeviceDriver) device.getDeviceDriver();
request.setMix_mum(String.valueOf(lnshMixingMillDeviceDriver.getMix_num()));
}
}
List<String> getDeviceCodeList = this.getExtraDeviceCodes("link_device_code");
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
for (int i = 0; i < getDeviceCodeList.size(); i++) {
ApplyDeviceDto applyDeviceDto=new ApplyDeviceDto();
Device getDevice = deviceAppService.findDeviceByCode(getDeviceCodeList.get(i).toString());
if(getDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver){
lnshPalletizingManipulatorSiteDeviceDriver=(LnshPalletizingManipulatorSiteDeviceDriver) getDevice.getDeviceDriver();
applyDeviceDto.setQty(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getEncoder_qty()));
applyDeviceDto.setDevice_code(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code()));
applyDeviceDto.setVehicle_code(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getBarcode()));
}
listDto.add(applyDeviceDto);
request.setList(listDto);
}
}
// if(ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))){
// Device device = deviceAppService.findDeviceByCode(this.getDevice().getExtraValue().get("link_device_code").toString());
// if(ObjectUtil.isNotEmpty(device)){
// //混碾满料请求给lms碾次
// LnshMixingMillDeviceDriver lnshMixingMillDeviceDriver;
// if(device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver){
// lnshMixingMillDeviceDriver = (LnshMixingMillDeviceDriver) device.getDeviceDriver();
// request.setMix_mum(String.valueOf(lnshMixingMillDeviceDriver.getMix_num()));
// }
// }
//
// //包装下料位木托盘满托请求
// List<String> getDeviceCodeList = this.getExtraDeviceCodes("link_device_code");
// LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
// for (int i = 0; i < getDeviceCodeList.size(); i++) {
// ApplyDeviceDto applyDeviceDto=new ApplyDeviceDto();
// Device getDevice = deviceAppService.findDeviceByCode(getDeviceCodeList.get(i).toString());
// if(getDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver){
// lnshPalletizingManipulatorSiteDeviceDriver=(LnshPalletizingManipulatorSiteDeviceDriver) getDevice.getDeviceDriver();
// applyDeviceDto.setQty(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getEncoder_qty()));
// applyDeviceDto.setDevice_code(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code()));
// applyDeviceDto.setVehicle_code(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getBarcode()));
// }
// listDto.add(applyDeviceDto);
// request.setList(listDto);
// }
// }
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));

View File

@@ -133,7 +133,6 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
@@ -166,7 +165,6 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
if (resp.getCode() == 200) {
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求成功" + resp.getMessage();;
} else {
this.writing(400);
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();;
}
}
@@ -195,7 +193,6 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
if (resp.getCode() == 200) {
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求成功" + resp.getMessage();;
} else {
this.writing(400);
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();;
}
}

View File

@@ -86,4 +86,8 @@ public class GrabRequest extends BaseRequest {
*/
private String unqualified_qty;
/**
* 重量
*/
private String weight;
}

View File

@@ -259,6 +259,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
resp.setCode(200);
} else {
resp.setCode(400);
resp.setErrArr(errArr);
}
log.info("createFromWms - 返回参数 {}", resultJson.toString());