Sfoglia il codice sorgente

180更新

样式分支
Mr_z 2 anni fa
parent
commit
52e54cbf41
8 ha cambiato i file con 130 aggiunte e 56 eliminazioni
  1. +35
    -33
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  2. +11
    -0
      FryPot_DosingSystem/Model/FlowProcessManage.cs
  3. +2
    -2
      FryPot_DosingSystem/Model/FlowProcessModel.cs
  4. +2
    -2
      FryPot_DosingSystem/Model/MaterialType.cs
  5. +8
    -3
      FryPot_DosingSystem/View/FlowProcessView.xaml
  6. +24
    -4
      FryPot_DosingSystem/View/FlowProcessView.xaml.cs
  7. +25
    -11
      FryPot_DosingSystem/View/NewRecipeView.xaml.cs
  8. +23
    -1
      FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs

+ 35
- 33
FryPot_DosingSystem/Control/DosingLogicControl.cs Vedi File

@@ -3723,7 +3723,7 @@ namespace FryPot_DosingSystem.Control
materialType = result.materialCollection[i],
materialId = result.RecipeId
});
RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//3号滚筒线桶号以及重量数据、偏差量下发
RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset * 10);//3号滚筒线桶号以及重量数据、偏差量下发



@@ -3930,7 +3930,7 @@ namespace FryPot_DosingSystem.Control
materialType = result.materialCollection[i],
materialId = result.RecipeId
});
RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//2号滚筒线桶号以及重量、偏差量数据下发
RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset*10);//2号滚筒线桶号以及重量、偏差量数据下发



@@ -4156,7 +4156,7 @@ namespace FryPot_DosingSystem.Control
materialType = result.materialCollection[i],
materialId = result.RecipeId
});
RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//1号滚筒线桶号以及重量、偏差量数据下发
RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset*10);//1号滚筒线桶号以及重量、偏差量数据下发



@@ -6382,23 +6382,23 @@ namespace FryPot_DosingSystem.Control
DeviceOperate.GetInstance.WriteRealPlcData("D1244", 0.0F);
DeviceOperate.GetInstance.WriteRealPlcData("D1246", 0.0F);
}
/// <summary>
/// 累加重量计算
/// </summary>
/// <param name="collect"></param>
public ushort SumAllTargetWeight(ObservableCollection<FlowProcessModel> collect,int length)
{
ushort total = 0;
if (collect.Count >= length)
{
for (int i = 0; i < length; i++)
{
total += collect.ElementAt(i).TargeWeight;
///// <summary>
///// 累加重量计算
///// </summary>
///// <param name="collect"></param>
//public ushort SumAllTargetWeight(ObservableCollection<FlowProcessModel> collect,int length)
//{
// ushort total = 0;
// if (collect.Count >= length)
// {
// for (int i = 0; i < length; i++)
// {
// total += collect.ElementAt(i).TargeWeight;
}
}
return total;
}
// }
// }
// return total;
//}

/// <summary>
@@ -6414,6 +6414,8 @@ namespace FryPot_DosingSystem.Control
#region 炒锅工艺下发
int length = 0;
WritePotData(potNum,"D3920",Convert.ToUInt16(result.FlowProcess.targetWeightOffset*10));//目标重量偏差下发

WritePotData(potNum, "D3143", Convert.ToUInt16(result.FlowProcess.StirTime));//秘制配方搅拌时间下发
if (result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == "清洗") != null)
{
WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count - 1));//工序数量
@@ -6421,7 +6423,7 @@ namespace FryPot_DosingSystem.Control
{
length = result.FlowProcess.fpModels.Count - 1;
WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryTemperature * 10));
WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryPeriodTime * 600));
WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryPeriodTime));
WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryWeight * 10));//炒制重量
WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).SmallFirePercent));
WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).MidFirePercent));
@@ -6476,7 +6478,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3002", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3003", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3003", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3005", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3006", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3007", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6515,7 +6517,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3012", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3013", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3013", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3015", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3016", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3017", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6554,7 +6556,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3022", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3023", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3023", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3025", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3026", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3027", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6593,7 +6595,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3032", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3033", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3033", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3035", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3036", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3037", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6632,7 +6634,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3042", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3043", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3043", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3045", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3046", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3047", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6671,7 +6673,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3052", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3053", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3053", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3055", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3056", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3057", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6710,7 +6712,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3062", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3063", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3063", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3065", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3066", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3067", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6749,7 +6751,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3072", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3073", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3073", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3075", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3076", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3077", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6788,7 +6790,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3082", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3083", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3083", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3085", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3086", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3087", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6826,7 +6828,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3092", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3093", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3093", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3095", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3096", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
WritePotData(potNum, "D3097", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
@@ -6865,7 +6867,7 @@ namespace FryPot_DosingSystem.Control
}

