From 52e54cbf4168376fe7ca63ebf003bcd46b174cb7 Mon Sep 17 00:00:00 2001 From: Mr_z <1047577696@qqcom> Date: Wed, 14 Dec 2022 15:08:55 +0800 Subject: [PATCH] =?UTF-8?q?180=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Control/DosingLogicControl.cs | 68 ++++++++++--------- .../Model/FlowProcessManage.cs | 11 +++ FryPot_DosingSystem/Model/FlowProcessModel.cs | 4 +- FryPot_DosingSystem/Model/MaterialType.cs | 4 +- FryPot_DosingSystem/View/FlowProcessView.xaml | 11 ++- .../View/FlowProcessView.xaml.cs | 28 ++++++-- .../View/NewRecipeView.xaml.cs | 36 +++++++--- .../ViewModel/FlowProcessSetViewModel.cs | 24 ++++++- 8 files changed, 130 insertions(+), 56 deletions(-) diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 3b4457e2..7564ab37 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -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); } - /// - /// 累加重量计算 - /// - /// - public ushort SumAllTargetWeight(ObservableCollection collect,int length) - { - ushort total = 0; - if (collect.Count >= length) - { - for (int i = 0; i < length; i++) - { - total += collect.ElementAt(i).TargeWeight; + ///// + ///// 累加重量计算 + ///// + ///// + //public ushort SumAllTargetWeight(ObservableCollection 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; + //} /// @@ -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);//秘制配方搅拌时间清零 } } diff --git a/FryPot_DosingSystem/Model/FlowProcessManage.cs b/FryPot_DosingSystem/Model/FlowProcessManage.cs index b09c707f..11e70b46 100644 --- a/FryPot_DosingSystem/Model/FlowProcessManage.cs +++ b/FryPot_DosingSystem/Model/FlowProcessManage.cs @@ -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; + /// + /// 秘制配方搅拌时间 + /// + public ushort StirTime + { + get { return _stirTime; } + set { _stirTime = value; OnPropertyChanged(); } + } + public ObservableCollection fpModels { get; set; } = new ObservableCollection(); } } diff --git a/FryPot_DosingSystem/Model/FlowProcessModel.cs b/FryPot_DosingSystem/Model/FlowProcessModel.cs index 9b2b2e3a..b08640d2 100644 --- a/FryPot_DosingSystem/Model/FlowProcessModel.cs +++ b/FryPot_DosingSystem/Model/FlowProcessModel.cs @@ -37,8 +37,8 @@ namespace FryPot_DosingSystem.Model /// /// 目标重量 /// - 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; /// /// 炒制温度 /// diff --git a/FryPot_DosingSystem/Model/MaterialType.cs b/FryPot_DosingSystem/Model/MaterialType.cs index 3c068c01..23cf1d92 100644 --- a/FryPot_DosingSystem/Model/MaterialType.cs +++ b/FryPot_DosingSystem/Model/MaterialType.cs @@ -22,8 +22,8 @@ namespace FryPot_DosingSystem.Model /// /// 原料重量 /// - 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(); } } /// /// 原料偏差 diff --git a/FryPot_DosingSystem/View/FlowProcessView.xaml b/FryPot_DosingSystem/View/FlowProcessView.xaml index 4331dd0c..1a4f7ac1 100644 --- a/FryPot_DosingSystem/View/FlowProcessView.xaml +++ b/FryPot_DosingSystem/View/FlowProcessView.xaml @@ -450,6 +450,11 @@ + + + + + @@ -468,7 +473,7 @@ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="87" Height="40" V - + @@ -480,10 +485,10 @@ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="87" Height="40" V - + - + diff --git a/FryPot_DosingSystem/View/FlowProcessView.xaml.cs b/FryPot_DosingSystem/View/FlowProcessView.xaml.cs index 7f0efff8..c6ee25cf 100644 --- a/FryPot_DosingSystem/View/FlowProcessView.xaml.cs +++ b/FryPot_DosingSystem/View/FlowProcessView.xaml.cs @@ -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; + } + } } diff --git a/FryPot_DosingSystem/View/NewRecipeView.xaml.cs b/FryPot_DosingSystem/View/NewRecipeView.xaml.cs index ebe53134..43e793a3 100644 --- a/FryPot_DosingSystem/View/NewRecipeView.xaml.cs +++ b/FryPot_DosingSystem/View/NewRecipeView.xaml.cs @@ -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; + } + } } diff --git a/FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs b/FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs index 6fece1b0..1dafbca3 100644 --- a/FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs @@ -26,6 +26,18 @@ namespace FryPot_DosingSystem.ViewModel /// public string targetWeightOffset { get { return _targetWeightOffset; } set { _targetWeightOffset = value;OnPropertyChanged(); } } private string _targetWeightOffset="0"; + + private string _stirTime; + /// + /// 秘制配方搅拌时间 + /// + 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) {