刘彬 пре 1 година
родитељ
комит
852f4065ae
61 измењених фајлова са 6869 додато и 0 уклоњено
  1. 62 0
      App.config
  2. 9 0
      App.xaml
  3. 38 0
      App.xaml.cs
  4. 475 0
      Communication/S7PlcCommunicate.cs
  5. 248 0
      Communication/SerialCommunication.cs
  6. 194 0
      Core/FileHelper.cs
  7. 676 0
      Core/Management.cs
  8. 36 0
      Core/TipService.cs
  9. 111 0
      DataBase/SqlSugarHelper.cs
  10. 339 0
      DefaultEdit.csproj
  11. 25 0
      DefaultEdit.sln
  12. 19 0
      Enums/Terminator.cs
  13. 161 0
      HttpService/ApiHelper.cs
  14. 137 0
      HttpService/HttpWebResponseUtility.cs
  15. 61 0
      HttpService/IServer.cs
  16. 81 0
      HttpService/MesServer.cs
  17. 169 0
      HttpService/TicketPrinterHelper.cs
  18. 90 0
      Log4xml/LogHelper.cs
  19. 278 0
      Log4xml/log4net.config
  20. 35 0
      Model/CurentApplicationSettings.cs
  21. 52 0
      Model/CurrConfig.cs
  22. 20 0
      Model/DescriptionItem.cs
  23. 20 0
      Model/PrintModel.cs
  24. 225 0
      Model/ProcessDataModel.cs
  25. 45 0
      Model/ProjectData.cs
  26. 13 0
      Model/Re_Items.cs
  27. 41 0
      Model/Re_ModelsInfo.cs
  28. 24 0
      Model/Re_PrintTaskDto.cs
  29. 23 0
      Model/Re_ProductionRecord.cs
  30. 38 0
      Model/Re_UserDto.cs
  31. 26 0
      Model/RfidInfo.cs
  32. 32 0
      Model/Rt_ProductionRecordDto.cs
  33. 45 0
      Model/XnRestfulResult.cs
  34. 25 0
      OpenTK.dll.config
  35. 53 0
      Properties/AssemblyInfo.cs
  36. 63 0
      Properties/Resources.Designer.cs
  37. 117 0
      Properties/Resources.resx
  38. 26 0
      Properties/Settings.Designer.cs
  39. 7 0
      Properties/Settings.settings
  40. 38 0
      ValueConverters/EnumToBoolConverter.cs
  41. 105 0
      ViewModels/MainWindowViewModel.cs
  42. 59 0
      ViewModels/MenuViewModel.cs
  43. 15 0
      ViewModels/ProductViewModel.cs
  44. 206 0
      ViewModels/RoleLoginViewModel.cs
  45. 47 0
      ViewModels/SettingViewModel.cs
  46. 172 0
      ViewModels/WorkRunViewModel.cs
  47. 112 0
      Views/LoadingView.xaml
  48. 28 0
      Views/LoadingView.xaml.cs
  49. 173 0
      Views/MainWindow.xaml
  50. 76 0
      Views/MainWindow.xaml.cs
  51. 190 0
      Views/MenuView.xaml
  52. 15 0
      Views/MenuView.xaml.cs
  53. 433 0
      Views/ProductView.xaml
  54. 15 0
      Views/ProductView.xaml.cs
  55. 347 0
      Views/RoleLoginView.xaml
  56. 20 0
      Views/RoleLoginView.xaml.cs
  57. 140 0
      Views/SettingView.xaml
  58. 15 0
      Views/SettingView.xaml.cs
  59. 441 0
      Views/WorkRunView.xaml
  60. 32 0
      Views/WorkRunView.xaml.cs
  61. 51 0
      packages.config

+ 62 - 0
App.config

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
+  </startup>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Prism" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-8.1.97.5141" newVersion="8.1.97.5141" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Prism.Wpf" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-8.1.97.5141" newVersion="8.1.97.5141" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Unity.Container" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.11.9.0" newVersion="5.11.9.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.0.119.0" newVersion="1.0.119.0" />
+      </dependentAssembly>
+      <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>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+  <entityFramework>
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
+    </providers>
+  </entityFramework>
+  <system.data>
+    <DbProviderFactories>
+      <remove invariant="System.Data.SQLite.EF6" />
+      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
+    <remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
+  </system.data>
+</configuration>

+ 9 - 0
App.xaml

@@ -0,0 +1,9 @@
+<prism:PrismApplication  x:Class="DefaultEdit.App"
+                         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                         xmlns:local="clr-namespace:DefaultEdit"
+                         xmlns:prism="http://prismlibrary.com/">
+    <Application.Resources>
+
+    </Application.Resources>
+</prism:PrismApplication>

+ 38 - 0
App.xaml.cs

@@ -0,0 +1,38 @@
+using DefaultEdit.Core;
+using DefaultEdit.Log4xml;
+using DefaultEdit.Model;
+using DefaultEdit.Views;
+using log4net.Config;
+using Prism.Ioc;
+using Prism.Unity;
+using System.IO;
+using System.Windows;
+
+namespace DefaultEdit
+{
+    /// <summary>
+    /// App.xaml 的交互逻辑
+    /// </summary>
+    public partial class App : PrismApplication
+    {
+        protected override Window CreateShell()
+        {
+            XmlConfigurator.Configure(new FileInfo("Log4xml/log4net.config"));
+            LogHelper.Info("程序启动");
+            return Container.Resolve<MainWindow>();
+        }
+
+        protected override void RegisterTypes(IContainerRegistry containerRegistry)
+        {
+            containerRegistry.RegisterForNavigation<RoleLoginView>("RoleLoginView");
+            containerRegistry.RegisterForNavigation<MenuView>("MenuView");
+            containerRegistry.RegisterForNavigation<ProductView>("ProductView");
+            containerRegistry.RegisterForNavigation<SettingView>("SettingView");
+            containerRegistry.RegisterForNavigation<WorkRunView>("WorkRunView");
+            containerRegistry.RegisterSingleton<Management>();
+
+        }
+
+
+    }
+}

+ 475 - 0
Communication/S7PlcCommunicate.cs

