|
|
@@ -2,11 +2,14 @@ package com.example.bpa.app; |
|
|
|
|
|
|
|
import com.example.bpa.Model.IReadCallBack; |
|
|
|
import com.example.bpa.Model.IRun; |
|
|
|
import com.example.bpa.Model.IRunT; |
|
|
|
import com.example.bpa.Model.IThread; |
|
|
|
import com.example.bpa.Model.IWriteCallBack; |
|
|
|
import com.example.bpa.helper.RTrig; |
|
|
|
import com.example.bpa.helper.ThreadManager; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ConcurrentLinkedQueue; |
|
|
|
|
|
|
@@ -19,6 +22,37 @@ public class DeviceData { |
|
|
|
return _instance; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------Start 测试 ---------------------------------------------------------------- |
|
|
|
ConcurrentLinkedQueue<Integer> testComms = new ConcurrentLinkedQueue<>(); |
|
|
|
|
|
|
|
public void testAddComm(int value) { |
|
|
|
testComms.offer(value); |
|
|
|
} |
|
|
|
|
|
|
|
public void TestInit() { |
|
|
|
ThreadManager.Get().StartLong("TestInit", true, new IThread() { |
|
|
|
@Override |
|
|
|
public void Run() throws InterruptedException { |
|
|
|
while (testComms.size() > 0) { |
|
|
|
Thread.sleep(5000); |
|
|
|
if (OnChargeMixtureComNotPar != null) { |
|
|
|
OnChargeMixtureComNotPar.Run(testComms.poll()); |
|
|
|
} |
|
|
|
} |
|
|
|
Thread.sleep(100); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void RunComplete() throws InterruptedException { |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
; |
|
|
|
} |
|
|
|
//----------------------------------------------------------------End 测试 ---------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
public void Init() { |
|
|
|
ThreadManager.Get().StartLong("Plc设备数据监听", true, new IThread() { |
|
|
|
@Override |
|
|
@@ -62,14 +96,22 @@ public class DeviceData { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//获取清洗参数 |
|
|
|
ModbusTcpServer.get().ReadBool("M6.5", 1, new IReadCallBack<boolean[]>() { |
|
|
|
@Override |
|
|
|
public void onSuccess(boolean[] booleans) { |
|
|
|
WeightCalibrationMode = booleans[0]; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//配料完成 M0.3 |
|
|
|
CompleteListen("M0.3", "配料完成", ChargeMixtureCompleteNotify); |
|
|
|
CompleteListen("M0.3", "配料完成", OnChargeMixtureCompleteNotify); |
|
|
|
|
|
|
|
//清洗完成 M0.6 |
|
|
|
CompleteListen("M0.6", "清洗完成", CleaningCompleteNotify); |
|
|
|
CompleteListen("M0.6", "清洗完成", OnCleaningCompleteNotify); |
|
|
|
|
|
|
|
//去皮完成 M1.3 |
|
|
|
CompleteListen("M1.3", "去皮完成", PeelingCompleteNotify); |
|
|
|
CompleteListen("M1.3", "去皮完成", OnPeelingCompleteNotify); |
|
|
|
|
|
|
|
Thread.sleep(10); |
|
|
|
} |
|
|
@@ -96,20 +138,26 @@ public class DeviceData { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 配料完成通知 |
|
|
|
*/ |
|
|
|
public IRun ChargeMixtureCompleteNotify; |
|
|
|
public IRun OnChargeMixtureCompleteNotify; |
|
|
|
|
|
|
|
/** |
|
|
|
* 通道配料完成通知 |
|
|
|
*/ |
|
|
|
public IRunT OnChargeMixtureComNotPar; |
|
|
|
|
|
|
|
/** |
|
|
|
* 清洗完成通知 |
|
|
|
*/ |
|
|
|
public IRun CleaningCompleteNotify; |
|
|
|
public IRun OnCleaningCompleteNotify; |
|
|
|
|
|
|
|
/** |
|
|
|
* 去皮完成 |
|
|
|
*/ |
|
|
|
public IRun PeelingCompleteNotify; |
|
|
|
public IRun OnPeelingCompleteNotify; |
|
|
|
|
|
|
|
/** |
|
|
|
* 校准值写入 |
|
|
@@ -234,6 +282,11 @@ public class DeviceData { |
|
|
|
ModbusTcpServer.get().WriteBool("M6.3", true, callback); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 砝码校准模式 |
|
|
|
*/ |
|
|
|
boolean WeightCalibrationMode; |
|
|
|
|
|
|
|
/** |
|
|
|
* 砝码校准模式 |
|
|
|
*/ |
|
|
@@ -241,6 +294,15 @@ public class DeviceData { |
|
|
|
ModbusTcpServer.get().WriteBool("M6.5", true, callback); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取砝码校准模式 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public boolean getWeightCalibrationMode() { |
|
|
|
return WeightCalibrationMode; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 启动通道校准 |
|
|
|
*/ |
|
|
|