Compare commits

...

10 Commits

Author SHA1 Message Date
0e3250c8b8 上传当前项目状态 2026-05-23 13:54:15 +08:00
XingCheng3
3b871f24b3 增加开机自启配置 2026-05-16 14:50:22 +08:00
XingCheng3
9aaa9a97e9 添加配置跳过重量前N个点 2026-05-16 13:53:41 +08:00
XingCheng3
e11c727114 增加码块订货号解析顺序配置项 2026-05-16 13:48:12 +08:00
XingCheng3
bb307f01db 隐藏主界面报警显示 2026-05-16 13:38:18 +08:00
XingCheng3
e0391dc32f 增加 兜底时记录订货号 增加常量 app.config配置文件 2026-05-14 13:06:53 +08:00
XingCheng3
fa121f4ab8 增加 称重分析 点位Tip弹窗显示点位详细信息 2026-05-13 01:35:16 +08:00
XingCheng3
185b197be2 简化无用参数 2026-05-13 01:25:44 +08:00
XingCheng3
8784a5a982 称重分析模块新增 2026-05-13 01:22:00 +08:00
XingCheng3
134a06a31d 改回水含量和合格结果UI 2026-05-13 01:09:21 +08:00
42 changed files with 24720 additions and 24305 deletions

13
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Framework: WC_GKJ_OIL",
"type": "clr",
"request": "launch",
"program": "${workspaceFolder}\\WC_GKJ_OIL_EXE\\WC_GKJ_OIL.exe",
"cwd": "${workspaceFolder}\\WC_GKJ_OIL_EXE",
"preLaunchTask": "build Debug"
}
]
}

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"dotnet.preferCSharpExtension": true
}

22
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build Debug",
"type": "process",
"command": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe",
"args": [
"${workspaceFolder}\\WC_GKJ_OIL_SLN.sln",
"/restore",
"/m",
"/p:Configuration=Debug",
"/p:Platform=Any CPU"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,57 +1,57 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}</ProjectGuid> <ProjectGuid>{1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MW_Log</RootNamespace> <RootNamespace>MW_Log</RootNamespace>
<AssemblyName>MW_Log</AssemblyName> <AssemblyName>MW_Log</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net"> <Reference Include="log4net">
<HintPath>..\DLL\log4net.dll</HintPath> <HintPath>..\DLL\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="LoggerHelper.cs" /> <Compile Include="LoggerHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="log4net.config"> <None Include="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -1,49 +1,49 @@
using log4net; using log4net;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace MW_Log namespace MW_Log
{ {
/// <summary> /// <summary>
/// LoggerHelper /// LoggerHelper
/// </summary> /// </summary>
public class LoggerHelper public class LoggerHelper
{ {
/// <summary> /// <summary>
/// LogInfo /// LogInfo
/// </summary> /// </summary>
private static readonly ILog LogInfo = LogManager.GetLogger("LogInfo"); private static readonly ILog LogInfo = LogManager.GetLogger("LogInfo");
/// <summary> /// <summary>
/// 记录Info日志 /// 记录Info日志
/// </summary> /// </summary>
/// <param name="msg"></param> /// <param name="msg"></param>
/// <param name="ex"></param> /// <param name="ex"></param>
public static void Info(string type, string msg, Exception ex = null) public static void Info(string type, string msg, Exception ex = null)
{ {
try try
{ {
msg = $"【类别:{type}】\r\n【内容】{msg}"; msg = $"【类别:{type}】\r\n【内容】{msg}";
if (ex != null) if (ex != null)
{ {
LogInfo.Info(msg, ex); LogInfo.Info(msg, ex);
} }
else else
{ {
LogInfo.Info(msg); LogInfo.Info(msg);
} }
} }
catch (Exception err) catch (Exception err)
{ {
} }
} }
} }
} }

View File

@@ -1,37 +1,37 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下 // 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改 // 控制。更改这些特性值可修改
// 与程序集关联的信息。 // 与程序集关联的信息。
[assembly: AssemblyTitle("MW_Log")] [assembly: AssemblyTitle("MW_Log")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MW_Log")] [assembly: AssemblyProduct("MW_Log")]
[assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型 // 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。 //请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1ac112c4-2400-4d03-a26d-2e3ace6fe6d4")] [assembly: Guid("1ac112c4-2400-4d03-a26d-2e3ace6fe6d4")]
// 程序集的版本信息由下列四个值组成: // 程序集的版本信息由下列四个值组成:
// //
// 主版本 // 主版本
// 次版本 // 次版本
// 生成号 // 生成号
// 修订号 // 修订号
// //
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)] [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]

View File

@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<configSections> <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections> </configSections>
<log4net> <log4net>
<!--Info日志--> <!--Info日志-->
<appender name="InfoAppender" type="log4net.Appender.RollingFileAppender"> <appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
<!--日志文件存放位置,可以为绝对路径也可以为相对路径 --> <!--日志文件存放位置,可以为绝对路径也可以为相对路径 -->
<param name="File" value="C:\MWLOG" /> <param name="File" value="C:\MWLOG" />
<!--是否支持分割文件--> <!--是否支持分割文件-->
<param name="AppendToFile" value="true" /> <param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" /> <param name="MaxFileSize" value="10240" />
<!--当日志文件达到MaxFileSize大小就自动创建备份文件。--> <!--当日志文件达到MaxFileSize大小就自动创建备份文件。-->
<param name="MaxSizeRollBackups" value="100" /> <param name="MaxSizeRollBackups" value="100" />
<!-- 当将日期作为日志文件的名字时必须将staticLogFileName的值设置为false --> <!-- 当将日期作为日志文件的名字时必须将staticLogFileName的值设置为false -->
<param name="StaticLogFileName" value="false" /> <param name="StaticLogFileName" value="false" />
<!-- 日志文件的命名规则 --> <!-- 日志文件的命名规则 -->
<param name="DatePattern" value="\\yyyy_MM\\yyyy_MM_dd'.log'" /> <param name="DatePattern" value="\\yyyy_MM\\yyyy_MM_dd'.log'" />
<!--日志文件的记录形式--> <!--日志文件的记录形式-->
<param name="RollingStyle" value="Date" /> <param name="RollingStyle" value="Date" />
<!--日志文件的布局格式:%newline【%date】【级别%-5level】【线程ID%thread】%n【内容】%message%newline %n%n--> <!--日志文件的布局格式:%newline【%date】【级别%-5level】【线程ID%thread】%n【内容】%message%newline %n%n-->
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="【%date】【线程ID%thread】%message%newline %n%n" /> <conversionPattern value="【%date】【线程ID%thread】%message%newline %n%n" />
</layout> </layout>
</appender> </appender>
<!--Info日志--> <!--Info日志-->
<logger name="LogInfo"> <logger name="LogInfo">
<level value="INFO" /> <level value="INFO" />
<appender-ref ref="InfoAppender" /> <appender-ref ref="InfoAppender" />
</logger> </logger>
</log4net> </log4net>
</configuration> </configuration>

View File

@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<configSections> <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections> </configSections>
<log4net> <log4net>
<!--Info日志--> <!--Info日志-->
<appender name="InfoAppender" type="log4net.Appender.RollingFileAppender"> <appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
<!--日志文件存放位置,可以为绝对路径也可以为相对路径 --> <!--日志文件存放位置,可以为绝对路径也可以为相对路径 -->
<param name="File" value="C:\MWLOG" /> <param name="File" value="C:\MWLOG" />
<!--是否支持分割文件--> <!--是否支持分割文件-->
<param name="AppendToFile" value="true" /> <param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" /> <param name="MaxFileSize" value="10240" />
<!--当日志文件达到MaxFileSize大小就自动创建备份文件。--> <!--当日志文件达到MaxFileSize大小就自动创建备份文件。-->
<param name="MaxSizeRollBackups" value="100" /> <param name="MaxSizeRollBackups" value="100" />
<!-- 当将日期作为日志文件的名字时必须将staticLogFileName的值设置为false --> <!-- 当将日期作为日志文件的名字时必须将staticLogFileName的值设置为false -->
<param name="StaticLogFileName" value="false" /> <param name="StaticLogFileName" value="false" />
<!-- 日志文件的命名规则 --> <!-- 日志文件的命名规则 -->
<param name="DatePattern" value="\\yyyy_MM\\yyyy_MM_dd'.log'" /> <param name="DatePattern" value="\\yyyy_MM\\yyyy_MM_dd'.log'" />
<!--日志文件的记录形式--> <!--日志文件的记录形式-->
<param name="RollingStyle" value="Date" /> <param name="RollingStyle" value="Date" />
<!--日志文件的布局格式:%newline【%date】【级别%-5level】【线程ID%thread】%n【内容】%message%newline %n%n--> <!--日志文件的布局格式:%newline【%date】【级别%-5level】【线程ID%thread】%n【内容】%message%newline %n%n-->
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="【%date】【线程ID%thread】%message%newline %n%n" /> <conversionPattern value="【%date】【线程ID%thread】%message%newline %n%n" />
</layout> </layout>
</appender> </appender>
<!--Info日志--> <!--Info日志-->
<logger name="LogInfo"> <logger name="LogInfo">
<level value="INFO" /> <level value="INFO" />
<appender-ref ref="InfoAppender" /> <appender-ref ref="InfoAppender" />
</logger> </logger>
</log4net> </log4net>
</configuration> </configuration>

View File

@@ -1,39 +1,40 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="IsDemoMesServer" value="1"/> <add key="IsDemoMesServer" value="0"/>
<add key="BasicDataTableFile" value="SignalTable_CZ.xlsx"/> <add key="BasicDataTableFile" value="SignalTable_CZ.xlsx"/>
<add key="IsAllowWrite" value="1"/> <add key="IsAllowWrite" value="1"/>
<!--是启用写监控报错日志--> <!--是启用写监控报错日志-->
<add key="IsWriteMonitorLog" value="0"/> <add key="IsWriteMonitorLog" value="0"/>
<add key="IsWriteLog4" value="1"/> <add key="IsWriteLog4" value="1"/>
<!--称重类型Ground=地面称重(两独立工位), Hanging=空中称重/吊称(放油前+放油后)--> <!--称重类型Ground=地面称重(两独立工位), Hanging=空中称重/吊称(放油前+放油后)-->
<add key="WeighingType" value="Hanging"/> <add key="WeighingType" value="Hanging"/>
<!--逻辑工位映射必须与SignalTable_CZ.xlsx的设备类型对应表工位号一致--> <!--码块订货号解析顺序0=订货号在前/流水号在后, 1=流水号在前/订货号在后-->
<add key="Station1OpName" value="ST04"/> <add key="CodeBlockOrderNoReverse" value="0"/>
<add key="Station2OpName" value="ST05"/> <!--逻辑工位映射必须与SignalTable_CZ.xlsx的设备类型对应表工位号一致-->
<!--数据库连接--> <add key="Station1OpName" value="ST04"/>
<add key="ConnectionString" value="server=.,1333;database=MESBasicDB_WC_CZGKJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000"/> <add key="Station2OpName" value="ST05"/>
<!--数据库连接-->
<add key="ConnectionString" value="server=LAPTOP-ELBDN3OJ\SQLEXPRESS;database=MESBasicDB_WC_CZGKJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000"/>
<!--WebApi--> <!--WebApi-->
<add key="WebApi_Port" value="9981"/> <add key="WebApi_Port" value="9981"/>
<!--扫码枪1=启用, 0=禁用-->
<add key="WebApi_ReqUrl_WMS_Call" value="http://127.0.0.1:9981/api/wms/msgRequest_WMS_Call"/> <add key="IsUseBarcode" value="0"/>
<add key="WebApi_ReqUrl_WMS_Return" value="http://127.0.0.1:9981/api/wms/msgRequest_WMS_Return"/> <!--工位1扫码枪COM口如COM3-->
<add key="WebUrl_AGV_HK" value=" http://127.0.0.1:9981/api/agv/MES_To_AGV_HK_Continue" /> <add key="Station1BarCOM" value="COM2"/>
<add key="WebUrl_AGV_HK_CTU" value="http://127.0.0.1:9981/api/agv/MES_To_AGV_HK_CTU" /> <!--工位2扫码枪COM口如COM4-->
<add key="Station2BarCOM" value="COM3"/>
<add key="WebUrl_AGV_HK_agvCallback" value="http://127.0.0.1:9981/api/agv/agvCallback" />
<!--扫码枪1=启用, 0=禁用-->
<add key="IsUseBarcode" value="0"/>
<!--工位1扫码枪COM口如COM3-->
<add key="Station1BarCOM" value="COM2"/>
<!--工位2扫码枪COM口如COM4-->
<add key="Station2BarCOM" value="COM3"/>
<!--扫码枪波特率--> <!--扫码枪波特率-->
<add key="BarcodeBaudRate" value="9600"/> <add key="BarcodeBaudRate" value="9600"/>
<!--曲线采样间隔(ms)-->
<add key="CurveCollectorSampleIntervalMs" value="200"/>
<!--曲线稳定窗口点数-->
<add key="CurveStableWindowSize" value="20"/>
<!--最终重量计算时跳过前置称重点数0=不跳过-->
<add key="CurveStableSkipStartPointCount" value="50"/>
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>

View File

@@ -41,12 +41,8 @@ namespace MesWork
public static int IsWriteLog4 = Convert.ToInt32(AppSettings["IsWriteLog4"]); public static int IsWriteLog4 = Convert.ToInt32(AppSettings["IsWriteLog4"]);
public static string ConnectionString = AppSettings["ConnectionString"]; public static string ConnectionString = AppSettings["ConnectionString"];
public static string AuthorizationSet = AppSettings["AuthorizationSet"];
public static int WebApi_Port = Convert.ToInt32(AppSettings["WebApi_Port"]); public static int WebApi_Port = Convert.ToInt32(AppSettings["WebApi_Port"]);
public static string WebApi_ReqUrl = AppSettings["WebApi_ReqUrl"];
/// <summary> /// <summary>
/// 当前工位号 /// 当前工位号
/// </summary> /// </summary>
@@ -57,6 +53,11 @@ namespace MesWork
/// </summary> /// </summary>
public static string WeighingType = AppSettings["WeighingType"] ?? "Hanging"; public static string WeighingType = AppSettings["WeighingType"] ?? "Hanging";
/// <summary>
/// 码块订货号解析顺序0=订货号在前, 1=流水号在前
/// </summary>
public static int CodeBlockOrderNoReverse = int.TryParse(AppSettings["CodeBlockOrderNoReverse"], out var _cbonr) ? _cbonr : 0;
/// <summary> /// <summary>
/// 工位1现场工位号Hanging模式下代表放油前工位 /// 工位1现场工位号Hanging模式下代表放油前工位
/// </summary> /// </summary>
@@ -169,6 +170,8 @@ namespace MesWork
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
new System.Threading.Mutex(true, $"MES_PWT_A95", out bool bCanRun); new System.Threading.Mutex(true, $"MES_PWT_A95", out bool bCanRun);
if (!bCanRun) if (!bCanRun)
{ {

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -17,163 +17,160 @@ namespace MesWork
private void InitializeComponent() private void InitializeComponent()
{ {
this.pnl_Card = new System.Windows.Forms.Panel(); this.pnl_Card = new System.Windows.Forms.Panel();
this.lbl_Title = new System.Windows.Forms.Label(); this.lbl_Title = new System.Windows.Forms.Label();
this.lbl_SubTitle = new System.Windows.Forms.Label(); this.lbl_SubTitle = new System.Windows.Forms.Label();
this.lbl_User = new System.Windows.Forms.Label(); this.lbl_User = new System.Windows.Forms.Label();
this.txt_LoginID = new System.Windows.Forms.TextBox(); this.txt_LoginID = new System.Windows.Forms.TextBox();
this.lbl_Pwd = new System.Windows.Forms.Label(); this.lbl_Pwd = new System.Windows.Forms.Label();
this.txt_userPassword = new System.Windows.Forms.TextBox(); this.txt_userPassword = new System.Windows.Forms.TextBox();
this.btn_Login = new System.Windows.Forms.Button(); this.btn_Login = new System.Windows.Forms.Button();
this.btn_Cancel = new System.Windows.Forms.Button(); this.btn_Cancel = new System.Windows.Forms.Button();
this.lbl_Msg = new System.Windows.Forms.Label(); this.lbl_Msg = new System.Windows.Forms.Label();
this.pnl_Card.SuspendLayout(); this.pnl_Card.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// pnl_Card - 白色登录卡片 // pnl_Card
// //
this.pnl_Card.BackColor = System.Drawing.Color.White; this.pnl_Card.BackColor = System.Drawing.Color.White;
this.pnl_Card.Location = new System.Drawing.Point(310, 180); this.pnl_Card.Controls.Add(this.lbl_Title);
this.pnl_Card.Name = "pnl_Card"; this.pnl_Card.Controls.Add(this.lbl_SubTitle);
this.pnl_Card.Size = new System.Drawing.Size(400, 380); this.pnl_Card.Controls.Add(this.lbl_User);
this.pnl_Card.TabIndex = 0; this.pnl_Card.Controls.Add(this.txt_LoginID);
this.pnl_Card.Paint += new System.Windows.Forms.PaintEventHandler(this.pnl_Card_Paint); this.pnl_Card.Controls.Add(this.lbl_Pwd);
// this.pnl_Card.Controls.Add(this.txt_userPassword);
// lbl_Title - 系统图标+名称 this.pnl_Card.Controls.Add(this.btn_Login);
// this.pnl_Card.Controls.Add(this.btn_Cancel);
this.lbl_Title.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold); this.pnl_Card.Controls.Add(this.lbl_Msg);
this.lbl_Title.ForeColor = System.Drawing.Color.FromArgb(30, 58, 95); this.pnl_Card.Location = new System.Drawing.Point(310, 180);
this.lbl_Title.Location = new System.Drawing.Point(20, 30); this.pnl_Card.Name = "pnl_Card";
this.lbl_Title.Name = "lbl_Title"; this.pnl_Card.Size = new System.Drawing.Size(400, 380);
this.lbl_Title.Size = new System.Drawing.Size(360, 40); this.pnl_Card.TabIndex = 0;
this.lbl_Title.TabIndex = 0; this.pnl_Card.Paint += new System.Windows.Forms.PaintEventHandler(this.pnl_Card_Paint);
this.lbl_Title.Text = "⚖ 称重数据采集分析"; //
this.lbl_Title.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // lbl_Title
// //
// lbl_SubTitle this.lbl_Title.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold);
// this.lbl_Title.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(58)))), ((int)(((byte)(95)))));
this.lbl_SubTitle.Font = new System.Drawing.Font("微软雅黑", 11F); this.lbl_Title.Location = new System.Drawing.Point(20, 30);
this.lbl_SubTitle.ForeColor = System.Drawing.Color.FromArgb(107, 114, 128); this.lbl_Title.Name = "lbl_Title";
this.lbl_SubTitle.Location = new System.Drawing.Point(20, 72); this.lbl_Title.Size = new System.Drawing.Size(360, 40);
this.lbl_SubTitle.Name = "lbl_SubTitle"; this.lbl_Title.TabIndex = 0;
this.lbl_SubTitle.Size = new System.Drawing.Size(360, 24); this.lbl_Title.Text = "⚖ 称重数据采集分析";
this.lbl_SubTitle.TabIndex = 1; this.lbl_Title.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lbl_SubTitle.Text = "管理系统"; //
this.lbl_SubTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // lbl_SubTitle
// //
// lbl_User this.lbl_SubTitle.Font = new System.Drawing.Font("微软雅黑", 11F);
// this.lbl_SubTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(114)))), ((int)(((byte)(128)))));
this.lbl_User.Font = new System.Drawing.Font("微软雅黑", 10F); this.lbl_SubTitle.Location = new System.Drawing.Point(20, 72);
this.lbl_User.ForeColor = System.Drawing.Color.FromArgb(55, 65, 81); this.lbl_SubTitle.Name = "lbl_SubTitle";
this.lbl_User.Location = new System.Drawing.Point(40, 120); this.lbl_SubTitle.Size = new System.Drawing.Size(360, 24);
this.lbl_User.Name = "lbl_User"; this.lbl_SubTitle.TabIndex = 1;
this.lbl_User.Size = new System.Drawing.Size(60, 24); this.lbl_SubTitle.Text = "管理系统";
this.lbl_User.TabIndex = 2; this.lbl_SubTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lbl_User.Text = "👤 用户名"; //
// // lbl_User
// txt_LoginID //
// this.lbl_User.Font = new System.Drawing.Font("微软雅黑", 10F);
this.txt_LoginID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lbl_User.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(55)))), ((int)(((byte)(65)))), ((int)(((byte)(81)))));
this.txt_LoginID.Font = new System.Drawing.Font("微软雅黑", 12F); this.lbl_User.Location = new System.Drawing.Point(40, 120);
this.txt_LoginID.Location = new System.Drawing.Point(40, 148); this.lbl_User.Name = "lbl_User";
this.txt_LoginID.Name = "txt_LoginID"; this.lbl_User.Size = new System.Drawing.Size(60, 24);
this.txt_LoginID.Size = new System.Drawing.Size(320, 29); this.lbl_User.TabIndex = 2;
this.txt_LoginID.TabIndex = 1; this.lbl_User.Text = "👤 用户名";
this.txt_LoginID.Text = "admin"; //
this.txt_LoginID.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_LoginID_KeyDown); // txt_LoginID
// //
// lbl_Pwd this.txt_LoginID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
// this.txt_LoginID.Font = new System.Drawing.Font("微软雅黑", 12F);
this.lbl_Pwd.Font = new System.Drawing.Font("微软雅黑", 10F); this.txt_LoginID.Location = new System.Drawing.Point(40, 148);
this.lbl_Pwd.ForeColor = System.Drawing.Color.FromArgb(55, 65, 81); this.txt_LoginID.Name = "txt_LoginID";
this.lbl_Pwd.Location = new System.Drawing.Point(40, 195); this.txt_LoginID.Size = new System.Drawing.Size(320, 29);
this.lbl_Pwd.Name = "lbl_Pwd"; this.txt_LoginID.TabIndex = 1;
this.lbl_Pwd.Size = new System.Drawing.Size(60, 24); this.txt_LoginID.Text = "admin";
this.lbl_Pwd.TabIndex = 4; this.txt_LoginID.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_LoginID_KeyDown);
this.lbl_Pwd.Text = "🔒 密码"; //
// // lbl_Pwd
// txt_userPassword //
// this.lbl_Pwd.Font = new System.Drawing.Font("微软雅黑", 10F);
this.txt_userPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lbl_Pwd.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(55)))), ((int)(((byte)(65)))), ((int)(((byte)(81)))));
this.txt_userPassword.Font = new System.Drawing.Font("微软雅黑", 12F); this.lbl_Pwd.Location = new System.Drawing.Point(40, 195);
this.txt_userPassword.Location = new System.Drawing.Point(40, 223); this.lbl_Pwd.Name = "lbl_Pwd";
this.txt_userPassword.Name = "txt_userPassword"; this.lbl_Pwd.Size = new System.Drawing.Size(60, 24);
this.txt_userPassword.PasswordChar = '*'; this.lbl_Pwd.TabIndex = 4;
this.txt_userPassword.Size = new System.Drawing.Size(320, 29); this.lbl_Pwd.Text = "🔒 密码";
this.txt_userPassword.TabIndex = 2; //
this.txt_userPassword.Text = "admin"; // txt_userPassword
this.txt_userPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_userPassword_KeyDown); //
// this.txt_userPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
// btn_Login - Steel Blue 主按钮 this.txt_userPassword.Font = new System.Drawing.Font("微软雅黑", 12F);
// this.txt_userPassword.Location = new System.Drawing.Point(40, 223);
this.btn_Login.BackColor = System.Drawing.Color.FromArgb(74, 144, 217); this.txt_userPassword.Name = "txt_userPassword";
this.btn_Login.Cursor = System.Windows.Forms.Cursors.Hand; this.txt_userPassword.PasswordChar = '*';
this.btn_Login.FlatAppearance.BorderSize = 0; this.txt_userPassword.Size = new System.Drawing.Size(320, 29);
this.btn_Login.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.txt_userPassword.TabIndex = 2;
this.btn_Login.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold); this.txt_userPassword.Text = "admin";
this.btn_Login.ForeColor = System.Drawing.Color.White; this.txt_userPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_userPassword_KeyDown);
this.btn_Login.Location = new System.Drawing.Point(40, 280); //
this.btn_Login.Name = "btn_Login"; // btn_Login
this.btn_Login.Size = new System.Drawing.Size(150, 42); //
this.btn_Login.TabIndex = 3; this.btn_Login.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(144)))), ((int)(((byte)(217)))));
this.btn_Login.Text = "登 录"; this.btn_Login.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_Login.UseVisualStyleBackColor = false; this.btn_Login.FlatAppearance.BorderSize = 0;
this.btn_Login.Click += new System.EventHandler(this.btn_Login_Click); this.btn_Login.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
// this.btn_Login.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
// btn_Cancel - 灰色边框按钮 this.btn_Login.ForeColor = System.Drawing.Color.White;
// this.btn_Login.Location = new System.Drawing.Point(40, 280);
this.btn_Cancel.BackColor = System.Drawing.Color.White; this.btn_Login.Name = "btn_Login";
this.btn_Cancel.Cursor = System.Windows.Forms.Cursors.Hand; this.btn_Login.Size = new System.Drawing.Size(150, 42);
this.btn_Cancel.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(209, 213, 219); this.btn_Login.TabIndex = 3;
this.btn_Cancel.FlatAppearance.BorderSize = 1; this.btn_Login.Text = "登 录";
this.btn_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_Login.UseVisualStyleBackColor = false;
this.btn_Cancel.Font = new System.Drawing.Font("微软雅黑", 12F); this.btn_Login.Click += new System.EventHandler(this.btn_Login_Click);
this.btn_Cancel.ForeColor = System.Drawing.Color.FromArgb(107, 114, 128); //
this.btn_Cancel.Location = new System.Drawing.Point(210, 280); // btn_Cancel
this.btn_Cancel.Name = "btn_Cancel"; //
this.btn_Cancel.Size = new System.Drawing.Size(150, 42); this.btn_Cancel.BackColor = System.Drawing.Color.White;
this.btn_Cancel.TabIndex = 4; this.btn_Cancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_Cancel.Text = "取 消"; this.btn_Cancel.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(209)))), ((int)(((byte)(213)))), ((int)(((byte)(219)))));
this.btn_Cancel.UseVisualStyleBackColor = false; this.btn_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click); this.btn_Cancel.Font = new System.Drawing.Font("微软雅黑", 12F);
// this.btn_Cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(114)))), ((int)(((byte)(128)))));
// lbl_Msg this.btn_Cancel.Location = new System.Drawing.Point(210, 280);
// this.btn_Cancel.Name = "btn_Cancel";
this.lbl_Msg.Font = new System.Drawing.Font("微软雅黑", 9F); this.btn_Cancel.Size = new System.Drawing.Size(150, 42);
this.lbl_Msg.ForeColor = System.Drawing.Color.FromArgb(239, 68, 68); this.btn_Cancel.TabIndex = 4;
this.lbl_Msg.Location = new System.Drawing.Point(40, 332); this.btn_Cancel.Text = "取 消";
this.lbl_Msg.Name = "lbl_Msg"; this.btn_Cancel.UseVisualStyleBackColor = false;
this.lbl_Msg.Size = new System.Drawing.Size(320, 24); this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click);
this.lbl_Msg.TabIndex = 8; //
this.lbl_Msg.Visible = false; // lbl_Msg
// //
// 添加控件到卡片 this.lbl_Msg.Font = new System.Drawing.Font("微软雅黑", 9F);
// this.lbl_Msg.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.pnl_Card.Controls.Add(this.lbl_Title); this.lbl_Msg.Location = new System.Drawing.Point(40, 332);
this.pnl_Card.Controls.Add(this.lbl_SubTitle); this.lbl_Msg.Name = "lbl_Msg";
this.pnl_Card.Controls.Add(this.lbl_User); this.lbl_Msg.Size = new System.Drawing.Size(320, 24);
this.pnl_Card.Controls.Add(this.txt_LoginID); this.lbl_Msg.TabIndex = 8;
this.pnl_Card.Controls.Add(this.lbl_Pwd); this.lbl_Msg.Visible = false;
this.pnl_Card.Controls.Add(this.txt_userPassword); //
this.pnl_Card.Controls.Add(this.btn_Login); // Frm_Login
this.pnl_Card.Controls.Add(this.btn_Cancel); //
this.pnl_Card.Controls.Add(this.lbl_Msg); this.AcceptButton = this.btn_Login;
// this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
// Frm_Login this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
// this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(244)))), ((int)(((byte)(248)))));
this.AcceptButton = this.btn_Login; this.ClientSize = new System.Drawing.Size(1024, 720);
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.Controls.Add(this.pnl_Card);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.BackColor = System.Drawing.Color.FromArgb(240, 244, 248); this.Name = "Frm_Login";
this.ClientSize = new System.Drawing.Size(1024, 720); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Controls.Add(this.pnl_Card); this.Text = "称重数据采集分析管理系统 - 登录";
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.pnl_Card.ResumeLayout(false);
this.Name = "Frm_Login"; this.pnl_Card.PerformLayout();
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.ResumeLayout(false);
this.Text = "称重数据采集分析管理系统 - 登录";
this.pnl_Card.ResumeLayout(false);
this.pnl_Card.PerformLayout();
this.ResumeLayout(false);
} }
#endregion #endregion