@@ -0,0 +1,475 @@
+using DefaultEdit.Core;
+using DefaultEdit.Log4xml;
+using Sharp7;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Prism.Mvvm;
+using TouchSocket.Sockets;
+using System.Xml;
+using NextTreatMesDemo.Utils;
+using System.Data;
+
+namespace DefaultEdit.Communication
+{
+    public class S7PlcCommunicate : BindableBase
+    {
+
+        private  S7Client client = new S7Client();
+
+        private bool _IsConnected=false;
+        private string IP;
+
+        public S7Client Client { get => client; set => client = value; }
+        public bool IsConnected { get => _IsConnected; set { SetProperty(ref _IsConnected, value); } }
+
+      
+
+        public event Action<string> ConnectedEvent;
+        public event Action<string> DisconnectedEvent;
+        public event Action<string> ReceivedEvent;
+        public event Action<string> SendEvent;
+        public S7PlcCommunicate(string ip)
+        {
+            IP = ip;
+
+        }
+
+        public async Task OpenPlc()
+        {
+
+            var res = Client.ConnectTo(IP, 0, 1);//连接PLC的IP地址
+            if ( res == 0 )
+            {
+                ConnectedEvent += S7PlcCommunicate_ConnectedEvent;
+                DisconnectedEvent += S7PlcCommunicate_DisconnectedEvent;
+                ReceivedEvent += S7PlcCommunicate_ReceivedEvent;
+                IsConnected = true;
+                LogHelper.Info($"Plc {IP}:连接成功");
+            }
+            else
+            {
+
+                IsConnected = false;
+                LogHelper.Info($"Plc{IP}:连接失败");
+            }
+        }
+
+        public async Task ReconnectedPlc()
+        {
+
+            while ( !Client.Connected )
+            {
+                try
+                {
+                    var res = Client.ConnectTo(IP, 0, 1);//连接PLC的IP地址
+                    if ( res == 0 )
+                    {
+                        LogHelper.Info($"Plc {IP}:重连成功");
+                        break;
+                    }
+                    else
+                    {
+                        LogHelper.Info($"Plc {IP}:重连失败");
+                    }
+
+                }
+                catch ( Exception ex )
+                {
+
+                    LogHelper.Error("重连plc出错" + ex.Message);
+                }
+                Thread.Sleep(200);
+            }
+            IsConnected = true;
+        }
+
+      
+        public void StopPlc()
+        {
+            Client.Disconnect();
+        }
+        private void S7PlcCommunicate_ReceivedEvent(string arg2)
+        {
+
+        }
+
+        private void S7PlcCommunicate_DisconnectedEvent(string arg2)
+        {
+            IsConnected = false;
+            ReconnectedPlc();
+        }
+
+        private void S7PlcCommunicate_ConnectedEvent(string arg2)
+        {
+            LogHelper.Info("PLC已连接");
+        }
+
+        public bool ReadBool(int ReadONDBNumber, int ReadStart,int bitStart)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+                    
+                    byte[]buffs=new byte[1];
+                    Client.DBRead(ReadONDBNumber, ReadStart, 1, buffs);
+                    return buffs.GetBitAt(0, bitStart);
+                }
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("plc读取bool异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+           
+            throw new InvalidOperationException‌("PLC未连接");
+
+        }
+
+        public byte[] ReadByte(int ReadONDBNumber, int ReadStart, int byteSize) 
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+
+                    byte[]buffs=new byte[byteSize];
+                    Client.DBRead(ReadONDBNumber, ReadStart, byteSize, buffs);
+                    return buffs;
+                }
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("plc读取bool异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+
+            throw new InvalidOperationException‌("PLC未连接");
+
+
+        }
+
+       
+
+        public bool[] ReadBools(int ReadONDBNumber, int ReadStart,int bitStart,int bitSize) 
+        {
+
+            try
+            {
+                if ( client.Connected )
+                {
+                    int bytesToRead = CalculateBytesToRead(ReadStart, bitStart, bitSize); // 返回3
+                    byte[]buffs=new byte[bytesToRead];
+                    Client.DBRead(ReadONDBNumber, ReadStart, bytesToRead, buffs);
+                    return ParseBoolArray(buffs, bitStart, bitSize);
+                }
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("plc读取bool数组异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+
+            throw new InvalidOperationException‌("PLC未连接");
+        }
+        /// <summary>
+        /// 两位
+        /// </summary>
+        /// <param name="ReadONDBNumber"></param>
+        /// <param name="ReadStart"></param>
+        /// <returns></returns>
+        /// <exception cref="TimeoutException‌"></exception>
+        /// <exception cref="InvalidOperationException‌"></exception>
+        public short Readshort(int ReadONDBNumber, int ReadStart)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+                  
+                    byte[]buffs=new byte[2];
+                    Client.DBRead(ReadONDBNumber, ReadStart, 2, buffs);
+                    return buffs.GetIntAt(0);
+                }
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("plc读取Ushort异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+
+            throw new InvalidOperationException‌("PLC未连接");
+
+        }
+
+        /// <summary>
+        /// 四位
+        /// </summary>
+        /// <param name="ReadONDBNumber"></param>
+        /// <param name="ReadStart"></param>
+        /// <returns></returns>
+        /// <exception cref="TimeoutException‌"></exception>
+        /// <exception cref="InvalidOperationException‌"></exception>
+        public int ReadInt(int ReadONDBNumber, int ReadStart)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+
+                    byte[]buffs=new byte[4];
+                    Client.DBRead(ReadONDBNumber, ReadStart, 4, buffs);
+                    return buffs.GetDIntAt(0);
+                }
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("plc读取Ushort异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+
+            throw new InvalidOperationException‌("PLC未连接");
+
+        }
+
+        public float Readfloat(int ReadONDBNumber, int ReadStart)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+
+                    byte[]buffs=new byte[4];
+                    Client.DBRead(ReadONDBNumber, ReadStart, 4, buffs);
+                    return buffs.GetRealAt(0);
+                }
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("plc读取Float异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+
+            throw new InvalidOperationException‌("PLC未连接");
+
+        }
+
+        public TimeSpan ReadTime(int ReadONDBNumber, int ReadStart)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+
+                    byte[]buffs=new byte[4];
+                    Client.DBRead(ReadONDBNumber, ReadStart, 4, buffs);
+                    return buffs.GetS7TimespanAt(0);
+                }
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("plc读取Float异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+
+            throw new InvalidOperationException‌("PLC未连接");
+
+        }
+
+        public string ReadString(int ReadONDBNumber, int ReadStart, int ReadSize = 1)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+                  
+                    byte []buffs = new byte[ReadSize];
+                    //读取数据
+                    Client.DBRead(ReadONDBNumber, ReadStart, ReadSize, buffs);
+                    byte[] buffsT = new byte[ buffs[ 1 ] ];
+                    Array.Copy(buffs, 2, buffsT, 0, buffs[ 1 ]);
+                    string str=(Encoding.ASCII.GetString(buffsT)).Trim().TrimEnd('\0') ;
+                    return str;
+                }
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("plc读取String异常" + e.Message);
+            }
+           
+            return null;
+        }
+        public void WriteBool(int WriteONDBNumber, int WriteStart,int bitStart, bool value)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+                   
+                    byte[] res = new byte[1];
+                    client.DBRead(WriteONDBNumber, WriteStart, 1, res);
+                    res.SetBitAt(0, bitStart, value);
+                    client.DBWrite(WriteONDBNumber, WriteStart, 1, res);
+                }
+            }
+            catch ( Exception e )
+            {
+              
+                LogHelper.Error("plc写入bool异常" + e.Message);
+            }
+
+        }
+        public void Writeshort(int WriteONDBNumber, int WriteStart, short value)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+                   
+                    byte[] res = new byte[2];
+                    res.SetIntAt(0, value);
+                    client.DBWrite(WriteONDBNumber, WriteStart, 2, res);
+                }     
+            }
+            catch ( Exception e )
+            {
+               
+                LogHelper.Error("plc写入Ushort异常" + e.Message);
+            }
+           
+        }
+
+        public void Writefloat(int WriteONDBNumber, int WriteStart, float value)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+
+                    byte[] res = new byte[4];
+                    res.SetRealAt(0, value);
+                    client.DBWrite(WriteONDBNumber, WriteStart, 4, res);
+                }
+            }
+            catch ( Exception e )
+            {
+
+                LogHelper.Error("plc写入Float异常" + e.Message);
+            }
+
+        }
+
+
+        public void WriteTime(int WriteONDBNumber, int WriteStart, TimeSpan value)
+        {
+            try
+            {
+                if ( client.Connected )
+                {
+
+                    byte[] res = new byte[4];
+                    res.SetS7TimespanAt(0, value);
+                    client.DBWrite(WriteONDBNumber, WriteStart, 4, res);
+                }
+            }
+            catch ( Exception e )
+            {
+
+                LogHelper.Error("plc写入Float异常" + e.Message);
+            }
+
+        }
+
+
+        public bool GetBitAt(byte[] buffs, int byteStart, int bitStart)
+        {
+            try
+            {
+                return buffs.GetBitAt(byteStart, bitStart);
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("提取bool异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+        }
+
+        public float GetRealAt(byte[] buffs, int byteStart)
+        {
+            try
+            {
+                return buffs.GetRealAt(byteStart);
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("提取float异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+        }
+
+        public short GetShortAt(byte[] buffs, int byteStart)
+        {
+            try
+            {
+                return buffs.GetIntAt(byteStart);
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("提取short异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+        }
+
+        public string GetStringAt(byte[] buffs, int byteStart)
+        {
+            try
+            {
+                return buffs.GetStringAt(byteStart);
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("提取float异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+        }
+        public TimeSpan GetTimeSpanAt(byte[] buffs, int byteStart)
+        {
+            try
+            {
+                return buffs.GetS7TimespanAt(byteStart);
+            }
+            catch ( Exception e )
+            {
+                LogHelper.Error("提取TimeSpan异常" + e.Message);
+                throw new TimeoutException‌("PLC读取异常");
+            }
+        }
+
+
+
+        // 参数说明:startByte-起始字节, startBit-起始位(0-7), bitCount-读取位数
+        int CalculateBytesToRead(int startByte, int startBit, int bitCount)
+        {
+            int totalBits = startByte * 8 + startBit + bitCount; // 全局结束位索引
+            int endByte = (totalBits - 1) / 8; // 结束字节索引(整数除法)
+            return endByte - startByte + 1; // 需要读取的字节数
+        }
+        bool[] ParseBoolArray(byte[] buffer, int startBit, int bitCount)
+        {
+            bool[] results = new bool[bitCount];
+            for ( int i = 0; i < bitCount; i++ )
+            {
+                int globalBit = startBit + i; // 目标位全局偏移
+                int byteIndex = globalBit / 8; // 字节在buffer中的索引
+                int bitIndex = globalBit % 8;  // 位在字节中的索引
+                results[ i ] = S7.GetBitAt(buffer, byteIndex, bitIndex); // 提取位值
+            }
+            return results;
+        }
+
+    }
+}

+ 248 - 0
Communication/SerialCommunication.cs

@@ -0,0 +1,248 @@
+using DefaultEdit.Enums;
+using System;
+using System.Collections.Generic;
+using System.IO.Ports;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TouchSocket.Core;
+using TouchSocket.SerialPorts;
+using TouchSocket.Sockets;
+
+namespace DefaultEdit.Communication
+{
+    public class SerialCommunication : IDisposable
+    {
+
+        /// <summary>
+        /// 串口名称
+        /// </summary>
+        public string PortName { get; private set; }
+
+        /// <summary>
+        /// 波特率
+        /// </summary>
+        public int BaudRate { get; private set; }
+
+        /// <summary>
+        /// 奇偶校验位
+        /// </summary>
+        public Parity Parity { get; private set; }
+
+        /// <summary>
+        /// 停止位
+        /// </summary>
+        public StopBits StopBits { get; private set; }
+
+        /// <summary>
+        /// 数据位
+        /// </summary>
+        public int DataBits { get; private set; }
+
+        public Encoding Encoding { get; set; } = Encoding.ASCII;
+
+        /// <summary>
+        /// 当前连接状态
+        /// </summary>
+        public bool IsConnected
+        {
+            get
+            {
+                if ( client != null )
+                {
+                    return client.Online;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+        }
+
+        private SerialPortClient client;
+        private IWaitingClient<ISerialPortClient, IReceiverResult> WaitClient;
+
+        /// <summary>
+        /// 接收到的数据
+        /// </summary>
+        public string Data { get; private set; }
+
+        /// <summary>
+        /// 连接状态变化事件
+        /// </summary>
+        public event Action<SerialCommunication, bool> ConnectionChanged;
+
+        /// <summary>
+        /// 数据接收事件
+        /// </summary>
+        public event Action<SerialCommunication, string> DataReceived;
+
+        /// <summary>
+        /// 发送数据事件
+        /// </summary>
+        public event Action<SerialCommunication, string> SendData;
+
+
+        public Terminator terminator;
+
+        public SerialCommunication(Terminator terminator, string portName, int baudRate = 9600, Parity parity = Parity.None, StopBits stopBits = StopBits.One, int dataBits = 8)
+        {
+            PortName = portName;
+            BaudRate = baudRate;
+            Parity = parity;
+            StopBits = stopBits;
+            DataBits = dataBits;
+            client = new SerialPortClient();
+            client.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
+            client.Connected = (client, e) =>
+            {
+                ConnectionChanged?.Invoke(this, IsConnected);
+                return EasyTask.CompletedTask;
+            };//成功连接到端口
+            client.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
+            client.Closed = (client, e) =>
+            {
+                ConnectionChanged?.Invoke(this, IsConnected);
+                return EasyTask.CompletedTask;
+            };//从端口断开连接,当连接不成功时不会触发。
+
+            client.Received = async (c, e) =>
+            {
+
+                Data = e.ByteBlock.Span.ToString(Encoding); //接收到数据
+                DataReceived?.Invoke(this, Data);
+            };
+            TouchSocketConfig touchSocket = new TouchSocketConfig();
+            touchSocket.SetSerialPortOption(new SerialPortOption()
+            {
+                BaudRate = BaudRate,//波特率
+                DataBits = DataBits,//数据位
+                Parity = Parity,//校验位
+                PortName = PortName,//COM
+                StopBits = StopBits//停止位
+
+            });
+            if ( terminator == Terminator.None )
+            {
+                touchSocket.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromSeconds(0.8) });
+            }
+
+            if ( terminator == Terminator.CRLF )
+            {
+                touchSocket.SetSerialDataHandlingAdapter(() => new TerminatorPackageAdapter("\r\n"));
+            }
+
+            client.Setup(touchSocket);
+        }
+
+        /// <summary>
+        /// 异步连接到串口扫描枪
+        /// </summary>
+        /// <returns></returns>
+        public async Task<bool> ConnectAsync()
+        {
+            if ( ( await client.TryConnectAsync() ).IsSuccess )
+            {
+                ConnectionChanged?.Invoke(this, IsConnected);
+                //调用CreateWaitingClient获取到IWaitingClient的对象。
+                WaitClient = client.CreateWaitingClient(new WaitingOptions()
+                {
+                    FilterFunc = response => //设置用于筛选的fun委托,当返回为true时,才会响应返回
+                    {
+                        return true;
+                    }
+                });
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 连接到串口扫描枪
+        /// </summary>
+        /// <returns></returns>
+        public bool Connect()
+        {
+            if ( client.TryConnect().IsSuccess )//尝试连接到端口
+            {
+                //调用CreateWaitingClient获取到IWaitingClient的对象。
+                WaitClient = client.CreateWaitingClient(new WaitingOptions()
+                {
+                    FilterFunc = response => //设置用于筛选的fun委托,当返回为true时,才会响应返回
+                    {
+                        return true;
+                    }
+                });
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 断开连接到串口扫描枪
+        /// </summary>
+        public void Disconnect()
+        {
+            if ( IsConnected )
+            {
+                client.Close();
+                ConnectionChanged?.Invoke(this, IsConnected);
+            }
+        }
+
+        /// <summary>
+        /// 发送数据到串口扫描枪,并等待返回数据。
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <param name="millisecondsTimeout"></param>
+        /// <returns></returns>
+        public string SendThenReturn(string msg, int millisecondsTimeout = 5000)
+        {
+            //然后使用SendThenReturn。
+            SendData?.Invoke(this, msg);
+            byte[] returnData = WaitClient.SendThenReturn(Encoding.GetBytes(msg), millisecondsTimeout);
+            DataReceived?.Invoke(this, Encoding.GetString(returnData));
+            return Encoding.GetString(returnData);
+        }
+
+        /// <summary>
+        /// 异步发送数据到串口扫描枪,并等待返回数据。
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <param name="millisecondsTimeout"></param>
+        /// <returns></returns>
+        public async Task<string> SendThenReturnAsync(string msg, int millisecondsTimeout = 5000)
+        {
+            SendData?.Invoke(this, msg);
+            byte[] returnData = await WaitClient.SendThenReturnAsync(Encoding.GetBytes(msg), millisecondsTimeout);
+            DataReceived?.Invoke(this, Encoding.GetString(returnData));
+            return Encoding.GetString(returnData);
+        }
+
+        /// <summary>
+        /// 发送数据到串口扫描枪
+        /// </summary>
+        /// <param name="msg"></param>
+        public void Send(string msg)
+        {
+            if ( IsConnected )
+            {
+                SendData?.Invoke(this, msg);
+                client.Send(Encoding.GetBytes(msg)); //发送数据到串口扫描枪
+            }
+        }
+
+        public void Dispose()
+        {
+            if ( WaitClient != null )
+            {
+                WaitClient = null;
+            }
+            if ( client != null )
+            {
+                client.Dispose();
+                client = null;
+            }
+        }
+    }
+}

+ 194 - 0
Core/FileHelper.cs

@@ -0,0 +1,194 @@
+using DefaultEdit.Model;
+using EasyHttp.Infrastructure;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace DefaultEdit.Core
+{
+    public static class FileHelper
+    {
+
+        private static string  ApplicationConfigurationPath="..//Config//ApplicationConfigurationPath.cfg";
+        /// <summary>
+        /// 写入Json文件
+        /// </summary>
+        /// <param name="obj">对象</param>
+        /// <param name="path">文件路径</param>
+        public static void WriteJsonFile(object obj, string path)
+        {
+            if ( !Directory.Exists(Path.GetDirectoryName(path)) )
+            {
+                Directory.CreateDirectory(Path.GetDirectoryName(path));
+            }
+
+            ////保存参数
+            //JsonSerializer serializer = new JsonSerializer();
+            //TextReader tr = new StringReader(JsonConvert.SerializeObject(obj));
+            //JsonTextReader jtr = new JsonTextReader(tr);
+            //object obj1 = serializer.Deserialize(jtr);
+            //if (obj1 != null)
+            //{
+            //    StringWriter textWriter = new StringWriter();
+            //    JsonTextWriter jsonWriter = new JsonTextWriter(textWriter)
+            //    {
+            //        Formatting = Formatting.Indented,
+            //        Indentation = 4,
+            //        IndentChar = ' '
+            //    };
+            //    serializer.Serialize(jsonWriter, obj1);
+
+            //    using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
+            //    {
+            //        using (StreamWriter sw = new StreamWriter(fs))
+            //        {
+            //            sw.Write(textWriter.ToString());
+            //        }
+            //    }
+            //}
+            //else
+            //{
+            //    using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
+            //    {
+            //        using (StreamWriter sw = new StreamWriter(fs))
+            //        {
+            //            string json = JsonConvert.SerializeObject(obj, Formatting.Indented);
+            //            sw.Write(JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented));
+            //        }
+            //    }
+            //}
+            using ( StreamWriter sw = new StreamWriter(path) )
+            {
+                string json = JsonConvert.SerializeObject(obj, Formatting.Indented);
+                sw.Write(JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented));
+            }
+        }
+
+        /// <summary>
+        /// 读取Json文件
+        /// </summary>
+        /// <typeparam name="T">对象</typeparam>
+        /// <param name="path">文件路径</param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public static T ReadJsonFile<T>(string path)
+        {
+            if ( File.Exists(path) )
+            {
+                string buffer;
+                using ( StreamReader sr = new StreamReader(path) )
+                {
+                    buffer = sr.ReadToEnd();
+                }
+                return JsonConvert.DeserializeObject<T>(buffer);
+            }
+            else
+            {
+                throw new Exception($"文件不存在:[{path}]");
+            }
+        }
+
+        /// <summary>
+        /// 写入文件
+        /// </summary>
+        /// <param name="content">对象</param>
+        /// <param name="path">文件路径</param>
+        public static void WriteFile(string content, string path)
+        {
+            if ( !Directory.Exists(Path.GetDirectoryName(path)) )
+            {
+                Directory.CreateDirectory(Path.GetDirectoryName(path));
+            }
+            using ( StreamWriter sw = new StreamWriter(path) )
+            {
+                sw.Write(content);
+            }
+        }
+
+        /// <summary>
+        /// 读取文件
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public static string ReadFile(string path)
+        {
+            if ( File.Exists(path) )
+            {
+                string buffer;
+                using ( StreamReader sr = new StreamReader(path) )
+                {
+                    buffer = sr.ReadToEnd();
+                }
+                return buffer;
+            }
+            else
+            {
+                throw new Exception($"文件不存在:[{path}]");
+            }
+        }
+
+        /// <summary>
+        /// 读取软件设置参数
+        /// </summary>
+        /// <returns></returns>
+        public static CurentApplicationSettings ReadApplicationConfiguration()
+        {
+            try
+            {
+                var config = FileHelper.ReadJsonFile<CurentApplicationSettings>(ApplicationConfigurationPath);
+                return config;
+            }
+            catch ( Exception )
+            {
+                return new CurentApplicationSettings();
+            }
+        }
+
+        /// <summary>
+        /// 保存软件设置参数
+        /// </summary>
+        /// <param name="config"></param>
+        public static void SaveApplicationConfiguration(CurentApplicationSettings config)
+        {
+            try
+            {
+               // config.DT = DateTime.Now;
+                FileHelper.WriteJsonFile(config, ApplicationConfigurationPath);
+            }
+            catch ( Exception )
+            {
+
+            }
+        }
+
+        /// <summary>
+        /// 检测文件名是否合规
+        /// </summary>
+        /// <param name="filename"></param>
+        /// <returns></returns>
+        public static bool CheckFileName(string filename)
+        {
+            //
+            // 定义文件名合法性的正则表达式
+            string pattern = @"^[^-\\/:*?""<>|\x00-\x1F]*$"; // 匹配不包含非法字符的文件名
+
+            // 使用正则表达式进行匹配
+            if ( Regex.IsMatch(filename, pattern) )
+            {
+                //Console.WriteLine("输入的名称符合文件名命名规则,并且不包含非法字符。");
+                return true;
+            }
+            else
+            {
+                //Console.WriteLine("输入的名称不符合文件名命名规则,或者包含非法字符。");
+                return false;
+            }
+        }
+    }
+}

+ 676 - 0
Core/Management.cs

@@ -0,0 +1,676 @@
+
+using DefaultEdit.Communication;
+using DefaultEdit.Log4xml;
+using DefaultEdit.Model;
+using Newtonsoft.Json.Linq;
+using NextTreatMesDemo.Models;
+using NextTreatMesDemo.Utils;
+using ObservableCollections;
+using Prism.Modularity;
+using Prism.Mvvm;
+using ScottPlot;
+using SqlSugar;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+
+
+namespace DefaultEdit.Core
+{
+    public class Management : BindableBase
+    {
+
+        private CurentApplicationSettings _CurentApplicationSettings=new CurentApplicationSettings();
+
+        private IServer _httpService = new MesServer();
+
+        private S7PlcCommunicate s7PlcCommunicate;
+        public event Action<string,bool> RuningToWorkEvent;
+
+
+        public event Action ProduceDataToChangeEvent;
+
+        private List<RfidInfo> _RfIDList=new List<RfidInfo>();
+        public List<RfidInfo> RfIDList { get => _RfIDList; set => _RfIDList = value; }
+
+        private ObservableCollection<RfidInfo> _RuningData=new ObservableCollection<RfidInfo>();
+        public ObservableCollection<RfidInfo> RuningData { get => _RuningData; set => _RuningData = value; }
+
+        private CurrConfig _currConfig = new CurrConfig();
+
+        public CurrConfig CurrConfig { get => _currConfig; set { SetProperty(ref _currConfig, value); } }
+
+        private DateTime _DateTimeNow;
+        /// <summary>
+        /// 当前时间
+        /// </summary>
+        public DateTime DateTimeNow
+        {
+            get { return _DateTimeNow; }
+            set { SetProperty(ref _DateTimeNow, value); }
+        }
+
+        private  ObservableCollection<string> _CurrStationRfid=new ObservableCollection<string>();
+
+        public ObservableCollection<string> CurrStationRfid { get => _CurrStationRfid; set => _CurrStationRfid = value; }
+
+        /// <summary>
+        /// 用户Id(从MES接口内获取)
+        /// </summary>
+        private  string _UserId = "";
+        /// <summary>
+        /// 用户名(从MES接口内获取)
+        /// </summary>
+        private  string _UserName = "未登录";
+        /// <summary>
+        /// 用于记录后处理数据来打印小票
+        /// </summary>
+        public ObservableCollection<ProcessDataModel> processDataModels = new ObservableCollection<ProcessDataModel>();
+
+        public double[] ProduceData = new double[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 };
+
+         
+        public IServer HttpService { get => _httpService; set { SetProperty(ref _httpService, value); } }
+
+        public string UserId { get => _UserId; set { SetProperty(ref _UserId, value); } }
+        public string UserName { get => _UserName; set { SetProperty(ref _UserName, value); } }
+
+        public CurentApplicationSettings CurentApplicationSettings { get => _CurentApplicationSettings; set { SetProperty(ref _CurentApplicationSettings, value); } }
+
+
+
+
+
+
+
+
+
+
+        //运行线程
+        private Thread  WorkThread;
+        public Management()
+        {
+            s7PlcCommunicate = new S7PlcCommunicate(CurentApplicationSettings.PlcIP);
+            s7PlcCommunicate.OpenPlc();
+            for ( int i = 0; i < 6; i++ )
+            {
+                CurrStationRfid.Add("");
+            }
+
+            RuningToWorkEvent += Management_RuningToWorkEvent; ;
+            WorkThread = new Thread(DataBridging);
+            WorkThread.Name = "Plc读取";
+            WorkThread.IsBackground = true;
+            WorkThread.Start();
+           
+        }
+
+
+        private void Management_RuningToWorkEvent(string key, bool value)
+        {
+            switch ( key )
+            {
+                case "1工位离心开始":
+                    if ( value )
+                    {
+                        if ( RfIDList.Count != 0 )
+                        {
+                            int index= RfIDList.FindIndex(x => x.StationId == 1);
+                            if ( index != -1 )
+                            {
+                                RfIDList[ index ].StationId = 2;
+                                CurrStationRfid[ 1 ] = RfIDList[ index ].Rfid;
+                                LogHelper.Info(RfIDList[ index ].Rfid + " 1工位离心开始");
+                            }
+                            else 
+                            {
+
+                                LogHelper.Info(" 1工位离心开始");
+                            }
+                        }
+                    }
+                    break;
+                case "1工位离心完成":
+                    if ( value )
+                    {
+                        if ( RfIDList.Count != 0 )
+                        {
+                            int index= RfIDList.FindIndex(x => x.StationId == 2);
+                            if ( index != -1 )
+                            {
+                                RfIDList[ index ].StationId = 4;
+                                LogHelper.Info(CurrStationRfid[ 1 ] + " 1工位离心完成");
+                            }
+                            else 
+                            {
+                                LogHelper.Info(" 1工位离心完成");
+
+                            }
+                        }
+                    }
+                    break;
+                case "2工位离心开始":
+                    if ( value )
+                    {
+                        if ( RfIDList.Count != 0 )
+                        {
+                            int index= RfIDList.FindIndex(x => x.StationId == 1);
+                            if ( index != -1 )
+                            {
+                                RfIDList[ index ].StationId = 3;
+                                CurrStationRfid[ 2 ] = RfIDList[ index ].Rfid;
+                                LogHelper.Info(RfIDList[ index ].Rfid + " 2工位离心开始");
+                            }
+                            else 
+                            {
+                                LogHelper.Info( " 2工位离心开始");
+                            }
+                        }
+                    }
+                    break;
+                case "2工位离心完成":
+                    if ( value )
+                    {
+                        if ( RfIDList.Count != 0 )
+                        {
+                            int index= RfIDList.FindIndex(x => x.StationId == 3);
+                            if ( index != -1 )
+                            {
+                                RfIDList[ index ].StationId = 4;
+                                LogHelper.Info(CurrStationRfid[ 2 ] + " 2工位离心完成");
+                            }
+                            else 
+                            {
+                                LogHelper.Info(" 2工位离心完成");
+                            }
+                        }
+                    }
+                    break;
+                case "脱模开始":
+                    if ( value )
+                    {
+                        LogHelper.Info(CurrConfig.Rfid + " 脱模开始");
+                        PlateInPlace(CurrConfig.Rfid);
+                    }
+                    break;
+                case "脱模完成":
+                    if ( value )
+                    {
+                        LogHelper.Info(CurrConfig.Rfid + " 脱模完成");
+                        PrintInfo(processDataModels[0],"");
+                    }
+                    break;
+                case "固化开始":
+                    if ( value )
+                    {
+                        if ( RfIDList.Count != 0 )
+                        {
+                            int index= RfIDList.FindIndex(x => x.StationId ==4 );
+                            if ( index != -1 )
+                            {
+                                RfIDList[ index ].StationId = 5;
+                                CurrStationRfid[ 3 ] = RfIDList[ index ].Rfid;
+                                LogHelper.Info(RfIDList[ index ].Rfid + " 固化开始");
+                            }
+                            else 
+                            {
+                                LogHelper.Info( " 固化开始");
+                            }
+                        }
+                    }
+                    break;
+                case "固化完成":
+                    if ( value )
+                    {
+                        if ( RfIDList.Count != 0 )
+                        {
+                            int index= RfIDList.FindIndex(x => x.StationId ==5 );
+                            if ( index != -1 )
+                            {
+                                RfIDList.RemoveAt(index);
+                                LogHelper.Info(RfIDList[ index ].Rfid + " 固化完成");
+                            }
+                            else 
+                            {
+                                LogHelper.Info( " 固化完成");
+                            }
+                            int hour= DateTime.Now.Hour;
+                            ProduceData[ hour ] = ProduceData[ hour ]+1;
+                            for ( int i = hour+1; i < ProduceData.Length; i++ )
+                            {
+                                ProduceData[ i ] = 0;  
+                            }
+                            ProduceDataToChangeEvent?.Invoke();
+                        }
+
+
+                    }
+                    break;
+                default:
+                    break;
+            }
+
+        }
+        public void DataBridging()
+        {
+
+
+            ObservableDictionary<string,bool> BoolPairs=new ObservableDictionary<string, bool>();
+            BoolPairs.Add("1工位离心开始", false);
+            BoolPairs.Add("1工位离心完成", false);
+            BoolPairs.Add("2工位离心开始", false);
+            BoolPairs.Add("2工位离心完成", false);
+            BoolPairs.Add("脱模开始", false);
+            BoolPairs.Add("脱模完成", false);
+            BoolPairs.Add("固化开始", false);
+            BoolPairs.Add("固化完成", false);
+            BoolPairs.CollectionChanged += BoolPairs_CollectionChanged;
+
+
+
+            while ( true )
+            {
+                try
+                {
+                    if ( s7PlcCommunicate.IsConnected )
+                    {
+                        byte []buff= s7PlcCommunicate.ReadByte(25, 780, 74);
+                        int actuallength=buff[53];
+                        byte[] buffsT = new byte[ actuallength ];
+                        Array.Copy(buff, 54, buffsT, 0, actuallength);
+                        CurrConfig.Rfid = Encoding.ASCII.GetString(buffsT);
+                        BoolPairs[ "1工位离心开始" ] = s7PlcCommunicate.GetBitAt(buff, 0, 0);
+                        BoolPairs[ "1工位离心完成" ] = s7PlcCommunicate.GetBitAt(buff, 0, 1);
+                        BoolPairs[ "2工位离心开始" ] = s7PlcCommunicate.GetBitAt(buff, 1, 0);
+                        BoolPairs[ "2工位离心完成" ] = s7PlcCommunicate.GetBitAt(buff, 1, 1);
+                        BoolPairs[ "脱模开始" ] = s7PlcCommunicate.GetBitAt(buff, 2, 0);
+                        BoolPairs[ "脱模完成" ] = s7PlcCommunicate.GetBitAt(buff, 2, 1);
+                        BoolPairs[ "固化开始" ] = s7PlcCommunicate.GetBitAt(buff, 3, 0);
+                        BoolPairs[ "固化完成" ] = s7PlcCommunicate.GetBitAt(buff, 3, 1);
+                        CurrConfig.Speed = s7PlcCommunicate.GetShortAt(buff, 12);
+                        CurrConfig.Time = s7PlcCommunicate.GetTimeSpanAt(buff, 16);
+                        CurrConfig.Power1_1 = s7PlcCommunicate.GetShortAt(buff, 20);
+                        CurrConfig.Power1_2 = s7PlcCommunicate.GetShortAt(buff, 22);
+                        CurrConfig.Power1_3 = s7PlcCommunicate.GetShortAt(buff, 24);
+                        CurrConfig.Power1_4 = s7PlcCommunicate.GetShortAt(buff, 26);
+                        CurrConfig.Power2_1 = s7PlcCommunicate.GetShortAt(buff, 28);
+                        CurrConfig.Power2_2 = s7PlcCommunicate.GetShortAt(buff, 30);
+                        CurrConfig.Power2_3 = s7PlcCommunicate.GetShortAt(buff, 32);
+                        CurrConfig.Power2_4 = s7PlcCommunicate.GetShortAt(buff, 34);
+                        CurrConfig.Pressure1 = s7PlcCommunicate.GetRealAt(buff, 36);
+                        CurrConfig.Pressure2 = s7PlcCommunicate.GetRealAt(buff, 40);
+                        CurrConfig.PTime1 = s7PlcCommunicate.GetTimeSpanAt(buff, 44);
+                        CurrConfig.PTime2 = s7PlcCommunicate.GetTimeSpanAt(buff, 48);
+                    }
+                }
+                catch
+                {
+
+                }
+
+            }
+        }
+
+        private void BoolPairs_CollectionChanged(in NotifyCollectionChangedEventArgs<KeyValuePair<string, bool>> e)
+        {
+
+            if ( e.NewItem.Value != e.OldItem.Value )
+            {
+                RuningToWorkEvent?.Invoke(e.OldItem.Key, e.NewItem.Value);
+            }
+        }
+
+        private void Serial_ConnectionChanged(SerialCommunication arg1, bool arg2)
+        {
+            if ( arg2 )
+                LogHelper.Info(arg1.PortName + ":已连接");
+            if ( !arg2 )
+                LogHelper.Info(arg1.PortName + ":断开连接");
+        }
+
+        private void Serial_DataReceived(SerialCommunication arg1, string arg2)
+        {
+            LogHelper.Info("收到" + arg1.PortName + $"消息:{arg2}");
+        }
+
+
+
+        /// <summary>
+        /// 网板读取获取数据并上传记录
+        /// </summary>
+        public async Task PlateInPlace(string value)
+        {
+            var IsOK = true;
+            try
+            {
+
+                if ( !string.IsNullOrEmpty(value) )
+                {
+                    try
+                    {
+                        if ( value.Length != 8 )
+                        {
+                            return;
+                        }
+                        else
+                        {
+                            var boardId = value;
+                            string boardguid = Guid.NewGuid().ToString();
+                            var modelsinfo = "";
+                            var materialtype = "";
+                            var printdeviceId = "";
+                            var brand = "";
+                            var printTagProduct = "";
+                            var iskid = false;
+                            var ishaiwai = false;
+                            var isLarge = "无";
+                            var count = 0;
+                            var tip = "";
+                            var isoutline = false;
+                            var groupdata = _httpService.GetGroupItems(boardId, CurentApplicationSettings.DeviceId);
+                            if ( !groupdata.Success )
+                            {
+
+                                if ( groupdata.RawText.Contains("未点检") )
+                                {
+                                    var s = MessageBox.Show("设备未点检,请点检后确认!", "提示", MessageBoxButton.OK);
+
+                                }
+                                LogHelper.MesInfo($"网板ID:{boardId}获取信息失败,Code:{( int ) groupdata.Code},原因:{groupdata.RawText}");
+                                isoutline = true;
+                            }
+                            else
+                            {
+                                if ( groupdata.Data.Count <= 0 )
+                                {
+                                    LogHelper.MesInfo($"网板ID:{boardId}获取信息失败,Code:{( int ) groupdata.Code},原因:{groupdata.RawText}");
+                                    isoutline = true;
+                                }
+                            }
+                            if ( !isoutline )
+                            {
+                                ///上传后处理记录
+                                var result = UpdateRecord(boardId);
+                                if ( !string.IsNullOrEmpty(result) )
+                                {
+                                    LogHelper.MesInfo($"上传记录失败,{result}!");
+                                    var boxresult = MessageBox.Show($"{result}(是:放回;否:重试)", "提示", MessageBoxButton.YesNo);
+                                    if ( boxresult == MessageBoxResult.Yes )
+                                    {
+                                        IsOK = false;
+                                        return;
+                                    }
+
+                                }
+                                ///读取网板内的牙模的信息(方便打印在小票上),如果读取失败就读取下一个牙模,读取成功就跳出循环
+                                for ( int i = 0; i < 10; i++ )
+                                {
+                                    try
+                                    {
+                                        modelsinfo = "";
+                                        count = groupdata.Data.Count;
+                                        var Id = groupdata.Data[groupdata.Data.Count - i].itemId;
+                                        var infos = _httpService.GetModels(Id, CurentApplicationSettings.DeviceId);
+                                        if ( infos.Success )
+                                        {
+                                            modelsinfo = infos.Data.uvcuringReleaseBatch + "  " + infos.Data.alignerSpec.material + "-" + infos.Data.alignerSpec.thickness;
+                                            if ( infos.Data.order.is_expedited == "1" || infos.Data.remade || infos.Data.produceType == "R" )
+                                            {
+                                                modelsinfo = modelsinfo + "\r\n";
+                                                if ( infos.Data.order.is_expedited == "1" )
+                                                {
+                                                    modelsinfo = modelsinfo + "  加急";
+                                                }
+                                                if ( infos.Data.remade )
+                                                {
+                                                    modelsinfo = modelsinfo + "  返工";
+                                                }
+                                                if ( infos.Data.produceType == "R" )
+                                                {
+                                                    modelsinfo = modelsinfo + "  保持器";
+                                                }
+                                            }
+                                            iskid = infos.Data.isKid;
+                                            ishaiwai = infos.Data.order.country.Contains("中国") ? false : true;
+                                            if ( infos.Data.processParameters != null )
+                                            {
+                                                var carrierf = infos.Data.processParameters.FirstOrDefault(x => x.key == "carrier");
+                                                if ( carrierf != null )
+                                                {
+                                                    isLarge = carrierf.value == "small" ? "小载具" : "大载具";
+                                                }
+                                            }
+                                            var record = _httpService.GetProductionRecord(Id);
+                                            if ( record.Success )
+                                            {
+                                                printdeviceId = record.Data.First().deviceId;
+                                                if ( record.Data.First().description.FirstOrDefault(x => x.key == "printTaskId") != null )
+                                                {
+                                                    var taskId = record.Data.First().description.FirstOrDefault(x => x.key == "printTaskId").value;
+                                                    var taskinfo = _httpService.GetPrintTask(taskId);
+                                                    if ( taskinfo.Success )
+                                                    {
+                                                        materialtype = taskinfo.Data.description.FirstOrDefault(x => x.key == "filmType") != null ? taskinfo.Data.description.FirstOrDefault(x => x.key == "filmType").value : "";
+                                                        printTagProduct = taskinfo.Data.description.FirstOrDefault(x => x.key == "printTagProduct") != null ? taskinfo.Data.description.FirstOrDefault(x => x.key == "printTagProduct").value : "";
+                                                        brand = taskinfo.Data.description.FirstOrDefault(x => x.key == "productOfProduce") != null ? taskinfo.Data.description.FirstOrDefault(x => x.key == "productOfProduce").value : "";
+                                                        break;
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                    catch ( Exception e )
+                                    {
+                                        LogHelper.Error("读取网板内牙模信息异常:" + e.ToString());
+                                    }
+                                }
+                            }
+                            else
+                            {
+                                LogHelper.MesInfo($"网板{value}获取数据异常,不上传记录");
+                                modelsinfo = "异常";
+                                materialtype = "异常";
+                                printTagProduct = "异常";
+                                printdeviceId = "异常";
+                                brand = "异常";
+                            }
+                            ///将生产信息记录下,用于在打印完成时打印小票
+                            App.Current.Dispatcher.Invoke(( System.Action ) delegate
+                            {
+                                //添加记录
+                                processDataModels.Add(new ProcessDataModel()
+                                {
+                                    BoardId = boardId,
+                                    ModelsInfo = modelsinfo,
+                                    StartTime = DateTime.Now.ToString("HH:mm:ss"),
+                                    State = ProcessState.入料中,
+                                    BoardGuid = boardguid,
+                                    stopwatch = new System.Diagnostics.Stopwatch(),
+                                    MaterialType = materialtype,
+                                    PrintTagProduct = printTagProduct,
+                                    PrintDeviceId = printdeviceId,
+                                    IsKid = iskid,
+                                    Tip = tip,
+                                    IsOverSea = ishaiwai,
+                                    IsLarge = isLarge,
+                                    Brand = brand,
+                                    Count = count,
+                                });
+                                if ( processDataModels.Count > 10 )
+                                {
+                                    processDataModels.RemoveAt(0);
+                                }
+                                RfidInfo rfidInfo=   new RfidInfo() { Rfid = value, StationId = 1, ModelsInfo=modelsinfo, State="入料中", StartTime=DateTime.Now };
+                                if ( RfIDList.Find(x=>x.Rfid==value)==null )
+                                {
+                                    RfIDList.Add(rfidInfo);
+                                    RuningData.Add(rfidInfo);
+                                }
+                            });
+
+                        }
+                    }
+                    catch ( Exception e )
+                    {
+                        LogHelper.Error("网板读取获取数据异常,原因:" + e.ToString());
+                    }
+                }
+                else
+                {
+                    LogHelper.Info("未读取到网板编号");
+                    //WriteInfo($"未读取到网板编号");
+                }
+            }
+            catch
+            {
+
+            }
+            finally
+            {
+
+            }
+        }
+
+
+
+
+        /// <summary>
+        /// 上传生产记录
+        /// </summary>
+        /// <param name="RfidId">从扫码枪获取的网板Id</param>
+        /// <returns></returns>
+        public string UpdateRecord(string RfidId)
+        {
+            try
+            {
+                Rt_ProductionRecordDto rt_ProductionRecord = new Rt_ProductionRecordDto()
+                {
+                    userId = UserId,///用户Id
+                    creationTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"),///生产时间
+                    deviceId = CurentApplicationSettings.DeviceId,///设备编号
+                    productionType = "UVcuringNextTreat",///生产工序,固定不变
+                    description = new List<DescriptionItem>()
+                    {
+                    ///从扫码枪获取的网板Id
+                    new DescriptionItem(){ key="containerId",value=RfidId},
+                    //后处理配方(根据设备不同参数也不同,具体需要上传什么参数要具体咨询下现场的工艺人员(程朋))
+                    new DescriptionItem(){ key="CentrifugalTime1",value=""},
+                    new DescriptionItem(){ key="CentrifugalTime2",value=""},
+                    new DescriptionItem(){ key="LightSolidifiedTime",value=""},
+                    }
+                };
+                var recordData = _httpService.PostRecord(rt_ProductionRecord);
+                if ( recordData.Success )
+                {
+                    LogHelper.MesInfo($"网板ID:{RfidId}上传记录成功");
+                    return "";
+                }
+                else
+                {
+                    LogHelper.MesInfo($"网板ID:{RfidId}上传记录失败,Code:{( int ) recordData.Code},原因:{recordData.RawText}");
+                    /////记录至数据库
+                    //Rt_AngelNetRecordDto recordDto = new Rt_AngelNetRecordDto()
+                    //{
+                    //    DevcieId = DataPathcs.GetConnectionStringsConfig("DeviceID"),
+                    //    EquipmentType = 4,
+                    //    UserId = UserName,
+                    //    descriptions = new List<Description>() {
+                    //     new Description(){ Key="BoardId",KeyValue=RfidId },
+                    //     new Description(){ Key="Code",KeyValue=recordData.Code.ToString() },
+                    //     new Description(){ Key="RawText",KeyValue=recordData.RawText }
+                    //    }
+                    //};
+                    //var recorddata = alignServer.InsertProductionRecord(recordDto);
+                    return $"{recordData.RawText}";
+                }
+            }
+            catch ( Exception ex )
+            {
+                LogHelper.Error($"网板ID:{RfidId}上传记录异常,原因{ex.Message}");
+                return ex.ToString();
+            }
+
+        }
+
+        /// <summary>
+        /// 小票打印
+        /// </summary>
+        /// <param name="printinfo"></param>
+        /// <param name="Position"></param>
+        public void PrintInfo(ProcessDataModel printinfo, string Position)
+        {
+            try
+            {
+                var pmTitle = new PrintModel
+                {
+                    FontFamily = "宋体",
+                    FontSize = 15,
+                    IsBold = true,
+                    Text = new StringReader("\n" + "<<<<后处理收料信息>>>>") //首行需要空行,某些打印机首行不为空时会出现“首行乱码问题”
+                };
+                var count = 0;
+                if ( printinfo.SolidifyStation != 0 )
+                {
+                    count = printinfo.SolidifyStation % 2 == 1 ? 1 : 2;
+                }
+                var printContent = new StringBuilder();
+                printContent.Append("<<<----------------------------->>>" + "\n");
+                printContent.Append($"出料窗口:{CurentApplicationSettings.DeviceId}" + $",{Position}传送带,第{count}板" + "\n");
+                printContent.Append($"网板编号:{printinfo.BoardId}" + "\n");
+                printContent.Append("出票时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n");
+                printContent.Append("<<<----------------------------->>>" + "\n");
+                printContent.Append(" " + "\n");
+
+                var batchs = new PrintModel
+                {
+                    FontFamily = "宋体",
+                    FontSize = 12,
+                    IsBold = true,
+                    Text = new StringReader(printContent.ToString())
+                };
+                var sb = new StringBuilder();
+                if ( !string.IsNullOrEmpty(printinfo.Tip) )
+                {
+                    sb.Append($"记录上传异常:{printinfo.Tip}" + "\n");
+                }
+                sb.Append($"3D打印设备:{printinfo.PrintDeviceId}" + "\n");
+                sb.Append($"批次:{printinfo.ModelsInfo}" + "\n");
+                sb.Append($"膜片规格:{printinfo.MaterialType}" + "\n");
+                sb.Append($"类型:{printinfo.PrintTagProduct}" + "\n");
+                sb.Append($"品牌:{printinfo.Brand}" + "\n");
+                sb.Append($"是否Kid:{( printinfo.IsKid == true ? "是" : "否" )}" + "\n");
+                sb.Append($"是否海外:{( printinfo.IsOverSea == true ? "是" : "否" )}" + "\n");
+                sb.Append($"大小载具:{printinfo.IsLarge}" + "\n");
+                sb.Append($"数量:{printinfo.Count.ToString()}" + "\n");
+
+                var pmContent2 = new PrintModel
+                {
+                    FontFamily = "宋体",
+                    FontSize = 10,
+                    IsBold = false,
+                    Text = new StringReader(sb.ToString().Trim())
+                };
+                PrintModel[] pms = { pmTitle, batchs, pmContent2 };
+                LogHelper.Info($"打印内容{printContent}" + "\n" + sb + "\n" + "<<<------------------------------->>>");
+                TicketPrinterHelper.Print(pms, CurentApplicationSettings.PrinterName);
+            }
+            catch ( Exception ex )
+            {
+                LogHelper.Error("打印异常,原因:" + ex.ToString());
+            }
+
+        }
+    }
+
+
+
+
+
+}

+ 36 - 0
Core/TipService.cs

@@ -0,0 +1,36 @@
+using DefaultEdit.Views;
+using System;
+
+namespace DefaultEdit.Core
+{
+    public class TipService
+    {
+
+        LoadingView loadingView=new LoadingView();
+
+
+        public TipService()
+        {
+            Tshow();
+        }
+        public void Tshow()
+        {
+
+            loadingView.Show();
+
+        }
+
+        public void Tcolse()
+        {
+            loadingView.Dispatcher.BeginInvoke(new Action(() => loadingView.Close()));
+
+
+        }
+
+        public void ShowMsg(string msg)
+        {
+            loadingView.Dispatcher.BeginInvoke(new Action(() => loadingView.Str = msg));
+        }
+
+    }
+}

+ 111 - 0
DataBase/SqlSugarHelper.cs

@@ -0,0 +1,111 @@
+using DefaultEdit.Model;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+
+namespace DefaultEdit.DataBase
+{
+    public class SqlSugarHelper
+    {
+
+        public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
+        {
+            ConnectionString = "datasource=Project.db",//连接符字串
+            DbType = DbType.Sqlite,//数据库类型
+            IsAutoCloseConnection = true //不设成true要手动close
+        },
+         db =>
+         {
+
+             db.Aop.OnLogExecuting = (sql, pars) =>
+             {
+
+
+                 Console.WriteLine(UtilMethods.GetNativeSql(sql, pars));
+
+
+             };
+
+         });
+
+
+        public static void CreataDatabase()
+        {
+
+            //建库
+            Db.DbMaintenance.CreateDatabase("ProjectData");
+            CreataDataTable();
+        }
+
+
+        public static void CreataDataTable()
+        {
+            //建表 
+            Db.CodeFirst.InitTables<ProjectData>();
+
+            //Db.CodeFirst.InitTables<SettingModel>();
+
+
+        }
+
+
+
+        public static List<ProjectData> QueryablePage(int pagenumber)
+        {
+            return Db.Queryable<ProjectData>().ToPageList(pagenumber, 50);
+        }
+        public static List<ProjectData> QueryableTake()
+        {
+            //查询 
+            return Db.Queryable<ProjectData>().Take(30).OrderBy(it => it.id, OrderByType.Desc).ToList();
+        }
+
+
+        public static List<ProjectData> QueryableProjectData()
+        {
+            //查询 
+            return Db.Queryable<ProjectData>().ToList();
+        }
+
+
+
+        public static List<ProjectData> QueryableBySn(string sn)
+        {
+            //条件查询
+            return Db.Queryable<ProjectData>().Where(it => it.orderId == sn).ToList();
+        }
+
+
+
+
+        public static void Insertable(ProjectData data)
+        {
+
+            //插入
+            Db.Insertable(data).ExecuteCommand();
+        }
+        public static void Updateable(ProjectData data)
+        {
+
+            //更新
+            // Db.Updateable(data).ExecuteCommand(); //注意  需要条件
+        }
+
+
+
+
+
+
+
+        public static void Updateable()
+        {
+
+            //删除
+            Db.Deleteable<ProjectData>().Where(it => it.id == 1).ExecuteCommand();
+        }
+
+
+
+
+    }
+}

+ 339 - 0
DefaultEdit.csproj

@@ -0,0 +1,339 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="packages\OpenCvSharp4.runtime.win.4.10.0.20241108\build\net48\OpenCvSharp4.runtime.win.props" Condition="Exists('packages\OpenCvSharp4.runtime.win.4.10.0.20241108\build\net48\OpenCvSharp4.runtime.win.props')" />
+  <Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
+  <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>{3719CDFC-4396-4749-8A54-E848CEA07CEA}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>DefaultEdit</RootNamespace>
+    <AssemblyName>DefaultEdit</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="EasyHttp, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>packages\EasyHttp.1.7.0\lib\net40\EasyHttp.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
+    <Reference Include="GLWpfControl, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>packages\OpenTK.GLWpfControl.3.3.0\lib\net452\GLWpfControl.dll</HintPath>
+    </Reference>
+    <Reference Include="HarfBuzzSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+      <HintPath>packages\HarfBuzzSharp.7.3.0.3\lib\net462\HarfBuzzSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="JsonFx, Version=2.0.1209.2802, Culture=neutral, PublicKeyToken=315052dd637f8a52, processorArchitecture=MSIL">
+      <HintPath>packages\JsonFx.2.0.1209.2802\lib\net40\JsonFx.dll</HintPath>
+    </Reference>
+    <Reference Include="log4net, Version=3.0.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
+      <HintPath>packages\log4net.3.0.0\lib\net462\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.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.31\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>
+    </Reference>
+    <Reference Include="ObservableCollections, Version=3.3.4.0, Culture=neutral, PublicKeyToken=df4c250b14d82627, processorArchitecture=MSIL">
+      <HintPath>packages\ObservableCollections.3.3.4\lib\netstandard2.0\ObservableCollections.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenTK, Version=3.3.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
+      <HintPath>packages\OpenTK.3.3.1\lib\net20\OpenTK.dll</HintPath>
+    </Reference>
+    <Reference Include="Prism, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
+      <HintPath>packages\Prism.Core.8.1.97\lib\net47\Prism.dll</HintPath>
+    </Reference>
+    <Reference Include="Prism.Unity.Wpf, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
+      <HintPath>packages\Prism.Unity.8.1.97\lib\net47\Prism.Unity.Wpf.dll</HintPath>
+    </Reference>
+    <Reference Include="Prism.Wpf, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
+      <HintPath>packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll</HintPath>
+    </Reference>
+    <Reference Include="ScottPlot, Version=5.0.55.0, Culture=neutral, PublicKeyToken=86698dc10387c39e, processorArchitecture=MSIL">
+      <HintPath>packages\ScottPlot.5.0.55\lib\net462\ScottPlot.dll</HintPath>
+    </Reference>
+    <Reference Include="ScottPlot.WPF, Version=5.0.55.0, Culture=neutral, PublicKeyToken=86698dc10387c39e, processorArchitecture=MSIL">
+      <HintPath>packages\ScottPlot.WPF.5.0.55\lib\net462\ScottPlot.WPF.dll</HintPath>
+    </Reference>
+    <Reference Include="Sharp7, Version=1.1.84.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>packages\Sharp7.1.1.84\lib\net40\Sharp7.dll</HintPath>
+    </Reference>
+    <Reference Include="SkiaSharp, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+      <HintPath>packages\SkiaSharp.2.88.9\lib\net462\SkiaSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="SkiaSharp.HarfBuzz, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+      <HintPath>packages\SkiaSharp.HarfBuzz.2.88.9\lib\net462\SkiaSharp.HarfBuzz.dll</HintPath>
+    </Reference>
+    <Reference Include="SkiaSharp.Views.Desktop.Common, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+      <HintPath>packages\SkiaSharp.Views.Desktop.Common.2.88.9\lib\net462\SkiaSharp.Views.Desktop.Common.dll</HintPath>
+    </Reference>
+    <Reference Include="SkiaSharp.Views.WPF, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+      <HintPath>packages\SkiaSharp.Views.WPF.2.88.9\lib\net462\SkiaSharp.Views.WPF.dll</HintPath>
+    </Reference>
+    <Reference Include="SqlSugar, Version=5.1.4.188, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>packages\SqlSugar.5.1.4.188\lib\SqlSugar.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
+      <HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
+      <HintPath>packages\System.Data.SQLite.EF6.1.0.119.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
+      <HintPath>packages\System.Data.SQLite.Linq.1.0.119.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Drawing.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\System.Drawing.Common.8.0.0\lib\net462\System.Drawing.Common.dll</HintPath>
+    </Reference>
+    <Reference Include="System.IO.Ports, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\System.IO.Ports.8.0.0\lib\net462\System.IO.Ports.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>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>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>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security" />
+    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Web" />
+    <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="TouchSocket, Version=3.1.6.0, Culture=neutral, PublicKeyToken=5f39d7da98dac6a9, processorArchitecture=MSIL">
+      <HintPath>packages\TouchSocket.3.1.6\lib\net472\TouchSocket.dll</HintPath>
+    </Reference>
+    <Reference Include="TouchSocket.Core, Version=3.1.6.0, Culture=neutral, PublicKeyToken=d6c415a2f58eda72, processorArchitecture=MSIL">
+      <HintPath>packages\TouchSocket.Core.3.1.6\lib\net472\TouchSocket.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="TouchSocket.SerialPorts, Version=3.1.6.0, Culture=neutral, PublicKeyToken=b0dfdf1c6b51c716, processorArchitecture=MSIL">
+      <HintPath>packages\TouchSocket.SerialPorts.3.1.6\lib\net472\TouchSocket.SerialPorts.dll</HintPath>
+    </Reference>
+    <Reference Include="Unity.Abstractions, Version=5.11.7.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
+      <HintPath>packages\Unity.Abstractions.5.11.7\lib\net48\Unity.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Unity.Container, Version=5.11.11.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
+      <HintPath>packages\Unity.Container.5.11.11\lib\net48\Unity.Container.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.QuickBuild.Controls" />
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </ApplicationDefinition>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Communication\S7PlcCommunicate.cs" />
+    <Compile Include="Communication\SerialCommunication.cs" />
+    <Compile Include="Core\FileHelper.cs" />
+    <Compile Include="Core\Management.cs" />
+    <Compile Include="Core\TipService.cs" />
+    <Compile Include="DataBase\SqlSugarHelper.cs" />
+    <Compile Include="Enums\Terminator.cs" />
+    <Compile Include="HttpService\ApiHelper.cs" />
+    <Compile Include="HttpService\HttpWebResponseUtility.cs" />
+    <Compile Include="HttpService\IServer.cs" />
+    <Compile Include="HttpService\MesServer.cs" />
+    <Compile Include="HttpService\TicketPrinterHelper.cs" />
+    <Compile Include="Log4xml\LogHelper.cs" />
+    <Compile Include="Model\CurentApplicationSettings.cs" />
+    <Compile Include="Model\CurrConfig.cs" />
+    <Compile Include="Model\DescriptionItem.cs" />
+    <Compile Include="Model\PrintModel.cs" />
+    <Compile Include="Model\ProcessDataModel.cs" />
+    <Compile Include="Model\ProjectData.cs" />
+    <Compile Include="Model\Re_Items.cs" />
+    <Compile Include="Model\Re_ModelsInfo.cs" />
+    <Compile Include="Model\Re_PrintTaskDto.cs" />
+    <Compile Include="Model\Re_ProductionRecord.cs" />
+    <Compile Include="Model\Re_UserDto.cs" />
+    <Compile Include="Model\RfidInfo.cs" />
+    <Compile Include="Model\Rt_ProductionRecordDto.cs" />
+    <Compile Include="Model\XnRestfulResult.cs" />
+    <Compile Include="ValueConverters\EnumToBoolConverter.cs" />
+    <Compile Include="ViewModels\MainWindowViewModel.cs" />
+    <Compile Include="ViewModels\MenuViewModel.cs" />
+    <Compile Include="ViewModels\ProductViewModel.cs" />
+    <Compile Include="ViewModels\RoleLoginViewModel.cs" />
+    <Compile Include="ViewModels\SettingViewModel.cs" />
+    <Compile Include="ViewModels\WorkRunViewModel.cs" />
+    <Compile Include="Views\LoadingView.xaml.cs">
+      <DependentUpon>LoadingView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\MainWindow.xaml.cs">
+      <DependentUpon>MainWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\MenuView.xaml.cs">
+      <DependentUpon>MenuView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\ProductView.xaml.cs">
+      <DependentUpon>ProductView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\RoleLoginView.xaml.cs">
+      <DependentUpon>RoleLoginView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\SettingView.xaml.cs">
+      <DependentUpon>SettingView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\WorkRunView.xaml.cs">
+      <DependentUpon>WorkRunView.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="Log4xml\log4net.config">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="OpenTK.dll.config" />
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Analyzer Include="packages\TouchSocket.Core.3.1.6\analyzers\dotnet\cs\TouchSocket.Core.SourceGenerator.dll" />
+  </ItemGroup>
+  <ItemGroup>
+    <Page Include="Views\LoadingView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\MainWindow.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\MenuView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\ProductView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\RoleLoginView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\SettingView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\WorkRunView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
+    <Error Condition="!Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
+    <Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
+    <Error Condition="!Exists('packages\OpenCvSharp4.runtime.win.4.10.0.20241108\build\net48\OpenCvSharp4.runtime.win.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\OpenCvSharp4.runtime.win.4.10.0.20241108\build\net48\OpenCvSharp4.runtime.win.props'))" />
+    <Error Condition="!Exists('packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets'))" />
+    <Error Condition="!Exists('packages\HarfBuzzSharp.NativeAssets.macOS.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.macOS.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\HarfBuzzSharp.NativeAssets.macOS.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.macOS.targets'))" />
+    <Error Condition="!Exists('packages\HarfBuzzSharp.NativeAssets.Win32.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Win32.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\HarfBuzzSharp.NativeAssets.Win32.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Win32.targets'))" />
+    <Error Condition="!Exists('packages\SkiaSharp.NativeAssets.macOS.2.88.9\build\net462\SkiaSharp.NativeAssets.macOS.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\SkiaSharp.NativeAssets.macOS.2.88.9\build\net462\SkiaSharp.NativeAssets.macOS.targets'))" />
+    <Error Condition="!Exists('packages\SkiaSharp.NativeAssets.Win32.2.88.9\build\net462\SkiaSharp.NativeAssets.Win32.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\SkiaSharp.NativeAssets.Win32.2.88.9\build\net462\SkiaSharp.NativeAssets.Win32.targets'))" />
+    <Error Condition="!Exists('packages\HarfBuzzSharp.NativeAssets.Linux.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Linux.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\HarfBuzzSharp.NativeAssets.Linux.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Linux.targets'))" />
+    <Error Condition="!Exists('packages\SkiaSharp.NativeAssets.Linux.NoDependencies.2.88.9\build\net462\SkiaSharp.NativeAssets.Linux.NoDependencies.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\SkiaSharp.NativeAssets.Linux.NoDependencies.2.88.9\build\net462\SkiaSharp.NativeAssets.Linux.NoDependencies.targets'))" />
+  </Target>
+  <Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
+  <Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
+  <Import Project="packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets" Condition="Exists('packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" />
+  <Import Project="packages\HarfBuzzSharp.NativeAssets.macOS.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.macOS.targets" Condition="Exists('packages\HarfBuzzSharp.NativeAssets.macOS.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.macOS.targets')" />
+  <Import Project="packages\HarfBuzzSharp.NativeAssets.Win32.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Win32.targets" Condition="Exists('packages\HarfBuzzSharp.NativeAssets.Win32.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Win32.targets')" />
+  <Import Project="packages\SkiaSharp.NativeAssets.macOS.2.88.9\build\net462\SkiaSharp.NativeAssets.macOS.targets" Condition="Exists('packages\SkiaSharp.NativeAssets.macOS.2.88.9\build\net462\SkiaSharp.NativeAssets.macOS.targets')" />
+  <Import Project="packages\SkiaSharp.NativeAssets.Win32.2.88.9\build\net462\SkiaSharp.NativeAssets.Win32.targets" Condition="Exists('packages\SkiaSharp.NativeAssets.Win32.2.88.9\build\net462\SkiaSharp.NativeAssets.Win32.targets')" />
+  <Import Project="packages\HarfBuzzSharp.NativeAssets.Linux.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Linux.targets" Condition="Exists('packages\HarfBuzzSharp.NativeAssets.Linux.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Linux.targets')" />
+  <Import Project="packages\SkiaSharp.NativeAssets.Linux.NoDependencies.2.88.9\build\net462\SkiaSharp.NativeAssets.Linux.NoDependencies.targets" Condition="Exists('packages\SkiaSharp.NativeAssets.Linux.NoDependencies.2.88.9\build\net462\SkiaSharp.NativeAssets.Linux.NoDependencies.targets')" />
+</Project>

+ 25 - 0
DefaultEdit.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34728.123
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DefaultEdit", "DefaultEdit.csproj", "{3719CDFC-4396-4749-8A54-E848CEA07CEA}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {CEA61AD8-CE7B-4291-9A66-0AD992DDC7E7}
+	EndGlobalSection
+EndGlobal

+ 19 - 0
Enums/Terminator.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DefaultEdit.Enums
+{
+    /// <summary>
+    /// 结束符
+    /// </summary>
+    public enum Terminator
+    {
+        CR = 0,
+        LF = 1,
+        CRLF = 2,
+        None = 3
+    }
+}

+ 161 - 0
HttpService/ApiHelper.cs

@@ -0,0 +1,161 @@
+using DefaultEdit.Log4xml;
+using EasyHttp.Http;
+using Newtonsoft.Json;
+using NextTreatMesDemo.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Utils
+{
+    public class ApiHelper : HttpClient
+    {
+        public ApiHelper()
+        {
+            this.Request.Accept = HttpContentTypes.ApplicationJson;
+            this.Request.ContentType = "application/json";
+        }
+        public XnRestfulResult<T> ApiGet<T>(string uri, object query = null)
+        {
+            try
+            {
+                var response = ConvertResult<T>(Get(uri, query));
+                //日志记录
+                System.Diagnostics.Debug.WriteLine("ReqMethod:Get,URL:" + uri + $",\r\n Code:{(int)response.Code} Request:" + response.RawText);
+                LogHelper.MesInfo("ReqMethod:Get,URL:" + uri + $",\r\n Code:{(int)response.Code} Request:" + response.RawText);
+                return response;
+            }
+            catch (Exception ex)
+            {
+                LogHelper.MesInfo($"GET异常,原因{ex.Message}");
+                return new XnRestfulResult<T>()
+                {
+                    Data = default(T),
+                    RawText = null,
+                    Success = false,
+                    Message = $"GET异常,原因{ex.Message}"
+                };
+            }
+
+        }
+
+        public XnRestfulResult<T> ApiDelete<T>(string uri, object query = null)
+        {
+            try
+            {
+                var response = ConvertResult<T>(Delete(uri, query));
+                //日志记录
+                System.Diagnostics.Debug.WriteLine("ReqMethod:Delete,URL:" + uri + $",\r\n Code:{(int)response.Code} Request:" + response.RawText);
+                //LogHelper.Write_Info("ReqMethod:Delete,URL:" + uri + $",\r\n Code:{(int)response.Code} Request:" + response.RawText);
+                return response;
+            }
+            catch (Exception ex)
+            {
+                LogHelper.MesInfo($"Delete异常,原因{ex.Message}");
+                return new XnRestfulResult<T>()
+                {
+                    Data = default(T),
+                    RawText = null,
+                    Success = false,
+                    Message = $"Delete异常,原因{ex.Message}"
+                };
+            }
+
+        }
+
+        public XnRestfulResult<T> ApiPost<T>(string uri, object data, string contentType, object query = null)
+        {
+            try
+            {
+                string json = JsonConvert.SerializeObject(data);
+                var response = ConvertResult<T>(Post(uri, json, contentType));
+                //日志记录
+                System.Diagnostics.Debug.WriteLine("ReqMethod: Post, URL: " + uri + $",\r\n Code:{(int)response.Code} Request:" + JsonConvert.SerializeObject(data) + "\r\n Response:" + response.RawText);
+                LogHelper.MesInfo("ReqMethod: Post, URL: " + uri + $",\r\n Code:{(int)response.Code} Request:" + JsonConvert.SerializeObject(data) + "\r\n Response:" + response.RawText);
+                return response;
+            }
+            catch (Exception ex)
+            {
+                LogHelper.MesInfo($"Post异常,原因{ex.Message}");
+                return new XnRestfulResult<T>()
+                {
+                    Data = default(T),
+                    RawText = null,
+                    Success = false,
+                    Message = $"Post异常,原因{ex.Message}"
+                };
+            }
+
+        }
+
+        public XnRestfulResult<T> ApiPut<T>(string uri, object data, string contentType, object query = null)
+        {
+            try
+            {
+                string json = JsonConvert.SerializeObject(data);
+                var response = ConvertResult<T>(Put(uri, json, contentType));
+                //日志记录
+                Console.WriteLine("ReqMethod: Put, URL: " + uri + $",\r\n Code:{(int)response.Code} Request:" + JsonConvert.SerializeObject(data) + "\r\n Response:" + response.RawText);
+                LogHelper.MesInfo("ReqMethod: Put, URL: " + uri + $",\r\n Code:{(int)response.Code} Request:" + JsonConvert.SerializeObject(data) + "\r\n Response:" + response.RawText);
+                return response;
+            }
+            catch (Exception ex)
+            {
+                LogHelper.MesInfo($"PUT异常,原因{ex.Message}");
+                return new XnRestfulResult<T>()
+                {
+                    Data = default(T),
+                    RawText = null,
+                    Success = false,
+                    Message = $"PUT异常,原因{ex.Message}"
+                };
+            }
+
+        }
+
+        private XnRestfulResult<T> ConvertResult<T>(HttpResponse httpResponse)
+        {
+            try
+            {
+
+                XnRestfulResult<T> xnRestfulResult = new XnRestfulResult<T>()
+                {
+                    Code = httpResponse.StatusCode,
+                    RawText = httpResponse.RawText,
+                    Success = false,
+                    Timestamp = httpResponse.Date.Millisecond
+                };
+                //httpcoded
+                //2开头 (请求成功)表示成功处理了请求的状态代码。
+                //3开头 (请求被重定向)表示要完成请求,需要进一步操作。 通常,这些状态代码用来重定向。
+                //4开头 (请求错误)这些状态代码表示请求可能出错,妨碍了服务器的处理。
+                //5开头(服务器错误)这些状态代码表示服务器在尝试处理请求时发生内部错误。 这些错误可能是服务器本身的错误,而不是请求出错。
+                if ((int)httpResponse.StatusCode < 300)
+                {
+                    xnRestfulResult.Success = true;
+                    if (!string.IsNullOrEmpty(httpResponse.RawText))
+                    {
+                        xnRestfulResult.Data = JsonConvert.DeserializeObject<T>(httpResponse.RawText);
+                        //xnRestfulResult.Message = JsonConvert.DeserializeObject<XnRestfulResult<object>>(httpResponse.RawText).Message;
+                    }
+
+                }
+
+                return xnRestfulResult;
+            }
+            catch (Exception ex)
+            {
+                return new XnRestfulResult<T>()
+                {
+                    Code = httpResponse.StatusCode,
+                    Data = default(T),
+                    RawText = $"api调用异常,原因{ex.Message}",
+                    Success = false,
+                    Message = $"api调用异常,原因{ex.Message}"
+                };
+            }
+        }
+    }
+}

+ 137 - 0
HttpService/HttpWebResponseUtility.cs

@@ -0,0 +1,137 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+
+namespace DefaultEdit.HttpService
+{
+    /// <summary>  
+    /// 有关HTTP请求的辅助类  
+    /// </summary>  
+    public class HttpWebResponseUtility
+    {
+        private static readonly string DefaultUserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
+        /// <summary>  
+        /// 创建GET方式的HTTP请求  
+        /// </summary>  
+        /// <param name="url">请求的URL</param>  
+        /// <param name="timeout">请求的超时时间</param>  
+        /// <param name="userAgent">请求的客户端浏览器信息,可以为空</param>  
+        /// <param name="cookies">随同HTTP请求发送的Cookie信息,如果不需要身份验证可以为空</param>  
+        /// <returns></returns>  
+        public static HttpWebResponse CreateGetHttpResponse(string url, int? timeout, string userAgent, CookieCollection cookies)
+        {
+            if ( string.IsNullOrEmpty(url) )
+            {
+                throw new ArgumentNullException("url");
+            }
+            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
+            request.Method = "GET";
+            request.UserAgent = DefaultUserAgent;
+            if ( !string.IsNullOrEmpty(userAgent) )
+            {
+                request.UserAgent = userAgent;
+            }
+            if ( timeout.HasValue )
+            {
+                request.Timeout = timeout.Value;
+            }
+            if ( cookies != null )
+            {
+                request.CookieContainer = new CookieContainer();
+                request.CookieContainer.Add(cookies);
+            }
+            return request.GetResponse() as HttpWebResponse;
+        }
+        /// <summary>  
+        /// 创建POST方式的HTTP请求  
+        /// </summary>  
+        /// <param name="url">请求的URL</param>  
+        /// <param name="parameters">随同请求POST的参数名称及参数值字典</param>  
+        /// <param name="timeout">请求的超时时间</param>  
+        /// <param name="userAgent">请求的客户端浏览器信息,可以为空</param>  
+        /// <param name="requestEncoding">发送HTTP请求时所用的编码</param>  
+        /// <param name="cookies">随同HTTP请求发送的Cookie信息,如果不需要身份验证可以为空</param>  
+        /// <returns></returns>  
+        public static HttpWebResponse CreatePostHttpResponse(string url, IDictionary<string, string> parameters, int? timeout, string userAgent, Encoding requestEncoding, CookieCollection cookies)
+        {
+            if ( string.IsNullOrEmpty(url) )
+            {
+                throw new ArgumentNullException("url");
+            }
+            if ( requestEncoding == null )
+            {
+                throw new ArgumentNullException("requestEncoding");
+            }
+            HttpWebRequest request=null;
+            //如果是发送HTTPS请求  
+            if ( url.StartsWith("https", StringComparison.OrdinalIgnoreCase) )
+            {
+                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
+                request = WebRequest.Create(url) as HttpWebRequest;
+                request.ProtocolVersion = HttpVersion.Version10;
+            }
+            else
+            {
+                request = WebRequest.Create(url) as HttpWebRequest;
+            }
+            request.Method = "POST";
+            request.ContentType = "application/x-www-form-urlencoded";
+
+            if ( !string.IsNullOrEmpty(userAgent) )
+            {
+                request.UserAgent = userAgent;
+            }
+            else
+            {
+                request.UserAgent = DefaultUserAgent;
+            }
+
+            if ( timeout.HasValue )
+            {
+                request.Timeout = timeout.Value;
+            }
+            if ( cookies != null )
+            {
+                request.CookieContainer = new CookieContainer();
+                request.CookieContainer.Add(cookies);
+            }
+            //如果需要POST数据  
+            if ( !( parameters == null || parameters.Count == 0 ) )
+            {
+                StringBuilder buffer = new StringBuilder();
+                int i = 0;
+                foreach ( string key in parameters.Keys )
+                {
+                    if ( i > 0 )
+                    {
+                        buffer.AppendFormat("&{0}={1}", key, parameters[ key ]);
+                    }
+                    else
+                    {
+                        buffer.AppendFormat("{0}={1}", key, parameters[ key ]);
+                    }
+                    i++;
+                }
+                byte[] data = requestEncoding.GetBytes(buffer.ToString());
+                using ( Stream stream = request.GetRequestStream() )
+                {
+                    stream.Write(data, 0, data.Length);
+                }
+            }
+            return request.GetResponse() as HttpWebResponse;
+        }
+
+        private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
+        {
+            return true; //总是接受  
+        }
+
+
+
+
+    }
+}

+ 61 - 0
HttpService/IServer.cs

@@ -0,0 +1,61 @@
+using DefaultEdit.Model;
+using NextTreatMesDemo.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Utils
+{
+    public interface IServer
+    {
+        #region 生产相关
+       
+        /// <summary>
+        /// 上传记录
+        /// </summary>
+        /// <param name="rt_ProductionRecord"></param>
+        /// <returns></returns>
+        XnRestfulResult<object> PostRecord(Rt_ProductionRecordDto rt_ProductionRecord);
+        
+        /// <summary>
+        /// 根据cardid获取用户信息
+        /// </summary>
+        /// <param name="cardId"></param>
+        /// <returns></returns>
+        XnRestfulResult<Re_UserDto> GetUserInfo(string cardId);
+       
+        /// <summary>
+        /// 验证登录信息(账号密码)
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <param name="userPassword"></param>
+        /// <returns></returns>
+        XnRestfulResult<Re_UserDto> GetUserInfoByAccount(string userId, string userPassword);
+        /// <summary>
+        /// 获取容器内容项
+        /// </summary>
+        /// <param name="groupName"></param>
+        /// <param name="DeviceId"></param>
+        /// <returns></returns>
+        XnRestfulResult<List<Re_Items>> GetGroupItems(string groupName, string DeviceId);
+        /// <summary>
+        /// 获取光固化信息
+        /// </summary>
+        /// <param name="modelid"></param>
+        /// <param name="deviceId"></param>
+        /// <returns></returns>
+        XnRestfulResult<Re_ModelsInfo> GetModels(string modelid, string deviceId);
+
+        /// <summary>
+        /// 获取光固化记录
+        /// </summary>
+        /// <param name="modelId"></param>
+        /// <returns></returns>
+        XnRestfulResult<Re_ProductionRecord[]> GetProductionRecord(string modelId);
+        XnRestfulResult<Re_PrintTaskDto> GetPrintTask(string taskId);
+        #endregion
+
+    }
+}

+ 81 - 0
HttpService/MesServer.cs

@@ -0,0 +1,81 @@
+using DefaultEdit.Model;
+using NextTreatMesDemo.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Utils
+{
+    public class MesServer : IServer
+    {
+        /// <summary>
+        /// MES地址(最好写在配置文件内方便维护)
+        /// </summary>
+        public static string MesHead = "https://mes2-web.sw.eainc.com/mes2/rest/";
+
+
+        #region 生产相关
+
+        public XnRestfulResult<Re_ModelsInfo> GetModels(string modelid, string deviceId)
+        {
+            var http = new ApiHelper();
+            var response = http.ApiGet<Re_ModelsInfo>(MesHead + $"models/{modelid}?deviceCode={deviceId}");
+            string responseValue = response.RawText;
+            return response;
+        }
+        public XnRestfulResult<Re_ProductionRecord[]> GetProductionRecord(string modelId)
+        {
+            var http = new ApiHelper();
+            var response = http.ApiGet<Re_ProductionRecord[]>(MesHead + $"productionRecords?modelId={modelId}&productionType=UVcuring");
+            string responseValue = response.RawText;
+            return response;
+        }
+
+        public XnRestfulResult<Re_PrintTaskDto> GetPrintTask(string taskId)
+        {
+            var http = new ApiHelper();
+            var response = http.ApiGet<Re_PrintTaskDto>(MesHead + $"printTasks/{taskId}/info");
+            string responseValue = response.RawText;
+            return response;
+        }
+
+       
+
+        public XnRestfulResult<Re_UserDto> GetUserInfo(string cardId)
+        {
+            var http = new ApiHelper();
+            var response = http.ApiGet<Re_UserDto>(MesHead + $"users?cardId={cardId}");
+            string responseValue = response.RawText;
+            return response;
+        }
+
+        
+       
+        public XnRestfulResult<object> PostRecord(Rt_ProductionRecordDto rt_ProductionRecord)
+        {
+            var http = new ApiHelper();
+            var response = http.ApiPost<object>(MesHead + "productionRecords", rt_ProductionRecord, EasyHttp.Http.HttpContentTypes.ApplicationJson);
+            string responseValue = response.RawText;
+            return response;
+        }
+
+        public XnRestfulResult<Re_UserDto> GetUserInfoByAccount(string userId, string userPassword)
+        {
+            var http = new ApiHelper();
+            var response = http.ApiGet<Re_UserDto>(MesHead + $"users/{userId}?password={userPassword}");
+            string responseValue = response.RawText;
+            return response;
+        }
+        public XnRestfulResult<List<Re_Items>> GetGroupItems(string groupName, string DeviceId)
+        {
+            var http = new ApiHelper();
+            var response = http.ApiGet<List<Re_Items>>(MesHead + $"items?containerId={groupName}&deviceCode={DeviceId}");
+            string responseValue = response.RawText;
+            return response;
+        }
+        #endregion
+
+    }
+}

+ 169 - 0
HttpService/TicketPrinterHelper.cs

@@ -0,0 +1,169 @@
+using NextTreatMesDemo.Models;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+using Brushes = System.Drawing.Brushes;
+using FontStyle = System.Drawing.FontStyle;
+
+namespace NextTreatMesDemo.Utils
+{
+    public class TicketPrinterHelper
+    {
+        //定义一个字符串流,用来接收所要打印的数据
+        private static StringReader sr;
+
+        //打印列表
+        static PrintModel[] PrintModels;
+
+        //二维码
+        static string QrCode;
+
+        //str要打印的数据
+        public static bool Print(string str)
+        {
+            bool result = true;
+            try
+            {
+                sr = new StringReader(str);
+                PrintDocument pd = new PrintDocument();
+                pd.PrintController = new StandardPrintController();
+                //PaperSize pageSize = new PaperSize("Custom", getYc(193), 600);
+                pd.DefaultPageSettings.Margins.Top = 2;
+                pd.DefaultPageSettings.Margins.Left = 10;
+                //pd.DefaultPageSettings.PaperSize = pageSize;
+                pd.PrinterSettings.PrinterName = pd.DefaultPageSettings.PrinterSettings.PrinterName;//默认打印机
+                pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
+                pd.Print();
+            }
+            catch (Exception)
+            {
+                result = false;
+            }
+            finally
+            {
+                if (sr != null)
+                    sr.Close();
+            }
+            return result;
+        }
+
+
+        public static bool Print(PrintModel[] pms, string ptrName)
+        {
+            bool result = true;
+            try
+            {
+                PrintModels = pms;
+                PrintDocument pd = new PrintDocument();
+                pd.PrintController = new StandardPrintController();
+                //PaperSize pageSize = new PaperSize("Custom", getYc(193), 600);
+                pd.DefaultPageSettings.Margins.Top = 2;
+                pd.DefaultPageSettings.Margins.Left = 10;
+                //pd.DefaultPageSettings.PaperSize = pageSize;
+                pd.PrinterSettings.PrinterName = ptrName;// pd.DefaultPageSettings.PrinterSettings.PrinterName;//默认打印机
+                pd.PrintPage += new PrintPageEventHandler(pd_PrintPage1);
+                pd.Print();
+            }
+            catch (Exception)
+            {
+                result = false;
+            }
+            finally
+            {
+                if (sr != null)
+                    sr.Close();
+            }
+            return result;
+        }
+
+        private static int getYc(double cm)
+        {
+
+            return (int)(cm / 25.4) * 100;
+
+        }
+
+        private static void pd_PrintPage(object sender, PrintPageEventArgs ev)
+        {
+            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
+            Font printFont = new Font("Arial", 9);//打印字体
+            float linesPerPage = 0;
+            float yPos = 0;
+            int count = 0;
+            float leftMargin = ev.MarginBounds.Left;
+            float topMargin = ev.MarginBounds.Top;
+            String line = "";
+            linesPerPage = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics);
+            while (count < linesPerPage && ((line = sr.ReadLine()) != null))
+            {
+                //leftMargin = (350 - ev.Graphics.MeasureString(line, printFont).ToSize().Width)/2;
+                yPos = topMargin + (count * printFont.GetHeight(ev.Graphics));
+                ev.Graphics.DrawString(line, printFont, Brushes.Black,
+                   leftMargin, yPos);
+                count++;
+            }
+            //ev.Graphics.DrawImage(QRCodeHelper.CreateQRCode("http://www.baidu.com"), new Point(70, Convert.ToInt32(yPos) + 20));
+            //If more lines exist, print another page.
+            if (line != null)
+                ev.HasMorePages = true;
+            else
+                ev.HasMorePages = false;
+        }
+
+
+        private static void pd_PrintPage1(object sender, PrintPageEventArgs ev)
+        {
+            float yPos = 0;
+            float leftMargin = ev.MarginBounds.Left;
+            float topMargin = ev.MarginBounds.Top;
+            int count = 0;
+            Font printFont;
+            foreach (PrintModel pm in PrintModels)
+            {
+                if (pm.IsBold)
+                {
+                    printFont = new Font(pm.FontFamily, pm.FontSize, FontStyle.Bold);//打印字体
+                }
+                else
+                {
+                    printFont = new Font(pm.FontFamily, pm.FontSize);//打印字体
+                }
+                float linesPerPage = 0;
+                String line = "";
+                linesPerPage = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics);
+                while (count < linesPerPage && ((line = pm.Text.ReadLine()) != null))
+                {
+                    //leftMargin = (350 - ev.Graphics.MeasureString(line, printFont).ToSize().Width)/2;
+                    yPos = topMargin + (count * printFont.GetHeight(ev.Graphics));
+                    ev.Graphics.DrawString(line, printFont, Brushes.Black,
+                       leftMargin, yPos);
+                    count++;
+                }
+                //If more lines exist, print another page.
+                if (line != null)
+                    ev.HasMorePages = true;
+                else
+                    ev.HasMorePages = false;
+                topMargin = topMargin + 20;
+                yPos = yPos + 20;
+            }
+            //if (!string.IsNullOrEmpty(QrCode))
+            //{
+            //    ev.Graphics.DrawImage(QRCodeHelper.CreateQRCode(QrCode), new Point(70, Convert.ToInt32(yPos)));
+            //}
+        }
+    }
+
+    public enum Printer
+    {
+        REGO = 0,
+        DASCOM = 1
+    }
+}

+ 90 - 0
Log4xml/LogHelper.cs

@@ -0,0 +1,90 @@
+using System;
+
+
+namespace DefaultEdit.Log4xml
+{
+    public class LogHelper
+    {
+
+        public delegate void LogChangHandler(Log log);
+
+        public static LogChangHandler logChangHandler;
+        // #region 执行日志
+        private static readonly log4net.ILog infologger = log4net.LogManager.GetLogger("LogInfo");
+        /// <summary>
+        /// 普通日志
+        /// </summary>
+        /// <param name="message">日志内容</param>
+        public static void Info(string message)
+        {
+            // 可以改成type typeof(类)
+            if ( infologger.IsInfoEnabled )
+            {
+                infologger.Info(message);
+                logChangHandler?.Invoke(new Log() { Time = DateTime.Now.ToString("yyyy-MM-dd:HH:mm:ss"), Msg = message });
+            }
+        }
+
+        private static readonly log4net.ILog infologgermes = log4net.LogManager.GetLogger("LogMes");
+        /// <summary>
+        /// 普通日志
+        /// </summary>
+        /// <param name="message">日志内容</param>
+        public static void MesInfo(string message)
+        {
+            // 可以改成type typeof(类)
+            if ( infologgermes.IsInfoEnabled )
+            {
+                infologgermes.Info(message);
+                logChangHandler?.Invoke(new Log() { Time = DateTime.Now.ToString("yyyy-MM-dd:HH:mm:ss"), Msg = message });
+            }
+        }
+
+        
+        private static log4net.ILog alarmlog4net =log4net.LogManager.GetLogger("AlarmLogInfo");
+        /// <summary>
+        /// 警告日志
+        /// </summary>
+        /// <param name="message">警告日志</param>
+        public static void Warn(string message)
+        {
+
+            if ( alarmlog4net.IsWarnEnabled )
+            {
+                alarmlog4net.Warn(message);
+            }
+
+        }
+        private static log4net.ILog Errlog4net =log4net.LogManager.GetLogger("ErrLogInfo");
+        /// <summary>
+        /// 错误日志
+        /// </summary>
+        /// <param name="message">错误日志</param>
+        public static void Error(string message)
+        {
+
+            if ( Errlog4net.IsInfoEnabled )
+            {
+                Errlog4net.Error(message);
+            }
+
+        }
+
+
+    }
+
+
+    public class Log
+    {
+
+        private string time;
+        private string msg;
+
+        public string Time { get => time; set => time = value; }
+        public string Msg { get { return time + " " + msg; } set => msg = value; }
+
+    }
+
+
+
+}

+ 278 - 0
Log4xml/log4net.config

@@ -0,0 +1,278 @@
+<?xml version="1.0" encoding="utf-8" ?>
+      <configuration>
+		<configSections>
+			<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
+		</configSections>
+		<log4net>
+			<!-- 运行日志文件-->
+			<appender name="InfoFileAppender" type="log4net.Appender.RollingFileAppender">
+				<!-- RollingFileAppender以FileAppender为基础 -->
+				<File value="Log\InfoLog" />
+				<!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
+				<param name="AppendToFile" value="true" />
+				<!-- 指定是追加到还是覆盖掉已有的日志文件 -->
+				<!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
+				<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
+				<!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
+				<param name="RollingStyle" value="Composite" />
+				<!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
+				<StaticLogFileName value="false" />
+				<DatePattern value="yyyy\\MM\\dd\\yyyy-MM-dd'.txt'" />
+				<MaxSizeRollBackups value="-1" />
+				<!-- 最多个数为-1无限个-->
+				<MaximumFileSize value="2MB" />
+				<layout type="log4net.Layout.PatternLayout">
+					<conversionPattern value="时间:%date___描述:%message%newline" />
+
+				</layout>
+			</appender>
+
+			<!-- 运行日志文件-->
+			<appender name="MesInfoFileAppender" type="log4net.Appender.RollingFileAppender">
+				<!-- RollingFileAppender以FileAppender为基础 -->
+				<File value="Log\MesLog" />
+				<!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
+				<param name="AppendToFile" value="true" />
+				<!-- 指定是追加到还是覆盖掉已有的日志文件 -->
+				<!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
+				<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
+				<!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
+				<param name="RollingStyle" value="Composite" />
+				<!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
+				<StaticLogFileName value="false" />
+				<DatePattern value="yyyy\\MM\\dd\\yyyy-MM-dd'.txt'" />
+				<MaxSizeRollBackups value="-1" />
+				<!-- 最多个数为-1无限个-->
+				<MaximumFileSize value="2MB" />
+				<layout type="log4net.Layout.PatternLayout">
+					<conversionPattern value="时间:%date___描述:%message%newline" />
+
+				</layout>
+			</appender>
+
+			<!-- 报警日志文件 -->
+			<appender name="AlarmInfoFileAppender" type="log4net.Appender.RollingFileAppender">
+				<!-- RollingFileAppender以FileAppender为基础 -->
+				<File value="Log\AlarmInfo" />
+				<!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
+				<param name="AppendToFile" value="true" />
+				<!-- 指定是追加到还是覆盖掉已有的日志文件 -->
+				<!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
+				<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
+				<!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
+				<param name="RollingStyle" value="Composite" />
+				<!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
+				<StaticLogFileName value="false" />
+				<DatePattern value="yyyy\\MM\\dd\\CSV_yyyy-MM-dd'.txt'" />
+				<MaxSizeRollBackups value="-1" />
+				<!-- 最多个数为-1无限个-->
+				<MaximumFileSize value="2MB" />
+				<layout type="log4net.Layout.PatternLayout">
+					<conversionPattern value="时间:%date___描述:%message%newline" />
+				</layout>
+			</appender>
+
+			<!-- 运行错误日志文件 -->
+			<appender name="ErrFileAppender" type="log4net.Appender.RollingFileAppender">
+				<!-- RollingFileAppender以FileAppender为基础 -->
+				<File value="Log\ErrInfo" />
+				<!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
+				<param name="AppendToFile" value="true" />
+				<!-- 指定是追加到还是覆盖掉已有的日志文件 -->
+				<!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
+				<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
+				<!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
+				<param name="RollingStyle" value="Composite" />
+				<!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
+				<StaticLogFileName value="false" />
+				<DatePattern value="yyyy\\MM\\dd\\CSV_yyyy-MM-dd'.txt'" />
+				<MaxSizeRollBackups value="-1" />
+				<!-- 最多个数为-1无限个-->
+				<MaximumFileSize value="2MB" />
+				<layout type="log4net.Layout.PatternLayout">
+					<conversionPattern value="时间:%date___描述:%message%newline" />
+				</layout>
+			</appender>
+
+
+			<logger name="LogInfo">
+				<level value="INFO" />
+				<appender-ref ref="InfoFileAppender" />
+			</logger>
+			<logger name="LogMes">
+				<level value="INFO" />
+				<appender-ref ref="MesInfoFileAppender" />
+			</logger>
+			<logger name="AlarmLogInfo">
+				<level value="WARN" />
+				<appender-ref ref="AlarmInfoFileAppender" />
+			</logger>
+
+			<logger name="ErrLogInfo">
+				<level value="ERROR" />
+				<appender-ref ref="ErrFileAppender" />
+			</logger>
+		</log4net>
+	</configuration>
+
+
+
+
+
+
+
+
+
+
+
+
+<!-- log4net-警告的信息级别区分 -->
+<!--<appender name="AspNetTraceAppender" type="log4net.Appender.AspNetTraceAppender" >
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->
+<!-- log4net-消息缓冲区配置(将日志信息进行缓存,达到10条时把日志输出,只有WARN及更高级别时才会被记录 ) -->
+<!--<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" >
+<bufferSize value="5"/>
+<lossy value="true" />
+<evaluator type="log4net.Core.LevelEvaluator">
+<threshold value="WARN"/>
+</evaluator>
+<appender-ref ref="ConsoleAppender" />
+</appender>-->
+<!--log4net-ERROR消息打印到控制台_红底白字-->
+<!--<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
+<mapping>
+<level value="ERROR" />
+<foreColor value="White" />
+<backColor value="Red, HighIntensity" />
+</mapping>
+<mapping>
+<level value="WARN" />
+<foreColor value="Yellow" />
+</mapping>
+<mapping>
+<level value="INFO" />
+<foreColor value="White" />
+</mapping>
+<mapping>
+<level value="DEBUG" />
+<backColor value="Green" />
+</mapping>
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->
+<!-- log4net-将日志消息定向到控制台错误流 -->
+<!--<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
+<target value="Console.Error" />
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->
+<!-- log4net-将日志写入本地机器的应用程序事件日志中 -->
+<!--<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
+<applicationName value="MyApp" />
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->
+<!-- 向指定网络sink发送日志 -->
+<!--<appender name="RemotingAppender" type="log4net.Appender.RemotingAppender" >
+<sink value="tcp://localhost:8085/LoggingSink" />
+<lossy value="true" />
+<bufferSize value="95" />
+<onlyFixPartialEventData value="true" />
+<evaluator type="log4net.Core.LevelEvaluator">
+<threshold value="ERROR"/>
+</evaluator>
+</appender>-->
+<!-- 向指定邮箱发送日志 -->
+<!--<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender,log4net">
+<to value="***@qq.com" />
+<from value="840937370@qq.com" />
+<username value="840937370@qq.com" />
+-->
+<!--为客户端授权码-->
+<!--
+<password value="***********" />
+<subject value="B2P主控中心Error警告" />
+<smtpHost value="SMTPServer.qq.com" />
+<bufferSize value="512" />
+-->
+<!-- 大小超过512发送一次-->
+<!--
+<lossy value="true" />
+<evaluator type="log4net.Core.LevelEvaluator,log4net">
+<threshold value="WARN" />
+</evaluator>
+<layout type="log4net.Layout.PatternLayout,log4net">
+<conversionPattern value="
+%n【log4net的HostName】%property{log4net:HostName} ::
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:%property{NDC}
+%n【错误描述】%message
+%newlineLogger: %logger%newlineThread: %thread%newlineDate: %date%newlineNDC:
+%n【错误详情】%newline%newline" />
+</layout>
+</appender>-->
+<!-- 使用SmtpPickupDir时的配置-->
+<!--<appender name="SmtpPickupDirAppender" type="log4net.Appender.SmtpPickupDirAppender">
+<to value="to@domain.com" />
+<from value="from@domain.com" />
+<subject value="test logging message" />
+<pickupDir value="C:\SmtpPickup" />
+<bufferSize value="512" />
+<lossy value="true" />
+<evaluator type="log4net.Core.LevelEvaluator">
+<threshold value="WARN"/>
+</evaluator>
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->

+ 35 - 0
Model/CurentApplicationSettings.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DefaultEdit.Model
+{
+    public class CurentApplicationSettings
+    {
+        /// <summary>
+        /// 小票打印机的名称(最好写在配置文件内,方便维护)
+        /// </summary>
+        private  string _PrinterName = "";
+        /// <summary>
+        /// MES地址(最好写在配置文件内,方便维护)
+        /// </summary>
+        private  string _Url = "https://mes2-web.sw.eainc.com/mes2/rest/";
+        /// <summary>
+        /// 设备编号(最好写在配置文件内,方便维护)
+        /// </summary>
+        private string _DeviceId = "EA-P-2590";
+
+
+
+        private string _PlcIP="127.0.0.1";
+
+
+
+        public string PrinterName { get => _PrinterName; set => _PrinterName = value; }
+        public string Url { get => _Url; set => _Url = value; }
+        public string DeviceId { get => _DeviceId; set => _DeviceId =  value ; }
+        public string PlcIP { get => _PlcIP; set => _PlcIP =  value ; }
+    }
+}

+ 52 - 0
Model/CurrConfig.cs

@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+
+namespace DefaultEdit.Model
+{
+    public class CurrConfig:BindableBase
+    {
+
+        private float _Speed;
+
+
+        private TimeSpan _Time;
+
+        private short _Power1_1;
+        private short _Power1_2;
+        private short _Power1_3;
+        private short _Power1_4;
+
+        private short _Power2_1;
+        private short _Power2_2;
+        private short _Power2_3;
+        private short _Power2_4;
+
+        private float _Pressure1;
+        private float _Pressure2;
+        private TimeSpan _PTime1;
+        private TimeSpan _PTime2;
+        private string _Rfid;
+
+
+        public float Speed { get => _Speed; set { SetProperty(ref _Speed, value); } }
+        public TimeSpan Time { get => _Time; set { SetProperty(ref _Time, value); } }
+        public short Power1_1 { get => _Power1_1; set { SetProperty(ref _Power1_1, value); } }
+        public short Power1_2 { get => _Power1_2; set { SetProperty(ref _Power1_2, value); } }
+        public short Power1_3 { get => _Power1_3; set { SetProperty(ref _Power1_3, value); } }
+        public short Power1_4 { get => _Power1_4; set { SetProperty(ref _Power1_4, value); } }
+        public short Power2_1 { get => _Power2_1; set { SetProperty(ref _Power2_1, value); } }
+        public short Power2_2 { get => _Power2_2; set { SetProperty(ref _Power2_2, value); } }
+        public short Power2_3 { get => _Power2_3; set { SetProperty(ref _Power2_3, value); } }
+        public short Power2_4 { get => _Power2_4; set { SetProperty(ref _Power2_4, value); } }
+        public float Pressure1 { get => _Pressure1; set { SetProperty(ref _Pressure1, value); } }
+        public float Pressure2 { get => _Pressure2; set { SetProperty(ref _Pressure2, value); } }
+        public TimeSpan PTime1 { get => _PTime1; set { SetProperty(ref _PTime1, value); } }
+        public TimeSpan PTime2 { get => _PTime2; set { SetProperty(ref _PTime2, value); } }
+
+        public string Rfid { get => _Rfid; set { SetProperty(ref _Rfid, value); } }
+    }
+}

+ 20 - 0
Model/DescriptionItem.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    public class DescriptionItem
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public string key { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string value { get; set; }
+    }
+}

+ 20 - 0
Model/PrintModel.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    public class PrintModel
+    {
+        public StringReader Text { get; set; }
+
+        public string FontFamily { get; set; }
+
+        public int FontSize { get; set; }
+
+        public bool IsBold { get; set; }
+    }
+}

+ 225 - 0
Model/ProcessDataModel.cs

@@ -0,0 +1,225 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    public class ProcessDataModel : INotifyPropertyChanged
+    {
+        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+        protected void OnPropertyChanged(string propertyName)
+        {
+            if (PropertyChanged != null)
+            {
+                PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
+            }
+        }
+        public string MaterialType { get; set; }
+        public string PrintTagProduct { get; set; }
+        public string Brand { get; set; }
+        public string PrintDeviceId { get; set; }
+        public string Tip { get; set; }
+        public int SolidifyStation { get; set; }
+        public bool IsKid { get; set; }
+        public bool IsOverSea { get; set; }
+        public string IsLarge { get; set; } = "无";
+
+        public int Count { get; set; } = 0;
+        private string boardId;
+        /// <summary>
+        /// 网板ID
+        /// </summary>
+        public string BoardId
+        {
+            get { return boardId; }
+            set
+            {
+                boardId = value;
+                OnPropertyChanged("BoardId");
+            }
+        }
+
+
+        /// <summary>
+        /// 网板处理唯一编码
+        /// </summary>
+        public string BoardGuid { get; set; }
+
+        private ProcessState state;
+
+        /// <summary>
+        /// 状态
+        /// </summary>
+        public ProcessState State
+        {
+            get { return state; }
+            set
+            {
+                state = value;
+                OnPropertyChanged("State");
+            }
+        }
+
+        private string totalCount;
+
+        /// <summary>
+        /// 总数
+        /// </summary>
+        public string TotalCount
+        {
+            get { return totalCount; }
+            set
+            {
+                totalCount = value;
+                OnPropertyChanged("TotalCount");
+            }
+        }
+
+        private string totalWeight;
+
+        /// <summary>
+        /// 总重
+        /// </summary>
+        public string TotalWeight
+        {
+            get { return totalWeight; }
+            set
+            {
+                totalWeight = value;
+                OnPropertyChanged("TotalWeight");
+            }
+        }
+        /// <summary>
+        /// 计时器
+        /// </summary>
+        public Stopwatch stopwatch { get; set; }
+
+        private string startTime;
+
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        public string StartTime
+        {
+            get { return startTime; }
+            set
+            {
+                startTime = value;
+                OnPropertyChanged("StartTime");
+            }
+        }
+
+        private string totalSpendTime;
+
+        /// <summary>
+        /// 总耗时
+        /// </summary>
+        public string TotalSpendTime
+        {
+            get { return totalSpendTime; }
+            set
+            {
+                totalSpendTime = value;
+                OnPropertyChanged("TotalSpendTime");
+            }
+        }
+
+        private string centrifugalSpendTime;
+
+        /// <summary>
+        /// 离心耗时
+        /// </summary>
+        public string CentrifugalSpendTime
+        {
+            get { return centrifugalSpendTime; }
+            set
+            {
+                centrifugalSpendTime = value;
+                OnPropertyChanged("CentrifugalSpendTime");
+            }
+        }
+
+        private string waterSpendTime;
+
+        /// <summary>
+        /// 水固化耗时
+        /// </summary>
+        public string WaterSpendTime
+        {
+            get { return waterSpendTime; }
+            set
+            {
+                waterSpendTime = value;
+                OnPropertyChanged("WaterSpendTime");
+            }
+        }
+
+        private string lightSpendTime;
+
+        /// <summary>
+        /// 光固化耗时
+        /// </summary>
+        public string LightSpendTime
+        {
+            get { return lightSpendTime; }
+            set
+            {
+                lightSpendTime = value;
+                OnPropertyChanged("LightSpendTime");
+            }
+        }
+
+
+        private string finishTime;
+
+        /// <summary>
+        /// 完成时间
+        /// </summary>
+        public string FinishTime
+        {
+            get { return finishTime; }
+            set
+            {
+                finishTime = value;
+                OnPropertyChanged("FinishTime");
+            }
+        }
+
+        private string modelsInfo;
+
+        /// <summary>
+        /// 模型信息
+        /// </summary>
+        public string ModelsInfo
+        {
+            get { return modelsInfo; }
+            set
+            {
+                modelsInfo = value;
+                OnPropertyChanged("ModelsInfo");
+            }
+        }
+    }
+
+    public enum ProcessState
+    {
+        入料中,
+        待离心,
+        第一次离心中,
+        待翻面,
+        翻面完成,
+        第二次离心中,
+        离心完成,
+        待脱模,
+        脱模完成,
+        待真空固化,
+        真空固化开始,
+        真空固化完成,
+        送料中,
+        送料完成,
+    }
+}

+ 45 - 0
Model/ProjectData.cs

@@ -0,0 +1,45 @@
+using Prism.Mvvm;
+using SqlSugar;
+using System;
+
+namespace DefaultEdit.Model
+{
+    public class ProjectData : BindableBase
+    {
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int id { get; set; }
+        /// <summary>
+        /// 员工
+        /// </summary>
+        public string userId { get; set; }
+        /// <summary>
+        /// 设备名称
+        /// </summary>
+        public string deviceId { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string recordId { get; set; }
+
+        /// <summary>
+        /// 订单编号
+        /// </summary>
+        public string orderId { get; set; }
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime creationTime { get; set; }
+        /// <summary>
+        /// json订单信息
+        /// </summary>
+        public string orderJson { get; set; }
+
+        /// <summary>
+        /// json上传信息
+        /// </summary>
+        public string productionRecords { get; set; }
+
+    }
+}

+ 13 - 0
Model/Re_Items.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    public class Re_Items
+    {
+        public string itemId { get; set; }
+    }
+}

+ 41 - 0
Model/Re_ModelsInfo.cs

@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    public class Re_ModelsInfo
+    {
+        public string uvcuringReleaseBatch { get; set; }
+        public AlignerSpec alignerSpec { get; set; }
+        public bool remade { get; set; }
+
+        public bool isKid { get; set; }
+        public string produceType { get; set; }
+
+        public Order order { get; set; }
+
+        public ProcessParameter[] processParameters { get; set; }
+    }
+    public class ProcessParameter
+    {
+        public string key { get; set; }
+        public string value { get; set; }
+    }
+
+    public class AlignerSpec
+    {
+        public string material { get; set; }
+        public string thickness { get; set; }
+    }
+
+    public class Order
+    {
+        public string is_expedited { get; set; }
+
+
+        public string country { get; set; }
+    }
+}

+ 24 - 0
Model/Re_PrintTaskDto.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    public class Re_PrintTaskDto
+    {
+
+        /// <summary>
+        /// taskId
+        /// </summary>
+        public string taskId { get; set; }
+        public Description[] description { get; set; }
+    }
+    public class Description
+    {
+        public string key;
+        public string name;
+        public string value;
+    }
+}

+ 23 - 0
Model/Re_ProductionRecord.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    public class Re_ProductionRecord
+    {
+        public string userId { get; set; }
+        public string taskId { get; set; }
+        public string deviceId { get; set; }
+        public string productionType { get; set; }
+        public string creationTime { get; set; }
+        public Discriptin[] description { get; set; }
+    }
+    public class Discriptin
+    {
+        public string key;
+        public string value;
+    }
+}

+ 38 - 0
Model/Re_UserDto.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DefaultEdit.Model
+{
+    public class Re_UserDto
+    {
+        /// <summary>
+        /// 用户ID
+        /// </summary>
+        public string userId { get; set; }
+        /// <summary>
+        /// 用户名
+        /// </summary>
+        public string userName { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public List<string> functions { get; set; }
+        /// <summary>
+        /// 业务上的组
+        /// </summary>
+        public List<string> groups { get; set; }
+
+        /// <summary>
+        /// 权限
+        /// </summary>
+        public List<string> roles { get; set; }
+
+        /// <summary>
+        /// 权限code
+        /// </summary>
+        public List<string> roleCodes { get; set; }
+    }
+}

+ 26 - 0
Model/RfidInfo.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+
+namespace DefaultEdit.Model
+{
+    public class RfidInfo:BindableBase
+    {
+        private string _Rfid;
+        private int _StationId;
+        private string _ModelsInfo;
+        private string _State;
+        private DateTime _StartTime;
+
+        public string Rfid { get => _Rfid; set { SetProperty(ref _Rfid, value); } }
+        public int StationId { get => _StationId; set { SetProperty(ref _StationId, value); } }
+
+        public string ModelsInfo { get => _ModelsInfo; set { SetProperty(ref _ModelsInfo, value); } }
+        public string State { get => _State; set { SetProperty(ref _State, value); } }
+
+        public DateTime StartTime { get => _StartTime; set { SetProperty(ref _StartTime, value); } }
+    }
+}

+ 32 - 0
Model/Rt_ProductionRecordDto.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    public class Rt_ProductionRecordDto
+    {
+        /// <summary>
+        /// 操作员
+        /// </summary>
+        public string userId { get; set; }
+        /// <summary>
+        /// 设备ID
+        /// </summary>
+        public string deviceId { get; set; }
+        /// <summary>
+        /// 处理类型(光固化:UVcuring 光固化后处理:UVcuringNextTreat)
+        /// </summary>
+        public string productionType { get; set; }
+        /// <summary>
+        /// 生产时间。时间格式:1990-12-31T15:59:59.000+08:00
+        /// </summary>
+        public string creationTime { get; set; }
+        /// <summary>
+        /// 生产过程数据
+        /// </summary>
+        public List<DescriptionItem> description { get; set; }
+    }
+}

+ 45 - 0
Model/XnRestfulResult.cs

@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NextTreatMesDemo.Models
+{
+    /// <summary>
+    /// RESTful风格返回格式
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class XnRestfulResult<T>
+    {
+        /// <summary>
+        /// 执行成功
+        /// </summary>
+        public bool Success { get; set; }
+
+        /// <summary>
+        /// 状态码
+        /// </summary>
+        public HttpStatusCode Code { get; set; }
+
+        /// <summary>
+        /// 错误信息
+        /// </summary>
+        public object Message { get; set; }
+
+        /// <summary>
+        /// 数据
+        /// </summary>
+        public T Data { get; set; }
+
+        /// <summary>
+        /// 时间戳
+        /// </summary>
+        public long Timestamp { get; set; }
+        /// <summary>
+        /// 原始数据
+        /// </summary>
+        public string RawText { get; set; }
+    }
+}

+ 25 - 0
OpenTK.dll.config

@@ -0,0 +1,25 @@
+<configuration>
+  <dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
+  <dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
+  <dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
+  <dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
+  <dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
+  <dllmap os="linux" dll="libX11" target="libX11.so.6"/>
+  <dllmap os="linux" dll="libXi" target="libXi.so.6"/>
+  <dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
+  <dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
+  <dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
+  <dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
+  <dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
+  <dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
+  <dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
+  <dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
+  <dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
+  <!-- XQuartz compatibility (X11 on Mac) -->
+  <dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
+  <dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
+  <dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
+  <dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
+  <dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
+  <dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
+</configuration>

+ 53 - 0
Properties/AssemblyInfo.cs

@@ -0,0 +1,53 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("DefaultEdit")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DefaultEdit")]
+[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.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 63 - 0
Properties/Resources.Designer.cs

@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DefaultEdit.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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 (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DefaultEdit.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;
+            }
+        }
+    }
+}

+ 117 - 0
Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : 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:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <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" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 26 - 0
Properties/Settings.Designer.cs

@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DefaultEdit.Properties {
+    
+    
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.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;
+            }
+        }
+    }
+}

+ 7 - 0
Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 38 - 0
ValueConverters/EnumToBoolConverter.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+
+namespace DefaultEdit.ValueConverters
+{
+    public class EnumToBoolConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ( value == null ) return false;
+
+            //if ( value is TriggerMode )
+            //{
+            //    return value?.ToString() == parameter?.ToString();
+
+            //}
+
+            return false;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            //if ( value == null ) return TriggerMode.On;
+
+            //if ( ( bool ) value&& parameter.ToString() == "On")
+            //{
+
+            //    return TriggerMode.On;
+            //}
+            //else
+            //{
+            //    return TriggerMode.Off;
+            //}
+            return false;
+        }
+    }
+}

+ 105 - 0
ViewModels/MainWindowViewModel.cs

@@ -0,0 +1,105 @@
+using DefaultEdit.Core;
+using DefaultEdit.DataBase;
+using DefaultEdit.Log4xml;
+using DefaultEdit.Model;
+using DefaultEdit.Views;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Mvvm;
+using Prism.Regions;
+using System.Threading.Tasks;
+
+namespace DefaultEdit.ViewModels
+{
+    public class MainWindowViewModel : BindableBase
+    {
+        private Management management;
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+
+
+        public DelegateCommand LoadedCommand { get; set; }
+
+        public DelegateCommand ClosedCommand { get; set; }
+
+        public MainWindowViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            SqlSugarHelper.CreataDatabase();
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+            Management = _container.Resolve<Management>();
+
+
+            LoadedCommand = new DelegateCommand(OnLoad);
+            ClosedCommand = new DelegateCommand(OnClose);
+        }
+
+
+        private DelegateCommand _OpenMenuViewCommand;
+        public DelegateCommand OpenMenuViewCommand =>
+            _OpenMenuViewCommand ?? ( _OpenMenuViewCommand = new DelegateCommand(MenuViewShow) );
+
+        private DelegateCommand _OpenRoleLoginViewCommand;
+        public DelegateCommand OpenRoleLoginViewCommand =>
+            _OpenRoleLoginViewCommand ?? ( _OpenRoleLoginViewCommand = new DelegateCommand(RoleLoginViewShow) );
+
+        private DelegateCommand _OpenWorkRunViewCommand;
+        public DelegateCommand OpenWorkRunViewCommand =>
+            _OpenWorkRunViewCommand ?? ( _OpenWorkRunViewCommand = new DelegateCommand(WorkRunViewShow) );
+
+
+        private DelegateCommand<MainWindow>_CloseViewCommand;
+        public DelegateCommand<MainWindow> CloseViewCommand =>
+            _CloseViewCommand ?? ( _CloseViewCommand = new DelegateCommand<MainWindow>(CloseViewMethod) );
+
+        public Management Management { get => management; set { SetProperty(ref management, value); } }
+
+        private void OnLoad()
+        {
+
+            //TipService tipService = new TipService();
+            //Task.Run(() => { 
+
+
+            //});
+            //tipService.Tcolse();
+          
+            _regionManager.Regions[ "RegionContent" ].RequestNavigate("WorkRunView");
+        }
+
+        private void OnClose()
+        {
+
+
+
+        }
+
+        void MenuViewShow()
+        {
+            _regionManager.Regions[ "RegionContent" ].RequestNavigate("SettingView");
+
+        }
+
+        void RoleLoginViewShow()
+        {
+            RoleLoginView roleLoginView = new RoleLoginView();
+            roleLoginView.ShowDialog();
+        }
+
+        void WorkRunViewShow()
+        {
+            _regionManager.Regions[ "RegionContent" ].RequestNavigate("WorkRunView");
+        }
+
+        void CloseViewMethod(MainWindow window)
+        {
+           
+            window.Close();
+        }
+
+
+    }
+}

+ 59 - 0
ViewModels/MenuViewModel.cs

@@ -0,0 +1,59 @@
+using Prism.Commands;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+
+namespace DefaultEdit.ViewModels
+{
+    public class MenuViewModel : BindableBase
+    {
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+
+
+        private DelegateCommand<string> _OpenCameraViewCommand;
+        public DelegateCommand<string> OpenCameraViewCommand =>
+            _OpenCameraViewCommand ?? ( _OpenCameraViewCommand = new DelegateCommand<string>(CameraViewShow) );
+
+
+        private DelegateCommand <string> _OpenVisionProViewCommand;
+        public DelegateCommand<string> OpenVisionProViewCommand =>
+            _OpenVisionProViewCommand ?? ( _OpenVisionProViewCommand = new DelegateCommand<string>(VisionProViewShow) );
+
+
+
+
+
+
+        public MenuViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+        }
+
+
+
+
+
+        void CameraViewShow(string index)
+        {
+
+            NavigationParameters paras = new NavigationParameters();
+            paras.Add("Index", Convert.ToInt32(index)); //键值对
+            _regionManager.Regions[ "MenuRegionContent" ].RequestNavigate("CameraView", paras);
+        }
+        void VisionProViewShow(string index)
+        {
+            NavigationParameters paras = new NavigationParameters();
+            paras.Add("Index", Convert.ToInt32(index)); //键值对
+            _regionManager.Regions[ "MenuRegionContent" ].RequestNavigate("VisionProView", paras);
+        }
+
+
+
+    }
+}

