change -修改结束工单时产量差距条件为-10米,添加报工时的上限提示,防止超量执行。

main
启龙 曹 8 months ago
commit 97e596fec3

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

Loading…
Cancel
Save