View File

@@ -152,6 +152,8 @@ namespace MesWork
MesWorkForm.Curr_UserPassWord = txt_userPassword.Text; MesWorkForm.Curr_UserPassWord = txt_userPassword.Text;
MesWorkForm.Curr_UserName = name; MesWorkForm.Curr_UserName = name;
B_DB_Opera.LoginState_Save(MesWorkForm.Curr_LoginID, MesWorkForm.Curr_UserName, perm);
// 记录登录日志 // 记录登录日志
try { B_DB_Opera.SaveLog_Request(MesWorkForm.Curr_Station, Log_Type.ZK_Login, "", Log_FromAndTo.ZK, Log_FromAndTo.ZK, $"用户[{name}({txt_LoginID.Text.Trim()})]登录系统", out long _); } catch { } try { B_DB_Opera.SaveLog_Request(MesWorkForm.Curr_Station, Log_Type.ZK_Login, "", Log_FromAndTo.ZK, Log_FromAndTo.ZK, $"用户[{name}({txt_LoginID.Text.Trim()})]登录系统", out long _); } catch { }

View File

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

View File

@@ -15,40 +15,56 @@ namespace MesWork
public class B_DB_Opera public class B_DB_Opera
{ {
public static void Event_WorkStart(string opName, int tagTypeCodeID, string partType, string tagID)
{
var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var procedureName = "Event_WorkStart";
var sqlParameter = new SqlParameter[] {
new SqlParameter("@OpName", opName),
new SqlParameter("@TagTypeCodeID", tagTypeCodeID),
new SqlParameter("@PartType", partType),
new SqlParameter("@ChangeTime",ChangeTime),
new SqlParameter("@TagID", tagID)
};
SqlOperation.ExecuteStoredProcedure(procedureName, sqlParameter, out string errorMessage);
public static bool LoginState_Query(out LoginStateInfo loginState)
{
loginState = null;
try
{
var sqlParameter = new SqlParameter[] {
new SqlParameter("@机器名", Environment.MachineName)
};
SqlOperation.ExecuteStoredProcedure("系统登录状态_查询", sqlParameter, out DataTable dt, out string err);
if (dt != null && dt.Rows.Count > 0 && dt.Rows[0]["result"].ToString() == "1")
{
loginState = new LoginStateInfo
{
LoginID = dt.Rows[0]["登录账号"]?.ToString() ?? "",
UserName = dt.Rows[0]["用户姓名"]?.ToString() ?? "",
Permission = dt.Rows[0]["权限"]?.ToString() ?? ""
};
return !string.IsNullOrWhiteSpace(loginState.LoginID) && !string.IsNullOrWhiteSpace(loginState.UserName);
}
}
catch { }
return false;
} }
public static void Event_WorkEnd(string opName, int tagTypeCodeID, string partType public static void LoginState_Save(string loginID, string userName, string permission)
, string barCode, int qualityMask, int outCount, int duration
, string tagID)
{ {
var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); try
var procedureName = "Event_WorkEnd"; {
var sqlParameter = new SqlParameter[] { var sqlParameter = new SqlParameter[] {
new SqlParameter("@OpName", opName), new SqlParameter("@机器名", Environment.MachineName),
new SqlParameter("@TagTypeCodeID", tagTypeCodeID), new SqlParameter("@登录账号", loginID ?? ""),
new SqlParameter("@PartType", partType), new SqlParameter("@用户姓名", userName ?? ""),
new SqlParameter("@BarCode", barCode), new SqlParameter("@权限", permission ?? "")
new SqlParameter("@QualityMask", qualityMask),
new SqlParameter("@OutCount", outCount),
new SqlParameter("@Duration", duration),
new SqlParameter("@ChangeTime",ChangeTime),
new SqlParameter("@TagID", tagID)
}; };
SqlOperation.ExecuteStoredProcedure("系统登录状态_保存", sqlParameter, out string err);
}
catch { }
}
SqlOperation.ExecuteStoredProcedure(procedureName, sqlParameter, out string errorMessage); public static void LoginState_Clear()
{
try
{
var sqlParameter = new SqlParameter[] {
new SqlParameter("@机器名", Environment.MachineName)
};
SqlOperation.ExecuteStoredProcedure("系统登录状态_清空", sqlParameter, out string err);
}
catch { }
} }
@@ -101,36 +117,6 @@ namespace MesWork
} }
public static void Event_AlarmAndTip_Start(string opName, int tagTypeCodeID, string alarmText, string tagID, int Alarm1_Tip2)
{
var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var procedureName = "Event_AlarmAndTip_Start";
var sqlParameter = new SqlParameter[] {
new SqlParameter("@OpName", opName),
new SqlParameter("@TagTypeCodeID", tagTypeCodeID),
new SqlParameter("@AlarmText", alarmText),
new SqlParameter("@ChangeTime",ChangeTime),
new SqlParameter("@TagID", tagID),
new SqlParameter("@Alarm1_Tip2", Alarm1_Tip2),
};
SqlOperation.ExecuteStoredProcedure(procedureName, sqlParameter, out string errorMessage);
}
public static void MES_StatusChange(string opName, int StatusCode, string TriggerTime)
{
var procedureName = "设备管理_状态变化新增";
var sqlParameter = new SqlParameter[] {
new SqlParameter("@opName", opName),
new SqlParameter("@StatusCode", StatusCode),
new SqlParameter("@TriggerTime", TriggerTime),
};
SqlOperation.ExecuteStoredProcedure(procedureName, sqlParameter, out string errorMessage);
}
public static void Query_AlarmData(string opName, out int count, out string text) public static void Query_AlarmData(string opName, out int count, out string text)
{ {
count = 0; count = 0;
@@ -151,22 +137,6 @@ namespace MesWork
} }
public static void Event_DeviceStatus_UseTime(string opName, string Onhours, string Workhours, string DeviceStatus)
{
var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var procedureName = "Event_DeviceStatus_UseTime";
var sqlParameter = new SqlParameter[] {
new SqlParameter("@OpName", opName),
new SqlParameter("@Onhours", Onhours),
new SqlParameter("@Workhours", Workhours),
new SqlParameter("@DeviceStatus", DeviceStatus),
new SqlParameter("@ChangeTime",ChangeTime),
};
SqlOperation.ExecuteStoredProcedure(procedureName, sqlParameter, out string errorMessage);
}
public static void Event_DeviceStatus_Change(string opName, string DeviceStatus) public static void Event_DeviceStatus_Change(string opName, string DeviceStatus)
{ {
var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
@@ -445,12 +415,22 @@ namespace MesWork
/// <summary> /// <summary>
/// 更新过站记录为完成case 19 请求保存时调用) /// 更新过站记录为完成case 19 请求保存时调用)
/// </summary> /// </summary>
public static bool UpdateStationComplete(string engineNo, string stationNo, decimal weight) public static bool UpdateStationComplete(string engineNo, string stationNo, decimal weight,
string modelNo = "", string orderNo = "", string palletNo = "", string stationName = "",
decimal addOilQty = 0, decimal extractOilQty = 0, decimal density = 0, string worker = "")
{ {
var sqlParameter = new SqlParameter[] { var sqlParameter = new SqlParameter[] {
new SqlParameter("@发动机号", engineNo), new SqlParameter("@发动机号", engineNo),
new SqlParameter("@工位号", stationNo), new SqlParameter("@工位号", stationNo),
new SqlParameter("@称重重量", weight) new SqlParameter("@称重重量", weight),
new SqlParameter("@机型号", modelNo),
new SqlParameter("@工单号", orderNo),
new SqlParameter("@托盘号", palletNo),
new SqlParameter("@工位名称", stationName),
new SqlParameter("@加油量", addOilQty),
new SqlParameter("@抽油量", extractOilQty),
new SqlParameter("@油密度", density),
new SqlParameter("@操作者", worker)
}; };
SqlOperation.ExecuteStoredProcedure("过站记录_完成", sqlParameter, out DataTable dt, out string err); SqlOperation.ExecuteStoredProcedure("过站记录_完成", sqlParameter, out DataTable dt, out string err);
return dt != null && dt.Rows.Count > 0 && dt.Rows[0]["result"].ToString() == "1"; return dt != null && dt.Rows.Count > 0 && dt.Rows[0]["result"].ToString() == "1";
@@ -521,6 +501,13 @@ namespace MesWork
} }
public class LoginStateInfo
{
public string LoginID;
public string UserName;
public string Permission;
}
/// <summary> /// <summary>
/// 曲线采样点数据结构 /// 曲线采样点数据结构
/// </summary> /// </summary>

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@@ -30,8 +31,17 @@ namespace MesWork
private static readonly ConcurrentDictionary<string, CurveCollectorState> _curveCollectors private static readonly ConcurrentDictionary<string, CurveCollectorState> _curveCollectors
= new ConcurrentDictionary<string, CurveCollectorState>(StringComparer.OrdinalIgnoreCase); = new ConcurrentDictionary<string, CurveCollectorState>(StringComparer.OrdinalIgnoreCase);
private const int CurveCollectorSampleIntervalMs = 200; private static readonly int CurveCollectorSampleIntervalMs = int.TryParse(
private const int CurveStableWindowSize = 20; ConfigurationManager.AppSettings["CurveCollectorSampleIntervalMs"], out int _sampleIntervalMs)
? _sampleIntervalMs : 200;
private static readonly int CurveStableWindowSize = int.TryParse(
ConfigurationManager.AppSettings["CurveStableWindowSize"], out int _stableWindowSize)
? _stableWindowSize : 20;
private static readonly int CurveStableSkipStartPointCount = int.TryParse(
ConfigurationManager.AppSettings["CurveStableSkipStartPointCount"], out int _skipStartPointCount)
? _skipStartPointCount : 0;
/// <summary> /// <summary>
/// 允许工作后启动曲线采集,每个工位同一时间只保留一个采集段。 /// 允许工作后启动曲线采集,每个工位同一时间只保留一个采集段。
@@ -230,18 +240,19 @@ namespace MesWork
} }
/// <summary> /// <summary>
/// 找连续20点中极差最小的一段,去掉一个最大值和一个最小值后取平均。 /// 跳过前置配置点数后,找连续稳定窗口中极差最小的一段,去掉一个最大值和一个最小值后取平均。
/// </summary> /// </summary>
private bool CurveCollector_CalculateStableWeight(List<decimal> weights, out decimal stableWeight, out int startSeq, out int endSeq) private bool CurveCollector_CalculateStableWeight(List<decimal> weights, out decimal stableWeight, out int startSeq, out int endSeq)
{ {
stableWeight = 0; stableWeight = 0;
startSeq = 0; startSeq = 0;
endSeq = 0; endSeq = 0;
if (weights == null || weights.Count < CurveStableWindowSize) return false; int skipStartPointCount = Math.Max(0, CurveStableSkipStartPointCount);
if (weights == null || weights.Count - skipStartPointCount < CurveStableWindowSize) return false;
int bestStart = 0; // 0-based窗口起点保存时转成1-based序号 int bestStart = 0; // 0-based窗口起点保存时转成1-based序号
decimal bestRange = decimal.MaxValue; decimal bestRange = decimal.MaxValue;
for (int i = 0; i <= weights.Count - CurveStableWindowSize; i++) for (int i = skipStartPointCount; i <= weights.Count - CurveStableWindowSize; i++)
{ {
decimal min = weights[i]; decimal min = weights[i];
decimal max = weights[i]; decimal max = weights[i];

View File

@@ -1,40 +1,40 @@
using DC_A95; using DC_A95;
using OpcBasic; using OpcBasic;
using OpcData; using OpcData;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using SystemFramework; using SystemFramework;
namespace MesWork namespace MesWork
{ {
/// <summary> /// <summary>
/// 设备状态的处理 /// 设备状态的处理
/// </summary> /// </summary>
public partial class MesWorkForm public partial class MesWorkForm
{ {
/// <summary> /// <summary>
/// 设备状态的处理 /// 设备状态的处理
/// </summary> /// </summary>
/// <param name="e"></param> /// <param name="e"></param>
private void MIS_Device(object e) private void MIS_Device(object e)
{ {
var eState = (DeviceDriver_BasicData.PlcStateEvetnArgs)e; var eState = (DeviceDriver_BasicData.PlcStateEvetnArgs)e;
var ip = eState.IP.ToString(); var ip = eState.IP.ToString();
var onLine = eState.OnLine; var onLine = eState.OnLine;
} }
} }
} }

View File

@@ -134,24 +134,24 @@ namespace MesWork
// ==================================================================== // ====================================================================
// 称重交互核心方法 // 称重交互核心方法
// ==================================================================== // ====================================================================
/// <summary> /// <summary>
/// 获取称重类型:地面/放油前/放油后 /// 获取称重类型:地面/放油前/放油后
/// Ground模式统一返回"地面" /// Ground模式统一返回"地面"
/// Hanging模式工位1=放油前工位2=放油后 /// Hanging模式工位1=放油前工位2=放油后
/// </summary> /// </summary>
private string GetWeighingType(string opName) private string GetWeighingType(string opName)
{ {
if (WeighingType == "Ground") if (WeighingType == "Ground")
return "地面"; return "地面";
if (string.Equals(opName, Station1OpName, StringComparison.OrdinalIgnoreCase)) if (string.Equals(opName, Station1OpName, StringComparison.OrdinalIgnoreCase))
return "放油前"; return "放油前";
if (string.Equals(opName, Station2OpName, StringComparison.OrdinalIgnoreCase)) if (string.Equals(opName, Station2OpName, StringComparison.OrdinalIgnoreCase))
return "放油后"; return "放油后";
throw new InvalidOperationException($"工位号[{opName}]未匹配到App.config中的Station1OpName/Station2OpName请检查工位配置"); throw new InvalidOperationException($"工位号[{opName}]未匹配到App.config中的Station1OpName/Station2OpName请检查工位配置");
} }
/// <summary> /// <summary>
@@ -171,7 +171,6 @@ namespace MesWork
// 清除结果信息 // 清除结果信息
WeighingPage?.UpdateOilResult(stIdx, 0, 0); WeighingPage?.UpdateOilResult(stIdx, 0, 0);
WeighingPage?.ClearSaveResult(stIdx);
} }
catch (Exception err) catch (Exception err)
@@ -181,14 +180,15 @@ namespace MesWork
} }
/// <summary> /// <summary>
/// 码块数据转换:将产品编号统一转大写,并拆分出订货号与产品编号 /// 码块数据转换:将产品编号统一转大写,并拆分出订货号与产品编号
/// 支持格式: /// 支持格式:
/// 0/DHN2.5Q0219-36/D426E016767 /// 0/DHN2.5Q0219-36/D426E016767
/// DHH02K0014-400/B726E00584555 /// DHH02K0014-400/B726E00584555
/// </summary> /// CodeBlockOrderNoReverse=0订货号/流水号CodeBlockOrderNoReverse=1流水号/订货号
private bool TryConvertCodeBlockData(string codeBlock, out string orderNo, out string productNo) /// </summary>
{ private bool TryConvertCodeBlockData(string codeBlock, out string orderNo, out string productNo)
{
orderNo = ""; orderNo = "";
productNo = ""; productNo = "";
if (string.IsNullOrWhiteSpace(codeBlock)) if (string.IsNullOrWhiteSpace(codeBlock))
@@ -197,14 +197,22 @@ namespace MesWork
} }
string normalizedCode = codeBlock.Trim().ToUpperInvariant(); string normalizedCode = codeBlock.Trim().ToUpperInvariant();
string[] parts = normalizedCode.Split('/'); string[] parts = normalizedCode.Split('/');
if (parts.Length >= 2) if (parts.Length >= 2)
{ {
orderNo = parts[parts.Length - 2].Trim(); if (CodeBlockOrderNoReverse == 1)
productNo = parts[parts.Length - 1].Trim(); {
} productNo = parts[parts.Length - 2].Trim();
else orderNo = parts[parts.Length - 1].Trim();
{ }
else
{
orderNo = parts[parts.Length - 2].Trim();
productNo = parts[parts.Length - 1].Trim();
}
}
else
{
productNo = normalizedCode; productNo = normalizedCode;
} }
@@ -320,9 +328,16 @@ namespace MesWork
decimal plcWeight = Convert.ToDecimal(ReadPLC(100140, opName)); // PLC锁定重量曲线无效时兜底使用 decimal plcWeight = Convert.ToDecimal(ReadPLC(100140, opName)); // PLC锁定重量曲线无效时兜底使用
decimal weight = plcWeight; // 默认使用PLC锁定重量曲线算法成功后覆盖 decimal weight = plcWeight; // 默认使用PLC锁定重量曲线算法成功后覆盖
decimal waterContent = Convert.ToDecimal(ReadPLC(100180, opName)); // 水含量 decimal waterContent = Convert.ToDecimal(ReadPLC(100180, opName)); // 水含量
string engineNo = PLC_R.GetString_CleanGarbled(ReadPLC(10, opName)); // 产品编号 string engineNo = PLC_R.GetString_CleanGarbled(ReadPLC(10, opName)); // 原始代码串/产品编号
if (TryConvertCodeBlockData(engineNo, out _, out string parsedProductNo)) string modelNo = PLC_R.GetString_CleanGarbled(ReadPLC(11, opName)); // 机型号
string orderNo = PLC_R.GetString_CleanGarbled(ReadPLC(39, opName)); // 工单号/订货号
string palletNo = PLC_R.GetString_CleanGarbled(ReadPLC(80, opName)); // 托盘号
if (TryConvertCodeBlockData(engineNo, out string parsedOrderNo, out string parsedProductNo))
{ {
if (!string.IsNullOrWhiteSpace(parsedOrderNo))
{
orderNo = parsedOrderNo;
}
engineNo = parsedProductNo; engineNo = parsedProductNo;
} }
else if (string.IsNullOrWhiteSpace(engineNo)) else if (string.IsNullOrWhiteSpace(engineNo))
@@ -352,9 +367,30 @@ namespace MesWork
} }
long curveWeighingRecordId = 0; long curveWeighingRecordId = 0;
B_DB_Opera.UpdateStationComplete(engineNo, opName, weight); // 过站记录保存最终采用重量
WeighingPage?.UpdateFinalWeight(WeighingPage?.GetStationIndex(opName) ?? 1, weight);
string weighType = GetWeighingType(opName); string weighType = GetWeighingType(opName);
decimal addOilQty = 0;
decimal extractOilQty = 0;
decimal density = 0;
decimal residualOilUpperLimit = 0;
decimal residualOilLowerLimit = 0;
if (!string.IsNullOrWhiteSpace(orderNo) &&
B_DB_Opera.QueryWorkpieceByOrderNo(orderNo, out string matchedModelNo, out decimal matchedAddOilQty,
out decimal matchedExtractOilQty, out decimal matchedDensity, out decimal matchedResidualOilUpperLimit,
out decimal matchedResidualOilLowerLimit))
{
modelNo = matchedModelNo;
addOilQty = matchedAddOilQty;
extractOilQty = matchedExtractOilQty;
density = matchedDensity;
residualOilUpperLimit = matchedResidualOilUpperLimit;
residualOilLowerLimit = matchedResidualOilLowerLimit;
}
if (!B_DB_Opera.UpdateStationComplete(engineNo, opName, weight, modelNo, orderNo, palletNo, weighType,
addOilQty, extractOilQty, density, Curr_UserName)) // 过站记录保存最终采用重量找不到则由SP补异常完成记录
{
LogWeighingFallback(opName, engineNo, "请求保存-过站", "未找到请求工作过站记录,已补异常过站完成记录", AID);
}
decimal oilReleaseQty = 0; decimal oilReleaseQty = 0;
decimal residualOilQty = 0; decimal residualOilQty = 0;
int finalQualityFlag = 1; int finalQualityFlag = 1;
@@ -378,8 +414,8 @@ namespace MesWork
else else
{ {
// 兜底机制请求工作阶段资料异常可能没有占位记录保存时补一条异常完成记录避免PLC等不到保存完成。 // 兜底机制请求工作阶段资料异常可能没有占位记录保存时补一条异常完成记录避免PLC等不到保存完成。
curveWeighingRecordId = B_DB_Opera.InsertWeighingRecord(opName, "地面", engineNo, "", "", "", curveWeighingRecordId = B_DB_Opera.InsertWeighingRecord(opName, "地面", engineNo, modelNo, orderNo, palletNo,
0, weight, 0, 0, 0, 0, 0, 0, 0, 2, waterContent, 0, weight, addOilQty, extractOilQty, density, residualOilUpperLimit, residualOilLowerLimit, 0, 0, 2, waterContent,
opName, Curr_UserName, isComplete: 1); opName, Curr_UserName, isComplete: 1);
finalQualityFlag = 2; finalQualityFlag = 2;
qualityMsg = "未找到请求工作占位记录,已按异常地面记录保存"; qualityMsg = "未找到请求工作占位记录,已按异常地面记录保存";
@@ -402,8 +438,8 @@ namespace MesWork
else else
{ {
// 兜底机制:没有占位记录时补异常记录并完成握手,后续放油后仍可按异常链路继续。 // 兜底机制:没有占位记录时补异常记录并完成握手,后续放油后仍可按异常链路继续。
curveWeighingRecordId = B_DB_Opera.InsertWeighingRecord(opName, "空中", engineNo, "", "", "", curveWeighingRecordId = B_DB_Opera.InsertWeighingRecord(opName, "空中", engineNo, modelNo, orderNo, palletNo,
weight, 0, 0, 0, 0, 0, 0, 0, 0, 2, waterContent, weight, 0, addOilQty, extractOilQty, density, residualOilUpperLimit, residualOilLowerLimit, 0, 0, 2, waterContent,
opName, Curr_UserName, isComplete: 1); opName, Curr_UserName, isComplete: 1);
finalQualityFlag = 2; finalQualityFlag = 2;
qualityMsg = "未找到请求工作占位记录,已按异常放油前记录保存"; qualityMsg = "未找到请求工作占位记录,已按异常放油前记录保存";
@@ -428,9 +464,9 @@ namespace MesWork
} }
else else
{ {
// 找不到放油前记录(可能直接进放油后工位):创建一条放油后记录并标记完成 // 找不到放油前记录(可能直接进放油后工位):创建一条放油后记录并标记完成
curveWeighingRecordId = B_DB_Opera.InsertWeighingRecord(opName, "空中放油后", engineNo, "", "", "", curveWeighingRecordId = B_DB_Opera.InsertWeighingRecord(opName, "空中放油后", engineNo, modelNo, orderNo, palletNo,
0, weight, 0, 0, 0, 0, 0, 0, 0, 2, waterContent, 0, weight, addOilQty, extractOilQty, density, residualOilUpperLimit, residualOilLowerLimit, 0, 0, 2, waterContent,
opName, Curr_UserName, isComplete: 1); // 异常兜底记录,质量直接判不合格 opName, Curr_UserName, isComplete: 1); // 异常兜底记录,质量直接判不合格
finalQualityFlag = 2; finalQualityFlag = 2;
qualityMsg = "未找到放油前记录"; qualityMsg = "未找到放油前记录";
@@ -464,7 +500,7 @@ namespace MesWork
/// 扫码枪扫码完成后的业务处理 /// 扫码枪扫码完成后的业务处理
/// 将码值写入PLC地址102500触发完成信号100016=11秒后复位 /// 将码值写入PLC地址102500触发完成信号100016=11秒后复位
/// </summary> /// </summary>
/// <param name="opName">工位号由COM口绑定决定</param> /// <param name="opName">工位号由COM口绑定决定</param>
/// <param name="barcode">扫到的条码值</param> /// <param name="barcode">扫到的条码值</param>
public void Barcode_HandleScan(string opName, string barcode) public void Barcode_HandleScan(string opName, string barcode)
{ {

View File

@@ -21,56 +21,69 @@ namespace MesWork
public MesWorkForm() public MesWorkForm()
{ {
Frm_Login frm_Login = new Frm_Login(); if (!TryAutoLogin())
if (frm_Login.ShowDialog() == DialogResult.OK)
{ {
OnStart(); Frm_Login frm_Login = new Frm_Login();
if (frm_Login.ShowDialog() != DialogResult.OK)
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
IsMdiContainer = false;
// 加载窗口图标
LoadWindowIcon();
// 设置用户名
lbl_UserName.Text = $"操作员:{MesWorkForm.Curr_UserName}";
// 标题追加工位号
if (!string.IsNullOrEmpty(Curr_Station))
Text = $"称重数据采集分析管理系统 - {Curr_Station}";
// 启动定时器
timer_OnLine_Show.Interval = 1000;
timer_OnLine_Show.Enabled = true;
timer_Clock.Interval = 1000;
timer_Clock.Enabled = true;
// 启动SQL在线检测
CommunicationCheckOnLine();
// 初始化扫码枪
if (MesWorkForm.IsUseBarcode == 1)
{ {
BarcodeManager.Init(); Process.GetCurrentProcess().Kill();
BarcodeManager.OnBarcodeScanned = (opName, barcode) => return;
{
// 在线程池中执行业务处理与PLC信号处理一致
System.Threading.ThreadPool.QueueUserWorkItem(_ =>
{
try { Barcode_HandleScan(opName, barcode); }
catch { }
});
};
} }
}
// 默认选中"称重作业" OnStart();
SetActiveNav(pnl_NavWeighing);
} InitializeComponent();
else InsertWeighingAnalysisNav();
CheckForIllegalCrossThreadCalls = false;
IsMdiContainer = false;
// 加载窗口图标
LoadWindowIcon();
// 设置用户名
lbl_UserName.Text = $"操作员:{MesWorkForm.Curr_UserName}";
// 标题追加工位号
if (!string.IsNullOrEmpty(Curr_Station))
Text = $"称重数据采集分析管理系统 - {Curr_Station}";
// 启动定时器
timer_OnLine_Show.Interval = 1000;
timer_OnLine_Show.Enabled = true;
timer_Clock.Interval = 1000;
timer_Clock.Enabled = true;
// 启动SQL在线检测
CommunicationCheckOnLine();
// 初始化扫码枪
if (MesWorkForm.IsUseBarcode == 1)
{ {
Process.GetCurrentProcess().Kill(); BarcodeManager.Init();
BarcodeManager.OnBarcodeScanned = (opName, barcode) =>
{
// 在线程池中执行业务处理与PLC信号处理一致
System.Threading.ThreadPool.QueueUserWorkItem(_ =>
{
try { Barcode_HandleScan(opName, barcode); }
catch { }
});
};
} }
// 默认选中"称重作业"
SetActiveNav(pnl_NavWeighing);
}
private bool TryAutoLogin()
{
if (!B_DB_Opera.LoginState_Query(out LoginStateInfo loginState)) return false;
Curr_LoginID = loginState.LoginID;
Curr_UserName = loginState.UserName;
Curr_UserPassWord = "";
return true;
} }
// ==================================================================== // ====================================================================
@@ -161,7 +174,13 @@ namespace MesWork
string pageKey = ""; string pageKey = "";
UserControl uc = null; UserControl uc = null;
if (navTag.Contains("称重")) if (navTag.Contains("称重分析"))
{
pageKey = "weighing_analysis";
if (!_pageCache.ContainsKey(pageKey))
_pageCache[pageKey] = new Pages.UC_WeighingAnalysis();
}
else if (navTag.Contains("称重"))
{ {
pageKey = "weighing"; pageKey = "weighing";
if (!_pageCache.ContainsKey(pageKey)) if (!_pageCache.ContainsKey(pageKey))
@@ -228,6 +247,43 @@ namespace MesWork
} }
} }
/// <summary>
/// 在统计分析后插入称重分析入口,减少对设计器文件的手工改动。
/// </summary>
private void InsertWeighingAnalysisNav()
{
var pnlNav = new Panel
{
BackColor = Color.FromArgb(30, 58, 95),
Cursor = Cursors.Hand,
Location = new Point(1, 470),
Name = "pnl_NavWeighingAnalysis",
Size = new Size(78, 64),
Tag = "📈\n称重分析"
};
var lblNav = new Label
{
AutoSize = false,
Cursor = Cursors.Hand,
Dock = DockStyle.Fill,
Font = new Font("微软雅黑", 9F),
ForeColor = Color.FromArgb(148, 163, 184),
Text = "📈\n称重分析",
TextAlign = ContentAlignment.MiddleCenter
};
pnlNav.Controls.Add(lblNav);
pnlNav.Click += Nav_Click;
lblNav.Click += Nav_Click;
pnl_NavSettings.Top += 66; // 称重分析占用一个导航位,后续菜单整体下移。
pnl_NavLog.Top += 66;
pnl_NavPLC.Top += 66;
pnl_SidebarScroll.Controls.Add(pnlNav);
pnlNav.BringToFront();
pnl_NavActiveIndicator.BringToFront();
}
// ==================================================================== // ====================================================================
// Timer Events // Timer Events
// ==================================================================== // ====================================================================
@@ -280,6 +336,7 @@ namespace MesWork
BarcodeManager.Shutdown(); BarcodeManager.Shutdown();
B_DB_Opera.SaveLog_Request(Curr_Station, Log_Type.ZK_Login, "", Log_FromAndTo.ZK, Log_FromAndTo.ZK, $"用户[{Curr_UserName}({Curr_LoginID})]退出称重系统", out long AID); B_DB_Opera.SaveLog_Request(Curr_Station, Log_Type.ZK_Login, "", Log_FromAndTo.ZK, Log_FromAndTo.ZK, $"用户[{Curr_UserName}({Curr_LoginID})]退出称重系统", out long AID);
B_DB_Opera.LoginState_Clear();
Process.GetCurrentProcess().Kill(); Process.GetCurrentProcess().Kill();
} }
} }

View File

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

View File

@@ -1,7 +1,11 @@
using System; using System;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Security;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Microsoft.Win32;
namespace MesWork.Pages namespace MesWork.Pages
{ {
@@ -10,6 +14,13 @@ namespace MesWork.Pages
/// </summary> /// </summary>
public partial class UC_SystemSettings : UserControl public partial class UC_SystemSettings : UserControl
{ {
private const string AutoStartKeyName = "WC_GKJ_OIL";
private const string AutoStartRunKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Run";
private const string AutoStartTaskName = "WC_GKJ_OIL_AutoStart";
private bool _isLoadingAutoStart;
private CheckBox chk_AutoStart;
private Label lbl_AutoStartStatus;
// 工位1控件 // 工位1控件
private ComboBox cmb_Com1; private ComboBox cmb_Com1;
private Button btn_Connect1, btn_Disconnect1, btn_ManualSend1; private Button btn_Connect1, btn_Disconnect1, btn_ManualSend1;
@@ -32,6 +43,7 @@ namespace MesWork.Pages
grp_Station2.Text = $" 工位2{station2} "; grp_Station2.Text = $" 工位2{station2} ";
grp_Scanner1.Text = $" {station1} 扫码枪 "; grp_Scanner1.Text = $" {station1} 扫码枪 ";
grp_Scanner2.Text = $" {station2} 扫码枪 "; grp_Scanner2.Text = $" {station2} 扫码枪 ";
BuildAutoStartPanel();
if (BarcodeManager.IsEnabled) if (BarcodeManager.IsEnabled)
{ {
@@ -52,6 +64,46 @@ namespace MesWork.Pages
} }
} }
/// <summary>
/// 构建开机自启设置区域状态直接读取Windows当前用户启动项。
/// </summary>
private void BuildAutoStartPanel()
{
var grpAutoStart = new GroupBox
{
Text = " 开机自启 ",
Font = new Font("微软雅黑", 12F, FontStyle.Bold),
ForeColor = Color.FromArgb(30, 58, 95),
Location = new Point(30, 410),
Size = new Size(840, 120)
};
chk_AutoStart = new CheckBox
{
Text = "启用开机自启",
Font = new Font("微软雅黑", 11F, FontStyle.Bold),
ForeColor = Color.FromArgb(31, 41, 55),
Location = new Point(24, 36),
AutoSize = true,
Cursor = Cursors.Hand
};
chk_AutoStart.CheckedChanged += chk_AutoStart_CheckedChanged;
grpAutoStart.Controls.Add(chk_AutoStart);
lbl_AutoStartStatus = new Label
{
Text = "--",
Font = new Font("微软雅黑", 10F),
ForeColor = Color.FromArgb(75, 85, 99),
Location = new Point(24, 72),
AutoSize = true
};
grpAutoStart.Controls.Add(lbl_AutoStartStatus);
Controls.Add(grpAutoStart);
RefreshAutoStartState();
}
/// <summary> /// <summary>
/// 动态构建单个扫码枪面板的控件 /// 动态构建单个扫码枪面板的控件
/// </summary> /// </summary>
@@ -144,6 +196,232 @@ namespace MesWork.Pages
// ── 操作方法 ── // ── 操作方法 ──
private string GetAutoStartCommand()
{
return Application.ExecutablePath;
}
private bool RunSchtasks(string arguments, out string output)
{
output = "";
try
{
var psi = new ProcessStartInfo
{
FileName = "schtasks.exe",
Arguments = arguments,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true
};
using (Process process = Process.Start(psi))
{
output = process.StandardOutput.ReadToEnd() + process.StandardError.ReadToEnd();
process.WaitForExit();
return process.ExitCode == 0;
}
}
catch (Exception ex)
{
output = ex.Message;
return false;
}
}
private bool TryGetAutoStartTaskXml(out string taskXml, out string errMsg)
{
taskXml = "";
errMsg = "";
if (RunSchtasks($"/Query /TN \"{AutoStartTaskName}\" /XML", out string output))
{
taskXml = output;
return true;
}
if (IsTaskNotFoundOutput(output))
{
return true;
}
errMsg = output;
return false;
}
private bool IsTaskNotFoundOutput(string output)
{
return output.IndexOf("cannot find", StringComparison.OrdinalIgnoreCase) >= 0 ||
output.Contains("找不到") ||
output.Contains("不存在");
}
private void DeleteLegacyRegistryAutoStart()
{
try
{
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(AutoStartRunKeyPath, true))
{
key?.DeleteValue(AutoStartKeyName, false);
}
}
catch
{
}
}
private bool TryCreateAutoStartTask(out string errMsg)
{
errMsg = "";
string xmlPath = Path.Combine(Path.GetTempPath(), $"{AutoStartTaskName}.xml");
string exePath = GetAutoStartCommand();
string workDir = Path.GetDirectoryName(exePath);
string taskXml =
$@"<?xml version=""1.0"" encoding=""UTF-16""?>
<Task version=""1.2"" xmlns=""http://schemas.microsoft.com/windows/2004/02/mit/task"">
<RegistrationInfo>
<Description>潍柴称重工控机程序开机自启</Description>
</RegistrationInfo>
<Triggers>
<LogonTrigger>
<Enabled>true</Enabled>
<Delay>PT30S</Delay>
</LogonTrigger>
</Triggers>
<Principals>
<Principal id=""Author"">
<LogonType>InteractiveToken</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>false</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context=""Author"">
<Exec>
<Command>{SecurityElement.Escape(exePath)}</Command>
<WorkingDirectory>{SecurityElement.Escape(workDir)}</WorkingDirectory>
</Exec>
</Actions>
</Task>";
try
{
File.WriteAllText(xmlPath, taskXml, System.Text.Encoding.Unicode);
if (RunSchtasks($"/Create /TN \"{AutoStartTaskName}\" /XML \"{xmlPath}\" /F", out string output))
{
DeleteLegacyRegistryAutoStart();
return true;
}
errMsg = output;
return false;
}
catch (Exception ex)
{
errMsg = ex.Message;
return false;
}
finally
{
try { if (File.Exists(xmlPath)) File.Delete(xmlPath); } catch { }
}
}
private bool IsCurrentProgramAutoStart(string taskXml)
{
return !string.IsNullOrWhiteSpace(taskXml) &&
taskXml.IndexOf(GetAutoStartCommand(), StringComparison.OrdinalIgnoreCase) >= 0;
}
private bool TrySetAutoStart(bool enabled, out string errMsg)
{
errMsg = "";
if (enabled)
{
return TryCreateAutoStartTask(out errMsg);
}
DeleteLegacyRegistryAutoStart();
if (RunSchtasks($"/Delete /TN \"{AutoStartTaskName}\" /F", out string output))
{
return true;
}
if (IsTaskNotFoundOutput(output))
{
return true;
}
errMsg = output;
return false;
}
private void RefreshAutoStartState()
{
if (chk_AutoStart == null || lbl_AutoStartStatus == null) return;
_isLoadingAutoStart = true;
try
{
if (!TryGetAutoStartTaskXml(out string taskXml, out string errMsg))
{
chk_AutoStart.Checked = false;
lbl_AutoStartStatus.Text = $"读取任务计划失败:{errMsg}";
lbl_AutoStartStatus.ForeColor = Color.FromArgb(239, 68, 68);
return;
}
bool isCurrentProgramAutoStart = IsCurrentProgramAutoStart(taskXml);
chk_AutoStart.Checked = isCurrentProgramAutoStart;
if (isCurrentProgramAutoStart)
{
lbl_AutoStartStatus.Text = $"已启用任务计划:{Application.ExecutablePath}";
lbl_AutoStartStatus.ForeColor = Color.FromArgb(16, 185, 129);
}
else if (string.IsNullOrWhiteSpace(taskXml))
{
lbl_AutoStartStatus.Text = "未启用";
lbl_AutoStartStatus.ForeColor = Color.FromArgb(107, 114, 128);
}
else
{
lbl_AutoStartStatus.Text = "任务计划存在但路径不是当前程序,请重新勾选修正";
lbl_AutoStartStatus.ForeColor = Color.FromArgb(245, 158, 11);
}
}
finally
{
_isLoadingAutoStart = false;
}
}
private void chk_AutoStart_CheckedChanged(object sender, EventArgs e)
{
if (_isLoadingAutoStart) return;
bool enabled = chk_AutoStart.Checked;
if (!TrySetAutoStart(enabled, out string errMsg))
{
MessageBox.Show($"开机自启设置失败:{errMsg}", "设置失败", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
RefreshAutoStartState();
}
private void DoConnect(string opName, ComboBox cmb) private void DoConnect(string opName, ComboBox cmb)
{ {
string com = cmb.SelectedItem?.ToString(); string com = cmb.SelectedItem?.ToString();

File diff suppressed because it is too large Load Diff

View File

@@ -253,9 +253,7 @@ namespace MesWork.Pages
ConfigureWeightCard(weightBox, weightTitle, weightValue, weightUnit, topCardWidth, 128, 41F); ConfigureWeightCard(weightBox, weightTitle, weightValue, weightUnit, topCardWidth, 128, 41F);
weightBox.Location = new Point(margin, weightY); weightBox.Location = new Point(margin, weightY);
ConfigureMetricCard(station, waterBox, waterTitle, waterValue, waterUnit, "最终重量", "KG", margin + topCardWidth + gap, weightY, topCardWidth, 128, 28F); ConfigureMetricCard(station, waterBox, waterTitle, waterValue, waterUnit, "水含量", "ppm", margin + topCardWidth + gap, weightY, topCardWidth, 128, 28F);
if (string.IsNullOrWhiteSpace(waterValue.Text) || waterValue.Text == "0.00")
waterValue.Text = "0.000";
metricBox.BackColor = Color.White; metricBox.BackColor = Color.White;
metricBox.Location = new Point(margin, metricY); metricBox.Location = new Point(margin, metricY);
@@ -268,9 +266,7 @@ namespace MesWork.Pages
ConfigureMetricCard(metricBox, extractOilBox, extractOilTitle, extractOilValue, extractOilUnit, "抽油量", "L", (metricCardWidth + gap) * 2, 0, metricCardWidth, 74, 18F); ConfigureMetricCard(metricBox, extractOilBox, extractOilTitle, extractOilValue, extractOilUnit, "抽油量", "L", (metricCardWidth + gap) * 2, 0, metricCardWidth, 74, 18F);
ConfigureMetricCard(metricBox, oilReleaseBox, oilReleaseTitle, oilReleaseValue, oilReleaseUnit, "放油量", "L", 0, 74 + metricRowGap, metricCardWidth, 74, 18F); ConfigureMetricCard(metricBox, oilReleaseBox, oilReleaseTitle, oilReleaseValue, oilReleaseUnit, "放油量", "L", 0, 74 + metricRowGap, metricCardWidth, 74, 18F);
ConfigureMetricCard(metricBox, residualOilBox, residualOilTitle, residualOilValue, residualOilUnit, "残油量", "L", metricCardWidth + gap, 74 + metricRowGap, metricCardWidth, 74, 18F); ConfigureMetricCard(metricBox, residualOilBox, residualOilTitle, residualOilValue, residualOilUnit, "残油量", "L", metricCardWidth + gap, 74 + metricRowGap, metricCardWidth, 74, 18F);
ConfigureMetricCard(metricBox, qualityBox, qualityTitle, qualityValue, null, "水含量", "", (metricCardWidth + gap) * 2, 74 + metricRowGap, metricCardWidth, 74, 18F); ConfigureMetricCard(metricBox, qualityBox, qualityTitle, qualityValue, null, "合格结果", "", (metricCardWidth + gap) * 2, 74 + metricRowGap, metricCardWidth, 74, 18F);
if (string.IsNullOrWhiteSpace(qualityValue.Text) || qualityValue.Text == "--" || qualityValue.Text == "0.00")
qualityValue.Text = "0.00 ppm";
} }
private void LayoutStationHeaderSection( private void LayoutStationHeaderSection(
@@ -386,7 +382,7 @@ namespace MesWork.Pages
valueLabel.BackColor = panel.BackColor; valueLabel.BackColor = panel.BackColor;
valueLabel.Font = new System.Drawing.Font("微软雅黑", valueFontSize, System.Drawing.FontStyle.Bold); valueLabel.Font = new System.Drawing.Font("微软雅黑", valueFontSize, System.Drawing.FontStyle.Bold);
valueLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(58)))), ((int)(((byte)(95))))); valueLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(58)))), ((int)(((byte)(95)))));
int unitWidth = unit == "KG/L" ? 66 : (unit == "ppm" ? 58 : 38); int unitWidth = unit == "KG/L" ? 66 : (unit == "ppm" ? 76 : 38);
int valueRightPadding = unitLabel == null ? 16 : unitWidth + 24; int valueRightPadding = unitLabel == null ? 16 : unitWidth + 24;
valueLabel.Location = new System.Drawing.Point(20, height >= 100 ? 24 : 20); valueLabel.Location = new System.Drawing.Point(20, height >= 100 ? 24 : 20);
valueLabel.Size = new System.Drawing.Size(Math.Max(72, width - 20 - valueRightPadding), height >= 100 ? height - 40 : height - 24); valueLabel.Size = new System.Drawing.Size(Math.Max(72, width - 20 - valueRightPadding), height >= 100 ? height - 40 : height - 24);
@@ -601,7 +597,7 @@ namespace MesWork.Pages
waterValue.Font = new Font("微软雅黑", 18F, FontStyle.Bold); waterValue.Font = new Font("微软雅黑", 18F, FontStyle.Bold);
waterValue.Location = new Point(660, 401); waterValue.Location = new Point(660, 401);
waterValue.Size = new Size(599, 164); waterValue.Size = new Size(599, 164);
waterValue.Text = "最终重0.000 KG"; waterValue.Text = "水含0.00 ppm";
waterValue.TextAlign = ContentAlignment.MiddleCenter; waterValue.TextAlign = ContentAlignment.MiddleCenter;
waterValue.AutoSize = false; waterValue.AutoSize = false;
@@ -614,7 +610,7 @@ namespace MesWork.Pages
ConfigureDesignerMetricLabel(extractOilValue, "抽油量0.00", 840, 0); ConfigureDesignerMetricLabel(extractOilValue, "抽油量0.00", 840, 0);
ConfigureDesignerMetricLabel(oilReleaseValue, "放油量0.00", 0, 93); ConfigureDesignerMetricLabel(oilReleaseValue, "放油量0.00", 0, 93);
ConfigureDesignerMetricLabel(residualOilValue, "残油量0.00", 420, 93); ConfigureDesignerMetricLabel(residualOilValue, "残油量0.00", 420, 93);
ConfigureDesignerMetricLabel(qualityValue, "水含量0.00 ppm", 840, 93); ConfigureDesignerMetricLabel(qualityValue, "合格结果:--", 840, 93);
alarmLabel.Font = new Font("微软雅黑", 13F, FontStyle.Bold); alarmLabel.Font = new Font("微软雅黑", 13F, FontStyle.Bold);
alarmLabel.Location = new Point(30, 792); alarmLabel.Location = new Point(30, 792);
@@ -683,12 +679,12 @@ namespace MesWork.Pages
{ {
if (!string.IsNullOrEmpty(_op1)) if (!string.IsNullOrEmpty(_op1))
PollStation(1, _op1, _s1Signals, PollStation(1, _op1, _s1Signals,
lbl_S1_Weight, lbl_S1_QualityVal, lbl_S1_Info2, lbl_S1_Weight, lbl_S1_Info1, lbl_S1_Info2,
lbl_S1_PalletVal, lbl_S1_AlarmVal); lbl_S1_PalletVal, lbl_S1_AlarmVal);
if (!string.IsNullOrEmpty(_op2)) if (!string.IsNullOrEmpty(_op2))
PollStation(2, _op2, _s2Signals, PollStation(2, _op2, _s2Signals,
lbl_S2_Weight, lbl_S2_QualityVal, lbl_S2_Info2, lbl_S2_Weight, lbl_S2_Info1, lbl_S2_Info2,
lbl_S2_PalletVal, lbl_S2_AlarmVal); lbl_S2_PalletVal, lbl_S2_AlarmVal);
} }
catch { } catch { }
@@ -732,6 +728,9 @@ namespace MesWork.Pages
signals[11].BackColor = qColor; signals[11].BackColor = qColor;
signals[11].Invalidate(); signals[11].Invalidate();
} }
var lblQuality = station == 1 ? lbl_S1_QualityVal : lbl_S2_QualityVal;
lblQuality.Text = qFlag == 1 ? "合格" : (qFlag == 2 ? "不合格" : "--");
lblQuality.ForeColor = qFlag == 2 ? C_SignalBad : Color.FromArgb(30, 58, 95);
} }
catch { } catch { }
@@ -757,7 +756,7 @@ namespace MesWork.Pages
{ {
var sv = PlcLinkForm.ReadPLC(100180, opName); var sv = PlcLinkForm.ReadPLC(100180, opName);
if (sv != null) if (sv != null)
lblWater.Text = $"{Convert.ToDouble(sv):F2} ppm"; lblWater.Text = Convert.ToDouble(sv).ToString("F2");
} }
catch { } catch { }
@@ -813,39 +812,6 @@ namespace MesWork.Pages
lbl.Text = weight.ToString("F3"); lbl.Text = weight.ToString("F3");
} }
/// <summary>
/// 更新保存时采用的最终重量显示。
/// </summary>
public void UpdateFinalWeight(int station, decimal weight)
{
var lbl = station == 1 ? lbl_S1_Info1 : lbl_S2_Info1;
Action act = () => lbl.Text = weight.ToString("F3");
if (lbl.InvokeRequired) lbl.Invoke(act); else act();
}
/// <summary>
/// 清空保存结果相关显示。
/// </summary>
public void ClearSaveResult(int station)
{
Action act = () =>
{
if (station == 1)
{
lbl_S1_Info1.Text = "0.000";
lbl_S1_QualityVal.Text = "0.00 ppm";
lbl_S1_QualityVal.ForeColor = Color.FromArgb(30, 58, 95);
}
else
{
lbl_S2_Info1.Text = "0.000";
lbl_S2_QualityVal.Text = "0.00 ppm";
lbl_S2_QualityVal.ForeColor = Color.FromArgb(30, 58, 95);
}
};
if (InvokeRequired) Invoke(act); else act();
}
public void UpdateStationInfo(int station, string engineNo, string modelNo, string orderNo) public void UpdateStationInfo(int station, string engineNo, string modelNo, string orderNo)
{ {
Action act = () => Action act = () =>

View File

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

View File

@@ -0,0 +1,545 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
using MesWork;
namespace MesWork.Pages
{
/// <summary>
/// 称重分析页面:查询称重记录,查看曲线点位和最终重量取值依据。
/// </summary>
public class UC_WeighingAnalysis : UserControl
{
private readonly Panel pnl_QueryBar = new Panel();
private readonly DateTimePicker dtp_Start = new DateTimePicker();
private readonly DateTimePicker dtp_End = new DateTimePicker();
private readonly TextBox txt_ProductNo = new TextBox();
private readonly TextBox txt_ModelNo = new TextBox();
private readonly TextBox txt_OrderNo = new TextBox();
private readonly Button btn_Query = new Button();
private readonly SplitContainer split_Main = new SplitContainer();
private readonly Panel pnl_Chart = new Panel();
private readonly Panel pnl_Info = new Panel();
private readonly DataGridView dgv_Data = new DataGridView();
private readonly Label lbl_Title = new Label();
private readonly Label lbl_FinalWeight = new Label();
private readonly Label lbl_Window = new Label();
private readonly Label lbl_Method = new Label();
private readonly Label lbl_Product = new Label();
private readonly Label lbl_Sample = new Label();
private readonly Label lbl_Status = new Label();
private readonly ToolTip tip_Point = new ToolTip();
private readonly List<decimal> _points = new List<decimal>();
private PointF[] _chartPoints = new PointF[0];
private int _finalStartSeq;
private int _finalEndSeq;
private decimal? _finalWeight;
private int _sampleIntervalMs;
private int _lastTipSeq;
private static readonly Color ClrPrimary = Color.FromArgb(74, 144, 217);
private static readonly Color ClrPrimaryDark = Color.FromArgb(30, 58, 95);
private static readonly Color ClrAccent = Color.FromArgb(245, 158, 11);
private static readonly Color ClrGood = Color.FromArgb(5, 150, 105);
private static readonly Color ClrGrid = Color.FromArgb(229, 231, 235);
private static readonly Color ClrText = Color.FromArgb(55, 65, 81);
private static readonly Color ClrMuted = Color.FromArgb(107, 114, 128);
public UC_WeighingAnalysis()
{
InitializeLayout();
InitGrid();
dtp_Start.Value = DateTime.Today.AddDays(-30);
dtp_End.Value = DateTime.Today;
SetHint(txt_ProductNo, "产品编号...");
SetHint(txt_ModelNo, "机型号...");
SetHint(txt_OrderNo, "工单号...");
pnl_Chart.Paint += pnl_Chart_Paint;
pnl_Chart.Resize += (s, e) => pnl_Chart.Invalidate();
pnl_Chart.MouseMove += pnl_Chart_MouseMove;
pnl_Chart.MouseLeave += (s, e) => HidePointTip();
}
private void InitializeLayout()
{
BackColor = Color.FromArgb(245, 247, 250);
Dock = DockStyle.Fill;
pnl_QueryBar.BackColor = Color.White;
pnl_QueryBar.Dock = DockStyle.Top;
pnl_QueryBar.Height = 56;
pnl_QueryBar.Padding = new Padding(16, 0, 16, 0);
Controls.Add(split_Main);
Controls.Add(pnl_QueryBar);
AddQueryLabel("从", 16);
InitDatePicker(dtp_Start, 40);
AddQueryLabel("到", 180);
InitDatePicker(dtp_End, 204);
InitTextBox(txt_ProductNo, 365, 150);
InitTextBox(txt_ModelNo, 525, 130);
InitTextBox(txt_OrderNo, 665, 150);
InitButton();
split_Main.Dock = DockStyle.Fill;
split_Main.Orientation = Orientation.Horizontal;
split_Main.SplitterDistance = 430;
split_Main.SplitterWidth = 6;
split_Main.Panel1.Padding = new Padding(12, 8, 12, 4);
split_Main.Panel2.Padding = new Padding(12, 4, 12, 12);
split_Main.Panel1.Controls.Add(pnl_Chart);
split_Main.Panel1.Controls.Add(pnl_Info);
split_Main.Panel2.Controls.Add(dgv_Data);
pnl_Info.BackColor = Color.FromArgb(248, 250, 252);
pnl_Info.Dock = DockStyle.Right;
pnl_Info.Width = 340;
pnl_Info.Padding = new Padding(20, 12, 20, 12);
pnl_Info.Controls.Add(lbl_Status);
pnl_Info.Controls.Add(lbl_Sample);
pnl_Info.Controls.Add(lbl_Product);
pnl_Info.Controls.Add(lbl_Method);
pnl_Info.Controls.Add(lbl_Window);
pnl_Info.Controls.Add(lbl_FinalWeight);
InitInfoLabel(lbl_FinalWeight, 18, FontStyle.Bold, ClrGood, 18);
InitInfoLabel(lbl_Window, 11, FontStyle.Bold, ClrPrimaryDark, 78);
InitInfoLabel(lbl_Method, 10, FontStyle.Regular, ClrText, 124);
InitInfoLabel(lbl_Product, 10, FontStyle.Regular, ClrText, 210);
InitInfoLabel(lbl_Sample, 10, FontStyle.Regular, ClrText, 246);
InitInfoLabel(lbl_Status, 10, FontStyle.Regular, ClrMuted, 282);
pnl_Chart.BackColor = Color.White;
pnl_Chart.Dock = DockStyle.Fill;
pnl_Chart.Padding = new Padding(18, 8, 18, 8);
pnl_Chart.Controls.Add(lbl_Title);
lbl_Title.Dock = DockStyle.Top;
lbl_Title.Height = 34;
lbl_Title.Font = new Font("微软雅黑", 12F, FontStyle.Bold);
lbl_Title.ForeColor = ClrPrimaryDark;
lbl_Title.Text = "称重曲线与最终取值依据";
lbl_Title.TextAlign = ContentAlignment.MiddleLeft;
}
private void AddQueryLabel(string text, int x)
{
var label = new Label
{
AutoSize = true,
Font = new Font("微软雅黑", 10F),
ForeColor = ClrText,
Location = new Point(x, 18),
Text = text
};
pnl_QueryBar.Controls.Add(label);
}
private void InitDatePicker(DateTimePicker picker, int x)
{
picker.Font = new Font("微软雅黑", 10F);
picker.Format = DateTimePickerFormat.Short;
picker.Location = new Point(x, 13);
picker.Size = new Size(130, 25);
pnl_QueryBar.Controls.Add(picker);
}
private void InitTextBox(TextBox textBox, int x, int width)
{
textBox.BorderStyle = BorderStyle.FixedSingle;
textBox.Font = new Font("微软雅黑", 10F);
textBox.Location = new Point(x, 13);
textBox.Size = new Size(width, 27);
pnl_QueryBar.Controls.Add(textBox);
}
private void InitButton()
{
btn_Query.BackColor = ClrPrimary;
btn_Query.Cursor = Cursors.Hand;
btn_Query.FlatAppearance.BorderSize = 0;
btn_Query.FlatStyle = FlatStyle.Flat;
btn_Query.Font = new Font("微软雅黑", 10F, FontStyle.Bold);
btn_Query.ForeColor = Color.White;
btn_Query.Location = new Point(830, 12);
btn_Query.Size = new Size(110, 30);
btn_Query.Text = "查询分析";
btn_Query.UseVisualStyleBackColor = false;
btn_Query.Click += btn_Query_Click;
pnl_QueryBar.Controls.Add(btn_Query);
}
private void InitInfoLabel(Label label, float fontSize, FontStyle style, Color color, int y)
{
label.Font = new Font("微软雅黑", fontSize, style);
label.ForeColor = color;
label.Location = new Point(20, y);
label.Size = new Size(300, y == 124 ? 72 : 32);
label.TextAlign = ContentAlignment.MiddleLeft;
}
private void InitGrid()
{
dgv_Data.AllowUserToAddRows = false;
dgv_Data.AllowUserToDeleteRows = false;
dgv_Data.AllowUserToResizeRows = false;
dgv_Data.AutoGenerateColumns = false;
dgv_Data.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgv_Data.BackgroundColor = Color.White;
dgv_Data.BorderStyle = BorderStyle.None;
dgv_Data.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal;
dgv_Data.ColumnHeadersHeight = 40;
dgv_Data.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
dgv_Data.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(232, 237, 242);
dgv_Data.ColumnHeadersDefaultCellStyle.ForeColor = ClrPrimaryDark;
dgv_Data.ColumnHeadersDefaultCellStyle.Font = new Font("微软雅黑", 10F, FontStyle.Bold);
dgv_Data.DefaultCellStyle.Font = new Font("微软雅黑", 10F);
dgv_Data.DefaultCellStyle.ForeColor = Color.FromArgb(31, 41, 55);
dgv_Data.DefaultCellStyle.SelectionBackColor = Color.FromArgb(219, 234, 254);
dgv_Data.DefaultCellStyle.SelectionForeColor = ClrPrimaryDark;
dgv_Data.DefaultCellStyle.Padding = new Padding(6, 0, 6, 0);
dgv_Data.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(248, 250, 252);
dgv_Data.Dock = DockStyle.Fill;
dgv_Data.EnableHeadersVisualStyles = false;
dgv_Data.GridColor = ClrGrid;
dgv_Data.MultiSelect = false;
dgv_Data.ReadOnly = true;
dgv_Data.RowHeadersVisible = false;
dgv_Data.RowTemplate.Height = 36;
dgv_Data.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgv_Data.SelectionChanged += dgv_Data_SelectionChanged;
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "检测时间", DataPropertyName = "测试时间", FillWeight = 95 });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "产品编号", DataPropertyName = "发动机号", FillWeight = 110 });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "工单号", DataPropertyName = "订单号", FillWeight = 95 });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "机型号", DataPropertyName = "机型号", FillWeight = 65 });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "称重类型", DataPropertyName = "称重类型", FillWeight = 70 });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "工位号", DataPropertyName = "设备编号", FillWeight = 60 });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "最终重量", DataPropertyName = "最终重量", FillWeight = 70, DefaultCellStyle = new DataGridViewCellStyle { Format = "F3" } });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "取点区间", DataPropertyName = "取点区间", FillWeight = 70 });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "采样点数", DataPropertyName = "采样点数", FillWeight = 60 });
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "操作员", DataPropertyName = "操作员", FillWeight = 60 });
}
private void SetHint(TextBox txt, string hint)
{
txt.Tag = hint;
txt.Text = hint;
txt.ForeColor = Color.FromArgb(156, 163, 175);
txt.GotFocus += (s, e) => { if (txt.Text == hint) { txt.Text = ""; txt.ForeColor = ClrPrimaryDark; } };
txt.LostFocus += (s, e) => { if (string.IsNullOrWhiteSpace(txt.Text)) { txt.Text = hint; txt.ForeColor = Color.FromArgb(156, 163, 175); } };
}
private string GetHintValue(TextBox txt)
{
return txt.Text == txt.Tag?.ToString() ? "" : txt.Text.Trim();
}
private void btn_Query_Click(object sender, EventArgs e)
{
QueryData();
}
private void QueryData()
{
try
{
var parms = new SqlParameter[]
{
new SqlParameter("@发动机号", GetHintValue(txt_ProductNo)),
new SqlParameter("@机型号", GetHintValue(txt_ModelNo)),
new SqlParameter("@工单号", GetHintValue(txt_OrderNo)),
new SqlParameter("@开始时间", dtp_Start.Value.ToString("yyyy-MM-dd")),
new SqlParameter("@结束时间", dtp_End.Value.AddDays(1).ToString("yyyy-MM-dd"))
};
SqlOperation.ExecuteStoredProcedure("称重分析_查询", parms, out DataTable dt, out string err);
if (!string.IsNullOrWhiteSpace(err))
throw new Exception(err);
dgv_Data.DataSource = dt;
if (dt == null || dt.Rows.Count == 0)
{
ClearCurve("查询范围内无曲线数据");
MessageBox.Show("查询范围内无称重曲线记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show($"查询失败:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void dgv_Data_SelectionChanged(object sender, EventArgs e)
{
if (dgv_Data.CurrentRow?.DataBoundItem is DataRowView rowView)
{
LoadCurve(rowView.Row);
}
}
private void LoadCurve(DataRow row)
{
_points.Clear();
HidePointTip();
string pointValues = row.Table.Columns.Contains("点位值") ? row["点位值"]?.ToString() : "";
foreach (string item in (pointValues ?? "").Split('|'))
{
if (decimal.TryParse(item, NumberStyles.Number, CultureInfo.InvariantCulture, out decimal value))
_points.Add(value);
}
_finalStartSeq = ToInt(row, "最终取点开始序号");
_finalEndSeq = ToInt(row, "最终取点结束序号");
_sampleIntervalMs = ToInt(row, "采样间隔ms");
_finalWeight = ToNullableDecimal(row, "最终重量");
string productNo = GetText(row, "发动机号");
string stationNo = GetText(row, "设备编号");
lbl_FinalWeight.Text = _finalWeight.HasValue ? $"最终重量 {_finalWeight.Value:F3} kg" : "最终重量 —";
lbl_Window.Text = _finalStartSeq > 0 && _finalEndSeq > 0
? $"依据点位 第 {_finalStartSeq} - {_finalEndSeq} 点"
: "依据点位 未记录";
lbl_Method.Text = "计算方式 取连续20点中极差最小的一段去掉一个最大值和一个最小值剩余18点求平均。";
lbl_Product.Text = $"产品编号 {productNo}";
lbl_Sample.Text = $"工位号 {stationNo} 采样点数 {_points.Count} 间隔 {_sampleIntervalMs}ms";
lbl_Status.Text = _points.Count > 0 ? "曲线状态 已加载,可追溯最终取值区间" : "曲线状态 无点位数据";
pnl_Chart.Invalidate();
}
private void ClearCurve(string msg)
{
_points.Clear();
HidePointTip();
_finalWeight = null;
_finalStartSeq = 0;
_finalEndSeq = 0;
lbl_FinalWeight.Text = "最终重量 —";
lbl_Window.Text = "依据点位 —";
lbl_Method.Text = "计算方式 —";
lbl_Product.Text = "";
lbl_Sample.Text = "";
lbl_Status.Text = msg;
pnl_Chart.Invalidate();
}
private int ToInt(DataRow row, string column)
{
if (!row.Table.Columns.Contains(column) || row[column] == DBNull.Value) return 0;
int.TryParse(row[column].ToString(), out int value);
return value;
}
private decimal? ToNullableDecimal(DataRow row, string column)
{
if (!row.Table.Columns.Contains(column) || row[column] == DBNull.Value) return null;
return decimal.TryParse(row[column].ToString(), out decimal value) ? value : (decimal?)null;
}
private string GetText(DataRow row, string column)
{
return row.Table.Columns.Contains(column) && row[column] != DBNull.Value ? row[column].ToString() : "";
}
private void pnl_Chart_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
Rectangle rect = pnl_Chart.ClientRectangle;
using (var bg = new SolidBrush(Color.White))
g.FillRectangle(bg, rect);
int padL = 70, padR = 36, padT = 54, padB = 54;
int chartW = rect.Width - padL - padR;
int chartH = rect.Height - padT - padB;
if (chartW < 80 || chartH < 80) return;
if (_points.Count == 0)
{
_chartPoints = new PointF[0];
DrawCenterText(g, rect, "选择一条称重记录后显示曲线");
return;
}
decimal minDec = _points.Min();
decimal maxDec = _points.Max();
double minVal = (double)minDec;
double maxVal = (double)maxDec;
double range = maxVal - minVal;
if (range < 0.001) range = Math.Max(Math.Abs(maxVal) * 0.1, 1);
minVal -= range * 0.15;
maxVal += range * 0.15;
DrawGrid(g, padL, padT, chartW, chartH, minVal, maxVal);
_chartPoints = BuildPointLocations(padL, padT, chartW, chartH, minVal, maxVal);
DrawHighlightWindow(g, _chartPoints, padT, chartH);
DrawCurve(g, _chartPoints);
DrawPoints(g, _chartPoints);
DrawFinalLine(g, padL, padT, chartW, chartH, minVal, maxVal);
}
private void DrawGrid(Graphics g, int padL, int padT, int chartW, int chartH, double minVal, double maxVal)
{
using (var axisPen = new Pen(Color.FromArgb(200, 210, 220), 1))
using (var gridPen = new Pen(ClrGrid, 1) { DashStyle = DashStyle.Dot })
using (var font = new Font("微软雅黑", 9F))
using (var brush = new SolidBrush(ClrMuted))
{
g.DrawLine(axisPen, padL, padT, padL, padT + chartH);
g.DrawLine(axisPen, padL, padT + chartH, padL + chartW, padT + chartH);
for (int i = 0; i <= 5; i++)
{
int y = padT + chartH - (int)(chartH * i / 5.0);
if (i > 0) g.DrawLine(gridPen, padL + 1, y, padL + chartW, y);
string text = (minVal + (maxVal - minVal) * i / 5.0).ToString("F2");
SizeF size = g.MeasureString(text, font);
g.DrawString(text, font, brush, padL - size.Width - 6, y - size.Height / 2);
}
}
}
private PointF[] BuildPointLocations(int padL, int padT, int chartW, int chartH, double minVal, double maxVal)
{
var points = new PointF[_points.Count];
for (int i = 0; i < _points.Count; i++)
{
float x = _points.Count == 1 ? padL + chartW / 2f : padL + chartW * i / (float)(_points.Count - 1);
float y = padT + chartH - (float)(chartH * (((double)_points[i] - minVal) / (maxVal - minVal)));
points[i] = new PointF(x, y);
}
return points;
}
private void DrawHighlightWindow(Graphics g, PointF[] points, int padT, int chartH)
{
if (_finalStartSeq <= 0 || _finalEndSeq <= 0 || _finalStartSeq > points.Length) return;
int startIndex = Math.Max(0, _finalStartSeq - 1);
int endIndex = Math.Min(points.Length - 1, _finalEndSeq - 1);
float x1 = points[startIndex].X;
float x2 = points[endIndex].X;
using (var brush = new SolidBrush(Color.FromArgb(46, 245, 158, 11)))
g.FillRectangle(brush, x1, padT, Math.Max(2, x2 - x1), chartH);
using (var pen = new Pen(ClrAccent, 1.6f) { DashStyle = DashStyle.Dash })
{
g.DrawLine(pen, x1, padT, x1, padT + chartH);
g.DrawLine(pen, x2, padT, x2, padT + chartH);
}
}
private void DrawCurve(Graphics g, PointF[] points)
{
if (points.Length < 2) return;
using (var shadow = new Pen(Color.FromArgb(34, 74, 144, 217), 5f) { LineJoin = LineJoin.Round })
using (var line = new Pen(ClrPrimary, 2.2f) { LineJoin = LineJoin.Round })
{
g.DrawLines(shadow, points);
g.DrawLines(line, points);
}
}
private void DrawPoints(Graphics g, PointF[] points)
{
int step = Math.Max(1, points.Length / 120);
for (int i = 0; i < points.Length; i += step)
{
Brush brush = IsInFinalWindow(i + 1) ? new SolidBrush(ClrAccent) : new SolidBrush(ClrPrimary);
using (brush)
g.FillEllipse(brush, points[i].X - 3, points[i].Y - 3, 6, 6);
}
}
private void DrawFinalLine(Graphics g, int padL, int padT, int chartW, int chartH, double minVal, double maxVal)
{
if (!_finalWeight.HasValue) return;
float y = padT + chartH - (float)(chartH * (((double)_finalWeight.Value - minVal) / (maxVal - minVal)));
if (y < padT || y > padT + chartH) return;
using (var pen = new Pen(ClrGood, 1.8f) { DashStyle = DashStyle.Dash })
using (var font = new Font("微软雅黑", 9F, FontStyle.Bold))
using (var brush = new SolidBrush(ClrGood))
{
g.DrawLine(pen, padL, y, padL + chartW, y);
string text = $"最终 {_finalWeight.Value:F3} kg";
SizeF size = g.MeasureString(text, font);
g.DrawString(text, font, brush, padL + chartW - size.Width - 4, y - size.Height - 4);
}
}
private bool IsInFinalWindow(int seq)
{
return _finalStartSeq > 0 && _finalEndSeq > 0 && seq >= _finalStartSeq && seq <= _finalEndSeq;
}
private void pnl_Chart_MouseMove(object sender, MouseEventArgs e)
{
int index = FindNearestPointIndex(e.Location);
if (index < 0)
{
HidePointTip();
return;
}
int seq = index + 1;
if (seq == _lastTipSeq) return;
_lastTipSeq = seq;
string finalText = IsInFinalWindow(seq) ? "\r\n取值依据最终采用区间内" : "";
string tipText = $"第 {seq} 点\r\n重量{_points[index]:F3} kg\r\n时间{FormatElapsedTime(seq)}{finalText}";
tip_Point.Show(tipText, pnl_Chart, e.Location.X + 16, e.Location.Y + 16, 3000);
}
private int FindNearestPointIndex(Point mouse)
{
if (_chartPoints.Length == 0 || _points.Count == 0) return -1;
int nearestIndex = -1;
double nearestDistance = double.MaxValue;
for (int i = 0; i < _chartPoints.Length; i++)
{
double dx = _chartPoints[i].X - mouse.X;
double dy = _chartPoints[i].Y - mouse.Y;
double distance = dx * dx + dy * dy;
if (distance < nearestDistance)
{
nearestDistance = distance;
nearestIndex = i;
}
}
return nearestDistance <= 144 ? nearestIndex : -1; // 鼠标离点 12px 内才显示,避免误触。
}
private string FormatElapsedTime(int seq)
{
int interval = _sampleIntervalMs > 0 ? _sampleIntervalMs : 200;
int totalMs = Math.Max(0, seq - 1) * interval; // 第1点按采集起点0ms估算。
int seconds = totalMs / 1000;
int milliseconds = totalMs % 1000;
return $"{seconds}秒{milliseconds:D3}毫秒";
}
private void HidePointTip()
{
_lastTipSeq = 0;
tip_Point.Hide(pnl_Chart);
}
private void DrawCenterText(Graphics g, Rectangle rect, string text)
{
using (var font = new Font("微软雅黑", 14F))
using (var brush = new SolidBrush(Color.FromArgb(156, 163, 175)))
{
SizeF size = g.MeasureString(text, font);
g.DrawString(text, font, brush, (rect.Width - size.Width) / 2, (rect.Height - size.Height) / 2);
}
}
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,397 +1,397 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, 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="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="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <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> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : 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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata"> <xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
<xsd:complexType> <xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <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:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <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="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:choice> </xsd:choice>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:schema> </xsd:schema>
<resheader name="resmimetype"> <resheader name="resmimetype">
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="返回2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="返回2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\返回2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\返回2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="HMI" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="HMI" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\HMI.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\HMI.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="列表2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="列表2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\列表2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\列表2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="信息_记录" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="信息_记录" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\信息_记录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\信息_记录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="辅助_协助" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="辅助_协助" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\辅助_协助.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\辅助_协助.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="更多" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="更多" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\更多.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\更多.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="帮助" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="帮助" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\帮助.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\帮助.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="JD" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="JD" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\JD.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\JD.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="配置2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="配置2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\配置2.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\配置2.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="BOSS_数据管理1" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="BOSS_数据管理1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\BOSS-数据管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\BOSS-数据管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="重新加载数据" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="重新加载数据" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\重新加载数据.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\重新加载数据.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="导出" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="导出" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\导出.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\导出.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="MBE风格多色图标_密码" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="MBE风格多色图标_密码" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\MBE风格多色图标-密码.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\MBE风格多色图标-密码.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="断开" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="断开" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\断开.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\断开.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="excelICON" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="excelICON" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\excelICON.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\excelICON.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="系统管理" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="系统管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\系统管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\系统管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="关闭系统" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="关闭系统" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\关闭系统.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\关闭系统.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="登录" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="登录" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\登录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\登录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="刷新" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="刷新" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\刷新.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\刷新.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="导入" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="导入" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\导入.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\导入.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="零件管理" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="零件管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\零件管理.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\零件管理.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="连接状态" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="连接状态" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\连接状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\连接状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="操作管理" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="操作管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\操作管理.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\操作管理.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="断开连接" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="断开连接" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\断开连接.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\断开连接.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="按键分割线" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="按键分割线" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\按键分割线.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\按键分割线.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="任务监控和查询" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="任务监控和查询" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\任务监控和查询.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\任务监控和查询.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="分布图1" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="分布图1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\分布图.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\分布图.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="系统管理和监控服务" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="系统管理和监控服务" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\系统管理和监控服务.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\系统管理和监控服务.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="ssbj" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ssbj" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\ssbj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\ssbj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="解锁" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="解锁" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\解锁.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\解锁.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="配置1" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="配置1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\配置.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\配置.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="_002_列表" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="_002_列表" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\002_列表.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\002_列表.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="panlClose" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="panlClose" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\panlClose.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\panlClose.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="文档" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="文档" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\文档.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\文档.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="正确_成功" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="正确_成功" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\正确_成功.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\正确_成功.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="按键分割线浅" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="按键分割线浅" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\按键分割线浅.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\按键分割线浅.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="异常_危险" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="异常_危险" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\异常_危险.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\异常_危险.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="bitbug_favicon" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="bitbug_favicon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\bitbug_favicon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\bitbug_favicon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="连接" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="连接" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\连接.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\连接.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="图表_线_通用_统计" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="图表_线_通用_统计" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\图表_线_通用_统计.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\图表_线_通用_统计.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="下载" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="下载" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\下载.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\下载.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="搜索" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="搜索" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\搜索.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\搜索.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="上传" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="上传" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\上传.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\上传.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="图表_柱" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="图表_柱" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\图表_柱.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\图表_柱.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="用户_账号_我的_未登录" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="用户_账号_我的_未登录" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\用户_账号_我的_未登录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\用户_账号_我的_未登录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="工作台" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="工作台" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\工作台.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\工作台.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="新增_添加" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="新增_添加" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\新增_添加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\新增_添加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="分布图" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="分布图" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\分布图.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\分布图.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="动态数据查询" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="动态数据查询" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\动态数据查询.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\动态数据查询.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="筛选" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="筛选" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\筛选.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\筛选.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="图表_饼" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="图表_饼" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\图表_饼.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\图表_饼.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="action_Cancel_16xLG" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="action_Cancel_16xLG" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\action_Cancel_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\action_Cancel_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="权限角色管理" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="权限角色管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\权限角色管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\权限角色管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="_0780fca3def52d8a02649c7aa2f8093a" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="_0780fca3def52d8a02649c7aa2f8093a" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\0780fca3def52d8a02649c7aa2f8093a.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\0780fca3def52d8a02649c7aa2f8093a.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="编辑_修改" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="编辑_修改" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\编辑_修改.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\编辑_修改.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="关闭" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="关闭" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\关闭.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\关闭.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="手动打印" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="手动打印" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\手动打印.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\手动打印.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="上载" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="上载" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\上载.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\上载.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="BOSS_数据管理" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="BOSS_数据管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\BOSS-数据管理.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\BOSS-数据管理.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="保存" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="保存" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\保存.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\保存.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="列表" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="列表" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\列表.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\列表.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="合作" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="合作" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\合作.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\合作.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="断开状态" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="断开状态" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\断开状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\断开状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="配置21" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="配置21" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\配置2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\配置2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="日志" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="日志" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\日志.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\日志.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="错误_失败" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="错误_失败" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\错误_失败.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\错误_失败.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="用户_账号_我的" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="用户_账号_我的" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\用户_账号_我的.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\用户_账号_我的.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="业务" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="业务" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\业务.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\业务.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="工具" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="工具" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\工具.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\工具.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="jk" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="jk" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\jk.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\jk.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="进度_沙漏" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="进度_沙漏" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\进度_沙漏.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\进度_沙漏.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="记录2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="记录2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\记录2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\记录2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="质控管理" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="质控管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\质控管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\质控管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="登出2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="登出2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\登出2.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\登出2.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="删除" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="删除" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\删除.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\删除.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="添加" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="添加" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\添加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\添加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="备份_复制" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="备份_复制" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\备份_复制.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\备份_复制.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="写入托盘" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="写入托盘" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\写入托盘.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\写入托盘.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="配置" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="配置" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\配置.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\配置.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="日志1" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="日志1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\日志.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\日志.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="密码" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="密码" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\密码.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\密码.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="锁定" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="锁定" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\锁定.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\锁定.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="staticjd" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="staticjd" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\staticjd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\staticjd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="组群_角色" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="组群_角色" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\组群_角色.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\组群_角色.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="增加" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="增加" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\增加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\增加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="打印机" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="打印机" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\打印机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\打印机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="审核_盖章" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="审核_盖章" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\审核_盖章.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\审核_盖章.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="退出" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="退出" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\退出.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\退出.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="布局图" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="布局图" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\布局图.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\布局图.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="工件信息" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="工件信息" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\工件信息.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\工件信息.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="清洗信息" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="清洗信息" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\清洗信息.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\清洗信息.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="能耗信息" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="能耗信息" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\能耗信息.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icon\能耗信息.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </root>

View File

@@ -1,26 +1,26 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。
// 运行时版本:4.0.30319.42000 // 运行时版本:4.0.30319.42000
// //
// 对此文件的更改可能会导致不正确的行为,并且如果 // 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。 // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace WC_GKJ_OIL.Properties { namespace WC_GKJ_OIL.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default { public static Settings Default {
get { get {
return defaultInstance; return defaultInstance;
} }
} }
} }
} }