+ 15 - 0
ViewModels/ProductViewModel.cs

@@ -0,0 +1,15 @@
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Mvvm;
+
+namespace DefaultEdit.ViewModels
+{
+    public class ProductViewModel : BindableBase
+    {
+
+        public ProductViewModel(IContainerProvider container, IEventAggregator eventAggregator)
+        {
+
+        }
+    }
+}

+ 206 - 0
ViewModels/RoleLoginViewModel.cs

@@ -0,0 +1,206 @@
+using DefaultEdit.Log4xml;
+using DefaultEdit.Model;
+using DefaultEdit.Views;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
+using System.Xml.Linq;
+using DefaultEdit.Core;
+
+namespace DefaultEdit.ViewModels
+{
+    public class RoleLoginViewModel : BindableBase
+    {
+        private Management _management;
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+        private Brush _brush= Brushes.Transparent;
+        private string loginstr="";
+
+
+        private DelegateCommand<RoleLoginView> _LoginCommand;
+        public DelegateCommand<RoleLoginView> LogoutCommand =>
+            _LoginCommand ?? ( _LoginCommand = new DelegateCommand<RoleLoginView>(OnRoleLogin) );
+
+
+
+
+        private  string _CurrRole="操作员";
+        public RoleLoginViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+            _management = _container.Resolve<Management>();
+        }
+        bool colorswitch=false;
+        void OnRoleLogin(RoleLoginView view)
+        {
+            string  userPassword= SecureStringToString(Password);
+
+            if ( string.IsNullOrEmpty(CurrRole) || string.IsNullOrEmpty(userPassword) )
+            {
+                MessageBox.Show("请输入账户名或密码!");
+                return;
+            }
+            var userdata =_management.HttpService.GetUserInfoByAccount(CurrRole, userPassword);
+            if ( userdata.Success )
+            {
+                ///groups内的值满足以下条件才能够登录
+                if ( userdata.Data.groups.Contains("光固化") || userdata.Data.roles.Contains("光固化操作员") || userdata.Data.roles.Contains("光固化主管") || userdata.Data.roles.Contains("矫治器主管") )
+                {
+                    LogHelper.Info($"{CurrRole}登录成功");
+                    ///从返回的数据内获取用户ID,上传生产记录时需要用到
+                    _management.UserId = userdata.Data.userId;
+                    _management.UserName = userdata.Data.userName;
+
+                    L_Brush = Brushes.Green;
+                    Loginstr = "登录成功";
+                    Task task=  Task.Run(() =>
+                    {
+                        Thread.Sleep(1000);
+                        Application.Current.Dispatcher.Invoke(new Action(() =>
+                        {
+                            view.Close();
+                        }));
+                    });
+                }
+                else
+                {
+                    LogHelper.Info($"{CurrRole}无操作权限登录");
+                    //Log4netHelper.WriteInfo("无操作权限登录");
+                    if ( colorswitch )
+                    {
+                        colorswitch = false;
+                        L_Brush = Brushes.Red;
+                    }
+                    else
+                    {
+                        colorswitch = true;
+                        L_Brush = Brushes.OrangeRed;
+                    }
+                    Loginstr = "无操作权限登录";
+                }
+
+
+            }
+            else
+            {
+                L_Brush = Brushes.Red;
+                Loginstr = userdata.Code.ToString();
+                //Log4netHelper.WriteInfo($"登录失败,{userdata.RawText}:{userdata.Code}");
+                LogHelper.Info($"登录失败,{userdata.RawText}:{userdata.Code}");
+            }
+
+
+        }
+
+
+
+        public DelegateCommand<object> PasswordChangedCommand => new DelegateCommand<object>(PasswordChanged);
+        // 密码变量
+        private SecureString _password;
+
+        public SecureString Password
+        {
+            get
+            {
+                return _password;
+            }
+            set
+            {
+                // 如果新值与旧值不同
+                if ( _password != value )
+                {
+                    // 更新密码
+
+                    // 触发属性更改通知,通知UI层密码已更改
+                    SetProperty(ref _password, value);
+                }
+
+            }
+        }
+
+        public string CurrRole
+        {
+            get => _CurrRole;
+            set
+            {
+                SetProperty(ref _CurrRole, value);
+
+            }
+        }
+
+
+
+        public Brush L_Brush { get => _brush; set { SetProperty(ref _brush, value); } }
+
+        public string Loginstr { get => loginstr; set { SetProperty(ref loginstr, value); } }
+
+        private void PasswordChanged(object parameter)
+        {
+            var passwordBox = parameter as PasswordBox;
+            if ( passwordBox != null )
+            {
+                // 设置 ViewModel 中的密码属性
+                Password = passwordBox.SecurePassword;
+            }
+            L_Brush = Brushes.Transparent;
+            Loginstr = "";
+        }
+
+
+        /// <summary>
+        /// 将 SecureString 类型的数据转换为普通的字符串类型。
+        /// </summary>
+        /// <param name="secureString">要转换的 SecureString 对象。</param>
+        /// <returns>转换后的字符串,如果转换失败则返回空字符串。</returns>
+        private string SecureStringToString(SecureString secureString)
+        {
+            // 初始化指针
+            IntPtr ptr = IntPtr.Zero;
+            try
+            {
+                // 将 SecureString 转换为指针
+                ptr = Marshal.SecureStringToGlobalAllocUnicode(secureString);
+
+                if ( ptr != IntPtr.Zero )
+                {
+                    // 将指针中的数据复制到一个普通的字符串
+                    return Marshal.PtrToStringUni(ptr);
+                }
+                else
+                {
+                    return string.Empty;
+                }
+            }
+            catch ( Exception ex )
+            {
+                // 处理异常
+                Console.WriteLine($"转换 SecureString 出错:{ex.Message}");
+                return string.Empty;
+            }
+            finally
+            {
+                // 清除内存中的敏感数据
+                if ( ptr != IntPtr.Zero )
+                {
+                    Marshal.ZeroFreeGlobalAllocUnicode(ptr);
+                }
+            }
+        }
+    }
+}

