rev 优化

This commit is contained in:
USER-20220102CG\noblelift
2023-08-10 18:22:33 +08:00
parent 455a51d3cb
commit e78a3c35fe
17 changed files with 339 additions and 410 deletions

View File

@@ -36,13 +36,15 @@ public enum RequestMethodEnum {
apply_one_grab(13, "apply_one_grab", "单次放置完成","0"),
real_time_set_point(14, "real_time_set_point", "反馈光电状态","1"),
real_time_set_point(14, "real_time_set_point", "反馈信号状态","1"),
feedback_task_status(15, "feedback_task_status", "反馈任务状态","1"),
feedback_device_status(16, "feedback_device_status", "反馈设备状态","1"),
apply_feedback_weight(16, "apply_feedback_weight", "反馈压机残留重量","0");
apply_feedback_weight(17, "apply_feedback_weight", "反馈压机残留重量","0"),
apply_get_put_station(18, "apply_get_put_station", "反馈当前抓取放置位","0");
//驱动索引

View File

@@ -11,9 +11,12 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RequestMethodEnum;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
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.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
@@ -22,6 +25,8 @@ import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.lucene.service.LuceneExecuteLogService;
import org.nl.modules.lucene.service.dto.LuceneLogDto;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +48,8 @@ import java.util.Map;
public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@@ -137,15 +144,23 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + " -> " + task);
}
if (container_type != last_container_type) {
this.setRequireSucess(false);
logServer.deviceItemValue(this.device_code, "container_type", String.valueOf(container_type));
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_type" + last_container_type + " -> " + container_type);
}
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));
request.setVehicle_type(String.valueOf(container_type));
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 ("true".equals(this.device.getExtraValue().get("inspect_in_stocck"))) {
if (!requireSucess) {
if (this.feedbackVehicleType(String.valueOf(container_type))) {
this.setRequireSucess(true);
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();;
}
}
}
@@ -170,19 +185,6 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
message = "";
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
return;
case 2:
break;
case 4:
if (!requireSucess) {
getVehicle_code();
}
break;
}
}
last_mode = mode;
@@ -235,30 +237,6 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
}
/**
* 获取托盘号
*
* @param
*/
public synchronized boolean getVehicle_code() {
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 false;
} else {
this.instruction_require_time = date;
JSONObject jo = acsToWmsService.getVehicleCode(this.device_code);
if (jo.getInteger("status") == 200) {
String vehicle_code = jo.getString("vehicle_code");
this.writing("to_barcode", vehicle_code);
this.writing(200);
requireSucess = true;
}
return true;
}
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
server.disconnect();

View File