View File

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

View File

@@ -249,12 +249,15 @@
<Compile Include="Pages\UC_StationRecord.Designer.cs"> <Compile Include="Pages\UC_StationRecord.Designer.cs">
<DependentUpon>UC_StationRecord.cs</DependentUpon> <DependentUpon>UC_StationRecord.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\UC_Statistics.cs"> <Compile Include="Pages\UC_Statistics.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Pages\UC_Statistics.Designer.cs"> <Compile Include="Pages\UC_WeighingAnalysis.cs">
<DependentUpon>UC_Statistics.cs</DependentUpon> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Pages\UC_Statistics.Designer.cs">
<DependentUpon>UC_Statistics.cs</DependentUpon>
</Compile>
<Compile Include="Core\BarcodeScanner.cs" /> <Compile Include="Core\BarcodeScanner.cs" />
<Compile Include="Core\BarcodeManager.cs" /> <Compile Include="Core\BarcodeManager.cs" />
<Compile Include="Pages\UC_SystemSettings.cs"> <Compile Include="Pages\UC_SystemSettings.cs">
@@ -364,4 +367,4 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -1,46 +1,46 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Http; using System.Web.Http;
using System.Net.Http; using System.Net.Http;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace WebApi namespace WebApi
{ {
public enum ResponseCode public enum ResponseCode
{ {
Fail = 00000, Fail = 00000,
Success = 00200, Success = 00200,
} }
public class ApiTools public class ApiTools
{ {
private string msgModel = "{{\"code\":{0},\"message\":\"{1}\",\"result\":{2}}}"; private string msgModel = "{{\"code\":{0},\"message\":\"{1}\",\"result\":{2}}}";
public ApiTools() public ApiTools()
{ {
} }
public HttpResponseMessage MsgFormat(ResponseCode code, string explanation, string result) public HttpResponseMessage MsgFormat(ResponseCode code, string explanation, string result)
{ {
string r = @"^(\-|\+)?\d+(\.\d+)?$"; string r = @"^(\-|\+)?\d+(\.\d+)?$";
string json = string.Empty; string json = string.Empty;
if (Regex.IsMatch(result, r) || result.ToLower() == "true" || result.ToLower() == "false" || result == "[]" || result.Contains('{')) if (Regex.IsMatch(result, r) || result.ToLower() == "true" || result.ToLower() == "false" || result == "[]" || result.Contains('{'))
{ {
json = string.Format(msgModel, (int)code, explanation, result); json = string.Format(msgModel, (int)code, explanation, result);
} }
else else
{ {
if (result.Contains('"')) if (result.Contains('"'))
{ {
json = string.Format(msgModel, (int)code, explanation, result); json = string.Format(msgModel, (int)code, explanation, result);
} }
else else
{ {
json = string.Format(msgModel, (int)code, explanation, "\"" + result + "\""); json = string.Format(msgModel, (int)code, explanation, "\"" + result + "\"");
} }
} }
return new HttpResponseMessage { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") }; return new HttpResponseMessage { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") };
} }
} }
} }