WritePotData(potNum, "D3102", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3103", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3103", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));

WritePotData(potNum, "D3105", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3106", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
@@ -6905,7 +6907,7 @@ namespace FryPot_DosingSystem.Control
if (result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum == "清洗")
{
WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
@@ -6997,7 +6999,7 @@ namespace FryPot_DosingSystem.Control
#endregion
WritePotData(PotNum, "D3120", 0);
WritePotData(PotNum,"D3920",0);//目标重量清零
WritePotData(PotNum, "D3143", 0);//秘制配方搅拌时间清零
}
}



+ 11
- 0
FryPot_DosingSystem/Model/FlowProcessManage.cs Vedi File

@@ -13,6 +13,17 @@ namespace FryPot_DosingSystem.Model
public string RecipeName { get; set; }
public float targetWeightOffset { get { return _targetWeightOffset; } set { _targetWeightOffset = value;OnPropertyChanged(); }}
private float _targetWeightOffset;

private ushort _stirTime;
/// <summary>
/// 秘制配方搅拌时间
/// </summary>
public ushort StirTime
{
get { return _stirTime; }
set { _stirTime = value; OnPropertyChanged(); }
}

public ObservableCollection<FlowProcessModel> fpModels { get; set; } = new ObservableCollection<FlowProcessModel>();
}
}

+ 2
- 2
FryPot_DosingSystem/Model/FlowProcessModel.cs Vedi File

@@ -37,8 +37,8 @@ namespace FryPot_DosingSystem.Model
/// <summary>
/// 目标重量
/// </summary>
public ushort TargeWeight { get { return _targetWeight; }set { _targetWeight = value;OnPropertyChanged(); } }
private ushort _targetWeight;
public double TargeWeight { get { return _targetWeight; }set { _targetWeight = value;OnPropertyChanged(); } }
private double _targetWeight;
/// <summary>
/// 炒制温度
/// </summary>


+ 2
- 2
FryPot_DosingSystem/Model/MaterialType.cs Vedi File

@@ -22,8 +22,8 @@ namespace FryPot_DosingSystem.Model
/// <summary>
/// 原料重量
/// </summary>
private ushort _materialWeight;
public ushort MaterialWeight { get { return _materialWeight; }set { _materialWeight = value;OnPropertyChanged(); } }
private double _materialWeight;
public double MaterialWeight { get { return _materialWeight; }set { _materialWeight = value;OnPropertyChanged(); } }

/// <summary>
/// 原料偏差


+ 8
- 3
FryPot_DosingSystem/View/FlowProcessView.xaml Vedi File

@@ -450,6 +450,11 @@
<TextBox Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#e69519" Cursor="Hand" Text="{Binding targetWeightOffset}" FontSize="18" Width="200" TextChanged="TextBox_TextChanged_10" Height="35" VerticalContentAlignment="Center"/>
<TextBlock Text="Kg" FontSize="20" Foreground="#FF2AB2E7" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="3" VerticalAlignment="Center" Orientation="Horizontal" Margin="500,0,0,5">
<TextBlock Text="秘制配方搅拌时间设置:" FontSize="20" Foreground="#FF2AB2E7" VerticalAlignment="Center"/>
<TextBox Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#e69519" Cursor="Hand" Text="{Binding StriTime}" FontSize="18" Width="200" TextChanged="TextBox_TextChanged_10" Height="35" VerticalContentAlignment="Center"/>
<TextBlock Text="分钟" FontSize="20" Foreground="#FF2AB2E7" VerticalAlignment="Center"/>
</StackPanel>
<ScrollViewer Grid.Row="4" VerticalScrollBarVisibility="Hidden">
<ItemsControl x:Name="itemcontrols" AlternationCount="{Binding flowProcessModels.Count}" ItemsSource="{Binding flowProcessModels}" Margin="0,1,0,-1">
<ItemsControl.ItemsPanel>
@@ -468,7 +473,7 @@ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="87" Height="40" V
<TextBox Text="{Binding TargeWeight}" Width="112" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1" TextChanged="TextBox_TextChanged_8"/>
<TextBox Text="{Binding FryTemperature}" Width="92" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1" TextChanged="TextBox_TextChanged_2"/>
<TextBox Text="{Binding FryPeriodTime}" Width="92" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1" TextChanged="TextBox_TextChanged_3"/>

