Selaa lähdekoodia

添加项目文件。

844184169 9 kuukautta sitten
sitoutus
0db172ae82

+ 63 - 0
.gitattributes

@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs     diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following 
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln       merge=binary
+#*.csproj    merge=binary
+#*.vbproj    merge=binary
+#*.vcxproj   merge=binary
+#*.vcproj    merge=binary
+#*.dbproj    merge=binary
+#*.fsproj    merge=binary
+#*.lsproj    merge=binary
+#*.wixproj   merge=binary
+#*.modelproj merge=binary
+#*.sqlproj   merge=binary
+#*.wwaproj   merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg   binary
+#*.png   binary
+#*.gif   binary
+
+###############################################################################
+# diff behavior for common document formats
+# 
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the 
+# entries below.
+###############################################################################
+#*.doc   diff=astextplain
+#*.DOC   diff=astextplain
+#*.docx  diff=astextplain
+#*.DOCX  diff=astextplain
+#*.dot   diff=astextplain
+#*.DOT   diff=astextplain
+#*.pdf   diff=astextplain
+#*.PDF   diff=astextplain
+#*.rtf   diff=astextplain
+#*.RTF   diff=astextplain

+ 363 - 0
.gitignore

@@ -0,0 +1,363 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Oo]ut/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd

+ 25 - 0
LocalhostMES.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}") = "LocalhostMES", "LocalhostMES\LocalhostMES.csproj", "{F51B99A2-C4D9-40C8-A79F-5C7BFE34C202}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{F51B99A2-C4D9-40C8-A79F-5C7BFE34C202}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F51B99A2-C4D9-40C8-A79F-5C7BFE34C202}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F51B99A2-C4D9-40C8-A79F-5C7BFE34C202}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F51B99A2-C4D9-40C8-A79F-5C7BFE34C202}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {335FAB7B-D5A7-4BE3-AD6C-D984F6DD2B00}
+	EndGlobalSection
+EndGlobal

+ 358 - 0
LocalhostMES/App.config

@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <configSections>
+    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
+  </configSections>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+  </startup>
+  <log4net>
+    <root>
+      <level value="ALL" />
+    </root>
+    <logger name="OperationLog">
+      <level value="INFO" />
+      <appender-ref ref="OperationLogAppender" />
+    </logger>
+    <logger name="ErrorLog">
+      <level value="WARN" />
+      <appender-ref ref="ErrorLogAppender" />
+    </logger>
+    <!--错误日志类-->
+    <logger name="logerror">
+      <!--日志类的名字-->
+      <level value="ALL" />
+      <!--定义记录的日志级别-->
+      <appender-ref ref="ErrorAppender" />
+      <!--记录到哪个介质中去-->
+    </logger>
+    <!--信息日志类-->
+    <logger name="loginfo">
+      <level value="ALL" />
+      <appender-ref ref="InfoAppender" />
+    </logger>
+    <!--调试日志类-->
+    <logger name="logdebug">
+      <!--日志类的名字-->
+      <level value="ALL" />
+      <!--定义记录的日志级别-->
+      <appender-ref ref="DebugAppender" />
+      <!--记录到哪个介质中去-->
+    </logger>
+    <!--警告日志类-->
+    <logger name="logwarn">
+      <!--日志类的名字-->
+      <level value="ALL" />
+      <!--定义记录的日志级别-->
+      <appender-ref ref="WarnAppender" />
+      <!--记录到哪个介质中去-->
+    </logger>
+    <!--重大错误日志类-->
+    <logger name="logfatal">
+      <!--日志类的名字-->
+      <level value="ALL" />
+      <!--定义记录的日志级别-->
+      <appender-ref ref="FatalAppender" />
+      <!--记录到哪个介质中去-->
+    </logger>
+    <!--动态日志类-->
+    <logger name="logDynamic">
+      <level value="ALL" />
+      <appender-ref ref="DynamicAppender" />
+    </logger>
+    <!--定义输出到文件中-->
+    <!--错误日志附加介质-->
+    <appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
+      <!-- name属性指定其名称,type则是log4net.Appender命名空间的一个类的名称,意思是,指定使用哪种介质-->
+      <param name="File" value="..\\Log\\LogError\\" />
+      <!--日志输出到exe程序这个相对目录下-->
+      <param name="AppendToFile" value="true" />
+      <!--输出的日志不会覆盖以前的信息-->
+      <param name="MaxSizeRollBackups" value="100" />
+      <!--备份文件的个数-->
+      <param name="MaxFileSize" value="10240" />
+      <!--当个日志文件的最大大小-->
+      <param name="StaticLogFileName" value="false" />
+      <!--是否使用静态文件名-->
+      <param name="DatePattern" value="yyyy-MM\\yyyy-MM-dd&quot;.htm&quot;" />
+      <!--日志文件名-->
+      <param name="RollingStyle" value="Date" />
+      <!--文件创建的方式,这里是以Date方式创建-->
+      <!--错误日志布局-->
+      <layout type="log4net.Layout.PatternLayout">
+        <param name="ConversionPattern" value="&lt;HR COLOR=red&gt;%n异常时间:%d [%t] &lt;BR&gt;%n异常级别:%-5p &lt;BR&gt;%n异 常 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n &lt;HR Size=1&gt;" />
+      </layout>
+    </appender>
+    <!--重大错误日志附加介质-->
+    <appender name="FatalAppender" type="log4net.Appender.RollingFileAppender">
+      <!-- name属性指定其名称,type则是log4net.Appender命名空间的一个类的名称,意思是,指定使用哪种介质-->
+      <param name="File" value="..\\Log\\LogFatal\\" />
+      <!--日志输出到exe程序这个相对目录下-->
+      <param name="AppendToFile" value="true" />
+      <!--输出的日志不会覆盖以前的信息-->
+      <param name="MaxSizeRollBackups" value="100" />
+      <!--备份文件的个数-->
+      <param name="MaxFileSize" value="10240" />
+      <!--当个日志文件的最大大小-->
+      <param name="StaticLogFileName" value="false" />
+      <!--是否使用静态文件名-->
+      <param name="DatePattern" value="yyyy-MM\\yyyy-MM-dd&quot;.htm&quot;" />
+      <!--日志文件名-->
+      <param name="RollingStyle" value="Date" />
+      <!--文件创建的方式,这里是以Date方式创建-->
+      <!--错误日志布局-->
+      <layout type="log4net.Layout.PatternLayout">
+        <param name="ConversionPattern" value="&lt;HR COLOR=red&gt;%n异常时间:%d [%t] &lt;BR&gt;%n异常级别:%-5p &lt;BR&gt;%n异 常 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n &lt;HR Size=1&gt;" />
+      </layout>
+    </appender>
+    <!--信息日志附加介质-->
+    <appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
+      <param name="File" value="..\\Log\\LogInfo\\" />
+      <param name="AppendToFile" value="true" />
+      <param name="MaxFileSize" value="10240" />
+      <param name="MaxSizeRollBackups" value="100" />
+      <param name="StaticLogFileName" value="false" />
+      <param name="DatePattern" value="yyyy-MM\\yyyy-MM-dd&quot;.txt&quot;" />
+      <param name="RollingStyle" value="Date" />
+      <!--信息日志布局-->
+      <layout type="log4net.Layout.PatternLayout">
+        <!--param name="ConversionPattern" value="&lt;HR COLOR=blue&gt;%n日志时间:%d [%t] &lt;BR&gt;%n日志级别:%-5p &lt;BR&gt;%n日 志 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n &lt;HR Size=1&gt;"  /-->
+        <param name="ConversionPattern" value="[日志时间:%d] [%t] [%-5p]:%m%n" />
+      </layout>
+    </appender>
+    <!--调试日志附加介质-->
+    <appender name="DebugAppender" type="log4net.Appender.RollingFileAppender">
+      <param name="File" value="..\\Log\\LogDebug\\" />
+      <param name="AppendToFile" value="true" />
+      <param name="MaxFileSize" value="10240" />
+      <param name="MaxSizeRollBackups" value="100" />
+      <param name="StaticLogFileName" value="false" />
+      <param name="DatePattern" value="yyyy-MM\\yyyy-MM-dd&quot;.txt&quot;" />
+      <param name="RollingStyle" value="Date" />
+      <!--信息日志布局-->
+      <layout type="log4net.Layout.PatternLayout">
+        <!--param name="ConversionPattern" value="&lt;HR COLOR=blue&gt;%n日志时间:%d [%t] &lt;BR&gt;%n日志级别:%-5p &lt;BR&gt;%n日 志 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n &lt;HR Size=1&gt;"  /-->
+        <param name="ConversionPattern" value="[日志时间:%d] [%t] [%-5p]:%m%n" />
+      </layout>
+    </appender>
+    <!--警告日志附加介质-->
+    <appender name="WarnAppender" type="log4net.Appender.RollingFileAppender">
+      <param name="File" value="..\\Log\\LogWarn\\" />
+      <param name="AppendToFile" value="true" />
+      <param name="MaxFileSize" value="10240" />
+      <param name="MaxSizeRollBackups" value="100" />
+      <param name="StaticLogFileName" value="false" />
+      <param name="DatePattern" value="yyyy-MM\\yyyy-MM-dd&quot;.txt&quot;" />
+      <param name="RollingStyle" value="Date" />
+      <!--信息日志布局-->
+      <layout type="log4net.Layout.PatternLayout">
+        <!--param name="ConversionPattern" value="&lt;HR COLOR=blue&gt;%n日志时间:%d [%t] &lt;BR&gt;%n日志级别:%-5p &lt;BR&gt;%n日 志 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n &lt;HR Size=1&gt;"  /-->
+        <param name="ConversionPattern" value="[日志时间:%d] [%t] [%-5p]:%m%n" />
+      </layout>
+    </appender>
+    <!--动态日志附加介质-->
+    <appender name="DynamicAppender" type="log4net.Appender.RollingFileAppender">
+      <!--输出日志文件的路径-->
+      <param name="File" value="..\\Log\\LogOther\\" />
+      <!--输出日志时自动向后追加-->
+      <param name="AppendToFile" value="true" />
+      <!--防止多线程时不能写Log,官方说线程非安全,但实际使用时,本地测试正常,部署后有不能写日志的情况-->
+      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
+      <param name="MaxFileSize" value="10240" />
+      <param name="MaxSizeRollBackups" value="100" />
+      <param name="StaticLogFileName" value="false" />
+      <param name="DatePattern" value="yyyy-MM\\yyyy-MM-dd&quot;.txt&quot;" />
+      <param name="RollingStyle" value="Date" />
+      <!--输出格式-->
+      <!--样例:[日志时间:2023-11-08 10:56:12,247] [1] [INFO ]:系统启动!-->
+      <!--信息日志布局-->
+      <layout type="log4net.Layout.PatternLayout">
+        <param name="ConversionPattern" value="[日志时间:%d] [%t] [%-5p]:%m%n" />
+      </layout>
+    </appender>
+  </log4net>
+  <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.4.0" newVersion="4.2.4.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.ObjectPool" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-8.0.11.0" newVersion="8.0.11.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.AspNetCore.Http.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.AspNetCore.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.1.1.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.AspNetCore.Authentication.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Net.Http.Headers" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.AspNetCore.Authentication.Core" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Configuration.EnvironmentVariables" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Configuration.FileExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.FileProviders.Physical" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Configuration.CommandLine" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Logging.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Logging.Console" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Logging.Debug" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Options.ConfigurationExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Configuration.Json" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Extensions.Configuration.UserSecrets" publicKeyToken="adb9793829ddae60" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.1" newVersion="10.0.0.1" />
+      </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="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.2.3.0" newVersion="4.2.3.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-9.5.0.0" newVersion="9.5.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Unity.Abstractions" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.11.7.0" newVersion="5.11.7.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Unity.Container" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.11.1.0" newVersion="5.11.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 54 - 0
LocalhostMES/App.xaml

@@ -0,0 +1,54 @@
+<prism:PrismApplication x:Class="LocalhostMES.App"
+                        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                        xmlns:prism="http://prismlibrary.com/"
+                        xmlns:local="clr-namespace:LocalhostMES.Views">
+    <Application.Resources>
+        <!-- 转换器 -->
+        <local:ResultColorConverter x:Key="ResultColorConverter" />
+        <Style TargetType="Button">
+            <Setter Property="Background"
+                    Value="#007ACC" />
+            <Setter Property="Foreground"
+                    Value="White" />
+            <Setter Property="BorderThickness"
+                    Value="0" />
+            <Setter Property="Padding"
+                    Value="10,5" />
+            <Setter Property="Cursor"
+                    Value="Hand" />
+            <Style.Triggers>
+                <Trigger Property="IsMouseOver"
+                         Value="True">
+                    <Setter Property="Background"
+                            Value="#005A9E" />
+                </Trigger>
+                <Trigger Property="IsEnabled"
+                         Value="False">
+                    <Setter Property="Background"
+                            Value="#CCCCCC" />
+                </Trigger>
+            </Style.Triggers>
+        </Style>
+
+        <Style TargetType="TextBox">
+            <Setter Property="BorderThickness"
+                    Value="1" />
+            <Setter Property="BorderBrush"
+                    Value="#CCCCCC" />
+            <Setter Property="Padding"
+                    Value="5" />
+        </Style>
+
+        <Style TargetType="DataGrid">
+            <Setter Property="BorderThickness"
+                    Value="1" />
+            <Setter Property="BorderBrush"
+                    Value="#CCCCCC" />
+            <Setter Property="RowBackground"
+                    Value="White" />
+            <Setter Property="AlternatingRowBackground"
+                    Value="#F5F5F5" />
+        </Style>
+    </Application.Resources>
+</prism:PrismApplication>

+ 72 - 0
LocalhostMES/App.xaml.cs

@@ -0,0 +1,72 @@
+using LocalhostMES.Controller;
+using LocalhostMES.Core;
+using LocalhostMES.ViewModels;
+using LocalhostMES.Views;
+using Microsoft.Owin.Hosting;
+using Prism.Ioc;
+using Prism.Regions;
+using Prism.Unity;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using Unity;
+
+namespace LocalhostMES
+{
+    /// <summary>
+    /// App.xaml 的交互逻辑
+    /// </summary>
+    public partial class App : PrismApplication
+    {
+
+        protected override Window CreateShell()
+        {
+
+       
+
+            // 写入启动日志
+            LogHelper.WriteLogInfo("程序启动");
+            return Container.Resolve<MainView>();
+
+        }
+        protected override void RegisterTypes(IContainerRegistry containerRegistry)
+        {
+            
+
+            containerRegistry.Register<MainViewModel>();
+
+
+        }
+        protected override void OnInitialized()
+        {
+            base.OnInitialized();
+            
+        }
+        private static System.Threading.Mutex mutex;
+        protected override void OnStartup(StartupEventArgs e)
+        {
+           
+
+            mutex = new System.Threading.Mutex(true, "LocalhostMes_CRNS");
+            if ( mutex.WaitOne(0, false) )
+            {
+                base.OnStartup(e);
+            }
+            else
+            {
+                MessageBox.Show("程序已经在运行!", "提示");
+                this.Shutdown();
+            }
+        }
+ 
+
+       
+    }
+}
+

+ 200 - 0
LocalhostMES/Controller/MesApiClient.cs

@@ -0,0 +1,200 @@
+using LocalhostMES.DataBase;
+using LocalhostMES.Models;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Text.Json.Nodes;
+using System.Threading.Tasks;
+
+namespace LocalhostMES.Controller
+{
+    public class MesApiClient : IDisposable
+    {
+        private readonly HttpClient _httpClient;
+        private readonly string _baseUrl;
+        private readonly string _appKey;
+        private readonly string _token;
+
+        public MesApiClient(string baseUrl, string appKey = "test-app-key", string token = "test-token-123")
+        {
+            _baseUrl = baseUrl;
+            _appKey = appKey;
+            _token = token;
+            _httpClient = new HttpClient
+            {
+                Timeout = TimeSpan.FromSeconds(60)
+            };
+        }
+
+        #region 2.1 厂级MES下发工单信息
+        public async Task<ApiResponse<bool>> SendWorkOrderAsync(WorkOrderRequest request)
+        {
+            // 2.1.2 Headers - 免TOKEN写入
+            var content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");
+            var response = await _httpClient.PostAsync($"{_baseUrl}/api/mes/receiveWorkOrder", content);//http://192.168.1.26:5000/api/mes/receiveWorkOrder
+            return await ParseResponseAsync<ApiResponse<bool>>(response);
+        }
+
+        public async Task<ApiResponse<List<WorkOrderInfo>>> GetWorkOrdersAsync()
+        {
+            var response = await _httpClient.GetAsync($"{_baseUrl}/api/mes/getWorkOrders");
+            return await ParseResponseAsync<ApiResponse<List<WorkOrderInfo>>>(response);
+        }
+        #endregion
+
+        #region 2.2 SN打印请求
+        public async Task<ApiResponse<SnPrintResponseData>> RequestSnPrintAsync(SnPrintRequest request)
+        {
+            // 2.2.2 Headers - 需要token
+            var requestJson = JsonConvert.SerializeObject(request);
+            var content = new StringContent(requestJson, Encoding.UTF8, "application/json");
+            var requestMessage = new HttpRequestMessage(HttpMethod.Post, $"https://uat-mom-jh-handle-api.leapmotor.com:443/app-mom-mes/api/battery/sn/print")
+            {
+                Content = content
+            };
+            requestMessage.Headers.Add("app-key", _appKey);
+            requestMessage.Headers.Add("token", _token);
+            var response = await _httpClient.SendAsync(requestMessage);
+            ApiResponse<SnPrintResponseData> res = await ParseResponseAsync<ApiResponse<SnPrintResponseData>>(response);
+
+            List<SnInfo> inSn = new List<SnInfo>();
+            for (int i = 0; i < res.data.Sn.Count; i++)
+            {
+                inSn.Add(new SnInfo() 
+                {
+                 WorkOrderNo=res.data.WorkOrderNo,
+                    Sn = res.data.Sn[i].Sn,
+                     GenerateTime=DateTime.Now,
+                      IsUsed=false,
+                       PrintType="0"     
+                });
+            }
+            if (inSn.Count != 0) 
+            {
+                if (DatabaseHelper.InsertSnInfos(inSn))
+                {
+                    return res;
+                }
+                else 
+                {
+                    res.success = false;
+                    res.msg = "SN插入数据库错误";
+                }
+            }
+            return res;
+        }
+
+        public async Task<ApiResponse<List<SnInfo>>> GetSnsAsync(string workOrderNo)
+        {
+            var requestMessage = new HttpRequestMessage(HttpMethod.Get, $"{_baseUrl}/api/mes/getSns/{workOrderNo}");
+            requestMessage.Headers.Add("app-key", _appKey);
+            requestMessage.Headers.Add("token", _token);
+            var response = await _httpClient.SendAsync(requestMessage);
+            return await ParseResponseAsync<ApiResponse<List<SnInfo>>>(response);
+        }
+        #endregion
+
+        #region 2.3 接收SN和关键件
+        public async Task<ApiResponse<bool?>> SendSnComponentAsync(SnKeyComponentRequest request)
+        {
+            var requestJson = JsonConvert.SerializeObject(request);
+            var content = new StringContent(requestJson, Encoding.UTF8, "application/json");
+            var requestMessage = new HttpRequestMessage(HttpMethod.Post, $"https://uat-mom-jh-handle-api.leapmotor.com/app-mom-mes/api/task/receive/sn/keyComponent" )
+            {
+                Content = content
+            };
+            requestMessage.Headers.Add("app-key", _appKey);
+            requestMessage.Headers.Add("token", _token);
+
+            var response = await _httpClient.SendAsync(requestMessage);
+            return await ParseResponseAsync<ApiResponse<bool?>>(response);
+        }
+
+        public async Task<ApiResponse<List<BindRecord>>> GetBindRecordsAsync()
+        {
+            var requestMessage = new HttpRequestMessage(HttpMethod.Get, $"{_baseUrl}/api/mes/getBindRecords");
+            requestMessage.Headers.Add("app-key", _appKey);
+            requestMessage.Headers.Add("token", _token);
+
+            var response = await _httpClient.SendAsync(requestMessage);
+            return await ParseResponseAsync<ApiResponse<List<BindRecord>>>(response);
+        }
+        #endregion
+
+        #region 2.4 接收工件加工参数
+        public async Task<ApiResponse<bool?>> SendProcessParametersAsync(ProcessParameterRequest request)
+        {
+            var requestJson = JsonConvert.SerializeObject(request);
+            var content = new StringContent(requestJson, Encoding.UTF8, "application/json");
+
+            var requestMessage = new HttpRequestMessage(HttpMethod.Post, $"https://uat-mom-jh-handle-api.leapmotor.com/app-mom-mes/api/task/receive/manualSave")
+            {
+                Content = content
+            };
+
+            requestMessage.Headers.Add("app-key", _appKey);
+            requestMessage.Headers.Add("token", _token);
+
+            var response = await _httpClient.SendAsync(requestMessage);
+            return await ParseResponseAsync<ApiResponse<bool?>>(response);
+        }
+
+        public async Task<ApiResponse<List<ProcessRecord>>> GetProcessRecordsAsync()
+        {
+            var requestMessage = new HttpRequestMessage(HttpMethod.Get, $"{_baseUrl}/api/mes/getProcessRecords");
+            requestMessage.Headers.Add("app-key", _appKey);
+            requestMessage.Headers.Add("token", _token);
+
+            var response = await _httpClient.SendAsync(requestMessage);
+            return await ParseResponseAsync<ApiResponse<List<ProcessRecord>>>(response);
+        }
+        #endregion
+
+        #region 辅助方法
+        private async Task<T> ParseResponseAsync<T>(HttpResponseMessage response) where T : class
+        {
+            if ( response.IsSuccessStatusCode )
+            {
+                var json = await response.Content.ReadAsStringAsync();
+                var jObject = JObject.Parse(json);
+                // 将JObject转换回字符串
+                string newJsonString = jObject.ToString();
+                return JsonConvert.DeserializeObject<T>(json);
+            }
+            else
+            {
+                var errorJson = await response.Content.ReadAsStringAsync();
+                try
+                {
+                    var jObject = JObject.Parse(errorJson);
+                    if (jObject.ContainsKey("data"))
+                    {
+                        if (jObject["data"].ToString() == "null")
+                        {
+                            // 添加新属性
+                            jObject["data"] = "false";
+                        }
+                    }
+                    return JsonConvert.DeserializeObject<T>(errorJson);
+                }
+                catch
+                {
+                    throw new HttpRequestException($"请求失败: {response.StatusCode}");
+                }
+            }
+        }
+
+        public void Dispose()
+        {
+            _httpClient?.Dispose();
+            GC.SuppressFinalize(this);
+        }
+        #endregion
+    }
+}
+