+ 47 - 0
ViewModels/SettingViewModel.cs

@@ -0,0 +1,47 @@
+using DefaultEdit.Core;
+using DefaultEdit.Log4xml;
+using DefaultEdit.Model;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Mvvm;
+using Prism.Regions;
+using System.Windows;
+
+namespace DefaultEdit.ViewModels
+{
+    public class SettingViewModel : BindableBase
+    {
+
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+        private Management _management;
+
+
+        private DelegateCommand _SaveSettingsCommand;
+        public DelegateCommand SaveSettingsCommand =>
+            _SaveSettingsCommand ?? ( _SaveSettingsCommand = new DelegateCommand(SaveSettings) );
+
+        public Management Management { get => _management; set { SetProperty(ref _management, value); } }
+
+        public SettingViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+            Management=container.Resolve<Management>();
+
+        }
+
+        
+
+
+        public void SaveSettings()
+        {
+            FileHelper.SaveApplicationConfiguration(Management.CurentApplicationSettings);
+            LogHelper.Info("保存完成");
+            MessageBox.Show("保存完成");
+        }
+    }
+}

+ 172 - 0
ViewModels/WorkRunViewModel.cs

@@ -0,0 +1,172 @@
+using DefaultEdit.Communication;
+using DefaultEdit.Core;
+using DefaultEdit.Log4xml;
+using DefaultEdit.Model;
+using DefaultEdit.Views;
+using Microsoft.Xaml.Behaviors;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.Diagnostics;
+using System.Threading;
+using System.Windows.Controls;
+
+namespace DefaultEdit.ViewModels
+{
+    public class WorkRunViewModel : BindableBase
+    {
+        private Management _management;
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+
+
+
+
+        private ObservableCollection<string> _Logs = new ObservableCollection<string>();
+        public ObservableCollection<string> Logs { get => _Logs; set => _Logs = value; }
+        public Management Management { get => _management; set => _management =  value ; }
+
+
+        private DelegateCommand _OpenRoleLoginViewCommand;
+        public DelegateCommand OpenRoleLoginViewCommand =>
+            _OpenRoleLoginViewCommand ?? ( _OpenRoleLoginViewCommand = new DelegateCommand(RoleLoginViewShow) );
+
+        private DelegateCommand _SwitchModeCommand;
+        public DelegateCommand  SwitchModeCommand =>
+            _SwitchModeCommand ?? ( _SwitchModeCommand = new DelegateCommand(SwitchModeMethod) );
+
+        private DelegateCommand _ClearRunDataCommand;
+        public DelegateCommand ClearRunDataCommand =>
+            _ClearRunDataCommand ?? ( _ClearRunDataCommand = new DelegateCommand(ClearRunData) );
+
+
+        private DelegateCommand _ClearLogDataCommand;
+        public DelegateCommand  ClearLogDataCommand =>
+            _ClearLogDataCommand ?? ( _ClearLogDataCommand = new DelegateCommand(ClearLogData) );
+
+        public WorkRunViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+            Management = container.Resolve<Management>();
+            LogHelper.logChangHandler += ShowLog;
+            LogHelper.Info("===========================程序启动==========================");
+            Management.CurentApplicationSettings = FileHelper.ReadApplicationConfiguration();
+            LogHelper.Info("加载配置文件完成");
+          
+            //创建一个定时器,每秒更新一次时间
+            var timer = new System.Timers.Timer(1000);
+            timer.Elapsed += (sender, e) =>
+            {
+                Management.DateTimeNow = DateTime.Now;
+            };
+            timer.Start();
+        }
+
+
+        private void ShowLog(Log4xml.Log log)
+        {
+            System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
+            {
+                string str = log.Msg.Trim();
+                while ( true )
+                {
+                    if ( str.Length > 80 )
+                    {
+                        Logs.Add(str.Substring(0, 80));
+                        str = log.Time + " " + str.Substring(80);
+                    }
+                    else
+                    {
+                        Logs.Add(str);
+                        break;
+                    }
+                }
+                if ( Logs.Count > 100 )
+                {
+                    Logs.RemoveAt(0);
+                }
+            }));
+
+        }
+
+
+
+        void SwitchModeMethod() 
+        { 
+        
+        
+        
+        
+        }
+        void ClearRunData() 
+        {
+
+            Management.RuningData.Clear();
+        
+        }
+
+        void ClearLogData()
+        {
+
+            Logs.Clear();
+
+        }
+
+
+        void RoleLoginViewShow()
+        {
+            RoleLoginView roleLoginView = new RoleLoginView();
+            roleLoginView.ShowDialog();
+        }
+
+
+
+
+
+
+    }
+
+
+    public class AutoScrollBehavior : Behavior<ListBox>
+    {
+        protected override void OnAttached()
+        {
+            base.OnAttached();
+            var items = AssociatedObject.Items;
+            if ( items is INotifyCollectionChanged incc )
+            {
+                incc.CollectionChanged += OnCollectionChanged;
+            }
+        }
+
+        private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
+            if ( e.Action == NotifyCollectionChangedAction.Add && AssociatedObject.HasItems )
+            {
+                AssociatedObject.Dispatcher.BeginInvoke(new Action(() =>
+                {
+
+                    AssociatedObject.ScrollIntoView(AssociatedObject.Items[ AssociatedObject.Items.Count - 1 ]);
+                }));
+
+            }
+        }
+
+        protected override void OnDetaching()
+        {
+            if ( AssociatedObject.Items is INotifyCollectionChanged incc )
+            {
+                incc.CollectionChanged -= OnCollectionChanged;
+            }
+            base.OnDetaching();
+        }
+    }
+}

