|
@@ -43,7 +43,7 @@ public class DeviceCollectionTaskJob {
|
|
|
* 设备采集任务FANUC
|
|
|
* FANUC
|
|
|
*/
|
|
|
- @Scheduled(cron = "0/5 * * * * *")
|
|
|
+ @Scheduled(cron = "0/10 * * * * *")
|
|
|
void deviceCollectionTaskFanuc() throws Exception {
|
|
|
Object fanucObj = this.redisGet("FANUC_COLLECTION");
|
|
|
this.executorHandle(fanucObj);
|
|
@@ -53,7 +53,7 @@ public class DeviceCollectionTaskJob {
|
|
|
* 设备采集任务Opcua
|
|
|
* 西门子
|
|
|
*/
|
|
|
- @Scheduled(cron = "0/5 * * * * *")
|
|
|
+ @Scheduled(cron = "0/10 * * * * *")
|
|
|
void deviceCollectionTaskOpcua() throws Exception {
|
|
|
Object opcuaObj = this.redisGet("OPCUA_COLLECTION");
|
|
|
this.executorHandle(opcuaObj);
|
|
@@ -63,7 +63,7 @@ public class DeviceCollectionTaskJob {
|
|
|
* 设备采集任务Heidenhain
|
|
|
* 海德汉
|
|
|
*/
|
|
|
- @Scheduled(cron = "0/5 * * * * *")
|
|
|
+ @Scheduled(cron = "0/10 * * * * *")
|
|
|
void deviceCollectionTaskHeidenhain() throws Exception {
|
|
|
Object heidenhainObj = this.redisGet("HEIDENHAIN_COLLECTION");
|
|
|
this.executorHandle(heidenhainObj);
|
|
@@ -73,7 +73,7 @@ public class DeviceCollectionTaskJob {
|
|
|
* 设备采集任务Mitsubishi
|
|
|
* 三菱
|
|
|
*/
|
|
|
- @Scheduled(cron = "0/5 * * * * *")
|
|
|
+ @Scheduled(cron = "0/10 * * * * *")
|
|
|
void deviceCollectionTaskMitsubishi() throws Exception {
|
|
|
Object mitsubishiObj = this.redisGet("MITSUBISHI_COLLECTION");
|
|
|
this.executorHandle(mitsubishiObj);
|
|
@@ -83,12 +83,12 @@ public class DeviceCollectionTaskJob {
|
|
|
* 设备采集任务MtConnect
|
|
|
* 赫克
|
|
|
*/
|
|
|
- @Scheduled(cron = "0/5 * * * * *")
|
|
|
+ /*@Scheduled(cron = "0/10 * * * * *")
|
|
|
void deviceCollectionTaskMtConnect() throws Exception {
|
|
|
Object mtConnectObj = this.redisGet("MTCONNECT_COLLECTION");
|
|
|
this.executorHandle(mtConnectObj);
|
|
|
}
|
|
|
-
|
|
|
+*/
|
|
|
/**
|
|
|
* 多线程处理
|
|
|
*/
|
|
@@ -104,10 +104,14 @@ public class DeviceCollectionTaskJob {
|
|
|
if(returnInfo !=null){
|
|
|
JSONObject returnJson = JSONUtil.parseObj(returnInfo);
|
|
|
if((boolean)returnJson.get("result")){
|
|
|
- this.saveOrUpdateDeviceCollection(returnJson,map.get("serverUrl"));
|
|
|
- this.saveOrUpdateDeviceCollectionDetail(returnJson,map.get("serverUrl"));
|
|
|
+ Object ip = map.get("serverUrl");
|
|
|
+ if("Opcua".equals(map.get("deviceType").toString())){
|
|
|
+ ip = map.get("ip");
|
|
|
+ }
|
|
|
+ this.saveOrUpdateDeviceCollection(returnJson,ip,map.get("deviceType").toString());
|
|
|
+ this.saveOrUpdateDeviceCollectionDetail(returnJson,ip);
|
|
|
try {
|
|
|
- this.deviceCollectionInfoWriteFile(returnJson,map.get("serverUrl"));
|
|
|
+ this.deviceCollectionInfoWriteFile(returnJson,ip);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -125,10 +129,18 @@ public class DeviceCollectionTaskJob {
|
|
|
* @param returnJson
|
|
|
* @param ip
|
|
|
*/
|
|
|
- public void saveOrUpdateDeviceCollection(JSONObject returnJson,Object ip){
|
|
|
+ public void saveOrUpdateDeviceCollection(JSONObject returnJson,Object ip,String deviceType){
|
|
|
//组装参数,更新设备采集表
|
|
|
+ Object mainProg = returnJson.get("mainProg");
|
|
|
JSONObject deviceInfo = new JSONObject();
|
|
|
- deviceInfo.putOnce("mainProg",returnJson.get("mainProg"));
|
|
|
+ if("Opcua".equals(deviceType) && !Objects.isNull(mainProg)){
|
|
|
+ if(mainProg.toString().contains("/")){
|
|
|
+ String[] split = mainProg.toString().split("/");
|
|
|
+ mainProg = split[split.length - 1];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ deviceInfo.putOnce("mainProg",mainProg);
|
|
|
deviceInfo.putOnce("actFeed",returnJson.get("actFeed"));
|
|
|
deviceInfo.putOnce("spindleMagnification",returnJson.get("spindleMagnification"));
|
|
|
deviceInfo.putOnce("actSpindle",returnJson.get("actSpindle"));
|