View File

@@ -1,148 +1,148 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SlMesDbIterface namespace SlMesDbIterface
{ {
public partial class MyHttpRequest { public partial class MyHttpRequest {
public static string MyPost(string url,string jsonStr) public static string MyPost(string url,string jsonStr)
{ {
string result = ""; string result = "";
try try
{ {
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST"; req.Method = "POST";
req.ContentType = "text/html, application/xhtml+xml, application/json, */*"; req.ContentType = "text/html, application/xhtml+xml, application/json, */*";
req.Proxy = null; req.Proxy = null;
req.KeepAlive = false; req.KeepAlive = false;
byte[] data = Encoding.UTF8.GetBytes(jsonStr); byte[] data = Encoding.UTF8.GetBytes(jsonStr);
req.ContentLength = data.Length; req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream()) using (Stream reqStream = req.GetRequestStream())
{ {
reqStream.Write(data, 0, data.Length); reqStream.Write(data, 0, data.Length);
reqStream.Close(); reqStream.Close();
} }
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream(); Stream stream = resp.GetResponseStream();
//获取响应内容 //获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{ {
result = reader.ReadToEnd(); result = reader.ReadToEnd();
} }
Console.WriteLine(result); Console.WriteLine(result);
} }
catch (Exception err) catch (Exception err)
{ {
Console.WriteLine("<Error> " + err.Message); Console.WriteLine("<Error> " + err.Message);
} }
return result; return result;
} }
public static string MyPost(string url,Dictionary<string,string> paramDict, string jsonStr) public static string MyPost(string url,Dictionary<string,string> paramDict, string jsonStr)
{ {
string result = ""; string result = "";
try try
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.Append(url); builder.Append(url);
if (paramDict.Count > 0) if (paramDict.Count > 0)
{ {
builder.Append("?"); builder.Append("?");
int i = 0; int i = 0;
foreach (var item in paramDict) foreach (var item in paramDict)
{ {
if (i > 0) if (i > 0)
builder.Append("&"); builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value); builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++; i++;
} }
} }
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString()); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString());
req.Method = "POST"; req.Method = "POST";
req.ContentType = "text/html, application/xhtml+xml, application/json, */*"; req.ContentType = "text/html, application/xhtml+xml, application/json, */*";
req.Proxy = null; req.Proxy = null;
req.KeepAlive = false; req.KeepAlive = false;
byte[] data = Encoding.UTF8.GetBytes(jsonStr); byte[] data = Encoding.UTF8.GetBytes(jsonStr);
req.ContentLength = data.Length; req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream()) using (Stream reqStream = req.GetRequestStream())
{ {
reqStream.Write(data, 0, data.Length); reqStream.Write(data, 0, data.Length);
reqStream.Close(); reqStream.Close();
} }
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream(); Stream stream = resp.GetResponseStream();
//获取响应内容 //获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{ {
result = reader.ReadToEnd(); result = reader.ReadToEnd();
} }
Console.WriteLine(result); Console.WriteLine(result);
} }
catch (Exception err) catch (Exception err)
{ {
Console.WriteLine("<Error> " + err.Message); Console.WriteLine("<Error> " + err.Message);
} }
return result; return result;
} }
public static string MyGet(string url, Dictionary<string,string> paramDict) public static string MyGet(string url, Dictionary<string,string> paramDict)
{ {
string result = ""; string result = "";
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.Append(url); builder.Append(url);
if (paramDict.Count > 0) if (paramDict.Count > 0)
{ {
builder.Append("?"); builder.Append("?");
int i = 0; int i = 0;
foreach (var item in paramDict) foreach (var item in paramDict)
{ {
if (i > 0) if (i > 0)
builder.Append("&"); builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value); builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++; i++;
} }
} }
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString()); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString());
req.Method = "GET"; req.Method = "GET";
req.ContentType = "text/html, application/xhtml+xml, application/json, */*"; req.ContentType = "text/html, application/xhtml+xml, application/json, */*";
req.Proxy = null; req.Proxy = null;
req.KeepAlive = false; req.KeepAlive = false;
HttpWebResponse response = (HttpWebResponse)req.GetResponse(); HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream rs = response.GetResponseStream(); Stream rs = response.GetResponseStream();
StreamReader sr = new StreamReader(rs, Encoding.UTF8); StreamReader sr = new StreamReader(rs, Encoding.UTF8);
result = sr.ReadToEnd(); result = sr.ReadToEnd();
sr.Close(); sr.Close();
rs.Close(); rs.Close();
return result; return result;
} }
} }
} }

