This commit is contained in:
XingCheng3
2026-05-26 09:41:24 +08:00
commit dff0156cdd
1329 changed files with 88153 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--配置信号表的模板表路径-->
<add key="BasicDataTableFile" value="SIGNAL_MODEL.xlsx" />
<!--变量模拟测试开关1为开启-->
<add key="IsDemoMesServer" value="0" />
<!--是启用写监控报错日志-->
<add key="IsWriteMonitorLog" value="1" />
<!--是启用保存监控变量到数据库-->
<add key="IsRecordTagStatus" value="1" />
<!--数据库连接-->
<add key="ConnectionString_MES" value="server=172.16.1.5;User ID=sa;Password=126.com;database=AMES_PDC;Connection Reset=FALSE" />
<!--MQTT参数配置-->
<add key="MqttUrl" value="127.0.0.1:1883,WEB/InstantMessaging/CATL_PDC/MisServer" />
<add key="TopicList" value="PLC/InstantMessaging/CATL_PDC/+,PLC|WEB/InstantMessaging/CATL_PDC/MisServer,WEB" />
<add key="MqttTargetTopic" value="MES/InstantMessaging/CATL_PDC" />
<!--REST服务-->
<add key="Url_WebApi" value="http://localhost:9983" />
<!--检测数据上传接口-->
<add key="OnlineCheckDataUrl" value="http://127.0.0.1:9983/OnlineCheckData" />
<!--PrintURL-->
<add key="PrintURL" value="172.16.1.54:9100" />
<add key="PrintTempleName" value="PDC打印模板" />
<!--首检图片上传基本映射地址-->
<!-- 普通 value="Z:\" UNC value="\\cait-mesfile01\pto\PL001N\首件照片\" -->
<add key="ImageShareBasePath" value="\\cait-mesfile01\pto\PL001N\首件照片\" />
<!--UNC 网络共享凭据-->
<add key="ImageShareUser" value="\catlbattery\SHM1-PDC01" />
<add key="ImageSharePassword" value="Sh-myname" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<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>
</assemblyBinding>
</runtime>
</configuration>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,289 @@
<?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>{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>MisDataFun</RootNamespace>
<AssemblyName>MisDataFun</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\MisDataFun_Exe\</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>
<PropertyGroup>
<ApplicationIcon>Mes32X32.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Compile Include="mes_signal_conf\MES_CONF.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="mes_signal_conf\MES_CONF.Designer.cs">
<DependentUpon>MES_CONF.cs</DependentUpon>
</Compile>
<Compile Include="mes_signal_conf\SqlOperation.cs" />
<Compile Include="MisDataFun.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisDataFun.Designer.cs">
<DependentUpon>MisDataFun.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="webApi\Analysis_MOM_Msg.cs" />
<Compile Include="webApi\Controller\WebSendControll.cs" />
<Compile Include="webApi\Controller\ipcControll.cs" />
<Compile Include="webApi\InitServer.cs" />
<Compile Include="webApi\msgResHeader.cs" />
<Compile Include="webApi\OnlineCheckData.cs" />
<Compile Include="webApi\WebSendServer.cs" />
<EmbeddedResource Include="mes_signal_conf\MES_CONF.resx">
<DependentUpon>MES_CONF.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MisDataFun.resx">
<DependentUpon>MisDataFun.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.manifest" />
<None Include="jsconfig1.json" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="BasicData">
<HintPath>..\..\dll_common\BasicData.dll</HintPath>
</Reference>
<Reference Include="BouncyCastle.Crypto">
<HintPath>..\..\dll_common\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="ConLink, Version=7.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_common\ConLink.dll</HintPath>
</Reference>
<Reference Include="ConLink19">
<HintPath>..\..\dll_common\ConLink19.dll</HintPath>
</Reference>
<Reference Include="DataLinkMesWork">
<HintPath>..\..\dll_common\DataLinkMesWork.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.7, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_common\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="MesControl">
<HintPath>..\..\dll_common\MesControl.dll</HintPath>
</Reference>
<Reference Include="MesWork.DeviceDriver">
<HintPath>..\..\dll_common\MesWork.DeviceDriver.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Monitor.MesWork">
<HintPath>..\..\dll_common\Monitor.MesWork.dll</HintPath>
</Reference>
<Reference Include="MQTTnet">
<HintPath>..\..\dll_common\MQTTnet.dll</HintPath>
</Reference>
<Reference Include="MQTTnet.Extensions.ManagedClient">
<HintPath>..\..\dll_common\MQTTnet.Extensions.ManagedClient.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\dll_common\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NPOI, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_common\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_common\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_common\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_common\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Client">
<HintPath>..\..\dll_common\Opc.Ua.Client.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Configuration">
<HintPath>..\..\dll_common\Opc.Ua.Configuration.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Core">
<HintPath>..\..\dll_common\Opc.Ua.Core.dll</HintPath>
</Reference>
<Reference Include="OpcUaHelper">
<HintPath>..\..\dll_common\OpcUaHelper.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="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_common\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_fun\System.Net.Security.dll</HintPath>
</Reference>
<Reference Include="System.Net.WebSockets, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_fun\System.Net.WebSockets.dll</HintPath>
</Reference>
<Reference Include="System.Net.WebSockets.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_fun\System.Net.WebSockets.Client.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_fun\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_fun\System.Security.Cryptography.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_fun\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll_fun\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Web.Cors">
<HintPath>..\..\dll_common\System.Web.Cors.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http">
<HintPath>..\..\dll_common\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Cors">
<HintPath>..\..\dll_common\System.Web.Http.Cors.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.SelfHost">
<HintPath>..\..\dll_common\System.Web.Http.SelfHost.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\09MesDataFunction\MesDataFunction\01-MesDataFunction.csproj">
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
<Name>01-MesDataFunction</Name>
</ProjectReference>
<ProjectReference Include="..\..\Common\MyLog4Net\00_MyLog4Net.csproj">
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
<Name>00_MyLog4Net</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1051\Function1051.csproj">
<Project>{b5a0baa3-c1a7-4aab-9486-2e650adaca7e}</Project>
<Name>Function1051</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1052\Function1052.csproj">
<Project>{5fee5c91-8419-49ff-b2c2-47476f0b8c68}</Project>
<Name>Function1052</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1053\Function1053.csproj">
<Project>{ca8a12c5-7bf0-4489-93fa-180b1c492bba}</Project>
<Name>Function1053</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1054\Function1054.csproj">
<Project>{cc45d613-11b9-48af-b073-6523d6273525}</Project>
<Name>Function1054</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1055\Function1055.csproj">
<Project>{86df6a20-91fc-4b62-aabf-116f933e31aa}</Project>
<Name>Function1055</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1056\Function1056.csproj">
<Project>{191419a0-cceb-4816-bedc-c39abf2981a7}</Project>
<Name>Function1056</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1057\Function1057.csproj">
<Project>{9377bb04-b518-4e77-8b90-e56fe7980204}</Project>
<Name>Function1057</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1058\Function1058.csproj">
<Project>{fc07f99c-0c97-4fef-9a0e-ca4883400464}</Project>
<Name>Function1058</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1059\Function1059.csproj">
<Project>{913ce3c1-7d16-4a19-a9b0-bbcdb6770b4b}</Project>
<Name>Function1059</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1060\Function1060.csproj">
<Project>{d5dc93c7-91dd-4c82-9444-64180f15a9c9}</Project>
<Name>Function1060</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1061\Function1061.csproj">
<Project>{9ace8658-5e01-4323-8a59-d43cffcb47f3}</Project>
<Name>Function1061</Name>
</ProjectReference>
<ProjectReference Include="..\..\MisDataFunction\Function1065\Function1065.csproj">
<Project>{abe98fa8-80eb-40e8-a93a-d70f14eb80dc}</Project>
<Name>Function1065</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Mes32X32.ico" />
<None Include="Resources\连接状态.png" />
<None Include="Resources\断开状态.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,230 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>22, 12</value>
</metadata>
<metadata name="选择.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="工位号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="OpCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="OpName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MesDll.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PLC.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PLC代码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="timer_Status.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>267, 7</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>137, 15</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>36</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQIyAKEgMgChczIA
occyAKHqMgChmTIAoTwyAKEJMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQQyAKEvMgChdzIA
odYyAKH7MgCh/zIAof8yAKH/MgCh6jIAoacyAKFJMgChEjIAoQAyAKEAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChADIAoQoyAKE+MgChkTIA
oeoyAKH+MgCh+TIAoe0yAKH+MgCh/zIAofwyAKH3MgCh/jIAofgyAKHBMgChZDIAoR4yAKEBMgChAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChATIAoRUyAKFcMgChujIA
ofEyAKH/MgCh9DIAobcyAKFPMgChfjIAof8yAKH/MgCh5TIAoVUyAKGLMgCh4jIAofwyAKH9MgCh2TIA
oYcyAKEoMgChBTIAoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChAjIAoSYyAKF2MgCh0DIA
ofcyAKH+MgCh8zIAof8yAKGjMgChDTIAoQAyAKFpMgCh/zIAof8yAKHhMgChHjIAoQIyAKEiMgChbjIA
ocoyAKH3MgCh/jIAoeUyAKGfMgChQTIAoQsyAKEAAAAAAAAAAAAAAAAAMgChCDIAoUEyAKGXMgCh4jIA
of4yAKH/MgChzzIAoW0yAKFoMgCh+zIAoZcyAKEAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChADIA
oQAyAKEBMgChETIAoVAyAKGiMgCh8DIAof8yAKH0MgChuTIAoW0yAKEVMgChADIAoQAyAKG2MgCh7TIA
of8yAKHvMgCh7jIAofgyAKFLMgChADIAoTcyAKH1MgChlzIAoQAyAKEAMgChaTIAof8yAKH/MgCh4TIA
oR4yAKEAAAAAAAAAAAAAAAAAMgChADIAoQcyAKE4MgChijIAod8yAKH9MgCh+zIAoc4yAKFdMgChADIA
of8yAKHlMgChlDIAoToyAKGgMgCh7jIAoSwyAKEAMgChFzIAodgyAKGZMgChADIAoQAyAKFpMgCh/zIA
of8yAKHxMgChfDIAoSkyAKEBMgChAAAAAAAAAAAAAAAAADIAoQAyAKECMgChITIAoW8yAKG/MgCh/zIA
oZYyAKEAMgCh/zIAoZoyAKEBMgChADIAoZkyAKHSMgChEjIAoQAyAKEGMgChujIAoZoyAKEAMgChADIA
oWkyAKH/MgCh/zIAof0yAKH+MgCh4TIAoZIyAKFEMgChDjIAoQAyAKEAAAAAAAAAAAAAAAAAMgChADIA
oUIyAKH7MgChlzIAoQAyAKH/MgChlzIAoQAyAKEAMgChmjIAobMyAKEEMgChADIAoQAyAKGcMgChmzIA
oQAyAKEAMgChaTIAof8yAKH/MgCh4zIAoZYyAKHRMgCh+zIAofQyAKHDMgChZDIAoSIyAKEBMgChAAAA
AAAyAKEAMgChPzIAofsyAKGXMgChADIAof8yAKGXMgChADIAoQAyAKGaMgChiDIAoQAAAAAAMgChADIA
oYgyAKGaMgChADIAoQAyAKFpMgCh/zIAof8yAKHhMgChIDIAoRIyAKFeMgChqzIAoe0yAKH+MgCh3jIA
oYYyAKEqMgChADIAoQAyAKE/MgCh+zIAoZcyAKEAMgCh/zIAoZcyAKEAMgChADIAoZgyAKFtMgChAAAA
AAAyAKEAMgChXDIAoZQyAKEAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChADIAoQAyAKEGMgChMDIA
oX8yAKHTMgCh+jIAoWkyAKEAMgChADIAoT8yAKH7MgChlzIAoQAyAKH/MgChlzIAoQAyAKEAMgChlTIA
oWMyAKEAAAAAADIAoQAyAKE2MgChhTIAoQAyAKEAMgChaTIAof8yAKH/MgCh4TIAoR4yAKEAAAAAAAAA
AAAyAKEAMgChATIAoRUyAKFYMgChQDIAoQAyAKEAMgChPzIAofsyAKGXMgChADIAof8yAKGXMgChADIA
oQAyAKGLMgChQTIAoQAyAKEFMgChADIAoSMyAKF4MgChADIAoQAyAKFpMgCh/zIAof8yAKHhMgChHjIA
oQAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQAyAKEBMgChADIAoQAyAKE/MgCh+zIAoZcyAKEAMgCh/zIA
oZcyAKEAMgChADIAoXcyAKEkMgChBzIAoUIyAKEBMgChFjIAoWUyAKEBMgChADIAoWkyAKH/MgCh/zIA
oeEyAKEeMgChADIAoQAyAKE5MgChSTIAoQ8yAKEBMgChAAAAAAAAAAAAMgChADIAoT8yAKH7MgChlzIA
oQAyAKH/MgChlzIAoQAyAKECMgChWzIAoQ8yAKEVMgChhTIAoQoyAKEHMgChMzIAoQEyAKEAMgChaTIA
of8yAKH/MgCh4TIAoR4yAKEAMgChADIAoWkyAKH1MgChyzIAoX8yAKE4MgChBTIAoQAyAKEAMgChPzIA
ofsyAKGXMgChADIAof8yAKGXMgChADIAoQMyAKFZMgChCzIAoS4yAKHDMgChGjIAoQAAAAAAAAAAADIA
oQAyAKFpMgCh/zIAof8yAKHhMgChHjIAoQAyAKEAMgChLDIAoaEyAKHkMgCh/DIAoe8yAKGrMgChUzIA
oREyAKFBMgCh+zIAoZcyAKEAMgCh/zIAoZcyAKEAMgChBzIAoVAyAKEEMgChQTIAodoyAKEjMgChAAAA
AAAAAAAAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChAAAAAAAyAKEAMgChBjIAoSAyAKFyMgChwjIA
ofMyAKH4MgCh0zIAobMyAKH9MgChljIAoQAyAKH/MgChlzIAoQAyAKEBMgChBDIAoQAyAKFKMgCh7jIA
oT0yAKEAAAAAADIAoQAyAKEAMgChbDIAof8yAKH/MgCh4TIAoR8yAKEAAAAAAAAAAAAAAAAAMgChADIA
oQEyAKELMgChRzIAoZYyAKHeMgCh/TIAof8yAKGWMgChADIAof8yAKGXMgChAAAAAAAAAAAAMgChADIA
oW0yAKH/MgChZDIAoQAyAKEEMgChHDIAoWAyAKHPMgCh/zIAof8yAKH3MgChkTIAoS8yAKELMgChADIA
oQAAAAAAAAAAAAAAAAAyAKEAMgChATIAoSAyAKF2MgCh/zIAoZYyAKEAMgCh/zIAoZcyAKEAAAAAADIA
oQAyAKEAMgChljIAof8yAKGeMgChOTIAoZEyAKHcMgCh+TIAof8yAKH/MgCh/zIAof8yAKH+MgCh6jIA
obgyAKFXMgChITIAoQEyAKEAAAAAAAAAAAAAAAAAMgChADIAoT8yAKH7MgChlzIAoQAyAKH/MgChlzIA
oQAAAAAAMgChADIAoQwyAKG9MgCh/zIAofMyAKHyMgCh/jIAof8yAKH/MgCh/zIAofoyAKH3MgCh/jIA
of8yAKH/MgCh/zIAofsyAKHbMgChmzIAoUwyAKENMgChATIAoQAyAKEAMgChPzIAofsyAKGXMgChADIA
of8yAKGXMgChATIAoRkyAKFbMgChsTIAofAyAKH/MgCh/zIAof8yAKH/MgCh/DIAoeYyAKGxMgChVTIA
oUIyAKGFMgCh1TIAofUyAKH/MgCh/zIAof8yAKH/MgCh9DIAocUyAKGDMgChMDIAoQYyAKE/MgCh+zIA
oZcyAKEAMgCh/zIAocEyAKGOMgCh2TIAofcyAKH/MgCh/zIAof8yAKH/MgCh7jIAobMyAKFwMgChJjIA
oQoyAKEAMgChADIAoQEyAKEXMgChTTIAoZsyAKHYMgCh/TIAof8yAKH/MgCh/zIAof4yAKHqMgChszIA
oZgyAKH+MgChljIAoQAyAKH/MgCh/zIAof8yAKH/MgCh/zIAof8yAKH0MgChyTIAoYEyAKE/MgChBzIA
oQAAAAAAMgChADIAoSIyAKF2MgChQjIAoRIyAKEAMgChATIAoR4yAKFjMgChrjIAoecyAKH9MgCh/zIA
of8yAKH/MgCh/zIAof8yAKGWMgChADIAof8yAKH/MgCh/zIAofkyAKHWMgChmjIAoUIyAKERMgChATIA
oQAyAKEGMgChFTIAoQMyAKEAMgChKDIAoZUyAKHHMgChxjIAoXcyAKE3MgChBzIAoQAyAKEGMgChKTIA
oXYyAKHDMgCh7jIAof4yAKH/MgCh/zIAoZYyAKEAMgChrjIAoeYyAKH+MgCh0zIAoVcyAKELMgChADIA
oQAyAKEAMgChADIAoVUyAKHAMgChkjIAoVYyAKEUMgChATIAoRYyAKFhMgChqzIAodUyAKGmMgChZTIA
oR8yAKEDMgChBDIAoS0yAKGiMgCh9DIAofUyAKHGMgChWTIAoQAyAKEGMgChKjIAoWsyAKHBMgCh3DIA
ocEyAKFwMgChJTIAoQYyAKEAMgChDDIAoTgyAKF/MgChyjIAocMyAKGUMgChMzIAoQsyAKEEMgChJjIA
oWUyAKG/MgCh0TIAoaYyAKGoMgCh1TIAodYyAKGNMgChQTIAoRAyAKEAMgChAAAAAAAyAKEAMgChADIA
oQ8yAKE8MgChkDIAoc8yAKHfMgChpDIAoVIyAKEcMgChADIAoQEyAKETMgChRzIAoZ8yAKHGMgChvzIA
oWQyAKEtMgChMzIAoY8yAKHvMgCh5zIAoa8yAKFcMgChHDIAoQMyAKEAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAADIAoQAyAKECMgChFTIAoVcyAKGaMgCh3DIAodEyAKGaMgChSDIAoQsyAKEAMgChATIA
oSUyAKGGMgCh6TIAofEyAKHhMgChtzIAoXAyAKErMgChBTIAoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQIyAKElMgChXTIAobgyAKHbMgChxTIA
oYUyAKFbMgChqzIAodEyAKHLMgChhDIAoTsyAKELMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChCzIA
oTcyAKGTMgCh0zIAofAyAKG2MgChWjIAoRcyAKEBMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA/+Af//+AB//8AAD/8AAAP8AIAA8AGDABARg+AQEYD4ERGAPxMZgAcTOY
ADEzmDAxM5g8MTKIPzEgCDDxIAgwMSB4MAEgeDgBJHg+ATxAD8E8AAHxOAAAMQAAAAEAAwABABwgAQBE
BAEBwAABAEAAA+AAAA/4AAB//wAD///gD/8=
</value>
</data>
</root>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("MisDataSaveDate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("大连迈思信息技术有限公司")]
[assembly: AssemblyProduct("MisDataSaveDate")]
[assembly: AssemblyCopyright("Copyright © 大连迈思信息技术有限公司 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("9aede061-8490-436a-b38b-9495dc908f19")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

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

View File

@@ -0,0 +1,127 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="断开状态" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\断开状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="连接状态" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\连接状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

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

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@@ -0,0 +1,10 @@
{
"exclude": [
"**/bin",
"**/bower_components",
"**/jspm_packages",
"**/node_modules",
"**/obj",
"**/platforms"
]
}

View File

@@ -0,0 +1,126 @@
namespace MES_SIGNAL_CONF
{
partial class MES_CONF
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btn_ConfigToSql = new System.Windows.Forms.Button();
this.label_ReadExcel = new System.Windows.Forms.Label();
this.label_WriteSql = new System.Windows.Forms.Label();
this.txt_Msg = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btn_OpenExcel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btn_ConfigToSql
//
this.btn_ConfigToSql.Location = new System.Drawing.Point(487, 74);
this.btn_ConfigToSql.Name = "btn_ConfigToSql";
this.btn_ConfigToSql.Size = new System.Drawing.Size(161, 36);
this.btn_ConfigToSql.TabIndex = 0;
this.btn_ConfigToSql.Text = "重新将配置写入数据库";
this.btn_ConfigToSql.UseVisualStyleBackColor = true;
this.btn_ConfigToSql.Click += new System.EventHandler(this.btn_ConfigToSql_Click);
//
// label_ReadExcel
//
this.label_ReadExcel.AutoSize = true;
this.label_ReadExcel.Location = new System.Drawing.Point(12, 16);
this.label_ReadExcel.Name = "label_ReadExcel";
this.label_ReadExcel.Size = new System.Drawing.Size(95, 12);
this.label_ReadExcel.TabIndex = 1;
this.label_ReadExcel.Text = "label_ReadExcel";
//
// label_WriteSql
//
this.label_WriteSql.AutoSize = true;
this.label_WriteSql.Location = new System.Drawing.Point(12, 42);
this.label_WriteSql.Name = "label_WriteSql";
this.label_WriteSql.Size = new System.Drawing.Size(89, 12);
this.label_WriteSql.TabIndex = 1;
this.label_WriteSql.Text = "label_WriteSql";
//
// txt_Msg
//
this.txt_Msg.Location = new System.Drawing.Point(14, 116);
this.txt_Msg.Multiline = true;
this.txt_Msg.Name = "txt_Msg";
this.txt_Msg.Size = new System.Drawing.Size(634, 316);
this.txt_Msg.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 70);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(335, 36);
this.label1.TabIndex = 3;
this.label1.Text = "使用到数据库的表:\r\n读取MES_计划BOM_工位与名称[是否启用MES] = 1\r\n写入MES_基本变量_原始数据、MES_基本变量设备类型对应表";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// btn_OpenExcel
//
this.btn_OpenExcel.Location = new System.Drawing.Point(406, 83);
this.btn_OpenExcel.Name = "btn_OpenExcel";
this.btn_OpenExcel.Size = new System.Drawing.Size(75, 23);
this.btn_OpenExcel.TabIndex = 4;
this.btn_OpenExcel.Text = "打开Excel";
this.btn_OpenExcel.UseVisualStyleBackColor = true;
this.btn_OpenExcel.Click += new System.EventHandler(this.btn_OpenExcel_Click);
//
// MES_CONF
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(660, 437);
this.Controls.Add(this.btn_OpenExcel);
this.Controls.Add(this.label1);
this.Controls.Add(this.txt_Msg);
this.Controls.Add(this.label_WriteSql);
this.Controls.Add(this.label_ReadExcel);
this.Controls.Add(this.btn_ConfigToSql);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "MES_CONF";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MES监控系统信号配置";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btn_ConfigToSql;
private System.Windows.Forms.Label label_ReadExcel;
private System.Windows.Forms.Label label_WriteSql;
private System.Windows.Forms.TextBox txt_Msg;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btn_OpenExcel;
}
}

View File

@@ -0,0 +1,241 @@
using NPOI.SS.Formula.Functions;
using NPOI.SS.UserModel;
using SlMesDbIterface;
using System;
using System.Data;
using System.Linq;
using System.Windows.Forms;
using static System.Configuration.ConfigurationManager;
namespace MES_SIGNAL_CONF
{
public partial class MES_CONF : Form
{
static int tagAid = 0;
public MES_CONF()
{
InitializeComponent();
label_ReadExcel.Text = $"读取位置:{MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile}";
label_WriteSql.Text = $"写入位置:{MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES}";
}
private void btn_ConfigToSql_Click(object sender, EventArgs e)
{
WriteLog("正在操作中...");
LoadOpcData();
WriteLog("");
}
public void WriteLog(string msg)
{
txt_Msg.Text = txt_Msg.Text + $"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}]{msg}\r\n";
}
private void LoadOpcData()
{
DataTable dt_Tag = null;
Select_Station(out DataTable dt_Station);
DataTable dt_Tag_Mes = null;
var dr_Tag_Mes = NPOITest.ExeclHelper.ExcelToDataTable(MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile, "MES_基本变量原始数据", true).Select($"是否启用='1'");
if (dr_Tag_Mes.Length > 0)
{
dt_Tag_Mes = dr_Tag_Mes.CopyToDataTable();
}
var dt_Tag_Model = NPOITest.ExeclHelper.ExcelToDataTable(MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile, "MES_信号表模板", true).Select($"是否启用='1'").CopyToDataTable();
var dt_Tag_Model_DX = NPOITest.ExeclHelper.ExcelToDataTable(MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile, "MES_信号表模板(电芯)", true).Select($"是否启用='1'").CopyToDataTable();
var dt_Device = NPOITest.ExeclHelper.ExcelToDataTable(MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile, "设备类型对应表", true).Select($"是否启用='1'").CopyToDataTable();
dt_Tag = dt_Tag_Model.Clone();
for (int i = 0; i < dt_Station.Rows.Count; i++)
{
//[工位号],[工位名称],[PLC],[工位起始DB号],[PX],[PY],[PX_T],[PY_T],[控件启用]
var dr = dt_Station.Rows[i];
var = dr["工位代码"].ToString();
var = dr["工位名称"].ToString();
var PLC = dr["PLC"].ToString();
var stationName = dr["工位号"].ToString();
var PLC代码 = dr["PLC代码"].ToString();
var 线 = dr["线体类型"].ToString();
DataTable dt_Tag_Model_Copy = null;
switch (线)
{
case "1":
dt_Tag_Model_Copy = dt_Tag_Model_DX.Copy();
break;
default:
dt_Tag_Model_Copy = dt_Tag_Model.Copy();
break;
}
UpdateOpTable(dt_Tag_Model_Copy, , stationName, , PLC, PLC代码);
dt_Tag.Merge(dt_Tag_Model_Copy);
}
dt_Tag.Merge(dt_Tag_Mes);
//var dt_QC_OP170 = MakeQC();
//dt_Tag.Merge(dt_QC_OP170);
dt_Tag.TableName = "MES_基本变量_原始数据";
SqlOperation.ExecuteSql($"truncate table {dt_Tag.TableName}", out string err1);
WriteLog($"清空了数据库表:{dt_Tag.TableName}");
SqlOperation.SqlbulkcopyInsert(dt_Tag, out string err2);
WriteLog($"写入数据库表:{dt_Tag.TableName}");
dt_Device.TableName = "MES_基本变量设备类型对应表";
SqlOperation.ExecuteSql($"truncate table {dt_Device.TableName}", out string err11);
WriteLog($"清空了数据库表:{dt_Device.TableName}");
SqlOperation.SqlbulkcopyInsert(dt_Device, out string err22);
WriteLog($"写入数据库表:{dt_Device.TableName}");
}
private void UpdateOpTable(DataTable dt, string , string opName, string opNameName, string ip, string dbName)
{
foreach (DataRow row in dt.Rows)
{
//TagID TagName 工位号 数据来源 IP DbName 变量特点 变量类型代码
var TagID = row["TagID"].ToString();
row["TagID"] = TagID.Replace("****", .PadLeft(4, '0'));
//row["TagID"] = Guid.NewGuid().ToString ().ToUpper ();
row["工位号"] = opName;
row["数据来源"] = opNameName;
row["IP"] = ip;
row["DbName"] = dbName;
row["监控组"] = $"{row[""].ToString()}_{opName}";
}
}
private void UpdateOpTable(DataRow row, string , string opName, string opNameName, string ip, string dbName
, int startAddr, string tagName, int )
{
tagAid++;
//TagID TagName 工位号 数据来源 IP TagTypeID TagLong DbName 变量类型 变量地址 变量其它
//演示偏移 列位置 测量位置 测量项目 测量单位 变量类型代码 变量类型名称 机体类型
//线体类型 TagAdr TagAdrDemo 是否启用 监控组 监控时间间隔 OpcServer_OPNAME 变量特点
//是否监控 变量排序 工序能力 监控属性代码 测量位置短 上限值 下限值 理论值 IsGoodBad
//IsSaveToSql IsWebSocket 连接名称 OpcServer_MIS type 序号 高亮
var = row["测量项目"].ToString();
if (.Length > 0)
{
= $"_{测量项目}";
}
row["TagID"] = $"7{工位代码.PadLeft(4, '0')}{tagAid.ToString().PadLeft(4, '0')}";
row["工位号"] = opName;
row["数据来源"] = opNameName;
row["IP"] = ip;
row["DbName"] = dbName;
row["监控组"] = $"Group_QC_{opName}";
row["变量地址"] = $"{startAddr}";
row["TagName"] = $"{tagName}{测量项目}";
row["测量位置"] = $"{tagName}{测量项目}";
row["测量项目"] = $"{tagName}{测量项目}";
row["变量类型名称"] = $"{tagName}{测量项目}";
row["列位置"] = ;
}
public static void Select_Station(out DataTable dt)
{
var sql =
$" SELECT *" +
$" FROM [MES_计划BOM_工位与名称] WHERE [工位类型] = 0" +
$" ORDER BY [工位号]";
SqlOperation.ExecuteSql(sql, out dt, out string error);
}
private void label1_Click(object sender, EventArgs e)
{
}
private void btn_OpenExcel_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile);
}
private void btn_MakeData_OP170_Click(object sender, EventArgs e)
{
var dt = MakeQC();
}
public DataTable MakeQC()
{
tagAid = 0;
DataTable dt_Tag = null;
Select_Station(out DataTable dt_Station);
dt_Station = dt_Station.Copy().Select($"工位号='OP170'").CopyToDataTable();
var dt_Tag_Model = NPOITest.ExeclHelper.ExcelToDataTable(MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile, "MES_质量数据模板", true).Select($"是否启用='1'").CopyToDataTable();
var dt_Qd_Conf = NPOITest.ExeclHelper.ExcelToDataTable(MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile, "质量数据清单", true).Select($"是否启用='1'").CopyToDataTable();
dt_Tag = dt_Tag_Model.Clone();
for (int i = 0; i < dt_Station.Rows.Count; i++)
{
//[工位号],[工位名称],[PLC],[工位起始DB号],[PX],[PY],[PX_T],[PY_T],[控件启用]
var dr = dt_Station.Rows[i];
var = dr["工位代码"].ToString();
var = dr["工位名称"].ToString();
var PLC = dr["PLC"].ToString();
var stationName = dr["工位号"].ToString();
var PLC代码 = dr["PLC代码"].ToString();
var 线 = dr["线体类型"].ToString();
var = 0;
for (int k = 0; k < 40; k++)
{
for (int j = 0; j < dt_Qd_Conf.Rows.Count; j++)
{
//工位号 变量名称 起始地址 长度 类型 是否启用
var dr2 = dt_Qd_Conf.Rows[j];
var = dr2["工位号"].ToString();
var = dr2["变量名称"].ToString();
if ( == 0)
{
= Convert.ToInt32(dr2["起始地址"].ToString());
}
var = Convert.ToInt32(dr2["长度"].ToString());
var = dr2["类型"].ToString();
var = j + 1;
var dt_Tag_Model_Copy = dt_Tag_Model.Copy();
var tagName = $"焊点{k + 1}_{变量名称}";
UpdateOpTable(dt_Tag_Model_Copy.Rows[0], , stationName, , PLC, PLC代码, = , tagName, );
UpdateOpTable(dt_Tag_Model_Copy.Rows[1], , stationName, , PLC, PLC代码, = + 2, tagName, );
UpdateOpTable(dt_Tag_Model_Copy.Rows[2], , stationName, , PLC, PLC代码, = + 4, tagName, );
UpdateOpTable(dt_Tag_Model_Copy.Rows[3], , stationName, , PLC, PLC代码, = + 4, tagName, );
= + 4;
dt_Tag.Merge(dt_Tag_Model_Copy);
}
}
}
return dt_Tag;
}
}
}