+ 847 - 0
LocalhostMES/Controller/MesController.cs

@@ -0,0 +1,847 @@
+using LocalhostMES.Core;
+using LocalhostMES.DataBase;
+using LocalhostMES.Models;
+using Newtonsoft.Json;
+using Prism.Ioc;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Web.Http;
+
+namespace LocalhostMES.Controller
+{
+    [RoutePrefix("api/mes")]
+    public class MesController : ApiController
+    {
+        private static readonly Random _random = new Random();
+        private static int _snCounter = 1;
+        private Management management;
+
+        public MesController()
+        {
+            management = Management.GetManagement();
+        }
+        #region 2.1 厂级MES下发工单信息
+        [HttpPost]
+        [Route("receiveWorkOrder")]
+        public IHttpActionResult ReceiveWorkOrder([FromBody] WorkOrderRequest request)
+        {
+            try
+            {
+                LogHelper.WriteLogInfo("厂级MES下发工单信息");
+                // 验证必填字段
+                if (string.IsNullOrEmpty(request.WorkOrderNo) ||
+                    string.IsNullOrEmpty(request.MaterialCode) ||
+                    string.IsNullOrEmpty(request.MaterialName) ||
+                    string.IsNullOrEmpty(request.LineCode))
+                {
+                    LogHelper.WriteLogInfo("必填字段不能为空");
+                    return BadRequest("必填字段不能为空");
+                }
+
+                // 工单状态验证
+                if (!IsValidStatus(request.Status))
+                {
+                    LogHelper.WriteLogInfo("无效的工单状态");
+                    return BadRequest($"无效的工单状态: {request.Status}");
+                }
+
+                // 创建或更新工单信息
+                var workOrder = new WorkOrderInfo
+                {
+                    WorkOrderNo = request.WorkOrderNo,
+                    MaterialCode = request.MaterialCode,
+                    OrderNo = request.OrderNo,
+                    MaterialName = request.MaterialName,
+                    PlannedQuantity = int.TryParse(request.WorkOrderNum, out var qty) ? qty : 0,
+                    CompletedQuantity = 0,
+                    Status = request.Status,
+                    LineCode = request.LineCode,
+                    CreateTime = DateTime.Now,
+                    StartTime = DateTime.Now.AddSeconds(2),
+                    EndTime = DateTime.Now.AddSeconds(5)
+                };
+
+                if (DatabaseHelper.InsertWorkOrderInfo(workOrder))
+                {
+
+                    var response = new ApiResponse<bool>
+                    {
+                        code = "200",
+                        success = true,
+                        msg = "工单接收成功",
+                        msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                        traceId = Guid.NewGuid().ToString("N").Substring(0, 24),
+                        data = true
+                    };
+                    LogHelper.WriteLogInfo("工单接收成功");
+                    return Ok(response);
+                }
+                else
+                {
+                    var errorResponse = new ErrorResponse
+                    {
+                        code = "55000",
+                        success = false,
+                        msg = $"工单接收失败:数据库插入异常",
+                        msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                        traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                    };
+                    LogHelper.WriteLogInfo("数据库插入异常");
+                    return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+                }
+            }
+            catch (Exception ex)
+            {
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"工单接收失败: {ex.Message}",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+        }
+
+        [HttpGet]
+        [Route("getWorkOrders")]
+        public IHttpActionResult GetWorkOrders()
+        {
+            try
+            {
+                LogHelper.WriteLogInfo("接口getWorkOrders收到消息");
+                var workOrders = DatabaseHelper.SelectWorkOrderInfo(null, management.IsLocalhostMode);
+                var response = new ApiResponse<List<WorkOrderInfo>>
+                {
+                    code = "200",
+                    success = true,
+                    msg = "获取成功",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24),
+                    data = workOrders
+                };
+                return Ok(response);
+            }
+            catch (Exception ex)
+            {
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"获取工单失败: {ex.Message}",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+        }
+        #endregion
+
+        #region 2.2 SN打印请求
+        [HttpPost]
+        [Route("requestSnPrint")]
+        public async Task<IHttpActionResult> RequestSnPrint([FromBody] SnPrintRequest request)
+        {
+            try
+            {
+                // 验证请求头
+                if (!ValidateHeaders())
+                {
+                    return Unauthorized();
+                }
+                // 验证必填字段
+                if (string.IsNullOrEmpty(request.workOrderNo) || request.count <= 0)
+                {
+                    return BadRequest("工单号和数量为必填项且数量必须大于0");
+                }
+                var workOrder = DatabaseHelper.SelectWorkOrderInfo(request.workOrderNo);
+                // 验证工单是否存在
+                if (workOrder.Count == 0)
+                {
+                    return BadRequest($"工单 {request.workOrderNo} 不存在");
+                }
+                // 验证打印类型
+                if (request.printType < 1 || request.printType > 4)
+                {
+                    return BadRequest($"无效的打印类型: {request.printType}");
+                }
+
+
+                LogHelper.WriteLogInfo("请求参数:");
+                LogHelper.WriteLogInfo(JsonConvert.SerializeObject(request, Formatting.Indented));
+                if (management.IsLocalhostMode)
+                {
+                    var Manualsninfo = DatabaseHelper.SelectSnInfo(request.workOrderNo);
+                    DatabaseHelper.InsertSnInfo(new SnInfo()
+                    {
+                        Sn = "000001"+DateCodeConverter.GetYearCode(DateTime.Now.Year) +
+                             DateCodeConverter.GetMonthCode(DateTime.Now.Month) +
+                             DateCodeConverter.GetDayCode(DateTime.Now.Day) +
+                             "00000" + Manualsninfo.Count,
+                             IsUsed = false,
+                             WorkOrderNo= request.workOrderNo,
+                             GenerateTime=DateTime.Now,
+                             PrintType="1",
+
+                    });
+                }
+
+                var sninfo = DatabaseHelper.SelectSnInfo(request.workOrderNo, true, false);
+                if (sninfo.Count == 0)
+                {
+                    ApiResponse<SnPrintResponseData> mesres = await management.ApiClient.RequestSnPrintAsync(request);
+                    if (mesres.success && mesres.data.Sn.Count != 0)
+                    {
+                        for (int i = 0; i < mesres.data.Sn.Count; i++)
+                        {
+                            if (!DatabaseHelper.InsertSnInfo(new SnInfo()
+                            {
+                                WorkOrderNo = mesres.data.WorkOrderNo,
+                                Sn = mesres.data.Sn[i].Sn,
+                                GenerateTime = DateTime.Now,
+                                PrintType = "1",
+                                IsUsed = false,
+
+                            }))
+                            {
+                                mesres.msg = "插入SN到数据库出错";
+                                mesres.success = false;
+                                return Content(System.Net.HttpStatusCode.InternalServerError, mesres);
+
+                            }
+                        }
+                        return Ok(mesres);
+                    }
+                    return Content(System.Net.HttpStatusCode.InternalServerError, mesres);
+
+                }
+                // 生成SN列表
+                var snList = new List<SnItem>();
+                if (sninfo.Count != 0)
+                {
+                    snList.Add(new SnItem { Sn = sninfo[0].Sn });
+
+                    var responseData = new SnPrintResponseData
+                    {
+                        Sn = snList,
+                        OrderNo = request.orderNo ?? "",
+                        WorkOrderNo = request.workOrderNo,
+                        Line = request.line ?? "",
+                        VehicleCode = workOrder[0].MaterialCode,
+                        MaterialDesc = workOrder[0].MaterialName
+                    };
+
+                    var response = new ApiResponse<SnPrintResponseData>
+                    {
+                        code = "200",
+                        success = true,
+                        msg = "SN生成成功",
+                        msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                        traceId = Guid.NewGuid().ToString("N").Substring(0, 24),
+                        data = responseData
+                    };
+
+                    return Ok(response);
+                }
+
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"SN获取失败",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+            catch (Exception ex)
+            {
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"SN生成失败: {ex.Message}",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+        }
+
+        [HttpGet]
+        [Route("getSns/{workOrderNo}")]
+        public IHttpActionResult GetSns(string workOrderNo)
+        {
+            try
+            {
+                var sninfo = DatabaseHelper.SelectSnInfo(workOrderNo, true, false);
+                if (sninfo.Count != 0)
+                {
+                    var response = new ApiResponse<List<SnInfo>>
+                    {
+                        code = "200",
+                        success = true,
+                        msg = "获取成功",
+                        msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                        traceId = Guid.NewGuid().ToString("N").Substring(0, 24),
+                        data = sninfo
+                    };
+                    return Ok(response);
+                }
+
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55001",
+                    success = false,
+                    msg = $"工单 {workOrderNo} 没有SN记录",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.NotFound, errorResponse);
+            }
+            catch (Exception ex)
+            {
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"获取SN失败: {ex.Message}",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+        }
+        #endregion
+
+        #region 2.3 接收SN和关键件
+        [HttpPost]
+        [Route("receiveSnComponent")]
+        public async Task<IHttpActionResult> ReceiveSnComponent([FromBody] SnKeyComponentRequest request)
+        {
+            try
+            {
+
+                LogHelper.WriteLogInfo($"收到请求: 接收SN和关键件");
+                if (management.IsLocalhostMode)
+                {
+                    return Ok(new ApiResponse<bool?>() { data = true });
+                }
+                // 验证请求头
+                if (!ValidateHeaders())
+                {
+                    return Unauthorized();
+                }
+                // 验证必填字段
+                if (string.IsNullOrEmpty(request.plant) ||
+                    string.IsNullOrEmpty(request.stationCode) ||
+                    string.IsNullOrEmpty(request.positionCode) ||
+                    string.IsNullOrEmpty(request.sn) ||
+                    string.IsNullOrEmpty(request.scanTime))
+                {
+                    return BadRequest("必填字段不能为空");
+                }
+
+                // 处理关键件绑定
+                if (request.part != null && request.part.Count > 0)
+                {
+                    foreach (var part in request.part)
+                    {
+                        if (string.IsNullOrEmpty(part.partNum))
+                        {
+                            return BadRequest("关键件条码不能为空");
+                        }
+                        var bindRecord = new BindRecord
+                        {
+                            Sn = request.sn,
+                            PartNum = part.partNum,
+                            StationCode = request.stationCode,
+                            BindTime = DateTime.TryParse(request.scanTime, out var scanTime) ? scanTime : DateTime.Now,
+                            Employee = request.employee ?? "",
+                            ScanType = request.scanTpye
+                        };
+                        //DatabaseHelper.InsertBindRecord(bindRecord);
+                        if (management.IsLocalhostMode)
+                        {
+                            //if (DatabaseHelper.GetProductProductionRecords(request.sn) == 0)
+                            //{
+                            var response = new ApiResponse<bool>
+                            {
+                                code = "200",
+                                success = true,
+                                msg = "已存在记录",
+                                msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                                traceId = Guid.NewGuid().ToString("N").Substring(0, 24),
+                                data = true
+                            };
+                                return Ok(response);
+                            //}
+                            //else
+                            //{
+
+                            //    var errorResponse = new ErrorResponse
+                            //    {
+                            //        code = "55000",
+                            //        success = false,
+                            //        msg = $"数据库查询失败",
+                            //        msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                            //        traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                            //    };
+                            //    return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+                            //}
+                        }
+
+
+                    }
+                }
+                if (management.IsLocalhostMode)
+                {
+                    return Ok(new ApiResponse<bool?>() { data=true} );
+                }
+                var okresponse = await management.ApiClient.SendSnComponentAsync(request);
+                if (okresponse.success && okresponse.code == "200")
+                {
+                    return Ok(okresponse);
+                }
+                else
+                {
+                    okresponse.success = false;
+                    return Content(System.Net.HttpStatusCode.InternalServerError, okresponse);
+                }
+            }
+            catch (Exception ex)
+            {
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"SN和关键件接收失败: {ex.Message}",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+        }
+
+        [HttpGet]
+        [Route("getBindRecords")]
+        public IHttpActionResult GetBindRecords()
+        {
+            try
+            {
+                var records = DatabaseHelper.SelectBindRecord();
+                var response = new ApiResponse<List<BindRecord>>
+                {
+                    code = "200",
+                    success = true,
+                    msg = "获取成功",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24),
+                    data = records
+                };
+                return Ok(response);
+            }
+            catch (Exception ex)
+            {
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"获取绑定记录失败: {ex.Message}",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+        }
+        #endregion
+
+        #region 2.4 接收工件加工参数
+        [HttpPost]
+        [Route("receiveProcessParameters")]
+        public async Task<IHttpActionResult> ReceiveProcessParameters([FromBody] ProcessParameterRequest request)
+        {
+            try
+            {
+                // 验证请求头
+                if (!ValidateHeaders())
+                {
+                    return Unauthorized();
+                }
+
+                // 验证必填字段
+                if (string.IsNullOrEmpty(request.plant) ||
+                    string.IsNullOrEmpty(request.station) ||
+                    string.IsNullOrEmpty(request.sn) ||
+                    string.IsNullOrEmpty(request.overallResult))
+                {
+                    return BadRequest("必填字段不能为空");
+                }
+
+                // 验证总结果
+                if (request.overallResult != "OK" && request.overallResult != "NG")
+                {
+                    return BadRequest($"无效的总结果: {request.overallResult}");
+                }
+
+                // 保存加工记录
+                var processRecord = new ProcessRecord
+                {
+                    Sn = request.sn,
+                    Station = request.station,
+                    OverallResult = request.overallResult,
+                    ProcessTime = DateTime.TryParse(request.messageTime, out var msgTime) ? msgTime : DateTime.Now,
+                    Equipment = request.equipment ?? ""
+                };
+
+                //DatabaseHelper.InsertProcessRecord(processRecord);
+                if (management.IsLocalhostMode)
+                {
+                    var response = new ApiResponse<bool>
+                    {
+                        code = "200",
+                        success = true,
+                        msg = "加工参数接收成功",
+                        msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                        traceId = Guid.NewGuid().ToString("N").Substring(0, 24),
+                        data = true
+                    };
+                    return Ok(response);
+                }
+                var mesres = management.ApiClient.SendProcessParametersAsync(request);
+                return Ok(mesres);
+            }
+            catch (Exception ex)
+            {
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"加工参数接收失败: {ex.Message}",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+        }
+
+        [HttpGet]
+        [Route("getProcessRecords")]
+        public IHttpActionResult GetProcessRecords()
+        {
+            try
+            {
+                var records = DatabaseHelper.SelectProcessRecord();
+                var response = new ApiResponse<List<ProcessRecord>>
+                {
+                    code = "200",
+                    success = true,
+                    msg = "获取成功",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24),
+                    data = records
+                };
+                return Ok(response);
+            }
+            catch (Exception ex)
+            {
+                var errorResponse = new ErrorResponse
+                {
+                    code = "55000",
+                    success = false,
+                    msg = $"获取加工记录失败: {ex.Message}",
+                    msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    traceId = Guid.NewGuid().ToString("N").Substring(0, 24)
+                };
+                return Content(System.Net.HttpStatusCode.InternalServerError, errorResponse);
+            }
+        }
+        #endregion
+
+        #region 辅助方法
+        private bool ValidateHeaders()
+        {
+            // 简单的token验证
+            if (Request.Headers.TryGetValues("app-key", out var appKeyValues) &&
+                Request.Headers.TryGetValues("token", out var tokenValues))
+            {
+                var appKey = appKeyValues.FirstOrDefault();
+                var token = tokenValues.FirstOrDefault();
+
+                // 这里使用简单的验证
+                return appKey == "test-app-key" && token == "test-token-123";
+            }
+
+            return false;
+        }
+
+        private bool IsValidStatus(string status)
+        {
+            var validStatuses = new[] { "0", "1", "2", "3", "4", "5", "6", "7" };
+            return validStatuses.Contains(status);
+        }
+
+        private string GenerateSn(WorkOrderInfo workOrder, int printType)
+        {
+            var prefix = GetPrintTypePrefix(printType);
+            var timestamp = DateTime.Now.ToString("yyMMddHHmm");
+            var randomStr = Guid.NewGuid().ToString("N").Substring(0, 6).ToUpper();
+            var counter = Interlocked.Increment(ref _snCounter);
+
+            return $"{prefix}-{workOrder.MaterialCode}-{timestamp}-{counter:D4}-{randomStr}";
+        }
+
+        private string GetPrintTypePrefix(int printType)
+        {
+
+            switch (printType)
+            {
+                case 1:
+                    return "P";
+                case 2:
+                    return "C";
+                case 3:
+                    return "Q";
+                case 4:
+                    return "B";
+                default:
+                    return "U";
+            }
+
+        }
+
+        private string GetPrintTypeName(int printType)
+        {
+
+            switch (printType)
+            {
+                case 1:
+                    return "产品码";
+                case 2:
+                    return "零件码";
+                case 3:
+                    return "合格码";
+                case 4:
+                    return "装箱码";
+                default:
+                    return "未知";
+            }
+
+
+        }
+        #endregion
+
+    }
+
+    public class DateCodeConverter
+    {
+        // ============== 年份对照表 ==============
+        private static readonly Dictionary<int, string> yearToCode = new Dictionary<int, string>
+    {
+        {2018, "1"}, {2019, "2"}, {2020, "3"}, {2021, "4"}, {2022, "5"},
+        {2023, "6"}, {2024, "7"}, {2025, "8"}, {2026, "9"}, {2027, "A"},
+        {2028, "B"}, {2029, "C"}, {2030, "D"}, {2031, "E"}, {2032, "F"},
+        {2033, "G"}, {2034, "H"}, {2035, "J"}, {2036, "K"}, {2037, "L"},
+        {2038, "M"}, {2039, "N"}, {2040, "P"}, {2041, "R"}, {2042, "S"},
+        {2043, "T"}, {2044, "V"}, {2045, "W"}, {2046, "X"}, {2047, "Y"},
+        {2048, "1"}, {2049, "2"}, {2050, "3"}, {2051, "4"}, {2052, "5"},
+        {2053, "6"}, {2054, "7"}, {2055, "8"}, {2056, "9"}, {2057, "A"}
+    };
+
+        // ============== 月份对照表 ==============
+        private static readonly Dictionary<int, string> monthToCode = new Dictionary<int, string>
+    {
+        {1, "1"}, {2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"},
+        {7, "7"}, {8, "8"}, {9, "9"}, {10, "A"}, {11, "B"}, {12, "C"}
+    };
+
+        // ============== 日期对照表 ==============
+        private static readonly Dictionary<int, string> dayToCode = new Dictionary<int, string>
+    {
+        {1, "1"}, {2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"}, {7, "7"}, {8, "8"}, {9, "9"},
+        {10, "A"}, {11, "B"}, {12, "C"}, {13, "D"}, {14, "E"}, {15, "F"}, {16, "G"},
+        {17, "H"}, {18, "J"}, {19, "K"},{20,"L"},{21, "M"}, {22, "N"}, {23, "P"},  {24, "R"},
+        {25, "S"}, {26, "T"}, {27, "U"}, {28, "V"}, {29, "W"}, {30, "X"}, {31, "Y"}
+    };
+
+        // ============== 反向查找字典 ==============
+        private static readonly Dictionary<string, int> codeToYear;
+        private static readonly Dictionary<string, int> codeToMonth;
+        private static readonly Dictionary<string, int> codeToDay;
+
+        static DateCodeConverter()
+        {
+            // 初始化反向字典
+            codeToYear = yearToCode
+                .GroupBy(kv => kv.Value)
+                .ToDictionary(g => g.Key, g => g.Last().Key);
+
+            codeToMonth = monthToCode
+                .ToDictionary(kv => kv.Value, kv => kv.Key);
+
+            codeToDay = dayToCode
+                .ToDictionary(kv => kv.Value, kv => kv.Key);
+        }
+
+        // ============== 年份相关方法 ==============
+
+        /// <summary>
+        /// 根据年份获取代码
+        /// </summary>
+        public static string GetYearCode(int year)
+        {
+            return yearToCode.TryGetValue(year, out string code) ? code : "未知年份";
+        }
+
+        /// <summary>
+        /// 根据代码获取年份(返回最新的对应年份)
+        /// </summary>
+        public static int? GetYearByCode(string code)
+        {
+            return codeToYear.TryGetValue(code, out int year) ? year : (int?)null;
+        }
+
+        /// <summary>
+        /// 获取所有对应某个代码的年份
+        /// </summary>
+        public static List<int> GetAllYearsByCode(string code)
+        {
+            return yearToCode
+                .Where(kv => kv.Value == code)
+                .Select(kv => kv.Key)
+                .ToList();
+        }
+
+        // ============== 月份相关方法 ==============
+
+        /// <summary>
+        /// 根据月份获取代码
+        /// </summary>
+        public static string GetMonthCode(int month)
+        {
+            if (month < 1 || month > 12)
+                return "无效月份";
+
+            return monthToCode.TryGetValue(month, out string code) ? code : "未知月份";
+        }
+
+        /// <summary>
+        /// 根据代码获取月份
+        /// </summary>
+        public static int? GetMonthByCode(string code)
+        {
+            return codeToMonth.TryGetValue(code, out int month) ? month : (int?)null;
+        }
+
+        // ============== 日期相关方法 ==============
+
+        /// <summary>
+        /// 根据日期获取代码
+        /// </summary>
+        public static string GetDayCode(int day)
+        {
+            if (day < 1 || day > 31)
+                return "无效日期";
+
+            return dayToCode.TryGetValue(day, out string code) ? code : "未知日期";
+        }
+
+        /// <summary>
+        /// 根据代码获取日期
+        /// </summary>
+        public static int? GetDayByCode(string code)
+        {
+            return codeToDay.TryGetValue(code, out int day) ? day : (int?)null;
+        }
+
+        // ============== 完整日期转换方法 ==============
+
+        /// <summary>
+        /// 将DateTime转换为日期代码(3位字符:年份代码 + 月份代码 + 日期代码)
+        /// </summary>
+        public static string ConvertToDateCode(DateTime date)
+        {
+            string yearCode = GetYearCode(date.Year);
+            string monthCode = GetMonthCode(date.Month);
+            string dayCode = GetDayCode(date.Day);
+
+            // 检查是否有无效的代码
+            if (yearCode == "未知年份" || monthCode == "无效月份" || dayCode == "无效日期" || dayCode == "未知日期")
+            {
+                return "无效日期";
+            }
+
+            return $"{yearCode}{monthCode}{dayCode}";
+        }
+
+        /// <summary>
+        /// 将日期代码转换为DateTime(如果有多个年份对应,返回最新的)
+        /// </summary>
+        public static DateTime? ConvertFromDateCode(string dateCode)
+        {
+            if (string.IsNullOrEmpty(dateCode) || dateCode.Length != 3)
+                return null;
+
+            string yearCode = dateCode.Substring(0, 1);
+            string monthCode = dateCode.Substring(1, 1);
+            string dayCode = dateCode.Substring(2, 1);
+
+            var year = GetYearByCode(yearCode);
+            var month = GetMonthByCode(monthCode);
+            var day = GetDayByCode(dayCode);
+
+            if (!year.HasValue || !month.HasValue || !day.HasValue)
+                return null;
+
+            try
+            {
+                return new DateTime(year.Value, month.Value, day.Value);
+            }
+            catch (ArgumentOutOfRangeException)
+            {
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// 将日期代码转换为所有可能的DateTime列表(考虑年份重复的情况)
+        /// </summary>
+        public static List<DateTime> ConvertAllFromDateCode(string dateCode)
+        {
+            var result = new List<DateTime>();
+
+            if (string.IsNullOrEmpty(dateCode) || dateCode.Length != 3)
+                return result;
+
+            string yearCode = dateCode.Substring(0, 1);
+            string monthCode = dateCode.Substring(1, 1);
+            string dayCode = dateCode.Substring(2, 1);
+
+            var allYears = GetAllYearsByCode(yearCode);
+            var month = GetMonthByCode(monthCode);
+            var day = GetDayByCode(dayCode);
+
+            if (allYears.Count == 0 || !month.HasValue || !day.HasValue)
+                return result;
+
+            foreach (var year in allYears)
+            {
+                try
+                {
+                    result.Add(new DateTime(year, month.Value, day.Value));
+                }
+                catch (ArgumentOutOfRangeException)
+                {
+                    // 跳过无效日期(如2月30日等)
+                }
+            }
+
+            return result;
+        }
+    }
+}

+ 93 - 0
LocalhostMES/Controller/PrismDependencyResolver.cs

@@ -0,0 +1,93 @@
+using Prism.Ioc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web.Http.Controllers;
+using System.Web.Http.Dependencies;
+
+namespace LocalhostMES.Controller
+{
+    // 自定义的依赖解析器
+    public class PrismDependencyResolver : IDependencyResolver
+    {
+        private readonly IContainerProvider _containerProvider;
+
+        public PrismDependencyResolver(IContainerProvider containerProvider)
+        {
+            _containerProvider = containerProvider;
+        }
+
+        public IDependencyScope BeginScope()
+        {
+            // 返回同一个作用域,因为 Prism 容器通常不支持作用域
+            return this;
+        }
+
+        public object GetService(Type serviceType)
+        {
+            try
+            {
+                // 尝试从 Prism 容器解析
+                // 1. 如果是控制器,从 Prism 容器解析
+                if (typeof(IHttpController).IsAssignableFrom(serviceType))
+                {
+                    return _containerProvider.Resolve(serviceType);
+                }
+
+                // 2. 如果是我们自己注册的类型,从 Prism 容器解析
+                if (IsCustomType(serviceType))
+                {
+                    return _containerProvider.Resolve(serviceType);
+                }
+
+                // 3. 其他类型(Web API 内置服务)返回 null,让 Web API 使用默认解析器
+                return null;
+            }
+            catch (ContainerResolutionException)
+            {
+                // 如果类型未注册,返回 null(Web API 会使用默认构造函数)
+                return null;
+            }
+            catch
+            {
+                return null;
+            }
+        }
+        private bool IsCustomType(Type serviceType)
+        {
+            // 检查是否是我们自定义的类型
+            var typeName = serviceType.FullName ?? "";
+
+            // 添加我们需要处理的类型
+            var customTypes = new[]
+            {
+                "LocalhostMES.Controller.Management",
+                "LocalhostMES.Controller.ApiClient",
+                // 添加其他需要从 Prism 容器解析的类型
+            };
+
+            return Array.Exists(customTypes, t => typeName.Contains(t));
+        }
+        public IEnumerable<object> GetServices(Type serviceType)
+        {
+            try
+            {
+                // 对于集合类型,尝试解析 IEnumerable<T>
+                var enumerableType = typeof(IEnumerable<>).MakeGenericType(serviceType);
+                var services = _containerProvider.Resolve(enumerableType);
+                return (IEnumerable<object>)services;
+            }
+            catch
+            {
+                return Enumerable.Empty<object>();
+            }
+        }
+
+        public void Dispose()
+        {
+            // 清理资源
+        }
+    }
+}

+ 175 - 0
LocalhostMES/Controller/WebApiService.cs

@@ -0,0 +1,175 @@
+using LocalhostMES.Core;
+using LocalhostMES.DataBase;
+using Microsoft.Owin.Hosting;
+using Org.BouncyCastle.Asn1.Ocsp;
+using Owin;
+using Prism.Ioc;
+using System;
+using System.Net;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Web.Http;
+using Unity;
+using Unity.Lifetime;
+using Unity.WebApi;
+
+
+namespace LocalhostMES.Controller
+{
+    public class WebApiService : IDisposable
+    {
+        private IDisposable _webApp;
+        private  CancellationTokenSource _cts = new CancellationTokenSource();
+        private  int _port;
+        private  StartOptions _startOptions;
+        private  string _baseUrl="192.168.1.26:8081";
+
+        public WebApiService()
+        {
+          
+        }
+        public void Init(int port = 8081) 
+        {
+            _port = port;
+            _baseUrl = $"http://192.168.1.26:{port}";
+            _startOptions = new StartOptions { Urls = { $"http://192.168.1.26:{port}" } };//$"http://10.157.15.51:{port}", 
+
+        }
+        public async Task StartAsync()
+        {
+            try
+            {
+               
+
+                // 创建 Startup 实例并传入容器提供者
+                var startup = new Startup();
+
+                // 启动 Web App
+                _webApp = WebApp.Start(_startOptions, startup.Configuration);
+                // 启动Web API服务
+                // 初始化测试数据
+                InitializeTestData();
+                LogHelper.WriteLogInfo($"Web API服务已启动: {_baseUrl}");
+                Console.WriteLine($"Web API服务已启动: {_baseUrl}");
+            }
+            catch ( Exception ex )
+            {
+                Console.WriteLine($"启动Web API服务失败: {ex.Message}");
+                LogHelper.WriteLogInfo($"启动Web API服务失败: {ex.Message}");
+                throw;
+            }
+        }
+
+        private void InitializeTestData()
+        {
+            try
+            {
+                //// 添加一些测试工单
+                //var testWorkOrder = new Models.WorkOrderInfo
+                //{
+                //    WorkOrderNo = "GD-001",
+                //    MaterialCode = "T03GCD",
+                //    MaterialName = "T03贯穿灯",
+                //    PlannedQuantity = 100,
+                //    CompletedQuantity = 0,
+                //    Status = "2", // 已发布
+                //    LineCode = "RSC01",
+                //    CreateTime = DateTime.Now.AddDays(-1),
+                //    StartTime = DateTime.Now.AddHours(-2),
+                //    EndTime = DateTime.Now.AddHours(1),
+                //};
+
+                //DatabaseHelper.InsertWorkOrderInfo(testWorkOrder);
+
+                //// 生成测试SN
+                //for ( int i = 1; i <= 10; i++ )
+                //{
+                //    DatabaseHelper.InsertSnInfo(new Models.SnInfo
+                //    {
+                //        Sn = $"P-T03GCD-{DateTime.Now:yyMMddHHmm}-{i:D4}-{Guid.NewGuid().ToString("N").Substring(0, 6).ToUpper()}",
+                //        GenerateTime = DateTime.Now.AddMinutes(-i * 5),
+                //        WorkOrderNo = "GD-001",
+                //        PrintType = "产品码",
+                //        IsUsed = i > 5 // 前5个已使用
+                //    });
+                //}
+               
+
+                Console.WriteLine("测试数据初始化完成");
+            }
+            catch ( Exception ex )
+            {
+                Console.WriteLine($"初始化测试数据失败: {ex.Message}");
+            }
+        }
+
+        public Task StopAsync()
+        {
+            _webApp?.Dispose();
+            _webApp = null;
+            Console.WriteLine("Web API服务已停止");
+            return Task.CompletedTask;
+        }
+
+        public void Dispose()
+        {
+            _cts?.Cancel();
+            _cts?.Dispose();
+            _webApp?.Dispose();
+            GC.SuppressFinalize(this);
+        }
+
+        public bool IsRunning => _webApp != null;
+        public string BaseUrl => _baseUrl;
+    }
+
+    // OWIN Startup类
+    public class Startup
+    {
+       
+        public void Configuration(IAppBuilder app)
+        {
+            // 创建 Unity 容器
+            var container = new UnityContainer();
+
+
+            // 启用CORS
+            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
+
+            // 配置Web API
+            var config = new HttpConfiguration();
+
+            // 启用属性路由
+            config.MapHttpAttributeRoutes();
+
+            // 配置默认路由
+            config.Routes.MapHttpRoute(
+                name: "DefaultApi",
+                routeTemplate: "api/{controller}/{action}/{id}",
+                defaults: new { id = RouteParameter.Optional }
+            );
+
+            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling =
+                Newtonsoft.Json.ReferenceLoopHandling.Ignore;
+            config.Formatters.JsonFormatter.SerializerSettings.Formatting =
+                Newtonsoft.Json.Formatting.Indented;
+
+            // 使用Web API
+            app.UseWebApi(config);
+        }
+    }
+
+    // 辅助类,用于跨控制器共享数据
+    //public static class ConcurrentStorage
+    //{
+    //    //public static readonly System.Collections.Concurrent.ConcurrentDictionary<string, Models.WorkOrderInfo> WorkOrders
+    //    //    = new System.Collections.Concurrent.ConcurrentDictionary<string, Models.WorkOrderInfo>();
+    //    //public static readonly System.Collections.Concurrent.ConcurrentDictionary<string, System.Collections.Generic.List<Models.SnInfo>> WorkOrderSns
+    //    //    = new System.Collections.Concurrent.ConcurrentDictionary<string, System.Collections.Generic.List<Models.SnInfo>>();
+    //    //public static readonly System.Collections.Concurrent.ConcurrentBag<Models.BindRecord> BindRecords
+    //    //    = new System.Collections.Concurrent.ConcurrentBag<Models.BindRecord>();
+    //    //public static readonly System.Collections.Concurrent.ConcurrentBag<Models.ProcessRecord> ProcessRecords
+    //    //    = new System.Collections.Concurrent.ConcurrentBag<Models.ProcessRecord>();
+    //}
+}
+

+ 78 - 0
LocalhostMES/Core/LogHelper.cs

@@ -0,0 +1,78 @@
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace LocalhostMES.Core
+{
+    public static class LogHelper
+    {
+        public static readonly ILog loginfo = LogManager.GetLogger("loginfo");
+        public static readonly ILog logerror = LogManager.GetLogger("logerror");
+        public static readonly ILog logdebug = LogManager.GetLogger("logdebug");
+        public static readonly ILog logwarn = LogManager.GetLogger("logwarn");
+        public static readonly ILog logfatal = LogManager.GetLogger("logfatal");
+        public static readonly ILog logDynamic = LogManager.GetLogger("logDynamic");
+
+
+        public delegate void LogChangHandler(string msg);
+
+        public static LogChangHandler logChangHandler;
+
+        public static void WriteLogInfo(string info)
+        {
+            if ( loginfo.IsInfoEnabled )
+            {
+
+                loginfo.Info(info);
+                logChangHandler?.Invoke(info);
+            }
+        }
+
+        public static void WriteLogDebug(string info)
+        {
+            if ( logdebug.IsDebugEnabled )
+            {
+                logdebug.Debug(info);
+            }
+        }
+
+        public static void WriteLogWarn(string info)
+        {
+            if ( logwarn.IsWarnEnabled )
+            {
+                logwarn.Warn(info);
+            }
+        }
+
+        public static void WriteLogError(string info, Exception se)
+        {
+            if ( logerror.IsErrorEnabled )
+            {
+                logerror.Error(info, se);
+
+            }
+        }
+
+        public static void WriteLogFatal(string info, Exception se)
+        {
+            if ( logfatal.IsFatalEnabled )
+            {
+                logfatal.Fatal(info, se);
+
+            }
+        }
+
+        public static void WriteOther(string info)
+        {
+            if ( logDynamic.IsInfoEnabled )
+            {
+                logDynamic.Info(info);
+
+            }
+        }
+    }
+}

+ 34 - 0
LocalhostMES/Core/Management.cs

@@ -0,0 +1,34 @@
+using LocalhostMES.Controller;
+using Prism.Ioc;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocalhostMES.Core
+{
+    public  class Management
+    {
+        private IContainerProvider _container;
+
+        private  WebApiService _webApiService;
+        private MesApiClient _apiClient;
+
+        private bool _IsLocalhostMode = false;
+
+        public MesApiClient ApiClient { get => _apiClient; set => _apiClient = value; }
+        public WebApiService WebApiService { get => _webApiService; set => _webApiService = value; }
+        public bool IsLocalhostMode { get => _IsLocalhostMode; set => _IsLocalhostMode = value; }
+
+        public static Management management = new Management();
+
+        public static Management GetManagement() 
+        {
+            return management;
+        }
+
+    }
+}

+ 105 - 0
LocalhostMES/Core/TrayIconManager.cs

@@ -0,0 +1,105 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace LocalhostMES.Core
+{
+    public class TrayIconManager : IDisposable
+    {
+        private NotifyIcon trayIcon;
+        private ContextMenuStrip trayMenu;
+
+        public event EventHandler OnExit;
+        public event EventHandler OnSettings;
+        public event EventHandler OnAbout;
+
+        public TrayIconManager()
+        {
+            InitializeTrayIcon();
+        }
+
+        private void InitializeTrayIcon()
+        {
+            // 创建托盘菜单
+            trayMenu = new ContextMenuStrip();
+
+            // 添加菜单项
+            ToolStripMenuItem settingsItem = new ToolStripMenuItem("设置");
+            settingsItem.Click += (s, e) => OnSettings?.Invoke(this, e);
+
+            ToolStripMenuItem aboutItem = new ToolStripMenuItem("关于");
+            aboutItem.Click += (s, e) => OnAbout?.Invoke(this, e);
+
+            ToolStripMenuItem exitItem = new ToolStripMenuItem("退出");
+            exitItem.Click += (s, e) => OnExit?.Invoke(this, e);
+
+            trayMenu.Items.Add(settingsItem);
+            trayMenu.Items.Add(new ToolStripSeparator());
+            trayMenu.Items.Add(aboutItem);
+            trayMenu.Items.Add(new ToolStripSeparator());
+            trayMenu.Items.Add(exitItem);
+
+            // 创建托盘图标
+            trayIcon = new NotifyIcon
+            {
+                Text = "本地MES",
+                Icon = CreateTrayIcon(),
+                ContextMenuStrip = trayMenu,
+                Visible = false
+            };
+
+            // 双击托盘图标事件
+            trayIcon.DoubleClick += (s, e) => OnSettings?.Invoke(this, e);
+
+            // 气泡提示事件
+            trayIcon.BalloonTipClicked += (s, e) => OnAbout?.Invoke(this, e);
+        }
+
+        private Icon CreateTrayIcon()
+        {
+            // 创建一个简单的图标(可以使用资源文件或外部图标)
+            Bitmap bitmap = new Bitmap(16, 16);
+            using ( Graphics g = Graphics.FromImage(bitmap) )
+            {
+                g.Clear(Color.Transparent);
+                g.FillRectangle(Brushes.Blue, 2, 2, 4, 12);  // 第一个屏幕
+                g.FillRectangle(Brushes.Green, 8, 2, 4, 12); // 第二个屏幕
+                g.FillEllipse(Brushes.White, 6, 6, 4, 4);    // 鼠标指针
+            }
+
+            return Icon.FromHandle(bitmap.GetHicon());
+        }
+
+        public void Show()
+        {
+            trayIcon.Visible = true;
+
+            // 显示启动提示
+            trayIcon.ShowBalloonTip(1000, "本地MES",
+                "程序已启动", ToolTipIcon.Info);
+        }
+
+        public void ShowNotification(string title, string message)
+        {
+            trayIcon.ShowBalloonTip(1000, title, message, ToolTipIcon.Info);
+        }
+
+        public void Dispose()
+        {
+            if ( trayIcon != null )
+            {
+                trayIcon.Visible = false;
+                trayIcon.Dispose();
+            }
+
+            if ( trayMenu != null )
+            {
+                trayMenu.Dispose();
+            }
+        }
+    }
+}

+ 336 - 0
LocalhostMES/DataBase/DatabaseHelper.cs

@@ -0,0 +1,336 @@
+using LocalhostMES.Core;
+using LocalhostMES.Enums;
+using LocalhostMES.Models;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Security.Claims;
+using System.Text;
+using System.Threading.Tasks;
+using static Org.BouncyCastle.Pqc.Crypto.Utilities.PqcOtherInfoGenerator;
+
+namespace LocalhostMES.DataBase
+{
+    public class DatabaseHelper
+    {
+        public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
+        {
+           // ConnectionString= "Server = 192.168.1.26; Database =LingPaoProject; User Id = root; Password = root; ",
+            ConnectionString = "Database=LingPaoProject; Data Source=192.168.1.26; Port=3306;User Id=root; Password=root;Charset=utf8;TreatTinyAsBoolean=false;",//连接符字串
+            DbType = SqlSugar.DbType.MySql,//数据库类型
+            IsAutoCloseConnection = true //不设成true要手动close
+        },
+         db =>
+         {
+
+             db.Aop.OnLogExecuting = (sql, pars) =>
+             {
+                 Console.WriteLine(UtilMethods.GetNativeSql(sql, pars));
+             };
+
+         });
+
+        public static void CreataDataTable()
+        {
+
+            Db.CodeFirst.InitTables<WorkOrderInfo>();
+            Db.CodeFirst.InitTables<SnInfo>();
+            Db.CodeFirst.InitTables<BindRecord>();
+            Db.CodeFirst.InitTables<ProcessRecord>();
+            Db.CodeFirst.InitTables<ParkingLot>();
+            
+
+        }
+
+        public static int GetProductProductionRecords(string sn)
+        {
+            try
+            {
+                return Db.Queryable<ProductionToStation>().Where(it => it.SN == sn).ToList().Count;
+            }
+            catch ( Exception ex )
+            {
+                LogHelper.WriteLogError("获取一条产品的生产记录至数据库时出错!", ex);
+
+            }
+            return 0;
+        }
+        public static List<WorkOrderInfo> SelectWorkOrderInfo(string workOrderNo = null,bool islocalhost=false)
+        {
+
+
+            
+
+            if ( workOrderNo != null )
+            {
+                return Db.Queryable<WorkOrderInfo>().Where(it => it.WorkOrderNo == workOrderNo).ToList();
+            }
+            else
+            {
+                return Db.Queryable<WorkOrderInfo>().ToList();
+            }
+        }
+
+        public static bool InsertWorkOrderInfo(WorkOrderInfo info)
+        {
+
+            if ( Db.Storageable(info).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool UpdateWorkOrderInfo(WorkOrderInfo info)
+        {
+
+            if ( Db.Updateable(info).Where(it => it.WorkOrderNo == info.WorkOrderNo).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool DeleteWorkOrderInfo(WorkOrderInfo info)
+        {
+
+            if ( Db.Deleteable(info).Where(it => it.WorkOrderNo == info.WorkOrderNo).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+        public static List<SnInfo> SelectSnInfo(string workOrderNo = null, bool needused = false, bool isused = false)
+        {
+            if ( workOrderNo != null )
+            {
+                if ( needused )
+                {
+                    return Db.Queryable<SnInfo>().Where(it => it.WorkOrderNo == workOrderNo && it.IsUsed == isused).ToList();
+                }
+                else
+                {
+                    return Db.Queryable<SnInfo>().Where(it => it.WorkOrderNo == workOrderNo).ToList();
+                }
+            }
+            else
+            {
+                return Db.Queryable<SnInfo>().ToList();
+            }
+        }
+        public static bool InsertSnInfo(SnInfo info)
+        {
+
+            if ( Db.Storageable(info).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool InsertSnInfos(List<SnInfo> info)
+        {
+
+            if (Db.Storageable(info).ExecuteCommand() == info.Count)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool UpdateSnInfo(SnInfo info)
+        {
+
+            if ( Db.Updateable(info).Where(it => it.Sn == info.Sn).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool DeleteSnInfo(SnInfo info)
+        {
+
+            if ( Db.Deleteable(info).Where(it => it.Sn == info.Sn).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+        public static List<BindRecord> SelectBindRecord(string Sn = null, string PartNum = null, string StationCode = null)
+        {
+            var query = Db.Queryable<BindRecord>();
+
+            // 动态添加查询条件
+            if ( !string.IsNullOrWhiteSpace(Sn) )
+            {
+                query = query.Where(it => it.Sn == Sn);
+            }
+
+            if ( !string.IsNullOrWhiteSpace(PartNum) )
+            {
+                query = query.Where(it => it.PartNum == PartNum);
+            }
+
+            if ( !string.IsNullOrWhiteSpace(StationCode) )
+            {
+                query = query.Where(it => it.StationCode == StationCode);
+            }
+
+            return query.ToList();
+
+        }
+        public static bool InsertBindRecord(BindRecord info)
+        {
+
+            if ( Db.Storageable(info).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool UpdateBindRecord(BindRecord info)
+        {
+
+            if ( Db.Updateable(info).Where(it => it.Sn == info.Sn).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool DeleteBindRecord(string sn = null)
+        {
+            if ( sn != null )
+            {
+                if ( Db.Deleteable<BindRecord>().Where(it => it.Sn == sn).ExecuteCommand() == 1 )
+                {
+                    return true;
+                }
+            }
+            else
+            {
+                if ( Db.Deleteable<BindRecord>().ExecuteCommand() != 0 )
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public static List<ProcessRecord> SelectProcessRecord(string Sn = null, string StationCode = null)
+        {
+            var query = Db.Queryable<ProcessRecord>();
+
+            // 动态添加查询条件
+            if ( !string.IsNullOrWhiteSpace(Sn) )
+            {
+                query = query.Where(it => it.Sn == Sn);
+            }
+
+
+
+            if ( !string.IsNullOrWhiteSpace(StationCode) )
+            {
+                query = query.Where(it => it.Station == StationCode);
+            }
+
+            return query.ToList();
+
+        }
+        public static bool InsertProcessRecord(ProcessRecord info)
+        {
+
+            if ( Db.Storageable(info).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool UpdateProcessRecord(ProcessRecord info)
+        {
+
+            if ( Db.Updateable(info).Where(it => it.Sn == info.Sn).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static bool DeleteProcessRecord(string sn = null)
+        {
+
+            if ( Db.Deleteable<ProcessRecord>().Where(it => it.Sn == sn).ExecuteCommand() == 1 )
+            {
+                return true;
+            }
+            return false;
+        }
+
+
+        public static List<LocalhostPartInfo> SelectPartInfo(StationType StationCode =  StationType.OP10)
+        {
+            var query = Db.Queryable<LocalhostPartInfo>().Where(it => it.FormulaType == StationCode); ;
+            return query.ToList();
+
+        }
+        public static bool InsertPartInfo(LocalhostPartInfo info)
+        {
+
+            if (Db.Storageable(info).ExecuteCommand() == 1)
+            {
+                return true;
+            }
+            return false;
+        }
+
+    
+
+        public static bool DeletePartInfo(StationType StationCode, string MaterialCode)
+        {
+
+            if (Db.Deleteable<LocalhostPartInfo>().Where(it => it.FormulaType == StationCode&&it.MaterialCode==MaterialCode).ExecuteCommand() == 1)
+            {
+                return true;
+            }
+            return false;
+        }
+
+    
+
+
+        public static List<ParkingLot> SelectParkingLot(StationType StationCode = StationType.OP10)
+        {
+            var query = Db.Queryable<ParkingLot>().Where(it => it.FormulaType == StationCode); ;
+            return query.ToList();
+
+        }
+        public static bool InsertParkingLot(ParkingLot info)
+        {
+
+            if (Db.Storageable(info).ExecuteCommand() == 1)
+            {
+                return true;
+            }
+            return false;
+        }
+
+
+
+        public static bool DeleteParkingLot(StationType StationCode, int id)
+        {
+
+            if (Db.Deleteable<ParkingLot>().Where(it => it.FormulaType == StationCode && it.Id == id).ExecuteCommand() == 1)
+            {
+                return true;
+            }
+            return false;
+        }
+        
+
+    }
+}

+ 40 - 0
LocalhostMES/Enums/FormulaPartType.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocalhostMES.Enums
+{
+    /// <summary>
+    /// 配方站的类型
+    /// </summary>
+    public enum FormulaPartType
+    {
+        /// <summary>
+        /// OP10配方
+        /// </summary>
+        OP10Formula = 0,
+
+        /// <summary>
+        /// OP2030配方
+        /// </summary>
+        OP203040Formula = 1,
+
+        /// <summary>
+        /// OP4050配方
+        /// </summary>
+        OP506070Formula = 2,
+
+
+        /// <summary>
+        /// OP80配方
+        /// </summary>
+        OP80Formula = 3,
+
+        /// <summary>
+        /// OP90配方
+        /// </summary>
+        OP90Formula = 4,
+    }
+}

+ 75 - 0
LocalhostMES/Enums/StationType.cs

@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Markup;
+
+namespace LocalhostMES.Enums
+{
+    public enum StationType
+    {
+        OP10,
+        OP20L,
+        OP20R,
+        OP30L,
+        OP30R,
+        OP40L,
+        OP40R,
+        OP50L,
+        OP50R,
+        OP60L,
+        OP60R,
+        OP70L,
+        OP70R,
+        OP80L,
+        OP80R
+
+    }
+
+    public class EnumBindingSourceExtension : MarkupExtension
+    {
+        private Type _enumType;
+        public Type EnumType
+        {
+            get => _enumType;
+            set
+            {
+                if ( value != _enumType )
+                {
+                    if ( null != value )
+                    {
+                        Type enumType = Nullable.GetUnderlyingType(value) ?? value;
+                        if ( !enumType.IsEnum )
+                            throw new ArgumentException("Type must be for an Enum.");
+                    }
+
+                    _enumType = value;
+                }
+            }
+        }
+
+        public EnumBindingSourceExtension() { }
+
+        public EnumBindingSourceExtension(Type enumType)
+        {
+            EnumType = enumType;
+        }
+
+        public override object ProvideValue(IServiceProvider serviceProvider)
+        {
+            if ( null == _enumType )
+                throw new InvalidOperationException("The EnumType must be specified.");
+
+            Type actualEnumType = Nullable.GetUnderlyingType(_enumType) ?? _enumType;
+            Array enumValues = Enum.GetValues(actualEnumType);
+
+            if ( actualEnumType == _enumType )
+                return enumValues;
+
+            Array tempArray = Array.CreateInstance(actualEnumType, enumValues.Length + 1);
+            enumValues.CopyTo(tempArray, 1);
+            return tempArray;
+        }
+    }
+}

+ 464 - 0
LocalhostMES/LocalhostMES.csproj

@@ -0,0 +1,464 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F51B99A2-C4D9-40C8-A79F-5C7BFE34C202}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>LocalhostMES</RootNamespace>
+    <AssemblyName>LocalhostMES</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</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>
+  </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>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
+      <HintPath>..\packages\BouncyCastle.Cryptography.2.6.2\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Protobuf, Version=3.32.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Protobuf.3.32.0\lib\net45\Google.Protobuf.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
+    </Reference>
+    <Reference Include="log4net, Version=3.1.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
+      <HintPath>..\packages\log4net.3.1.0\lib\net462\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore, Version=2.3.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.2.3.8\lib\netstandard2.0\Microsoft.AspNetCore.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Authentication.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Authentication.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Authentication.Core, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Authentication.Core.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Authorization, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Authorization.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Authorization.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Authorization.Policy, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Authorization.Policy.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Authorization.Policy.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Connections.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Connections.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Connections.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Diagnostics, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Diagnostics.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Diagnostics.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Diagnostics.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Diagnostics.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Diagnostics.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.HostFiltering, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.HostFiltering.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.HostFiltering.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Hosting, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Hosting.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Hosting.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Hosting.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Hosting.Server.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Server.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Http, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Http.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Http.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Http.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Http.Extensions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Http.Extensions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Http.Features, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Http.Features.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.HttpOverrides, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.HttpOverrides.2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.HttpOverrides.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Mvc.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Mvc.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Mvc.Core, Version=2.3.9.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Mvc.Core.2.3.9\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.ResponseCaching.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.ResponseCaching.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.ResponseCaching.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Routing, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Routing.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Routing.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Routing.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Routing.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Routing.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Server.IISIntegration, Version=2.1.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Server.IISIntegration.2.1.7\lib\netstandard2.0\Microsoft.AspNetCore.Server.IISIntegration.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Server.Kestrel, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Server.Kestrel.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Server.Kestrel.Core, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Server.Kestrel.Core.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Server.Kestrel.Https, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Server.Kestrel.Https.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.Https.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AspNetCore.WebUtilities, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNetCore.WebUtilities.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.1\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.DotNet.PlatformAbstractions.2.1.0\lib\net45\Microsoft.DotNet.PlatformAbstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Configuration, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Configuration.10.0.1\lib\net462\Microsoft.Extensions.Configuration.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.10.0.1\lib\net462\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Configuration.Binder, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Configuration.Binder.10.0.1\lib\net462\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Configuration.CommandLine, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Configuration.CommandLine.10.0.1\lib\net462\Microsoft.Extensions.Configuration.CommandLine.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Configuration.EnvironmentVariables.10.0.1\lib\net462\Microsoft.Extensions.Configuration.EnvironmentVariables.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Configuration.FileExtensions.10.0.1\lib\net462\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Configuration.Json, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Configuration.Json.10.0.1\lib\net462\Microsoft.Extensions.Configuration.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Configuration.UserSecrets, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Configuration.UserSecrets.10.0.1\lib\net462\Microsoft.Extensions.Configuration.UserSecrets.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.DependencyInjection, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.10.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.DependencyModel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Diagnostics, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Diagnostics.10.0.1\lib\net462\Microsoft.Extensions.Diagnostics.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Diagnostics.Abstractions, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Diagnostics.Abstractions.10.0.1\lib\net462\Microsoft.Extensions.Diagnostics.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.FileProviders.Abstractions.10.0.1\lib\net462\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.FileProviders.Physical.10.0.1\lib\net462\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.FileSystemGlobbing.10.0.1\lib\net462\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Hosting.Abstractions, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Hosting.Abstractions.10.0.1\lib\net462\Microsoft.Extensions.Hosting.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Logging, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Logging.10.0.1\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.1\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Logging.Configuration, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Logging.Configuration.10.0.1\lib\net462\Microsoft.Extensions.Logging.Configuration.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Logging.Console, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Logging.Console.10.0.1\lib\net462\Microsoft.Extensions.Logging.Console.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Logging.Debug, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Logging.Debug.10.0.1\lib\net462\Microsoft.Extensions.Logging.Debug.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Logging.EventLog, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Logging.EventLog.10.0.1\lib\net462\Microsoft.Extensions.Logging.EventLog.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Logging.EventSource, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Logging.EventSource.10.0.1\lib\net462\Microsoft.Extensions.Logging.EventSource.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.ObjectPool, Version=8.0.11.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.ObjectPool.8.0.11\lib\net462\Microsoft.Extensions.ObjectPool.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Options, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Options.10.0.1\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Options.ConfigurationExtensions, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Options.ConfigurationExtensions.10.0.1\lib\net462\Microsoft.Extensions.Options.ConfigurationExtensions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Primitives, Version=10.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Primitives.10.0.1\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Net.Http.Headers, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Net.Http.Headers.2.3.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Owin, Version=4.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Owin.4.2.3\lib\net45\Microsoft.Owin.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Owin.Cors, Version=4.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Owin.Cors.4.2.3\lib\net45\Microsoft.Owin.Cors.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Owin.Host.HttpListener, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Owin.Host.HttpListener.4.2.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Owin.Hosting, Version=4.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Owin.Hosting.4.2.3\lib\net45\Microsoft.Owin.Hosting.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="MySql.Data, Version=9.5.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+      <HintPath>..\packages\MySql.Data.9.5.0\lib\net462\MySql.Data.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json.Bson, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.Bson.1.0.2\lib\net45\Newtonsoft.Json.Bson.dll</HintPath>
+    </Reference>
+    <Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
+      <HintPath>..\packages\Owin.1.0\lib\net40\Owin.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="SqlSugar, Version=5.1.4.207, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\SqlSugar.5.1.4.207\lib\SqlSugar.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Collections.Immutable, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Collections.Immutable.8.0.0\lib\net462\System.Collections.Immutable.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel.Composition" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Diagnostics.DiagnosticSource.10.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.IO.Pipelines, Version=10.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.IO.Pipelines.10.0.1\lib\net462\System.IO.Pipelines.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Management" />
+    <Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Formatting, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.6.0.0\lib\net45\System.Net.Http.Formatting.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reflection.Metadata, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Reflection.Metadata.8.0.1\lib\net462\System.Reflection.Metadata.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.Cng, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.Cng.5.0.0\lib\net47\System.Security.Cryptography.Cng.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Security.Principal.Windows, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Principal.Windows.4.5.1\lib\net461\System.Security.Principal.Windows.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Text.Encodings.Web, Version=10.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Encodings.Web.10.0.1\lib\net462\System.Text.Encodings.Web.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Text.Json, Version=10.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Json.10.0.1\lib\net462\System.Text.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Transactions" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Web.Cors, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.Cors.5.0.0\lib\net45\System.Web.Cors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Web.Http, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.3.0\lib\net45\System.Web.Http.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Web.Http.Owin, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.3.0\lib\net45\System.Web.Http.Owin.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="Unity.Abstractions, Version=5.11.7.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
+      <HintPath>..\packages\Unity.Abstractions.5.11.7\lib\net47\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\net47\Unity.Container.dll</HintPath>
+    </Reference>
+    <Reference Include="Unity.WebApi, Version=5.4.0.0, Culture=neutral, PublicKeyToken=43da31bc42a85347, processorArchitecture=MSIL">
+      <HintPath>..\packages\Unity.WebAPI.5.4.0\lib\net45\Unity.WebApi.dll</HintPath>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="ZstdSharp, Version=0.8.6.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
+      <HintPath>..\packages\ZstdSharp.Port.0.8.6\lib\net462\ZstdSharp.dll</HintPath>
+    </Reference>
+  </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="Controller\MesApiClient.cs" />
+    <Compile Include="Controller\MesController.cs" />
+    <Compile Include="Controller\PrismDependencyResolver.cs" />
+    <Compile Include="Controller\WebApiService.cs" />
+    <Compile Include="Core\LogHelper.cs" />
+    <Compile Include="Core\Management.cs" />
+    <Compile Include="Core\TrayIconManager.cs" />
+    <Compile Include="DataBase\DatabaseHelper.cs" />
+    <Compile Include="Enums\FormulaPartType.cs" />
+    <Compile Include="Enums\StationType.cs" />
+    <Compile Include="Models\MesModel.cs" />
+    <Compile Include="ViewModels\MainViewModel.cs" />
+    <Compile Include="Views\MainView.xaml.cs">
+      <DependentUpon>MainView.xaml</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup />
+  <ItemGroup>
+    <Page Include="Views\MainView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <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'))" />
+  </Target>
+</Project>

+ 324 - 0
LocalhostMES/Models/MesModel.cs

@@ -0,0 +1,324 @@
+using LocalhostMES.Enums;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocalhostMES.Models
+{
+    public class MesModel
+    {
+    }
+    #region 通用响应模型
+    public class ApiResponse<T>
+    {
+        public string code { get; set; } = "200";
+        public bool success { get; set; } = true;
+        public string msg { get; set; } = "请求成功";
+        public string msgTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+        public string traceId { get; set; } = Guid.NewGuid().ToString("N").Substring(0, 24);
+        public T data { get; set; }
+    }
+
+    public class ErrorResponse
+    {
+        public string code { get; set; } = "55000";
+        public bool success { get; set; } = false;
+        public string msg { get; set; }
+        public string msgTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+        public string traceId { get; set; } = Guid.NewGuid().ToString("N").Substring(0, 24);
+        public object data { get; set; } = null;
+    }
+    #endregion
+
+    #region 2.1 厂级MES下发工单信息
+    public class WorkOrderRequest
+    {
+        public string WorkOrderNo { get; set; }           // 工单号
+        public string MaterialCode { get; set; }          // 成品物料号
+        public string MaterialName { get; set; }          // 成品物料名称
+        public string OrderNo { get; set; }               // 订单号
+        public string SequenceNo { get; set; }            // 工单顺序号
+        public string WorkOrderNum { get; set; }          // 工单生产数量
+        public string PlanOnlineTime { get; set; }        // 计划上线时间
+        public string PlanOfflineTime { get; set; }       // 计划下线时间
+        public string Status { get; set; }                // 工单状态
+        public string FrozenStatus { get; set; }          // 冻结状态
+        public string ReleaseStatus { get; set; }         // 下发状态
+        public string LineCode { get; set; }              // 线体编码
+    }
+
+    public class WorkOrderInfo
+    {
+        [SqlSugar.SugarColumn(IsPrimaryKey = true)]
+        public string WorkOrderNo { get; set; }
+
+        public bool IsLocalhost { get; set;}
+        public string OrderNo { get; set; } = "0";
+        public string MaterialCode { get; set; }
+        public string MaterialName { get; set; }
+        public int PlannedQuantity { get; set; }
+        public int CompletedQuantity { get; set; }
+        public string Status { get; set; }
+        public string LineCode { get; set; }
+        public DateTime CreateTime { get; set; }
+        public DateTime? StartTime { get; set; }
+        public DateTime? EndTime { get; set; }
+    }
+    #endregion
+
+    #region 2.2 SN打印请求
+    public class SnPrintRequest
+    {
+        public string plant { get; set; }                 // 工厂编码
+        public string workShop { get; set; }              // 车间
+        public string line { get; set; }                  // 产线
+        public string station { get; set; }               // 工位编码
+        public string site { get; set; }                  // 站点编码
+        public string equipment { get; set; }             // 设备编码
+        public string orderNo { get; set; }               // 订单号
+        public string workOrderNo { get; set; }           // 工单号
+        public int count { get; set; }                    // 数量
+        public int printType { get; set; }                // 条码类型
+        public string messageTime { get; set; }           // 接口同步时间
+    }
+
+    public class SnInfo
+    {
+        [SqlSugar.SugarColumn(IsPrimaryKey = true)]
+        public string Sn { get; set; }                    // SN条码
+        public DateTime GenerateTime { get; set; }        // 生成时间
+        public string WorkOrderNo { get; set; }           // 所属工单
+        public string PrintType { get; set; }             // 条码类型
+        public bool IsUsed { get; set; } = false;         // 是否已使用
+    }
+
+    public class SnPrintResponseData
+    {
+        public List<SnItem> Sn { get; set; }              // SN列表
+        public string OrderNo { get; set; }               // 订单号
+        public string WorkOrderNo { get; set; }           // 工单号
+        public string Line { get; set; }                  // 产线
+        public string VehicleCode { get; set; }           // 成品物料编码
+        public string MaterialDesc { get; set; }          // 成品物料名称
+    }
+
+    public class SnItem
+    {
+        public string Sn { get; set; }
+    }
+    #endregion
+
+    #region 2.3 接收SN和关键件
+    public class SnKeyComponentRequest
+    {
+        public string businessTpye { get; set; } = "SCAN_TASK";    // 业务类型
+        public string plant { get; set; }                         // 工厂编码
+        public string workShop { get; set; }                      // 车间
+        public string lineCode { get; set; }                      // 产线
+        public string stationCode { get; set; }                   // 工位编码
+        public string positionCode { get; set; }                  // 站点编码
+        public string barcodeBoundProcInfo { get; set; } = "1";   // 绑定关键件加工信息
+        public string equipment { get; set; }                     // 设备编码
+        public string scanTime { get; set; }                      // 扫描时间
+        public string taskCode { get; set; }                      // 任务编码
+        public string scanTpye { get; set; } = "1";              // 扫描执行类型
+        public string sn { get; set; }                           // SN
+        public string gbCode { get; set; }                       // 国标码
+        public string snStatus { get; set; }                     // 产品状态
+        public string employee { get; set; }                     // 人员
+        public List<PartInfo> part { get; set; }                 // 关键件信息
+    }
+
+    public class PartInfo
+    {
+        public string partNum { get; set; }                      // 关键件条码
+        public decimal partQty { get; set; }                     // 关键件数量
+        public string materialCode { get; set; }                 // 关键件物料
+        public string oldPartNum { get; set; }                   // 原关键件条码
+        public string materialType { get; set; }                 // 关键件类型
+        public string positionNo { get; set; }                   // 位置序号
+    }
+    public class LocalhostPartInfo : BindableBase
+    {
+
+
+        private StationType _FormulaType;
+        private string _PartNum;                   // 关键件条码
+        private decimal _PartQty;                   // 关键件数量
+        private string _MaterialCode;              // 关键件物料
+        private string _OldPartNum;               // 原关键件条码
+        private string _MaterialType="1";         // 关键件类型
+        private string _PositionNo="";                // 位置序号
+
+        public StationType FormulaType { get => _FormulaType; set { SetProperty(ref _FormulaType, value); } }
+
+        public string PartNum { get => _PartNum; set { SetProperty(ref _PartNum, value); } }
+        public decimal PartQty { get => _PartQty; set { SetProperty(ref _PartQty, value); } }
+        [SqlSugar.SugarColumn(IsPrimaryKey = true)]
+        public string MaterialCode { get => _MaterialCode; set { SetProperty(ref _MaterialCode, value); } }
+        public string OldPartNum { get => _OldPartNum; set { SetProperty(ref _OldPartNum, value); } }
+        public string MaterialType { get => _MaterialType; set { SetProperty(ref _MaterialType, value); } }
+        public string PositionNo { get => _PositionNo; set { SetProperty(ref _PositionNo, value); } }
+    }
+    public class BindRecord
+    {
+        [SqlSugar.SugarColumn(IsPrimaryKey = true,IsIdentity =true)]
+        public int id { get; set; }
+        public string Sn { get; set; }
+        public string PartNum { get; set; }
+        public string StationCode { get; set; }
+        public DateTime BindTime { get; set; }
+        public string Employee { get; set; }
+        public string ScanType { get; set; }
+    }
+    #endregion
+
+    #region 2.4 接收工件加工参数
+    public class ProcessParameterRequest
+    {
+        public string businessTpye { get; set; }                 // 业务类型
+        public string plant { get; set; }                       // 工厂编码
+        public string workShop { get; set; }                    // 车间
+        public string line { get; set; }                        // 产线
+        public string station { get; set; }                     // 工位编码
+        public string site { get; set; }                        // 站点编码
+        public string sn { get; set; }                          // SN
+        public string barcode { get; set; }                     // 关键件条码
+        public string materialCode { get; set; }                // 物料号
+        public string equipment { get; set; }                   // 设备编号
+        public string overallResult { get; set; }               // 总结果
+        public List<TightenResult> tightenResultDetail { get; set; } // 拧紧任务结果详情
+        public List<StepResult> stepResultDetail { get; set; }  // 工步任务结果详情
+        public string reservedField1 { get; set; }              // 预留字段1
+        public string reservedField2 { get; set; }              // 预留字段2
+        public string reservedField3 { get; set; }              // 预留字段3
+        public string messageTime { get; set; }                 // 接口同步时间
+    }
+
+    public class TightenResult
+    {
+        public int point_num { get; set; }                      // 拧紧序号
+        public int pset { get; set; }                           // 拧紧程序编号
+        public decimal torque { get; set; }                     // 拧紧扭矩
+        public decimal angle { get; set; }                       // 拧紧角度
+        public string tighten_status { get; set; }              // 单次拧紧结果
+        public string tighten_dt { get; set; }                  // 拧紧时间
+    }
+
+    public class StepResult
+    {
+        public string tagCode { get; set; }                     // 参数名
+        public string tagValue { get; set; }                    // 实际值
+        public string tagRage { get; set; }                     // 参数上下限范围
+        public string tagResult { get; set; }                   // 参数结果
+        public string tagUnit { get; set; }                     // 参数单位
+        public List<NgCodeInfo> ngCode { get; set; }            // 异常代码
+    }
+
+    public class NgCodeInfo
+    {
+        public string ngCode { get; set; }                      // 异常代码
+        public string ngDes { get; set; }                       // 异常描述
+    }
+
+    public class ProcessRecord
+    {
+        public string Sn { get; set; }
+        public string Station { get; set; }
+        public string OverallResult { get; set; }
+        public DateTime ProcessTime { get; set; }
+        public string Equipment { get; set; }
+    }
+    #endregion
+
+
+    #region
+    /// <summary>
+    /// 生产数据
+    /// </summary>
+    public class ProductionToStation : BindableBase
+    {
+
+        private Guid _id = Guid.NewGuid();
+        private string _SN;
+        private string _PartNum;
+        private DateTime _CreateTime;
+
+        private string _FormulaName;
+
+        private FormulaPartType _formulaPart;
+
+        private string _Result;
+
+        private List<ResultInfo> _resultContent = new List<ResultInfo>();
+
+        public Guid Id { get => _id; set { SetProperty(ref _id, value); } }
+        public DateTime CreateTime { get => _CreateTime; set { SetProperty(ref _CreateTime, value); } }
+        public string FormulaName { get => _FormulaName; set { SetProperty(ref _FormulaName, value); } }
+        public FormulaPartType FormulaPart { get => _formulaPart; set { SetProperty(ref _formulaPart, value); } }
+        public string Result { get => _Result; set { SetProperty(ref _Result, value); } }
+
+        [SqlSugar.SugarColumn(IsJson = true, ColumnDataType = "nvarchar(2000)")]//必填
+        public List<ResultInfo> ResultContent { get => _resultContent; set { SetProperty(ref _resultContent, value); } }
+
+        public string SN { get => _SN; set { SetProperty(ref _SN, value); } }
+        public string PartNum { get => _PartNum; set { SetProperty(ref _PartNum, value); } }
+    }
+
+    public class ParkingLot : BindableBase
+    {
+        private int _id = 0;
+        private StationType _FormulaType;
+        private string _SerialNumber;
+        private string _PartNumber;
+        private string _PartName;
+        private string _PlanNum;
+        private string _UseNum;
+        private int _CompletedNum;
+
+
+        public StationType FormulaType { get => _FormulaType; set { SetProperty(ref _FormulaType, value); } }
+        /// <summary>
+        /// 序号
+        /// </summary>
+        public string SerialNumber { get => _SerialNumber; set { SetProperty(ref _SerialNumber, value); } }
+        /// <summary>
+        /// 零件号
+        /// </summary>
+        public string PartNumber { get => _PartNumber; set { SetProperty(ref _PartNumber, value); } }
+        /// <summary>
+        /// 零件名称
+        /// </summary>
+        public string PartName { get => _PartName; set { SetProperty(ref _PartName, value); } }
+        /// <summary>
+        /// 计划数量
+        /// </summary>
+        public string PlanNum { get => _PlanNum; set { SetProperty(ref _PlanNum, value); } }
+        /// <summary>
+        /// 使用数量
+        /// </summary>
+        public string UseNum { get => _UseNum; set { SetProperty(ref _UseNum, value); } }
+        /// <summary>
+        /// 已完成数量
+        /// </summary>
+        public int CompletedNum { get => _CompletedNum; set { SetProperty(ref _CompletedNum, value); } }
+
+        [SqlSugar.SugarColumn(IsPrimaryKey = true,IsIdentity =true)]
+        public int Id { get => _id; set { SetProperty(ref _id, value); } }
+    }
+    public class ResultInfo : BindableBase
+    {
+
+        private string resultName;
+        private string resultValue;
+        private string result;
+
+        public string ResultName { get => resultName; set { SetProperty(ref resultName, value); } }
+        public string ResultValue { get => resultValue; set { SetProperty(ref resultValue, value); } }
+        public string Result { get => result; set { SetProperty(ref result, value); } }
+    }
+    #endregion
+}

+ 57 - 0
LocalhostMES/Properties/AssemblyInfo.cs

@@ -0,0 +1,57 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("LocalhostMES")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("LocalhostMES")]
+[assembly: AssemblyCopyright("Copyright ©  2026")]
+[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")]
+// 在程序启动时确保log4net配置已加载
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]

+ 71 - 0
LocalhostMES/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本: 4.0.30319.42000
+//
+//     对此文件的更改可能导致不正确的行为,如果
+//     重新生成代码,则所做更改将丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace LocalhostMES.Properties
+{
+
+
+    /// <summary>
+    ///   强类型资源类,用于查找本地化字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   返回此类使用的缓存 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ( ( resourceMan == null ) )
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LocalhostMES.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
LocalhostMES/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>

+ 30 - 0
LocalhostMES/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace LocalhostMES.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
LocalhostMES/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>

+ 950 - 0
LocalhostMES/ViewModels/MainViewModel.cs

@@ -0,0 +1,950 @@
+using LocalhostMES.Controller;
+using LocalhostMES.Core;
+using LocalhostMES.DataBase;
+using LocalhostMES.Models;
+using LocalhostMES.Views;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Prism.Commands;
+using Prism.Ioc;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.ComponentModel.Composition.Primitives;
+using System.Drawing;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web.UI.WebControls;
+using System.Windows;
+using System.Windows.Threading;
+using System.Xml.Linq;
+
+namespace LocalhostMES.ViewModels
+{
+    public class MainViewModel:BindableBase
+    {
+        IContainerProvider _container;
+        private Management management;
+
+        private bool _isServiceRunning = false;
+
+        #region 属性
+        private int _ServerPort=8081;
+        public int ServerPort { get => _ServerPort; set { SetProperty(ref _ServerPort, value); } }
+
+        private string  _ApiUrl ="http://localhost:5000";
+        public string ApiUrl { get => _ApiUrl; set { SetProperty(ref _ApiUrl, value); } }
+        private string  _AppKey = "API_HANDLE";
+        public string AppKey { get => _AppKey; set { SetProperty(ref _AppKey, value); } }
+        private string _Token = "0575d02f82ee7e8aee232933943e6adb";
+        public string Token { get => _Token; set { SetProperty(ref _Token, value); } }
+
+
+        private ObservableCollection<string> _Logs=new ObservableCollection<string>();
+        public ObservableCollection<string> Logs { get => _Logs; set { SetProperty(ref _Logs, value); } }
+
+
+        private  ObservableCollection<WorkOrderInfo> _dgWorkOrders =new ObservableCollection<WorkOrderInfo>();
+        public ObservableCollection<WorkOrderInfo> DgWorkOrders { get => _dgWorkOrders; set { SetProperty(ref _dgWorkOrders, value); } }
+
+        private WorkOrderInfo _SelectWorkOrderInfo;
+        public WorkOrderInfo SelectWorkOrderInfo { get => _SelectWorkOrderInfo; set { SetProperty(ref _SelectWorkOrderInfo, value); } }
+
+        private  ObservableCollection<SnInfo> _dgSns =new ObservableCollection<SnInfo>();
+        public ObservableCollection<SnInfo> DgSns { get => _dgSns; set { SetProperty(ref _dgSns, value); } }
+
+        private SnInfo _SelectSnInfo;
+        public SnInfo SelectSnInfo { get => _SelectSnInfo; set { SetProperty(ref _SelectSnInfo, value); } }
+
+        private  ObservableCollection<BindRecord> _dgBindRecords =new ObservableCollection<BindRecord>();
+        public ObservableCollection<BindRecord> DgBindRecords { get => _dgBindRecords; set { SetProperty(ref _dgBindRecords, value); } }
+
+        private BindRecord _SelectBindRecord;
+        public BindRecord SelectBindRecord { get => _SelectBindRecord; set { SetProperty(ref _SelectBindRecord, value); } }
+
+        private  ObservableCollection<ProcessRecord> _dgProcessRecords =new ObservableCollection<ProcessRecord>();
+        public ObservableCollection<ProcessRecord> DgProcessRecords { get => _dgProcessRecords; set { SetProperty(ref _dgProcessRecords, value); } }
+
+        private ProcessRecord _SelectProcessRecord;
+        public ProcessRecord SelectProcessRecord { get => _SelectProcessRecord; set { SetProperty(ref _SelectProcessRecord, value); } }
+
+        private ObservableCollection<LocalhostPartInfo> _PartInfos = new ObservableCollection<LocalhostPartInfo>();
+        public ObservableCollection<LocalhostPartInfo> PartInfos { get => _PartInfos; set { SetProperty(ref _PartInfos, value); } }
+
+        private LocalhostPartInfo _NewPart = new LocalhostPartInfo();
+        public LocalhostPartInfo NewPart { get => _NewPart; set { SetProperty(ref _NewPart, value); } }
+
+        private LocalhostPartInfo _SelectPart = new LocalhostPartInfo();
+        public LocalhostPartInfo SelectPart { get => _SelectPart; set { SetProperty(ref _SelectPart, value); } }
+
+
+        private string _SearchWorkOrder;
+        public string  SearchWorkOrder { get => _SearchWorkOrder; set { SetProperty(ref _SearchWorkOrder, value); } }
+
+
+        private string _ServiceStatus="服务状态: 已停止";
+
+        private Brush _Servicebrushes = Brushes.Green;
+
+
+        private bool _StartServiceEnable=true;
+
+        private bool _StopServiceEnable=true;
+
+        public string ServiceStatus { get => _ServiceStatus; set { SetProperty(ref _ServiceStatus, value); } }
+        public Brush Servicebrushes { get => _Servicebrushes; set { SetProperty(ref _Servicebrushes, value); } }
+        public bool StartServiceEnable { get => _StartServiceEnable; set { SetProperty(ref _StartServiceEnable, value); } }
+        public bool StopServiceEnable { get => _StopServiceEnable; set { SetProperty(ref _StopServiceEnable, value); } }
+
+        private string _StatusTxt; 
+        public string StatusTxt { get => _StatusTxt; set { SetProperty(ref _StatusTxt, value); } }
+
+        private Brush _StatusForeground=Brushes.Green;
+        public Brush StatusForeground { get => _StatusForeground; set { SetProperty(ref _StatusForeground, value); } }
+
+
+        #region 零件
+
+        private ObservableCollection<ParkingLot> _parkingLots=new ObservableCollection<ParkingLot>();
+        public ObservableCollection<ParkingLot> ParkingLots
+        {
+            get => _parkingLots;
+            set => SetProperty(ref _parkingLots, value);
+        }
+
+        private ParkingLot _currentParkingLot=new ParkingLot();
+        public ParkingLot CurrentParkingLot
+        {
+            get => _currentParkingLot;
+            set => SetProperty(ref _currentParkingLot, value);
+        }
+
+        private ParkingLot _selectedParkingLot;
+        public ParkingLot SelectedParkingLot
+        {
+            get => _selectedParkingLot;
+            set => SetProperty(ref _selectedParkingLot, value);
+        }
+
+        private bool _isEditMode;
+        public bool IsEditMode
+        {
+            get => _isEditMode;
+            set => SetProperty(ref _isEditMode, value);
+        }
+        // 命令
+        public DelegateCommand AddCommand { get; private set; }
+        public DelegateCommand UpdateCommand { get; private set; }
+        public DelegateCommand<ParkingLot> DeleteCommand { get; private set; }
+        public DelegateCommand<ParkingLot> EditCommand { get; private set; }
+        public DelegateCommand ClearFormCommand { get; private set; }
+        public DelegateCommand CancelEditCommand { get; private set; }
+
+
+
+
+        #endregion
+        #endregion
+        #region 命令
+        private DelegateCommand _LoadedCommand;
+        public DelegateCommand LoadedCommand =>
+            _LoadedCommand ?? ( _LoadedCommand = new DelegateCommand(ExecuteLoadedCommand) );
+
+        private DelegateCommand _ClosedCommand;
+        public DelegateCommand ClosedCommand =>
+            _ClosedCommand ?? ( _ClosedCommand = new DelegateCommand(ExecuteClosedCommand) );
+
+        private DelegateCommand _TestSnPrintCommand;
+        public DelegateCommand TestSnPrintCommand =>
+            _TestSnPrintCommand ?? ( _TestSnPrintCommand = new DelegateCommand(TestSnPrint) );
+
+
+
+        private DelegateCommand _TestSnComponentCommand;
+        public DelegateCommand TestSnComponentCommand =>
+            _TestSnComponentCommand ?? ( _TestSnComponentCommand = new DelegateCommand(TestSnComponent) );
+
+        private DelegateCommand _TestProcessParamsCommand;
+        public DelegateCommand TestProcessParamsCommand =>
+            _TestProcessParamsCommand ?? ( _TestProcessParamsCommand = new DelegateCommand(TestProcessParams) );
+
+
+        private DelegateCommand _ClearLogCommand;
+        public DelegateCommand ClearLogCommand =>
+            _ClearLogCommand ?? ( _ClearLogCommand = new DelegateCommand(ClearLog) );
+
+
+
+
+      
+        private DelegateCommand _RefreshWorkOrdersCommand;
+        public DelegateCommand RefreshWorkOrdersCommand =>
+            _RefreshWorkOrdersCommand ?? ( _RefreshWorkOrdersCommand = new DelegateCommand(RefreshWorkOrders) );
+
+        private DelegateCommand _AddWorkOrderCommand;
+        public DelegateCommand AddWorkOrderCommand =>
+            _AddWorkOrderCommand ?? ( _AddWorkOrderCommand = new DelegateCommand(AddWorkOrder) );
+        private DelegateCommand _DeleteWorkOrderCommand;
+        public DelegateCommand DeleteWorkOrderCommand =>
+            _DeleteWorkOrderCommand ?? ( _DeleteWorkOrderCommand = new DelegateCommand(DeleteWorkOrder) );
+
+
+        private DelegateCommand _SearchSnsCommand;
+        public DelegateCommand SearchSnsCommand =>
+            _SearchSnsCommand ?? ( _SearchSnsCommand = new DelegateCommand(SearchSns) );
+
+
+        private DelegateCommand _RefreshBindRecordsCommand;
+        public DelegateCommand RefreshBindRecordsCommand =>
+            _RefreshBindRecordsCommand ?? ( _RefreshBindRecordsCommand = new DelegateCommand(RefreshBindRecords) );
+        private DelegateCommand _ClearBindRecordsCommand;
+        public DelegateCommand ClearBindRecordsCommand =>
+            _ClearBindRecordsCommand ?? ( _ClearBindRecordsCommand = new DelegateCommand(ClearBindRecords) );
+
+        private DelegateCommand _RefreshProcessRecordsCommand;
+        public DelegateCommand RefreshProcessRecordsCommand =>
+            _RefreshProcessRecordsCommand ?? ( _RefreshProcessRecordsCommand = new DelegateCommand(RefreshProcessRecords) );
+        private DelegateCommand _ClearProcessRecordsCommand;
+        public DelegateCommand ClearProcessRecordsCommand =>
+            _ClearProcessRecordsCommand ?? ( _ClearProcessRecordsCommand = new DelegateCommand(ClearProcessRecords) );
+        private DelegateCommand _StartServiceCommand;
+        public DelegateCommand StartServiceCommand =>
+            _StartServiceCommand ?? ( _StartServiceCommand = new DelegateCommand(StartService) );
+
+        private DelegateCommand _StopServiceCommand;
+        public DelegateCommand StopServiceCommand =>
+            _StopServiceCommand ?? ( _StopServiceCommand = new DelegateCommand(StopService) );
+        private DelegateCommand _SaveSettingsCommand;
+        public DelegateCommand SaveSettingsCommand =>
+            _SaveSettingsCommand ?? ( _SaveSettingsCommand = new DelegateCommand(SaveSettings) );
+
+        private DelegateCommand _AddPartInfoCommand;
+        public DelegateCommand AddPartInfoCommand =>
+            _AddPartInfoCommand ?? (_AddPartInfoCommand = new DelegateCommand(AddPartInfo));
+
+        private DelegateCommand _RefPartInfoCommand;
+        public DelegateCommand RefPartInfoCommand =>
+            _RefPartInfoCommand ?? (_RefPartInfoCommand = new DelegateCommand(RefPartInfo));
+
+
+        private DelegateCommand _DeletePartInfoCommand;
+        public DelegateCommand DeletePartInfoCommand =>
+            _DeletePartInfoCommand ?? (_DeletePartInfoCommand = new DelegateCommand(DeletePartInfo));
+
+        
+
+        public Management Management { get => management; set { SetProperty(ref management, value); } }
+        #endregion
+        public MainViewModel(IContainerProvider container) 
+        {
+            _container= container;
+            Management = Management.GetManagement();
+            AddCommand = new DelegateCommand(AddParkingLot);
+            UpdateCommand = new DelegateCommand(UpdateParkingLot, CanUpdate)
+                .ObservesProperty(() => IsEditMode);
+
+            DeleteCommand = new DelegateCommand<ParkingLot>(DeleteParkingLot);
+
+
+            EditCommand = new DelegateCommand<ParkingLot>(EditParkingLot);
+            ClearFormCommand = new DelegateCommand(ClearForm);
+            CancelEditCommand = new DelegateCommand(CancelEdit);
+            //// 初始化服务
+            //management.WebApiService = new WebApiService();
+            //management.WebApiService.Init(8081);
+            //management.WebApiService.StartAsync();
+            // 初始化数据
+
+            InitializeDataGrids();
+
+            LogHelper.logChangHandler += AddLog;
+        }
+
+        private void ExecuteLoadedCommand()
+        {
+            UpdateServiceStatus();
+        }
+
+        private async void ExecuteClosedCommand()
+        {
+            if ( _isServiceRunning )
+            {
+                await Management.WebApiService.StopAsync();
+            }
+        }
+        private async void TestSnPrint()
+        {
+            try
+            {
+                if (Management.ApiClient == null )
+                {
+                    ShowMessage("请先启动服务并配置API客户端", true);
+                    return;
+                }
+
+                AddLog("=== 测试SN打印请求接口 ===");
+                
+                var request = new SnPrintRequest
+                {
+                    plant = "1211",
+                    workShop = "附件工厂",
+                    line = DgWorkOrders[0].LineCode,
+                    station = "ST01",
+                    site = "ST01-01",
+                    equipment = "PRINTER001",
+                    orderNo = null,
+                    workOrderNo = DgWorkOrders[0].WorkOrderNo,
+                    count = 2,
+                    printType = 1,
+                    messageTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                };
+
+                AddLog("请求参数:");
+                AddLog(JsonConvert.SerializeObject(request, Formatting.Indented));
+                var response = await Management.ApiClient.RequestSnPrintAsync(request);
+                AddLog("响应结果:");
+                LogHelper.WriteLogInfo(JsonConvert.SerializeObject(response, Formatting.Indented));
+               // AddLog(JsonConvert.SerializeObject(response, Formatting.Indented));
+                ShowMessage("SN打印请求测试完成", false);
+            }
+            catch ( Exception ex )
+            {
+                AddLog($"错误: {ex.Message}");
+                ShowMessage($"测试失败: {ex.Message}", true);
+            }
+        }
+
+        private async void TestSnComponent()
+        {
+            try
+            {
+                if (Management.ApiClient== null )
+                {
+                    ShowMessage("请先启动服务并配置API客户端", true);
+                    return;
+                }
+
+                AddLog("=== 测试SN关键件绑定接口 ===");
+                List<SnInfo> infos = new List<SnInfo>();
+
+                infos = DatabaseHelper.SelectSnInfo(DgWorkOrders[0].WorkOrderNo,true,false);
+
+                if (infos.Count != 0)
+                {
+                    var request = new SnKeyComponentRequest
+                    {
+                        businessTpye = "SCAN_TASK",
+                        plant = "1",
+                        workShop = "ZPCJ",
+                        lineCode = "ZPX-01",
+                        stationCode = "ZPX-01-01",
+                        positionCode = "ZPX-01-01-01",
+                        barcodeBoundProcInfo = "1",
+                        equipment = "SCANNER001",
+                        scanTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                        taskCode = "TASK-001",
+                        scanTpye = "1",
+                        sn = infos[0].Sn,
+                        gbCode = "GB123456",
+                        snStatus = "1",
+                        employee = "张三",
+                        part = new List<PartInfo>
+                    {
+                        new PartInfo
+                        {
+                            partNum = "5120101-ZE02-001",
+                            partQty = 1,
+                            materialCode = "MAT-001",
+                            oldPartNum = "",
+                            materialType = "1",
+                            positionNo = "P001"
+                        }
+                    }
+                    };
+
+                    AddLog("请求参数:");
+                    AddLog(JsonConvert.SerializeObject(request, Formatting.Indented));
+
+                    var response = await Management.ApiClient.SendSnComponentAsync(request);
+
+                    AddLog("响应结果:");
+                    AddLog(JsonConvert.SerializeObject(response, Formatting.Indented));
+                    
+                }
+                else 
+                {
+                    AddLog("无可用SN");
+                }
+                ShowMessage("SN关键件绑定测试完成", false);
+            }
+            catch ( Exception ex )
+            {
+                AddLog($"错误: {ex.Message}");
+                ShowMessage($"测试失败: {ex.Message}", true);
+            }
+        }
+        private async void TestProcessParams()
+        {
+            try
+            {
+                if ( Management.ApiClient == null )
+                {
+                    ShowMessage("请先启动服务并配置API客户端", true);
+                    return;
+                }
+
+                AddLog("=== 测试加工参数上报接口 ===");
+                List<SnInfo> infos = new List<SnInfo>();
+
+                infos = DatabaseHelper.SelectSnInfo(DgWorkOrders[0].WorkOrderNo, true, false);
+
+                if (infos.Count != 0)
+                {
+                    var request = new ProcessParameterRequest
+                    {
+                        businessTpye = "SCAN_TASK",
+                        plant = "1211",
+                        workShop = "ZPCJ",
+                        line = "ZPX-01",
+                        station = "ZPX-01-01",
+                        site = "ZPX-01-01-01",
+                        sn = infos[0].Sn,
+                        barcode = "PART-001",
+                        materialCode = "T03GCD",
+                        equipment = "EQUIP001",
+                        overallResult = "OK",
+                        tightenResultDetail = new List<TightenResult>
+                    {
+                        new TightenResult
+                        {
+                            point_num = 1,
+                            pset = 1,
+                            torque = 45.08m,
+                            angle = 44.0m,
+                            tighten_status = "OK",
+                            tighten_dt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                        }
+                    },
+                        stepResultDetail = new List<StepResult>
+                    {
+                        new StepResult
+                        {
+                            tagCode = "TEST_PRESSURE",
+                            tagValue = "3.0",
+                            tagRage = "2.7-3.3",
+                            tagResult = "OK",
+                            tagUnit = "kg",
+                            ngCode = new List<NgCodeInfo>()
+                        }
+                    },
+                        reservedField1 = "",
+                        reservedField2 = "",
+                        reservedField3 = "",
+                        messageTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                    };
+
+                    AddLog("请求参数:");
+                    AddLog(JsonConvert.SerializeObject(request, Formatting.Indented));
+
+                    var response = await Management.ApiClient.SendProcessParametersAsync(request);
+
+                    AddLog("响应结果:");
+                    AddLog(JsonConvert.SerializeObject(response, Formatting.Indented));
+                    infos[0].IsUsed = true;
+                    DatabaseHelper.UpdateSnInfo(infos[0]);
+                }
+                else
+                {
+                    AddLog("无可用SN");
+                }
+                ShowMessage("加工参数上报测试完成", false);
+            }
+            catch ( Exception ex )
+            {
+                AddLog($"错误: {ex.Message}");
+                ShowMessage($"测试失败: {ex.Message}", true);
+            }
+        }
+        private void ClearLog()
+        {
+            Logs.Clear();
+        }
+        
+        #region Tab 2: 工单管理
+
+
+
+        private async void RefreshWorkOrders()
+        {
+            try
+            {
+                DgWorkOrders =new ObservableCollection<WorkOrderInfo>( DatabaseHelper.SelectWorkOrderInfo()) ;
+                ShowMessage($"已加载 {DgWorkOrders.Count} 个工单", false);
+            }
+            catch ( Exception ex )
+            {
+                ShowMessage($"刷新失败: {ex.Message}", true);
+            }
+        }
+
+        private async void AddWorkOrder()
+        {
+            try
+            {
+                // 创建新工单对话框
+                var dialog = new WorkOrderDialog();
+                if ( dialog.ShowDialog() == true )
+                {
+                    // 创建或更新工单信息
+                    var workOrder = dialog.WorkOrder;
+                    if ( DatabaseHelper.InsertWorkOrderInfo(workOrder) )
+                    {
+                        ShowMessage("工单创建成功", false);
+                        RefreshWorkOrders();
+                    }
+                    else
+                    {
+                        ShowMessage($"创建失败", true);
+                    }
+                }
+            }
+            catch ( Exception ex )
+            {
+                ShowMessage($"创建失败: {ex.Message}", true);
+            }
+        }
+       
+
+        private void DeleteWorkOrder()
+        {
+            
+            if ( SelectWorkOrderInfo == null )
+            {
+                ShowMessage("请先选择要删除的工单", true);
+                return;
+            }
+
+            var result = MessageBox.Show($"确定要删除工单 {SelectWorkOrderInfo.WorkOrderNo} 吗?",
+                "确认删除", MessageBoxButton.YesNo, MessageBoxImage.Warning);
+
+            if ( result == MessageBoxResult.Yes )
+            {
+                try
+                {
+                    // 从内存中删除(实际应该调用API)
+                    DatabaseHelper.DeleteWorkOrderInfo(SelectWorkOrderInfo);
+                    ShowMessage("工单已删除", false);
+                    RefreshWorkOrders();
+                }
+                catch ( Exception ex )
+                {
+                    ShowMessage($"删除失败: {ex.Message}", true);
+                }
+            }
+        }
+        #endregion
+
+        #region Tab 3: SN管理
+
+
+        private async void SearchSns()
+        {
+            try
+            {
+                var workOrderNo = SearchWorkOrder.Trim();
+                if ( string.IsNullOrEmpty(workOrderNo) )
+                {
+                    ShowMessage("请输入工单号", true);
+                    return;
+                }
+                var response = DatabaseHelper.SelectSnInfo(workOrderNo);
+                if ( response.Count != 0 )
+                {
+                    DgSns =new ObservableCollection<SnInfo>(response);
+                    ShowMessage($"已加载 {response.Count} 个SN", false);
+                }
+                else
+                {
+                    ShowMessage($"加载失败: {response.Count}", true);
+                }
+            }
+            catch ( Exception ex )
+            {
+                ShowMessage($"查询失败: {ex.Message}", true);
+            }
+        }
+        #endregion
+
+        #region Tab 4: 绑定记录
+        private async void RefreshBindRecords()
+        {
+            try
+            {
+                var response = DatabaseHelper.SelectBindRecord();
+                if ( response.Count!=0 )
+                {
+                    DgBindRecords=new ObservableCollection<BindRecord>(response);
+                    ShowMessage($"已加载 {response.Count} 条绑定记录", false);
+                }
+                else
+                {
+                    ShowMessage($"加载失败: {response.Count}", true);
+                }
+            }
+            catch ( Exception ex )
+            {
+                ShowMessage($"刷新失败: {ex.Message}", true);
+            }
+        }
+
+
+        private void ClearBindRecords()
+        {
+            var result = MessageBox.Show("确定要清空所有绑定记录吗?",
+                "确认清空", MessageBoxButton.YesNo, MessageBoxImage.Warning);
+
+            if ( result == MessageBoxResult.Yes )
+            {
+                try
+                {
+                    DatabaseHelper.DeleteBindRecord();
+                    DgBindRecords.Clear();
+                    ShowMessage("绑定记录已清空", false);
+                }
+                catch ( Exception ex )
+                {
+                    ShowMessage($"清空失败: {ex.Message}", true);
+                }
+            }
+        }
+        #endregion
+
+        #region Tab 5: 加工记录
+        private async void RefreshProcessRecords()
+        {
+            try
+            {
+                var response =  DatabaseHelper.SelectProcessRecord();
+                if ( response.Count!=0 )
+                {
+                    DgProcessRecords=new ObservableCollection<ProcessRecord>(response);
+                    ShowMessage($"已加载 {response.Count} 条加工记录", false);
+                }
+                else
+                {
+                    ShowMessage($"加载失败: {response.Count}", true);
+                }
+            }
+            catch ( Exception ex )
+            {
+                ShowMessage($"刷新失败: {ex.Message}", true);
+            }
+        }
+
+
+        private void ClearProcessRecords()
+        {
+            var result = MessageBox.Show("确定要清空所有加工记录吗?",
+                "确认清空", MessageBoxButton.YesNo, MessageBoxImage.Warning);
+
+            if ( result == MessageBoxResult.Yes )
+            {
+                try
+                {
+                    DatabaseHelper.DeleteProcessRecord();
+                    DgProcessRecords.Clear();
+                    ShowMessage("加工记录已清空", false);
+                }
+                catch ( Exception ex )
+                {
+                    ShowMessage($"清空失败: {ex.Message}", true);
+                }
+            }
+        }
+        #endregion
+
+        #region Tab 6: 系统设置
+
+
+        private async void StartService()
+        {
+            try
+            {
+                if ( ServerPort < 1 || ServerPort > 65535 )
+                {
+                    ShowMessage("请输入有效的端口号(1-65535)", true);
+                    return;
+                }
+                if (Management.WebApiService == null) 
+                {
+                    Management.WebApiService = _container.Resolve<WebApiService>();
+                }
+                if (Management.WebApiService.IsRunning )
+                    Management.WebApiService.Dispose();
+
+               
+                Management.WebApiService.Init(ServerPort);
+                await Management.WebApiService.StartAsync();
+
+                _isServiceRunning = true;
+                UpdateServiceStatus();
+                ShowMessage($"Web API服务已启动,端口: {ServerPort}", false);
+            }
+            catch ( Exception ex )
+            {
+                ShowMessage($"服务启动失败: {ex.Message}", true);
+            }
+        }
+        private async void StopService()
+        {
+            try
+            {
+                await Management.WebApiService.StopAsync();
+                _isServiceRunning = false;
+                UpdateServiceStatus();
+
+                ShowMessage("Web API服务已停止", false);
+            }
+            catch ( Exception ex )
+            {
+                ShowMessage($"服务停止失败: {ex.Message}", true);
+            }
+        }
+        private void SaveSettings()
+        {
+            try
+            {
+                var apiUrl = ApiUrl.Trim();
+                var appKey = AppKey.Trim();
+                var token = Token.Trim();
+
+                if ( string.IsNullOrEmpty(apiUrl) )
+                {
+                    ShowMessage("请输入API地址", true);
+                    return;
+                }
+
+                Management.ApiClient = new MesApiClient(apiUrl, appKey, token);
+                ShowMessage("API客户端配置已保存", false);
+            }
+            catch ( Exception ex )
+            {
+                ShowMessage($"保存失败: {ex.Message}", true);
+            }
+        }
+        #endregion
+
+        #region 零件
+
+        private void AddParkingLot()
+        {
+            if (!ValidateParkingLot())
+                return;
+
+            // 创建新对象(避免引用问题)
+            var newParkingLot = new ParkingLot
+            {
+                FormulaType = CurrentParkingLot.FormulaType,
+                SerialNumber = CurrentParkingLot.SerialNumber,
+                PartNumber = CurrentParkingLot.PartNumber,
+                PartName = CurrentParkingLot.PartName,
+                PlanNum = CurrentParkingLot.PlanNum,
+                UseNum = CurrentParkingLot.UseNum,
+                CompletedNum = CurrentParkingLot.CompletedNum
+            };
+            DatabaseHelper.InsertParkingLot(newParkingLot);
+            ParkingLots = new ObservableCollection<ParkingLot>(DatabaseHelper.SelectParkingLot(CurrentParkingLot.FormulaType));
+            MessageBox.Show("添加成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
+        }
+
+        private void EditParkingLot(ParkingLot parkingLot)
+        {
+            if (parkingLot == null)
+                return;
+
+            // 复制数据到表单
+            CurrentParkingLot = new ParkingLot
+            {
+                FormulaType = parkingLot.FormulaType,
+                SerialNumber = parkingLot.SerialNumber,
+                PartNumber = parkingLot.PartNumber,
+                PartName = parkingLot.PartName,
+                PlanNum = parkingLot.PlanNum,
+                UseNum = parkingLot.UseNum,
+                CompletedNum = parkingLot.CompletedNum
+            };
+
+            IsEditMode = true;
+            SelectedParkingLot = parkingLot;
+
+        }
+
+        private void UpdateParkingLot()
+        {
+            if (!ValidateParkingLot() || SelectedParkingLot == null)
+                return;
+
+            // 更新选中项的数据
+            SelectedParkingLot.FormulaType = CurrentParkingLot.FormulaType;
+            SelectedParkingLot.SerialNumber = CurrentParkingLot.SerialNumber;
+            SelectedParkingLot.PartNumber = CurrentParkingLot.PartNumber;
+            SelectedParkingLot.PartName = CurrentParkingLot.PartName;
+            SelectedParkingLot.PlanNum = CurrentParkingLot.PlanNum;
+            SelectedParkingLot.UseNum = CurrentParkingLot.UseNum;
+            SelectedParkingLot.CompletedNum = CurrentParkingLot.CompletedNum;
+
+            CancelEdit();
+            MessageBox.Show("更新成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
+        }
+
+        private bool CanUpdate()
+        {
+            return IsEditMode;
+        }
+
+        private void DeleteParkingLot(ParkingLot parkingLot)
+        {
+            if (parkingLot == null)
+                return;
+
+            var result = MessageBox.Show($"确定要删除站点 '{parkingLot.FormulaType}' 的记录吗?",
+                "确认删除", MessageBoxButton.YesNo, MessageBoxImage.Warning);
+
+            if (result == MessageBoxResult.Yes)
+            {
+                ParkingLots.Remove(parkingLot);
+
+                if (IsEditMode && SelectedParkingLot == parkingLot)
+                {
+                    CancelEdit();
+                }
+            }
+        }
+
+        private void ClearForm()
+        {
+            CurrentParkingLot = new ParkingLot();
+        }
+
+        private void CancelEdit()
+        {
+            IsEditMode = false;
+            ClearForm();
+            SelectedParkingLot = null;
+        }
+
+        private bool ValidateParkingLot()
+        {
+            //if (CurrentParkingLot.FormulaType)
+            //{
+            //    MessageBox.Show("站点名称不能为空!", "验证错误", MessageBoxButton.OK, MessageBoxImage.Warning);
+            //    return false;
+            //}
+
+            // 验证已完成数量是否为数字
+            if (!int.TryParse(CurrentParkingLot.PlanNum, out _) && !string.IsNullOrWhiteSpace(CurrentParkingLot.PlanNum))
+            {
+                MessageBox.Show("计划数量必须为数字!", "验证错误", MessageBoxButton.OK, MessageBoxImage.Warning);
+                return false;
+            }
+
+            if (!int.TryParse(CurrentParkingLot.UseNum, out _) && !string.IsNullOrWhiteSpace(CurrentParkingLot.UseNum))
+            {
+                MessageBox.Show("使用数量必须为数字!", "验证错误", MessageBoxButton.OK, MessageBoxImage.Warning);
+                return false;
+            }
+
+            return true;
+        }
+
+
+        #endregion
+
+        #region 辅助方法
+        private void UpdateServiceStatus()
+        {
+            if ( _isServiceRunning )
+            {
+                ServiceStatus = "服务状态: 运行中";
+                Servicebrushes = Brushes.Green;
+                StartServiceEnable = false;
+                StopServiceEnable = true;
+            }
+            else
+            {
+                ServiceStatus = "服务状态: 已停止";
+                Servicebrushes = Brushes.Red;
+                StartServiceEnable = true;
+                StopServiceEnable = false;
+            }
+        }
+
+        private void AddLog(string message)
+        {
+            System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
+            {
+
+                Logs.Add($"[{DateTime.Now:HH:mm:ss}] {message}\n");
+            }));
+        }
+
+        private void ShowMessage(string message, bool isError)
+        {
+            System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
+            {
+                StatusTxt = message;
+                StatusForeground = isError ? Brushes.Red : Brushes.Green;
+            }));
+        }
+
+        private void InitializeDataGrids()
+        {
+            DatabaseHelper.CreataDataTable();
+            // 初始化工单列表
+            DgWorkOrders=new ObservableCollection<WorkOrderInfo>( DatabaseHelper.SelectWorkOrderInfo());
+            // 初始化绑定记录
+            DgBindRecords = new ObservableCollection<BindRecord>(DatabaseHelper.SelectBindRecord());
+            // 初始化加工记录
+            DgProcessRecords = new ObservableCollection<ProcessRecord>(DatabaseHelper.SelectProcessRecord());
+        }
+        #endregion
+
+
+
+
+        public void AddPartInfo() 
+        {
+
+            if (DatabaseHelper.InsertPartInfo(NewPart))
+            {
+                ShowMessage("工单创建成功", false);
+                RefreshWorkOrders();
+            }
+            else
+            {
+                ShowMessage($"创建失败", true);
+            }
+
+        }
+
+        public void RefPartInfo()
+        {
+
+            PartInfos = new ObservableCollection<LocalhostPartInfo>(DatabaseHelper.SelectPartInfo(NewPart.FormulaType));
+
+        }
+        public void DeletePartInfo() 
+        {
+            DatabaseHelper.DeletePartInfo(SelectPart.FormulaType, SelectPart.MaterialCode);
+        }
+
+        public void SetMesState()
+        {
+            Management.IsLocalhostMode = true;
+        }
+    }
+}

+ 900 - 0
LocalhostMES/Views/MainView.xaml

@@ -0,0 +1,900 @@
+<Window x:Class="LocalhostMES.Views.MainView"
+        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:b="http://schemas.microsoft.com/xaml/behaviors"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:LocalhostMES.Views"
+        xmlns:enums="clr-namespace:LocalhostMES.Enums"
+        xmlns:prism="http://prismlibrary.com/"
+        prism:ViewModelLocator.AutoWireViewModel="True"
+        mc:Ignorable="d"
+        Title="MainView"
+        Height="450"
+        Width="800">
+
+
+    <Window.Resources>
+        <!-- 样式定义 -->
+        <Style TargetType="TabItem">
+            <Setter Property="FontSize"
+                    Value="14" />
+            <Setter Property="FontWeight"
+                    Value="Bold" />
+            <Setter Property="Padding"
+                    Value="10,5" />
+        </Style>
+
+        <Style TargetType="GroupBox">
+            <Setter Property="Margin"
+                    Value="5" />
+            <Setter Property="Padding"
+                    Value="10" />
+        </Style>
+
+        <Style TargetType="Button">
+            <Setter Property="Padding"
+                    Value="8,4" />
+            <Setter Property="Margin"
+                    Value="2" />
+            <Setter Property="MinWidth"
+                    Value="80" />
+        </Style>
+
+        <Style TargetType="DataGrid">
+            <Setter Property="Margin"
+                    Value="5" />
+            <Setter Property="AutoGenerateColumns"
+                    Value="False" />
+            <Setter Property="IsReadOnly"
+                    Value="True" />
+            <Setter Property="CanUserAddRows"
+                    Value="False" />
+            <Setter Property="CanUserDeleteRows"
+                    Value="False" />
+            <Setter Property="CanUserReorderColumns"
+                    Value="False" />
+            <Setter Property="CanUserResizeRows"
+                    Value="False" />
+            <Setter Property="AlternatingRowBackground"
+                    Value="#F5F5F5" />
+        </Style>
+
+
+
+        <Style TargetType="TextBox">
+            <Setter Property="Margin"
+                        Value="5" />
+            <Setter Property="VerticalContentAlignment"
+                        Value="Center" />
+        </Style>
+
+        <Style TargetType="ComboBox">
+            <Setter Property="Margin"
+                        Value="5" />
+            <Setter Property="VerticalContentAlignment"
+                        Value="Center" />
+        </Style>
+
+        <Style TargetType="Label">
+            <Setter Property="Margin"
+                        Value="5,5,2,5" />
+            <Setter Property="VerticalAlignment"
+                        Value="Center" />
+        </Style>
+
+        <DataTemplate x:Key="StationTypeTemplate">
+            <TextBlock Text="{Binding Path=FormulaType, Mode=OneWay}" />
+        </DataTemplate>
+    </Window.Resources>
+    <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>
+    <Grid>
+        <TabControl>
+            <!-- Tab 1: 接口测试 -->
+            <TabItem Header="接口测试">
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="400" />
+                        <ColumnDefinition Width="*" />
+                    </Grid.ColumnDefinitions>
+
+                    <!-- 左侧:接口列表 -->
+                    <GroupBox Grid.Column="0"
+                              Header="接口列表"
+                              Margin="10">
+                        <StackPanel>
+                            <!--<Button x:Name="btnTestWorkOrder"
+                                    Content="测试工单下发"
+                                    Height="40"
+                                    Margin="0,5"
+                                    Click="BtnTestWorkOrder_Click" />-->
+                            <Button x:Name="btnTestSnPrint"
+                                    Content="测试SN打印请求"
+                                    Height="40"
+                                    Margin="0,5"
+                                    Command="{Binding TestSnPrintCommand}" />
+                            <Button x:Name="btnTestSnComponent"
+                                    Content="测试SN关键件绑定"
+                                    Height="40"
+                                    Margin="0,5"
+                                    Command="{Binding TestSnComponentCommand}" />
+                            <Button x:Name="btnTestProcessParams"
+                                    Content="测试加工参数上报"
+                                    Height="40"
+                                    Margin="0,5"
+                                    Command="{Binding TestProcessParamsCommand}" />
+
+                            <Separator Margin="0,10" />
+
+                            <Button x:Name="btnClearLog"
+                                    Content="清空日志"
+                                    Height="30"
+                                    Margin="0,5"
+                                    Command="{Binding ClearLogCommand}" />
+                        </StackPanel>
+                    </GroupBox>
+
+                    <!-- 右侧:日志显示 -->
+                    <GroupBox Grid.Column="1"
+                              Header="请求/响应日志"
+                              Margin="10">
+                        <Grid>
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="*" />
+                                <RowDefinition Height="Auto" />
+                            </Grid.RowDefinitions>
+
+
+
+                            <ListBox Name="logbox"
+                                     Grid.Row="0"
+                                     ItemsSource="{Binding Logs}"
+                                     BorderBrush="Transparent">
+
+                            </ListBox>
+
+                            <StackPanel Grid.Row="1"
+                                        Orientation="Horizontal"
+                                        HorizontalAlignment="Right">
+                                <TextBlock x:Name="txtStatus"
+                                           Text="{Binding StatusTxt}"
+                                           Margin="5"
+                                           Foreground="{Binding StatusForeground}"
+                                           VerticalAlignment="Center" />
+                            </StackPanel>
+                        </Grid>
+                    </GroupBox>
+                </Grid>
+            </TabItem>
+
+            <!-- Tab 2: 工单管理 -->
+            <TabItem Header="工单管理">
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="*" />
+                    </Grid.RowDefinitions>
+
+                    <!-- 工具栏 -->
+                    <StackPanel Grid.Row="0"
+                                Orientation="Horizontal"
+                                Margin="10">
+                        <Button x:Name="btnRefreshWorkOrders"
+                                Content="刷新"
+                                Width="80"
+                                Command="{Binding RefreshWorkOrdersCommand}" />
+                        <Button x:Name="btnAddWorkOrder"
+                                Content="添加工单"
+                                Width="80"
+                                Margin="10,0,0,0"
+                                Command="{Binding AddWorkOrderCommand}" />
+                        <Button x:Name="btnDeleteWorkOrder"
+                                Content="删除工单"
+                                Width="80"
+                                Margin="10,0,0,0"
+                                Command="{Binding DeleteWorkOrderCommand}" />
+                    </StackPanel>
+
+                    <!-- 工单列表 -->
+                    <DataGrid x:Name="dgWorkOrders"
+                              Grid.Row="1"
+                              SelectedItem="{Binding SelectWorkOrderInfo}"
+                              ItemsSource="{Binding DgWorkOrders}"
+                              Margin="10,0,10,10">
+                        <DataGrid.Columns>
+                            <DataGridTextColumn Header="工单号"
+                                                Binding="{Binding WorkOrderNo}"
+                                                Width="120" />
+                            <DataGridTextColumn Header="物料编码"
+                                                Binding="{Binding MaterialCode}"
+                                                Width="100" />
+                            <DataGridTextColumn Header="物料名称"
+                                                Binding="{Binding MaterialName}"
+                                                Width="150" />
+                            <DataGridTextColumn Header="计划数量"
+                                                Binding="{Binding PlannedQuantity}"
+                                                Width="80" />
+                            <DataGridTextColumn Header="完成数量"
+                                                Binding="{Binding CompletedQuantity}"
+                                                Width="80" />
+                            <DataGridTextColumn Header="状态"
+                                                Binding="{Binding Status}"
+                                                Width="80">
+                                <DataGridTextColumn.ElementStyle>
+                                    <Style TargetType="TextBlock">
+                                        <Setter Property="HorizontalAlignment"
+                                                Value="Center" />
+                                    </Style>
+                                </DataGridTextColumn.ElementStyle>
+                            </DataGridTextColumn>
+                            <DataGridTextColumn Header="线体编码"
+                                                Binding="{Binding LineCode}"
+                                                Width="80" />
+                            <DataGridTextColumn Header="创建时间"
+                                                Binding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm}"
+                                                Width="140" />
+                        </DataGrid.Columns>
+                    </DataGrid>
+                </Grid>
+            </TabItem>
+
+            <!-- Tab 3: SN管理 -->
+            <TabItem Header="SN管理">
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="117*" />
+                        <ColumnDefinition Width="165*" />
+                        <ColumnDefinition Width="512*" />
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="*" />
+                    </Grid.RowDefinitions>
+
+                    <!-- 查询条件 -->
+                    <GroupBox Grid.Row="0"
+                              Header="查询条件"
+                              Margin="10,10,10,10"
+                              Grid.ColumnSpan="3">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="工单号:"
+                                       VerticalAlignment="Center"
+                                       Margin="5,0" />
+                            <TextBox x:Name="txtSearchWorkOrder"
+                                     Width="150"
+                                     Margin="5,0"
+                                     Text="{Binding SearchWorkOrder}" />
+                            <Button x:Name="btnSearchSns"
+                                    Content="查询"
+                                    Width="80"
+                                    Margin="10,0,0,0"
+                                    Command="{Binding SearchSnsCommand}" />
+                        </StackPanel>
+                    </GroupBox>
+
+                    <!-- SN列表 -->
+                    <DataGrid x:Name="dgSns"
+                              Grid.Row="1"
+                              ItemsSource="{Binding DgSns}"
+                              SelectedItem="{Binding SelectSnInfo}"
+                              Margin="10,0,10,10"
+                              Grid.ColumnSpan="3">
+                        <DataGrid.Columns>
+                            <DataGridTextColumn Header="SN条码"
+                                                Binding="{Binding Sn}"
+                                                Width="200" />
+                            <DataGridTextColumn Header="工单号"
+                                                Binding="{Binding WorkOrderNo}"
+                                                Width="120" />
+                            <DataGridTextColumn Header="类型"
+                                                Binding="{Binding PrintType}"
+                                                Width="80" />
+                            <DataGridTextColumn Header="生成时间"
+                                                Binding="{Binding GenerateTime, StringFormat=yyyy-MM-dd HH:mm:ss}"
+                                                Width="140" />
+                            <DataGridCheckBoxColumn Header="已使用"
+                                                    Binding="{Binding IsUsed}"
+                                                    Width="70" />
+                        </DataGrid.Columns>
+                    </DataGrid>
+                </Grid>
+            </TabItem>
+
+            <TabItem Header="关键件管理">
+                <Grid Margin="10">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="*" />
+                        <RowDefinition Height="Auto" />
+                    </Grid.RowDefinitions>
+
+                    <!-- 标题 -->
+                    <TextBlock Grid.Row="0"
+                               Text="关键件信息"
+                               FontSize="20"
+                               FontWeight="Bold"
+                               HorizontalAlignment="Center"
+                               Margin="0,0,0,15" />
+
+                    <!-- 添加区域 -->
+                    <Border Grid.Row="1"
+                            BorderBrush="#CCCCCC"
+                            BorderThickness="1"
+                            CornerRadius="5"
+                            Padding="10"
+                            Margin="0,0,0,40"
+                            Background="#F5F5F5">
+                        <Grid>
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="Auto" />
+                                <ColumnDefinition Width="*" />
+                                <ColumnDefinition Width="Auto" />
+                                <ColumnDefinition Width="*" />
+                                <ColumnDefinition Width="Auto" />
+                                <ColumnDefinition Width="80" />
+                            </Grid.ColumnDefinitions>
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="Auto" />
+                                <RowDefinition Height="Auto" />
+                            </Grid.RowDefinitions>
+
+                            <!-- 第一行 -->
+                            <Label Grid.Row="0"
+                                   Grid.Column="0">工位类型:</Label>
+                            <ComboBox Grid.Row="0"
+                                      Grid.Column="1"
+                                      ItemsSource="{Binding Source={ enums:EnumBindingSource {x:Type enums:StationType}}}"
+                                      SelectedItem="{Binding NewPart.FormulaType}" />
+
+                            <Label Grid.Row="0"
+                                   Grid.Column="2">关键件条码:</Label>
+                            <TextBox Grid.Row="0"
+                                     Grid.Column="3"
+                                     Text="{Binding NewPart.PartNum, UpdateSourceTrigger=PropertyChanged}" />
+
+                            <Label Grid.Row="0"
+                                   Grid.Column="4">数量:</Label>
+                            <TextBox Grid.Row="0"
+                                     Grid.Column="5"
+                                     Text="{Binding NewPart.PartQty, UpdateSourceTrigger=PropertyChanged}" />
+
+                            <!-- 第二行 -->
+                            <Label Grid.Row="1"
+                                   Grid.Column="0">物料名称:</Label>
+                            <TextBox Grid.Row="1"
+                                     Grid.Column="1"
+                                     Text="{Binding NewPart.MaterialCode, UpdateSourceTrigger=PropertyChanged}" />
+
+                            <Label Grid.Row="1"
+                                   Grid.Column="2">原条码:</Label>
+                            <TextBox Grid.Row="1"
+                                     Grid.Column="3"
+                                     Text="{Binding NewPart.OldPartNum, UpdateSourceTrigger=PropertyChanged}" />
+
+                            <Label Grid.Row="1"
+                                   Grid.Column="4">位置序号:</Label>
+                            <TextBox Grid.Row="1"
+                                     Grid.Column="5"
+                                     Text="{Binding NewPart.PositionNo, UpdateSourceTrigger=PropertyChanged}" />
+                        </Grid>
+                    </Border>
+
+                    <!-- 按钮区域 -->
+                    <StackPanel Grid.Row="1"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Right"
+                                Margin="0,0,0,0"
+                                VerticalAlignment="Bottom">
+                        <Button Content="添加"
+                                Command="{Binding AddPartInfoCommand}"
+                                Background="#4CAF50"
+                                Foreground="White" />
+                        <Button Content="刷新"
+                                Command="{Binding RefPartInfoCommand}"
+                                Background="#FF9800"
+                                Foreground="White" />
+                        <Button Content="删除"
+                                Command="{Binding DeletePartInfoCommand}"
+                                Background="#F44336"
+                                Foreground="White" />
+                    </StackPanel>
+
+                    <!-- 数据列表 -->
+                    <DataGrid Grid.Row="2"
+                              ItemsSource="{Binding PartInfos}"
+                              SelectedItem="{Binding SelectPart}"
+                              SelectionMode="Single"
+                              AutoGenerateColumns="False"
+                              CanUserAddRows="False"
+                              IsReadOnly="True"
+                              GridLinesVisibility="None"
+                              RowDetailsVisibilityMode="Collapsed"
+                              HeadersVisibility="Column"
+                              Margin="0,10,0,10">
+
+                        <DataGrid.Resources>
+                            <Style TargetType="DataGridRow">
+                                <Style.Triggers>
+                                    <Trigger Property="IsSelected"
+                                             Value="True">
+                                        <Setter Property="Background"
+                                                Value="#E3F2FD" />
+                                        <Setter Property="BorderBrush"
+                                                Value="#2196F3" />
+                                    </Trigger>
+                                </Style.Triggers>
+                            </Style>
+
+                            <Style TargetType="DataGridColumnHeader">
+                                <Setter Property="Background"
+                                        Value="#2196F3" />
+                                <Setter Property="Foreground"
+                                        Value="White" />
+                                <Setter Property="FontWeight"
+                                        Value="Bold" />
+                                <Setter Property="Padding"
+                                        Value="10,5" />
+                                <Setter Property="HorizontalContentAlignment"
+                                        Value="Center" />
+                            </Style>
+                        </DataGrid.Resources>
+
+                        <DataGrid.Columns>
+                            <DataGridCheckBoxColumn Binding="{Binding IsSelected}"
+                                                    Header="选择"
+                                                    Width="50" />
+                            <DataGridTextColumn Header="工位类型"
+                                                Binding="{Binding FormulaType}"
+                                                Width="80" />
+                            <DataGridTextColumn Header="关键件条码"
+                                                Binding="{Binding PartNum}"
+                                                Width="120" />
+                            <DataGridTextColumn Header="数量"
+                                                Binding="{Binding PartQty}"
+                                                Width="60">
+                                <DataGridTextColumn.ElementStyle>
+                                    <Style TargetType="TextBlock">
+                                        <Setter Property="HorizontalAlignment"
+                                                Value="Right" />
+                                        <Setter Property="Margin"
+                                                Value="0,0,10,0" />
+                                    </Style>
+                                </DataGridTextColumn.ElementStyle>
+                            </DataGridTextColumn>
+                            <DataGridTextColumn Header="物料代码"
+                                                Binding="{Binding MaterialCode}"
+                                                Width="100" />
+                            <DataGridTextColumn Header="关键件类型"
+                                                Binding="{Binding MaterialType}"
+                                                Width="80" />
+                            <DataGridTextColumn Header="原关键件条码"
+                                                Binding="{Binding OldPartNum}"
+                                                Width="120" />
+                            <DataGridTextColumn Header="位置序号"
+                                                Binding="{Binding PositionNo}"
+                                                Width="80" />
+                            <DataGridTemplateColumn Header="操作"
+                                                    Width="100">
+                                <DataGridTemplateColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <Button Content="删除"
+                                                Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
+                                                CommandParameter="{Binding}"
+                                                Background="#F44336"
+                                                Foreground="White"
+                                                Padding="5,2"
+                                                Margin="2,0" />
+                                    </DataTemplate>
+                                </DataGridTemplateColumn.CellTemplate>
+                            </DataGridTemplateColumn>
+                        </DataGrid.Columns>
+                    </DataGrid>
+
+                    <!-- 状态栏 -->
+                    <StatusBar Grid.Row="3"
+                               Background="#F5F5F5">
+                        <StatusBarItem>
+                            <TextBlock>
+                    <Run Text="记录总数:" />
+                    <Run Text="{Binding PartInfos.Count, Mode=OneWay}" />
+                            </TextBlock>
+                        </StatusBarItem>
+                        <StatusBarItem HorizontalAlignment="Right">
+                            <TextBlock Text="{Binding StatusMessage}" />
+                        </StatusBarItem>
+                    </StatusBar>
+                </Grid>
+            </TabItem>
+            <TabItem Header="零件管理">
+                <Grid Margin="10">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto"/>
+                        <RowDefinition Height="Auto"/>
+                        <RowDefinition Height="*"/>
+                    </Grid.RowDefinitions>
+
+                    <!-- 标题 -->
+                    <TextBlock Grid.Row="0" Text="零件管理" FontSize="20" FontWeight="Bold" 
+                   HorizontalAlignment="Center" Margin="0,0,0,20"/>
+
+                    <!-- 数据输入表单 -->
+                    <GroupBox Grid.Row="1" Header="添加/编辑零件信息" Margin="0,0,0,10">
+                        <Grid Margin="10">
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="Auto"/>
+                                <ColumnDefinition Width="*"/>
+                                <ColumnDefinition Width="Auto"/>
+                                <ColumnDefinition Width="*"/>
+                            </Grid.ColumnDefinitions>
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="Auto"/>
+                                <RowDefinition Height="Auto"/>
+                                <RowDefinition Height="Auto"/>
+                                <RowDefinition Height="Auto"/>
+                                <RowDefinition Height="Auto"/>
+                                <RowDefinition Height="Auto"/>
+                                <RowDefinition Height="Auto"/>
+                                <RowDefinition Height="Auto"/>
+                            </Grid.RowDefinitions>
+
+                            <!-- 第一列 -->
+
+
+                            <TextBlock Grid.Row="0" Grid.Column="0" Text="站点名称:" VerticalAlignment="Center" Margin="5"/>
+                            <ComboBox Grid.Row="0"
+                                      Grid.Column="1"
+                                      ItemsSource="{Binding Source={ enums:EnumBindingSource {x:Type enums:StationType}}}"
+                                      SelectedItem="{Binding CurrentParkingLot.FormulaType}"  Margin="5" Width="200"/>
+
+
+                            <TextBlock Grid.Row="1" Grid.Column="0" Text="序号:" VerticalAlignment="Center" Margin="5"/>
+                            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CurrentParkingLot.SerialNumber, UpdateSourceTrigger=PropertyChanged}" 
+                         Margin="5" Width="200"/>
+
+                            <TextBlock Grid.Row="2" Grid.Column="0" Text="零件号:" VerticalAlignment="Center" Margin="5"/>
+                            <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CurrentParkingLot.PartNumber, UpdateSourceTrigger=PropertyChanged}" 
+                         Margin="5" Width="200"/>
+
+                            <TextBlock Grid.Row="3" Grid.Column="0" Text="零件名称:" VerticalAlignment="Center" Margin="5"/>
+                            <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CurrentParkingLot.PartName, UpdateSourceTrigger=PropertyChanged}" 
+                         Margin="5" Width="200"/>
+
+                            <!-- 第二列 -->
+                            <TextBlock Grid.Row="0" Grid.Column="2" Text="计划数量:" VerticalAlignment="Center" Margin="5,5,5,5"/>
+                            <TextBox Grid.Row="0" Grid.Column="3" Text="{Binding CurrentParkingLot.PlanNum, UpdateSourceTrigger=PropertyChanged}" 
+                         Margin="5" Width="200"/>
+
+                            <TextBlock Grid.Row="1" Grid.Column="2" Text="使用数量:" VerticalAlignment="Center" Margin="5"/>
+                            <TextBox Grid.Row="1" Grid.Column="3" Text="{Binding CurrentParkingLot.UseNum, UpdateSourceTrigger=PropertyChanged}" 
+                         Margin="5" Width="200"/>
+
+                            <TextBlock Grid.Row="2" Grid.Column="2" Text="已完成数量:" VerticalAlignment="Center" Margin="5"/>
+                            <TextBox Grid.Row="2" Grid.Column="3" Text="{Binding CurrentParkingLot.CompletedNum, UpdateSourceTrigger=PropertyChanged}" 
+                         Margin="5" Width="200"/>
+
+                            <!-- 按钮 -->
+                            <StackPanel Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" 
+                            Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,20,0,0">
+                                <Button x:Name="btnAdd" Content="添加" Width="80" Height="30" Margin="10" 
+                            Command="{Binding AddCommand}"/>
+                                <Button x:Name="btnUpdate" Content="更新" Width="80" Height="30" Margin="10" 
+                            Command="{Binding UpdateCommand}" 
+                            IsEnabled="{Binding IsEditMode}"/>
+                                <Button x:Name="btnCancel" Content="取消编辑" Width="80" Height="30" Margin="10" 
+                            Command="{Binding CancelEditCommand}"
+                            IsEnabled="{Binding IsEditMode}"/>
+                                <Button x:Name="btnClear" Content="清空表单" Width="80" Height="30" Margin="10" 
+                            Command="{Binding ClearFormCommand}"/>
+                            </StackPanel>
+                        </Grid>
+                    </GroupBox>
+
+                    <!-- 数据列表 -->
+                    <GroupBox Grid.Row="2" Header="零件列表">
+                        <Grid>
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="*"/>
+                                <RowDefinition Height="Auto"/>
+                            </Grid.RowDefinitions>
+
+                            <!-- DataGrid -->
+                            <DataGrid x:Name="dataGrid" Grid.Row="0" AutoGenerateColumns="False" 
+                          ItemsSource="{Binding ParkingLots}" 
+                          SelectedItem="{Binding SelectedParkingLot, Mode=TwoWay}"
+                          CanUserAddRows="False" CanUserDeleteRows="False"
+                          SelectionMode="Single" SelectionUnit="FullRow"
+                          Margin="5" IsReadOnly="True">
+                                <DataGrid.Columns>
+                                    <DataGridTextColumn Header="站点名称" Binding="{Binding FormulaType}" Width="120"/>
+                                    <DataGridTextColumn Header="序号" Binding="{Binding SerialNumber}" Width="80"/>
+                                    <DataGridTextColumn Header="零件号" Binding="{Binding PartNumber}" Width="120"/>
+                                    <DataGridTextColumn Header="零件名称" Binding="{Binding PartName}" Width="150"/>
+                                    <DataGridTextColumn Header="计划数量" Binding="{Binding PlanNum}" Width="80"/>
+                                    <DataGridTextColumn Header="使用数量" Binding="{Binding UseNum}" Width="80"/>
+                                    <DataGridTextColumn Header="已完成数量" Binding="{Binding CompletedNum}" Width="100"/>
+                                    <DataGridTemplateColumn Header="操作" Width="200">
+                                        <DataGridTemplateColumn.CellTemplate>
+                                            <DataTemplate>
+                                                <StackPanel Orientation="Horizontal">
+                                                    <Button Content="编辑" Width="50" Margin="2" 
+                                                Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
+                                                CommandParameter="{Binding}"/>
+                                                    <Button Content="删除" Width="50" Margin="2" 
+                                                Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
+                                                CommandParameter="{Binding}"/>
+                                                </StackPanel>
+                                            </DataTemplate>
+                                        </DataGridTemplateColumn.CellTemplate>
+                                    </DataGridTemplateColumn>
+                                </DataGrid.Columns>
+                            </DataGrid>
+
+                            <!-- 统计信息 -->
+                            <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
+                                <TextBlock Text="总计:" FontWeight="Bold" Margin="5"/>
+                                <TextBlock Text="{Binding ParkingLots.Count}" Foreground="Blue" Margin="5"/>
+                                <TextBlock Text="条记录" Margin="5"/>
+                            </StackPanel>
+                        </Grid>
+                    </GroupBox>
+                </Grid>
+            </TabItem>
+            <!-- Tab 4: 绑定记录 -->
+            <TabItem Header="绑定记录">
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="*" />
+                    </Grid.RowDefinitions>
+
+                    <!-- 工具栏 -->
+                    <StackPanel Grid.Row="0"
+                                Orientation="Horizontal"
+                                Margin="10">
+                        <Button x:Name="btnRefreshBindRecords"
+                                Content="刷新"
+                                Width="80"
+                                Command="{Binding RefreshBindRecordsCommand}" />
+                        <Button x:Name="btnClearBindRecords"
+                                Content="清空"
+                                Width="80"
+                                Margin="10,0,0,0"
+                                Command="{Binding ClearBindRecordsCommand}" />
+                    </StackPanel>
+
+                    <!-- 绑定记录列表 -->
+                    <DataGrid x:Name="dgBindRecords"
+                              Grid.Row="1"
+                              ItemsSource="{Binding DgBindRecords}"
+                              SelectedItem="{Binding SelectBindRecord}"
+                              Margin="10,0,10,10">
+                        <DataGrid.Columns>
+                            <DataGridTextColumn Header="SN"
+                                                Binding="{Binding Sn}"
+                                                Width="150" />
+                            <DataGridTextColumn Header="关键件条码"
+                                                Binding="{Binding PartNum}"
+                                                Width="150" />
+                            <DataGridTextColumn Header="工位"
+                                                Binding="{Binding StationCode}"
+                                                Width="100" />
+                            <DataGridTextColumn Header="绑定类型"
+                                                Binding="{Binding ScanType}"
+                                                Width="80">
+                                <DataGridTextColumn.ElementStyle>
+                                    <Style TargetType="TextBlock">
+                                        <Setter Property="HorizontalAlignment"
+                                                Value="Center" />
+                                    </Style>
+                                </DataGridTextColumn.ElementStyle>
+                            </DataGridTextColumn>
+                            <DataGridTextColumn Header="操作员"
+                                                Binding="{Binding Employee}"
+                                                Width="100" />
+                            <DataGridTextColumn Header="绑定时间"
+                                                Binding="{Binding BindTime, StringFormat=yyyy-MM-dd HH:mm:ss}"
+                                                Width="140" />
+                        </DataGrid.Columns>
+                    </DataGrid>
+                </Grid>
+            </TabItem>
+
+            <!-- Tab 5: 加工记录 -->
+            <TabItem Header="加工记录">
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="*" />
+                    </Grid.RowDefinitions>
+
+                    <!-- 工具栏 -->
+                    <StackPanel Grid.Row="0"
+                                Orientation="Horizontal"
+                                Margin="10">
+                        <Button x:Name="btnRefreshProcessRecords"
+                                Content="刷新"
+                                Width="80"
+                                Command="{Binding RefreshProcessRecordsCommand}" />
+                        <Button x:Name="btnClearProcessRecords"
+                                Content="清空"
+                                Width="80"
+                                Margin="10,0,0,0"
+                                Command="{Binding ClearProcessRecordsCommand}" />
+                    </StackPanel>
+
+                    <!-- 加工记录列表 -->
+                    <DataGrid x:Name="dgProcessRecords"
+                              Grid.Row="1"
+                              ItemsSource="{Binding DgProcessRecords}"
+                              SelectedItem="{Binding SelectProcessRecord}"
+                              Margin="10,0,10,10">
+                        <DataGrid.Columns>
+                            <DataGridTextColumn Header="SN"
+                                                Binding="{Binding Sn}"
+                                                Width="150" />
+                            <DataGridTextColumn Header="工位"
+                                                Binding="{Binding Station}"
+                                                Width="100" />
+                            <DataGridTextColumn Header="结果"
+                                                Binding="{Binding OverallResult}"
+                                                Width="60">
+                                <DataGridTextColumn.ElementStyle>
+                                    <Style TargetType="TextBlock">
+                                        <Setter Property="HorizontalAlignment"
+                                                Value="Center" />
+                                        <Setter Property="Foreground"
+                                                Value="{Binding OverallResult, Converter={StaticResource ResultColorConverter}}" />
+                                    </Style>
+                                </DataGridTextColumn.ElementStyle>
+                            </DataGridTextColumn>
+                            <DataGridTextColumn Header="设备"
+                                                Binding="{Binding Equipment}"
+                                                Width="120" />
+                            <DataGridTextColumn Header="加工时间"
+                                                Binding="{Binding ProcessTime, StringFormat=yyyy-MM-dd HH:mm:ss}"
+                                                Width="140" />
+                        </DataGrid.Columns>
+                    </DataGrid>
+                </Grid>
+            </TabItem>
+
+            <!-- Tab 6: 系统设置 -->
+            <TabItem Header="系统设置">
+                <Grid Margin="10">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="*" />
+                    </Grid.RowDefinitions>
+
+                    <!-- Web API设置 -->
+                    <GroupBox Grid.Row="0"
+                              Header="Web API服务设置">
+                        <StackPanel>
+                            <StackPanel Orientation="Horizontal"
+                                        Margin="0,5">
+                                <TextBlock Text="服务端口:"
+                                           Width="80"
+                                           VerticalAlignment="Center" />
+                                <TextBox x:Name="txtPort"
+                                         Width="100"
+                                         Text="{Binding ServerPort}" />
+                                <Button x:Name="btnStartService"
+                                        Content="启动服务"
+                                        Width="80"
+                                        IsEnabled="{Binding StartServiceEnable}"
+                                        Margin="10,0,0,0"
+                                        Command="{Binding StartServiceCommand}" />
+                                <Button x:Name="btnStopService"
+                                        Content="停止服务"
+                                        Width="80"
+                                        IsEnabled="{Binding StopServiceEnable}"
+                                        Margin="5,0,0,0"
+                                        Command="{Binding StopServiceCommand}" />
+                                <StackPanel Margin="200,0,0,0" Orientation="Horizontal">
+
+                                    <CheckBox Content="屏蔽远程MES" 
+                                            Width="110" 
+                                            IsEnabled="{Binding StopServiceEnable}" 
+                                            Margin="5,0,0,0" 
+                                            IsChecked="{Binding Management.IsLocalhostMode}"/>
+
+                                    <!--<Button Content="停止服务" 
+                                               Width="80" 
+                                                  IsEnabled="{Binding StopServiceEnable}" 
+                                                  Margin="5,0,0,0" 
+                                                  Command="{Binding StopServiceCommand}"/>-->
+
+                                </StackPanel>
+                            </StackPanel>
+                            <TextBlock x:Name="txtServiceStatus"
+                                       Foreground="{Binding  Servicebrushes}"
+                                       Text="{Binding ServiceStatus}"
+                                       Margin="0,5" />
+                        </StackPanel>
+                    </GroupBox>
+
+                    <!-- API客户端设置 -->
+                    <GroupBox Grid.Row="1"
+                              Header="API客户端设置"
+                              Margin="0,10,0,0">
+                        <StackPanel>
+                            <StackPanel Orientation="Horizontal"
+                                        Margin="0,5">
+                                <TextBlock Text="API地址:"
+                                           Width="80"
+                                           VerticalAlignment="Center" />
+                                <TextBox x:Name="txtApiUrl"
+                                         Width="300"
+                                         Text="{Binding ApiUrl}" />
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal"
+                                        Margin="0,5">
+                                <TextBlock Text="App Key:"
+                                           Width="80"
+                                           VerticalAlignment="Center" />
+                                <TextBox x:Name="txtAppKey"
+                                         Width="200"
+                                         Text="{Binding AppKey}" />
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal"
+                                        Margin="0,5">
+                                <TextBlock Text="Token:"
+                                           Width="80"
+                                           VerticalAlignment="Center" />
+                                <TextBox x:Name="txtToken"
+                                         Width="200"
+                                         Text="{Binding Token}" />
+                            </StackPanel>
+                            <Button x:Name="btnSaveSettings"
+                                    Content="保存设置"
+                                    Width="80"
+                                    Margin="0,10,0,0"
+                                    Command="{Binding SaveSettingsCommand}" />
+                        </StackPanel>
+                    </GroupBox>
+
+                    <!-- 接口地址 -->
+                    <GroupBox Grid.Row="2"
+                              Header="接口地址"
+                              Margin="0,10,0,0">
+                        <StackPanel>
+                            <TextBlock Text="1. 工单下发接口: /api/mes/receiveWorkOrder"
+                                       Margin="0,2" />
+                            <TextBlock Text="2. SN打印请求接口: /api/mes/requestSnPrint"
+                                       Margin="0,2" />
+                            <TextBlock Text="3. SN关键件绑定接口: /api/mes/receiveSnComponent"
+                                       Margin="0,2" />
+                            <TextBlock Text="4. 加工参数上报接口: /api/mes/receiveProcessParameters"
+                                       Margin="0,2" />
+                        </StackPanel>
+                    </GroupBox>
+
+                    <!-- 工单状态说明 -->
+                    <GroupBox Grid.Row="3"
+                              Header="工单状态说明"
+                              Margin="0,10,0,0">
+                        <StackPanel>
+                            <TextBlock Text="0:已创建、1:已排产、2:已发布、3:关闭、4:已锁定、5:已开工、6:已完成、7:异常完工"
+                                       Margin="0,2" />
+                            <TextBlock Text="冻结状态: 0:否、1:是"
+                                       Margin="0,2" />
+                            <TextBlock Text="下发状态: 0:未下发、1:已下发"
+                                       Margin="0,2" />
+                        </StackPanel>
+                    </GroupBox>
+                </Grid>
+            </TabItem>
+        </TabControl>
+    </Grid>
+</Window>

+ 271 - 0
LocalhostMES/Views/MainView.xaml.cs

@@ -0,0 +1,271 @@
+using LocalhostMES.Controller;
+using LocalhostMES.Core;
+using LocalhostMES.DataBase;
+using LocalhostMES.Models;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Unity;
+
+namespace LocalhostMES.Views
+{
+    /// <summary>
+    /// MainView.xaml 的交互逻辑
+    /// </summary>
+    public partial class MainView : Window
+    {
+        private TrayIconManager trayIconManager;
+        public MainView()
+        {
+            InitializeComponent();
+            
+            // 设置窗体不可见
+            this.WindowState = WindowState.Minimized;
+            this.ShowInTaskbar = false;
+            this.Visibility = Visibility.Hidden;
+            InitializeManagers();
+        }
+
+        private void InitializeManagers()
+        {
+            try
+            {
+
+
+                // 初始化托盘图标
+                trayIconManager = new TrayIconManager();
+                trayIconManager.OnExit += OnExit;
+                trayIconManager.OnSettings += OnSettings;
+                trayIconManager.Show();
+            }
+            catch ( Exception ex )
+            {
+                LogHelper.WriteLogError("启动托盘失败", ex);
+
+            }
+        }
+
+        private void OnSettings(object sender, EventArgs e)
+        {
+            this.WindowState = WindowState.Normal;
+            this.Show();
+        }
+
+        private void OnExit(object sender, EventArgs e)
+        {
+            trayIconManager?.Dispose();
+            this.Close();
+        }
+        #region Tab 1: 接口测试
+        //private async void BtnTestWorkOrder_Click(object sender, RoutedEventArgs e)
+        //{
+        //    try
+        //    {
+                
+
+        //        AddLog("=== 测试工单下发接口 ===");
+
+        //        var request = new WorkOrderRequest
+        //        {
+        //            WorkOrderNo = "TEST-" + DateTime.Now.ToString("yyyyMMddHHmmss"),
+        //            MaterialCode = "T03GCD",
+        //            MaterialName = "T03贯穿灯",
+        //            OrderNo = "ORD-" + DateTime.Now.ToString("yyyyMMdd"),
+        //            SequenceNo = "001",
+        //            WorkOrderNum = "100",
+        //            PlanOnlineTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+        //            PlanOfflineTime = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss"),
+        //            Status = "2", // 已发布
+        //            FrozenStatus = "0",
+        //            ReleaseStatus = "1",
+        //            LineCode = "RSC01"
+        //        };
+
+        //        AddLog("请求参数:");
+        //        AddLog(JsonConvert.SerializeObject(request, Formatting.Indented));
+
+        //        var response = await _apiClient.SendWorkOrderAsync(request);
+
+        //        AddLog("响应结果:");
+        //        AddLog(JsonConvert.SerializeObject(response, Formatting.Indented));
+
+        //        ShowMessage("工单下发测试完成", false);
+        //    }
+        //    catch ( Exception ex )
+        //    {
+        //        AddLog($"错误: {ex.Message}");
+        //        ShowMessage($"测试失败: {ex.Message}", true);
+        //    }
+        //}
+        #endregion
+    }
+
+    // 工单对话框
+    public partial class WorkOrderDialog : Window
+    {
+        public WorkOrderInfo WorkOrder { get; private set; }
+
+        public WorkOrderDialog()
+        {
+            InitializeComponent();
+            WorkOrder = new WorkOrderInfo
+            {
+                WorkOrderNo = "WO-" + DateTime.Now.ToString("yyyyMMddHHmmss"),
+                Status = "2",
+                LineCode = "RSC01",
+                CreateTime = DateTime.Now,
+                PlannedQuantity = 100,
+                 StartTime=DateTime.Now,
+                 EndTime=DateTime.Now
+            };
+            DataContext = WorkOrder;
+        }
+
+        private void InitializeComponent()
+        {
+            if (WorkOrder == null) 
+            {
+                WorkOrder = new WorkOrderInfo();
+            }
+            Width = 400;
+            Height = 450;
+            WindowStartupLocation = WindowStartupLocation.CenterOwner;
+            Title = "创建新工单";
+
+            var grid = new Grid();
+            grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.ColumnDefinitions.Add(new ColumnDefinition());
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+            grid.RowDefinitions.Add(new RowDefinition());
+
+            // 添加控件
+            int row = 0;
+            AddLabeledTextBox(grid, "工单号:", nameof(WorkOrder.WorkOrderNo), row++);
+            AddLabeledTextBox(grid, "物料编码:", nameof(WorkOrder.MaterialCode), row++);
+            AddLabeledTextBox(grid, "物料名称:", nameof(WorkOrder.MaterialName), row++);
+            AddLabeledTextBox(grid, "计划数量:", nameof(WorkOrder.PlannedQuantity), row++);
+            AddLabeledTextBox(grid, "线体编码:", nameof(WorkOrder.LineCode), row++);
+
+            // 工单状态选择
+            var statusLabel = new Label { Content = "工单状态:" };
+            Grid.SetRow(statusLabel, row);
+            Grid.SetColumn(statusLabel, 0);
+
+            var statusComboBox = new ComboBox
+            {
+                ItemsSource = new[]
+                {
+                    new { Value = "0", Display = "已创建" },
+                    new { Value = "1", Display = "已排产" },
+                    new { Value = "2", Display = "已发布" },
+                    new { Value = "3", Display = "关闭" },
+                    new { Value = "4", Display = "已锁定" },
+                    new { Value = "5", Display = "已开工" },
+                    new { Value = "6", Display = "已完成" },
+                    new { Value = "7", Display = "异常完工" }
+                },
+                DisplayMemberPath = "Display",
+                SelectedValuePath = "Value",
+                SelectedValue = WorkOrder.Status
+            };
+            statusComboBox.SetBinding(ComboBox.SelectedValueProperty, "Status");
+
+            Grid.SetRow(statusComboBox, row);
+            Grid.SetColumn(statusComboBox, 1);
+            grid.Children.Add(statusLabel);
+            grid.Children.Add(statusComboBox);
+            row++;
+
+            // 按钮
+            var buttonPanel = new StackPanel
+            {
+                Orientation = Orientation.Horizontal,
+                HorizontalAlignment = HorizontalAlignment.Right,
+                Margin = new Thickness(0, 20, 0, 0)
+            };
+
+            var okButton = new Button
+            {
+                Content = "确定",
+                Width = 80,
+                Margin = new Thickness(5)
+            };
+            okButton.Click += (s, e) => { DatabaseHelper.InsertWorkOrderInfo(WorkOrder);  DialogResult = true; Close(); };
+
+            var cancelButton = new Button
+            {
+                Content = "取消",
+                Width = 80,
+                Margin = new Thickness(5)
+            };
+            cancelButton.Click += (s, e) => { DialogResult = false; Close(); };
+
+            buttonPanel.Children.Add(okButton);
+            buttonPanel.Children.Add(cancelButton);
+
+            Grid.SetRow(buttonPanel, row);
+            Grid.SetColumnSpan(buttonPanel, 2);
+            grid.Children.Add(buttonPanel);
+
+            Content = grid;
+
+
+        }
+
+        private void AddLabeledTextBox(Grid grid, string label, string bindingPath, int row)
+        {
+            var labelControl = new Label { Content = label };
+            Grid.SetRow(labelControl, row);
+            Grid.SetColumn(labelControl, 0);
+
+            var textBox = new TextBox();
+            textBox.SetBinding(TextBox.TextProperty, bindingPath);
+            Grid.SetRow(textBox, row);
+            Grid.SetColumn(textBox, 1);
+
+            grid.Children.Add(labelControl);
+            grid.Children.Add(textBox);
+        }
+    }
+
+    // 结果颜色转换器
+    public class ResultColorConverter : System.Windows.Data.IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+        {
+            if ( value is string result )
+            {
+                return result == "OK" ? Brushes.Green : Brushes.Red;
+            }
+            return Brushes.Black;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 113 - 0
LocalhostMES/packages.config

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="BouncyCastle.Cryptography" version="2.6.2" targetFramework="net472" />
+  <package id="Google.Protobuf" version="3.32.0" targetFramework="net472" />
+  <package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net472" />
+  <package id="K4os.Compression.LZ4.Streams" version="1.3.8" targetFramework="net472" />
+  <package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
+  <package id="log4net" version="3.1.0" targetFramework="net472" />
+  <package id="Microsoft.AspNet.Cors" version="5.0.0" targetFramework="net472" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net472" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNet.WebApi.Owin" version="5.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore" version="2.3.8" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Authentication.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Authentication.Core" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Authorization" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Authorization.Policy" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Connections.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Diagnostics" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Diagnostics.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.HostFiltering" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Hosting" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Http" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Http.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Http.Extensions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Http.Features" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.HttpOverrides" version="2.1.1" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Mvc.Core" version="2.3.9" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.ResponseCaching.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Routing" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Routing.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Server.IISIntegration" version="2.1.7" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Server.Kestrel" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Server.Kestrel.Core" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.AspNetCore.WebUtilities" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.DotNet.PlatformAbstractions" version="2.1.0" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Configuration" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Configuration.Abstractions" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Configuration.Binder" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Configuration.CommandLine" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Configuration.FileExtensions" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Configuration.Json" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Configuration.UserSecrets" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.DependencyInjection" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.DependencyModel" version="2.1.0" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Diagnostics" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Diagnostics.Abstractions" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.FileProviders.Abstractions" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.FileProviders.Physical" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.FileSystemGlobbing" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Hosting.Abstractions" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Logging" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Logging.Abstractions" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Logging.Configuration" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Logging.Console" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Logging.Debug" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Logging.EventLog" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Logging.EventSource" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.ObjectPool" version="8.0.11" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Options" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Options.ConfigurationExtensions" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Extensions.Primitives" version="10.0.1" targetFramework="net472" />
+  <package id="Microsoft.Net.Http.Headers" version="2.3.0" targetFramework="net472" />
+  <package id="Microsoft.Owin" version="4.2.3" targetFramework="net472" />
+  <package id="Microsoft.Owin.Cors" version="4.2.3" targetFramework="net472" />
+  <package id="Microsoft.Owin.Host.HttpListener" version="4.2.2" targetFramework="net472" />
+  <package id="Microsoft.Owin.Hosting" version="4.2.3" targetFramework="net472" />
+  <package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.31" targetFramework="net472" />
+  <package id="MySql.Data" version="9.5.0" targetFramework="net472" />
+  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
+  <package id="Newtonsoft.Json.Bson" version="1.0.2" targetFramework="net472" />
+  <package id="Owin" version="1.0" targetFramework="net472" />
+  <package id="Prism.Core" version="8.1.97" targetFramework="net472" />
+  <package id="Prism.Unity" version="8.1.97" targetFramework="net472" />
+  <package id="Prism.Wpf" version="8.1.97" targetFramework="net472" />
+  <package id="SqlSugar" version="5.1.4.207" targetFramework="net472" />
+  <package id="System.Buffers" version="4.6.1" targetFramework="net472" />
+  <package id="System.Collections.Immutable" version="8.0.0" targetFramework="net472" />
+  <package id="System.Configuration.ConfigurationManager" version="8.0.0" targetFramework="net472" />
+  <package id="System.Diagnostics.DiagnosticSource" version="10.0.1" targetFramework="net472" />
+  <package id="System.IO" version="4.3.0" targetFramework="net472" />
+  <package id="System.IO.Pipelines" version="10.0.1" targetFramework="net472" />
+  <package id="System.Memory" version="4.6.3" targetFramework="net472" />
+  <package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net472" />
+  <package id="System.Reflection.Metadata" version="8.0.1" targetFramework="net472" />
+  <package id="System.Runtime" version="4.3.0" targetFramework="net472" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net472" />
+  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0" targetFramework="net472" />
+  <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net472" />
+  <package id="System.Security.Cryptography.Cng" version="5.0.0" targetFramework="net472" />
+  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" />
+  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
+  <package id="System.Security.Principal.Windows" version="4.5.1" targetFramework="net472" />
+  <package id="System.Text.Encodings.Web" version="10.0.1" targetFramework="net472" />
+  <package id="System.Text.Json" version="10.0.1" targetFramework="net472" />
+  <package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net472" />
+  <package id="System.ValueTuple" version="4.6.1" targetFramework="net472" />
+  <package id="Unity" version="5.11.1" targetFramework="net472" />
+  <package id="Unity.Abstractions" version="5.11.7" targetFramework="net472" />
+  <package id="Unity.Container" version="5.11.11" targetFramework="net472" />
+  <package id="Unity.WebAPI" version="5.4.0" targetFramework="net472" />
+  <package id="ZstdSharp.Port" version="0.8.6" targetFramework="net472" />
+</packages>