@@ -2,7 +2,6 @@ package org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
@@ -17,24 +16,26 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.StandardRequestMethod;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
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.AcsToWmsData.grab_place_station.GrabPlaceStationRequest;
import org.nl.acs.ext.wms.data.AcsToWmsData.grab_place_station.GrabPlaceStationResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.lucene.service.LuceneExecuteLogService;
import org.nl.modules.lucene.service.dto.LuceneLogDto;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -66,6 +67,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl");
DeviceAppService deviceAppService = SpringContextHolder.getBean("deviceAppServiceImpl");
int mode = 0;
int error = 0;
int last_mode = 0;
@@ -132,6 +135,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
int last_Htrapezoidal = 0;
int last_Wthickness = 0;
int grab_station =0;
int last_grab_station = 0;
int place_station =0;
int last_place_station = 0;
int order_qty = 0;
int last_order_qty = 0;
@@ -158,13 +166,13 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
production_time = this.itemProtocol.getProduction_time();
error_time = this.itemProtocol.getError_time();
order_No = this.itemProtocol.getOrder_No();
product_code = this.itemProtocol.getProduct_code();
AlongSide = this.itemProtocol.getAlongSide();
BshortSide = this.itemProtocol.getBshortSide();
Htrapezoidal = this.itemProtocol.getHtrapezoidal();
Wthickness = this.itemProtocol.getWthickness();
grab_station = this.itemProtocol.getGrabStation();
place_station = this.itemProtocol.getPlaceStation();
if (mode != last_mode) {
this.setRequireSucess(false);
logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode));
@@ -234,6 +242,88 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
logServer.deviceItemValue(this.device_code,"Wthickness" ,String.valueOf(Wthickness));
logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness" + last_Wthickness + " -> " + Wthickness);
}
if(grab_station != last_grab_station){
GrabPlaceStationRequest request = new GrabPlaceStationRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(RequestMethodEnum.apply_get_put_station.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_get_put_station.getName());
List<String> getDeviceCodeList = this.getExtraDeviceCodes("link_get_station");
List<String> putDeviceCodeList = this.getExtraDeviceCodes("link_put_station");
request.setGet_station(getDeviceCodeList.get(grab_station));
request.setPut_station(putDeviceCodeList.get(place_station));
Device getDevice = deviceAppService.findDeviceByCode(getDeviceCodeList.get(grab_station).toString());
Device putDevice = deviceAppService.findDeviceByCode(putDeviceCodeList.get(place_station).toString());
if (ObjectUtil.isEmpty(getDevice)) {
throw new Exception("抓取位未找到对应设备:" + getDeviceCodeList.get(grab_station));
}
if (ObjectUtil.isEmpty(putDevice)) {
throw new Exception("放置位找到对应设备:" + putDeviceCodeList.get(grab_station));
}
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
if(getDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver){
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) getDevice.getDeviceDriver();
request.setGet_station_vehicle_code(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getBarcode()));
request.setGet_station_qty(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getEncoder_qty()));
}
if(putDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver){
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) putDevice.getDeviceDriver();
request.setPut_station_vehicle_code(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getBarcode()));
request.setPut_station_qty(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getEncoder_qty()));
}
GrabPlaceStationResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), GrabPlaceStationResponse.class);
message = RequestMethodEnum.getName("apply_get_put_station") + "apply_get_put_station 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
message = RequestMethodEnum.getName("apply_get_put_station") + "apply_get_put_station 接口请求成功" + resp.getMessage();;
} else {
message = RequestMethodEnum.getName("apply_get_put_station") + "apply_get_put_station 接口请求失败" + resp.getMessage();;
}
}
if(place_station != last_place_station){
GrabPlaceStationRequest request = new GrabPlaceStationRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(RequestMethodEnum.apply_get_put_station.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_get_put_station.getName());
List<String> getDeviceCodeList = this.getExtraDeviceCodes("link_get_station");
List<String> putDeviceCodeList = this.getExtraDeviceCodes("link_put_station");
request.setGet_station(getDeviceCodeList.get(grab_station));
request.setPut_station(putDeviceCodeList.get(place_station));
Device getDevice = deviceAppService.findDeviceByCode(getDeviceCodeList.get(grab_station).toString());
Device putDevice = deviceAppService.findDeviceByCode(putDeviceCodeList.get(place_station).toString());
if (ObjectUtil.isEmpty(getDevice)) {
throw new Exception("抓取位未找到对应设备:" + getDeviceCodeList.get(grab_station));
}
if (ObjectUtil.isEmpty(putDevice)) {
throw new Exception("放置位找到对应设备:" + putDeviceCodeList.get(grab_station));
}
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
if(getDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver){
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) getDevice.getDeviceDriver();
request.setGet_station_vehicle_code(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getBarcode()));
request.setGet_station_qty(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getEncoder_qty()));
}
if(putDevice.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver){
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) putDevice.getDeviceDriver();
request.setPut_station_vehicle_code(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getBarcode()));
request.setPut_station_qty(String.valueOf(lnshPalletizingManipulatorSiteDeviceDriver.getEncoder_qty()));
}
GrabPlaceStationResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), GrabPlaceStationResponse.class);
message = RequestMethodEnum.getName("apply_get_put_station") + "apply_get_put_station 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
message = RequestMethodEnum.getName("apply_get_put_station") + "apply_get_put_station 接口请求成功" + resp.getMessage();;
} else {
message = RequestMethodEnum.getName("apply_get_put_station") + "apply_get_put_station 接口请求失败" + resp.getMessage();;
}
}
} catch (Exception var17) {
return;
@@ -287,12 +377,13 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
last_production_time = production_time;
last_error_time = error_time;
last_order_No = order_No;
last_product_code = product_code;
last_AlongSide = AlongSide;
last_BshortSide = BshortSide;
last_Htrapezoidal = Htrapezoidal;
last_Wthickness = Wthickness;
last_grab_station = grab_station;
last_place_station = place_station;
}

