2026-06-17 15:41:06 +08:00
|
|
|
|
using HandyControl.Controls;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using LiveChartsCore;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
using LiveChartsCore.Defaults;
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using LiveChartsCore.SkiaSharpView;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using LiveChartsCore.SkiaSharpView.Painting;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
using Prism.Events;
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using Prism.Mvvm;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using SkiaSharp;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using System.Collections.ObjectModel;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using YY.Admin.Core;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using YY.Admin.Core.Entity;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
using YY.Admin.Core.Events;
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using YY.Admin.Core.Services;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
using YY.Admin.Core.Session;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
namespace YY.Admin.ViewModels.RubberQuickTest;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
|
|
|
|
|
|
public class QuickTestInspectCellViewModel : BindableBase
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string? DataPointId { get; set; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string PointName { get; set; } = string.Empty;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public decimal? LowerLimit { get; set; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public decimal? UpperLimit { get; set; }
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private decimal? _value;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public decimal? Value
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _value;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (SetProperty(ref _value, value))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
ValueChanged?.Invoke(this);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public event Action<QuickTestInspectCellViewModel>? ValueChanged;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public class QuickTestInspectRowViewModel : BindableBase
|
|
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
private string _rowNo = string.Empty;
|
|
|
|
|
|
public string RowNo
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _rowNo;
|
|
|
|
|
|
set => SetProperty(ref _rowNo, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public ObservableCollection<QuickTestInspectCellViewModel> Cells { get; } = new();
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private string _inspectResultText = string.Empty;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string InspectResultText
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _inspectResultText;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set => SetProperty(ref _inspectResultText, value);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string InspectResultCode { get; private set; } = "0";
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public void RecalculateResult()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (Cells.Count == 0)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectResultCode = "0";
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectResultText = string.Empty;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(InspectResultText));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (Cells.Any(c => c.Value == null))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectResultCode = "0";
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectResultText = "待填写";
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(InspectResultText));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var pass = Cells.All(c =>
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (c.LowerLimit != null && c.Value < c.LowerLimit) return false;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (c.UpperLimit != null && c.Value > c.UpperLimit) return false;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return true;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
});
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectResultCode = pass ? "1" : "0";
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectResultText = pass ? "合格" : "不合格";
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(InspectResultText));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>胶料快检记录操作台 ViewModel(密炼计划、实验标准均读本地缓存)</summary>
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public class RubberQuickTestOperationViewModel : BaseViewModel
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private readonly IRubberQuickTestOperationService _operationService;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
private readonly IMixingProductionPlanService _planService;
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IRubberQuickTestStdService _stdService;
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private readonly Random _rnd = new();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private List<MesXslMixingProductionPlan> _allPlans = new();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
private List<MesXslRubberQuickTestStd> _allStds = new();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private MesXslRubberQuickTestStd? _currentStd;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
private SubscriptionToken? _planChangedToken;
|
|
|
|
|
|
|
|
|
|
|
|
private SubscriptionToken? _stdChangedToken;
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private const int ChartPointCount = 5;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
/// <summary>曲线横坐标时间点(min):0、0.5、1、1.5、2</summary>
|
|
|
|
|
|
private static readonly double[] ChartTimeMinutes = { 0, 0.5, 1, 1.5, 2 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public event Action? InspectColumnsChanged;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public RubberQuickTestOperationViewModel(
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
IRubberQuickTestOperationService operationService,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
IMixingProductionPlanService planService,
|
|
|
|
|
|
|
|
|
|
|
|
IRubberQuickTestStdService stdService,
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
IContainerExtension container,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
IRegionManager regionManager) : base(container, regionManager)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
_operationService = operationService;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
_planService = planService;
|
|
|
|
|
|
|
|
|
|
|
|
_stdService = stdService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
_inspectTimesText = "1";
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
AddInspectRowCommand = new DelegateCommand(AddInspectRow, () => DataPointColumns.Count > 0);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RemoveInspectRowCommand = new DelegateCommand(() => RemoveInspectRow(SelectedInspectRow), () => SelectedInspectRow != null);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SaveCommand = new DelegateCommand(async () => await SaveAsync(), () => InspectRows.Count > 0);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
RefreshPlansCommand = new DelegateCommand(async () => await LoadLocalDataAsync(showSuccess: true));
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RefreshChartDemoCommand = new DelegateCommand(FillRandomChartData);
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
TemperatureSeries = new ObservableCollection<ISeries>
|
|
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
new LineSeries<ObservablePoint> { Name = "上模温度", Values = UpperTempValues, GeometrySize = 4, LineSmoothness = 0.3 },
|
|
|
|
|
|
new LineSeries<ObservablePoint> { Name = "下模温度", Values = LowerTempValues, GeometrySize = 4, LineSmoothness = 0.3 }
|
2026-06-17 15:41:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
TorqueSeries = new ObservableCollection<ISeries>
|
|
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
new LineSeries<ObservablePoint> { Name = "S'(dNm)", Values = TorqueValues, GeometrySize = 4, LineSmoothness = 0.3 }
|
2026-06-17 15:41:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
FillRandomChartData();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
InspectorDisplay = ResolveInspectorDisplay();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_planChangedToken = _eventAggregator.GetEvent<MixingProductionPlanChangedEvent>()
|
|
|
|
|
|
.Subscribe(async _ => await ReloadLocalDataQuietAsync(), ThreadOption.UIThread);
|
|
|
|
|
|
_stdChangedToken = _eventAggregator.GetEvent<RubberQuickTestStdChangedEvent>()
|
|
|
|
|
|
.Subscribe(async _ => await ReloadLocalDataQuietAsync(), ThreadOption.UIThread);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_ = LoadLocalDataAsync(showSuccess: false);
|
|
|
|
|
|
|
|
|
|
|
|
RecalculateOverallInspectResult();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static string ResolveInspectorDisplay()
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var user = AppSession.CurrentUser;
|
|
|
|
|
|
|
|
|
|
|
|
if (user == null) return string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(user.RealName)) return user.RealName.Trim();
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(user.Account)) return user.Account.Trim();
|
|
|
|
|
|
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
/// <summary>中间库未接入时的曲线演示说明</summary>
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string ChartDemoHint => "演示数据(中间库未接入,打开页面自动生成;接入后将显示实测曲线)";
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public ObservableCollection<ISeries> TemperatureSeries { get; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public ObservableCollection<ISeries> TorqueSeries { get; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<ObservablePoint> UpperTempValues { get; } = new();
|
|
|
|
|
|
public ObservableCollection<ObservablePoint> LowerTempValues { get; } = new();
|
|
|
|
|
|
public ObservableCollection<ObservablePoint> TorqueValues { get; } = new();
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
|
|
|
|
|
|
public Axis[] TemperatureXAxes { get; } = BuildTimeAxis();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public Axis[] TemperatureYAxes { get; } = BuildTempYAxis();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public Axis[] TorqueXAxes { get; } = BuildTimeAxis();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public Axis[] TorqueYAxes { get; } = BuildTorqueYAxis();
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public ObservableCollection<string> MachineOptions { get; } = new();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public ObservableCollection<WorkShiftOption> ShiftOptions { get; } = new();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<MesXslMixingProductionPlan> PlanOptions { get; } = new();
|
|
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<MesXslRubberQuickTestStd> StdOptions { get; } = new();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public ObservableCollection<MesXslRubberQuickTestStdLine> DataPointColumns { get; } = new();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public ObservableCollection<QuickTestInspectRowViewModel> InspectRows { get; } = new();
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private QuickTestInspectRowViewModel? _selectedInspectRow;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public QuickTestInspectRowViewModel? SelectedInspectRow
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _selectedInspectRow;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (SetProperty(ref _selectedInspectRow, value))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RemoveInspectRowCommand.RaiseCanExecuteChanged();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private DateTime _mixingDate = DateTime.Today;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public DateTime MixingDate
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _mixingDate;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!SetProperty(ref _mixingDate, value)) return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RefreshMachineOptions();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
ClearPlanAndStdSelection();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private string? _selectedMachine;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string? SelectedMachine
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _selectedMachine;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!SetProperty(ref _selectedMachine, value)) return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RefreshShiftOptions();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
ClearPlanAndStdSelection();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private WorkShiftOption? _selectedShift;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public WorkShiftOption? SelectedShift
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _selectedShift;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!SetProperty(ref _selectedShift, value)) return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RefreshPlanOptions();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
ClearPlanAndStdSelection();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MesXslMixingProductionPlan? _selectedPlan;
|
|
|
|
|
|
|
|
|
|
|
|
public MesXslMixingProductionPlan? SelectedPlan
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _selectedPlan;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!SetProperty(ref _selectedPlan, value)) return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
ApplySelectedPlan();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MesXslRubberQuickTestStd? _selectedStd;
|
|
|
|
|
|
|
|
|
|
|
|
public MesXslRubberQuickTestStd? SelectedStd
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get => _selectedStd;
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (!SetProperty(ref _selectedStd, value)) return;
|
|
|
|
|
|
|
|
|
|
|
|
_ = ApplySelectedStdAsync();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string? MachineName => _selectedPlan?.MachineName ?? SelectedMachine;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string? WorkShiftDisplay => SelectedShift?.Name ?? string.Empty;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 17:52:31 +08:00
|
|
|
|
public string? RubberMaterialName => _selectedPlan?.MaterialName ?? _selectedPlan?.FormulaName;
|
2026-06-17 15:41:06 +08:00
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string? _testMethodName;
|
|
|
|
|
|
|
|
|
|
|
|
public string? TestMethodName
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get => _testMethodName;
|
|
|
|
|
|
|
|
|
|
|
|
private set => SetProperty(ref _testMethodName, value);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private string? _trainNo;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string? TrainNo
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _trainNo;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set => SetProperty(ref _trainNo, value);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string? _recordNo;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>快检记录号(保存后由 MES 生成,只读)</summary>
|
|
|
|
|
|
|
|
|
|
|
|
public string? RecordNo
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get => _recordNo;
|
|
|
|
|
|
|
|
|
|
|
|
private set => SetProperty(ref _recordNo, value);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string _inspectorDisplay = string.Empty;
|
|
|
|
|
|
/// <summary>检验人(当前登录用户,只读)</summary>
|
|
|
|
|
|
public string InspectorDisplay
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _inspectorDisplay;
|
|
|
|
|
|
private set => SetProperty(ref _inspectorDisplay, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string _overallInspectResultDisplay = "不合格";
|
|
|
|
|
|
/// <summary>检验结果(试验信息区汇总,只读)</summary>
|
|
|
|
|
|
public string OverallInspectResultDisplay
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _overallInspectResultDisplay;
|
|
|
|
|
|
private set => SetProperty(ref _overallInspectResultDisplay, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>检验结果编码:1 合格,0 不合格</summary>
|
|
|
|
|
|
public string OverallInspectResultCode { get; private set; } = "0";
|
|
|
|
|
|
|
|
|
|
|
|
private string? _inspectTimesText;
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
/// <summary>试验次数(手填正整数)</summary>
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string? InspectTimesText
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _inspectTimesText;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set => SetProperty(ref _inspectTimesText, value);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private double _upperMoldTemp;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public double UpperMoldTemp
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _upperMoldTemp;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set => SetProperty(ref _upperMoldTemp, value);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private double _lowerMoldTemp;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public double LowerMoldTemp
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _lowerMoldTemp;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set => SetProperty(ref _lowerMoldTemp, value);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private double _torqueS;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public double TorqueS
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
get => _torqueS;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
set => SetProperty(ref _torqueS, value);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public DelegateCommand AddInspectRowCommand { get; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public DelegateCommand RemoveInspectRowCommand { get; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public DelegateCommand SaveCommand { get; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public DelegateCommand RefreshPlansCommand { get; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public DelegateCommand RefreshChartDemoCommand { get; }
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task LoadLocalDataAsync(bool showSuccess)
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
IsLoading = true;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
try
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
_allPlans = await _planService.GetAllCachedAsync();
|
|
|
|
|
|
|
|
|
|
|
|
_allStds = await _stdService.GetAllCachedAsync();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RefreshMachineOptions();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (showSuccess)
|
|
|
|
|
|
|
|
|
|
|
|
Growl.Success("本地密炼计划与实验标准已刷新");
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
catch (Exception ex)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
Growl.Error($"加载本地数据失败:{ex.Message}");
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
finally
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
IsLoading = false;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task ReloadLocalDataQuietAsync()
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
_allPlans = await _planService.GetAllCachedAsync();
|
|
|
|
|
|
|
|
|
|
|
|
_allStds = await _stdService.GetAllCachedAsync();
|
|
|
|
|
|
|
|
|
|
|
|
RefreshMachineOptions();
|
|
|
|
|
|
|
|
|
|
|
|
RefreshStdOptions();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Warning($"[胶料快检记录] 本地数据刷新失败:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private IEnumerable<MesXslMixingProductionPlan> FilteredByDate =>
|
|
|
|
|
|
|
|
|
|
|
|
_allPlans.Where(p => p.PlanDate?.Date == MixingDate.Date);
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
|
|
|
|
|
|
private void RefreshMachineOptions()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
MachineOptions.Clear();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
foreach (var name in FilteredByDate.Select(o => o.MachineName).Where(n => !string.IsNullOrWhiteSpace(n)).Distinct().OrderBy(n => n))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
MachineOptions.Add(name!);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (SelectedMachine != null && !MachineOptions.Contains(SelectedMachine))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SelectedMachine = null;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (SelectedMachine == null && MachineOptions.Count > 0)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SelectedMachine = MachineOptions[0];
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
else
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RefreshShiftOptions();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private void RefreshShiftOptions()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
ShiftOptions.Clear();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var machine = SelectedMachine;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var shifts = FilteredByDate
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
.Where(o => string.IsNullOrWhiteSpace(machine) || o.MachineName == machine)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
.GroupBy(o => o.ShiftFlag?.ToString() ?? string.Empty)
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
.Select(g => g.First())
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
.OrderBy(o => o.ShiftFlag);
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
foreach (var s in shifts)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
ShiftOptions.Add(new WorkShiftOption(s.ShiftFlag?.ToString() ?? string.Empty, s.ShiftFlagText));
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (SelectedShift != null && !ShiftOptions.Any(x => x.Code == SelectedShift.Code))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SelectedShift = null;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (SelectedShift == null && ShiftOptions.Count > 0)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SelectedShift = ShiftOptions[0];
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
else
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RefreshPlanOptions();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private void RefreshPlanOptions()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
PlanOptions.Clear();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var machine = SelectedMachine;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var shiftCode = SelectedShift?.Code;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
foreach (var p in FilteredByDate
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
.Where(x => string.IsNullOrWhiteSpace(machine) || x.MachineName == machine)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
.Where(x => string.IsNullOrWhiteSpace(shiftCode) || (x.ShiftFlag?.ToString() ?? string.Empty) == shiftCode)
|
|
|
|
|
|
|
|
|
|
|
|
.Where(x => !string.IsNullOrWhiteSpace(x.PlanMaterialNo))
|
|
|
|
|
|
|
|
|
|
|
|
.OrderBy(x => x.PlanMaterialNo))
|
|
|
|
|
|
|
|
|
|
|
|
PlanOptions.Add(p);
|
|
|
|
|
|
|
|
|
|
|
|
if (SelectedPlan != null && PlanOptions.All(p => p.Id != SelectedPlan.Id))
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SelectedPlan = null;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (SelectedPlan == null && PlanOptions.Count > 0)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SelectedPlan = PlanOptions[0];
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void ClearPlanAndStdSelection()
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
_selectedPlan = null;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(SelectedPlan));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(MachineName));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(WorkShiftDisplay));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(RubberMaterialName));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
ClearStdSelection();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void ClearStdSelection()
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
_selectedStd = null;
|
|
|
|
|
|
|
|
|
|
|
|
RaisePropertyChanged(nameof(SelectedStd));
|
|
|
|
|
|
|
|
|
|
|
|
TestMethodName = null;
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
ClearStdAndResults();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
StdOptions.Clear();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private void ApplySelectedPlan()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(MachineName));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(WorkShiftDisplay));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RaisePropertyChanged(nameof(RubberMaterialName));
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
ClearStdSelection();
|
|
|
|
|
|
|
|
|
|
|
|
RefreshStdOptions();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void RefreshStdOptions()
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
StdOptions.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
var rubberName = RubberMaterialName;
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(rubberName)) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var std in FilterApplicableStds(rubberName).OrderBy(s => s.StdName))
|
|
|
|
|
|
|
|
|
|
|
|
StdOptions.Add(std);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StdOptions.Count == 0)
|
|
|
|
|
|
|
|
|
|
|
|
Growl.Warning($"未找到胶料「{rubberName}」的使用中且已批准的快检实验标准,请先在「胶料快检实验标准」中同步数据");
|
|
|
|
|
|
|
|
|
|
|
|
RecalculateOverallInspectResult();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private IEnumerable<MesXslRubberQuickTestStd> FilterApplicableStds(string rubberMaterialName)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var name = rubberMaterialName.Trim();
|
|
|
|
|
|
|
|
|
|
|
|
return _allStds.Where(std =>
|
|
|
|
|
|
|
|
|
|
|
|
string.Equals(std.RubberMaterialName?.Trim(), name, StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|
|
|
|
|
|
|
&& std.EnableStatus == "1"
|
|
|
|
|
|
|
|
|
|
|
|
&& std.AuditStatus == "1");
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task ApplySelectedStdAsync()
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
DataPointColumns.Clear();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectRows.Clear();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
_currentStd = null;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
TestMethodName = null;
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectColumnsChanged?.Invoke();
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
RecalculateOverallInspectResult();
|
|
|
|
|
|
|
|
|
|
|
|
if (SelectedStd == null || string.IsNullOrWhiteSpace(SelectedStd.Id)) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
|
|
|
|
|
|
IsLoading = true;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
try
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
_currentStd = await _stdService.GetWithLinesAsync(SelectedStd.Id);
|
|
|
|
|
|
|
|
|
|
|
|
if (_currentStd == null)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Growl.Warning("所选实验标准在本地缓存中不存在,请刷新本地数据");
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TestMethodName = _currentStd.TestMethodName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_currentStd.LineList == null || _currentStd.LineList.Count == 0)
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
Growl.Warning($"标准「{_currentStd.StdName}」明细未同步到本地,请联网后重选,或先在「胶料快检实验标准」中查看该标准详情");
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
foreach (var line in _currentStd.LineList.OrderBy(l => l.SortNo ?? 0))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
DataPointColumns.Add(line);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectColumnsChanged?.Invoke();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
InitInspectRowsFromTimes();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
AddInspectRowCommand.RaiseCanExecuteChanged();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
catch (Exception ex)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Growl.Error($"加载实验标准失败:{ex.Message}");
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
finally
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
IsLoading = false;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
RecalculateOverallInspectResult();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private void ClearStdAndResults()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
DataPointColumns.Clear();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectRows.Clear();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
_currentStd = null;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectColumnsChanged?.Invoke();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
RecalculateOverallInspectResult();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private void FillRandomChartData()
|
|
|
|
|
|
{
|
|
|
|
|
|
UpperTempValues.Clear();
|
|
|
|
|
|
LowerTempValues.Clear();
|
|
|
|
|
|
TorqueValues.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ChartPointCount; i++)
|
|
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
var time = ChartTimeMinutes[i];
|
|
|
|
|
|
var upper = 189 + _rnd.NextDouble() * 12;
|
|
|
|
|
|
var lower = Math.Max(189, upper - 2 - _rnd.NextDouble() * 2);
|
|
|
|
|
|
var torque = Math.Min(14.8, i * 2.5 + _rnd.NextDouble() * 2.5);
|
|
|
|
|
|
UpperTempValues.Add(new ObservablePoint(time, Math.Round(upper, 2)));
|
|
|
|
|
|
LowerTempValues.Add(new ObservablePoint(time, Math.Round(lower, 2)));
|
|
|
|
|
|
TorqueValues.Add(new ObservablePoint(time, Math.Round(torque, 2)));
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
UpperMoldTemp = UpperTempValues[^1].Y ?? 0;
|
|
|
|
|
|
LowerMoldTemp = LowerTempValues[^1].Y ?? 0;
|
|
|
|
|
|
TorqueS = TorqueValues[^1].Y ?? 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void InitInspectRowsFromTimes()
|
|
|
|
|
|
{
|
|
|
|
|
|
InspectRows.Clear();
|
|
|
|
|
|
var times = 1;
|
|
|
|
|
|
if (TryParseInspectTimes(out var n, out _))
|
|
|
|
|
|
times = n;
|
|
|
|
|
|
for (var i = 0; i < times; i++)
|
|
|
|
|
|
AddInspectRow();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void RenumberInspectRows()
|
|
|
|
|
|
{
|
|
|
|
|
|
for (var i = 0; i < InspectRows.Count; i++)
|
|
|
|
|
|
InspectRows[i].RowNo = $"{i + 1}_1";
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void AddInspectRow()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var rowIndex = InspectRows.Count + 1;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var row = new QuickTestInspectRowViewModel { RowNo = $"{rowIndex}_1" };
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
foreach (var col in DataPointColumns)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var cell = new QuickTestInspectCellViewModel
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
DataPointId = col.DataPointId,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
PointName = col.PointName ?? string.Empty,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
LowerLimit = col.LowerLimit,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
UpperLimit = col.UpperLimit
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
};
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
cell.ValueChanged += _ =>
|
|
|
|
|
|
{
|
|
|
|
|
|
row.RecalculateResult();
|
|
|
|
|
|
RecalculateOverallInspectResult();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
row.Cells.Add(cell);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
row.RecalculateResult();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectRows.Add(row);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SaveCommand.RaiseCanExecuteChanged();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
RecalculateOverallInspectResult();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private void RemoveInspectRow(QuickTestInspectRowViewModel? row)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (row == null) return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectRows.Remove(row);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SelectedInspectRow = null;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
RenumberInspectRows();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SaveCommand.RaiseCanExecuteChanged();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
RecalculateOverallInspectResult();
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private async Task SaveAsync()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (string.IsNullOrWhiteSpace(TrainNo))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Growl.Warning("请填写车次");
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (SelectedPlan == null)
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
Growl.Warning("请选择密炼计划");
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (string.IsNullOrWhiteSpace(RubberMaterialName))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Growl.Warning("请先选择密炼计划以带出胶料名称");
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (SelectedStd == null || _currentStd == null)
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
Growl.Warning("请选择实验标准");
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (InspectRows.Any(r => r.InspectResultText == "待填写" || string.IsNullOrWhiteSpace(r.InspectResultText)))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Growl.Warning("请手填全部检验行的检测值后再保存");
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!TryParseInspectTimes(out var inspectTimes, out var inspectTimesError))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Growl.Warning(inspectTimesError);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var lineList = BuildAveragedLineList();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (lineList.Count == 0)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Growl.Warning("无法根据试验结果计算明细数据");
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var rawLineList = BuildRawLineList();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (rawLineList.Count == 0)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Growl.Warning("无法生成试验结果原始数据");
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var user = AppSession.CurrentUser;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
IsLoading = true;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
try
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var record = BuildSaveRecord(lineList, rawLineList, inspectTimes, user);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
var recordNo = await _operationService.SaveRecordAsync(record);
|
|
|
|
|
|
|
|
|
|
|
|
RecordNo = recordNo;
|
|
|
|
|
|
|
|
|
|
|
|
Growl.Success(string.IsNullOrWhiteSpace(recordNo)
|
|
|
|
|
|
|
|
|
|
|
|
? "胶料快检记录已保存到 MES"
|
|
|
|
|
|
|
|
|
|
|
|
: $"胶料快检记录已保存,单号:{recordNo}");
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectRows.Clear();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SaveCommand.RaiseCanExecuteChanged();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
catch (Exception ex)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Growl.Error($"保存失败:{ex.Message}");
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
finally
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
IsLoading = false;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private bool TryParseInspectTimes(out int value, out string error)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
error = string.Empty;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var text = string.IsNullOrWhiteSpace(InspectTimesText) ? "1" : InspectTimesText.Trim();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!int.TryParse(text, out var n) || n <= 0)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
error = "试验次数须填写正整数";
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
value = 0;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return false;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
value = n;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return true;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private List<MesXslRubberQuickTestRecordLine> BuildAveragedLineList()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var lines = new List<MesXslRubberQuickTestRecordLine>();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
for (int i = 0; i < DataPointColumns.Count; i++)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var col = DataPointColumns[i];
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var values = InspectRows
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
.Where(r => i < r.Cells.Count && r.Cells[i].Value != null)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
.Select(r => r.Cells[i].Value!.Value)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
.ToList();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (values.Count == 0)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var avg = values.Average(v => (double)v);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var avgDecimal = Math.Round((decimal)avg, 6);
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var line = new MesXslRubberQuickTestRecordLine { SortNo = i };
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(col.DataPointId))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
line.DataPointId = col.DataPointId;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(col.PointName))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
line.InspectItem = col.PointName;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (col.LowerLimit != null)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
line.LowerLimit = col.LowerLimit;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (col.UpperLimit != null)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
line.UpperLimit = col.UpperLimit;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
line.InspectValue = avgDecimal;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
lines.Add(line);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return lines;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private List<MesXslRubberQuickTestRecordRawLine> BuildRawLineList()
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var rawLines = new List<MesXslRubberQuickTestRecordRawLine>();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
int sort = 0;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
foreach (var row in InspectRows)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
for (int i = 0; i < row.Cells.Count; i++)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var cell = row.Cells[i];
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (cell.Value == null)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var raw = new MesXslRubberQuickTestRecordRawLine { SortNo = sort++ };
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(row.RowNo))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
raw.RowNo = row.RowNo;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(cell.DataPointId))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
raw.DataPointId = cell.DataPointId;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(cell.PointName))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
raw.InspectItem = cell.PointName;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (cell.LowerLimit != null)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
raw.LowerLimit = cell.LowerLimit;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (cell.UpperLimit != null)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
raw.UpperLimit = cell.UpperLimit;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
raw.InspectValue = cell.Value;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
raw.RowInspectResult = row.InspectResultCode;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
rawLines.Add(raw);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return rawLines;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool HasExperimentStandardForRubber(string? rubberMaterialName)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(rubberMaterialName)) return false;
|
|
|
|
|
|
return FilterApplicableStds(rubberMaterialName).Any();
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
private void RecalculateOverallInspectResult()
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
string display;
|
|
|
|
|
|
string code;
|
|
|
|
|
|
|
|
|
|
|
|
if (!HasExperimentStandardForRubber(RubberMaterialName)
|
|
|
|
|
|
|| _currentStd == null
|
|
|
|
|
|
|| DataPointColumns.Count == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
display = "不合格";
|
|
|
|
|
|
code = "0";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (InspectRows.Count == 0
|
|
|
|
|
|
|| InspectRows.Any(r => !string.Equals(r.InspectResultText, "合格", StringComparison.Ordinal)))
|
|
|
|
|
|
{
|
|
|
|
|
|
display = "不合格";
|
|
|
|
|
|
code = "0";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
display = "合格";
|
|
|
|
|
|
code = "1";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OverallInspectResultCode = code;
|
|
|
|
|
|
OverallInspectResultDisplay = display;
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MesXslRubberQuickTestRecord BuildSaveRecord(
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
List<MesXslRubberQuickTestRecordLine> lineList,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
List<MesXslRubberQuickTestRecordRawLine> rawLineList,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
int inspectTimes,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
SysUser? user)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
var record = new MesXslRubberQuickTestRecord
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
LineList = lineList,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
RawLineList = rawLineList,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
InspectTime = DateTime.Now,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
InspectResult = OverallInspectResultCode
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(_currentStd?.RubberMaterialId))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.RubberMaterialId = _currentStd.RubberMaterialId;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(RubberMaterialName))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.RubberMaterialName = RubberMaterialName;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(_currentStd?.Id))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.StdId = _currentStd.Id;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(_selectedPlan?.MachineId))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.ProdEquipmentLedgerId = _selectedPlan.MachineId;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(MachineName))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.ProdEquipmentName = MachineName;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.ProductionDate = MixingDate;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(TrainNo))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.TrainNo = TrainNo.Trim();
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (SelectedShift != null && !string.IsNullOrWhiteSpace(SelectedShift.Code))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.WorkShift = SelectedShift.Code;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.InspectTimes = inspectTimes;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(_selectedPlan?.PlanMaterialNo))
|
|
|
|
|
|
|
|
|
|
|
|
record.ProductionPlanNo = _selectedPlan.PlanMaterialNo;
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
|
|
|
|
|
|
var inspectorId = user?.JeecgBizUserId ?? (user != null ? user.Id.ToString() : null);
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(inspectorId))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.InspectorUserId = inspectorId;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(user?.Account))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.InspectorUsername = user.Account;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(user?.RealName))
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
record.InspectorRealname = user.RealName;
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
return record;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private static Axis[] BuildTimeAxis() => new[]
|
|
|
|
|
|
{
|
|
|
|
|
|
new Axis
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "时间(min)",
|
|
|
|
|
|
MinLimit = 0,
|
|
|
|
|
|
MaxLimit = 2,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
MinStep = 0.5,
|
|
|
|
|
|
ForceStepToMin = true,
|
2026-06-17 15:41:06 +08:00
|
|
|
|
LabelsPaint = new SolidColorPaint(SKColors.Gray),
|
|
|
|
|
|
NamePaint = new SolidColorPaint(SKColors.Gray)
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private static Axis[] BuildTempYAxis() => new[]
|
|
|
|
|
|
{
|
|
|
|
|
|
new Axis
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "温度(℃)",
|
|
|
|
|
|
MinLimit = 189,
|
|
|
|
|
|
MaxLimit = 201,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
MinStep = 3,
|
|
|
|
|
|
ForceStepToMin = true,
|
|
|
|
|
|
Labeler = v => FormatAxisTick(v, 189, 192, 195, 198, 201),
|
2026-06-17 15:41:06 +08:00
|
|
|
|
LabelsPaint = new SolidColorPaint(SKColors.Gray),
|
|
|
|
|
|
NamePaint = new SolidColorPaint(SKColors.Gray)
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
private static readonly double[] TorqueYTicks = { 0.0, 3.0, 5.9, 8.9, 11.8, 14.8 };
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
private static Axis[] BuildTorqueYAxis() => new[]
|
|
|
|
|
|
{
|
|
|
|
|
|
new Axis
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "S'(dNm)",
|
|
|
|
|
|
MinLimit = 0,
|
2026-06-18 15:18:11 +08:00
|
|
|
|
MaxLimit = 14.8,
|
|
|
|
|
|
CustomSeparators = TorqueYTicks,
|
|
|
|
|
|
Labeler = FormatTorqueAxisLabel,
|
2026-06-17 15:41:06 +08:00
|
|
|
|
LabelsPaint = new SolidColorPaint(SKColors.Gray),
|
|
|
|
|
|
NamePaint = new SolidColorPaint(SKColors.Gray)
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
private static string FormatTorqueAxisLabel(double value)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var tick in TorqueYTicks)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Math.Abs(value - tick) > 0.05) continue;
|
|
|
|
|
|
return tick.ToString("0.0");
|
|
|
|
|
|
}
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static string FormatAxisTick(double value, params double[] ticks)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var tick in ticks)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Math.Abs(value - tick) > 0.01) continue;
|
|
|
|
|
|
return Math.Abs(tick - Math.Round(tick)) < 0.001
|
|
|
|
|
|
? ((int)Math.Round(tick)).ToString()
|
|
|
|
|
|
: tick.ToString("0.#");
|
|
|
|
|
|
}
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override void CleanUp()
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (_planChangedToken != null)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
_eventAggregator.GetEvent<MixingProductionPlanChangedEvent>().Unsubscribe(_planChangedToken);
|
|
|
|
|
|
|
|
|
|
|
|
_planChangedToken = null;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_stdChangedToken != null)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
_eventAggregator.GetEvent<RubberQuickTestStdChangedEvent>().Unsubscribe(_stdChangedToken);
|
|
|
|
|
|
|
|
|
|
|
|
_stdChangedToken = null;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
base.CleanUp();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public new void Destroy() => base.Destroy();
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public class WorkShiftOption
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public WorkShiftOption(string code, string name)
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
{
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Code = code;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
Name = name;
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string Code { get; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
public string Name { get; }
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
2026-06-17 15:41:06 +08:00
|
|
|
|
}
|
2026-06-18 15:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|