chore: initial commit

This commit is contained in:
XingCheng3
2026-05-29 09:34:04 +08:00
commit 78ae9dcd2e
683 changed files with 68110 additions and 0 deletions

24
.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
## Visual Studio
.vs/
[Bb]in/
[Oo]bj/
packages/
*.user
*.suo
*.userosscache
*.sln.docstates
*.userprefs
## Build results
[Dd]ebug/
[Rr]elease/
x64/
x86/
[Aa][Rr][Mm]/
[Bb]uild/
bld/
## Logs / temp
*.log
*.tmp
*.cache

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

@@ -0,0 +1,3 @@
{
"claudeCodeChat.permissions.yoloMode": false
}

View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32901.82
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MesDataFunction", "MesDataFunction\MesDataFunction.csproj", "{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {48DF007D-B08C-43B9-9AC7-78F6B2C23954}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MesDataFunction</RootNamespace>
<AssemblyName>09MesDataFunction</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BasicData">
<HintPath>..\..\..\dll_common\BasicData.dll</HintPath>
</Reference>
<Reference Include="ConLink">
<HintPath>..\..\..\dll_common\ConLink.dll</HintPath>
</Reference>
<Reference Include="ConLink19">
<HintPath>..\..\..\dll_common\ConLink19.dll</HintPath>
</Reference>
<Reference Include="DataLinkMesWork">
<HintPath>..\..\..\dll_common\DataLinkMesWork.dll</HintPath>
</Reference>
<Reference Include="MesWork.DeviceDriver">
<HintPath>..\..\..\dll_common\MesWork.DeviceDriver.dll</HintPath>
</Reference>
<Reference Include="Monitor.MesWork">
<HintPath>..\..\..\dll_common\Monitor.MesWork.dll</HintPath>
</Reference>
<Reference Include="MQTTnet">
<HintPath>..\..\..\dll_common\MQTTnet.dll</HintPath>
</Reference>
<Reference Include="MQTTnet.Extensions.ManagedClient">
<HintPath>..\..\..\dll_common\MQTTnet.Extensions.ManagedClient.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\dll_common\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NPOI">
<HintPath>..\..\..\dll_common\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML">
<HintPath>..\..\..\dll_common\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net">
<HintPath>..\..\..\dll_common\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats">
<HintPath>..\..\..\dll_common\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Client">
<HintPath>..\..\..\dll_common\Opc.Ua.Client.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Configuration">
<HintPath>..\..\..\dll_common\Opc.Ua.Configuration.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Core">
<HintPath>..\..\..\dll_common\Opc.Ua.Core.dll</HintPath>
</Reference>
<Reference Include="OpcUaHelper">
<HintPath>..\..\..\dll_common\OpcUaHelper.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="04-DataBaseAccess\DataAccess.cs" />
<Compile Include="04-DataBaseAccess\JsonHelper.cs" />
<Compile Include="08-WebFun_base\MesWebFun_base.cs" />
<Compile Include="08-WebFun_base\MesWebFun_baseFun.cs" />
<Compile Include="12SendMessageToWeb\MIS.SendMessage.cs" />
<Compile Include="12SendMessageToWeb\Mqtt.cs" />
<Compile Include="12SendMessageToWeb\SendMessage.cs" />
<Compile Include="12SendMessageToWeb\SendMessageFun.cs" />
<Compile Include="13MIS_FuntionSaveData\Funtion.Alarm.cs" />
<Compile Include="13MIS_FuntionSaveData\Funtion.MesRead.cs" />
<Compile Include="13MIS_FuntionSaveData\GetQualityData_GoodBad.cs" />
<Compile Include="14MisDataFunctionDB\CommFun_CATL.cs" />
<Compile Include="14MisDataFunctionDB\MisDataFun.Base.DB.cs" />
<Compile Include="14MisDataFunctionDB\MisDataFun.CommonUtils.cs" />
<Compile Include="14MisDataFunctionDB\MisDataFun.DB.cs" />
<Compile Include="14MisDataFunctionDB\MisDataFun.MES.cs" />
<Compile Include="14MisDataFunctionDB\MisDataFun.ShaftPositionData.cs" />
<Compile Include="14MisDataFunctionDB\MisDataFun.TagTypeCodeID.cs" />
<Compile Include="14MisDataFunctionDB\Reflection.cs" />
<Compile Include="LoadTagTypeCodeID.cs" />
<Compile Include="MesDataFunction\InitTagValueListData.cs" />
<Compile Include="MesDataFunction\MIS.Hashtable.cs" />
<Compile Include="MesDataFunction\MIS.Hashtable.TagID.cs" />
<Compile Include="MesDataFunction\MIS.OpcServerMIS.Read.cs" />
<Compile Include="MesDataFunction\MIS.OpcServerMIS.Write.cs" />
<Compile Include="MesDataFunction\MIS.QualityData.Read.cs" />
<Compile Include="MesWorkPlc.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MesDataFunction\MIS_BASE.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ToPrinter\PP.cs" />
<Compile Include="ToPrinter\PrinterCommandCenter.cs" />
<Compile Include="ToPrinter\PrintTo.cs" />
<Compile Include="ToPrinter\Print_Sql.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MyLog4Net\00_MyLog4Net.csproj">
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
<Name>00_MyLog4Net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<Folder Include="MisDataFunction\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,746 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataLinkMesWork1
{
public class DataAccess
{
// 读配置文件有问题,先直接写死
public static string ConnectionString_MES = ConfigurationManager.AppSettings["ConnectionString_MES"];
public static bool ExecuteNonQuery(string sql, string connectionString, out string errorMessage)
{
bool result = false;
errorMessage = "";
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
cmd.ExecuteNonQuery();
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
//ApplicationLog.WriteLog(e, "\r\nExecuteNonQuery\r\nSQL<51><4C>䣺\r\n" + sql + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteDataset(string sql, string connectionString, out DataSet ds, out string errorMessage)
{
errorMessage = "";
bool result = true;
errorMessage = "";
ds = new DataSet();
/// SQLSERVER
/// SQLiteDB
try
{
//bool result = false;
errorMessage = "";
ds = new DataSet();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(sql, conn);
dsCommand.Fill(ds);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
//ApplicationLog.WriteLog(e, "\r\nExecuteNonQuery\r\nSQL<51><4C>䣺\r\n" + sql + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
catch (Exception err)
{
}
return result;
}
/// <summary>
/// 增 删 改
/// </summary>
/// <param name="procedureName"></param>
/// <param name="sqlParameters"></param>
/// <returns></returns>
public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters)
{
string connectionString = ConnectionString_MES;
string errorMessage;
bool result = false;
errorMessage = "";
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlCommand cmd = new SqlCommand(procedureName, conn))
{
cmd.CommandTimeout = 0;
cmd.CommandType = CommandType.StoredProcedure;
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
cmd.Parameters.Add(sqlParameters[i]);
}
}
cmd.ExecuteNonQuery();
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
if (conn.State == ConnectionState.Open)
conn.Close();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + procedureName + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters,out DataTable dt)
{
string connectionString = ConnectionString_MES;
string errorMessage;
bool result = false;
errorMessage = "";
//ds = new DataSet();
dt = new DataTable();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
dsCommand.SelectCommand.CommandTimeout = 0;
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
}
}
dsCommand.Fill(dt);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + procedureName + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters, out DataSet ds)
{
string connectionString = ConnectionString_MES;
string errorMessage;
bool result = false;
errorMessage = "";
ds = new DataSet();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
dsCommand.SelectCommand.CommandTimeout = 0;
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
}
}
dsCommand.Fill(ds);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + procedureName + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters, out string errorMessage)
{
string connectionString = ConnectionString_MES;
bool result = false;
errorMessage = "";
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlCommand cmd = new SqlCommand(procedureName, conn))
{
cmd.CommandTimeout = 0;
cmd.CommandType = CommandType.StoredProcedure;
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
cmd.Parameters.Add(sqlParameters[i]);
}
}
cmd.ExecuteNonQuery();
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
if (conn.State == ConnectionState.Open)
conn.Close();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + procedureName + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters, out DataTable dt, out string errorMessage)
{
string connectionString = ConnectionString_MES;
bool result = false;
errorMessage = "";
//ds = new DataSet();
dt = new DataTable();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
dsCommand.SelectCommand.CommandTimeout = 0;
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
}
}
dsCommand.Fill(dt);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + procedureName + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage)
{
string connectionString = ConnectionString_MES;
bool result = false;
errorMessage = "";
ds = new DataSet();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
dsCommand.SelectCommand.CommandTimeout = 0;
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
}
}
dsCommand.Fill(ds);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + procedureName + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteDataset(string sql, out DataSet ds)
{
string errorMessage;
string connectionString = ConnectionString_MES;
bool result = false;
errorMessage = "";
ds = new DataSet();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(sql, conn);
dsCommand.Fill(ds);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteNonQuery\r\nSQL<51><4C>䣺\r\n" + sql + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteDataTable(string sql, out DataTable dt)
{
//public static bool ExecuteDataTable(string sql, string connectionString, out DataTable dt, out string errorMessage)
string errorMessage;
string connectionString = ConnectionString_MES;
bool result = false;
errorMessage = "";
dt = new DataTable();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(sql, conn);
dsCommand.Fill(dt);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteNonQuery\r\nSQL<51><4C>䣺\r\n" + sql + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static DataTable ExecuteSQL(string sql, ref SqlParameter[] sqlParameters)
{
string connectionString = ConnectionString_MES;
string err;
bool result = false;
err = "";
DataTable dt = new DataTable();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter(sql, conn))
{
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
}
}
dsCommand.Fill(dt);
}
result = true;
}
catch (Exception e)
{
err = e.ToString();
////ApplicationLog.WriteLog(e, "\r\nExecuteSelectMesWork\r\n" + sql + "\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return dt;
}
public static bool ExecuteSQL(string sql)
{
string connectionString = ConnectionString_MES;
string errorMessage;
bool result = false;
errorMessage = "";
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
cmd.ExecuteNonQuery();
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteNonQuery\r\nSQL<51><4C>䣺\r\n" + sql + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
/// <summary>
/// 提供通用的调用存储过程的方法(增加数据的数据表的到数据库的调用)
/// </summary>
/// <param name="procedureName">存储过程名称</param>
/// <param name="sqlParameters">存储过程参数数组</param>
/// <param name="dt">增加数据的数据表</param>
/// <returns></returns>
public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters, DataTable dt)
{
string connectionString = ConnectionString_MES;
string errorMessage;
bool result = false;
errorMessage = "";
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
// if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.InsertCommand = new SqlCommand(procedureName, conn);
dsCommand.InsertCommand.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.InsertCommand.Parameters.Add(sqlParameters[i]);
}
if (dt == null) return false;
dt.AcceptChanges();
for (int i = 0; i < dt.Rows.Count; i++)
{
dt.Rows[i].SetAdded();
}
dsCommand.Update(dt);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + procedureName + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
/// <summary>
/// 提供通用的调用存储过程的方法(增加数据的数据表的到数据库的调用)
/// </summary>
/// <param name="procedureName"></param>
/// <param name="dt"></param>
/// <returns></returns>
public static bool ExecuteStoredProcedure(string procedureName, out DataTable dt)
{
string connectionString = ConnectionString_MES;
string errorMessage;
bool result = false;
errorMessage = "";
dt = new DataTable();
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
dsCommand.Fill(dt);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + procedureName + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
/// <summary>
///
/// </summary>
/// <param name="sql"></param>
/// <param name="sqlParameters"></param>
/// <param name="tb"></param>
/// <returns></returns>
public static bool ExecuteSQL(string sql, ref SqlParameter[] sqlParameters, DataTable dt)
{
string connectionString = ConnectionString_MES;
string errorMessage;
bool result = false;
errorMessage = "";
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
// if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.InsertCommand = new SqlCommand(sql, conn);
for (int i = 0; i < sqlParameters.Length; i++)
{
sqlParameters[i].IsNullable = true;
dsCommand.InsertCommand.Parameters.Add(sqlParameters[i]);
}
if (dt == null) return false;
dt.AcceptChanges();
for (int i = 0; i < dt.Rows.Count; i++)
{
dt.Rows[i].SetAdded();
}
dsCommand.Update(dt);
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
//ApplicationConfig.ConnectionStringPIS_NEW_Value = "0";
//TestConnection();
//errorMessage = e.ToString();
////ApplicationLog.WriteLog(e, "\r\nExecuteSQL\r\nSQL<51><4C>䣺\r\n" + sql + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
public static bool ExecuteNonQuery_newID(string sql, out long newID)
{
sql += ";select @@identity";
string connectionString;
connectionString = ConnectionString_MES;
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
conn.Open();
newID = Convert.ToInt64(cmd.ExecuteScalar());
}
return true;
}
catch (Exception e)
{
newID = 0;
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\n ExecuteNonQuery_newID\r\n<><EFBFBD><E6B4A2><EFBFBD>̣<EFBFBD>\r\n" + sql + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
return false;
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
}
public static bool ExecuteOutNum(string sql, out int count)
{
string connectionString;
connectionString = ConnectionString_MES;
string errorMessage;
bool result = false;
errorMessage = "";
using (SqlConnection conn = new SqlConnection(connectionString))
{
count = 0;
try
{
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
count = Convert.ToInt32(cmd.ExecuteScalar().ToString());
}
//SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
//TestConnection();
////ApplicationLog.WriteLog(e, "\r\nExecuteNonQuery\r\nSQL<51><4C>䣺\r\n" + sql + "\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
}
}

View File

@@ -0,0 +1,336 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Data;
using System.Runtime.Serialization.Json;
using System.Web.Script.Serialization;
//using System.Runtime.Serialization.Json;
//using System.Runtime.Serialization.Json;
public class JsonHelper
{
#region
// 序列化
public static string JsonSerializer<T>(T t)
{
// 使用 DataContractJsonSerializer 将 T 对象序列化为内存流。
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(T));
MemoryStream ms = new MemoryStream();
// 使用 WriteObject 方法将 JSON 数据写入到流中。
jsonSerializer.WriteObject(ms, t);
// 流转字符串
string jsonString = Encoding.UTF8.GetString(ms.ToArray());
ms.Close();
//替换Json的Date字符串
string p = @"\\/Date\((\d+)\+\d+\)\\/";
MatchEvaluator matchEvaluator = new MatchEvaluator(ConvertJsonDateToDateString);
Regex reg = new Regex(p);
jsonString = reg.Replace(jsonString, matchEvaluator);
return jsonString;
}
public static T JsonDeserialize<T>(string jsonString)
{
//将"yyyy-MM-dd HH:mm:ss"格式的字符串转为"\/Date(1294499956278+0800)\/"格式
string p = @"\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}";
MatchEvaluator matchEvaluator = new MatchEvaluator(ConvertDateStringToJsonDate);
Regex reg = new Regex(p);
jsonString = reg.Replace(jsonString, matchEvaluator);
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(T));
// 字符串转流
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));
// 通过使用 DataContractJsonSerializer 的 ReadObject 方法,将 JSON 编码数据反序列化为T
T obj = (T)jsonSerializer.ReadObject(ms);
return obj;
}
public static string ConvertJsonDateToDateString(Match match)
{
string result = string.Empty;
DateTime dateTime = new DateTime(1970, 1, 1);
dateTime = dateTime.AddMilliseconds(long.Parse(match.Groups[1].Value));
dateTime = dateTime.ToLocalTime();
result = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
return result;
}
private static string ConvertDateStringToJsonDate(Match m)
{
string result = string.Empty;
DateTime dt = DateTime.Parse(m.Groups[0].Value);
dt = dt.ToUniversalTime();
TimeSpan ts = dt - DateTime.Parse("1970-01-01");
result = string.Format("\\/Date({0}+0800)\\/", ts.TotalMilliseconds);
return result;
}
#endregion
// 对象转换为Json
public static string ObjectToJson(object obj)
{
JavaScriptSerializer js = new JavaScriptSerializer();
js.MaxJsonLength = Int32.MaxValue; // 定义JavaScriptSerializer接受字符串的最大长度 hdk 20180524
try
{
return js.Serialize(obj);
}
catch (Exception exception)
{
throw new Exception(exception.Message);
}
}
// 数据表转化为集合
public static List<Dictionary<string, object>> DataTableToList(DataTable dt)
{
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
foreach (DataRow dataRow in dt.Rows)
{
Dictionary<string, object> dic = new Dictionary<string, object>();
foreach (DataColumn dc in dt.Columns)
{
if (dataRow[dc.ColumnName].GetType() == typeof(DateTime))
{
string str = Convert.ToDateTime(dataRow[dc.ColumnName]).ToString("yyyy-MM-dd HH:mm:ss");
dic.Add(dc.ColumnName, str);
}
else if
(dataRow[dc.ColumnName].GetType() == typeof(byte[]))
{
string str = Convert.ToBase64String((byte[])dataRow[dc.ColumnName]);
dic.Add(dc.ColumnName, str);
}
else
{
dic.Add(dc.ColumnName, dataRow[dc.ColumnName]);
}
//Type type1 = dt.Rows[0]["产品图片"].GetType();
//Type type2 = typeof(byte[]);
}
list.Add(dic);
}
return list;
}
/// <summary>
/// 表转换为Json
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public static string DataTableToJson(DataTable dt)
{
return ObjectToJson(DataTableToList(dt));
}
/// <summary>
/// 将DataTable中的数据转换成JSON格式
/// </summary>
/// <param name="dt">数据源DataTable</param>
/// <param name="displayCount">是否输出数据总条数</param>
/// <param name="totalcount">JSON中显示的数据总条数</param>
/// <returns></returns>
public static string CreateJsonParameters(DataTable dt, bool displayCount, int totalcount)
{
StringBuilder JsonString = new StringBuilder();
//Exception Handling
if (dt != null)
{
JsonString.Append("{ ");
JsonString.Append("\"rows\":[ ");
for (int i = 0; i < dt.Rows.Count; i++)
{
JsonString.Append("{ ");
for (int j = 0; j < dt.Columns.Count; j++)
{
if (j < dt.Columns.Count - 1)
{
//if (dt.Rows[i][j] == DBNull.Value) continue;
if (dt.Columns[j].DataType == typeof(bool))
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" +
dt.Rows[i][j].ToString().ToLower() + ",");
}
else if (dt.Columns[j].DataType == typeof(string))
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" +
ObjectToJson(dt.Rows[i][j]).ToString() + ",");
//JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" +
// dt.Rows[i][j].ToString().Replace("\"", "\\\"") + "\",");
}
else
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" + dt.Rows[i][j] + "\",");
}
}
else if (j == dt.Columns.Count - 1)
{
//if (dt.Rows[i][j] == DBNull.Value) continue;
if (dt.Columns[j].DataType == typeof(bool))
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" +
dt.Rows[i][j].ToString().ToLower());
}
else if (dt.Columns[j].DataType == typeof(string))
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" +
ObjectToJson(dt.Rows[i][j]).ToString());
//JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" +
// dt.Rows[i][j].ToString().Replace("\"", "\\\"") + "\"");
}
else
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" + dt.Rows[i][j] + "\"");
}
}
}
/*end Of String*/
if (i == dt.Rows.Count - 1)
{
JsonString.Append("} ");
}
else
{
JsonString.Append("}, ");
}
}
JsonString.Append("]");
if (displayCount)
{
JsonString.Append(",");
JsonString.Append("\"total\":");
JsonString.Append(totalcount);
}
JsonString.Append("}");
return JsonString.ToString().Replace("\n", "");
}
else
{
return null;
}
}
public static string CreateJsonParameters(DataTable dt)
{
StringBuilder JsonString = new StringBuilder();
//Exception Handling
if (dt != null)
{
JsonString.Append("{ ");
JsonString.Append("\"rows\":[ ");
for (int i = 0; i < dt.Rows.Count; i++)
{
JsonString.Append("{ ");
for (int j = 0; j < dt.Columns.Count; j++)
{
if (j < dt.Columns.Count - 1)
{
//if (dt.Rows[i][j] == DBNull.Value) continue;
if (dt.Columns[j].DataType == typeof(bool))
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" +
dt.Rows[i][j].ToString().ToLower() + ",");
}
else if (dt.Columns[j].DataType == typeof(string))
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" +
ObjectToJson(dt.Rows[i][j]).ToString() + ",");
//JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" +
// dt.Rows[i][j].ToString().Replace("\"", "\\\"") + "\",");
}
else
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" + dt.Rows[i][j] + "\",");
}
}
else if (j == dt.Columns.Count - 1)
{
//if (dt.Rows[i][j] == DBNull.Value) continue;
if (dt.Columns[j].DataType == typeof(bool))
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" +
dt.Rows[i][j].ToString().ToLower());
}
else if (dt.Columns[j].DataType == typeof(string))
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" +
ObjectToJson(dt.Rows[i][j]).ToString());
//JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" +
// dt.Rows[i][j].ToString().Replace("\"", "\\\"") + "\"");
}
else
{
JsonString.Append("\"" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" + dt.Rows[i][j] + "\"");
}
}
}
/*end Of String*/
if (i == dt.Rows.Count - 1)
{
JsonString.Append("} ");
}
else
{
JsonString.Append("}, ");
}
}
JsonString.Append("]");
JsonString.Append("}");
return JsonString.ToString().Replace("\n", "");
}
else
{
return null;
}
}
StringBuilder result = new StringBuilder();
StringBuilder sb = new StringBuilder();
/// <summary>
/// 根据DataTable生成EasyUI Tree Json树结构
/// </summary>
/// <param name="tabel">数据源</param>
/// <param name="idCol">ID列</param>
/// <param name="txtCol">Text列</param>
/// <param name="url">节点Url</param>
/// <param name="rela">关系字段</param>
/// <param name="pId">父ID</param>
public string GetTreeJsonByTable(DataTable tabel, string idCol, string txtCol, string url, string rela, object pId)
{
result.Append(sb.ToString());
sb.Clear();
if (tabel.Rows.Count > 0)
{
sb.Append("[");
string filer = string.Format("{0}='{1}'", rela, pId);
DataRow[] rows = tabel.Select(filer);
if (rows.Length > 0)
{
foreach (DataRow row in rows)
{
sb.Append("{\"id\":\"" + row[idCol] + "\",\"text\":\"" + row[txtCol] + "\",\"attributes\":\"" + row[url] + "\",\"state\":\"open\"");
if (tabel.Select(string.Format("{0}='{1}'", rela, row[idCol])).Length > 0)
{
sb.Append(",\"children\":");
GetTreeJsonByTable(tabel, idCol, txtCol, url, rela, row[idCol]);
result.Append(sb.ToString());
sb.Clear();
}
result.Append(sb.ToString());
sb.Clear();
sb.Append("},");
}
sb = sb.Remove(sb.Length - 1, 1);
}
sb.Append("]");
result.Append(sb.ToString());
sb.Clear();
}
return result.ToString();
}
}

View File

