Parcourir la source

180更新

样式分支
taoye il y a 2 ans
Parent
révision
e71497cce7
1 fichiers modifiés avec 39 ajouts et 0 suppressions
  1. +39
    -0
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs

+ 39
- 0
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs Voir le fichier

@@ -98,8 +98,22 @@ namespace FryPot_DosingSystem.ViewModel

if (name == null)
{
if (materials.Count<=8&& materials.Count> 0)
{
int lineNum= materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5)
{
MessageLog.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}

prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
if (res == null)
@@ -130,6 +144,18 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.Count > 0 && materials.Count <= 8)
{
int lineNum = materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageLog.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}
bom.materialCollection = materials;
bom.RecipeName = RecipeName;
bom.UpdateTime = DateTime.Now.ToShortDateString();
@@ -154,6 +180,19 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.Count>0&& materials.Count<=8)//验证配方中原料桶数
{
int lineNum = materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageLog.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}

prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
if (res == null)


Chargement…
Annuler
Enregistrer