+ 112 - 0
Views/LoadingView.xaml

@@ -0,0 +1,112 @@
+<Window x:Class="DefaultEdit.Views.LoadingView"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:DefaultEdit.Views"
+        mc:Ignorable="d"
+        WindowStartupLocation="CenterScreen"
+        WindowStyle="None"
+        ResizeMode="NoResize"
+        Width="300"
+        Height="100"
+        d:DesignHeight="150"
+        d:DesignWidth="300"
+        Background="Transparent"
+        Title="LoadingView">
+    <Window.Resources>
+        <Style x:Key="ellipse"
+               TargetType="Ellipse">
+            <Setter Property="Width"
+                    Value="20" />
+            <Setter Property="Height"
+                    Value="20" />
+            <Setter Property="Fill"
+                    Value="#41b6e6" />
+            <Setter Property="RenderTransform">
+                <Setter.Value>
+                    <TranslateTransform X="0"
+                                        Y="0" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <PowerEase x:Key="powerEase"
+                   Power="2"
+                   EasingMode="EaseInOut" />
+    </Window.Resources>
+    <Canvas Background="Transparent"
+            Width="200"
+            Height="200">
+        <Canvas.Triggers>
+            <EventTrigger RoutedEvent="Loaded">
+                <BeginStoryboard>
+                    <Storyboard RepeatBehavior="Forever"
+                                Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
+                        <DoubleAnimation  Storyboard.TargetName="e1"
+                                          To="-50"
+                                          BeginTime="0:0:0.0"
+                                          Duration="0:0:0.5"
+                                          AutoReverse="True"
+                                          EasingFunction="{StaticResource powerEase}" />
+                        <DoubleAnimation Storyboard.TargetName="e2"
+                                         To="-50"
+                                         BeginTime="0:0:0.1"
+                                         Duration="0:0:0.5"
+                                         AutoReverse="True"
+                                         EasingFunction="{StaticResource powerEase}" />
+                        <DoubleAnimation Storyboard.TargetName="e3"
+                                         To="-50"
+                                         BeginTime="0:0:0.2"
+                                         Duration="0:0:0.5"
+                                         AutoReverse="True"
+                                         EasingFunction="{StaticResource powerEase}" />
+                        <DoubleAnimation Storyboard.TargetName="e4"
+                                         To="-50"
+                                         BeginTime="0:0:0.3"
+                                         Duration="0:0:0.5"
+                                         AutoReverse="True"
+                                         EasingFunction="{StaticResource powerEase}" />
+                        <DoubleAnimation Storyboard.TargetName="e5"
+                                         To="-50"
+                                         BeginTime="0:0:0.4"
+                                         Duration="0:0:0.5"
+                                         AutoReverse="True"
+                                         EasingFunction="{StaticResource powerEase}" />
+                    </Storyboard>
+                </BeginStoryboard>
+            </EventTrigger>
+        </Canvas.Triggers>
+
+
+        <Label Content="Loading"
+               Name="Msg"
+               FontSize="16"
+               FontFamily="Times New Roman"
+               Foreground="#ffb549"
+               FontWeight="Bold"
+               Width="200"
+               HorizontalContentAlignment="Center"
+               Canvas.Top="70" />
+
+        <Ellipse Name="e1"
+                 Canvas.Left="30"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+        <Ellipse Name="e2"
+                 Canvas.Left="60"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+        <Ellipse Name="e3"
+                 Canvas.Left="90"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+        <Ellipse Name="e4"
+                 Canvas.Left="120"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+        <Ellipse Name="e5"
+                 Canvas.Left="150"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+    </Canvas>
+</Window>

