|
@@ -948,6 +948,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
private async Task ReadJudge(String strLogic)
|
|
private async Task ReadJudge(String strLogic)
|
|
{
|
|
{
|
|
int countCond = 0;
|
|
int countCond = 0;
|
|
|
|
+ DateTime entryTime = DateTime.Now;
|
|
foreach (var item in OutConList.OrderBy(x => x.Id))
|
|
foreach (var item in OutConList.OrderBy(x => x.Id))
|
|
{
|
|
{
|
|
string plcAddress = item.PlcAddress;
|
|
string plcAddress = item.PlcAddress;
|
|
@@ -958,7 +959,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
{
|
|
{
|
|
|
|
|
|
case "bool":
|
|
case "bool":
|
|
- DateTime entryTime = DateTime.Now;
|
|
|
|
|
|
+
|
|
string readResult = string.Empty;
|
|
string readResult = string.Empty;
|
|
//一直读
|
|
//一直读
|
|
await Task.Run(async () =>
|
|
await Task.Run(async () =>
|
|
@@ -979,7 +980,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
await Task.Delay(1000);
|
|
await Task.Delay(1000);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+ //可能有多个条件判定的,第二次时间到了直接跳出延时,直接读取,不用在延时20s
|
|
|
|
+ readResult = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Bit);
|
|
ProVisibility = Visibility.Hidden;
|
|
ProVisibility = Visibility.Hidden;
|
|
///实时值记录
|
|
///实时值记录
|
|
item.RealValue = readResult;
|
|
item.RealValue = readResult;
|
|
@@ -996,12 +998,12 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
|
|
|
break;
|
|
break;
|
|
case "word":
|
|
case "word":
|
|
- DateTime entryTime2 = DateTime.Now;
|
|
|
|
|
|
+ // DateTime entryTime2 = DateTime.Now;
|
|
string readResult2 = string.Empty;
|
|
string readResult2 = string.Empty;
|
|
//一直读
|
|
//一直读
|
|
await Task.Run(async () =>
|
|
await Task.Run(async () =>
|
|
{
|
|
{
|
|
- while (entryTime2.AddMilliseconds(delayTime * 1000) > DateTime.Now)
|
|
|
|
|
|
+ while (entryTime.AddMilliseconds(delayTime * 1000) > DateTime.Now)
|
|
{
|
|
{
|
|
//显示进度条
|
|
//显示进度条
|
|
System.Windows.Application.Current.Dispatcher.Invoke((delegate
|
|
System.Windows.Application.Current.Dispatcher.Invoke((delegate
|
|
@@ -1017,7 +1019,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
await Task.Delay(1000);
|
|
await Task.Delay(1000);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+ //可能有多个条件判定的,第二次直接跳出延时,直接读取
|
|
|
|
+ readResult2 = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Word);
|
|
ProVisibility = Visibility.Hidden;
|
|
ProVisibility = Visibility.Hidden;
|
|
///实时值记录
|
|
///实时值记录
|
|
item.RealValue = readResult2;
|
|
item.RealValue = readResult2;
|