This commit is contained in:
USER-20220102CG\noblelift
2023-09-03 10:55:53 +08:00
parent ecbb66cbe8
commit a26ee63253
8 changed files with 94 additions and 74 deletions

View File

@@ -870,7 +870,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
} else {
//空盘堆叠驱动 需要按照数量生成
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
if (StrUtil.equals(driver_code, "standard_emptypallet_site") && form.containsKey("max_emptypalletnum")) {
if ((StrUtil.equals(driver_code, "standard_emptypallet_site") || StrUtil.equals(driver_code, "lnsh_fold_disc_site") ) && form.containsKey("max_emptypalletnum")) {
int num = form.getInteger("max_emptypalletnum");
for (int i = 1; i < num + 1; i++) {
JSONObject json = wo.query("storage_code ='" + device_code + "." + i + "'").uniqueResult(0);
@@ -882,7 +882,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
celldto.setX("0");
celldto.setY("0");
celldto.setZ("0");
celldto.setAddress(Integer.parseInt(CodeUtil.getNewCode("NDCADDRESS_NO")));
celldto.setAddress(0);
celldto.setCreate_by("init");
celldto.setCreate_time(SecurityUtils.getCurrentUsername());
wo.insert((JSONObject) JSONObject.toJSON(celldto));
@@ -898,7 +898,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
celldto.setX("0");
celldto.setY("0");
celldto.setZ("0");
celldto.setAddress(Integer.parseInt(CodeUtil.getNewCode("NDCADDRESS_NO")));
celldto.setAddress(0);
celldto.setCreate_by("init");
celldto.setCreate_time(SecurityUtils.getCurrentUsername());
wo.insert((JSONObject) JSONObject.toJSON(celldto));

View File

@@ -86,6 +86,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
int last_error = 0;
String error_message = "";
boolean flag = false;
String agv_message ="";
private synchronized void setErrorInfo(int error, String error_code, String error_message) {
this.error = error;
this.error_code = error_code;
@@ -208,6 +210,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//校验agv上报站点编号与指令起始点相同
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到编号{}对应的指令", ikey);
agv_message = "未找到编号"+ikey +"对应的指令";
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
return;
}
@@ -241,6 +244,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV取货。";
lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message);
agv_message = lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -274,6 +278,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV取货。";
lnshStationDeviceDriver.setMessage(message);
agv_message = lnshStationDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -305,6 +310,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV取货。";
conveyorPressStationDeviceDriver.setMessage(message);
agv_message = conveyorPressStationDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -332,8 +338,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
conveyorBarcodeDeviceDriver.writing(3);
if (conveyorBarcodeDeviceDriver.getMode() != 0
&& conveyorBarcodeDeviceDriver.getMove() != 0
&& (conveyorBarcodeDeviceDriver.getIo_action() == 3 || conveyorBarcodeDeviceDriver.getIo_action() == 1)
&& (conveyorBarcodeDeviceDriver.getAction() == 3 || conveyorBarcodeDeviceDriver.getAction() == 1)) {
) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
@@ -347,15 +352,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (conveyorBarcodeDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (conveyorBarcodeDeviceDriver.getIo_action() != 3 && conveyorBarcodeDeviceDriver.getIo_action() != 1) {
message += "站点不允许进入,";
}
if (conveyorBarcodeDeviceDriver.getAction() != 3 && conveyorBarcodeDeviceDriver.getAction() != 1) {
message += "站点不允许取货,";
}
}
message += "不允许AGV取货。";
conveyorBarcodeDeviceDriver.setMessage(message);
agv_message = conveyorBarcodeDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -388,6 +388,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
// }
}
message += "不允许AGV取货。";
agv_message = lnshFoldDiscSiteDeviceDriver.getDevice_code() + message;
lnshFoldDiscSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
@@ -476,6 +477,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV取货后离开。";
lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message);
agv_message = lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -506,6 +508,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV取货后离开。";
lnshStationDeviceDriver.setMessage(message);
agv_message = lnshStationDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -536,6 +539,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV取货后离开。";
conveyorPressStationDeviceDriver.setMessage(message);
agv_message = conveyorPressStationDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -559,10 +563,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if(device.getDeviceDriver() instanceof ConveyorBarcodeDeviceDriver){
conveyorBarcodeDeviceDriver = (ConveyorBarcodeDeviceDriver) device.getDeviceDriver();
conveyorBarcodeDeviceDriver.writing(5);
if (conveyorBarcodeDeviceDriver.getMode() != 0
&& conveyorBarcodeDeviceDriver.getMove() != 0
&& (conveyorBarcodeDeviceDriver.getIo_action() == 3 || conveyorBarcodeDeviceDriver.getIo_action() == 2)
) {
if (conveyorBarcodeDeviceDriver.getMode() != 0) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
@@ -582,6 +583,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV取货后离开。";
conveyorBarcodeDeviceDriver.setMessage(message);
agv_message = conveyorBarcodeDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -612,6 +614,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV取货后离开。";
lnshFoldDiscSiteDeviceDriver.setMessage(message);
agv_message = lnshFoldDiscSiteDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -633,22 +636,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(data)) {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase" + phase + "反馈:" + Bytes2HexString(data));
}
if (flag) {
String hasWms = acsConfigService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(inst.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
try {
JSONArray ar = new JSONArray();
JSONObject param = new JSONObject();
param.put("task_code", inst.getTask_code());
param.put("task_status", "4");
ar.add(param);
acsToWmsService.feedbackTaskStatusToWms(ar);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "AGV取货完成离开后反馈上位系统失败");
e.printStackTrace();
}
}
}
// if (flag) {
// String hasWms = acsConfigService.findByCode(AcsConfig.HASWMS).getValue();
// if (!StrUtil.startWith(inst.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
// try {
// JSONArray ar = new JSONArray();
// JSONObject param = new JSONObject();
// param.put("task_code", inst.getTask_code());
// param.put("task_status", "4");
// ar.add(param);
// acsToWmsService.feedbackTaskStatusToWms(ar);
// } catch (Exception e) {
// logServer.deviceExecuteLog(device_code, "", "", "AGV取货完成离开后反馈上位系统失败");
// e.printStackTrace();
// }
// }
// }
if (flag) {
log.info("================允许AGV取货后离开=================");
logServer.deviceExecuteLog(device_code, "", "", "允许AGV取货后离开。");
@@ -721,6 +724,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
message += "不允许AGV放货。";
agv_message = lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code() + message;
lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
@@ -755,6 +759,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV放货。";
lnshStationDeviceDriver.setMessage(message);
agv_message = lnshStationDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -788,6 +793,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV放货。";
conveyorPressStationDeviceDriver.setMessage(message);
agv_message = conveyorPressStationDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -829,6 +835,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV放货。";
conveyorBarcodeDeviceDriver.setMessage(message);
agv_message = conveyorBarcodeDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -863,6 +870,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV放货。";
lnshFoldDiscSiteDeviceDriver.setMessage(message);
agv_message = lnshFoldDiscSiteDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -950,6 +958,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV放货后离开。";
lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message);
agv_message = lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -979,6 +988,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV放货后离开。";
lnshStationDeviceDriver.setMessage(message);
agv_message = lnshStationDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -1023,6 +1033,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV放货后离开。";
conveyorPressStationDeviceDriver.setMessage(message);
agv_message = conveyorPressStationDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
@@ -1064,11 +1075,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (conveyorBarcodeDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (conveyorBarcodeDeviceDriver.getIo_action() != 2 && conveyorBarcodeDeviceDriver.getIo_action() != 3) {
message += "站点不允许离开,";
}
}
message += "不允许AGV放货后离开。";
agv_message = conveyorBarcodeDeviceDriver.getDevice_code() + message;
conveyorBarcodeDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
@@ -1100,6 +1109,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
message += "不允许AGV放货后离开。";
lnshFoldDiscSiteDeviceDriver.setMessage(message);
agv_message = lnshFoldDiscSiteDeviceDriver.getDevice_code() + message;
logServer.deviceExecuteLog(device_code, "", "", message);
}
}

