add - 手动控制添加保存功能

dep_nodyang
wangsr 1 year ago
parent 15c2a22cf3
commit 948af42a47

@ -1,7 +1,9 @@
using DataBlockHelper;
using DevExpress.DataAccess.Native.Json;
using DevExpress.Utils.About;
using ICSharpCode.Core;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Action.ChemicalWeighing.FreeDb;
using Mesnac.Action.ChemicalWeighing.InterfaceDocking;
using Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity;
@ -118,6 +120,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
MCButton WetRequest8;
MCButton Focus;
MCButton SaveSetting;
MCButton LoadSetting;
#endregion
@ -135,7 +139,14 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
BottomSelect(runtime);
SetWaterValue1.MCValue = Setting.Default.SetWaterValue1;
SetWaterValue2.MCValue = Setting.Default.SetWaterValue2;
SetWaterValue3.MCValue = Setting.Default.SetWaterValue3;
SetWaterValue4.MCValue = Setting.Default.SetWaterValue4;
SetSpiralValue1.MCValue = Setting.Default.SetSpiralValue1;
SetSpiralValue2.MCValue = Setting.Default.SetSpiralValue2;
SetSpiralValue3.MCValue = Setting.Default.SetSpiralValue3;
SetSpiralValue4.MCValue = Setting.Default.SetSpiralValue4;
}
/// <summary>
@ -227,6 +238,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
WetRequest8 = GetButtonControl("WetRequest8");
Focus = GetButtonControl("Focus");
SaveSetting = GetButtonControl("SaveSetting");
LoadSetting = GetButtonControl("LoadSetting");
}
/// <summary>
@ -1161,24 +1175,74 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
ManualLogControl("湿混机8返回数据 " + returnTest);
MesnacServiceManager.Instance.LoggingService.Info("湿混机8返回数据" + returnTest);
}
}
if(SaveSetting == runtime.Sender)
{
short value1;
short value2;
short value3;
short value4;
short value5;
short value6;
short value7;
short value8;
if (short.TryParse(Convert.ToString(SetWaterValue1.MCValue), out value1) &&
short.TryParse(Convert.ToString(SetWaterValue2.MCValue), out value2) &&
short.TryParse(Convert.ToString(SetWaterValue3.MCValue), out value3) &&
short.TryParse(Convert.ToString(SetWaterValue4.MCValue), out value4) &&
short.TryParse(Convert.ToString(SetSpiralValue1.MCValue), out value5) &&
short.TryParse(Convert.ToString(SetSpiralValue2.MCValue), out value6) &&
short.TryParse(Convert.ToString(SetSpiralValue3.MCValue), out value7) &&
short.TryParse(Convert.ToString(SetSpiralValue4.MCValue), out value8))
{
if (MessageBox.Show("是否保存当前配置?", "保存确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
Setting.Default.SetWaterValue1 = value1;
Setting.Default.SetWaterValue2 = value2;
Setting.Default.SetWaterValue3 = value3;
Setting.Default.SetWaterValue4 = value4;
Setting.Default.SetSpiralValue1 = value1;
Setting.Default.SetSpiralValue2 = value2;
Setting.Default.SetSpiralValue3 = value3;
Setting.Default.SetSpiralValue4 = value4;
MesnacServiceManager.Instance.LoggingService.Info("配置已保存");
ManualLogControl("配置已保存 " + value1 + value2 + value3 + value4 + value5 + value6 + value7 + value8);
}
}
if (LoadSetting == runtime.Sender)
{
if (MessageBox.Show("是否加载上次保存的配置?", "加载确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
SetWaterValue1.MCValue = Setting.Default.SetWaterValue1;
SetWaterValue2.MCValue = Setting.Default.SetWaterValue2;
SetWaterValue3.MCValue = Setting.Default.SetWaterValue3;
SetWaterValue4.MCValue = Setting.Default.SetWaterValue4;
SetSpiralValue1.MCValue = Setting.Default.SetSpiralValue1;
SetSpiralValue2.MCValue = Setting.Default.SetSpiralValue2;
SetSpiralValue3.MCValue = Setting.Default.SetSpiralValue3;
SetSpiralValue4.MCValue = Setting.Default.SetSpiralValue4;
MesnacServiceManager.Instance.LoggingService.Info("配置已加载");
ManualLogControl("配置已加载 ");
}
}
private void PlcControl(string address, short binNo)
{
{
PlcConnect.Instance.Write(address, binNo);
}
}
private void PlcControl(string address, bool state)
{
PlcConnect.Instance.Write(address, state);
}
private IBaseControl GetBaseControl(string name)
{
return _McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl;
}
{
return _McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl;
}
private MCButton GetButtonControl(string name)
{
return McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl as MCButton;

@ -0,0 +1,122 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Mesnac.Action.ChemicalWeighing.ManualControl {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.6.0.0")]
internal sealed partial class Setting : global::System.Configuration.ApplicationSettingsBase {
private static Setting defaultInstance = ((Setting)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Setting())));
public static Setting Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("190")]
public short SetWaterValue1 {
get {
return ((short)(this["SetWaterValue1"]));
}
set {
this["SetWaterValue1"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("205")]
public short SetWaterValue2 {
get {
return ((short)(this["SetWaterValue2"]));
}
set {
this["SetWaterValue2"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("190")]
public short SetWaterValue3 {
get {
return ((short)(this["SetWaterValue3"]));
}
set {
this["SetWaterValue3"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("205")]
public short SetWaterValue4 {
get {
return ((short)(this["SetWaterValue4"]));
}
set {
this["SetWaterValue4"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("480")]
public short SetSpiralValue1 {
get {
return ((short)(this["SetSpiralValue1"]));
}
set {
this["SetSpiralValue1"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("480")]
public short SetSpiralValue2 {
get {
return ((short)(this["SetSpiralValue2"]));
}
set {
this["SetSpiralValue2"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("480")]
public short SetSpiralValue3 {
get {
return ((short)(this["SetSpiralValue3"]));
}
set {
this["SetSpiralValue3"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("480")]
public short SetSpiralValue4 {
get {
return ((short)(this["SetSpiralValue4"]));
}
set {
this["SetSpiralValue4"] = value;
}
}
}
}

@ -0,0 +1,30 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Mesnac.Action.ChemicalWeighing.ManualControl" GeneratedClassName="Setting">
<Profiles />
<Settings>
<Setting Name="SetWaterValue1" Type="System.Int16" Scope="User">
<Value Profile="(Default)">190</Value>
</Setting>
<Setting Name="SetWaterValue2" Type="System.Int16" Scope="User">
<Value Profile="(Default)">205</Value>
</Setting>
<Setting Name="SetWaterValue3" Type="System.Int16" Scope="User">
<Value Profile="(Default)">190</Value>
</Setting>
<Setting Name="SetWaterValue4" Type="System.Int16" Scope="User">
<Value Profile="(Default)">205</Value>
</Setting>
<Setting Name="SetSpiralValue1" Type="System.Int16" Scope="User">
<Value Profile="(Default)">480</Value>
</Setting>
<Setting Name="SetSpiralValue2" Type="System.Int16" Scope="User">
<Value Profile="(Default)">480</Value>
</Setting>
<Setting Name="SetSpiralValue3" Type="System.Int16" Scope="User">
<Value Profile="(Default)">480</Value>
</Setting>
<Setting Name="SetSpiralValue4" Type="System.Int16" Scope="User">
<Value Profile="(Default)">480</Value>
</Setting>
</Settings>
</SettingsFile>

@ -503,6 +503,11 @@
<Compile Include="ManualControl\InitAction.cs" />
<Compile Include="ManualControl\ManualLogEntity.cs" />
<Compile Include="ManualControl\ManualControlAction.cs" />
<Compile Include="ManualControl\Setting.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Setting.settings</DependentUpon>
</Compile>
<Compile Include="MaterialManage\BarcodeReport.cs">
<SubType>Component</SubType>
</Compile>
@ -853,6 +858,11 @@
<ItemGroup>
<Content Include="ChemicalWeighingPlc\0Readme.txt" />
<Content Include="LjRecipeData\NewFile1.txt" />
<None Include="app.config" />
<None Include="ManualControl\Setting.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Setting.Designer.cs</LastGenOutput>
</None>
<None Include="Resources\loading.gif" />
<Content Include="Sys\0readme.txt" />
</ItemGroup>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Mesnac.Action.ChemicalWeighing.ManualControl.Setting" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<Mesnac.Action.ChemicalWeighing.ManualControl.Setting>
<setting name="SetWaterValue1" serializeAs="String">
<value>190</value>
</setting>
<setting name="SetWaterValue2" serializeAs="String">
<value>205</value>
</setting>
<setting name="SetWaterValue3" serializeAs="String">
<value>190</value>
</setting>
<setting name="SetWaterValue4" serializeAs="String">
<value>205</value>
</setting>
<setting name="SetSpiralValue1" serializeAs="String">
<value>480</value>
</setting>
<setting name="SetSpiralValue2" serializeAs="String">
<value>480</value>
</setting>
<setting name="SetSpiralValue3" serializeAs="String">
<value>480</value>
</setting>
<setting name="SetSpiralValue4" serializeAs="String">
<value>480</value>
</setting>
</Mesnac.Action.ChemicalWeighing.ManualControl.Setting>
</userSettings>
</configuration>

@ -1,5 +1,53 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="ManualWaterControl" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton23" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAEAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIDhBNkE3NzM4OTg2NDRFQjlBQ0FGQkRDOEZENjZERjNDBgYAAAAM5oyJ6ZKu5LqL5Lu2BgcAAAAM5oyJ6ZKu5LqL5Lu2Cw==</Binary>
</Property>
<Property name="MCKey">LoadSetting</Property>
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">Query</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">加载配置</Property>
<Property name="Location">732, 601</Property>
<Property name="Name">MCButton23</Property>
<Property name="Size">85, 47</Property>
<Property name="TabIndex">29</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton22" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAACAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIDhBNkE3NzM4OTg2NDRFQjlBQ0FGQkRDOEZENjZERjNDBgYAAAAM5oyJ6ZKu5LqL5Lu2BgcAAAAM5oyJ6ZKu5LqL5Lu2Cw==</Binary>
</Property>
<Property name="MCKey">SaveSetting</Property>
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">Query</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">保存配置</Property>
<Property name="Location">732, 508</Property>
<Property name="Name">MCButton22</Property>
<Property name="Size">85, 47</Property>
<Property name="TabIndex">8</Property>
</Object>
<Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox10" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton21" children="Controls">
<Property name="ClickActionList">

Loading…
Cancel
Save