View File

@@ -0,0 +1,120 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,68 @@
using System;
using System.Data;
using System.Data.SqlClient;
namespace SlMesDbIterface
{
public class SqlOperation
{
public static bool ExecuteStoredProcedure(string name, SqlParameter[] sqlParameters, out string errorMessage)
{
return DataLinkMesWork.SQLCommon.ExecuteStoredProcedure(name, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, ref sqlParameters, out errorMessage);
}
public static bool ExecuteStoredProcedure(string name, SqlParameter[] sqlParameters, out DataTable dt, out string errorMessage)
{
return DataLinkMesWork.SQLCommon.ExecuteStoredProcedure(name, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, ref sqlParameters, out dt, out errorMessage);
}
public static bool ExecuteStoredProcedure(string name, SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage)
{
return DataLinkMesWork.SQLCommon.ExecuteStoredProcedure(name, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, ref sqlParameters, out ds, out errorMessage);
}
public static bool ExecuteSql(string sql, out DataTable dt, out string errorMessage)
{
return DataLinkMesWork.SQLCommon.ExecuteSql(sql, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, out dt, out errorMessage);
}
public static bool ExecuteSql(string sql, out DataSet ds, out string errorMessage)
{
return DataLinkMesWork.SQLCommon.ExecuteDataset(sql, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, out ds, out errorMessage);
}
public static bool ExecuteSql(string sql, out string errorMessage)
{
return DataLinkMesWork.SQLCommon.ExecuteSql(sql, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, out errorMessage);
}
/// <summary>
/// 通过SqlBulkCopy复制table数据到数据库
/// </summary>
/// <param name="dataset"></param>
public static bool SqlbulkcopyInsert(DataTable dt,out string ErrMsg)
{
bool success = false;
ErrMsg = "";
try
{
// SqlBulkCopy sqlbulkcopy = new SqlBulkCopy(connectString, SqlBulkCopyOptions.KeepIdentity);//删除自增ID插入原始数据
SqlBulkCopy sqlbulkcopy = new SqlBulkCopy(MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, SqlBulkCopyOptions.UseInternalTransaction);//批量事务处理
sqlbulkcopy.DestinationTableName = dt.TableName;//数据库中的表名
for (int i = 0; i < dt.Columns.Count; i++)
{
var columnName = dt.Columns[i].ColumnName.ToString();
sqlbulkcopy.ColumnMappings.Add(columnName, columnName);
}
sqlbulkcopy.WriteToServer(dt);
success = true;
}
catch (Exception err)
{
ErrMsg=err.Message;
}
return success;
}
}
}

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