+ 28 - 0
Views/LoadingView.xaml.cs

@@ -0,0 +1,28 @@
+using System.Windows;
+
+namespace DefaultEdit.Views
+{
+    /// <summary>
+    /// LoadingView.xaml 的交互逻辑
+    /// </summary>
+    public partial class LoadingView : Window
+    {
+
+
+        private string str="";
+        public LoadingView()
+        {
+            InitializeComponent();
+        }
+
+        public string Str
+        {
+            get => str;
+            set
+            {
+                str = value;
+                Msg.Content = value;
+            }
+        }
+    }
+}

+ 173 - 0
Views/MainWindow.xaml

@@ -0,0 +1,173 @@
+<Window x:Class="DefaultEdit.Views.MainWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:DefaultEdit"
+        xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
+        xmlns:prism="http://prismlibrary.com/"
+        prism:ViewModelLocator.AutoWireViewModel="True"
+        mc:Ignorable="d"
+        WindowStyle="None"
+        Title="EA时代天使"
+        Height="450"
+        FontWeight="Bold"
+        FontFamily="微软雅黑"
+        MouseDoubleClick="Grid_MouseDown"
+        SizeChanged="Window_SizeChanged"
+        Width="800">
+    <b:Interaction.Triggers>
+        <b:EventTrigger EventName="Loaded">
+            <b:InvokeCommandAction Command="{Binding LoadedCommand}" />
+        </b:EventTrigger>
+        <b:EventTrigger EventName="Closed">
+            <b:InvokeCommandAction Command="{Binding ClosedCommand}" />
+        </b:EventTrigger>
+    </b:Interaction.Triggers>
+    <WindowChrome.WindowChrome>
+        <WindowChrome GlassFrameThickness="50"
+                      CaptionHeight="30"
+                      NonClientFrameEdges="Left,Bottom,Right"
+                      CornerRadius="20" />
+    </WindowChrome.WindowChrome>
+    <Window.Resources>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="White" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="#D4D8DD" />
+                </Setter.Value>
+            </Setter> 
+        </Style>
+    </Window.Resources>
+    <Border BorderBrush="AliceBlue"
+            BorderThickness="2"
+            Margin="10"
+            CornerRadius="10">
+        <Border.Background>
+            <LinearGradientBrush>
+                <GradientStop Color="#95DDFD"
+                              Offset="0" />
+                <GradientStop Color="#97B8FF"
+                              Offset="0.4" />
+                <GradientStop Color="#2961AC"
+                              Offset="0.9" />
+            </LinearGradientBrush>
+        </Border.Background>
+        <Grid Background="White"
+              Opacity="0.8">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="70" />
+                <RowDefinition />
+            </Grid.RowDefinitions>
+            <Grid Grid.Row="0"
+                  VerticalAlignment="Center">
+                <StackPanel Orientation="Horizontal">
+
+                    <TextBlock Text="EA时代天使"
+                               FontSize="26"
+                               Margin="30,20,0,0"
+                               FontWeight="Bold" />
+                </StackPanel>
+                <StackPanel Orientation="Horizontal"
+                            VerticalAlignment="Top"
+                            Height="65"
+                            HorizontalAlignment="Right">
+                    <TextBlock Text="当前时间:"
+                               FontSize="16"
+                               Margin="5,5,5,10"
+                               VerticalAlignment="Bottom" />
+                    <TextBlock Text="{Binding Management.DateTimeNow,StringFormat=yyyy-MM-dd HH:mm:ss}"
+                               FontSize="16"
+                               Margin="0,0,25,10"
+                               VerticalAlignment="Bottom" />
+                    <!--<Border Style="{StaticResource buttonborder}">
+
+                        <Button Content="权限登录"
+                                VerticalAlignment="Top"
+                                Command="{Binding OpenRoleLoginViewCommand}"
+                                Padding="5"
+                                BorderBrush="Transparent"
+                                FontSize="15"
+                                WindowChrome.IsHitTestVisibleInChrome="True"
+                                Background="Transparent" />
+
+                    </Border>-->
+                    <Border Style="{StaticResource buttonborder}">
+
+                        <Button Content="参数界面"
+                                VerticalAlignment="Top"
+                                Padding="5"
+                                BorderBrush="Transparent"
+                                FontSize="15"
+                                Command="{Binding OpenMenuViewCommand}"
+                                WindowChrome.IsHitTestVisibleInChrome="True"
+                                Background="Transparent" />
+
+                    </Border>
+                    <Border Style="{StaticResource buttonborder}">
+
+                        <Button Content="主界面"
+                                VerticalAlignment="Top"
+                                Padding="5"
+                                BorderBrush="Transparent"
+                                FontSize="15"
+                                Command="{Binding OpenWorkRunViewCommand}"
+                                WindowChrome.IsHitTestVisibleInChrome="True"
+                                Background="Transparent" />
+
+                    </Border>
+                    <Button Content="➖"
+                            Margin="0,10,0,0"
+                            VerticalAlignment="Top"
+                            Name="btnNormal"
+                            Click="btnNormal_Click"
+                            Width="45"
+                            FontWeight="Bold"
+                            FontSize="15"
+                            BorderThickness="0"
+                            WindowChrome.IsHitTestVisibleInChrome="True"
+                            Background="Transparent" />
+                    <Button  Content="⭕"
+                             Margin="0,7,0,0"
+                             VerticalAlignment="Top"
+                             Click="btnMaximize_Click"
+                             Name="btnMaximize"
+                             Width="45"
+                             FontWeight="Bold"
+                             FontSize="20"
+                             BorderThickness="0"
+                             WindowChrome.IsHitTestVisibleInChrome="True"
+                             Background="Transparent" />
+                    <Button  Content="❌"
+                             Margin="0,10,0,0"
+                             VerticalAlignment="Top"
+                             Width="45"
+                             Command="{Binding CloseViewCommand}"
+                             CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
+                             FontWeight="Bold"
+                             FontSize="15"
+                             BorderThickness="0"
+                             WindowChrome.IsHitTestVisibleInChrome="True"
+                             Background="Transparent" />
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="1">
+                <ContentControl prism:RegionManager.RegionName="RegionContent" />
+            </Grid>
+        </Grid>
+    </Border>
+</Window>

+ 76 - 0
Views/MainWindow.xaml.cs

@@ -0,0 +1,76 @@
+using System.Windows;
+using System.Windows.Input;
+
+namespace DefaultEdit.Views
+{
+    /// <summary>
+    /// MainWindow.xaml 的交互逻辑
+    /// </summary>
+    public partial class MainWindow : Window
+    {
+        private WindowState _windowState= WindowState.Normal;
+        public MainWindow()
+        {
+            InitializeComponent();
+
+        }
+
+
+
+        Rect rcnormal;//定义一个全局rect记录还原状态下窗口的位置和大小。
+        /// <summary>
+        /// 最大化
+        /// </summary>
+        private void btnMaximize_Click(object sender, RoutedEventArgs e)
+        {
+            if ( _windowState == WindowState.Normal )
+            {
+                _windowState = WindowState.Maximized;
+                rcnormal = new Rect(this.Left, this.Top, this.Width, this.Height);//保存下当前位置与大小
+                this.Left = 0;//设置位置
+                this.Top = 0;
+                Rect rc = SystemParameters.WorkArea;//获取工作区大小
+                this.Width = rc.Width;
+                this.Height = rc.Height;
+            }
+            else
+            {
+                _windowState = WindowState.Normal;
+                this.Left = rcnormal.Left;
+                this.Top = rcnormal.Top;
+                this.Width = rcnormal.Width;
+                this.Height = rcnormal.Height;
+            }
+        }
+        /// <summary>
+        /// 还原
+        /// </summary>
+        private void btnNormal_Click(object sender, RoutedEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+
+        }
+        private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
+        {
+            if ( this.ActualHeight > SystemParameters.WorkArea.Height || this.ActualWidth > SystemParameters.WorkArea.Width )
+            {
+                this.WindowState = System.Windows.WindowState.Normal;
+                btnMaximize_Click(null, null);
+            }
+        }
+        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            if ( e.ClickCount == 2 )
+            {
+                if ( this.ActualWidth == SystemParameters.WorkArea.Width )
+                {
+                    btnNormal_Click(null, null);
+                }
+                else
+                {
+                    btnMaximize_Click(null, null);
+                }
+            }
+        }
+    }
+}

+ 190 - 0
Views/MenuView.xaml

