数字孪生+bugfix
This commit is contained in:
@@ -26,6 +26,8 @@ public interface ZheDaAgvService {
|
||||
*/
|
||||
public HttpResponse queryAgvInstStatus(String floor);
|
||||
|
||||
public HttpResponse queryAgvDeviceStatus(String floor);
|
||||
|
||||
String process(String jobno, String type, String address, String action, String processingVehicle);
|
||||
|
||||
public HttpResponse markComplete(String code);
|
||||
|
||||
@@ -116,6 +116,31 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
//ZDAGV
|
||||
public HttpResponse queryAgvDeviceStatus(String type) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
String agvurl = "";
|
||||
String agvport = "";
|
||||
|
||||
agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
||||
agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/vehicles";
|
||||
log.info("下发agv查询设备状态请求:{}内容为:{}", agvurl);
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body(String.valueOf(new JSONObject()))//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("查询agv设备数据:" + result.body());
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
//ZDAGV
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic
|
||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site.SiteDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
@@ -73,6 +74,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
int last_electric_qty = 0;
|
||||
int last_status = 0;
|
||||
int last_error = 0;
|
||||
String transportOrder = "";
|
||||
|
||||
@LokiLog(type = LokiLogType.ACS_TO_LMS)
|
||||
public synchronized void processSocket(int[] arr) throws Exception {
|
||||
@@ -115,27 +117,18 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if (arr[18] * 256 + arr[19] == 0) {
|
||||
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
//普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
//货架
|
||||
StandardStorageDeviceDriver standardStorageDeviceDriver;
|
||||
//
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
|
||||
TaskDto task =taskService.findById(inst.getTask_id());
|
||||
int start_height= ObjectUtil.isNotEmpty(task.getStart_height())?Integer.parseInt(task.getStart_height()):0;
|
||||
int next_height= ObjectUtil.isNotEmpty(task.getNext_height())?Integer.parseInt(task.getNext_height()):0;
|
||||
String start_point=task.getStart_point_code();
|
||||
String next_point=task.getNext_point_code();
|
||||
TaskDto task = taskService.findById(inst.getTask_id());
|
||||
|
||||
//分配 车id
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x02) {
|
||||
inst.setCarno(String.valueOf(carno));
|
||||
instructionService.update(inst);
|
||||
transportOrder = inst.getTask_code();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data);
|
||||
|
||||
//到达取货点
|
||||
@@ -220,7 +213,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
data = getData(data, index, inst, task);
|
||||
//到达放货等待点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x06) {
|
||||
} else if (phase == 0x06) {
|
||||
//到达放货点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x07) {
|
||||
@@ -285,12 +278,17 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof SiteDeviceDriver) {
|
||||
SiteDeviceDriver siteDeviceDriver = (SiteDeviceDriver) device.getDeviceDriver();
|
||||
siteDeviceDriver.writing(12);
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
|
||||
transportOrder = "";
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
//到达位置点
|
||||
//(需要WCS反馈)
|
||||
@@ -298,14 +296,29 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
agvaddr_copy = agvaddr;
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x50) {//进入交通灯区域
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x51) {//离开交通灯区域
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x70) {
|
||||
//x坐标
|
||||
x = ikey;
|
||||
} else if (phase == 0x71) {
|
||||
//y坐标
|
||||
y = ikey;
|
||||
} else if (phase == 0x72) {
|
||||
//车辆角度
|
||||
angle = ikey;
|
||||
} else if (phase == 0x73) {
|
||||
//agv电量
|
||||
electric_qty = ikey;
|
||||
} else if (phase == 0x74) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
@@ -318,31 +331,31 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String start_point;
|
||||
int next_height;
|
||||
int start_height;
|
||||
if(!"2".equals(task.getTask_type())) {
|
||||
if (!"2".equals(task.getTask_type())) {
|
||||
BaseRequest request = new BaseRequest();
|
||||
request.setRequestNo(IdUtil.simpleUUID());
|
||||
request.setTaskId(task.getExt_task_id());
|
||||
JSONObject resp = JSONObject.parseObject(acsToWmsService.feedbackState(request));
|
||||
if("200".equals(resp.getString("code"))){
|
||||
start_height=resp.getJSONObject("parameters").getInteger("start_height");
|
||||
next_height=resp.getJSONObject("parameters").getInteger("next_height");
|
||||
start_point=resp.getJSONObject("parameters").getString("start_point");
|
||||
next_point=resp.getJSONObject("parameters").getString("next_point");
|
||||
if ("200".equals(resp.getString("code"))) {
|
||||
start_height = resp.getJSONObject("parameters").getInteger("start_height");
|
||||
next_height = resp.getJSONObject("parameters").getInteger("next_height");
|
||||
start_point = resp.getJSONObject("parameters").getString("start_point");
|
||||
next_point = resp.getJSONObject("parameters").getString("next_point");
|
||||
task.setStart_height(String.valueOf(start_height));
|
||||
task.setNext_height(String.valueOf(next_height));
|
||||
task.setStart_point_code(start_point);
|
||||
task.setStart_device_code(start_point);
|
||||
task.setNext_point_code(next_point);
|
||||
task.setNext_device_code(next_point);
|
||||
int start_address=deviceService.queryAddressBydeviceCode(start_point);
|
||||
int next_address=deviceService.queryAddressBydeviceCode(next_point);
|
||||
int start_address = deviceService.queryAddressBydeviceCode(start_point);
|
||||
int next_address = deviceService.queryAddressBydeviceCode(next_point);
|
||||
taskService.update(task);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, next_address, start_height, next_height);
|
||||
log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(),phase);
|
||||
}else{
|
||||
log.info("指令号:{},phase:{},acs请求wms申请失败", inst.getInstruction_code(),phase);
|
||||
log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(), phase);
|
||||
} else {
|
||||
log.info("指令号:{},phase:{},acs请求wms申请失败", inst.getInstruction_code(), phase);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
return data;
|
||||
|
||||
@@ -123,7 +123,7 @@ public class BaoshijianSiteDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
int flag;
|
||||
|
||||
String devicecode;
|
||||
String device_code;
|
||||
|
||||
int x0 = 0;
|
||||
int last_x0 = 0;
|
||||
@@ -165,8 +165,8 @@ public class BaoshijianSiteDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
public void execute() {
|
||||
String message = null;
|
||||
try {
|
||||
devicecode = this.getDeviceCode();
|
||||
log.info("123:"+devicecode);
|
||||
device_code = this.getDeviceCode();
|
||||
log.info("123:"+device_code);
|
||||
x0 = this.itemProtocol.getX0();
|
||||
x1 = this.itemProtocol.getX1();
|
||||
x2 = this.itemProtocol.getX2();
|
||||
@@ -183,13 +183,13 @@ public class BaoshijianSiteDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
x37 = this.itemProtocol.getX37();
|
||||
|
||||
if (x1 != last_x1 && x1 == 0) {
|
||||
log.info("设备{}反馈收片任务完成", this.devicecode);
|
||||
log.info("设备{}反馈收片任务完成", this.device_code);
|
||||
this.writing("x6", 0);
|
||||
this.writing("x8", 0);
|
||||
} else if (x1 != last_x1 && x1 == 1 &&!in ) {
|
||||
in = false;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String device_code = this.devicecode + "DJW01";
|
||||
String device_code = this.device_code + "DJW01";
|
||||
jsonObject.put("device_code", device_code);
|
||||
jsonObject.put("requestDate", new Date());
|
||||
jsonObject.put("requestNo", IdUtil.simpleUUID());
|
||||
@@ -203,13 +203,13 @@ public class BaoshijianSiteDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
}
|
||||
|
||||
if (x2 != last_x2 && x2 == 0) {
|
||||
log.info("设备{}反馈上空架完成", this.devicecode);
|
||||
log.info("设备{}反馈上空架完成", this.device_code);
|
||||
this.writing("x5", 0);
|
||||
this.writing("x7", 0);
|
||||
} else if (x2 != last_x2 && x2 == 1 && !out) {
|
||||
out = false;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String device_code = this.devicecode + "DJW02";
|
||||
String device_code = this.device_code + "DJW02";
|
||||
jsonObject.put("device_code", device_code);
|
||||
jsonObject.put("requestDate", new Date());
|
||||
jsonObject.put("vehicle_type",2);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
|
||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
int flag;
|
||||
|
||||
String devicecode;
|
||||
String device_code;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
@@ -144,7 +144,7 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
|
||||
public void execute() {
|
||||
String message = null;
|
||||
try {
|
||||
devicecode = this.getDeviceCode();
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getMove();
|
||||
@@ -155,10 +155,10 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
|
||||
if (move != last_move) {
|
||||
this.setRequireSucess(false);
|
||||
//反馈输送线点位状态
|
||||
if (devicecode.startsWith("ZCSSX")) {
|
||||
if (device_code.startsWith("ZCSSX")) {
|
||||
BaseRequest request = new BaseRequest();
|
||||
request.setType("2");
|
||||
request.setDevice_code(devicecode);
|
||||
request.setDevice_code(device_code);
|
||||
request.setState(String.valueOf(move));
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
@@ -393,14 +393,14 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
|
||||
} else {
|
||||
this.time = date;
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setDevice_code(devicecode);
|
||||
request.setDevice_code(device_code);
|
||||
request.setRequest_medthod_code(String.valueOf(type));
|
||||
String resp = acsToWmsService.applyTask(request);
|
||||
JSONObject res_jo = JSONObject.parseObject(resp);
|
||||
if (StrUtil.equals(res_jo.getString("code"), "200")) {
|
||||
this.writing(type);
|
||||
this.setRequireSucess(true);
|
||||
log.info("acs申请任务", this.devicecode, "任务申请成功!");
|
||||
log.info("acs申请任务", this.device_code, "任务申请成功!");
|
||||
}else{
|
||||
this.writing(99);
|
||||
}
|
||||
|
||||
@@ -57,13 +57,17 @@ public class ItemProtocol {
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
try {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -127,7 +127,19 @@ public class SiteStatusDeviceDriver extends AbstractOpcDeviceDriver implements D
|
||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
int flag;
|
||||
|
||||
String devicecode;
|
||||
String device_code;
|
||||
|
||||
int open_time=0;
|
||||
int last_open_time=0;
|
||||
int standby_time=0;
|
||||
int last_standby_time=0;
|
||||
int production_time=0;
|
||||
int last_production_time=0;
|
||||
int error_time=0;
|
||||
int last_error_time=0;
|
||||
int end_time=0;
|
||||
int last_end_time=0;
|
||||
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
@@ -139,8 +151,13 @@ public class SiteStatusDeviceDriver extends AbstractOpcDeviceDriver implements D
|
||||
public void execute() {
|
||||
String message = null;
|
||||
try {
|
||||
devicecode = this.getDeviceCode();
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
open_time =this.itemProtocol.getItem_open_time();
|
||||
standby_time =this.itemProtocol.getItem_standby_time();
|
||||
production_time =this.itemProtocol.getItem_production_time();
|
||||
error_time =this.itemProtocol.getItem_error_time();
|
||||
end_time =this.itemProtocol.getItem_end_time();
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
if(mode==2){
|
||||
@@ -185,7 +202,11 @@ public class SiteStatusDeviceDriver extends AbstractOpcDeviceDriver implements D
|
||||
last_task = task;
|
||||
last_material_type = material_type;
|
||||
last_barcode=barcode;
|
||||
|
||||
open_time=last_open_time;
|
||||
standby_time=last_standby_time;
|
||||
production_time=last_production_time;
|
||||
error_time=last_error_time;
|
||||
end_time=last_end_time;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package org.nl.quartz.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.guhuashi.GuhuashiSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site.SiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site_status.SiteStatusDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.tubanxian.TubanxianSiteDeviceDriver;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自动上报驱动数据
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendDeviceData {
|
||||
@Resource
|
||||
private DeviceAppService deviceAppService;
|
||||
public void run() throws Exception {
|
||||
long startTime = System.currentTimeMillis();
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
List<Device> deviceList = deviceAppService.findAllDevice();
|
||||
for(Device device:deviceList){
|
||||
if (device.getDeviceDriver() instanceof TubanxianSiteDeviceDriver) {
|
||||
JSONObject json = new JSONObject();
|
||||
//todo 待提供字段
|
||||
jsonArray.add(json);
|
||||
}else if(device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
|
||||
JSONObject json = new JSONObject();
|
||||
//todo 待提供字段
|
||||
jsonArray.add(json);
|
||||
}else if(device.getDeviceDriver() instanceof SiteStatusDeviceDriver) {
|
||||
JSONObject json = new JSONObject();
|
||||
//todo 待提供字段
|
||||
jsonArray.add(json);
|
||||
}else if(device.getDeviceDriver() instanceof SiteDeviceDriver) {
|
||||
JSONObject json = new JSONObject();
|
||||
//todo 待提供字段
|
||||
jsonArray.add(json);
|
||||
}else if(device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
JSONObject json = new JSONObject();
|
||||
//todo 待提供字段
|
||||
jsonArray.add(json);
|
||||
}
|
||||
}
|
||||
log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis()-startTime);
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,17 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site.SiteDeviceDriver;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 查询AGV任务状态
|
||||
*/
|
||||
@@ -25,6 +31,9 @@ public class QueryZDAgvTaskStatus {
|
||||
@Autowired
|
||||
ZheDaAgvService agvService;
|
||||
|
||||
@Resource
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
|
||||
public void run() throws Exception {
|
||||
try {
|
||||
@@ -67,6 +76,14 @@ public class QueryZDAgvTaskStatus {
|
||||
}
|
||||
} else if ("FINISHED".equals(status)) {
|
||||
if (inst != null) {
|
||||
if(!"2".equals(inst.getInstruction_status())){
|
||||
String startPoint=inst.getStart_point_code();
|
||||
Device device = deviceAppService.findDeviceByCode(startPoint);
|
||||
if (device.getDeviceDriver() instanceof SiteDeviceDriver) {
|
||||
SiteDeviceDriver siteDeviceDriver=(SiteDeviceDriver)device.getDeviceDriver();
|
||||
siteDeviceDriver.writing(10);
|
||||
}
|
||||
}
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
package org.nl.quartz.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.baoshijian.BaoshijianSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.guhuashi.GuhuashiSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site.SiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site_status.SiteStatusDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.tubanxian.TubanxianSiteDeviceDriver;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.common.utils.RedisUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自动同步设备状态
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SyncDeviceStatus {
|
||||
|
||||
|
||||
@Autowired
|
||||
ZheDaAgvService agvService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
@Resource
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
|
||||
public void run() throws Exception {
|
||||
rgv();
|
||||
device();
|
||||
}
|
||||
|
||||
private void rgv() {
|
||||
try {
|
||||
log.info("自动线程开始查询浙大RGV设备状态");
|
||||
HttpResponse response = agvService.queryAgvDeviceStatus("1");
|
||||
//查询AGV指令列表
|
||||
JSONArray jsonArray = JSONArray.parseArray(response.body());
|
||||
redisUtils.set("RGV", jsonArray);
|
||||
} catch (Exception e) {
|
||||
log.error("自动线程查询浙大RGV设备状态失败{}{}", e, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void device() {
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
JSONArray baoshijian = new JSONArray();
|
||||
JSONArray guhuashi = new JSONArray();
|
||||
JSONArray site = new JSONArray();
|
||||
JSONArray AGV = new JSONArray();
|
||||
log.info("自动线程开始查询AGV设备状态");
|
||||
List<Device> deviceList = deviceAppService.findAllDevice();
|
||||
for (Device device : deviceList) {
|
||||
if (device.getDeviceDriver() instanceof BaoshijianSiteDeviceDriver) {
|
||||
BaoshijianSiteDeviceDriver baoshijianSiteDeviceDriver=(BaoshijianSiteDeviceDriver)device.getDeviceDriver();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode()+"DJW01");
|
||||
json.put("move",baoshijianSiteDeviceDriver.getX1());
|
||||
baoshijian.add(json);
|
||||
json.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode()+"DJW02");
|
||||
json.put("move",baoshijianSiteDeviceDriver.getX2()==1?0:1);
|
||||
baoshijian.add(json);
|
||||
} else if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
|
||||
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver=(GuhuashiSiteDeviceDriver)device.getDeviceDriver();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("temperature_setting", guhuashiSiteDeviceDriver.getVW7010());
|
||||
json.put("temperature", guhuashiSiteDeviceDriver.getVW7012());
|
||||
json.put("humidity_setting", guhuashiSiteDeviceDriver.getVW7014());
|
||||
json.put("humidity", guhuashiSiteDeviceDriver.getVW7016());
|
||||
json.put("total_running_time", guhuashiSiteDeviceDriver.getVW7038());
|
||||
json.put("current_stage", guhuashiSiteDeviceDriver.getVW7042());
|
||||
json.put("executing_stage_num", guhuashiSiteDeviceDriver.getVW7044());
|
||||
json.put("device_statue", guhuashiSiteDeviceDriver.getVW7058());
|
||||
json.put("front_door", guhuashiSiteDeviceDriver.getVW70004()==0?1:0);
|
||||
json.put("back_door", guhuashiSiteDeviceDriver.getVW7010());
|
||||
json.put("error", guhuashiSiteDeviceDriver.getVW7046());
|
||||
guhuashi.add(json);
|
||||
} else if (device.getDeviceDriver() instanceof SiteStatusDeviceDriver) {
|
||||
SiteStatusDeviceDriver siteStatusDeviceDriver=(SiteStatusDeviceDriver)device.getDeviceDriver();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", siteStatusDeviceDriver.getDevice_code());
|
||||
json.put("mode",siteStatusDeviceDriver.getMode());
|
||||
json.put("open_time",siteStatusDeviceDriver.getOpen_time());
|
||||
json.put("standby_time",siteStatusDeviceDriver.getStandby_time());
|
||||
json.put("production_time",siteStatusDeviceDriver.getProduction_time());
|
||||
json.put("error_time",siteStatusDeviceDriver.getError_time());
|
||||
json.put("end_time",siteStatusDeviceDriver.getEnd_time());
|
||||
site.add(json);
|
||||
} else if (device.getDeviceDriver() instanceof SiteDeviceDriver) {
|
||||
SiteDeviceDriver siteDeviceDriver=(SiteDeviceDriver)device.getDeviceDriver();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", siteDeviceDriver.getDevice_code());
|
||||
json.put("move", siteDeviceDriver.getMove());
|
||||
json.put("action", siteDeviceDriver.getAction());
|
||||
json.put("pallet_type", siteDeviceDriver.getPallet_type());
|
||||
json.put("error", siteDeviceDriver.getError());
|
||||
json.put("move", siteDeviceDriver.getMove());
|
||||
site.add(json);
|
||||
} else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver=(AgvNdcOneDeviceDriver)device.getDeviceDriver();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", agvNdcOneDeviceDriver.getDevice_code());
|
||||
json.put("device_name", "AGV" + agvNdcOneDeviceDriver.getDevice_code());
|
||||
json.put("device_status", agvNdcOneDeviceDriver.getStatus());
|
||||
json.put("energyLevel", agvNdcOneDeviceDriver.getElectric_qty());
|
||||
json.put("transportOrder", agvNdcOneDeviceDriver.getTransportOrder());
|
||||
json.put("positionX", agvNdcOneDeviceDriver.getX());
|
||||
json.put("positionY", agvNdcOneDeviceDriver.getY());
|
||||
json.put("positionAngle", agvNdcOneDeviceDriver.getAngle());
|
||||
AGV.add(json);
|
||||
}
|
||||
}
|
||||
redisUtils.set("baoshijian", baoshijian);
|
||||
redisUtils.set("guhuashi", guhuashi);
|
||||
redisUtils.set("site", site);
|
||||
redisUtils.set("AGV", AGV);
|
||||
log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
|
||||
} catch (Exception e) {
|
||||
log.error("自动线程开始查询AGV设备状态失败{}{}", e, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ spring:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:tn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
password: ${DB_PWD:123456}
|
||||
@@ -72,6 +72,7 @@ spring:
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:2}
|
||||
# host: ${REDIS_HOST:10.44.101.112}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
# password: ${REDIS_PWD:}
|
||||
|
||||
@@ -6,7 +6,8 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.4.121}:${DB_PORT:3306}/${DB_NAME:tn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.93.41.198}:${DB_PORT:3306}/${DB_NAME:rl_mg_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:tn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
@@ -14,9 +15,11 @@ spring:
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
# 最大连接数
|
||||
max-active: 60
|
||||
max-active: 30
|
||||
# 超时时间(以秒数为单位)
|
||||
remove-abandoned-timeout: 180
|
||||
# 获取连接超时时间
|
||||
max-wait: 5000
|
||||
max-wait: 3000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
@@ -36,11 +39,8 @@ spring:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
# 控制台管理用户名和密码
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
login-username: admin
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
@@ -53,22 +53,11 @@ spring:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:2}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
redisson:
|
||||
config: |
|
||||
threads: 4
|
||||
nettyThreads: 4
|
||||
singleServerConfig:
|
||||
database: 1
|
||||
connectionMinimumIdleSize: 8
|
||||
connectionPoolSize: 8
|
||||
address: redis://127.0.0.1:6379
|
||||
idleConnectionTimeout: 10000
|
||||
timeout: 3000
|
||||
|
||||
# 登录相关配置
|
||||
login:
|
||||
# 登录缓存
|
||||
@@ -87,7 +76,7 @@ login:
|
||||
heigth: 36
|
||||
# 内容长度
|
||||
length: 2
|
||||
# 字体名称,为空则使用默认字体,如遇到线上乱码,设置其他字体即可
|
||||
# 字体名称,为空则使用默认字体
|
||||
font-name:
|
||||
# 字体大小
|
||||
font-size: 25
|
||||
@@ -99,36 +88,29 @@ jwt:
|
||||
token-start-with: Bearer
|
||||
# 必须使用最少88位的Base64对该令牌进行编码
|
||||
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认2小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 7200000
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 14400000
|
||||
# 在线用户key
|
||||
online-key: online-token-
|
||||
# 验证码
|
||||
code-key: code-key-
|
||||
# token 续期检查时间范围(默认30分钟,单位默认毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
detect: 1800000
|
||||
# 续期时间范围,默认 1小时,这里单位毫秒
|
||||
# 续期时间范围,默认1小时,单位毫秒
|
||||
renew: 3600000
|
||||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: true
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: true
|
||||
|
||||
# IP 本地解析
|
||||
ip:
|
||||
local-parsing: true
|
||||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: false
|
||||
|
||||
#如果生产环境要开启swagger,需要配置请求地址
|
||||
#springfox:
|
||||
# documentation:
|
||||
# swagger:
|
||||
# v2:
|
||||
# host: # 接口域名或外网ip
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: false
|
||||
|
||||
# 文件存储路径
|
||||
file:
|
||||
mac:
|
||||
@@ -145,8 +127,11 @@ file:
|
||||
avatarMaxSize: 5
|
||||
logging:
|
||||
file:
|
||||
path: /app/jar/logs
|
||||
path: D:\log\ACS
|
||||
config: classpath:logback-spring.xml
|
||||
lucene:
|
||||
index:
|
||||
path: D:\lucene\index
|
||||
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
@@ -167,5 +152,7 @@ sa-token:
|
||||
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
|
||||
# token 前缀
|
||||
token-prefix: Bearer
|
||||
is-read-cookie: false
|
||||
is-read-body: false
|
||||
|
||||
loki:
|
||||
url: http://localhost:3100/loki/api/v1
|
||||
systemName: acs
|
||||
|
||||
@@ -21,8 +21,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<include resource="log/AutoCreateInst.xml"/>
|
||||
<include resource="log/AcsToWms.xml"/>
|
||||
<include resource="log/WmsToAcs.xml"/>
|
||||
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
|
||||
<!-- <include resource="log/Lucene.xml"/>-->
|
||||
<include resource="log/NDCSocketConnectionAutoRun.xml"/>
|
||||
<include resource="log/AgvNdcOneDeviceDriver.xml"/>
|
||||
<include resource="log/NDCAgvServiceImpl.xml"/>
|
||||
<include resource="log/LnshRGVDeviceDriver.xml"/>
|
||||
|
||||
Reference in New Issue
Block a user