|
|
|
@ -5,6 +5,7 @@ using SlnMesnac.Business;
|
|
|
|
|
using SlnMesnac.Business.@base;
|
|
|
|
|
using SlnMesnac.Model.domain;
|
|
|
|
|
using SlnMesnac.Plc;
|
|
|
|
|
using SlnMesnac.WPF.Model;
|
|
|
|
|
using SlnMesnac.WPF.ViewModel;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
@ -38,9 +39,13 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
private readonly ILogger<DevMonitorPage> _logger;
|
|
|
|
|
|
|
|
|
|
System.Timers.Timer systemRunTimer = new System.Timers.Timer(1000 * 60);
|
|
|
|
|
//系统频率配方
|
|
|
|
|
private RecipeManageCache recipeManageCache = RecipeManageCache.Instance;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DevMonitorPage()
|
|
|
|
|
{
|
|
|
|
|
RecipeModeSetWindow.ManualChangeRecipeEvent += ManualChangeRecipe;
|
|
|
|
|
_logger = App.ServiceProvider.GetService<ILogger<DevMonitorPage>>();
|
|
|
|
|
_configInfoBusiness = App.ServiceProvider.GetService<ConfigInfoBusiness>();
|
|
|
|
|
|
|
|
|
@ -50,33 +55,31 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
this.DataContext = new DevMonitorViewModel();
|
|
|
|
|
Init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StartMachineLisening();
|
|
|
|
|
StartAdjustRecipe();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Init()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Init()
|
|
|
|
|
{
|
|
|
|
|
systemRunTimer.Elapsed += new System.Timers.ElapsedEventHandler(CalculateSystemRunTime);
|
|
|
|
|
systemRunTimer.AutoReset = true;
|
|
|
|
|
systemRunTimer.Enabled = true;
|
|
|
|
|
systemRunTimer.Start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
|
|
|
|
|
|
|
|
|
|
// UnpackSet1Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机翻转机频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
// UnpackSet2Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机滚筒筛频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
UnpackSet3Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机螺旋1频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
UnpackSet4Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机螺旋2频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
// UnpackSet5Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机废袋机频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
BagsAmountTxt.Text = configInfos.Where(x => x.ConfigKey == "包装袋余量").FirstOrDefault().ConfigValue;
|
|
|
|
|
Speed1Txt.Text = configInfos.Where(x => x.ConfigKey == "螺旋1速度设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
Speed2Txt.Text = configInfos.Where(x => x.ConfigKey == "螺旋2速度设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
HotSpiralSpeedTxt.Text = configInfos.Where(x => x.ConfigKey == "烘干机螺旋频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
// UnpackSet1Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机翻转机频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
// UnpackSet2Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机滚筒筛频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
//UnpackSet3Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机螺旋1频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
//UnpackSet4Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机螺旋2频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
// UnpackSet5Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机废袋机频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
|
|
|
|
|
//Speed1Txt.Text = configInfos.Where(x => x.ConfigKey == "螺旋1速度设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
//Speed2Txt.Text = configInfos.Where(x => x.ConfigKey == "螺旋2速度设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
// HotSpiralSpeedTxt.Text = configInfos.Where(x => x.ConfigKey == "烘干机螺旋频率设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
|
|
|
|
|
//HotTempTxt.Text = configInfos.Where(x => x.ConfigKey == "烘干机温度设定值").FirstOrDefault().ConfigValue;
|
|
|
|
|
}
|
|
|
|
@ -95,8 +98,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
if (unPackStatus1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
BaseConfigInfo configInfo = _configInfoBusiness.GetConfigInfos().Where(x => x.ConfigKey == "拆包机系统运行时长").FirstOrDefault();
|
|
|
|
|
BaseConfigInfo configInfo = _configInfoBusiness.GetConfigInfos().Where(x => x.ConfigKey == "系统运行时长").FirstOrDefault();
|
|
|
|
|
configInfo.ConfigValue += 1;
|
|
|
|
|
_configInfoBusiness.UpdateConfigInfo(configInfo);
|
|
|
|
|
}
|
|
|
|
@ -126,10 +128,10 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
RefreshHot();
|
|
|
|
|
RefreshUnPack();
|
|
|
|
|
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
BagsAmountTxt.Text = _configInfoBusiness.GetConfigInfos().FirstOrDefault(x => x.ConfigKey == "包装袋余量").ConfigValue;
|
|
|
|
|
}));
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
BagsAmountTxt.Text = _configInfoBusiness.GetConfigInfos().FirstOrDefault(x => x.ConfigKey == "包装袋余量").ConfigValue;
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -146,6 +148,220 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 监测缓存区重量,动态调整配方频率
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 开始启动监测缓存区重量,动态调整配方频率
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void StartAdjustRecipe()
|
|
|
|
|
{
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(1000 * 10);
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
float cacheWeigh = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("缓存区重量"));
|
|
|
|
|
recipeManageCache.BufferWeight = cacheWeigh;
|
|
|
|
|
if (recipeManageCache.RecipeMode == "自动模式")
|
|
|
|
|
{
|
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
bool signal2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1状态"));
|
|
|
|
|
bool signal3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2状态"));
|
|
|
|
|
int signal1_1 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋状态"));
|
|
|
|
|
|
|
|
|
|
if (signal1_1 == 1 && signal2 && signal3 && unPackStatus1) // 1.设备都已经启动
|
|
|
|
|
{
|
|
|
|
|
// 1.判断缓存区重量是否满足配方要求
|
|
|
|
|
RecipeManage targetRecipe = null;
|
|
|
|
|
int result = JudgeCacheWeighIsOk(cacheWeigh, out targetRecipe);
|
|
|
|
|
switch (result)
|
|
|
|
|
{
|
|
|
|
|
case -1:
|
|
|
|
|
// TODO添加报警记录推送
|
|
|
|
|
break;
|
|
|
|
|
case 0: break;
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
// 高切低
|
|
|
|
|
HighToLowSpeed(targetRecipe);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
// 低切高
|
|
|
|
|
LowToHighSpeed(targetRecipe);
|
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(1000 * 10);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"监测缓存区重量,动态调整配方频率StartAdjustRecipe异常:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 判断缓存区重量是否满足配方要求
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>-1,重量未匹配到目标配方,报警</returns>
|
|
|
|
|
/// <returns>0,无需更改配方</returns>
|
|
|
|
|
/// <returns>1,从高速模版切换到低速模版</returns>
|
|
|
|
|
/// <returns>2,从低速模版切换到高速模版</returns>
|
|
|
|
|
private int JudgeCacheWeighIsOk(float weight,out RecipeManage targetRecipe)
|
|
|
|
|
{
|
|
|
|
|
int result = -1;
|
|
|
|
|
targetRecipe = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in recipeManageCache.recipeManageList)
|
|
|
|
|
{
|
|
|
|
|
if (item.LowWeight <= weight && weight < item.HightWeight)
|
|
|
|
|
{
|
|
|
|
|
// 找到重量对应的配方
|
|
|
|
|
if (recipeManageCache.useRecipeManage == item)
|
|
|
|
|
{
|
|
|
|
|
// 不需要更改配方
|
|
|
|
|
result = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (recipeManageCache.useRecipeManage.LowWeight < item.LowWeight)
|
|
|
|
|
{
|
|
|
|
|
//重量变大 从高速模版切换到低速模版
|
|
|
|
|
result = 1;
|
|
|
|
|
targetRecipe = item;
|
|
|
|
|
}
|
|
|
|
|
else if (recipeManageCache.useRecipeManage.LowWeight > item.LowWeight)
|
|
|
|
|
{
|
|
|
|
|
//重量变小 从低速模版切换到高速模版
|
|
|
|
|
result = 2;
|
|
|
|
|
targetRecipe = item;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("JudgeCacheWeighIsOk异常:" + ex.Message);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 螺旋配方从高速切到低速:从前往后:拆包机、烘干、螺旋1,螺旋2
|
|
|
|
|
/// </summary>
|
|
|
|
|
private bool HighToLowSpeed(RecipeManage targetRecipe)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), targetRecipe.UnpackSpiral1);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), targetRecipe.UnpackSpiral2);
|
|
|
|
|
Thread.Sleep(int.Parse(recipeManageCache.UnpackToHotTime));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), targetRecipe.DryerSpiral);
|
|
|
|
|
Thread.Sleep(int.Parse(recipeManageCache.HotToSpiralTime));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设置"), targetRecipe.Spiral1);
|
|
|
|
|
Thread.Sleep(int.Parse(recipeManageCache.SpiralTwoTime));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设置"), targetRecipe.Spiral2);
|
|
|
|
|
//更新配方缓存里的当前使用模版
|
|
|
|
|
recipeManageCache.RecipeName = targetRecipe.RecipeName;
|
|
|
|
|
return true;
|
|
|
|
|
}catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("HighToLowSpeed异常:" + ex.Message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 螺旋配方从低速切到高速:从后往前:螺旋2、螺旋1、烘干、拆包机
|
|
|
|
|
/// </summary>
|
|
|
|
|
private bool LowToHighSpeed(RecipeManage targetRecipe)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设置"), targetRecipe.Spiral2);
|
|
|
|
|
Thread.Sleep(int.Parse(recipeManageCache.SpiralTwoTime));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设置"), targetRecipe.Spiral1);
|
|
|
|
|
Thread.Sleep(int.Parse(recipeManageCache.HotToSpiralTime));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), targetRecipe.DryerSpiral);
|
|
|
|
|
Thread.Sleep(int.Parse(recipeManageCache.UnpackToHotTime));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), targetRecipe.UnpackSpiral1);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), targetRecipe.UnpackSpiral2);
|
|
|
|
|
//更新配方缓存里的当前使用模版
|
|
|
|
|
recipeManageCache.RecipeName = targetRecipe.RecipeName;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("LowToHighSpeed异常:" + ex.Message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<bool> ManualChangeRecipe(RecipeManage targetRecipet)
|
|
|
|
|
{
|
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
bool signal2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1状态"));
|
|
|
|
|
bool signal3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2状态"));
|
|
|
|
|
int signal1_1 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋状态"));
|
|
|
|
|
|
|
|
|
|
if (signal1_1 == 1 && signal2 && signal3 && unPackStatus1) // 1.设备都已经启动
|
|
|
|
|
{
|
|
|
|
|
if(recipeManageCache.useRecipeManage.RecipeName == targetRecipet.RecipeName)
|
|
|
|
|
{
|
|
|
|
|
recipeManageCache.RecipeMode = "手动模式";
|
|
|
|
|
return true;
|
|
|
|
|
}else if (recipeManageCache.useRecipeManage.LowWeight < targetRecipet.LowWeight)
|
|
|
|
|
{//高速切低速
|
|
|
|
|
bool result = await Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
return HighToLowSpeed(targetRecipet);
|
|
|
|
|
});
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
recipeManageCache.RecipeMode = "手动模式";
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
else if (recipeManageCache.useRecipeManage.LowWeight > targetRecipet.LowWeight)
|
|
|
|
|
{
|
|
|
|
|
bool result = await Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
return LowToHighSpeed(targetRecipet);
|
|
|
|
|
});
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
recipeManageCache.RecipeMode = "手动模式";
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 设备启动、停止
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -168,11 +384,13 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void StartButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var result = MessageBox.Show("是否确认启动?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("拆包机MES允许远程,未切换远程");
|
|
|
|
@ -234,11 +452,14 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"一键启动:{ex.Message}");
|
|
|
|
|
_logger.LogError($"一键启动异常:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -357,11 +578,11 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
SendPulseSignal("拆包机远程启动");
|
|
|
|
|
|
|
|
|
|
//频率设定
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定值")));
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定值")));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定值")));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定值")));
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值")));
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定值")));
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定值")));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), recipeManageCache.useRecipeManage.UnpackSpiral1);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), recipeManageCache.useRecipeManage.UnpackSpiral2);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值")));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
@ -648,9 +869,9 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int value2 = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设定值"));
|
|
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), true);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设置"), value2);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设置"), recipeManageCache.useRecipeManage.Spiral2);
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
result = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"));
|
|
|
|
|
}
|
|
|
|
@ -678,7 +899,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#region 启动磁选机 / 前提:check螺旋2启动及速度是否达标
|
|
|
|
|
int value2 = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设定值")) * 100;
|
|
|
|
|
int value2 = recipeManageCache.useRecipeManage.Spiral2;
|
|
|
|
|
bool startFlag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"));
|
|
|
|
|
int speed2 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度反馈"));
|
|
|
|
|
if (!startFlag)
|
|
|
|
@ -686,7 +907,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
MessageBox.Show($"前提条件螺旋2未成功启动,请检查后重新启动");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (speed2 < value2 * 0.8)
|
|
|
|
|
if (speed2 < value2 * 100 * 0.8)
|
|
|
|
|
{
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
|
|
|
|
|
MessageBox.Show($"前提条件螺旋2速度{speed2}未达到设定值{value2}的下限阈值80%,请检查后重新启动");
|
|
|
|
@ -736,9 +957,9 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int value1 = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设定值"));
|
|
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), true);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设置"), value1);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设置"), recipeManageCache.useRecipeManage.Spiral1);
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
result = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"));
|
|
|
|
|
|
|
|
|
@ -761,7 +982,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
int value1 = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设定值"));
|
|
|
|
|
int value1 = recipeManageCache.useRecipeManage.Spiral1;
|
|
|
|
|
bool startFlag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"));
|
|
|
|
|
int speed1 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度反馈"));
|
|
|
|
|
if (!startFlag)
|
|
|
|
@ -777,7 +998,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
}
|
|
|
|
|
int value = int.Parse(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定值"));
|
|
|
|
|
SendPulseSignal("烘干机螺旋启动");
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), value1);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), recipeManageCache.useRecipeManage.DryerSpiral);
|
|
|
|
|
Thread.Sleep(MachineSleep / 2);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -816,7 +1037,6 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 烘干机燃烧启动/前提:check:烘干机风机启动
|
|
|
|
|
/// </summary>
|
|
|
|
@ -868,11 +1088,11 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
SendPulseSignal("拆包机远程启动");
|
|
|
|
|
|
|
|
|
|
//频率设定
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定值")));
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定值")));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定值")));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定值")));
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值")));
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定值")));
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定值")));
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), recipeManageCache.useRecipeManage.UnpackSpiral1);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), recipeManageCache.useRecipeManage.UnpackSpiral2);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值")));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
@ -977,8 +1197,6 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 螺旋机参数监控
|
|
|
|
|
/// </summary>
|
|
|
|
@ -1141,159 +1359,165 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
MessageBox.Show(message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 螺旋速度设定
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void SpiralSpeed_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
|
|
|
|
private void AmountChangeButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BagsAmountSetWindow window = new BagsAmountSetWindow();
|
|
|
|
|
window.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
bool isValidSpeed1 = int.TryParse(Speed1Txt.Text, out int speed1);
|
|
|
|
|
bool isValidSpeed2 = int.TryParse(Speed2Txt.Text, out int speed2);
|
|
|
|
|
|
|
|
|
|
// 校验输入的整数是否在0到50之间且大于0
|
|
|
|
|
if (isValidSpeed1 && isValidSpeed2 && speed1 > 0 && speed1 <= 50 && speed2 > 0 && speed2 <= 50)
|
|
|
|
|
{
|
|
|
|
|
if (speed1 > speed2)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("螺旋1速度不能大于螺旋2速度");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var result = MessageBox.Show("是否确认更改?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
|
|
|
|
|
BaseConfigInfo configInfo1 = configInfos.Where(x => x.ConfigKey == "螺旋1速度设定值").FirstOrDefault();
|
|
|
|
|
BaseConfigInfo configInfo2 = configInfos.Where(x => x.ConfigKey == "螺旋2速度设定值").FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设置"), speed1);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设置"), speed2);
|
|
|
|
|
#region 设备管理界面螺旋频率设定--暂未启用
|
|
|
|
|
|
|
|
|
|
configInfo1.ConfigValue = Speed1Txt.Text;
|
|
|
|
|
configInfo2.ConfigValue = Speed2Txt.Text;
|
|
|
|
|
_configInfoBusiness.UpdateConfigInfo(configInfo1);
|
|
|
|
|
_configInfoBusiness.UpdateConfigInfo(configInfo2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请输入0到50之间的正整数!");
|
|
|
|
|
}
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 螺旋速度设定
|
|
|
|
|
///// </summary>
|
|
|
|
|
///// <param name="sender"></param>
|
|
|
|
|
///// <param name="e"></param>
|
|
|
|
|
//private void SpiralSpeed_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// bool isValidSpeed1 = int.TryParse(Speed1Txt.Text, out int speed1);
|
|
|
|
|
// bool isValidSpeed2 = int.TryParse(Speed2Txt.Text, out int speed2);
|
|
|
|
|
|
|
|
|
|
// // 校验输入的整数是否在0到50之间且大于0
|
|
|
|
|
// if (isValidSpeed1 && isValidSpeed2 && speed1 > 0 && speed1 <= 50 && speed2 > 0 && speed2 <= 50)
|
|
|
|
|
// {
|
|
|
|
|
// if (speed1 > speed2)
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("螺旋1速度不能大于螺旋2速度");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// var result = MessageBox.Show("是否确认更改?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
// if (result == MessageBoxResult.Yes)
|
|
|
|
|
// {
|
|
|
|
|
// List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
|
|
|
|
|
// BaseConfigInfo configInfo1 = configInfos.Where(x => x.ConfigKey == "螺旋1速度设定值").FirstOrDefault();
|
|
|
|
|
// BaseConfigInfo configInfo2 = configInfos.Where(x => x.ConfigKey == "螺旋2速度设定值").FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 烘干机螺旋频率设定
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void HotSpiralSpeedSet_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
bool isValidSpeed1 = int.TryParse(HotSpiralSpeedTxt.Text, out int speed1);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设置"), speed1);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设置"), speed2);
|
|
|
|
|
|
|
|
|
|
// 校验输入的整数是否在0到50之间且大于0
|
|
|
|
|
if (isValidSpeed1 && speed1 > 0 && speed1 <= 50)
|
|
|
|
|
{
|
|
|
|
|
var result = MessageBox.Show("是否确认更改?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
|
|
|
|
|
BaseConfigInfo configInfo = configInfos.Where(x => x.ConfigKey == "烘干机螺旋频率设定值").FirstOrDefault();
|
|
|
|
|
// configInfo1.ConfigValue = Speed1Txt.Text;
|
|
|
|
|
// configInfo2.ConfigValue = Speed2Txt.Text;
|
|
|
|
|
// _configInfoBusiness.UpdateConfigInfo(configInfo1);
|
|
|
|
|
// _configInfoBusiness.UpdateConfigInfo(configInfo2);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("请输入0到50之间的正整数!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), speed1);
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// _logger.LogError(ex.Message);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
configInfo.ConfigValue = HotSpiralSpeedTxt.Text;
|
|
|
|
|
|
|
|
|
|
_configInfoBusiness.UpdateConfigInfo(configInfo);
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 烘干机螺旋频率设定
|
|
|
|
|
///// </summary>
|
|
|
|
|
///// <param name="sender"></param>
|
|
|
|
|
///// <param name="e"></param>
|
|
|
|
|
//private void HotSpiralSpeedSet_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// bool isValidSpeed1 = int.TryParse(HotSpiralSpeedTxt.Text, out int speed1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请输入0到50之间的正整数!");
|
|
|
|
|
}
|
|
|
|
|
// // 校验输入的整数是否在0到50之间且大于0
|
|
|
|
|
// if (isValidSpeed1 && speed1 > 0 && speed1 <= 50)
|
|
|
|
|
// {
|
|
|
|
|
// var result = MessageBox.Show("是否确认更改?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
// if (result == MessageBoxResult.Yes)
|
|
|
|
|
// {
|
|
|
|
|
// List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
|
|
|
|
|
// BaseConfigInfo configInfo = configInfos.Where(x => x.ConfigKey == "烘干机螺旋频率设定值").FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), speed1);
|
|
|
|
|
|
|
|
|
|
private void UnpackSetButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// bool isValidSpeed1 = int.TryParse(UnpackSet1Txt.Text, out int speed1) && speed1 >= 0 && speed1 <= 50;
|
|
|
|
|
// bool isValidSpeed2 = int.TryParse(UnpackSet2Txt.Text, out int speed2) && speed2 >= 0 && speed2 <= 50;
|
|
|
|
|
bool isValidSpeed3 = int.TryParse(UnpackSet3Txt.Text, out int speed3) && speed3 >= 0 && speed3 <= 50;
|
|
|
|
|
bool isValidSpeed4 = int.TryParse(UnpackSet4Txt.Text, out int speed4) && speed4 >= 0 && speed4 <= 50;
|
|
|
|
|
// bool isValidSpeed5 = int.TryParse(UnpackSet5Txt.Text, out int speed5) && speed5 >= 0 && speed5 <= 50;
|
|
|
|
|
// configInfo.ConfigValue = HotSpiralSpeedTxt.Text;
|
|
|
|
|
|
|
|
|
|
// _configInfoBusiness.UpdateConfigInfo(configInfo);
|
|
|
|
|
|
|
|
|
|
if ( isValidSpeed3 && isValidSpeed4 )
|
|
|
|
|
{
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("请输入0到50之间的正整数!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
var result = MessageBox.Show("是否确认更改?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// _logger.LogError(ex.Message);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//private void UnpackSetButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// // bool isValidSpeed1 = int.TryParse(UnpackSet1Txt.Text, out int speed1) && speed1 >= 0 && speed1 <= 50;
|
|
|
|
|
// // bool isValidSpeed2 = int.TryParse(UnpackSet2Txt.Text, out int speed2) && speed2 >= 0 && speed2 <= 50;
|
|
|
|
|
// bool isValidSpeed3 = int.TryParse(UnpackSet3Txt.Text, out int speed3) && speed3 >= 0 && speed3 <= 50;
|
|
|
|
|
// bool isValidSpeed4 = int.TryParse(UnpackSet4Txt.Text, out int speed4) && speed4 >= 0 && speed4 <= 50;
|
|
|
|
|
// // bool isValidSpeed5 = int.TryParse(UnpackSet5Txt.Text, out int speed5) && speed5 >= 0 && speed5 <= 50;
|
|
|
|
|
|
|
|
|
|
//频率设定
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), speed1);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), speed2);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), speed3);
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), speed4);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), speed5);
|
|
|
|
|
|
|
|
|
|
List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
|
|
|
|
|
// BaseConfigInfo configInfo1 = configInfos.Where(x => x.ConfigKey == "拆包机翻转机频率设定值").FirstOrDefault();
|
|
|
|
|
// BaseConfigInfo configInfo2 = configInfos.Where(x => x.ConfigKey == "拆包机滚筒筛频率设定值").FirstOrDefault();
|
|
|
|
|
BaseConfigInfo configInfo3 = configInfos.Where(x => x.ConfigKey == "拆包机螺旋1频率设定值").FirstOrDefault();
|
|
|
|
|
BaseConfigInfo configInfo4 = configInfos.Where(x => x.ConfigKey == "拆包机螺旋2频率设定值").FirstOrDefault();
|
|
|
|
|
// BaseConfigInfo configInfo5 = configInfos.Where(x => x.ConfigKey == "拆包机废袋机频率设定值").FirstOrDefault();
|
|
|
|
|
// configInfo1.ConfigValue = UnpackSet1Txt.Text;
|
|
|
|
|
// configInfo2.ConfigValue = UnpackSet2Txt.Text;
|
|
|
|
|
configInfo3.ConfigValue = UnpackSet3Txt.Text;
|
|
|
|
|
configInfo4.ConfigValue = UnpackSet4Txt.Text;
|
|
|
|
|
// configInfo5.ConfigValue = UnpackSet5Txt.Text;
|
|
|
|
|
// _configInfoBusiness.UpdateConfigInfo(configInfo1);
|
|
|
|
|
// _configInfoBusiness.UpdateConfigInfo(configInfo2);
|
|
|
|
|
_configInfoBusiness.UpdateConfigInfo(configInfo3);
|
|
|
|
|
_configInfoBusiness.UpdateConfigInfo(configInfo4);
|
|
|
|
|
// _configInfoBusiness.UpdateConfigInfo(configInfo5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请输入0到50之间的正整数!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
// if ( isValidSpeed3 && isValidSpeed4 )
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// var result = MessageBox.Show("是否确认更改?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
// if (result == MessageBoxResult.Yes)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AmountChangeButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BagsAmountSetWindow window = new BagsAmountSetWindow();
|
|
|
|
|
window.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
// //频率设定
|
|
|
|
|
// // plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), speed1);
|
|
|
|
|
// // plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), speed2);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), speed3);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), speed4);
|
|
|
|
|
// // plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), speed5);
|
|
|
|
|
|
|
|
|
|
// List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
|
|
|
|
|
// // BaseConfigInfo configInfo1 = configInfos.Where(x => x.ConfigKey == "拆包机翻转机频率设定值").FirstOrDefault();
|
|
|
|
|
// // BaseConfigInfo configInfo2 = configInfos.Where(x => x.ConfigKey == "拆包机滚筒筛频率设定值").FirstOrDefault();
|
|
|
|
|
// BaseConfigInfo configInfo3 = configInfos.Where(x => x.ConfigKey == "拆包机螺旋1频率设定值").FirstOrDefault();
|
|
|
|
|
// BaseConfigInfo configInfo4 = configInfos.Where(x => x.ConfigKey == "拆包机螺旋2频率设定值").FirstOrDefault();
|
|
|
|
|
// // BaseConfigInfo configInfo5 = configInfos.Where(x => x.ConfigKey == "拆包机废袋机频率设定值").FirstOrDefault();
|
|
|
|
|
// // configInfo1.ConfigValue = UnpackSet1Txt.Text;
|
|
|
|
|
// // configInfo2.ConfigValue = UnpackSet2Txt.Text;
|
|
|
|
|
// configInfo3.ConfigValue = UnpackSet3Txt.Text;
|
|
|
|
|
// configInfo4.ConfigValue = UnpackSet4Txt.Text;
|
|
|
|
|
// // configInfo5.ConfigValue = UnpackSet5Txt.Text;
|
|
|
|
|
// // _configInfoBusiness.UpdateConfigInfo(configInfo1);
|
|
|
|
|
// // _configInfoBusiness.UpdateConfigInfo(configInfo2);
|
|
|
|
|
// _configInfoBusiness.UpdateConfigInfo(configInfo3);
|
|
|
|
|
// _configInfoBusiness.UpdateConfigInfo(configInfo4);
|
|
|
|
|
// // _configInfoBusiness.UpdateConfigInfo(configInfo5);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("请输入0到50之间的正整数!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// _logger.LogError(ex.Message);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 烘干机温度设定
|
|
|
|
@ -1334,5 +1558,9 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
// _logger.LogError(ex.Message);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|