@@ -0,0 +1,190 @@
+<UserControl x:Class="DefaultEdit.Views.MenuView"
+             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:DefaultEdit.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d"
+             d:DesignHeight="450"
+             d:DesignWidth="800">
+    <UserControl.Resources>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="White" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="#D4D8DD" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style x:Key="textborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="#D4D8DD" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="White" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style x:Key="Menubutton"
+               TargetType="Button">
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="HorizontalContentAlignment"
+                    Value="Left" />
+            <Setter Property="FontWeight"
+                    Value="Bold" />
+            <Setter Property="Margin"
+                    Value="15,5,5,5" />
+            <Setter Property="Padding"
+                    Value="5" />
+            <Setter Property="FontSize"
+                    Value="14" />
+            <Setter Property="BorderThickness"
+                    Value="0" />
+        </Style>
+    </UserControl.Resources>
+   
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="Auto" />
+            <ColumnDefinition Width="*" />
+        </Grid.ColumnDefinitions>
+        <Border Grid.Column="0"
+                Margin="10"
+                Padding="2"
+                CornerRadius="5"
+                BorderBrush="#D4D8DD"
+                BorderThickness="2">
+           <Grid Margin="5">
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="40" />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+                    <Border Style="{StaticResource textborder}"
+                            Grid.Row="0">
+                        <TextBlock Text="调试"
+                                   Width="150"
+                                   Margin="15,5,5,5"
+                                   FontSize="14" />
+                    </Border>
+                    <Border BorderBrush="#D4D8DD"
+                            BorderThickness="1"
+                            Grid.Row="1">
+                        <StackPanel>
+                            <Button Content="相机1"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="0"/>
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="0"/>
+                            <Button Content="相机2"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="1"/>
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="1"/>
+                            <Button Content="相机3"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="2" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="2" />
+                            <Button Content="相机4"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="3" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="3" />
+                            <Button Content="相机5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="4" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="4" />
+                            <Button Content="相机6"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="5" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="5" />
+                            <Button Content="相机7"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="6" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="6" />
+                            <Button Content="相机8"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="7" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="7" />
+                        </StackPanel>
+                    </Border>
+
+                </Grid>
+            </Grid>
+        </Border>
+
+        <Border Grid.Column="1"
+                Margin="20"
+                BorderBrush="#D4D8DD"
+                BorderThickness="2">
+            <ContentControl prism:RegionManager.RegionName="MenuRegionContent" />
+        </Border>
+      
+    </Grid>
+    
+</UserControl>

+ 15 - 0
Views/MenuView.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace DefaultEdit.Views
+{
+    /// <summary>
+    /// MenuView.xaml 的交互逻辑
+    /// </summary>
+    public partial class MenuView : UserControl
+    {
+        public MenuView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 433 - 0
Views/ProductView.xaml

@@ -0,0 +1,433 @@
+<UserControl x:Class="DefaultEdit.Views.ProductView"
+             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:DefaultEdit.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d"
+             d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+        <Style  TargetType="{x:Type GridViewColumnHeader}">
+            <Setter Property="OverridesDefaultStyle"
+                    Value="True" />
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
+                        <Grid Name="g">
+                            <Border Name="bd"
+                                    Padding="{TemplateBinding Padding}"
+                                    MaxHeight="{TemplateBinding Height}">
+                                <!--<ContentPresenter Margin="5,4,1,3" 
+                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>-->
+                                <ContentPresenter RecognizesAccessKey="True"
+                                                  Content="{TemplateBinding ContentControl.Content}"
+                                                  ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
+                                                  ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
+                                                  Name="HeaderContent"
+                                                  Margin="5,4,1,3"
+                                                  SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
+                            </Border>
+                            <Thumb Name="PART_HeaderGripper"
+                                   Template="{StaticResource tmpForThumb}"
+                                   HorizontalAlignment="Right"
+                                   Margin="0,0,-1,0" />
+                        </Grid>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsMouseOver"
+                                     Value="True">
+                                <Setter TargetName="g"
+                                        Property="Background"
+                                        Value="#0A6CE7">
+
+                                </Setter>
+                            </Trigger>
+                            <Trigger Property="IsPressed"
+                                     Value="True">
+                                <Setter Property="Margin"
+                                        Value="6,5,1,3"
+                                        TargetName="HeaderContent" />
+                            </Trigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <ControlTemplate x:Key="tmpForThumb"
+                         TargetType="{x:Type Thumb}">
+            <Border>
+                <Border BorderThickness="1 0 1 0"
+                        Name="rec"
+                        BorderBrush="Transparent">
+                </Border>
+            </Border>
+        </ControlTemplate>
+        <Style TargetType="{x:Type ListViewItem}">
+            <Style.Setters>
+                <!--<Setter Property="Background">
+                    <Setter.Value>
+                        <Binding RelativeSource="{RelativeSource Self}"
+                                 Converter="{StaticResource myConverter}" />
+                    </Setter.Value>
+                </Setter>-->
+                <Setter Property="SnapsToDevicePixels"
+                        Value="True" />
+                <Setter Property="Template">
+                    <Setter.Value>
+                        <ControlTemplate TargetType="{x:Type ListViewItem}">
+                            <Border Padding="{TemplateBinding Control.Padding}"
+                                    Background="{TemplateBinding Panel.Background}"
+                                    Name="Bd"
+                                    SnapsToDevicePixels="True">
+                                <GridViewRowPresenter HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
+                                                      VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
+                                                      SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
+                                                      Margin="3" />
+                            </Border>
+                            <ControlTemplate.Triggers>
+                                <MultiTrigger>
+                                    <MultiTrigger.Conditions>
+                                        <Condition Property="IsSelected"
+                                                   Value="False" />
+                                    </MultiTrigger.Conditions>
+                                    <Setter Property="Foreground"
+                                            Value="#000000" />
+                                </MultiTrigger>
+                                <MultiTrigger>
+                                    <MultiTrigger.Conditions>
+                                        <Condition Property="UIElement.IsMouseOver"
+                                                   Value="True">
+                                        </Condition>
+                                    </MultiTrigger.Conditions>
+                                    <Setter Property="Panel.Background"
+                                            TargetName="Bd">
+                                        <Setter.Value>
+                                            <SolidColorBrush>#D9DFE8</SolidColorBrush>
+                                        </Setter.Value>
+                                    </Setter>
+                                </MultiTrigger>
+                                <MultiTrigger>
+                                    <MultiTrigger.Conditions>
+                                        <Condition Property="Selector.IsSelectionActive"
+                                                   Value="False">
+                                        </Condition>
+                                        <Condition Property="Selector.IsSelected"
+                                                   Value="True">
+                                        </Condition>
+                                    </MultiTrigger.Conditions>
+                                    <Setter Property="Panel.Background"
+                                            TargetName="Bd">
+                                        <Setter.Value>
+                                            <SolidColorBrush>#3DDADADA</SolidColorBrush>
+                                        </Setter.Value>
+                                    </Setter>
+
+                                </MultiTrigger>
+                                <MultiTrigger>
+                                    <MultiTrigger.Conditions>
+                                        <Condition Property="Selector.IsSelectionActive"
+                                                   Value="True">
+                                        </Condition>
+                                        <Condition Property="Selector.IsSelected"
+                                                   Value="True">
+                                        </Condition>
+                                    </MultiTrigger.Conditions>
+                                    <Setter Property="Panel.Background"
+                                            TargetName="Bd">
+                                        <Setter.Value>
+                                            <SolidColorBrush>#3D26A0DA</SolidColorBrush>
+                                        </Setter.Value>
+                                    </Setter>
+
+                                </MultiTrigger>
+                                <Trigger Property="IsSelected"
+                                         Value="True">
+                                    <Trigger.Setters>
+                                        <Setter TargetName="Bd"
+                                                Property="Background"
+                                                Value="#8CB1E0" />
+                                        <Setter Property="Foreground"
+                                                Value="#FFFFFF" />
+                                    </Trigger.Setters>
+                                </Trigger>
+                            </ControlTemplate.Triggers>
+                        </ControlTemplate>
+                    </Setter.Value>
+                </Setter>
+            </Style.Setters>
+        </Style>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Margin"
+                    Value="70,5,0,0" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Top" />
+            <Setter Property="BorderBrush"
+                    Value="White" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="#E0CCB2" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style x:Key="textborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="#F9F2E9" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="#D4D8DD" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="White" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <!--List -->
+        <Style TargetType="{x:Type ListView}">
+            <Setter Property="SnapsToDevicePixels"
+                    Value="true" />
+            <Setter Property="OverridesDefaultStyle"
+                    Value="true" />
+            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
+                    Value="Auto" />
+            <Setter Property="ScrollViewer.VerticalScrollBarVisibility"
+                    Value="Auto" />
+            <Setter Property="ScrollViewer.CanContentScroll"
+                    Value="true" />
+            <Setter Property="VerticalContentAlignment"
+                    Value="Center" />
+            <Setter Property="Padding"
+                    Value="10" />
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type  ListView}">
+                        <Border Name="Border"
+                                BorderThickness="1"
+                                Background="White">
+                            <Border.BorderBrush>
+                                <SolidColorBrush Color="#EFF1F6" />
+                            </Border.BorderBrush>
+                            <ScrollViewer Style="{StaticResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
+                                <ItemsPresenter />
+                            </ScrollViewer>
+                        </Border>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <!--列表内容样式-->
+        <Style TargetType="{x:Type ListViewItem}"
+               x:Key="ListViewItemContainerStylePatientList">
+            <Setter Property="FontSize"
+                    Value="12" />
+            <Setter Property="Height"
+                    Value="60" />
+            <Setter Property="FontWeight"
+                    Value="Normal" />
+            <Setter Property="Foreground"
+                    Value="#3E4A58" />
+            <Setter Property="HorizontalContentAlignment"
+                    Value="Center" />
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type ListViewItem}">
+                        <Border x:Name="Bd"
+                                CornerRadius="4"
+                                Margin="0,5"
+                                Background="{TemplateBinding Background}"
+                                BorderBrush="{TemplateBinding BorderBrush}"
+                                BorderThickness="0">
+                            <GridViewRowPresenter Content="{TemplateBinding Content}"
+                                                  Columns="{TemplateBinding GridView.ColumnCollection}" />
+                        </Border>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsSelected"
+                                     Value="true">
+                                <Setter Property="Background"
+                                        TargetName="Bd"
+                                        Value="#F6F6F6" />
+                            </Trigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+
+            <!--隔行变色-->
+            <Style.Triggers>
+                <MultiTrigger>
+                    <MultiTrigger.Conditions>
+                        <Condition Property="ItemsControl.AlternationIndex"
+                                   Value="1" />
+                    </MultiTrigger.Conditions>
+                    <Setter Property="Background"
+                            Value="#F6F8FA" />
+                </MultiTrigger>
+            </Style.Triggers>
+        </Style>
+        <!--列头样式定义-->
+        <Style x:Key="ListViewHeaderPatientList"
+               TargetType="{x:Type GridViewColumnHeader}">
+            <Setter Property="OverridesDefaultStyle"
+                    Value="True" />
+            <Setter Property="FontSize"
+                    Value="14" />
+
+            <Setter Property="Foreground"
+                    Value="#3E4A58" />
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
+                        <Grid Name="gird"
+                              Height="36"
+                              Margin="1,0">
+                            <Grid.Background>
+                                <SolidColorBrush Color="#F9F2E9" />
+                            </Grid.Background>
+                            <Border Name="bd"
+                                    CornerRadius="4"
+                                    Padding="{TemplateBinding Padding}">
+                                <ContentPresenter  HorizontalAlignment="Center"
+                                                   VerticalAlignment="Center" />
+                            </Border>
+                            <!--<Thumb Name="PART_HeaderGripper" Template="{StaticResource ThumbColumnHeaderSpliter}" HorizontalAlignment="Right" Margin="0,0,-1,0"/>-->
+                        </Grid>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsMouseOver"
+                                     Value="True">
+                                <Setter TargetName="gird"
+                                        Property="Background">
+                                    <Setter.Value>
+                                        <SolidColorBrush Color="#F7F6F6" />
+                                    </Setter.Value>
+                                </Setter>
+                            </Trigger>
+
+
+                            <Trigger Property="IsPressed"
+                                     Value="True">
+                                <Setter TargetName="gird"
+                                        Property="Background">
+                                    <Setter.Value>
+                                        <SolidColorBrush Color="#F7F6F6" />
+                                    </Setter.Value>
+                                </Setter>
+                            </Trigger>
+
+
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition />
+        </Grid.RowDefinitions>
+        <StackPanel Orientation="Horizontal"
+                    Height="50"
+                    Margin="5,20,5,5"
+                    Grid.Row="0">
+            <Border Style="{StaticResource textborder}"
+                 >
+                <TextBlock Text="开始时间"
+                           Margin="10,0,10,5"
+                           FontSize="22" />
+                </Border>
+            <DatePicker  FontSize="14"
+                         Margin="20,5,70,0"
+                         BorderThickness="0">
+                <DatePicker.RenderTransform>
+                    <ScaleTransform ScaleX="1.6"
+                                    ScaleY="1.6">
+                    </ScaleTransform>
+                </DatePicker.RenderTransform>
+            </DatePicker>
+            <Border Style="{StaticResource textborder}"
+                    Grid.Row="0">
+                <TextBlock Text="结束时间"
+                           Margin="10,0,10,5"
+                           FontSize="22" />
+            </Border>
+            <DatePicker  FontSize="14"
+                         BorderThickness="0"
+                         Margin="20,5,70,0">
+                <DatePicker.RenderTransform>
+                    <ScaleTransform ScaleX="1.6"
+                                    ScaleY="1.6">
+                    </ScaleTransform>
+                </DatePicker.RenderTransform>
+            </DatePicker>
+            <Border Style="{StaticResource buttonborder}">
+
+                <Button Content="查询"
+                        VerticalAlignment="Top" 
+                        Padding="30,5,30,5"
+                        BorderBrush="Transparent"
+                        FontSize="20"
+                        WindowChrome.IsHitTestVisibleInChrome="True"
+                        Background="Transparent" />
+            </Border>
+        </StackPanel>
+        <Grid Grid.Row="1">
+
+            <ListView
+                      x:Name="LVPatients"
+                      Margin="36,18,36,0"
+                      ItemContainerStyle="{StaticResource ResourceKey=ListViewItemContainerStylePatientList}"
+                      AlternationCount="2"
+                      BorderThickness="0">
+
+                <ListView.View>
+                    <GridView x:Name="pList"
+                              ColumnHeaderContainerStyle="{StaticResource ResourceKey=ListViewHeaderPatientList}">
+                        <GridViewColumn Header="序号"
+                                        DisplayMemberBinding="{Binding NAME}"
+                                        Width="100" />
+                        <GridViewColumn Header="创建日期"
+                                        DisplayMemberBinding="{Binding GENDER}"
+                                        Width="165" />
+                        <GridViewColumn Header="登录账号"
+                                        DisplayMemberBinding="{Binding AGE}"
+                                        Width="160" />
+                        <GridViewColumn Header="病例号"
+                                        DisplayMemberBinding="{Binding PATIENTSNO}"
+                                        Width="200" />
+                        <GridViewColumn Header="病例信息"
+                                        DisplayMemberBinding="{Binding TREATTYPE}"
+                                        Width="400" />
+                        <GridViewColumn Header="状态"
+                                        DisplayMemberBinding="{Binding BEDNO}"
+                                        Width="100" />
+                        <GridViewColumn Header="完成时间"
+                                        DisplayMemberBinding="{Binding DEPTNAME}"
+                                        Width="200" />
+                    </GridView>
+                </ListView.View>
+            </ListView>
+
+
+
+        </Grid>
+    </Grid>
+</UserControl>

+ 15 - 0
Views/ProductView.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace DefaultEdit.Views
+{
+    /// <summary>
+    /// ProductView.xaml 的交互逻辑
+    /// </summary>
+    public partial class ProductView : UserControl
+    {
+        public ProductView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 347 - 0
Views/RoleLoginView.xaml

@@ -0,0 +1,347 @@
+<Window x:Class="DefaultEdit.Views.RoleLoginView"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:DefaultEdit.Views"
+        xmlns:prism="http://prismlibrary.com/"
+        prism:ViewModelLocator.AutoWireViewModel="True"
+        xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+        mc:Ignorable="d"
+        FontFamily="微软雅黑"
+        WindowStyle="None"
+        Title="RoleLoginView" Height="360" Width="650">
+    <WindowChrome.WindowChrome>
+        <WindowChrome GlassFrameThickness="50"
+                      CaptionHeight="30"
+                      NonClientFrameEdges="Left,Bottom,Right"
+                      CornerRadius="20" />
+    </WindowChrome.WindowChrome>
+    <Window.Resources>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="Transparent" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="1"
+                                      ShadowDepth="0.5"
+                                      Color="#2961AC" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <!--ComboBox-->
+        <!--ComBoBox项选中背景色-->
+        <SolidColorBrush x:Key="ComboBoxSelectdBackground"
+                         Color="#ff8c69" />
+        <!--ComBoBox项鼠标经过背景色-->
+        <SolidColorBrush x:Key="ComboBoxMouseOverBackground"
+                         Color="#ff3030" />
+        <!--ComBoBox项选中前景色-->
+        <SolidColorBrush x:Key="ComboBoxSelectedForeground"
+                         Color="White" />
+        <!--ComBoBox项鼠标经过前景色-->
+        <SolidColorBrush x:Key="ComboBoxMouseOverForegrond"
+                         Color="White" />
+        <ControlTemplate x:Key="ComboBoxToggleButton"
+                         TargetType="{x:Type ToggleButton}">
+            <Grid Height="25"
+                  HorizontalAlignment="Stretch">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*" />
+                    <ColumnDefinition Width="30" />
+                </Grid.ColumnDefinitions>
+                <Border  Background="White"
+                         Grid.ColumnSpan="2"
+                         Opacity="0" />
+                <Path x:Name="Arrow"
+                      Grid.Column="1"
+                      Data="M 0 0  6 6 12 0 Z"
+                      VerticalAlignment="Center"
+                      HorizontalAlignment="Center"
+                      Stretch="None"
+                      Fill="#999" />
+            </Grid>
+            <ControlTemplate.Triggers>
+                <Trigger Property="IsChecked"
+                         Value="true">
+                    <Setter TargetName="Arrow"
+                            Property="RenderTransform">
+                        <Setter.Value>
+                            <RotateTransform   CenterX="6"
+                                               CenterY="3"
+                                               Angle="180"></RotateTransform>
+                        </Setter.Value>
+                    </Setter>
+                    <Setter TargetName="Arrow"
+                            Property="Margin"
+                            Value="0 0 0 2" />
+                </Trigger>
+            </ControlTemplate.Triggers>
+        </ControlTemplate>
+        <Style TargetType="{x:Type ComboBox}">
+            <Setter Property="ItemContainerStyle">
+                <Setter.Value>
+                    <Style TargetType="ComboBoxItem">
+                        <Setter Property="Height"
+                                Value="20" />
+                        <Setter Property="Template">
+                            <Setter.Value>
+                                <ControlTemplate  TargetType="{x:Type ComboBoxItem}">
+                                    <Grid Height="{TemplateBinding Height}"
+                                          Width="{TemplateBinding Width}">
+                                        <Border x:Name="_borderbg"
+                                                Background="Transparent" />
+                                        <TextBlock Margin="3 0 3 0"
+                                                   VerticalAlignment="Center"
+                                                   x:Name="_txt"
+                                                   Foreground="#333"
+                                                   Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}" />
+                                        <Border x:Name="_border"
+                                                Background="White"
+                                                Opacity="0" />
+                                    </Grid>
+                                    <ControlTemplate.Triggers>
+                                        <Trigger Property="IsSelected"
+                                                 Value="true">
+                                            <Setter TargetName="_borderbg"
+                                                    Property="Background"
+                                                    Value="{StaticResource ComboBoxSelectdBackground}" />
+                                            <Setter TargetName="_txt"
+                                                    Property="Foreground"
+                                                    Value="{StaticResource ComboBoxSelectedForeground}" />
+                                        </Trigger>
+                                        <MultiTrigger>
+                                            <MultiTrigger.Conditions>
+                                                <Condition Property="IsSelected"
+                                                           Value="false" />
+                                                <Condition Property="IsMouseOver"
+                                                           Value="true" />
+                                            </MultiTrigger.Conditions>
+                                            <Setter TargetName="_borderbg"
+                                                    Property="Background"
+                                                    Value="{StaticResource ComboBoxMouseOverBackground}" />
+                                            <Setter TargetName="_txt"
+                                                    Property="Foreground"
+                                                    Value="{StaticResource ComboBoxMouseOverForegrond}" />
+                                        </MultiTrigger>
+
+                                    </ControlTemplate.Triggers>
+                                </ControlTemplate>
+                            </Setter.Value>
+                        </Setter>
+                    </Style>
+                </Setter.Value>
+            </Setter>
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type ComboBox}">
+                        <Grid>
+
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="0.7*" />
+                                <ColumnDefinition Width="0.3*"
+                                                  MaxWidth="30" />
+                            </Grid.ColumnDefinitions>
+                            <Border  Grid.Column="0"
+                                     Grid.ColumnSpan="2"
+                                     BorderThickness="1"
+                                     BorderBrush="{TemplateBinding BorderBrush}"
+                                     CornerRadius="1,0,0,1" />
+                            <ContentPresenter HorizontalAlignment="Left"
+                                              Margin="3,3,0,3"
+                                              x:Name="ContentSite"
+                                              VerticalAlignment="Center"
+                                              Content="{TemplateBinding SelectionBoxItem}"
+                                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
+                                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
+                                              IsHitTestVisible="False" />
+
+                            <!--ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen-->
+                            <ToggleButton Grid.Column="0"
+                                          Grid.ColumnSpan="2"
+                                          Template="{StaticResource ComboBoxToggleButton}"
+                                          x:Name="ToggleButton"
+                                          Focusable="false"
+                                          IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
+                                          ClickMode="Press" />
+                            <!--必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它-->
+                            <TextBox   Visibility="Hidden"
+                                       BorderThickness="0"
+                                       Margin="2 0 0 0"
+                                       x:Name="PART_EditableTextBox"
+                                       VerticalAlignment="Center"
+                                       Focusable="True"
+                                       Background="Transparent"
+                                       IsReadOnly="{TemplateBinding IsReadOnly}" />
+
+                            <!--Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen-->
+                            <Popup IsOpen="{TemplateBinding IsDropDownOpen}"
+                                   Placement="Bottom"
+                                   x:Name="Popup"
+                                   Focusable="False"
+                                   AllowsTransparency="True"
+                                   PopupAnimation="Slide">
+                                <Grid MaxHeight="150"
+                                      MinWidth="{TemplateBinding ActualWidth}"
+                                      x:Name="DropDown"
+                                      SnapsToDevicePixels="True">
+                                    <Border x:Name="DropDownBorder"
+                                            BorderBrush="#e8e8e8"
+                                            BorderThickness="1 0 1 1" />
+                                    <ScrollViewer Margin="1"
+                                                  SnapsToDevicePixels="True"
+                                                  HorizontalScrollBarVisibility="Auto"
+                                                  VerticalScrollBarVisibility="Auto"
+                                                  CanContentScroll="True">
+                                        <!--StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True-->
+                                        <StackPanel IsItemsHost="True"
+                                                    KeyboardNavigation.DirectionalNavigation="Contained"
+                                                    Background="White" />
+                                    </ScrollViewer>
+                                </Grid>
+                            </Popup>
+                        </Grid>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsEditable"
+                                     Value="true">
+                                <Setter TargetName="PART_EditableTextBox"
+                                        Property="Visibility"
+                                        Value="Visible" />
+                            </Trigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </Window.Resources>
+    <Grid Background="Transparent">
+        <Border BorderBrush="AliceBlue" BorderThickness="2" Margin="10" CornerRadius="10">
+            <Border.Background>
+                <LinearGradientBrush>
+                    <GradientStop Color="#95DDFD"
+                                  Offset="0" />
+                    <GradientStop Color="#97B8FF"
+                                  Offset="0.4" />
+                    <GradientStop Color="#2961AC"
+                                  Offset="0.9" />
+                </LinearGradientBrush>
+            </Border.Background>
+            <Grid Background="White" Opacity="0.8">
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="60"/>
+                    <RowDefinition Height="Auto"/>
+                    <RowDefinition Height="Auto"/>
+                    <RowDefinition />
+                </Grid.RowDefinitions>
+                <Grid Grid.Row="0">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                    </Grid.ColumnDefinitions>
+                    <StackPanel Orientation="Horizontal" Grid.Column="0">
+                        <Ellipse Fill="#8A2BE1"
+                                 Width="50"
+                                 Height="50"
+                                 Stretch="Fill">
+                        </Ellipse>
+                        <TextBlock Text="自动外包"
+                                   Foreground="Black"
+                                   FontSize="25"
+                                   Margin="10"
+                                   FontWeight="Bold" />
+                    </StackPanel>
+                    <TextBlock Text="Login" Grid.Column="0"
+                               HorizontalAlignment="Left"
+                               Margin="5"
+                               VerticalAlignment="Center"
+                               FontSize="14" />
+                    <StackPanel Grid.Column="1" HorizontalAlignment="Right">
+                        <Border Style="{StaticResource buttonborder}">
+
+                            <Button Content="关闭"
+                                    VerticalAlignment="Top"
+                                    Foreground="Black"
+                                    Padding="5"
+                                    MinWidth="50"
+                                    BorderBrush="Transparent"
+                                    FontSize="15"
+                                    Click="Button_Click"
+                                    WindowChrome.IsHitTestVisibleInChrome="True"
+                                    Background="Transparent" />
+                        </Border>
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">
+                    <StackPanel>
+                        <TextBlock Text="登录"
+                                   Foreground="Black"
+                                   FontSize="25"
+                                   FontWeight="Bold" />
+                        <TextBlock Text="Sign in"
+                                   Foreground="Black"
+                                   FontSize="25"
+                                   Margin="0,0,0,10"
+                                   FontWeight="Bold" />
+                        <TextBox x:Name="combox"
+                                  Width="180"
+                                  Height="30"
+                                  Text="{Binding CurrRole}"
+                                 />
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="2">
+                    <StackPanel VerticalAlignment="Bottom"
+                                HorizontalAlignment="Center"
+                               >
+           
+                        <PasswordBox x:Name="PasswordBox"
+                                         Margin="5,20,5,5"
+                                         Width="180"
+                                     Height="30"
+                                     VerticalContentAlignment="Bottom"
+                                     FontSize="20"
+                                     FontWeight="Thin">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="PasswordChanged">
+                                    <i:InvokeCommandAction Command="{Binding PasswordChangedCommand}"
+                                                           CommandParameter="{Binding ElementName=PasswordBox}" />
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </PasswordBox>
+                       
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="3">
+                    
+                    <StackPanel HorizontalAlignment="Stretch"  VerticalAlignment="Center" Width="180">
+                        <TextBlock  TextAlignment="Center"
+                                    Background="{ Binding L_Brush}"
+                                    Text="{Binding Loginstr}" FontSize="12" FontWeight="Bold" FontFamily="微软雅黑" Margin="50,0,50,10"/>
+                        <Border Background="#0A85D9"  BorderBrush="Black" BorderThickness="1" CornerRadius="8">
+                            <Button Content="登录"
+                                    Name="loginbtu"
+                                    Background="Transparent"
+                                    FontSize="20"
+                                    Foreground="White"
+                                    Margin="5"
+                                    BorderThickness="0"
+                                    Command="{Binding LogoutCommand}"
+                                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"/>
+                        </Border>
+                    </StackPanel>
+                </Grid>
+
+            </Grid>
+        </Border>
+    </Grid>
+</Window>

