opt:更新交互接口

This commit is contained in:
2026-03-11 16:43:56 +08:00
parent 69558bcdc3
commit 4899ca3251
11 changed files with 374 additions and 92 deletions

View File

@@ -869,6 +869,80 @@ public class ConveyorBarcodeDeviceDriver extends AbstractOpcDeviceDriver impleme
}
/**
* 升降输送机位申请叫空托盘
*
* @param
*/
public synchronized boolean lifter_conveyor_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()));
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("lifter_conveyor_apply_put_empty_vehicle") + "lifter_conveyor_apply_put_empty_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command",200);
this.writing(map);
this.setRequireSucess(true);
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command",400);
this.writing(map);
message = RequestMethodEnum.getName("lifter_conveyor_apply_put_empty_vehicle") + "lifter_conveyor_apply_put_empty_vehicle 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("lifter_conveyor_apply_put_empty_vehicle") + "lifter_conveyor_apply_put_empty_vehicle 设备有货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
/**
* 升降机申请出空托盘
*
* @param
*/
public synchronized boolean lifter_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()));
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("lifter_apply_put_empty_vehicle") + "lifter_apply_put_empty_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command",200);
this.writing(map);
this.setRequireSucess(true);
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command",400);
this.writing(map);
message = RequestMethodEnum.getName("lifter_apply_put_empty_vehicle") + "lifter_apply_put_empty_vehicle 接口请求失败" + resp.getMessage();;
}
return true;
} else {
message = RequestMethodEnum.getName("lifter_apply_put_empty_vehicle") + "lifter_apply_put_empty_vehicle 设备有货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
// /**
// * 申请贴标
// */

View File

@@ -16,6 +16,7 @@ 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.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService;
@@ -24,6 +25,7 @@ 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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
@@ -31,6 +33,7 @@ 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 java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -61,6 +64,8 @@ public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl");
LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
@Autowired
private DeviceAppService deviceAppService;
//放货准备锁
String putReadyLock = null;
@@ -71,7 +76,7 @@ public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements
int error = 0;
int last_mode = 0;
int last_error = 0;
int to_command=0;
int to_command = 0;
Boolean isonline = true;
int hasGoods = 0;
String message = null;
@@ -236,39 +241,7 @@ public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements
}
/**
* 叫料
*
* @return
*/
public synchronized boolean pressRequestMaterial() {
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.setOrder_code(String.valueOf(order_No));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplyTaskResponse.class);
message = RequestMethodEnum.getName("pressRequestMaterial") + "pressRequestMaterial 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "请求参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 200);
this.writing(map);
this.setRequireSucess(true);
message = RequestMethodEnum.getName("pressRequestMaterial") + "pressRequestMaterial 接口请求成功" + resp.getMessage();
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp)));
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 400);
this.writing(map);
message = RequestMethodEnum.getName("pressRequestMaterial") + "pressRequestMaterial 接口请求失败" + resp.getMessage();
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp)));
}
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp)));
return true;
}
public boolean exe_business() {
@@ -415,5 +388,111 @@ public class LnshCrusherDeviceDriver extends AbstractOpcDeviceDriver implements
}
/**
* 申请补空料盅托盘
*
* @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()));
request.setVehicle_code(String.valueOf(code));
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) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 200);
this.writing(map);
this.setRequireSucess(true);
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 400);
this.writing(map);
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_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()));
request.setVehicle_code(String.valueOf(code));
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_take_full_vehicle() {
if (move > 0 && code > 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()));
request.setVehicle_code(String.valueOf(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)) {
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) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 200);
this.writing(map);
this.setRequireSucess(true);
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求成功" + resp.getMessage();
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp)));
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 400);
this.writing(map);
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求失败" + resp.getMessage();
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp)));
}
return true;
} else if (move == 0) {
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
} else if (code <= 0) {
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备条码不正确未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
}
return false;
}
}

View File

@@ -429,7 +429,64 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
}
}
/**
* 申请取走满料盅托盘
*
* @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()));
request.setWeight(String.valueOf(weight));
request.setVehicle_code(String.valueOf(barcode));
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_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()));
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_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 200);
this.writing(map);
this.setRequireSucess(true);
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 400);
this.writing(map);
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;
}
}
}

View File

@@ -62,24 +62,31 @@ public class ItemProtocol {
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getStatus() {
return this.getOpcIntegerValue(item_status);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getOpenTime() {
return this.getOpcIntegerValue(item_open_time);
public String getOpenTime() {
return this.getOpcStringValue(item_open_time);
}
public int getStandbyTime() {
return this.getOpcIntegerValue(item_standby_time);
}
public int getProductionTime() {
return this.getOpcIntegerValue(item_production_time);
}
public int getErrorTime() {
return this.getOpcIntegerValue(item_error_time);
}

View File

@@ -1,12 +1,11 @@
package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
@@ -16,10 +15,7 @@ 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.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse;
import org.nl.acs.ext.wms.data.Resp;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
import org.nl.acs.ext.wms.data.AcsToWmsData.grab.GrabRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
@@ -32,7 +28,6 @@ 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.system.domain.Param;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
@@ -102,7 +97,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
String device_code;
int status = 0;
int open_time = 0;
String open_time = "0";
int standby_time = 0;
int production_time = 0;
int error_time = 0;
@@ -125,7 +120,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
int error_cause = 0;
int last_status = 0;
int last_open_time = 0;
String last_open_time = "0";
int last_standby_time = 0;
int last_production_time = 0;
int last_error_time = 0;

View File

@@ -46,36 +46,47 @@ public class ItemProtocol {
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getStatus() {
return this.getOpcIntegerValue(item_status);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getOpenTime() {
return this.getOpcIntegerValue(item_open_time);
public String getOpenTime() {
return this.getOpcStringValue(item_open_time);
}
public int getStandbyTime() {
return this.getOpcIntegerValue(item_standby_time);
}
public int getProductionTime() {
return this.getOpcIntegerValue(item_production_time);
}
public int getErrorTime() {
return this.getOpcIntegerValue(item_error_time);
}
public int getMaterial() {
return this.getOpcIntegerValue(item_material);
public String getMaterial() {
return this.getOpcStringValue(item_material);
}
public int getQty() {
return this.getOpcIntegerValue(item_qty);
}
public int getWeight() {
return this.getOpcIntegerValue(item_weight);
}
public int getQualified() {
return this.getOpcIntegerValue(item_qualified);
}

View File

@@ -2,14 +2,12 @@ package org.nl.acs.device_driver.lnsh.lnsh_press;
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;
import lombok.Setter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.jinterop.dcom.common.JIException;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
@@ -20,7 +18,6 @@ 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;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse;
import org.nl.acs.ext.wms.data.Resp;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
@@ -28,16 +25,12 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
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.AddFailedException;
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;
@@ -98,11 +91,11 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
String device_code;
int status = 0;
int open_time = 0;
String open_time = "0";
int standby_time = 0;
int production_time = 0;
int error_time = 0;
int material = 0;
String material = "0";
int qty = 0;
int weight = 0;
int qualified = 0;
@@ -110,11 +103,11 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
String order_No = "0";
int last_status = 0;
int last_open_time = 0;
String last_open_time = "0";
int last_standby_time = 0;
int last_production_time = 0;
int last_error_time = 0;
int last_material = 0;
String last_material = "0";
int last_qty = 0;
int last_weight = 0;
int last_qualified = 0;

View File

@@ -8,12 +8,10 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jinterop.dcom.common.JIException;
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.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
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;
@@ -35,15 +33,11 @@ import org.nl.modules.lucene.service.LuceneExecuteLogService;
import org.nl.modules.lucene.service.dto.LuceneLogDto;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.AddFailedException;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.lang.reflect.Field;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 和兴RGV双工位
@@ -116,8 +110,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
int task2 = 0;
int last_task2 = 0;
//开机时间
int open_time = 0;
int last_open_time = 0;
String open_time = "0";
String last_open_time = "0";
//待机时间
int standby_time = 0;
int last_standby_time = 0;
@@ -209,6 +203,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
to_command2 = this.itemProtocol.getTo_command2();
to_oneset2 = this.itemProtocol.getTo_onset2();
to_target2 = this.itemProtocol.getTo_target2();
open_time = this.itemProtocol.getOpen_time();
if (mode != last_mode) {
if (mode == 2) {
inst = null;

View File

@@ -30,10 +30,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 和兴-钢托盘拆盘位
@@ -219,6 +216,7 @@ public class SplitSteelTraySiteDeviceDriver extends AbstractOpcDeviceDriver impl
}
public synchronized boolean apply_labelling() {
if (move == 1) {
ApplyTaskRequest request = new ApplyTaskRequest();
@@ -263,6 +261,46 @@ public class SplitSteelTraySiteDeviceDriver extends AbstractOpcDeviceDriver impl
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "to_command 写入 " + command));
}
/**
* 多个信号一起下发电气
*
* @param map
*/
public void writing(Map<String, Object> map) {
LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
try {
this.checkcontrol(itemMap);
} catch (Exception e) {
e.printStackTrace();
try {
this.checkcontrol(itemMap);
} catch (Exception e1) {
e1.printStackTrace();
}
}
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
lucene.deviceExecuteLog(new LuceneLogDto(this.getDeviceCode(), "下发多个电气信号:" + itemMap));
}
}
/**
* 抽取统一下发电气信号前缀
*
* @return
*/
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
@@ -358,6 +396,42 @@ public class SplitSteelTraySiteDeviceDriver extends AbstractOpcDeviceDriver impl
return jo;
}
/**
* 请求数据(工单信息,各自冷却窑的数量)
*
* @param
*/
public synchronized boolean get_order_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_order_info") + "get_order_info 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 200);
this.writing(map);
this.setRequireSucess(true);
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 400);
this.writing(map);
message = RequestMethodEnum.getName("get_order_info") + "get_order_info 接口请求失败" + resp.getMessage();
;
}
return true;
} else {
message = RequestMethodEnum.getName("get_order_info") + "get_order_info 设备无货未请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
return false;
}
}
@Override
public void setDeviceStatus(JSONObject data) {

View File

@@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.AgvUtil;
@@ -58,8 +57,8 @@ import org.nl.modules.wql.exception.WDKException;
import org.nl.modules.wql.util.SpringContextHolder;
import org.slf4j.MDC;
import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
@@ -341,6 +340,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
}
//lms下发工单
@Override
public JSONObject createOrder(JSONObject param) throws Exception {
try{
@@ -460,32 +460,29 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
errArr.add(json);
continue;
}
//压机下发工单信息
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_order_No", order_code);
map.put("to_qty", qty);
map.put("to_material_code", material_code);
map.put("to_product_code", product_code);
map.put("to_AlongSide", AlongSide);
map.put("to_BshortSide", BshortSide);
map.put("to_Htrapezoidal", Htrapezoidal);
map.put("to_Wthickness", Wthickness);
map.put("to_brick_code", brick_code);
map.put("to_formula", formula);
map.put("to_size_error", size_error);
map.put("to_single_weight", single_weight);
map.put("to_drawing_address", drawing_address);
map.put("to_standard_weight", standard_weight);
map.put("to_detection_error", detection_error);
map.put("to_standard_size_height1", standard_size_height1);
map.put("to_standard_size_height2", standard_size_height2);
map.put("to_standard_size_height3", standard_size_height3);
map.put("to_standard_size_height4", standard_size_height4);
map.put("to_reduce_volume",reduce_volume);
map.put("to_command",100);
// map.put("to_size_error", size_error);
// map.put("to_single_weight", single_weight);
// map.put("to_drawing_address", drawing_address);
// map.put("to_standard_weight", standard_weight);
// map.put("to_detection_error", detection_error);
// map.put("to_standard_size_height1", standard_size_height1);
// map.put("to_standard_size_height2", standard_size_height2);
// map.put("to_standard_size_height3", standard_size_height3);
// map.put("to_standard_size_height4", standard_size_height4);
// map.put("to_reduce_volume",reduce_volume);
map.put("to_command", 100);
// delayed(device_code,map);
lnshPressDeviceDriver.writing(map);
Date date1=new Date();
log.info("压机下发工单的当前时间是{}",date1);
Date date1 = new Date();
log.info("压机下发工单的当前时间是{}", date1);
is_flag = true;
}
if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
@@ -514,7 +511,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
errArr.add(json);
continue;
}
String formula1=brick_code+"~"+formula;
String formula1 = brick_code + "~" + formula;
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_order_No", order_code);
map.put("to_material", material_code);

View File

@@ -108,7 +108,7 @@ https://juejin.cn/post/6844903775631572999
<appender-ref ref="asyncFileAppender"/>
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.nl.modules.wql" level="debug" additivity="true">
<logger name="org.nl.modules.wql" level="ERROR" additivity="true">
<appender-ref ref="asyncFileAppender"/>
<appender-ref ref="CONSOLE"/>
</logger>