diff --git a/SlnMesnac.WPF/ViewModel/ProductionReportViewModel.cs b/SlnMesnac.WPF/ViewModel/ProductionReportViewModel.cs index cbe5fb8..26a4bcf 100644 --- a/SlnMesnac.WPF/ViewModel/ProductionReportViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/ProductionReportViewModel.cs @@ -67,7 +67,7 @@ namespace SlnMesnac.WPF.ViewModel if (planInfo != null) { complateRate = GetComplateRate(Convert.ToDouble(planInfo.CompleteAmount), planInfo.PlanAmount); - if (complateRate > 0.9) + if (complateRate > -10) { EndButtonColor = "#FF11B514"; } @@ -190,6 +190,14 @@ namespace SlnMesnac.WPF.ViewModel return; } + // + complateRate = GetComplateRate(Convert.ToDouble(planInfo.CompleteAmount), planInfo.PlanAmount); + if (complateRate > 10) + { + HintText = "实际数量已超过计划数量,请结束工单"; + return; + } + // 获取新输入的产量 string newAmount = NewAmountText?.Trim(); if (string.IsNullOrEmpty(newAmount)) @@ -233,7 +241,7 @@ namespace SlnMesnac.WPF.ViewModel // 更新完成率 complateRate = GetComplateRate(result, PlanAmountText); - if (complateRate > 0.9) + if (complateRate > -10) { EndButtonColor = "#FF11B514"; } @@ -252,7 +260,7 @@ namespace SlnMesnac.WPF.ViewModel private void EndPlan() { // 判断工单实际产量与目标产量的差距,满足才能执行结束 - if (complateRate > 0.9) + if (complateRate > -10) { if (EmployeeLoginViewModel.isOnDuty == true) // 是否有班组当班,无当班时操作无效 { @@ -332,7 +340,7 @@ namespace SlnMesnac.WPF.ViewModel private double GetComplateRate(double complateAmount, string planAmount) { double plan = Convert.ToDouble(planAmount); - return complateAmount / plan; + return complateAmount - plan; } public void OnPropertyChanged([CallerMemberName] string propertyName = "")