chore: 初始化平芝126KV断路器线程序
This commit is contained in:
25
Common/09MesDataFunction/MesDataFunction.sln
Normal file
25
Common/09MesDataFunction/MesDataFunction.sln
Normal 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
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -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 "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:屏蔽MES;1:启用MES(必须MIS)
|
||||
//79 通过线体工位PC实现下达工位工作状态:工位有三种状态:在线、离线、屏蔽。在线;0正常状态,实现正常功能。1离线:2屏蔽。(必须MIS)
|
||||
//41 机体流向标志(1 BYTE):0普通工位: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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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=1,MES合格放行MES0.5=0,MES0.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=1,MES合格放行MES0.5=1,MES0.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,
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
128
Common/09MesDataFunction/MesDataFunction/LoadTagTypeCodeID.cs
Normal file
128
Common/09MesDataFunction/MesDataFunction/LoadTagTypeCodeID.cs
Normal 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]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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大屏幕(1,2,3,4)
|
||||
/// </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大屏幕(1,2,3,4)
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -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>
|
||||
/// 工位三种状态:在线、离线、屏蔽(0,1,2)(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,复位设备(MES)DBX0.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
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
41
Common/09MesDataFunction/MesDataFunction/MesWorkPlc.cs
Normal file
41
Common/09MesDataFunction/MesDataFunction/MesWorkPlc.cs
Normal 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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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=1,MES合格放行MES0.5=0,MES0.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=1,MES合格放行MES0.5=1,MES0.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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;//托盘号
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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")]
|
||||
24
Common/09MesDataFunction/MesDataFunction/ToPrinter/PP.cs
Normal file
24
Common/09MesDataFunction/MesDataFunction/ToPrinter/PP.cs
Normal 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; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
61
Common/MyLog4Net/00_MyLog4Net.csproj
Normal file
61
Common/MyLog4Net/00_MyLog4Net.csproj
Normal 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>
|
||||
14
Common/MyLog4Net/MyLogEventArgs.cs
Normal file
14
Common/MyLog4Net/MyLogEventArgs.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
65
Common/MyLog4Net/MyLogHelper.cs
Normal file
65
Common/MyLog4Net/MyLogHelper.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
37
Common/MyLog4Net/Properties/AssemblyInfo.cs
Normal file
37
Common/MyLog4Net/Properties/AssemblyInfo.cs
Normal 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)]
|
||||
35
Common/MyLog4Net/log4net.config
Normal file
35
Common/MyLog4Net/log4net.config
Normal 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>
|
||||
4
Common/MyLog4Net/packages.config
Normal file
4
Common/MyLog4Net/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net461" />
|
||||
</packages>
|
||||
BIN
MES基础数据.xlsx
Normal file
BIN
MES基础数据.xlsx
Normal file
Binary file not shown.
BIN
Mes32X32.ico
Normal file
BIN
Mes32X32.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
88
MisDataFun.sln
Normal file
88
MisDataFun.sln
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33205.214
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MisDataFun", "MisDataFun\MisDataFun\MisDataFun.csproj", "{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01-MesDataFunction", "Common\09MesDataFunction\MesDataFunction\01-MesDataFunction.csproj", "{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Function", "Function", "{4BF576F8-7AFE-41D3-A998-2AE62375DEC6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "00_MyLog4Net", "Common\MyLog4Net\00_MyLog4Net.csproj", "{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function1051", "MisDataFunction\Function1051\Function1051.csproj", "{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function1052", "MisDataFunction\Function1052\Function1052.csproj", "{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function1053", "MisDataFunction\Function1053\Function1053.csproj", "{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}.Release|x86.Build.0 = Release|Any CPU
|
||||
{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}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}.Debug|x86.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
|
||||
{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{90E76FB4-646D-45E2-95DB-0B8AB4E465D6}.Release|x86.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}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Debug|x86.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
|
||||
{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}.Release|x86.Build.0 = Release|Any CPU
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}.Release|x86.Build.0 = Release|Any CPU
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
||||
{5FEE5C91-8419-49FF-B2C2-47476F0B8C68} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
||||
{CA8A12C5-7BF0-4489-93FA-180B1C492BBA} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9BB32B35-134E-4853-B853-73A014D416DF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
MisDataFun/MisDataFun/Mes32X32.ico
Normal file
BIN
MisDataFun/MisDataFun/Mes32X32.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
1986
MisDataFun/MisDataFun/MisDataFun.Designer.cs
generated
Normal file
1986
MisDataFun/MisDataFun/MisDataFun.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
1036
MisDataFun/MisDataFun/MisDataFun.cs
Normal file
1036
MisDataFun/MisDataFun/MisDataFun.cs
Normal file
File diff suppressed because it is too large
Load Diff
253
MisDataFun/MisDataFun/MisDataFun.csproj
Normal file
253
MisDataFun/MisDataFun/MisDataFun.csproj
Normal file
@@ -0,0 +1,253 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DD9131C7-BF40-45B0-827A-C5E46FC8A89E}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>MisDataFun</RootNamespace>
|
||||
<AssemblyName>MisDataFun</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\MisDataFun_Exe\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Mes32X32.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="mes_signal_conf\MES_CONF.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="mes_signal_conf\MES_CONF.Designer.cs">
|
||||
<DependentUpon>MES_CONF.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="mes_signal_conf\SqlOperation.cs" />
|
||||
<Compile Include="MisDataFun.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MisDataFun.Designer.cs">
|
||||
<DependentUpon>MisDataFun.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="webApi\Analysis_MOM_Msg.cs" />
|
||||
<Compile Include="webApi\Controller\ipcControll.cs" />
|
||||
<Compile Include="webApi\InitServer.cs" />
|
||||
<Compile Include="webApi\msgResHeader.cs" />
|
||||
<Compile Include="webApi\OnlineCheckData.cs" />
|
||||
<EmbeddedResource Include="mes_signal_conf\MES_CONF.resx">
|
||||
<DependentUpon>MES_CONF.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MisDataFun.resx">
|
||||
<DependentUpon>MisDataFun.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.manifest" />
|
||||
<None Include="jsconfig1.json" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BasicData">
|
||||
<HintPath>..\..\dll_common\BasicData.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BouncyCastle.Crypto">
|
||||
<HintPath>..\..\dll_common\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ConLink, Version=7.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_common\ConLink.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ConLink19">
|
||||
<HintPath>..\..\dll_common\ConLink19.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DataLinkMesWork">
|
||||
<HintPath>..\..\dll_common\DataLinkMesWork.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.7, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_common\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MesControl">
|
||||
<HintPath>..\..\dll_common\MesControl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MesWork.DeviceDriver">
|
||||
<HintPath>..\..\dll_common\MesWork.DeviceDriver.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Owin, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Monitor.MesWork">
|
||||
<HintPath>..\..\dll_common\Monitor.MesWork.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet">
|
||||
<HintPath>..\..\dll_common\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient">
|
||||
<HintPath>..\..\dll_common\MQTTnet.Extensions.ManagedClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\dll_common\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_common\NPOI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OOXML, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_common\NPOI.OOXML.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OpenXml4Net, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_common\NPOI.OpenXml4Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OpenXmlFormats, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_common\NPOI.OpenXmlFormats.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Client">
|
||||
<HintPath>..\..\dll_common\Opc.Ua.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Configuration">
|
||||
<HintPath>..\..\dll_common\Opc.Ua.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Core">
|
||||
<HintPath>..\..\dll_common\Opc.Ua.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpcUaHelper">
|
||||
<HintPath>..\..\dll_common\OpcUaHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data.Linq" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_common\System.Net.Http.Formatting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_fun\System.Net.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_fun\System.Net.WebSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_fun\System.Net.WebSockets.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_fun\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_fun\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_fun\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_fun\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Cors">
|
||||
<HintPath>..\..\dll_common\System.Web.Cors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Http">
|
||||
<HintPath>..\..\dll_common\System.Web.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Cors">
|
||||
<HintPath>..\..\dll_common\System.Web.Http.Cors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.SelfHost">
|
||||
<HintPath>..\..\dll_common\System.Web.Http.SelfHost.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Common\09MesDataFunction\MesDataFunction\01-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>01-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\MyLog4Net\00_MyLog4Net.csproj">
|
||||
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
|
||||
<Name>00_MyLog4Net</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MisDataFunction\Function1051\Function1051.csproj">
|
||||
<Project>{b5a0baa3-c1a7-4aab-9486-2e650adaca7e}</Project>
|
||||
<Name>Function1051</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MisDataFunction\Function1052\Function1052.csproj">
|
||||
<Project>{5fee5c91-8419-49ff-b2c2-47476f0b8c68}</Project>
|
||||
<Name>Function1052</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MisDataFunction\Function1053\Function1053.csproj">
|
||||
<Project>{ca8a12c5-7bf0-4489-93fa-180b1c492bba}</Project>
|
||||
<Name>Function1053</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Mes32X32.ico" />
|
||||
<None Include="Resources\连接状态.png" />
|
||||
<None Include="Resources\断开状态.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
230
MisDataFun/MisDataFun/MisDataFun.resx
Normal file
230
MisDataFun/MisDataFun/MisDataFun.resx
Normal file
@@ -0,0 +1,230 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>22, 12</value>
|
||||
</metadata>
|
||||
<metadata name="选择.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="工位号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="OpCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="OpName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="MesDll.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="PLC.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="PLC代码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="timer_Status.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>267, 7</value>
|
||||
</metadata>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>137, 15</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>36</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQIyAKEgMgChczIA
|
||||
occyAKHqMgChmTIAoTwyAKEJMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQQyAKEvMgChdzIA
|
||||
odYyAKH7MgCh/zIAof8yAKH/MgCh6jIAoacyAKFJMgChEjIAoQAyAKEAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChADIAoQoyAKE+MgChkTIA
|
||||
oeoyAKH+MgCh+TIAoe0yAKH+MgCh/zIAofwyAKH3MgCh/jIAofgyAKHBMgChZDIAoR4yAKEBMgChAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChATIAoRUyAKFcMgChujIA
|
||||
ofEyAKH/MgCh9DIAobcyAKFPMgChfjIAof8yAKH/MgCh5TIAoVUyAKGLMgCh4jIAofwyAKH9MgCh2TIA
|
||||
oYcyAKEoMgChBTIAoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChAjIAoSYyAKF2MgCh0DIA
|
||||
ofcyAKH+MgCh8zIAof8yAKGjMgChDTIAoQAyAKFpMgCh/zIAof8yAKHhMgChHjIAoQIyAKEiMgChbjIA
|
||||
ocoyAKH3MgCh/jIAoeUyAKGfMgChQTIAoQsyAKEAAAAAAAAAAAAAAAAAMgChCDIAoUEyAKGXMgCh4jIA
|
||||
of4yAKH/MgChzzIAoW0yAKFoMgCh+zIAoZcyAKEAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChADIA
|
||||
oQAyAKEBMgChETIAoVAyAKGiMgCh8DIAof8yAKH0MgChuTIAoW0yAKEVMgChADIAoQAyAKG2MgCh7TIA
|
||||
of8yAKHvMgCh7jIAofgyAKFLMgChADIAoTcyAKH1MgChlzIAoQAyAKEAMgChaTIAof8yAKH/MgCh4TIA
|
||||
oR4yAKEAAAAAAAAAAAAAAAAAMgChADIAoQcyAKE4MgChijIAod8yAKH9MgCh+zIAoc4yAKFdMgChADIA
|
||||
of8yAKHlMgChlDIAoToyAKGgMgCh7jIAoSwyAKEAMgChFzIAodgyAKGZMgChADIAoQAyAKFpMgCh/zIA
|
||||
of8yAKHxMgChfDIAoSkyAKEBMgChAAAAAAAAAAAAAAAAADIAoQAyAKECMgChITIAoW8yAKG/MgCh/zIA
|
||||
oZYyAKEAMgCh/zIAoZoyAKEBMgChADIAoZkyAKHSMgChEjIAoQAyAKEGMgChujIAoZoyAKEAMgChADIA
|
||||
oWkyAKH/MgCh/zIAof0yAKH+MgCh4TIAoZIyAKFEMgChDjIAoQAyAKEAAAAAAAAAAAAAAAAAMgChADIA
|
||||
oUIyAKH7MgChlzIAoQAyAKH/MgChlzIAoQAyAKEAMgChmjIAobMyAKEEMgChADIAoQAyAKGcMgChmzIA
|
||||
oQAyAKEAMgChaTIAof8yAKH/MgCh4zIAoZYyAKHRMgCh+zIAofQyAKHDMgChZDIAoSIyAKEBMgChAAAA
|
||||
AAAyAKEAMgChPzIAofsyAKGXMgChADIAof8yAKGXMgChADIAoQAyAKGaMgChiDIAoQAAAAAAMgChADIA
|
||||
oYgyAKGaMgChADIAoQAyAKFpMgCh/zIAof8yAKHhMgChIDIAoRIyAKFeMgChqzIAoe0yAKH+MgCh3jIA
|
||||
oYYyAKEqMgChADIAoQAyAKE/MgCh+zIAoZcyAKEAMgCh/zIAoZcyAKEAMgChADIAoZgyAKFtMgChAAAA
|
||||
AAAyAKEAMgChXDIAoZQyAKEAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChADIAoQAyAKEGMgChMDIA
|
||||
oX8yAKHTMgCh+jIAoWkyAKEAMgChADIAoT8yAKH7MgChlzIAoQAyAKH/MgChlzIAoQAyAKEAMgChlTIA
|
||||
oWMyAKEAAAAAADIAoQAyAKE2MgChhTIAoQAyAKEAMgChaTIAof8yAKH/MgCh4TIAoR4yAKEAAAAAAAAA
|
||||
AAAyAKEAMgChATIAoRUyAKFYMgChQDIAoQAyAKEAMgChPzIAofsyAKGXMgChADIAof8yAKGXMgChADIA
|
||||
oQAyAKGLMgChQTIAoQAyAKEFMgChADIAoSMyAKF4MgChADIAoQAyAKFpMgCh/zIAof8yAKHhMgChHjIA
|
||||
oQAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQAyAKEBMgChADIAoQAyAKE/MgCh+zIAoZcyAKEAMgCh/zIA
|
||||
oZcyAKEAMgChADIAoXcyAKEkMgChBzIAoUIyAKEBMgChFjIAoWUyAKEBMgChADIAoWkyAKH/MgCh/zIA
|
||||
oeEyAKEeMgChADIAoQAyAKE5MgChSTIAoQ8yAKEBMgChAAAAAAAAAAAAMgChADIAoT8yAKH7MgChlzIA
|
||||
oQAyAKH/MgChlzIAoQAyAKECMgChWzIAoQ8yAKEVMgChhTIAoQoyAKEHMgChMzIAoQEyAKEAMgChaTIA
|
||||
of8yAKH/MgCh4TIAoR4yAKEAMgChADIAoWkyAKH1MgChyzIAoX8yAKE4MgChBTIAoQAyAKEAMgChPzIA
|
||||
ofsyAKGXMgChADIAof8yAKGXMgChADIAoQMyAKFZMgChCzIAoS4yAKHDMgChGjIAoQAAAAAAAAAAADIA
|
||||
oQAyAKFpMgCh/zIAof8yAKHhMgChHjIAoQAyAKEAMgChLDIAoaEyAKHkMgCh/DIAoe8yAKGrMgChUzIA
|
||||
oREyAKFBMgCh+zIAoZcyAKEAMgCh/zIAoZcyAKEAMgChBzIAoVAyAKEEMgChQTIAodoyAKEjMgChAAAA
|
||||
AAAAAAAAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChAAAAAAAyAKEAMgChBjIAoSAyAKFyMgChwjIA
|
||||
ofMyAKH4MgCh0zIAobMyAKH9MgChljIAoQAyAKH/MgChlzIAoQAyAKEBMgChBDIAoQAyAKFKMgCh7jIA
|
||||
oT0yAKEAAAAAADIAoQAyAKEAMgChbDIAof8yAKH/MgCh4TIAoR8yAKEAAAAAAAAAAAAAAAAAMgChADIA
|
||||
oQEyAKELMgChRzIAoZYyAKHeMgCh/TIAof8yAKGWMgChADIAof8yAKGXMgChAAAAAAAAAAAAMgChADIA
|
||||
oW0yAKH/MgChZDIAoQAyAKEEMgChHDIAoWAyAKHPMgCh/zIAof8yAKH3MgChkTIAoS8yAKELMgChADIA
|
||||
oQAAAAAAAAAAAAAAAAAyAKEAMgChATIAoSAyAKF2MgCh/zIAoZYyAKEAMgCh/zIAoZcyAKEAAAAAADIA
|
||||
oQAyAKEAMgChljIAof8yAKGeMgChOTIAoZEyAKHcMgCh+TIAof8yAKH/MgCh/zIAof8yAKH+MgCh6jIA
|
||||
obgyAKFXMgChITIAoQEyAKEAAAAAAAAAAAAAAAAAMgChADIAoT8yAKH7MgChlzIAoQAyAKH/MgChlzIA
|
||||
oQAAAAAAMgChADIAoQwyAKG9MgCh/zIAofMyAKHyMgCh/jIAof8yAKH/MgCh/zIAofoyAKH3MgCh/jIA
|
||||
of8yAKH/MgCh/zIAofsyAKHbMgChmzIAoUwyAKENMgChATIAoQAyAKEAMgChPzIAofsyAKGXMgChADIA
|
||||
of8yAKGXMgChATIAoRkyAKFbMgChsTIAofAyAKH/MgCh/zIAof8yAKH/MgCh/DIAoeYyAKGxMgChVTIA
|
||||
oUIyAKGFMgCh1TIAofUyAKH/MgCh/zIAof8yAKH/MgCh9DIAocUyAKGDMgChMDIAoQYyAKE/MgCh+zIA
|
||||
oZcyAKEAMgCh/zIAocEyAKGOMgCh2TIAofcyAKH/MgCh/zIAof8yAKH/MgCh7jIAobMyAKFwMgChJjIA
|
||||
oQoyAKEAMgChADIAoQEyAKEXMgChTTIAoZsyAKHYMgCh/TIAof8yAKH/MgCh/zIAof4yAKHqMgChszIA
|
||||
oZgyAKH+MgChljIAoQAyAKH/MgCh/zIAof8yAKH/MgCh/zIAof8yAKH0MgChyTIAoYEyAKE/MgChBzIA
|
||||
oQAAAAAAMgChADIAoSIyAKF2MgChQjIAoRIyAKEAMgChATIAoR4yAKFjMgChrjIAoecyAKH9MgCh/zIA
|
||||
of8yAKH/MgCh/zIAof8yAKGWMgChADIAof8yAKH/MgCh/zIAofkyAKHWMgChmjIAoUIyAKERMgChATIA
|
||||
oQAyAKEGMgChFTIAoQMyAKEAMgChKDIAoZUyAKHHMgChxjIAoXcyAKE3MgChBzIAoQAyAKEGMgChKTIA
|
||||
oXYyAKHDMgCh7jIAof4yAKH/MgCh/zIAoZYyAKEAMgChrjIAoeYyAKH+MgCh0zIAoVcyAKELMgChADIA
|
||||
oQAyAKEAMgChADIAoVUyAKHAMgChkjIAoVYyAKEUMgChATIAoRYyAKFhMgChqzIAodUyAKGmMgChZTIA
|
||||
oR8yAKEDMgChBDIAoS0yAKGiMgCh9DIAofUyAKHGMgChWTIAoQAyAKEGMgChKjIAoWsyAKHBMgCh3DIA
|
||||
ocEyAKFwMgChJTIAoQYyAKEAMgChDDIAoTgyAKF/MgChyjIAocMyAKGUMgChMzIAoQsyAKEEMgChJjIA
|
||||
oWUyAKG/MgCh0TIAoaYyAKGoMgCh1TIAodYyAKGNMgChQTIAoRAyAKEAMgChAAAAAAAyAKEAMgChADIA
|
||||
oQ8yAKE8MgChkDIAoc8yAKHfMgChpDIAoVIyAKEcMgChADIAoQEyAKETMgChRzIAoZ8yAKHGMgChvzIA
|
||||
oWQyAKEtMgChMzIAoY8yAKHvMgCh5zIAoa8yAKFcMgChHDIAoQMyAKEAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAADIAoQAyAKECMgChFTIAoVcyAKGaMgCh3DIAodEyAKGaMgChSDIAoQsyAKEAMgChATIA
|
||||
oSUyAKGGMgCh6TIAofEyAKHhMgChtzIAoXAyAKErMgChBTIAoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQIyAKElMgChXTIAobgyAKHbMgChxTIA
|
||||
oYUyAKFbMgChqzIAodEyAKHLMgChhDIAoTsyAKELMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChCzIA
|
||||
oTcyAKGTMgCh0zIAofAyAKG2MgChWjIAoRcyAKEBMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAA/+Af//+AB//8AAD/8AAAP8AIAA8AGDABARg+AQEYD4ERGAPxMZgAcTOY
|
||||
ADEzmDAxM5g8MTKIPzEgCDDxIAgwMSB4MAEgeDgBJHg+ATxAD8E8AAHxOAAAMQAAAAEAAwABABwgAQBE
|
||||
BAEBwAABAEAAA+AAAA/4AAB//wAD///gD/8=
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
36
MisDataFun/MisDataFun/Properties/AssemblyInfo.cs
Normal file
36
MisDataFun/MisDataFun/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("MisDataSaveDate")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("大连迈思信息技术有限公司")]
|
||||
[assembly: AssemblyProduct("MisDataSaveDate")]
|
||||
[assembly: AssemblyCopyright("Copyright © 大连迈思信息技术有限公司 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("9aede061-8490-436a-b38b-9495dc908f19")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
83
MisDataFun/MisDataFun/Properties/Resources.Designer.cs
generated
Normal file
83
MisDataFun/MisDataFun/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,83 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MisDataFun.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MisDataFun.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap 断开状态 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("断开状态", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap 连接状态 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("连接状态", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
127
MisDataFun/MisDataFun/Properties/Resources.resx
Normal file
127
MisDataFun/MisDataFun/Properties/Resources.resx
Normal file
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="断开状态" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\断开状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="连接状态" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\连接状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
26
MisDataFun/MisDataFun/Properties/Settings.Designer.cs
generated
Normal file
26
MisDataFun/MisDataFun/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MesServerMisDataFun.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
MisDataFun/MisDataFun/Properties/Settings.settings
Normal file
7
MisDataFun/MisDataFun/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
BIN
MisDataFun/MisDataFun/Resources/断开状态.png
Normal file
BIN
MisDataFun/MisDataFun/Resources/断开状态.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
BIN
MisDataFun/MisDataFun/Resources/连接状态.png
Normal file
BIN
MisDataFun/MisDataFun/Resources/连接状态.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
79
MisDataFun/MisDataFun/app.manifest
Normal file
79
MisDataFun/MisDataFun/app.manifest
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC 清单选项
|
||||
如果想要更改 Windows 用户帐户控制级别,请使用
|
||||
以下节点之一替换 requestedExecutionLevel 节点。
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
|
||||
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
|
||||
元素。
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
|
||||
Windows 版本的列表。取消评论适当的元素,
|
||||
Windows 将自动选择最兼容的环境。 -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
|
||||
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
|
||||
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
|
||||
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
|
||||
|
||||
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
|
||||
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
</assembly>
|
||||
10
MisDataFun/MisDataFun/jsconfig1.json
Normal file
10
MisDataFun/MisDataFun/jsconfig1.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"exclude": [
|
||||
"**/bin",
|
||||
"**/bower_components",
|
||||
"**/jspm_packages",
|
||||
"**/node_modules",
|
||||
"**/obj",
|
||||
"**/platforms"
|
||||
]
|
||||
}
|
||||
113
MisDataFun/MisDataFun/mes_signal_conf/MES_CONF.Designer.cs
generated
Normal file
113
MisDataFun/MisDataFun/mes_signal_conf/MES_CONF.Designer.cs
generated
Normal file
@@ -0,0 +1,113 @@
|
||||
namespace MES_SIGNAL_CONF
|
||||
{
|
||||
partial class MES_CONF
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows 窗体设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btn_ConfigToSql = new System.Windows.Forms.Button();
|
||||
this.label_ReadExcel = new System.Windows.Forms.Label();
|
||||
this.label_WriteSql = new System.Windows.Forms.Label();
|
||||
this.txt_Msg = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btn_ConfigToSql
|
||||
//
|
||||
this.btn_ConfigToSql.Location = new System.Drawing.Point(487, 74);
|
||||
this.btn_ConfigToSql.Name = "btn_ConfigToSql";
|
||||
this.btn_ConfigToSql.Size = new System.Drawing.Size(161, 36);
|
||||
this.btn_ConfigToSql.TabIndex = 0;
|
||||
this.btn_ConfigToSql.Text = "重新将配置写入数据库";
|
||||
this.btn_ConfigToSql.UseVisualStyleBackColor = true;
|
||||
this.btn_ConfigToSql.Click += new System.EventHandler(this.btn_ConfigToSql_Click);
|
||||
//
|
||||
// label_ReadExcel
|
||||
//
|
||||
this.label_ReadExcel.AutoSize = true;
|
||||
this.label_ReadExcel.Location = new System.Drawing.Point(12, 16);
|
||||
this.label_ReadExcel.Name = "label_ReadExcel";
|
||||
this.label_ReadExcel.Size = new System.Drawing.Size(95, 12);
|
||||
this.label_ReadExcel.TabIndex = 1;
|
||||
this.label_ReadExcel.Text = "label_ReadExcel";
|
||||
//
|
||||
// label_WriteSql
|
||||
//
|
||||
this.label_WriteSql.AutoSize = true;
|
||||
this.label_WriteSql.Location = new System.Drawing.Point(12, 42);
|
||||
this.label_WriteSql.Name = "label_WriteSql";
|
||||
this.label_WriteSql.Size = new System.Drawing.Size(89, 12);
|
||||
this.label_WriteSql.TabIndex = 1;
|
||||
this.label_WriteSql.Text = "label_WriteSql";
|
||||
//
|
||||
// txt_Msg
|
||||
//
|
||||
this.txt_Msg.Location = new System.Drawing.Point(14, 116);
|
||||
this.txt_Msg.Multiline = true;
|
||||
this.txt_Msg.Name = "txt_Msg";
|
||||
this.txt_Msg.Size = new System.Drawing.Size(634, 316);
|
||||
this.txt_Msg.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 70);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(335, 36);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "使用到数据库的表:\r\n读取:MES_计划BOM_工位与名称([是否启用MES] = 1)\r\n写入:MES_基本变量_原始数据、MES_基本变量设备类型对应表";
|
||||
this.label1.Click += new System.EventHandler(this.label1_Click);
|
||||
//
|
||||
// MES_CONF
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(660, 437);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.txt_Msg);
|
||||
this.Controls.Add(this.label_WriteSql);
|
||||
this.Controls.Add(this.label_ReadExcel);
|
||||
this.Controls.Add(this.btn_ConfigToSql);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "MES_CONF";
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "MES监控系统信号配置";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btn_ConfigToSql;
|
||||
private System.Windows.Forms.Label label_ReadExcel;
|
||||
private System.Windows.Forms.Label label_WriteSql;
|
||||
private System.Windows.Forms.TextBox txt_Msg;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
|
||||
421
MisDataFun/MisDataFun/mes_signal_conf/MES_CONF.cs
Normal file
421
MisDataFun/MisDataFun/mes_signal_conf/MES_CONF.cs
Normal file
@@ -0,0 +1,421 @@
|
||||
using SlMesDbIterface;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using static System.Configuration.ConfigurationManager;
|
||||
|
||||
namespace MES_SIGNAL_CONF
|
||||
{
|
||||
public partial class MES_CONF : Form
|
||||
{
|
||||
#region 构造函数与初始化
|
||||
|
||||
public MES_CONF()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeLabels();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化界面标签
|
||||
/// </summary>
|
||||
private void InitializeLabels()
|
||||
{
|
||||
label_ReadExcel.Text = $"读取位置:{MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile}";
|
||||
label_WriteSql.Text = $"写入位置:{MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事件处理
|
||||
|
||||
/// <summary>
|
||||
/// 配置导入到SQL按钮点击事件
|
||||
/// </summary>
|
||||
private void btn_ConfigToSql_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
WriteLog("========== 开始导入配置 ==========");
|
||||
LoadOpcData();
|
||||
WriteLog("========== 导入配置完成 ==========");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLog($"✗ 导入失败:{ex.Message}");
|
||||
MessageBox.Show($"配置导入失败!\n{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void label1_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 预留事件
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 主要业务逻辑
|
||||
|
||||
/// <summary>
|
||||
/// 加载OPC数据并导入数据库
|
||||
/// </summary>
|
||||
private void LoadOpcData()
|
||||
{
|
||||
// 1. 加载基础数据
|
||||
WriteLog("正在加载Excel数据...");
|
||||
var excelData = LoadExcelData();
|
||||
|
||||
// 2. 生成标签数据
|
||||
WriteLog("正在生成标签数据...");
|
||||
DataTable dtTag = GenerateTagData(excelData);
|
||||
|
||||
excelData.DeviceTable.TableName = "MES_基本变量设备类型对应表";
|
||||
|
||||
// 3. 保存到数据库
|
||||
WriteLog("正在保存到数据库...");
|
||||
SaveToDatabase(dtTag, excelData.DeviceTable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Excel加载所有基础数据
|
||||
/// </summary>
|
||||
private ExcelDataModel LoadExcelData()
|
||||
{
|
||||
string excelFile = MisDataSaveDate.MesServerMisDataFun.BasicDataTableFile;
|
||||
|
||||
return new ExcelDataModel
|
||||
{
|
||||
StationTable = GetStationData(),
|
||||
TagMesTable = LoadEnabledData(excelFile, "MES_基本变量原始数据"),
|
||||
TagModelTable = LoadEnabledData(excelFile, "MES_信号表模板"),
|
||||
//TagModelKwTable = LoadEnabledData(excelFile, "MES_信号表模板(库位)"),
|
||||
DeviceTable = LoadEnabledData(excelFile, "设备类型对应表")
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载Excel启用数据
|
||||
/// </summary>
|
||||
private DataTable LoadEnabledData(string excelFile, string sheetName)
|
||||
{
|
||||
var rawData = NPOITest.ExeclHelper.ExcelToDataTable(excelFile, sheetName, true);
|
||||
var enabledRows = rawData.Select($"是否启用='1'");
|
||||
|
||||
return enabledRows.Length > 0 ? enabledRows.CopyToDataTable() : rawData.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成标签数据
|
||||
/// </summary>
|
||||
private DataTable GenerateTagData(ExcelDataModel excelData)
|
||||
{
|
||||
DataTable dtTag = excelData.TagModelTable.Clone();
|
||||
|
||||
// 分离库位工位和普通工位
|
||||
var stationData = SplitStationByType(excelData.StationTable, "1");
|
||||
//var stationKw = SplitStationByType(excelData.StationTable, "2");
|
||||
|
||||
// 处理普通工位
|
||||
WriteLog($"处理普通工位数据,共 {stationData.Rows.Count} 个工位");
|
||||
ProcessStations(stationData, excelData.TagModelTable, dtTag);
|
||||
|
||||
//// 处理库位工位
|
||||
//WriteLog($"处理库位工位数据,共 {stationKw.Rows.Count} 个工位");
|
||||
//ProcessStations(stationKw, excelData.TagModelKwTable, dtTag);
|
||||
|
||||
// 合并报警数据
|
||||
MergeAlarmData(dtTag);
|
||||
|
||||
// 合并MES基本变量数据
|
||||
dtTag.Merge(excelData.TagMesTable);
|
||||
|
||||
dtTag.TableName = "MES_基本变量_原始数据";
|
||||
|
||||
WriteLog($"标签数据生成完成,共 {dtTag.Rows.Count} 条记录");
|
||||
return dtTag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按线体类型分离工位数据
|
||||
/// </summary>
|
||||
private DataTable SplitStationByType(DataTable stationTable, string lineType)
|
||||
{
|
||||
string filter = $"线体类型 = '{lineType}'";
|
||||
var rows = stationTable.Select(filter);
|
||||
|
||||
return rows.Length > 0 ? rows.CopyToDataTable() : stationTable.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理工位数据
|
||||
/// </summary>
|
||||
private void ProcessStations(DataTable stations, DataTable tagModel, DataTable targetTag)
|
||||
{
|
||||
foreach (DataRow stationRow in stations.Rows)
|
||||
{
|
||||
var stationInfo = new StationInfo
|
||||
{
|
||||
工位代码 = stationRow["工位代码"].ToString(),
|
||||
工位号 = stationRow["工位号"].ToString(),
|
||||
工位名称 = stationRow["工位名称"].ToString(),
|
||||
PLC = stationRow["PLC"].ToString(),
|
||||
PLC代码 = stationRow["PLC代码"].ToString()
|
||||
};
|
||||
|
||||
DataTable tagCopy = tagModel.Copy();
|
||||
UpdateTagTableByStation(tagCopy, stationInfo);
|
||||
targetTag.Merge(tagCopy);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工位信息更新标签表
|
||||
/// </summary>
|
||||
private void UpdateTagTableByStation(DataTable tagTable, StationInfo stationInfo)
|
||||
{
|
||||
foreach (DataRow row in tagTable.Rows)
|
||||
{
|
||||
// 更新TagID:将****替换为工位代码(补齐4位)
|
||||
string tagId = row["TagID"].ToString();
|
||||
row["TagID"] = tagId.Replace("****", stationInfo.工位代码.PadLeft(4, '0'));
|
||||
|
||||
// 更新工位相关信息
|
||||
row["工位号"] = stationInfo.工位号;
|
||||
row["数据来源"] = stationInfo.工位名称;
|
||||
row["IP"] = stationInfo.PLC;
|
||||
row["DbName"] = stationInfo.PLC代码;
|
||||
|
||||
// 更新监控组
|
||||
row["监控组"] = $"{row["监控组"]}_{stationInfo.工位号}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合并报警数据
|
||||
/// </summary>
|
||||
private void MergeAlarmData(DataTable targetTable)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetAlarmTableData(out DataTable alarmTable);
|
||||
if (alarmTable != null && alarmTable.Rows.Count > 0)
|
||||
{
|
||||
targetTable.Merge(alarmTable, false, MissingSchemaAction.Ignore);
|
||||
WriteLog($"合并报警数据成功,共 {alarmTable.Rows.Count} 条记录");
|
||||
}
|
||||
}
|
||||
catch (DataException ex)
|
||||
{
|
||||
WriteLog($"⚠ 合并报警数据失败:{ex.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据库操作
|
||||
|
||||
/// <summary>
|
||||
/// 使用事务安全保存数据到数据库
|
||||
/// </summary>
|
||||
private void SaveToDatabase(DataTable tagTable, DataTable deviceTable)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES))
|
||||
{
|
||||
conn.Open();
|
||||
SqlTransaction transaction = conn.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
// 1. 创建备份
|
||||
var backupTables = CreateBackupTables(conn, transaction, tagTable.TableName, deviceTable.TableName);
|
||||
|
||||
// 2. 清空原表
|
||||
ClearTables(conn, transaction, tagTable.TableName, deviceTable.TableName);
|
||||
|
||||
// 3. 批量插入新数据
|
||||
BulkInsertData(conn, transaction, tagTable);
|
||||
BulkInsertData(conn, transaction, deviceTable);
|
||||
|
||||
// 4. 提交事务
|
||||
transaction.Commit();
|
||||
WriteLog("✓ 所有操作成功完成,事务已提交");
|
||||
|
||||
// 5. 清理备份表
|
||||
CleanupBackupTables(conn, backupTables);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
transaction.Rollback();
|
||||
WriteLog($"✗ 操作失败,事务已回滚:{ex.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建备份表
|
||||
/// </summary>
|
||||
private string[] CreateBackupTables(SqlConnection conn, SqlTransaction transaction, params string[] tableNames)
|
||||
{
|
||||
string[] backupTables = new string[tableNames.Length];
|
||||
|
||||
for (int i = 0; i < tableNames.Length; i++)
|
||||
{
|
||||
backupTables[i] = $"{tableNames[i]}_Backup_{DateTime.Now:yyyyMMddHHmmss}";
|
||||
ExecuteNonQuery(conn, transaction, $"SELECT * INTO [{backupTables[i]}] FROM [{tableNames[i]}]");
|
||||
WriteLog($"已创建备份表:{backupTables[i]}");
|
||||
}
|
||||
|
||||
return backupTables;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空表数据
|
||||
/// </summary>
|
||||
private void ClearTables(SqlConnection conn, SqlTransaction transaction, params string[] tableNames)
|
||||
{
|
||||
foreach (var tableName in tableNames)
|
||||
{
|
||||
ExecuteNonQuery(conn, transaction, $"DELETE FROM [{tableName}]");
|
||||
WriteLog($"清空数据库表:{tableName}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量插入数据
|
||||
/// </summary>
|
||||
private void BulkInsertData(SqlConnection conn, SqlTransaction transaction, DataTable dataTable)
|
||||
{
|
||||
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(conn, SqlBulkCopyOptions.Default, transaction))
|
||||
{
|
||||
bulkCopy.DestinationTableName = dataTable.TableName;
|
||||
bulkCopy.BatchSize = 1000;
|
||||
bulkCopy.BulkCopyTimeout = 300;
|
||||
bulkCopy.WriteToServer(dataTable);
|
||||
WriteLog($"写入数据库表:{dataTable.TableName},共 {dataTable.Rows.Count} 条记录");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理备份表
|
||||
/// </summary>
|
||||
private void CleanupBackupTables(SqlConnection conn, string[] backupTables)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var backupTable in backupTables)
|
||||
{
|
||||
ExecuteNonQuery(conn, null, $"DROP TABLE [{backupTable}]");
|
||||
}
|
||||
WriteLog("已清理备份表");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLog($"⚠ 清理备份表时出错(不影响主流程):{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行SQL命令
|
||||
/// </summary>
|
||||
private void ExecuteNonQuery(SqlConnection conn, SqlTransaction transaction, string sql)
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn, transaction))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据查询
|
||||
|
||||
/// <summary>
|
||||
/// 获取工位数据
|
||||
/// </summary>
|
||||
private DataTable GetStationData()
|
||||
{
|
||||
string sql = @"
|
||||
SELECT *
|
||||
FROM [MES_计划BOM_工位与名称]
|
||||
WHERE [是否启用MES] = 1
|
||||
ORDER BY [工位号]";
|
||||
|
||||
SqlOperation.ExecuteSql(sql, out DataTable dt, out string error);
|
||||
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
{
|
||||
WriteLog($"⚠ 查询工位数据出错:{error}");
|
||||
}
|
||||
|
||||
return dt ?? new DataTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取报警表数据
|
||||
/// </summary>
|
||||
private void GetAlarmTableData(out DataTable dt)
|
||||
{
|
||||
string sql = @"
|
||||
SELECT *
|
||||
FROM [MES_基本变量_原始数据]
|
||||
WHERE [type] = 9
|
||||
ORDER BY [TagID]";
|
||||
|
||||
SqlOperation.ExecuteSql(sql, out dt, out string error);
|
||||
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
{
|
||||
WriteLog($"⚠ 查询报警数据出错:{error}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 辅助方法
|
||||
|
||||
/// <summary>
|
||||
/// 写入日志
|
||||
/// </summary>
|
||||
public void WriteLog(string msg)
|
||||
{
|
||||
string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
txt_Msg.Text += $"[{timestamp}] {msg}\r\n";
|
||||
txt_Msg.SelectionStart = txt_Msg.Text.Length;
|
||||
txt_Msg.ScrollToCaret();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 内部数据模型
|
||||
|
||||
/// <summary>
|
||||
/// Excel数据模型
|
||||
/// </summary>
|
||||
private class ExcelDataModel
|
||||
{
|
||||
public DataTable StationTable { get; set; }
|
||||
public DataTable TagMesTable { get; set; }
|
||||
public DataTable TagModelTable { get; set; }
|
||||
public DataTable TagModelKwTable { get; set; }
|
||||
public DataTable DeviceTable { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工位信息模型
|
||||
/// </summary>
|
||||
private class StationInfo
|
||||
{
|
||||
public string 工位代码 { get; set; }
|
||||
public string 工位号 { get; set; }
|
||||
public string 工位名称 { get; set; }
|
||||
public string PLC { get; set; }
|
||||
public string PLC代码 { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
120
MisDataFun/MisDataFun/mes_signal_conf/MES_CONF.resx
Normal file
120
MisDataFun/MisDataFun/mes_signal_conf/MES_CONF.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
68
MisDataFun/MisDataFun/mes_signal_conf/SqlOperation.cs
Normal file
68
MisDataFun/MisDataFun/mes_signal_conf/SqlOperation.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace SlMesDbIterface
|
||||
{
|
||||
public class SqlOperation
|
||||
{
|
||||
public static bool ExecuteStoredProcedure(string name, SqlParameter[] sqlParameters, out string errorMessage)
|
||||
{
|
||||
return DataLinkMesWork.SQLCommon.ExecuteStoredProcedure(name, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, ref sqlParameters, out errorMessage);
|
||||
}
|
||||
public static bool ExecuteStoredProcedure(string name, SqlParameter[] sqlParameters, out DataTable dt, out string errorMessage)
|
||||
{
|
||||
return DataLinkMesWork.SQLCommon.ExecuteStoredProcedure(name, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, ref sqlParameters, out dt, out errorMessage);
|
||||
}
|
||||
public static bool ExecuteStoredProcedure(string name, SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage)
|
||||
{
|
||||
return DataLinkMesWork.SQLCommon.ExecuteStoredProcedure(name, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, ref sqlParameters, out ds, out errorMessage);
|
||||
}
|
||||
public static bool ExecuteSql(string sql, out DataTable dt, out string errorMessage)
|
||||
{
|
||||
return DataLinkMesWork.SQLCommon.ExecuteSql(sql, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, out dt, out errorMessage);
|
||||
}
|
||||
|
||||
public static bool ExecuteSql(string sql, out DataSet ds, out string errorMessage)
|
||||
{
|
||||
return DataLinkMesWork.SQLCommon.ExecuteDataset(sql, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, out ds, out errorMessage);
|
||||
}
|
||||
|
||||
public static bool ExecuteSql(string sql, out string errorMessage)
|
||||
{
|
||||
return DataLinkMesWork.SQLCommon.ExecuteSql(sql, MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, out errorMessage);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 通过SqlBulkCopy复制table数据到数据库
|
||||
/// </summary>
|
||||
/// <param name="dataset"></param>
|
||||
public static bool SqlbulkcopyInsert(DataTable dt,out string ErrMsg)
|
||||
{
|
||||
bool success = false;
|
||||
ErrMsg = "";
|
||||
try
|
||||
{
|
||||
// SqlBulkCopy sqlbulkcopy = new SqlBulkCopy(connectString, SqlBulkCopyOptions.KeepIdentity);//删除自增ID插入原始数据
|
||||
SqlBulkCopy sqlbulkcopy = new SqlBulkCopy(MisDataSaveDate.MesServerMisDataFun.ConnectionString_MES, SqlBulkCopyOptions.UseInternalTransaction);//批量事务处理
|
||||
sqlbulkcopy.DestinationTableName = dt.TableName;//数据库中的表名
|
||||
for (int i = 0; i < dt.Columns.Count; i++)
|
||||
{
|
||||
var columnName = dt.Columns[i].ColumnName.ToString();
|
||||
sqlbulkcopy.ColumnMappings.Add(columnName, columnName);
|
||||
}
|
||||
sqlbulkcopy.WriteToServer(dt);
|
||||
success = true;
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrMsg=err.Message;
|
||||
}
|
||||
return success;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
386
MisDataFun/MisDataFun/webApi/Analysis_MOM_Msg.cs
Normal file
386
MisDataFun/MisDataFun/webApi/Analysis_MOM_Msg.cs
Normal file
@@ -0,0 +1,386 @@
|
||||
using DataLinkMesWork1;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MyLog4Net;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection.Emit;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public class Analysis_MOM_Msg
|
||||
{
|
||||
/// <summary>
|
||||
/// UUID生成
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string UuidUtil()
|
||||
{
|
||||
string result = Guid.NewGuid().ToString();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取时间戳
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Int64 GetTimeStamp()
|
||||
{
|
||||
TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||
return Convert.ToInt64(ts.TotalSeconds);
|
||||
}
|
||||
/// <summary>
|
||||
/// 接收检测数据
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string OnlineCheckData(string url, [FromBody] JObject jobj)
|
||||
{
|
||||
var result = new msgResHeader();
|
||||
result.MsgId = "";
|
||||
result.Message = "";
|
||||
result.Code = "200";
|
||||
result.Data = "";
|
||||
|
||||
string errorMessage = "";
|
||||
string parentID = "";
|
||||
int AID = -1;
|
||||
|
||||
if (jobj == null)
|
||||
{
|
||||
result.Code = "500";
|
||||
result.Message = "参数格式不正确!";
|
||||
string retString1 = JsonConvert.SerializeObject(result);
|
||||
MyLogHelper.Info("接收检测数据_res", retString1);
|
||||
return retString1;
|
||||
}
|
||||
int isError = 0;
|
||||
string str = jobj.ToString();
|
||||
try
|
||||
{
|
||||
//存储日志
|
||||
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
//Event_MOM_Log_Insert,@创建时间,@内容
|
||||
var param = new SqlParameter[] {
|
||||
new SqlParameter("@接口地址",url),
|
||||
new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口
|
||||
new SqlParameter("@请求内容",str),
|
||||
new SqlParameter("@请求时间",CreateTime)
|
||||
};
|
||||
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out errorMessage);
|
||||
|
||||
// 解析订单内容,存储数据库,根据实际业务来写
|
||||
OnlineCheckData onlineCheckData = JsonConvert.DeserializeObject<OnlineCheckData>(str);
|
||||
if (onlineCheckData.MsgId == "")
|
||||
{
|
||||
throw new Exception("参数MsgId为空!");
|
||||
}
|
||||
result.MsgId = onlineCheckData.MsgId;
|
||||
if (onlineCheckData.OpCode == "")
|
||||
{
|
||||
throw new Exception("参数OpCode为空!");
|
||||
}
|
||||
if (onlineCheckData.ProductionCode == "")
|
||||
{
|
||||
throw new Exception("参数ProductionCode为空!");
|
||||
}
|
||||
string OpName = onlineCheckData.OpCode;
|
||||
int Id_tagCF = 0;
|
||||
SqlParameter[] param1 = new SqlParameter[6];
|
||||
param1[0] = new SqlParameter("@EngineID", onlineCheckData.ProductionCode);
|
||||
param1[1] = new SqlParameter("@工位号", OpName);
|
||||
param1[2] = new SqlParameter("@操作者工号", onlineCheckData.CheckPerson);
|
||||
param1[3] = new SqlParameter("@扫码时间", onlineCheckData.ScanTime);
|
||||
param1[4] = new SqlParameter("@合格标志", onlineCheckData.QualityMark);
|
||||
param1[5] = new SqlParameter("@Id_tagCF", Id_tagCF);
|
||||
param1[5].Direction = ParameterDirection.Output;
|
||||
DataAccess.ExecuteStoredProcedure("测量数据合格索引_增加_测试设备", ref param1, out errorMessage);
|
||||
if (errorMessage != "")
|
||||
{
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
Id_tagCF = Convert.ToInt32(param1[5].Value.ToString());
|
||||
|
||||
List<OnlineCheckData_CheckData> onlineCheckData_CheckDataList = onlineCheckData.CheckData;
|
||||
|
||||
for (int i = 0; i < onlineCheckData_CheckDataList.Count; i++)
|
||||
{
|
||||
OnlineCheckData_CheckData onlineCheckData_CheckData = onlineCheckData_CheckDataList[i];
|
||||
|
||||
var param2 = new SqlParameter[] {
|
||||
new SqlParameter("@Id_tagCF", Id_tagCF),
|
||||
new SqlParameter("@EngineID", onlineCheckData.ProductionCode),
|
||||
new SqlParameter("@TagID",onlineCheckData_CheckData.CheckCode),
|
||||
new SqlParameter("@TagValue",onlineCheckData_CheckData.CheckValue),
|
||||
new SqlParameter("@IsGoodBad",onlineCheckData_CheckData.QualityMark),
|
||||
new SqlParameter("@工位号",OpName),
|
||||
new SqlParameter("@理论值",onlineCheckData_CheckData.StandardValue),
|
||||
new SqlParameter("@上限值",onlineCheckData_CheckData.MaxValue),
|
||||
new SqlParameter("@下限值",onlineCheckData_CheckData.MinValue),
|
||||
new SqlParameter("@测量项目",onlineCheckData_CheckData.CheckName),
|
||||
new SqlParameter("@测量单位",onlineCheckData_CheckData.Unit),
|
||||
};
|
||||
DataAccess.ExecuteStoredProcedure("测量数据合格_增加_测试设备", ref param2, out errorMessage);
|
||||
if (errorMessage != "")
|
||||
{
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询PLC是否传递机型,保证工位有件,可以写保存完成和工作完成
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out bool tagValue);
|
||||
if (tagValue)
|
||||
{
|
||||
// 电芯段OP040流程比较特殊,无PLC保存数据的流程,可以直接写完成。
|
||||
if (OpName == "OP040")
|
||||
{
|
||||
//通知PLC,MES保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
//通知PLC,MES工作完成
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||
MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
||||
MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 查看PLC是否完成流程,如果完成的话流程结束,否则的话要等PLC完成流程(即允许保存)
|
||||
DataTable dt2 = MisDataFunDll.MisDataFun.CheckAllFinish(OpName, onlineCheckData.ProductionCode, 2);
|
||||
string msg1 = "查询PLC流程出错";
|
||||
if (dt2 != null && dt2.Rows.Count > 0)
|
||||
{
|
||||
string result1 = dt2.Rows[0]["result"].ToString();
|
||||
msg1 = dt2.Rows[0]["msg"].ToString();
|
||||
|
||||
if (result1 == "1") //已完成
|
||||
{
|
||||
//通知PLC,MES保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
//通知PLC,MES工作完成
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||
MisDataFunDll. MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", msg1);
|
||||
MisDataFunDll. MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
||||
MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", msg1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFunDll.MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", msg1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
result.Code = "500";
|
||||
result.Message = err.Message;
|
||||
MisDataFunDll.MisDataFun.LogRecording_OP("All", "ERROR", "MIS", err.Message);
|
||||
}
|
||||
string retString = JsonConvert.SerializeObject(result);
|
||||
MyLogHelper.Info("接收检测数据_res", retString);
|
||||
|
||||
return retString;
|
||||
}
|
||||
/// <summary>
|
||||
/// 接收查询检测次数
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string OnlineCheckDataCount(string url, [FromBody] JObject jobj)
|
||||
{
|
||||
var result = new msgResHeader2();
|
||||
result.MsgId = "";
|
||||
result.Message = "";
|
||||
result.Code = "200";
|
||||
result.Data = new checkCountData();
|
||||
result.Data.CheckCountOk = 0;
|
||||
result.Data.CheckCountNg = 0;
|
||||
string errorMessage = "";
|
||||
string parentID = "";
|
||||
int AID = -1;
|
||||
|
||||
if (jobj == null)
|
||||
{
|
||||
result.Code = "500";
|
||||
result.Message = "参数格式不正确!";
|
||||
string retString1 = JsonConvert.SerializeObject(result);
|
||||
MyLogHelper.Info("接收查询检测次数_res", retString1);
|
||||
return retString1;
|
||||
}
|
||||
int isError = 0;
|
||||
string str = jobj.ToString();
|
||||
try
|
||||
{
|
||||
//存储日志
|
||||
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
//Event_MOM_Log_Insert,@创建时间,@内容
|
||||
var param = new SqlParameter[] {
|
||||
new SqlParameter("@接口地址",url),
|
||||
new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口
|
||||
new SqlParameter("@请求内容",str),
|
||||
new SqlParameter("@请求时间",CreateTime)
|
||||
};
|
||||
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out errorMessage);
|
||||
|
||||
// 解析订单内容,存储数据库,根据实际业务来写
|
||||
OnlineCheckData onlineCheckData = JsonConvert.DeserializeObject<OnlineCheckData>(str);
|
||||
if (onlineCheckData.MsgId == "")
|
||||
{
|
||||
throw new Exception("参数MsgId为空!");
|
||||
}
|
||||
result.MsgId = onlineCheckData.MsgId;
|
||||
if (onlineCheckData.OpCode == "")
|
||||
{
|
||||
throw new Exception("参数OpCode为空!");
|
||||
}
|
||||
if (onlineCheckData.ProductionCode == "")
|
||||
{
|
||||
throw new Exception("参数ProductionCode为空!");
|
||||
}
|
||||
|
||||
SqlParameter[] param1 = new SqlParameter[2];
|
||||
param1[0] = new SqlParameter("@EngineID", onlineCheckData.ProductionCode);
|
||||
param1[1] = new SqlParameter("@工位号", onlineCheckData.OpCode);
|
||||
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("CATL_测量数据合格_查询测试次数_测试设备", ref param1, out DataTable dt1, out errorMessage);
|
||||
if (errorMessage != "")
|
||||
{
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
|
||||
if (dt1 != null && dt1.Rows.Count > 0)
|
||||
{
|
||||
result.Data.CheckCountOk = Convert.ToInt32(dt1.Rows[0]["OK"]);
|
||||
result.Data.CheckCountNg = Convert.ToInt32(dt1.Rows[0]["NG"]);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
result.Code = "500";
|
||||
result.Message = err.Message;
|
||||
}
|
||||
string retString = JsonConvert.SerializeObject(result);
|
||||
MyLogHelper.Info("接收查询检测次数_res", retString);
|
||||
return retString;
|
||||
}
|
||||
/// <summary>
|
||||
/// 接收打印任务
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReceivePrintTask(string url, [FromBody] JObject jobj)
|
||||
{
|
||||
var result = new msgResHeader();
|
||||
result.MsgId = "";
|
||||
result.Message = "";
|
||||
result.Code = "200";
|
||||
result.Data = "";
|
||||
|
||||
string errorMessage = "";
|
||||
string parentID = "";
|
||||
int AID = -1;
|
||||
|
||||
if (jobj == null)
|
||||
{
|
||||
result.Code = "500";
|
||||
result.Message = "参数格式不正确!";
|
||||
string retString1 = JsonConvert.SerializeObject(result);
|
||||
MyLogHelper.Info("接收打印任务_res", retString1);
|
||||
return retString1;
|
||||
}
|
||||
|
||||
string str = jobj.ToString();
|
||||
try
|
||||
{
|
||||
//存储日志
|
||||
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
//Event_MOM_Log_Insert,@创建时间,@内容
|
||||
var param = new SqlParameter[] {
|
||||
new SqlParameter("@接口地址",url),
|
||||
new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口
|
||||
new SqlParameter("@请求内容",str),
|
||||
new SqlParameter("@请求时间",CreateTime)
|
||||
};
|
||||
DataLinkMesWork1.DataAccess.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ref param, out DataTable dt, out errorMessage);
|
||||
|
||||
// 解析订单内容,存储数据库,根据实际业务来写
|
||||
PrintTaskData printTaskData = JsonConvert.DeserializeObject<PrintTaskData>(str);
|
||||
if (printTaskData.printTemplete == "")
|
||||
{
|
||||
throw new Exception("参数printTemplete为空!");
|
||||
}
|
||||
|
||||
if (printTaskData.productCode == "")
|
||||
{
|
||||
throw new Exception("参数productCode为空!");
|
||||
}
|
||||
if (printTaskData.printDate == "")
|
||||
{
|
||||
throw new Exception("参数printDate为空!");
|
||||
}
|
||||
string msg = $"MARK|{printTaskData.printTemplete}|{printTaskData.productCode},{printTaskData.printDate}";
|
||||
|
||||
// 连接打印机
|
||||
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
try
|
||||
{
|
||||
//socket.Connect(MesWorkForm.MarkingMachine_Ip, int.Parse(MesWorkForm.MarkingMachine_Port));
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
throw new Exception("连接打印机失败:" + err.Message);
|
||||
}
|
||||
// 发送数据
|
||||
try
|
||||
{
|
||||
if (socket.Connected)
|
||||
{
|
||||
byte[] decBytes = System.Text.Encoding.UTF8.GetBytes(msg);
|
||||
//socket.Send(decBytes);
|
||||
socket.Send(decBytes, 0, decBytes.Length, SocketFlags.None);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("连接打印机失败");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
throw new Exception("发送打印数据失败:" + err.Message);
|
||||
}
|
||||
// 关闭
|
||||
try
|
||||
{
|
||||
if (socket.Connected)
|
||||
{
|
||||
socket.Shutdown(SocketShutdown.Both);
|
||||
socket.Close(100);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
result.Code = "500";
|
||||
result.Message = err.Message;
|
||||
}
|
||||
string retString = JsonConvert.SerializeObject(result);
|
||||
MyLogHelper.Info("接收打印任务_res", retString);
|
||||
return retString;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
54
MisDataFun/MisDataFun/webApi/Controller/ipcControll.cs
Normal file
54
MisDataFun/MisDataFun/webApi/Controller/ipcControll.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Collections.Concurrent;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
|
||||
public class IpcController : ApiController
|
||||
{
|
||||
readonly string headUrl = "Project/";
|
||||
|
||||
[HttpPost]
|
||||
[Route("OnlineCheckData")]
|
||||
public HttpResponseMessage ReceiveMomPlanData([FromBody] JObject jobj)
|
||||
{
|
||||
|
||||
return new HttpResponseMessage
|
||||
{
|
||||
Content = new StringContent(Analysis_MOM_Msg.OnlineCheckData(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
|
||||
};
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("OnlineCheckDataCount")]
|
||||
public HttpResponseMessage OnlineCheckDataCount([FromBody] JObject jobj)
|
||||
{
|
||||
|
||||
return new HttpResponseMessage
|
||||
{
|
||||
Content = new StringContent(Analysis_MOM_Msg.OnlineCheckDataCount(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
|
||||
};
|
||||
}
|
||||
[HttpPost]
|
||||
[Route("ReceivePrintTask")]
|
||||
public HttpResponseMessage ReceivePrintTask([FromBody] JObject jobj)
|
||||
{
|
||||
|
||||
return new HttpResponseMessage
|
||||
{
|
||||
Content = new StringContent(Analysis_MOM_Msg.ReceivePrintTask(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
66
MisDataFun/MisDataFun/webApi/InitServer.cs
Normal file
66
MisDataFun/MisDataFun/webApi/InitServer.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Cors;
|
||||
using System.Web.Http.SelfHost;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public class InitServer
|
||||
{
|
||||
HttpSelfHostConfiguration config = null;
|
||||
HttpSelfHostServer server = null;
|
||||
public InitServer(string Url_WebApi)
|
||||
{
|
||||
// var Url_WebApi = System.Configuration.ConfigurationManager.AppSettings["Url_WebApi"];
|
||||
Init(Url_WebApi);
|
||||
}
|
||||
public void Init(string url)
|
||||
{
|
||||
config = new HttpSelfHostConfiguration(url);
|
||||
|
||||
// 启用跨域
|
||||
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
|
||||
// 启用特性路由
|
||||
config.MapHttpAttributeRoutes();
|
||||
|
||||
//config.Routes.MapHttpRoute(
|
||||
// name: "DefaultApi",
|
||||
// routeTemplate: "api/{controller}/{id}",
|
||||
// defaults: new { id = RouteParameter.Optional }
|
||||
//);
|
||||
|
||||
// 自定义路由匹配到action
|
||||
config.Routes.MapHttpRoute(
|
||||
name: "API Default",
|
||||
routeTemplate: "api/{controller}/{action}/{id}",
|
||||
defaults: new { id = RouteParameter.Optional }
|
||||
);
|
||||
|
||||
|
||||
|
||||
server = new HttpSelfHostServer(config);
|
||||
|
||||
server.OpenAsync().Wait();
|
||||
|
||||
|
||||
}
|
||||
public class JsonContentNegotiator : IContentNegotiator
|
||||
{
|
||||
private readonly JsonMediaTypeFormatter _jsonFormatter;
|
||||
|
||||
public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
|
||||
{
|
||||
_jsonFormatter = formatter;
|
||||
}
|
||||
public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
|
||||
{
|
||||
var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
98
MisDataFun/MisDataFun/webApi/OnlineCheckData.cs
Normal file
98
MisDataFun/MisDataFun/webApi/OnlineCheckData.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
/// <summary>
|
||||
/// OnlineCheckData
|
||||
/// </summary>
|
||||
|
||||
public class OnlineCheckData
|
||||
{
|
||||
/// <summary>
|
||||
/// MsgId
|
||||
/// </summary>
|
||||
public string MsgId { get; set; } = "";
|
||||
/// <summary>
|
||||
/// OpCode
|
||||
/// </summary>
|
||||
public string OpCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// ProductionCode
|
||||
/// </summary>
|
||||
public string ProductionCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// CheckTime
|
||||
/// </summary>
|
||||
public string ScanTime { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// CheckPerson
|
||||
/// </summary>
|
||||
public string CheckPerson { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// QualityMark
|
||||
/// </summary>
|
||||
public int QualityMark { get; set; } = 1;
|
||||
|
||||
public List<OnlineCheckData_CheckData> CheckData { get; set; } = new List<OnlineCheckData_CheckData>();
|
||||
}
|
||||
|
||||
public class OnlineCheckData_CheckData
|
||||
{
|
||||
/// <summary>
|
||||
/// CheckCode
|
||||
/// </summary>
|
||||
public string CheckCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// CheckName
|
||||
/// </summary>
|
||||
public string CheckName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// ProductionCode
|
||||
/// </summary>
|
||||
public string Unit { get; set; }
|
||||
/// <summary>
|
||||
/// StandardValue
|
||||
/// </summary>
|
||||
public string StandardValue { get; set; } = "";
|
||||
/// <summary>
|
||||
/// MinValue
|
||||
/// </summary>
|
||||
public string MinValue { get; set; } = "";
|
||||
/// <summary>
|
||||
/// MaxValue
|
||||
/// </summary>
|
||||
public string MaxValue { get; set; } = "";
|
||||
/// <summary>
|
||||
/// CheckValue
|
||||
/// </summary>
|
||||
public string CheckValue { get; set; } = "";
|
||||
/// <summary>
|
||||
/// QualityMark
|
||||
/// </summary>
|
||||
public int QualityMark { get; set; } = 1;
|
||||
}
|
||||
public class PrintTaskData
|
||||
{
|
||||
/// string msg = $"MARK|{printTemplete}|{productCode},{printDate}";
|
||||
|
||||
/// <summary>
|
||||
/// printTemplete
|
||||
/// </summary>
|
||||
public string printTemplete { get; set; } = "";
|
||||
/// <summary>
|
||||
/// productCode
|
||||
/// </summary>
|
||||
public string productCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// printDate
|
||||
/// </summary>
|
||||
public string printDate { get; set; } = "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
100
MisDataFun/MisDataFun/webApi/msgResHeader.cs
Normal file
100
MisDataFun/MisDataFun/webApi/msgResHeader.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public class msgResHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务ID
|
||||
/// </summary>
|
||||
public string MsgId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回结果
|
||||
/// </summary>
|
||||
public string Code
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回消息
|
||||
/// </summary>
|
||||
public string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回数据
|
||||
/// </summary>
|
||||
public string Data
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
public class msgResHeader2
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务ID
|
||||
/// </summary>
|
||||
public string MsgId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回结果
|
||||
/// </summary>
|
||||
public string Code
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回消息
|
||||
/// </summary>
|
||||
public string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回数据
|
||||
/// </summary>
|
||||
public checkCountData Data
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public class checkCountData
|
||||
{
|
||||
/// <summary>
|
||||
/// 检测次数
|
||||
/// </summary>
|
||||
public int CheckCountOk
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 检测次数
|
||||
/// </summary>
|
||||
public int CheckCountNg
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
MisDataFunction/Function1051/DataAccess/DataAccess.cs
Normal file
16
MisDataFunction/Function1051/DataAccess/DataAccess.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1051/DataAccess/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/DataAccess/vssver2.scc
Normal file
Binary file not shown.
15
MisDataFunction/Function1051/Db.cs
Normal file
15
MisDataFunction/Function1051/Db.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public class Db
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
10
MisDataFunction/Function1051/Function08.csproj.vspscc
Normal file
10
MisDataFunction/Function1051/Function08.csproj.vspscc
Normal file
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = "relative:MesServer.Function\\Function08"
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
137
MisDataFunction/Function1051/Function1051.csproj
Normal file
137
MisDataFunction/Function1051/Function1051.csproj
Normal file
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Function1051</RootNamespace>
|
||||
<AssemblyName>Function1051</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\MisDataFun_Exe\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</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>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MesWork.DeviceDriver">
|
||||
<HintPath>..\..\dll_common\MesWork.DeviceDriver.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="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http">
|
||||
<HintPath>..\..\DLL\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Security, Version=4.0.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.Security.4.3.2\lib\net46\System.Net.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.4.3.0\lib\net46\System.Net.WebSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets.Client, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.Client.4.3.2\lib\net46\System.Net.WebSockets.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<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.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="Db.cs" />
|
||||
<Compile Include="MesServerFunction\Function1051.cs" />
|
||||
<Compile Include="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\MaterialsScanOver.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\ReqTestResistor.cs" />
|
||||
<Compile Include="OpcServer\ReqEarlyFeeding.cs" />
|
||||
<Compile Include="OpcServer\PartLoad.cs" />
|
||||
<Compile Include="OpcServer\MesReadOver.cs" />
|
||||
<Compile Include="OpcServer\WebSubmit.cs" />
|
||||
<Compile Include="OpcServer\WorkStart.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Common\09MesDataFunction\MesDataFunction\01-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>01-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\MyLog4Net\00_MyLog4Net.csproj">
|
||||
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
|
||||
<Name>00_MyLog4Net</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
305
MisDataFunction/Function1051/MesServerFunction/Function1051.cs
Normal file
305
MisDataFunction/Function1051/MesServerFunction/Function1051.cs
Normal file
@@ -0,0 +1,305 @@
|
||||
using MesServerWork;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using MisDataFunDll;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = MisDataFun.GetCmdStringList(recData);
|
||||
//string[] dataArray = recData.Split('|');
|
||||
//if (dataArray.Count != 4)
|
||||
//return;
|
||||
//消息来源
|
||||
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();
|
||||
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs e = new DeviceDriver_BasicData.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string tagValue;
|
||||
switch (m_Source)
|
||||
{
|
||||
case "BarCode":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Value;
|
||||
fun_Barcode(e);
|
||||
|
||||
break;
|
||||
case "WEB":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Command + "|" + m_Value;
|
||||
fun_WebSubmit(e);
|
||||
break;
|
||||
case "PLC":
|
||||
e = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string TagID = e.TagID.ToString();
|
||||
switch (e.TagValue.ToString().ToLower())
|
||||
{
|
||||
case "false":
|
||||
tagValue = "0";
|
||||
break;
|
||||
case "true":
|
||||
tagValue = "1";
|
||||
break;
|
||||
default:
|
||||
tagValue = e.TagValue.ToString();
|
||||
break;
|
||||
}
|
||||
e.TagValue = tagValue;
|
||||
switch (e.TagTypeCodeID.ToString())
|
||||
{
|
||||
//PLC 工件到位
|
||||
case "2":
|
||||
fun_WorkStart(e);
|
||||
break;
|
||||
//PLC 允许保存质量数据
|
||||
case "19":
|
||||
fun_MesRead(e);
|
||||
break;
|
||||
//MES 保存数据完成
|
||||
case "20":
|
||||
fun_MesReadOver(e);
|
||||
break;
|
||||
//PLC 申请上线
|
||||
case "43":
|
||||
PartLoad(e);
|
||||
break;
|
||||
//PLC 传递机型
|
||||
case "44":
|
||||
fun_EngineTypeGetOverPLC(e);
|
||||
break;
|
||||
//MES 合格放行
|
||||
case "51":
|
||||
fun_ConfirmOkGo(e);
|
||||
break;
|
||||
//MES 不合格放行
|
||||
case "8":
|
||||
fun_FalseGo(e);
|
||||
break;
|
||||
// PLC 系统健康心跳
|
||||
case "14":
|
||||
fun_HeartBeatMIS(e);
|
||||
break;
|
||||
//物料扫码完成
|
||||
case "49":
|
||||
fun_MaterislaScanOver(e);
|
||||
break;
|
||||
// 写入托盘号后通知MES
|
||||
case "48":
|
||||
string write_Pallet_res;
|
||||
MIS_BASE.Read_TagTypeID(48, m_OpName, out write_Pallet_res);
|
||||
if (write_Pallet_res.ToLower() == "true" || write_Pallet_res.ToLower() == "1")
|
||||
{
|
||||
SendMessageFun.SendInfomation("writePallet", "1", m_OpName);
|
||||
}
|
||||
MIS_BASE.WritePLC(70, m_OpName, false);
|
||||
break;
|
||||
case "63":
|
||||
fun_ReqEarlyFeeding(e);
|
||||
break;
|
||||
case "64":
|
||||
fun_ReqTestResistor(e);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//public void FunWork(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
//{
|
||||
// //lock1 = new object();
|
||||
// //lock (lock1)
|
||||
// {
|
||||
// switch (e.TagTypeCodeID.ToString())
|
||||
// {
|
||||
// //PLC 工件到位
|
||||
// case "2":
|
||||
// fun_WorkStart(e);
|
||||
// break;
|
||||
// //PLC 允许保存质量数据
|
||||
// case "19":
|
||||
// fun_MesRead(e);
|
||||
// break;
|
||||
// //MES 保存数据完成
|
||||
// case "20":
|
||||
// fun_MesReadOver(e);
|
||||
// break;
|
||||
// //PLC 传递机型
|
||||
// case "44":
|
||||
// fun_EngineTypeGetOverPLC(e);
|
||||
// break;
|
||||
// //MES 合格放行
|
||||
// case "51":
|
||||
// fun_ConfirmOkGo(e);
|
||||
// break;
|
||||
// //MES 不合格放行
|
||||
// case "8":
|
||||
// fun_FalseGo(e);
|
||||
// break;
|
||||
// //MES 扫描条码
|
||||
// case "Barcode":
|
||||
// fun_Barcode(e);
|
||||
// break;
|
||||
// //WEB 处理页面传递过来的数据
|
||||
// case "WebSubmit":
|
||||
// fun_WebSubmit(e);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
//1.工件到位后,PLC给MES传递机型(DBX0.4)(44),
|
||||
//2.MES判断是否扫描完成
|
||||
//3.若扫描完成,则MES给出合格放行(DBX2.5)(51)
|
||||
/// <summary>
|
||||
/// 扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void fun_Barcode(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
//// ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提前上料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ReqEarlyFeeding(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ReqEarlyFeeding, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求测试电阻 调用电阻仪
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ReqTestResistor(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem( ReqTestResistor, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成 20
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料扫码完成
|
||||
/// </summary>
|
||||
public void fun_MaterislaScanOver(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MaterialsScanOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成 19
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WorkStart, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
public void fun_WebSubmit(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WebSubmit, e);
|
||||
}
|
||||
|
||||
public int fun_SubLineLoadPartCountMatch()
|
||||
{
|
||||
return SubLineLoadPartCountMatch;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MES系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatMIS(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(HeartBeatMES, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// PLC系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatPLC(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
//ThreadPool.QueueUserWorkItem(HeartBeatPLC, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1051/MesServerFunction/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/MesServerFunction/vssver2.scc
Normal file
Binary file not shown.
285
MisDataFunction/Function1051/Methods/EngineGetOverBaseWork.cs
Normal file
285
MisDataFunction/Function1051/Methods/EngineGetOverBaseWork.cs
Normal file
@@ -0,0 +1,285 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 分线上总线的数量
|
||||
/// </summary>
|
||||
public static int SubLineLoadPartCount = 2;
|
||||
/// <summary>
|
||||
/// 分线上总线已经匹配的数量
|
||||
/// </summary>
|
||||
public static int SubLineLoadPartCountMatch = 0;
|
||||
/// <summary>
|
||||
/// 正常逻辑工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="PartPallet_Code"></param>
|
||||
private void EngineTypeGetOver_PLC_Work(string OpName, int EngineTypeID, string EngineType, string EngineID, int PartPallet_Code,string OrderForm)
|
||||
{
|
||||
int IsAllowWork;
|
||||
int RepairPartStatusPLC = 0;
|
||||
int MES_QualityMask = 1;
|
||||
|
||||
if (EngineTypeID <= 0 || EngineID.Length == 0 || EngineType.Length == 0)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "PLC传递机型为空!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
|
||||
return;
|
||||
}
|
||||
|
||||
//初始化物料临时表
|
||||
//第二步,将零件信息转移到零件_临时表中(本地BOM与订单BOM的选择显示关系)
|
||||
//BaseDataSystemMES.MesServer_Process_EngineTypeOver_BQ_FirstOP(OpName);
|
||||
|
||||
// 记录一下开工
|
||||
MisDataFun.OpWork_StartOrOver(OpName, EngineID, OrderForm, 1);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(OpName);
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(OpName);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(OpName);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(OpName);
|
||||
//第四步,获取是否允许工作
|
||||
MisDataFun.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
// 暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存MOBY信息
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="engineTypeID"></param>
|
||||
/// <param name="engineType"></param>
|
||||
/// <param name="engineID"></param>
|
||||
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>
|
||||
private void IsNeedRepaire_OK(string OpName)
|
||||
{
|
||||
|
||||
int isRepair;
|
||||
int engineTypeID;
|
||||
|
||||
string engineType = "";
|
||||
string engineID = "";
|
||||
string palletCode = "";
|
||||
string orderForm = "";
|
||||
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);
|
||||
}
|
||||
/// <summary>
|
||||
/// 正常匹配分线和总线
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="engineID">总线工件号</param>
|
||||
/// <param name="engineTypeID">总线工件机型代码</param>
|
||||
/// <param name="engineType">总线工件机型</param>
|
||||
private void Match(string opName, string engineID, int engineTypeID, string engineType, int PartPallet_Code)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool m_EngineGetOver_PLC_SubLine;
|
||||
int engineTypeID_SubLine;
|
||||
int partPallet_Code_SubLine;
|
||||
int PalletInfo = 1;//总线托盘状态
|
||||
|
||||
string opName_SubLine = "";//分线工件信息
|
||||
string engineID_SubLine;
|
||||
string engineType_SubLine;
|
||||
string AlarmStr;
|
||||
if (MIS_BASE.hashtable_OpNameRepair == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
//第一步:获取分线中间交互工位号
|
||||
if (MIS_BASE.hashtable_OpNameRepair.ContainsKey(opName))
|
||||
{
|
||||
opName_SubLine = MIS_BASE.hashtable_OpNameRepair[opName].ToString();
|
||||
}
|
||||
if (opName_SubLine == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//第二步:获取分线传递机型信号
|
||||
MIS_BASE.Read_EngineGetOver_PLC(opName_SubLine, out m_EngineGetOver_PLC_SubLine);
|
||||
if (!m_EngineGetOver_PLC_SubLine) return;//必须工件同时到位才能进行匹配
|
||||
|
||||
//第三步:判断合格标志
|
||||
MIS_BASE.Read_PalletInfo(opName_SubLine, out PalletInfo);
|
||||
if (PalletInfo == 2) return; //若不合格则返回不进行匹配
|
||||
string OrderForm;
|
||||
//第四步:获取分线的信息,匹配验证
|
||||
MIS_BASE.GetEngineTypeFromPLC(opName_SubLine, out engineTypeID_SubLine, out engineType_SubLine, out engineID_SubLine, out partPallet_Code_SubLine,out OrderForm);
|
||||
//判断分线数据是否合格
|
||||
//if (!BaseDataSystemMES.QulityDataVerify(opName, engineID_SubLine, out AlarmStr) && !BaseDataSystemMES.QualityVerifyStatus_Hash_Read(opName))
|
||||
//{
|
||||
// SendInfomation("LineoutAlert", AlarmStr, opName);
|
||||
// return;
|
||||
//}
|
||||
|
||||
//if (engineTypeID_SubLine == engineTypeID)
|
||||
//{
|
||||
// BaseDataSystemMES.SubLineLoadPartCountMatch_Select(opName, out SubLineLoadPartCountMatch);
|
||||
// SubLineLoadPartCountMatch = SubLineLoadPartCountMatch + 1;
|
||||
// BaseDataSystemMES.SubLineLoadPartCountMatch_Update(opName, SubLineLoadPartCountMatch);
|
||||
|
||||
|
||||
// BaseDataSystemMES.MailLineAndSubLineData_Insert(engineID, engineTypeID, engineType, engineID_SubLine);//分线上总线数据转移
|
||||
// MIS_BASE.Write_Match(opName, true);//匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(opName, true);//匹配完成
|
||||
// if(SubLineLoadPartCountMatch== SubLineLoadPartCount)
|
||||
// {
|
||||
// MIS_BASE.Write_FixAllow(opName, true);
|
||||
// SubLineLoadPartCountMatch = 0;
|
||||
// BaseDataSystemMES.SubLineLoadPartCountMatch_Update(opName, SubLineLoadPartCountMatch);
|
||||
|
||||
// }
|
||||
|
||||
// SendMessageFun.SendInfomation("MatchSuccess", "1", opName);
|
||||
// SendMessageFun.SendMessage(opName, 1, "Match");//匹配结果
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MIS_BASE.Write_Match(opName, false);//匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(opName, true);//匹配完成//68:1、取消返修;2、匹配成功 自己监控发送 MES|MatchingCompleted
|
||||
|
||||
// //发送匹配完成和匹配结果信息
|
||||
// SendMessageFun.AsyncSendMessage_Notice(opName,"匹配失败,工件型号不匹配!");
|
||||
// SendMessageFun.SendInfomation("MatchSuccess", "0", opName);
|
||||
// SendMessageFun.SendMessage(opName, 0, "Match");//匹配结果
|
||||
//}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog("Match:" + err.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强制匹配分线和总线
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
private void ForceMatch(string opName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//bool m_EngineGetOver_PLC_SubLine;
|
||||
//bool m_EngineGetOver_PLC;
|
||||
|
||||
//int engineTypeID_SubLine;
|
||||
//int engineTypeID;
|
||||
//int partPallet_Code_SubLine;
|
||||
//int partPallet_Code;
|
||||
|
||||
//string opName_SubLine = "";//分线工件信息
|
||||
//string engineID_SubLine;
|
||||
//string engineType_SubLine;
|
||||
//string engineID;
|
||||
//string engineType;
|
||||
//if (MIS_BASE.hashtable_OpNameRepair == null)
|
||||
//{
|
||||
// MIS_BASE.InitHashtable_MesServerCode();
|
||||
//}
|
||||
////获取分线中间交互工位号
|
||||
//if (MIS_BASE.hashtable_OpNameRepair.ContainsKey(opName))
|
||||
//{
|
||||
// opName_SubLine = MIS_BASE.hashtable_OpNameRepair[opName].ToString();
|
||||
//}
|
||||
//if (opName_SubLine == "")
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
//MIS_BASE.Read_EngineGetOver_PLC(opName_SubLine, out m_EngineGetOver_PLC_SubLine);//1:读取分线工件到位的传递机型信号。
|
||||
|
||||
//if (!m_EngineGetOver_PLC_SubLine) return;//必须工件同时到位才能进行匹配
|
||||
|
||||
//MIS_BASE.Read_EngineGetOver_PLC(opName, out m_EngineGetOver_PLC);//2:读取总线工件到位的传递机型信号。
|
||||
|
||||
//if (!m_EngineGetOver_PLC) return;//必须工件同时到位才能进行匹配
|
||||
//string OrderForm;
|
||||
//MIS_BASE.GetEngineTypeFromPLC(opName_SubLine, out engineTypeID_SubLine, out engineType_SubLine, out engineID_SubLine, out partPallet_Code_SubLine,out OrderForm);//获取分线的信息
|
||||
//MIS_BASE.GetEngineTypeFromPLC(opName, out engineTypeID, out engineType, out engineID, out partPallet_Code, out OrderForm);
|
||||
|
||||
//Mis.MailLineAndSubLineData_Insert(engineID, engineTypeID, engineType, engineID_SubLine);//分线上总线数据转移
|
||||
|
||||
//MIS_BASE.Write_Match(opName, true);//匹配结果
|
||||
//MIS_BASE.Write_MatchingCompleted(opName, true);//匹配完成
|
||||
|
||||
//SendMessageFun.SendInfomation("MatchSuccess", "1", opName);//界面显示匹配成功
|
||||
|
||||
//MIS_BASE.Write_FixAllow(opName, true);//允许PLC工作
|
||||
|
||||
////发送匹配完成和匹配结果信息
|
||||
//sendmessage(opName, 1, "MatchingComplete");//匹配完成
|
||||
//sendmessage(opName, 1, "Match");//匹配结果
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1051/Methods/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/Methods/vssver2.scc
Normal file
Binary file not shown.
236
MisDataFunction/Function1051/OpcServer/Barcode.cs
Normal file
236
MisDataFunction/Function1051/OpcServer/Barcode.cs
Normal file
@@ -0,0 +1,236 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockBarcode = new object();
|
||||
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void Barcode(object e)
|
||||
{
|
||||
lock(lockBarcode)
|
||||
{
|
||||
try
|
||||
{
|
||||
//DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
//string OpName = Convert.ToString(msgEvent.OpName);
|
||||
////+*************DbName*****************
|
||||
//string DbName = Convert.ToString(msgEvent.OpName);
|
||||
//string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
|
||||
//int EngineTypeID;//机型代码
|
||||
//string EngineType;//机型
|
||||
//string EngineID;//工件编号
|
||||
|
||||
//string OrderForm;
|
||||
//int Recipe1;
|
||||
//int Recipe2;
|
||||
|
||||
//bool IsNotRepeatedNumber = false;
|
||||
////1:获得申请上线信息后,扫描条码才处理业务
|
||||
//bool ispartload;
|
||||
////(115)
|
||||
//int PTO;
|
||||
////(118)0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//int NgearSwitch;
|
||||
////(119)0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//int RgearSwitch;
|
||||
////(120)0=不检测;1=检测。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//int SpeedSensor;
|
||||
////(121)例如:5S 400。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//string PartTypeMid;
|
||||
////(122) 0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//int Tcu_V;
|
||||
////判断工件是否到位
|
||||
//MIS_BASE.Read_WorkStart(OpName, out ispartload);
|
||||
//if (!ispartload)
|
||||
//{
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "请检查设备是否到位(DBX500.1=1)");
|
||||
// return;
|
||||
//}
|
||||
////判断设备是否申请上线
|
||||
//MIS_BASE.Read_PartLoad(OpName, out ispartload);
|
||||
//if (!ispartload)
|
||||
//{
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "请检查设备是否申请上线(DBX500.3=1)");
|
||||
// return;
|
||||
//}
|
||||
//// 判读条码是变速器序列号条码号还是物料号 小机型*日月年* 流水号(给起始号 + 数量)
|
||||
//// 选小机型 从北汽福田BOM中选 得先维护BOM
|
||||
//// 变速器序列号 '1333 050 062*16012023*30000001'
|
||||
|
||||
////扫描完变速器序列号条码号 true
|
||||
//bool isGetOver_PLC = false;
|
||||
////判断上线工位,MES 是否将工件流水号、机型等信息已经写入到PLC了
|
||||
// MIS_BASE.Read_EngineGetOver_PLC(OpName, out isGetOver_PLC);
|
||||
|
||||
////如果工件流水号、机型等信息没有写入PLC,扫描的条码按工件流水号进行验证
|
||||
////否则按装配物料进行验证
|
||||
//if (!isGetOver_PLC)
|
||||
//{
|
||||
|
||||
// if (barcode.Split('*').Length > 2)
|
||||
// {
|
||||
// //2: 判断是否重号, 从数据库获得机型、机型代码等信息
|
||||
// string partSn = barcode;
|
||||
// EngineID = barcode;
|
||||
|
||||
// MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineID_MES, EngineID);
|
||||
|
||||
// //Db.GetEngineType( partSn, out EngineTypeID, out EngineType, out EngineID, out IsRepeatedNumber);
|
||||
// //Db.GetEngineType( partSn, out EngineTypeID, out EngineType, out EngineID, out IsRepeatedNumber);
|
||||
|
||||
// //IsRepeatedNumber true 不重号;false 重号;
|
||||
// IsNotRepeatedNumber = BaseDataSystemMES.EngineTypeID_IsNotRepeatedNumber(partSn);
|
||||
// if (IsNotRepeatedNumber)
|
||||
// {
|
||||
// BaseDataSystemMES.GetEngineTypeUpLoadOpName(partSn, OpName, out EngineTypeID, out EngineType, out OrderForm, out Recipe1, out Recipe2);
|
||||
|
||||
// //MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
// //MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
// //MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
// //MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
|
||||
|
||||
// BaseDataSystemMES.UpLoadPTO(EngineType, out PTO, out NgearSwitch, out RgearSwitch, out SpeedSensor, out PartTypeMid, out Tcu_V);
|
||||
// //PTO
|
||||
// MIS_BASE.WritePLC(115, OpName, PTO);
|
||||
// //空挡开关检测
|
||||
// MIS_BASE.WritePLC(95, OpName, NgearSwitch);
|
||||
// //倒挡开关检测
|
||||
// MIS_BASE.WritePLC(96, OpName, RgearSwitch);
|
||||
// //里程表检测
|
||||
// MIS_BASE.WritePLC(97, OpName, SpeedSensor);
|
||||
// //大机型扩展
|
||||
// MIS_BASE.WritePLC(98, OpName, PartTypeMid);
|
||||
// //TCU
|
||||
// MIS_BASE.WritePLC(122, OpName, Tcu_V);
|
||||
// string tagStartAdr;//= "DB411.10";
|
||||
|
||||
// // 先查询配方号 根据工位号 去moby表查配方号
|
||||
// // 根据配方号 去配方表查配方数据
|
||||
// // 写入配方数据
|
||||
// BaseDataSystemMES.PLCRcipeCurrent(OpName, out byte[] bytes, out tagStartAdr);
|
||||
// DtWebApi.ReadWritePLC.Write_TagValueByTagTypeID("94", OpName, System.Text.Encoding.ASCII.GetString(bytes));
|
||||
// ////将产品信息写入PLC
|
||||
// MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
// MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
// MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
// MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
|
||||
// //写入到数据库的[北汽福田工位状态监控MOBY]表中
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineTypeID_MES, EngineTypeID.ToString());
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineType_MES, EngineType);
|
||||
// MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineID_MES, EngineID);
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.OrderForm_MES, OrderForm);
|
||||
|
||||
|
||||
// // 工位号],[订单号],[产品型号代码],[变速器序列号],[发动机型号],[机型基本代码],[变速器总成号] ,[托盘号]
|
||||
// // [产品型号代码_MES],[变速器序列号_MES],[发动机型号_MES]
|
||||
// // [机床上电],[循环开始],[机床故障],[上料无件],[下料堵塞],[工件到位]
|
||||
// // [传递机型],[申请上件],[允许保存],[保存完成],[合格标志],[前序合格]
|
||||
// // [工号],[班次],[是否返修件],[合格放行],[不合格放行],[扫描条码]
|
||||
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName, "产品型号代码_MES", EngineTypeID.ToString());
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName, "发动机型号_MES", EngineType);
|
||||
|
||||
// MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
|
||||
// //Thread.Sleep(5000);
|
||||
// //MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
|
||||
// //等待PLC将数据写入RFID;写入PLC的DB块,通知MES验证RFID机型数据是否正确传递
|
||||
|
||||
// //通知web显示
|
||||
// SendMessage.ShowMoby(OpName);
|
||||
// //SendMessageFun.SendMessage("1235", "1111", OpName);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.SendInfomation("EngineIDRepeat", "partSn", OpName);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "变速器序列号格式不正确,请确认!");
|
||||
|
||||
// }
|
||||
//}
|
||||
//else//验证物料
|
||||
//{
|
||||
// //物料号
|
||||
// {
|
||||
// //读取PLC的传递机型信号
|
||||
// bool tagValue;
|
||||
// MIS_BASE.Read_EngineGetOver_PLC(OpName, out tagValue);
|
||||
// if (tagValue)
|
||||
// {
|
||||
// //验证物料
|
||||
// BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out bool IsSuccess);
|
||||
// if (!IsSuccess)//????
|
||||
// {
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
// }
|
||||
// //判断物料是否验证完成
|
||||
// BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out int IsAllowWork);
|
||||
|
||||
|
||||
// if (IsSuccess)
|
||||
// {
|
||||
// if (IsAllowWork == 1)
|
||||
// {
|
||||
// //移到允许保存信号中
|
||||
// //BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
// ////更新订单完工数量及物料
|
||||
// SendMessageFun.SendMessage("24", "11", OpName);
|
||||
|
||||
// //物料验证完成,通知PLC允许工作,允许工作在保存完成时清空
|
||||
// MIS_BASE.Write_FixAllow(OpName, true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC未传递机型");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessage.AsyncSendMessage_Notice(OpName, "产品上线后,PLC获得变速器序列号后,再验证物料!");
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:Barcode");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
108
MisDataFunction/Function1051/OpcServer/EngineGetOver.cs
Normal file
108
MisDataFunction/Function1051/OpcServer/EngineGetOver.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockBarcodeEngineTypeGetOver = new object();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
lock(lockBarcodeEngineTypeGetOver)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
bool MesRead = false;
|
||||
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_MES;//工件编号
|
||||
string OrderForm_MES;
|
||||
|
||||
MIS_BASE.Read_QualityData_Read_CF(OpName, out MesRead);
|
||||
//第一步,判断允许保存和保存完成信号是否全部被清空,若未清空,则通知复位MES&PLC
|
||||
if (MesRead)
|
||||
{
|
||||
//未能清空信号,请求复位
|
||||
string msg = "【" + OpName + "】" + "未能清空MesRead信号,请求复位!";
|
||||
SendMessageFun.SendInfomation("AskReset", "1", OpName);
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
return;
|
||||
}
|
||||
|
||||
string OrderForm;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
MIS_BASE.GetEngineTypeFromPLC_MES(OpName, out EngineTypeID_MES, out EngineType_MES, out EngineID_MES, out OrderForm_MES);
|
||||
|
||||
// 读取MES区数据 校验MES区数据是否符合 同时判断是否此工件已工作过,若已工作过则弹出弹窗提示
|
||||
if (EngineTypeID == EngineTypeID_MES & EngineID == EngineID_MES & EngineType == EngineType_MES & OrderForm == OrderForm_MES)
|
||||
{
|
||||
if (EngineTypeID == 0 || EngineID == "" || EngineType == "" || OrderForm == "")
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "传递机型数据为空!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//写入到数据库的[北汽福田工位状态监控MOBY]表中
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineType, EngineType);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineID, EngineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.OrderForm, OrderForm);
|
||||
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
|
||||
// 将工序数据转入临时表中
|
||||
MisDataFun.ProcessDataToTemp(OpName, EngineTypeID_MES, OrderForm_MES, EngineID_MES);
|
||||
SendMessageFun.SendMessage("5123", "11111", OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "PLC与MES信息不一致!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
55
MisDataFunction/Function1051/OpcServer/MaterialsScanOver.cs
Normal file
55
MisDataFunction/Function1051/OpcServer/MaterialsScanOver.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料扫码完成
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MaterialsScanOver(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out int EngineTypeID, out string EngineType, out string EngineID, out int PartPallet_Code, out string OrderForm);
|
||||
string materialsCode = MIS_BASE.ReadPLC(40, OpName).ToString();
|
||||
var dt = MisDataFun.Get_MaterialsScanOverRes(OpName, OrderForm, EngineID, materialsCode);
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
if (result == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 1);
|
||||
}
|
||||
else if (result == 2)
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(96, OpName, 0); // 提前上料位置
|
||||
MIS_BASE.WritePLC(33, OpName, false); // 允许提前上料
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
81
MisDataFunction/Function1051/OpcServer/MesRead.cs
Normal file
81
MisDataFunction/Function1051/OpcServer/MesRead.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockMesRead = new object ();
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
int EngineTypeID;
|
||||
string EngineType;
|
||||
string EngineID;
|
||||
int PartPallet_Code;
|
||||
string OrderForm;
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_MES;//工件编号
|
||||
string OrderForm_MES;
|
||||
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int qualityMask;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID,out PartPallet_Code, out OrderForm);
|
||||
|
||||
// 保存质量数据
|
||||
qualityMask = MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
|
||||
// 保存物料数据
|
||||
MisDataFun.Material_Insert(OpName, qualityMask);
|
||||
|
||||
// 保存过站信息
|
||||
MisDataFun.OpWork_StartOrOver(OpName, EngineID, OrderForm, 2);
|
||||
|
||||
// 存追溯表数据 同时质量数据存入 接口表
|
||||
//MisDataFun.WorkOrderOpWorkOver(OpName, EngineID, OrderForm);
|
||||
|
||||
// 推送质量数据到MES的页面
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
|
||||
//对应手动工位的
|
||||
//MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
//通知设备,MES的质量数据(和物料数据)保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//统计在线产量,在线节拍
|
||||
SendMessage.SendActuallyCount(OpName, tagValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
36
MisDataFunction/Function1051/OpcServer/MesReadOver.cs
Normal file
36
MisDataFunction/Function1051/OpcServer/MesReadOver.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesReadOver(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
//string OpName = Convert.ToString(msgEvent.OpName);
|
||||
//int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//if (tagValue == 1)
|
||||
//{
|
||||
|
||||
// BaseDataSystemMES.Material_Insert(OpName, tagValue);
|
||||
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
74
MisDataFunction/Function1051/OpcServer/PartLoad.cs
Normal file
74
MisDataFunction/Function1051/OpcServer/PartLoad.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线(针对上线工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 读取当前选择的计划中的机型,写入PLC
|
||||
// 获取订单的机型
|
||||
var OrderTD = MisDataFun.GetEngineType_Order(OpName);
|
||||
if (OrderTD.Rows.Count > 0)
|
||||
{
|
||||
string OrderForm = OrderTD.Rows[0]["制造编号"].ToString();
|
||||
string EngineID = OrderTD.Rows[0]["间隔编号"].ToString();
|
||||
string EngineType = OrderTD.Rows[0]["间隔图号"].ToString();
|
||||
int EngineTypeID = Convert.ToInt32(OrderTD.Rows[0]["产品型号代码"]);
|
||||
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineTypeID_MES, EngineTypeID.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineType_MES, EngineType);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineID_MES, EngineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.OrderForm_MES, OrderForm);
|
||||
|
||||
// 写入机型代码 (大机型) 机型 发动机号 订单号
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
|
||||
// MES传递机型
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "无可用生产计划 请确认!";
|
||||
// 判断到线体上有滞留工件 ,让去管理系统进行处理
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Error("PartLoad", msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
72
MisDataFunction/Function1051/OpcServer/ReqEarlyFeeding.cs
Normal file
72
MisDataFunction/Function1051/OpcServer/ReqEarlyFeeding.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请提前上料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void ReqEarlyFeeding(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
var dt = MisDataFun.Get_ReqEarlyFeedingData(OpName);
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
string msg = dt.Rows[0]["msg"].ToString();
|
||||
int EngineTypeID = Convert.ToInt32(dt.Rows[0]["产品型号代码"]);
|
||||
if (result == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(96, OpName, EngineTypeID); // 产品型号
|
||||
MIS_BASE.Write_EngineID_MES(OpName, dt.Rows[0]["工件编号"].ToString());
|
||||
int ReadEngineID = Convert.ToInt32(MIS_BASE.ReadPLC(96, OpName));
|
||||
if (EngineTypeID != ReadEngineID)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("ReqEarlyFeeding", $"写入提前上料机型{EngineTypeID.ToString()} 与 读取到的{ReadEngineID.ToString()}不一致");
|
||||
return;
|
||||
}
|
||||
if (EngineTypeID == 0 || ReadEngineID == 0)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("ReqEarlyFeeding", $"写入提前上料机型{EngineTypeID.ToString()} 与 读取到的{ReadEngineID.ToString()} 其中存在空值");
|
||||
return;
|
||||
}
|
||||
MIS_BASE.WritePLC(33, OpName, true); // 允许提前上料
|
||||
|
||||
}
|
||||
else if (result == 2)
|
||||
{
|
||||
MIS_BASE.WritePLC(33, OpName, false);
|
||||
string msg2 = "【" + OpName + "】" + msg;
|
||||
MyLog4Net.MyLogHelper.Error("ReqEarlyFeeding", msg2);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(96, OpName, 0); // 提前上料位置
|
||||
MIS_BASE.WritePLC(33, OpName, false); // 允许提前上料
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
238
MisDataFunction/Function1051/OpcServer/ReqTestResistor.cs
Normal file
238
MisDataFunction/Function1051/OpcServer/ReqTestResistor.cs
Normal file
@@ -0,0 +1,238 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
private readonly object _lockObject = new object();
|
||||
private volatile bool _isTestOk = false;
|
||||
private string _opName;
|
||||
private const int DEFAULT_TIMEOUT = 7000; // 默认超时时间(毫秒)
|
||||
private const int MAX_RETRY_COUNT = 10; // 最大重试次数
|
||||
private const int RESULT_LENGTH = 113; // 预期结果长度
|
||||
|
||||
/// <summary>
|
||||
/// 电阻测试
|
||||
/// </summary>
|
||||
private void ReqTestResistor(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
_opName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
TestResistor().GetAwaiter().GetResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetPLCValues();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("电阻测试", $"测试过程发生错误: {err.Message}");
|
||||
ErrPLCValues();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行电阻测试
|
||||
/// </summary>
|
||||
private async Task TestResistor()
|
||||
{
|
||||
TcpClient tcpClient = null;
|
||||
try
|
||||
{
|
||||
string IP = ConfigurationManager.AppSettings["ResistorDeviceIP_"+_opName];
|
||||
string Port = ConfigurationManager.AppSettings["ResistorDevicePort"];
|
||||
|
||||
using (tcpClient = new TcpClient())
|
||||
{
|
||||
var connectTask = tcpClient.ConnectAsync(IP, Convert.ToInt32(Port));
|
||||
if (await Task.WhenAny(connectTask, Task.Delay(DEFAULT_TIMEOUT)) != connectTask)
|
||||
{
|
||||
throw new TimeoutException(_opName+"连接电阻仪超时");
|
||||
}
|
||||
|
||||
if (tcpClient.Connected)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Info(_opName + "电阻测试", "电阻仪链接成功!");
|
||||
await SendCommand(tcpClient, "01 09 64 00 05 00 00 00 00 00 73");
|
||||
|
||||
await Task.Delay(DEFAULT_TIMEOUT);
|
||||
|
||||
var readTask = Task.Run(() => Read(tcpClient));
|
||||
|
||||
int count = 0;
|
||||
while (!_isTestOk && count < MAX_RETRY_COUNT)
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
await SendCommand(tcpClient, "03 01 04");
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count >= MAX_RETRY_COUNT && !_isTestOk)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试", "测试超时,未收到有效结果");
|
||||
ErrPLCValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试", $"测试过程发生错误: {ex.Message}");
|
||||
ErrPLCValues();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tcpClient != null)
|
||||
{
|
||||
tcpClient.Close();
|
||||
MyLog4Net.MyLogHelper.Info(_opName + "电阻测试", "电阻仪链接关闭");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetPLCValues()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 0);
|
||||
MIS_BASE.WritePLC(203, _opName, 0);
|
||||
MIS_BASE.WritePLC(204, _opName, 0);
|
||||
MIS_BASE.WritePLC(34, _opName, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void ErrPLCValues()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 0);
|
||||
MIS_BASE.WritePLC(203, _opName, 0);
|
||||
MIS_BASE.WritePLC(204, _opName, 0);
|
||||
MIS_BASE.WritePLC(34, _opName, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送命令到电阻仪
|
||||
/// </summary>
|
||||
private async Task SendCommand(TcpClient tcpClient, string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 将空格分隔的HEX字符串转换为字节数组
|
||||
string[] hexValues = command.Split(' ');
|
||||
byte[] commandbyte = new byte[hexValues.Length];
|
||||
|
||||
for (int i = 0; i < hexValues.Length; i++)
|
||||
{
|
||||
commandbyte[i] = Convert.ToByte(hexValues[i], 16);
|
||||
}
|
||||
|
||||
// 发送HEX格式的数据
|
||||
await tcpClient.Client.SendAsync(new ArraySegment<byte>(commandbyte), SocketFlags.None);
|
||||
|
||||
// 记录发送的命令
|
||||
MyLog4Net.MyLogHelper.Info(_opName + "电阻测试Send", $"发送命令: {command}");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试Send", $"发送命令失败: {err.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void Read(TcpClient tcpClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (!_isTestOk)
|
||||
{
|
||||
if (tcpClient != null && tcpClient.Connected)
|
||||
{
|
||||
byte[] byteCommand = new byte[1024];
|
||||
int icommand = tcpClient.Client.Receive(byteCommand);
|
||||
string hexString = BitConverter.ToString(byteCommand, 0, icommand).Replace("-", " ");
|
||||
|
||||
if (hexString.Length == RESULT_LENGTH)
|
||||
{
|
||||
DataAnalysis(hexString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试Read", err.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataAnalysis(string hexString)
|
||||
{
|
||||
try
|
||||
{
|
||||
var byteArray = HexStringToByteArray(hexString.Replace(" ", ""));
|
||||
var start = 2;
|
||||
|
||||
var 状态 = BitConverter.ToInt32(byteArray.Skip(start + 0).Take(4).ToArray(), 0);
|
||||
if (状态 != 2) return;
|
||||
var 电压V = BitConverter.ToDouble(byteArray.Skip(start + 4).Take(8).ToArray(), 0);
|
||||
var 电流A = BitConverter.ToDouble(byteArray.Skip(start + 12).Take(8).ToArray(), 0);
|
||||
var 电阻uΩ = BitConverter.ToDouble(byteArray.Skip(start + 20).Take(8).ToArray(), 0) * 1000000;
|
||||
var yyyy = BitConverter.ToUInt16(byteArray.Skip(start + 28).Take(2).ToArray(), 0);
|
||||
var MM = byteArray[start + 30];
|
||||
var dd = byteArray[start + 31];
|
||||
var HH = byteArray[start + 32];
|
||||
var mm = byteArray[start + 33];
|
||||
var ss = byteArray[start + 34];
|
||||
var datetime = $"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";
|
||||
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 电压V);
|
||||
MIS_BASE.WritePLC(203, _opName, 电流A);
|
||||
MIS_BASE.WritePLC(204, _opName, 电阻uΩ);
|
||||
MIS_BASE.WritePLC(34, _opName, true);
|
||||
_isTestOk = true;
|
||||
}
|
||||
|
||||
MyLog4Net.MyLogHelper.Info(_opName + "电阻测试", $"电阻结果写入完毕 【电压】{电压V}【电流】{电流A}【电阻】{电阻uΩ}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试DataAnalysis", $"数据分析错误: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] HexStringToByteArray(string hex)
|
||||
{
|
||||
if (hex.Length % 2 != 0)
|
||||
{
|
||||
throw new ArgumentException("十六进制字符串长度必须是偶数");
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[hex.Length / 2];
|
||||
for (int i = 0; i < hex.Length; i += 2)
|
||||
{
|
||||
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
410
MisDataFunction/Function1051/OpcServer/WebSubmit.cs
Normal file
410
MisDataFunction/Function1051/OpcServer/WebSubmit.cs
Normal file
@@ -0,0 +1,410 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
private void WebSubmit(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string Content = Convert.ToString(msgEvent.TagValue);
|
||||
|
||||
string opName_SubLine = "";
|
||||
string engineID = "";//工件信息
|
||||
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; //消息参数长度
|
||||
|
||||
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();
|
||||
}
|
||||
if (MIS_BASE.hashtable_OpNameRepair == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs _e = new DeviceDriver_BasicData.CustomeEvetnArgs();
|
||||
_e.OpName = OpName;
|
||||
_e.TagValue = m_Value;
|
||||
string msg;
|
||||
bool bolVal;
|
||||
|
||||
//根据请求的命令处理逻辑
|
||||
switch (m_Command)
|
||||
{
|
||||
case "Barcode":
|
||||
if (m_Value_length > 1) return;
|
||||
fun_Barcode(_e);
|
||||
break;
|
||||
case "ConfirmOkGo"://合格放行
|
||||
//修改托盘状态
|
||||
|
||||
//MisDataFun.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
break;
|
||||
case "FalseGO"://返修放行
|
||||
//修改托盘状态
|
||||
//BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
break;
|
||||
case "NgGO"://不合格放行
|
||||
//修改托盘状态
|
||||
//保存不合格信息(必须保存不合格放行信息,由于B5A的Moby没有不合格标志位)
|
||||
//BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Insert(OpName, engineID, "", "");
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_FalseGO(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));
|
||||
|
||||
if (a == 2) SendMessage.AsyncSendMessage_Notice(OpName, "屏蔽MES!");
|
||||
if (a == 0) SendMessage.AsyncSendMessage_Notice(OpName, "启用MES!");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "NullWorkGo"://空托盘放行 0不放行 1放行
|
||||
try
|
||||
{
|
||||
int a = Convert.ToInt32(m_Value);
|
||||
//修改地址值
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName, a);
|
||||
if (a == 1)
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "开启空托盘放行!");
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "关闭空托盘放行!");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case "Reset"://复位,将MES所有的信息都复位了
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
|
||||
break;
|
||||
case "FixAllow"://重新拧紧
|
||||
break;
|
||||
case "IsAutoGetEngineID"://自动手动申请编号(线首)
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.Write_IsAutoGetEngineID(OpName, Convert.ToInt32(m_Value));
|
||||
break;
|
||||
case "PartPalletGoOver"://空托盘放行
|
||||
MIS_BASE.Write_RepairUpline_MES(opName_SubLine, true);
|
||||
//MIS_BASE.Write_PalletInfo(opName_SubLine, 4);
|
||||
//MIS_BASE.Write_UpdatePalletOK(opName_SubLine, true);
|
||||
MIS_BASE.Write_MaterialVerifyOver(opName_SubLine, true);
|
||||
break;
|
||||
case "SetMoby"://清空托盘(线首)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
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.WritePLC(113, OpName, Convert.ToInt32(m_Value));
|
||||
Thread.Sleep(500);
|
||||
MIS_BASE.WritePLC(70, OpName, true);
|
||||
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_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
break;
|
||||
//强制匹配
|
||||
case "ForceMatch":
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
ForceMatch(OpName);
|
||||
}
|
||||
break;
|
||||
case "PalletGO":
|
||||
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
//直接给出工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(opName_SubLine, true);
|
||||
}
|
||||
break;
|
||||
case "ContinueMatch":
|
||||
//BaseDataSystemMES.QualityVerifyStatus_Hash_Write(OpName, true);
|
||||
fun_EngineTypeGetOverPLC(_e);
|
||||
break;
|
||||
//初始化网页信号
|
||||
case "IniSingalToWeb":
|
||||
InitializeSingalToWeb(OpName);
|
||||
break;
|
||||
// 检查项 检查完成
|
||||
case "checkWorkOver":
|
||||
MIS_BASE.WritePLC(30, OpName,1);
|
||||
msg = "MES|checkWorkOverIsShow|" + OpName + "|" + 0;
|
||||
SendMessage.AsyncSendMessage(msg);
|
||||
break;
|
||||
// 重新申请上线
|
||||
case "againPartLoad":
|
||||
// 判断是否有工件到位
|
||||
MIS_BASE.Read_WorkStart(OpName, out bolVal);
|
||||
if (bolVal)
|
||||
{
|
||||
MIS_BASE.WritePLC(35, OpName, 1);
|
||||
msg = "【" + OpName + "】" + "重新申请上线完成!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "【" + OpName + "】" + "当前无工件到位信号,请确认是否存在工件!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
break;
|
||||
// 跳过交互
|
||||
case "skipWork":
|
||||
// 判断是否有工件到位
|
||||
MIS_BASE.Read_WorkStart(OpName, out bolVal);
|
||||
if (bolVal)
|
||||
{
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true); // 传递机型
|
||||
MIS_BASE.Write_FixAllow(OpName,true); // 允许工作
|
||||
MIS_BASE.WritePLC(30, OpName, 1); // 检查完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true); // 保存完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true); // 工作完成
|
||||
msg = "【" + OpName + "】" + "跳过交互完成!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "【" + OpName + "】" + "当前无工件到位信号,请确认是否存在工件!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:WebSubmit");
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMoby(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//清空Moby时,需要将MES信号清空
|
||||
MIS_BASE.Write_ClearMesMoby(OpName);
|
||||
|
||||
//BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||||
|
||||
SendMessageFun.SendMessage("5123", "1111", OpName);
|
||||
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 网页重现登录,恢复关闭前的页面状态
|
||||
/// </summary>
|
||||
/// <param name="Opname">工位号</param>
|
||||
private void InitializeSingalToWeb(string Opname)
|
||||
{
|
||||
InitOpPosion(Opname);
|
||||
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(Opname);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(Opname);
|
||||
// MOBY数据
|
||||
SendMessageFun.SendMessage("5", "1", Opname);
|
||||
//SendMessageFun.SendMessage("5123", "1111", Opname);
|
||||
// 物料信息 物料信息
|
||||
SendMessage.MaterialList(Opname);
|
||||
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
//MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
InitAlarm(Opname);
|
||||
}
|
||||
|
||||
//分线发送工件到位信号函数
|
||||
private void sendmessage(string OpName, int tagValue, string Command)
|
||||
{
|
||||
string SendMessage;
|
||||
SendMessage = "MES|" + Command + "|" + OpName + "|" + tagValue;
|
||||
SendMessageFun.AsyncSendMessage(SendMessage);
|
||||
|
||||
}
|
||||
private void InitAlarm(string Opname)
|
||||
{
|
||||
FuntionMesRead.Alarm_InitAlarm_Send(Opname, out Hashtable ht);
|
||||
foreach (DictionaryEntry kv in ht)
|
||||
{
|
||||
var TagID = kv.Key.ToString();
|
||||
var TagValue = kv.Value.ToString();
|
||||
FuntionMesRead.Send_AlarmMsg(TagID, TagValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void InitOpPosion(string Opname)
|
||||
{
|
||||
int S_WorkCheckOver = Convert.ToInt32(MIS_BASE.ReadPLC(30, Opname));
|
||||
string S_WorkCheckOver_Msg = "MES|checkWorkOverIsShow|" + Opname + "|" + S_WorkCheckOver;
|
||||
SendMessage.AsyncSendMessage(S_WorkCheckOver_Msg);
|
||||
|
||||
bool S_WorkStart;//工件到位 DBX0.1
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_PartLoad;//申请上线
|
||||
MIS_BASE.Read_PartLoad(Opname, out S_PartLoad);
|
||||
if (S_PartLoad == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PartLoad", Convert.ToString(Convert.ToInt32(S_PartLoad)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_EngineGetOver;//传递机型 DBX0.4
|
||||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(Opname);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_FixAllow;//允许工作 DBX3.1
|
||||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||||
if (S_FixAllow == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_MesRead;//允许保存 DBX3.1
|
||||
MIS_BASE.Read_QualityData_Read_CF(Opname, out S_MesRead);
|
||||
if (S_MesRead == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MesRead", Convert.ToString(Convert.ToInt32(S_MesRead)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_ReadOver;//保存完成
|
||||
MIS_BASE.Read_MesReadOver(Opname, out S_ReadOver);
|
||||
if (S_ReadOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MesReadOver", Convert.ToString(Convert.ToInt32(S_ReadOver)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_MaterialVerifyOver;//工作完成 DBX0.3
|
||||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||||
if (S_MaterialVerifyOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
int S_QualityMask;//合格标志 DBX588
|
||||
MIS_BASE.Read_QualityMask(Opname, out S_QualityMask);
|
||||
if (S_QualityMask == 1)
|
||||
{
|
||||
SendMessageFun.SendInfomation("QualityMask", Convert.ToString(Convert.ToInt32(S_QualityMask)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
string S_plcStatus = "false";//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
if (S_plcStatus.ToLower() == "false")
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
66
MisDataFunction/Function1051/OpcServer/WorkStart.cs
Normal file
66
MisDataFunction/Function1051/OpcServer/WorkStart.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void WorkStart(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//线首显示订单信息
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStart, tagValue.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
|
||||
// 清除工位数据
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, "");
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, "");
|
||||
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
|
||||
MIS_BASE.WritePLC(115, OpName, 0); // 清除小机型
|
||||
|
||||
// 检查项完成
|
||||
MIS_BASE.Write_TagTypeID(30, OpName,0);
|
||||
string message = "MES|checkWorkOverIsShow|" + OpName + "|" + 0;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
|
||||
// 重新申请上线
|
||||
MIS_BASE.WritePLC(35, OpName, 0);
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:WorkStart");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user