taoye пре 2 година
родитељ
комит
e71497cce7
1 измењених фајлова са 39 додато и 0 уклоњено
  1. +39
    -0
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs

+ 39
- 0
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs Прегледај датотеку

@@ -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)


Loading…
Откажи
Сачувај