|
@@ -955,21 +955,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
private async Task ReadJudge(String strLogic)
|
|
|
{
|
|
|
int countCond = 0;
|
|
|
- DateTime entryTime = DateTime.Now;
|
|
|
- await Task.Run(async () =>
|
|
|
- {
|
|
|
- while (entryTime.AddMilliseconds(delayTime * 1000) > DateTime.Now)
|
|
|
- {
|
|
|
- //显示进度条
|
|
|
- System.Windows.Application.Current.Dispatcher.Invoke((delegate
|
|
|
- {
|
|
|
- ProVisibility = Visibility.Visible;
|
|
|
- }));
|
|
|
-
|
|
|
- await Task.Delay(1000);
|
|
|
- }
|
|
|
- });
|
|
|
- ProVisibility = Visibility.Hidden;
|
|
|
+
|
|
|
foreach (var item in OutConList.OrderBy(x => x.Id))
|
|
|
{
|
|
|
string plcAddress = item.PlcAddress;
|
|
@@ -983,8 +969,26 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
|
|
|
string readResult = string.Empty;
|
|
|
//
|
|
|
-
|
|
|
- readResult = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Bit);
|
|
|
+ DateTime entryTime = DateTime.Now;
|
|
|
+ await Task.Run(async () =>
|
|
|
+ {
|
|
|
+ while (entryTime.AddMilliseconds(delayTime * 1000) > DateTime.Now)
|
|
|
+ {
|
|
|
+ //显示进度条
|
|
|
+ System.Windows.Application.Current.Dispatcher.Invoke((delegate
|
|
|
+ {
|
|
|
+ ProVisibility = Visibility.Visible;
|
|
|
+ }));
|
|
|
+ readResult = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Bit);
|
|
|
+ if (readResult == item.PlcValue)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ await Task.Delay(1000);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ ProVisibility = Visibility.Hidden;
|
|
|
+
|
|
|
|
|
|
///实时值记录
|
|
|
item.RealValue = readResult;
|
|
@@ -1014,8 +1018,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
ProVisibility = Visibility.Visible;
|
|
|
}));
|
|
|
|
|
|
- readResult = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Word);
|
|
|
- if (readResult == item.PlcValue)
|
|
|
+ readResult2 = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Word);
|
|
|
+ if (readResult2 == item.PlcValue)
|
|
|
{
|
|
|
break;
|
|
|
}
|