|
@@ -190,6 +190,22 @@ namespace TeamAAS_VP.ViewModels.Home
|
|
|
set { SetProperty(ref _Points, value); }
|
|
set { SetProperty(ref _Points, value); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private bool _IsScrewProvide2;
|
|
|
|
|
+
|
|
|
|
|
+ public bool IsScrewProvide2
|
|
|
|
|
+ {
|
|
|
|
|
+ get { return _IsScrewProvide2; }
|
|
|
|
|
+ set { SetProperty(ref _IsScrewProvide2, value); }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private bool _IsScrewProvide1;
|
|
|
|
|
+
|
|
|
|
|
+ public bool IsScrewProvide1
|
|
|
|
|
+ {
|
|
|
|
|
+ get { return _IsScrewProvide1; }
|
|
|
|
|
+ set { SetProperty(ref _IsScrewProvide1, value); }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
@@ -237,7 +253,9 @@ namespace TeamAAS_VP.ViewModels.Home
|
|
|
var ConfigModel = new PickScrewAccuracyAnalyzerrConfigModel
|
|
var ConfigModel = new PickScrewAccuracyAnalyzerrConfigModel
|
|
|
{
|
|
{
|
|
|
RepeatCount = this.RepeatCount,
|
|
RepeatCount = this.RepeatCount,
|
|
|
- MoveSpeed = this.MoveSpeed
|
|
|
|
|
|
|
+ MoveSpeed = this.MoveSpeed,
|
|
|
|
|
+ IsScrewProvide1 = this.IsScrewProvide1,
|
|
|
|
|
+ IsScrewProvide2 = this.IsScrewProvide2,
|
|
|
};
|
|
};
|
|
|
FileHelper.WriteJsonFile(ConfigModel, FilePath.PickScrewAccuracyAnalyzerrConfigurationPath);
|
|
FileHelper.WriteJsonFile(ConfigModel, FilePath.PickScrewAccuracyAnalyzerrConfigurationPath);
|
|
|
}
|
|
}
|
|
@@ -254,6 +272,8 @@ namespace TeamAAS_VP.ViewModels.Home
|
|
|
var res = FileHelper.ReadJsonFile<PickScrewAccuracyAnalyzerrConfigModel>(FilePath.PickScrewAccuracyAnalyzerrConfigurationPath);
|
|
var res = FileHelper.ReadJsonFile<PickScrewAccuracyAnalyzerrConfigModel>(FilePath.PickScrewAccuracyAnalyzerrConfigurationPath);
|
|
|
this.RepeatCount = res.RepeatCount;
|
|
this.RepeatCount = res.RepeatCount;
|
|
|
this.MoveSpeed = res.MoveSpeed;
|
|
this.MoveSpeed = res.MoveSpeed;
|
|
|
|
|
+ this.IsScrewProvide2 = res.IsScrewProvide2;
|
|
|
|
|
+ this.IsScrewProvide1 = res.IsScrewProvide1;
|
|
|
}
|
|
}
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
|
{
|
|
{
|
|
@@ -276,11 +296,10 @@ namespace TeamAAS_VP.ViewModels.Home
|
|
|
FailCount = 0;
|
|
FailCount = 0;
|
|
|
TestResults = new ObservableCollection<PickDynamicTestResult>();
|
|
TestResults = new ObservableCollection<PickDynamicTestResult>();
|
|
|
Message = "测试进行中...";
|
|
Message = "测试进行中...";
|
|
|
-
|
|
|
|
|
|
|
+ PlcAddressConfig addressConfig = _configService.GetPlcAddresses();
|
|
|
|
|
+ OpcUaClientPLC plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- PlcAddressConfig addressConfig = _configService.GetPlcAddresses();
|
|
|
|
|
- OpcUaClientPLC plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
|
|
|
|
|
var result = System.Windows.MessageBox.Show("确定进行连续测试吗?", "提示", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Question);
|
|
var result = System.Windows.MessageBox.Show("确定进行连续测试吗?", "提示", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Question);
|
|
|
if (result != System.Windows.MessageBoxResult.Yes)
|
|
if (result != System.Windows.MessageBoxResult.Yes)
|
|
|
{
|
|
{
|
|
@@ -297,6 +316,30 @@ namespace TeamAAS_VP.ViewModels.Home
|
|
|
|
|
|
|
|
while (CurrentProgress < RepeatCount)
|
|
while (CurrentProgress < RepeatCount)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (IsScrewProvide1)
|
|
|
|
|
+ {
|
|
|
|
|
+ while(!await plc.ReadNodeAsync<bool>(addressConfig.ScrewProvide1.Address))
|
|
|
|
|
+ {
|
|
|
|
|
+ Message = "螺丝供料机1未到位,可暂停等待";
|
|
|
|
|
+ if (_cts.Token.IsCancellationRequested)
|
|
|
|
|
+ {
|
|
|
|
|
+ Message = "测试已取消!";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (IsScrewProvide2)
|
|
|
|
|
+ {
|
|
|
|
|
+ while (!await plc.ReadNodeAsync<bool>(addressConfig.ScrewProvide2.Address))
|
|
|
|
|
+ {
|
|
|
|
|
+ Message = "螺丝供料机2未到位,可暂停等待";
|
|
|
|
|
+ if (_cts.Token.IsCancellationRequested)
|
|
|
|
|
+ {
|
|
|
|
|
+ Message = "测试已取消!";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
DateTime startTime = DateTime.Now;
|
|
DateTime startTime = DateTime.Now;
|
|
|
if (_cts.Token.IsCancellationRequested)
|
|
if (_cts.Token.IsCancellationRequested)
|
|
|
{
|
|
{
|
|
@@ -353,8 +396,9 @@ namespace TeamAAS_VP.ViewModels.Home
|
|
|
if (CurrentProgress >= RepeatCount)
|
|
if (CurrentProgress >= RepeatCount)
|
|
|
{
|
|
{
|
|
|
Message = "测试完成!";
|
|
Message = "测试完成!";
|
|
|
- await _torqueService.Throw_Screw_Async(Robot, plc, addressConfig, Points, MoveSpeed);
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
|
{
|
|
{
|
|
@@ -362,6 +406,7 @@ namespace TeamAAS_VP.ViewModels.Home
|
|
|
}
|
|
}
|
|
|
finally
|
|
finally
|
|
|
{
|
|
{
|
|
|
|
|
+ await _torqueService.Throw_Screw_Async(Robot, plc, addressConfig, Points, MoveSpeed);
|
|
|
IsRunning = false;
|
|
IsRunning = false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -370,8 +415,8 @@ namespace TeamAAS_VP.ViewModels.Home
|
|
|
{
|
|
{
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
{
|
|
{
|
|
|
- _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg =msg, Duration = 1 });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = msg, Duration = 1 });
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void ExecuteExportCSVCommand()
|
|
private void ExecuteExportCSVCommand()
|