View File

@@ -1,362 +1,367 @@
using MesWork; using MesWork;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.Configuration;
using System.Linq; using System.IO;
using System.Net; using System.Linq;
using System.Text; using System.Net;
using System.Threading.Tasks; using System.Text;
using System.Threading.Tasks;
namespace PLMTEST
{ namespace PLMTEST
public class HttpCli {
{ public class HttpCli
{
/// <summary>
/// 指定Url地址使用Get 方式获取全部字符串 /// <summary>
/// </summary> /// 指定Url地址使用Get 方式获取全部字符串
/// <param name="url">请求链接地址</param> /// </summary>
/// <returns></returns> /// <param name="url">请求链接地址</param>
public static string Get(string url) /// <returns></returns>
{ public static string Get(string url)
string result = ""; {
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); string result = "";
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
Stream stream = resp.GetResponseStream(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
try Stream stream = resp.GetResponseStream();
{ try
//获取内容 {
using (StreamReader reader = new StreamReader(stream)) //获取内容
{ using (StreamReader reader = new StreamReader(stream))
result = reader.ReadToEnd(); {
} result = reader.ReadToEnd();
} }
finally }
{ finally
stream.Close(); {
} stream.Close();
return result; }
} return result;
}
public static void GetFile(string url,string path)
{ public static void GetFile(string url,string path)
WebRequest request = WebRequest.Create(url); {
WebResponse response = request.GetResponse(); WebRequest request = WebRequest.Create(url);
if (response.ContentType.ToLower().Length > 0) WebResponse response = request.GetResponse();
{ if (response.ContentType.ToLower().Length > 0)
using (Stream reader = response.GetResponseStream()) {
{ using (Stream reader = response.GetResponseStream())
using (FileStream writer = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write)) {
{ using (FileStream writer = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write))
byte[] buffer = new byte[1024]; {
int c = 0; byte[] buffer = new byte[1024];
while ((c = reader.Read(buffer, 0, buffer.Length)) > 0) int c = 0;
{ while ((c = reader.Read(buffer, 0, buffer.Length)) > 0)
writer.Write(buffer, 0, c); {
} writer.Write(buffer, 0, c);
} }
} }
//HttpContext }
} //HttpContext
} }
}
public static byte[] GetFile_Bytes(string url)
{ public static byte[] GetFile_Bytes(string url)
byte[] bytesAll = null; {
WebRequest request = WebRequest.Create(url); byte[] bytesAll = null;
WebResponse response = request.GetResponse(); WebRequest request = WebRequest.Create(url);
if (response.ContentType.ToLower().Length > 0) WebResponse response = request.GetResponse();
{ if (response.ContentType.ToLower().Length > 0)
using (Stream reader = response.GetResponseStream()) {
{ using (Stream reader = response.GetResponseStream())
MemoryStream ms = new MemoryStream(); {
byte[] buffer = new byte[1024]; MemoryStream ms = new MemoryStream();
while (true) byte[] buffer = new byte[1024];
{ while (true)
int sz = reader.Read(buffer, 0, 1024); {
if (sz == 0) break; int sz = reader.Read(buffer, 0, 1024);
ms.Write(buffer, 0, sz); if (sz == 0) break;
} ms.Write(buffer, 0, sz);
bytesAll = ms.ToArray(); }
} bytesAll = ms.ToArray();
} }
}
//如是图片
//System.Drawing.Image img = System.Drawing.Image.FromStream(ms); //如是图片
//System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
return bytesAll;
return bytesAll;
}
}
/// <summary>
/// 发送Get请求 /// <summary>
/// </summary> /// 发送Get请求
/// <param name="url">地址</param> /// </summary>
/// <param name="dic">请求参数定义</param> /// <param name="url">地址</param>
/// <returns></returns> /// <param name="dic">请求参数定义</param>
public static string Get(string url, Dictionary<string, string> dic) /// <returns></returns>
{ public static string Get(string url, Dictionary<string, string> dic)
string result = ""; {
StringBuilder builder = new StringBuilder(); string result = "";
builder.Append(url); StringBuilder builder = new StringBuilder();
if (dic.Count > 0) builder.Append(url);
{ if (dic.Count > 0)
builder.Append("?"); {
int i = 0; builder.Append("?");
foreach (var item in dic) int i = 0;
{ foreach (var item in dic)
if (i > 0) {
builder.Append("&"); if (i > 0)
builder.AppendFormat("{0}={1}", item.Key, item.Value); builder.Append("&");
i++; builder.AppendFormat("{0}={1}", item.Key, item.Value);
} i++;
} }
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString()); }
//添加参数 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString());
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); //添加参数
Stream stream = resp.GetResponseStream(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
try Stream stream = resp.GetResponseStream();
{ try
//获取内容 {
using (StreamReader reader = new StreamReader(stream)) //获取内容
{ using (StreamReader reader = new StreamReader(stream))
result = reader.ReadToEnd(); {
} result = reader.ReadToEnd();
} }
finally }
{ finally
stream.Close(); {
} stream.Close();
return result; }
} return result;
}
/// <summary>
/// 指定Post地址使用Get 方式获取全部字符串 /// <summary>
/// </summary> /// 指定Post地址使用Get 方式获取全部字符串
/// <param name="url">请求后台地址</param> /// </summary>
/// <returns></returns> /// <param name="url">请求后台地址</param>
public static string Post(string url) /// <returns></returns>
{ public static string Post(string url)
string result = ""; {
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); string result = "";
req.Method = "POST"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); req.Method = "POST";
Stream stream = resp.GetResponseStream(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
//获取内容 Stream stream = resp.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) //获取内容
{ using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
result = reader.ReadToEnd(); {
} result = reader.ReadToEnd();
return result; }
} return result;
}
/// <summary>
/// 指定Post地址使用Get 方式获取全部字符串 /// <summary>
/// </summary> /// 指定Post地址使用Get 方式获取全部字符串
/// <param name="url">请求后台地址</param> /// </summary>
/// <returns></returns> /// <param name="url">请求后台地址</param>
public static string Post(string url, Dictionary<string, string> dic) /// <returns></returns>
{ public static string Post(string url, Dictionary<string, string> dic)
string result = ""; {
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); string result = "";
req.Method = "POST"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.ContentType = "application/x-www-form-urlencoded"; req.Method = "POST";
#region Post req.ContentType = "application/x-www-form-urlencoded";
StringBuilder builder = new StringBuilder(); #region Post
int i = 0; StringBuilder builder = new StringBuilder();
foreach (var item in dic) int i = 0;
{ foreach (var item in dic)
if (i > 0) {
builder.Append("&"); if (i > 0)
builder.AppendFormat("{0}={1}", item.Key, item.Value); builder.Append("&");
i++; builder.AppendFormat("{0}={1}", item.Key, item.Value);
} i++;
byte[] data = Encoding.UTF8.GetBytes(builder.ToString()); }
req.ContentLength = data.Length; byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
using (Stream reqStream = req.GetRequestStream()) req.ContentLength = data.Length;
{ using (Stream reqStream = req.GetRequestStream())
reqStream.Write(data, 0, data.Length); {
reqStream.Close(); reqStream.Write(data, 0, data.Length);
} reqStream.Close();
#endregion }
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); #endregion
Stream stream = resp.GetResponseStream(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
//获取响应内容 Stream stream = resp.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) //获取响应内容
{ using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
result = reader.ReadToEnd(); {
} result = reader.ReadToEnd();
return result; }
} return result;
}
/// <summary>
/// 指定Post地址使用Get 方式获取全部字符串 /// <summary>
/// </summary> /// 指定Post地址使用Get 方式获取全部字符串
/// <param name="url">请求后台地址</param> /// </summary>
/// <param name="content">Post提交数据内容(utf-8编码的)</param> /// <param name="url">请求后台地址</param>
/// <returns></returns> /// <param name="content">Post提交数据内容(utf-8编码的)</param>
public static string Post_Authorization(string url, string content,out string error ) /// <returns></returns>
{ public static string Post_Authorization(string url, string content,out string error )
string result = ""; {
error = ""; string result = "";
try error = "";
{ try
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); {
req.Timeout = 30000; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST"; req.Timeout = 30000;
req.ContentType = "application/json"; req.Method = "POST";
req.ContentType = "application/json";
// 添加自定义 Header
req.Headers.Add("Authorization", MesWorkForm.AuthorizationSet); // 添加自定义 Header
req.Headers.Add("uuid", Guid.NewGuid().ToString().ToUpper()); string authorization = ConfigurationManager.AppSettings["AuthorizationSet"];
if (!string.IsNullOrWhiteSpace(authorization))
#region Post {
byte[] data = Encoding.UTF8.GetBytes(content); req.Headers.Add("Authorization", authorization);
req.ContentLength = data.Length; }
using (Stream reqStream = req.GetRequestStream()) req.Headers.Add("uuid", Guid.NewGuid().ToString().ToUpper());
{
reqStream.Write(data, 0, data.Length); #region Post
reqStream.Close(); byte[] data = Encoding.UTF8.GetBytes(content);
} req.ContentLength = data.Length;
#endregion using (Stream reqStream = req.GetRequestStream())
{
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); reqStream.Write(data, 0, data.Length);
Stream stream = resp.GetResponseStream(); reqStream.Close();
//获取响应内容 }
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) #endregion
{
result = reader.ReadToEnd(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
} Stream stream = resp.GetResponseStream();
} //获取响应内容
catch (Exception err) using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{ {
error = $"WebApi Post请求调用错误{err.Message}"; result = reader.ReadToEnd();
} }
}
return result; catch (Exception err)
} {
public static string Post(string url, string content, out string error) error = $"WebApi Post请求调用错误{err.Message}";
{ }
string result = "";
error = ""; return result;
try }
{ public static string Post(string url, string content, out string error)
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); {
req.Timeout = 30000; string result = "";
req.Method = "POST"; error = "";
req.ContentType = "application/json"; try
{
#region Post HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
byte[] data = Encoding.UTF8.GetBytes(content); req.Timeout = 30000;
req.ContentLength = data.Length; req.Method = "POST";
using (Stream reqStream = req.GetRequestStream()) req.ContentType = "application/json";
{
reqStream.Write(data, 0, data.Length); #region Post
reqStream.Close(); byte[] data = Encoding.UTF8.GetBytes(content);
} req.ContentLength = data.Length;
#endregion using (Stream reqStream = req.GetRequestStream())
{
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); reqStream.Write(data, 0, data.Length);
Stream stream = resp.GetResponseStream(); reqStream.Close();
//获取响应内容 }
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) #endregion
{
result = reader.ReadToEnd(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
} Stream stream = resp.GetResponseStream();
} //获取响应内容
catch (Exception err) using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{ {
error = $"WebApi Post请求调用错误{err.Message}"; result = reader.ReadToEnd();
} }
}
return result; catch (Exception err)
} {
error = $"WebApi Post请求调用错误{err.Message}";
}
return result;
/// <summary> }
/// Http下载文件
/// </summary>
/// <param name="uri">下载地址</param>
/// <param name="filefullpath">存放完整路径(含文件名)</param>
/// <param name="size">每次多的大小</param> /// <summary>
/// <returns>下载操作是否成功</returns> /// Http下载文件
/// </summary>
public static bool DownLoadFiles(string uri, string filefullpath, int size = 1000000) /// <param name="uri">下载地址</param>
{ /// <param name="filefullpath">存放完整路径(含文件名)</param>
try /// <param name="size">每次多的大小</param>
{ /// <returns>下载操作是否成功</returns>
if (File.Exists(filefullpath))
{ public static bool DownLoadFiles(string uri, string filefullpath, int size = 1000000)
try {
{ try
File.Delete(filefullpath); {
} if (File.Exists(filefullpath))
catch (Exception ex) {
{ try
return false; {
} File.Delete(filefullpath);
} }
catch (Exception ex)
string fileDirectory = System.IO.Path.GetDirectoryName(filefullpath); {
return false;
if (!Directory.Exists(fileDirectory)) }
{ }
Directory.CreateDirectory(fileDirectory);
} string fileDirectory = System.IO.Path.GetDirectoryName(filefullpath);
FileStream fs = new FileStream(filefullpath, FileMode.Create); if (!Directory.Exists(fileDirectory))
{
byte[] buffer = new byte[size]; Directory.CreateDirectory(fileDirectory);
}
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
FileStream fs = new FileStream(filefullpath, FileMode.Create);
request.Timeout = 100000;
byte[] buffer = new byte[size];
request.AddRange((int)fs.Length);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
Stream ns = request.GetResponse().GetResponseStream();
request.Timeout = 100000;
long contentLength = request.GetResponse().ContentLength;
request.AddRange((int)fs.Length);
int length = ns.Read(buffer, 0, buffer.Length);
Stream ns = request.GetResponse().GetResponseStream();
while (length > 0)
{ long contentLength = request.GetResponse().ContentLength;
fs.Write(buffer,0 , length);
buffer = new byte[size]; int length = ns.Read(buffer, 0, buffer.Length);
length = ns.Read(buffer, 0, buffer.Length);
} while (length > 0)
{
fs.Close(); fs.Write(buffer,0 , length);
buffer = new byte[size];
return true; length = ns.Read(buffer, 0, buffer.Length);
} }
catch (Exception ex)
{ fs.Close();
return false;
} return true;
}
} catch (Exception ex)
{
return false;
}
}
}
}
}
}