<TextBox FontSize="18" >
<TextBox.Template>
@@ -480,10 +485,10 @@ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="87" Height="40" V
</StackPanel>
</Border>
<ControlTemplate.Triggers>
</ControlTemplate.Triggers>
</ControlTemplate>
</TextBox.Template>
</TextBox>
<TextBox FontSize="18" >


+ 24
- 4
FryPot_DosingSystem/View/FlowProcessView.xaml.cs Vedi File

@@ -106,9 +106,19 @@ namespace FryPot_DosingSystem.View

private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
if (sender is TextBox txtbox)
{
txt.Text = TextLimit(txt.Text);
if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[0-9]{0,1})?$"))//验证整数或1位小数
{
txtbox.Text = txtbox.Text.Trim();

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

}
}

@@ -162,9 +172,19 @@ namespace FryPot_DosingSystem.View

private void TextBox_TextChanged_8(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
if (sender is TextBox txtbox)
{
txt.Text = TextLimit(txt.Text);
if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[0-9]{0,1})?$"))//验证整数或1位小数
{
txtbox.Text = txtbox.Text.Trim();

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

}
}



+ 25
- 11
FryPot_DosingSystem/View/NewRecipeView.xaml.cs Vedi File

@@ -162,22 +162,36 @@ namespace FryPot_DosingSystem.View

private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
{
//if (sender is TextBox txtbox)
//{
// if (txtbox != null)
// {
// 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;
// }
// }

//}
if (sender is TextBox txtbox)
{
if (txtbox != null)
if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[0-9]{0,1})?$"))//验证整数或1位小数
{
if (Regex.IsMatch(txtbox.Text, @"^\+?[0-9][0-9]*$"))//非零正整数
{
txtbox.Text = txtbox.Text.Trim();
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;
}

}
}



+ 23
- 1
FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs Vedi File

@@ -26,6 +26,18 @@ namespace FryPot_DosingSystem.ViewModel
/// </summary>
public string targetWeightOffset { get { return _targetWeightOffset; } set { _targetWeightOffset = value;OnPropertyChanged(); } }
private string _targetWeightOffset="0";

private string _stirTime;
/// <summary>
/// 秘制配方搅拌时间
/// </summary>
public string StirTime
{
get { return _stirTime; }
set { _stirTime = value; OnPropertyChanged(); }
}


public string currentRecipeName { get; set; }
public static int currentItemId { get; set; }
public RelayCommand CloseWindowCommand { get; set; }
@@ -72,6 +84,7 @@ namespace FryPot_DosingSystem.ViewModel
if (res != null && res is NewRecipeModel recipe) //编辑已有工艺
{
targetWeightOffset = recipe.FlowProcess.targetWeightOffset.ToString();
StirTime=recipe.FlowProcess.StirTime.ToString();
foreach (var item in recipe.materialCollection)
{
if (!FlowItems.Contains(item.MaterialLoc.ToString()))
@@ -81,7 +94,6 @@ namespace FryPot_DosingSystem.ViewModel
{
flowProcessModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, TargeWeight=item.TargeWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime, SmallFirePercent = item.SmallFirePercent, MidFirePercent = item.MidFirePercent, BigFirePercent = item.BigFirePercent, StrongFirePercent = item.StrongFirePercent });
}

// ActionManage.GetInstance.Send("MaterialNum", recipe.materialCollection.Count);
}
else//创建新工艺
@@ -127,6 +139,16 @@ namespace FryPot_DosingSystem.ViewModel
name.FlowProcess.targetWeightOffset = 0.0F;
return;
}
if (ushort.TryParse(_stirTime.Trim(), out ushort time))
{
name.FlowProcess.StirTime = time;//秘制配方搅拌时间
}
else
{
MessageBox.Show("非法秘制配方搅拌时间设置", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
name.FlowProcess.StirTime = 0;
return;
}
//工艺桶号重复性检测
foreach (var item in name.materialCollection)
{


Caricamento…
Annulla
Salva