View File

@@ -759,6 +759,7 @@ public class ConveyorBarcodeDeviceDriver extends AbstractOpcDeviceDriver impleme
if (resp.getCode() == 200) {
this.writing(200);
this.writing("to_barcode",String.valueOf(resp.getWeight()));
this.setRequireSucess(true);
} else {
this.writing(400);

View File

@@ -836,7 +836,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
List<ApplyDeviceDto> listDto = new ArrayList<>();
// if(ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))){
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碾次
@@ -847,22 +847,22 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
// }
// }
//
// //包装下料位木托盘满托请求
// 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);
// }
// }
//包装下料位木托盘满托请求
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);

View File

@@ -145,6 +145,9 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
barcode = this.itemProtocol.getBarcode();
if (mode != last_mode) {
if(mode==2){
this.writing(0);
}
this.setRequireSucess(false);
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + " -> " + mode);

View File

@@ -21,5 +21,5 @@ public class ApplyTaskResponse extends BaseResponse {
*/
private String mix_num;
private String weight;
}

View File

@@ -573,18 +573,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
finishAndCreateNextInst(entity);
}
}
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
//变更三色灯状态
if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) {
String lamd_device = device.getExtraValue().get("link_three_lamp").toString();
Device lamddevice = appService.findDeviceByCode(lamd_device);
if (lamddevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lamddevice.getDeviceDriver();
lampThreecolorDeviceDriver.writing(0);
}
}
removeByCodeFromCache(entity.getInstruction_code());
}
@@ -807,15 +795,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
return;
}
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
//变更三色灯状态
if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) {
String lamd_device = device.getExtraValue().get("link_three_lamp").toString();
Device lamddevice = appService.findDeviceByCode(lamd_device);
if (lamddevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lamddevice.getDeviceDriver();
lampThreecolorDeviceDriver.writing(0);
}
}
removeByCodeFromCache(entity.getInstruction_code());
}