HMI.Base/PluginLoader.cs
@@ -62,6 +62,7 @@ } private IPluginContainer pluginContainer; public void LoadMenuAndPlugin(IPluginContainer container, Dispatcher dispatcher) { pluginContainer = container; @@ -76,6 +77,7 @@ }); } } private void LoadChildrenMenu() { foreach (var menu in Plugins) @@ -139,7 +141,7 @@ } catch (Exception ex) { log.Error("Load Plugin Failed.", ex); log.Error($"Load Plugin [{menu.Name}] Failed.", ex); LoadMessageAppend?.Invoke(this, new LoadMsg { Type = LoadMsgType.LOADING, @@ -217,6 +219,5 @@ } return data; } } } HMI.Core/Api/IFolderOwner.cs
@@ -9,7 +9,7 @@ public interface IFolderOwner { /// <summary> /// 基础路径 /// 插件加载完之后会分配一个路径,可以存放一些独立的文件 /// </summary> /// <param name="folder"></param> void SetBaseFolder(string folder); HMI.Core/Api/IPlugin.cs
@@ -53,10 +53,5 @@ /// <param name="sender"></param> /// <param name="args"></param> void OnTabChange(object sender, object args); /// <summary> /// 插件加载完之后会分配一个路径,可以存放一些独立的文件 /// </summary> /// <param name="folder"></param> void SetBaseFolder(string folder); } } HMI.IOMonitor/HMI.IOMonitor.csproj
@@ -139,9 +139,9 @@ </None> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\HMI.Old\OPCInterface\OpcInterface\OpcInterface.csproj"> <Project>{e1464149-2c0a-499d-ab90-0c72e6ed1c53}</Project> <Name>OpcInterface</Name> <ProjectReference Include="..\..\ConnectionUtil\ConnectionUtil\ConnectionUtil.csproj"> <Project>{D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}</Project> <Name>ConnectionUtil</Name> </ProjectReference> <ProjectReference Include="..\HMI.Base\HMI.Base.csproj"> <Project>{2a6f9720-a890-4036-9d73-41a0dae28341}</Project> @@ -155,6 +155,10 @@ <Project>{f17de6b5-af1d-48c6-94a0-6b763a6546a6}</Project> <Name>HMI.UI</Name> </ProjectReference> <ProjectReference Include="..\OPCClient\OPCClient.csproj"> <Project>{e5740bb5-9fc6-4a20-b7c2-cc90c281ed05}</Project> <Name>OPCClient</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> HMI.IOMonitor/IOMonitor.xaml.cs
@@ -1,4 +1,5 @@ using HMI.Base; using ConnectionUtil; using HMI.Base; using HMI.Core.Setting; using HMI.Core.Util; using HMI.IOMonitor.Entity; @@ -7,11 +8,13 @@ using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; using OPCConnection; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Net.Sockets; using System.Timers; using System.Windows; using System.Windows.Controls; @@ -33,7 +36,7 @@ private string DQTag = string.Empty; private SystemSetting systemSetting; private Timer MonitorTimer; private OpcInterface.OpcInterface lTSCADAApi = new OpcInterface.OpcInterface(); private SCADAApi lTSCADAApi = new OPCClient(); /// <summary> HMI.UI/Controls/NumberPanel.xaml
@@ -73,6 +73,6 @@ <Button Grid.Row="4" Grid.Column="2" Tag="3" Click="Button_Click" Content="3"/> <Button Grid.Row="5" Grid.ColumnSpan="2" Tag="0" Click="Button_Click" Content="0"/> <Button Grid.Row="5" Grid.Column="2" Tag="." Click="Button_Click" Content="."/> <Button Grid.Row="5" Grid.Column="2" Tag="." IsEnabled="{Binding DotEnabled}" Click="Button_Click" Content="."/> </Grid> </pu:WindowX> HMI.UI/Controls/NumberPanel.xaml.cs
@@ -16,6 +16,18 @@ InitializeComponent(); } private bool dotEnabled = true; public bool DotEnabled { get { return dotEnabled; } set { Set(ref dotEnabled, value); } } public double? Data { get; private set; } private bool _isProcessing; HMI.UI/Style/Colors.xaml
@@ -54,6 +54,12 @@ <GradientStop Color="#23458c" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="ReVerBar" StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#23458c" Offset="0"/> <GradientStop Color="#4268b1" Offset="0.5"/> <GradientStop Color="#5d87d2" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="GreenVerBar" StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#28ea1d" Offset="0"/> <GradientStop Color="#21c418" Offset="0.5"/> HMI.UI/Style/PanuonResource.xaml
@@ -12,7 +12,7 @@ xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/> <pu:StyleDictionary Includes="PasswordBox,TextBox,ComboBox,Button,DataGrid,TreeView,Menu" /> <pu:StyleDictionary Includes="PasswordBox,TextBox,ComboBox,Button,DataGrid,TreeView,Menu,ListBox" /> <ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/> </ResourceDictionary.MergedDictionaries> <sys:Double x:Key="TitleFontSize">20</sys:Double> @@ -290,4 +290,16 @@ Opacity="0" Visibility="Visible" /> </Popup> <Style x:Key="DefaultListBox" TargetType="ListBox" BasedOn="{StaticResource {x:Static pu:StyleKeys.ListBoxStyle}}"> <Setter Property="pu:ListBoxHelper.ItemsHoverBackground" Value="{StaticResource SecondPrimaryColor}"/> <Setter Property="pu:ListBoxHelper.ItemsHoverForeground" Value="{StaticResource SecondPrimaryColorContract}"/> <Setter Property="pu:ListBoxHelper.ItemsSelectedBackground" Value="{StaticResource PrimaryColor}"/> <Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" Value="{StaticResource PrimaryColorContract}"/> <Setter Property="pu:ListBoxHelper.ItemsMargin" Value="0"/> <Setter Property="pu:ListBoxHelper.ItemsPadding" Value="7,5,7,5"/> <Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderThickness" Value="0"/> </Style> </ResourceDictionary> HMI.UnitTest/App.config
@@ -1,6 +1,14 @@ <?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> </startup> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> HMI.UnitTest/App.xaml
@@ -4,13 +4,25 @@ xmlns:local="clr-namespace:UnitTest" xmlns:pw="https://opensource.panuon.com/wpf" xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:uic="clr-namespace:HMI.UI.Converter;assembly=HMI.UI" xmlns:hc="clr-namespace:HMI.Core;assembly=HMI.Core" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/HMI.UI;component/Style/BaseWindow.xaml"/> <ResourceDictionary Source="/HMI.UI;component/Style/FormStyle.xaml"/> <ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/> <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/> <ResourceDictionary Source="/HMI.UI;component/Style/PanuonResource.xaml"/> <ResourceDictionary Source="/HMI.UI;component/Style/MsgBoxStyle.xaml"/> </ResourceDictionary.MergedDictionaries> <Style TargetType="{x:Type pu:FormGroup}" BasedOn="{StaticResource InputFormGroupStyle}"></Style> <uic:PathImageConverter x:Key="path2Image"/> <uic:DataGridRowNumberConverter x:Key="rowNumber"/> <uic:VisibilityBoolConverter x:Key="vbConverter"/> <uic:DataGridRowFlagConverter x:Key="rowFlag"/> <hc:LangConverter x:Key="lc"/> </ResourceDictionary> </Application.Resources> </Application> HMI.UnitTest/HMI.UnitTest.csproj
@@ -68,6 +68,7 @@ <Reference Include="System.Configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Web" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Core" /> @@ -127,6 +128,14 @@ <None Include="App.config" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\ConnectionUtil\ConnectionUtil\ConnectionUtil.csproj"> <Project>{d0806fa6-3f6d-4304-81b8-ead9da7cb5b2}</Project> <Name>ConnectionUtil</Name> </ProjectReference> <ProjectReference Include="..\HMI.Base\HMI.Base.csproj"> <Project>{2A6F9720-A890-4036-9D73-41A0DAE28341}</Project> <Name>HMI.Base</Name> </ProjectReference> <ProjectReference Include="..\HMI.Core\HMI.Core.csproj"> <Project>{3e3bf44a-0b69-45c5-9512-528cb48a7106}</Project> <Name>HMI.Core</Name> @@ -139,6 +148,14 @@ <Project>{f17de6b5-af1d-48c6-94a0-6b763a6546a6}</Project> <Name>HMI.UI</Name> </ProjectReference> <ProjectReference Include="..\Plugin.SNGenerateTool\Plugin.SNGenerateTool.csproj"> <Project>{3e18af3f-8212-45a5-a6e3-f5b1cfa3afae}</Project> <Name>Plugin.SNGenerateTool</Name> </ProjectReference> <ProjectReference Include="..\Plugin.TestResult\Plugin.TestResult.csproj"> <Project>{7375b74c-b6bf-4814-9838-e1caacad1897}</Project> <Name>Plugin.TestResult</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project> HMI.UnitTest/MainWindow.xaml
@@ -5,8 +5,24 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:UnitTest" mc:Ignorable="d" Loaded="Window_Loaded" Title="MainWindow" Height="450" Width="800"> <Grid x:Name="page"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition/> </Grid.RowDefinitions> <Button Click="Button_Click">测试</Button> <!--<Button Click="Button_Click2" Grid.Row="1">发送</Button> <Button Click="Button_Click3" Grid.Row="2">发送TCP</Button> <Button Click="Button_Click4" Grid.Row="4">发送Data</Button>--> <TextBox x:Name="input" Height="0" Grid.Row="3"></TextBox> <TextBlock Grid.Row="5" Height="0" x:Name="console"></TextBlock> <Border Grid.Row="6" x:Name="border"></Border> </Grid> </Window> HMI.UnitTest/MainWindow.xaml.cs
@@ -1,18 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ConnectionUtil; using HMI.Core.Api; using HMI.Core.Util; using Plugin.TestResult_WPF; using System; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using HMI.SettingControl; namespace UnitTest { @@ -23,9 +14,121 @@ { public MainWindow() { LangUtil.Load(); InitializeComponent(); page.Children.Clear(); //page.Children.Add(new SettingControl()); //page.Children.Add(new UserControl1()); } TcpClientWrapper tcpClient; PipeClient2 client; private void Button_Click(object sender, RoutedEventArgs e) { //client = new PipeClient2("DAService"); ////client.OnData += Client_OnData1; //client.Connect(); //tcpClient = new TcpClientWrapper("127.0.0.1", 5555); //tcpClient.Connect(); viewControl.View.GetDataTable(0).GetSingleCell(0).SetStatus("testing"); //new Thread(new ThreadStart(PipeServerMessage)).Start(); //new Thread(new ThreadStart(PipeClientMessage)).Start(); } private void Client_OnData1(object sender, PipeDataEventArgs e) { Console.WriteLine($"{e.Data}"); } private void Client_OnData(object sender, PipeDataEventArgs e) { Dispatcher.Invoke(() => { console.Text += e.Data; }); } private void Button_Click2(object sender, RoutedEventArgs e) { var allStart = DateTime.Now; for (int i = 0; i < 100; i++) { var start = DateTime.Now; if (client.SendMessage("ping", out string res)) { var interval = (DateTime.Now - start).TotalMilliseconds; Console.WriteLine($"{interval}: {res}"); } } Console.WriteLine($"Total: {(DateTime.Now - allStart).TotalMilliseconds}"); } private void Button_Click3(object sender, RoutedEventArgs e) { try { var allStart = DateTime.Now; for (int i = 0; i < 500; i++) { var start = DateTime.Now; string data = input.Text; string str = $"{{\"command\":5,\"value\":{data},\"id\":\"DITag0\"}}\r\n"; string res = tcpClient.SendMessage(str); var interval = (DateTime.Now - start).TotalMilliseconds; Console.WriteLine($"{interval}: {res}"); } Console.WriteLine($"Total: {(DateTime.Now - allStart).TotalMilliseconds}"); } catch (Exception ex) { } } private void Button_Click4(object sender, RoutedEventArgs e) { try { var allStart = DateTime.Now; for (int i = 0; i < 500; i++) { var start = DateTime.Now; string data = input.Text; string str = $"{{\"command\":5,\"value\":{data},\"id\":\"DITag0\"}}"; client.SendMessage(str, out string res); var interval = (DateTime.Now - start).TotalMilliseconds; Console.WriteLine($"{interval}: {res}"); } Console.WriteLine($"Total: {(DateTime.Now - allStart).TotalMilliseconds}"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } private void HandlePlugin(object obj) { if (obj is IPlugin plugin) { plugin.SetBaseFolder(PathHelper.AppFolder); plugin.InitFinish(); } } private ViewControl viewControl; private void Window_Loaded(object sender, RoutedEventArgs e) { viewControl = new ViewControl(); HandlePlugin(viewControl); border.Child = viewControl; this.Loaded -= Window_Loaded; } } } Libs/SupersocketCommon.dllBinary files differ
OPCClient/Commond.cs
New file @@ -0,0 +1,37 @@ using LT.Utils.Json; using System.Collections.Generic; namespace OPCConnection { internal class Commond { private const string Cmd_STX = "02h"; private const string Cmd_End = "\r\n"; /// <summary> /// 创建请求命令 /// </summary> /// <param name="Code"></param> /// <param name="Parameters"></param> /// <returns></returns> public static string BuildCmd(string Code, List<string> Parameters) { string str = "02h;" + Code + ";"; foreach (string str2 in Parameters) { str = str + str2 + ";"; } return (str + "\r\n"); } /// <summary> /// 创建请求命令 /// </summary> /// <param name="_object"></param> /// <returns></returns> public static string BuildCmdScada(object _object) => JsonExtensions.ToJson(_object, false, false, false); } } OPCClient/OPCClient.cs
New file @@ -0,0 +1,664 @@ using ConnectionUtil; using LT.Utils.Json; using Newtonsoft.Json; using SuperSocketServer.Common; using System; using System.Collections.Generic; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; namespace OPCConnection { public class OPCClient : SCADAApi { private Socket ClientSocket = null; /// <summary> /// 连接超时事件ms /// </summary> public int _ConnectTimeout = 20000; private int Size = 0x989680; private Dictionary<int, string> paraMPairs = new Dictionary<int, string>(); /// <summary> /// IP连接Scada服务器 /// </summary> /// <param name="IP">MES服务器IP</param> /// <param name="Port"> MES服务器Port口</param> /// <param name="LocalIP">本地连接IP</param> /// <param name="LocalPort">本地连接端口</param> /// <returns></returns> public bool Connect(string IP, int Port, string LocalIP, int LocalPort) { try { this.ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress address = IPAddress.Parse(IP); IPEndPoint point = new IPEndPoint(IPAddress.Parse(LocalIP), LocalPort); IPEndPoint remoteEP = new IPEndPoint(address, Port); this.ClientSocket.Connect(remoteEP); return true; } catch (Exception) { return false; } } /// <summary> /// 连接Scada管理服务器 /// </summary> /// <param name="IP"> Scada服务器IP</param> /// <param name="Port">ScadPort口</param> /// <param name="LocalPort">本地连接端口</param> /// <param name="errMsg"></param> /// <param name="socket"></param> /// <returns></returns> public bool Connect2(string IP, int Port, int LocalPort, out string errMsg, Socket socket = null) { try { errMsg = string.Empty; if (!this.TcpPing(IP, Port, out errMsg)) { throw new Exception(errMsg); } if (socket != null) { this.ClientSocket = socket; } else { this.ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); } IPAddress address = IPAddress.Parse(IP); this.ClientSocket.Connect(address, Port); if (!this.DoLogin("admin", "LT123456", out string str)) { throw new Exception(str); } return true; } catch (Exception exception) { errMsg = "连接SCADA服务失败:" + exception.Message; return false; } } /// <summary> /// 连接Scada管理服务器 /// </summary> /// <param name="IP">ScadaManagerIP</param> /// <param name="Port">ScadaManagerPort口</param> /// <param name="LocalPort">本地连接端口</param> /// <param name="errMsg"></param> /// <returns></returns> public bool ConnectManager(string IP, int Port, int LocalPort, out string errMsg) { try { errMsg = string.Empty; if (!this.TcpPing(IP, Port, out errMsg)) { throw new Exception(errMsg); } this.ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress address = IPAddress.Parse(IP); this.ClientSocket.Connect(address, Port); return true; } catch (Exception exception) { errMsg = "连接SCADA服务失败:" + exception.Message; return false; } } /// <summary> /// 断开服务器连接 /// </summary> public void DisConnect() { try { if (this.ClientSocket != null) { //this.ClientSocket.Shutdown(SocketShutdown.Both); this.ClientSocket.Close(); } } catch (Exception exception) { throw new Exception("断开SCADA服务器失败:" + exception.Message); } } /// <summary> /// 释放资源 /// </summary> public void Dispose() { if (this.ClientSocket != null) { this.ClientSocket.Dispose(); } } /// <summary> /// 批量写增加参数 /// </summary> /// <param name="id"></param> /// <param name="par"></param> /// <returns></returns> public bool DoAddParWriteMultiple(int id, string par) { if (this.paraMPairs.ContainsKey(id)) { return false; } this.paraMPairs.Add(id, par); return true; } /// <summary> /// 换型 /// </summary> /// <param name="_ProductLineName"></param> /// <param name="_ProductName"></param> /// <param name="errMsg"></param> /// <param name="_WorkStationName"></param> /// <returns></returns> public bool DoDoChangeModel(string _ProductLineName, string _ProductName, out string errMsg, string _WorkStationName = null) { try { var type = new { command = 7, ProductLineName = _ProductLineName, ProductName = _ProductName, WorkStationName = _WorkStationName }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); return this.ResquestResult(resquestStr, out _, out errMsg); } catch (Exception exception) { errMsg = exception.Message; return false; } } /// <summary> /// 批量读值 /// </summary> /// <param name="_Id"></param> /// <returns></returns> public string[,] DoFctReadMultiple(int[] _Id) { string[,] strArray2; try { var type = new { command = 2, comefrom = 1, paraM = _Id }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); if (this.ResquestResult(resquestStr, out Result result, out _)) { Dictionary<string, string> dictionary = JsonUtil.ToObject<Dictionary<string, string>>(result.result.ToString()); string[,] strArray = new string[dictionary.Count, 2]; int num = 0; foreach (KeyValuePair<string, string> pair in dictionary) { strArray[num, 0] = pair.Key; strArray[num, 1] = pair.Value; num++; } return strArray; } strArray2 = null; } catch (Exception exception) { throw new Exception(exception.Message); } return strArray2; } /// <summary> /// 单一读值 /// </summary> /// <param name="_name"></param> /// <param name="result"></param> /// <param name="errMsg"></param> /// <returns></returns> public bool DoFctReadSingle(string _name, out string result, out string errMsg) { result = string.Empty; try { var type = new { command = 0x31, id = _name, comefrom = 1 }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); if (this.ResquestResult(resquestStr, out Result result2, out errMsg)) { result = result2.result?.ToString(); return true; } return false; } catch (Exception exception) { errMsg = exception.Message; return false; } finally { GC.Collect(); } } /// <summary> /// 单一写值 /// </summary> /// <param name="errMsg"></param> /// <returns></returns> public bool DoFctWriteMultiple(out string errMsg) { bool flag2; errMsg = string.Empty; try { if (this.ToFctWriteMultiple(this.paraMPairs, out errMsg)) { return true; } flag2 = false; } catch (Exception exception) { errMsg = exception.Message; flag2 = false; } finally { this.InitParWriteMultiple(); } return flag2; } /// <summary> /// 写单一值 /// </summary> /// <param name="_name"></param> /// <param name="_value"></param> /// <param name="errMsg"></param> /// <returns></returns> public bool DoFctWriteSingle(string _name, string _value, out string errMsg) { try { var type = new { command = 5, id = _name, value = _value }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); return this.ResquestResult(resquestStr, out _, out errMsg); } catch (Exception exception) { errMsg = exception.Message; return false; } } /// <summary> /// mqtt发布消息 /// </summary> /// <param name="topic">主题</param> /// <param name="_value">值</param> /// <param name="errMsg">错误信息></param> /// <returns></returns> public bool DoMqttPublish(string topic, string _value, out string errMsg) { try { var type = new { command = 12, Tag = topic, value = _value }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); return this.ResquestResult(resquestStr, out _, out errMsg); } catch (Exception exception) { errMsg = exception.Message; return false; } } /// <summary> /// /// </summary> /// <param name="_user"></param> /// <param name="_password"></param> /// <param name="errMsg"></param> /// <returns></returns> public bool DoLogin(string _user, string _password, out string errMsg) { try { var type = new { command = 11, user = _user, password = _password }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); return this.ResquestResult(resquestStr, out _, out errMsg); } catch (Exception exception) { errMsg = exception.Message; return false; } } /// <summary> /// 重启DataServer服务器 /// </summary> /// <param name="errMsg"></param> /// <returns></returns> public bool DoReSETDataServer(out string errMsg) { try { var type = new { command = 10 }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); return this.ResquestResult(resquestStr, out _, out errMsg); } catch (Exception exception) { errMsg = exception.Message; return false; } } /// <summary> /// 获取动态IP /// </summary> /// <returns></returns> public string getLocalIP() { string str2 = null; IPHostEntry hostByName = Dns.GetHostByName(Dns.GetHostName()); int length = hostByName.AddressList.Length; for (int i = 0; i < length; i++) { IPAddress address = hostByName.AddressList[i]; str2 = Convert.ToString(address); if (str2.Substring(0, 5) == "10.10") { return str2; } } return str2; } /// <summary> /// /// </summary> /// <param name="_paraMPairs"></param> /// <param name="errMsg"></param> /// <returns></returns> public short[,] GetLowerComputerStatus(short[] _paraMPairs, out string errMsg) { try { var type = new { command = 9, paraM = _paraMPairs }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); if (this.ResquestResult(resquestStr, out Result result, out errMsg)) { Dictionary<short, short> dictionary = JsonUtil.ToObject<Dictionary<short, short>>(result.result.ToString()); short[,] numArray = new short[dictionary.Count, 2]; int num = 0; foreach (KeyValuePair<short, short> pair in dictionary) { numArray[num, 0] = pair.Key; numArray[num, 1] = pair.Value; num++; } return numArray; } return null; } catch (Exception exception) { errMsg = exception.Message; return null; } } /// <summary> /// 初始化批量写参数 /// </summary> public void InitParWriteMultiple() { this.paraMPairs.Clear(); } /// <summary> /// 检查与LTSCADA是否断开连接了 /// </summary> /// <param name="errMsg"></param> /// <returns></returns> public bool IsConnected(out string errMsg) { try { var type = new { command = 6 }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); return this.ResquestResult(resquestStr, out _, out errMsg); } catch (Exception exception) { errMsg = exception.Message; return false; } } /// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="Pars"></param> /// <returns></returns> private static string ParsToString<T>(T Pars) => null; /// <summary> /// 返回请求信息 /// </summary> /// <param name="ResquestStr"></param> /// <param name="JResult"></param> /// <param name="errMsg"></param> /// <returns></returns> private bool ResquestResult(string ResquestStr, out Result JResult, out string errMsg) { errMsg = string.Empty; JResult = null; try { JResult = JsonConvert.DeserializeObject<Result>(ResquestStr); if (!JResult.success) { errMsg = "请求失败:" + JResult.message; return false; } return true; } catch (Exception exception) { errMsg = JResult?.message + " --- " + exception.Message; return false; } } /// <summary> /// 接收数据超时时间 /// </summary> public uint TimeRecOut { set; get; } = 20000; /// <summary> /// 线程锁 /// </summary> private readonly object objLock = new object(); /// <summary> /// 发送请求信息 /// </summary> /// <param name="Cmd"></param> /// <returns></returns> private string SendSocketMessage(string Cmd) { string str2; try { string str = ""; byte[] bytes = Encoding.UTF8.GetBytes(Cmd + "\r\n"); lock (objLock) { int available = this.ClientSocket.Available; if (available > 0) { byte[] buffer2 = new byte[available]; this.ClientSocket.Receive(buffer2, 0, available, SocketFlags.None); } this.ClientSocket.Send(bytes); bool flag = false; int tickCount = Environment.TickCount; int size = this.ClientSocket.Available; bool flag2 = false; while (((size < this.Size) && !flag) && !(flag2 = str.Contains("\r\n"))) { Thread.Sleep(2); size = this.ClientSocket.Available; if ((size > this.Size) || (str.Length > this.Size)) { throw new Exception($"接收数据超过设定值{this.Size}BYTE!"); } flag = (Environment.TickCount - tickCount) > TimeRecOut; if (flag) { if (size > 0) { byte[] buffer3 = new byte[size]; this.ClientSocket.Receive(buffer3, 0, size, SocketFlags.None); } throw new Exception("接收数据超时!"); } if (!flag && (size > 0)) { byte[] buffer4 = new byte[size]; this.ClientSocket.Receive(buffer4, 0, size, SocketFlags.None); str = str + Encoding.UTF8.GetString(buffer4); } } } str2 = str; } catch (Exception exception) { throw new Exception(exception.Message); } return str2; } /// <summary> /// TcpPing /// </summary> /// <param name="Host"></param> /// <param name="Port"></param> /// <param name="errMsg"></param> /// <returns></returns> private bool TcpPing(string Host, int Port, out string errMsg) { bool flag = false; errMsg = string.Empty; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { bool flag2 = socket.BeginConnect(Host, Port, null, null).AsyncWaitHandle.WaitOne(this._ConnectTimeout, true); if (!flag2) { errMsg = "errTCPConnectionFailed"; } flag = flag2; } catch { errMsg = "errTCPConnectionFailed"; flag = false; } socket.Close(); return flag; } /// <summary> /// 批量写 /// </summary> /// <param name="_paraMPairs">参数列表</param> /// <param name="errMsg">错误信息</param> /// <returns>处理结果</returns> public bool ToFctWriteMultiple(Dictionary<int, string> _paraMPairs, out string errMsg) { try { var type = new { command = 15, paraM = _paraMPairs }; string resquestStr = this.SendSocketMessage(JsonExtensions.ToJson(type, false, false, false)); return this.ResquestResult(resquestStr, out _, out errMsg); } catch (Exception exception) { errMsg = exception.Message; return false; } } public bool Connect(object config, out string errMsg) { errMsg = null; return false; } } } OPCClient/OPCClient.csproj
New file @@ -0,0 +1,64 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>OPCClient</RootNamespace> <AssemblyName>OPCClient</AssemblyName> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <Deterministic>true</Deterministic> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="SupersocketCommon"> <HintPath>..\Libs\SupersocketCommon.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Commond.cs" /> <Compile Include="OPCClient.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\ConnectionUtil\ConnectionUtil\ConnectionUtil.csproj"> <Project>{d0806fa6-3f6d-4304-81b8-ead9da7cb5b2}</Project> <Name>ConnectionUtil</Name> </ProjectReference> </ItemGroup> <ItemGroup> <None Include="packages.config" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project> OPCClient/Properties/AssemblyInfo.cs
New file @@ -0,0 +1,33 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("OPCClient")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OPCClient")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("e5740bb5-9fc6-4a20-b7c2-cc90c281ed05")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] OPCClient/packages.config
New file @@ -0,0 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" /> </packages> Plugin.DOControl/DOControl.xaml.cs
@@ -1,4 +1,5 @@ using HMI.Base; using ConnectionUtil; using HMI.Base; using HMI.Core.Setting; using HMI.Core.Util; using HMI.UI; @@ -13,7 +14,6 @@ using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; namespace Plugin.DOControl @@ -26,7 +26,8 @@ /// <summary> /// 实例化服务器接口函数 /// </summary> private OpcInterface.OpcInterface lTSCADAApi = new OpcInterface.OpcInterface(); //private OpcInterface.OpcInterface lTSCADAApi = new OpcInterface.OpcInterface(); private PipeClient pipeClient = new PipeClient("DAService"); private ObservableCollection<string> groups; public ObservableCollection<string> Groups @@ -124,15 +125,14 @@ private void LoadData() { ObservableCollection<DOControlData> datas = new ObservableCollection<DOControlData>(); try { motorMonitorTimer.Enabled = false; ObservableCollection<DOControlData> datas = new ObservableCollection<DOControlData>(); if (File.Exists(FilePath)) { datas = XmlHelper.DeserializeFromXml<ObservableCollection<DOControlData>>(FilePath); } Datasource = datas; GroupMap = datas.GroupBy(x => x.Group) .ToDictionary( group => group.Key, @@ -157,6 +157,7 @@ { motorMonitorTimer.Enabled = true; } Datasource = datas; } private void MotorMonitorTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) @@ -174,7 +175,7 @@ string value = GetPlcValue(data.Address); switch (data.ControlType) { case ControlType.Button: case ControlType.BOOL: var color = Application.Current.FindResource("VerBar") as Brush; if (value == data.PressDownValue) { @@ -183,12 +184,12 @@ ((Button)ui).Background = color; ((Button)ui).Content = value; break; case ControlType.Int16: case ControlType.Int32: case ControlType.Real: case ControlType.LReal: case ControlType.String: case ControlType.WString: case ControlType.INT: case ControlType.WORD: case ControlType.REAL: case ControlType.LREAL: case ControlType.STRING: case ControlType.WSTRING: ((Button)ui).Content = value; break; default: @@ -235,19 +236,14 @@ FrameworkElement ui = null; switch (data.ControlType) { case ControlType.Button: case ControlType.ClickButton: case ControlType.BOOL: case ControlType.PULSE: ui = CreateButton(data); break; case ControlType.Int16: case ControlType.Int32: case ControlType.Real: case ControlType.LReal: case ControlType.String: case ControlType.WString: ui = CreateNumberInput(data); case ControlType.TIME: break; default: ui = CreateInput(data); break; } if (ui != null) @@ -294,11 +290,11 @@ MinWidth = 180, MinHeight = 40 }; if (data.ControlType == ControlType.Button) if (data.ControlType == ControlType.BOOL) { btn.Click += ControlButton_Click; } else if (data.ControlType == ControlType.ClickButton) else if (data.ControlType == ControlType.PULSE) { btn.Content = data.Address; btn.PreviewMouseLeftButtonDown += Btn_MouseLeftButtonDown; @@ -341,7 +337,7 @@ } } private Button CreateNumberInput(DOControlData data) private Button CreateInput(DOControlData data) { Style btnStyle = Application.Current.FindResource("PrimaryButton") as Style; var tb = new Button @@ -361,7 +357,7 @@ return tb; } if (data.ControlType == ControlType.String || data.ControlType == ControlType.WString) if (data.ControlType == ControlType.STRING || data.ControlType == ControlType.WSTRING) { tb.Click += StringInput_Click; } @@ -380,22 +376,25 @@ /// <param name="value">值</param> private void SetPlcValue(string key, string value) { if (!lTSCADAApi.DoFctWriteSingle(key, value, out string errMsg)) { throw new Exception(errMsg); } //if (!lTSCADAApi.DoFctWriteSingle(key, value, out string errMsg)) //{ // ToastHelper.Error(this, errMsg); //} pipeClient.SendMessage("asdsadasda", out _); } private string GetPlcValue(string key) { if (lTSCADAApi.DoFctReadSingle(key, out string Val, out string errMsg)) { return Val; } else { return null; } //if (lTSCADAApi.DoFctReadSingle(key, out string Val, out string errMsg)) //{ // return Val; //} //else //{ // return null; //} return null; } private void ControlButton_Click(object sender, RoutedEventArgs args) @@ -437,7 +436,8 @@ NumberPanel np = new NumberPanel { Title = data.Name, Owner = Window.GetWindow(this) Owner = Window.GetWindow(this), DotEnabled = data.ControlType == ControlType.REAL || data.ControlType == ControlType.LREAL }; if (np.Open(tb.Content?.ToString()) == true) { @@ -450,19 +450,34 @@ LoadData(); if (SystemSetting.Instance.PlcEnabled) { if (lTSCADAApi.Connect2("127.0.0.1", 6543, 18888, out string errMsg)) //if (lTSCADAApi.Connect2("127.0.0.1", 6543, 18888, out string errMsg)) //{ // motorMonitorTimer.Enabled = true; // RefreshControl(); //} //else //{ // MsgBoxHelper2.Error(errMsg); //} try { motorMonitorTimer.Enabled = true; RefreshControl(); pipeClient.OnConnected += PipeClient_OnConnected; pipeClient.Connect(); } else catch (Exception ex) { MsgBoxHelper2.Error(errMsg); MsgBoxHelper.Error(this, ex.Message); } } Loaded -= UserControl_Loaded; } private void PipeClient_OnConnected(object sender, EventArgs e) { } private void Button_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; Plugin.DOControl/DataModal.xaml
@@ -6,13 +6,24 @@ xmlns:local="clr-namespace:Plugin.DOControl" xmlns:pw="https://opensource.panuon.com/wpf" xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI" xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:ety="clr-namespace:Plugin.DOControl.Entity" mc:Ignorable="d" Title="Form" SizeToContent="Height" Width="600" WindowStartupLocation="CenterOwner" Style="{StaticResource ModalWindow}"> <Window.Resources> <ObjectDataProvider x:Key="enumValues" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> <ObjectDataProvider.MethodParameters> <x:Type TypeName="ety:ControlType"/> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> </Window.Resources> <Grid Margin="10"> <StackPanel x:Name="formPanel"> <pu:FormGroup x:Name="FgGroup" @@ -69,15 +80,17 @@ Style="{StaticResource InputFormGroupStyle}" dp:FormGroupHelper.IsRequired="True" GroupName="MyFormGroup"> <ComboBox x:Name="CbControlType" Style="{StaticResource FormComboxStyle}" SelectedValuePath="Content"> <ComboBoxItem>0</ComboBoxItem> <ComboBox x:Name="CbControlType" Style="{StaticResource FormComboxStyle}" ItemsSource="{Binding Source={StaticResource enumValues}}" SelectedValuePath="Content"> <!--<ComboBoxItem>0</ComboBoxItem> <ComboBoxItem>1</ComboBoxItem> <ComboBoxItem>2</ComboBoxItem> <ComboBoxItem>3</ComboBoxItem> <ComboBoxItem>4</ComboBoxItem> <ComboBoxItem>4</ComboBoxItem> <ComboBoxItem>5</ComboBoxItem> <ComboBoxItem>6</ComboBoxItem> <ComboBoxItem>7</ComboBoxItem> <ComboBoxItem>7</ComboBoxItem>--> </ComboBox> </pu:FormGroup> </StackPanel> Plugin.DOControl/DataModal.xaml.cs
@@ -108,7 +108,7 @@ Data.ReadOnly = CxReadOnly.IsChecked == true; Data.PressDownValue = TbPressDownValue.Text; Data.PressUpValue = TbPressUpValue.Text; Data.ControlType = (ControlType)int.Parse(CbControlType.SelectedValue.ToString()); Data.ControlType = (ControlType)CbControlType.SelectedItem; } return flag; } @@ -124,13 +124,17 @@ CxReadOnly.IsChecked = Data.ReadOnly; TbPressDownValue.Text = Data.PressDownValue; TbPressUpValue.Text = Data.PressUpValue; CbControlType.SelectedValue = (int)Data.ControlType; CbControlType.SelectedItem = Data.ControlType; return this.ShowDialog(); } private void SaveOrUpdateData() { int index = Datasource.IndexOf(Data); int index = -1; if (Datasource != null) { index = Datasource.IndexOf(Data); } if (index < 0) { InsertData(Data); Plugin.DOControl/Entity/DOControlData.cs
@@ -5,7 +5,19 @@ { public enum ControlType { Button, Int16, Int32, Real, LReal, String, WString, ClickButton BOOL = 0, BYTE = 1, INT = 2, UINT = 3, DINT = 4, UDINT = 5, REAL = 6, LREAL = 7, TIME = 8, WORD = 9, STRING = 10, WSTRING = 11, PULSE = 12 } public class DOControlData : SelectBase { Plugin.DOControl/Plugin.DOControl.csproj
@@ -31,6 +31,24 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <DebugSymbols>true</DebugSymbols> <OutputPath>bin\x64\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x64</PlatformTarget> <LangVersion>7.3</LangVersion> <ErrorReport>prompt</ErrorReport> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <OutputPath>bin\x64\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <Optimize>true</Optimize> <DebugType>pdbonly</DebugType> <PlatformTarget>x64</PlatformTarget> <LangVersion>7.3</LangVersion> <ErrorReport>prompt</ErrorReport> </PropertyGroup> <ItemGroup> <Reference Include="log4net, Version=3.0.4.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\log4net.3.0.4\lib\net462\log4net.dll</HintPath> @@ -107,9 +125,9 @@ </None> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\HMI.Old\OPCInterface\OpcInterface\OpcInterface.csproj"> <Project>{e1464149-2c0a-499d-ab90-0c72e6ed1c53}</Project> <Name>OpcInterface</Name> <ProjectReference Include="..\..\ConnectionUtil\ConnectionUtil\ConnectionUtil.csproj"> <Project>{D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}</Project> <Name>ConnectionUtil</Name> </ProjectReference> <ProjectReference Include="..\HMI.Base\HMI.Base.csproj"> <Project>{2a6f9720-a890-4036-9d73-41a0dae28341}</Project> Plugin.SNGenerateTool/Entity/DataInfo.cs
New file @@ -0,0 +1,53 @@ using System; namespace Plugin.SNGenerateTool.Entity { public class DataInfo { public string GUID { get; set; } public string OrderID { get; set; } public string Model { get; set; } public string MESSN { get; set; } public string XDSN { get; set; } public string DHUID { get; set; } public string ProductSN { get; set; } public string HW { get; set; } public string SW { get; set; } public string GeelyDU { get; set; } public string GeelyHWSD { get; set; } public string SXBL { get; set; } public string SXDI_SXBL { get; set; } public string ECUDAPN { get; set; } public string ECUCAPN { get; set; } public string HSMKey { get; set; } public string JtagKey { get; set; } public string TEEKey { get; set; } public int Status { get; set; } public DateTime CreateTime { get; set; } public DateTime ModifyTime { get; set; } public bool IsPrint { get; set; } public DateTime PrintTime { get; set; } } } Plugin.SNGenerateTool/Entity/UserSetting.cs
New file @@ -0,0 +1,130 @@ using Microsoft.Extensions.Configuration; using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; namespace Plugin.SNGenerateTool.Entity { public class UserSettings { public string OrderId { get; set; } public string Model { get; set; } public string SNPrefix { get; set; } public string MESSstartSN { get; set; } public string MESEndSN { get; set; } public string XDSNDate { get; set; } public string XDSNDaySN { get; set; } public string XDSNSpecialSN { get; set; } public string PartNo { get; set; } public string HW { get; set; } public string SW { get; set; } public string GeelyDU { get; set; } public string GeelyHWSD { get; set; } public string SXBL { get; set; } public string SXDISXBL { get; set; } public string VolvoDU { get; set; } public string VolvoHWSD { get; set; } public string DBConn { get; set; } private string IP { get; set; } private string DataBase { get; set; } private string Uid { get; set; } private string Pwd { get; set; } public string Models { get; set; } public string Field { get; set; } [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, byte[] retVal, int size, string filePath); public UserSettings(string file) { GetString(file); } public UserSettings(string section, string file) { GetString(section, file); } private void GetString(string fPath) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (!File.Exists(fPath)) { MessageBox.Show("配置文件不存在,读取失败", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } ConfigurationBuilder val = new ConfigurationBuilder(); IniConfigurationExtensions.AddIniFile((IConfigurationBuilder)(object)val, fPath); IConfigurationRoot val2 = val.Build(); IP = ((IConfiguration)val2)["Server:ip"]; DataBase = ((IConfiguration)val2)["Server:database"]; Uid = ((IConfiguration)val2)["Server:uid"]; Pwd = ((IConfiguration)val2)["Server:pwd"]; DBConn = "Server=" + IP + ";DataBase=" + DataBase + ";Uid=" + Uid + ";Pwd=" + Pwd; Models = ((IConfiguration)val2)["UserDefined:models"]; Field = ((IConfiguration)val2)["UserDefined:field"]; } private void GetString(string section, string fPath) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (!File.Exists(fPath)) { MessageBox.Show("配置文件不存在,读取失败", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } ConfigurationBuilder val = new ConfigurationBuilder(); IniConfigurationExtensions.AddIniFile((IConfigurationBuilder)(object)val, fPath); IConfigurationRoot val2 = val.Build(); OrderId = ((IConfiguration)val2)[section + ":Orderid"]; Model = ((IConfiguration)val2)[section + ":Model"]; SNPrefix = ((IConfiguration)val2)[section + ":SNPrefix"]; MESSstartSN = ((IConfiguration)val2)[section + ":MESStartSN"]; MESEndSN = ((IConfiguration)val2)[section + ":MESEndSN"]; XDSNDate = ((IConfiguration)val2)[section + ":XDSNDate"]; XDSNDaySN = ((IConfiguration)val2)[section + ":XDSNDaySN"]; XDSNSpecialSN = ((IConfiguration)val2)[section + ":XDSNSpecialSN"]; PartNo = ((IConfiguration)val2)[section + ":PartNo"]; HW = ((IConfiguration)val2)[section + ":HW"]; SW = ((IConfiguration)val2)[section + ":SW"]; GeelyDU = ((IConfiguration)val2)[section + ":GeelyDU"]; GeelyHWSD = ((IConfiguration)val2)[section + ":GeelyHWSD"]; SXBL = ((IConfiguration)val2)[section + ":SXBL"]; SXDISXBL = ((IConfiguration)val2)[section + ":SXDISXBL"]; VolvoDU = ((IConfiguration)val2)[section + ":VolvoDU"]; VolvoHWSD = ((IConfiguration)val2)[section + ":VolvoHWSD"]; } } } Plugin.SNGenerateTool/Form1.Designer.cs
New file @@ -0,0 +1,3 @@ namespace Plugin.SNGenerateTool { } Plugin.SNGenerateTool/Form1.cs
New file @@ -0,0 +1,1986 @@ using Plugin.SNGenerateTool; using Plugin.SNGenerateTool.Entity; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Drawing.Drawing2D; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Timers; using System.Windows.Forms; public class Form1 : Form { private Point Point; private string iniFile = Path.Combine(Application.StartupPath, "Config", "UserSettings.ini"); private UserSettings settings1; private UserSettings settings2; private DataTable table = new DataTable(); private bool flag; private string[] years = new string[30] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "V", "W", "X", "Y" }; private string[] months = new string[12] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C" }; private string[] days = new string[31] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "V", "W", "X", "Y", "Z" }; private string[] F18CY = new string[10] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; private System.Timers.Timer timer = new System.Timers.Timer(); private string fileNameWithoutExt = string.Empty; private ProgressBar progressBar = new ProgressBar(); private IContainer components = null; private ToolStripPanel BottomToolStripPanel; private ToolStripPanel TopToolStripPanel; private ToolStripPanel RightToolStripPanel; private ToolStripPanel LeftToolStripPanel; private ToolStripContentPanel ContentPanel; private TabControl tabControl1; private TabPage tabPage1; private Panel panel1; private GroupBox groupBox2; private TextBox txt_FactoryCode; private Label label4; private TextBox txt_PCODE; private TextBox txt_LineNo1; private Label label5; private Label label6; private GroupBox groupBox1; private TextBox txt_StartSN; private Label label1; private TextBox txt_SNPrefix; private Label label2; private TabPage tabPage2; private StatusStrip statusStrip1; private GroupBox groupBox3; private TextBox txt_StartDHUIDSN; private Label label11; private TextBox txt_ShiftsNo; private Label label12; private TextBox txt_Date2; private Label label13; private TextBox txt_PN; private Label label14; private TextBox txt_VendorCode; private Label label15; private Label label17; private TextBox txt_EndDaySN; private TextBox txt_MinSpecialSN; private Label label10; private TextBox txt_StartDaySN; private Label label9; private TextBox txt_Date1; private Label label8; private Label label7; private TextBox txt_EndSN; private TextBox txt_MaxSpecialSN; private Label label18; private TextBox txt_EndDHUIDSN; private Label label19; private GroupBox groupBox4; private TextBox txt_HW; private TextBox txt_GeelyHWSD; private Label label21; private Label label20; private TextBox txt_SW; private Label label25; private TextBox txt_VolvoDU; private Label label24; private TextBox txt_VolvoHWSD; private Label label23; private TextBox txt_GeelyDU; private Label label22; private Button btn_ClearText; private Button btn_ImportData; private Button btn_CreateSN; private DataGridView dataGridView1; private ToolStripStatusLabel toolStripStatusLabel1; private ToolStripStatusLabel toolStripStatusLabel2; private ToolStripStatusLabel toolStripStatusLabel3; private ToolStripStatusLabel toolStripStatusLabel4; private ToolStripStatusLabel toolStripStatusLabel5; private ToolStripStatusLabel toolStripStatusLabel6; private ToolTip toolTip1; private ErrorProvider errorProvider1; private Label label3; private Label lbl_Title; private TextBox txt_MachineCode; private Label label16; private Button btn_Close; private Button btn_Minimize; private ToolStripStatusLabel toolStripStatusLabel7; private ToolStripStatusLabel toolStripStatusLabel8; private DataGridView dataGridView2; private Panel panel2; private Label label28; private Label label27; private Button btn_Delete; private Button btn_Modify; private Button btn_Query; private ComboBox cbox_Field; private TextBox tbx_content; private ComboBox cbox_Model; private Label label26; private TextBox txt_SXBL; private Label label29; private TextBox txt_SXDISXBL; private Label label30; private TextBox tbx_OrderID; private Button btn_OpenDlg; private Button btn_Export; [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); public Form1() { InitializeComponent(); settings1 = new UserSettings(iniFile); SetMainForm(); SetTabControl(); SetToolStrip(); SetToolTip(); SetErrorProvider(); SetControls(base.Controls); SetDataGridColumn(dataGridView1); Timer(timer, Realtime); } private string GetVersion() { return "程序集版本:" + Assembly.GetExecutingAssembly().GetName().Version.ToString(); } private void SetMainForm() { Text = "E04 SN Generate Tool"; base.ControlBox = false; base.FormBorderStyle = FormBorderStyle.None; base.StartPosition = FormStartPosition.CenterScreen; BackColor = Color.FromArgb(71, 236, 255); } private void SetTabControl() { tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed; tabControl1.ItemSize = new Size(75, 25); tabControl1.SizeMode = TabSizeMode.Fixed; } private void SetToolStrip() { statusStrip1.BackColor = Color.FromArgb(227, 237, 243); statusStrip1.ForeColor = Color.MediumBlue; toolStripStatusLabel1.Text = ""; toolStripStatusLabel1.AutoSize = false; toolStripStatusLabel1.Width = 700; toolStripStatusLabel2.Text = "当前用户:"; toolStripStatusLabel3.Text = ""; toolStripStatusLabel3.AutoSize = false; toolStripStatusLabel3.Width = 50; toolStripStatusLabel4.Text = GetVersion(); toolStripStatusLabel5.Text = ""; toolStripStatusLabel5.AutoSize = false; toolStripStatusLabel5.Width = 50; toolStripStatusLabel6.Text = "系统时间:" + DateTime.Now.ToString("G"); toolStripStatusLabel7.Text = ""; toolStripStatusLabel7.AutoSize = false; toolStripStatusLabel7.Width = 50; toolStripStatusLabel8.Text = "0行"; } private void SetToolTip() { toolTip1.InitialDelay = 10; toolTip1.ReshowDelay = 10; toolTip1.SetToolTip(txt_Date1, "日期格式:yyyyMMdd"); toolTip1.SetToolTip(txt_Date2, "日期格式:yyyyMMdd"); toolTip1.SetToolTip(btn_Minimize, "最小化"); toolTip1.SetToolTip(btn_Close, "关闭"); } private void SetErrorProvider() { errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink; } private void SetControls(Control.ControlCollection controls) { foreach (Control control in controls) { if (control is TabControl tabControl) { tabControl.DrawItem += tabControl1_DrawItem; } else if (control is Panel panel) { panel.BackColor = Color.FromArgb(227, 237, 243); } else if (control is GroupBox groupBox) { groupBox.ForeColor = ColorTranslator.FromHtml("#442A9D"); } else if (control is TextBox textBox) { textBox.ImeMode = ImeMode.Disable; if (textBox.Name == "txt_Date1" || textBox.Name == "txt_Date2") { textBox.Text = DateTime.Now.ToString("yyyyMMdd"); } if (textBox.Name == "txt_EndDaySN" || textBox.Name == "txt_MaxSpecialSN" || textBox.Name == "txt_EndDHUIDSN") { textBox.Enabled = false; } textBox.KeyPress += textBox_KeyPress; if (textBox.Name == "tbx_content") { textBox.Validated += textBox_Validated; } else { textBox.Validating += textBox_Validating; } } else if (control is Label label) { label.ForeColor = ColorTranslator.FromHtml("#442A9D"); if (label.Name == "lbl_Title") { label.MouseDown += LabelMouseDown; label.MouseMove += LabelMouseMove; } } else if (control is Button button) { if (button.Name == "btn_Minimize" || button.Name == "btn_Close" || button.Name == "btn_OpenDlg") { button.BackColor = Color.Transparent; button.BackgroundImageLayout = ImageLayout.Zoom; button.FlatStyle = FlatStyle.Flat; button.FlatAppearance.BorderSize = 0; button.FlatAppearance.MouseOverBackColor = Color.FromArgb(9, 229, 255); button.FlatAppearance.MouseDownBackColor = Color.FromArgb(64, 177, 255); } else { button.BackColor = ColorTranslator.FromHtml("#442A9D"); button.ForeColor = Color.White; button.FlatStyle = FlatStyle.Flat; button.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0); button.FlatAppearance.BorderSize = 0; button.FlatAppearance.MouseDownBackColor = Color.FromArgb(58, 102, 127); } button.Cursor = Cursors.Hand; } else if (control is DataGridView dataGridStyle) { SetDataGridStyle(dataGridStyle); } else if (control is ComboBox comboBox) { if (comboBox.Name == "cbox_Model") { ComboBox.ObjectCollection items = comboBox.Items; object[] items2 = settings1.Models.Split(','); items.AddRange(items2); comboBox.DropDownStyle = ComboBoxStyle.DropDownList; } else { ComboBox.ObjectCollection items3 = comboBox.Items; object[] items2 = settings1.Field.Split(','); items3.AddRange(items2); comboBox.DropDownStyle = ComboBoxStyle.DropDownList; } comboBox.Validating += ComboBox_Validating; } if (control.HasChildren) { SetControls(control.Controls); } } } private void tabControl1_DrawItem(object sender, DrawItemEventArgs e) { Font font; Brush brush; Brush brush2; if (e.Index == tabControl1.SelectedIndex) { font = new Font(e.Font, FontStyle.Bold); brush = new LinearGradientBrush(e.Bounds, Color.FromArgb(71, 236, 255), Color.FromArgb(0, 150, 255), LinearGradientMode.Vertical); brush2 = new SolidBrush(Color.FromArgb(255, 255, 255)); } else { font = e.Font; brush = new SolidBrush(SystemColors.Control); brush2 = new SolidBrush(Color.DimGray); } string s = tabControl1.TabPages[e.Index].Text; StringFormat stringFormat = new StringFormat(); stringFormat.LineAlignment = StringAlignment.Center; stringFormat.Alignment = StringAlignment.Center; e.Graphics.FillRectangle(brush, e.Bounds); Rectangle bounds = e.Bounds; bounds = new Rectangle(bounds.X, bounds.Y + 4, bounds.Width, bounds.Height - 4); e.Graphics.DrawString(s, font, brush2, bounds, stringFormat); } private void GDIPaint(object sender, PaintEventArgs e) { Label label = sender as Label; Graphics graphics = e.Graphics; Color color = Color.FromArgb(71, 236, 255); Color color2 = Color.FromArgb(64, 177, 255); Color color3 = Color.FromArgb(9, 229, 255); Color color4 = Color.FromArgb(0, 150, 255); Brush brush = new LinearGradientBrush(label.ClientRectangle, color, color2, LinearGradientMode.Vertical); graphics.FillRectangle(brush, label.ClientRectangle); } private void LabelMouseDown(object sender, MouseEventArgs e) { Point = e.Location; } private void LabelMouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { base.Location = new Point(base.Location.X + e.X - Point.X, base.Location.Y + e.Y - Point.Y); } } private void textBox_Validated(object sender, EventArgs e) { TextBox textBox = sender as TextBox; ValidatingText(textBox, "此项为必填项"); } private void textBox_Validating(object sender, CancelEventArgs e) { TextBox textBox = sender as TextBox; ValidatingText(textBox, "此项为必填项"); } private void ComboBox_Validated(object sender, EventArgs e) { ComboBox comboBox = sender as ComboBox; ValidatingText(comboBox, "请选择查询字段"); } private void ComboBox_Validating(object sender, CancelEventArgs e) { ComboBox comboBox = sender as ComboBox; ValidatingText(comboBox, "请选择查询字段"); } private void textBox_KeyPress(object sender, KeyPressEventArgs e) { TextBox textBox = sender as TextBox; if (textBox.Name == "txt_StartSN" || textBox.Name == "txt_EndSN" || textBox.Name == "txt_StartDaySN" || textBox.Name == "txt_EndDaySN" || textBox.Name == "txt_MinSpecialSN" || textBox.Name == "txt_MaxSpecialSN" || textBox.Name == "txt_StartDHUIDSN" || textBox.Name == "txt_EndDHUIDSN") { if (char.IsDigit(e.KeyChar) || e.KeyChar == '\b' || char.IsControl(e.KeyChar)) { e.Handled = false; } else { e.Handled = true; } } else if (char.IsLetterOrDigit(e.KeyChar) || char.IsPunctuation(e.KeyChar) || e.KeyChar == '\b' || char.IsControl(e.KeyChar)) { e.Handled = false; } else { e.Handled = true; } e.KeyChar = char.ToUpper(e.KeyChar); } private bool ValidatingText(TextBox textBox, string errorMsg) { if (textBox.Text.Length == 0) { errorProvider1.SetError(textBox, errorMsg); return false; } errorProvider1.SetError(textBox, string.Empty); return true; } private bool ValidatingText(ComboBox comboBox, string errorMsg) { if (comboBox.Text.Length == 0) { errorProvider1.SetError(comboBox, errorMsg); return false; } errorProvider1.SetError(comboBox, string.Empty); return true; } private void SetDataGridColumn(DataGridView dataGrid) { string[] array = new string[23] { "GUID", "Orderid", "Model", "MESSN", "XDSN", "DHUID", "ProductSN", "HW", "SW", "GeelyDU", "GeelyHWSD", "SXBL", "SXDI_SXBL", "ECUDAPN", "ECUCAPN", "HSMKey", "JtagKey", "TEEKey", "Status", "CreateTime", "ModifyTime", "IsPrint", "PrintTime" }; for (int i = 0; i < array.Length; i++) { table.Columns.Add(array[i]); } dataGrid.DataSource = table.DefaultView; } private void SetDataGridStyle(DataGridView dataGrid) { dataGrid.BackgroundColor = Color.White; dataGrid.AllowUserToAddRows = false; dataGrid.AllowUserToDeleteRows = false; dataGrid.AllowUserToOrderColumns = false; dataGrid.AllowUserToResizeColumns = true; dataGrid.AllowUserToResizeRows = false; dataGrid.ReadOnly = true; dataGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; dataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dataGrid.RowHeadersWidth = 35; dataGrid.ColumnHeadersHeight = 30; dataGrid.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; foreach (DataGridViewColumn column in dataGrid.Columns) { column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; column.SortMode = DataGridViewColumnSortMode.Programmatic; } dataGrid.RowPostPaint += dataGridView_RowPostPaint; dataGrid.RowHeadersDefaultCellStyle.Padding = new Padding(dataGridView1.RowHeadersWidth); } private void dataGridView_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { DataGridView dataGridView = sender as DataGridView; Rectangle bounds = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dataGridView1.RowHeadersWidth - 1, e.RowBounds.Height); TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), dataGridView.RowHeadersDefaultCellStyle.Font, bounds, dataGridView.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter); List<int> list = new List<int> { e.RowIndex + 1 }; } private void btn_CreateSN_Click(object sender, EventArgs e) { SaveSettings(cbox_Model.Text, iniFile); CreateSN(); } private void CreateSN() { if (table.Rows.Count > 0) { table.Clear(); } try { int num = Convert.ToInt32(txt_StartSN.Text); int num2 = Convert.ToInt32(txt_EndSN.Text); int num3 = Convert.ToInt32(txt_StartDaySN.Text); int num4 = Convert.ToInt32(txt_MinSpecialSN.Text); int num5 = Convert.ToInt32(txt_StartDHUIDSN.Text); int num6 = Convert.ToInt32(txt_Date1.Text.Substring(0, 4)) % 2001; int num7 = Convert.ToInt32(txt_Date1.Text.Substring(4, 2)) - 1; int num8 = Convert.ToInt32(txt_Date1.Text.Substring(6, 2)) - 1; if (Convert.ToInt32(txt_Date1.Text.Substring(0, 4)) < 2020) { MessageBox.Show("生产日期中的年份早于当前年份!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } int num9 = Convert.ToInt32(txt_Date1.Text.Substring(0, 4)) % 2020; GregorianCalendar gregorianCalendar = new GregorianCalendar(); DateTime time = DateTime.ParseExact(txt_Date1.Text, "yyyyMMdd", CultureInfo.CurrentCulture); int weekOfYear = gregorianCalendar.GetWeekOfYear(time, CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday); int num10 = 0; switch (time.DayOfWeek.ToString()) { case "Monday": num10 = 1; break; case "Tuesday": num10 = 2; break; case "Wednesday": num10 = 3; break; case "Thursday": num10 = 4; break; case "Friday": num10 = 5; break; case "Saturday": num10 = 6; break; case "Sunday": num10 = 7; break; } if (txt_StartSN.Text != null && txt_EndSN.Text != null && num <= num2 && txt_EndSN.TextLength < 5) { int num11 = num; int num12 = num3; int num13 = num4; int num14 = num5; while (num11 <= num2) { DataRow dataRow = table.NewRow(); if (num12.ToString().Length < 5 && num13.ToString().Length < 8 && num14.ToString().Length < 5) { string text = txt_PCODE.Text.Trim() + years[num6] + num13.ToString().PadLeft(7, '0'); string text2 = HashPlus.GetHashMD5(text).ToUpper(); text2 = text2.Substring(0, 8) + "-" + text2.Substring(8, 4) + "-" + text2.Substring(12, 4) + "-" + text2.Substring(16, 4) + "-" + text2.Substring(20, 12); string text3 = txt_SNPrefix.Text + num11.ToString().PadLeft(4, '0'); string text4 = txt_PCODE.Text + txt_MachineCode.Text + txt_FactoryCode.Text + txt_LineNo1.Text + years[num6] + months[num7] + days[num8] + num12.ToString().PadLeft(4, '0') + num13.ToString().PadLeft(7, '0'); string text5 = txt_VendorCode.Text + txt_PN.Text + years[num6] + months[num7] + days[num8] + txt_ShiftsNo.Text + num14.ToString().PadLeft(4, '0'); string empty = string.Empty; empty = F18CY[num9] + weekOfYear.ToString().PadLeft(2, '0') + num10 + num12.ToString().PadLeft(4, '0'); if (text3.Length != 14 && text4.Length != 24 && text5.Length != 24) { MessageBox.Show("MESSN / XDSN / DHUID长度有误,请检查输入的数据是否有误!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } dataRow["GUID"] = text2; dataRow["Orderid"] = tbx_OrderID.Text.Trim(); dataRow["Model"] = cbox_Model.Text.Trim(); dataRow["MESSN"] = text3.Trim(); dataRow["XDSN"] = text4.Trim(); dataRow["DHUID"] = text5.Trim(); dataRow["ProductSN"] = empty.Trim(); dataRow["HW"] = txt_HW.Text.PadRight(16, '0').Trim(); dataRow["SW"] = txt_SW.Text.Trim(); dataRow["SXBL"] = txt_SXBL.Text.Trim(); dataRow["SXDI_SXBL"] = txt_SXDISXBL.Text.Trim(); dataRow["GeelyDU"] = txt_GeelyDU.Text.Trim(); dataRow["GeelyHWSD"] = txt_GeelyHWSD.Text.Trim(); dataRow["ECUDAPN"] = txt_VolvoDU.Text.Trim(); dataRow["ECUCAPN"] = txt_VolvoHWSD.Text.Trim(); dataRow["Status"] = 0; dataRow["CreateTime"] = Convert.ToDateTime(DateTime.Now.ToString("G")); table.Rows.Add(dataRow); num11++; num12++; num13++; num14++; continue; } MessageBox.Show("日流水号或连续号位数超出范围", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); break; } dataGridView1.DataSource = table.DefaultView; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; toolStripStatusLabel8.Text = $"{table.Rows.Count}行"; } else { MessageBox.Show("请检查所有文本框是否有填写,并确认SN的流水号及位数是否有误", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } catch (Exception ex) { MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } private void btn_ImportData_Click(object sender, EventArgs e) { ImportData(); } private void ImportData() { //if (MessageBox.Show("确认是否导入数据库?", "消息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) //{ // return; //} //if (table.Rows.Count != 0) //{ // PwdForm pwdForm = new PwdForm(); // if (pwdForm.ShowDialog() != DialogResult.OK) // { // return; // } // using (SqlConnection sqlConnection = new SqlConnection(settings1.DBConn)) // { // try // { // sqlConnection.Open(); // SqlBulkCopy sqlBulkCopy = new SqlBulkCopy(sqlConnection); // sqlBulkCopy.DestinationTableName = "SNDTL"; // sqlBulkCopy.WriteToServer(table); // sqlBulkCopy.Close(); // MessageBox.Show("数据导入成功!", "消息提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); // return; // } // catch (SqlException ex) // { // throw new Exception(ex.Message); // } // finally // { // sqlConnection.Close(); // } // } //} MessageBox.Show("数据为空,导入失败,请生成序列号后再导入!", "消息提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); } private void btn_ClearText_Click(object sender, EventArgs e) { ClearText(base.Controls); } private void ClearText(Control.ControlCollection controls) { foreach (Control control in controls) { if (control is TextBox textBox) { textBox.ResetText(); } if (control.HasChildren) { ClearText(control.Controls); } } } private void btn_Mininimze_Click(object sender, EventArgs e) { base.WindowState = FormWindowState.Minimized; } private void btn_Close_Click(object sender, EventArgs e) { Close(); } private void MainForm_Paint(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; Color color = Color.FromArgb(71, 236, 255); Color color2 = Color.FromArgb(64, 177, 255); Color color3 = Color.FromArgb(9, 229, 255); Color color4 = Color.FromArgb(0, 150, 255); Brush brush = new LinearGradientBrush(base.ClientRectangle, color, color2, LinearGradientMode.Vertical); graphics.FillRectangle(brush, base.ClientRectangle); } private void Timer(System.Timers.Timer t, Action<object, ElapsedEventArgs> action) { t.Elapsed += action.Invoke; t.AutoReset = true; t.Enabled = true; } private void Realtime(object sender, EventArgs e) { timer.Interval = 1000.0; toolStripStatusLabel6.Text = "系统时间:" + DateTime.Now.ToString("G"); timer.Enabled = true; } private void cbx_Field_SelectedIndexChanged(object sender, EventArgs e) { if (cbox_Field.Text.Equals("最大连续号")) { tbx_content.Visible = false; btn_Query_Click(sender, e); } else { tbx_content.Visible = true; } } private void btn_Query_Click(object sender, EventArgs e) { if (cbox_Field.Text.Equals("最大连续号")) { using (SqlConnection sqlConnection = new SqlConnection(settings1.DBConn)) { string empty = string.Empty; string text = cbox_Field.Text; string text2 = text; if (text2 == "最大连续号") { empty = "Subtring(XDSN,0,7)Substring(XDSN,11,1)Right(XDSN,7)"; } string text3 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE 'SHU1011%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE1"; string text4 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE 'SHU104S%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE2"; string text5 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE 'SHU206S%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE3"; string text6 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE '02647G1%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE4"; string text7 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE '02647G2%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE5"; string text8 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE '02648G3%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE6"; string text9 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE '02648G1%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE7"; string text10 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE '02648G2%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE8"; string text11 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE '02601P3%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLE9"; string text12 = "select * FROM (select TOP(1) * FROM DBO.SNDTL WHERE XDSN LIKE 'DHU057L%' ORDER BY SUBSTRING(XDSN,0,7)+SUBSTRING(XDSN,11,1)+RIGHT(XDSN,7) DESC) AS TABLEA"; string cmdText = text3 + "\r\nUNION\r\n" + text4 + "\r\nUNION\r\n" + text5 + "\r\nUNION\r\n" + text6 + "\r\nUNION\r\n" + text7 + "\r\nUNION\r\n" + text8 + "\r\nUNION\r\n" + text9 + "\r\nUNION\r\n" + text10 + "\r\nUNION\r\n" + text11 + "\r\nUNION\r\n" + text12; using (SqlCommand selectCommand = new SqlCommand(cmdText, sqlConnection)) { sqlConnection.Open(); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectCommand); DataSet dataSet = new DataSet(); sqlDataAdapter.Fill(dataSet); dataGridView2.DataSource = dataSet.Tables[0]; dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; toolStripStatusLabel8.Text = $"{dataSet.Tables[0].Rows.Count}行"; sqlDataAdapter.Dispose(); dataSet.Dispose(); sqlConnection.Close(); return; } } } if (!ValidatingText(cbox_Field, "请选择查询字段") || !ValidatingText(tbx_content, "请输入查询内容")) { return; } using (SqlConnection sqlConnection2 = new SqlConnection(settings1.DBConn)) { string text13 = string.Empty; switch (cbox_Field.Text) { case "工单号": text13 = "orderid"; break; case "机型": text13 = "Model"; break; case "过站码": text13 = "MESSN"; break; case "XDSN": text13 = "XDSN"; break; case "DHUID": text13 = "DHUID"; break; case "GeelyDU": text13 = "DU"; break; case "硬件版本": text13 = "HW"; break; case "软件版本": text13 = "SW"; break; case "JtagKey": text13 = "JtagKey"; break; } string cmdText2 = "select * from [dbo].[SNDTL] where " + text13 + " like @value"; using (SqlCommand sqlCommand = new SqlCommand(cmdText2, sqlConnection2)) { sqlCommand.Parameters.AddWithValue("@value", "%" + tbx_content.Text + "%"); sqlConnection2.Open(); SqlDataAdapter sqlDataAdapter2 = new SqlDataAdapter(sqlCommand); DataSet dataSet2 = new DataSet(); sqlDataAdapter2.Fill(dataSet2); dataGridView2.DataSource = dataSet2.Tables[0]; dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; toolStripStatusLabel8.Text = $"{dataSet2.Tables[0].Rows.Count}行"; sqlDataAdapter2.Dispose(); dataSet2.Dispose(); sqlConnection2.Close(); } } } private void tbx_content_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { btn_Query_Click(sender, e); } } private void btn_Modify_Click(object sender, EventArgs e) { MessageBox.Show("此功能暂未开放!", "Tips:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } private void btn_Delete_Click(object sender, EventArgs e) { MessageBox.Show("此功能暂未开放!", "Tips:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { ShowDataGridRows(base.Controls); } private void ShowDataGridRows(Control.ControlCollection controls) { foreach (Control control in controls) { if (control is DataGridView dataGridView) { toolStripStatusLabel8.Text = $"{dataGridView.Rows}行"; } if (control.HasChildren) { ShowDataGridRows(control.Controls); } } } private void cbx_Model_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(fileNameWithoutExt)) { string file = Path.Combine(Environment.CurrentDirectory, "Config", fileNameWithoutExt + ".ini"); settings2 = new UserSettings(cbox_Model.Text, file); } else { settings2 = new UserSettings(cbox_Model.Text, iniFile); } GetVal(); Commonparams(cbox_Model.Text); } private void Commonparams(string model) { switch (model) { case "E371-H-CN": txt_SNPrefix.Text = $"002101G1{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU1011"; break; case "E371-L-CN": txt_SNPrefix.Text = $"002101G2{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU1011"; break; case "HY11-H-CN": txt_SNPrefix.Text = $"002104S1{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU104S"; break; case "HY11-L-CN": txt_SNPrefix.Text = $"002104S2{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU104S"; break; case "HS11-H-CN": txt_SNPrefix.Text = $"002104S3{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU104S"; break; case "HS11-L-CN": txt_SNPrefix.Text = $"002104S4{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU104S"; break; case "HY11-H-EU": txt_SNPrefix.Text = $"002206S1{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU206S"; break; case "HY11-L-EU": txt_SNPrefix.Text = $"002206S2{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU206S"; break; case "HS11-H-EU": txt_SNPrefix.Text = $"002206S3{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU206S"; break; case "HS11-L-EU": txt_SNPrefix.Text = $"002206S4{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "SHU206S"; break; case "E245-H-CN": txt_SNPrefix.Text = $"002647G1{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "02647G1"; break; case "E245-L-CN": txt_SNPrefix.Text = $"002647G2{DateTime.Now:yyMMdd}"; txt_PCODE.Text = "02647G2"; break; } if (model.Contains("E245")) { txt_MachineCode.Text = "0"; txt_FactoryCode.Text = "D"; txt_LineNo1.Text = "9"; txt_VendorCode.Text = "999722"; txt_ShiftsNo.Text = "0"; } else { txt_MachineCode.Text = "0"; txt_FactoryCode.Text = "D"; txt_LineNo1.Text = "1"; txt_VendorCode.Text = "999722"; txt_ShiftsNo.Text = "A"; } } private void txt_StartSN_TextChanged(object sender, EventArgs e) { TextBox textBox = txt_StartDHUIDSN; string text2 = (txt_StartDaySN.Text = txt_StartSN.Text); textBox.Text = text2; } private void txt_StartDaySN_TextChanged(object sender, EventArgs e) { txt_StartDHUIDSN.Text = txt_StartDaySN.Text; } private void txt_Date1_TextChanged(object sender, EventArgs e) { txt_Date2.Text = txt_Date1.Text; } private void txt_GeelyDU_TextChanged(object sender, EventArgs e) { txt_PN.Text = txt_GeelyDU.Text.Split('/')[0]; } private void GetVal() { tbx_OrderID.Text = settings2.OrderId; cbox_Model.SelectedItem = settings2.Model; txt_SNPrefix.Text = settings2.SNPrefix; txt_StartSN.Text = settings2.MESSstartSN; txt_EndSN.Text = settings2.MESEndSN; txt_Date1.Text = settings2.XDSNDate; txt_StartDaySN.Text = settings2.XDSNDaySN; txt_MinSpecialSN.Text = settings2.XDSNSpecialSN; txt_PN.Text = settings2.PartNo; txt_HW.Text = settings2.HW; txt_SW.Text = settings2.SW; txt_GeelyDU.Text = settings2.GeelyDU; txt_GeelyHWSD.Text = settings2.GeelyHWSD; txt_SXBL.Text = settings2.SXBL; txt_SXDISXBL.Text = settings2.SXDISXBL; txt_VolvoDU.Text = settings2.VolvoDU; txt_VolvoHWSD.Text = settings2.VolvoHWSD; } private void SaveSettings(string file) { if (!File.Exists(file)) { MessageBox.Show("配置文件不存在,保存失败", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } WritePrivateProfileString("Settings", "OrderId", tbx_OrderID.Text, file); WritePrivateProfileString("Settings", "PartNo", txt_PN.Text, file); WritePrivateProfileString("Settings", "HW", txt_HW.Text, file); WritePrivateProfileString("Settings", "SW", txt_SW.Text, file); WritePrivateProfileString("Settings", "GeelyDU", txt_GeelyDU.Text, file); WritePrivateProfileString("Settings", "GeelyHWSD", txt_GeelyHWSD.Text, file); WritePrivateProfileString("Settings", "SXBL", txt_SXBL.Text, file); WritePrivateProfileString("Settings", "SXDISXBL", txt_SXDISXBL.Text, file); WritePrivateProfileString("Settings", "VolvoDU", txt_VolvoDU.Text, file); WritePrivateProfileString("Settings", "VolvoHWSD", txt_VolvoHWSD.Text, file); } private void SaveSettings(string section, string file) { if (!File.Exists(file)) { MessageBox.Show("配置文件不存在,保存失败", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } WritePrivateProfileString(section, "OrderId", tbx_OrderID.Text, file); WritePrivateProfileString(section, "SNPrefix", txt_SNPrefix.Text, file); WritePrivateProfileString(section, "MESStartSN", txt_StartSN.Text, file); WritePrivateProfileString(section, "MESEndSN", txt_EndSN.Text, file); WritePrivateProfileString(section, "XDSNDate", txt_Date1.Text, file); WritePrivateProfileString(section, "XDSNDaySN", txt_StartDaySN.Text, file); WritePrivateProfileString(section, "XDSNSpecialSN", txt_MinSpecialSN.Text, file); WritePrivateProfileString(section, "PartNo", txt_PN.Text, file); WritePrivateProfileString(section, "HW", txt_HW.Text, file); WritePrivateProfileString(section, "SW", txt_SW.Text, file); WritePrivateProfileString(section, "GeelyDU", txt_GeelyDU.Text, file); WritePrivateProfileString(section, "GeelyHWSD", txt_GeelyHWSD.Text, file); WritePrivateProfileString(section, "SXBL", txt_SXBL.Text, file); WritePrivateProfileString(section, "SXDISXBL", txt_SXDISXBL.Text, file); WritePrivateProfileString(section, "VolvoDU", txt_VolvoDU.Text, file); WritePrivateProfileString(section, "VolvoHWSD", txt_VolvoHWSD.Text, file); } private void btn_OpenDlg_Click(object sender, EventArgs e) { cbox_Model.SelectedIndexChanged -= cbx_Model_SelectedIndexChanged; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Path.Combine(Application.StartupPath, "Config"); openFileDialog.Filter = "INI文件(*.ini)|*.ini|所有文件(*.*)|*.*"; openFileDialog.Multiselect = false; if (openFileDialog.ShowDialog() == DialogResult.OK) { fileNameWithoutExt = Path.GetFileNameWithoutExtension(openFileDialog.FileName); tbx_OrderID.Text = fileNameWithoutExt; string file = Path.Combine(Environment.CurrentDirectory, "Config", fileNameWithoutExt + ".ini"); settings2 = new UserSettings("Config", file); GetVal(); Commonparams(cbox_Model.Text); } else { openFileDialog.Dispose(); } cbox_Model.SelectedIndexChanged += cbx_Model_SelectedIndexChanged; fileNameWithoutExt = string.Empty; } private void btn_Export_Click(object sender, EventArgs e) { if (dataGridView2.DataSource != null) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Excel 97-2003工作簿|*.xls"; DialogResult dialogResult = saveFileDialog.ShowDialog(); if (dialogResult == DialogResult.OK) { progressBar.Value = 0; progressBar.Minimum = 0; progressBar.Maximum = ((DataTable)dataGridView2.DataSource).Rows.Count; string fileName = saveFileDialog.FileName; //if (nPOIHelper.ExportExcel((DataTable)dataGridView2.DataSource, "导出数据", fileName, progressBar)) //{ // MessageBox.Show("数据导出完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); // return; //} MessageBox.Show("数据导出失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); progressBar.Value = 0; } } else { MessageBox.Show("未发现数据,导出失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } protected override void Dispose(bool disposing) { if (disposing && components != null) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.BottomToolStripPanel = new System.Windows.Forms.ToolStripPanel(); this.TopToolStripPanel = new System.Windows.Forms.ToolStripPanel(); this.RightToolStripPanel = new System.Windows.Forms.ToolStripPanel(); this.LeftToolStripPanel = new System.Windows.Forms.ToolStripPanel(); this.ContentPanel = new System.Windows.Forms.ToolStripContentPanel(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.panel1 = new System.Windows.Forms.Panel(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.txt_SXBL = new System.Windows.Forms.TextBox(); this.label29 = new System.Windows.Forms.Label(); this.txt_SXDISXBL = new System.Windows.Forms.TextBox(); this.label30 = new System.Windows.Forms.Label(); this.btn_ClearText = new System.Windows.Forms.Button(); this.txt_GeelyHWSD = new System.Windows.Forms.TextBox(); this.label21 = new System.Windows.Forms.Label(); this.btn_ImportData = new System.Windows.Forms.Button(); this.txt_SW = new System.Windows.Forms.TextBox(); this.label25 = new System.Windows.Forms.Label(); this.btn_CreateSN = new System.Windows.Forms.Button(); this.txt_VolvoDU = new System.Windows.Forms.TextBox(); this.txt_VolvoHWSD = new System.Windows.Forms.TextBox(); this.label23 = new System.Windows.Forms.Label(); this.label24 = new System.Windows.Forms.Label(); this.txt_GeelyDU = new System.Windows.Forms.TextBox(); this.label22 = new System.Windows.Forms.Label(); this.txt_HW = new System.Windows.Forms.TextBox(); this.label20 = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.txt_EndDHUIDSN = new System.Windows.Forms.TextBox(); this.label19 = new System.Windows.Forms.Label(); this.txt_StartDHUIDSN = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.txt_ShiftsNo = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); this.txt_Date2 = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.txt_PN = new System.Windows.Forms.TextBox(); this.label14 = new System.Windows.Forms.Label(); this.txt_VendorCode = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.txt_MachineCode = new System.Windows.Forms.TextBox(); this.label16 = new System.Windows.Forms.Label(); this.txt_MaxSpecialSN = new System.Windows.Forms.TextBox(); this.label18 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.txt_EndDaySN = new System.Windows.Forms.TextBox(); this.txt_MinSpecialSN = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.txt_StartDaySN = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.txt_Date1 = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.txt_FactoryCode = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.txt_PCODE = new System.Windows.Forms.TextBox(); this.txt_LineNo1 = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.tbx_OrderID = new System.Windows.Forms.TextBox(); this.btn_OpenDlg = new System.Windows.Forms.Button(); this.cbox_Model = new System.Windows.Forms.ComboBox(); this.label26 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.txt_EndSN = new System.Windows.Forms.TextBox(); this.txt_StartSN = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.txt_SNPrefix = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.dataGridView2 = new System.Windows.Forms.DataGridView(); this.panel2 = new System.Windows.Forms.Panel(); this.btn_Export = new System.Windows.Forms.Button(); this.tbx_content = new System.Windows.Forms.TextBox(); this.cbox_Field = new System.Windows.Forms.ComboBox(); this.btn_Delete = new System.Windows.Forms.Button(); this.btn_Modify = new System.Windows.Forms.Button(); this.btn_Query = new System.Windows.Forms.Button(); this.label28 = new System.Windows.Forms.Label(); this.label27 = new System.Windows.Forms.Label(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel6 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel7 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel8 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); this.lbl_Title = new System.Windows.Forms.Label(); this.btn_Close = new System.Windows.Forms.Button(); this.btn_Minimize = new System.Windows.Forms.Button(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)this.dataGridView1).BeginInit(); this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.tabPage2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)this.dataGridView2).BeginInit(); this.panel2.SuspendLayout(); this.statusStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)this.errorProvider1).BeginInit(); base.SuspendLayout(); this.BottomToolStripPanel.Location = new System.Drawing.Point(0, 0); this.BottomToolStripPanel.Name = "BottomToolStripPanel"; this.BottomToolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; this.BottomToolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.BottomToolStripPanel.Size = new System.Drawing.Size(0, 0); this.TopToolStripPanel.Location = new System.Drawing.Point(0, 0); this.TopToolStripPanel.Name = "TopToolStripPanel"; this.TopToolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; this.TopToolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.TopToolStripPanel.Size = new System.Drawing.Size(0, 0); this.RightToolStripPanel.Location = new System.Drawing.Point(0, 0); this.RightToolStripPanel.Name = "RightToolStripPanel"; this.RightToolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; this.RightToolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.RightToolStripPanel.Size = new System.Drawing.Size(0, 0); this.LeftToolStripPanel.Location = new System.Drawing.Point(0, 0); this.LeftToolStripPanel.Name = "LeftToolStripPanel"; this.LeftToolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; this.LeftToolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.LeftToolStripPanel.Size = new System.Drawing.Size(0, 0); this.ContentPanel.AutoScroll = true; this.ContentPanel.Size = new System.Drawing.Size(1578, 819); this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Location = new System.Drawing.Point(0, 81); this.tabControl1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(1902, 925); this.tabControl1.TabIndex = 1; this.tabControl1.SelectedIndexChanged += new System.EventHandler(tabControl1_SelectedIndexChanged); this.tabPage1.Controls.Add(this.dataGridView1); this.tabPage1.Controls.Add(this.panel1); this.tabPage1.Location = new System.Drawing.Point(4, 25); this.tabPage1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabPage1.Size = new System.Drawing.Size(1894, 896); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "创建号码◢"; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Location = new System.Drawing.Point(5, 298); this.dataGridView1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.RowHeadersWidth = 51; this.dataGridView1.RowTemplate.Height = 30; this.dataGridView1.Size = new System.Drawing.Size(1886, 594); this.dataGridView1.TabIndex = 0; this.panel1.Controls.Add(this.groupBox4); this.panel1.Controls.Add(this.groupBox3); this.panel1.Controls.Add(this.groupBox2); this.panel1.Controls.Add(this.groupBox1); this.panel1.Location = new System.Drawing.Point(5, 5); this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(1886, 289); this.panel1.TabIndex = 0; this.groupBox4.Controls.Add(this.txt_SXBL); this.groupBox4.Controls.Add(this.label29); this.groupBox4.Controls.Add(this.txt_SXDISXBL); this.groupBox4.Controls.Add(this.label30); this.groupBox4.Controls.Add(this.btn_ClearText); this.groupBox4.Controls.Add(this.txt_GeelyHWSD); this.groupBox4.Controls.Add(this.label21); this.groupBox4.Controls.Add(this.btn_ImportData); this.groupBox4.Controls.Add(this.txt_SW); this.groupBox4.Controls.Add(this.label25); this.groupBox4.Controls.Add(this.btn_CreateSN); this.groupBox4.Controls.Add(this.txt_VolvoDU); this.groupBox4.Controls.Add(this.txt_VolvoHWSD); this.groupBox4.Controls.Add(this.label23); this.groupBox4.Controls.Add(this.label24); this.groupBox4.Controls.Add(this.txt_GeelyDU); this.groupBox4.Controls.Add(this.label22); this.groupBox4.Controls.Add(this.txt_HW); this.groupBox4.Controls.Add(this.label20); this.groupBox4.Location = new System.Drawing.Point(5, 183); this.groupBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox4.Name = "groupBox4"; this.groupBox4.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox4.Size = new System.Drawing.Size(1876, 100); this.groupBox4.TabIndex = 21; this.groupBox4.TabStop = false; this.groupBox4.Text = "版本信息"; this.txt_SXBL.Location = new System.Drawing.Point(800, 22); this.txt_SXBL.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_SXBL.Name = "txt_SXBL"; this.txt_SXBL.Size = new System.Drawing.Size(202, 25); this.txt_SXBL.TabIndex = 29; this.label29.AutoSize = true; this.label29.Location = new System.Drawing.Point(755, 27); this.label29.Name = "label29"; this.label29.Size = new System.Drawing.Size(39, 15); this.label29.TabIndex = 31; this.label29.Text = "SXBL"; this.txt_SXDISXBL.Location = new System.Drawing.Point(801, 63); this.txt_SXDISXBL.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_SXDISXBL.Name = "txt_SXDISXBL"; this.txt_SXDISXBL.Size = new System.Drawing.Size(201, 25); this.txt_SXDISXBL.TabIndex = 28; this.label30.AutoSize = true; this.label30.Location = new System.Drawing.Point(716, 68); this.label30.Name = "label30"; this.label30.Size = new System.Drawing.Size(79, 15); this.label30.TabIndex = 30; this.label30.Text = "SXDI_SXBL"; this.btn_ClearText.Location = new System.Drawing.Point(1751, 41); this.btn_ClearText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btn_ClearText.Name = "btn_ClearText"; this.btn_ClearText.Size = new System.Drawing.Size(110, 47); this.btn_ClearText.TabIndex = 8; this.btn_ClearText.Text = "清空内容"; this.btn_ClearText.UseVisualStyleBackColor = true; this.btn_ClearText.Click += new System.EventHandler(btn_ClearText_Click); this.txt_GeelyHWSD.Location = new System.Drawing.Point(444, 63); this.txt_GeelyHWSD.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_GeelyHWSD.Name = "txt_GeelyHWSD"; this.txt_GeelyHWSD.Size = new System.Drawing.Size(201, 25); this.txt_GeelyHWSD.TabIndex = 2; this.label21.AutoSize = true; this.label21.Location = new System.Drawing.Point(351, 68); this.label21.Name = "label21"; this.label21.Size = new System.Drawing.Size(87, 15); this.label21.TabIndex = 19; this.label21.Text = "Geely HWSD"; this.btn_ImportData.Location = new System.Drawing.Point(1622, 41); this.btn_ImportData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btn_ImportData.Name = "btn_ImportData"; this.btn_ImportData.Size = new System.Drawing.Size(110, 47); this.btn_ImportData.TabIndex = 7; this.btn_ImportData.Text = "导入数据库"; this.btn_ImportData.UseVisualStyleBackColor = true; this.btn_ImportData.Click += new System.EventHandler(btn_ImportData_Click); this.txt_SW.Location = new System.Drawing.Point(89, 63); this.txt_SW.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_SW.Name = "txt_SW"; this.txt_SW.Size = new System.Drawing.Size(236, 25); this.txt_SW.TabIndex = 1; this.label25.AutoSize = true; this.label25.Location = new System.Drawing.Point(16, 68); this.label25.Name = "label25"; this.label25.Size = new System.Drawing.Size(67, 15); this.label25.TabIndex = 27; this.label25.Text = "软件版本"; this.btn_CreateSN.Location = new System.Drawing.Point(1490, 41); this.btn_CreateSN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btn_CreateSN.Name = "btn_CreateSN"; this.btn_CreateSN.Size = new System.Drawing.Size(110, 47); this.btn_CreateSN.TabIndex = 6; this.btn_CreateSN.Text = "生成序列号"; this.btn_CreateSN.UseVisualStyleBackColor = true; this.btn_CreateSN.Click += new System.EventHandler(btn_CreateSN_Click); this.txt_VolvoDU.Location = new System.Drawing.Point(1155, 22); this.txt_VolvoDU.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_VolvoDU.Name = "txt_VolvoDU"; this.txt_VolvoDU.Size = new System.Drawing.Size(202, 25); this.txt_VolvoDU.TabIndex = 5; this.txt_VolvoHWSD.Location = new System.Drawing.Point(1155, 63); this.txt_VolvoHWSD.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_VolvoHWSD.Name = "txt_VolvoHWSD"; this.txt_VolvoHWSD.Size = new System.Drawing.Size(202, 25); this.txt_VolvoHWSD.TabIndex = 4; this.label23.AutoSize = true; this.label23.Location = new System.Drawing.Point(1062, 68); this.label23.Name = "label23"; this.label23.Size = new System.Drawing.Size(87, 15); this.label23.TabIndex = 23; this.label23.Text = "Volvo HWSD"; this.label24.AutoSize = true; this.label24.Location = new System.Drawing.Point(1062, 27); this.label24.Name = "label24"; this.label24.Size = new System.Drawing.Size(71, 15); this.label24.TabIndex = 25; this.label24.Text = "Volvo DU"; this.txt_GeelyDU.Location = new System.Drawing.Point(443, 22); this.txt_GeelyDU.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_GeelyDU.Name = "txt_GeelyDU"; this.txt_GeelyDU.Size = new System.Drawing.Size(202, 25); this.txt_GeelyDU.TabIndex = 3; this.txt_GeelyDU.TextChanged += new System.EventHandler(txt_GeelyDU_TextChanged); this.label22.AutoSize = true; this.label22.Location = new System.Drawing.Point(366, 27); this.label22.Name = "label22"; this.label22.Size = new System.Drawing.Size(71, 15); this.label22.TabIndex = 21; this.label22.Text = "Geely DU"; this.txt_HW.Location = new System.Drawing.Point(89, 22); this.txt_HW.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_HW.Name = "txt_HW"; this.txt_HW.Size = new System.Drawing.Size(236, 25); this.txt_HW.TabIndex = 0; this.label20.AutoSize = true; this.label20.Location = new System.Drawing.Point(16, 27); this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(67, 15); this.label20.TabIndex = 17; this.label20.Text = "硬件版本"; this.groupBox3.Controls.Add(this.txt_EndDHUIDSN); this.groupBox3.Controls.Add(this.label19); this.groupBox3.Controls.Add(this.txt_StartDHUIDSN); this.groupBox3.Controls.Add(this.label11); this.groupBox3.Controls.Add(this.txt_ShiftsNo); this.groupBox3.Controls.Add(this.label12); this.groupBox3.Controls.Add(this.txt_Date2); this.groupBox3.Controls.Add(this.label13); this.groupBox3.Controls.Add(this.txt_PN); this.groupBox3.Controls.Add(this.label14); this.groupBox3.Controls.Add(this.txt_VendorCode); this.groupBox3.Controls.Add(this.label15); this.groupBox3.Location = new System.Drawing.Point(5, 119); this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox3.Name = "groupBox3"; this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox3.Size = new System.Drawing.Size(1876, 59); this.groupBox3.TabIndex = 12; this.groupBox3.TabStop = false; this.groupBox3.Text = "DHUID"; this.txt_EndDHUIDSN.Location = new System.Drawing.Point(1147, 22); this.txt_EndDHUIDSN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_EndDHUIDSN.Name = "txt_EndDHUIDSN"; this.txt_EndDHUIDSN.Size = new System.Drawing.Size(84, 25); this.txt_EndDHUIDSN.TabIndex = 5; this.label19.AutoSize = true; this.label19.Location = new System.Drawing.Point(1119, 27); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(22, 15); this.label19.TabIndex = 15; this.label19.Text = "到"; this.txt_StartDHUIDSN.Location = new System.Drawing.Point(1032, 22); this.txt_StartDHUIDSN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_StartDHUIDSN.Name = "txt_StartDHUIDSN"; this.txt_StartDHUIDSN.Size = new System.Drawing.Size(82, 25); this.txt_StartDHUIDSN.TabIndex = 4; this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(940, 27); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(82, 15); this.label11.TabIndex = 10; this.label11.Text = "生产流水号"; this.txt_ShiftsNo.Location = new System.Drawing.Point(848, 22); this.txt_ShiftsNo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_ShiftsNo.Name = "txt_ShiftsNo"; this.txt_ShiftsNo.Size = new System.Drawing.Size(69, 25); this.txt_ShiftsNo.TabIndex = 3; this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(756, 27); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(82, 15); this.label12.TabIndex = 8; this.label12.Text = "生产班次号"; this.txt_Date2.Location = new System.Drawing.Point(632, 22); this.txt_Date2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_Date2.Name = "txt_Date2"; this.txt_Date2.Size = new System.Drawing.Size(104, 25); this.txt_Date2.TabIndex = 2; this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(556, 27); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(67, 15); this.label13.TabIndex = 6; this.label13.Text = "生产日期"; this.txt_PN.Location = new System.Drawing.Point(308, 22); this.txt_PN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_PN.Name = "txt_PN"; this.txt_PN.Size = new System.Drawing.Size(229, 25); this.txt_PN.TabIndex = 1; this.label14.AutoSize = true; this.label14.Location = new System.Drawing.Point(7, 27); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(82, 15); this.label14.TabIndex = 0; this.label14.Text = "供应商代码"; this.txt_VendorCode.Location = new System.Drawing.Point(100, 22); this.txt_VendorCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_VendorCode.Name = "txt_VendorCode"; this.txt_VendorCode.Size = new System.Drawing.Size(100, 25); this.txt_VendorCode.TabIndex = 0; this.label15.AutoSize = true; this.label15.Location = new System.Drawing.Point(215, 27); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(82, 15); this.label15.TabIndex = 2; this.label15.Text = "零部件编号"; this.groupBox2.Controls.Add(this.txt_MachineCode); this.groupBox2.Controls.Add(this.label16); this.groupBox2.Controls.Add(this.txt_MaxSpecialSN); this.groupBox2.Controls.Add(this.label18); this.groupBox2.Controls.Add(this.label17); this.groupBox2.Controls.Add(this.txt_EndDaySN); this.groupBox2.Controls.Add(this.txt_MinSpecialSN); this.groupBox2.Controls.Add(this.label10); this.groupBox2.Controls.Add(this.txt_StartDaySN); this.groupBox2.Controls.Add(this.label9); this.groupBox2.Controls.Add(this.txt_Date1); this.groupBox2.Controls.Add(this.label8); this.groupBox2.Controls.Add(this.txt_FactoryCode); this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.txt_PCODE); this.groupBox2.Controls.Add(this.txt_LineNo1); this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.label6); this.groupBox2.Location = new System.Drawing.Point(5, 59); this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox2.Name = "groupBox2"; this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox2.Size = new System.Drawing.Size(1876, 55); this.groupBox2.TabIndex = 9; this.groupBox2.TabStop = false; this.groupBox2.Text = "XDSN"; this.txt_MachineCode.Location = new System.Drawing.Point(284, 22); this.txt_MachineCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_MachineCode.Name = "txt_MachineCode"; this.txt_MachineCode.Size = new System.Drawing.Size(97, 25); this.txt_MachineCode.TabIndex = 1; this.label16.AutoSize = true; this.label16.Location = new System.Drawing.Point(204, 27); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(67, 15); this.label16.TabIndex = 15; this.label16.Text = "整机代码"; this.txt_MaxSpecialSN.Location = new System.Drawing.Point(1487, 22); this.txt_MaxSpecialSN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_MaxSpecialSN.Name = "txt_MaxSpecialSN"; this.txt_MaxSpecialSN.Size = new System.Drawing.Size(92, 25); this.txt_MaxSpecialSN.TabIndex = 8; this.label18.AutoSize = true; this.label18.Location = new System.Drawing.Point(1458, 27); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(22, 15); this.label18.TabIndex = 13; this.label18.Text = "到"; this.label17.AutoSize = true; this.label17.Location = new System.Drawing.Point(1163, 27); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(22, 15); this.label17.TabIndex = 9; this.label17.Text = "到"; this.txt_EndDaySN.Location = new System.Drawing.Point(1192, 22); this.txt_EndDaySN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_EndDaySN.Name = "txt_EndDaySN"; this.txt_EndDaySN.Size = new System.Drawing.Size(92, 25); this.txt_EndDaySN.TabIndex = 6; this.txt_MinSpecialSN.Location = new System.Drawing.Point(1360, 22); this.txt_MinSpecialSN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_MinSpecialSN.Name = "txt_MinSpecialSN"; this.txt_MinSpecialSN.Size = new System.Drawing.Size(92, 25); this.txt_MinSpecialSN.TabIndex = 7; this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(1297, 26); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(52, 15); this.label10.TabIndex = 10; this.label10.Text = "连续号"; this.txt_StartDaySN.Location = new System.Drawing.Point(1073, 22); this.txt_StartDaySN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_StartDaySN.Name = "txt_StartDaySN"; this.txt_StartDaySN.Size = new System.Drawing.Size(85, 25); this.txt_StartDaySN.TabIndex = 5; this.txt_StartDaySN.TextChanged += new System.EventHandler(txt_StartDaySN_TextChanged); this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(993, 27); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(67, 15); this.label9.TabIndex = 8; this.label9.Text = "日流水号"; this.txt_Date1.Location = new System.Drawing.Point(877, 22); this.txt_Date1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_Date1.Name = "txt_Date1"; this.txt_Date1.Size = new System.Drawing.Size(97, 25); this.txt_Date1.TabIndex = 4; this.txt_Date1.TextChanged += new System.EventHandler(txt_Date1_TextChanged); this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(797, 27); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(67, 15); this.label8.TabIndex = 6; this.label8.Text = "生产日期"; this.txt_FactoryCode.Location = new System.Drawing.Point(492, 22); this.txt_FactoryCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_FactoryCode.Name = "txt_FactoryCode"; this.txt_FactoryCode.Size = new System.Drawing.Size(97, 25); this.txt_FactoryCode.TabIndex = 2; this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(16, 27); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(47, 15); this.label4.TabIndex = 0; this.label4.Text = "PCODE"; this.txt_PCODE.Location = new System.Drawing.Point(73, 22); this.txt_PCODE.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_PCODE.Name = "txt_PCODE"; this.txt_PCODE.Size = new System.Drawing.Size(96, 25); this.txt_PCODE.TabIndex = 0; this.txt_LineNo1.Location = new System.Drawing.Point(684, 22); this.txt_LineNo1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_LineNo1.Name = "txt_LineNo1"; this.txt_LineNo1.Size = new System.Drawing.Size(97, 25); this.txt_LineNo1.TabIndex = 3; this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(412, 27); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(67, 15); this.label5.TabIndex = 2; this.label5.Text = "工厂代码"; this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(604, 27); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(67, 15); this.label6.TabIndex = 4; this.label6.Text = "产线编号"; this.groupBox1.Controls.Add(this.tbx_OrderID); this.groupBox1.Controls.Add(this.btn_OpenDlg); this.groupBox1.Controls.Add(this.cbox_Model); this.groupBox1.Controls.Add(this.label26); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label7); this.groupBox1.Controls.Add(this.txt_EndSN); this.groupBox1.Controls.Add(this.txt_StartSN); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.txt_SNPrefix); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(3, 2); this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox1.Size = new System.Drawing.Size(1878, 52); this.groupBox1.TabIndex = 8; this.groupBox1.TabStop = false; this.groupBox1.Text = "SN"; this.tbx_OrderID.Location = new System.Drawing.Point(70, 17); this.tbx_OrderID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tbx_OrderID.Name = "tbx_OrderID"; this.tbx_OrderID.Size = new System.Drawing.Size(172, 25); this.tbx_OrderID.TabIndex = 13; this.btn_OpenDlg.Location = new System.Drawing.Point(248, 15); this.btn_OpenDlg.Name = "btn_OpenDlg"; this.btn_OpenDlg.Size = new System.Drawing.Size(41, 27); this.btn_OpenDlg.TabIndex = 12; this.btn_OpenDlg.Text = "..."; this.btn_OpenDlg.UseVisualStyleBackColor = true; this.btn_OpenDlg.Click += new System.EventHandler(btn_OpenDlg_Click); this.cbox_Model.FormattingEnabled = true; this.cbox_Model.Location = new System.Drawing.Point(390, 16); this.cbox_Model.Name = "cbox_Model"; this.cbox_Model.Size = new System.Drawing.Size(192, 23); this.cbox_Model.TabIndex = 11; this.cbox_Model.SelectedIndexChanged += new System.EventHandler(cbx_Model_SelectedIndexChanged); this.label26.AutoSize = true; this.label26.Location = new System.Drawing.Point(351, 19); this.label26.Name = "label26"; this.label26.Size = new System.Drawing.Size(37, 15); this.label26.TabIndex = 10; this.label26.Text = "机型"; this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(12, 20); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(52, 15); this.label3.TabIndex = 9; this.label3.Text = "工单号"; this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(1110, 18); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(22, 15); this.label7.TabIndex = 8; this.label7.Text = "到"; this.txt_EndSN.Location = new System.Drawing.Point(1139, 14); this.txt_EndSN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_EndSN.Name = "txt_EndSN"; this.txt_EndSN.Size = new System.Drawing.Size(92, 25); this.txt_EndSN.TabIndex = 3; this.txt_StartSN.Location = new System.Drawing.Point(1016, 14); this.txt_StartSN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_StartSN.Name = "txt_StartSN"; this.txt_StartSN.Size = new System.Drawing.Size(89, 25); this.txt_StartSN.TabIndex = 2; this.txt_StartSN.TextChanged += new System.EventHandler(txt_StartSN_TextChanged); this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(612, 18); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(53, 15); this.label1.TabIndex = 0; this.label1.Text = "SN前缀"; this.txt_SNPrefix.Location = new System.Drawing.Point(676, 14); this.txt_SNPrefix.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txt_SNPrefix.Name = "txt_SNPrefix"; this.txt_SNPrefix.Size = new System.Drawing.Size(231, 25); this.txt_SNPrefix.TabIndex = 1; this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(953, 18); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(52, 15); this.label2.TabIndex = 2; this.label2.Text = "流水号"; this.tabPage2.Controls.Add(this.dataGridView2); this.tabPage2.Controls.Add(this.panel2); this.tabPage2.Location = new System.Drawing.Point(4, 25); this.tabPage2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabPage2.Size = new System.Drawing.Size(1894, 896); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "查询号码◢"; this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView2.Location = new System.Drawing.Point(4, 83); this.dataGridView2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.dataGridView2.Name = "dataGridView2"; this.dataGridView2.RowHeadersWidth = 51; this.dataGridView2.RowTemplate.Height = 30; this.dataGridView2.Size = new System.Drawing.Size(1886, 809); this.dataGridView2.TabIndex = 1; this.panel2.Controls.Add(this.btn_Export); this.panel2.Controls.Add(this.tbx_content); this.panel2.Controls.Add(this.cbox_Field); this.panel2.Controls.Add(this.btn_Delete); this.panel2.Controls.Add(this.btn_Modify); this.panel2.Controls.Add(this.btn_Query); this.panel2.Controls.Add(this.label28); this.panel2.Controls.Add(this.label27); this.panel2.Location = new System.Drawing.Point(3, 5); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(1888, 73); this.panel2.TabIndex = 0; this.btn_Export.Location = new System.Drawing.Point(1718, 11); this.btn_Export.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btn_Export.Name = "btn_Export"; this.btn_Export.Size = new System.Drawing.Size(110, 47); this.btn_Export.TabIndex = 22; this.btn_Export.Text = "导出数据"; this.btn_Export.UseVisualStyleBackColor = true; this.btn_Export.Click += new System.EventHandler(btn_Export_Click); this.tbx_content.Location = new System.Drawing.Point(424, 24); this.tbx_content.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tbx_content.Name = "tbx_content"; this.tbx_content.Size = new System.Drawing.Size(383, 25); this.tbx_content.TabIndex = 21; this.tbx_content.KeyPress += new System.Windows.Forms.KeyPressEventHandler(tbx_content_KeyPress); this.cbox_Field.FormattingEnabled = true; this.cbox_Field.Location = new System.Drawing.Point(97, 24); this.cbox_Field.Name = "cbox_Field"; this.cbox_Field.Size = new System.Drawing.Size(199, 23); this.cbox_Field.TabIndex = 20; this.cbox_Field.SelectedIndexChanged += new System.EventHandler(cbx_Field_SelectedIndexChanged); this.btn_Delete.Location = new System.Drawing.Point(1436, 11); this.btn_Delete.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btn_Delete.Name = "btn_Delete"; this.btn_Delete.Size = new System.Drawing.Size(110, 47); this.btn_Delete.TabIndex = 19; this.btn_Delete.Text = "删除"; this.btn_Delete.UseVisualStyleBackColor = true; this.btn_Delete.Visible = false; this.btn_Delete.Click += new System.EventHandler(btn_Delete_Click); this.btn_Modify.Location = new System.Drawing.Point(1295, 11); this.btn_Modify.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btn_Modify.Name = "btn_Modify"; this.btn_Modify.Size = new System.Drawing.Size(110, 47); this.btn_Modify.TabIndex = 18; this.btn_Modify.Text = "修改"; this.btn_Modify.UseVisualStyleBackColor = true; this.btn_Modify.Visible = false; this.btn_Modify.Click += new System.EventHandler(btn_Modify_Click); this.btn_Query.Location = new System.Drawing.Point(1577, 11); this.btn_Query.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btn_Query.Name = "btn_Query"; this.btn_Query.Size = new System.Drawing.Size(110, 47); this.btn_Query.TabIndex = 17; this.btn_Query.Text = "查询"; this.btn_Query.UseVisualStyleBackColor = true; this.btn_Query.Click += new System.EventHandler(btn_Query_Click); this.label28.AutoSize = true; this.label28.Location = new System.Drawing.Point(351, 27); this.label28.Name = "label28"; this.label28.Size = new System.Drawing.Size(67, 15); this.label28.TabIndex = 14; this.label28.Text = "查询内容"; this.label27.AutoSize = true; this.label27.Location = new System.Drawing.Point(24, 27); this.label27.Name = "label27"; this.label27.Size = new System.Drawing.Size(67, 15); this.label27.TabIndex = 11; this.label27.Text = "查询字段"; this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[8] { this.toolStripStatusLabel1, this.toolStripStatusLabel2, this.toolStripStatusLabel3, this.toolStripStatusLabel4, this.toolStripStatusLabel5, this.toolStripStatusLabel6, this.toolStripStatusLabel7, this.toolStripStatusLabel8 }); this.statusStrip1.Location = new System.Drawing.Point(0, 1007); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 12, 0); this.statusStrip1.Size = new System.Drawing.Size(1902, 26); this.statusStrip1.TabIndex = 2; this.statusStrip1.Text = "statusStrip1"; this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Size = new System.Drawing.Size(167, 20); this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; this.toolStripStatusLabel2.Size = new System.Drawing.Size(167, 20); this.toolStripStatusLabel2.Text = "toolStripStatusLabel2"; this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; this.toolStripStatusLabel3.Size = new System.Drawing.Size(167, 20); this.toolStripStatusLabel3.Text = "toolStripStatusLabel3"; this.toolStripStatusLabel4.Name = "toolStripStatusLabel4"; this.toolStripStatusLabel4.Size = new System.Drawing.Size(167, 20); this.toolStripStatusLabel4.Text = "toolStripStatusLabel4"; this.toolStripStatusLabel5.Name = "toolStripStatusLabel5"; this.toolStripStatusLabel5.Size = new System.Drawing.Size(167, 20); this.toolStripStatusLabel5.Text = "toolStripStatusLabel5"; this.toolStripStatusLabel6.Name = "toolStripStatusLabel6"; this.toolStripStatusLabel6.Size = new System.Drawing.Size(167, 20); this.toolStripStatusLabel6.Text = "toolStripStatusLabel6"; this.toolStripStatusLabel7.Name = "toolStripStatusLabel7"; this.toolStripStatusLabel7.Size = new System.Drawing.Size(167, 20); this.toolStripStatusLabel7.Text = "toolStripStatusLabel7"; this.toolStripStatusLabel8.Name = "toolStripStatusLabel8"; this.toolStripStatusLabel8.Size = new System.Drawing.Size(167, 20); this.toolStripStatusLabel8.Text = "toolStripStatusLabel8"; this.errorProvider1.ContainerControl = this; this.lbl_Title.Font = new System.Drawing.Font("微软雅黑", 30f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134); this.lbl_Title.Location = new System.Drawing.Point(0, 0); this.lbl_Title.Name = "lbl_Title"; this.lbl_Title.Size = new System.Drawing.Size(1902, 66); this.lbl_Title.TabIndex = 3; this.lbl_Title.Text = "SN Generate Tool"; //this.btn_Close.BackgroundImage = Hexiv.JK.SNGenerateTool.Properties.Resources.关闭3; this.btn_Close.Location = new System.Drawing.Point(1858, 5); this.btn_Close.Name = "btn_Close"; this.btn_Close.Size = new System.Drawing.Size(32, 32); this.btn_Close.TabIndex = 5; this.btn_Close.UseVisualStyleBackColor = false; this.btn_Close.Click += new System.EventHandler(btn_Close_Click); //this.btn_Minimize.BackgroundImage = Hexiv.JK.SNGenerateTool.Properties.Resources.最小化; this.btn_Minimize.Location = new System.Drawing.Point(1803, 5); this.btn_Minimize.Name = "btn_Minimize"; this.btn_Minimize.Size = new System.Drawing.Size(32, 32); this.btn_Minimize.TabIndex = 4; this.btn_Minimize.UseVisualStyleBackColor = false; this.btn_Minimize.Click += new System.EventHandler(btn_Mininimze_Click); base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 15f); base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.ClientSize = new System.Drawing.Size(1902, 1033); base.Controls.Add(this.btn_Close); base.Controls.Add(this.btn_Minimize); base.Controls.Add(this.lbl_Title); base.Controls.Add(this.tabControl1); base.Controls.Add(this.statusStrip1); //base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); base.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); base.Name = "MainForm"; this.Text = "Form1"; base.Paint += new System.Windows.Forms.PaintEventHandler(MainForm_Paint); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)this.dataGridView1).EndInit(); this.panel1.ResumeLayout(false); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.tabPage2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)this.dataGridView2).EndInit(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)this.errorProvider1).EndInit(); base.ResumeLayout(false); base.PerformLayout(); } } Plugin.SNGenerateTool/HashPlus.cs
New file @@ -0,0 +1,89 @@ using System.Security.Cryptography; using System.Text; namespace Plugin.SNGenerateTool { internal class HashPlus { public static string GetHashSHA256(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (SHA256Managed sHA256Managed = new SHA256Managed()) { byte[] array = sHA256Managed.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } public static string GetHashSHA512(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (SHA512Managed sHA512Managed = new SHA512Managed()) { byte[] array = sHA512Managed.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } public static string GetHashSHA384(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (SHA384Managed sHA384Managed = new SHA384Managed()) { byte[] array = sHA384Managed.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } public static string GetHashSHA1(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (SHA1Managed sHA1Managed = new SHA1Managed()) { byte[] array = sHA1Managed.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } public static string GetHashMD5(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (MD5 mD = MD5.Create()) { byte[] array = mD.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } } } Plugin.SNGenerateTool/Plugin.SNGenerateTool.csproj
New file @@ -0,0 +1,144 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}</ProjectGuid> <OutputType>library</OutputType> <RootNamespace>Plugin.SNGenerateTool</RootNamespace> <AssemblyName>Plugin.SNGenerateTool</AssemblyName> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <WarningLevel>4</WarningLevel> <Deterministic>true</Deterministic> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Microsoft.Extensions.Configuration, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Microsoft.Extensions.Configuration.9.0.3\lib\net462\Microsoft.Extensions.Configuration.dll</HintPath> </Reference> <Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Microsoft.Extensions.Configuration.Abstractions.9.0.3\lib\net462\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath> </Reference> <Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Microsoft.Extensions.Configuration.FileExtensions.9.0.3\lib\net462\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath> </Reference> <Reference Include="Microsoft.Extensions.Configuration.Ini, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Microsoft.Extensions.Configuration.Ini.9.0.3\lib\net462\Microsoft.Extensions.Configuration.Ini.dll</HintPath> </Reference> <Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Microsoft.Extensions.FileProviders.Abstractions.9.0.3\lib\net462\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath> </Reference> <Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Microsoft.Extensions.FileProviders.Physical.9.0.3\lib\net462\Microsoft.Extensions.FileProviders.Physical.dll</HintPath> </Reference> <Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Microsoft.Extensions.FileSystemGlobbing.9.0.3\lib\net462\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath> </Reference> <Reference Include="Microsoft.Extensions.Primitives, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Microsoft.Extensions.Primitives.9.0.3\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath> </Reference> <Reference Include="Panuon.WPF, Version=1.1.2.2, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Panuon.WPF.1.1.3\lib\net472\Panuon.WPF.dll</HintPath> </Reference> <Reference Include="Panuon.WPF.UI, Version=1.3.0.2, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Panuon.WPF.UI.1.3.0.2\lib\net472\Panuon.WPF.UI.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath> </Reference> <Reference Include="System.Configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath> </Reference> <Reference Include="System.Numerics" /> <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> </Reference> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath> </Reference> <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath> </Reference> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Xaml"> <RequiredTargetFramework>4.0</RequiredTargetFramework> </Reference> <Reference Include="WindowsBase" /> <Reference Include="PresentationCore" /> <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> <Page Include="UserControl1.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Compile Include="Entity\DataInfo.cs" /> <Compile Include="Entity\UserSetting.cs" /> <Compile Include="Form1.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile> <Compile Include="HashPlus.cs" /> <Compile Include="UserControl1.xaml.cs"> <DependentUpon>UserControl1.xaml</DependentUpon> <SubType>Code</SubType> </Compile> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Resources.resx</DependentUpon> </Compile> <Compile Include="Properties\Settings.Designer.cs"> <AutoGen>True</AutoGen> <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> <None Include="app.config" /> <None Include="packages.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> </None> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project> Plugin.SNGenerateTool/Properties/AssemblyInfo.cs
New file @@ -0,0 +1,52 @@ using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Plugin.SNGenerateTool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Plugin.SNGenerateTool")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] //若要开始生成可本地化的应用程序,请设置 //.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture> //在 <PropertyGroup> 中。例如,如果你使用的是美国英语。 //使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消 //对以下 NeutralResourceLanguage 特性的注释。 更新 //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //主题特定资源词典所处位置 //(未在页面中找到资源时使用, //或应用程序资源字典中找到时使用) ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 //(未在页面中找到资源时使用, //、应用程序或任何主题专用资源字典中找到时使用) )] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] Plugin.SNGenerateTool/Properties/Resources.Designer.cs
New file @@ -0,0 +1,62 @@ //------------------------------------------------------------------------------ // <auto-generated> // 此代码由工具生成。 // 运行时版本: 4.0.30319.42000 // // 对此文件的更改可能导致不正确的行为,如果 // 重新生成代码,则所做更改将丢失。 // </auto-generated> //------------------------------------------------------------------------------ namespace Plugin.SNGenerateTool.Properties { /// <summary> /// 强类型资源类,用于查找本地化字符串等。 /// </summary> // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // (以 /str 作为命令选项),或重新生成 VS 项目。 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// 返回此类使用的缓存 ResourceManager 实例。 /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if ((resourceMan == null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Plugin.SNGenerateTool.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// 重写当前线程的 CurrentUICulture 属性,对 /// 使用此强类型资源类的所有资源查找执行重写。 /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } Plugin.SNGenerateTool/Properties/Resources.resx
File was renamed from WPFProject/Forms/Form1.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,7 +60,6 @@ : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> @@ -69,10 +68,9 @@ <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> @@ -87,10 +85,9 @@ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> @@ -112,9 +109,9 @@ <value>2.0</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> </root> Plugin.SNGenerateTool/Properties/Settings.Designer.cs
New file @@ -0,0 +1,30 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Plugin.SNGenerateTool.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } Plugin.SNGenerateTool/Properties/Settings.settings
New file @@ -0,0 +1,7 @@ <?xml version='1.0' encoding='utf-8'?> <SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> <Profiles> <Profile Name="(Default)" /> </Profiles> <Settings /> </SettingsFile> Plugin.SNGenerateTool/UserControl1.xaml
New file @@ -0,0 +1,265 @@ <UserControl x:Class="Plugin.SNGenerateTool.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Plugin.SNGenerateTool" mc:Ignorable="d" xmlns:pw="https://opensource.panuon.com/wpf" xmlns:pu="https://opensource.panuon.com/wpf-ui" Background="#FFF" FontSize="18" d:DesignHeight="450" d:DesignWidth="1920"> <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <pu:StyleDictionary Includes="DataGrid" /> </ResourceDictionary.MergedDictionaries> <Style TargetType="TextBox"> <Setter Property="MinWidth" Value="100"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Height" Value="36"/> </Style> <Style TargetType="pu:FormGroup"> <Setter Property="Margin" Value="0,10,30,10"/> </Style> <Style TargetType="GroupBox"> </Style> </ResourceDictionary> </UserControl.Resources> <TabControl> <TabItem Header="创建号码"> <Grid Background="LightGray"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition/> </Grid.RowDefinitions> <StackPanel Margin="10"> <GroupBox Header="SN"> <StackPanel Orientation="Horizontal"> <pu:FormGroup Header="工单号"> <TextBox x:Name="tbx_OrderID" Width="200"/> </pu:FormGroup> <pu:FormGroup Header="机型"> <ComboBox x:Name="cbox_Model"/> </pu:FormGroup> <pu:FormGroup Header="SN前缀"> <TextBox x:Name="txt_SNPrefix" Width="200"/> </pu:FormGroup> <pu:FormGroup Header="流水号" Margin="0,10,0,10"> <TextBox x:Name="txt_StartSN"/> </pu:FormGroup> <pu:FormGroup Header="到"> <TextBox x:Name="txt_EndSN"/> </pu:FormGroup> </StackPanel> </GroupBox> <GroupBox Header="XDSN"> <StackPanel Orientation="Horizontal"> <pu:FormGroup Header="PCODE"> <TextBox x:Name="txt_PCODE"/> </pu:FormGroup> <pu:FormGroup Header="整机代码"> <TextBox x:Name="txt_MachineCode"/> </pu:FormGroup> <pu:FormGroup Header="工厂代码"> <TextBox x:Name="txt_FactoryCode"/> </pu:FormGroup> <pu:FormGroup Header="产线编号"> <TextBox x:Name="txt_LineNo1"/> </pu:FormGroup> <pu:FormGroup Header="生产日期"> <TextBox x:Name="txt_Date1"/> </pu:FormGroup> <pu:FormGroup Header="日流水号" Margin="0,10,0,10"> <TextBox x:Name="txt_StartDaySN"/> </pu:FormGroup> <pu:FormGroup Header="到"> <TextBox IsEnabled="False"/> </pu:FormGroup> <pu:FormGroup Header="连续号" Margin="0,10,0,10"> <TextBox x:Name="txt_MinSpecialSN"/> </pu:FormGroup> <pu:FormGroup Header="到"> <TextBox IsEnabled="False"/> </pu:FormGroup> </StackPanel> </GroupBox> <GroupBox Header="DHUID"> <StackPanel Orientation="Horizontal"> <pu:FormGroup Header="供应商代码"> <TextBox x:Name="txt_VendorCode"/> </pu:FormGroup> <pu:FormGroup Header="零部件编号"> <TextBox x:Name="txt_PN"/> </pu:FormGroup> <pu:FormGroup Header="生产日期"> <TextBox/> </pu:FormGroup> <pu:FormGroup Header="生产班次号"> <TextBox x:Name="txt_ShiftsNo"/> </pu:FormGroup> <pu:FormGroup Header="生产流水号" Margin="0,10,0,10"> <TextBox x:Name="txt_StartDHUIDSN"/> </pu:FormGroup> <pu:FormGroup Header="到"> <TextBox IsEnabled="False"/> </pu:FormGroup> </StackPanel> </GroupBox> <GroupBox Header="版本信息"> <GroupBox.Resources> <Style TargetType="TextBox"> <Setter Property="MinWidth" Value="200"/> </Style> </GroupBox.Resources> <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <pu:FormGroup Grid.Row="0" Grid.Column="0" Header="硬件版本" GroupName="Version"> <TextBox x:Name="txt_HW"/> </pu:FormGroup> <pu:FormGroup Grid.Row="1" Grid.Column="0" Header="软件版本" GroupName="Version"> <TextBox x:Name="txt_SW"/> </pu:FormGroup> <pu:FormGroup Grid.Row="0" Grid.Column="1" Header="Geely DU" GroupName="Version"> <TextBox x:Name="txt_GeelyDU"/> </pu:FormGroup> <pu:FormGroup Grid.Row="1" Grid.Column="1" Header="Geely HWSD" GroupName="Version"> <TextBox x:Name="txt_GeelyHWSD"/> </pu:FormGroup> <pu:FormGroup Grid.Row="0" Grid.Column="2" Header="SXBL" GroupName="Version"> <TextBox x:Name="txt_SXBL"/> </pu:FormGroup> <pu:FormGroup Grid.Row="1" Grid.Column="2" Header="SXDI_SXBL" GroupName="Version"> <TextBox x:Name="txt_SXDISXBL"/> </pu:FormGroup> <pu:FormGroup Grid.Row="0" Grid.Column="3" Header="Volvo DU" GroupName="Version"> <TextBox x:Name="txt_VolvoDU"/> </pu:FormGroup> <pu:FormGroup Grid.Row="1" Grid.Column="3" Header="Volvo HWSD" GroupName="Version"> <TextBox x:Name="txt_VolvoHWSD"/> </pu:FormGroup> <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="4" Grid.ColumnSpan="2"> <Button Click="Button_Click">生成序列号</Button> <Button>导入数据库</Button> <Button>清空内容</Button> </StackPanel> </Grid> </GroupBox> </StackPanel> <DataGrid Grid.Row="1" x:Name="table1" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Datasource}"> <DataGrid.Columns> <DataGridTemplateColumn Header="#" IsReadOnly="True" CanUserResize="False"> </DataGridTemplateColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding GUID}"> <DataGridTextColumn.Header> <TextBlock Text="GUID"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding OrderID}"> <DataGridTextColumn.Header> <TextBlock Text="OrderId"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding Model}"> <DataGridTextColumn.Header> <TextBlock Text="Model"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding MESSN}"> <DataGridTextColumn.Header> <TextBlock Text="MESSN"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding XDSN}"> <DataGridTextColumn.Header> <TextBlock Text="XDSN"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding DHUID}"> <DataGridTextColumn.Header> <TextBlock Text="DHUID"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding ProductSN}"> <DataGridTextColumn.Header> <TextBlock Text="ProductSN"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding HW}"> <DataGridTextColumn.Header> <TextBlock Text="HW"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding SW}"> <DataGridTextColumn.Header> <TextBlock Text="SW"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding GeelyDU}"> <DataGridTextColumn.Header> <TextBlock Text="GeelyDU"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding GeelyHWSD}"> <DataGridTextColumn.Header> <TextBlock Text="GeelyHWSD"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding SXBL}"> <DataGridTextColumn.Header> <TextBlock Text="SXBL"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding SXDI_SXBL}"> <DataGridTextColumn.Header> <TextBlock Text="SXDI_SXBL"/> </DataGridTextColumn.Header> </DataGridTextColumn> </DataGrid.Columns> </DataGrid> </Grid> </TabItem> <TabItem Header="查询号码"></TabItem> </TabControl> </UserControl> Plugin.SNGenerateTool/UserControl1.xaml.cs
New file @@ -0,0 +1,252 @@ using Panuon.WPF.UI; using Plugin.SNGenerateTool.Entity; using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.Data; using System.Globalization; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using System.Windows; using System.Windows.Controls; namespace Plugin.SNGenerateTool { /// <summary> /// UserControl1.xaml 的交互逻辑 /// </summary> public partial class UserControl1 : UserControl, INotifyPropertyChanged { #region ... public virtual event PropertyChangedEventHandler PropertyChanged; protected virtual void Set(string name) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } protected void Set<T>(ref T old, T @new, [CallerMemberName] string propertyName = null) { old = @new; if (propertyName != null) { Set(propertyName); } } #endregion private string iniFile = Path.Combine(Environment.CurrentDirectory, "Config", "UserSettings.ini"); private string[] years = new string[30] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "V", "W", "X", "Y" }; private string[] months = new string[12] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C" }; private string[] days = new string[31] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "V", "W", "X", "Y", "Z" }; private string[] F18CY = new string[10] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; private ObservableCollection<DataInfo> datasource = new ObservableCollection<DataInfo>(); public ObservableCollection<DataInfo> Datasource { get => datasource; set { Set(ref datasource, value); } } public UserControl1() { this.DataContext = this; InitializeComponent(); } [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); private void SaveSettings(string section, string file) { if (!File.Exists(file)) { MessageBox.Show("配置文件不存在,保存失败", "错误提示", MessageBoxButton.OK, MessageBoxImage.Hand); return; } WritePrivateProfileString(section, "OrderId", tbx_OrderID.Text, file); WritePrivateProfileString(section, "SNPrefix", txt_SNPrefix.Text, file); WritePrivateProfileString(section, "MESStartSN", txt_StartSN.Text, file); WritePrivateProfileString(section, "MESEndSN", txt_EndSN.Text, file); WritePrivateProfileString(section, "XDSNDate", txt_Date1.Text, file); WritePrivateProfileString(section, "XDSNDaySN", txt_StartDaySN.Text, file); WritePrivateProfileString(section, "XDSNSpecialSN", txt_MinSpecialSN.Text, file); WritePrivateProfileString(section, "PartNo", txt_PN.Text, file); WritePrivateProfileString(section, "HW", txt_HW.Text, file); WritePrivateProfileString(section, "SW", txt_SW.Text, file); WritePrivateProfileString(section, "GeelyDU", txt_GeelyDU.Text, file); WritePrivateProfileString(section, "GeelyHWSD", txt_GeelyHWSD.Text, file); WritePrivateProfileString(section, "SXBL", txt_SXBL.Text, file); WritePrivateProfileString(section, "SXDISXBL", txt_SXDISXBL.Text, file); WritePrivateProfileString(section, "VolvoDU", txt_VolvoDU.Text, file); WritePrivateProfileString(section, "VolvoHWSD", txt_VolvoHWSD.Text, file); } public void CreateSN() { Datasource.Clear(); try { int num = Convert.ToInt32(txt_StartSN.Text); int num2 = Convert.ToInt32(txt_EndSN.Text); int num3 = Convert.ToInt32(txt_StartDaySN.Text); int num4 = Convert.ToInt32(txt_MinSpecialSN.Text); int num5 = Convert.ToInt32(txt_StartDHUIDSN.Text); int num6 = Convert.ToInt32(txt_Date1.Text.Substring(0, 4)) % 2001; int num7 = Convert.ToInt32(txt_Date1.Text.Substring(4, 2)) - 1; int num8 = Convert.ToInt32(txt_Date1.Text.Substring(6, 2)) - 1; if (Convert.ToInt32(txt_Date1.Text.Substring(0, 4)) < 2020) { MessageBox.Show("生产日期中的年份早于当前年份!", "错误提示", MessageBoxButton.OK, MessageBoxImage.Hand); return; } int num9 = Convert.ToInt32(txt_Date1.Text.Substring(0, 4)) % 2020; GregorianCalendar gregorianCalendar = new GregorianCalendar(); DateTime time = DateTime.ParseExact(txt_Date1.Text, "yyyyMMdd", CultureInfo.CurrentCulture); int weekOfYear = gregorianCalendar.GetWeekOfYear(time, CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday); int num10 = 0; switch (time.DayOfWeek.ToString()) { case "Monday": num10 = 1; break; case "Tuesday": num10 = 2; break; case "Wednesday": num10 = 3; break; case "Thursday": num10 = 4; break; case "Friday": num10 = 5; break; case "Saturday": num10 = 6; break; case "Sunday": num10 = 7; break; } if (txt_StartSN.Text != null && txt_EndSN.Text != null && num <= num2 && txt_EndSN.Text.Length < 5) { int num11 = num; int num12 = num3; int num13 = num4; int num14 = num5; while (num11 <= num2) { DataRow dataRow = null; DataInfo di = new DataInfo(); if (num12.ToString().Length < 5 && num13.ToString().Length < 8 && num14.ToString().Length < 5) { string text = txt_PCODE.Text.Trim() + years[num6] + num13.ToString().PadLeft(7, '0'); string text2 = HashPlus.GetHashMD5(text).ToUpper(); text2 = text2.Substring(0, 8) + "-" + text2.Substring(8, 4) + "-" + text2.Substring(12, 4) + "-" + text2.Substring(16, 4) + "-" + text2.Substring(20, 12); string text3 = txt_SNPrefix.Text + num11.ToString().PadLeft(4, '0'); string text4 = txt_PCODE.Text + txt_MachineCode.Text + txt_FactoryCode.Text + txt_LineNo1.Text + years[num6] + months[num7] + days[num8] + num12.ToString().PadLeft(4, '0') + num13.ToString().PadLeft(7, '0'); string text5 = txt_VendorCode.Text + txt_PN.Text + years[num6] + months[num7] + days[num8] + txt_ShiftsNo.Text + num14.ToString().PadLeft(4, '0'); string empty = string.Empty; empty = F18CY[num9] + weekOfYear.ToString().PadLeft(2, '0') + num10 + num12.ToString().PadLeft(4, '0'); if (text3.Length != 14 && text4.Length != 24 && text5.Length != 24) { MessageBox.Show("MESSN / XDSN / DHUID长度有误,请检查输入的数据是否有误!", "Error", MessageBoxButton.OK, MessageBoxImage.Hand); return; } //dataRow["GUID"] = text2; //dataRow["Orderid"] = tbx_OrderID.Text.Trim(); //dataRow["Model"] = cbox_Model.Text.Trim(); //dataRow["MESSN"] = text3.Trim(); //dataRow["XDSN"] = text4.Trim(); //dataRow["DHUID"] = text5.Trim(); //dataRow["ProductSN"] = empty.Trim(); //dataRow["HW"] = txt_HW.Text.PadRight(16, '0').Trim(); //dataRow["SW"] = txt_SW.Text.Trim(); //dataRow["SXBL"] = txt_SXBL.Text.Trim(); //dataRow["SXDI_SXBL"] = txt_SXDISXBL.Text.Trim(); //dataRow["GeelyDU"] = txt_GeelyDU.Text.Trim(); //dataRow["GeelyHWSD"] = txt_GeelyHWSD.Text.Trim(); //dataRow["ECUDAPN"] = txt_VolvoDU.Text.Trim(); //dataRow["ECUCAPN"] = txt_VolvoHWSD.Text.Trim(); //dataRow["Status"] = 0; //dataRow["CreateTime"] = Convert.ToDateTime(DateTime.Now.ToString("G")); di.GUID = text2; di.OrderID = tbx_OrderID.Text.Trim(); di.Model = cbox_Model.Text.Trim(); di.MESSN = text3.Trim(); di.XDSN = text4.Trim(); di.DHUID = text5.Trim(); di.ProductSN = empty.Trim(); di.HW = txt_HW.Text.PadRight(16, '0').Trim(); di.SW = txt_SW.Text.Trim(); di.SXBL = txt_SXBL.Text.Trim(); di.SXDI_SXBL = txt_SXDISXBL.Text.Trim(); di.GeelyDU = txt_GeelyDU.Text.Trim(); di.GeelyHWSD = txt_GeelyHWSD.Text.Trim(); di.ECUDAPN = txt_VolvoDU.Text.Trim(); di.ECUCAPN = txt_VolvoHWSD.Text.Trim(); di.Status = 0; di.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("G")); Datasource.Add(di); num11++; num12++; num13++; num14++; continue; } MessageBox.Show("日流水号或连续号位数超出范围", "错误提示", MessageBoxButton.OK, MessageBoxImage.Hand); break; } //toolStripStatusLabel8.Text = $"{table.Rows.Count}行"; } else { MessageBox.Show("请检查所有文本框是否有填写,并确认SN的流水号及位数是否有误", "错误提示", MessageBoxButton.OK, MessageBoxImage.Hand); } } catch (Exception ex) { MessageBox.Show(ex.Message, "错误提示", MessageBoxButton.OK, MessageBoxImage.Hand); } } private void Button_Click(object sender, RoutedEventArgs e) { SaveSettings(cbox_Model.Text, iniFile); CreateSN(); } } } Plugin.SNGenerateTool/app.config
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> Plugin.SNGenerateTool/packages.config
New file @@ -0,0 +1,18 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Microsoft.Extensions.Configuration" version="9.0.3" targetFramework="net472" /> <package id="Microsoft.Extensions.Configuration.Abstractions" version="9.0.3" targetFramework="net472" /> <package id="Microsoft.Extensions.Configuration.FileExtensions" version="9.0.3" targetFramework="net472" /> <package id="Microsoft.Extensions.Configuration.Ini" version="9.0.3" targetFramework="net472" /> <package id="Microsoft.Extensions.FileProviders.Abstractions" version="9.0.3" targetFramework="net472" /> <package id="Microsoft.Extensions.FileProviders.Physical" version="9.0.3" targetFramework="net472" /> <package id="Microsoft.Extensions.FileSystemGlobbing" version="9.0.3" targetFramework="net472" /> <package id="Microsoft.Extensions.Primitives" version="9.0.3" targetFramework="net472" /> <package id="Panuon.WPF" version="1.1.3" targetFramework="net472" /> <package id="Panuon.WPF.UI" version="1.3.0.2" targetFramework="net472" /> <package id="System.Buffers" version="4.5.1" targetFramework="net472" /> <package id="System.Memory" version="4.5.5" targetFramework="net472" /> <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" /> <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" /> <package id="System.ValueTuple" version="4.5.0" targetFramework="net472" /> </packages> Plugin.ServoManage/Plugin.ServoManage.csproj
@@ -134,9 +134,9 @@ </None> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\HMI.Old\OPCInterface\OpcInterface\OpcInterface.csproj"> <Project>{e1464149-2c0a-499d-ab90-0c72e6ed1c53}</Project> <Name>OpcInterface</Name> <ProjectReference Include="..\..\ConnectionUtil\ConnectionUtil\ConnectionUtil.csproj"> <Project>{D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}</Project> <Name>ConnectionUtil</Name> </ProjectReference> <ProjectReference Include="..\HMI.Base\HMI.Base.csproj"> <Project>{2a6f9720-a890-4036-9d73-41a0dae28341}</Project> @@ -154,6 +154,10 @@ <Project>{f17de6b5-af1d-48c6-94a0-6b763a6546a6}</Project> <Name>HMI.UI</Name> </ProjectReference> <ProjectReference Include="..\OPCClient\OPCClient.csproj"> <Project>{e5740bb5-9fc6-4a20-b7c2-cc90c281ed05}</Project> <Name>OPCClient</Name> </ProjectReference> </ItemGroup> <ItemGroup> <WCFMetadata Include="Connected Services\" /> Plugin.ServoManage/ServoManage.xaml.cs
@@ -1,10 +1,12 @@ using HMI.Base; using ConnectionUtil; using HMI.Base; using HMI.Core.Entity; using HMI.Core.Manager; using HMI.Core.Setting; using HMI.Core.Util; using HMI.UI; using HMI.UI.Util; using OPCConnection; using Plugin.ServoManage.Entity; using System; using System.Collections.Generic; @@ -91,7 +93,7 @@ /// <summary> /// 实例化服务器接口函数 /// </summary> private OpcInterface.OpcInterface lTSCADAApi = new OpcInterface.OpcInterface(); private SCADAApi lTSCADAApi = new OPCClient(); private bool isActived = false; private System.Timers.Timer motorMonitorTimer; @@ -402,7 +404,8 @@ MsgBoxHelper2.Error(ex.Message); } } else { else { motorMonitorTimer.Enabled = true; } } Plugin.TestBuilder/Container/FunctionSetting.xaml
New file @@ -0,0 +1,44 @@ <UserControl x:Class="Plugin.TestBuilder.FunctionSetting" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Plugin.TestBuilder" xmlns:pw="https://opensource.panuon.com/wpf" xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:dd="urn:gong-wpf-dragdrop" xmlns:m="clr-namespace:Plugin.TestBuilder.Model" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <pu:StyleDictionary Includes="TreeView"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> <Grid> <TabControl> <TabItem Header="函数列表"> <StackPanel> <!--<hc:SearchBar hc:InfoElement.Placeholder="输入文本查询" Style="{StaticResource SearchBarPlus}" Margin="10,5,10,5"/>--> <TreeView ItemsSource="{Binding FuncModels}" Style="{StaticResource DefaultTreeView}" dd:DragDrop.IsDragSource="True" dd:DragDrop.ShowAlwaysDropTargetAdorner="True" dd:DragDrop.UseDefaultDragAdorner="True" dd:DragDrop.DragHandler="{Binding dragHandler}"> <TreeView.ItemTemplate> <HierarchicalDataTemplate DataType="{x:Type m:FuncModel}" ItemsSource="{Binding Path=Children}"> <ContentControl Content="{Binding Name}"/> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> </StackPanel> </TabItem> <TabItem Header="变量列表"> </TabItem> </TabControl> </Grid> </UserControl> Plugin.TestBuilder/Container/FunctionSetting.xaml.cs
File was renamed from WPFProject/UI/Test/FunctionSetting.xaml.cs @@ -1,25 +1,11 @@ using System; using System.Collections.Generic; using Plugin.TestBuilder.Model; using Plugin.TestBuilder.UI; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Xml.Serialization; using WPFProject.Models; using WPFProject.Utils; namespace WPFProject.UI.Test namespace Plugin.TestBuilder { /// <summary> /// FunctionSetting.xaml 的交互逻辑 @@ -50,11 +36,11 @@ public DdDragHandler dragHandler { get; set; } = new DdDragHandler(); private ObservableCollection<FuncModel> _FuncModels = new ObservableCollection<FuncModel>() { new FuncModel(){ private ObservableCollection<FuncModel> _FuncModels = new ObservableCollection<FuncModel>() { new FuncModel(){ Name = "111", Children = new ObservableCollection<FuncModel>(){ Children = new ObservableCollection<FuncModel>(){ new FuncModel(){ Name = "1123"}, new FuncModel(){ Name = "1223"}, } Plugin.TestBuilder/Container/ProgramList.xaml
File was renamed from WPFProject/UI/Test/ProgramList.xaml @@ -1,12 +1,12 @@ <UserControl x:Class="WPFProject.UI.Test.ProgramList" <UserControl x:Class="Plugin.TestBuilder.ProgramList" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:WPFProject.UI.Test" xmlns:vm="clr-namespace:WPFProject.ViewModels" xmlns:local="clr-namespace:Plugin.TestBuilder" xmlns:dd="urn:gong-wpf-dragdrop" xmlns:pw="https://opensource.panuon.com/wpf" xmlns:pu="https://opensource.panuon.com/wpf-ui" mc:Ignorable="d" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" @@ -14,23 +14,19 @@ <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/WPFProject;component/Style/ListViewStyle.xaml"/> <pu:StyleDictionary Includes="ListBox"/> </ResourceDictionary.MergedDictionaries> <Style TargetType="Label"></Style> </ResourceDictionary> </UserControl.Resources> <Grid> <ListView ItemsSource="{Binding Programs}" ItemContainerStyle="{StaticResource a}" VerticalContentAlignment="Center" <ListBox ItemsSource="{Binding Programs}" Style="{StaticResource DefaultListBox}" VerticalContentAlignment="Center" SelectionChanged="ListView_SelectionChanged"> <ListView.ItemTemplate> <ListBox.ItemTemplate> <DataTemplate> <ContentControl Content="{Binding Name}"/> </DataTemplate> </ListView.ItemTemplate> </ListView> </ListBox.ItemTemplate> </ListBox> </Grid> </UserControl> Plugin.TestBuilder/Container/ProgramList.xaml.cs
File was renamed from WPFProject/UI/Test/ProgramList.xaml.cs @@ -1,14 +1,11 @@ using System; using Plugin.TestBuilder.Model; using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Runtime.CompilerServices; using System.Windows.Controls; using System.Xml.Serialization; using WPFProject.Models; using WPFProject.Utils; namespace WPFProject.UI.Test namespace Plugin.TestBuilder { /// <summary> /// ProgramList.xaml 的交互逻辑 Plugin.TestBuilder/Container/SequnceList.xaml
File was renamed from WPFProject/UI/Test/SequnceList.xaml @@ -1,10 +1,9 @@ <UserControl x:Class="WPFProject.UI.Test.SequnceList" <UserControl x:Class="Plugin.TestBuilder.SequnceList" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:WPFProject.UI.Test" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:local="clr-namespace:Plugin.TestBuilder" xmlns:dd="urn:gong-wpf-dragdrop" mc:Ignorable="d" @@ -12,18 +11,7 @@ d:DesignHeight="450" d:DesignWidth="800"> <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/> <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/> <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/> <ResourceDictionary Source="/HMI.UI;component/Style/WindowResources.xaml"/> <ResourceDictionary Source="/WPFProject;component/Style/ListViewStyle.xaml"/> </ResourceDictionary.MergedDictionaries> <Style TargetType="Label"></Style> <Style TargetType="ListView"></Style> <Style TargetType="DataGridRow" x:Key="CommonRow" BasedOn="{StaticResource DataGridRowStyle}"> <Style TargetType="DataGridRow" x:Key="CommonRow"> <Setter Property="Margin" Value="0"/> <Setter Property="Template"> <Setter.Value> @@ -76,7 +64,7 @@ </Style.Triggers> </Style> <Style TargetType="DataGridCell" x:Key="CommonCell" BasedOn="{StaticResource DataGridCellStyle}"> <Style TargetType="DataGridCell" x:Key="CommonCell"> <Setter Property="BorderBrush" Value="{Binding Path=HorizontalGridLinesBrush,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}"/> <Setter Property="BorderThickness" Value="0,0,1,1"/> <Setter Property="Padding" Value="0"/> @@ -136,37 +124,36 @@ </Style.Triggers> </Style> <Style TargetType="DataGrid" BasedOn="{StaticResource DataGridBaseStyle}"> <Style TargetType="DataGrid" BasedOn="{StaticResource DefaultDataGrid}"> <Setter Property="GridLinesVisibility" Value="None"/> <Setter Property="HorizontalGridLinesBrush" Value="Gray"/> <Setter Property="RowStyle" Value="{StaticResource CommonRow}"/> <Setter Property="CellStyle" Value="{StaticResource CommonCell}"/> <Setter Property="ColumnHeaderStyle" Value="{StaticResource CommonColumnHeader}"/> <Setter Property="hc:BorderElement.CornerRadius" Value="0" /> <Setter Property="RowHeight" Value="30"/> </Style> </ResourceDictionary> </UserControl.Resources> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="3*"/> <ColumnDefinition Width="2*"/> <ColumnDefinition Width="2"/> <ColumnDefinition Width="7*"/> <ColumnDefinition Width="8*"/> </Grid.ColumnDefinitions> <ListView ItemContainerStyle="{StaticResource a}" ItemsSource="{Binding Sequences}" BorderThickness="0" <ListBox ItemsSource="{Binding Sequences}" Style="{StaticResource DefaultListBox}" BorderThickness="0" dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True" dd:DragDrop.ShowAlwaysDropTargetAdorner="True" dd:DragDrop.UseDefaultDragAdorner="True" SelectionChanged="ListView_SelectionChanged"> <ListView.ItemTemplate> <ListBox.ItemTemplate> <DataTemplate> <ContentControl Content="{Binding Name}"/> <ContentControl Cursor="Hand" Content="{Binding Name}"/> </DataTemplate> </ListView.ItemTemplate> </ListView> </ListBox.ItemTemplate> </ListBox> <GridSplitter Grid.Column="1" Background="LightGray" HorizontalAlignment="Center" Width="2" ResizeDirection="Columns"/> @@ -212,15 +199,6 @@ </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> <!--<ListView > <ListView.View> <GridView> </GridView> </ListView.View> </ListView>--> </Grid> </Grid> </UserControl> Plugin.TestBuilder/Container/SequnceList.xaml.cs
File was renamed from WPFProject/UI/Test/SequnceList.xaml.cs @@ -1,16 +1,13 @@ using AIStudio.Wpf.Controls; using GongSolutions.Wpf.DragDrop; using GongSolutions.Wpf.DragDrop; using Plugin.TestBuilder.Model; using Plugin.TestBuilder.UI; using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows.Controls; using WPFProject.Models; using WPFProject.Utils; namespace WPFProject.UI.Test namespace Plugin.TestBuilder { /// <summary> /// SequnceList.xaml 的交互逻辑 /// </summary> Plugin.TestBuilder/Container/StepSetting.xaml
New file @@ -0,0 +1,31 @@ <UserControl x:Class="Plugin.TestBuilder.StepSetting" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Plugin.TestBuilder" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <UserControl.Resources> <ResourceDictionary> <Style TargetType="Label"></Style> <Style TargetType="ListView"></Style> <Style TargetType="TabControl"/> <Color x:Key="DarkPrimaryColor">#e17933</Color> <Color x:Key="PrimaryColor">#e17933</Color> <Color x:Key="PrimaryTextColor">#e17933</Color> <Color x:Key="SecondaryTitleColor">#e17933</Color> <Color x:Key="BorderColor">#e17933</Color> </ResourceDictionary> </UserControl.Resources> <Grid> <TabControl TabStripPlacement="Left"> <TabItem Header="函数列表"> </TabItem> <TabItem Header="变量列表"> </TabItem> </TabControl> </Grid> </UserControl> Plugin.TestBuilder/Container/StepSetting.xaml.cs
New file @@ -0,0 +1,15 @@ using System.Windows.Controls; namespace Plugin.TestBuilder { /// <summary> /// StepSetting.xaml 的交互逻辑 /// </summary> public partial class StepSetting : UserControl { public StepSetting() { InitializeComponent(); } } } Plugin.TestBuilder/Entity/CanvasPosition.cs
File was renamed from WPFProject/Models/CanvasPosition.cs @@ -1,4 +1,4 @@ namespace WPFProject.Models namespace Plugin.TestBuilder.Entity { public class CanvasPosition { Plugin.TestBuilder/Model/FuncModel.cs
File was renamed from WPFProject/Models/FuncModel.cs @@ -1,6 +1,7 @@ using System.Collections.ObjectModel; using HMI.Core.Entity; using System.Collections.ObjectModel; namespace WPFProject.Models namespace Plugin.TestBuilder.Model { public class FuncModel : NotifyBase { @@ -9,7 +10,7 @@ public string Name { get { return _Name; } set => RaiseAndSetIfChanged(ref _Name, value); set => Set(ref _Name, value); } private ObservableCollection<FuncModel> _Children; @@ -17,7 +18,7 @@ public ObservableCollection<FuncModel> Children { get { return _Children; } set => RaiseAndSetIfChanged(ref _Children, value); set => Set(ref _Children, value); } } Plugin.TestBuilder/Model/Program.cs
File was renamed from WPFProject/Models/Program.cs @@ -1,11 +1,9 @@ using System; using HMI.Core.Entity; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Xml.Serialization; using HMI.Core.Api; using HMI.Core.Entity; namespace WPFProject.Models namespace Plugin.TestBuilder.Model { public class Program : NotifyBase { @@ -16,7 +14,7 @@ public string Name { get { return _Name; } set => RaiseAndSetIfChanged(ref _Name, value); set => Set(ref _Name, value); } /// <summary> @@ -26,7 +24,7 @@ public ObservableCollection<Sequence> Sequences { get { return _Sequences; } set => RaiseAndSetIfChanged(ref _Sequences, value); set => Set(ref _Sequences, value); } /// <summary> @@ -36,7 +34,7 @@ public ObservableCollection<Variable> Variables { get { return _Variables; } set => RaiseAndSetIfChanged(ref _Variables, value); set => Set(ref _Variables, value); } /// <summary> Plugin.TestBuilder/Model/Sequence.cs
File was renamed from WPFProject/Models/Sequence.cs @@ -1,7 +1,8 @@ using System.Collections.ObjectModel; using HMI.Core.Entity; using System.Collections.ObjectModel; using System.Xml.Serialization; namespace WPFProject.Models namespace Plugin.TestBuilder.Model { public class Sequence : NotifyBase { @@ -10,7 +11,7 @@ public string Name { get { return _Name; } set => RaiseAndSetIfChanged(ref _Name, value); set => Set(ref _Name, value); } [XmlIgnore] @@ -20,7 +21,7 @@ public ObservableCollection<Step> Steps { get { return _Steps; } set => RaiseAndSetIfChanged(ref _Steps, value); set => Set(ref _Steps, value); } public Sequence AddStep(params Step[] steps) Plugin.TestBuilder/Model/Step.cs
File was renamed from WPFProject/Models/Step.cs @@ -1,10 +1,9 @@ using System; using HMI.Core.Entity; using System.Collections.Generic; using System.Reflection; using System.Xml.Serialization; using HMI.Core.Api; namespace WPFProject.Models namespace Plugin.TestBuilder.Model { public class Step : NotifyBase { @@ -21,42 +20,42 @@ public int Index { get { return _Index; } set => RaiseAndSetIfChanged(ref _Index, value); set => Set(ref _Index, value); } private string _Name; public string Name { get { return _Name; } set => RaiseAndSetIfChanged(ref _Name, value); set => Set(ref _Name, value); } private string _DllPath = "C:/Users/cheng/source/repos/WPFProject/VisionBuilder.Test/bin/Debug/VisionBuilder.Test.dll"; public string DllPath { get { return _DllPath; } set => RaiseAndSetIfChanged(ref _DllPath, value); set => Set(ref _DllPath, value); } private string _ClassName = "VisionBuilder.Test.PluginOne"; public string ClassName { get { return _ClassName; } set => RaiseAndSetIfChanged(ref _ClassName, value); set => Set(ref _ClassName, value); } private string _MethodName; public string MethodName { get { return _MethodName; } set => RaiseAndSetIfChanged(ref _MethodName, value); set => Set(ref _MethodName, value); } private string _Description; public string Description { get { return _Description; } set => RaiseAndSetIfChanged(ref _Description, value); set => Set(ref _Description, value); } #endregion Plugin.TestBuilder/Model/Variable.cs
File was renamed from WPFProject/Models/Variable.cs @@ -1,12 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; using System.Security.Policy; using System.Text; using System.Threading.Tasks; using HMI.Core.Entity; using System; using System.Xml.Serialization; namespace WPFProject.Models namespace Plugin.TestBuilder.Model { public class Variable : NotifyBase { @@ -17,7 +13,7 @@ public string Name { get { return _Name; } set => RaiseAndSetIfChanged(ref _Name, value); set => Set(ref _Name, value); } /// <summary> @@ -29,7 +25,7 @@ get { return _TypeName; } set { RaiseAndSetIfChanged(ref _TypeName, value); Set(ref _TypeName, value); Type = value == null ? null : Type.GetType(value); } } @@ -44,7 +40,7 @@ public string ValueStr { get { return _ValueStr; } set => RaiseAndSetIfChanged(ref _ValueStr, value); set => Set(ref _ValueStr, value); } /// <summary> Plugin.TestBuilder/Plugin.TestBuilder.csproj
New file @@ -0,0 +1,200 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{30201EC1-9A82-48DB-94B9-BD5C1190228B}</ProjectGuid> <OutputType>library</OutputType> <RootNamespace>Plugin.TestBuilder</RootNamespace> <AssemblyName>Plugin.TestBuilder</AssemblyName> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <WarningLevel>4</WarningLevel> <Deterministic>true</Deterministic> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <DebugSymbols>true</DebugSymbols> <OutputPath>bin\x64\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x64</PlatformTarget> <LangVersion>7.3</LangVersion> <ErrorReport>prompt</ErrorReport> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <OutputPath>bin\x64\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <Optimize>true</Optimize> <DebugType>pdbonly</DebugType> <PlatformTarget>x64</PlatformTarget> <LangVersion>7.3</LangVersion> <ErrorReport>prompt</ErrorReport> </PropertyGroup> <ItemGroup> <Reference Include="GongSolutions.WPF.DragDrop, Version=4.0.0.0, Culture=neutral, PublicKeyToken=91f1945125b7a587, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\gong-wpf-dragdrop.4.0.0\lib\net462\GongSolutions.WPF.DragDrop.dll</HintPath> </Reference> <Reference Include="log4net, Version=3.0.4.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\log4net.3.0.4\lib\net462\log4net.dll</HintPath> </Reference> <Reference Include="Panuon.WPF, Version=1.1.2.2, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Panuon.WPF.1.1.3\lib\net472\Panuon.WPF.dll</HintPath> </Reference> <Reference Include="Panuon.WPF.UI, Version=1.3.0.2, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\WPFProject\packages\Panuon.WPF.UI.1.3.0.2\lib\net472\Panuon.WPF.UI.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Web" /> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Xaml"> <RequiredTargetFramework>4.0</RequiredTargetFramework> </Reference> <Reference Include="WindowsBase" /> <Reference Include="PresentationCore" /> <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> <Page Include="Container\FunctionSetting.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="Workspace.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\BottomBar.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\InnerWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\MinInnerWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="Container\ProgramList.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="Container\SequnceList.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="Container\StepSetting.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="TestBuilder.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Compile Include="Entity\CanvasPosition.cs" /> <Compile Include="Model\FuncModel.cs" /> <Compile Include="Model\Program.cs" /> <Compile Include="Model\Sequence.cs" /> <Compile Include="Model\Step.cs" /> <Compile Include="Model\Variable.cs" /> <Compile Include="Workspace.xaml.cs"> <DependentUpon>Workspace.xaml</DependentUpon> </Compile> <Compile Include="UI\BottomBar.xaml.cs"> <DependentUpon>BottomBar.xaml</DependentUpon> </Compile> <Compile Include="UI\CanvasHelper.cs" /> <Compile Include="Container\FunctionSetting.xaml.cs"> <DependentUpon>FunctionSetting.xaml</DependentUpon> </Compile> <Compile Include="UI\DdDragHandler.cs" /> <Compile Include="UI\DdDropHandler.cs" /> <Compile Include="UI\InnerWindow.xaml.cs"> <DependentUpon>InnerWindow.xaml</DependentUpon> </Compile> <Compile Include="UI\MinInnerWindow.xaml.cs"> <DependentUpon>MinInnerWindow.xaml</DependentUpon> </Compile> <Compile Include="Container\ProgramList.xaml.cs"> <DependentUpon>ProgramList.xaml</DependentUpon> </Compile> <Compile Include="UI\Resize.cs" /> <Compile Include="Container\SequnceList.xaml.cs"> <DependentUpon>SequnceList.xaml</DependentUpon> </Compile> <Compile Include="Container\StepSetting.xaml.cs"> <DependentUpon>StepSetting.xaml</DependentUpon> </Compile> <Compile Include="TestBuilder.xaml.cs"> <DependentUpon>TestBuilder.xaml</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Resources.resx</DependentUpon> </Compile> <Compile Include="Properties\Settings.Designer.cs"> <AutoGen>True</AutoGen> <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> <None Include="packages.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> </None> </ItemGroup> <ItemGroup> <ProjectReference Include="..\HMI.Base\HMI.Base.csproj"> <Project>{2a6f9720-a890-4036-9d73-41a0dae28341}</Project> <Name>HMI.Base</Name> </ProjectReference> <ProjectReference Include="..\HMI.Core\HMI.Core.csproj"> <Project>{3e3bf44a-0b69-45c5-9512-528cb48a7106}</Project> <Name>HMI.Core</Name> </ProjectReference> <ProjectReference Include="..\HMI.UI\HMI.UI.csproj"> <Project>{f17de6b5-af1d-48c6-94a0-6b763a6546a6}</Project> <Name>HMI.UI</Name> </ProjectReference> <ProjectReference Include="..\HMI.Util\HMI.Util.csproj"> <Project>{afea100a-9223-448d-ab10-3015d93dd98c}</Project> <Name>HMI.Util</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project> Plugin.TestBuilder/Properties/AssemblyInfo.cs
New file @@ -0,0 +1,52 @@ using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Plugin.TestBuilder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Plugin.TestBuilder")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] //若要开始生成可本地化的应用程序,请设置 //.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture> //在 <PropertyGroup> 中。例如,如果你使用的是美国英语。 //使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消 //对以下 NeutralResourceLanguage 特性的注释。 更新 //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //主题特定资源词典所处位置 //(未在页面中找到资源时使用, //或应用程序资源字典中找到时使用) ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 //(未在页面中找到资源时使用, //、应用程序或任何主题专用资源字典中找到时使用) )] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] Plugin.TestBuilder/Properties/Resources.Designer.cs
New file @@ -0,0 +1,62 @@ //------------------------------------------------------------------------------ // <auto-generated> // 此代码由工具生成。 // 运行时版本: 4.0.30319.42000 // // 对此文件的更改可能导致不正确的行为,如果 // 重新生成代码,则所做更改将丢失。 // </auto-generated> //------------------------------------------------------------------------------ namespace Plugin.TestBuilder.Properties { /// <summary> /// 强类型资源类,用于查找本地化字符串等。 /// </summary> // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // (以 /str 作为命令选项),或重新生成 VS 项目。 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// 返回此类使用的缓存 ResourceManager 实例。 /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if ((resourceMan == null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Plugin.TestBuilder.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// 重写当前线程的 CurrentUICulture 属性,对 /// 使用此强类型资源类的所有资源查找执行重写。 /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } Plugin.TestBuilder/Properties/Resources.resxcopy from WPFProject/Forms/Form1.resx copy to Plugin.TestBuilder/Properties/Resources.resx
File was copied from WPFProject/Forms/Form1.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,7 +60,6 @@ : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> @@ -69,10 +68,9 @@ <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> @@ -87,10 +85,9 @@ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> @@ -112,9 +109,9 @@ <value>2.0</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> </root> Plugin.TestBuilder/Properties/Settings.Designer.cs
New file @@ -0,0 +1,30 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Plugin.TestBuilder.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } Plugin.TestBuilder/Properties/Settings.settings
New file @@ -0,0 +1,7 @@ <?xml version='1.0' encoding='utf-8'?> <SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> <Profiles> <Profile Name="(Default)" /> </Profiles> <Settings /> </SettingsFile> Plugin.TestBuilder/TestBuilder.xaml
New file @@ -0,0 +1,30 @@ <hb:PluginControl x:Class="Plugin.TestBuilder.TestBuilder" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:hb="clr-namespace:HMI.Base;assembly=HMI.Base" xmlns:pw="https://opensource.panuon.com/wpf" xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:ui="clr-namespace:Plugin.TestBuilder.UI" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <pu:StyleDictionary Includes="ListBox"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> <Grid> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <Canvas x:Name="WorkArea" Background="{StaticResource CommonBoarder}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <!--<vt:ProgramList BorderThickness="1" BorderBrush="#000" Canvas.Left="335" Canvas.Top="121" utils:Resize.IsResizeable="True"></vt:ProgramList> <vt:ProgramList BorderThickness="1" BorderBrush="#000" Canvas.Left="600" Canvas.Top="121" FocusableChanged="ProgramList_FocusableChanged"></vt:ProgramList>--> <ui:BottomBar x:Name="BottomBar" Canvas.Bottom="0" Panel.ZIndex="9999999"/> </Canvas> </ScrollViewer> </Grid> </hb:PluginControl> Plugin.TestBuilder/TestBuilder.xaml.cscopy from WPFProject/UI/WorkControl.xaml.cs copy to Plugin.TestBuilder/TestBuilder.xaml.cs
File was copied from WPFProject/UI/WorkControl.xaml.cs @@ -1,22 +1,20 @@ using System; using HMI.Base; using Plugin.TestBuilder.Entity; using Plugin.TestBuilder.UI; using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using HMI.Base; using log4net; using WPFProject.Controls; using WPFProject.Models; using WPFProject.Utils; using System.Windows.Media; namespace WPFProject.UI namespace Plugin.TestBuilder { /// <summary> /// WorkControl.xaml 的交互逻辑 /// </summary> public partial class WorkControl : PluginControl public partial class TestBuilder : PluginControl { private ILog log; public WorkControl() public TestBuilder() { InitializeComponent(); Loaded += UserControl_Loaded; @@ -69,49 +67,49 @@ private void UserControl_Loaded(object sender, RoutedEventArgs e) { //List<CanvasPosition> pos = InitGridSize(); //ProgramList programList = new ProgramList(); //InnerWindow p = new InnerWindow(pos[0]) //{ // Title = "程序列表", // Content = programList //}; //HandleInnerWindow(p); List<CanvasPosition> pos = InitGridSize(); ProgramList programList = new ProgramList(); InnerWindow p = new InnerWindow(pos[0]) { Title = "程序列表", Content = programList }; HandleInnerWindow(p); //InnerWindow p1 = new InnerWindow(pos[1]) //{ // Title = "图片", //}; //HandleInnerWindow(p1); InnerWindow p1 = new InnerWindow(pos[1]) { Title = "图片" }; HandleInnerWindow(p1); //SequnceList sequnceList = new SequnceList(); //programList.ProgramChanged += sequnceList.Selected_Program_Changed; SequnceList sequnceList = new SequnceList(); programList.ProgramChanged += sequnceList.Selected_Program_Changed; //InnerWindow p2 = new InnerWindow(pos[2]) //{ // Title = "序列", // Content = sequnceList //}; //HandleInnerWindow(p2); InnerWindow p2 = new InnerWindow(pos[2]) { Title = "序列", Content = sequnceList }; HandleInnerWindow(p2); //FunctionSetting functionSetting = new FunctionSetting(); //InnerWindow p3 = new InnerWindow(pos[3]) //{ // Title = "函数", // Content = functionSetting //}; //HandleInnerWindow(p3); FunctionSetting functionSetting = new FunctionSetting(); InnerWindow p3 = new InnerWindow(pos[3]) { Title = "函数", Content = functionSetting }; HandleInnerWindow(p3); //StepSetting stepSetting = new StepSetting(); //InnerWindow p4 = new InnerWindow(pos[4]) //{ // Title = "单步设置", // Content = stepSetting //}; //HandleInnerWindow(p4); StepSetting stepSetting = new StepSetting(); InnerWindow p4 = new InnerWindow(pos[4]) { Title = "单步设置", Content = stepSetting }; HandleInnerWindow(p4); //SizeChanged += WorkControl_SizeChanged; SizeChanged += WorkControl_SizeChanged; Loaded -= UserControl_Loaded; } @@ -199,30 +197,30 @@ /// <param name="e"></param> private void WorkControl_SizeChanged(object sender, SizeChangedEventArgs e) { //Size newSize = e.NewSize; //Size previousSize = e.PreviousSize; Size newSize = e.NewSize; Size previousSize = e.PreviousSize; //double xRate = newSize.Width / previousSize.Width; //double yRate = newSize.Height / previousSize.Height; //for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++) //{ // UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement; // Canvas.SetLeft(child, Canvas.GetLeft(child) * xRate); // Canvas.SetTop(child, Canvas.GetTop(child) * yRate); //} double xRate = newSize.Width / previousSize.Width; double yRate = newSize.Height / previousSize.Height; for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++) { UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement; Canvas.SetLeft(child, Canvas.GetLeft(child) * xRate); Canvas.SetTop(child, Canvas.GetTop(child) * yRate); } //for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++) //{ // UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement; // if (Canvas.GetLeft(child) >= newSize.Width) // { // Canvas.SetLeft(child, Canvas.GetLeft(child) + newSize.Width - previousSize.Width); // } // if (Canvas.GetTop(child) >= newSize.Height) // { // Canvas.SetTop(child, Canvas.GetTop(child) + newSize.Height - previousSize.Height); // } //} for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++) { UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement; if (Canvas.GetLeft(child) >= newSize.Width) { Canvas.SetLeft(child, Canvas.GetLeft(child) + newSize.Width - previousSize.Width); } if (Canvas.GetTop(child) >= newSize.Height) { Canvas.SetTop(child, Canvas.GetTop(child) + newSize.Height - previousSize.Height); } } } #endregion @@ -264,50 +262,5 @@ } #endregion public void OnTabChange(object sender, SelectionChangedEventArgs args) { if (args.AddedItems.Count > 0) { IconTabItem newTab = args.AddedItems[0] as IconTabItem; if (newTab != null && newTab.Content == this) { } } if (args.RemovedItems.Count > 0) { IconTabItem oldTab = args.RemovedItems[0] as IconTabItem; if (oldTab != null && oldTab.Content == this) { } } } public object Active() { return null; } public object DeActive() { return null; } public void OnTabChange(object sender, object args) { } public object Init() { return null; } public void SetLogger(ILog logger) { log = logger; } } } Plugin.TestBuilder/UI/BottomBar.xaml
File was renamed from WPFProject/UI/BottomBar.xaml @@ -1,10 +1,9 @@ <UserControl x:Class="WPFProject.UI.BottomBar" <UserControl x:Class="Plugin.TestBuilder.UI.BottomBar" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:WPFProject.UI" xmlns:ctls="clr-namespace:WPFProject.Controls" xmlns:local="clr-namespace:Plugin.TestBuilder.UI" mc:Ignorable="d" d:DesignHeight="30" d:DesignWidth="800"> <ScrollViewer HorizontalScrollBarVisibility="Auto" Background="Transparent" VerticalScrollBarVisibility="Hidden"> Plugin.TestBuilder/UI/BottomBar.xaml.cs
File was renamed from WPFProject/UI/BottomBar.xaml.cs @@ -1,8 +1,7 @@ using System.Windows; using System.Windows.Controls; using WPFProject.Controls; namespace WPFProject.UI namespace Plugin.TestBuilder.UI { /// <summary> /// BottomBar.xaml 的交互逻辑 Plugin.TestBuilder/UI/CanvasHelper.cs
File was renamed from WPFProject/Utils/CanvasHelper.cs @@ -1,10 +1,8 @@ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using WPFProject.Controls; namespace WPFProject.Utils namespace Plugin.TestBuilder.UI { public class CanvasHelper { Plugin.TestBuilder/UI/DdDragHandler.cs
File was renamed from WPFProject/Utils/DdDragHandler.cs @@ -1,13 +1,7 @@ using GongSolutions.Wpf.DragDrop; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using WPFProject.Models; using Plugin.TestBuilder.Model; namespace WPFProject.Utils namespace Plugin.TestBuilder.UI { public class DdDragHandler : DefaultDragHandler { Plugin.TestBuilder/UI/DdDropHandler.cs
File was renamed from WPFProject/Utils/DdDropHandler.cs @@ -1,16 +1,13 @@ using GongSolutions.Wpf.DragDrop; using GongSolutions.Wpf.DragDrop.Utilities; using System.Collections.Generic; using System.ComponentModel; using Plugin.TestBuilder.Model; using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Markup; using System.Linq; using System.Collections; using WPFProject.Models; namespace WPFProject.Utils namespace Plugin.TestBuilder.UI { public class DdDropHandler : DefaultDropHandler { Plugin.TestBuilder/UI/InnerWindow.xaml
File was renamed from WPFProject/Controls/InnerWindow.xaml @@ -1,10 +1,9 @@ <UserControl x:Class="WPFProject.Controls.InnerWindow" <UserControl x:Class="Plugin.TestBuilder.UI.InnerWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:WPFProject.Controls" xmlns:local="clr-namespace:Plugin.TestBuilder.UI" mc:Ignorable="d" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" @@ -22,8 +21,8 @@ <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Label VerticalContentAlignment="Center" Background="{StaticResource ChildBorder}" Foreground="{Binding HeaderFontColor}" Content="{Binding Title}"/> <Label VerticalContentAlignment="Center" Foreground="{Binding HeaderFontColor}" Content="{Binding Title}"/> </ControlTemplate> </Setter.Value> </Setter> @@ -33,14 +32,14 @@ <UserControl.Template> <ControlTemplate TargetType="UserControl"> <AdornerDecorator HorizontalAlignment="Stretch" VerticalAlignment="Stretch" > <AdornerDecorator x:Name="PART_Adorner" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" > <Grid GotFocus="Grid_GotFocus"> <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid> <Grid Background="{StaticResource ReVerBar}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> @@ -50,9 +49,9 @@ DragStarted="DragStarted" DragCompleted="DragCompleted"/> <StackPanel Grid.Column="1" Orientation="Horizontal"> <Button Style="{StaticResource ChildWindowButton}" Click="Min_Click"></Button> <Button Style="{StaticResource ChildWindowButton}" Click="Max_Click" ></Button> <Button Style="{StaticResource ChildWindowCloseButton}" Click="CLose_Click"></Button> <Button Style="{StaticResource ChildWindowButton}" Background="Transparent" Click="Min_Click"></Button> <Button Style="{StaticResource ChildWindowButton}" Background="Transparent" Click="Max_Click" ></Button> <!--<Button Style="{StaticResource ChildWindowCloseButton}" Background="Transparent" Click="CLose_Click"></Button>--> </StackPanel> </Grid> Plugin.TestBuilder/UI/InnerWindow.xaml.cs
File was renamed from WPFProject/Controls/InnerWindow.xaml.cs @@ -1,20 +1,14 @@ using HandyControl.Controls; using Plugin.TestBuilder.Entity; using System; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Shapes; using WPFProject.Models; using WPFProject.UI.Test; using WPFProject.Utils; using static WPFProject.Utils.Resize.Resizeable; namespace WPFProject.Controls namespace Plugin.TestBuilder.UI { /// <summary> /// InnerWindow.xaml 的交互逻辑 @@ -46,7 +40,13 @@ public CanvasPosition canvasPosition; private Canvas canvas; public WindowState WindowState { get; set; } = WindowState.Normal; public AdornerDecorator ResizeAdornerDecorator { get => VisualTreeHelper.GetChild(this, 0) as AdornerDecorator; } public AdornerDecorator ResizeAdornerDecorator { get { return this.Template.FindName("PART_Adorner", this) as AdornerDecorator; } } private string _Title; public string Title @@ -83,7 +83,7 @@ } public static readonly DependencyProperty HeaderBackgroundProperty = DependencyProperty.Register("HeaderBackground", typeof(Brush), typeof(ProgramList), DependencyProperty.Register("HeaderBackground", typeof(Brush), typeof(InnerWindow), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(54, 146, 225)))); public Brush HeaderFontColor @@ -93,7 +93,7 @@ } public static readonly DependencyProperty HeaderFontColorProperty = DependencyProperty.Register("HeaderFontColor", typeof(Brush), typeof(ProgramList), DependencyProperty.Register("HeaderFontColor", typeof(Brush), typeof(InnerWindow), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(255, 255, 225)))); #endregion @@ -190,7 +190,7 @@ { if (true) { Resize.SetIsResizeable(this, true); Resize.SetIsResizeable(this, true); } canvas.Children.Add(this); this.canvas = canvas; Plugin.TestBuilder/UI/MinInnerWindow.xaml
File was renamed from WPFProject/Controls/MinInnerWindow.xaml @@ -1,9 +1,9 @@ <UserControl x:Class="WPFProject.Controls.MinInnerWindow" <UserControl x:Class="Plugin.TestBuilder.UI.MinInnerWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:WPFProject.Controls" xmlns:local="clr-namespace:Plugin.TestBuilder.UI" mc:Ignorable="d" Height="30" d:DesignHeight="450" d:DesignWidth="800"> @@ -16,9 +16,9 @@ </ResourceDictionary> </UserControl.Resources> <StackPanel Background="{StaticResource SecondPrimaryColor}" Orientation="Horizontal"> <StackPanel Background="{StaticResource VerBar}" Orientation="Horizontal"> <Label BorderBrush="{StaticResource PrimaryColor}" Foreground="#FFF" BorderThickness="2,0,0,0" VerticalContentAlignment="Center" ToolTip="{Binding Title}" Content="{Binding Title}"/> <Button Style="{StaticResource ChildWindowButton}" Click="Max_Click" ></Button> <Button Style="{StaticResource ChildWindowCloseButton}" Click="CLose_Click"></Button> <Button Style="{StaticResource ChildWindowButton}" Background="Transparent" Click="Max_Click" ></Button> <!--<Button Style="{StaticResource ChildWindowCloseButton}" Click="CLose_Click"></Button>--> </StackPanel> </UserControl> Plugin.TestBuilder/UI/MinInnerWindow.xaml.cs
File was renamed from WPFProject/Controls/MinInnerWindow.xaml.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Controls; namespace WPFProject.Controls namespace Plugin.TestBuilder.UI { /// <summary> /// MinInnerWindow.xaml 的交互逻辑 Plugin.TestBuilder/UI/Resize.cs
File was renamed from WPFProject/Utils/Resize.cs @@ -1,15 +1,13 @@ using System.Windows.Input; using System; using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System; using System.Windows.Shapes; using WPFProject.Controls; using System.Xml.Linq; namespace WPFProject.Utils namespace Plugin.TestBuilder.UI { public class Resize { @@ -80,10 +78,11 @@ RoutedEventHandler Loaded_Resize = null; Loaded_Resize = (sender, e1) => { Resizeable resize = new Resizeable(element); resize.Attach(); SetResizeable(element, resize); element.Loaded -= Loaded_Resize; FrameworkElement senderElement = sender as FrameworkElement; Resizeable r = new Resizeable(senderElement); r.Attach(); SetResizeable(senderElement, r); senderElement.Loaded -= Loaded_Resize; }; element.Loaded += Loaded_Resize; } @@ -298,7 +297,7 @@ { if (element is InnerWindow _inner) { AdornerLayer layer = _inner.ResizeAdornerDecorator.AdornerLayer; AdornerLayer layer = _inner.ResizeAdornerDecorator?.AdornerLayer; if (layer == null) throw new Exception("获取控件装饰层失败,控件可能没有装饰层!"); layer.Add(new ResizeAdorner(layer, grid)); @@ -615,7 +614,7 @@ static Canvas GetCanvas(DependencyObject element) { DependencyObject e = element; while (e is not null and not Canvas) while (e != null && !(e is Canvas)) { e = VisualTreeHelper.GetParent(e); } Plugin.TestBuilder/Workspace.xaml
File was renamed from WPFProject/UI/WorkControl.xaml @@ -1,27 +1,25 @@ <hb:PluginControl x:Class="WPFProject.UI.WorkControl" <hb:PluginControl x:Class="Plugin.TestBuilder.Workspace" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:hb="clr-namespace:HMI.Base;assembly=HMI.Base" xmlns:ui="clr-namespace:WPFProject.UI" xmlns:vm="clr-namespace:WPFProject.ViewModels" xmlns:view="clr-namespace:WPFProject.UI" xmlns:utils="clr-namespace:WPFProject.Utils" xmlns:vt="clr-namespace:WPFProject.UI.Test" xmlns:pw="https://opensource.panuon.com/wpf" xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:ui="clr-namespace:Plugin.TestBuilder.UI" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/> <pu:StyleDictionary Includes="ListBox"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> <Grid> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <Canvas x:Name="WorkArea" Background="#FFF" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Canvas x:Name="WorkArea" Background="{StaticResource CommonBoarder}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <!--<vt:ProgramList BorderThickness="1" BorderBrush="#000" Canvas.Left="335" Canvas.Top="121" utils:Resize.IsResizeable="True"></vt:ProgramList> <vt:ProgramList BorderThickness="1" BorderBrush="#000" Canvas.Left="600" Canvas.Top="121" FocusableChanged="ProgramList_FocusableChanged"></vt:ProgramList>--> Plugin.TestBuilder/Workspace.xaml.cs
File was renamed from WPFProject/UI/WorkControl.xaml.cs @@ -1,22 +1,20 @@ using System; using HMI.Base; using Plugin.TestBuilder.Entity; using Plugin.TestBuilder.UI; using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using HMI.Base; using log4net; using WPFProject.Controls; using WPFProject.Models; using WPFProject.Utils; using System.Windows.Media; namespace WPFProject.UI namespace Plugin.TestBuilder { /// <summary> /// WorkControl.xaml 的交互逻辑 /// </summary> public partial class WorkControl : PluginControl public partial class Workspace : PluginControl { private ILog log; public WorkControl() public Workspace() { InitializeComponent(); Loaded += UserControl_Loaded; @@ -69,49 +67,49 @@ private void UserControl_Loaded(object sender, RoutedEventArgs e) { //List<CanvasPosition> pos = InitGridSize(); //ProgramList programList = new ProgramList(); //InnerWindow p = new InnerWindow(pos[0]) //{ // Title = "程序列表", // Content = programList //}; //HandleInnerWindow(p); List<CanvasPosition> pos = InitGridSize(); ProgramList programList = new ProgramList(); InnerWindow p = new InnerWindow(pos[0]) { Title = "程序列表", Content = programList }; HandleInnerWindow(p); //InnerWindow p1 = new InnerWindow(pos[1]) //{ // Title = "图片", //}; //HandleInnerWindow(p1); InnerWindow p1 = new InnerWindow(pos[1]) { Title = "图片" }; HandleInnerWindow(p1); //SequnceList sequnceList = new SequnceList(); //programList.ProgramChanged += sequnceList.Selected_Program_Changed; SequnceList sequnceList = new SequnceList(); programList.ProgramChanged += sequnceList.Selected_Program_Changed; //InnerWindow p2 = new InnerWindow(pos[2]) //{ // Title = "序列", // Content = sequnceList //}; //HandleInnerWindow(p2); InnerWindow p2 = new InnerWindow(pos[2]) { Title = "序列", Content = sequnceList }; HandleInnerWindow(p2); //FunctionSetting functionSetting = new FunctionSetting(); //InnerWindow p3 = new InnerWindow(pos[3]) //{ // Title = "函数", // Content = functionSetting //}; //HandleInnerWindow(p3); FunctionSetting functionSetting = new FunctionSetting(); InnerWindow p3 = new InnerWindow(pos[3]) { Title = "函数", Content = functionSetting }; HandleInnerWindow(p3); //StepSetting stepSetting = new StepSetting(); //InnerWindow p4 = new InnerWindow(pos[4]) //{ // Title = "单步设置", // Content = stepSetting //}; //HandleInnerWindow(p4); StepSetting stepSetting = new StepSetting(); InnerWindow p4 = new InnerWindow(pos[4]) { Title = "单步设置", Content = stepSetting }; HandleInnerWindow(p4); //SizeChanged += WorkControl_SizeChanged; SizeChanged += WorkControl_SizeChanged; Loaded -= UserControl_Loaded; } @@ -199,30 +197,30 @@ /// <param name="e"></param> private void WorkControl_SizeChanged(object sender, SizeChangedEventArgs e) { //Size newSize = e.NewSize; //Size previousSize = e.PreviousSize; Size newSize = e.NewSize; Size previousSize = e.PreviousSize; //double xRate = newSize.Width / previousSize.Width; //double yRate = newSize.Height / previousSize.Height; //for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++) //{ // UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement; // Canvas.SetLeft(child, Canvas.GetLeft(child) * xRate); // Canvas.SetTop(child, Canvas.GetTop(child) * yRate); //} double xRate = newSize.Width / previousSize.Width; double yRate = newSize.Height / previousSize.Height; for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++) { UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement; Canvas.SetLeft(child, Canvas.GetLeft(child) * xRate); Canvas.SetTop(child, Canvas.GetTop(child) * yRate); } //for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++) //{ // UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement; // if (Canvas.GetLeft(child) >= newSize.Width) // { // Canvas.SetLeft(child, Canvas.GetLeft(child) + newSize.Width - previousSize.Width); // } // if (Canvas.GetTop(child) >= newSize.Height) // { // Canvas.SetTop(child, Canvas.GetTop(child) + newSize.Height - previousSize.Height); // } //} for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++) { UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement; if (Canvas.GetLeft(child) >= newSize.Width) { Canvas.SetLeft(child, Canvas.GetLeft(child) + newSize.Width - previousSize.Width); } if (Canvas.GetTop(child) >= newSize.Height) { Canvas.SetTop(child, Canvas.GetTop(child) + newSize.Height - previousSize.Height); } } } #endregion @@ -264,50 +262,5 @@ } #endregion public void OnTabChange(object sender, SelectionChangedEventArgs args) { if (args.AddedItems.Count > 0) { IconTabItem newTab = args.AddedItems[0] as IconTabItem; if (newTab != null && newTab.Content == this) { } } if (args.RemovedItems.Count > 0) { IconTabItem oldTab = args.RemovedItems[0] as IconTabItem; if (oldTab != null && oldTab.Content == this) { } } } public object Active() { return null; } public object DeActive() { return null; } public void OnTabChange(object sender, object args) { } public object Init() { return null; } public void SetLogger(ILog logger) { log = logger; } } } Plugin.TestBuilder/packages.config
New file @@ -0,0 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="gong-wpf-dragdrop" version="4.0.0" targetFramework="net472" /> <package id="log4net" version="3.0.4" targetFramework="net472" /> <package id="Panuon.WPF" version="1.1.3" targetFramework="net472" /> <package id="Panuon.WPF.UI" version="1.3.0.2" targetFramework="net472" /> </packages> Plugin.TestResult/Chart.xaml.cs
@@ -1,4 +1,5 @@ using ScottPlot; using Plugin.TestResult_WPF.Model; using ScottPlot; using ScottPlot.Plottables; using ScottPlot.TickGenerators; using System; @@ -9,6 +10,9 @@ namespace Plugin.TestResult_WPF { /// <summary> /// Chart.xaml 的交互逻辑 /// </summary> /// <summary> /// Chart.xaml 的交互逻辑 /// </summary> @@ -30,6 +34,7 @@ private double maxYValue = -1; private double minYValue = double.MaxValue; private float fontSize = -1; private Timer timer; @@ -167,6 +172,70 @@ timer.Elapsed += Timer_Elapsed; } public Chart(string title, bool multi, float titleSize) { BaseConfig config = new BaseConfig(); this.title = title; this.multi = multi; this.maxSize = config.MaxSize; this.refreshInterval = config.RefreshInterval; fontSize = titleSize; InitializeComponent(); if (this.multi) { xValues = new Dictionary<string, Queue<long>>(); yValues = new Dictionary<string, Queue<double>>(); //chart.Plot.ShowLegend(Alignment.UpperLeft, Orientation.Vertical); var legend = chart.Plot.ShowLegend(Edge.Top); legend.Alignment = Alignment.UpperLeft; legend.Padding = new PixelPadding(0); chart.Plot.Axes.Left.TickLabelStyle.FontSize = titleSize - 3; chart.Plot.Axes.Bottom.TickLabelStyle.FontSize = titleSize - 3; chart.Plot.Axes.Left.Label.FontSize = titleSize; } else { singleLogger = InitLogger(); singleLogger.Color = Colors.Red; xData = new Queue<long>(maxSize); yData = new Queue<double>(maxSize); chart.Plot.Axes.Left.TickLabelStyle.FontSize = titleSize - 3; chart.Plot.Axes.Bottom.TickLabelStyle.FontSize = titleSize - 3; chart.Plot.Axes.Left.Label.FontSize = titleSize; } /// 禁用鼠标 chart.UserInputProcessor.Disable(); string CustomFormatter(double position) { if (position > 0) return TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddMilliseconds(position).ToString("HH:mm:ss"); return ""; } EvenlySpacedMinorTickGenerator minorTickGen = new EvenlySpacedMinorTickGenerator(10); NumericAutomatic myTickGenerator = new NumericAutomatic() { LabelFormatter = CustomFormatter, MinorTickGenerator = minorTickGen }; chart.Plot.Axes.Bottom.TickGenerator = myTickGenerator; if (!string.IsNullOrEmpty(this.title)) { chart.Plot.Axes.Left.Label.Text = this.title; chart.Plot.Axes.Left.Label.Bold = false; chart.Plot.Font.Automatic(); //RefreshData(); } timer = new Timer(); timer.Interval = this.refreshInterval; timer.Elapsed += Timer_Elapsed; } private void Timer_Elapsed(object sender, ElapsedEventArgs e) { if (maxYValue > 0) @@ -177,16 +246,25 @@ public void RefreshData() { /// 限制y轴 if (maxYValue > -1) bool flag = timer.Enabled; try { chart.Plot.Axes.SetLimitsY(minYValue > 5 ? minYValue - 5 : 0, maxYValue + 5); timer.Enabled = false; /// 限制y轴 if (maxYValue > -1) { chart.Plot.Axes.SetLimitsY(minYValue > 5 ? minYValue - 5 : 0, maxYValue + 5); } else { chart.Plot.Axes.SetLimitsY(0, 100); } chart.Refresh(); } else finally { chart.Plot.Axes.SetLimitsY(0, 100); timer.Enabled = flag; } chart.Refresh(); } public void Clear() @@ -234,6 +312,20 @@ .ToList() .ForEach(m => chart.Plot.Remove(m)); //RefreshData(); } public List<double> GetSingleData() { bool flag = timer.Enabled; try { timer.Enabled = false; return yData?.ToList(); } finally { timer.Enabled = flag; } } private void InsertData(Queue<long> xAxis, Queue<double> yAxis, long x, double y) @@ -306,9 +398,18 @@ private void UserControl_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e) { if (this.multi) return; chart.Plot.Axes.Left.Label.FontSize = (float)FontSizeConverter.CountFontSize(15, ActualHeight, 92); chart.Plot.Axes.Left.TickLabelStyle.FontSize = (float)FontSizeConverter.CountFontSize(10, ActualHeight, 92); chart.Plot.Axes.Bottom.TickLabelStyle.FontSize = (float)FontSizeConverter.CountFontSize(10, ActualHeight, 92); if (fontSize < 0) { chart.Plot.Axes.Left.Label.FontSize = (float)FontSizeConverter.CountFontSize(15, ActualHeight, 92); chart.Plot.Axes.Left.TickLabelStyle.FontSize = (float)FontSizeConverter.CountFontSize(10, ActualHeight, 92); chart.Plot.Axes.Bottom.TickLabelStyle.FontSize = (float)FontSizeConverter.CountFontSize(10, ActualHeight, 92); } else { chart.Plot.Axes.Left.Label.FontSize = fontSize - 3; chart.Plot.Axes.Left.TickLabelStyle.FontSize = fontSize - 3; chart.Plot.Axes.Bottom.TickLabelStyle.FontSize = fontSize; } } } } Plugin.TestResult/DataTable.xaml
@@ -63,7 +63,7 @@ Converter={StaticResource FontSizeConverter}, ConverterParameter='15,940'}"></local:InfoTable> </Grid> <UniformGrid x:Name="mainGrid" Grid.Row="1" Columns="6" dp:UniformGridHelper.InnerBorder="1" <UniformGrid x:Name="mainGrid" Grid.Row="1" dp:UniformGridHelper.InnerBorder="1" dp:UniformGridHelper.InnerBorderIgnore="Left,Right,Bottom"> </UniformGrid> Plugin.TestResult/DataTable.xaml.cs
@@ -99,6 +99,7 @@ this.chartTitle = config.MainChartTitle; DataContext = this; InitializeComponent(); mainGrid.Columns = config.PositionColumn; this.chart = new Chart(this.chartTitle, false, config.MaxSize, config.RefreshInterval); this.multiChart = new Chart(config.DetailChartTitle, true, config.MaxSize, config.RefreshInterval) { @@ -110,7 +111,7 @@ for (int i = 0; i < this.cellCount; i++) { var cell = new SingleCell(title, i, config.CellListMaxSize); var cell = new SingleCell(title, i, config.CellListMaxSize, countIniPath); mainGrid.Children.Add(cell); cells[i] = cell; } @@ -255,6 +256,7 @@ string LookupStr = e.name == "Zone1" ? $"StationState.SN[{dutNo}]" : $"StationState.SN[{(dutNo + 54)}]"; parent.engine.Globals.SetValString(LookupStr, 0, snrCode); parent.engine.CommitGlobalsToDisk(promptOnSaveConflicts: false); string code = parent.engine.Globals.GetValString(LookupStr, 0); parent.nameTables[cellInfo.OvenName].GetSingleCell(cellInfo.Index).SetStatus("hadCode"); } @@ -496,5 +498,13 @@ parent.SetOvenProduct(index, ""); } } public void ClearElectricData() { foreach (var cell in cells) { cell.ClearElectricData(); } } } } Plugin.TestResult/InfoWindow.xaml
@@ -14,49 +14,67 @@ xmlns:cc="clr-namespace:HMI.Core;assembly=HMI.Core" InteropOwnersMask="False" Topmost="False" Loaded="Window_Loaded" Unloaded="Window_Unloaded" SizeChanged="Window_SizeChanged" pu:WindowXModalDialog.Buttons="{x:Null}" Title="{Binding title}" Height="500" Width="800"> <DataGrid ItemsSource="{Binding dataSource}" Style="{StaticResource DefaultDataGrid}"> <DataGrid.Columns> <DataGridTemplateColumn Header="#" CanUserResize="False"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource rowNumber}, <Grid x:Name="mainGrid"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <DataGrid ItemsSource="{Binding dataSource}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True" ColumnWidth="*" VirtualizingStackPanel.VirtualizationMode="Standard" FontSize="16"> <DataGrid.Columns> <!--<DataGridTemplateColumn Header="#" CanUserResize="False" Width="Auto"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource rowNumber}, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow},AncestorLevel=1}}"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> <DataGridTextColumn Width="*" Binding="{Binding step}"> <DataGridTextColumn.Header> <TextBlock Text="{DynamicResource Test.Name}"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn Width="*" Binding="{Binding value}"> <DataGridTextColumn.Header> <TextBlock Text="{DynamicResource Test.Value}"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn Width="*" Binding="{Binding result}"> <DataGridTextColumn.Header> <TextBlock Text="{DynamicResource Test.Result}"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn Width="*" Binding="{Binding range}"> <DataGridTextColumn.Header> <TextBlock Text="{DynamicResource Test.Range}"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn Width="*" Binding="{Binding condition}"> <DataGridTextColumn.Header> <TextBlock Text="{DynamicResource Test.Condition}"/> </DataGridTextColumn.Header> </DataGridTextColumn> <DataGridTextColumn Width="*" Binding="{Binding updateTime}"> <DataGridTextColumn.Header> <TextBlock Text="{DynamicResource Test.UpdateTime}"/> </DataGridTextColumn.Header> </DataGridTextColumn> </DataGrid.Columns> </DataGrid> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn>--> <DataGridTextColumn Header="测试项名称" Binding="{Binding step}"/> <DataGridTextColumn Header="测试值" Binding="{Binding value}"/> <DataGridTextColumn Header="测试结果" Binding="{Binding result}"/> <DataGridTextColumn Header="测试范围" Binding="{Binding range}"/> <DataGridTextColumn Header="测试条件" Binding="{Binding condition}"/> <DataGridTextColumn Header="更新时间" Binding="{Binding updateTime}"/> </DataGrid.Columns> </DataGrid> <Grid Background="#f1eded" Grid.Row="2" Height="25"> <DockPanel> <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Margin="0,0,30,0"> <Label Padding="0" FontSize="12" VerticalAlignment="Center" VerticalContentAlignment="Center" Content="探针使用次数:"/> <Label Padding="0" FontSize="12" Margin="0,0,15,0" VerticalAlignment="Center" VerticalContentAlignment="Center" Content="{Binding ProbeCount}"/> <Label x:Name="alarmLabel" Padding="0" FontSize="12" VerticalAlignment="Center" VerticalContentAlignment="Center" Content="预警次数:"/> <Label x:Name="alarmValue" Padding="0" FontSize="12" VerticalAlignment="Center" VerticalContentAlignment="Center" Content="{Binding ProbeWarn}"/> <Button Style="{StaticResource LinkButton}" Margin="10,0,0,0" Click="Button_Click" >清空</Button> </StackPanel> <Label x:Name="probeCountAlarm" Visibility="Collapsed" DockPanel.Dock="Left" Padding="30,0" FontSize="12" Foreground="Red" VerticalAlignment="Center" VerticalContentAlignment="Center" Content="探针使用已达到预警次数,请注意!"/> </DockPanel> </Grid> </Grid> </pu:WindowX> Plugin.TestResult/InfoWindow.xaml.cs
@@ -1,6 +1,16 @@ using Panuon.WPF.UI; using HMI.Core.Api; using HMI.Core.Entity; using HMI.Core.Manager; using HMI.Core.Util; using HMI.UI.Util; using Panuon.WPF.UI; using Plugin.TestResult_WPF.Model; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Windows; using System.Windows.Controls; namespace Plugin.TestResult_WPF { @@ -24,19 +34,109 @@ get => _dataSource == null ? new ObservableCollection<Info>() : _dataSource; set => Set(ref _dataSource, value); } public InfoWindow(string title, ObservableCollection<Info> infos) private Chart electricChart; public InfoWindow(string title, ObservableCollection<Info> infos, Chart electricChart, int probeCount) { this.title = title; this.dataSource = infos; DataContext = this; Topmost = false; InitializeComponent(); if (AlarmProbeCount < 0) { alarmLabel.Visibility = Visibility.Collapsed; alarmValue.Visibility = Visibility.Collapsed; } UpdateProbeCount(probeCount); this.electricChart = electricChart; mainGrid.Children.Add(electricChart); Grid.SetRow(electricChart, 1); } private static int AlarmProbeCount; static InfoWindow() { int probeWarn = -1; try { probeWarn = Convert.ToInt32(ParameterManager.GetCommonParameter<List<ParameterData>>() .FirstOrDefault(x => x.Name == "ProbeWarn")?.Value); } catch (Exception ex) { probeWarn = -1; } AlarmProbeCount = probeWarn; } public event EventHandler ClearProbeCountEvent; private int probeCount; public int ProbeCount { get => probeCount; set { Set(ref probeCount, value); } } public int ProbeWarn { get => AlarmProbeCount; set { } } public void UpdateProbeCount(int count) { Dispatcher.Invoke(() => { ProbeCount = count; if (AlarmProbeCount >= 0) { probeCountAlarm.Visibility = (ProbeCount >= AlarmProbeCount) ? Visibility.Visible : Visibility.Collapsed; } }); } public void UpdateSource(ObservableCollection<Info> infos) { this.dataSource = infos; } private void Window_Loaded(object sender, RoutedEventArgs e) { DataContext = this; } private void Window_Unloaded(object sender, RoutedEventArgs e) { DataContext = null; } protected override void OnClosed(EventArgs e) { electricChart = null; mainGrid.Children.Clear(); base.OnClosed(e); } private void Window_SizeChanged(object sender, SizeChangedEventArgs e) { if (electricChart != null) { electricChart.Height = this.ActualHeight * 0.3; } } private void Button_Click(object sender, RoutedEventArgs e) { if (MsgBoxHelper.WarnMessage(this, "确定要清空探针使用次数吗?") == MessageBoxResult.OK) { ClearProbeCountEvent?.Invoke(this, null); } } } } Plugin.TestResult/Model/BaseConfig.cs
@@ -52,6 +52,19 @@ } /// <summary> /// 点位列数 /// </summary> private int positionColumn = 6; public int PositionColumn { get { var data = GetValue(); return data == null ? positionColumn : int.Parse(data); } } /// <summary> /// 每个炉子的点位数 /// </summary> private int positionCount = 54; Plugin.TestResult/SingleCell.xaml.cs
@@ -1,10 +1,12 @@ using Plugin.TestResult_WPF.Constant; using HMI.Util; using Plugin.TestResult_WPF.Constant; using Plugin.TestResult_WPF.Model; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; @@ -42,13 +44,15 @@ InitializeComponent(); } public SingleCell(string parentName, int index, int maxSize) public SingleCell(string parentName, int index, int maxSize, string iniFile) { this.parentName = parentName; this.index = index; this.maxSize = maxSize; this.countIniPath = iniFile; DataContext = this; InitializeComponent(); LoadProbeCount(); } private string _parentName; @@ -102,7 +106,7 @@ private ConcurrentQueue<Info> queue = new ConcurrentQueue<Info>(); private ObservableCollection<Info> _infos; private ObservableCollection<Info> _infos = new ObservableCollection<Info>(); public ObservableCollection<Info> infos { @@ -114,12 +118,44 @@ } } private string countIniPath; /// <summary> /// 探针寿命 /// </summary> private int probeCount; public int ProbeCount { get => probeCount; set { RaiseAndSetIfchanged(ref probeCount, value); } } public void LoadProbeCount() { string temp = IniFileHelper.ReadIniData($"{title}", "ProbeCount", "", countIniPath); if (!string.IsNullOrEmpty(temp)) { int count = Convert.ToInt32(temp); ProbeCount = count; } } private void UpdateProbeCount(int count) { ProbeCount = count; IniFileHelper.WriteIniData($"{title}", "ProbeCount", ProbeCount.ToString(), countIniPath); if (window != null) window.UpdateProbeCount(ProbeCount); } private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (window == null) { window = new InfoWindow(title, infos); window = new InfoWindow(title, infos, electricChart, ProbeCount); window.Closed += Window_Closed; window.ClearProbeCountEvent += Window_ClearProbeCountEvent; window.Owner = Window.GetWindow(this); window.Show(); } @@ -127,6 +163,11 @@ { window.Activate(); } } private void Window_ClearProbeCountEvent(object sender, EventArgs e) { UpdateProbeCount(0); } private void Window_Closed(object sender, EventArgs e) @@ -137,12 +178,10 @@ public void SetStatus(string status) { this.status = status; } public void SetInfos(List<Info> infos) { this.infos = new ObservableCollection<Info>(infos); if (window != null) window.UpdateSource(this.infos); if (status == "testing") { UpdateProbeCount(ProbeCount + 1); } } public void SetInfos(Info info) @@ -183,5 +222,47 @@ if (window != null) window.UpdateSource(this.infos); } private Chart electricChart = new Chart("电流曲线(A)", false, 20); public void AddElectricData(double data) { electricChart.AddData(data); } public void ClearElectricData() { electricChart.Clear(); } public void SaveElectricDataToCSV(string filePath) { try { List<double> datas = electricChart?.GetSingleData(); FileInfo fi = new FileInfo(filePath); if (!fi.Directory.Exists) { fi.Directory.Create(); //文件不存在,创建文件 } using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write)) using (StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8)) { string title = "电流数据(A)"; sw.WriteLine(title); if (datas != null) { for (int i = 0; i < datas.Count; i++) { sw.WriteLine(datas[i].ToString()); } } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } } Plugin.TestResult/TestResultView.xaml.cs
@@ -90,21 +90,21 @@ Random random = new Random(i * 13); sb.Elapsed += (s, e) => { table.RefreshCount(1, 0); table.SetTemperature(random.Next(100)); for (int j = 0; j < 3; j++) { table.SetTemperature(j + "89", random.Next(100)); } table.SetOkCount(random.Next(100)); table.SetNgCount(random.Next(100)); //table.SetOkCount(random.Next(100)); //table.SetNgCount(random.Next(100)); table.SetStatus(CommonStatus.GetRandomStatus()); table.SetStartTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); table.SetEndTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); table.SetConsumeTime(random.Next(10000)); tables[0].GetSingleCell(0).AddElectricData(random.Next(100)); var cell = table.GetSingleCell(random.Next(table.GetSize())); var cell = tables[0].GetSingleCell(0);//table.GetSingleCell(random.Next(table.GetSize())); cell.SetStatus(CommonStatus.GetRandomStatus()); cell.SetInfos(new Info { @@ -155,7 +155,7 @@ public DataTable GetDataTable(int index) { if (index > 0 && index < tables.Length) return tables[index]; if (index >= 0 && index < tables.Length) return tables[index]; return null; } @@ -394,6 +394,36 @@ tables[ovenIndex].SaveTempFile(folder); return; } if (MethodCode == 13) { /// 添加电流数据 strData = e.uiMsg.StringData; string[] datas = strData.Split(';'); int ovenIndex = int.Parse(datas[0]); int cellIndex = int.Parse(datas[1]); double eData = double.Parse(datas[2]); tables[ovenIndex].GetSingleCell(cellIndex).AddElectricData(eData); return; } if (MethodCode == 14) { /// 清空电流数据 strData = e.uiMsg.StringData; int ovenIndex = int.Parse(strData); tables[ovenIndex].ClearElectricData(); return; } if (MethodCode == 15) { /// 清空电流数据 strData = e.uiMsg.StringData; string[] datas = strData.Split(';'); int ovenIndex = int.Parse(datas[0]); int cellIndex = int.Parse(datas[1]); string filePath = datas[2]; tables[ovenIndex].GetSingleCell(cellIndex).SaveElectricDataToCSV(filePath); return; } } catch (Exception ex) { @@ -447,8 +477,9 @@ } } public void SetOvenProduct(int index, string product) { public void SetOvenProduct(int index, string product) { } } } Plugin.TestResult/ViewControl.xaml.cs
@@ -72,14 +72,19 @@ testResultView.testApp.ExecutionClosed += new _ApplicationMgrEvents_ExecutionClosedEventHandler(this.axApplicationMgr_ExecutionClosed); } public TestResultView View { get => testResultView; } public override void InitFinish() { base.InitFinish(); string path = Path.Combine(BaseFolder, "Count.ini"); testResultView.SetCountIniPath(path); testResultView.InitMainGrid(); LoadProduct(); testResultView.InitTestStandEngine(); LoadProduct(); } public override void DoClose(object sender, EventArgs e) @@ -167,7 +172,13 @@ } testResultView.SetProductSource(productSource); if (products.Count > 0) string model = testResultView.engine.Globals.GetValString("ProductModel", 0); if (!string.IsNullOrEmpty(model)) { this.modelSelect.SelectedItem = model; testResultView.SetCurrentProduct(model); } else if (products.Count > 0) { this.modelSelect.SelectedIndex = 0; testResultView.SetCurrentProduct(products[0].Name); @@ -178,7 +189,8 @@ { try { List<ParameterData> parameters = ProductManager.GetParametersByProductName(this.modelSelect.SelectedItem.ToString()); string currentModel = this.modelSelect.SelectedItem.ToString(); List<ParameterData> parameters = ProductManager.GetParametersByProductName(currentModel); //MessageBox.Show("ParaFile:" + ParaFile + "ParaCount:" + this.parameterManager.Parameters.Count.ToString()); //this.TestTemperature = Convert.ToDouble(this.parameterManager.Find("TestTemperature").ParmValue); //this.TestTime = Convert.ToInt32(this.parameterManager.Find("TestTime").ParmValue); @@ -187,6 +199,9 @@ //this.Time_Heating_Low = Convert.ToDouble(this.parameterManager.Find("Time_Heat_Low").ParmValue); //this.Time_Heating_High = Convert.ToDouble(this.parameterManager.Find("Time_Heat_High").ParmValue); testResultView.testSeqFile = parameters.FirstOrDefault(p => p.Name == "TestSequence")?.Value; testResultView.engine.Globals.SetValString("ProductModel", 0, currentModel); testResultView.engine.CommitGlobalsToDisk(promptOnSaveConflicts: false); } catch (Exception ex) { WPFProject/App.config
@@ -3,7 +3,7 @@ <configSections> <section name="TestResultConfig" type="System.Configuration.SingleTagSectionHandler" /> </configSections> <TestResultConfig Row="1" Column="2" PortStart="6660" /> <TestResultConfig Row="2" Column="3" PortStart="6660" PositionColumn="3" PositionCount="18" /> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> </startup> WPFProject/BuildCmd.txt
File was renamed from WPFProject/TextFile1.txt @@ -13,6 +13,7 @@ move /y "$(TargeDir)Plugin.TsExecution.dll" $(TargeDir)Plugin\Plugin.TsExecution.dll" move /y "$(TargeDir)Plugin.ServoManage.dll" $(TargeDir)Plugin\Plugin.ServoManage.dll" move /y "$(TargeDir)Plugin.DOControl.dll" $(TargeDir)Plugin\Plugin.DOControl.dll" move /y "$(TargeDir)Plugin.TestBuilder.dll" $(TargeDir)Plugin\Plugin.TestBuilder.dll" setlocal enabledelayedexpansion WPFProject/Controls/MainTabControl.xaml.cs
@@ -1,6 +1,5 @@ using HMI.Base; using HMI.Core.Api; using Microsoft.DwayneNeed.Interop; using Panuon.WPF.UI; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -9,9 +8,6 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Forms.Integration; using System.Windows.Media; using WPFProject.UI; namespace WPFProject.Controls { @@ -42,7 +38,6 @@ private WinFormHolder winFormHolder; public MainTabControl() { IPlugin plugin = new WorkControl(); MenuItems = new ObservableCollection<PluginInfo>(PluginLoader.GetLoader().Menus); SubMenuItems = MenuItems[0].Children; this.DataContext = this; WPFProject/Controls/MenuTabControl.xaml.cs
@@ -1,11 +1,10 @@ using System; using HMI.Core.Api; using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; using HMI.Core.Api; using WPFProject.UI; namespace WPFProject.Controls { @@ -99,26 +98,26 @@ public MenuTabControl() { IPlugin plugin = new WorkControl(); ChildTabChanged += plugin.OnTabChange; //IPlugin plugin = new WorkControl(); //ChildTabChanged += plugin.OnTabChange; DataContext = this; InitializeComponent(); Items = new ObservableCollection<IconTabItem> { new IconTabItem(){ Header="111", Children = new ObservableCollection<IconTabItem>{ new IconTabItem(){ Header = "112", Content = plugin } } }, new IconTabItem(){ Header="222", Children = new ObservableCollection<IconTabItem>() } }; //DataContext = this; //InitializeComponent(); //Items = new ObservableCollection<IconTabItem> { //new IconTabItem(){ // Header="111", // Children = new ObservableCollection<IconTabItem>{ // new IconTabItem(){ // Header = "112", // Content = plugin // } // } //}, //new IconTabItem(){ // Header="222", // Children = new ObservableCollection<IconTabItem>() //} //}; } private void UserControl_Loaded(object sender, RoutedEventArgs e) WPFProject/Entity/PluginSettingInfo.cs
File was deleted WPFProject/Forms/Form1.Designer.cs
File was deleted WPFProject/Forms/Form1.cs
File was deleted WPFProject/MainWindow.xaml
@@ -5,7 +5,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WPFProject" xmlns:ctl="clr-namespace:WPFProject.Controls" xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI" xmlns:utils="clr-namespace:WPFProject.Utils" WindowStyle="None" ResizeMode="NoResize" WPFProject/Models/NotifyBase.cs
File was deleted WPFProject/UI/StepSetting.xaml
File was deleted WPFProject/UI/StepSetting.xaml.cs
File was deleted WPFProject/UI/Test/FunctionSetting.xaml
File was deleted WPFProject/UI/WorkWindow.xaml
@@ -4,7 +4,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WPFProject.UI" xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI" mc:Ignorable="d" Loaded="Window_Loaded" Height="450" Width="800"> @@ -15,19 +14,17 @@ </Grid.RowDefinitions> <TextBlock Text="99999999999999"/> <!--停靠布局,让菜单栏和工具栏位于窗口顶部--> <mdi:MdiContainer Name="Container" Grid.Row="1"> <mdi:MdiContainer.Menu> <Menu DockPanel.Dock="Top"> <MenuItem Header="文件"> <!--菜单项为MenuItem,文字使用属性 Header--> <MenuItem Name="newFile" Header="新建"></MenuItem> <Grid Name="Container" Grid.Row="1"> <Menu DockPanel.Dock="Top"> <MenuItem Header="文件"> <!--菜单项为MenuItem,文字使用属性 Header--> <MenuItem Name="newFile" Header="新建"></MenuItem> </MenuItem> <MenuItem Header="节点"></MenuItem> <MenuItem Header="窗口" x:Name="WindowsMenu" x:FieldModifier="private" /> <MenuItem Header="关于"></MenuItem> </Menu> </mdi:MdiContainer.Menu> </mdi:MdiContainer> </MenuItem> <MenuItem Header="节点"></MenuItem> <MenuItem Header="窗口" x:Name="WindowsMenu" x:FieldModifier="private" /> <MenuItem Header="关于"></MenuItem> </Menu> </Grid> </Grid> </Window> WPFProject/UI/WorkWindow.xaml.cs
@@ -1,18 +1,4 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using WPF.MDI; using WPFProject.Utils; using System.Windows; namespace WPFProject.UI { WPFProject/Utils/CommonLogger.cs
@@ -6,6 +6,9 @@ namespace WPFProject.Utils { /// <summary> /// 往sqlite写日志 /// </summary> class CommonLogger : ILogWriter { private static ILog log = LogManager.GetLogger("CommonLogger"); WPFProject/Utils/LogCleanner.cs
@@ -9,6 +9,9 @@ namespace WPFProject.Utils { /// <summary> /// 自动日志清理 /// </summary> public class LogCleanner { @@ -24,7 +27,8 @@ timer.Interval = ms; timer.Elapsed += Timer_Elapsed; timer.Enabled = true; Task.Run(() => { Task.Run(() => { Clean(); }); } WPFProject/Utils/XmlUtil.cs
File was deleted WPFProject/ViewModels/ProgramListViewModel.cs
File was deleted WPFProject/WPFProject.csproj
@@ -98,15 +98,6 @@ <ApplicationManifest>Properties\app.manifest</ApplicationManifest> </PropertyGroup> <ItemGroup> <Reference Include="AIStudio.Wpf.Controls, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>packages\AIStudio.Wpf.Controls.1.2.2\lib\net461\AIStudio.Wpf.Controls.dll</HintPath> </Reference> <Reference Include="GongSolutions.WPF.DragDrop, Version=3.0.0.0, Culture=neutral, PublicKeyToken=91f1945125b7a587, processorArchitecture=MSIL"> <HintPath>packages\gong-wpf-dragdrop.3.2.1\lib\net47\GongSolutions.WPF.DragDrop.dll</HintPath> </Reference> <Reference Include="HandyControl, Version=3.4.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL"> <HintPath>packages\HandyControl.3.4.0\lib\net472\HandyControl.dll</HintPath> </Reference> <Reference Include="log4net, Version=3.0.4.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <HintPath>packages\log4net.3.0.4\lib\net462\log4net.dll</HintPath> </Reference> @@ -115,9 +106,6 @@ </Reference> <Reference Include="Microsoft.DwayneNeed.Win32"> <HintPath>..\Libs\Microsoft.DwayneNeed.Win32.dll</HintPath> </Reference> <Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath> </Reference> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> @@ -135,41 +123,6 @@ <Reference Include="System.Configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath> <Private>True</Private> <Private>True</Private> </Reference> <Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath> <Private>True</Private> <Private>True</Private> </Reference> <Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath> <Private>True</Private> <Private>True</Private> </Reference> <Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath> <Private>True</Private> <Private>True</Private> </Reference> <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath> <Private>True</Private> <Private>True</Private> </Reference> <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath> <Private>True</Private> <Private>True</Private> </Reference> <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath> <Private>True</Private> <Private>True</Private> </Reference> <Reference Include="System.Web" /> <Reference Include="System.Web.Extensions" /> <Reference Include="System.Windows.Forms" /> @@ -186,9 +139,6 @@ <Reference Include="PresentationCore" /> <Reference Include="PresentationFramework" /> <Reference Include="WindowsFormsIntegration" /> <Reference Include="WPF.MDI, Version=1.1.4.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>packages\WPF.MDI.1.1.4\lib\net40-client\WPF.MDI.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <ApplicationDefinition Include="App.xaml"> @@ -202,9 +152,6 @@ <Compile Include="Controls\HolderForm.Designer.cs"> <DependentUpon>HolderForm.cs</DependentUpon> </Compile> <Compile Include="Controls\InnerWindow.xaml.cs"> <DependentUpon>InnerWindow.xaml</DependentUpon> </Compile> <Compile Include="Controls\MainTabControl.xaml.cs"> <DependentUpon>MainTabControl.xaml</DependentUpon> </Compile> @@ -214,91 +161,42 @@ <Compile Include="Controls\MaskControl.Designer.cs"> <DependentUpon>MaskControl.cs</DependentUpon> </Compile> <Compile Include="Controls\MinInnerWindow.xaml.cs"> <DependentUpon>MinInnerWindow.xaml</DependentUpon> </Compile> <Compile Include="Controls\WinFormHolder.xaml.cs"> <DependentUpon>WinFormHolder.xaml</DependentUpon> </Compile> <Compile Include="Entity\PluginLoadMessage.cs" /> <Compile Include="Entity\PluginSettingInfo.cs" /> <Compile Include="Forms\Form1.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Forms\Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile> <Compile Include="LoadingWindow.xaml.cs"> <DependentUpon>LoadingWindow.xaml</DependentUpon> </Compile> <Compile Include="Login.xaml.cs"> <DependentUpon>Login.xaml</DependentUpon> </Compile> <Compile Include="Models\CanvasPosition.cs" /> <Compile Include="Models\FuncModel.cs" /> <Compile Include="Models\NotifyBase.cs" /> <Compile Include="Models\Variable.cs" /> <Compile Include="Models\Program.cs" /> <Compile Include="Models\Sequence.cs" /> <Compile Include="Models\Step.cs" /> <Compile Include="PanuonWindow.xaml.cs"> <DependentUpon>PanuonWindow.xaml</DependentUpon> </Compile> <Compile Include="TestWindow.xaml.cs"> <DependentUpon>TestWindow.xaml</DependentUpon> </Compile> <Compile Include="UI\BottomBar.xaml.cs"> <DependentUpon>BottomBar.xaml</DependentUpon> </Compile> <Compile Include="UI\StepSetting.xaml.cs"> <DependentUpon>StepSetting.xaml</DependentUpon> </Compile> <Compile Include="UI\TestWindow.xaml.cs"> <DependentUpon>TestWindow.xaml</DependentUpon> </Compile> <Compile Include="UI\Test\FunctionSetting.xaml.cs"> <DependentUpon>FunctionSetting.xaml</DependentUpon> </Compile> <Compile Include="UI\Test\ProgramList.xaml.cs"> <DependentUpon>ProgramList.xaml</DependentUpon> </Compile> <Compile Include="UI\Test\SequnceList.xaml.cs"> <DependentUpon>SequnceList.xaml</DependentUpon> </Compile> <Compile Include="UI\WorkControl.xaml.cs"> <DependentUpon>WorkControl.xaml</DependentUpon> </Compile> <Compile Include="UI\WorkWindow.xaml.cs"> <DependentUpon>WorkWindow.xaml</DependentUpon> </Compile> <Compile Include="Utils\BinUtil.cs" /> <Compile Include="Utils\CanvasHelper.cs" /> <Compile Include="Utils\CommonLogger.cs" /> <Compile Include="Utils\DdDragHandler.cs" /> <Compile Include="Utils\DdDropHandler.cs" /> <Compile Include="Utils\Encryptor.cs" /> <Compile Include="Utils\LogCleanner.cs" /> <Compile Include="Utils\MainToastHandler.cs" /> <Compile Include="Utils\Resize.cs" /> <Compile Include="Utils\Win32Helper.cs" /> <Compile Include="Utils\XmlUtil.cs" /> <Compile Include="ViewModels\ProgramListViewModel.cs" /> <Compile Include="Window1.xaml.cs"> <DependentUpon>Window1.xaml</DependentUpon> </Compile> <Page Include="Controls\InnerWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="Controls\MainTabControl.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> <Page Include="Controls\MenuTabControl.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> <Page Include="Controls\MinInnerWindow.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> @@ -334,31 +232,7 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> <Page Include="UI\BottomBar.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\StepSetting.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\TestWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\Test\FunctionSetting.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\Test\ProgramList.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\Test\SequnceList.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Page Include="UI\WorkControl.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> @@ -420,7 +294,7 @@ <Content Include="Icon\JingCeLogo2.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Resource Include="TextFile1.txt" /> <Resource Include="BuildCmd.txt" /> <Resource Include="JingCeLogo2.ico" /> <Resource Include="Icon\t1.png" /> <Resource Include="Icon\t2.png" /> @@ -433,9 +307,6 @@ <Resource Include="Resources\JingCeLogo.png" /> <EmbeddedResource Include="Controls\HolderForm.resx"> <DependentUpon>HolderForm.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Forms\Form1.resx"> <DependentUpon>Form1.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> @@ -570,6 +441,10 @@ <Project>{1853e00f-6865-4bc6-974b-6a5e1c00bafe}</Project> <Name>Plugin.ServoManage</Name> </ProjectReference> <ProjectReference Include="..\Plugin.TestBuilder\Plugin.TestBuilder.csproj"> <Project>{30201ec1-9a82-48db-94b9-bd5c1190228b}</Project> <Name>Plugin.TestBuilder</Name> </ProjectReference> <ProjectReference Include="..\Plugin.TestResult\Plugin.TestResult.csproj"> <Project>{7375b74c-b6bf-4814-9838-e1caacad1897}</Project> <Name>Plugin.TestResult</Name> @@ -596,6 +471,7 @@ <Install>false</Install> </BootstrapperPackage> </ItemGroup> <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> <PostBuildEvent>move /y "$(TargeDir)HMI.Core.dll" $(TargeDir)Libs\HMI.Core.dll" @@ -613,6 +489,7 @@ move /y "$(TargeDir)Plugin.TsExecution.dll" $(TargeDir)Plugin\Plugin.TsExecution.dll" move /y "$(TargeDir)Plugin.ServoManage.dll" $(TargeDir)Plugin\Plugin.ServoManage.dll" move /y "$(TargeDir)Plugin.DOControl.dll" $(TargeDir)Plugin\Plugin.DOControl.dll" move /y "$(TargeDir)Plugin.TestBuilder.dll" $(TargeDir)Plugin\Plugin.TestBuilder.dll" setlocal enabledelayedexpansion WPFProject/WPFProject.sln
@@ -41,9 +41,15 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.ServoManage", "..\Plugin.ServoManage\Plugin.ServoManage.csproj", "{1853E00F-6865-4BC6-974B-6A5E1C00BAFE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpcInterface", "..\..\HMI.Old\OPCInterface\OpcInterface\OpcInterface.csproj", "{E1464149-2C0A-499D-AB90-0C72E6ED1C53}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.DOControl", "..\Plugin.DOControl\Plugin.DOControl.csproj", "{306A83DC-A7DB-4057-BAA7-477D8756F5D9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectionUtil", "..\..\ConnectionUtil\ConnectionUtil\ConnectionUtil.csproj", "{D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OPCClient", "..\OPCClient\OPCClient.csproj", "{E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.TestBuilder", "..\Plugin.TestBuilder\Plugin.TestBuilder.csproj", "{30201EC1-9A82-48DB-94B9-BD5C1190228B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.SNGenerateTool", "..\Plugin.SNGenerateTool\Plugin.SNGenerateTool.csproj", "{3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -205,22 +211,46 @@ {1853E00F-6865-4BC6-974B-6A5E1C00BAFE}.Release|Any CPU.Build.0 = Release|Any CPU {1853E00F-6865-4BC6-974B-6A5E1C00BAFE}.Release|x64.ActiveCfg = Release|Any CPU {1853E00F-6865-4BC6-974B-6A5E1C00BAFE}.Release|x64.Build.0 = Release|Any CPU {E1464149-2C0A-499D-AB90-0C72E6ED1C53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1464149-2C0A-499D-AB90-0C72E6ED1C53}.Debug|Any CPU.Build.0 = Debug|Any CPU {E1464149-2C0A-499D-AB90-0C72E6ED1C53}.Debug|x64.ActiveCfg = Debug|x64 {E1464149-2C0A-499D-AB90-0C72E6ED1C53}.Debug|x64.Build.0 = Debug|x64 {E1464149-2C0A-499D-AB90-0C72E6ED1C53}.Release|Any CPU.ActiveCfg = Release|Any CPU {E1464149-2C0A-499D-AB90-0C72E6ED1C53}.Release|Any CPU.Build.0 = Release|Any CPU {E1464149-2C0A-499D-AB90-0C72E6ED1C53}.Release|x64.ActiveCfg = Release|Any CPU {E1464149-2C0A-499D-AB90-0C72E6ED1C53}.Release|x64.Build.0 = Release|Any CPU {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Debug|Any CPU.Build.0 = Debug|Any CPU {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Debug|x64.ActiveCfg = Debug|Any CPU {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Debug|x64.Build.0 = Debug|Any CPU {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Debug|x64.ActiveCfg = Debug|x64 {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Debug|x64.Build.0 = Debug|x64 {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Release|Any CPU.ActiveCfg = Release|Any CPU {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Release|Any CPU.Build.0 = Release|Any CPU {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Release|x64.ActiveCfg = Release|Any CPU {306A83DC-A7DB-4057-BAA7-477D8756F5D9}.Release|x64.Build.0 = Release|Any CPU {D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}.Debug|x64.ActiveCfg = Debug|Any CPU {D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}.Debug|x64.Build.0 = Debug|Any CPU {D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}.Release|Any CPU.Build.0 = Release|Any CPU {D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}.Release|x64.ActiveCfg = Release|Any CPU {D0806FA6-3F6D-4304-81B8-EAD9DA7CB5B2}.Release|x64.Build.0 = Release|Any CPU {E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}.Debug|Any CPU.Build.0 = Debug|Any CPU {E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}.Debug|x64.ActiveCfg = Debug|Any CPU {E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}.Debug|x64.Build.0 = Debug|Any CPU {E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}.Release|Any CPU.ActiveCfg = Release|Any CPU {E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}.Release|Any CPU.Build.0 = Release|Any CPU {E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}.Release|x64.ActiveCfg = Release|Any CPU {E5740BB5-9FC6-4A20-B7C2-CC90C281ED05}.Release|x64.Build.0 = Release|Any CPU {30201EC1-9A82-48DB-94B9-BD5C1190228B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {30201EC1-9A82-48DB-94B9-BD5C1190228B}.Debug|Any CPU.Build.0 = Debug|Any CPU {30201EC1-9A82-48DB-94B9-BD5C1190228B}.Debug|x64.ActiveCfg = Debug|x64 {30201EC1-9A82-48DB-94B9-BD5C1190228B}.Debug|x64.Build.0 = Debug|x64 {30201EC1-9A82-48DB-94B9-BD5C1190228B}.Release|Any CPU.ActiveCfg = Release|Any CPU {30201EC1-9A82-48DB-94B9-BD5C1190228B}.Release|Any CPU.Build.0 = Release|Any CPU {30201EC1-9A82-48DB-94B9-BD5C1190228B}.Release|x64.ActiveCfg = Release|Any CPU {30201EC1-9A82-48DB-94B9-BD5C1190228B}.Release|x64.Build.0 = Release|Any CPU {3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}.Debug|x64.ActiveCfg = Debug|Any CPU {3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}.Debug|x64.Build.0 = Debug|Any CPU {3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}.Release|Any CPU.Build.0 = Release|Any CPU {3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}.Release|x64.ActiveCfg = Release|Any CPU {3E18AF3F-8212-45A5-A6E3-F5B1CFA3AFAE}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE WPFProject/packages.config
@@ -1,19 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="AIStudio.Wpf.Controls" version="1.2.2" targetFramework="net472" /> <package id="gong-wpf-dragdrop" version="3.2.1" targetFramework="net472" /> <package id="HandyControl" version="3.4.0" targetFramework="net472" /> <package id="log4net" version="3.0.4" targetFramework="net472" /> <package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.39" targetFramework="net472" /> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" /> <package id="Panuon.WPF" version="1.1.3" targetFramework="net472" /> <package id="Panuon.WPF.UI" version="1.3.0.2" targetFramework="net472" /> <package id="System.IO" version="4.3.0" targetFramework="net472" /> <package id="System.Net.Http" version="4.3.4" targetFramework="net472" /> <package id="System.Runtime" version="4.3.0" targetFramework="net472" /> <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net472" /> <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" /> <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" /> <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net472" /> <package id="WPF.MDI" version="1.1.4" targetFramework="net472" /> </packages>