@@ -0,0 +1,165 @@
using System;
namespace MesWebFun_base
{
public partial class MisWebInterface
{
public static MesWebFun_base _MesWebFun_base = new MesWebFun_base();
public string WebSocket_Function(string msg)
{
var responseStr = "";
try
{
//返回的数据msg.data包含了协议中的4部分9
var arrays_signal = msg.Split('|');
var m_Source = arrays_signal[0];
var m_Command = arrays_signal[1];
var m_Opname = arrays_signal[2];
var m_Value = arrays_signal[3];
// var opName = $("#tbx_opname").val();
switch (m_Source)
{
case "MES":
switch (m_Command)
{
//显示托盘信息 √
case "ShowMoby":
try
{
responseStr = MesWebFun_base.MobySelect(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点ShowMoby" + "|" + "info");
}
break;
//显示操作指南√
case "ProcessList":
try
{
responseStr = MesWebFun_base.ProcessList(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点ProcessList" + "|" + "info");
}
break;
//显示物料√
case "MaterialList":
try
{
responseStr = MesWebFun_base.MaterialList(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点MaterialList" + "|" + "info");
}
break;
//显示操作图片√
case "PicShow":
try
{
responseStr = MesWebFun_base.PictureShow(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点PicShow" + "|" + "info");
}
break;
//显示拧紧位置√
case "ShaftPosition":
try
{
responseStr = MesWebFun_base.ShaftPotion_Select(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点ShaftPosition" + "|" + "info");
}
break;
//实时显示质量数据√
case "ShowTimelyQuality":
try
{
responseStr = MesWebFun_base.Quality_Select(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点ShowTimelyQuality" + "|" + "info");
}
break;
//手动拧紧实时显示质量数据√
case "ShowTimelyQuality_Tight":
try
{
responseStr = MesWebFun_base.Quality_Select(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点ShowTimelyQuality_Tight" + "|" + "info");
}
break;
//√
case "OrderFormList":
try
{
responseStr = MesWebFun_base.OrderFormList(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点OrderFormList" + "|" + "info");
}
break;
//弹窗消息√
case "Notice":
try
{
responseStr = MesWebFun_base.ShowWindowNotice(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点Notice" + "|" + "info");
}
break;
//LED消息提醒√
case "ScrollNotice":
try
{
responseStr = MesWebFun_base.ShowLEDNotice(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点ScrollNotice" + "|" + "info");
}
break;
//物料检测初始化√
case "MaterialCheckPosition":
try
{
responseStr = MesWebFun_base.MaterialCheckPosition(m_Opname);
}
catch (Exception exception)
{
//ApplicationLog.WriteLog("信息提示" + "|" + "错误断点MaterialCheckPosition" + "|" + "info");
}
break;
default:
// Web_Socket_Interface(m_Opname, msg);
break;
}
break;
}
}
catch (Exception exception)
{
var error = exception.ToString();
//ApplicationLog.WriteLog("信息提示" + "|" + "系统出现错误接受onmessage" + "|" + error + "|" + "info");
responseStr = "";
}
return responseStr;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,100 @@
using System;
using System.Data;
using System.Collections;
//using BasicData;
////using bizFacade;
//using SystemFramework;
using System.Configuration;
//using MesWork;
using MQTTnet.Client.Connecting;
using MQTTnet.Client.Disconnecting;
using MQTTnet.Client.Receiving;
using MQTTnet;
using System.Threading.Tasks;
namespace MesServerFunctions
{
public partial class MIS_SendMessage
{
/// <summary>
///
/// </summary>
public static string MqttTargetTopic = ConfigurationManager.AppSettings["MqttTargetTopic"];
/// <summary>
///
/// </summary>
static new MesWebFun_base.MisWebInterface misWebInterface = new MesWebFun_base.MisWebInterface();
/// <summary>
///
/// </summary>
static readonly Object locker = new Object();
/// <summary>
/// 发消息给通讯服务器
/// </summary>
/// <param name="Message"></param>
public static string asyncSendMessage(string Message)
{
lock (locker)
{
//"MES|MachinePlan|OpName|Value
var array = Message.Split('|');
var cmd = array[1];
var opName = array[2];
var topic = $"{MqttTargetTopic}/{opName}";
Task.Run(() => Mqtt.Publish(topic, Message));
var responseStr = misWebInterface.WebSocket_Function(Message);
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
return responseStr;
}
}
public static string asyncSendMessageDemo(string Message)
{
lock (locker)
{
//"MES|MachinePlan|OpName|Value
var array = Message.Split('|');
var cmd = array[1];
var opName = array[2];
var topic = $"{MqttTargetTopic}/{opName}";
//Mqtt.Publish(topic, Message);
string responseStr = "";
//var responseStr = misWebInterface.WebSocket_Function(Message);
//if (responseStr.Length > 0)
//{
// Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}");
//}
return responseStr;
}
}
/// <summary>
/// 发消息给通讯服务器
/// </summary>
/// <param name="Message"></param>
public static string asyncSendMessageQos0(string Message)
{
lock (locker)
{
//"MES|MachinePlan|OpName|Value
var array = Message.Split('|');
var cmd = array[1];
var opName = array[2];
var topic = $"{MqttTargetTopic}/{opName}";
Mqtt.PublishQos0(topic, Message);
return "";
}
}
}
}

View File

@@ -0,0 +1,281 @@
using MQTTnet;
using MQTTnet.Client;
using MQTTnet.Client.Connecting;
using MQTTnet.Client.Disconnecting;
using MQTTnet.Client.Options;
using MQTTnet.Client.Receiving;
using MQTTnet.Extensions.ManagedClient;
using MQTTnet.Formatter;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MesServerFunctions
{
public class Mqtt
{
/// <summary>
///
/// </summary>
public static IManagedMqttClient mqttClient = null;
public static string MqttUrl = ConfigurationManager.AppSettings["MqttUrl"];
/// <summary>
///
/// </summary>
public static string topic = "";
/// <summary>
///
/// </summary>
/// <param name="uri"></param>
/// <returns></returns>
public static async Task StartAsync()
{
string uri = MqttUrl;
//127.0.0.1:18083,123
var array = uri.Split(new char[] { ':', ',' });
string mqttUser = "MisDataFun";
string mqttPassword = "";
var options = new MqttClientOptions
{
ClientId = "MisDataFun-200170511",
ProtocolVersion = MqttProtocolVersion.V311,
ChannelOptions = new MqttClientTcpOptions { Server = array[0], Port = Convert.ToInt32(array[1]) },
CleanSession = false,
SessionExpiryInterval = 300,
KeepAlivePeriod = TimeSpan.FromSeconds(20),
Credentials = new MqttClientCredentials
{
Username = mqttUser,
Password = Encoding.UTF8.GetBytes(mqttPassword)
}
};
mqttClient = new MqttFactory().CreateManagedMqttClient();
//mqttClient.ConnectedHandler = new MqttClientConnectedHandlerDelegate(OnSubscriberConnected);
//mqttClient.DisconnectedHandler = new MqttClientDisconnectedHandlerDelegate(OnSubscriberDisconnected);
//mqttClient.ApplicationMessageReceivedHandler = new MqttApplicationMessageReceivedHandlerDelegate(OnSubscriberMessageReceived);
await mqttClient.StartAsync(new ManagedMqttClientOptions { ClientOptions = options });
topic = array[2];
await mqttClient.SubscribeAsync(new MqttTopicFilter { Topic = topic });
}
/// <summary>
///
/// </summary>
/// <param name="publish_topic"></param>
/// <param name="publish_msg"></param>
/// <returns></returns>
public static async Task Publish(string publish_topic, string publish_msg)
{
if (mqttClient != null)
{
try
{
await mqttClient.PublishAsync(new MqttApplicationMessageBuilder().WithTopic(publish_topic).WithPayload(publish_msg).WithExactlyOnceQoS().Build());
}
catch (Exception err)
{
}
}
}
/// <summary>
///
/// </summary>
/// <param name="publish_topic"></param>
/// <param name="publish_msg"></param>
/// <returns></returns>
public static async Task PublishQos0(string publish_topic, string publish_msg)
{
if (mqttClient != null)
{
await mqttClient.PublishAsync(new MqttApplicationMessageBuilder().WithTopic(publish_topic).WithPayload(publish_msg).WithAtLeastOnceQoS().Build());
}
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public static async Task StopAsync()
{
if (mqttClient != null)
{
await mqttClient.UnsubscribeAsync(new string[] { topic });
await mqttClient.StopAsync();
}
}
///// <summary>
/////
///// </summary>
///// <param name="x"></param>
//private static void OnSubscriberConnected(MqttClientConnectedEventArgs x)
//{
// var rec = x.AuthenticateResult.ResultCode.ToString();
// // label_State.Text = rec;
//}
///// <summary>
/////
///// </summary>
///// <param name="x"></param>
//private static void OnSubscriberDisconnected(MqttClientDisconnectedEventArgs x)
//{
// //var rec = x.AuthenticateResult.ResultCode.ToString();
// //label_State.Text = rec;
//}
///// <summary>
/////
///// </summary>
///// <param name="x"></param>
//private static void OnSubscriberMessageReceived(MqttApplicationMessageReceivedEventArgs x)
//{
// var rec = x.ApplicationMessage.ConvertPayloadToString();
// // txt_Rec.Text = txt_Rec.Text + rec + System.Environment.NewLine;
//}
}
public class Mqtt2
{
/// <summary>
///
/// </summary>
public IManagedMqttClient mqttClient = null;
public string MqttUrl;
/// <summary>
///
/// </summary>
public string topic = "";
public Mqtt2()
{
mqttClient = new MqttFactory().CreateManagedMqttClient();
}
/// <summary>
///
/// </summary>
/// <param name="uri"></param>
/// <returns></returns>
public async Task StartAsync()
{
string uri = MqttUrl;
//127.0.0.1:18083,123
var array = uri.Split(new char[] { ':', ',' });
string mqttUser = "";
string mqttPassword = "";
var options = new MqttClientOptions
{
ClientId = Guid.NewGuid().ToString(),
ProtocolVersion = MqttProtocolVersion.V311,
ChannelOptions = new MqttClientTcpOptions { Server = array[0], Port = Convert.ToInt32(array[1]) },
CleanSession = true,
KeepAlivePeriod = TimeSpan.FromSeconds(100),
Credentials = new MqttClientCredentials
{
Username = mqttUser,
Password = Encoding.UTF8.GetBytes(mqttPassword)
}
};
//mqttClient.ConnectedHandler = new MqttClientConnectedHandlerDelegate(OnSubscriberConnected);
//mqttClient.DisconnectedHandler = new MqttClientDisconnectedHandlerDelegate(OnSubscriberDisconnected);
//mqttClient.ApplicationMessageReceivedHandler = new MqttApplicationMessageReceivedHandlerDelegate(OnSubscriberMessageReceived);
await mqttClient.StartAsync(new ManagedMqttClientOptions { ClientOptions = options });
//topic = array[2];
await mqttClient.SubscribeAsync(new MqttTopicFilter { Topic = topic });
}
/// <summary>
///
/// </summary>
/// <param name="publish_topic"></param>
/// <param name="publish_msg"></param>
/// <returns></returns>
public async Task Publish(string publish_topic, string publish_msg)
{
if (mqttClient != null)
{
try
{
await mqttClient.PublishAsync(new MqttApplicationMessageBuilder().WithTopic(publish_topic).WithPayload(publish_msg).WithExactlyOnceQoS().Build());
}
catch (Exception err)
{
}
}
}
//static public async Task Publish(IManagedMqttClient mqttClient_1, string publish_topic, string publish_msg)
//{
// if (mqttClient_1 != null)
// {
// try
// {
// await mqttClient_1.PublishAsync(new MqttApplicationMessageBuilder().WithTopic(publish_topic).WithPayload(publish_msg).WithExactlyOnceQoS().Build());
// }
// catch (Exception err)
// {
// }
// }
//}
/// <summary>
///
/// </summary>
/// <returns></returns>
public async Task StopAsync()
{
if (mqttClient != null)
{
await mqttClient.UnsubscribeAsync(new string[] { topic });
await mqttClient.StopAsync();
}
}
///// <summary>
/////
///// </summary>
///// <param name="x"></param>
//private static void OnSubscriberConnected(MqttClientConnectedEventArgs x)
//{
// var rec = x.AuthenticateResult.ResultCode.ToString();
// // label_State.Text = rec;
//}
///// <summary>
/////
///// </summary>
///// <param name="x"></param>
//private static void OnSubscriberDisconnected(MqttClientDisconnectedEventArgs x)
//{
// //var rec = x.AuthenticateResult.ResultCode.ToString();
// //label_State.Text = rec;
//}
///// <summary>
/////
///// </summary>
///// <param name="x"></param>
//private static void OnSubscriberMessageReceived(MqttApplicationMessageReceivedEventArgs x)
//{
// var rec = x.ApplicationMessage.ConvertPayloadToString();
// // txt_Rec.Text = txt_Rec.Text + rec + System.Environment.NewLine;
//}
}
}

View File

@@ -0,0 +1,666 @@
using MisDataFunDll;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace MesServerFunctions
{
/// <summary>
/// 命令
///显示托盘信息√ case "ShowMoby":
///显示操作指南√ case "ProcessList":
///显示物料√ case "MaterialList":
///显示操作图片√ case "PicShow":
///显示拧紧位置√ case "ShaftPosition":
///实时显示质量数据√ case "ShowTimelyQuality":
///手动拧紧实时显示质量数据√case "ShowTimelyQuality_Tight":
///√ case "OrderFormList":
///弹窗消息√ case "Notice":
///LED消息提醒√ case "ScrollNotice":
///物料检测初始化√ case "MaterialCheckPosition":
///返修质量数据显示√ case "RepairQuality"
///
/// </summary>
public class SendMessage
{
/// <summary>
/// MES/InstantMessaging/BQ
/// </summary>
public static string MqttTargetTopic = ConfigurationManager.AppSettings["MqttTargetTopic"];
/// <summary>
/// 5 显示订单、机型信息 上线工位
/// </summary>
/// <param name="opName"></param>
public static void ShowMoby_FirstOpName(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = ShowMoby_String_FirstOpName(opName);
string cmd = "ShowMoby";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
/// <summary>
/// 5 显示订单、机型信息 非上线工位
/// </summary>
/// <param name="opName"></param>
public static void ShowMoby(string opName, int type = 1)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = ShowMoby_String(opName, type);
string cmd = "ShowMoby";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
public static void MaterialList_Dif(string opName, string msgText)
{
var topic = $"{MqttTargetTopic}/{opName}";
string cmd = "MaterialList_Dif";
if (msgText.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{msgText}"));
}
}
public static void AsyncSendMessage_Notice(string opname, string notice)
{
//通知Web界面
MisDataFun.Web_Notice_Insert(opname, notice);
Notice(opname);
}
public static void Notice(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = Notice_String(opName);
string cmd = "Notice";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
/// <summary>
/// 1直接在界面通过选择机型确认工序内容
/// </summary>
/// <param name="opName"></param>
public static void ProcessList(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = ProcessList_String(opName);
string cmd = "ProcessList";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
public static void ProcessList_FirstOpName(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = ProcessList_String_FirstOpName(opName);
string cmd = "ProcessList";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
/// <summary>
/// 2显示物料
/// </summary>
/// <param name="opName"></param>
public static void MaterialList(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = MaterialList_String(opName);
string cmd = "MaterialList";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
public static void MaterialList_FirstOpName(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = MaterialList_String_FirstOpName(opName);
string cmd = "MaterialList";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
/// <summary>
/// 3显示操作指导图片
/// </summary>
/// <param name="opName"></param>
public static void PicShow(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = PicShow_String(opName);
string cmd = "PicShow";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
public static void PicShow_FirstOpName(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = PicShow_String_FirstOpName(opName);
string cmd = "PicShow";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
/// <summary>
/// 4订单完工模块刷新完成数量
/// </summary>
/// <param name="opName"></param>
public static void OrderFormList(string opName)
{
var topic = $"{MqttTargetTopic}/{opName}";
var responseStr = OrderFormList_String();
string cmd = "OrderFormList";
if (responseStr.Length > 0)
{
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
}
}
//实时显示质量数据√
public static void ShowTimelyQuality(string opName)
{
}
public static void SendActuallyCount(string OpName, int tagValue)
{
//当工件离开时,更新在线产量、在线节拍
//if (tagValue == 0)
{
try
{
int opNameCount = 0;//在线产量
int opNameCountTime = 0;//在线节拍
MisDataFun.OpNameCount_BQ(OpName, out opNameCount, out opNameCountTime); //基本数据_工作日历_班次产量查询_New
SendInfomation("ActuallyCount", opNameCount.ToString() + "&" + opNameCountTime.ToString(), OpName);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function01:SendActuallyCount");
}
}
}
public static void SendInfomation(string Command, string Value, string OpName)
{
string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
}
public static void AsyncSendMessage(string Message)
{
//lock (locker)
{
//"MES|MachinePlan|OpName|Value
var array = Message.Split('|');
var cmd = array[1];
var opName = array[2];
var topic = $"{MqttTargetTopic}/{opName}";
Task.Run(() => Mqtt.Publish(topic, Message));
}
}
private static string ProcessList_String(string OpName)
{
string jsonStr_Process = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
DataTable dt_Proccess;
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
MisDataFun.Process_Select(OpName, EngineTypeID, EngineType, out dt_Proccess);
if (dt_Proccess != null)
{
if (dt_Proccess.Rows.Count > 0)
{
jsonStr_Process = JsonHelper.CreateJsonParameters(dt_Proccess);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:ProcessList");
}
return jsonStr_Process;
}
private static string ProcessList_String_FirstOpName(string OpName)
{
string jsonStr_Process = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
DataTable dt_Proccess;
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
MisDataFun.Process_Select(OpName, EngineTypeID, EngineType, out dt_Proccess);
if (dt_Proccess != null)
{
if (dt_Proccess.Rows.Count > 0)
{
jsonStr_Process = JsonHelper.CreateJsonParameters(dt_Proccess);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:ProcessList");
}
return jsonStr_Process;
}
//
private static string PicShow_String(string OpName)
{
string data = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
byte[] imgBytesIn;
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
MisDataFun.GetImageFile(OpName, EngineTypeID, out imgBytesIn);
if (imgBytesIn == null)
{
return data;
}
data = Convert.ToBase64String(imgBytesIn);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:PictureShow");
}
return data;
}
private static string PicShow_String_FirstOpName(string OpName)
{
string data = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
byte[] imgBytesIn;
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
MisDataFun.GetImageFile(OpName, EngineTypeID, out imgBytesIn);
if (imgBytesIn == null)
{
return data;
}
data = Convert.ToBase64String(imgBytesIn);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:PictureShow");
}
return data;
}
/// <summary>
/// 上线工位
/// </summary>
/// <param name="OpName"></param>
/// <returns></returns>
private static string ShowMoby_String(string OpName, int type = 1)
{
string data = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
//非上线工位
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
data = orderNum + "&" + EngineTypeID + "&" + EngineType + "&" + EngineID + "&" + PartPallet_Code + "&" + IsrepairBarcode + "&" + repairBarcode + "&" + EngineTypeString;
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:MobySelect");
}
return data;
}
private static string ShowMoby_String_FirstOpName(string OpName)
{
string data = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
//上线工位
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
data = orderNum + "&" + EngineTypeID + "&" + EngineType + "&" + EngineID + "&" + PartPallet_Code + "&" + IsrepairBarcode + "&" + repairBarcode + "&" + EngineTypeString;
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:MobySelect");
}
return data;
}
private static string MaterialList_String(string OpName)
{
string jsonStr_Materail = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
MisDataFun.PartMaterialVerify_Select(OpName, EngineTypeID, EngineType, out DataTable dt_Material);
if (dt_Material != null)
{
if (dt_Material.Rows.Count > 0)
{
jsonStr_Materail = JsonHelper.CreateJsonParameters(dt_Material);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:MaterialList");
}
return jsonStr_Materail;
}
private static string MaterialList_String_FirstOpName(string OpName)
{
string jsonStr_Materail = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
MisDataFun.PartMaterialVerify_Select(OpName, EngineTypeID, EngineType, out DataTable dt_Material);
if (dt_Material != null)
{
if (dt_Material.Rows.Count > 0)
{
jsonStr_Materail = JsonHelper.CreateJsonParameters(dt_Material);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:MaterialList");
}
return jsonStr_Materail;
}
private static string ShowTimelyQuality_String(string OpName)
{
string text = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
DataTable dt;
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
MisDataFun.QualitySelect(OpName, EngineID, out dt);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
text = JsonHelper.CreateJsonParameters(dt);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:Quality_Select");
}
return text;
}
private static string ShowTimelyQuality_String_FirstOpName(string OpName)
{
string text = "";
try
{
string orderNum = "";
int EngineTypeID = 0;
string EngineType = "";
string EngineID = "";
string PartPallet_Code = "";
int IsrepairBarcode = 0;
string repairBarcode = "";
string EngineTypeString = "";
DataTable dt;
MisDataFun.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode, out EngineTypeString);
MisDataFun.QualitySelect(OpName, EngineID, out dt);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
text = JsonHelper.CreateJsonParameters(dt);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:Quality_Select");
}
return text;
}
private static string OrderFormList_String()
{
string enginetypelist = "";
try
{
System.Data.DataTable dt = null;
MisDataFun.EngineType_Select(out dt);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
enginetypelist = JsonHelper.DataTableToJson(dt);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:Orderenginetypeselect");
}
return enginetypelist;
}
/// <summary>
/// 消息提醒
/// </summary>
/// <returns></returns>
private static string Notice_String(string opname)
{
string text = "";
try
{
System.Data.DataTable dt = null;
MisDataFun.ShowWindowNotice(opname, out dt);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
text = JsonHelper.DataTableToJson(dt);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:ShowWindowNotice");
}
return text;
}
/// <summary>
/// 批量发送WEB消息Value为BOOL值
/// </summary>
/// <param name="MessageNumm">消息编号组合</param>
/// <param name="Value">消息值组合</param>
/// <param name="OpName">工位号</param>
void Sendmessage(string MessageNumm, string Value, string OpName)
{
for (int i = 0; i < MessageNumm.Length; i++)
{
Sendmessage(MessageNumm[i], Value[i].ToString(), OpName);
}
}
/// <summary>
/// 选择发送给WEB的消息
/// </summary>
/// <param name="Num">消息类型</param>
/// <param name="OpName">消息工位</param>
static void Sendmessage(char Num, string Value, string OpName)
{
string SendMessage;
switch (Num)
{
case '1':
//1直接在界面通过选择机型确认工序内容
SendMessage = "MES|ProcessList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '2':
//2显示物料
SendMessage = "MES|MaterialList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '3':
//3显示操作指导图片
SendMessage = "MES|PicShow|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '4':
//3显示操作指导图片
SendMessage = "MES|OrderFormList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '5':
SendMessage = "MES|ShowMoby|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '6':
SendMessage = "MES|MaterialCheckPosition|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '7':
SendMessage = "MES|WorkStart|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '8':
SendMessage = "MES|OrderFormList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '9':
SendMessage = "MES|ConfirmOkGo|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case 'a':
SendMessage = "MES|FixAllow|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case 'b':
SendMessage = "MES|ShaftPosition|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case 'c':
SendMessage = "MES|ShowQuality|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
}
}
///// <summary>
///// 发送信息到MES通讯服务器或者其他的
///// </summary>
///// <param name="Message"></param>
//static private void AsyncSendMessage1(string Message)
//{
// MIS_BASE.asyncSendMessage(Message);
//}
}
}

View File

@@ -0,0 +1,249 @@
using MisDataFunDll;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MesServerFunctions
{
/// <summary>
/// 命令
///显示托盘信息√ case "ShowMoby":
///显示操作指南√ case "ProcessList":
///显示物料√ case "MaterialList":
///显示操作图片√ case "PicShow":
///显示拧紧位置√ case "ShaftPosition":
///实时显示质量数据√ case "ShowTimelyQuality":
///手动拧紧实时显示质量数据√case "ShowTimelyQuality_Tight":
///√ case "OrderFormList":
///弹窗消息√ case "Notice":
///LED消息提醒√ case "ScrollNotice":
///物料检测初始化√ case "MaterialCheckPosition":
///返修质量数据显示√ case "RepairQuality"
///
/// </summary>
public class SendMessageFun
{
/// <summary>
/// 批量发送WEB消息Value为BOOL值
/// 1:显示工序内容
/// 2显示物料
/// 3显示操作指导图片
/// 5显示机型、工件流水号、订单信息
/// c:显示质量数据
/// </summary>
/// <param name="MessageNumm">消息编号组合</param>
/// <param name="Value">消息值组合</param>
/// <param name="OpName">工位号</param>
static public void SendMessage(string MessageNumm, string Value, string OpName)
{
for (int i = 0; i < MessageNumm.Length; i++)
{
SendMessageFun.SendMessage(MessageNumm[i], Value[i].ToString(), OpName);
}
}
/// <summary>
/// 向WEB发送信息value为字符串
/// </summary>
/// <param name="Command">消息种类</param>
/// <param name="Value">消息内容</param>
/// <param name="OpName">工位号</param>
static public void SendInfomation(string Command, string Value, string OpName)
{
string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
}
static public void AsyncSendMessage_Notice(string opname, string notice, string noticeType = "misServer")
{
//通知Web界面
notice = $"{{\"Notice\":\"{notice}\",\"NoticeType\":\"{noticeType}\"}}";
MisDataFun.Web_Notice_Insert(opname, notice);
string SendMessage = "MES|Notice_Info|" + opname + "|" + notice;
MIS_SendMessage.asyncSendMessage(SendMessage);
}
/// <summary>
///
/// </summary>
/// <param name="opname"></param>
/// <param name="notice"></param>
/// <param name="noticeType">barcode mis</param>
static public void AsyncSendMessage_Notice_Error(string opname, string notice, string noticeType)
{
//通知Web界面
// notice: notice, noticeType: noticeType
notice = $"{{\"Notice\":\"{notice}\",\"NoticeType\":\"{noticeType}\"}}";
MisDataFun.Web_Notice_Insert(opname, notice);
string SendMessage = "MES|Notice_Error|" + opname + "|" + notice;
MIS_SendMessage.asyncSendMessage(SendMessage);
}
/// <summary>
/// 选择发送给WEB的消息
/// 1:显示工序内容
/// 2显示物料
/// 3显示操作指导图片
/// 5显示机型、工件流水号、订单信息
/// c:显示质量数据
/// </summary>
/// <param name="Num">消息类型</param>
/// <param name="OpName">消息工位</param>
static void SendMessage(char Num, string Value, string OpName)
{
string SendMessage;
switch (Num)
{
case '1':
//1直接在界面通过选择机型确认工序内容
SendMessage = "MES|ProcessList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '2':
//2显示物料
SendMessage = "MES|MaterialList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '3':
//3显示操作指导图片
SendMessage = "MES|PicShow|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '4':
//3显示操作指导图片
SendMessage = "MES|OrderFormList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '5':
SendMessage = "MES|ShowMoby|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '6':
SendMessage = "MES|MaterialCheckPosition|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '7':
SendMessage = "MES|WorkStart|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '8':
SendMessage = "MES|OrderFormList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '9':
SendMessage = "MES|ConfirmOkGo|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case 'a':
SendMessage = "MES|FixAllow|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case 'b':
SendMessage = "MES|ShaftPosition|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case 'c':
//SendMessage = "MES|ShowQuality|" + OpName + "|" + Value;
SendMessage = "MES|ShowTimelyQuality|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
}
}
/// <summary>
/// 向WEB发送信息value为字符串
/// </summary>
/// <param name="Command">消息种类</param>
/// <param name="Value">消息内容</param>
/// <param name="OpName">工位号</param>
//void SendInfomation(string Command, string Value, string OpName)
//{
// string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
// AsyncSendMessage(SendMessage);
//}
/// <summary>
/// 发送在线产量、在线节拍
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
private void SendActuallyCount(string OpName, int tagValue)
{
//当工件离开时,更新在线产量、在线节拍
if (tagValue == 0)
{
try
{
int opNameCount = 0;//在线产量
int opNameCountTime = 0;//在线节拍
MisDataFun.OpNameCount_New(OpName, out opNameCount, out opNameCountTime); //基本数据_工作日历_班次产量查询_New
SendInfomation("ActuallyCount", opNameCount.ToString() + "&" + opNameCountTime.ToString(), OpName);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function01:SendActuallyCount");
}
}
}
/// <summary>
/// 发送信息到MES通讯服务器或者其他的
/// </summary>
/// <param name="Message"></param>
static public void AsyncSendMessage(string Message)
{
MIS_SendMessage.asyncSendMessage(Message);
}
///// <summary>
///// 发送提示消息
///// </summary>
///// <param name="Message"></param>
//static public void AsyncSendMessage_Notice(string opname, string notice)
//{
// //通知Web界面
// BaseDataSystemMES.Web_Notice_Insert(opname, notice);
// string SendMessage = "MES|Notice|" + opname + "|" + "1";
// MIS_BASE.asyncSendMessage(SendMessage);
//}
/// <summary>
/// 发送信息到打印机
/// </summary>
/// <param name="Message"></param>
private void asyncSendMessageToMark(string Message)
{
string messageSend = (string)Message;
//UDPClientSend.Send_ALL(ApplicationConfig.MES_MarkPortNum, messageSend);
}
/// <summary>
/// 发送信息到LED
/// </summary>
/// <param name="Message"></param>
private void asyncSendMessageLED(string OpName)
{
//发送到大屏幕显示 41104
string strMessage = "MIS|" + OpName + "|" + "0" + "|" + "1";
//UDPClientSend.Send_ALL(ApplicationConfig.Port_ShowLED_ProductCount, strMessage);
}
}
}

View File

@@ -0,0 +1,247 @@
using DataLinkMesWork1;
using MesServerFunctions;
using MesServerWork;
using MisDataFunDll;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace MisDataSaveDate
{
public partial class FuntionMesRead
{
#region 2023.05.14,
public static Hashtable Base_TagIdList = new Hashtable();
public static Hashtable Base_ObjList = new Hashtable();
public static void GetAlarmInit()
{
Base_TagIdList.Clear();
GetTagIdList("", out DataTable dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
string tagid = dt.Rows[i]["TagID"].ToString();
if (tagid[0].ToString() == "9")
{
var opName = dt.Rows[i]["工位号"].ToString();
var ItemName = dt.Rows[i]["测量项目"].ToString(); // 报警内容
var ShaftID = dt.Rows[i]["测量位置"].ToString(); // 报警类型
string SendMessage = "MES|PlcAlarm|" + opName + "|" + tagid + "&@TagValue&" + ItemName + "&" + ShaftID;
Base_TagIdList.Add(tagid, SendMessage);
//在存一份报警对象到键值对中
Base_ObjList.Add(tagid, dt.Rows[i]);
}
}
}
//public static void Send_AlarmMsg(string tagid, string tagVvalue)
//{
// var val = Base_TagIdList[tagid];
// if (val != null)
// {
// //var msg = Base_TagIdList[tagid].ToString();
// //var sendmsg = msg.Replace("@TagValue", tagVvalue);
// //SendMessageFun.AsyncSendMessage(sendmsg);
// string alarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// var msg = Base_TagIdList[tagid].ToString();
// var sendmsg = msg.Replace("@TagValue", tagVvalue) + "&" + alarmTime;
// SendMessageFun.AsyncSendMessage(sendmsg);
// // 去存一份记录到数据库
// DataRow errObj = (DataRow)Base_ObjList[tagid];
// MisDataFun.Alarm_Insert2(Convert.ToInt32(errObj["TagID"]), errObj["工位号"].ToString(), errObj["测量项目"].ToString(), Convert.ToInt32(tagVvalue), errObj["测量位置"].ToString());
// }
//}
public static DataRow Send_AlarmMsg(string tagid, string tagVvalue)
{
var val = Base_TagIdList[tagid];
DataRow errObj = null;
if (val != null)
{
//var msg = Base_TagIdList[tagid].ToString();
//var sendmsg = msg.Replace("@TagValue", tagVvalue);
//SendMessageFun.AsyncSendMessage(sendmsg);
var msg = Base_TagIdList[tagid].ToString();
var sendmsg = msg.Replace("@TagValue", tagVvalue);
SendMessageFun.AsyncSendMessage(sendmsg);
// 去存一份记录到数据库
errObj = (DataRow)Base_ObjList[tagid];
MisDataFun.Alarm_Insert2(Convert.ToInt32(errObj["TagID"]), errObj["工位号"].ToString(), errObj["测量项目"].ToString(), Convert.ToInt32(tagVvalue), errObj["测量位置"].ToString());
}
return errObj;
}
static public void GetTagIdList(string opName, out DataTable dt)
{
string procedureName;
procedureName = "MES_基本变量_原始数据_根据工位号查询";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
}
#endregion
public static void Alarm_Insert_Init(string Opname)
{
DataTable dt;
MisDataFun.Alarm_Moby_Search(out dt);
if (dt == null) return;
for (int i = 0; i < dt.Rows.Count; i++)
{
string TagId = dt.Rows[i]["TagId"].ToString();
object tagValueStr = "";
string tagValue = "0";
MIS_BASE.Read_TagValueByTagID(TagId, out tagValueStr);
if (tagValueStr != null)
{
switch (tagValueStr.ToString().ToLower())
{
case "1":
case "true":
tagValue = "1";
break;
default:
tagValue = "0";
break;
}
Send_AlarmMsg(TagId, tagValue);
}
}
}
public static void Alarm_InitAlarm_Send(string opName, out Hashtable ht)
{
var tagValues = MIS_BASE.ReadPLC_OpName(opName);
//过滤出来质量数据 //获得带合格标志的质量数据
var keyValues = tagValues.OrderBy(x => x.Key).ToDictionary(k => k.Key, v => v.Value);
ht = new Hashtable();
foreach (KeyValuePair<string, DeviceDriver_BasicData.CustomeEvetnArgs> _cd in keyValues)
{
var tf = _cd.Value;
string TagID = tf.TagID.ToString();
if (TagID[0].ToString() == "9")
{
string tagValue = tf.TagValue.ToString();
if (tf.TagValue == null) return;
switch (tagValue.ToLower())
{
case "1":
case "true":
tagValue = "1";
break;
default:
tagValue = "0";
break;
}
if (tagValue == "1")
{
ht.Add(tf.TagID, tagValue);
}
}
}
}
public static bool Alarm_Insert(string TagID, string tagTypeID, string opName, int TagValue,
DateTime alarmStartTime, DateTime alarmEndTime, int TimeDiff,
string Text1, string Text2, string TagOrderBy)
{
string produceName = "测量数据工位报警全部_增加数据";
SqlParameter[] thisParms = new SqlParameter[10];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@TagID", TagID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@TagTypeID", tagTypeID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@opName", opName);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@TagValue", TagValue);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@alarmStartTime", alarmStartTime);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@alarmEndTime", alarmEndTime);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@TimeDiff", TimeDiff);
thisParms[7] = new System.Data.SqlClient.SqlParameter("@Text1", Text1);
thisParms[8] = new System.Data.SqlClient.SqlParameter("@Text2", Text2);
thisParms[9] = new System.Data.SqlClient.SqlParameter("@TagOrderBy", TagOrderBy);
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
{
return true;
}
return false;
}
/// <summary>
/// 报错详细工件记录日志 (有可能报错 所以封装)
/// </summary>
/// <param name="errorStep">1.申请上线 2.传递机型 3.允许保存 4.扫码</param>
/// <param name="e"></param>
public static void Alarm_SaveFileLog4Error(string errorStep, object e, string FunName, Exception err)
{
try
{
MyLog4Net.MyLogHelper.Error($"{FunName}异常:", $"Message:{err.Message} InnerException: {err.InnerException}");
string leftErrorStep;
if (errorStep == "PartLoad")
{
leftErrorStep = "申请上线";
}
else if (errorStep == "EngineGetOver")
{
leftErrorStep = "传递机型";
}
else if (errorStep == "MesRead")
{
leftErrorStep = "允许保存";
}
else if (errorStep == "Barcode")
{
leftErrorStep = "扫码";
}
else
{
leftErrorStep = $"未知类型{errorStep}";
}
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
string OpName = Convert.ToString(msgEvent.OpName);
MIS_BASE.GetEngineTypeFromPLC(OpName, out int EngineTypeID, out string EngineType, out string EngineID, out int PartPallet_Code, out string OrderForm);
MyLog4Net.MyLogHelper.Error($"{FunName}{leftErrorStep}操作异常:", $"工位号:{OpName}、总成号:{EngineID}、机型:{EngineType}、机型代码:{EngineTypeID}、订单号:{OrderForm}、托盘号:{PartPallet_Code}");
string saveString = $"{FunName}{leftErrorStep}操作异常 Message:{err.Message} InnerException: {err.InnerException}:工位号:{OpName}、总成号:{EngineID}、机型:{EngineType}、机型代码:{EngineTypeID}、订单号:{OrderForm}、托盘号:{PartPallet_Code}";
var sql =
$"INSERT INTO 合力_系统日志 ([工位号],[日志类型],[日志文本])"+
$" VALUES('{OpName}', 'system', '{saveString}')";
DataAccess.ExecuteDataTable(sql, out DataTable dt);
}
catch (Exception ex)
{
MyLog4Net.MyLogHelper.Error($"{FunName}保存错误日志失败:", $"Message:{ex}");
}
}
public static void Alarm_SystemError(string FunName, Exception err)
{
MyLog4Net.MyLogHelper.Error($"系统{FunName}方法异常:", $"Message:{err.Message} InnerException:{err.InnerException}");
}
}
}

View File

@@ -0,0 +1,635 @@
using BasicData;
using MesServerFunctions;
using MesServerWork;
using MisDataFunDll;
using Newtonsoft.Json;
using OpcBasic;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using DataLinkMesWork1;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskBand;
namespace MisDataSaveDateMesRead
{
public partial class Funtion
{
/// <summary>
/// 允许保存(针对半自动和手动压装工位)
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
public static int MesRead(string opName, string tagValue, string tagid, bool isCheck = false)
{
int qualityMask = 0;
qualityMask = SaveQualityData(opName, Convert.ToInt32(tagValue), tagid, isCheck);
//if (tagValue == "0")
//{
// MIS_BASE.Write_TagTypeID(20, opName, false);
//}
//else
//{
// qualityMask = SaveQualityData(opName, Convert.ToInt32(tagValue), tagid, isCheck);
// MIS_BASE.Write_TagTypeID(20, opName, true);
//}
return qualityMask;
}
public static string GetRealTimeQualityData(string opName)
{
string message = "";
DataTable dt1 = new DataTable();
DataTable dt_WWW;
DataTable dt_WWW_Copy1;
DataTable dt_WWW_Copy2;
Hashtable valueList;
try
{
//读取工位全部数据
var rtList = MIS_BASE.ReadPLC_OpName(opName); //GetDbAndMaxLengthByOpNameByBytes(opName);
var pp = JsonConvert.SerializeObject(rtList);
var tagValues = JsonConvert.DeserializeObject<ConcurrentDictionary<string, TagFormat>>(pp);
//过滤出来质量数据 //获得带合格标志的质量数据
valueList = ReadPLC_OpName_Qd(tagValues);
//获得带基本信息的质量数据表
GetQualityDataTable(valueList, opName, MIS_BASE.BasicDataTagValue, MIS_BASE.BasicDataTagValueUpDown, out dt_WWW);
dt_WWW_Copy1 = dt_WWW.Copy().Select("变量排序 = 1").CopyToDataTable();
DataView dv1 = dt_WWW_Copy1.DefaultView;
dv1.Sort = "列位置 DESC";
dt_WWW_Copy1 = dv1.ToTable();
dt_WWW_Copy2 = dt_WWW.Copy().Select("变量排序 = 2").CopyToDataTable();
DataView dv2 = dt_WWW_Copy2.DefaultView;
dv2.Sort = "列位置 DESC";
dt_WWW_Copy2 = dv2.ToTable();
dt1.Columns.Add("列位置", System.Type.GetType("System.String"));
dt1.Columns.Add("测量项目1", System.Type.GetType("System.String"));
dt1.Columns.Add("测量项目2", System.Type.GetType("System.String"));
dt1.Columns.Add("合格标志", System.Type.GetType("System.String"));
dt1.Columns.Add("名称", System.Type.GetType("System.String"));
for (int i = 0; i < dt_WWW_Copy1.Rows.Count; i++)
{
if (Convert.ToInt32(dt_WWW_Copy1.Rows[i]["TagValue"]) > 45)
{
var dr = dt1.NewRow();
dr["列位置"] = dt_WWW_Copy1.Rows[i]["列位置"].ToString();
dr["测量项目1"] = dt_WWW_Copy1.Rows[i]["TagValue"].ToString();
dr["合格标志"] = "1";
dr["名称"] = dt_WWW_Copy1.Rows[i]["测量项目"].ToString();
dt1.Rows.Add(dr);
}
}
for (int i = 0; i < dt_WWW_Copy2.Rows.Count; i++)
{
if (Convert.ToInt32(dt_WWW_Copy2.Rows[i]["TagValue"]) > 45)
{
var dr = dt1.NewRow();
dr["列位置"] = dt_WWW_Copy2.Rows[i]["列位置"].ToString();
dr["测量项目1"] = dt_WWW_Copy2.Rows[i]["TagValue"].ToString();
dr["合格标志"] = "1";
dr["名称"] = dt_WWW_Copy2.Rows[i]["测量项目"].ToString();
dt1.Rows.Add(dr);
}
}
}
catch (Exception err)
{
}
message = JsonHelper.CreateJsonParameters(dt1);
return message;
}
/// <summary>
/// 返回合格标志
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
/// <param name="tagID"></param>
/// <returns></returns>
private static int SaveQualityData(string opName, int tagValue, string tagID, bool isCheck = false)
{
int id_tagCF;
int qualityMask = 0;
int engineTypeID = 0;
string engineID = "";
string engineType = "";
string partPallet = "";
string orderFormPlc = "";
DataTable dt_WWW;
Hashtable valueList;
try
{
//读取工位全部数据
var rtList = MIS_BASE.ReadPLC_OpName(opName); //GetDbAndMaxLengthByOpNameByBytes(opName);
var pp = JsonConvert.SerializeObject(rtList);
var tagValues = JsonConvert.DeserializeObject<ConcurrentDictionary<string, TagFormat>>(pp);
//过滤出来质量数据 //获得带合格标志的质量数据
valueList = ReadPLC_OpName_Qd(tagValues);
engineTypeID = Convert.ToInt32(GetValueByTagTypeCodeID(tagValues, Convert.ToInt32(EnumTagTypeCodeID.EngineTypeID)));
engineID = GetValueByTagTypeCodeID(tagValues, Convert.ToInt32(EnumTagTypeCodeID.EngineID)).ToString();
engineType = GetValueByTagTypeCodeID(tagValues, Convert.ToInt32(EnumTagTypeCodeID.EngineType)).ToString();
orderFormPlc = GetValueByTagTypeCodeID(tagValues, Convert.ToInt32(EnumTagTypeCodeID.OrderFormPLC)).ToString();
qualityMask = Convert.ToInt32(GetValueByTagTypeCodeID(tagValues, Convert.ToInt32(EnumTagTypeCodeID.QualityMask)));
//获得带基本信息的质量数据表
GetQualityDataTable(valueList, opName, MIS_BASE.BasicDataTagValue,
MIS_BASE.BasicDataTagValueUpDown, out dt_WWW);
DateTime lastupdatetime = DateTime.Now;
//保存质量数
BaseData_tagTable_QualityData_B5A_IndexInsert(engineID, tagID, engineType, engineTypeID, opName, qualityMask, partPallet, out id_tagCF);
BaseData_tagTable_QualityData_B5A_Insert(id_tagCF, engineTypeID, engineID, opName, dt_WWW, isCheck);
//保存质量数据到 接口表
MisDataFun.SaveQualityInterfaceData(opName, engineID);
}
catch (Exception err)
{
//MIS_BASE.Write_TagTypeID(20, opName, true);
////ApplicationLog.WriteLog(err, err.Message);
}
return qualityMask;
}
public class QualityDataType1
{
public int tagValueType;
public int tagTypeID;
public string opName;
public string tagID;
public object TagValeNormal;
public object TagValueDown;
public object TagValueUp;
public object Unit;
public object tagValue;
public int tagQuality;
public int tagOrderBy;
public int tagItemOrderBy;
public int tagProperty;
public int isGoodBad;
}
static public void GetQualityDataTable(Hashtable valuList, string opName, DataTable BasicDataTagValue, DataTable BasicDataTagValueUpDown, out DataTable dt)
{
//78 0屏蔽MES1启用MES(必须MIS)
//79 通过线体工位PC实现下达工位工作状态工位有三种状态在线、离线、屏蔽。在线;0正常状态实现正常功能。1离线2屏蔽。(必须MIS)
//41 机体流向标志1 BYTE0普通工位1上线发动机上线2下线发动机下线(必须PLC)
//51 返修工位修改后的数据MES将数据写入PLC MES通知PLC数据修改完成。(YN)
//8 只要返修必须由mes发送此信号plc接收此信号后才能放行
//暂时没用用于有扳手拧紧工位。通知设备螺钉拧紧完成。PC已经将数据保存到数据库中。(B5A)
QualityDataType1 qualityData;
//是否有数据
//bool isUsing;
DataRow dr;
DataRow[] dr_WWW;
//MES_基本数据_测量范围
DataRow[] dr_WWW_UpDown;
dt = MisDataFun.BuildDataTables_WWW();
//测量位置
string shaftID;
//测量项目
string item;
//测量单位
string unit;
//机体类型
//原始数据中的机型代码
int engineTypeID_Source;
//上限值
string tagValueUp;
//下限值
string tagValueDown;
//理论值
string tagValeNormal;
//TagValue
// 合格标志
//string IsGoodBad;
foreach (DictionaryEntry valueItem in valuList) //ht为一个Hashtable实例
{
try
{
qualityData = (QualityDataType1)valueItem.Value;
//if ((qualityData.tagProperty != 2) || (qualityData.tagProperty != 6))
//{
// continue ;
//}
//if ((qualityData.tagProperty == 2) || (qualityData.tagProperty == 6))
{
//if (engineTypeID == 0)
//{
// engineTypeID = 1;
//}
dr_WWW = BasicDataTagValue.Select("TagID = " + qualityData.tagID);
//try
//{
// dr_WWW_UpDown = BasicDataTagValueUpDown.Select("TagID = " + qualityData.tagID);
//}
//catch { dr_WWW_UpDown = null; }
//if (dr_WWW.Length > 0)
//{
// {
// engineTypeID_Source = Convert.ToInt32(dr_WWW[0]["机体类型"]);
// int temp;
// temp = engineTypeID_Source & engineTypeID;
// if (temp == 0)
// {
// continue;
// }
// if (qualityData.isGoodBad == -1)
// {
// continue;
// }
// }
//}
//else
//{
// continue;
//}
try
{
shaftID = dr_WWW[0]["测量位置"].ToString();
}
catch
{
shaftID = "";
}
try
{
item = dr_WWW[0]["测量项目"].ToString();
}
catch
{
item = "";
}
try
{
unit = dr_WWW[0]["测量单位"].ToString();
}
catch
{
unit = "";
}
try
{
tagValueUp = qualityData.TagValueUp.ToString();
//if (dr_WWW_UpDown != null && dr_WWW_UpDown.Length > 0)
//{
// tagValueUp = dr_WWW_UpDown[0]["值上限"].ToString();
//}
//else
//{
// tagValueUp = "";
//}
}
catch
{
tagValueUp = "";
}
try
{
tagValueDown = "";
tagValueDown = qualityData.TagValueDown.ToString();
//if (dr_WWW_UpDown != null && dr_WWW_UpDown.Length > 0)
//{
// tagValueDown = dr_WWW_UpDown[0]["值下限"].ToString();
//}
}
catch
{
tagValueDown = "";
}
try
{
tagValeNormal = "";
tagValeNormal = qualityData.TagValeNormal.ToString();
//if (dr_WWW_UpDown != null && dr_WWW_UpDown.Length > 0)
//{
// tagValeNormal = dr_WWW_UpDown[0]["理论值"].ToString();
//}
}
catch
{
tagValeNormal = "";
}
dr = dt.NewRow();
dr["TagID"] = qualityData.tagID;
dr["测量位置"] = shaftID;
dr["测量项目"] = item;
dr["测量单位"] = unit;
dr["上限值"] = tagValueUp;
dr["下限值"] = tagValueDown;
dr["理论值"] = tagValeNormal;
dr["工位号"] = opName;
dr["列位置"] = qualityData.tagOrderBy;
dr["变量排序"] = qualityData.tagItemOrderBy;
dr["IsGoodBad"] = qualityData.isGoodBad;
switch (qualityData.tagTypeID)//
{
//合格标志数组
case 8203:
dr["TagValue"] = MisDataFun.GetQualityData_GoodBad_String((bool[])qualityData.tagValue);
break;
case 8209:
dr["TagValue"] = "";
break;
//非标准REAL
case 8210:
dr["TagValue"] = MisDataFun.GetNoNormalReal(qualityData.tagValue);
dt.Rows.Add(dr);
break;
default:
dr["TagValue"] = Convert.ToString(qualityData.tagValue);
dt.Rows.Add(dr);
break;
}
////福田对质量数据特殊处理MA20保留4位小数点其余保留两位
//if (opName == "J07MA020")
//{
// dr["TagValue"] = Convert.ToDouble(dr["TagValue"]).ToString("0.####");
//}
//else
//{
// dr["TagValue"] = Convert.ToDouble(dr["TagValue"]).ToString("0.##");
//}
//if (opName == "J07MA150")
//{
// dr["变量排序"] = 1;
// dr["IsGoodBad"] = 1;
//}
}
}
catch (Exception err)
{
//ApplicationLog.WriteLog(err, err.Message);
}
}
}
/// <summary>
/// 数据表
/// </summary>
/// <returns></returns>
private static object GetValueByTagTypeCodeID(ConcurrentDictionary<string, TagFormat> opTagList, int TagTypeCodeID)
{
try
{
return opTagList.Where(x => x.Value.TagTypeCodeID == TagTypeCodeID).ToList()[0].Value.TagValue;
}
catch (Exception err) { return "-3"; }
}
/// <summary>
/// 根据工位名称,读取工位对应的质量数据,带合格标志
/// </summary>
/// <param name="opName"></param>
/// <returns></returns>
public static Hashtable ReadPLC_OpName_Qd(ConcurrentDictionary<string, TagFormat> tagValues)
{
//lock (l)
{
//var tagValues = DtWebApi.ReadWritePLC.ReadPLC_OpName(opName); //GetDbAndMaxLengthByOpNameByBytes(opName);
var keyValues = tagValues.Where(x => x.Value.TagTypeCodeID == 105).OrderBy(x => x.Key).ToDictionary(k => k.Key, v => v.Value);
TagFormat tagFormatTemp;
int tagIndex = 1;
int isOK = 0;
string TagValeNormal = "";
string TagValueDown = "";
string TagValueUp = "";
Hashtable ht = new Hashtable();
for (int i = 0; i < keyValues.Count / 8; i++)
{
isOK = Convert.ToInt32(keyValues.ElementAt(i * 8 + 0).Value.TagValue);
TagValeNormal = keyValues.ElementAt(i * 8 + 3).Value.TagValue.ToString();
TagValueUp = keyValues.ElementAt(i * 8 + 4).Value.TagValue.ToString();
TagValueDown = keyValues.ElementAt(i * 8 + 5).Value.TagValue.ToString();
var TF1 = keyValues.ElementAt(i * 8 + 1).Value;
QualityDataType1 qualityDataType1;
qualityDataType1 = GetQualityDataType(TF1);
qualityDataType1.isGoodBad = isOK;
qualityDataType1.TagValeNormal = TagValeNormal;
qualityDataType1.TagValueDown = TagValueDown;
qualityDataType1.TagValueUp = TagValueUp;
ht.Add(qualityDataType1.tagID, qualityDataType1);
var TF2 = keyValues.ElementAt(i * 8 + 2).Value;
QualityDataType1 qualityDataType2;
qualityDataType2 = GetQualityDataType(TF2);
qualityDataType2.isGoodBad = isOK;
qualityDataType2.TagValeNormal = TagValeNormal;
qualityDataType2.TagValueDown = TagValueDown;
qualityDataType2.TagValueUp = TagValueUp;
ht.Add(qualityDataType2.tagID, qualityDataType2);
}
//foreach (KeyValuePair<string, TagFormat> _cd in keyValues)
//{
// if (_cd.Key.ToString()[0].ToString() == "7")
// {
// tagFormatTemp = _cd.Value;
// if (tagIndex % 8 == 1)
// {
// isOK = Convert.ToInt32(tagFormatTemp.TagValue);
// }
// else if (tagIndex % 8 == 2)
// {
// var TF = _cd.Value;
// QualityDataType qualityDataType;
// qualityDataType = GetQualityDataType(TF);
// qualityDataType.isGoodBad = isOK;
// ht.Add(qualityDataType.tagID, qualityDataType);
// }
// else if (tagIndex % 8 == 3)
// {
// var TF = (TagFormat)_cd.Value;
// QualityDataType qualityDataType;
// qualityDataType = GetQualityDataType(TF);
// qualityDataType.isGoodBad = isOK;
// ht.Add(qualityDataType.tagID, qualityDataType);
// }
// tagIndex++;
// }
// //Console.WriteLine($"key{kv.Key} value{kv.Value}");
//}
return ht;
}
}
//public static Hashtable ReadPLC_OpName_Entite(string opName)
//{
// //lock (l)
// {
// var tagValues = DtWebApi.ReadWritePLC.ReadPLC_OpName(opName); //GetDbAndMaxLengthByOpNameByBytes(opName);
// var keyValues = tagValues.OrderBy(x => x.Key).ToDictionary(k => k.Key, v => v.Value);
// TagFormat tagFormatTemp;
// int tagIndex = 1;
// int isOK = 0;
// Hashtable ht = new Hashtable();
// foreach (KeyValuePair<string, TagFormat> _cd in keyValues)
// {
// if (_cd.Key.ToString()[0].ToString() == "7")
// {
// tagFormatTemp = _cd.Value;
// if (tagIndex % 3 == 1)
// {
// isOK = Convert.ToInt32(tagFormatTemp.TagValue);
// }
// else if (tagIndex % 3 == 2)
// {
// var TF = _cd.Value;
// QualityDataType qualityDataType;
// qualityDataType = GetQualityDataType(TF);
// qualityDataType.isGoodBad = isOK;
// ht.Add(qualityDataType.tagID, qualityDataType);
// }
// else if (tagIndex % 3 == 0)
// {
// var TF = (TagFormat)_cd.Value;
// QualityDataType qualityDataType;
// qualityDataType = GetQualityDataType(TF);
// qualityDataType.isGoodBad = isOK;
// ht.Add(qualityDataType.tagID, qualityDataType);
// }
// tagIndex++;
// }
// //Console.WriteLine($"key{kv.Key} value{kv.Value}");
// }
// return ht;
// }
//}
public static QualityDataType1 GetQualityDataType(TagFormat TF)
{
QualityDataType1 qualityDataType;
qualityDataType = new QualityDataType1();
qualityDataType.tagID = TF.TagID;
qualityDataType.tagTypeID = TF.TagTypeID;//变量类型
qualityDataType.opName = TF.OpName;
qualityDataType.tagValueType = TF.TagTypeCodeID;
int.TryParse(TF.TagOrderBy, out int TagOrderBy);
qualityDataType.tagOrderBy = TagOrderBy;
int.TryParse(TF.TagItemOrderBy, out int TagItemOrderBy);
qualityDataType.tagItemOrderBy = TagItemOrderBy;
qualityDataType.tagValue = TF.TagValue;//变量值
return qualityDataType;
}
public static bool BaseData_tagTable_QualityData_B5A_IndexInsert(string EngineID, string tagID, string EngineType, int EngineTypeID, string opName, int isGoodBad, string PartPalletCode, out int Id_tagCF)
{
string procedureName;
procedureName = "测量数据合格索引_增加";
Id_tagCF = 0;
SqlParameter[] thisParms = new SqlParameter[8];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@EngineID", EngineID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@TagID_CF", tagID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineType", EngineType);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", EngineTypeID);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@托盘编号", PartPalletCode);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@合格标志", isGoodBad);
thisParms[7] = new System.Data.SqlClient.SqlParameter("@Id_tagCF", Id_tagCF);
thisParms[7].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
{
Id_tagCF = Convert.ToInt32(thisParms[7].Value.ToString());
return true;
}
return false;
}
public static bool BaseData_tagTable_QualityData_B5A_Insert(int Id_tagCF, int engineTypeID, string engineID, string opName, DataTable dt, bool IsCheck = false)
{
string procedureName;
procedureName = "测量数据合格_增加";
SqlParameter[] thisParms = new SqlParameter[15];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@Id_tagCF", Id_tagCF);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", engineTypeID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineID", engineID);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@TagID", SqlDbType.Int, 4, "TagID");
thisParms[4] = new System.Data.SqlClient.SqlParameter("@TagValue", SqlDbType.NVarChar, 100, "TagValue");
thisParms[5] = new System.Data.SqlClient.SqlParameter("@IsGoodBad", SqlDbType.Int, 4, "IsGoodBad");
//是否保存无合格标志数据数据
//thisParms[6] = new System.Data.SqlClient.SqlParameter("@IsCheck", IsCheck);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@测量位置", SqlDbType.NVarChar, 50, "测量位置");
thisParms[7] = new System.Data.SqlClient.SqlParameter("@测量项目", SqlDbType.NVarChar, 50, "测量项目");
thisParms[8] = new System.Data.SqlClient.SqlParameter("@工位号", opName); //为了给J07MA020 保留四位精度而设置
thisParms[9] = new System.Data.SqlClient.SqlParameter("@理论值", SqlDbType.NVarChar, 50, "理论值");
thisParms[10] = new System.Data.SqlClient.SqlParameter("@上限值", SqlDbType.NVarChar, 50, "上限值");
thisParms[11] = new System.Data.SqlClient.SqlParameter("@下限值", SqlDbType.NVarChar, 50, "下限值");
thisParms[12] = new System.Data.SqlClient.SqlParameter("@测量单位", SqlDbType.NVarChar, 50, "测量单位");
thisParms[13] = new System.Data.SqlClient.SqlParameter("@列位置", SqlDbType.Int, 4, "列位置");
thisParms[14] = new System.Data.SqlClient.SqlParameter("@变量排序", SqlDbType.Int, 4, "变量排序");
//table.Columns.Add("TagID", typeof(System.Int32));
//table.Columns.Add("TagValue", typeof(System.String));
//table.Columns.Add("IsGoodBad", typeof(System.Int32));
//table.Columns.Add("测量位置", typeof(System.String));
//table.Columns.Add("测量项目", typeof(System.String));
//table.Columns.Add("工位号", typeof(System.String));
//table.Columns.Add("理论值", typeof(System.String));
//table.Columns.Add("上限值", typeof(System.String));
//table.Columns.Add("下限值", typeof(System.String));
//table.Columns.Add("测量单位", typeof(System.String));
//table.Columns.Add("列位置", typeof(System.Int32));
//table.Columns.Add("变量排序", typeof(System.Int32));
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, dt);
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Data;
namespace MisDataSaveDateMesRead
{
public partial class Funtion
{
/// <summary>
/// 数据表
/// </summary>
/// <returns></returns>
static public DataTable BuildDataTables_WWW()
{
DataTable table;
DataColumnCollection columns;
table = new DataTable();
columns = table.Columns;
table.Columns.Add("TagID", typeof(System.String));
table.Columns.Add("TagValue", typeof(System.String));
table.Columns.Add("IsGoodBad", typeof(System.Int32));
table.Columns.Add("测量位置", typeof(System.String));
table.Columns.Add("测量项目", typeof(System.String));
table.Columns.Add("工位号", typeof(System.String));
table.Columns.Add("理论值", typeof(System.String));
table.Columns.Add("上限值", typeof(System.String));
table.Columns.Add("下限值", typeof(System.String));
table.Columns.Add("测量单位", typeof(System.String));
table.Columns.Add("列位置", typeof(System.Int32));
table.Columns.Add("变量排序", typeof(System.Int32));
return table;
}
/// <summary>
/// 返回非标准real
/// </summary>
/// <param name="vDataValue"></param>
/// <returns></returns>
static public string GetNoNormalReal(object vDataValue)
{
try
{
string real_a;
string real_b;
string groupValueString;
int length;
//int real_b_Int;
length = ((System.Array)(vDataValue)).Length;
groupValueString = "";
if (length != 2)
return "0.0";
real_a = Convert.ToUInt16((((System.Array)(vDataValue)).GetValue(0))).ToString();
real_b = Convert.ToUInt16((((System.Array)(vDataValue)).GetValue(1))).ToString("00");
groupValueString = real_a + "." + real_b;
return groupValueString;
}
catch
{
////ApplicationLog.WriteLog(err, "GetNoNormalReal");
return "0.0";
}
}
/// <summary>
/// 29 工位具体零件合格标志
/// </summary>
/// <param name="QualityData_GoodBad"></param>
static public string GetQualityData_GoodBad_String(bool[] QualityData_GoodBad)
{
string str;
str = "";
if (QualityData_GoodBad != null)
{
for (int i = 0; i < QualityData_GoodBad.Length; i++)
{
str = str + (Convert.ToInt32(QualityData_GoodBad[i])).ToString() + "|";
}
}
return str;
}
/// <summary>
/// 返回非标准real
/// </summary>
/// <param name="vDataValue"></param>
/// <returns></returns>
}
}

View File

@@ -0,0 +1,18 @@
using System.Threading;
namespace MisDataFunDll
{
public partial class CommFun_CATL
{
// 由于现在没有接口先模拟调用webapi输入参数1.电芯码返回参数1.对比结果
public static int GetCellInfo(string cellCode)
{
int result = 1;
Thread.Sleep(200);
return result;
}
}
}

View File

@@ -0,0 +1,299 @@
using DataLinkMesWork1;
using System.Data;
using System.Data.SqlClient;
namespace MisDataFunDll
{
public partial class MisDataFun
{
public static DataTable BaseData_tagTable_TagName()
{
DataTable dt = null;
string sql;
sql = "SELECT distinct[TagName],[变量类型代码] FROM[MES_基本变量_原始数据] ";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
public static DataTable GetMesServerCodeFromMIS()
{
DataTable dt;
string sql;
sql = "exec MES_计划BOM_工位与名称_查询应用程序";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
public static DataTable dt_Signal()
{
DataTable dt;
string sql;
sql = "SELECT * FROM [MES_基本变量_原始数据]";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
public static DataTable dt_Device()
{
DataTable dt;
string sql;
sql = "SELECT * FROM [MES_基本变量设备类型对应表]";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
public static DataTable dt_TagTypeDataType()
{
DataTable dt;
string sql;
sql = "SELECT TOP (1000) [序号],[变量类型],[TagTypeDataType],[TagName],[变量类型代码],[TagTypeChange],[MesTagTypeChange],[WebTagTypeChange],[信号点名称][变量类型名称] FROM [MES_基本变量变量类型代码]";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
public static DataTable GetCheckOpName()
{
DataTable dt = new DataTable();
string produceName = "MES_计划BOM_工位与名称_查询";
SqlParameter[] thisParms = null;
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
/// <summary>
/// 查询工步属性
/// </summary>
/// <returns></returns>
public static DataTable GetworkStepPropertyFromMIS()
{
DataTable dt;
string sql;
sql = "SELECT distinct 工位号,工步属性 FROM [MES_计划BOM_工位与名称] where 是否监控=1";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// 查询返修工位号
/// </summary>
/// <returns></returns>
public static DataTable GetOpNameRepairFromMIS()
{
DataTable dt;
string sql;
sql = "SELECT distinct 工位号,返修工位号 FROM [MES_计划BOM_工位与名称] where 是否监控=1";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// 测量工位号和工位名称
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_QualityData_OpName_Name()
{
DataTable dt;
string sql = "SELECT distinct [工位号],[工位名称] FROM [MES_计划BOM_工位与名称] "
+ " where (监控属性代码 = '" + 1 + "')"
+ " ORDER BY 工位号 ";
//来源于SQL Server
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// MES_计划BOM_工位与名称
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_OpName()
{
//DataTable dt;
//string sql = "SELECT * FROM [MES_计划BOM_工位与名称] "
// + " where (监控属性代码 = '" + ApplicationConfig.MES_Code.ToString() + "')"
// + " ORDER BY 工位号 ";
//DataAccess.ExecuteDataTable(sql, out dt);
//return dt;
//2022.07.27.LLX 处理了一下子
DataTable dt;
string sql = "SELECT * FROM [MES_计划BOM_工位与名称] "
+ " where (监控属性代码 = '" + 1 + "') and [是否通过监控系统保存数据] is not null"
+ " ORDER BY 工位号 ";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// MES_基本变量_DB数据结构_根据工位代码_获得普通变量
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_OpcServerMES(int mesCode, string opName)
{
DataTable dt;
string sql;
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 "
+ " FROM MES_基本变量_原始数据 "
+ " where 变量类型代码 = " + mesCode.ToString() + " and 是否启用 = 1"
+ " and 工位号='" + opName + "'"
+ " and (监控属性代码 = '" + 1 + "')";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// MES_基本变量_DB数据结构_根据工位代码_获得普通变量
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_OpcServerMES(int mesCode)
{
DataTable dt;
string sql;
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 "
+ " FROM MES_基本变量_原始数据 "
+ " where 变量类型代码 = " + mesCode.ToString() + " and 是否启用 = 1"
+ " and (监控属性代码 = '" + 1 + "')";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// MES_基本变量_DB数据结构_获得激发变量
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_All()
{
//string errorMessage;
DataTable dt = null;
string sql;
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 FROM [MES_基本变量_原始数据] "
+ " where ((变量类型代码 >= 19 and 变量类型代码 <= 27) or (变量类型代码 = 101) or (变量类型代码 = 102) or (变量类型代码 = 105) or (变量类型代码 = 1000) or (变量类型代码 = 1001) or (变量类型代码 = 1002) or (变量类型代码 = 1003) or (变量类型代码 = 1004)) and (是否启用 = 1) "
+ " and (监控属性代码 = '" + 1 + "')"
+ " ORDER BY TagID ";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// MES_基本变量_DB数据结构_获得激发变量
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_All_B5A()
{
//string errorMessage;
DataTable dt = null;
string sql;
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 FROM [MES_基本变量_原始数据] "
+ " where ((变量类型代码 = 101) or (变量类型代码 = 102) ) and (是否启用 = 1) "
+ " and (监控属性代码 = '" + 1 + "')"
+ " ORDER BY TagID ";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// 20170310 新加
/// MES_基本变量_DB数据结构_获得所有普通变量除101.102.103.104.105
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_OpcServerMES_ALL_CF()
{
DataTable dt;
string sql;
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 "
+ " FROM MES_基本变量_原始数据 "
+ " where 变量类型代码 <> 101 and 变量类型代码 <> 102 and 变量类型代码 <> 103 and 变量类型代码 <> 104 and 变量类型代码 <> 105 and 是否启用 = 1"
+ " and (监控属性代码 = '" + 1 + "')";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// 发动机类型转换表
/// SELECT ID,发动机机型代码 FROM MES_计划BOM_发动机型号代码
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_QualityData_EngineTypeID()
{
DataTable dt;
string sql;
sql = "SELECT ID,发动机机型代码 FROM MES_计划BOM_发动机型号代码 ";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// 测量合格标志
/// 全部测量数据的测量工位
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName_B5A()
{
DataTable dt;
string sql;
sql = "SELECT distinct 工位号 "
+ " FROM MES_基本变量_原始数据 "
+ " where 变量特点 = 8 and 是否启用 = 1 "
+ " and (监控属性代码 = '" + 1 + "')";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// 测量合格标志
/// 全部测量数据的测量工位的数据来源
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName(string opName)
{
DataTable dt;
string sql;
sql = "SELECT TagID,工位号,数据来源 "
+ " FROM MES_基本变量_原始数据 "
+ " where OpcServer_OPNAME = '1' and 是否启用 = 1 "
+ " and 工位号='" + opName + "'"
+ " and (监控属性代码 = '" + 1 + "')";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// 测量合格标志
/// 全部测量数据的测量工位的数据来源的测量变量
/// </summary>
/// <returns></returns>
public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName(string opName, string opNameFrom)
{
DataTable dt;
string sql;
sql = "SELECT TagID "
+ " FROM MES_基本变量_原始数据 "
+ " where OpcServer_OPNAME = '2' and 是否启用 = 1 "
+ " and 工位号='" + opName + "'"
+ " and 数据来源='" + opNameFrom + "'"
+ " and (监控属性代码 = '" + 1 + "')";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
/// <summary>
/// MES_基本变量_机型代码_查询
/// </summary>
/// <param name="dt"></param>
static public void EngineType_Select(out DataTable dt)
{
dt = null;
string sql = "exec MES_基本变量_机型代码_查询";
DataAccess.ExecuteDataTable(sql, out dt);
}
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
namespace MisDataFunDll
{
public partial class MisDataFun
{
/// <summary>
/// Source|Cmd|OpName|TagValue
/// </summary>
/// <param name="cmd"></param>
/// <returns></returns>
public static List<string> GetCmdStringList(string cmd)
{
List<string> list = new List<string>();
string item;
int index;
try
{
index = cmd.IndexOf('|');
item = cmd.Substring(0, index);
list.Add(item);
cmd = cmd.Substring(index + 1);
index = cmd.IndexOf('|');
item = cmd.Substring(0, index);
list.Add(item);
cmd = cmd.Substring(index + 1);
index = cmd.IndexOf('|');
item = cmd.Substring(0, index);
list.Add(item);
item = cmd.Substring(index + 1);
list.Add(item);
}
catch { }
return list;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,163 @@
using DataLinkMesWork1;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
namespace MisDataFunDll
{
public partial class MisDataFun
{
static object locker = new object();
/// <summary>
///引用程序集Hashtable
/// </summary>
public static Hashtable Hashtable_assembly = new Hashtable();
public static Hashtable hashtable_MesServerCode = new Hashtable();
public static Hashtable hashtable_MesDll = new Hashtable();
public static Hashtable hashtable_TagTypeTagName = new Hashtable();
public static Hashtable hashtable_TagName = new Hashtable();
/// <summary>
///
/// </summary>
/// <param name="hashtable_TagName">变量名称对应的变量类型代码</param>
/// <param name="hashtable_TagTypeTagName">变量类型代码对应的变量名称</param>
public static void GetBaseData_tagTable_TagName(out Hashtable hashtable_TagName, out Hashtable hashtable_TagTypeTagName)
{
hashtable_TagName = new Hashtable();
hashtable_TagTypeTagName = new Hashtable();
string tagName;
string tagTypeCode;
DataTable dt;//GetMesServerCodeFromMIS
dt = BaseData_tagTable_TagName();
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
tagName = dt.Rows[i]["TagName"].ToString();
tagTypeCode = dt.Rows[i]["变量类型代码"].ToString();
if (!hashtable_TagName.Contains(tagName))
{
hashtable_TagName.Add(tagName, tagTypeCode);
}
if (!hashtable_TagTypeTagName.Contains(tagTypeCode))
{
hashtable_TagTypeTagName.Add(tagTypeCode, tagName);
}
}
}
}
public static void GetMesServerCodeAndMesDll(out Hashtable hashtable_MesServerCode, out Hashtable hashtable_MesDll)
{
hashtable_MesServerCode = new Hashtable();
hashtable_MesDll = new Hashtable();
string OpName;
string MesServerCode;
string MesDll;
DataTable dt;//GetMesServerCodeFromMIS
dt = GetMesServerCodeFromMIS();
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
OpName = dt.Rows[i]["工位号"].ToString();
MesServerCode = dt.Rows[i]["MesServerCode"].ToString();
MesDll = dt.Rows[i]["MesDll"].ToString();
if (!hashtable_MesDll.Contains(OpName))
{
hashtable_MesDll.Add(OpName, MesDll);
}
if (!hashtable_MesServerCode.Contains(OpName))
{
hashtable_MesServerCode.Add(OpName, MesServerCode);
}
}
}
}
/// <summary>
/// MesServerFunction
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
/// <param name="fun"></param>
public static void TransferInfToMES(object text)
{
try
{
string recData = text.ToString();
List<string> dataArray = GetCmdStringList(recData);
//消息来源
string m_Source = dataArray[0].ToString();
//消息类型 Barcode
string m_Command = dataArray[1].ToString();
//工位号
string m_OpName = dataArray[2].ToString();
//消息参数
string m_Value = dataArray[3].ToString();
string mesServerdllName;
//获得工位对应的 dll
if (!GetMesServerDllNameByOpName(out mesServerdllName, m_OpName)) return;
if (mesServerdllName == null) return;
if (mesServerdllName.Length < 1) return;
string ResultOK = "";
object[] Paramsters = new object[1];
Paramsters[0] = text;
System.Reflection.Assembly assembly = null;
bool IsOK = Hashtable_assembly.ContainsKey(mesServerdllName);
if (IsOK)
{
assembly = (System.Reflection.Assembly)Hashtable_assembly[mesServerdllName];
}
else
{
assembly = System.Reflection.Assembly.Load(mesServerdllName);
if (assembly == null)
{
return;
}
Hashtable_assembly.Add(mesServerdllName, assembly);
}
ResultOK = Reflection.ReflectionMethod(assembly, "MesServerFunctions", "FunctionMES", "FunWork", Paramsters);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "TransferInf");
}
}
/// <summary>
/// 获得工位对应的 dll
/// </summary>
/// <param name="mesServerdllName"></param>
/// <param name="opName"></param>
/// <returns></returns>
private static bool GetMesServerDllNameByOpName(out string mesServerdllName, string opName)
{
try
{
mesServerdllName = hashtable_MesDll[opName].ToString();
return true;
}
catch
{
mesServerdllName = "";
return false;
}
}
}
}

View File

@@ -0,0 +1,156 @@
using DataLinkMesWork1;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MisDataFunDll
{
public partial class ShaftPosition
{
/// <summary>
/// 测量数据合格_电子看板_质量数据_临时表_增加_返修工位
/// @EngineID nvarchar(50)=null,
/// @EngineType nvarchar(50)=null,
/// @EngineTypeID int = null,
/// @工位号 nvarchar(50)=null,
/// @工位号返修工位 nvarchar(50)=null,
/// @订单号 nvarchar(50)=null,
/// @合格标志 int
/// </summary>
/// <param name="engineID">工件号</param>
/// <param name="engineType">机型</param>
/// <param name="engineTypeID">机型代码</param>
/// <param name="opName">工位号(被返修的工位号)</param>
/// <param name="opNameRepair">工位号返修工位</param>
/// <param name="orderForm">订单号</param>
/// <param name="isOK">合格标志</param>
static public void ShaftPosition_Data_OpNameRepair_Insert(string engineID, string engineType, int engineTypeID, string opName, string opNameRepair, string orderForm, int isOK)
{
string procedureName;
procedureName = "测量数据合格_电子看板_质量数据_临时表_增加_返修工位";
SqlParameter[] thisParmsSql = new SqlParameter[7];
thisParmsSql[0] = new SqlParameter("@EngineID", engineID);
thisParmsSql[1] = new SqlParameter("@EngineType", engineType);
thisParmsSql[2] = new SqlParameter("@EngineTypeID", engineTypeID);
thisParmsSql[3] = new SqlParameter("@工位号", opName);
thisParmsSql[4] = new SqlParameter("@工位号返修工位", opNameRepair);
thisParmsSql[5] = new SqlParameter("@订单号", orderForm);
thisParmsSql[6] = new SqlParameter("@合格标志", isOK);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
}
/// <summary>
/// 测量数据合格_电子看板_质量数据_临时表_增加
/// @EngineID nvarchar(50)=null,
/// @EngineType nvarchar(50)=null,
/// @EngineTypeID int = null,
/// @工位号 nvarchar(50)=null,
/// @订单号 nvarchar(50)=null,
/// @合格标志 int
/// </summary>
/// <param name="engineID">工件号</param>
/// <param name="engineType">机型</param>
/// <param name="engineTypeID">机型代码</param>
/// <param name="opName">工位号</param>
/// <param name="orderForm">订单号</param>
/// <param name="isOK">合格标志</param>
static public void ShaftPosition_Data_Insert(string engineID, string engineType, int engineTypeID, string opName, string orderForm, int isOK)
{
string procedureName;
procedureName = "测量数据合格_电子看板_质量数据_临时表_增加";
SqlParameter[] thisParmsSql = new SqlParameter[6];
thisParmsSql[0] = new SqlParameter("@EngineID", engineID);
thisParmsSql[1] = new SqlParameter("@EngineType", engineType);
thisParmsSql[2] = new SqlParameter("@EngineTypeID", engineTypeID);
thisParmsSql[3] = new SqlParameter("@工位号", opName);
thisParmsSql[4] = new SqlParameter("@订单号", orderForm);
thisParmsSql[5] = new SqlParameter("@合格标志", isOK);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
}
/// <summary>
///
/// </summary>
/// <param name="opName"></param>
/// <param name="shaftStep"></param>
/// <param name="engineID"></param>
/// <param name="engineType"></param>
/// <param name="engineTypeID"></param>
/// <param name="orderBy"></param>
/// <param name="tagValue"></param>
/// <param name="isOK"></param>
static public void ShaftPosition_Data_Insert_RepairOpName(string opName, int shaftStep, string engineID, string engineType, int engineTypeID, int orderBy, string tagValue, int isOK)
{
string procedureName;
procedureName = "电子看板_质量数据_临时表_增加_备用拧紧工位";
SqlParameter[] thisParmsSql = new SqlParameter[8];
thisParmsSql[0] = new SqlParameter("@工位号", opName);
thisParmsSql[1] = new SqlParameter("@序号", shaftStep);
thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
thisParmsSql[3] = new SqlParameter("@EngineType", engineType);
thisParmsSql[4] = new SqlParameter("@EngineTypeID", engineTypeID);
thisParmsSql[5] = new SqlParameter("@变量排序", orderBy);
thisParmsSql[6] = new SqlParameter("@测量值", tagValue);
thisParmsSql[7] = new SqlParameter("@合格标志", isOK);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
}
/// <summary>
/// 电子看板_质量数据_临时表_增加
/// </summary>
/// <param name="opName">工位号</param>
/// <param name="shaftStep">序号</param>
/// <param name="engineID">工件号</param>
/// <param name="engineType">机型</param>
/// <param name="engineTypeID">机型代码</param>
/// <param name="tagID">变量代码</param>
/// <param name="tagValue">变量值</param>
/// <param name="isOK">合格标志</param>
static public void ShaftPosition_Data_Insert(string opName, int shaftStep, string engineID, string engineType, int engineTypeID, int tagID, string tagValue, int isOK)
{
string procedureName;
procedureName = "电子看板_质量数据_临时表_增加";
SqlParameter[] thisParmsSql = new SqlParameter[8];
thisParmsSql[0] = new SqlParameter("@工位号", opName);
thisParmsSql[1] = new SqlParameter("@序号", shaftStep);
thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
thisParmsSql[3] = new SqlParameter("@EngineType", engineType);
thisParmsSql[4] = new SqlParameter("@EngineTypeID", engineTypeID);
thisParmsSql[5] = new SqlParameter("@TagID", tagID);
thisParmsSql[6] = new SqlParameter("@测量值", tagValue);
thisParmsSql[7] = new SqlParameter("@合格标志", isOK);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
}
/// <summary>
/// 电子看板_工位机型_质量数据测量位置_查询_工作顺序
/// </summary>
/// <param name="opName"></param>
/// <param name="engineTypeID"></param>
/// <param name="dt"></param>
static public void ShaftPosition_Select_WorkingStep(string opName, int engineTypeID, out DataTable dt)
{
dt = null;
string sql = "exec 电子看板_工位机型_质量数据测量位置_查询_工作顺序 '" + opName + "'," + engineTypeID.ToString();
DataAccess.ExecuteDataTable(sql, out dt);
}
/// <summary>
/// 电子看板_质量数据_临时表_删除
/// </summary>
/// <param name="opName">工位号</param>
/// <param name="shaftStep">列位置</param>
/// <param name="engineID">EngineID</param>
static public void ShaftPosition_Data_Delete(string opName, int shaftStep, string engineID)
{
string procedureName;
procedureName = "电子看板_质量数据_临时表_删除";
SqlParameter[] thisParmsSql = new SqlParameter[3];
thisParmsSql[0] = new SqlParameter("@工位号", opName);
thisParmsSql[1] = new SqlParameter("@列位置", shaftStep);
thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
}
}
}

View File

@@ -0,0 +1,462 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
///1 X WorkStart 2 工件到位(PLC) 工件到位。托盘到达工位,并且托盘上有工件。
///2 X RepairPartStatusPLC 3 RepairPartStatusPLC 备用
///3 STRING RepairPathString 4 RepairPathString "工位返修字符串121211112222111,前2位是西门子字符串格式第一位是总长度第二位是实际长度"
///4 X EngineTypeGetOverMES 5 传递机型(MES) MES传递总成信息给PLC上线工位
///5 X PartPalletGoOver 6 PartPalletGoOver 上线工位。0正常工作1空托盘放行PLC读取到此标志不走申请上线逻辑。
///6 X MaterialVerifyOver 7 MaterialVerifyOver MES保存完质量数据物料数据等与PLC信号交互完成后通知PLC所以工步都完成才可以放行工件正常工作时工件放行的必要条件。
///7 X FalseGo 8 FalseGo 按MES界面[不合格放行]按钮MES发送此信号。操作者判断工件不合格通知设备按不合格方式放行工件工件流转到返修下线工位后返修下线。MES工作完成MES0.3=1MES合格放行MES0.5=0MES0.4=1
///8 INT EngineTypeID 9 EngineTypeID MES发动机机型标志(必须PLC)
///9 STRING EngineID 10 EngineID MES发动机编号(必须PLC)
///10 STRING EngineType 11 机型(MES) MES发动机机型(必须PLC)
///11 X PartPalletStatus 13 PartPalletStatus MES激发变量托盘到位离开(必须PLC)
///12 X HeartBeatPLC 14 HeartBeatPLC 心跳处理PLC收到MES心跳信号后PLC延时5秒后数值取反再写回PLC写回PLC开始计时如果5秒钟MES无反馈报通讯故障。
///13 X HeartBeatMIS 15 HeartBeatMIS 间隔时间5S心跳处理。收到PLC心跳信号后MES按原值回写。PLC收到MES信号后延时5秒取反写入以此循环。
///14 X TargetTimeRead 16 TargetTimeRead MES允许可读工位运行时间
///15 Int MachineTargetTime 17 MachineTargetTime 目标运行时间
///16 Int MachineActualTime 18 MachineActualTime 实际运行时间
///17 X MesRead 19 允许保存(PLC) 质量数据可以读数据
///18 X MesReadOver 20 保存完成(MES) MES保存完数据(必须MIS)
///19 INT QualityMask 21 合格标志(PLC) 质量数据工位合格标志0:没有工作1合格 2 :不合格(必须PLC)
///20 B PalletInfo 22 PalletInfo 0空托盘1合格件2不合格件
///21 INT RepairStatusPLC 23 RepairStatusPLC 0正常件1返修件
///22 INT OrderNo 24 订单号(MES) 订单号(MES)
///23 X StorageNo 25 库位号(MES) 库位号(MES)
///24 X AllowPass 26 允许放行(MES) 允许放行
///25 X PartLoadFinish 27 PartLoadFinish PartLoadFinish
///26 X Reserved_7 28 Reserved_7 备用
///27 X Reserved_8 29 Reserved_8 备用
///28 X Reserved_9 30 Reserved_9 备用
///29 X Reserved_10 31 Reserved_10 备用
///30 X Reserved_11 32 Reserved_11 备用
///31 X Reserved_12 33 Reserved_12 备用
///32 X Reserved_13 34 Reserved_13 备用
///33 X Reserved_14 35 Reserved_14 备用
///34 Int PLCSPareint1 36 PLCSPareint1 备用
///35 Int PLCSPareint2 37 PLCSPareint2 备用
///36 Int PLCSPareint3 38 PLCSPareint3 备用
///37 STRING PLCSarestring1 39 PLCSarestring1 备用
///38 STRING PLCSarestring2 40 PLCSarestring2 备用
///39 STRING MarkID 42 MarkID 机体打标号MES前2位是西门子字符串格式第一位是总长度第二位是实际长度
///40 X PartLoad 43 PartLoad 上线工位PLC向MES申请总成编号。收到该信号后MES将机型标志DBB22 ~23、总成号DBB24 ~63、总成机型DBB64 ~103写入PLC。之后MES通过信号“传递机型DBX0.1”通知PLC。
///41 X EngineTypeGetOverPLC 44 传递机型PLC PLC将机型标志DBB50…51、工件编号DBB52…101、产品型号DBB102…187、托盘编号DBB188…189准备完毕后通知MES。
///42 X PartLoadOK 48 PartLoadOK 备用
///43 X Reserved_18 49 Reserved_18 备用
///44 X PalletDown 50 PalletDown 暂时保留,项目未使用
///45 X ConfirmOkGo 51 ConfirmOkGo 按MES界面[合格放行]按钮MES发送此信号。操作者判断工件合格通知设备工件按合格方式放行工件。MES工作完成MES0.3=1MES合格放行MES0.5=1MES0.4=0
///46 X ResetDevice 52 ResetDevice 针对手动工位无HMI需要复位设备在MES页面操作。
///47 X UnloadCompleted 53 UnloadCompleted 暂时保留,项目未使用
///48 X MachineTime_ReadOver 54 MachineTime_ReadOver 备用
///49 X Reserved_19 58 Reserved_19 备用
///50 X FixOK 59 FixOK 手动拧紧工位单工步螺栓拧紧完成通知PC读取数据。
///51 X Reserved_21 61 Reserved_21 备用
///52 X Reserved_22 62 Reserved_22 备用
///53 X Reserved_23 63 Reserved_23 备用
///54 X Reserved_24 64 Reserved_24 备用
///55 X Reserved_25 65 Reserved_25 备用
///56 X FixAllow 66 FixAllow "设备工作的必须信号,对于有物料验证的工位MES验证完成给出此信号对于无物料验证工位MES直接给出此信号。"
///57 X FixOver 67 FixOver 用于手动拧紧且有质量数据工位。通知设备当前工步拧紧螺钉工作结束。
///58 X MatchingCompleted 68 MatchingCompleted 分线上总线匹配成功是1不成功是0。
///59 X Match 69 Match 分线上总线匹配成功是1不成功是0。
///60 X Reserved_2 70 Reserved_2 备用
///61 X IsAutoGetEngineID 71 IsAutoGetEngineID 自动手动申请工件编号。0是自动方式1手动方式。暂时保留生成流水号方式是在数据库中实现的
///62 X RepairUplineMES 72 RepairUplineMES 上线清空MOBY针对上线工位通知PLC从新开始申请上线流程
///63 INT EngineTypeID_MES 73 机型代码(MES) MES发动机机型标志(必须MES)
///64 STRING EngineID_MES 74 工件编号(MES) MES发动机编号(必须MES)
///65 STRING EngineType_MES 75 EngineType_MES MES发动机机型(必须MES)
///66 X Reserved_20 76 Reserved_20 备用
///67 INT ProcessCode 77 ProcessCode 手动拧紧工位由MES通知PLC拧紧序号
///68 B OnLineState 79 OnLineState 通过线体工位PC实现下达工位工作状态工位有三种状态在线、离线、屏蔽。在线0正常状态实现正常功能。1离线:设备脱离MES工作进入不交互模式。
///69 INT PartPalletCode 80 托盘号(MES) 托盘编号(B5A)
///70 INT BoltCode 88 BoltCode 手动拧紧工位指导PLC所用套筒
///71 INT RepairStatus 93 RepairStatus "0正常件1返修件。对于上线工位MES给出是正常上线还是返修上线,返修路径"
///72 DInt Reserved_15 110 Reserved_15 备用
///73 DInt Reserved_16 111 Reserved_16 备用
///74 B Reserved_17 112 Reserved_17 备用
///75 INT SPareint1 113 SPareint1 备用int1
///76 INT SPareint2 114 SPareint2 备用int2
///77 INT SPareint3 115 SPareint3 备用int3
///78 STRING Sparestring1 116 Sparestring1 备用字符串1
///79 STRING Sparestring2 117 Sparestring2 备用字符串2
///80 X MachineStatusPutOn 1000 机床上电(PLC) 机床上电(必须PLC)
///81 X MachineStatusWorkOn 1001 循环开始(PLC) 循环开始(必须PLC)
///82 X MachineStatusAlarm 1002 设备报警(PLC) 机床故障(必须PLC)
///83 X MachineStatusNoPart 1003 MachineStatusNoPart 上料无件(必须PLC)
///84 X MachineStatusBlock 1004 MachineStatusBlock 下料堵塞(必须PLC)
namespace MisDataFunDll
{
/// <summary>
/// 这是变量类型代码的配置,几乎是不变的
/// 请不要随意修改,为了保证变量版本同一,并且方便维护,请联系发行人修改!
/// 请注意,此修改为全局修改!
/// </summary>
public enum EnumTagTypeCodeID
{
/// <summary>
/// 工件到位(PLC)
/// 变量类型Bool
/// 解释:托盘到达工位,并且托盘上有工件。
/// </summary>
WorkStart = 2,
/// <summary>
///
/// </summary>
RepairPartStatusPLC = 3,
/// <summary>
/// 工位返修字符串
/// 变量类型String
/// 解释:工位返修字符串
/// </summary>
RepairPathString = 4,
/// <summary>
/// 传递机型(MES)
/// 变量类型Bool
/// 解释MES传递总成信息给PLC上线工位
/// </summary>
EngineTypeGetOverMES = 5,
/// <summary>
///
/// </summary>
PartPalletGoOver = 6,
/// <summary>
///
/// </summary>
MaterialVerifyOver = 7,
/// <summary>
///
/// </summary>
FalseGo = 8,
/// <summary>
///
/// </summary>
EngineTypeID = 9,
/// <summary>
///
/// </summary>
EngineID = 10,
/// <summary>
/// 机型(MES)
/// 变量类型String
/// </summary>
EngineType = 11,
/// <summary>
///
/// </summary>
PartPalletStatus = 13,
/// <summary>
///
/// </summary>
HeartBeatPLC = 14,
/// <summary>
///
/// </summary>
HeartBeatMIS = 15,
/// <summary>
///
/// </summary>
TargetTimeRead = 16,
/// <summary>
///
/// </summary>
MachineTargetTime = 17,
/// <summary>
///
/// </summary>
MachineActualTime = 18,
/// <summary>
/// 允许保存(PLC)
/// 变量类型Bool
/// </summary>
MesRead = 19,
/// <summary>
/// 保存完成(MES)
/// 变量类型Bool
/// </summary>
MesReadOver = 20,
/// <summary>
/// 合格标志(PLC)
/// 变量类型Int
/// </summary>
QualityMask = 21,
/// <summary>
///
/// </summary>
PalletInfo = 22,
/// <summary>
///
/// </summary>
RepairStatusPLC = 23,
/// <summary>
/// 订单号(MES)
/// 变量类型Int
/// </summary>
OrderNo = 24,
/// <summary>
/// 库位号(MES)
/// 变量类型Bool
/// </summary>
StorageNo = 25,
/// <summary>
/// 允许放行(MES)
/// 变量类型Bool
/// </summary>
AllowPass = 26,
/// <summary>
///
/// </summary>
PartLoadFinish = 27,
/// <summary>
///
/// </summary>
Reserved_7 = 28,
/// <summary>
///
/// </summary>
Reserved_8 = 29,
/// <summary>
///
/// </summary>
Reserved_9 = 30,
/// <summary>
///
/// </summary>
Reserved_10 = 31,
/// <summary>
///
/// </summary>
Reserved_11 = 32,
/// <summary>
///
/// </summary>
Reserved_12 = 33,
/// <summary>
///
/// </summary>
Reserved_13 = 34,
/// <summary>
///
/// </summary>
Reserved_14 = 35,
/// <summary>
///
/// </summary>
PLCSPareint1 = 36,
/// <summary>
///
/// </summary>
PLCSPareint2 = 37,
/// <summary>
///
/// </summary>
PLCSPareint3 = 38,
/// <summary>
/// 订单号(PLC)
/// </summary>
OrderFormPLC = 39,
/// <summary>
///
/// </summary>
PLCSarestring2 = 40,
/// <summary>
///
/// </summary>
MarkID = 42,
/// <summary>
///
/// </summary>
PartLoad = 43,
/// <summary>
/// 传递机型PLC
/// 变量类型Bool
/// </summary>
EngineTypeGetOverPLC = 44,
/// <summary>
///
/// </summary>
PartLoadOK = 48,
/// <summary>
///
/// </summary>
Reserved_18 = 49,
/// <summary>
///
/// </summary>
PalletDown = 50,
/// <summary>
///
/// </summary>
ConfirmOkGo = 51,
/// <summary>
///
/// </summary>
ResetDevice = 52,
/// <summary>
///
/// </summary>
UnloadCompleted = 53,
/// <summary>
///
/// </summary>
MachineTime_ReadOver = 54,
/// <summary>
///
/// </summary>
Reserved_19 = 58,
/// <summary>
///
/// </summary>
FixOK = 59,
/// <summary>
///
/// </summary>
Reserved_21 = 61,
/// <summary>
///
/// </summary>
Reserved_22 = 62,
/// <summary>
///
/// </summary>
Reserved_23 = 63,
/// <summary>
///
/// </summary>
Reserved_24 = 64,
/// <summary>
///
/// </summary>
Reserved_25 = 65,
/// <summary>
///
/// </summary>
FixAllow = 66,
/// <summary>
///
/// </summary>
FixOver = 67,
/// <summary>
///
/// </summary>
MatchingCompleted = 68,
/// <summary>
///
/// </summary>
Match = 69,
/// <summary>
///
/// </summary>
Reserved_2 = 70,
/// <summary>
///
/// </summary>
IsAutoGetEngineID = 71,
/// <summary>
///
/// </summary>
RepairUplineMES = 72,
/// <summary>
/// 机型代码(MES)
/// 变量类型Int
/// </summary>
EngineTypeID_MES = 73,
/// <summary>
/// 工件编号(MES)
/// 变量类型String
/// </summary>
EngineID_MES = 74,
/// <summary>
///
/// </summary>
EngineType_MES = 75,
/// <summary>
///
/// </summary>
Reserved_20 = 76,
/// <summary>
///
/// </summary>
ProcessCode = 77,
/// <summary>
///
/// </summary>
OnLineState = 79,
/// <summary>
/// 托盘号(MES)
/// 变量类型Int
/// </summary>
PartPalletCode = 80,
/// <summary>
///
/// </summary>
BoltCode = 88,
/// <summary>
///
/// </summary>
RepairStatus = 93,
/// <summary>
///
/// </summary>
Reserved_15 = 110,
/// <summary>
///
/// </summary>
Reserved_16 = 111,
/// <summary>
///
/// </summary>
Reserved_17 = 112,
/// <summary>
///
/// </summary>
SPareint1 = 113,
/// <summary>
///
/// </summary>
SPareint2 = 114,
/// <summary>
///
/// </summary>
/// <summary>
/// MES订单号
/// </summary>
OrdeFormMES = 116,
/// <summary>
///
/// </summary>
Sparestring2 = 117,
/// <summary>
/// 机床上电(PLC)
/// 变量类型Bool
/// </summary>
MachineStatusPutOn = 1000,
/// <summary>
/// 循环开始(PLC)
/// 变量类型Bool
/// </summary>
MachineStatusWorkOn = 1001,
/// <summary>
/// 设备报警(PLC)
/// 变量类型Bool
/// </summary>
MachineStatusAlarm = 1002,
/// <summary>
/// 上料无件(PLC)
/// 变量类型Bool
/// </summary>
MachineStatusNoPart = 1003,
/// <summary>
/// 下料堵塞(PLC)
/// 变量类型Bool
/// </summary>
MachineStatusBlock = 1004,
}
}

View File

@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Web;
using System.ComponentModel;
namespace MisDataFunDll
{
/// <summary>
///
/// </summary>
public class Reflection
{
/// <summary>
/// 通过反射调用动态连接库方法
/// </summary>
/// <param name="assembly">程序集(DLL)</param>
/// <param name="Namespace">命名空间名称,如果无命名空间写“”</param>
/// <param name="Classname">类名</param>
/// <param name="Method">方法名</param>
/// <param name="Paramsters">函数参数数组</param>
static public string ReflectionMethod(Assembly assembly, string Namespace, string Classname, string Method, object[] Paramsters)
{
try
{
Type t;
//类
if (Namespace == "")
{
t = assembly.GetType(Classname);
}
else
{
t = assembly.GetType(Namespace + "." + Classname);
}
if (t == null)
{
return "类不存在";
}
////方法
MethodInfo mi = t.GetMethod(Method); //获取方法
if (mi == null)
{
return "方法不存在";
}
ParameterInfo[] paramsInfo = mi.GetParameters();
for (int i = 0; i < paramsInfo.Length; i++)
{
Type tType = paramsInfo[i].ParameterType;
//改变参数类型
Paramsters[i]= SD_ChanageType(Paramsters[i],tType);
}
/// 建一个实例化的类
object instanceObject = Activator.CreateInstance(t);
mi.Invoke(instanceObject, Paramsters);
return "ok";
}
catch(Exception err)
{
return err.ToString();
}
}
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <param name="convertsionType"></param>
/// <returns></returns>
public static object SD_ChanageType(object value, Type convertsionType)
{
//判断convertsionType类型是否为泛型因为nullable是泛型类,
if (convertsionType.IsGenericType &&
//判断convertsionType是否为nullable泛型类
convertsionType.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
{
if (value == null || value.ToString().Length == 0)
{
return null;
}
//如果convertsionType为nullable类声明一个NullableConverter类该类提供从Nullable类到基础基元类型的转换
NullableConverter nullableConverter = new NullableConverter(convertsionType);
//将convertsionType转换为nullable对的基础基元类型
convertsionType = nullableConverter.UnderlyingType;
}
return Convert.ChangeType(value, convertsionType);
}
}
}

View File

@@ -0,0 +1,128 @@
//using BasicData;
//using MesWork;
//using OpcBasic;
using MesServerWork;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static MesServerWork.MIS_BASE;
namespace MesDataFunction
{
public class LoadTagTypeCodeID
{
public static void Load(string path)
{
MIS_BASE.hashtable_TagType = new NameValueCollection();
MIS_BASE.hashtable_TagTypeTagName = new NameValueCollection();
MIS_BASE.hashtable_TagTypeChange = new NameValueCollection();
MIS_BASE.hashtable_MesTagTypeChange = new NameValueCollection();
MIS_BASE.hashtable_WebTagTypeChange = new NameValueCollection();
MIS_BASE.hashtable_TagTypeDataType = new NameValueCollection();
var dt = NPOITest.ExeclHelper.ExcelToDataTable(path, "变量类型代码", true);
for (int i = 0; i < dt.Rows.Count; i++)
{
//序号 变量类型 TagTypeDataType TagName 变量类型代码 TagTypeChange MesTagTypeChange WebTagTypeChange 信号点名称 变量类型名称
var TagTypeDataType = dt.Rows[i]["TagTypeDataType"].ToString();
var TagName = dt.Rows[i]["TagName"].ToString();
var = dt.Rows[i]["变量类型代码"].ToString();
var TagTypeChange = dt.Rows[i]["TagTypeChange"].ToString();
var WebTagTypeChange = dt.Rows[i]["WebTagTypeChange"].ToString();
var MesTagTypeChange = dt.Rows[i]["MesTagTypeChange"].ToString();
//OpcOperation.hashtable_TagType.Add(TagName, 变量类型代码);
//OpcOperation.hashtable_TagTypeTagName.Add(变量类型代码, TagName);
//OpcOperation.hashtable_TagTypeChange.Add(TagName, TagTypeChange);
//OpcOperation.hashtable_MesTagTypeChange.Add(TagName, MesTagTypeChange);
//OpcOperation.hashtable_WebTagTypeChange.Add(TagName, WebTagTypeChange);
//OpcOperation.hashtable_TagTypeDataType.Add(变量类型代码, TagTypeDataType);
if (!MIS_BASE.hashtable_TagType.AllKeys.Contains(TagName))
MIS_BASE.hashtable_TagType.Add(TagName, );
if (!MIS_BASE.hashtable_TagTypeTagName.AllKeys.Contains())
MIS_BASE.hashtable_TagTypeTagName.Add(, TagName);
if (!MIS_BASE.hashtable_TagTypeChange.AllKeys.Contains(TagName))
MIS_BASE.hashtable_TagTypeChange.Add(TagName, TagTypeChange);
if (!MIS_BASE.hashtable_MesTagTypeChange.AllKeys.Contains(TagName))
MIS_BASE.hashtable_MesTagTypeChange.Add(TagName, MesTagTypeChange);
if (!MIS_BASE.hashtable_WebTagTypeChange.AllKeys.Contains(TagName))
MIS_BASE.hashtable_WebTagTypeChange.Add(TagName, WebTagTypeChange);
if (!MIS_BASE.hashtable_TagTypeDataType.AllKeys.Contains())
MIS_BASE.hashtable_TagTypeDataType.Add(, TagTypeDataType);
}
HashtableList.hashtable_TagTypeTagName_Temp = new Hashtable();
foreach (string key in MIS_BASE.hashtable_TagTypeTagName.Keys)
{
HashtableList.hashtable_TagTypeTagName_Temp.Add(key, MIS_BASE.hashtable_TagTypeTagName[key]);
}
HashtableList.hashtable_TagTypeDataType_Temp = new NameValueCollection();
foreach (string key in MIS_BASE.hashtable_TagTypeDataType.Keys)
{
HashtableList.hashtable_TagTypeDataType_Temp.Add(key, MIS_BASE.hashtable_TagTypeDataType[key]);
}
HashtableList.hashtable_TagType_Temp = new NameValueCollection();
foreach (string key in MIS_BASE.hashtable_TagType.Keys)
{
HashtableList.hashtable_TagType_Temp.Add(key, MIS_BASE.hashtable_TagType[key]);
}
}
public static void Load(DataTable dt)
{
MIS_BASE.hashtable_TagType = new NameValueCollection();
MIS_BASE.hashtable_TagTypeTagName = new NameValueCollection();
MIS_BASE.hashtable_TagTypeChange = new NameValueCollection();
MIS_BASE.hashtable_MesTagTypeChange = new NameValueCollection();
MIS_BASE.hashtable_WebTagTypeChange = new NameValueCollection();
MIS_BASE.hashtable_TagTypeDataType = new NameValueCollection();
for (int i = 0; i < dt.Rows.Count; i++)
{
//序号 变量类型 TagTypeDataType TagName 变量类型代码 TagTypeChange MesTagTypeChange WebTagTypeChange 信号点名称 变量类型名称
var TagTypeDataType = dt.Rows[i]["TagTypeDataType"].ToString();
var TagName = dt.Rows[i]["TagName"].ToString();
var = dt.Rows[i]["变量类型代码"].ToString();
var TagTypeChange = dt.Rows[i]["TagTypeChange"].ToString();
var WebTagTypeChange = dt.Rows[i]["WebTagTypeChange"].ToString();
var MesTagTypeChange = dt.Rows[i]["MesTagTypeChange"].ToString();
if (!MIS_BASE.hashtable_TagType.AllKeys.Contains(TagName))
MIS_BASE.hashtable_TagType.Add(TagName, );
if (!MIS_BASE.hashtable_TagTypeTagName.AllKeys.Contains())
MIS_BASE.hashtable_TagTypeTagName.Add(, TagName);
if (!MIS_BASE.hashtable_TagTypeChange.AllKeys.Contains(TagName))
MIS_BASE.hashtable_TagTypeChange.Add(TagName, TagTypeChange);
if (!MIS_BASE.hashtable_MesTagTypeChange.AllKeys.Contains(TagName))
MIS_BASE.hashtable_MesTagTypeChange.Add(TagName, MesTagTypeChange);
if (!MIS_BASE.hashtable_WebTagTypeChange.AllKeys.Contains(TagName))
MIS_BASE.hashtable_WebTagTypeChange.Add(TagName, WebTagTypeChange);
if (!MIS_BASE.hashtable_TagTypeDataType.AllKeys.Contains())
MIS_BASE.hashtable_TagTypeDataType.Add(, TagTypeDataType);
}
HashtableList.hashtable_TagTypeTagName_Temp = new Hashtable();
foreach (string key in MIS_BASE.hashtable_TagTypeTagName.Keys)
{
HashtableList.hashtable_TagTypeTagName_Temp.Add(key, MIS_BASE.hashtable_TagTypeTagName[key]);
}
HashtableList.hashtable_TagTypeDataType_Temp = new NameValueCollection();
foreach (string key in MIS_BASE.hashtable_TagTypeDataType.Keys)
{
HashtableList.hashtable_TagTypeDataType_Temp.Add(key, MIS_BASE.hashtable_TagTypeDataType[key]);
}
HashtableList.hashtable_TagType_Temp = new NameValueCollection();
foreach (string key in MIS_BASE.hashtable_TagType.Keys)
{
HashtableList.hashtable_TagType_Temp.Add(key, MIS_BASE.hashtable_TagType[key]);
}
}
}
}

View File

@@ -0,0 +1,83 @@
//using DataLinkMesWork;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
//using SystemFramework;
namespace MesServerWork
{
public class InitTagValueListData
{
public InitTagValueListData()
{
DataTable dt = ReadMesServerData();
InitMesReadTagKey();
initAllItemValue(dt);
}
DataTable ReadMesServerData()
{
return null;// MesWork.PlcLinkForm.dt_BasicData.Select($"是否启用 = 1 and 监控属性代码 = '{1}'").CopyToDataTable<DataRow>();
}
void InitMesReadTagKey()
{
DataTable dt = null;// MesWork.PlcLinkForm.dt_BasicData.Select($"是否启用 = 1 and 变量类型代码=19 and 监控属性代码 = '{1}'").CopyToDataTable<DataRow>(); ;
for (int i = 0; i < dt.Rows.Count; i++)
{
if (MesReadTagKey_Hash.ContainsKey(dt.Rows[i]["工位号"].ToString()))
{
MesReadTagKey_Hash[dt.Rows[i]["工位号"].ToString()] = dt.Rows[i]["TagID"].ToString();
}
else
{
MesReadTagKey_Hash.Add(dt.Rows[i]["工位号"].ToString(), dt.Rows[i]["TagID"].ToString());
}
}
}
void initAllItemValue(DataTable dt)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
if (ItemValue_Hash.ContainsKey(dt.Rows[i]["TagID"]))
{
if (Convert.ToInt32(dt.Rows[i]["列位置"]) != 0)
{
ItemValue_Hash[dt.Rows[i]["TagID"]] = dt.Rows[i]["测量项目"].ToString() + "(" + dt.Rows[i]["列位置"].ToString() + ")";
}
else
{
ItemValue_Hash[dt.Rows[i]["TagID"]] = dt.Rows[i]["测量项目"].ToString();
}
}
else
{
if (Convert.ToInt32(dt.Rows[i]["列位置"]) != 0)
{
ItemValue_Hash[dt.Rows[i]["TagID"]] = dt.Rows[i]["测量项目"].ToString() + "(" + dt.Rows[i]["列位置"].ToString() + ")";
}
else
{
ItemValue_Hash[dt.Rows[i]["TagID"]] = dt.Rows[i]["测量项目"].ToString();
}
}
}
}
public static Hashtable MesReadTagKey_Hash = new Hashtable();
public static Hashtable ItemValue_Hash = new Hashtable();
}
}

View File

@@ -0,0 +1,95 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
using bizFacade;
namespace MesServerWork
{
public partial class MIS_BASE
{
static object lockerBarcode = new object();
/// <summary>
///1.扫描配送单号用于接收物料扫描单号的时候将接收的物料信息显示在“物料拉动”Tab区域
///2.扫描料箱标签/看板卡,用于追溯物料批次信息
///3.扫描零件条码,根据零件图号进行防错
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
///第二步,条码类型(将扫描的条码保存到对应的表中)
///第三步,扫描完成之后给出允许工作信号
/// 处理页面扫描条码
/// </summary>
/// <param name="OpName"></param>
/// <param name="barcode"></param>
static public void Barcode(object e)
{
lock (lockerBarcode)
{
try
{
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
string OpName = Convert.ToString(msgEvent.OpName);
string barcode = Convert.ToString(msgEvent.TagValue);
string AlarmStr = "";
int IsAllowWork;
bool IsSuccess = false;
bool EngineGetOver_PLC_NextWorkStep;
//传递机型是否到位
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
if (!IsSuccess)
{
AsyncSendMessage_Notice(OpName, "条码无效,请确认");
return;
}
else
{
SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
}
//获取是否允许工作
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
//此处逻辑有问题 需要考虑到批次扫描 提示PLC未传递机型的情况
if (EngineGetOver_PLC_NextWorkStep && IsSuccess)
{
if (IsAllowWork == 1)
{
BaseDataSystemMES.Material_Insert(OpName, 1);
//if (!BaseDataSystemMES.QualityVerifyStatusOutline(OpName, out AlarmStr))
//{
// SendInfomation("LineoutAlert", AlarmStr, OpName);
// return;
//}
//通知PLC允许工作,允许工作在保存完成时清空
MIS_BASE.Write_FixAllow(OpName, true);
}
else
{
AsyncSendMessage_Notice(OpName, "请扫描物料!");
}
}
else
{
AsyncSendMessage_Notice(OpName, "PLC未传递机型");
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:Barcode");
}
}
}
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
namespace MesServerWork
{
public partial class MIS_BASE
{
static object lockerConfirmOkGo = new object();
static public void ConfirmOkGo(object e)
{
lock (lockerConfirmOkGo)
{
try
{
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
string OpName = Convert.ToString(msgEvent.OpName);
int tagValue = Convert.ToInt32(msgEvent.TagValue);
if (tagValue == 1)
{
//BaseDataSystemMES.Material_Insert(OpName, 1);
//更新订单完工数量及物料
Sendmessage("24", "11", OpName);
//工作完成
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
}
}
}
}
}

View File

@@ -0,0 +1,139 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
using bizFacade;
namespace MesServerWork
{
public partial class MIS_BASE
{
static object lockerEngineTypeGetOver_PLC_Work = new object();
static public void EngineTypeGetOver_PLC_Work(string OpName, int EngineTypeID, string EngineType, string EngineID, int PartPallet_Code,string OrderForm)
{
lock (lockerEngineTypeGetOver_PLC_Work)
{
int IsAllowWork;
int RepairPartStatusPLC = 0;
int MES_QualityMask = 1;
//string OrderForm = "";//订单号
DataTable dt;
if (EngineTypeID <= 0)
{
AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
return;
}
//第一步,查询订单号,保存机型、机型代码、总成号、托盘号、订单号到数据库
BaseDataSystemMES.GetEngineID_Select(OpName, EngineID, out dt);
if (dt != null && dt.Rows.Count > 0)
{
OrderForm = Convert.ToString(dt.Rows[0]["订单号"]);
}
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, OrderForm, EngineTypeID, EngineType, EngineID, PartPallet_Code, 0, 0, "");
SaveMobyMessage(OpName, EngineTypeID, EngineType, EngineID, OrderForm);
//第二步将零件信息转移到零件_临时表中本地BOM与订单BOM的选择显示关系
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
//通知web显示
Sendmessage("5123", "1111", OpName);
MIS_BASE.Read_PalletInfo(OpName, out MES_QualityMask);//合格标志
MIS_BASE.Read_RepairStatus_PLC(OpName, out RepairPartStatusPLC);//返修标志
SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);//显示合格标志
SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);//显示返修标志
if (MES_QualityMask == 2)
{
//工作完成
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
SendInfomation("NgGO", "1", OpName);//显示不合格标志
return;
}
//第三步,用于工件离开后完工数量统计及工件编号追溯
BaseDataSystemMES.MaterialPush_EngineIDStatus_Insert(OpName);//更新订单产量
//第四步,获取是否允许工作
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
if (IsAllowWork == 1)
{
//通知PLC允许工作,允许工作在保存完成时清空
MIS_BASE.Write_FixAllow(OpName, true);
}
else
{
AsyncSendMessage_Notice(OpName, "请扫描物料!");
}
}
}
/// <summary>
/// 保存MOBY信息
/// </summary>
/// <param name="OpName"></param>
/// <param name="engineTypeID"></param>
/// <param name="engineType"></param>
/// <param name="engineID"></param>
static private void SaveMobyMessage(string OpName, int engineTypeID, string engineType, string engineID, string orderForm)
{
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
{
MIS_BASE.InitHashtable_MesServerCode();
}
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID.ContainsKey(OpName))
{
MIS_BASE.hashtable_EngineGetOver_EngineTypeID[OpName] = engineTypeID;
}
if (MIS_BASE.hashtable_EngineGetOver_EngineType.ContainsKey(OpName))
{
MIS_BASE.hashtable_EngineGetOver_EngineType[OpName] = engineType;
}
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
{
MIS_BASE.hashtable_EngineGetOver_EngineID[OpName] = engineID;
}
if (MIS_BASE.hashtable_EngineGetOver_OrderForm.ContainsKey(OpName))
{
MIS_BASE.hashtable_EngineGetOver_OrderForm[OpName] = orderForm;
}
}
/// <summary>
/// 返修件需要工作
/// </summary>
/// <param name="OpName">工位号</param>
static private void IsNeedRepaire_OK(string OpName)
{
string orderForm = "";
int engineTypeID;
string engineType = "";
string engineID = "";
string palletCode = "";
int isRepair;
string repairCode = "";
//从监控系统中查询出本工位信息
BaseDataSystemMES.OpName_MIS_Moby_Select(OpName,
out orderForm, out engineTypeID, out engineType,
out engineID, out palletCode, out isRepair, out repairCode);
EngineTypeGetOver_PLC_Work(OpName, engineTypeID, engineType, engineID, Convert.ToInt32(palletCode),orderForm);
}
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
namespace MesServerWork
{
public partial class MIS_BASE
{
static object lockerFalseGO = new object();
static public void FalseGO(object e)
{
lock (lockerConfirmOkGo)
{
try
{
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
string OpName = Convert.ToString(msgEvent.OpName);
int tagValue = Convert.ToInt32(msgEvent.TagValue);
if (tagValue == 1)
{
//总合格标志2不合格
//BaseDataSystemMES.Material_Insert_NG(OpName, 2);
Sendmessage("24", "11", OpName);
//工作完成
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
}
}
}
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
using bizFacade;
namespace MesServerWork
{
public partial class MIS_BASE
{
static object lockerMaterial_Insert = new object();
static public void Material_Insert(string OpName)
{
lock (lockerMaterial_Insert)
{
try
{
//int tagValue = Convert.ToInt32(msgEvent.TagValue);
int IsAllowWork;
//第四步,获取是否允许工作
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
bool EngineGetOver_PLC_NextWorkStep;
//传递机型是否到位
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
if (EngineGetOver_PLC_NextWorkStep&&IsAllowWork == 1)
{
BaseDataSystemMES.Material_Insert(OpName, 1);
//更新订单完工数量及物料
Sendmessage("24", "11", OpName);
//工作完成
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
//通知PLC允许工作,允许工作在保存完成时清空
MIS_BASE.Write_FixAllow(OpName, true);
}
else
{
AsyncSendMessage_Notice(OpName, "请扫描物料!");
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
}
}
}
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
namespace MesServerWork
{
public partial class MIS_BASE
{
static object lockerMesReadOver = new object();
/// <summary>
/// 保存完成(针对半自动和手动压装工位)
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
static public void MesReadOver(object e)
{
lock (lockerMesReadOver)
{
try
{
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
string OpName = Convert.ToString(msgEvent.OpName);
var tagValue = msgEvent.TagValue.ToString();
if (tagValue == "1" | tagValue.ToLower() == "true")
{
int qualityMask;
MIS_BASE.Read_QualityMask(OpName, out qualityMask);
SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);//发给Web页面显示质量数据
if (qualityMask == 1)//全部OK给出合格放行
{
//如果存在线外扫描工位,根据扫描条码绑定线外数据 需要时解除禁用
//BaseDataSystemMES.TransLaunchDataByMainMaterial(OpName, EngineType, EngineID, EngineTypeID);
//如果存在线外排队工位,根据排队编号绑定线外数据 需要时解除禁用
////BaseDataSystemMES.MailLineAndSubLineData_InsertByEngineID_Subline(OpName,EngineID, EngineTypeID, EngineType);
MIS_BASE.Write_ConfirmOkGo(OpName, true);
//MIS_BASE.Write_FalseGO(OpName, false);
}
else
{
//MIS_BASE.Write_ConfirmOkGo(OpName, false);
MIS_BASE.Write_FalseGO(OpName, true);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:MesReadOver");
}
}
}
}
}

View File

@@ -0,0 +1,162 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
using bizFacade;
namespace MesServerWork
{
public partial class MIS_BASE
{
/// <summary>
/// 发送提示消息
/// </summary>
/// <param name="Message"></param>
static private void AsyncSendMessage_Notice(string opname, string notice)
{
//通知Web界面
BaseDataSystemMES.Web_Notice_Insert(opname, notice);
string SendMessage = "MES|Notice|" + opname + "|" + "1";
MIS_BASE.asyncSendMessage(SendMessage);
}
/// <summary>
/// 向WEB发送信息value为字符串
/// </summary>
/// <param name="Command">消息种类</param>
/// <param name="Value">消息内容</param>
/// <param name="OpName">工位号</param>
static public string SendInfomation(string Command, string Value, string OpName)
{
string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
return AsyncSendMessage(SendMessage);
}
/// <summary>
/// 发送信息到MES通讯服务器或者其他的
/// </summary>
/// <param name="Message"></param>
static private string AsyncSendMessage(string Message)
{
return MIS_BASE.asyncSendMessage(Message);
}
/// <summary>
/// 批量发送WEB消息Value为BOOL值
/// </summary>
/// <param name="MessageNumm">消息编号组合</param>
/// <param name="Value">消息值组合</param>
/// <param name="OpName">工位号</param>
static void Sendmessage(string MessageNumm, string Value, string OpName)
{
for (int i = 0; i < MessageNumm.Length; i++)
{
Sendmessage(MessageNumm[i], Value[i].ToString(), OpName);
}
}
/// <summary>
/// 选择发送给WEB的消息
/// </summary>
/// <param name="Num">消息类型</param>
/// <param name="OpName">消息工位</param>
static string Sendmessage(char Num, string Value, string OpName)
{
string SendMessage;
string result = "";
switch (Num)
{
case '1':
//1直接在界面通过选择机型确认工序内容
SendMessage = "MES|ProcessList|" + OpName + "|" + Value;
result = AsyncSendMessage(SendMessage);
break;
case '2':
//2显示物料
SendMessage = "MES|MaterialList|" + OpName + "|" + Value;
result = AsyncSendMessage(SendMessage);
break;
case '3':
//3显示操作指导图片
SendMessage = "MES|PicShow|" + OpName + "|" + Value;
result = AsyncSendMessage(SendMessage);
break;
case '4':
//4订单完工模块刷新完成数量
SendMessage = "MES|OrderFormList|" + OpName + "|" + Value;
AsyncSendMessage(SendMessage);
break;
case '5':
SendMessage = "MES|ShowMoby|" + OpName + "|" + Value;
result = AsyncSendMessage(SendMessage);
break;
case '6':
SendMessage = "MES|MaterialCheckPosition|" + OpName + "|" + Value;
result = AsyncSendMessage(SendMessage);
break;
case '7':
SendMessage = "MES|WorkStart|" + OpName + "|" + Value;
result = AsyncSendMessage(SendMessage);
break;
case '8'://清除MES生成编号
break;
case '9':
SendMessage = "MES|ConfirmOkGo|" + OpName + "|" + Value;
result = AsyncSendMessage(SendMessage);
break;
case 'a':
SendMessage = "MES|FixAllow|" + OpName + "|" + Value;
result = AsyncSendMessage(SendMessage);
break;
}
return result;
}
///// <summary>
///// 向WEB发送信息value为字符串
///// </summary>
///// <param name="Command">消息种类</param>
///// <param name="Value">消息内容</param>
///// <param name="OpName">工位号</param>
//string SendInfomation(string Command, string Value, string OpName)
//{
// string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
// return AsyncSendMessage(SendMessage);
//}
/// <summary>
/// 发送在线产量、在线节拍
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
private void SendActuallyCount(string OpName, int tagValue)
{
//当工件离开时,更新在线产量、在线节拍
if (tagValue == 0)
{
try
{
int opNameCount = 0;//在线产量
int opNameCountTime = 0;//在线节拍
//基本数据_工作日历_班次产量查询_New
BaseDataSystemMES.OpNameCount_New(OpName, out opNameCount, out opNameCountTime);
string SendMessage;
SendMessage = "MES|ActuallyCount|" + OpName + "|" + opNameCount.ToString() + "&" + opNameCountTime.ToString();
AsyncSendMessage(SendMessage);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:SendActuallyCount");
}
}
}
}
}

View File

@@ -0,0 +1,282 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
using System.Threading;
using bizFacade;
namespace MesServerWork
{
public partial class MIS_BASE
{
static object lockerWebSubmit = new object();
/// <summary>
/// 处理WEB页面发送过来的请求m_Command + "|" + m_Value;
/// </summary>
/// <param name="OpName"></param>
/// <param name="Content"></param>
static public void WebSubmit(object e)
{
lock (lockerWebSubmit)
{
try
{
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
string OpName = Convert.ToString(msgEvent.OpName);
string Content = Convert.ToString(msgEvent.TagValue);
string[] dataArray = Content.Split('|');
if (dataArray.Length != 2)
return;
//消息类型
string m_Command = dataArray[0].ToString();
//消息参数
string m_Value = dataArray[1].ToString();
//消息参数数量
string[] m_Value_array = m_Value.Split('&');
//消息参数长度
int m_Value_length = m_Value_array.Length;
//工件信息
string engineID = "";
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
{
MIS_BASE.InitHashtable_MesServerCode();
}
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
{
engineID = MIS_BASE.hashtable_EngineGetOver_EngineID[OpName].ToString();
}
DoWhatPlc.CustomeEvetnArgs _e = new DoWhatPlc.CustomeEvetnArgs();
_e.OpName = OpName;
_e.TagValue = m_Value;
//根据请求的命令处理逻辑
switch (m_Command)
{
case "Barcode":
if (m_Value_length > 1) return;
fun_Barcode(_e);
break;
case "ConfirmOkGo"://合格放行
//删除不合格放行记录
//修改托盘状态
//Update_PalletStatus(OpName, 1, false);
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
MIS_BASE.Write_ConfirmOkGo(OpName, true);
MIS_BASE.Write_FalseGO(OpName, false);
break;
case "FalseGO"://返修放行
//修改托盘状态
//Update_PalletStatus(OpName, 3, false);
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
MIS_BASE.Write_FalseGO(OpName, true);
MIS_BASE.Write_ConfirmOkGo(OpName, false);
break;
case "NgGO"://不合格放行
//修改托盘状态
//Update_PalletStatus(OpName, 2, false);
//保存不合格信息(必须保存不合格放行信息由于B5A的Moby没有不合格标志位)
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Insert(OpName, engineID, "", "");
MIS_BASE.Write_FalseGO(OpName, true);
MIS_BASE.Write_ConfirmOkGo(OpName, false);
break;
case "OnLineState"://在线0、离线1、屏蔽2
try
{
if (m_Value_length > 1) return;
int a = Convert.ToInt32(m_Value);
if (a <= 2)
{
BaseDataSystemMES.IsOnLine_Update(OpName, m_Value.ToString());
MIS_BASE.Write_OnLineState(OpName, Convert.ToInt32(m_Value));
}
}
catch
{
}
break;
case "Reset"://复位将MES所有的信息都复位了
SetMoby(OpName);//将MES所有信号清空
break;
case "FixAllow"://重新拧紧
MIS_BASE.Write_FixAllow(OpName, false);
MIS_BASE.Write_FixAllow(OpName, true);
break;
case "IsAutoGetEngineID"://自动手动申请编号(线首)
if (m_Value_length > 1) return;
MIS_BASE.Write_IsAutoGetEngineID(OpName, Convert.ToInt32(m_Value));
break;
case "PartPalletGoOver"://空托盘放行
int Is_PartPalletGoOver;
MIS_BASE.Read_PartPalletGoOver(OpName, out Is_PartPalletGoOver);
if (Is_PartPalletGoOver == 1)
{
MIS_BASE.Write_PartPalletGoOver(OpName, 1);
}
else
{
MIS_BASE.Write_PartPalletGoOver(OpName, 0);
}
break;
case "SetMoby"://清空托盘(线首)
SetMoby(OpName);//将MES所有信号清空
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
break;
case "RepairUplineMES"://返修上线
MIS_BASE.Write_RepairUpline_MES(OpName, true);
break;
case "CancelRepair"://将返修件置为正常件
break;
case "PartPalletCode"://申请写入托盘号
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
break;
case "WritePartPalletCode"://写入托盘号
if (m_Value_length > 1) return;
MIS_BASE.Write_PalletCode(OpName, Convert.ToInt32(m_Value));
break;
case "Normal"://启用正常拧紧工位
MIS_BASE.Write_Normal(OpName, 1);
MIS_BASE.Write_UnNormal(OpName, 0);
break;
case "UnNormal"://启用备用拧紧工位
MIS_BASE.Write_Normal(OpName, 0);
MIS_BASE.Write_UnNormal(OpName, 1);
break;
case "ResetDevice"://复位设备
MIS_BASE.Write_ResetDevice(OpName, true);
System.Threading.Thread.Sleep(1000);
MIS_BASE.Write_ResetDevice(OpName, false);
break;
case "IsNeedRepaire"://返修上线(返修上线点)
if (Convert.ToInt32(m_Value) == 1)
{
//修改托盘状态
MIS_BASE.Write_PalletInfo(OpName, 3);
//通知修改成功
MIS_BASE.Write_UpdatePalletOK(OpName, true);
IsNeedRepaire_OK(OpName);
}
else if (Convert.ToInt32(m_Value) == 0)
{
//通知修改成功
MIS_BASE.Write_UpdatePalletOK(OpName, true);
//直接给出工作完成
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
}
else
{ }
break;
case "ContinueMatch":
BaseDataSystemMES.QualityVerifyStatus_Hash_Write(OpName, true);
break;
//初始化网页信号
case "IniSingalToWeb":
InitializeSingalToWeb(OpName);
break;
case "Reset_Engine"://返修上线(返修上线点)
SetMoby(OpName);//将MES所有信号清空
//fun_EngineTypeGetOverPLC(OpName, 0);
//fun_EngineTypeGetOverPLC(OpName, 1);
break;
default: break;
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:WebSubmit");
}
}
}
//1.工件到位后PLC给MES传递机型(DBX0.4)(44)
//MES判断条码是否全部扫描完成
//PLC给出允许保存(DBX100.2)(19)MES见到(DBX100.2)(19)为1后给出保存完成(DBX102.2)(20)
//PLC见到保存完成(DBX102.2)(20)为1后清空允许保存(DBX100.2)(19)
//MES见到允许保存(DBX100.2)(19)为0后清空保存完成(DBX102.2)(20)
//MES判断总合格标志(INT104)(21)为1后给出合格放行(DBX2.5)(51)
/// <summary>
/// 扫描条码
/// </summary>
/// <param name="OpName"></param>
/// <param name="barcode"></param>
static public void fun_Barcode(DoWhatPlc.CustomeEvetnArgs e)
{
ThreadPool.QueueUserWorkItem(Barcode, e);
}
static private void SetMoby(string OpName)
{
try
{
//清空Moby时需要将MES信号清空
MIS_BASE.Write_ClearMesMoby(OpName);
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
Sendmessage("5123", "1111", OpName);
MIS_BASE.Write_ResetDevice(OpName, true);
System.Threading.Thread.Sleep(1000);
MIS_BASE.Write_ResetDevice(OpName, false);
}
catch
{
}
}
/// 网页重现登录,恢复关闭前的页面状态
/// </summary>
/// <param name="Opname">工位号</param>
static private void InitializeSingalToWeb(string Opname)
{
//工件到位 DBX0.1
bool S_WorkStart;
bool S_FixAllow;
bool S_EngineGetOver;
bool S_MaterialVerifyOver;
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
if (S_WorkStart == true)
{
SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
}
if (S_EngineGetOver == true)
{
SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
Sendmessage("5123", "1111", Opname);
}
if (S_FixAllow == true)
{
SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
}
if (S_MaterialVerifyOver == true)
{
SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
}
}
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
////using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;
using System.Threading;
namespace MesServerWork
{
public partial class MIS_BASE
{
static object lockerWorkStart = new object();
/// <summary>
/// 工件到位与离开时清空MES自身信号
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
static private void WorkStart(object e)
{
lock (lockerWorkStart)
{
try
{
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
string OpName = Convert.ToString(msgEvent.OpName);
int tagValue = Convert.ToInt32(msgEvent.TagValue);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:WorkStart");
}
}
}
}
}

View File

@@ -0,0 +1,805 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
using MisDataFunDll;
//using MesWork;
namespace MesServerWork
{
public partial class MIS_BASE // : Form
{
/// <summary>
/// 全部数据列表
/// </summary>
public static DataTable BasicDataTagValue;
/// <summary>
/// MES_基本数据_测量范围
/// </summary>
public static DataTable BasicDataTagValueUpDown;
/// <summary>
/// 是否通过监控系统保存数据
/// 1:通过监控系统保存采集的质量数据;0:不通过监控系统保存采集的质量数据
/// </summary>
static public Hashtable hashtable_tagTable_OpName_SaveData;
/// <summary>
/// 变量代码与列位置
/// </summary>
static public Hashtable hashtable_tagTable_TagID_TagOrderBy;
/// <summary>
/// 变量代码与变量排序
/// </summary>
static public Hashtable hashtable_tagTable_TagID_TagItemOrderBy;
/// <summary>
/// 变量代码与变量特点
/// 0:没定义1工位合格标志2需要合格标志的测量数据3每个工位的合格标志4:物料5:IQA码6:压装数据7:压装合格标志8(自动拧紧)工位合格标志
/// </summary>
static public Hashtable hashtable_tagTable_TagID_TagProperty;
/// <summary>
/// 发动机类型转换表
/// SELECT ID,发动机机型代码 FROM MES_计划BOM_发动机型号代码
/// </summary>
public static Hashtable hashtable_EngineTypeID;
/// <summary>
/// 工位号与工位上下线类型
/// 0普通工位1正常上线2正常下线3返修上线4返修下线
/// 5分线上线 总线6分线上线 分线)
/// </summary>
public static Hashtable hashtableOpName_OpType;
/// <summary>
/// 工位号与大屏幕代码
/// 对应LED大屏幕1234
/// </summary>
public static Hashtable hashtableOpName_LedID;
/// <summary>
/// 大屏幕显示产量端口(41104)
/// </summary>
public static Hashtable hashtableOpName_LedID_Port;
/// <summary>
/// 大屏幕显示Andon大屏幕代码 1
/// </summary>
public static Hashtable hashtableOpName_AndonID;
/// <summary>
/// 大屏幕显示Andon端口 (41105)
/// </summary>
public static Hashtable hashtableOpName_AndonID_Port;
/// <summary>
/// 是否有打印机(0,1)
/// </summary>
public static Hashtable hashtableOpName_IsPrinter;
/// <summary>
/// 打印机通讯端口
/// </summary>
public static Hashtable hashtableOpName_IsPrinter_Port;
/// <summary>
/// 工位号与目标循环时间
/// </summary>
public static Hashtable hashtableOpName_TargetTime;
/// <summary>
/// 工位号与线体类型
/// </summary>
public static Hashtable hashtableOpName_LineType;
/// <summary>
/// 是否有工位计算机
/// </summary>
public static Hashtable hashtableOpName_IsHaveComputer;
/// <summary>
/// 变量名称
/// </summary>
public static Hashtable hashtableTagID_TagName;
/// <summary>
/// 工位号
/// </summary>
public static Hashtable hashtableTagID_OpName;
/// <summary>
/// 数据来源
/// </summary>
public static Hashtable hashtableTagID_OpNameFrom;
/// <summary>
/// 工位名称
/// </summary>
static Hashtable hashtableTagID_OpName_Name;
/// <summary>
/// 测量位置
/// </summary>
public static Hashtable hashtableTagID_ShaftID;
/// <summary>
/// 测量项目
/// </summary>
public static Hashtable hashtableTagID_ItemVale;
/// <summary>
/// 变量代码与变量类型
/// </summary>
public static Hashtable hashtable_tagTable_TagID_TagTypeID_All;
/// <summary>
///工位号与机床状态
/// [测量数据机床状态]
/// </summary>
public static Hashtable m_MachineStatus_OpName;
/// <summary>
///工位号与工件离开 1->0 =0 无工件或工件离开
///工位号与工件到位 0->1 =1 有工件或工件到达
///[测量数据发动机在线状态]
/// </summary>
public static Hashtable m_WorkStart_OpName;
/// <summary>
///工位号与工件到位时间
///工位号与工件到位 0->1
///[测量数据发动机在线状态]
/// </summary>
public static Hashtable m_WorkStart_OpName_Time;
/// <summary>
///工位号与工件到位时间
///工位号与工件到位 0->1零件运动方向
/// </summary>
public static Hashtable m_WorkStart_OpName_PartMoveDirection;
/// <summary>
///工位号与发动机号
/// </summary>
public static Hashtable m_EngineTrace_OpName;
/// <summary>
///工位号与发动机号_时间
/// </summary>
public static Hashtable m_EngineTrace_OpName_Time;
/// <summary>
///工位号与合格标志
///[测量数据发动机在线状态]
/// </summary>
public static Hashtable m_QualityMask_OpName;
/// <summary>
///工位号与机型
///[测量数据发动机在线状态]
/// </summary>
public static Hashtable m_EngineNumberType_OpName;
/// <summary>
///工位号与发动机号
///[测量数据发动机在线状态]
/// </summary>
public static Hashtable m_EngineNumber_OpName;
/// <summary>
///工位号与订单号
///[测量数据发动机在线状态]
/// </summary>
public static Hashtable m_OrderForm_OpName;
/// <summary>
///工位号与操作者工号
///[测量数据发动机在线状态]
/// </summary>
public static Hashtable m_OperatorCode_OpName;
/// <summary>
/// 测量合格标志
/// 全部测量数据的测量工位
/// 全部测量数据的测量工位的数据来源
/// 全部测量数据的测量工位的数据来源的测量变量
/// </summary>
public static Hashtable hashtable_QualityData_GoodBad_MIS_OpName;
/// <summary>
/// 列位置
/// </summary>
public static Hashtable hashtable_QualityData_GoodBad_Index;
/// <summary>
/// MesServerCode
/// </summary>
public static Hashtable hashtable_MesServerCode;
/// <summary>
/// MesDll
/// </summary>
public static Hashtable hashtable_MesDll;
/// <summary>
/// 各个工位是否允许工作
/// </summary>
public static Hashtable hashtable_IsAllowWork;
/// <summary>
/// 返修工位是否需要强制合格放行
/// //20141104 ljl
/// </summary>
public static Hashtable hashtable_IsConfirmOkGo;
/// <summary>
/// 工步属性哈西表
/// </summary>
public static Hashtable hashtable_workStepProperty;
/// <summary>
/// 工作顺序哈西表
/// </summary>
public static Hashtable hashtable_WorkGroupIndex;
/// <summary>
/// 返修工位哈西表
/// </summary>
public static Hashtable hashtable_OpNameRepair;
/// <summary>
/// 记录工件到位的发动机机型代码
/// </summary>
public static Hashtable hashtable_EngineGetOver_EngineTypeID;
/// <summary>
/// 记录工件到位的发动机机型
/// </summary>
public static Hashtable hashtable_EngineGetOver_EngineType;
/// <summary>
/// 记录工件到位的发动机号
/// </summary>
public static Hashtable hashtable_EngineGetOver_EngineID;
/// <summary>
/// 记录工件到位的订单号
/// </summary>
public static Hashtable hashtable_EngineGetOver_OrderForm;
/// <summary>
/// 拧紧/压装过程中的合格标志
/// </summary>
public static Hashtable hashtable_QualityMesRead;
/// <summary>
/// 物料检测哈希表
/// </summary>
public static Hashtable hashtable_CheckMaterial;
/// <summary>
/// 托盘状态哈希表
/// </summary>
public static Hashtable hashtable_PalletInfo;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位机床上电开始时间
///机床上电产生 0->1
///机床上电解除 1->0
/// </summary>
public static Hashtable m_MachineStatusPutOn_OpName_Time;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位循环开始 开始时间
///循环开始产生 0->1
///循环开始解除 1->0
/// </summary>
public static Hashtable m_MachineStatusWorkOn_OpName_Time;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位机床故障开始时间
///机床故障产生 0->1
///机床故障解除 1->0
/// </summary>
public static Hashtable m_MachineStatusAlarm_OpName_Time;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位上料无件开始时间
///上料无件产生 0->1
///上料无件解除 1->0
/// </summary>
public static Hashtable m_MachineStatusNoPart_OpName_Time;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位下料堵塞开始时间
///下料堵塞产生 0->1
///下料堵塞解除 1->0
/// </summary>
public static Hashtable m_MachineStatusBlock_OpName_Time;
/// <summary>
///工位号与托盘离开 1->0
///工位号与托盘到位 0->1
///[测量数据_监控系统_托盘到位]
/// </summary>
public static Hashtable m_PartPalletStatus_OpName;
/// <summary>
///工位号与托盘离开 1->0
///工位号与托盘到位 0->1
///[测量数据_监控系统_托盘到位]
/// </summary>
public static Hashtable m_PartPalletStatus_OpName_Time;
/// <summary>
/// 托盘到位(1)托盘离开(0) (DBX101.7)(13)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位机床上电开始时间
///机床上电产生 0->1
///机床上电解除 1->0
/// </summary>
public static Hashtable m_MachineStatusPutOn_OpName;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位循环开始 开始时间
///循环开始产生 0->1
///循环开始解除 1->0
/// </summary>
public static Hashtable m_MachineStatusWorkOn_OpName;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位机床故障开始时间
///机床故障产生 0->1
///机床故障解除 1->0
/// </summary>
public static Hashtable m_MachineStatusAlarm_OpName;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位上料无件开始时间
///上料无件产生 0->1
///上料无件解除 1->0
/// </summary>
public static Hashtable m_MachineStatusNoPart_OpName;
/// <summary>
///[测量数据机床状态_分拆统计]
///各个工位下料堵塞开始时间
///下料堵塞产生 0->1
///下料堵塞解除 1->0
/// </summary>
public static Hashtable m_MachineStatusBlock_OpName;
public static NameValueCollection hashtable_TagTypeDataType ;
public static NameValueCollection hashtable_TagType;
/// <summary>
/// 托盘代码(DBB86)(80)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <summary>
/// 创建MesServerCode哈西表
/// </summary>
static public void InitHashtable_MesServerCode()
{
hashtable_MesServerCode = new Hashtable();
hashtable_IsAllowWork = new Hashtable();
hashtable_WorkGroupIndex = new Hashtable();
hashtable_EngineGetOver_EngineTypeID = new Hashtable();
hashtable_EngineGetOver_EngineType = new Hashtable();
hashtable_EngineGetOver_EngineID = new Hashtable();
hashtable_EngineGetOver_OrderForm = new Hashtable();
hashtable_QualityMesRead = new Hashtable();
hashtable_CheckMaterial = new Hashtable();
hashtable_PalletInfo = new Hashtable();
hashtable_IsConfirmOkGo = new Hashtable();
hashtable_MesDll = new Hashtable();
string OpName;
string MesServerCode;
string MesDll;
string workStepProperty;
string OpNameRepair;
DataTable dt;
dt = MisDataFun.GetMesServerCodeFromMIS();
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
OpName = dt.Rows[i]["工位号"].ToString();
MesServerCode = dt.Rows[i]["MesServerCode"].ToString();
MesDll = dt.Rows[i]["MesDll"].ToString();
hashtable_MesDll.Add(OpName, MesDll);
hashtable_MesServerCode.Add(OpName, MesServerCode);
hashtable_IsAllowWork.Add(OpName, 1);
hashtable_IsConfirmOkGo.Add(OpName, 0);//20141104 ljl
hashtable_PalletInfo.Add(OpName, 0);//20141104 ljl
hashtable_WorkGroupIndex.Add(OpName, 1);
hashtable_EngineGetOver_EngineTypeID.Add(OpName, 0);
hashtable_EngineGetOver_EngineType.Add(OpName, "");
hashtable_EngineGetOver_EngineID.Add(OpName, "");
hashtable_EngineGetOver_OrderForm.Add(OpName, "");
hashtable_QualityMesRead.Add(OpName, 0);
hashtable_CheckMaterial.Add(OpName, new bool[16]);
}
}
HashtableList.hashtable_MesServerCode_Temp = hashtable_MesServerCode;
HashtableList.hashtable_MesDll_Temp = hashtable_MesDll;
HashtableList.hashtable_EngineGetOver_EngineID_Temp = hashtable_EngineGetOver_EngineID;
HashtableList.hashtable_EngineGetOver_EngineTypeID_Temp = hashtable_EngineGetOver_EngineTypeID;
HashtableList.hashtable_EngineGetOver_EngineType_Temp = hashtable_EngineGetOver_EngineType;
HashtableList.hashtable_EngineGetOver_OrderForm_Temp = hashtable_EngineGetOver_OrderForm;
//初始化工步属性
hashtable_workStepProperty = new Hashtable();
dt = MisDataFun.GetworkStepPropertyFromMIS();
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
OpName = dt.Rows[i]["工位号"].ToString();
workStepProperty = dt.Rows[i]["工步属性"].ToString();
hashtable_workStepProperty.Add(OpName, workStepProperty);
}
}
//返修工位
hashtable_OpNameRepair = new Hashtable();
dt = MisDataFun.GetOpNameRepairFromMIS();
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
OpName = dt.Rows[i]["工位号"].ToString();
OpNameRepair = dt.Rows[i]["返修工位号"].ToString();
hashtable_OpNameRepair.Add(OpName, OpNameRepair);
}
}
HashtableList.hashtable_OpNameRepair_Temp = hashtable_OpNameRepair;
HashtableList.hashtable_workStepProperty_Temp = hashtable_workStepProperty;
HashtableList.hashtable_QualityMesRead_Temp = hashtable_QualityMesRead;
HashtableList.hashtable_IsAllowWork_Temp = hashtable_IsAllowWork;
HashtableList.hashtable_WorkGroupIndex_Temp = hashtable_WorkGroupIndex;
}
/// <summary>
/// 创建合格标志哈西表
/// </summary>
private static void InitHashtable_QualityData_GoodBad()
{
//列位置
string index;
//
int tagID;
DataTable dt ;
dt = MisDataFun.BaseData_tagTable_All_B5A();
hashtable_QualityData_GoodBad_Index = new Hashtable();
for (int i = 0; i < dt.Rows.Count; i++)
{
tagID = Convert.ToInt32(dt.Rows[i]["TagID"]);
index = (dt.Rows[i]["列位置"]).ToString();
hashtable_QualityData_GoodBad_Index.Add(tagID, index);
}
hashtable_EngineTypeID = new Hashtable();
dt = MisDataFun.BaseData_tagTable_QualityData_EngineTypeID();
for (int i = 0; i < dt.Rows.Count; i++)
{
tagID = Convert.ToInt32(dt.Rows[i]["发动机机型代码"]);
index = (dt.Rows[i]["ID"]).ToString();
hashtable_EngineTypeID.Add(tagID, index);
}
//工位号
DataTable dt_OpName;
//工位号数据来源
DataTable dt_OpNameFrom;
//数据来源对应的TagID
DataTable dt_OpNameTagID;
string opName;
string opNameFrom;
hashtable_QualityData_GoodBad_MIS_OpName = new Hashtable();
// 测量合格标志
// 全部测量数据的测量工位的数据来源
Hashtable hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom;
// 测量合格标志
// 全部测量数据的测量工位的数据来源的测量变量
Hashtable hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom_TagID;
dt_OpName = MisDataFun.BaseData_tagTable_QualityData_GoodBad_MIS_OpName_B5A();
if (dt_OpName != null)
{
//有不合格标志的测量工位
for (int i = 0; i < dt_OpName.Rows.Count; i++)
{
//有不合格标志的测量工位 对应的 数据来源工位号
hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom = new Hashtable();
opName = dt_OpName.Rows[i]["工位号"].ToString();
dt_OpNameFrom = MisDataFun.BaseData_tagTable_QualityData_GoodBad_MIS_OpName(opName);
if (dt_OpNameFrom != null)
{
for (int j = 0; j < dt_OpNameFrom.Rows.Count; j++)
{
opNameFrom = dt_OpNameFrom.Rows[j]["数据来源"].ToString();
dt_OpNameTagID = MisDataFun.BaseData_tagTable_QualityData_GoodBad_MIS_OpName(opName, opNameFrom);
//
hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom_TagID = new Hashtable();
if (dt_OpNameTagID != null)
{
for (int k = 0; k < dt_OpNameTagID.Rows.Count; k++)
{
tagID = Convert.ToInt32(dt_OpNameTagID.Rows[k]["TagID"]);
hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom_TagID.Add(tagID, tagID);
}
}
tagID = Convert.ToInt32(dt_OpNameFrom.Rows[j]["TagID"]);
//全部测量数据的测量工位的数据来源的测量变量
hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom.Add(tagID, hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom_TagID);
}
}
hashtable_QualityData_GoodBad_MIS_OpName.Add(opName, hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom);
}
}
}
public static NameValueCollection hashtable_TagTypeID_OpName_ToTagID;
/// <summary>
/// 变量代码与其他字段的对应关系
/// </summary>
public static void InitHashtableTagID()
{
//变量代码
string tagID;
//变量名称
string tagName;
//工位号
string opNmae;
//测量位置
string shaftID;
//测量项目
string itemVale;
//变量排序
int tagItemOrderBy;
//变量特点
// 0:没定义1工位合格标志2需要合格标志的测量数据3每个工位的合格标志4:物料5:IQA码6:压装数据7:压装合格标志8(自动拧紧)工位合格标志
int tagProperty;
//列位置
int tagOrderBy;
InitHashtable_QualityData_GoodBad();
//MesServerCode哈希表创建
InitHashtable_MesServerCode();
//列位置
hashtable_tagTable_TagID_TagOrderBy = new Hashtable();
// 变量代码与变量排序
hashtable_tagTable_TagID_TagItemOrderBy = new Hashtable();
// 变量代码与变量特点
// 0:没定义1工位合格标志2需要合格标志的测量数据3每个工位的合格标志4:物料5:IQA码6:压装数据7:压装合格标志8(自动拧紧)工位合格标志
hashtable_tagTable_TagID_TagProperty = new Hashtable();
hashtable_tagTable_OpName_SaveData = new Hashtable();
//工位号与机床状态
//[测量数据发动机在线状态]
m_MachineStatus_OpName = new Hashtable();
////工位号与工件离开 0
////工位号与工件到位 1
////[测量数据发动机在线状态]
//m_WorkStart_OpName = new Hashtable();
////工位号与工件到位时间
////工位号与工件到位 0->1
////[测量数据发动机在线状态]
//m_WorkStart_OpName_Time = new Hashtable();
//工位号与发动机号
//[测量数据发动机在线状态]
m_EngineTrace_OpName = new Hashtable();
m_EngineTrace_OpName_Time = new Hashtable();
//工位号与合格标志
//[测量数据发动机在线状态]
m_QualityMask_OpName = new Hashtable();
//工位号与目标循环时间
hashtableOpName_TargetTime = new Hashtable();
//工位号与线体类型
hashtableOpName_LineType = new Hashtable();
//是否有工位计算机
hashtableOpName_IsHaveComputer = new Hashtable();
//工位号与机型
//[测量数据发动机在线状态]
m_EngineNumberType_OpName = new Hashtable();
//工位号与发动机号
//[测量数据发动机在线状态]
m_EngineNumber_OpName = new Hashtable();
//工位号与订单号
//[测量数据发动机在线状态]
m_OrderForm_OpName = new Hashtable();
//工位号与操作者工号
//[测量数据发动机在线状态]
m_OperatorCode_OpName = new Hashtable();
// <summary>
// 变量名称
// </summary>
hashtableTagID_TagName = new Hashtable();
// <summary>
// 工位号
// </summary>
hashtableTagID_OpName = new Hashtable();
// <summary>
// 数据来源
// </summary>
hashtableTagID_OpNameFrom = new Hashtable();
// <summary>
// 工位名称
// </summary>
hashtableTagID_OpName_Name = new Hashtable();
// <summary>
// 测量位置
// </summary>
hashtableTagID_ShaftID = new Hashtable();
// <summary>
// 测量项目
// </summary>
hashtableTagID_ItemVale = new Hashtable();
hashtable_tagTable_TagID_TagTypeID_All = new Hashtable();
// 工位号与工位上下线类型
// 0普通工位1正常上线2正常下线3返修上线4返修下线
// (5 分线上线 总线) 6 分线上线 总线)
hashtableOpName_OpType = new Hashtable();
// 工位号与大屏幕代码
// 对应LED大屏幕1234
hashtableOpName_LedID = new Hashtable();
// 大屏幕显示产量端口(41104)
hashtableOpName_LedID_Port = new Hashtable();
// 大屏幕显示Andon大屏幕代码 1
hashtableOpName_AndonID = new Hashtable();
// 大屏幕显示Andon端口 (41105)
hashtableOpName_AndonID_Port = new Hashtable();
// 是否有打印机(0,1)
hashtableOpName_IsPrinter = new Hashtable();
// 打印机通讯端口 (缸盖打印机 41101 (发动机上线打印机 41102 (发动机下线打印机 41103
hashtableOpName_IsPrinter_Port = new Hashtable();
m_WorkStart_OpName_Time = new Hashtable();
m_WorkStart_OpName = new Hashtable();
m_MachineStatusPutOn_OpName_Time = new Hashtable();
m_MachineStatusPutOn_OpName = new Hashtable();
m_MachineStatusWorkOn_OpName_Time = new Hashtable();
m_MachineStatusWorkOn_OpName = new Hashtable();
m_MachineStatusAlarm_OpName_Time = new Hashtable();
m_MachineStatusAlarm_OpName = new Hashtable();
m_MachineStatusNoPart_OpName_Time = new Hashtable();
m_MachineStatusNoPart_OpName = new Hashtable();
m_MachineStatusBlock_OpName_Time = new Hashtable();
m_MachineStatusBlock_OpName = new Hashtable();
m_WorkStart_OpName_PartMoveDirection = new Hashtable();
m_PartPalletStatus_OpName_Time = new Hashtable();
m_PartPalletStatus_OpName = new Hashtable();
hashtable_TagTypeID_OpName_ToTagID = new NameValueCollection();
DataTable dt;
DateTime dateTime;
dateTime = DateTime.Now;
dt = MisDataFun.BaseData_tagTable_All();
//变量类型代码
int TagTypeID;
for (int i = 0; i < dt.Rows.Count; i++)
{
tagID = dt.Rows[i]["TagID"].ToString ();
tagName = Convert.ToString(dt.Rows[i]["TagName"]);
opNmae = Convert.ToString(dt.Rows[i]["工位号"]);
shaftID = Convert.ToString(dt.Rows[i]["测量位置"]);
itemVale = Convert.ToString(dt.Rows[i]["测量项目"]);
TagTypeID = Convert.ToInt32(dt.Rows[i]["变量类型代码"]);
tagItemOrderBy = Convert.ToInt32(dt.Rows[i]["变量排序"]);
tagProperty = Convert.ToInt32(dt.Rows[i]["变量特点"]);
tagOrderBy = Convert.ToInt32(dt.Rows[i]["列位置"]);
hashtableTagID_TagName.Add(tagID, tagName);
hashtableTagID_OpName.Add(tagID, opNmae);
hashtableTagID_ShaftID.Add(tagID, shaftID);
hashtableTagID_ItemVale.Add(tagID, itemVale);//列位置
hashtable_tagTable_TagID_TagTypeID_All.Add(tagID, TagTypeID);
hashtable_tagTable_TagID_TagItemOrderBy.Add(tagID, tagItemOrderBy);
hashtable_tagTable_TagID_TagProperty.Add(tagID, tagProperty);
hashtable_tagTable_TagID_TagOrderBy.Add(tagID, tagOrderBy);
}
dt = MisDataFun.BaseData_tagTable_OpName();
for (int i = 0; i < dt.Rows.Count; i++)
{
//是否通过监控系统保存数据
// 1:通过监控系统保存采集的质量数据;0:不通过监控系统保存采集的质量数据
hashtable_tagTable_OpName_SaveData.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["是否通过监控系统保存数据"]));
hashtableOpName_TargetTime.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToString(dt.Rows[i]["目标循环时间"]));
hashtableOpName_LineType.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToString(dt.Rows[i]["线体类型"]));
hashtableOpName_IsHaveComputer.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToString(dt.Rows[i]["是否有工位计算机"]));
//用于LED显示
// [MES_计划BOM_工位与名称]
// 工位上下线类型
//0普通工位1正常上线2正常下线3返修上线4返修下线
hashtableOpName_OpType.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["工位上下线类型"]));
hashtableOpName_LedID.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["大屏幕代码"]));
m_WorkStart_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
m_WorkStart_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
m_MachineStatusPutOn_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
m_MachineStatusPutOn_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
m_MachineStatusWorkOn_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
m_MachineStatusWorkOn_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
m_MachineStatusAlarm_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
m_MachineStatusAlarm_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
m_MachineStatusNoPart_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
m_MachineStatusNoPart_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
m_MachineStatusBlock_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
m_MachineStatusBlock_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
m_WorkStart_OpName_PartMoveDirection.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
m_PartPalletStatus_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
m_PartPalletStatus_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
try
{
hashtableOpName_LedID_Port.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["大屏幕显示产量端口"]));
}
catch { }
try
{
hashtableOpName_AndonID.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["大屏幕显示Andon大屏幕代码"]));
}
catch { }
try
{
hashtableOpName_AndonID_Port.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["大屏幕显示Andon端口"]));
}
catch { }
try { hashtableOpName_IsPrinter.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["是否有打印机"])); }
catch { }
try
{
hashtableOpName_IsPrinter_Port.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["打印机通讯端口"]));
}
catch { }
}
//20170310 CLB新加
dt = MisDataFun.BaseData_tagTable_OpcServerMES_ALL_CF();
for (int i = 0; i < dt.Rows.Count; i++)
{
try
{
hashtable_TagTypeID_OpName_ToTagID.Add(Convert.ToString(dt.Rows[i]["工位号"]) + "_" + Convert.ToString(dt.Rows[i]["变量类型代码"]), Convert.ToString(dt.Rows[i]["TagID"]));
//hashtable_TagTypeID_OpName_ToTagID;
}
catch(Exception err)
{
}
}
}
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Data;
using System.Collections;
using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
using MisDataFunDll;
//using MesWork;
namespace MesServerWork
{
public partial class MIS_BASE // : Form
{
public class HashtableList
{
/// <summary>
/// MesServerCode
/// </summary>
static public Hashtable hashtable_MesServerCode_Temp;
/// <summary>
/// MesDll
/// </summary>
static public Hashtable hashtable_MesDll_Temp;
static public NameValueCollection hashtable_TagTypeDataType_Temp;
static public NameValueCollection hashtable_TagType_Temp;
static public Hashtable hashtable_TagTypeTagName_Temp;
static public Hashtable hashtable_EngineGetOver_EngineTypeID_Temp;
static public Hashtable hashtable_EngineGetOver_EngineType_Temp;
static public Hashtable hashtable_EngineGetOver_EngineID_Temp;
static public Hashtable hashtable_EngineGetOver_OrderForm_Temp;
static public Hashtable hashtable_OpNameRepair_Temp;
static public Hashtable hashtable_WorkGroupIndex_Temp;
static public Hashtable hashtable_workStepProperty_Temp;
static public Hashtable hashtable_QualityMesRead_Temp;
static public Hashtable hashtable_IsAllowWork_Temp;
/// <summary>
/// 工位号与工位上下线类型
/// 0普通工位1正常上线2正常下线3返修上线4返修下线
/// 5 分线上线(总线) 6 分线上线(分线)
/// </summary>
static public Hashtable hashtableOpName_OpType_Temp;
static public Hashtable hashtable_tagTable_OpName_SaveData_Temp;
public Hashtable hashtable_tagTable_OpName_SaveData;
/// <summary>
/// <summary>
/// 工位号与工位上下线类型
/// 0普通工位1正常上线2正常下线3返修上线4返修下线
/// 5 分线上线(总线) 6 分线上线(分线)
/// </summary>
public Hashtable hashtableOpName_OpType;
public Hashtable hashtable_IsAllowWork;
public Hashtable hashtable_QualityMesRead;
public Hashtable hashtable_workStepProperty;
public Hashtable hashtable_OpNameRepair;
/// <summary>
/// MesServerCode
/// </summary>
public Hashtable hashtable_MesServerCode;
public Hashtable hashtable_TagTypeTagName;
/// <summary>
/// MesDll
/// </summary>
public Hashtable hashtable_MesDll;
public NameValueCollection hashtable_TagTypeDataType;
public NameValueCollection hashtable_TagType;
public Hashtable hashtable_EngineGetOver_EngineTypeID;
public Hashtable hashtable_EngineGetOver_EngineType;
public Hashtable hashtable_EngineGetOver_EngineID;
public Hashtable hashtable_EngineGetOver_OrderForm;
public Hashtable hashtable_WorkGroupIndex;
public DataTable BasicDataTagValue;
public DataTable BasicDataTagValueUpDown;
public Hashtable hashtable_EngineTypeID;
}
}
}

View File

@@ -0,0 +1,98 @@
using System;
using System.Data;
using System.Windows.Forms;
//using bizFacade;
//using DataLinkMesWork;
//using SystemFramework;
namespace MesServerWork
{
public partial class MIS_BASE
{
/// <summary>
/// 设备保养计划
/// </summary>
/// <param name="OpName"></param>
/// <param name="MachineType"></param>
/// <param name="PlanID"></param>
public delegate void MachinePlan_Invoke(string OpName, string MachineType, string PlanID);
/// <summary>
/// 设备保养计划
/// </summary>
public MachinePlan_Invoke machinePlan_Invoke;
/// <summary>
/// 设备保养
/// </summary>
/// <param name="OpName"></param>
/// <param name="MachineType">设备保养类型</param>
/// <param name="PlanID">工作日历流水号</param>
public void MachinePlan(string OpName, string MachineType, string PlanID)
{
try
{
string SendMessage;
SendMessage = "MES|MachinePlan|" + OpName + "|" + MachineType + "&" + PlanID;
asyncSendMessage(SendMessage);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "MachinePlan");
}
}
/// <summary>
/// 设备保养计划Timer
/// </summary>
private Timer timer_Machine;
/// <summary>
/// 初始化设备保养计划
/// </summary>
public void InitMachinePlan(MachinePlan_Invoke machinePlan_Invoke)
{
this.machinePlan_Invoke = machinePlan_Invoke;
timer_Machine = new Timer();
timer_Machine.Interval = 60000;//每隔一分钟查询一次
timer_Machine.Tick += new EventHandler(timer_Machine_Tick);
timer_Machine.Start();
}
/// <summary>
/// 分钟调度
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timer_Machine_Tick(object sender, EventArgs e)
{
try
{
//if (ApplicationConfig.Is_MachinePlan == 1)
//{
// DataTable dt;
// string opName;
// string machineType;//保养类型代码
// string planID;//工作日历流水号
// BaseDataSystemMES.MachinePlan_Select(out dt);
// if (dt != null)
// {
// if (dt.Rows.Count > 0)
// {
// for (int i = 0; i < dt.Rows.Count; i++)
// {
// opName = dt.Rows[i]["工位号"].ToString();
// machineType = dt.Rows[i]["保养类型代码"].ToString();
// planID = dt.Rows[i]["工作日历流水号"].ToString();
// BaseDataSystemMES.Rolling_news_Add(opName, opName + "工位有设备保养计划,请相关人员进行保养!!!");
// BeginInvoke(machinePlan_Invoke, new object[] { opName, machineType, planID });
// }
// }
// }
//}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "timer_Machine_Tick");
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,574 @@
using System;
//using SystemFramework;
namespace MesServerWork
{
public partial class MIS_BASE
{
//static public void WritePLC(int tagType, string opName, object tagValue)
//{
// Write_TagTypeID(tagType, opName, tagValue);
//}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
public delegate void DemoHandler(object sender, DeviceDriver_BasicData.CustomeEvetnArgs e);
/// <summary>
///
/// </summary>
public static event DemoHandler OPCTagDataDemo;
/// <summary>
/// 根据tagType,工位号写入PLC对应值
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
static private void Write_TagValueByTagTypeName(string cmd, string opName,object tagValue)
{
int tagTypeID = 0;
string msg;
try
{
tagTypeID = Convert.ToInt32(MIS_BASE.hashtable_TagType[cmd]);
MIS_BASE.WriteTagValue(tagTypeID, opName, tagValue);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Write_TagValueByTagTypeName_FUNC");
}
}
/// <summary>
/// 根据TagTypeID,工位号写入PLC对应值
/// </summary>
/// <param name="TagTypeID"></param>
/// <param name="tagValue"></param>
static public void Write_TagValueByTagTypeID(int tagTypeID, string opName, object tagValue)
{
string msg;
object tagValueOb;
object newTagValue= tagValue;
try
{
MIS_BASE.WriteTagValue(tagTypeID, opName, tagValue);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Write_TagValueByTagTypeID_FUNC");
}
}
/// <summary>
/// 通过TagID写入PLC数据
/// </summary>
/// <param name="TagID"></param>
/// <param name="tagValue"></param>
public static void Write_TagID(string TagID, object tagValue)
{
try
{
MIS_BASE.WritePLC(TagID, tagValue);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Write_TagValueByTagID_FUNC");
}
}
/// <summary>
/// 清空MES信号 MES传递机型(5) 允许工作(66) 合格放行(51) 不合格放行(8) 拧紧结束(67) 工作完成(7) 保存完成(20) 加工时间保存完成(54) 匹配完成(68) 默认false
/// </summary>
/// <param name="opName"></param>
/// <param name="false"></param>
public static void Write_ClearMesMoby(string opName)
{
MIS_BASE.Write_EngineTypeGetOver_MES(opName, false);
MIS_BASE.Write_FixAllow(opName, false);
MIS_BASE.Write_ConfirmOkGo(opName, false);
MIS_BASE.Write_FalseGO(opName, false);
MIS_BASE.Write_FixOver(opName, false);
MIS_BASE.Write_MesWorkFinish(opName, false);
MIS_BASE.Write_MesReadOver(opName, false);
MIS_BASE.Write_MachineTime_ReadOver(opName, false);
MIS_BASE.Write_MatchingCompleted(opName, false);
}
/// <summary>
/// 订单号(string)(25)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_OrderForm(string opName, string tagValue)
{
string cmd = "OrderForm";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 总成编号(string)(26)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_AssemblyCode(string opName, string tagValue)
{
string cmd = "AssemblyCode";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 配方号1(dint)(27)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_Recipe1(string opName, int tagValue)
{
string cmd = "Recipe1";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 配方号2(dint)(28)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_Recipe2(string opName, int tagValue)
{
tagValue = 0;
string cmd = "Recipe2";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 总成编号(string)(62)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_AssemblyCode_MES(string opName, string tagValue)
{
string cmd = "AssemblyCode_MES";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 配方号1(dint)(63)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_Recipe1_MES(string opName, int tagValue)
{
string cmd = "Recipe1_MES";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 配方号2(dint)(64)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_Recipe2_MES(string opName, int tagValue)
{
string cmd = "Recipe2_MES";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 各个工位返修状态(4)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_RepairPathString(string opName, string tagValue)
{
string cmd = "RepairPathString";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 加工时间保存完数据 DBX102.1 (54)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_MachineTime_ReadOver(string opName, bool tagValue)
{
int tagTypeID = 54;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 工位三种状态在线、离线、屏蔽012(DBB116)(79)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_OnLineState(string opName, int tagValue)
{
string cmd = "OnLineState";
Write_TagValueByTagTypeName(cmd, opName,Convert .ToInt16 ( tagValue));
}
/// <summary>
/// 托盘编号PLC)(80)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_PalletCode(string opName, int tagValue)
{
string cmd = "PartPalletCode";
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
}
/// <summary>
/// MES向PLC传递机型(5)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_EngineTypeGetOver_MES(string opName, bool tagValue)
{
int tagTypeID = 5;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// PLC向MES传递机型(44)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_EngineTypeGetOver_PLC(string opName, bool tagValue)
{
string cmd = "EngineTypeGetOverPLC";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// PLC向MES质量数据可以读 允许保存(19) DBX587.0
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_MesRead_PLC(string opName, bool tagValue)
{
string cmd = "MesRead";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 工件到位
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_WorkStart(string opName, bool tagValue)
{
string cmd = "WorkStart";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
/// 拧紧结束确认(67)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_FixOver(string opName, bool tagValue)
{
int tagTypeID = 67;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
///返修上线,在上线工位MES依据工件情况设定为返修件PLC见到MES设定为1后将返修标志写入到DBX0.2为1
///MES设定完返修返修上线后MES清空该信号
///DBX3.7(72)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_RepairUpline_MES(string opName, bool tagValue)
{
int tagTypeID = 72;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 匹配完成(68)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_MatchingCompleted(string opName, bool tagValue)
{
int tagTypeID = 68;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 匹配结果(69)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_Match(string opName, bool tagValue)
{
int tagTypeID = 69;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 空托盘放行(DBX2.2)(6)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_PartPalletGoOver(string opName, int tagValue)
{
int tagTypeID = 6;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 自动手动申请工件编号,0是自动方式1手动方式。切换时(DBX2.1)(71)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_IsAutoGetEngineID(string opName, int tagValue)
{
string cmd = "IsAutoGetEngineID";
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
}
/// <summary>
/// 正常拧紧时选择(DBX100.3)(81)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_Normal(string opName, int tagValue)
{
string cmd = "Normal";
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
}
/// <summary>
/// 备用拧紧时选择(DBX100.4)(82)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_UnNormal(string opName, int tagValue)
{
string cmd = "UnNormal";
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
}
/// <summary>
/// 变量类型代码=52复位设备MESDBX0.6
/// 通知PLC复位设备
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_ResetDevice(string opName, bool tagValue)
{
string cmd = "PartLoadFinish";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
/// <summary>
///托盘状态(22)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_PalletInfo(string opName, int tagValue)
{
string cmd = "PalletInfo";
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
}
/// <summary>
/// 返修标志(93)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_RepairStatusMES(string opName, int tagValue)
{
string cmd = "RepairStatusMES";
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
}
/// <summary>
/// MES通知PLC修改托盘状态成功
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_UpdatePalletOK(string opName, bool tagValue)
{
string cmd = "UpdatePalletOK";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
#region MES交互区写值
/// <summary>
/// 工作完成(7)MES
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_MesWorkFinish(string opName, bool tagValue)
{
int tagTypeID = 7;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 合格方式放行(51)MES
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_ConfirmOkGo(string opName, bool tagValue)
{
int tagTypeID = 51;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 允许拧紧(66)MES
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_FixAllow(string opName, bool tagValue)
{
int tagTypeID = 66;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 不合格放行(8)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_FalseGO(string opName, bool tagValue)
{
int tagTypeID = 8;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 拧紧序号(77)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_ProcessCode(string opName, int tagValue)
{
int tagTypeID = 77;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 套筒号(88)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_BoltCode(string opName, int tagValue)
{
int tagTypeID = 88;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// MES保存完数据(必须MIS)(X102.2)(20)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_MesReadOver(string opName, bool tagValue)
{
int tagTypeID = 20;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 工作完成(7)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_MaterialVerifyOver(string opName, bool tagValue)
{
string cmd = "MaterialVerifyOver";
Write_TagValueByTagTypeName(cmd, opName, tagValue);
}
public static void Write_TagTypeID(int tagTypeID, string opName, object tagValue)
{
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 变量类型代码=73机型代码。DBB404~405 机型标志
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_EngineTypeID_MES(string opName, int tagValue)
{
int tagTypeID = 73;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
public static void Write_OpNameIsOk(string opName,int qualityMask)
{
// -99 是复位
if (qualityMask == -99)
{
Write_TagValueByTagTypeID(51, opName, false);
Write_TagValueByTagTypeID(8, opName, false);
}
else if(qualityMask == 1)
{
// 51 合格放行
Write_TagValueByTagTypeID(51, opName, true);
}
else
{
// 8 不合格放行
Write_TagValueByTagTypeID(8, opName, true);
}
}
/// <summary>
/// 变量类型代码=74零件编号。DBB406~445 发动机编号
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_EngineID_MES(string opName, string tagValue)
{
int tagTypeID = 74;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 变量类型代码=75零件机型。DBB446~485 发动机机型
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_EngineType_MES(string opName, string tagValue)
{
int tagTypeID = 75;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
/// <summary>
/// 订单号(string)(116)
/// </summary>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
public static void Write_OrderForm_MES(string opName, string tagValue)
{
int tagTypeID = 116;
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
}
#endregion
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.Data;
using System.Collections;
using MisDataFunDll;
namespace MesServerWork
{
public partial class MIS_BASE
{
/// <summary>
/// 读取质量数据
/// </summary>
/// <param name="valueList"></param>
public static void ReadPLC_Sync_ValueList(string opName, out Hashtable valueList)
{
valueList = null;
ReadPLCData(opName, out valueList);
}
/// <summary>
/// 根据工位号 同步读取数据
/// </summary>
/// <param name="opName">工位号</param>
/// <param name="valueList">PLC仅仅值列表</param>
private static void ReadPLCData(string opName, out Hashtable valueList)
{
valueList = new Hashtable();
System.Data.DataTable dt;
dt = MisDataFun.BaseData_tagTable_QualityData_Item_B5A();
object tagValueStr = "0";
for (int i = 0; i < dt.Rows.Count; i++)
{
if (opName == dt.Rows[i]["工位号"].ToString())
{
DeviceDriver_BasicData.CustomeEvetnArgs qualityDataType;
qualityDataType = new DeviceDriver_BasicData.CustomeEvetnArgs();
qualityDataType.TagID = dt.Rows[i]["TagID"].ToString ();
qualityDataType.TagTypeID = Convert.ToInt32(dt.Rows[i]["TagTypeID"]);//变量类型
qualityDataType.OpName = opName;//
qualityDataType.IsGoodBad = 192;//
qualityDataType.TagQuality = 192;//
qualityDataType.TagValueType = Convert.ToInt32(dt.Rows[i]["变量类型代码"]);
qualityDataType.TagOrderBy = Convert.ToInt32(dt.Rows[i]["列位置"]);
qualityDataType.TagItemOrderBy = Convert.ToInt32(dt.Rows[i]["变量排序"]);
qualityDataType.TagProperty = Convert.ToInt32(dt.Rows[i]["变量特点"]); ;//变量特点
MIS_BASE.Read_TagValueByTagID(qualityDataType.TagID.ToString(), out tagValueStr);
if (Convert.ToInt32(qualityDataType.TagTypeID) == 18)
{
qualityDataType.TagValue = Convert.ToInt32(tagValueStr);//变量值
}
else
{
qualityDataType.TagValue = tagValueStr;//变量值
}
valueList.Add(qualityDataType.TagID, qualityDataType);
}
}
}
}
public class QualityDataSaveList
{
public Hashtable valuList;
public DataTable BasicDataTagValue;
public DataTable BasicDataTagValueUpDown;
public Hashtable hashtable_EngineTypeID;
public Hashtable hashtable_tagTable_OpName_SaveData;
}
}

View File

@@ -0,0 +1,341 @@
using BasicData;
using MesWork;
using Newtonsoft.Json;
using NPOI.Util;
using OpcBasic;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net.Http;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
namespace MesServerWork
{
/*
HeartBeatMIS 15
EngineTypeGetOverMES 5
PartPalletGoOver 6
MaterialVerifyOver 7
FalseGo 8
ConfirmOkGo 51
PartLoadFinish 52
UnloadCompleted 53
MachineTime_ReadOver 54
FixAllow 66
FixOver 67
MatchingCompleted 68
Match 69
Reserved_1 70
IsAutoGetEngineID 71
RepairUplineMES 72
ProcessCode 77
BoltCode 88
RepairStatus 93
Reserved_3 24
Reserved_4 25
Reserved_5 26
Reserved_6 27
Reserved_7 28
Reserved_8 29
Reserved_9 30
Reserved_10 31
Reserved_11 32
Reserved_12 33
Reserved_13 34
Reserved_14 35
MesReadOver 20
Reserved_15 110
Reserved_16 111
Reserved_17 112
OnLineState 79
EngineTypeID_MES 73
EngineID_MES 74
EngineType_MES 75
MarkID 42
RepairPathString 4
SPareint1 113
SPareint2 114
SPareint3 115
Sparestring1 116
Sparestring2 117
HeartBeatPLC 14
WorkStart 2
RepairPartStatusPLC 3
PartLoad 43
EngineTypeGetOverPLC 44
PartLoadOK 48
Reserved_18 49
PalletDown 50
Reserved_19 58
FixOK 59
Reserved_20 76
Reserved_21 61
Reserved_22 62
Reserved_23 63
Reserved_24 64
Reserved_25 65
EngineTypeID 9
EngineID 10
EngineType 11
PartPalletCode 80
PalletInfo 22
MesRead 19
PutOn 1000
WorkOn 1001
Alarm 1002
NoPart 1003
Block 1004
PartPalletStatus 13
TargetTimeRead 16
QualityMask 21
RepairStatusPLC 23
MachineTargetTime 17
MachineActualTime 18
PLCSPareint1 36
PLCSPareint2 37
PLCSPareint3 38
PLCSarestring1 39
PLCSarestring2 40
*/
public partial class MIS_BASE
{
/// <summary>
///引用程序集Hashtable
/// </summary>
public static Hashtable Hashtable_assembly = new Hashtable();
/// <summary>
///
/// </summary>
static public NameValueCollection hashtable_TagTypeTagName = null;
/// <summary>
///
/// </summary>
static public NameValueCollection hashtable_TagTypeChange = null;
/// <summary>
///
/// </summary>
static public NameValueCollection hashtable_WebTagTypeChange = null;
/// <summary>
///
/// </summary>
static public NameValueCollection hashtable_MesTagTypeChange = null;
/// <summary>
///
/// </summary>
static readonly object l = new object();
/// <summary>
///
/// </summary>
/// <param name="tagTypeCodeID"></param>
/// <param name="opName"></param>
/// <returns></returns>
public static object ReadPLC(int tagTypeCodeID, string opName)
{
try
{
return PlcLinkForm.ReadPLC(tagTypeCodeID, opName);
}
catch { return "-3"; }
}
/// <summary>
///
/// </summary>
/// <param name="tagID"></param>
/// <param name="tagValue"></param>
private static object ReadPLC(string tagID)
{
return PlcLinkForm.ReadPLC(tagID);
}
/// <summary>
/// 20230218
/// 按组读质量数据,返回带合格标志的质量数据列表
/// </summary>
/// <param name="opName"></param>
/// <returns></returns>
public static Hashtable ReadPLC_Sync_DataList_MesRead_ByOnlyDataGroup(string opName)
{
lock (l)
{
var tagValues = GetDbAndMaxLengthByOpNameByBytes(opName);
var keyValues = tagValues.OrderBy(x => x.Key).ToDictionary(k => k.Key, v => v.Value);
TagFormat tagFormatTemp;
int tagIndex = 1;
int isOK = 0;
Hashtable ht = new Hashtable();
foreach (KeyValuePair<string, object> _cd in keyValues)
{
if (_cd.Key.ToString()[0].ToString() == "7")
{
tagFormatTemp = (TagFormat)_cd.Value;
if (tagIndex % 3 == 1)
{
isOK = Convert.ToInt32(tagFormatTemp.TagValue);
}
else if (tagIndex % 3 == 2)
{
var TF = (TagFormat)_cd.Value;
QualityDataType qualityDataType;
qualityDataType = GetQualityDataType(TF);
qualityDataType.isGoodBad = isOK;
ht.Add(qualityDataType.tagID, qualityDataType);
}
else if (tagIndex % 3 == 0)
{
var TF = (TagFormat)_cd.Value;
QualityDataType qualityDataType;
qualityDataType = GetQualityDataType(TF);
qualityDataType.isGoodBad = isOK;
ht.Add(qualityDataType.tagID, qualityDataType);
}
tagIndex++;
}
//Console.WriteLine($"key{kv.Key} value{kv.Value}");
}
return ht;
}
}
public static ConcurrentDictionary<string, object> GetDbAndMaxLengthByOpNameByBytes(string opName)
{
string tagStartAdr = "";
ushort tagAdrListMaxLength = 0;
PlcLinkForm.GetDbAndMaxLengthByOpName(opName, out tagStartAdr, out tagAdrListMaxLength);
var tagAdrListTagFormat = PlcLinkForm.ReadQualityDataList(opName, tagStartAdr, tagAdrListMaxLength);
return tagAdrListTagFormat;
}
public static BasicData.QualityDataType GetQualityDataType(TagFormat TF)
{
QualityDataType qualityDataType;
qualityDataType = new QualityDataType();
qualityDataType.tagID = TF.TagID;
qualityDataType.tagTypeID = TF.TagTypeID;//变量类型
qualityDataType.opName = TF.OpName;
qualityDataType.tagQuality = TF.Code;
qualityDataType.tagValueType = TF.TagTypeCodeID;
int.TryParse(TF.TagOrderBy, out int TagOrderBy);
qualityDataType.tagOrderBy = TagOrderBy;
int.TryParse(TF.TagItemOrderBy, out int TagItemOrderBy);
qualityDataType.tagItemOrderBy = TagItemOrderBy;
qualityDataType.tagProperty = Convert.ToInt32( TF.TagProperty);//变量特点
qualityDataType.tagValue = TF.TagValue;//变量值
return qualityDataType;
}
/// <summary>
///
/// </summary>
/// <param name="tagTypeCodeID"></param>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
private static void ReadTagValue(int tagTypeCodeID, string opName, out string tagValue)
{
tagValue = "0";
try
{
var tagValueObj = PlcLinkForm.ReadPLC(tagTypeCodeID, opName);
var type = tagValueObj.GetType().Name.ToLower();
if (type == "bool" | type == "boolean")
{
var val = tagValueObj.ToString().ToLower();
if (val == "true")
{
tagValue = "1";
}
}
else
{
tagValue = tagValueObj.ToString();
}
}
catch { }
}
/// <summary>
///
/// </summary>
/// <param name="tagID"></param>
/// <param name="tagValue"></param>
/// <returns></returns>
private static bool WritePLC(string tagID, object tagValue)
{
return PlcLinkForm.WritePLC(tagID, tagValue);
}
/// <summary>
///
/// </summary>
/// <param name="tagTypeCodeID"></param>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
/// <returns></returns>
public static bool WritePLC(int tagTypeCodeID, string opName, object tagValue)
{
return PlcLinkForm.WritePLC(tagTypeCodeID, opName, tagValue);
}
/// <summary>
///
/// </summary>
/// <param name="tagTypeCodeID"></param>
/// <param name="opName"></param>
/// <param name="tagValue"></param>
/// <returns></returns>
private static bool WriteTagValue(int tagTypeCodeID, string opName, object tagValue)
{
return PlcLinkForm.WritePLC(tagTypeCodeID, opName, tagValue);
}
public static ConcurrentDictionary<string, DeviceDriver_BasicData.CustomeEvetnArgs> ReadPLC_OpName(string opName)
{
try
{
string tagStartAdr = "";
ushort tagAdrListMaxLength = 0;
PlcLinkForm.GetDbAndMaxLengthByOpName(opName, out tagStartAdr, out tagAdrListMaxLength);
var tagAdrListTagFormat0 = PlcLinkForm.ReadQualityDataList(opName, tagStartAdr, tagAdrListMaxLength);
var pp = JsonConvert.SerializeObject(tagAdrListTagFormat0);
var tagAdrListTagFormat = JsonConvert.DeserializeObject<ConcurrentDictionary<string, DeviceDriver_BasicData.CustomeEvetnArgs>>(pp);
return tagAdrListTagFormat;
}
catch (Exception err)
{
return null;
}
}
}
}

View File

@@ -0,0 +1,41 @@
using MesWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MesDataFunction
{
public class MesWorkPlc: PlcLinkForm
{
public static Action<DeviceDriver_BasicData.CustomeEvetnArgs> D_OPCTagData_TagDataOnChangeMIS = null;
/// <summary>
/// 监控数据的所有变化,从这里产生
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public override void OPCTagData_TagDataOnChangeMIS(object sender, DeviceDriver_BasicData.CustomeEvetnArgs e)
{
Console.WriteLine($"【【{e.TagName}【【{e.TagValueBefore}->{e.TagValue}【【{e.TagKeepTime}");
if (D_OPCTagData_TagDataOnChangeMIS != null)
D_OPCTagData_TagDataOnChangeMIS(e);
// OPCTagData_TagDataOnChange(sender, e);
}
/// <summary>
/// 定时触发检测PLC在线状态周期3 s
/// </summary>
/// <param name="sender"></param>
/// <param name="eState"></param>
public override void PlcStateEvent(object sender, DeviceDriver_BasicData.PlcStateEvetnArgs eState)
{
}
}
}

View File

@@ -0,0 +1,25 @@
//using bizFacade;
using System;
using System.Collections;
using System.Data;
//using SystemFramework;
namespace MisDataFunction
{
partial class Function
{
private static void Heartbeat(string opName, string tagValue)
{
if (tagValue == "1")
{
Write_TagValueByTagTypeID(15, opName, true);
}
else
{
Write_TagValueByTagTypeID(15, opName, false);
}
}
}
}

View File

@@ -0,0 +1,326 @@
using bizFacade;
using DoWhatPlc;
using MesServerWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using SystemFramework;
namespace MisDataFunction
{
public partial class Function: MIS_BASE
{
///<summary>
/// 处理MIS逻辑 TagName 变量类型代码 变量类型名称
/// WorkStart 2 工件到位。托盘到达工位,并且托盘上有工件。
///RepairPartStatusPLC 3 备用
///RepairPathString 4 工位返修字符串121211112222111,前2位是西门子字符串格式第一位是总长度第二位是实际长度
///EngineTypeGetOverMES 5 MES传递总成信息给PLC上线工位
///PartPalletGoOver 6 上线工位。0正常工作1空托盘放行PLC读取到此标志不走申请上线逻辑。
///MaterialVerifyOver 7 MES保存完质量数据物料数据等与PLC信号交互完成后通知PLC所以工步都完成才可以放行工件正常工作时工件放行的必要条件。
///FalseGo 8 按MES界面[不合格放行] 按钮MES发送此信号。操作者判断工件不合格通知设备按不合格方式放行工件工件流转到返修下线工位后返修下线。MES工作完成MES0.3=1MES合格放行MES0.5=0MES0.4=1
///EngineTypeID 9 MES发动机机型标志(必须PLC)
///EngineID 10 MES发动机编号(必须PLC)
///EngineType 11 MES发动机机型(必须PLC)
///PartPalletStatus 13 MES激发变量托盘到位离开(必须PLC)
///HeartBeatPLC 14 心跳处理PLC收到MES心跳信号后PLC延时5秒后数值取反再写回PLC写回PLC开始计时如果5秒钟MES无反馈报通讯故障。
///HeartBeatMIS 15 间隔时间5S心跳处理。收到PLC心跳信号后MES按原值回写。PLC收到MES信号后延时5秒取反写入以此循环。
///TargetTimeRead 16 MES允许可读工位运行时间
///MachineTargetTime 17 目标运行时间
///MachineActualTime 18 实际运行时间
///MesRead 19 质量数据可以读数据
///MesReadOver 20 MES保存完数据(必须MIS)
///QualityMask 21 质量数据工位合格标志0:没有工作1合格 2 :不合格(必须PLC)
///PalletInfo 22 0空托盘1合格件2不合格件
///RepairStatusPLC 23 0正常件1返修件
///Reserved_3 24 备用
///Reserved_4 25 备用
///Reserved_5 26 备用
///Reserved_6 27 备用
///Reserved_7 28 备用
///Reserved_8 29 备用
///Reserved_9 30 备用
///Reserved_10 31 备用
///Reserved_11 32 备用
///Reserved_12 33 备用
///Reserved_13 34 备用
///Reserved_14 35 备用
///PLCSPareint1 36 备用
///PLCSPareint2 37 备用
///PLCSPareint3 38 备用
///PLCSarestring1 39 备用
///PLCSarestring2 40 备用
///MarkID 42 机体打标号MES前2位是西门子字符串格式第一位是总长度第二位是实际长度
///PartLoad 43 上线工位PLC向MES申请总成编号。收到该信号后MES将机型标志DBB22 ~23、总成号DBB24 ~63、总成机型DBB64 ~103写入PLC。之后MES通过信号“传递机型DBX0.1”通知PLC。
///EngineTypeGetOverPLC 44 PLC将机型标志DBB50…51、工件编号DBB52…101、产品型号DBB102…187、托盘编号DBB188…189准备完毕后通知MES。
///PartLoadOK 48 备用
///Reserved_18 49 备用
///PalletDown 50 暂时保留,项目未使用
///ConfirmOkGo 51 按MES界面[合格放行] 按钮MES发送此信号。操作者判断工件合格通知设备工件按合格方式放行工件。MES工作完成MES0.3=1MES合格放行MES0.5=1MES0.4=0
///ResetDevice 52 针对手动工位无HMI需要复位设备在MES页面操作。
///UnloadCompleted 53 暂时保留,项目未使用
///MachineTime_ReadOver 54 备用
///Reserved_19 58 备用
///FixOK 59 手动拧紧工位单工步螺栓拧紧完成通知PC读取数据。
///Reserved_21 61 备用
///Reserved_22 62 备用
///Reserved_23 63 备用
///Reserved_24 64 备用
///Reserved_25 65 备用
///FixAllow 66 设备工作的必须信号,对于有物料验证的工位MES验证完成给出此信号对于无物料验证工位MES直接给出此信号。
///FixOver 67 用于手动拧紧且有质量数据工位。通知设备当前工步拧紧螺钉工作结束。
///MatchingCompleted 68 分线上总线匹配成功是1不成功是0。
///Match 69 分线上总线匹配成功是1不成功是0。
///Reserved_2 70 备用
///IsAutoGetEngineID 71 自动手动申请工件编号。0是自动方式1手动方式。暂时保留生成流水号方式是在数据库中实现的
///RepairUplineMES 72 上线清空MOBY针对上线工位通知PLC从新开始申请上线流程
///EngineTypeID_MES 73 MES发动机机型标志(必须MES)
///EngineID_MES 74 MES发动机编号(必须MES)
///EngineType_MES 75 MES发动机机型(必须MES)
///Reserved_20 76 备用
///ProcessCode 77 手动拧紧工位由MES通知PLC拧紧序号
///OnLineState 79 通过线体工位PC实现下达工位工作状态工位有三种状态在线、离线、屏蔽。在线0正常状态实现正常功能。1离线:设备脱离MES工作进入不交互模式。
///PartPalletCode 80 托盘编号(B5A)
///BoltCode 88 手动拧紧工位指导PLC所用套筒
///RepairStatus 93 0正常件1返修件。对于上线工位MES给出是正常上线还是返修上线,返修路径
///Reserved_15 110 备用
///Reserved_16 111 备用
///Reserved_17 112 备用
///SPareint1 113 备用int1
///SPareint2 114 备用int2
///SPareint3 115 备用int3
///Sparestring1 116 备用字符串1
///Sparestring2 117 备用字符串2
///MachineStatusPutOn 1000 机床上电(必须PLC)
///MachineStatusWorkOn 1001 循环开始(必须PLC)
///MachineStatusAlarm 1002 机床故障(必须PLC)
///MachineStatusNoPart 1003 上料无件(必须PLC)
///MachineStatusBlock 1004 下料堵塞(必须PLC)
///Alarm 103 设备报警
/// </summary>
/// <param name = "e" ></ param >
public static void MIS_Funtion(object e)
{
try
{
string recData = e.ToString();
string[] dataArray = recData.Split('|');
if (dataArray.Length != 4)
return;
//消息来源
string m_Source = dataArray[0].ToString();
//消息类型
string m_Command = dataArray[1].ToString();
//工位号
string m_OpName = dataArray[2].ToString();
//消息参数
string m_Value = dataArray[3].ToString();
DoWhatPlc.ReturnValueString rv = Newtonsoft.Json.JsonConvert.DeserializeObject<DoWhatPlc.ReturnValueString>(m_Value);
//Console.WriteLine($"【【{rv.TagID}【【【【{ rv.TagKeepTime}");
int tagType;
string opName;
string tagValue;
int tagid;
DoWhatPlc.ReturnValueString msgEvent = rv;
if (msgEvent.TagValue == null) return;
tagType = Convert.ToInt32(msgEvent.TagTypeID);
opName = msgEvent.OpName.ToString();
tagid = Convert.ToInt32(msgEvent.TagID);
//int tagType;
//string opName;
//string tagValue;
//int tagid;
//DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
//if (msgEvent.TagValue == null) return;
//tagType = Convert.ToInt32(msgEvent.TagType);
//opName = msgEvent.OpName.ToString();
//tagid = Convert.ToInt32(msgEvent.TagKey);
switch (Convert.ToInt32(msgEvent.TagTypeCodeID))
{
case 11:
switch (msgEvent.TagValue.ToLower())
{
case "1":
case "true":
tagValue = "1";
break;
default:
tagValue = "0";
break;
}
break;
default:
tagValue = msgEvent.TagValue.ToString();
break;
}
///根据信号处理逻辑
switch (tagType)
{
case 19:
//允许保存
MesRead(opName, tagValue, tagid);
break;
case 14:
//心跳
Heartbeat(opName, tagValue);
break;
case 44://PLC传递机型过后 才允许保存过站信息,否则不允许保存
//if (tagValue == "1")
//{
// IsEngTypeGetOver_Write(opName, true);
// EngineData Enginedata = new EngineData(DtWebApi.ReadWritePLC.ReadPLC("10", opName).ToString(), Convert.ToInt32(DtWebApi.ReadWritePLC.ReadPLC("80", opName)));
// //EngineData Enginedata = new EngineData(MesDataFunction.OpcOperation.ReadPLC(10, opName).ToString(), Convert.ToInt32(MesDataFunction.OpcOperation.ReadPLC(80, opName)));
// //保存产品编号、托盘号 保存过站信息用
// EngineData_Hash_Write(opName, Enginedata);
//}
break;
case 2://工件到位
WorkStart( rv);
//WorkStart(opName, tagValue);
break;
case 51:
if (hashtableOpName_IsHaveComputer[opName].ToString() == "1")
{
SaveProductLeaveData(opName, 1);
}
break;
case 8:
if (hashtableOpName_IsHaveComputer[opName].ToString() == "1")
{
SaveProductLeaveData(opName, 2);
}
break;
case 103:
Alarm_Insert(rv);
break;
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, err.Message);
}
}
private static void Alarm_Insert(ReturnValueString rv)
{
string TagID;
string opName;
string tagTypeID;
int TagValue;
DateTime alarmStartTime;
DateTime alarmEndTime;
int TimeDiff;
string TagOrderBy;
string Text1;
string Text2;
TagID = rv.TagID;
tagTypeID = rv.TagTypeID;
opName = rv.OpName;
TagValue = Convert.ToInt32( rv.TagValue);
alarmStartTime = Convert.ToDateTime( rv.TimeStampBefore);
alarmEndTime = Convert.ToDateTime( rv.TimeStamp);
TimeDiff = Convert.ToInt32(rv.TagKeepTime);
TagOrderBy = rv.TagOrderBy;
Text1 = rv.ItemName;
Text2 = rv.ShaftID;
BaseDataSystemMES.Alarm_Insert(TagID, tagTypeID, opName, TagValue,
alarmStartTime, alarmEndTime, TimeDiff, Text1, Text2, TagOrderBy);
}
private static void WorkStart(ReturnValueString rv)
{
var ro = rv.ReturnValueToObject();
string opName = ro.OpName;
DateTime arrivedTime = ro.TimeStampBefore;
DateTime leavedTime = ro.TimeStamp;
int TimeDiff = ro.TagKeepTime;
int targetTime = 0;
string isPass = "";
int QualityMark=0;
string tagValue="0";
switch (ro.TagValue.ToString().ToLower())
{
case "1":
case "true":
tagValue = "1";
break;
default:
tagValue = "0";
break;
}
//if (ro.TagValue.ToString() == "0")
//{
// //Write_TagTypeID(5, opName, false);//MES传递机型
// //Write_TagTypeID(66, opName, false);//允许工作
// //Write_TagTypeID(51, opName, false);//合格放行
// //Write_TagTypeID(8, opName, false);//不合格放行
// //Write_TagTypeID(7, opName, false);//工作完成
// //Write_TagTypeID(20, opName, false);//保存完成
// //string isHaveComputer = hashtableOpName_IsHaveComputer[opName].ToString();
// //if (Convert.ToInt32(isHaveComputer) == 0)//自动工位 读合格标志
// //{
// // if (IsEngTypeGetOver_Read(opName))
// // {
// // //PLC未传递机型 不保存过站信息
// // SaveProductLeaveData_AutoWorkStation(opName, Convert.ToInt32(DtWebApi.ReadWritePLC.ReadPLC("21", opName)));
// // //SaveProductLeaveData_AutoWorkStation(opName, Convert.ToInt32(MesDataFunction.OpcOperation.ReadPLC(21, opName)));
// // }
// //}
// ////清空信号
// ////m_WorkStart_OpName[opName] = 0;//清空工件到位标志
// ////通知WEB更新产量
// //SendActuallyCount(opName, 0);
//}
QualityMark = Convert.ToInt32(ReadPLC(21, opName));
if (QualityMark == 1)
{
isPass = "1";
}
else
{
isPass = "0";
}
int EngineTypeID;//机型代码
int PartPallet_Code;//托盘编号
string EngineType;//机型
string EngineID;//工件编号
string OrderForm;
MIS_BASE.GetEngineTypeFromPLC(opName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code,out OrderForm);
//EngineData Enginedata = (EngineData)EngineData_Hash_Read(opName);
BaseDataSystemMES.WorkStartInsert_AutoWorkStation(opName, EngineID, PartPallet_Code, arrivedTime, leavedTime, TimeDiff, targetTime, null, isPass, 0);
}
}
}

View File

@@ -0,0 +1,465 @@
//using BasicData;
using bizFacade;
using DoWhatPlc;
using Newtonsoft.Json;
//using bizFacade;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
//using SystemFramework;
namespace MisDataFunction
{
partial class Function
{
/// <summary>
/// 获取质量数据Hashtable
/// </summary>
/// <param name="opName"></param>
/// <returns></returns>
//static public Hashtable ReadPLC_Sync_DataList_MesRead(string opName)
//{
// return (Hashtable)MesDataFunction.OpcOperation.ReadPLC_Sync_DataList_MesRead(opName);
//}
static object lockerReadPLC_Sync_DataList_MesRead1 = new object();
public static void ReadPLC_Sync_DataList_MesRead(string opName, out Hashtable valueList, out DataTable BasicDataTagValue, out DataTable BasicDataTagValueUpDown, out Hashtable hashtable_EngineTypeID, out Hashtable hashtable_tagTable_OpName_SaveData)
{
//QualityDataSaveList QualityDataType
valueList = new Hashtable();
//var qualityDataSaveList = DtWebApi.SaveData.ReadPLC_Sync_DataList_MesRead(opName);
var qualityDataSaveList = MesServerWork.MIS_BASE.ReadPLC_Sync_DataList_MesRead(opName);
foreach (DictionaryEntry de in qualityDataSaveList.valuList)
{
valueList.Add(de.Key, JsonConvert.DeserializeObject<QualityDataType>(de.Value.ToString()));
}
BasicDataTagValue = qualityDataSaveList.BasicDataTagValue;
BasicDataTagValueUpDown = qualityDataSaveList.BasicDataTagValueUpDown;
hashtable_EngineTypeID = qualityDataSaveList.hashtable_EngineTypeID;
hashtable_tagTable_OpName_SaveData = qualityDataSaveList.hashtable_tagTable_OpName_SaveData;
}
public static Hashtable ReadPLC_Sync_DataList_MesRead(string opName)
{
lock (lockerReadPLC_Sync_DataList_MesRead1)
{
Hashtable ht = new Hashtable();
var cd = ReadPLC_GroupData(opName);
//var cd = PlcLinkForm.ReadPLC_GroupData(opName);
foreach (var _cd in cd)
{
var tagID = Convert.ToInt32(_cd.TagID);
var TF =_cd.TF;
QualityDataType qualityDataType;
qualityDataType = new QualityDataType();
qualityDataType.tagID = TF.TagID;
qualityDataType.tagTypeID = TF.TagTypeID;//变量类型
qualityDataType.opName = opName;
qualityDataType.isGoodBad = 192;
int.TryParse(TF.TagQuality, out int TagQuality);
qualityDataType.tagQuality = TagQuality;
qualityDataType.tagValueType = TF.TagTypeCodeID;
int.TryParse(TF.TagOrderBy, out int TagOrderBy);
qualityDataType.tagOrderBy = TagOrderBy;
int.TryParse(TF.TagItemOrderBy, out int TagItemOrderBy);
qualityDataType.tagItemOrderBy = TagItemOrderBy;
qualityDataType.tagProperty = TF.TagProperty;//变量特点
qualityDataType.tagValue = TF.TagValue;//变量值
ht.Add(tagID, qualityDataType);
}
return ht;
}
}
/// <summary>
/// 允许保存(针对半自动和手动压装工位)
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
private static void MesRead(string opName, string tagValue, int tagid)
{
if (tagValue == "0")
{
Write_TagValueByTagTypeID(20, opName, false);
}
else
{
SaveQualityData(opName, Convert.ToInt32(tagValue), tagid);
}
}
private static void SaveQualityData(string opName, int tagValue, int tagID)
{
try
{
int id_tagCF;
int qualityMask = 0;
int engineTypeID = 0;
string engineID = "";
string engineType = "";
string engineTraceCode = "";
string engineCap = "";
string partPallet = "";
DataTable dt_WWW;
dt_WWW = BaseDataSystemMES.BuildDataTables_WWW();
Hashtable valueList;
//valueList = ReadPLC_Sync_DataList_MesRead(opName);
ReadPLC_Sync_DataList_MesRead(opName, out valueList, out BasicDataTagValue, out BasicDataTagValueUpDown, out hashtable_EngineTypeID, out hashtable_tagTable_OpName_SaveData);
valueList = GetQualityData_GoodBad_Values(valueList);
int mes_MustTest = 0;
int onLineState = 0;
int partMoveDirection = 0;
int pressIsOK = 0;
int pressIsNoOK = 0;
BaseDataSystemMES.GetQualityDataTable_B5A(valueList, opName, BasicDataTagValue,
BasicDataTagValueUpDown,
out dt_WWW,//数据列表
out qualityMask,//工位合格标志
out engineTypeID,//发动机类型代码
out engineID,//发动机编号
out engineType, //发动机型号
out partPallet,//托盘编号
out engineTraceCode, //发动机条码
out engineCap,//缸盖号,
hashtable_EngineTypeID,//发动机类型转换表
out mes_MustTest, out onLineState, out partMoveDirection, out pressIsOK, out pressIsNoOK);
// 1:通过监控系统保存采集的质量数据;0:不通过监控系统保存采集的质量数据
if (Convert.ToInt32(hashtable_tagTable_OpName_SaveData[opName]) != 0)
{
DateTime lastupdatetime = DateTime.Now;
BaseDataSystemMES.BaseData_tagTable_QualityData_B5A_IndexInsert(engineID, tagID, engineType, engineTypeID, opName, qualityMask, partPallet, out id_tagCF);
BaseDataSystemMES.BaseData_tagTable_QualityData_B5A_Insert(id_tagCF, engineTypeID, engineID, opName, dt_WWW);
}
Write_TagValueByTagTypeID(20, opName, true);
#region
//string orderForm = "";
//string operatorCode = "";
//int shiftCode = 1;
//DateTime arrivedTime;
//DateTime leavedTime;
//int TimeDiff;
//int targetTime = 0;
//string lineType = "";
//string isPass;
//int machineWorkOn = 0;
//int arrivedOrLeaved = 2;
//int cartColorOpName = 0;
//int cartColorConfirm = 0;
//// int partMoveDirection;
//int partGoOver = 0;
//if (qualityMask == 1)
//{
// isPass = "PASS";
//}
//else
//{
// isPass = "FAIL";
//}
////工位上下线类型
////0普通工位1正常上线2正常下线3返修上线4返修下线
//int OpNameUpDownType;
//OpNameUpDownType = Convert.ToInt32(hashtableOpName_OpType[opName]);
//arrivedTime = (DateTime)m_WorkStart_OpName_Time[opName];
//leavedTime = DateTime.Now;
//TimeDiff = Convert.ToInt32(leavedTime.Subtract(arrivedTime).TotalSeconds);
//lineType = hashtableOpName_LineType[opName].ToString();
//string isHaveComputer = hashtableOpName_IsHaveComputer[opName].ToString();
////isHaveComputer = MIS_BASE.hashtable_tagTable_OpName_SaveData[opName].ToString();
////有计算机的工位,通过工位计算机保存[测量数据发动机在线状态]。
//if (Convert.ToInt32(isHaveComputer) == 0)
//{
// //1->0 工件离开 工件刚刚离开
// if (Convert.ToInt32(m_WorkStart_OpName[opName]) == 1)
// {
// //[测量数据发动机在线状态]
// QualityDataSystem.WorkStartInsert
// (opName, orderForm, engineTypeID, engineType, engineID, partPallet.ToString(), operatorCode, shiftCode,
// arrivedTime, leavedTime, TimeDiff, targetTime, lineType, isPass, machineWorkOn,
// arrivedOrLeaved, cartColorOpName, cartColorConfirm, partMoveDirection, partGoOver, mes_MustTest, onLineState, OpNameUpDownType);
// }
//}
#endregion
}
catch (Exception err)
{
Write_TagValueByTagTypeID(20, opName, true);
////ApplicationLog.WriteLog(err, err.Message);
}
}
public static void SaveQualityData_Mes(string opName, int tagID)
{
try
{
int id_tagCF;
int qualityMask = 0;
int engineTypeID = 0;
string engineID = "";
string engineType = "";
string engineTraceCode = "";
string engineCap = "";
string partPallet = "";
DataTable dt_WWW;
dt_WWW = BaseDataSystemMES.BuildDataTables_WWW();
Hashtable valueList;
valueList = ReadPLC_Sync_DataList_MesRead(opName);
valueList = GetQualityData_GoodBad_Values(valueList);
int mes_MustTest = 0;
int onLineState = 0;
int partMoveDirection = 0;
int pressIsOK = 0;
int pressIsNoOK = 0;
BaseDataSystemMES.GetQualityDataTable_B5A(valueList, opName, BasicDataTagValue,
BasicDataTagValueUpDown,
out dt_WWW,//数据列表
out qualityMask,//工位合格标志
out engineTypeID,//发动机类型代码
out engineID,//发动机编号
out engineType, //发动机型号
out partPallet,//托盘编号
out engineTraceCode, //发动机条码
out engineCap,//缸盖号,
hashtable_EngineTypeID,//发动机类型转换表
out mes_MustTest, out onLineState, out partMoveDirection, out pressIsOK, out pressIsNoOK);
// 1:通过监控系统保存采集的质量数据;0:不通过监控系统保存采集的质量数据
if (Convert.ToInt32(hashtable_tagTable_OpName_SaveData[opName]) != 0)
{
DateTime lastupdatetime = DateTime.Now;
BaseDataSystemMES.BaseData_tagTable_QualityData_B5A_IndexInsert(engineID, tagID, engineType, engineTypeID, opName, qualityMask, partPallet, out id_tagCF);
//BaseDataSystemMES.BaseData_tagTable_QualityData_B5A_Insert(id_tagCF, engineTypeID, engineID, opName, dt_WWW);
}
}
catch (Exception err)
{
Write_TagValueByTagTypeID(20, opName, true);
////ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 确定合格标志
/// </summary>
/// <param name="valuList"></param>
/// <returns></returns>
static public Hashtable GetQualityData_GoodBad_Values(Hashtable valuList)
{
try
{
Hashtable valuList_Temp;
valuList_Temp = (Hashtable)valuList.Clone();
int[] value_GoodBad_New = new int[128];
int tagID;
QualityDataType value;
//1获得合格标志
foreach (DictionaryEntry de in valuList) //ht为一个Hashtable实例
{
tagID = Convert.ToInt32(de.Key);
value = (QualityDataType)de.Value;
//拧紧数据合格标志
if (value.tagProperty == 1)
{
if (value.tagTypeID == 8203)
{
value_GoodBad_New = (int[])value.tagValue;
break;
}
else
{
value_GoodBad_New[value.tagOrderBy - 1] = Convert.ToInt32(value.tagValue);
}
}
//拧紧数据合格标志
if (value.tagProperty == 8)
{
if (value.tagTypeID == 8203)
{
value_GoodBad_New = (int[])value.tagValue;
break;
}
else
{
value_GoodBad_New[value.tagOrderBy - 1] = Convert.ToInt32(value.tagValue);
}
}
//压装数据合格标志
if (value.tagProperty == 7)
{
value_GoodBad_New[value.tagOrderBy - 1] = Convert.ToInt32(value.tagValue);
}
}
//将合格标志赋予每个变量
foreach (DictionaryEntry de in valuList) //ht为一个Hashtable实例
{
tagID = Convert.ToInt32(de.Key);
value = (QualityDataType)de.Value;
//201706061720新加
if (value .tagTypeID ==11)
{
if (value.tagValue.ToString ()=="False")
{
value.tagValue ="0";
}
else
{
value.tagValue = "1";
}
valuList_Temp[tagID] = value;
//value.tagValue = Convert.ToInt32(value.tagValue);
}
//测量变量
if (value.tagProperty == 2 || value.tagProperty == 6)
{
try
{
if (value_GoodBad_New != null)
{
value.isGoodBad = Convert.ToInt32(value_GoodBad_New[value.tagOrderBy - 1]);
valuList_Temp[tagID] = value;
}
else
{
value.isGoodBad = 0;
valuList_Temp[tagID] = value;
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, err.Message);
}
}
}
return valuList_Temp;
}
catch//转换出了故障时
{
return valuList;
}
}
/// <summary>
/// 制定工位PLC是否传递过机型 (默认不传递机型不保存过站信息)
/// </summary>
static Hashtable EngTypeGetOver = new Hashtable();
static Hashtable EngineData_Hash = new Hashtable(); //保存
public static void IsEngTypeGetOver_Write(string OpName, bool value)
{
if (EngTypeGetOver.ContainsKey(OpName))
{
EngTypeGetOver[OpName] = value;
}
else
{
EngTypeGetOver.Add(OpName, value);
}
}
public static bool IsEngTypeGetOver_Read(string OpName)
{
if (EngTypeGetOver.ContainsKey(OpName))
{
return Convert.ToBoolean(EngTypeGetOver[OpName]);
}
else
{
return true;
}
}
public static void EngineData_Hash_Write(string OpName, object value)
{
if (EngineData_Hash.ContainsKey(OpName))
{
EngineData_Hash[OpName] = value;
}
else
{
EngineData_Hash.Add(OpName, value);
}
}
public static object EngineData_Hash_Read(string OpName)
{
if (EngineData_Hash.ContainsKey(OpName))
{
return EngineData_Hash[OpName];
}
else
{
return null;
}
}
private DataTable ChangeQualificationMark(DataTable dt)
{
var dtNew = dt.Copy();
for (int i = 0; i < dt.Rows.Count; i++)
{
var = dt.Rows[i]["变量排序"].ToString();
if ( == "0")
{
}
}
return dtNew;
}
}
struct EngineData
{
public EngineData(string engineID, int pallet)
{
EngineID = engineID;
Pallet = pallet;
}
public string EngineID;//工件编号
//public string EngineType;
//public int EngineTypeID;
public int Pallet;//托盘号
}
}

View File

@@ -0,0 +1,236 @@
//using BasicData;
using bizFacade;
//using DataBaseAccess;
//using bizFacade;
using DataLinkMesWork;
using MesServerWork;
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
//using SystemFramework;
namespace MisDataFunction
{
partial class Function
{
/// <summary>
/// 工件到位与离开时清空MES自身信号
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
private static void WorkStart(string opName, string tagValue)
{
try
{
//工位没有工件,或工件刚刚离开 工件离开工位后,清空该工位的发动机号
if (tagValue == "0")
{
Write_TagValueByTagTypeID(5, opName, false);//MES传递机型
Write_TagValueByTagTypeID(66, opName, false);//允许工作
Write_TagValueByTagTypeID(51, opName, false);//合格放行
Write_TagValueByTagTypeID(8, opName, false);//不合格放行
Write_TagValueByTagTypeID(7, opName, false);//工作完成
Write_TagValueByTagTypeID(20, opName, false);//保存完成
//string isHaveComputer = hashtableOpName_IsHaveComputer[opName].ToString();
//if (Convert.ToInt32(isHaveComputer) == 0)//自动工位 读合格标志
{
if (IsEngTypeGetOver_Read(opName))
{
//PLC未传递机型 不保存过站信息
SaveProductLeaveData_AutoWorkStation(opName, Convert.ToInt32(Read_TagValueByTagTypeID(21, opName)));
//SaveProductLeaveData_AutoWorkStation(opName, Convert.ToInt32(MesDataFunction.OpcOperation.ReadPLC(21, opName)));
}
}
//清空信号
//m_WorkStart_OpName[opName] = 0;//清空工件到位标志
//通知WEB更新产量
SendActuallyCount(opName,0);
}
else
{
//保存工件到达数据
//m_WorkStart_OpName_Time[opName] = DateTime.Now;
//m_WorkStart_OpName[opName] = 1;
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 保存过站信息 (数据库读机型信息)
/// </summary>
/// <param name="opName"></param>
/// <param name="QualityMark"></param>
static void SaveProductLeaveData(string opName, int QualityMark)
{
try
{
if (!IsEngTypeGetOver_Read(opName))
{
//PLC未传递机型 不保存过站信息
return;
}
IsEngTypeGetOver_Write(opName, false);//清空传递机型标志
DateTime arrivedTime;
DateTime leavedTime;
int TimeDiff;
int targetTime = 0;
string lineType = "";
string isPass;
if (QualityMark == 1)
{
isPass = "PASS";
}
else
{
isPass = "FAIL";
}
//工位上下线类型
//0普通工位1正常上线2正常下线3返修上线4返修下线
int OpNameUpDownType;
OpNameUpDownType = Convert.ToInt32(hashtableOpName_OpType[opName]);
arrivedTime = (DateTime)m_WorkStart_OpName_Time[opName];
leavedTime = DateTime.Now;
TimeDiff = Convert.ToInt32(leavedTime.Subtract(arrivedTime).TotalSeconds);
lineType = hashtableOpName_LineType[opName].ToString();
//1->0 工件离开 工件刚刚离开
//if (Convert.ToInt32(m_WorkStart_OpName[opName]) == 1)
//{
// WorkStartInsert(opName, arrivedTime, leavedTime, TimeDiff, targetTime, lineType, isPass, OpNameUpDownType);
//}
//通知WEB更新产量
SendActuallyCount(opName, 0);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 保存过站信息 (数据库读机型信息)
/// </summary>
/// <param name="opName"></param>
/// <param name="QualityMark"></param>
static void SaveProductLeaveData_AutoWorkStation(string opName, int QualityMark)
{
try
{
if (!IsEngTypeGetOver_Read(opName))
{
//PLC未传递机型 不保存过站信息
return;
}
IsEngTypeGetOver_Write(opName, false);//清空传递机型标志
DateTime arrivedTime;
DateTime leavedTime;
int TimeDiff;
int targetTime = 0;
string lineType = "";
string isPass;
if (QualityMark == 1)
{
isPass = "PASS";
}
else
{
isPass = "FAIL";
}
//工位上下线类型
//0普通工位1正常上线2正常下线3返修上线4返修下线
int OpNameUpDownType;
//OpNameUpDownType = Convert.ToInt32(hashtableOpName_OpType[opName]);
// arrivedTime = (DateTime)m_WorkStart_OpName_Time[opName];
leavedTime = DateTime.Now;
//TimeDiff = Convert.ToInt32(leavedTime.Subtract(arrivedTime).TotalSeconds);
//lineType = hashtableOpName_LineType[opName].ToString();
//1->0 工件离开 工件刚刚离开
//if (Convert.ToInt32(m_WorkStart_OpName[opName]) == 1)
//{
// //查询工件编号、托盘号
//EngineData Enginedata = (EngineData)EngineData_Hash_Read(opName);
//WorkStartInsert_AutoWorkStation(opName, Enginedata.EngineID, Enginedata.Pallet, arrivedTime, leavedTime, TimeDiff, targetTime, lineType, isPass, OpNameUpDownType);
//}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 测量数据发动机在线状态_增加数据
/// </summary>
/// <param name="opName"></param>
/// <param name="arrivedTime"></param>
/// <param name="leavedTime"></param>
/// <param name="TimeDiff"></param>
/// <param name="Target"></param>
/// <param name="isPass"></param>
static public void WorkStartInsert(string opName, DateTime arrivedTime, DateTime leavedTime, int TimeDiff, int Target, string lineType, string isPass, int OpNameUpDownType)
{
string procedureName;
procedureName = "测量数据发动机在线状态_增加数据";
SqlParameter[] thisParms = new SqlParameter[8];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@到达时间", arrivedTime);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@离开时间", leavedTime);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@在线时间", TimeDiff);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@目标时间", Target);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@线体类型", lineType);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@是否合格", isPass);
thisParms[7] = new System.Data.SqlClient.SqlParameter("@工位上下线类型", OpNameUpDownType);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
}
/// <summary>
/// 发送在线产量、在线节拍
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
static void SendActuallyCount(string OpName, int tagValue)
{
//当工件离开时,更新在线产量、在线节拍
if (tagValue == 0)
{
try
{
int opNameCount = 0;//在线产量
int opNameCountTime = 0;//在线节拍
//基本数据_工作日历_班次产量查询_New
BaseDataSystemMES.OpNameCount_New(OpName, out opNameCount, out opNameCountTime);
string SendMessage;
SendMessage = "MES|ActuallyCount|" + OpName + "|" + opNameCount.ToString() + "&" + opNameCountTime.ToString();
MIS_BASE.asyncSendMessage(SendMessage);
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function01:SendActuallyCount");
}
}
}
}
}

View File

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

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MesDataFunction
{
public class PP
{
public static string ConnectionString_MES { get; set; }
public static string PrintURL { get; set; }
public static int IsDemoMesServer { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
using MesWork;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MesDataFunction
{
public class PrintTo
{
/// <summary>
///
/// </summary>
/// <param name="str"></param>
public static bool Print(bool isSinglePrint,string url,string[] strArray)
{
if (PP.IsDemoMesServer == 1)
{
var list = new List<string>();
foreach (string str in strArray)
{
var printStr = str;
if (isSinglePrint)
{
printStr = str.Replace("^XB", "");
}
list.Add(printStr);
}
File.WriteAllText($"PrintContent_{DateTime .Now.ToString ("yyyy_MM_dd_HH_mm_ss")}.print", string.Join (" ", list));
return true;
}
var sucess = false;
try
{
var client = new System.Net.Sockets.TcpClient();
client.Connect(url.Split(':')[0], Convert.ToInt32(url.Split(':')[1]));
foreach (string str in strArray)
{
var printStr = str;
if (isSinglePrint)
{
printStr = str.Replace("^XB", "");
}
client.Client.Send(System.Text.Encoding.ASCII.GetBytes(printStr));
}
client.Close();
sucess = true;
}
catch (Exception err) { }
return sucess;
}
}
}

View File

@@ -0,0 +1,80 @@
using MesDataFunction;
using MesWork;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MesDataFunction
{
public class Print_Sql
{
public static bool Select_Print_Template(out DataTable dt_Print_Template)
{
/*
SELECT [IDG],[TemplateName],[TemplateContent],[DefSelect],[UpdateTime] FROM [OL_Repair_Print_Template]
*/
bool success = false;
var sql =
@"
SELECT [IDG],[TemplateName],[DefSelect],[UpdateTime] FROM [OL_Repair_Print_Template]
ORDER BY [UpdateTime]
";
success = DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, PP.ConnectionString_MES, out DataTable dt, out string err2);
dt_Print_Template = dt;
return success;
}
public static bool Select_Print_TemplateStr(string IDG, out string templateStr)
{
/*
SELECT [IDG],[TemplateName],[TemplateContent],[DefSelect],[UpdateTime] FROM [OL_Repair_Print_Template]
*/
templateStr = "";
bool success = false;
var sql =
$" DECLARE @IDG nvarchar(50) = '{IDG}'" +
@"
SELECT [TemplateContent] FROM [OL_Repair_Print_Template]
WHERE [IDG] = @IDG
";
success = DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, PP.ConnectionString_MES, out DataTable dt, out string err2);
if (dt.Rows.Count > 0)
{
templateStr = dt.Rows[0]["TemplateContent"].ToString();
}
return success;
}
public static bool Select_Print_Template_Def(out string templateStr)
{
/*
SELECT [IDG],[TemplateName],[TemplateContent],[DefSelect],[UpdateTime] FROM [OL_Repair_Print_Template]
*/
templateStr = "";
bool success = false;
var sql =
@"
SELECT top 1 [TemplateContent] FROM [OL_Repair_Print_Template]
WHERE [DefSelect]= 'True'
";
success = DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, PP.ConnectionString_MES, out DataTable dt, out string err2);
if (dt.Rows.Count > 0)
{
templateStr = dt.Rows[0]["TemplateContent"].ToString();
}
return success;
}
}
}

View File

@@ -0,0 +1,33 @@
using MesWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MesDataFunction
{
public class PrinterCommandCenter
{
public static bool PrintToPrinter(string code)
{
bool success = false;
Print_Sql.Select_Print_Template_Def(out string templateStr);
var printContent = Template_Make_Zpl(templateStr, code);
PrintTo.Print(true, PP.PrintURL, new string[] { printContent });
return success;
}
public static string Template_Make_Zpl(string templateStr,string TowCode)
{
return templateStr.Replace("@TowCode", TowCode);
}
}
}

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyLog4Net</RootNamespace>
<AssemblyName>MyLog4Net</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyLogEventArgs.cs" />
<Compile Include="MyLogHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyLog4Net
{
public class MyLogEventArgs : EventArgs
{
public string Message { get; set; }
public string Module { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
using log4net;
using System;
namespace MyLog4Net
{
public class MyLogHelper
{
public delegate void MyLogEventHandler(object sender, MyLogEventArgs e);
public static event MyLogEventHandler LogCommit;
/// <summary>
/// 普通日志
/// </summary>
/// <param name="message">日志内容</param>
public static void Info(string module, string message)
{
ILog log = LogManager.GetLogger(module);
if (log.IsInfoEnabled)
{
log.Info(message);
var e = new MyLogEventArgs();
e.Module = module;
e.Message = message;
LogCommit?.Invoke(null, e);
}
}
/// <summary>
/// 错误日志带异常
/// </summary>
/// <param name="message">错误日志</param>
public static void Error(string module, string message, Exception ex)
{
ILog log = LogManager.GetLogger(module);
if (log.IsErrorEnabled)
{
log.Error(message, ex);
var e = new MyLogEventArgs();
e.Module = module;
e.Message = message;
LogCommit?.Invoke(null, e);
}
}
/// <summary>
/// 错误日志不带异常
/// </summary>
/// <param name="message">错误日志</param>
public static void Error(string module, string message)
{
ILog log = LogManager.GetLogger(module);
if (log.IsErrorEnabled)
{
log.Error(message);
var e = new MyLogEventArgs();
e.Module = module;
e.Message = message;
LogCommit?.Invoke(null, e);
}
}
}
}

View File

@@ -0,0 +1,37 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Log4Net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Log4Net")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1dc48c83-1842-4de8-acaf-26e1e7f7c58f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<!-- 控制台日志配置 -->
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<!--<conversionPattern value="%5level [%thread] (%file:%line) - %message%newline" />-->
<conversionPattern value="%date %-5level %thread %logger - %message%newline" />
</layout>
</appender>
<!-- 文件存储日志配置 -->
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<!-- 保存文件的名称 -->
<file value="./log/log.log" />
<appendToFile value="true" />
<!-- 文件的编码方式 -->
<param name="Encoding" value="UTF-8"/>
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
<!-- 每个文件的大小 -->
<maximumFileSize value="10000KB" />
<!-- 保存文件数量 -->
<maxSizeRollBackups value="2" />
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level %thread %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>
</log4net>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.14" targetFramework="net461" />
</packages>

View File

@@ -0,0 +1,95 @@
-- 现场总装数据库MESBasicDB_XD_ZZ
-- 用途:支持 AGV lower/raise 回调与 PLC 允许下降/举升放行查询。
-- 说明:请在目标库手工执行。本脚本不直接修改 AGV_光栅请求记录 表结构。
SET NOCOUNT ON;
GO
-- 1. 增加变量类型代码。500/501 是 MES 写 PLC 请求位550/551 是 PLC 允许位。
IF NOT EXISTS (SELECT 1 FROM [dbo].[MES_基本变量变量类型代码] WHERE [] = 500)
BEGIN
INSERT INTO [dbo].[MES_基本变量变量类型代码]
([], [TagTypeDataType], [TagName], [], [TagTypeChange], [MesTagTypeChange], [WebTagTypeChange], [], [])
VALUES
(N'X', 11, N'AGV请求下降', 500, 1, 0, 1, N'AGV请求下降', N'AGV请求下降');
END
IF NOT EXISTS (SELECT 1 FROM [dbo].[MES_基本变量变量类型代码] WHERE [] = 501)
BEGIN
INSERT INTO [dbo].[MES_基本变量变量类型代码]
([], [TagTypeDataType], [TagName], [], [TagTypeChange], [MesTagTypeChange], [WebTagTypeChange], [], [])
VALUES
(N'X', 11, N'AGV请求举升', 501, 1, 0, 1, N'AGV请求举升', N'AGV请求举升');
END
IF NOT EXISTS (SELECT 1 FROM [dbo].[MES_基本变量变量类型代码] WHERE [] = 550)
BEGIN
INSERT INTO [dbo].[MES_基本变量变量类型代码]
([], [TagTypeDataType], [TagName], [], [TagTypeChange], [MesTagTypeChange], [WebTagTypeChange], [], [])
VALUES
(N'X', 11, N'允许AGV下降', 550, 1, 0, 1, N'允许AGV下降', N'允许AGV下降');
END
IF NOT EXISTS (SELECT 1 FROM [dbo].[MES_基本变量变量类型代码] WHERE [] = 551)
BEGIN
INSERT INTO [dbo].[MES_基本变量变量类型代码]
([], [TagTypeDataType], [TagName], [], [TagTypeChange], [MesTagTypeChange], [WebTagTypeChange], [], [])
VALUES
(N'X', 11, N'允许AGV举升', 551, 1, 0, 1, N'允许AGV举升', N'允许AGV举升');
END
GO
-- 2. 扩展 AGV continueTask 放行查询。
-- apply/release 保持原有 XD_库位Moby 查询。
-- lower/raise 从 AGV_光栅请求记录 取最新未允许或最近请求,避免改动 XD_库位Moby 与历史表列顺序。
ALTER PROCEDURE [dbo].[AGV_允许进入离开_查询]
@opName nvarchar(50) = 'AC0901-02',
@engineID nvarchar(50) = '0',
@type nvarchar(50) = 'apply'
AS
BEGIN
SET NOCOUNT ON;
IF (@type = 'apply')
BEGIN
SELECT [req] AS reqCode, [task] AS taskCode
FROM [dbo].[XD_库位Moby]
WHERE [] = @opName
AND [AGV请求进入时间] IS NOT NULL;
END
IF (@type = 'release')
BEGIN
SELECT [req] AS reqCode, [task] AS taskCode
FROM [dbo].[XD_库位Moby]
WHERE [] = @opName
AND [AGV请求离开时间] IS NOT NULL;
END
IF (@type = 'lower')
BEGIN
SELECT TOP 1 [reqCode], [taskCode]
FROM [dbo].[AGV_光栅请求记录]
WHERE [method] = 'lower'
AND (
[currentPositionCode] = @opName
OR [currentPositionCode] LIKE @opName + N'[_]%'
OR [wbCode] = @opName
)
ORDER BY ISNULL([], 0) ASC, [] DESC, [ID] DESC;
END
IF (@type = 'raise')
BEGIN
SELECT TOP 1 [reqCode], [taskCode]
FROM [dbo].[AGV_光栅请求记录]
WHERE [method] = 'raise'
AND (
[currentPositionCode] = @opName
OR [currentPositionCode] LIKE @opName + N'[_]%'
OR [wbCode] = @opName
)
ORDER BY ISNULL([], 0) ASC, [] DESC, [ID] DESC;
END
END
GO

View File

@@ -0,0 +1,173 @@
IF OBJECT_ID(N'dbo.XD_电能表谐波数据', N'U') IS NULL
BEGIN
CREATE TABLE dbo.XD_电能表谐波数据
(
ID int IDENTITY(1,1) NOT NULL,
nvarchar(50) NULL,
A相电压总谐波畸变 float NULL,
B相电压总谐波畸变 float NULL,
C相电压总谐波畸变 float NULL,
float NULL,
A相电流总谐波畸变 float NULL,
B相电流总谐波畸变 float NULL,
C相电流总谐波畸变 float NULL,
float NULL,
A相电压奇次谐波畸变 float NULL,
B相电压奇次谐波畸变 float NULL,
C相电压奇次谐波畸变 float NULL,
A相电流奇次谐波畸变 float NULL,
B相电流奇次谐波畸变 float NULL,
C相电流奇次谐波畸变 float NULL,
A相电压偶次谐波畸变 float NULL,
B相电压偶次谐波畸变 float NULL,
C相电压偶次谐波畸变 float NULL,
A相电流偶次谐波畸变 float NULL,
B相电流偶次谐波畸变 float NULL,
C相电流偶次谐波畸变 float NULL,
datetime NULL CONSTRAINT DF_XD_电能表谐波数据_操作时间 DEFAULT (GETDATE()),
CONSTRAINT PK_XD_电能表谐波数据 PRIMARY KEY CLUSTERED (ID ASC)
);
END
GO
IF NOT EXISTS (
SELECT 1
FROM sys.indexes
WHERE name = N'IX_XD_电能表谐波数据_工位号_操作时间'
AND object_id = OBJECT_ID(N'dbo.XD_电能表谐波数据')
)
BEGIN
CREATE NONCLUSTERED INDEX IX_XD_电能表谐波数据_工位号_操作时间
ON dbo.XD_电能表谐波数据 ( ASC, DESC);
END
GO
IF OBJECT_ID(N'dbo.XD_电能表谐波数据_增加', N'P') IS NOT NULL
DROP PROCEDURE dbo.XD_电能表谐波数据_增加;
GO
CREATE PROCEDURE dbo.XD_电能表谐波数据_增加
@ nvarchar(50) = N'',
@A相电压总谐波畸变 float = NULL,
@B相电压总谐波畸变 float = NULL,
@C相电压总谐波畸变 float = NULL,
@ float = NULL,
@A相电流总谐波畸变 float = NULL,
@B相电流总谐波畸变 float = NULL,
@C相电流总谐波畸变 float = NULL,
@ float = NULL,
@A相电压奇次谐波畸变 float = NULL,
@B相电压奇次谐波畸变 float = NULL,
@C相电压奇次谐波畸变 float = NULL,
@A相电流奇次谐波畸变 float = NULL,
@B相电流奇次谐波畸变 float = NULL,
@C相电流奇次谐波畸变 float = NULL,
@A相电压偶次谐波畸变 float = NULL,
@B相电压偶次谐波畸变 float = NULL,
@C相电压偶次谐波畸变 float = NULL,
@A相电流偶次谐波畸变 float = NULL,
@B相电流偶次谐波畸变 float = NULL,
@C相电流偶次谐波畸变 float = NULL
AS
BEGIN
SET NOCOUNT ON;
IF NULLIF(LTRIM(RTRIM(@)), N'') IS NULL
RETURN;
-- 电表返回 -1 表示无效数据;任一谐波点无效时,本次整条采集不入库。
IF @A相电压总谐波畸变 = -1
OR @B相电压总谐波畸变 = -1
OR @C相电压总谐波畸变 = -1
OR @ = -1
OR @A相电流总谐波畸变 = -1
OR @B相电流总谐波畸变 = -1
OR @C相电流总谐波畸变 = -1
OR @ = -1
OR @A相电压奇次谐波畸变 = -1
OR @B相电压奇次谐波畸变 = -1
OR @C相电压奇次谐波畸变 = -1
OR @A相电流奇次谐波畸变 = -1
OR @B相电流奇次谐波畸变 = -1
OR @C相电流奇次谐波畸变 = -1
OR @A相电压偶次谐波畸变 = -1
OR @B相电压偶次谐波畸变 = -1
OR @C相电压偶次谐波畸变 = -1
OR @A相电流偶次谐波畸变 = -1
OR @B相电流偶次谐波畸变 = -1
OR @C相电流偶次谐波畸变 = -1
RETURN;
-- 谐波畸变允许为 0只有全部点位都为空时跳过保存。
IF @A相电压总谐波畸变 IS NULL
AND @B相电压总谐波畸变 IS NULL
AND @C相电压总谐波畸变 IS NULL
AND @ IS NULL
AND @A相电流总谐波畸变 IS NULL
AND @B相电流总谐波畸变 IS NULL
AND @C相电流总谐波畸变 IS NULL
AND @ IS NULL
AND @A相电压奇次谐波畸变 IS NULL
AND @B相电压奇次谐波畸变 IS NULL
AND @C相电压奇次谐波畸变 IS NULL
AND @A相电流奇次谐波畸变 IS NULL
AND @B相电流奇次谐波畸变 IS NULL
AND @C相电流奇次谐波畸变 IS NULL
AND @A相电压偶次谐波畸变 IS NULL
AND @B相电压偶次谐波畸变 IS NULL
AND @C相电压偶次谐波畸变 IS NULL
AND @A相电流偶次谐波畸变 IS NULL
AND @B相电流偶次谐波畸变 IS NULL
AND @C相电流偶次谐波畸变 IS NULL
RETURN;
INSERT INTO dbo.XD_电能表谐波数据
(
,
A相电压总谐波畸变,
B相电压总谐波畸变,
C相电压总谐波畸变,
,
A相电流总谐波畸变,
B相电流总谐波畸变,
C相电流总谐波畸变,
,
A相电压奇次谐波畸变,
B相电压奇次谐波畸变,
C相电压奇次谐波畸变,
A相电流奇次谐波畸变,
B相电流奇次谐波畸变,
C相电流奇次谐波畸变,
A相电压偶次谐波畸变,
B相电压偶次谐波畸变,
C相电压偶次谐波畸变,
A相电流偶次谐波畸变,
B相电流偶次谐波畸变,
C相电流偶次谐波畸变
)
VALUES
(
@,
@A相电压总谐波畸变 / 1000.0,
@B相电压总谐波畸变 / 1000.0,
@C相电压总谐波畸变 / 1000.0,
@ / 1000.0,
@A相电流总谐波畸变 / 1000.0,
@B相电流总谐波畸变 / 1000.0,
@C相电流总谐波畸变 / 1000.0,
@ / 1000.0,
@A相电压奇次谐波畸变 / 1000.0,
@B相电压奇次谐波畸变 / 1000.0,
@C相电压奇次谐波畸变 / 1000.0,
@A相电流奇次谐波畸变 / 1000.0,
@B相电流奇次谐波畸变 / 1000.0,
@C相电流奇次谐波畸变 / 1000.0,
@A相电压偶次谐波畸变 / 1000.0,
@B相电压偶次谐波畸变 / 1000.0,
@C相电压偶次谐波畸变 / 1000.0,
@A相电流偶次谐波畸变 / 1000.0,
@B相电流偶次谐波畸变 / 1000.0,
@C相电流偶次谐波畸变 / 1000.0
);
END
GO

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{727A1B50-D83A-4319-BDF6-E923F4BD41B3}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CallWebApi</RootNamespace>
<AssemblyName>CallWebApi</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CallWebApi.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--<add key="MqttUrl" value="124.220.32.217:1883,MES/InstantMessaging/MisServer" />-->
<add key="MqttUrl" value="124.220.15.242:1883,MES/InstantMessaging/SY/MisServer"/>
<add key="MqttTargetTopic" value="MES/InstantMessaging/SY"/>
<add key="MqttTargetTopicPLC" value="MES/InstantMessaging/SY/MisServer"/>
<add key="MqttTargetTopicTagTypeCodeID" value="MES/TagTypeCodeID"/>
<add key="Url_WebApi" value="http://localhost:41186"/>
<add key="ConnectionString_MES" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<!-- ERP数据库连接-->
<add key="ConnectionString_ERP" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<!-- 订单查询脚本-->
<add key="ConnectionString_ERP_Sql_OrderForm" value="select a.fbillno'工单号',a.FID '工单内码',b.FENTRYID '工单分录',bt.FNAME '单据类型',a.fdate '单据日期',org.fname '生产组织',m.FNUMBER '物料代码',m1.FNAME '物料名称',m1.FSPECIFICATION '规格型号',de.FNAME '生产车间',un.FNAME '单位',FBASEUNITQTY '数量',bom.FNUMBER 'BOM版本',b1.FSTATUS '业务状态',b.FPLANSTARTDATE '计划开工时间',b.FPLANFINISHDATE '计划完工时间',
b1.FSTARTDATE '开工时间',b1.FFINISHDATE'完工时间',b1.FREPQUAQTY '基本单位汇报合格数量',b1.FREPQUAAUXQTY '单据单位汇报合格数量 ',b1.FBASERPTFINISHQTY '基本单位汇报完成数量',b1.FRPTFINISHQTY'单据单位汇报完成数量' ,b2.FREMWORKSHOPID '产线'
from T_PRD_MO a
left join T_PRD_MOENTRY b on a.fid=b.fid --生产订单表体
left join T_PRD_MOENTRY_A b1 on b.FID=b1.FID and b.FENTRYID=b1.FENTRYID --生产订单表体
LEFT join T_PRD_MOENTRY_Q b2 on b.FID=b2.FID and b.FENTRYID=b2.FENTRYID --生产订单明细数量表
left join T_ORG_ORGANIZATIONS_L org on org.FORGID=a.FPRDORGID --组织
left join T_BD_MATERIAL m on m.FMATERIALID=b.FMATERIALID --生产订单表体物料信息
left join T_BD_MATERIAL_L m1 on m.FMATERIALID=m1.FMATERIALID
left join T_BD_DEPARTMENT_L de on de.FDEPTID=b.FWORKSHOPID --部门:生产车间
left join T_BD_UNIT_L un on un.FUNITID=b.FBASEUNITID --单位表
left join T_ENG_BOM bom on bom.FID=b.FBOMID --BOM信息
left join T_BAS_BILLTYPE_L bt on bt.FBILLTYPEID=a.FBILLTYPE and bt.FLOCALEID=2052--单据类型"/>
<!-- 配送物料查询脚本-->
<add key="ConnectionString_ERP_Sql_DistributeMaterials" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<!-- 补充物料查询脚本-->
<add key="ConnectionString_ERP_Sql_SupplementaryMaterials" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<add key="ConnectionString_MES0" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<add key="ConnectionString_MES1" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<add key="ConnectionString_MES2" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<add key="ConnectionString_MES3" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<add key="ConnectionString_MES4" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE"/>
<add key="OPName01" value="OP1010|1"/>
<add key="OPName02" value="OP0050|2"/>
<!--扫描枪COM口-->
<add key="PortName" value="COM1"/>
<!--读超时即在1000内未读到数据就引起超时异常-->
<add key="ReadTimeout" value="1000"/>
<!--比特率-->
<add key="BaudRate" value="115200"/>
<!--祛除后尾乱码-->
<add key="ScannerTrim" value="1"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>

View File

@@ -0,0 +1,257 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace CallWebApi
{
public class Post
{
public static string Postring(string url, Dictionary<string, string> dic)
{
string result = "";
//url = "http://172.16.22.15:8000/" + url;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Proxy = null;
req.KeepAlive = false;
#region Post
StringBuilder builder = new StringBuilder();
int i = 0;
foreach (var item in dic)
{
if (i > 0)
builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++;
}
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
#endregion
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
return result;
}
public static string Postring1(string url, string token, Dictionary<string, string> dic)
{
string results = "";
//url = "http://172.16.22.15:8000/" + url;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("Authorization", "Bearer " + token);
StringBuilder builder = new StringBuilder();
int i = 0;
foreach (var item in dic)
{
if (i > 0)
builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++;
}
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
req.ContentLength = data.Length;
try
{
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
results = reader.ReadToEnd();
}
return results;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return e.Message;
throw;
}
}
/// <summary>
/// 西开电器专用
/// </summary>
/// <param name="url"></param>
/// <param name="token"></param>
/// <param name="dic"></param>
/// <returns></returns>
public static string Post_XK(string url, string token, Dictionary<string, string> dic)
{
string results = "";
//url = "http://172.16.22.15:8000/" + url;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("Authorization", "Bearer " + token);
StringBuilder builder = new StringBuilder();
int i = 0;
foreach (var item in dic)
{
if (i > 0)
builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++;
}
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
req.ContentLength = data.Length;
try
{
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
results = reader.ReadToEnd();
}
return results;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return e.Message;
throw;
}
}
public static string MyPost()
{
// var url = "http://192.168.1.224:41190/";
var url = "http://127.0.0.1:41190/";
var controller = "ZSaveTag";
var action = "SelectPage";
Dictionary<string, string> dict = new Dictionary<string, string>();
dict.Add("OpName","");
dict.Add("StartTime", "2022-06-24 00:00:00");
dict.Add("EndTime", "2022-06-30 00:00:00");
dict.Add("PageCurrent", "1");
dict.Add("PageSize", "2");
var reqUrl = url + "/api/" + controller + "/" + action;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(reqUrl);
req.Method = "POST";
req.ContentType = "application/json";
req.Proxy = null;
req.KeepAlive = false;
#region Post
JObject jObject = new JObject();
jObject.Add("OpName", "");
jObject.Add("StartTime", "2022-06-24 00:00:00");
jObject.Add("EndTime", "2022-06-30 00:00:00");
jObject.Add("PageCurrent", "2");
jObject.Add("PageSize", "3");
var jStr = jObject.ToString();
//StringBuilder builder = new StringBuilder();
//int i = 0;
//foreach (var item in dict)
//{
// if (i > 0)
// builder.Append("&");
// builder.AppendFormat("{0}={1}", item.Key, item.Value);
// i++;
//}
//byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
byte[] data = Encoding.UTF8.GetBytes(jStr);
req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
#endregion
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
string result = "";
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
return result;
}
public static string MyPost(string url,string jsonStr)
{
string result = "";
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/json";
req.Proxy = null;
req.KeepAlive = false;
byte[] data = Encoding.UTF8.GetBytes(jsonStr);
req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
Console.WriteLine(result);
}
catch (Exception err)
{
Console.WriteLine("<Error> " + err.Message);
}
return result;
}
}
}

View File

@@ -0,0 +1,32 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CallWebApi
{
internal class Program
{
static void Main(string[] args)
{
Post.MyPost();
var url = "http://localhost:41190/api/ZSaveTag/SelectPage";
JObject jObject = new JObject();
jObject.Add("OpName", "");
jObject.Add("StartTime", "2022-06-24 00:00:00");
jObject.Add("EndTime", "2022-06-30 00:00:00");
jObject.Add("PageCurrent", "2");
jObject.Add("PageSize", "3");
var jStr = jObject.ToString();
Post.MyPost(url, jStr);
Console.ReadKey();
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CallWebApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CallWebApi")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("727a1b50-d83a-4319-bdf6-e923f4bd41b3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
</packages>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C7C5E929-BE10-4ED6-94DB-B8D65E05E52F}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>DatabaseClient</RootNamespace>
<AssemblyName>DatabaseClient</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.19.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.29.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.29\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.116.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.29\lib\net452\Ubiety.Dns.Core.dll</HintPath>
</Reference>
<Reference Include="ZstdNet, Version=1.4.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.29\lib\net452\ZstdNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DBClient.cs" />
<Compile Include="DatabaseFactory.cs" />
<Compile Include="DBClientFactory.cs" />
<Compile Include="GlobalVar.cs" />
<Compile Include="MssqlClient.cs" />
<Compile Include="MysqlClient.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SqliteClient.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="DBClientLog4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
</Target>
</Project>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseClient
{
public abstract class DBClient
{
/// <summary>
/// 根据连接字符串连接
/// </summary>
/// <param name="connString">连接字符串</param>
public abstract void Connect(string connString);
/// <summary>
/// 执行sql查询语句返回DataTable
/// </summary>
/// <param name="sql">查询sql字符串</param>
/// <returns></returns>
public abstract DataTable ExecQuery(string sql);
/// <summary>
/// 执行sql非查询语句返回执行结果
/// </summary>
/// <param name="sql">非查询sql字符串</param>
/// <returns></returns>
public abstract int ExecNonQuery(string sql);
/// <summary>
/// 分页,将原始表分成子表。约束为当前页数和每页记录数
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="originList">原始表</param>
/// <param name="pageSize">每页记录数</param>
/// <param name="currentPage">当前页数</param>
/// <returns></returns>
public static List<T> SplitePage<T>(List<T> originList,int pageSize,int currentPage)
{
List<T> resList = new List<T>();
var numAll = originList.Count;
var numPage = numAll / pageSize + 1;
var start = (currentPage - 1) * pageSize;
var end = start + pageSize;
for (int i = 0; i < originList.Count; i++)
{
var origin = originList[i];
if (i >= start && i < end)
{
resList.Add(origin);
}
}
return resList;
}
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseClient
{
public class DBClientFactory
{
DatabaseFactory factory;
public DBClientFactory(string dbTypeStr)
{
switch (dbTypeStr.ToLower())
{
case "mysql":
{
factory = new MysqlDatabaseFactory();
break;
}
case "sqlite":
{
factory = new SqliteDatabaseFactory();
break;
}
case "mssql":
{
factory = new MssqlDatabaseFactory();
break;
}
default:
{
factory = new MysqlDatabaseFactory();
break;
}
}
}
public DBClient Create()
{
return factory.Create();
}
}
}

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<!-- 控制台日志配置 -->
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<!--<conversionPattern value="%5level [%thread] (%file:%line) - %message%newline" />-->
<conversionPattern value="%date %-5level %thread %logger - %message%newline" />
</layout>
</appender>
<!-- 文件存储日志配置 -->
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<!-- 保存文件的名称 -->
<file value="./log/dbclient.log" />
<appendToFile value="true" />
<!-- 文件的编码方式 -->
<param name="Encoding" value="UTF-8"/>
<!-- 每个文件的大小 -->
<maximumFileSize value="100KB" />
<!-- 保存文件数量 -->
<maxSizeRollBackups value="2" />
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level %thread %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>
</log4net>

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseClient
{
public abstract class DatabaseFactory
{
public abstract DBClient Create();
}
class MysqlDatabaseFactory : DatabaseFactory
{
public override DBClient Create()
{
return new MysqlClient();
}
}
class SqliteDatabaseFactory : DatabaseFactory
{
public override DBClient Create()
{
return new SqliteClient();
}
}
class MssqlDatabaseFactory : DatabaseFactory
{
public override DBClient Create()
{
return new MssqlClient();
}
}
}

View File

@@ -0,0 +1,9 @@
using log4net;
namespace DatabaseClient
{
class GlobalVar
{
public static ILog log = LogManager.GetLogger("DBClient");
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.Data;
using System.Data.SqlClient;
namespace DatabaseClient
{
class MssqlClient : DBClient
{
SqlConnection conn = null;
public MssqlClient(){}
public override void Connect(string connString)
{
try
{
conn = new SqlConnection(connString);
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
}
public override DataTable ExecQuery(string sql)
{
DataTable dt = null;
try
{
if (conn != null)
{
conn.Open();
var cmd = new SqlCommand(sql, conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
conn.Close();
if (ds.Tables.Count > 0)
{
dt = ds.Tables[0];
}
}
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
return dt;
}
public override int ExecNonQuery(string sql)
{
int res = 0;
try
{
if (conn!=null)
{
var cmd = new SqlCommand(sql, conn);
conn.Open();
res = cmd.ExecuteNonQuery();
conn.Close();
}
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
return res;
}
}
}

View File

@@ -0,0 +1,126 @@
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseClient
{
public class MysqlClient : DBClient
{
MySqlConnection conn;
public MysqlClient() { }
public override void Connect(string connString)
{
try
{
conn = new MySqlConnection(connString);
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
}
public override DataTable ExecQuery(string sql)
{
DataTable dt = null;
try
{
if (conn != null)
{
conn.Open();
MySqlCommand command = new MySqlCommand(sql, conn);
MySqlDataAdapter da = new MySqlDataAdapter(command);
DataSet ds = new DataSet();
da.Fill(ds);
conn.Close();
if (ds.Tables.Count > 0)
{
dt = ds.Tables[0];
}
}
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
return dt;
}
public override int ExecNonQuery(string sql)
{
int res = 0;
try
{
if (conn != null)
{
conn.Open();
MySqlCommand command = new MySqlCommand(sql, conn);
res = command.ExecuteNonQuery();
conn.Close();
}
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
return res;
}
public static bool ExecQueryDataTable(string sql,string ConnectStr,out DataTable dt, out string err)
{
bool success = false;
err = "";
dt = null;
using (MySqlConnection conn = new MySqlConnection(ConnectStr))
{
try
{
conn.Open();
MySqlCommand command = new MySqlCommand(sql, conn);
MySqlDataAdapter da = new MySqlDataAdapter(command);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables.Count > 0)
{
dt = ds.Tables[0];
}
success = true;
}
catch (Exception er)
{
err = er.Message;
}
finally
{
if (conn != null)
{
conn.Close();
}
}
}
return success;
}
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseClient
{
internal class Program
{
static void Main(string[] args)
{
// TestSqlite();
TestMysql();
//TestMssql();
Console.ReadKey();
}
static void TestSqlite()
{
var sqlClient = new DBClientFactory("Sqlite").Create();
sqlClient.Connect("Data Source=mytest.sqlite;Version=3;");
var ds = sqlClient.ExecQuery("select * from Z_Save_Position");
}
static void TestMysql()
{
var sqlClient = new DBClientFactory("Mysql").Create();
sqlClient.Connect("server=192.168.1.204;port=33060;database=zkeco;username=mesuser;password=Mes147258;");
var ds = sqlClient.ExecQuery("select * from vw_mes_userinfo;");
}
static void TestMssql()
{
var sqlClient = new DBClientFactory("Mssql").Create();
sqlClient.Connect(@"server=.\WINCC;database=MW_DataFactory_App_Add;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000");
var ds = sqlClient.ExecQuery("select * from ProjectList");
}
}
}

View File

@@ -0,0 +1,38 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Database")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Database")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c7c5e929-be10-4ed6-94db-b8d65e05e52f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "DBClientLog4net.config", Watch = true)]

View File

@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SQLite;
namespace DatabaseClient
{
class SqliteClient : DBClient
{
SQLiteConnection conn;
public SqliteClient() { }
public override void Connect(string connString)
{
try
{
conn = new SQLiteConnection(connString);
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
}
public override int ExecNonQuery(string sql)
{
int res = 0;
try
{
if (conn!=null)
{
conn.Open();
var cmd = new SQLiteCommand(sql, conn);
res = cmd.ExecuteNonQuery();
conn.Close();
}
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
return res;
}
public override DataTable ExecQuery(string sql)
{
DataTable dt = null;
try
{
if (conn!=null)
{
conn.Open();
var cmd = new SQLiteCommand(sql, conn);
SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
conn.Close();
if (ds.Tables.Count > 0)
{
dt = ds.Tables[0];
}
}
}
catch (Exception err)
{
GlobalVar.log.Error(err.Message);
}
return dt;
}
}
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net461" />
<package id="Google.Protobuf" version="3.19.4" targetFramework="net461" />
<package id="K4os.Compression.LZ4" version="1.2.6" targetFramework="net461" />
<package id="K4os.Compression.LZ4.Streams" version="1.2.6" targetFramework="net461" />
<package id="K4os.Hash.xxHash" version="1.0.6" targetFramework="net461" />
<package id="MySql.Data" version="8.0.29" targetFramework="net461" requireReinstallation="true" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.116.0" targetFramework="net461" />
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
<package id="System.Data.SQLite.Core" version="1.0.116.0" targetFramework="net461" />
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
<package id="log4net" version="2.0.14" targetFramework="net461" />
</packages>

View File

@@ -0,0 +1,48 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "03_CallWebApi", "CallWebApi\03_CallWebApi.csproj", "{727A1B50-D83A-4319-BDF6-E923F4BD41B3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{157C56BA-4D67-4ED0-B3D6-6D29888D81B9}"
ProjectSection(SolutionItems) = preProject
ReadMe.md = ReadMe.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExternalDataSync", "SlMesDbIterface\ExternalDataSync.csproj", "{2F33D79D-1DFF-4CDA-B357-FCD5221CAB9A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01_DatabaseClient", "DatabaseClient\01_DatabaseClient.csproj", "{C7C5E929-BE10-4ED6-94DB-B8D65E05E52F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "00_MyLog4Net", "MyLog4Net\00_MyLog4Net.csproj", "{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{727A1B50-D83A-4319-BDF6-E923F4BD41B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{727A1B50-D83A-4319-BDF6-E923F4BD41B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{727A1B50-D83A-4319-BDF6-E923F4BD41B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{727A1B50-D83A-4319-BDF6-E923F4BD41B3}.Release|Any CPU.Build.0 = Release|Any CPU
{2F33D79D-1DFF-4CDA-B357-FCD5221CAB9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F33D79D-1DFF-4CDA-B357-FCD5221CAB9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F33D79D-1DFF-4CDA-B357-FCD5221CAB9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F33D79D-1DFF-4CDA-B357-FCD5221CAB9A}.Release|Any CPU.Build.0 = Release|Any CPU
{C7C5E929-BE10-4ED6-94DB-B8D65E05E52F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7C5E929-BE10-4ED6-94DB-B8D65E05E52F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7C5E929-BE10-4ED6-94DB-B8D65E05E52F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7C5E929-BE10-4ED6-94DB-B8D65E05E52F}.Release|Any CPU.Build.0 = Release|Any CPU
{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0AADB308-CA83-444C-BB95-7C628DA904BB}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyLog4Net</RootNamespace>
<AssemblyName>MyLog4Net</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyLogEventArgs.cs" />
<Compile Include="MyLogHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyLog4Net
{
public class MyLogEventArgs : EventArgs
{
public string Message { get; set; }
public string Module { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
using log4net;
using System;
namespace MyLog4Net
{
public class MyLogHelper
{
public delegate void MyLogEventHandler(object sender, MyLogEventArgs e);
public static event MyLogEventHandler LogCommit;
/// <summary>
/// 普通日志
/// </summary>
/// <param name="message">日志内容</param>
public static void Info(string module, string message)
{
ILog log = LogManager.GetLogger(module);
if (log.IsInfoEnabled)
{
log.Info(message);
var e = new MyLogEventArgs();
e.Module = module;
e.Message = message;
LogCommit?.Invoke(null, e);
}
}
/// <summary>
/// 错误日志带异常
/// </summary>
/// <param name="message">错误日志</param>
public static void Error(string module, string message, Exception ex)
{
ILog log = LogManager.GetLogger(module);
if (log.IsErrorEnabled)
{
log.Error(message, ex);
var e = new MyLogEventArgs();
e.Module = module;
e.Message = message;
LogCommit?.Invoke(null, e);
}
}
/// <summary>
/// 错误日志不带异常
/// </summary>
/// <param name="message">错误日志</param>
public static void Error(string module, string message)
{
ILog log = LogManager.GetLogger(module);
if (log.IsErrorEnabled)
{
log.Error(message);
var e = new MyLogEventArgs();
e.Module = module;
e.Message = message;
LogCommit?.Invoke(null, e);
}
}
}
}

View File

@@ -0,0 +1,37 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Log4Net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Log4Net")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1dc48c83-1842-4de8-acaf-26e1e7f7c58f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<!-- 控制台日志配置 -->
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<!--<conversionPattern value="%5level [%thread] (%file:%line) - %message%newline" />-->
<conversionPattern value="%date %-5level %thread %logger - %message%newline" />
</layout>
</appender>
<!-- 文件存储日志配置 -->
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<!-- 保存文件的名称 -->
<file value="./log/log.log" />
<appendToFile value="true" />
<!-- 文件的编码方式 -->
<param name="Encoding" value="UTF-8"/>
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
<!-- 每个文件的大小 -->
<maximumFileSize value="10000KB" />
<!-- 保存文件数量 -->
<maxSizeRollBackups value="2" />
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level %thread %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>
</log4net>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.14" targetFramework="net461" />
</packages>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="baseResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>ExternalDataSync.ESB_base.baseResponse, Connected Services.ESB_base.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="interfaceResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>ExternalDataSync.ESB_base.interfaceResponse, Connected Services.ESB_base.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,497 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace ExternalDataSync.ESB_base {
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://zk.ws.epichust.com/", ConfigurationName="ESB_base.UrmRsBaseInterface")]
public interface UrmRsBaseInterface {
// CODEGEN: 参数“return”需要其他方案信息使用参数模式无法捕获这些信息。特定特性为“System.Xml.Serialization.XmlElementAttribute”。
[System.ServiceModel.OperationContractAttribute(Action="", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
[return: System.ServiceModel.MessageParameterAttribute(Name="return")]
ExternalDataSync.ESB_base.baseResponse @base(ExternalDataSync.ESB_base.@base request);
[System.ServiceModel.OperationContractAttribute(Action="", ReplyAction="*")]
System.Threading.Tasks.Task<ExternalDataSync.ESB_base.baseResponse> baseAsync(ExternalDataSync.ESB_base.@base request);
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4161.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://zk.ws.epichust.com/")]
public partial class interfaceRequestHeader : object, System.ComponentModel.INotifyPropertyChanged {
private string interfaceIDField;
private string messageIDField;
private string receiverField;
private string senderField;
private string transIDField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
public string interfaceID {
get {
return this.interfaceIDField;
}
set {
this.interfaceIDField = value;
this.RaisePropertyChanged("interfaceID");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
public string messageID {
get {
return this.messageIDField;
}
set {
this.messageIDField = value;
this.RaisePropertyChanged("messageID");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
public string receiver {
get {
return this.receiverField;
}
set {
this.receiverField = value;
this.RaisePropertyChanged("receiver");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
public string sender {
get {
return this.senderField;
}
set {
this.senderField = value;
this.RaisePropertyChanged("sender");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=4)]
public string transID {
get {
return this.transIDField;
}
set {
this.transIDField = value;
this.RaisePropertyChanged("transID");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4161.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://zk.ws.epichust.com/")]
public partial class interfaceResponse : object, System.ComponentModel.INotifyPropertyChanged {
private string commentField;
private string interfaceIDField;
private string messageIDField;
private string resultCodeField;
private string resultMessageField;
private string resultTypeField;
private string transIDField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
public string comment {
get {
return this.commentField;
}
set {
this.commentField = value;
this.RaisePropertyChanged("comment");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
public string interfaceID {
get {
return this.interfaceIDField;
}
set {
this.interfaceIDField = value;
this.RaisePropertyChanged("interfaceID");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
public string messageID {
get {
return this.messageIDField;
}
set {
this.messageIDField = value;
this.RaisePropertyChanged("messageID");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
public string resultCode {
get {
return this.resultCodeField;
}
set {
this.resultCodeField = value;
this.RaisePropertyChanged("resultCode");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=4)]
public string resultMessage {
get {
return this.resultMessageField;
}
set {
this.resultMessageField = value;
this.RaisePropertyChanged("resultMessage");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=5)]
public string resultType {
get {
return this.resultTypeField;
}
set {
this.resultTypeField = value;
this.RaisePropertyChanged("resultType");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=6)]
public string transID {
get {
return this.transIDField;
}
set {
this.transIDField = value;
this.RaisePropertyChanged("transID");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4161.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://zk.ws.epichust.com/")]
public partial class rsBaseInfoTo : object, System.ComponentModel.INotifyPropertyChanged {
private string alarmDateField;
private string equipCodeField;
private string siteField;
private string toolCodeField;
private string toolDownProdutionField;
private string toolDownReasonField;
private string toolDownResidualField;
private string toolDownTypeField;
private string workCellCodeField;
private string workCenterField;
private string tNumberField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
public string alarmDate {
get {
return this.alarmDateField;
}
set {
this.alarmDateField = value;
this.RaisePropertyChanged("alarmDate");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
public string equipCode {
get {
return this.equipCodeField;
}
set {
this.equipCodeField = value;
this.RaisePropertyChanged("equipCode");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
public string site {
get {
return this.siteField;
}
set {
this.siteField = value;
this.RaisePropertyChanged("site");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
public string toolCode {
get {
return this.toolCodeField;
}
set {
this.toolCodeField = value;
this.RaisePropertyChanged("toolCode");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=4)]
public string toolDownProdution {
get {
return this.toolDownProdutionField;
}
set {
this.toolDownProdutionField = value;
this.RaisePropertyChanged("toolDownProdution");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=5)]
public string toolDownReason {
get {
return this.toolDownReasonField;
}
set {
this.toolDownReasonField = value;
this.RaisePropertyChanged("toolDownReason");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=6)]
public string toolDownResidual {
get {
return this.toolDownResidualField;
}
set {
this.toolDownResidualField = value;
this.RaisePropertyChanged("toolDownResidual");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=7)]
public string toolDownType {
get {
return this.toolDownTypeField;
}
set {
this.toolDownTypeField = value;
this.RaisePropertyChanged("toolDownType");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=8)]
public string workCellCode {
get {
return this.workCellCodeField;
}
set {
this.workCellCodeField = value;
this.RaisePropertyChanged("workCellCode");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=9)]
public string workCenter {
get {
return this.workCenterField;
}
set {
this.workCenterField = value;
this.RaisePropertyChanged("workCenter");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=10)]
public string tNumber {
get {
return this.tNumberField;
}
set {
this.tNumberField = value;
this.RaisePropertyChanged("tNumber");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="base", WrapperNamespace="http://zk.ws.epichust.com/", IsWrapped=true)]
public partial class @base {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://zk.ws.epichust.com/", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ExternalDataSync.ESB_base.interfaceRequestHeader arg0;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://zk.ws.epichust.com/", Order=1)]
[System.Xml.Serialization.XmlElementAttribute("arg1", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ExternalDataSync.ESB_base.rsBaseInfoTo[] arg1;
public @base() {
}
public @base(ExternalDataSync.ESB_base.interfaceRequestHeader arg0, ExternalDataSync.ESB_base.rsBaseInfoTo[] arg1) {
this.arg0 = arg0;
this.arg1 = arg1;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="baseResponse", WrapperNamespace="http://zk.ws.epichust.com/", IsWrapped=true)]
public partial class baseResponse {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://zk.ws.epichust.com/", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ExternalDataSync.ESB_base.interfaceResponse @return;
public baseResponse() {
}
public baseResponse(ExternalDataSync.ESB_base.interfaceResponse @return) {
this.@return = @return;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface UrmRsBaseInterfaceChannel : ExternalDataSync.ESB_base.UrmRsBaseInterface, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class UrmRsBaseInterfaceClient : System.ServiceModel.ClientBase<ExternalDataSync.ESB_base.UrmRsBaseInterface>, ExternalDataSync.ESB_base.UrmRsBaseInterface {
public UrmRsBaseInterfaceClient() {
}
public UrmRsBaseInterfaceClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public UrmRsBaseInterfaceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public UrmRsBaseInterfaceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public UrmRsBaseInterfaceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
ExternalDataSync.ESB_base.baseResponse ExternalDataSync.ESB_base.UrmRsBaseInterface.@base(ExternalDataSync.ESB_base.@base request) {
return base.Channel.@base(request);
}
public ExternalDataSync.ESB_base.interfaceResponse @base(ExternalDataSync.ESB_base.interfaceRequestHeader arg0, ExternalDataSync.ESB_base.rsBaseInfoTo[] arg1) {
ExternalDataSync.ESB_base.@base inValue = new ExternalDataSync.ESB_base.@base();
inValue.arg0 = arg0;
inValue.arg1 = arg1;
ExternalDataSync.ESB_base.baseResponse retVal = ((ExternalDataSync.ESB_base.UrmRsBaseInterface)(this)).@base(inValue);
return retVal.@return;
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
System.Threading.Tasks.Task<ExternalDataSync.ESB_base.baseResponse> ExternalDataSync.ESB_base.UrmRsBaseInterface.baseAsync(ExternalDataSync.ESB_base.@base request) {
return base.Channel.baseAsync(request);
}
public System.Threading.Tasks.Task<ExternalDataSync.ESB_base.baseResponse> baseAsync(ExternalDataSync.ESB_base.interfaceRequestHeader arg0, ExternalDataSync.ESB_base.rsBaseInfoTo[] arg1) {
ExternalDataSync.ESB_base.@base inValue = new ExternalDataSync.ESB_base.@base();
inValue.arg0 = arg0;
inValue.arg1 = arg1;
return ((ExternalDataSync.ESB_base.UrmRsBaseInterface)(this)).baseAsync(inValue);
}
}
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<ReferenceGroup xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="1f8b6301-1922-44ce-89fd-364583baf9f8" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
<ClientOptions>
<GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
<GenerateTaskBasedAsynchronousMethod>true</GenerateTaskBasedAsynchronousMethod>
<EnableDataBinding>true</EnableDataBinding>
<ExcludedTypes />
<ImportXmlTypes>false</ImportXmlTypes>
<GenerateInternalTypes>false</GenerateInternalTypes>
<GenerateMessageContracts>false</GenerateMessageContracts>
<NamespaceMappings />
<CollectionMappings />
<GenerateSerializableTypes>true</GenerateSerializableTypes>
<Serializer>Auto</Serializer>
<UseSerializerForFaults>true</UseSerializerForFaults>
<ReferenceAllAssemblies>true</ReferenceAllAssemblies>
<ReferencedAssemblies />
<ReferencedDataContractTypes />
<ServiceContractMappings />
</ClientOptions>
<MetadataSources>
<MetadataSource Address="http://10.6.201.184:8011/CDMOM/COMMON/COMMON2CDMOM_CutterDownInfo/ProxyServices/CutterDownInfoPS?wsdl" Protocol="http" SourceId="1" />
</MetadataSources>
<Metadata>
<MetadataFile FileName="urmRsBaseInterface.wsdl" MetadataType="Wsdl" ID="ee63af35-b73d-4d37-84c4-160ca34d6f7f" SourceId="1" SourceUrl="http://10.6.201.184:8011/CDMOM/COMMON/COMMON2CDMOM_CutterDownInfo/ProxyServices/CutterDownInfoPS?wsdl" />
<MetadataFile FileName="UrmRsBaseInterface2.wsdl" MetadataType="Wsdl" ID="dde62159-70e0-461f-bcea-d9cbff0ecd19" SourceId="1" SourceUrl="http://10.6.201.184:8011/CDMOM/COMMON/COMMON2CDMOM_CutterDownInfo/ProxyServices/CutterDownInfoPS?WSDL%2FCDMOM%2FCOMMON%2FCOMMON2CDMOM_CutterDownInfo%2FWSDLs%2FWSDL_974124712" />
</Metadata>
<Extensions>
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />
<ExtensionFile FileName="configuration.svcinfo" Name="configuration.svcinfo" />
</Extensions>
</ReferenceGroup>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<WL5G3N0:definitions xmlns:WL5G3N1="http://zk.ws.epichust.com/" name="UrmRsBaseInterface" targetNamespace="http://zk.ws.epichust.com/" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/">
<WL5G3N0:types>
<xs:schema xmlns:tns="http://zk.ws.epichust.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://zk.ws.epichust.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" elementFormDefault="unqualified" targetNamespace="http://zk.ws.epichust.com/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsd:element name="base" type="ns1:base" />
<xsd:element name="baseResponse" type="ns1:baseResponse" />
<xsd:complexType name="base">
<xsd:sequence>
<xsd:element minOccurs="0" name="arg0" type="ns1:interfaceRequestHeader" />
<xsd:element minOccurs="0" maxOccurs="unbounded" name="arg1" type="ns1:rsBaseInfoTo" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="interfaceRequestHeader">
<xsd:sequence>
<xsd:element minOccurs="0" name="interfaceID" type="xsd:string" />
<xsd:element minOccurs="0" name="messageID" type="xsd:string" />
<xsd:element minOccurs="0" name="receiver" type="xsd:string" />
<xsd:element minOccurs="0" name="sender" type="xsd:string" />
<xsd:element minOccurs="0" name="transID" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="rsBaseInfoTo">
<xsd:sequence>
<xsd:element minOccurs="0" name="alarmDate" type="xsd:string" />
<xsd:element minOccurs="0" name="equipCode" type="xsd:string" />
<xsd:element minOccurs="0" name="site" type="xsd:string" />
<xsd:element minOccurs="0" name="toolCode" type="xsd:string" />
<xsd:element minOccurs="0" name="toolDownProdution" type="xsd:string" />
<xsd:element minOccurs="0" name="toolDownReason" type="xsd:string" />
<xsd:element minOccurs="0" name="toolDownResidual" type="xsd:string" />
<xsd:element minOccurs="0" name="toolDownType" type="xsd:string" />
<xsd:element minOccurs="0" name="workCellCode" type="xsd:string" />
<xsd:element minOccurs="0" name="workCenter" type="xsd:string" />
<xsd:element minOccurs="0" name="tNumber" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="baseResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" type="ns1:interfaceResponse" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="interfaceResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="comment" type="xsd:string" />
<xsd:element minOccurs="0" name="interfaceID" type="xsd:string" />
<xsd:element minOccurs="0" name="messageID" type="xsd:string" />
<xsd:element minOccurs="0" name="resultCode" type="xsd:string" />
<xsd:element minOccurs="0" name="resultMessage" type="xsd:string" />
<xsd:element minOccurs="0" name="resultType" type="xsd:string" />
<xsd:element minOccurs="0" name="transID" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xs:schema>
</WL5G3N0:types>
<WL5G3N0:message name="baseResponse">
<WL5G3N0:part name="parameters" element="WL5G3N1:baseResponse" />
</WL5G3N0:message>
<WL5G3N0:message name="base">
<WL5G3N0:part name="parameters" element="WL5G3N1:base" />
</WL5G3N0:message>
<WL5G3N0:portType name="UrmRsBaseInterface">
<WL5G3N0:operation name="base">
<WL5G3N0:input name="base" message="WL5G3N1:base" />
<WL5G3N0:output name="baseResponse" message="WL5G3N1:baseResponse" />
</WL5G3N0:operation>
</WL5G3N0:portType>
</WL5G3N0:definitions>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configurationSnapshot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
<behaviors />
<bindings>
<binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data name=&quot;urmRsBaseInterfaceSoapBinding&quot; /&gt;" bindingType="basicHttpBinding" name="urmRsBaseInterfaceSoapBinding" />
</bindings>
<endpoints>
<endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;http://10.6.201.184:8011/CDMOM/COMMON/COMMON2CDMOM_CutterDownInfo/ProxyServices/CutterDownInfoPS&quot; binding=&quot;basicHttpBinding&quot; bindingConfiguration=&quot;urmRsBaseInterfaceSoapBinding&quot; contract=&quot;ESB_base.UrmRsBaseInterface&quot; name=&quot;UrmRsBaseInterfaceImplPort&quot; /&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;http://10.6.201.184:8011/CDMOM/COMMON/COMMON2CDMOM_CutterDownInfo/ProxyServices/CutterDownInfoPS&quot; binding=&quot;basicHttpBinding&quot; bindingConfiguration=&quot;urmRsBaseInterfaceSoapBinding&quot; contract=&quot;ESB_base.UrmRsBaseInterface&quot; name=&quot;UrmRsBaseInterfaceImplPort&quot; /&gt;" contractName="ESB_base.UrmRsBaseInterface" name="UrmRsBaseInterfaceImplPort" />
</endpoints>
</configurationSnapshot>

View File

@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="utf-8"?>
<SavedWcfConfigurationInformation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="9.1" CheckSum="d99Hcz2F9QvRcS+TTNv/IDtI7W/OO0fLCzdQ+ny9pfs=">
<bindingConfigurations>
<bindingConfiguration bindingType="basicHttpBinding" name="urmRsBaseInterfaceSoapBinding">
<properties>
<property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>urmRsBaseInterfaceSoapBinding</serializedValue>
</property>
<property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>StrongWildcard</serializedValue>
</property>
<property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/maxBufferSize" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>65536</serializedValue>
</property>
<property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue>
</property>
<property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>0</serializedValue>
</property>
<property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>0</serializedValue>
</property>
<property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>0</serializedValue>
</property>
<property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>0</serializedValue>
</property>
<property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>0</serializedValue>
</property>
<property path="/textEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.Text.Encoding, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.Text.UTF8Encoding</serializedValue>
</property>
<property path="/transferMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.TransferMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Buffered</serializedValue>
</property>
<property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Text</serializedValue>
</property>
<property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.BasicHttpSecurityElement</serializedValue>
</property>
<property path="/security/mode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpSecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>None</serializedValue>
</property>
<property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.HttpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.HttpTransportSecurityElement</serializedValue>
</property>
<property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>None</serializedValue>
</property>
<property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>None</serializedValue>
</property>
<property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue>
</property>
<property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Never</serializedValue>
</property>
<property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>TransportSelected</serializedValue>
</property>
<property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>(集合)</serializedValue>
</property>
<property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpMessageSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.BasicHttpMessageSecurityElement</serializedValue>
</property>
<property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpMessageCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>UserName</serializedValue>
</property>
<property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Default</serializedValue>
</property>
</properties>
</bindingConfiguration>
</bindingConfigurations>
<endpoints>
<endpoint name="UrmRsBaseInterfaceImplPort" contract="ESB_base.UrmRsBaseInterface" bindingType="basicHttpBinding" address="http://10.6.201.184:8011/CDMOM/COMMON/COMMON2CDMOM_CutterDownInfo/ProxyServices/CutterDownInfoPS" bindingConfiguration="urmRsBaseInterfaceSoapBinding">
<properties>
<property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>http://10.6.201.184:8011/CDMOM/COMMON/COMMON2CDMOM_CutterDownInfo/ProxyServices/CutterDownInfoPS</serializedValue>
</property>
<property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>basicHttpBinding</serializedValue>
</property>
<property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>urmRsBaseInterfaceSoapBinding</serializedValue>
</property>
<property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>ESB_base.UrmRsBaseInterface</serializedValue>
</property>
<property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue>
</property>
<property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>&lt;Header /&gt;</serializedValue>
</property>
<property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue>
</property>
<property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue>
</property>
<property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue>
</property>
<property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue>
</property>
<property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue>
</property>
<property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue>
</property>
<property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue>
</property>
<property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>My</serializedValue>
</property>
<property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>LocalMachine</serializedValue>
</property>
<property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>FindBySubjectDistinguishedName</serializedValue>
</property>
<property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>False</serializedValue>
</property>
<property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>UrmRsBaseInterfaceImplPort</serializedValue>
</property>
<property path="/kind" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
<property path="/endpointConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
</properties>
</endpoint>
</endpoints>
</SavedWcfConfigurationInformation>

Some files were not shown because too many files have changed in this diff Show More