View File

@@ -365,312 +365,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
}
}
/**
* 申请补满料盅托盘
*
* @param
*/
public synchronized boolean apply_put_full_vehicle() {
if(move == 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求失败" + resp.getMessage();;
}
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return true;
} else {
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 设备有货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 申请补空料盅托盘
*
* @param
*/
public synchronized boolean apply_put_empty_vehicle() {
if(move == 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 设备有货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 申请取走空料盅托盘
*
* @param
*/
public synchronized boolean apply_take_empty_vehicle() {
if(move == 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
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)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 设备有货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 申请取走满料盅托盘
*
* @param
*/
public synchronized boolean apply_take_full_vehicle() {
if(move > 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
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()));
}
}
}
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)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 申请强制取走满料盅托盘
*
* @param
*/
public synchronized boolean apply_force_take_full_vehicle() {
if(move > 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 申请强制满托入缓存
*
* @param
*/
public synchronized boolean apply_force_take_full_vehicle_in_storage() {
if(move > 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 扫码成功申请
*
* @param
*/
public synchronized boolean barcode_success_apply() {
if(move > 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.writing(resp.getIs_standing_finish(),"1");
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 获取组盘信息
*
* @param
*/
public synchronized boolean get_vehicle_info() {
if(move > 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 强制去包装-不包装
*/
public synchronized boolean force_no_package() {
if(move > 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 申请贴标
*/
public synchronized boolean apply_labelling() {
if(move > 0) {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
public boolean apply_one_grab() {
GrabRequest request = new GrabRequest();
@@ -692,6 +387,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
request.setLen(String.valueOf(len));
request.setVolume(String.valueOf(volume));
request.setFlatness(String.valueOf(flatness));
request.setIs_qualified(String.valueOf(is_qualified));
request.setUnqualified_qty(String.valueOf(unqualified_qty));
message = RequestMethodEnum.getName("apply_one_grab") + "apply_one_grab 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
@@ -708,30 +404,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
return true;
}
/**
* 反馈压机残留重量
*/
public synchronized boolean apply_feedback_weight() {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
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.setMaterial_code(String.valueOf(material_code));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_feedback_weight") + "apply_feedback_weight 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("apply_feedback_weight") + "apply_feedback_weight 接口请求失败" + resp.getMessage();
;
}
return true;
}
/**
* 获取托盘信息

View File

@@ -14,6 +14,7 @@ import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RequestMethodEnum;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.StandardRequestMethod;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
@@ -50,7 +51,7 @@ import java.util.Map;
@Getter
@Setter
@RequiredArgsConstructor
public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -336,36 +337,29 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
}
/**
* 排产单确认
*
* @param
* 反馈压机残留重量
*/
public synchronized boolean enterProduction(JSONObject json) {
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 false;
public synchronized boolean apply_feedback_weight() {
ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code());
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.setOrder_code(String.valueOf(order_No));
request.setMaterial_code(String.valueOf(material));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_feedback_weight") + "apply_feedback_weight 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.instruction_require_time = date;
HttpResponse result = acsToWmsService.enterOrder(json);
if (ObjectUtil.isNotEmpty(result)) {
if (result.getStatus() == HttpStatus.OK.value()) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
// ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
// if (this.mode == 3) {
// dto.setOrder_status("1");
// } else if (this.mode == 4) {
// dto.setOrder_status("2");
// }
// produceshiftorderService.update(dto);
this.writing(200);
this.setRequireSucess(true);
}
}
}
return true;
this.writing(400);
message = RequestMethodEnum.getName("apply_feedback_weight") + "apply_feedback_weight 接口请求失败" + resp.getMessage();
;
}
return true;
}
public boolean exe_business() {

View File

@@ -17,6 +17,8 @@ import org.nl.acs.device_driver.StandardRequestMethod;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
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.ApplyTaskResponse;
import org.nl.acs.ext.wms.data.Resp;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
@@ -151,6 +153,23 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
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 {
this.writing(400);
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));
@@ -163,6 +182,23 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + " -> " + 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 {
this.writing(400);
message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();;
}
}
}
if (io_action != last_ioaction) {
logServer.deviceItemValue(this.device_code, "io_action", String.valueOf(io_action));

View File

@@ -0,0 +1,25 @@
package org.nl.acs.ext.wms.data.AcsToWmsData.applySignalStaus;
import lombok.Data;
import org.nl.acs.ext.wms.data.BaseRequest;
import org.nl.acs.ext.wms.data.PalletizeDto;
@Data
public class ApplySignalStatusRequest extends BaseRequest {
/**
* 光电信号 0无货 1有货
*/
private String move;
/**
* 载具类型
*/
private String vehicle_type;
/**
* 是否允许 0不允许 1允许
*/
private String action;
}

View File

@@ -0,0 +1,10 @@
package org.nl.acs.ext.wms.data.AcsToWmsData.applySignalStaus;
import lombok.Data;
import org.nl.acs.ext.wms.data.BaseResponse;
@Data
public class ApplySignalStatusResponse extends BaseResponse {
}

View File

@@ -4,6 +4,9 @@ package org.nl.acs.ext.wms.data.AcsToWmsData.grab;
import lombok.Data;
import org.nl.acs.ext.wms.data.BaseRequest;
/**
* 反馈单次抓取
*/
@Data
public class GrabRequest extends BaseRequest {
@@ -17,6 +20,11 @@ public class GrabRequest extends BaseRequest {
*/
private String put_station;
/**
* 是否合格
*/
private String is_qualified;
/**
* 激光标刻码
*/

View File

@@ -0,0 +1,45 @@
package org.nl.acs.ext.wms.data.AcsToWmsData.grab_place_station;
import lombok.Data;
import org.nl.acs.ext.wms.data.BaseRequest;
/**
* 当前抓取放置工位切换
*/
@Data
public class GrabPlaceStationRequest extends BaseRequest {
/**
* 抓取位
*/
private String get_station;
/**
* 放置位
*/
private String put_station;
/**
* 取货点位载具号
*/
private String get_station_vehicle_code;
/**
* 放货点位载具号
*/
private String put_station_vehicle_code;
/**
* 取货点当前数量
*/
private String get_station_qty;
/**
* 放货点当前数量
*/
private String put_station_qty;
}

View File

@@ -0,0 +1,10 @@
package org.nl.acs.ext.wms.data.AcsToWmsData.grab_place_station;
import org.nl.acs.ext.wms.data.BaseResponse;
public class GrabPlaceStationResponse extends BaseResponse {
}

View File

@@ -118,7 +118,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String task_type = task.getString("task_type");
String remark = task.getString("remark");
String params = task.getString("params");
// 双工RGV任务 后工位任务
String start_point_code2 = task.getString("start_device_code2");
String next_point_code2 = task.getString("next_device_code2");
String start_device_code2 = task.getString("start_device_code2");
String next_device_code2 = task.getString("next_device_code2");
if (start_point_code.indexOf("-") > 0) {
String str[] = start_point_code.split("-");
start_device_code = str[0];
@@ -160,6 +164,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("next_parent_code", next_parent_code);
jo.put("start_device_code", start_device_code);
jo.put("next_device_code", next_device_code);
jo.put("start_point_code2", start_point_code2);
jo.put("next_point_code2", next_point_code2);
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("priority", priority);
jo.put("vehicle_code", vehicle_code);
jo.put("vehicle_type", vehicle_type);

View File

@@ -1,5 +1,6 @@
package org.nl.acs.opc;
import cn.hutool.core.util.ObjectUtil;
import eu.bitwalker.useragentutils.DeviceType;
import lombok.Data;
@@ -71,7 +72,11 @@ public class DeviceManageDto {
while (var2.hasNext()) {
DeviceExtraManageDto dto = (DeviceExtraManageDto) var2.next();
// result.put(dto.getExtra_code(), dto.parseName());
result.put(dto.getExtra_code(), dto.getExtra_name());
if(ObjectUtil.isEmpty( dto.getExtra_value())){
result.put(dto.getExtra_code(), dto.getExtra_name());
} else {
result.put(dto.getExtra_code(), dto.parseName());
}
}
this.extra_map = result;