+ 20 - 0
Views/RoleLoginView.xaml.cs

@@ -0,0 +1,20 @@
+using System.Windows;
+
+namespace DefaultEdit.Views
+{
+    /// <summary>
+    /// RoleLoginView.xaml 的交互逻辑
+    /// </summary>
+    public partial class RoleLoginView : Window
+    {
+        public RoleLoginView()
+        {
+            InitializeComponent();
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 140 - 0
Views/SettingView.xaml

@@ -0,0 +1,140 @@
+<UserControl x:Class="DefaultEdit.Views.SettingView"
+             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:DefaultEdit.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d"
+             d:DesignHeight="700"
+             d:DesignWidth="1000">
+    <UserControl.Resources>
+        <Style x:Key="textborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="#548CC5" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="#7DB1EC" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="White" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="White" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="#D4D8DD" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </UserControl.Resources>
+    <Grid Margin="20">
+        <Grid>
+
+            <StackPanel>
+                <StackPanel Margin="30"
+                            Orientation="Horizontal"
+                            HorizontalAlignment="Left"
+                            VerticalAlignment="Center">
+                    <TextBlock  Text="PlcIP:"
+                                Margin="5,5,58,5"
+                                FontSize="20"
+                                FontWeight="Bold" />
+                    <TextBox Text="{Binding Management.CurentApplicationSettings.PlcIP}"
+                             Width="280"
+                             FontSize="20"
+                             HorizontalContentAlignment="Center"
+                             VerticalContentAlignment="Center" />
+
+                </StackPanel>
+                <StackPanel Margin="30"
+                            Orientation="Horizontal"
+                            HorizontalAlignment="Left"
+                            VerticalAlignment="Center">
+                    <TextBlock  Text="打印机:"
+                                Margin="5,5,45,5"
+                                FontSize="20"
+                                FontWeight="Bold" />
+                    <TextBox Text="{Binding Management.CurentApplicationSettings.PrinterName}"
+                             FontSize="20"
+                             Width="280"
+                             HorizontalContentAlignment="Center"
+                             VerticalContentAlignment="Center" />
+
+                </StackPanel>
+                <StackPanel Margin="30"
+                            Orientation="Horizontal"
+                            HorizontalAlignment="Left"
+                            VerticalAlignment="Center">
+                    <TextBlock  Text="MES地址:"
+                                Margin="5,5,25,5"
+                                FontSize="20"
+                                FontWeight="Bold" />
+                    <TextBox Text="{Binding Management.CurentApplicationSettings.Url}"
+                             FontSize="20"
+                             Width="280"
+                             HorizontalContentAlignment="Center"
+                             VerticalContentAlignment="Center" />
+
+                </StackPanel>
+                <StackPanel Margin="30"
+                            Orientation="Horizontal"
+                            HorizontalAlignment="Left"
+                            VerticalAlignment="Center">
+                    <TextBlock  Text="设备编号:"
+                                Margin="5,5,25,5"
+                                FontSize="20"
+                                FontWeight="Bold" />
+                    <TextBox Text="{Binding Management.CurentApplicationSettings.DeviceId}"
+                             FontSize="20"
+                             Width="300"
+                             HorizontalContentAlignment="Center"
+                             VerticalContentAlignment="Center" />
+                </StackPanel>
+                <StackPanel Margin="30"
+                            Orientation="Horizontal"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center">
+                    <Border Style="{StaticResource buttonborder}">
+
+                        <Button Content="保存"
+                                VerticalAlignment="Top"
+                                Padding="30,5,30,5"
+                                BorderBrush="Black"
+                                FontSize="20"
+                                Command="{Binding SaveSettingsCommand}"
+                                WindowChrome.IsHitTestVisibleInChrome="True"
+                                Background="Transparent" />
+                    </Border>
+
+                </StackPanel>
+            </StackPanel>
+
+        </Grid>
+    </Grid>
+</UserControl>

+ 15 - 0
Views/SettingView.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace DefaultEdit.Views
+{
+    /// <summary>
+    /// SettingView.xaml 的交互逻辑
+    /// </summary>
+    public partial class SettingView : UserControl
+    {
+        public SettingView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 441 - 0
Views/WorkRunView.xaml

@@ -0,0 +1,441 @@
+<UserControl x:Class="DefaultEdit.Views.WorkRunView"
+             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:scottplot="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
+             xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
+             xmlns:local="clr-namespace:DefaultEdit.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             xmlns:Viewlocal="clr-namespace:DefaultEdit.ViewModels"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d"
+             d:DesignHeight="850"
+             d:DesignWidth="1200">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto" />
+            <RowDefinition Height="Auto" />
+            <RowDefinition Height="*" />
+
+        </Grid.RowDefinitions>
+
+
+        <Border  Grid.Row="0"
+                 Margin="5"
+                 BorderBrush="#7AB0F0"
+                 BorderThickness="2"
+                 CornerRadius="5"
+                 Padding="1">
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="20*" />
+                    <ColumnDefinition Width="40*" />
+                    <ColumnDefinition Width="40*" />
+
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <Grid.RowDefinitions>
+                        <RowDefinition />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+
+                    <StackPanel  Orientation="Horizontal"
+                                 Grid.Row="0"
+                                 VerticalAlignment="Bottom">
+                        <TextBlock Text="用户名"
+                                   Margin="20,5,5,5"
+                                   FontSize="18" />
+                        <TextBlock Text="1111"
+                                   Margin="20,5,5,5"
+                                   FontSize="18" />
+                    </StackPanel>
+
+                    <StackPanel  Orientation="Horizontal"
+                                 Grid.Row="1"
+                                 VerticalAlignment="Bottom">
+                        <Button Content="登录"
+                                Width="65"
+                                Background="#7E61E0"
+                                Margin="20,5,5,5"
+                                Command="{Binding OpenRoleLoginViewCommand}"
+                                FontSize="18" />
+                        <Button Content="在线"
+                                Width="65"
+                                Command="{Binding SwitchModeCommand}"
+                                Background="#7E61E0"
+                                Margin="20,5,5,5"
+                                FontSize="18" />
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Column="1"
+                      Margin="5,5,30,5"
+                      Height="300">
+                    <scottplot:WpfPlot Name="plot"
+                                       Grid.Column="0" />
+                </Grid>
+                <Grid Grid.Column="2"
+                      Margin="0,20,0,0">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+
+                    <TextBlock Text="离心工位#1"
+                               Margin="0,0,80,0"
+                               Grid.Row="0"
+                               Grid.Column="0" />
+                    <TextBlock Text="离心工位#2"
+                               Margin="0,0,80,0"
+                               Grid.Row="0"
+                               Grid.Column="1" />
+                    <TextBlock Text="{Binding Management.CurrStationRfid[0]}"
+                               Grid.Row="1"
+                               Grid.Column="0" />
+                    <TextBlock Text="{Binding Management.CurrStationRfid[1]}"
+                               Grid.Row="1"
+                               Grid.Column="1" />
+
+
+
+                    <TextBlock Text="离心工位#3"
+                               Grid.Row="2"
+                               Grid.Column="0" />
+                    <TextBlock Text="离心工位#4"
+                               Grid.Row="2"
+                               Grid.Column="1" />
+                    <TextBlock Text="离心工位#3"
+                               Grid.Row="3"
+                               Grid.Column="0" />
+                    <TextBlock Text="离心工位#4"
+                               Grid.Row="3"
+                               Grid.Column="1" />
+
+
+                    <TextBlock Text="#1固化工位#1"
+                               Grid.Row="4"
+                               Grid.Column="0" />
+                    <TextBlock Text="#1固化工位#2"
+                               Grid.Row="4"
+                               Grid.Column="1" />
+                    <TextBlock Text="#1固化工位#2"
+                               Grid.Row="5"
+                               Grid.Column="0" />
+                    <TextBlock Text="#1固化工位#2"
+                               Grid.Row="5"
+                               Grid.Column="1" />
+
+
+
+                    <TextBlock Text="#2固化工位#1"
+                               Grid.Row="6"
+                               Grid.Column="0" />
+                    <TextBlock Text="#2固化工位#2"
+                               Grid.Row="6"
+                               Grid.Column="1" />
+                    <TextBlock Text="#2固化工位#1"
+                               Grid.Row="7"
+                               Grid.Column="0" />
+                    <TextBlock Text="#2固化工位#2"
+                               Grid.Row="7"
+                               Grid.Column="1" />
+
+
+                    <TextBlock Text="顶出工位"
+                               Grid.Row="2"
+                               Grid.Column="2" />
+                    <TextBlock Text="顶出工位"
+                               Grid.Row="3"
+                               Grid.Column="2" />
+
+                </Grid>
+            </Grid>
+        </Border>
+        <Border  Grid.Row="1"
+                 Margin="5"
+                 BorderBrush="#7AB0F0"
+                 BorderThickness="2"
+                 CornerRadius="5"
+                 Padding="1">
+
+
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="Auto" />
+                    <ColumnDefinition Width="Auto" />
+                    <ColumnDefinition Width="*" />
+                </Grid.ColumnDefinitions>
+                <TextBlock Text="后处理"
+                           FontSize="20"
+                           Grid.Column="0"
+                           Margin="50,5,50,5"
+                           VerticalAlignment="Center" />
+                <StackPanel Width="5"
+                            Height="140"
+                            Background="DarkGray"
+                            Grid.Column="1">
+
+                </StackPanel>
+
+                <Grid Grid.Column="2">
+                    <Grid.RowDefinitions>
+                        <RowDefinition />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                    </Grid.ColumnDefinitions>
+                    <StackPanel   Grid.Row="0"
+                                  Grid.Column="0">
+                        <TextBlock Text="离心转速"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.Speed}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+                    <StackPanel   Grid.Row="0"
+                                  Grid.Column="1">
+                        <TextBlock Text="离心时间"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.Time,StringFormat=hh\\:mm\\:ss}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+
+                    <StackPanel   Grid.Row="0"
+                                  Grid.Column="2">
+                        <TextBlock Text="#1光固化#1功率"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.Power1_1}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+
+                    <StackPanel   Grid.Row="0"
+                                  Grid.Column="3">
+                        <TextBlock Text="#1光固化#2功率"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.Power1_2}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+                    <StackPanel   Grid.Row="0"
+                                  Grid.Column="4">
+                        <TextBlock Text="#2光固化#1功率"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.Power1_3}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+                    <StackPanel   Grid.Row="0"
+                                  Grid.Column="5">
+                        <TextBlock Text="#2光固化#2功率"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.Power1_4}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+
+
+                    <StackPanel   Grid.Row="1"
+                                  Grid.Column="0">
+                        <TextBlock Text="#1固化箱压力"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.Pressure1}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+                    <StackPanel   Grid.Row="1"
+                                  Grid.Column="1">
+                        <TextBlock Text="#2固化箱压力"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.Pressure2}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+
+                    <StackPanel   Grid.Row="1"
+                                  Grid.Column="2">
+                        <TextBlock Text="#1光固化时间"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.PTime1}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+                    <StackPanel   Grid.Row="1"
+                                  Grid.Column="3">
+                        <TextBlock Text="#2光固化时间"
+                                   Margin="0,0,80,0" />
+                        <TextBlock Text="{Binding Management.CurrConfig.PTime2}"
+                                   Margin="0,0,80,0" />
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </Border>
+        <Grid Grid.Row="2">
+
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="20*"/>
+                <ColumnDefinition Width="40*"/>
+                <ColumnDefinition Width="40*"/>
+              
+            </Grid.ColumnDefinitions>
+            <Grid Grid.Column="0">
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="Auto" />
+                    <RowDefinition />
+                </Grid.RowDefinitions>
+                <TextBlock Text="后处理配方参数"
+                           FontSize="20" />
+                <Border Margin="5"
+                        Grid.Row="1"
+                        BorderBrush="#7AB0F0"
+                        BorderThickness="2"
+                        CornerRadius="5"
+                        Padding="1">
+                    <Grid>
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition />
+                            <ColumnDefinition />
+
+                        </Grid.ColumnDefinitions>
+                        <Grid.RowDefinitions>
+                            <RowDefinition />
+                            <RowDefinition />
+                            <RowDefinition />
+                            <RowDefinition />
+                            <RowDefinition />
+                            <RowDefinition />
+                            <RowDefinition />
+                            <RowDefinition />
+                            <RowDefinition />
+                        </Grid.RowDefinitions>
+                        <TextBlock Text="配方名称"
+                                   Grid.Row="0"
+                                   Grid.Column="0" />
+                        <TextBlock Text="后处理配方"
+                                   Grid.Row="0"
+                                   Grid.Column="1" />
+
+                        <TextBlock Text="第一次离心转速"
+                                   Grid.Row="1"
+                                   Grid.Column="0" />
+                        <TextBlock Text="180"
+                                   Grid.Row="1"
+                                   Grid.Column="1" />
+
+                        <TextBlock Text="第一次离心时间"
+                                   Grid.Row="2"
+                                   Grid.Column="0" />
+                        <TextBlock Text="180"
+                                   Grid.Row="2"
+                                   Grid.Column="1" />
+
+                        <TextBlock Text="第二次离心转速"
+                                   Grid.Row="3"
+                                   Grid.Column="0" />
+                        <TextBlock Text="180"
+                                   Grid.Row="3"
+                                   Grid.Column="1" />
+
+                        <TextBlock Text="第二次离心时间"
+                                   Grid.Row="4"
+                                   Grid.Column="0" />
+                        <TextBlock Text="180"
+                                   Grid.Row="4"
+                                   Grid.Column="1" />
+                        <TextBlock Text="离心温度"
+                                   Grid.Row="5"
+                                   Grid.Column="0" />
+                        <TextBlock Text="180"
+                                   Grid.Row="5"
+                                   Grid.Column="1" />
+                        <TextBlock Text="光固化时间"
+                                   Grid.Row="6"
+                                   Grid.Column="0" />
+                        <TextBlock Text="180"
+                                   Grid.Row="6"
+                                   Grid.Column="1" />
+                    </Grid>
+                </Border>
+            </Grid>
+            <Grid Grid.Column="1">
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="Auto" />
+                    <RowDefinition />
+                </Grid.RowDefinitions>
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="过程信息"
+                               Margin="0,0,40,0"
+                               FontSize="20" />
+                    <Button Content="清空"
+                            Width="80"
+                            Command="{Binding ClearRunDataCommand}"
+                            Background="#1152D7"
+                            HorizontalAlignment="Right"
+                            FontSize="20" />
+                </StackPanel>
+                <Border Margin="5"
+                        Grid.Row="1"
+                        BorderBrush="#7AB0F0"
+                        BorderThickness="2"
+                        CornerRadius="5"
+                        Padding="1">
+                    <ListView ItemsSource="{Binding Management.RuningData}">
+                        <ListView.View>
+                            <GridView>
+                                <GridViewColumn  Header="网板ID"
+                                                 DisplayMemberBinding="{Binding Rfid}"
+                                                 Width="150" />
+                                <GridViewColumn  Header="状态"
+                                                 DisplayMemberBinding="{Binding State}"
+                                                 Width="200" />
+                                <GridViewColumn  Header="批次信息"
+                                                 DisplayMemberBinding="{Binding ModelsInfo}"
+                                                 Width="200" />
+                                <GridViewColumn  Header="开始时间"
+                                                 DisplayMemberBinding="{Binding StartTime,StringFormat=yyyy-MM-dd}"
+                                                 Width="200" />
+                            </GridView>
+                        </ListView.View>
+
+                    </ListView>
+                </Border>
+            </Grid>
+            <Grid Grid.Column="2" >
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="Auto" />
+                    <RowDefinition />
+                </Grid.RowDefinitions>
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="日志"
+                               Margin="0,0,40,0"
+                               FontSize="20" />
+                    <Button Content="清空"
+                            Width="80"
+                            Background="#1152D7"
+                            Command="{Binding ClearLogDataCommand}"
+                            HorizontalAlignment="Right"
+                            FontSize="20" />
+                </StackPanel>
+                <Border Margin="5"
+                        Grid.Row="1"
+                        BorderBrush="#7AB0F0"
+                        BorderThickness="2"
+                        CornerRadius="5"
+                        Padding="1">
+                    <ListBox ItemsSource="{Binding Logs}">
+                       
+                    </ListBox>
+                </Border>
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>

+ 32 - 0
Views/WorkRunView.xaml.cs

@@ -0,0 +1,32 @@
+using DefaultEdit.Core;
+using Prism.Ioc;
+using ScottPlot;
+using System.Windows.Controls;
+
+namespace DefaultEdit.Views
+{
+    /// <summary>
+    /// WorkRunView.xaml 的交互逻辑
+    /// </summary>
+    public partial class WorkRunView : UserControl
+    {
+        private Management management;
+        public WorkRunView(IContainerProvider container)
+        {
+            InitializeComponent();
+            var hist = plot.Plot;
+            management=container.Resolve<Management>();
+            management.ProduceDataToChangeEvent += Management_ProduceDataToChangeEvent;
+            hist.Add.Bars(management.ProduceData);
+            plot.Refresh();
+        }
+
+        private void Management_ProduceDataToChangeEvent()
+        {
+            var hist = plot.Plot;
+            hist.Clear();
+            hist.Add.Bars(management.ProduceData);
+            plot.Refresh();
+        }
+    }
+}

+ 51 - 0
packages.config

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="EasyHttp" version="1.7.0" targetFramework="net48" />
+  <package id="EntityFramework" version="6.4.4" targetFramework="net48" />
+  <package id="HarfBuzzSharp" version="7.3.0.3" targetFramework="net48" />
+  <package id="HarfBuzzSharp.NativeAssets.Linux" version="7.3.0.3" targetFramework="net48" />
+  <package id="HarfBuzzSharp.NativeAssets.macOS" version="7.3.0.3" targetFramework="net48" />
+  <package id="HarfBuzzSharp.NativeAssets.Win32" version="7.3.0.3" targetFramework="net48" />
+  <package id="JsonFx" version="2.0.1209.2802" targetFramework="net48" />
+  <package id="log4net" version="3.0.0" targetFramework="net48" />
+  <package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.31" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+  <package id="ObservableCollections" version="3.3.4" targetFramework="net48" />
+  <package id="OpenCvSharp4" version="4.10.0.20241108" targetFramework="net48" />
+  <package id="OpenCvSharp4.Extensions" version="4.10.0.20241108" targetFramework="net48" />
+  <package id="OpenCvSharp4.runtime.win" version="4.10.0.20241108" targetFramework="net48" />
+  <package id="OpenTK" version="3.3.1" targetFramework="net48" />
+  <package id="OpenTK.GLWpfControl" version="3.3.0" targetFramework="net48" />
+  <package id="Prism.Core" version="8.1.97" targetFramework="net48" />
+  <package id="Prism.Unity" version="8.1.97" targetFramework="net48" />
+  <package id="Prism.Wpf" version="8.1.97" targetFramework="net48" />
+  <package id="ScottPlot" version="5.0.55" targetFramework="net48" />
+  <package id="ScottPlot.WPF" version="5.0.55" targetFramework="net48" />
+  <package id="Sharp7" version="1.1.84" targetFramework="net48" />
+  <package id="SkiaSharp" version="2.88.9" targetFramework="net48" />
+  <package id="SkiaSharp.HarfBuzz" version="2.88.9" targetFramework="net48" />
+  <package id="SkiaSharp.NativeAssets.Linux.NoDependencies" version="2.88.9" targetFramework="net48" />
+  <package id="SkiaSharp.NativeAssets.macOS" version="2.88.9" targetFramework="net48" />
+  <package id="SkiaSharp.NativeAssets.Win32" version="2.88.9" targetFramework="net48" />
+  <package id="SkiaSharp.Views.Desktop.Common" version="2.88.9" targetFramework="net48" />
+  <package id="SkiaSharp.Views.WPF" version="2.88.9" targetFramework="net48" />
+  <package id="SqlSugar" version="5.1.4.188" targetFramework="net48" />
+  <package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net48" />
+  <package id="System.Data.SQLite" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Data.SQLite.EF6" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Data.SQLite.Linq" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Drawing.Common" version="8.0.0" targetFramework="net48" />
+  <package id="System.IO.Ports" version="8.0.0" targetFramework="net48" />
+  <package id="System.Memory" version="4.5.5" targetFramework="net48" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
+  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
+  <package id="System.ValueTuple" version="4.6.1" targetFramework="net48" />
+  <package id="TouchSocket" version="3.1.6" targetFramework="net48" />
+  <package id="TouchSocket.Core" version="3.1.6" targetFramework="net48" />
+  <package id="TouchSocket.SerialPorts" version="3.1.6" targetFramework="net48" />
+  <package id="Unity.Abstractions" version="5.11.7" targetFramework="net48" />
+  <package id="Unity.Container" version="5.11.11" targetFramework="net48" />
+</packages>