View File

@@ -1,147 +1,147 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Formatting; using System.Net.Http.Formatting;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Text; using System.Text;
using System.Web.Http; using System.Web.Http;
using System.Web.Http.Cors; using System.Web.Http.Cors;
using System.Web.Http.SelfHost; using System.Web.Http.SelfHost;
namespace WebApi namespace WebApi
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class InitServer public class InitServer
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
HttpSelfHostConfiguration config = null; HttpSelfHostConfiguration config = null;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
HttpSelfHostServer server = null; HttpSelfHostServer server = null;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="port"></param> /// <param name="port"></param>
public InitServer(int port) public InitServer(int port)
{ {
config = new HttpSelfHostConfiguration($"http://localhost:{port}"); config = new HttpSelfHostConfiguration($"http://localhost:{port}");
config.EnableCors(new EnableCorsAttribute("*", "*", "*")); config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
config.MapHttpAttributeRoutes(); config.MapHttpAttributeRoutes();
//config.Routes.MapHttpRoute( //config.Routes.MapHttpRoute(
// name: "DefaultApi", // name: "DefaultApi",
// routeTemplate: "api/{controller}/{id}", // routeTemplate: "api/{controller}/{id}",
// defaults: new { id = RouteParameter.Optional } // defaults: new { id = RouteParameter.Optional }
//); //);
// 自定义路由匹配到action // 自定义路由匹配到action
config.Routes.MapHttpRoute( config.Routes.MapHttpRoute(
name: "API Default", name: "API Default",
routeTemplate: "api/{controller}/{action}/{id}", routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional } defaults: new { id = RouteParameter.Optional }
); );
server = new HttpSelfHostServer(config); server = new HttpSelfHostServer(config);
server.OpenAsync().Wait(); server.OpenAsync().Wait();
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="port"></param> /// <param name="port"></param>
public void Close() public void Close()
{ {
server.CloseAsync(); server.CloseAsync();
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class JsonContentNegotiator : IContentNegotiator public class JsonContentNegotiator : IContentNegotiator
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private readonly JsonMediaTypeFormatter _jsonFormatter; private readonly JsonMediaTypeFormatter _jsonFormatter;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="formatter"></param> /// <param name="formatter"></param>
public JsonContentNegotiator(JsonMediaTypeFormatter formatter) public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
{ {
_jsonFormatter = formatter; _jsonFormatter = formatter;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="type"></param> /// <param name="type"></param>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="formatters"></param> /// <param name="formatters"></param>
/// <returns></returns> /// <returns></returns>
public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters) public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
{ {
var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json")); var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
return result; return result;
} }
public static string Postring1(string url, string token, Dictionary<string, string> dic) public static string Postring1(string url, string token, Dictionary<string, string> dic)
{ {
string results = ""; string results = "";
//url = "http://172.16.22.15:8000/" + url; //url = "http://172.16.22.15:8000/" + url;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST"; req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded"; req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("Authorization", "Bearer " + token); req.Headers.Add("Authorization", "Bearer " + token);
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
int i = 0; int i = 0;
foreach (var item in dic) foreach (var item in dic)
{ {
if (i > 0) if (i > 0)
builder.Append("&"); builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value); builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++; i++;
} }
byte[] data = Encoding.UTF8.GetBytes(builder.ToString()); byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
req.ContentLength = data.Length; req.ContentLength = data.Length;
try try
{ {
using (Stream reqStream = req.GetRequestStream()) using (Stream reqStream = req.GetRequestStream())
{ {
reqStream.Write(data, 0, data.Length); reqStream.Write(data, 0, data.Length);
reqStream.Close(); reqStream.Close();
} }
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream(); Stream stream = resp.GetResponseStream();
//获取响应内容 //获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{ {
results = reader.ReadToEnd(); results = reader.ReadToEnd();
} }
return results; return results;
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(e.Message); Console.WriteLine(e.Message);
return e.Message; return e.Message;
throw; throw;
} }
} }
} }
} }
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,312 +1,312 @@
using ExternalDataSync; using ExternalDataSync;
using MesWork; using MesWork;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
/// <summary> /// <summary>
/// 报警类型 /// 报警类型
/// </summary> /// </summary>
public enum Log_Type public enum Log_Type
{ {
/// <summary> /// <summary>
/// 报警 /// 报警
/// </summary> /// </summary>
ZK_Alarm = 1, ZK_Alarm = 1,
/// <summary> /// <summary>
/// 登录 /// 登录
/// </summary> /// </summary>
ZK_Login = 2, ZK_Login = 2,
/// <summary> /// <summary>
/// 提示 /// 提示
/// </summary> /// </summary>
ZK_Tip = 3, ZK_Tip = 3,
/// <summary> /// <summary>
/// MES处理信号 /// MES处理信号
/// </summary> /// </summary>
ZK_MesHandler = 4, ZK_MesHandler = 4,
/// <summary> /// <summary>
/// 配方下载 /// 配方下载
/// </summary> /// </summary>
ZK_DownloadRecipes = 5, ZK_DownloadRecipes = 5,
/// <summary> /// <summary>
/// 发动机上线 /// 发动机上线
/// </summary> /// </summary>
ZK_OnLine = 6, ZK_OnLine = 6,
/// <summary> /// <summary>
/// 发动机下线 /// 发动机下线
/// </summary> /// </summary>
ZK_OffLine = 7, ZK_OffLine = 7,
/// <summary> /// <summary>
/// MES请求接口的日志 /// MES请求接口的日志
/// </summary> /// </summary>
ZK_Interface_MesReq = 8, ZK_Interface_MesReq = 8,
/// <summary> /// <summary>
/// 1.AGV 请求进入 /// 1.AGV 请求进入
/// </summary> /// </summary>
AGV_To_MES_agvCallback = 9, AGV_To_MES_agvCallback = 9,
/// <summary> /// <summary>
/// 删除 /// 删除
/// 2025.11.25.0024.LLX /// 2025.11.25.0024.LLX
/// </summary> /// </summary>
ZK_Delete = 10, ZK_Delete = 10,
/// <summary> /// <summary>
/// 未定义 /// 未定义
/// </summary> /// </summary>
Undefined = 1000 Undefined = 1000
} }
public enum Log_FromAndTo public enum Log_FromAndTo
{ {
/// <summary> /// <summary>
/// PLC /// PLC
/// </summary> /// </summary>
PLC = 3, PLC = 3,
/// <summary> /// <summary>
/// AGV海康威视 /// AGV海康威视
/// </summary> /// </summary>
HK_AGV = 4, HK_AGV = 4,
/// <summary> /// <summary>
/// LES启明 /// LES启明
/// </summary> /// </summary>
WMS = 5, WMS = 5,
/// <summary> /// <summary>
/// AGV临工 /// AGV临工
/// </summary> /// </summary>
ZK = 10, ZK = 10,
/// <summary> /// <summary>
/// 未定义 /// 未定义
/// </summary> /// </summary>
Undefined = 1000 Undefined = 1000
} }
namespace LogRecord namespace LogRecord
{ {
/// <summary> /// <summary>
/// 日志处理 /// 日志处理
/// </summary> /// </summary>
public partial class LogRecord public partial class LogRecord
{ {
/// <summary> /// <summary>
/// 构造 /// 构造
/// </summary> /// </summary>
public LogRecord() public LogRecord()
{ {
InitializeComponent(); InitializeComponent();
//this.Width = _Width; //this.Width = _Width;
//this.Height = _Height; //this.Height = _Height;
cb_Type.DataSource = Enum.GetNames(typeof(Log_Type)); cb_Type.DataSource = Enum.GetNames(typeof(Log_Type));
cb_Type.Text = Log_Type.Undefined.ToString(); cb_Type.Text = Log_Type.Undefined.ToString();
cb_From.DataSource = Enum.GetNames(typeof(Log_FromAndTo)); cb_From.DataSource = Enum.GetNames(typeof(Log_FromAndTo));
cb_From.Text = Log_FromAndTo.Undefined.ToString(); cb_From.Text = Log_FromAndTo.Undefined.ToString();
cb_To.DataSource = Enum.GetNames(typeof(Log_FromAndTo)); cb_To.DataSource = Enum.GetNames(typeof(Log_FromAndTo));
cb_To.Text = Log_FromAndTo.Undefined.ToString(); cb_To.Text = Log_FromAndTo.Undefined.ToString();
cb_StationName.Items.Add(""); cb_StationName.Items.Add("");
foreach (var stationName in MesWorkForm.opNameList) foreach (var stationName in MesWorkForm.opNameList)
{ {
cb_StationName.Items.Add(stationName); cb_StationName.Items.Add(stationName);
} }
cb_StationName.SelectedIndex = 0; cb_StationName.SelectedIndex = 0;
var end = System.DateTime.Now.AddDays(1); var end = System.DateTime.Now.AddDays(1);
var start = end.AddDays(-3); var start = end.AddDays(-3);
dtp_Start.Value = start; dtp_Start.Value = start;
dtp_End.Value = end; dtp_End.Value = end;
} }
/// <summary> /// <summary>
/// 钩子 /// 钩子
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void LogRecord_Load(object sender, EventArgs e) private void LogRecord_Load(object sender, EventArgs e)
{ {
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="color"></param> /// <param name="color"></param>
/// <param name="dgv"></param> /// <param name="dgv"></param>
private void RowsColor(int row, Color color, DataGridView dgv) private void RowsColor(int row, Color color, DataGridView dgv)
{ {
var dt = (System.Data.DataTable)dgv.DataSource; var dt = (System.Data.DataTable)dgv.DataSource;
for (int i = 0; i < dt.Columns.Count; i++) for (int i = 0; i < dt.Columns.Count; i++)
{ {
dgv.Rows[row].Cells[i].Style.BackColor = color; dgv.Rows[row].Cells[i].Style.BackColor = color;
} }
} }
public static bool Insert_ScanLog_EleCraft(Log_Type LogType,string stationName, string Log_Content) public static bool Insert_ScanLog_EleCraft(Log_Type LogType,string stationName, string Log_Content)
{ {
bool success = false; bool success = false;
var sql = var sql =
$" INSERT INTO [记录_日志_扫码发送电子工艺]([Log_Station],[Log_Type],[Log_Time],[Log_Content])" + $" INSERT INTO [记录_日志_扫码发送电子工艺]([Log_Station],[Log_Type],[Log_Time],[Log_Content])" +
$" VALUES('{stationName}','{LogType.ToString()}',getdate(),'{Log_Content}')"; $" VALUES('{stationName}','{LogType.ToString()}',getdate(),'{Log_Content}')";
success = DataLinkMesWork.SQLCommon.ExecuteSql(sql, MesWorkForm.ConnectionString, out string err2); success = DataLinkMesWork.SQLCommon.ExecuteSql(sql, MesWorkForm.ConnectionString, out string err2);
return success; return success;
} }
/// <summary> /// <summary>
/// 手动刷新 /// 手动刷新
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void btn_Refresh_Click(object sender, EventArgs e) private void btn_Refresh_Click(object sender, EventArgs e)
{ {
try try
{ {
var start = dtp_Start.Value; var start = dtp_Start.Value;
var end = dtp_End.Value; var end = dtp_End.Value;
var stationName = cb_StationName.Text; var stationName = cb_StationName.Text;
var type = (Log_Type)Enum.Parse(typeof(Log_Type), cb_Type.Text); var type = (Log_Type)Enum.Parse(typeof(Log_Type), cb_Type.Text);
var taskID = txt_TaskID.Text; var taskID = txt_TaskID.Text;
var from = (Log_FromAndTo)Enum.Parse(typeof(Log_FromAndTo), cb_From.Text); var from = (Log_FromAndTo)Enum.Parse(typeof(Log_FromAndTo), cb_From.Text);
var to = (Log_FromAndTo)Enum.Parse(typeof(Log_FromAndTo), cb_To.Text); var to = (Log_FromAndTo)Enum.Parse(typeof(Log_FromAndTo), cb_To.Text);
var req = txt_Req.Text; var req = txt_Req.Text;
var rsp = txt_Rsp.Text; var rsp = txt_Rsp.Text;
var whereStr = ""; var whereStr = "";
if (start != null & end != null) if (start != null & end != null)
{ {
whereStr = whereStr + $" AND [请求时间] >= '{start.ToString("G")}' AND [请求时间] < '{end.ToString("yyyy-MM-dd 23:59:59")}'"; whereStr = whereStr + $" AND [请求时间] >= '{start.ToString("G")}' AND [请求时间] < '{end.ToString("yyyy-MM-dd 23:59:59")}'";
} }
if (!string.IsNullOrEmpty(stationName) && !string.IsNullOrEmpty(req)) if (!string.IsNullOrEmpty(stationName) && !string.IsNullOrEmpty(req))
{ {
whereStr = whereStr + $" AND ([工位号] = '{stationName}' OR [请求内容] like '%{req}%')"; whereStr = whereStr + $" AND ([工位号] = '{stationName}' OR [请求内容] like '%{req}%')";
} }
else if (!string.IsNullOrEmpty(stationName)) else if (!string.IsNullOrEmpty(stationName))
{ {
whereStr = whereStr + $" AND [工位号] = '{stationName}'"; whereStr = whereStr + $" AND [工位号] = '{stationName}'";
} }
else if (!string.IsNullOrEmpty(req)) else if (!string.IsNullOrEmpty(req))
{ {
whereStr = whereStr + $" AND [请求内容] like '%{req}%'"; whereStr = whereStr + $" AND [请求内容] like '%{req}%'";
} }
if (type != Log_Type.Undefined) if (type != Log_Type.Undefined)
{ {
whereStr = whereStr + $" AND [日志类型] = '{type.ToString()}'"; whereStr = whereStr + $" AND [日志类型] = '{type.ToString()}'";
} }
if (!string.IsNullOrEmpty(taskID)) if (!string.IsNullOrEmpty(taskID))
{ {
whereStr = whereStr + $" AND [TaskID] like '%{taskID}%'"; whereStr = whereStr + $" AND [TaskID] like '%{taskID}%'";
} }
if (from != Log_FromAndTo.Undefined) if (from != Log_FromAndTo.Undefined)
{ {
whereStr = whereStr + $" AND [请求FROM] like '%{from}%'"; whereStr = whereStr + $" AND [请求FROM] like '%{from}%'";
} }
if (to != Log_FromAndTo.Undefined) if (to != Log_FromAndTo.Undefined)
{ {
whereStr = whereStr + $" AND [请求TO] like '%{to}%'"; whereStr = whereStr + $" AND [请求TO] like '%{to}%'";
} }
if (!string.IsNullOrEmpty(rsp)) if (!string.IsNullOrEmpty(rsp))
{ {
whereStr = whereStr + $" AND [响应内容] like '%{rsp}%'"; whereStr = whereStr + $" AND [响应内容] like '%{rsp}%'";
} }
var sql = var sql =
$" SELECT " + $" SELECT " +
$" [工位号] '工位号'" + $" [工位号] '工位号'" +
$" ,[日志类型] '类型'" + $" ,[日志类型] '类型'" +
$" ,[请求时间] '请求时间'" + $" ,[请求时间] '请求时间'" +
$" ,[请求内容] '请求内容'" + $" ,[请求内容] '请求内容'" +
$" ,[响应时间] '响应时间'" + $" ,[响应时间] '响应时间'" +
$" ,[响应内容] '响应内容'" + $" ,[响应内容] '响应内容'" +
$" ,[请求CMD] 'CMD'" + $" ,[请求CMD] 'CMD'" +
$" ,[请求FROM] 'FROM'" + $" ,[请求FROM] 'FROM'" +
$" ,[请求TO] 'TO'" + $" ,[请求TO] 'TO'" +
$" ,[TaskID] 'TaskID'" + $" ,[TaskID] 'TaskID'" +
$" ,[AID] 'AID'" + $" ,[AID] 'AID'" +
$" FROM [记录_日志_项目运行日志]" + $" FROM [记录_日志_项目运行日志]" +
$" WHERE 1=1 {whereStr}" + $" WHERE 1=1 {whereStr}" +
$" ORDER BY [请求时间] DESC"; $" ORDER BY [请求时间] DESC";
DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, MesWorkForm.ConnectionString, out DataTable dt, out string err2); DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, MesWorkForm.ConnectionString, out DataTable dt, out string err2);
label_Count.Text = $"消息数量:{dt.Rows.Count}"; label_Count.Text = $"消息数量:{dt.Rows.Count}";
dgv_Log.DataSource = dt; dgv_Log.DataSource = dt;
for (int i = 0; i < dt.Rows.Count; i++) for (int i = 0; i < dt.Rows.Count; i++)
{ {
// Log_Type LogType = Log_Type.Undefined; // Log_Type LogType = Log_Type.Undefined;
var LogTypeStr = ""; var LogTypeStr = "";
try try
{ {
LogTypeStr = dt.Rows[i]["类型"].ToString(); LogTypeStr = dt.Rows[i]["类型"].ToString();
// LogType = (Log_Type)Enum.Parse(typeof(Log_Type), LogTypeStr); // LogType = (Log_Type)Enum.Parse(typeof(Log_Type), LogTypeStr);
} }
catch (Exception err) catch (Exception err)
{ {
MessageBox.Show($"填充日志类型,类型转换出错!{err.Message}"); MessageBox.Show($"填充日志类型,类型转换出错!{err.Message}");
break; break;
} }
switch (LogTypeStr) switch (LogTypeStr)
{ {
case "ZK_Alarm": case "ZK_Alarm":
case "ZK_Delete": case "ZK_Delete":
RowsColor(i, MesWorkForm.color_Red, dgv_Log); RowsColor(i, MesWorkForm.color_Red, dgv_Log);
break; break;
case "ZK_Login": case "ZK_Login":
RowsColor(i, MesWorkForm.color_Green, dgv_Log); RowsColor(i, MesWorkForm.color_Green, dgv_Log);
break; break;
case "ZK_Tip": case "ZK_Tip":
RowsColor(i, MesWorkForm.color_Yellow, dgv_Log); RowsColor(i, MesWorkForm.color_Yellow, dgv_Log);
break; break;
default: default:
RowsColor(i, MesWorkForm.color_Grey, dgv_Log); RowsColor(i, MesWorkForm.color_Grey, dgv_Log);
break; break;
} }
} }
dgv_Log.ClearSelection(); dgv_Log.ClearSelection();
//dgv_Log.CurrentCell = null; //dgv_Log.CurrentCell = null;
//dgv_Log.Rows[0].Selected = false; //dgv_Log.Rows[0].Selected = false;
} }
catch (Exception err) catch (Exception err)
{ {
MessageBox.Show($"点击查询按钮产生的未预知错误:【{err.Message }】------{err.StackTrace}"); MessageBox.Show($"点击查询按钮产生的未预知错误:【{err.Message }】------{err.StackTrace}");
} }
} }
private void dgv_Log_CellClick(object sender, DataGridViewCellEventArgs e) private void dgv_Log_CellClick(object sender, DataGridViewCellEventArgs e)
{ {
try try
{ {
var AID = dgv_Log.CurrentRow.Cells["AID"].Value.ToString(); var AID = dgv_Log.CurrentRow.Cells["AID"].Value.ToString();
var sql = $"SELECT [请求内容安全] FROM [记录_日志_项目运行日志] WHERE [AID] = '{AID}'"; var sql = $"SELECT [请求内容安全] FROM [记录_日志_项目运行日志] WHERE [AID] = '{AID}'";
DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, MesWorkForm.ConnectionString, out DataTable dt, out string err2); DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, MesWorkForm.ConnectionString, out DataTable dt, out string err2);
var reqStrSafe = dt.Rows[0][0].ToString(); var reqStrSafe = dt.Rows[0][0].ToString();
var reqStr = dgv_Log.CurrentRow.Cells["请求内容"].Value.ToString(); var reqStr = dgv_Log.CurrentRow.Cells["请求内容"].Value.ToString();
txt_RequestContext_3.Text = reqStr; txt_RequestContext_3.Text = reqStr;
txt_ResponseContext_3.Text = dgv_Log.CurrentRow.Cells["响应内容"].Value.ToString(); txt_ResponseContext_3.Text = dgv_Log.CurrentRow.Cells["响应内容"].Value.ToString();
} }
catch (Exception err) catch (Exception err)
{ {
} }
} }
} }
} }

View File

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

View File

@@ -1,31 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505 VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WC_GKJ_OIL", "SCADA\WC_GKJ_OIL.csproj", "{A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WC_GKJ_OIL", "SCADA\WC_GKJ_OIL.csproj", "{A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01_MW_Log", "MW_Log\01_MW_Log.csproj", "{1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01_MW_Log", "MW_Log\01_MW_Log.csproj", "{1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Debug|Any CPU.Build.0 = Debug|Any CPU {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Release|Any CPU.ActiveCfg = Release|Any CPU {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Release|Any CPU.Build.0 = Release|Any CPU {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Release|Any CPU.Build.0 = Release|Any CPU
{1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}.Release|Any CPU.Build.0 = Release|Any CPU {1AC112C4-2400-4D03-A26D-2E3ACE6FE6D4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {69A6FC91-6BE5-4336-BCE5-EF3A80318EBA} SolutionGuid = {69A6FC91-6BE5-4336-BCE5-EF3A80318EBA}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal