Browse Source

180更新

样式分支
taoye 1 year ago
parent
commit
e07505b41a
4 changed files with 69 additions and 32 deletions
  1. +32
    -6
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  2. +34
    -24
      FryPot_DosingSystem/View/NewRecipeView.xaml.cs
  3. +2
    -1
      FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs
  4. +1
    -1
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs

+ 32
- 6
FryPot_DosingSystem/Control/DosingLogicControl.cs View File

@@ -3723,7 +3723,7 @@ namespace FryPot_DosingSystem.Control
{
if (result.FlowProcess.fpModels.Count > 0)
{
FryPotMonitorManage.GetInstance.fryThree.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight;
FryPotMonitorManage.GetInstance.fryThree.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryThree.OilCapacity;
FryPotRecipeSetDown(headNum, result);//炒锅工艺数据下发
}
@@ -3738,6 +3738,8 @@ namespace FryPot_DosingSystem.Control
}
catch (Exception)
{
LThreeRecipeQuene.Clear();
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
return;

//throw;
@@ -3768,7 +3770,12 @@ namespace FryPot_DosingSystem.Control
LThreeRecipeQuene.Clear();

}
else if(LThreeRecipeQuene.Count > 0)
{
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
LThreeRecipeQuene.Clear();

}

}
/// <summary>
@@ -3925,7 +3932,7 @@ namespace FryPot_DosingSystem.Control
{
if (result.FlowProcess.fpModels.Count > 0)
{
FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight;
FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryTwo.OilCapacity;
FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
}
@@ -3940,6 +3947,8 @@ namespace FryPot_DosingSystem.Control
}
catch (Exception)
{
LTwoRecipeQuene.Clear();
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
return;
// throw;
}
@@ -3950,7 +3959,7 @@ namespace FryPot_DosingSystem.Control
{
if (result.FlowProcess.fpModels.Count > 0)
{
FryPotMonitorManage.GetInstance.fryFive.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight;
FryPotMonitorManage.GetInstance.fryFive.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryFive.OilCapacity;
FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
}
@@ -3965,6 +3974,8 @@ namespace FryPot_DosingSystem.Control
}
catch (Exception)
{
LTwoRecipeQuene.Clear();
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
return;
// throw;
}
@@ -3993,6 +4004,11 @@ namespace FryPot_DosingSystem.Control
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线处于集中洗桶模式,无法下发配方"); }));
LTwoRecipeQuene.Clear();
}
else if(LTwoRecipeQuene.Count > 0)
{
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
LTwoRecipeQuene.Clear();
}
}

/// <summary>
@@ -4144,7 +4160,8 @@ namespace FryPot_DosingSystem.Control
{
if (result.FlowProcess.fpModels.Count > 0)
{
FryPotMonitorManage.GetInstance.fryOne.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight;

FryPotMonitorManage.GetInstance.fryOne.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryOne.OilCapacity;
FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
}
@@ -4159,6 +4176,8 @@ namespace FryPot_DosingSystem.Control
}
catch (Exception)
{
RecipeQuene.Clear();
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒股工艺异常,配方下发失败"); }));
return;
// throw;
}
@@ -4169,7 +4188,7 @@ namespace FryPot_DosingSystem.Control
{
if (result.FlowProcess.fpModels.Count > 0)
{
FryPotMonitorManage.GetInstance.fryFour.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight;
FryPotMonitorManage.GetInstance.fryFour.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryFour.OilCapacity;
FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
}
@@ -4184,6 +4203,8 @@ namespace FryPot_DosingSystem.Control
}
catch (Exception)
{
RecipeQuene.Clear();
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
return;
//throw;
}
@@ -4210,7 +4231,12 @@ namespace FryPot_DosingSystem.Control
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线处于集中洗桶模式,无法下发配方"); }));
RecipeQuene.Clear();
}
else if (RecipeQuene.Count>0)
{
Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
RecipeQuene.Clear();

}

}



+ 34
- 24
FryPot_DosingSystem/View/NewRecipeView.xaml.cs View File

@@ -76,14 +76,18 @@ namespace FryPot_DosingSystem.View
{
if (sender is TextBox txt)
{
if (new Regex("^[1-8]$").IsMatch(txt.Text))//全匹配
if (txt.Text != null)
{

}
else
{
txt.Text = string.Empty;
if (new Regex("^[1-8]$").IsMatch(txt.Text))//全匹配
{

}
else
{
txt.Text = string.Empty;
}
}
}
}

@@ -160,17 +164,20 @@ namespace FryPot_DosingSystem.View
{
if (sender is TextBox txtbox)
{
if (Regex.IsMatch(txtbox.Text, @"^\+?[1-9][0-9]*$"))//非零正整数
{
txtbox.Text = txtbox.Text.Trim();

}
else
if (txtbox != null)
{
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
txtbox.Text = string.Empty;
if (Regex.IsMatch(txtbox.Text, @"^\+?[0-9][0-9]*$"))//非零正整数
{
txtbox.Text = txtbox.Text.Trim();

}
else
{
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
txtbox.Text = string.Empty;
}
}

}
}

@@ -178,17 +185,20 @@ namespace FryPot_DosingSystem.View
{
if (sender is TextBox txtbox)
{
if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[1-9]{0,1})?$"))//验证整数或1位小数
if (txtbox.Text != null)
{
txtbox.Text = txtbox.Text.Trim();

if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[1-9]{0,1})?$"))//验证整数或1位小数
{
txtbox.Text = txtbox.Text.Trim();

}
else
{
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
txtbox.Text = string.Empty;
}
}
else
{
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
txtbox.Text = string.Empty;
}

}
}
}


+ 2
- 1
FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs View File

@@ -25,7 +25,7 @@ namespace FryPot_DosingSystem.ViewModel
/// 目标重量偏差
/// </summary>
public string targetWeightOffset { get { return _targetWeightOffset; } set { _targetWeightOffset = value;OnPropertyChanged(); } }
private string _targetWeightOffset;
private string _targetWeightOffset="0";
public string currentRecipeName { get; set; }
public static int currentItemId { get; set; }
public RelayCommand CloseWindowCommand { get; set; }
@@ -116,6 +116,7 @@ namespace FryPot_DosingSystem.ViewModel
if (name != null)
{
name.FlowProcess.RecipeName = currentRecipeName.ToString();
if (float.TryParse(targetWeightOffset.Trim(), out float offset))
{
name.FlowProcess.targetWeightOffset = offset;//目标重量偏差


+ 1
- 1
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs View File

@@ -110,7 +110,7 @@ namespace FryPot_DosingSystem.ViewModel
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}


Loading…
Cancel
Save