View File

@@ -0,0 +1 @@
8b5a3748d02e6317e84befb5a58ac3a20830387e46e84edba20e48cb8da29037

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,483 @@
using DataLinkMesWork1;
using MesServerWork;
using MisDataFunDll;
using MyLog4Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Net.Sockets;
using System.Reflection.Emit;
using System.Web.Http;
namespace MisDataSaveDate
{
public class Analysis_MOM_Msg
{
/// <summary>
/// UUID生成
/// </summary>
/// <returns></returns>
public static string UuidUtil()
{
string result = Guid.NewGuid().ToString();
return result;
}
/// <summary>
/// 获取时间戳
/// </summary>
/// <returns></returns>
public static Int64 GetTimeStamp()
{
TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(ts.TotalSeconds);
}
/// <summary>
/// 接收检测数据
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string OnlineCheckData(string url, string str)
{
var result = new msgResHeader();
result.MsgId = "";
result.Message = "";
result.Code = "200";
result.Data = "";
var errorMessage = "";
var AID = -1;
if (str.Length < 1)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
return retString1;
}
try
{
//存储日志
var param = new SqlParameter[] {
new SqlParameter("@接口地址",url),
new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",str),
new SqlParameter("@请求时间",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"))
};
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out errorMessage);
if (dt.Rows.Count > 0)
{
AID = Convert.ToInt32(dt.Rows[0]["AID"].ToString());
}
List<OnlineCheckData> onlineCheckDataList = null;
var token = JToken.Parse(str);
switch (token.Type)
{
case JTokenType.Object:
onlineCheckDataList = new List<OnlineCheckData>();
var onlineCheckData = JsonConvert.DeserializeObject<OnlineCheckData>(str);
onlineCheckDataList.Add(onlineCheckData);
break;
case JTokenType.Array:
onlineCheckDataList = JsonConvert.DeserializeObject<List<OnlineCheckData>>(str);
break;
case JTokenType.String:
case JTokenType.Integer:
case JTokenType.Boolean:
case JTokenType.Null:
break;
}
var OpName = "";
Dictionary<string, int> Id_tagCF_DC = new Dictionary<string, int>();
string Id_tagCF_DC_Str = "";
string EngineID = "";
int QualityMark = 1;
foreach (var onlineCheckData in onlineCheckDataList)
{
if (onlineCheckData.MsgId == "")
{
throw new Exception("参数MsgId为空");
}
result.MsgId = onlineCheckData.MsgId;
if (onlineCheckData.OpCode == "")
{
throw new Exception("参数OpCode为空");
}
if (onlineCheckData.ProductionCode == "")
{
throw new Exception("参数ProductionCode为空");
}
OpName = onlineCheckData.OpCode;
QualityMark = onlineCheckData.QualityMark;
EngineID = onlineCheckData.ProductionCode;
int Id_tagCF = 0;
var param1 = new SqlParameter[6];
param1[0] = new SqlParameter("@EngineID", onlineCheckData.ProductionCode);
param1[1] = new SqlParameter("@工位号", OpName);
param1[2] = new SqlParameter("@操作者工号", onlineCheckData.CheckPerson);
param1[3] = new SqlParameter("@扫码时间", onlineCheckData.ScanTime);
param1[4] = new SqlParameter("@合格标志", onlineCheckData.QualityMark);
param1[5] = new SqlParameter("@Id_tagCF", Id_tagCF);
param1[5].Direction = ParameterDirection.Output;
DataAccess.ExecuteStoredProcedure("测量数据合格索引_增加_测试设备", ref param1, out errorMessage);
if (errorMessage != "")
{
throw new Exception(errorMessage);
}
Id_tagCF = Convert.ToInt32(param1[5].Value.ToString());
Id_tagCF_DC.Add(onlineCheckData.ProductionCode, Id_tagCF);
Id_tagCF_DC_Str += $"{Id_tagCF},";
List<OnlineCheckData_CheckData> onlineCheckData_CheckDataList = onlineCheckData.CheckData;
for (int i = 0; i < onlineCheckData_CheckDataList.Count; i++)
{
OnlineCheckData_CheckData onlineCheckData_CheckData = onlineCheckData_CheckDataList[i];
var param2 = new SqlParameter[] {
new SqlParameter("@Id_tagCF", Id_tagCF),
new SqlParameter("@EngineID", onlineCheckData.ProductionCode),
new SqlParameter("@TagID",onlineCheckData_CheckData.CheckCode),
new SqlParameter("@TagValue",onlineCheckData_CheckData.CheckValue),
new SqlParameter("@IsGoodBad",onlineCheckData_CheckData.QualityMark),
new SqlParameter("@工位号",OpName),
new SqlParameter("@理论值",onlineCheckData_CheckData.StandardValue),
new SqlParameter("@上限值",onlineCheckData_CheckData.MaxValue),
new SqlParameter("@下限值",onlineCheckData_CheckData.MinValue),
new SqlParameter("@测量项目",onlineCheckData_CheckData.CheckName),
new SqlParameter("@测量单位",onlineCheckData_CheckData.Unit),
};
DataAccess.ExecuteStoredProcedure("测量数据合格_增加_测试设备", ref param2, out errorMessage);
if (errorMessage != "")
{
throw new Exception(errorMessage);
}
}
if(OpName == "OP040")
{
MisDataFunDll.MisDataFun.Cell_PassStation(OpName, onlineCheckData.ProductionCode, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), 2, onlineCheckData.QualityMark);
}
}
// 查询PLC是否传递机型保证工位有件可以写保存完成和工作完成
MIS_BASE.Read_EngineGetOver_PLC(OpName, out bool tagValue);
// 电芯段OP040流程比较特殊无PLC保存数据的流程可以直接写完成。
if (OpName == "OP040")
{
if (tagValue)
{
//通知PLCMES保存完成
MIS_BASE.Write_MesReadOver(OpName, true);
//通知PLCMES工作完成
MIS_BASE.Write_MesWorkFinish(OpName, true);
MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "TestDevice", "MES保存数据完成MES工作完成");
}
}
else if (OpName == "OP540")
{
string msg1 = "";
// MOM_数据收集组_实时表_增加
MisDataFunDll.MisDataFun.SetPartQualityGroupParams(OpName, EngineID);
// 从数据库查出质量数据组 MOM_质量数据_上传_查询
MisDataFunDll.MisDataFun.GetPartQualityGroupParams(OpName, EngineID, out DataTable dt_quality);
// 调用工厂MES出站接口
CallWebService.Call_dataCollectForSfcEx(OpName, onlineCheckDataList[0].ProductionCode, dt_quality, QualityMark, out string code, out string message);
}
else // 其他测试设备 必须由PLC触发上传 存在先后顺序!
{
if (tagValue)
{
// 查看PLC是否完成流程如果完成的话流程结束否则的话要等PLC完成流程即允许保存
DataTable dt2 = MisDataFunDll.MisDataFun.CheckAllFinish(OpName, onlineCheckDataList[0].ProductionCode, 2);
string msg1 = "查询PLC流程出错";
if (dt2 != null && dt2.Rows.Count > 0)
{
string result1 = dt2.Rows[0]["result"].ToString();
msg1 = dt2.Rows[0]["msg"].ToString();
//MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "TestDevice", "测试设备传数据晚于PLC");
if (result1 == "1") //已完成
{
//// 从数据库查出质量数据组 MOM_质量数据_上传_查询
//MisDataFunDll.MisDataFun.GetPartQualityGroupParams(OpName, EngineID, out DataTable dt_quality);
//// 调用工厂MES出站接口
//CallWebService.Call_dataCollectForSfcEx(OpName, onlineCheckDataList[0].ProductionCode, dt_quality, QualityMark, out string code, out string message);
//if (code == "0")
//{
// //通知PLCMES保存完成
// MIS_BASE.Write_MesReadOver(OpName, true);
// //通知PLCMES工作完成
// MIS_BASE.Write_MesWorkFinish(OpName, true);
// MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "TestDevice", msg1);
// MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "TestDevice", "MES保存数据完成MES工作完成");
//}
//else if (code == "13921") // 质量判定不合格 走不合格放行
//{
// //通知PLCMES保存完成
// MIS_BASE.Write_MesReadOver(OpName, true);
// //通知PLCMES工作完成
// MIS_BASE.Write_MesWorkFinish(OpName, true);
// MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "TestDevice", msg1);
// MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "TestDevice", "MES保存数据完成MES工作完成");
//}
//else
//{
// string msg2 = "出站失败:" + onlineCheckDataList[0].ProductionCode + "code" + code + "message" + message;
// MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "ERROR", "MOM", msg2);
//}
}
else
{
MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "TestDevice", msg1);
}
}
else
{
MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "TestDevice", msg1);
}
}
}
}
catch (Exception err)
{
result.Code = "500";
result.Message = err.Message;
MisDataFunDll.MisDataFun.LogRecording_OP("All", "ERROR", "MIS", err.Message);
}
var retString = JsonConvert.SerializeObject(result);
var paramRsp = new SqlParameter[] {
new SqlParameter("@AID",AID),
new SqlParameter("@响应时间",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")),
new SqlParameter("@响应内容",retString)
};
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", ref paramRsp, out errorMessage);
return retString;
}
public static void Add_K_To_Database(string OpName, Dictionary<string, int> Id_tagCF_DC, Dictionary<string, string> checkResult)
{
foreach (KeyValuePair<string, string> kvp in checkResult)
{
int Id_tagCF = Id_tagCF_DC[kvp.Key];
var param2 = new SqlParameter[] {
new SqlParameter("@Id_tagCF", Id_tagCF),
new SqlParameter("@EngineID", kvp.Key),
new SqlParameter("@TagID","OP040_M0001_004"),
new SqlParameter("@TagValue",kvp.Value),
new SqlParameter("@IsGoodBad",1),
new SqlParameter("@工位号",OpName),
new SqlParameter("@理论值",0),
new SqlParameter("@上限值",0),
new SqlParameter("@下限值",0),
new SqlParameter("@测量项目","K值"),
new SqlParameter("@测量单位",""),
};
DataAccess.ExecuteStoredProcedure("测量数据合格_增加_测试设备", ref param2, out string errorMessage);
}
}
/// <summary>
/// 接收查询检测次数
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string OnlineCheckDataCount(string url, [FromBody] JObject jobj)
{
var result = new msgResHeader2();
result.MsgId = "";
result.Message = "";
result.Code = "200";
result.Data = new checkCountData();
result.Data.CheckCountOk = 0;
result.Data.CheckCountNg = 0;
string errorMessage = "";
string parentID = "";
int AID = -1;
if (jobj == null)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
MyLogHelper.Info("接收查询检测次数_res", retString1);
return retString1;
}
int isError = 0;
string str = jobj.ToString();
try
{
//存储日志
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//Event_MOM_Log_Insert,@创建时间,@内容
var param = new SqlParameter[] {
new SqlParameter("@接口地址",url),
new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",str),
new SqlParameter("@请求时间",CreateTime)
};
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out errorMessage);
// 解析订单内容,存储数据库,根据实际业务来写
OnlineCheckData onlineCheckData = JsonConvert.DeserializeObject<OnlineCheckData>(str);
if (onlineCheckData.MsgId == "")
{
throw new Exception("参数MsgId为空");
}
result.MsgId = onlineCheckData.MsgId;
if (onlineCheckData.OpCode == "")
{
throw new Exception("参数OpCode为空");
}
if (onlineCheckData.ProductionCode == "")
{
throw new Exception("参数ProductionCode为空");
}
SqlParameter[] param1 = new SqlParameter[2];
param1[0] = new SqlParameter("@EngineID", onlineCheckData.ProductionCode);
param1[1] = new SqlParameter("@工位号", onlineCheckData.OpCode);
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("CATL_测量数据合格_查询测试次数_测试设备", ref param1, out DataTable dt1, out errorMessage);
if (errorMessage != "")
{
throw new Exception(errorMessage);
}
if (dt1 != null && dt1.Rows.Count > 0)
{
result.Data.CheckCountOk = Convert.ToInt32(dt1.Rows[0]["OK"]);
result.Data.CheckCountNg = Convert.ToInt32(dt1.Rows[0]["NG"]);
}
}
catch (Exception err)
{
result.Code = "500";
result.Message = err.Message;
}
string retString = JsonConvert.SerializeObject(result);
MyLogHelper.Info("接收查询检测次数_res", retString);
return retString;
}
/// <summary>
/// 接收打印任务
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string ReceivePrintTask(string url, [FromBody] JObject jobj)
{
var result = new msgResHeader();
result.MsgId = "";
result.Message = "";
result.Code = "200";
result.Data = "";
string errorMessage = "";
string parentID = "";
int AID = -1;
if (jobj == null)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
MyLogHelper.Info("接收打印任务_res", retString1);
return retString1;
}
string str = jobj.ToString();
try
{
//存储日志
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//Event_MOM_Log_Insert,@创建时间,@内容
var param = new SqlParameter[] {
new SqlParameter("@接口地址",url),
new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",str),
new SqlParameter("@请求时间",CreateTime)
};
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out errorMessage);
// 解析订单内容,存储数据库,根据实际业务来写
PrintTaskData printTaskData = JsonConvert.DeserializeObject<PrintTaskData>(str);
if (printTaskData.printTemplete == "")
{
throw new Exception("参数printTemplete为空");
}
if (printTaskData.productCode == "")
{
throw new Exception("参数productCode为空");
}
if (printTaskData.printDate == "")
{
throw new Exception("参数printDate为空");
}
string msg = $"MARK|{printTaskData.printTemplete}|{printTaskData.productCode},{printTaskData.printDate}";
// 连接打印机
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
try
{
//socket.Connect(MesWorkForm.MarkingMachine_Ip, int.Parse(MesWorkForm.MarkingMachine_Port));
}
catch (Exception err)
{
throw new Exception("连接打印机失败:" + err.Message);
}
// 发送数据
try
{
if (socket.Connected)
{
byte[] decBytes = System.Text.Encoding.UTF8.GetBytes(msg);
//socket.Send(decBytes);
socket.Send(decBytes, 0, decBytes.Length, SocketFlags.None);
}
else
{
throw new Exception("连接打印机失败");
}
}
catch (Exception err)
{
throw new Exception("发送打印数据失败:" + err.Message);
}
// 关闭
try
{
if (socket.Connected)
{
socket.Shutdown(SocketShutdown.Both);
socket.Close(100);
}
}
catch (Exception ex)
{
}
}
catch (Exception err)
{
result.Code = "500";
result.Message = err.Message;
}
string retString = JsonConvert.SerializeObject(result);
MyLogHelper.Info("接收打印任务_res", retString);
return retString;
}
}
}

View File

@@ -0,0 +1,92 @@
using System.Net.Http;
using System.Text;
using System.Web.Http;
using Newtonsoft.Json.Linq;
namespace MisDataSaveDate
{
public class WebSendController : ApiController
{
readonly string headUrl = "WebSend/";
[HttpPost]
[Route("ApiFailRetry")]
public HttpResponseMessage ReceiveMomPlanData([FromBody] JObject jobj)
{
var url = Request.RequestUri.ToString();
return new HttpResponseMessage
{
Content = new StringContent(WebSendServer.ApiFailRetry(url, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
[HttpPost]
[Route("FirstProductUpLoad")]
public HttpResponseMessage FirstProductUpLoad([FromBody] JObject jobj)
{
var url = Request.RequestUri.ToString();
return new HttpResponseMessage
{
Content = new StringContent(WebSendServer.FirstProductUpLoad(url, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
[HttpPost]
[Route("UploadImageToShare")]
public HttpResponseMessage UploadImageToShare([FromBody] JObject jobj)
{
var url = Request.RequestUri.ToString();
return new HttpResponseMessage
{
Content = new StringContent(WebSendServer.UploadImageToShare(url, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// 获取产品生产状态接口
/// </summary>
/// <param name="jobj">请求参数MsgId, Site(默认2700), Barcode</param>
/// <returns>返回产品状态信息及原始XML响应</returns>
[HttpPost]
[Route("GetSfcStatusAndOperation")]
public HttpResponseMessage GetSfcStatusAndOperation([FromBody] JObject jobj)
{
var url = Request.RequestUri.ToString();
return new HttpResponseMessage
{
Content = new StringContent(WebSendServer.GetSfcStatusAndOperation(url, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// 前端主动触发设备报警
/// </summary>
/// <param name="jobj">请求参数MsgId, OpName, AlarmText, AlarmCode</param>
/// <returns>触发结果</returns>
[HttpPost]
[Route("TriggerDeviceAlarm")]
public HttpResponseMessage TriggerDeviceAlarm([FromBody] JObject jobj)
{
var url = Request.RequestUri.ToString();
return new HttpResponseMessage
{
Content = new StringContent(WebSendServer.TriggerDeviceAlarm(url, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// 获取客户标签码
/// </summary>
/// <param name="jobj">请求参数MsgId, EngineID, EngineTypeID</param>
/// <returns>客户标签码值</returns>
[HttpPost]
[Route("GetClientTagValue")]
public HttpResponseMessage GetClientTagValue([FromBody] JObject jobj)
{
var url = Request.RequestUri.ToString();
return new HttpResponseMessage
{
Content = new StringContent(WebSendServer.GetClientTagValue(url, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
}
}

View File

@@ -0,0 +1,50 @@
using System.Net.Http;
using System.Text;
using System.Web.Http;
using Newtonsoft.Json.Linq;
namespace MisDataSaveDate
{
public class IpcController : ApiController
{
readonly string headUrl = "Project/";
[HttpPost]
[Route("OnlineCheckData")]
public HttpResponseMessage ReceiveMomPlanData([FromBody] JToken jobj)
{
var url = Request.RequestUri.ToString();
return new HttpResponseMessage
{
Content = new StringContent(Analysis_MOM_Msg.OnlineCheckData(url, jobj.ToString()), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
[HttpPost]
[Route("OnlineCheckDataCount")]
public HttpResponseMessage OnlineCheckDataCount([FromBody] JObject jobj)
{
return new HttpResponseMessage
{
Content = new StringContent(Analysis_MOM_Msg.OnlineCheckDataCount(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// 这个不是量产线的接口
/// </summary>
/// <param name="jobj"></param>
/// <returns></returns>
[HttpPost]
[Route("ReceivePrintTask")]
public HttpResponseMessage ReceivePrintTask([FromBody] JObject jobj)
{
return new HttpResponseMessage
{
Content = new StringContent(Analysis_MOM_Msg.ReceivePrintTask(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
}
}

View File

@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Net;
using System.Web.Http;
using System.Web.Http.Cors;
using System.Web.Http.SelfHost;
using System.Threading;
using System.Threading.Tasks;
namespace MisDataSaveDate
{
public class InitServer
{
HttpSelfHostConfiguration config = null;
HttpSelfHostServer server = null;
public InitServer(string Url_WebApi)
{
// var Url_WebApi = System.Configuration.ConfigurationManager.AppSettings["Url_WebApi"];
Init(Url_WebApi);
}
public void Init(string url)
{
config = new HttpSelfHostConfiguration(url);
// 提高允许的请求体大小默认较小导致大图Base64 413
config.MaxReceivedMessageSize = 104857600; // 100 MB
// 启用跨域
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
// 兜底处理 CORS含预检请求
config.MessageHandlers.Add(new CorsPreflightHandler());
// 启用特性路由
config.MapHttpAttributeRoutes();
//config.Routes.MapHttpRoute(
// name: "DefaultApi",
// routeTemplate: "api/{controller}/{id}",
// defaults: new { id = RouteParameter.Optional }
//);
// 自定义路由匹配到action
config.Routes.MapHttpRoute(
name: "API Default",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
server = new HttpSelfHostServer(config);
server.OpenAsync().Wait();
}
/// <summary>
/// 处理OPTIONS预检并为所有响应添加CORS头自托管场景
/// </summary>
public class CorsPreflightHandler : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (request.Method == HttpMethod.Options)
{
var resp = new HttpResponseMessage(HttpStatusCode.OK);
AddCorsHeaders(resp);
return Task.FromResult(resp);
}
return base.SendAsync(request, cancellationToken).ContinueWith(t =>
{
var resp = t.Result;
AddCorsHeaders(resp);
return resp;
}, cancellationToken);
}
private static void AddCorsHeaders(HttpResponseMessage resp)
{
if (!resp.Headers.Contains("Access-Control-Allow-Origin"))
{
resp.Headers.Add("Access-Control-Allow-Origin", "*");
}
if (!resp.Headers.Contains("Access-Control-Allow-Methods"))
{
resp.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
}
if (!resp.Headers.Contains("Access-Control-Allow-Headers"))
{
resp.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Requested-With");
}
if (!resp.Headers.Contains("Access-Control-Allow-Credentials"))
{
resp.Headers.Add("Access-Control-Allow-Credentials", "true");
}
}
}
public class JsonContentNegotiator : IContentNegotiator
{
private readonly JsonMediaTypeFormatter _jsonFormatter;
public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
{
_jsonFormatter = formatter;
}
public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
{
var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
return result;
}
}
}
}

View File

@@ -0,0 +1,98 @@
using System.Collections.Generic;
namespace MisDataSaveDate
{
/// <summary>
/// OnlineCheckData
/// </summary>
public class OnlineCheckData
{
/// <summary>
/// MsgId
/// </summary>
public string MsgId { get; set; } = "";
/// <summary>
/// OpCode
/// </summary>
public string OpCode { get; set; } = "";
/// <summary>
/// ProductionCode
/// </summary>
public string ProductionCode { get; set; } = "";
/// <summary>
/// CheckTime
/// </summary>
public string ScanTime { get; set; } = "";
/// <summary>
/// CheckPerson
/// </summary>
public string CheckPerson { get; set; } = "";
/// <summary>
/// QualityMark
/// </summary>
public int QualityMark { get; set; } = 1;
public List<OnlineCheckData_CheckData> CheckData { get; set; } = new List<OnlineCheckData_CheckData>();
}
public class OnlineCheckData_CheckData
{
/// <summary>
/// CheckCode
/// </summary>
public string CheckCode { get; set; } = "";
/// <summary>
/// CheckName
/// </summary>
public string CheckName { get; set; } = "";
/// <summary>
/// ProductionCode
/// </summary>
public string Unit { get; set; }
/// <summary>
/// StandardValue
/// </summary>
public string StandardValue { get; set; } = "";
/// <summary>
/// MinValue
/// </summary>
public string MinValue { get; set; } = "";
/// <summary>
/// MaxValue
/// </summary>
public string MaxValue { get; set; } = "";
/// <summary>
/// CheckValue
/// </summary>
public string CheckValue { get; set; } = "";
/// <summary>
/// QualityMark
/// </summary>
public int QualityMark { get; set; } = 1;
}
public class PrintTaskData
{
/// string msg = $"MARK|{printTemplete}|{productCode},{printDate}";
/// <summary>
/// printTemplete
/// </summary>
public string printTemplete { get; set; } = "";
/// <summary>
/// productCode
/// </summary>
public string productCode { get; set; } = "";
/// <summary>
/// printDate
/// </summary>
public string printDate { get; set; } = "";
}
}

View File

@@ -0,0 +1,872 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyLog4Net;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Web.Http;
using MesServerWork;
using MesDataFunction;
using System.IO;
using System.Configuration;
using Org.BouncyCastle.Ocsp;
using System.Threading;
namespace MisDataSaveDate
{
public class WebSendServer
{
private static readonly string ImageShareBasePath = ConfigurationManager.AppSettings["ImageShareBasePath"];
private static readonly string ImageShareUser = ConfigurationManager.AppSettings["ImageShareUser"];
private static readonly string ImageSharePassword = ConfigurationManager.AppSettings["ImageSharePassword"];
/// <summary>
/// MES接口重试
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string ApiFailRetry(string url, [FromBody] JObject jobj)
{
var result = new msgResHeader2();
result.MsgId = "";
result.Message = "";
result.Code = "200";
if (jobj == null)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
MyLogHelper.Info("MES接口重试_res", retString1);
return retString1;
}
string str = jobj.ToString();
var req = JsonConvert.DeserializeObject<ApiFailRetryData>(str);
string opName = req.OpName.Trim();
string type = req.Type.Trim().ToLowerInvariant();
try
{
if (req == null)
{
throw new Exception("请求体解析失败!");
}
result.MsgId = req.MsgId ?? "";
if (string.IsNullOrWhiteSpace(req.OpName))
{
throw new Exception("参数OpName为空");
}
if (string.IsNullOrWhiteSpace(req.Type))
{
throw new Exception("参数Type为空");
}
string functionCode = MIS_BASE.hashtable_MesDll[opName].ToString();
// Type -> TagTypeCodeID
string tagTypeCodeId;
if (type == "workover")
{
MIS_BASE.Read_MesRead(opName, out bool isMesRead);
if(functionCode != "Function1055") // 非拧紧工位需要判断允许保存信号 其他工位不管
{
if (!isMesRead) throw new Exception("工位未允许保存,不可强制完成!");
}
else
{
MIS_BASE.Write_OpNameIsOk(opName, -99); // 先复位报警信号 一秒后 再写入合格 因为如果不合格MES会判定不合格的 拧紧工位PLCS 和 PLC不判定
Thread.Sleep(1000);
}
// 写入当前工位总合格标志为不合格 走不合格放行
MIS_BASE.Write_TagValueByTagTypeID(51, opName, false); // 合格放行
MIS_BASE.Write_TagValueByTagTypeID(8, opName, true); // 不合格放行
// 记录不合格过站信息
MisDataFunDll.MisDataFun.WorkStartInsert(opName, 2);
//通知PLCMES保存完成
MIS_BASE.Write_MesReadOver(opName, true);
//通知PLCMES工作完成
MIS_BASE.Write_MesWorkFinish(opName, true);
result.Code = "200";
result.Message = "强制出站成功";
MisDataFunDll.MisDataFun.LogRecording_OP(opName, "WARNING", "MIS", "强制出站成功 强制不合格出站!");
return JsonConvert.SerializeObject(result);
}
bool workStart,mesRead, engineGetOver_PLC, partLoad, engineTypeGetOverFromMES, fixAllow;
switch (type)
{
case "mesread":
tagTypeCodeId = "19"; // 允许保存
MIS_BASE.Read_WorkStart(opName, out workStart);
MIS_BASE.Read_MesRead(opName, out mesRead);
MIS_BASE.Read_FixAllow(opName, out fixAllow);
MIS_BASE.Read_EngineGetOver_PLC(opName, out engineGetOver_PLC);
if (!workStart) throw new Exception("当前工位无PLC在位产品 不可触发产品保存!");
if (!engineGetOver_PLC) throw new Exception("当前工位未PLC传递机型 不可主动触发传递机型!");
if(functionCode != "Function1055")
{
if(!fixAllow) throw new Exception("当前工位MES未允许工作 不可触发产品保存!"); // 只有非拧紧工位校验
if(!mesRead) throw new Exception("当前工位无PLC允许保存信号 不可触发产品保存!"); // 只有非拧紧工位校验
}
break;
case "enginegetover":
tagTypeCodeId = "44"; // 传递机型
MIS_BASE.Read_WorkStart(opName, out workStart);
MIS_BASE.Read_EngineGetOver_PLC(opName, out engineGetOver_PLC);
if (!workStart) throw new Exception("当前工位无PLC在位产品 不可触发传递机型!");
if (!engineGetOver_PLC) throw new Exception("当前工位未PLC传递机型 不可主动触发传递机型!");
break;
case "parload":
case "partload":
tagTypeCodeId = "43"; // 申请上线
// 判断是否有申请上线 以及MES的传递机型
MIS_BASE.Read_PartLoad(opName, out partLoad);
MIS_BASE.Read_EngineTypeGetOver_MES(opName, out engineTypeGetOverFromMES);
if (!partLoad) throw new Exception("当前工位PLC未申请上线 不可提前申请!");
if(engineTypeGetOverFromMES) throw new Exception("当前工位已获取上线条码并传递 不可重复获取!");
break;
default:
throw new Exception("无效的Type仅支持: MesRead, MesReadOver, ParLoad");
}
// ParLoad 限制
if (tagTypeCodeId == "43")
{
bool allow = string.Equals(opName, "OP090", StringComparison.OrdinalIgnoreCase)
|| string.Equals(opName, "OP250", StringComparison.OrdinalIgnoreCase);
if (!allow)
{
throw new Exception("ParLoad 仅允许 OP090 与 OP250 使用!");
}
}
// 确保 MesDll 映射可用
if (MIS_BASE.hashtable_MesDll == null || MIS_BASE.hashtable_MesDll.Count == 0)
{
MIS_BASE.InitHashtable_MesServerCode();
}
if (!MIS_BASE.hashtable_MesDll.ContainsKey(opName))
{
MIS_BASE.InitHashtable_MesServerCode();
if (!MIS_BASE.hashtable_MesDll.ContainsKey(opName))
{
throw new Exception("工位未配置 MesDll无法路由到对应Function");
}
}
// 取 TagID若无则回退到 "1"
string tagKey = $"{opName}_{tagTypeCodeId}";
string tagId = null;
if (MIS_BASE.hashtable_TagTypeID_OpName_ToTagID != null)
{
tagId = MIS_BASE.hashtable_TagTypeID_OpName_ToTagID.Get(tagKey);
}
if (string.IsNullOrWhiteSpace(tagId)) tagId = "1";
// 计算 cmd 名称(用于消息第二段)
string cmdName = null;
if (MIS_BASE.hashtable_TagTypeTagName != null)
{
cmdName = MIS_BASE.hashtable_TagTypeTagName.Get(tagTypeCodeId);
}
if (string.IsNullOrWhiteSpace(cmdName))
{
cmdName = tagTypeCodeId == "19" ? "MesRead" : tagTypeCodeId == "44" ? "EngineGetOver" : "s";
}
// 构建 PLC 源事件并路由
var eObj = new
{
OpName = opName,
TagTypeCodeID = tagTypeCodeId,
TagType = tagTypeCodeId,
TagID = tagId,
TagValue = "1"
};
string payload = JsonConvert.SerializeObject(eObj);
string msg = $"PLC|{cmdName}|{opName}|{payload}";
MisDataFunDll.MisDataFun.TransferInfToMES(msg);
result.Code = "200";
result.Message = "重试触发成功";
MisDataFunDll.MisDataFun.LogRecording_OP(opName, "WARNING", "MIS", $"{payload}重试触发成功!");
}
catch (Exception err)
{
MisDataFunDll.MisDataFun.LogRecording_OP(opName, "ERROR", "MIS", $"手动重试失败 {err}");
result.Code = "500";
result.Message = err.Message;
}
string ret = JsonConvert.SerializeObject(result);
MyLogHelper.Info("MES接口重试_res", ret);
return ret;
}
/// <summary>
/// 首件测试数据上传
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string FirstProductUpLoad(string url, [FromBody] JObject jobj)
{
var result = new msgResHeader2();
result.MsgId = "";
result.Message = "";
result.Code = "200";
string errorMessage = "";
int AID = -1;
if (jobj == null)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
MyLogHelper.Info("MES接口重试_res", retString1);
return retString1;
}
int isError = 0;
string str = jobj.ToString();
try
{
//存储日志
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//Event_MOM_Log_Insert,@创建时间,@内容
var param = new SqlParameter[] {
new SqlParameter("@接口地址",url),
new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",str),
new SqlParameter("@请求时间",CreateTime)
};
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out errorMessage);
// 解析订单内容,存储数据库,根据实际业务来写
FirstProductUpLoadReq firstProductUpLoadReq = JsonConvert.DeserializeObject<FirstProductUpLoadReq>(str);
if (firstProductUpLoadReq.MsgId == "")
{
throw new Exception("参数MsgId为空");
}
result.MsgId = firstProductUpLoadReq.MsgId;
if (firstProductUpLoadReq.OpName == "")
{
throw new Exception("参数OpName为空");
}
string OpName = firstProductUpLoadReq.OpName;
SqlParameter[] param1 = new SqlParameter[1];
param1[0] = new SqlParameter("@工位号", OpName);
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("电子看板_质量数据_首件数据_MOBY_查询", ref param1, out DataTable dt1, out errorMessage);
if (errorMessage != "")
{
throw new Exception(errorMessage);
}
if (dt1.Rows.Count <= 0)
{
throw new Exception(OpName + "首件数据查询为空,无可上传数据!");
}
// 这个是首件数据上传接口
string SOpName = OpName;
if (OpName == "OP270") SOpName = "OP270-1";
if (OpName == "OP440") SOpName = "OP440-1";
if (OpName == "OP490") SOpName = "OP490-1";
CallWebService.Call_dataCollectForResourceInspect(SOpName, dt1, out string code, out string message);
if (code == "0")
{
SqlParameter[] param2 = new SqlParameter[1];
param2[0] = new SqlParameter("@工位号", OpName);
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("电子看板_质量数据_首件数据_moby_数据转移", ref param2, out DataTable dt2, out errorMessage);
if (errorMessage != "")
{
throw new Exception("首件数据上传成功!数据转移失败!" + errorMessage);
}
result.Code = "200";
result.Message = "首件数据上传成功!";
}
else
{
throw new Exception("首件数据上传失败!原因:" + message);
}
}
catch (Exception err)
{
result.Code = "500";
result.Message = err.Message;
}
string retString = JsonConvert.SerializeObject(result);
MyLogHelper.Info("首件数据上传_res", retString);
return retString;
}
/// <summary>
/// 前端主动触发设备报警
/// </summary>
/// <param name="url"></param>
/// <param name="jobj"></param>
/// <returns></returns>
public static string TriggerDeviceAlarm(string url, [FromBody] JObject jobj)
{
var result = new msgResHeader2();
result.MsgId = "";
result.Message = "";
result.Code = "200";
string opName = "";
if (jobj == null)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
MyLogHelper.Info("前端触发设备报警_res", retString1);
return retString1;
}
string str = jobj.ToString();
try
{
TriggerDeviceAlarmReq req = JsonConvert.DeserializeObject<TriggerDeviceAlarmReq>(str);
if (req == null)
{
throw new Exception("请求体解析失败!");
}
if (string.IsNullOrWhiteSpace(req.MsgId))
{
throw new Exception("参数MsgId为空");
}
result.MsgId = req.MsgId;
if (string.IsNullOrWhiteSpace(req.OpName))
{
throw new Exception("参数OpName为空");
}
if (string.IsNullOrWhiteSpace(req.AlarmText))
{
throw new Exception("参数AlarmText为空");
}
if (string.IsNullOrWhiteSpace(req.AlarmCode))
{
throw new Exception("参数AlarmCode为空");
}
opName = req.OpName.Trim();
string alarmText = req.AlarmText.Trim();
string alarmCode = req.AlarmCode.Trim();
// 记录工位日志
MisDataFunDll.MisDataFun.LogRecording_OP(opName, "WARNING", "ALARM", $"触发设备报警 AlarmCode={alarmCode} AlarmText={alarmText}");
// 写入设备报警
MIS_BASE.Write_MesErrorType(opName, Convert.ToInt32(alarmCode));
result.Code = "200";
result.Message = "报警触发成功";
}
catch (Exception ex)
{
MisDataFunDll.MisDataFun.LogRecording_OP(opName, "ERROR", "ALARM", $"触发设备报警失败 {ex}");
result.Code = "500";
result.Message = ex.Message;
}
string retString = JsonConvert.SerializeObject(result);
MyLogHelper.Info("前端触发设备报警_res", retString);
return retString;
}
/// <summary>
/// 上传图片到网络共享路径
/// </summary>
/// <param name="url"></param>
/// <param name="jobj"></param>
/// <returns></returns>
public static string UploadImageToShare(string url, [FromBody] JObject jobj)
{
var result = new msgResHeader2();
result.MsgId = "";
result.Message = "";
result.Code = "200";
string errorMessage = "";
if (jobj == null)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
MyLogHelper.Info("上传图片到共享路径_res", retString1);
return retString1;
}
string str = jobj.ToString();
try
{
//// 日志记录
//var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//var param = new SqlParameter[] {
// new SqlParameter("@接口地址",url),
// new SqlParameter("@接口类型",2),
// new SqlParameter("@请求内容",str),
// new SqlParameter("@请求时间",CreateTime)
//};
//DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out errorMessage);
// 解析请求
UploadImageToShareReq req = JsonConvert.DeserializeObject<UploadImageToShareReq>(str);
if (req == null)
{
throw new Exception("请求体解析失败!");
}
if (string.IsNullOrWhiteSpace(req.MsgId))
{
throw new Exception("参数MsgId为空");
}
result.MsgId = req.MsgId;
// 两种传参方式:
// 1) TargetPath + FileName
// 2) RelativePath以共享根目录为基准如 OP120\\2025-08-30\\xxx.png
bool hasTargetAndFile = !string.IsNullOrWhiteSpace(req.TargetPath) && !string.IsNullOrWhiteSpace(req.FileName);
bool hasRelative = !string.IsNullOrWhiteSpace(req.RelativePath);
if (!hasTargetAndFile && !hasRelative)
{
throw new Exception("参数无效:需提供(TargetPath+FileName)或RelativePath之一");
}
if (string.IsNullOrWhiteSpace(req.ImageBase64))
{
throw new Exception("参数ImageBase64为空");
}
// 兼容 data:image/png;base64,xxx 前缀
string base64 = req.ImageBase64;
int commaIndex = base64.IndexOf(",");
if (base64.Contains("base64") && commaIndex >= 0)
{
base64 = base64.Substring(commaIndex + 1);
}
byte[] bytes;
try
{
bytes = Convert.FromBase64String(base64);
}
catch
{
throw new Exception("ImageBase64格式不正确无法解码");
}
// 目录与文件
string fullPath = string.Empty;
if (hasTargetAndFile)
{
string targetDir = req.TargetPath.Trim();
string fileName = req.FileName.Trim();
foreach (char c in Path.GetInvalidFileNameChars())
{
if (fileName.Contains(c))
{
throw new Exception("FileName包含非法字符");
}
}
fullPath = Path.Combine(targetDir, fileName);
}
else
{
// 使用相对路径(相对共享根目录)
string relative = req.RelativePath.Trim().Replace('/', '\\');
if (Path.IsPathRooted(relative) || relative.Contains(":"))
{
throw new Exception("RelativePath必须为相对路径不可包含盘符");
}
fullPath = Path.Combine(ImageShareBasePath, relative);
// 校验最终文件名
string leaf = Path.GetFileName(fullPath) ?? "";
foreach (char c in Path.GetInvalidFileNameChars())
{
if (leaf.Contains(c))
{
throw new Exception("RelativePath中的文件名包含非法字符");
}
}
}
string fullDir = Path.GetDirectoryName(fullPath) ?? "";
if (string.IsNullOrWhiteSpace(fullDir))
{
throw new Exception("TargetPath无效无法获取目录");
}
// 创建目录支持UNC
// 如果是 UNC 路径,先建立网络连接
EnsureNetworkConnection(fullDir);
if (!Directory.Exists(fullDir))
{
Directory.CreateDirectory(fullDir);
}
// 写入文件(覆盖或新增)
File.WriteAllBytes(fullPath, bytes);
result.Code = "200";
result.Message = "上传成功";
}
catch (Exception ex)
{
result.Code = "500";
result.Message = ex.Message;
}
string retString = JsonConvert.SerializeObject(result);
MyLogHelper.Info("上传图片到共享路径_res", retString);
return retString;
}
/// <summary>
/// 获取产品生产状态
/// </summary>
/// <param name="url"></param>
/// <param name="jobj"></param>
/// <returns></returns>
public static string GetSfcStatusAndOperation(string url, [FromBody] JObject jobj)
{
var result = new GetSfcStatusRes();
result.MsgId = "";
result.Message = "";
result.Code = "200";
if (jobj == null)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
MyLogHelper.Info("获取产品生产状态_res", retString1);
return retString1;
}
string str = jobj.ToString();
try
{
// 日志记录
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var param = new SqlParameter[] {
new SqlParameter("@接口地址", url),
new SqlParameter("@接口类型", 2),
new SqlParameter("@请求内容", str),
new SqlParameter("@请求时间", CreateTime)
};
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out string errorMessage);
// 解析请求
GetSfcStatusReq req = JsonConvert.DeserializeObject<GetSfcStatusReq>(str);
if (req == null)
{
throw new Exception("请求体解析失败!");
}
if (string.IsNullOrWhiteSpace(req.MsgId))
{
throw new Exception("参数MsgId为空");
}
result.MsgId = req.MsgId;
if (string.IsNullOrWhiteSpace(req.Barcode))
{
throw new Exception("参数Barcode为空");
}
string barcode = req.Barcode.Trim();
// 调用接口
CallWebService.Call_getSfcStatusAndOperation(barcode, out string statusBO, out string operation, out string productStatus, out string opStation, out string code, out string message);
// 设置返回结果
//result.StatusBO = statusBO;
//result.Operation = operation;
result.ProductStatus = productStatus;
result.OpStation = opStation;
if (code == "0")
{
result.Code = "200";
result.Message = "查询成功";
}
else
{
result.Code = code;
result.Message = message;
}
}
catch (Exception ex)
{
result.Code = "500";
result.Message = ex.Message;
}
string retString = JsonConvert.SerializeObject(result);
MyLogHelper.Info("获取产品生产状态_res", retString);
return retString;
}
/// <summary>
/// 确保网络共享连接可用(针对 UNC 路径)
/// </summary>
/// <param name="uncPath">UNC 路径或普通路径</param>
private static void EnsureNetworkConnection(string uncPath)
{
if (string.IsNullOrWhiteSpace(uncPath) || !uncPath.StartsWith(@"\\"))
{
return; // 非 UNC 路径,无需处理
}
try
{
// 从 UNC 路径中提取服务器和共享名,如 \\server\share
string[] parts = uncPath.TrimStart('\\').Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length < 2)
{
return; // 无法解析
}
string shareRoot = $@"\\{parts[0]}\{parts[1]}";
// 使用 net use 建立连接(若已存在则会快速返回)
var psi = new System.Diagnostics.ProcessStartInfo
{
FileName = "net",
Arguments = $"use \"{shareRoot}\" /user:{ImageShareUser} {ImageSharePassword}",
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true
};
using (var proc = System.Diagnostics.Process.Start(psi))
{
proc.WaitForExit(5000); // 最多等待 5 秒
// 忽略返回码,允许"已连接"等情况
}
}
catch (Exception ex)
{
MyLogHelper.Error("EnsureNetworkConnection", $"建立网络连接失败: {ex.Message}");
// 不抛异常,后续文件操作会给出更具体的错误
}
}
/// <summary>
/// 获取客户标签码
/// </summary>
/// <param name="url"></param>
/// <param name="jobj"></param>
/// <returns></returns>
public static string GetClientTagValue(string url, [FromBody] JObject jobj)
{
var result = new GetClientTagValueRes();
result.MsgId = "";
result.Message = "";
result.Code = "200";
if (jobj == null)
{
result.Code = "500";
result.Message = "参数格式不正确!";
string retString1 = JsonConvert.SerializeObject(result);
MyLogHelper.Info("获取客户标签码_res", retString1);
return retString1;
}
string str = jobj.ToString();
try
{
GetClientTagValueReq req = JsonConvert.DeserializeObject<GetClientTagValueReq>(str);
if (req == null)
{
throw new Exception("请求体解析失败!");
}
if (string.IsNullOrWhiteSpace(req.MsgId))
{
throw new Exception("参数MsgId为空");
}
result.MsgId = req.MsgId;
if (string.IsNullOrWhiteSpace(req.EngineID))
{
throw new Exception("参数EngineID为空");
}
if (req.EngineTypeID <= 0)
{
throw new Exception("参数EngineTypeID无效");
}
string engineID = req.EngineID.Trim();
int engineTypeID = req.EngineTypeID;
string opName = "OP490-3";
string tagValue = MisDataFunDll.MisDataFun.GetMesClientTagValue(opName, engineID, engineTypeID);
if (string.IsNullOrEmpty(tagValue))
{
result.Code = "500";
result.Message = "获取客户标签码失败,无可用客户标签码!";
}
else
{
result.Code = "200";
result.Message = "获取成功";
result.TagValue = tagValue;
}
}
catch (Exception ex)
{
result.Code = "500";
result.Message = ex.Message;
}
string retString = JsonConvert.SerializeObject(result);
return retString;
}
}
public class ApiFailRetryData
{
/// <summary>
/// MsgId
/// </summary>
public string MsgId { get; set; } = "";
public int UserId { get; set; } = 0;
public string OpName { get; set; }
public string Type { get; set; }
}
public class FirstProductUpLoadReq
{
/// <summary>
/// 唯一Id
/// </summary>
public string MsgId { get; set; } = "";
/// <summary>
/// 工位号
/// </summary>
public string OpName { get; set; }
}
public class UploadImageToShareReq
{
/// <summary>
/// 唯一Id
/// </summary>
public string MsgId { get; set; } = "";
/// <summary>
/// 目标共享目录或完整目录,如 \\Cait-officefile\mes\首件照片\OP120(固定架装配)\2025-08-30
/// </summary>
public string TargetPath { get; set; }
/// <summary>
/// 文件名,如 20250830-094503.png
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 相对共享根目录的相对路径,如 OP120(固定架装配)\\2025-08-30\\20250830-094503.png
/// 与 TargetPath+FileName 二选一
/// </summary>
public string RelativePath { get; set; }
/// <summary>
/// 图片Base64可含 data:image/png;base64, 前缀)
/// </summary>
public string ImageBase64 { get; set; }
}
public class GetSfcStatusReq
{
/// <summary>
/// 唯一Id
/// </summary>
public string MsgId { get; set; } = "";
/// <summary>
/// 产品条码
/// </summary>
public string Barcode { get; set; }
}
public class GetSfcStatusRes
{
public string MsgId { get; set; } = "";
public string Code { get; set; } = "200";
public string Message { get; set; } = "";
/// <summary>
/// 状态代码(原始值)
/// </summary>
//public string StatusBO { get; set; } = "";
/// <summary>
/// 操作编号(原始值)
/// </summary>
//public string Operation { get; set; } = "";
/// <summary>
/// 产品状态(转换后)
/// </summary>
public string ProductStatus { get; set; } = "";
/// <summary>
/// 工位号(转换后)
/// </summary>
public string OpStation { get; set; } = "";
}
public class TriggerDeviceAlarmReq
{
/// <summary>
/// 唯一Id
/// </summary>
public string MsgId { get; set; } = "";
/// <summary>
/// 工位号,如 OP120
/// </summary>
public string OpName { get; set; }
/// <summary>
/// 报警文本,如 安灯呼叫报警
/// </summary>
public string AlarmText { get; set; }
/// <summary>
/// 报警代码,如 10005
/// </summary>
public string AlarmCode { get; set; }
}
public class GetClientTagValueReq
{
/// <summary>
/// 唯一Id
/// </summary>
public string MsgId { get; set; } = "";
/// <summary>
/// 产品编号
/// </summary>
public string EngineID { get; set; }
/// <summary>
/// 产品型号代码
/// </summary>
public int EngineTypeID { get; set; }
}
public class GetClientTagValueRes
{
public string MsgId { get; set; } = "";
public string Code { get; set; } = "200";
public string Message { get; set; } = "";
/// <summary>
/// 客户标签码值
/// </summary>
public string TagValue { get; set; } = "";
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MisDataSaveDate
{
public class msgResHeader
{
/// <summary>
/// 任务ID
/// </summary>
public string MsgId
{
get;
set;
}
/// <summary>
/// 返回结果
/// </summary>
public string Code
{
get;
set;
}
/// <summary>
/// 返回消息
/// </summary>
public string Message
{
get;
set;
}
/// <summary>
/// 返回数据
/// </summary>
public string Data
{
get;
set;
}
}
public class msgResHeader2
{
/// <summary>
/// 任务ID
/// </summary>
public string MsgId
{
get;
set;
}
/// <summary>
/// 返回结果
/// </summary>
public string Code
{
get;
set;
}
/// <summary>
/// 返回消息
/// </summary>
public string Message
{
get;
set;
}
/// <summary>
/// 返回数据
/// </summary>
public checkCountData Data
{
get;
set;
}
}
public class checkCountData
{
/// <summary>
/// 检测次数
/// </summary>
public int CheckCountOk
{
get;
set;
}
/// <summary>
/// 检测次数
/// </summary>
public int CheckCountNg
{
get;
set;
}
}
}