chore: 初始化北汽福田MES采集程序
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
74
MisDataFunction/MesServer.Function/Function1051/Db.cs
Normal file
74
MisDataFunction/MesServer.Function/Function1051/Db.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DataLinkMesWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public class Db
|
||||
{
|
||||
/// <summary>
|
||||
/// 北汽福田变速器序列号总线上线_获得机型信息
|
||||
/// </summary>
|
||||
/// <param name="partSn"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="IsRepeatedNumber"> 0 不重号;1 重号;2:失败</param>
|
||||
/// <returns></returns>
|
||||
public static bool GetEngineType(string partSn, out int EngineTypeID, out string EngineType, out string EngineID,out int IsRepeatedNumber)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
EngineTypeID = 0;
|
||||
EngineType = "";
|
||||
EngineID = "";
|
||||
IsRepeatedNumber = 2;
|
||||
string produceName = "北汽福田变速器序列号总线上线_获得机型信息";
|
||||
SqlParameter[] thisParms = new SqlParameter[1];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@变速器序列号", partSn);
|
||||
|
||||
thisParms[2].Direction = ParameterDirection.Output;
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms,out dt))
|
||||
{
|
||||
if(dt.Rows.Count > 0)
|
||||
{
|
||||
IsRepeatedNumber = Convert.ToInt32( dt.Rows[0]["IsRepeatedNumber"]);
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["EngineTypeID"]);
|
||||
EngineType = dt.Rows[0]["EngineType"].ToString();
|
||||
EngineID = partSn;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 北汽福田变速器序列号总线上线_增加
|
||||
/// </summary>
|
||||
/// <param name="partSn"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="OpName"></param>
|
||||
/// <returns></returns>
|
||||
public static bool UpLoadOpNameInsert(string partSn, int EngineTypeID, string EngineType, string OpName)
|
||||
{
|
||||
|
||||
string produceName = "北汽福田变速器序列号总线上线_增加";
|
||||
SqlParameter[] thisParms = new SqlParameter[4];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@变速器序列号", partSn);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@基本型号代码", EngineTypeID);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@基本型号", EngineType);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@工位号", OpName);
|
||||
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
|
||||
}
|
||||
|
||||
// ALTER PROCEDURE[dbo].[北汽福田变速器序列号总线上线_增加]
|
||||
// @变速器序列号 nvarchar(50)='1333 050 062 0001*146012023*12345678',--'1333 050 062 0001'
|
||||
//@基本型号代码 int=1,
|
||||
//@基本型号 nvarchar(50)='1333 050 062 0001',
|
||||
//@工位号 nvarchar(50) = 'J05PA010'
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?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>..\..\..\dll_fun\</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="MQTTnet">
|
||||
<HintPath>..\..\..\Common\dll\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient">
|
||||
<HintPath>..\..\..\Common\dll\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>..\..\..\Common\dll\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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\UDP.Send.cs" />
|
||||
<Compile Include="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="Methods\SubmitToMisweb.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
||||
<Compile Include="OpcServer\ConfirmOkGo.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\FalseGO.cs" />
|
||||
<Compile Include="OpcServer\HeartBeat.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\PartLoad.cs" />
|
||||
<Compile Include="OpcServer\MesReadOver.cs" />
|
||||
<Compile Include="OpcServer\WebSubmit.cs" />
|
||||
<Compile Include="OpcServer\WorkIsOk.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\00MesWorkMqtt\MesWorkMqtt\00MesWorkMqtt.csproj">
|
||||
<Project>{f55da1a0-a982-4479-8c47-0d9a5aaf3e18}</Project>
|
||||
<Name>00MesWorkMqtt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\01DoWhatPlc\01_01DoWhatPlc.csproj">
|
||||
<Project>{0d1af432-439a-4920-8692-43ae139f5530}</Project>
|
||||
<Name>01_01DoWhatPlc</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\04DataBaseAccess\DataBaseAccess\04-DataBaseAccess.csproj">
|
||||
<Project>{f434e066-4c59-47c8-aa82-6f48cc84501a}</Project>
|
||||
<Name>04-DataBaseAccess</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\07WebBusinessFacade\BusinessFacade\07BusinessFacade.csproj">
|
||||
<Project>{f0a0c525-03fd-428a-9b17-7f54aa0e4475}</Project>
|
||||
<Name>07BusinessFacade</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\08WebFun_base\WebFun_base\08-WebFun_base.csproj">
|
||||
<Project>{d98be764-adeb-488d-9714-61e308aa8201}</Project>
|
||||
<Name>08-WebFun_base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\09MesDataFunction\MesDataFunction\09-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MisDataFun\SendMessageToWebMqtt\12SendMessageToWeb.csproj">
|
||||
<Project>{e4eb6420-906d-4672-947a-ca33ddcdadfc}</Project>
|
||||
<Name>12SendMessageToWeb</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MIS_FuntionSaveData\MIS_FuntionSaveData\13.3MIS_FuntionSaveData.csproj">
|
||||
<Project>{55b510c1-59e9-4bfd-ae84-d76d46f6e365}</Project>
|
||||
<Name>02-13.3MIS_FuntionSaveData</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>
|
||||
@@ -0,0 +1,318 @@
|
||||
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DoWhatPlc.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = DoWhatPlc.MessageText.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();
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs e =new DoWhatPlc.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DoWhatPlc.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<DoWhatPlc.CustomeEvetnArgs>(m_Value);
|
||||
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 "22":
|
||||
fun_IsOk(e);
|
||||
break;
|
||||
//MES保存实时质量数据
|
||||
case "65":
|
||||
fun_MesSaveNowData(e);
|
||||
break;
|
||||
//// PLC 系统健康心跳
|
||||
//case "14":
|
||||
// fun_HeartBeatMIS(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;
|
||||
// PLC直通
|
||||
case "63":
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
MIS_BASE.Read_TagTypeID(63, m_OpName, out S_plcStatus);
|
||||
if (Convert.ToInt32(S_plcStatus) == 0)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", m_OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", m_OpName);
|
||||
}
|
||||
break;
|
||||
// PLC 程序号
|
||||
case "125":
|
||||
// 将程序号转发给前端页面
|
||||
SendMessageFun.SendInfomation("CodeNumber", e.TagValue.ToString(), m_OpName);
|
||||
break;
|
||||
// PLC 程序号的第几颗螺丝
|
||||
case "126":
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", e.TagValue.ToString(), m_OpName);
|
||||
break;
|
||||
// PLC 当前拧紧螺丝数
|
||||
case "143":
|
||||
SendMessageFun.SendInfomation("NowBoltCount", e.TagValue.ToString(), m_OpName);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//public void FunWork(DoWhatPlc.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(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工位是否合格
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_IsOk(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(IsOk, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存完成 20
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成 19
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DoWhatPlc.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(DoWhatPlc.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(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(HeartBeatMES, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// PLC系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatPLC(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(HeartBeatPLC, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES实时保存质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesSaveNowData(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesSaveNowData, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,315 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
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 || OrderForm.Length == 0)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
|
||||
return;
|
||||
}
|
||||
|
||||
//初始化物料临时表
|
||||
//第二步,将零件信息转移到零件_临时表中(本地BOM与订单BOM的选择显示关系)
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOver_BQ_FirstOP(OpName);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(OpName);
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(OpName);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(OpName);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(OpName);
|
||||
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
// BaseDataSystemMES.MesServer_Process_EngineTypeOverBQ(OpName);
|
||||
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("5", "1", OpName);
|
||||
|
||||
//第四步,获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
// 暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_two(string OpName)
|
||||
{
|
||||
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);
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, Convert.ToInt32(PartPallet_Code), OrderForm);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 跳过二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_Skip(string OpName)
|
||||
{
|
||||
//MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
|
||||
|
||||
/// <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);
|
||||
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);
|
||||
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);
|
||||
|
||||
BaseDataSystemMES.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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 此类用于向WEB发送各种类型消息
|
||||
/// </summary>
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
|
||||
// /// <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>
|
||||
//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>
|
||||
/// 向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;//在线节拍
|
||||
|
||||
// BaseDataSystemMES.OpNameCount_New(OpName, out opNameCount, out opNameCountTime); //基本数据_工作日历_班次产量查询_New
|
||||
|
||||
// SendInfomation("ActuallyCount", opNameCount.ToString() + "&" + opNameCountTime.ToString(), OpName);
|
||||
|
||||
// }
|
||||
// catch (Exception err)
|
||||
// {
|
||||
// ////ApplicationLog.WriteLog(err, "Function01:SendActuallyCount");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MesServerWork;
|
||||
//using BasicData;
|
||||
using System.Collections;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
///// <summary>
|
||||
///// 发送信息到MES通讯服务器或者其他的
|
||||
///// </summary>
|
||||
///// <param name="Message"></param>
|
||||
//private void AsyncSendMessage(string Message)
|
||||
//{
|
||||
// MIS_BASE.asyncSendMessage(Message);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 发送提示消息
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
//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>
|
||||
/// 发送信息到打印机
|
||||
/// </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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,321 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
using bizFacade;
|
||||
|
||||
//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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
//+*************DbName*****************
|
||||
string DbName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
SendMessageFun.SendInfomation("BarCodeData", barcode, OpName); // 将扫码值发送给前端
|
||||
|
||||
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;
|
||||
//(123) 加有量检测线上线工位扫描总成条码,根据BOM,查出
|
||||
float addOil;
|
||||
//(124) 上线法兰凹凸 -- 5s 1 凸 2 凹 6s 4凸 8 凹
|
||||
int flange;
|
||||
//(17) 上线细一轴
|
||||
int Slender;
|
||||
//(35) 分泵推杆
|
||||
int Putters;
|
||||
|
||||
bool isShowBarNGTipBox = false;
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//判断工件是否到位
|
||||
|
||||
MIS_BASE.Read_WorkStart(OpName, out ispartload);
|
||||
if (!ispartload)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请检查设备是否到位(DBX500.1=1)");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
//判断设备是否申请上线 改为传递机型了
|
||||
MIS_BASE.Read_PartLoad(OpName, out ispartload);
|
||||
if (!ispartload)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请检查设备是否申请上线(DBX500.3=1)");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
// 判读条码是变速器序列号条码号还是物料号 小机型*日月年* 流水号(给起始号 + 数量)
|
||||
// 选小机型 从北汽福田BOM中选 得先维护BOM
|
||||
// 变速器序列号 '1333 050 062*16012023*30000001'
|
||||
|
||||
//扫描完变速器序列号条码号 true
|
||||
//扫描完变速器序列号条码号 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;
|
||||
|
||||
//判断是否返修件 若不是返修件则要校验是否在当前计划中
|
||||
DataTable backWorkDt = BaseDataSystemMES.Get_IsBarCodeBackWork(OpName, EngineID);
|
||||
if (Convert.ToInt32(backWorkDt.Rows[0]["Count"]) == 0)
|
||||
{
|
||||
// 判断扫的码是否在当前生产订单中
|
||||
if (OpName == "J07MA005")
|
||||
{
|
||||
DataTable BarCodeDt;
|
||||
BarCodeDt = BaseDataSystemMES.GetMainLineNowWorkOrderData(OpName, EngineID);
|
||||
if (BarCodeDt.Rows.Count == 0)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "当前工位订单可上线条码中不存在此条码,请在当前计划模块中查看!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, 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)
|
||||
{
|
||||
bool isData = BaseDataSystemMES.GetEngineTypeUpLoadOpName(partSn, OpName, out EngineTypeID, out EngineType, out OrderForm, out Recipe1, out Recipe2);
|
||||
if (!isData)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "生产订单中无此条码,请在当前计划模块中查看确认!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
//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,out addOil,out flange,out Slender,out Putters);
|
||||
//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);
|
||||
//注油量
|
||||
MIS_BASE.WritePLC(123, OpName, addOil);
|
||||
// 法兰编号
|
||||
if(OpName == "J07ET010") MIS_BASE.WritePLC(124, OpName, flange);
|
||||
|
||||
// 写入是否存在PKB
|
||||
bool isExistPKB = BaseDataSystemMES.Get_IsExistPKB(EngineType);
|
||||
MIS_BASE.WritePLC(64, OpName, isExistPKB);
|
||||
|
||||
//细一轴
|
||||
MIS_BASE.WritePLC(17, OpName, Slender);
|
||||
|
||||
//分泵推杆
|
||||
MIS_BASE.WritePLC(35, OpName, Putters);
|
||||
|
||||
string tagStartAdr;//= "DB411.10";
|
||||
|
||||
// 先查询配方号 根据工位号 去moby表查配方号
|
||||
// 根据配方号 去配方表查配方数据
|
||||
// 写入配方数据
|
||||
BaseDataSystemMES.PLCRcipeCurrent(OpName, out byte[] bytes, out tagStartAdr);
|
||||
MIS_BASE.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]表中
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID_MES, EngineTypeID.ToString());
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType_MES, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm_MES, OrderForm);
|
||||
|
||||
|
||||
// 工位号],[订单号],[产品型号代码],[变速器序列号],[发动机型号],[机型基本代码],[变速器总成号] ,[托盘号]
|
||||
// [产品型号代码_MES],[变速器序列号_MES],[发动机型号_MES]
|
||||
// [机床上电],[循环开始],[机床故障],[上料无件],[下料堵塞],[工件到位]
|
||||
// [传递机型],[申请上件],[允许保存],[保存完成],[合格标志],[前序合格]
|
||||
// [工号],[班次],[是否返修件],[合格放行],[不合格放行],[扫描条码]
|
||||
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, "产品型号代码_MES", EngineTypeID.ToString());
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, "发动机型号_MES", EngineType);
|
||||
|
||||
// 获取左置右置 只有测试线传
|
||||
if(OpName == "J07ET010")
|
||||
{
|
||||
int LeftRightData = 0;
|
||||
DataTable LeftRightDt = BaseDataSystemMES.Get_IsExistLeftRight(EngineType);
|
||||
LeftRightData = Convert.ToInt32(LeftRightDt.Rows[0]["type"]);
|
||||
MIS_BASE.WritePLC(114, OpName, LeftRightData);
|
||||
}
|
||||
|
||||
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
|
||||
//Thread.Sleep(5000);
|
||||
//MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
|
||||
//等待PLC将数据写入RFID;写入PLC的DB块,通知MES验证RFID机型数据是否正确传递
|
||||
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "扫码成功,请开始工作!");
|
||||
BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 2);
|
||||
//通知web显示
|
||||
SendMessage.ShowMoby(OpName);
|
||||
//SendMessageFun.SendMessage("1235", "1111", OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("EngineIDRepeat", "partSn", OpName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "变速器序列号格式不正确,请确认!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", 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, "条码无效,请确认");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
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, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "产品上线后,PLC获得变速器序列号后,再验证物料!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(4, e, "Fun1051", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:Barcode");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void ConfirmOkGo(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);//工作完成
|
||||
SendMessageFun.SendInfomation("OrderFormList","1", OpName);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
//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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.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;//工件编号
|
||||
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
|
||||
MIS_BASE.Read_QualityData_Read_CF(OpName, out MesRead);
|
||||
//第一步,判断允许保存和保存完成信号是否全部被清空,若未清空,则通知复位MES&PLC
|
||||
if (MesRead)
|
||||
{
|
||||
//未能清空信号,请求复位
|
||||
SendMessageFun.SendInfomation("AskReset", "1", OpName);
|
||||
return;
|
||||
}
|
||||
string OrderForm;
|
||||
string OrderForm_MES;
|
||||
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);
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (EngineTypeID_MES == EngineTypeID & EngineID_MES == EngineID & EngineType_MES == EngineType & OrderForm_MES == OrderForm)
|
||||
{
|
||||
DataTable dt = BaseDataSystemMES.EngineTypeChange(OpName, EngineID);
|
||||
// 提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
|
||||
//写入到数据库的[北汽福田工位状态监控MOBY]表中
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, EngineID);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm, OrderForm);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.PartPallet_Code, PartPallet_Code.ToString());
|
||||
|
||||
// 判断是否返修件 是否需要继续工作
|
||||
DataTable backWorkDt = BaseDataSystemMES.Get_IsBackWork(OpName, EngineID);
|
||||
if (backWorkDt.Rows[0]["result"].ToString() == "1")
|
||||
{
|
||||
// 写返修点并且退出方法
|
||||
MIS_BASE.WritePLC(33, OpName, true);
|
||||
string message = "MES|ShowTipBox|" + OpName + "|该工件为返工工件!";
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
return;
|
||||
}
|
||||
//判断该订单数据是否已经工作过,有的话则在WEB跳出弹窗选择 并同时禁止工作
|
||||
DataTable dt2 = BaseDataSystemMES.EngineIsTwoWork(OpName, OrderForm, EngineID);
|
||||
if (dt2.Rows[0]["result"].ToString() == "1") //已完成s
|
||||
{
|
||||
//不允许工作
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
//通知WEB校验重新工作还是跳过 点重新工作给允许工作,点跳过给工作完成
|
||||
string message = "MES|Engine_Is_TwoWork|" + OpName + "|1";
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
//正常传递机型流程
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
}
|
||||
|
||||
//EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "码块RFID机型与MES机型不匹配!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(2, e, "Fun1051", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 返修放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FalseGO(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);//工作完成
|
||||
SendMessageFun.SendInfomation("OrderFormList", "1", OpName);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeatMES(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//返写在MES心跳中
|
||||
//MIS_BASE.WritePLC(15, OpName, tagValue);
|
||||
|
||||
if(tagValue == 1)
|
||||
{
|
||||
//DataTable tempDt;
|
||||
//BaseDataSystemMES.Get_TempData(OpName, "登陆状态", out tempDt);
|
||||
//if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, OpName, tempDt.Rows[0]["数值"]);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeatPLC(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int HeartBeatPLC;
|
||||
//读取PLC心跳数据
|
||||
HeartBeatPLC = Convert.ToInt32(MIS_BASE.ReadPLC(14, OpName));
|
||||
//通知WEB修改状态
|
||||
string message = "MES|HeartBeatPLC|" + OpName + "|" + HeartBeatPLC.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockMesRead = new object ();
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
lock(lockMesRead)
|
||||
{
|
||||
try
|
||||
{
|
||||
int EngineTypeID;
|
||||
string EngineType;
|
||||
string EngineID;
|
||||
int PartPallet_Code;
|
||||
string OrderForm;
|
||||
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
//保存数据到线首表 先保存到 北汽福田变速器序列号总线上线 用于之前判断是否重号
|
||||
if (Db.UpLoadOpNameInsert(EngineID, EngineTypeID, EngineType, OpName))
|
||||
{
|
||||
// 保存质量数据
|
||||
int qualityMask = MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
// 推送质量数据到MES的页面
|
||||
MIS_BASE.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
|
||||
if (OpName == "J07MA005")
|
||||
{
|
||||
// 计数+1
|
||||
BaseDataSystemMES.newAddOrderCount(OpName, EngineID, OrderForm, 0);
|
||||
SendMessageFun.SendInfomation("FlushOverWorkList", "1", OpName);
|
||||
}
|
||||
|
||||
// 保存物料数据
|
||||
BaseDataSystemMES.Material_Insert(OpName, tagValue);
|
||||
// 测量数据发动机在线状态
|
||||
BaseDataSystemMES.WorkStartInsert(OpName, qualityMask);
|
||||
SendMessage.SendActuallyCount(OpName, tagValue);//统计在线产量,在线节拍
|
||||
|
||||
//通知设备,MES的质量数据(和物料数据)保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
// MES工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "保存上线数据失败!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(3, e, "Fun1051", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//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
|
||||
{
|
||||
//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, tagValue);
|
||||
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES保存实时质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesSaveNowData(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if(tagValue == 1 ) {
|
||||
// 直接发送实时的 质量数据
|
||||
string message = MisDataSaveDateMesRead.Funtion.GetRealTimeQualityData(OpName);
|
||||
//推送质量数据到MES的页面
|
||||
SendMessage.AsyncSendMessage("MES|ShowTimelyQuality_Resources|" + OpName + "|" + message);
|
||||
//SendMessageFun.SendMessageMESToWEB("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线(针对上线工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(1, e, "Fun1060", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,461 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
//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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.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();
|
||||
}
|
||||
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"://合格放行
|
||||
//修改托盘状态
|
||||
|
||||
BaseDataSystemMES.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 "Write_WorkNumber":
|
||||
//将工件号地址写入
|
||||
break;
|
||||
case "twoWorkSkip"://重新工作工件跳过工作(重新工作工件)
|
||||
//工作完成
|
||||
EngineTypeGetOver_PLC_Work_Skip(OpName);
|
||||
break;
|
||||
case "twoWork"://重新工作工件重新工作(重新工作工件)
|
||||
//允许工作
|
||||
EngineTypeGetOver_PLC_Work_two(OpName);
|
||||
break;
|
||||
case "FaultBackWork"://返修工件
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(34, OpName, true);
|
||||
break;
|
||||
case "FaultBackWorkUnpack"://返修 拆解返工
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(24, OpName, 1);
|
||||
break;
|
||||
case "FaultBackWorkSelect"://返修 选择工位返工
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(24, OpName, 2);
|
||||
break;
|
||||
//放行空托盘(上线工位独有)
|
||||
///case "Write_WorkNumber":
|
||||
//将工件号地址写入
|
||||
// Convert.ToBoolean(m_Value)
|
||||
// break;
|
||||
case "closeWebWindow":// 前端窗口关闭
|
||||
// 将持久化存储表中工位的登陆状态设置为接受值
|
||||
BaseDataSystemMES.Set_TempData(OpName, "登陆状态", m_Value);
|
||||
MIS_BASE.WritePLC(54, OpName, false);
|
||||
break;
|
||||
case "SkipDiskBearing":// 跳过盘轴
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.WritePLC(32, OpName, false);
|
||||
break;
|
||||
case "QuitEngineTypeCheck":// 发送给服务器换型请求,等待服务器换型判断发送到页面端
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.EngineTypeChange(OpName, m_Value);
|
||||
//提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
// 写入MOBY 写入机型信息与清空总成号
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, mesValue);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, "");
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("5", "1", OpName);
|
||||
}
|
||||
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)
|
||||
{
|
||||
bool S_WorkStart;//工件到位 DBX0.1
|
||||
bool S_EngineGetOver;//传递机型 DBX0.4
|
||||
bool S_FixAllow;//允许工作 DBX3.1
|
||||
bool S_MaterialVerifyOver;//工作完成 DBX2.3
|
||||
bool S_WorkOn; //申请上线
|
||||
string S_mesEmptyGo; // 空托盘放行
|
||||
|
||||
int IsCompleted = 0;
|
||||
int S_Match = 0;
|
||||
int PalletInfo_SubLine = 0;//显示分线托盘状态
|
||||
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
|
||||
DataTable tempDt;
|
||||
BaseDataSystemMES.Get_TempData(Opname , "登陆状态", out tempDt);
|
||||
if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, Opname, tempDt.Rows[0]["数值"]);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(Opname);
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(Opname);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(Opname);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(Opname);
|
||||
InitAlarm(Opname);
|
||||
// 新增查询MES 空托盘放行信号
|
||||
MIS_BASE.Read_TagTypeID(6, Opname, out S_mesEmptyGo);
|
||||
|
||||
// 查询螺丝号是否存在 存在则发送给前端
|
||||
string CodeNumber;
|
||||
MIS_BASE.Read_TagTypeID(125, Opname, out CodeNumber);
|
||||
if(CodeNumber != "0")
|
||||
{
|
||||
SendMessageFun.SendInfomation("CodeNumber", CodeNumber,Opname);
|
||||
}
|
||||
|
||||
// 查询螺丝号下拧紧排序是否存在 存在则发送给前端
|
||||
string CodeNumberWorkNumber;
|
||||
MIS_BASE.Read_TagTypeID(126, Opname, out CodeNumberWorkNumber);
|
||||
if (CodeNumberWorkNumber != "0")
|
||||
{
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", CodeNumberWorkNumber,Opname);
|
||||
}
|
||||
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
if (Convert.ToInt32(S_plcStatus) == 0)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
if (S_mesEmptyGo.ToLower() == "false")
|
||||
{
|
||||
SendMessageFun.SendInfomation("emptyTrayGo", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("emptyTrayGo", "1", Opname);
|
||||
}
|
||||
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||||
//sendmessage(Opname, Convert.ToInt32(S_WorkStart), "WorkStart_Subline");
|
||||
}
|
||||
|
||||
//sendmessage(Opname, Convert.ToInt32(S_WorkStart), "EngineTypeGetOverMES_Subline");
|
||||
|
||||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
//sendmessage(Opname, Convert.ToInt32(S_EngineGetOver), "EngineTypeGetOverMES_Subline");
|
||||
}
|
||||
|
||||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||||
|
||||
if (S_FixAllow == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||||
}
|
||||
|
||||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||||
|
||||
if (S_MaterialVerifyOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||||
}
|
||||
|
||||
MIS_BASE.Read_PartLoad(Opname, out S_WorkOn);
|
||||
|
||||
if (S_WorkOn == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("WorkOn", Convert.ToString(Convert.ToInt32(S_WorkOn)), Opname);
|
||||
}
|
||||
|
||||
//MIS_BASE.Read_MatchingCompleted(Opname, out IsCompleted); //DBX1.3 是否匹配
|
||||
//MIS_BASE.Read_Match(Opname, out S_Match); //DBX1.4 匹配结果
|
||||
|
||||
//if (IsCompleted == 1 && S_Match == 1)//发送匹配完成和匹配结果信息
|
||||
//{
|
||||
// SendMessageFun.SendInfomation("MatchingCompleted", "1", Opname);
|
||||
// SendMessageFun.SendInfomation("Match", "1", Opname);
|
||||
// SendMessageFun.SendInfomation("MatchSuccess", "1", Opname);//界面显示匹配成功
|
||||
//}
|
||||
//else if (IsCompleted == 1 && S_Match == 0)
|
||||
//{
|
||||
// SendMessageFun.SendInfomation("MatchSuccess", "0", Opname);//界面显示匹配失败
|
||||
//}
|
||||
|
||||
//if (MIS_BASE.hashtable_OpNameRepair == null)
|
||||
//{
|
||||
// MIS_BASE.InitHashtable_MesServerCode();
|
||||
//}
|
||||
//string Opname_SubLine = "";
|
||||
//if (MIS_BASE.hashtable_OpNameRepair.ContainsKey(Opname))
|
||||
//{
|
||||
// Opname_SubLine = MIS_BASE.hashtable_OpNameRepair[Opname].ToString();
|
||||
//}
|
||||
//if (Opname_SubLine == "")
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
//MIS_BASE.Read_PalletInfo(Opname, out PalletInfo_SubLine);
|
||||
//sendmessage(Opname, PalletInfo_SubLine, "SubQualityMask");
|
||||
//SendMessageFun.SendInfomation("ShowMobySubLine", Opname_SubLine, 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工位合格标志
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void IsOk(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int qualityMask;
|
||||
MIS_BASE.Read_QualityMask(OpName, out qualityMask);
|
||||
//判断是否合格
|
||||
if (qualityMask == 1)
|
||||
{
|
||||
qualityMask = 1;
|
||||
} else {
|
||||
qualityMask = 0;
|
||||
}
|
||||
//通知WEB修改状态
|
||||
string message = "MES|QualityMask|" + OpName + "|" + qualityMask.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void WorkStart(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//线首显示订单信息
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.Write_TagTypeID(115, OpName, 0);
|
||||
MIS_BASE.Write_TagTypeID(95, OpName, 0);
|
||||
MIS_BASE.Write_TagTypeID(96, OpName, 0);
|
||||
MIS_BASE.Write_TagTypeID(97, OpName, 0);
|
||||
MIS_BASE.Write_TagTypeID(98, OpName, "");
|
||||
MIS_BASE.WritePLC(123, OpName, 0);
|
||||
//清空MOBY的产品流水号
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStart, tagValue.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
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.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.WritePLC(115, OpName, "0");
|
||||
//空挡开关检测
|
||||
MIS_BASE.WritePLC(95, OpName, "0");
|
||||
//倒挡开关检测
|
||||
MIS_BASE.WritePLC(96, OpName, "0");
|
||||
//里程表检测
|
||||
MIS_BASE.WritePLC(97, OpName, "0");
|
||||
//大机型扩展
|
||||
MIS_BASE.WritePLC(98, OpName, "");
|
||||
//TCU
|
||||
MIS_BASE.WritePLC(122, OpName, "0");
|
||||
//注油量
|
||||
MIS_BASE.WritePLC(123, OpName, "0");
|
||||
// 法兰编号
|
||||
if (OpName == "J07ET010") MIS_BASE.WritePLC(124, OpName, "0");
|
||||
|
||||
BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 2);
|
||||
|
||||
// 是否返修点
|
||||
MIS_BASE.WritePLC(33, OpName, false);
|
||||
MIS_BASE.WritePLC(34, OpName, false);
|
||||
|
||||
// 工件离开清除 左右置
|
||||
MIS_BASE.WritePLC(114, OpName, 0);
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:WorkStart");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Function08")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("苏州宏软信息技术有限公司")]
|
||||
[assembly: AssemblyProduct("Function08")]
|
||||
[assembly: AssemblyCopyright("Copyright © 苏州宏软信息技术有限公司 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("47710f2c-e141-4252-8d13-701bf4c1c027")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 内部版本号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Binary file not shown.
19
MisDataFunction/MesServer.Function/Function1051/app.config
Normal file
19
MisDataFunction/MesServer.Function/Function1051/app.config
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MQTTnet" publicKeyToken="b69712f52770c0a7" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.13.0" newVersion="3.0.13.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,5 @@
|
||||
SCC = This is a Source Code Control file
|
||||
|
||||
[Function08.csproj]
|
||||
SCC_Aux_Path = "\\192.168.0.100\vss\MES4.0"
|
||||
SCC_Project_Name = "$/MisData/MisData/MisData/MesServer.Function/Function08", KRHAAAAA
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
|
||||
<package id="MQTTnet" version="3.0.13" targetFramework="net461" />
|
||||
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.13" targetFramework="net461" />
|
||||
<package id="NETStandard.Library" version="2.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
|
||||
<package id="System.Net.Security" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" requireReinstallation="true" />
|
||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
|
||||
</packages>
|
||||
BIN
MisDataFunction/MesServer.Function/Function1051/vssver2.scc
Normal file
BIN
MisDataFunction/MesServer.Function/Function1051/vssver2.scc
Normal file
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class Function1052
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = "relative:MesServer.Function\\Function02"
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
<?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>{5FEE5C91-8419-49FF-B2C2-47476F0B8C68}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Function1052</RootNamespace>
|
||||
<AssemblyName>Function1052</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>..\..\..\dll_fun\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<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="MQTTnet">
|
||||
<HintPath>..\..\..\Common\dll\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient">
|
||||
<HintPath>..\..\..\Common\dll\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>..\..\..\Common\dll\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="Methods\SubmitToMisweb.cs" />
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="MesServerFunction\Fun_1052.cs" />
|
||||
<Compile Include="Methods\UDP.Send.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\ConfirmOkGo.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\FalseGO.cs" />
|
||||
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
||||
<Compile Include="OpcServer\HeartBeat.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\MesReadOver.cs" />
|
||||
<Compile Include="OpcServer\WebSubmit.cs" />
|
||||
<Compile Include="OpcServer\WorkStart.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="OpcServer\WorkIsOk.cs" />
|
||||
<Compile Include="SaveCode\SaveCode_J07MA080.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Common\00MesWorkMqtt\MesWorkMqtt\00MesWorkMqtt.csproj">
|
||||
<Project>{f55da1a0-a982-4479-8c47-0d9a5aaf3e18}</Project>
|
||||
<Name>00MesWorkMqtt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\01DoWhatPlc\01_01DoWhatPlc.csproj">
|
||||
<Project>{0d1af432-439a-4920-8692-43ae139f5530}</Project>
|
||||
<Name>01_01DoWhatPlc</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\02WebApiCall\02_02WebApiCallPLC.csproj">
|
||||
<Project>{3e6d1dd5-01c9-435f-9941-61f906ce35bb}</Project>
|
||||
<Name>02_02WebApiCallPLC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\04DataBaseAccess\DataBaseAccess\04-DataBaseAccess.csproj">
|
||||
<Project>{f434e066-4c59-47c8-aa82-6f48cc84501a}</Project>
|
||||
<Name>04-DataBaseAccess</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\07WebBusinessFacade\BusinessFacade\07BusinessFacade.csproj">
|
||||
<Project>{f0a0c525-03fd-428a-9b17-7f54aa0e4475}</Project>
|
||||
<Name>07BusinessFacade</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\08WebFun_base\WebFun_base\08-WebFun_base.csproj">
|
||||
<Project>{d98be764-adeb-488d-9714-61e308aa8201}</Project>
|
||||
<Name>08-WebFun_base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\09MesDataFunction\MesDataFunction\09-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MisDataFun\SendMessageToWebMqtt\12SendMessageToWeb.csproj">
|
||||
<Project>{e4eb6420-906d-4672-947a-ca33ddcdadfc}</Project>
|
||||
<Name>12SendMessageToWeb</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MIS_FuntionSaveData\MIS_FuntionSaveData\13.3MIS_FuntionSaveData.csproj">
|
||||
<Project>{55b510c1-59e9-4bfd-ae84-d76d46f6e365}</Project>
|
||||
<Name>02-13.3MIS_FuntionSaveData</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>
|
||||
@@ -0,0 +1,317 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DoWhatPlc.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = DoWhatPlc.MessageText.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();
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs e = new DoWhatPlc.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DoWhatPlc.CustomeEvetnArgs>(m_Value);
|
||||
string tagValue;
|
||||
string strValue;
|
||||
int intValue;
|
||||
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<DoWhatPlc.CustomeEvetnArgs>(m_Value);
|
||||
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 "44":
|
||||
fun_EngineTypeGetOverPLC(e);
|
||||
break;
|
||||
//MES 合格放行
|
||||
case "51":
|
||||
fun_ConfirmOkGo(e);
|
||||
break;
|
||||
//MES 不合格放行
|
||||
case "8":
|
||||
fun_FalseGo(e);
|
||||
break;
|
||||
//PLC 工位合格标志
|
||||
case "22":
|
||||
fun_IsOk(e);
|
||||
break;
|
||||
//PLC 螺栓补拧结束
|
||||
case "30":
|
||||
int value = Convert.ToInt32(MIS_BASE.ReadPLC(30, m_OpName));
|
||||
if (value == 0)
|
||||
{
|
||||
MIS_BASE.WritePLC(77, m_OpName, 0);
|
||||
MIS_BASE.WritePLC(88, m_OpName, 0);
|
||||
//先修改按钮显示
|
||||
BaseDataSystemMES.SetButtomShouOrHide(m_OpName, "MES_BoltAddWorkStart", 1, 1, "MES_BoltAddWorkEnd", 0);
|
||||
//通知前端刷新按钮
|
||||
SendMessageFun.SendInfomation("SetButtomShouOrHide", "1", m_OpName);
|
||||
}
|
||||
break;
|
||||
//PLC 螺栓抽检结束
|
||||
case "31":
|
||||
value = Convert.ToInt32(MIS_BASE.ReadPLC(31, m_OpName));
|
||||
if (value == 0)
|
||||
{
|
||||
MIS_BASE.WritePLC(77, m_OpName, 0);
|
||||
MIS_BASE.WritePLC(88, m_OpName, 0);
|
||||
//先修改按钮显示
|
||||
BaseDataSystemMES.SetButtomShouOrHide(m_OpName, "MES_BoltSpotCheckStart", 1, 1, "MES_BoltSpotCheckEnd", 0);
|
||||
//通知前端刷新按钮
|
||||
SendMessageFun.SendInfomation("SetButtomShouOrHide", "1", m_OpName);
|
||||
}
|
||||
break;
|
||||
//PLC 监听铭牌打印结果
|
||||
case "40":
|
||||
strValue = MIS_BASE.ReadPLC(40, m_OpName).ToString();
|
||||
//通知前端显示铭牌信息
|
||||
if(m_OpName == "J07MA080")
|
||||
{
|
||||
SendMessageFun.SendInfomation("WatchMA080barCode", strValue, m_OpName);
|
||||
}
|
||||
break;
|
||||
//MES保存实时质量数据
|
||||
case "65":
|
||||
fun_MesSaveNowData(e);
|
||||
break;
|
||||
//MES 系统健康心跳
|
||||
case "14":
|
||||
fun_HeartBeatMIS(e);
|
||||
break;
|
||||
case "63":
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
MIS_BASE.Read_TagTypeID(63, m_OpName, out S_plcStatus);
|
||||
if (Convert.ToInt32(S_plcStatus) == 0)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", m_OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", m_OpName);
|
||||
}
|
||||
break;
|
||||
case "64":
|
||||
// MA070确认返工 (501.6) 机动点,做特殊化操作
|
||||
string S_plcBackGo;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
MIS_BASE.Read_TagTypeID(64, m_OpName, out S_plcBackGo);
|
||||
if (m_OpName == "J07MA070" || m_OpName == "J07ET030")
|
||||
{
|
||||
if (S_plcBackGo == "1")
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowBackWorkBox", "1", m_OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowBackWorkBox", "0", m_OpName);
|
||||
}
|
||||
}
|
||||
if (m_OpName == "J07MA050")
|
||||
{
|
||||
if (Convert.ToBoolean(S_plcBackGo))
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", "吊耳未装配,或传感器未刷吊耳,请再次刷吊耳", m_OpName);
|
||||
}
|
||||
}
|
||||
//if (m_OpName == "J07ET030")
|
||||
//{
|
||||
// if (Convert.ToBoolean(S_plcBackGo))
|
||||
// {
|
||||
// SendMessageFun.SendInfomation("TestWorkErrorBox", "1", m_OpName);
|
||||
// }
|
||||
//}
|
||||
break;
|
||||
// PLC 程序号
|
||||
case "125":
|
||||
// 将程序号转发给前端页面
|
||||
string returnValue = e.TagValue.ToString();
|
||||
SendMessageFun.SendInfomation("CodeNumber", returnValue, m_OpName);
|
||||
break;
|
||||
// PLC 程序号的第几颗螺丝
|
||||
case "126":
|
||||
returnValue = e.TagValue.ToString();
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", returnValue, m_OpName);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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>
|
||||
public void fun_Barcode(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许保存
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DoWhatPlc.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(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WebSubmit, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工位是否合格
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_IsOk(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(IsOk, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatMIS(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(HeartBeat, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES实时保存质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesSaveNowData(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesSaveNowData, e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,214 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <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;
|
||||
DataTable dt;
|
||||
|
||||
dt = BaseDataSystemMES.EngineTypeChange(OpName, EngineType);
|
||||
//提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
|
||||
if(OpName == "J07MA050")
|
||||
{
|
||||
// 搜索是否为换型工件,是的话进抽检模式
|
||||
dt = BaseDataSystemMES.EngineTypeChange_MA050(EngineType);
|
||||
//提示机型发生变化
|
||||
if (Convert.ToInt32(dt.Rows[0]["result"]) == 1)
|
||||
{
|
||||
string message = "MES|MaterialList_Dif_Resources_MA050|" + OpName + "|" + 1;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
if(OpName == "J07MA040")
|
||||
{
|
||||
// 判断是否存在细一轴 若存在则去反给PLC(11.2)35
|
||||
DataTable OneAxleDt = BaseDataSystemMES.Get_EngineOneAxle(EngineType);
|
||||
if (Convert.ToInt32(OneAxleDt.Rows[0]["result"]) == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(35, OpName, true);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "该工件存在细一轴物料,请注意!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOverBQ(OpName);
|
||||
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("1235", "1111", OpName);
|
||||
//MIS_BASE.Read_PalletInfo(OpName, out MES_QualityMask);//合格标志 合格标志暂时改为即时响应式的
|
||||
MIS_BASE.Read_RepairStatus_PLC(OpName, out RepairPartStatusPLC);//返修标志
|
||||
//SendMessageFun.SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);//显示合格标志
|
||||
SendMessageFun.SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);//显示返修标志
|
||||
|
||||
if (MES_QualityMask == 2)
|
||||
{
|
||||
// 暂时先屏蔽掉
|
||||
////工作完成
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//SendMessageFun.SendInfomation("NgGO", "1", OpName);//显示不合格标志
|
||||
//return;
|
||||
}
|
||||
|
||||
//第三步,用于工件离开后完工数量统计及工件编号追溯
|
||||
//BaseDataSystemMES.MaterialPush_EngineIDStatus_Insert(OpName);//更新订单产量
|
||||
|
||||
// 读取当前工件螺丝数量
|
||||
DataTable dt3 = BaseDataSystemMES.Get_WorkPositionSizeByPBOM(OpName, EngineType);
|
||||
// 变量类型代码数组
|
||||
// 128 ~ 167
|
||||
//遍历 将所需要写入地址的值读取出来写入到相应地址中
|
||||
for (int i = 0; i <= dt3.Rows.Count - 1; i++)
|
||||
{
|
||||
// 读取当前行的数据 判断该放到第几行 将对于的数据放到对应数据区中
|
||||
// 获取OP操作号 用于判断放哪个地址
|
||||
int OPNumber = Convert.ToInt32(dt3.Rows[i]["OP本工位操作顺序号"]);
|
||||
// 128 ~ 137 操作类型
|
||||
MIS_BASE.WritePLC(127 + OPNumber, OpName, dt3.Rows[i]["主线设备操作类型"]);
|
||||
// 138 ~ 147 拧紧程序号
|
||||
MIS_BASE.WritePLC(137 + OPNumber, OpName, dt3.Rows[i]["拧紧程序号"]);
|
||||
// 148 ~ 157 螺栓数量
|
||||
MIS_BASE.WritePLC(147 + OPNumber, OpName, dt3.Rows[i]["传递数量"]);
|
||||
// 158 ~ 167 OP操作号(操作顺序 预留) 目前不用写入这个而是根据这个判断数据放对应区第几行
|
||||
}
|
||||
|
||||
|
||||
//读取当前法兰类型,发送给PLC(124)
|
||||
if(OpName == "J07MA070")
|
||||
{
|
||||
DataTable dt4 = BaseDataSystemMES.Get_EngineFlangeType(EngineType);
|
||||
int flange = Convert.ToInt32(dt4.Rows[0]["flange"]);
|
||||
if (dt4.Rows.Count > 0) MIS_BASE.WritePLC(124, OpName, flange);
|
||||
// 发送有无pkB 若有,就发1
|
||||
if (BaseDataSystemMES.Get_IsExistPKB(EngineType))
|
||||
{
|
||||
MIS_BASE.WritePLC(112, OpName, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(112, OpName, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//判断当前工件是否为售后机型 0.7(53)
|
||||
int Aftermarket;
|
||||
if (OpName == "J07MA080")
|
||||
{
|
||||
DataTable dt4 = BaseDataSystemMES.Get_EngineAftermarketType(EngineType);
|
||||
Aftermarket = Convert.ToInt32(dt4.Rows[0]["是否售后机型"]);
|
||||
MIS_BASE.WritePLC(53, OpName, Aftermarket);
|
||||
if(Aftermarket == 1)
|
||||
{
|
||||
string message = "MES|ShowTipBox|" + OpName + "|该工件为售后机型,需手动打印铭牌!";
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
//读取当前脉冲轮类型,发送给PLC(99)
|
||||
if (OpName == "J07ET030")
|
||||
{
|
||||
DataTable dt5 = BaseDataSystemMES.Get_ImpulseWheelMeter(EngineType);
|
||||
int impulseWheelMeter = Convert.ToInt32(dt5.Rows[0]["result"]);
|
||||
if (dt5.Rows.Count > 0) MIS_BASE.WritePLC(99, OpName, impulseWheelMeter);
|
||||
if (EngineType == "1384033006") MIS_BASE.WritePLC(53, OpName, true);
|
||||
DataTable dt6 = BaseDataSystemMES.Get_EmptySwitch_ONOFF(EngineType);
|
||||
MIS_BASE.WritePLC(114, OpName, dt6.Rows[0]["result"]);
|
||||
|
||||
DataTable dt7 = BaseDataSystemMES.Get_Test_FrockType(EngineType);
|
||||
MIS_BASE.WritePLC(17, OpName, dt7.Rows[0]["result"]);
|
||||
|
||||
}
|
||||
|
||||
//第四步,获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_two(string OpName)
|
||||
{
|
||||
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);
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, Convert.ToInt32(PartPallet_Code), OrderForm);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 跳过二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_Skip(string OpName)
|
||||
{
|
||||
//MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返修件需要工作
|
||||
/// </summary>
|
||||
/// <param name="OpName">工位号</param>
|
||||
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,127 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 此类用于向WEB发送各种类型消息
|
||||
/// </summary>
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <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>
|
||||
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,53 @@
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using DataLinkMesWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 发送信息到MES通讯服务器或者其他的
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private string AsyncSendMessage(string Message)
|
||||
{
|
||||
return MIS_BASE.asyncSendMessage(Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送提示消息
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
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>
|
||||
/// 发送信息到打印机
|
||||
/// </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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,208 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
///1.扫描配送单号,用于接收物料,扫描单号的时候,将接收的物料信息显示在“物料拉动”Tab区域
|
||||
///2.扫描料箱标签/看板卡,用于追溯物料批次信息
|
||||
///3.扫描零件条码,根据零件图号进行防错
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void Barcode(object e)
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
SendMessageFun.SendInfomation("BarCodeData", barcode, OpName); // 将扫码值发送给前端
|
||||
string AlarmStr = "";
|
||||
bool isShowBarNGTipBox;
|
||||
|
||||
int IsAllowWork;
|
||||
bool IsSuccess = false;
|
||||
|
||||
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);
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
bool EngineGetOver_PLC_NextWorkStep;
|
||||
//传递机型是否到位
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
|
||||
if (!EngineGetOver_PLC_NextWorkStep)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC未传递机型");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
// MA080 只扫描铭牌信息记录 记录完就退出
|
||||
int SaveBarCodeStatusType = 0;
|
||||
if (OpName == "J07MA080")
|
||||
{
|
||||
bool isMaterialVerifyOver;
|
||||
MIS_BASE.Read_MaterialVerifyOver(OpName,out isMaterialVerifyOver);
|
||||
if (isMaterialVerifyOver) {
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "工作已完成,不再校验铭牌内容");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
// 1.查看铭牌信息是否存在铭牌内容
|
||||
// 2.校验铭牌信息 成功则保存标志位(168)
|
||||
string barCodeData = MIS_BASE.ReadPLC(40, OpName).ToString();
|
||||
if(barCodeData == null || barCodeData == "")
|
||||
{
|
||||
// 先校验有没有记录 如果没有则继续正常提示
|
||||
DataTable barCodeCheckDt = BaseDataSystemMES.Check_MA080BarCode(EngineID,barcode);
|
||||
if(barCodeCheckDt.Rows.Count > 0) {
|
||||
MIS_BASE.WritePLC(168, OpName, 4);
|
||||
SaveBarCodeStatusType = 2;
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "存在打印铭牌记录,校验成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(168, OpName, 1);
|
||||
SaveBarCodeStatusType = 1;
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请先打印铭牌后进行校验信息");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(barCodeData == barcode)
|
||||
{
|
||||
// 校验条码中是否包含序列号
|
||||
if (barcode.Contains(EngineID.Split('*')[2]))
|
||||
{
|
||||
MIS_BASE.WritePLC(168, OpName, 2);
|
||||
SaveBarCodeStatusType = 2;
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "铭牌二维码信息校验成功");
|
||||
BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(168, OpName, 3);
|
||||
SaveBarCodeStatusType = 3;
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "所扫铭牌二维码中未包含条码序列号,请确认条码是否打印正确!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫铭牌二维码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(168, OpName, 3);
|
||||
SaveBarCodeStatusType = 3;
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "扫码信息于打印信息不一致!校验失败");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描铭牌二维码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
SendMessageFun.SendInfomation("J07MA080BarCodeCheckBrushWriting", barcode, OpName);
|
||||
if(SaveBarCodeStatusType == 2)
|
||||
{
|
||||
bool isOk = BaseDataSystemMES.BarCodeCheck_Add(OpName, EngineID, EngineType, EngineTypeID, barcode, SaveBarCodeStatusType);
|
||||
if (isOk)
|
||||
{
|
||||
// 通知前端刷新结果
|
||||
SendMessageFun.SendInfomation("J07MA080BarCodeCheckBrushWriting", barcode, OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "铭牌二维码信息保存失败");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描铭牌二维码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//物料验证
|
||||
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||||
if (!IsSuccess)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描物料码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//此处逻辑有问题 需要考虑到批次扫描 提示PLC未传递机型的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
//更新订单完工数量及物料
|
||||
SendMessageFun.SendMessage("24", "11", OpName);
|
||||
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
|
||||
// 在物料验证完成后110 工位将该条码的总分先关系保存 并且信息拉取过来并且给允许工作 将两个工位该总成绑定的物料都给拉过来
|
||||
if(OpName == "J07MA110")
|
||||
{
|
||||
BaseDataSystemMES.BusPartLine_Add(EngineID, barcode, OpName, OrderForm, EngineType);
|
||||
BaseDataSystemMES.Update_DataBaind(EngineID,OpName,"J07PA050");
|
||||
BaseDataSystemMES.Update_DataBaind(EngineID,OpName,"J07PA060");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(4, e, "Fun1052", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:Barcode");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void ConfirmOkGo(object e)
|
||||
{
|
||||
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,129 @@
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if(OpNameIsWorkDt.Rows.Count > 0)
|
||||
{
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
|
||||
if (EngineTypeID <= 0 || EngineID.Length == 0 || EngineType.Length == 0 || OrderForm.Length == 0)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
|
||||
return;
|
||||
}
|
||||
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, EngineID);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm, OrderForm);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.PartPallet_Code, PartPallet_Code.ToString());
|
||||
|
||||
// 判断是否返修件 是否需要继续工作
|
||||
int isBackWork = 0;
|
||||
DataTable backWorkDt = BaseDataSystemMES.Get_IsBackWork(OpName, EngineID);
|
||||
if (backWorkDt.Rows[0]["result"].ToString() == "1")
|
||||
{
|
||||
// 写返修点并且退出方法
|
||||
MIS_BASE.WritePLC(33, OpName, true);
|
||||
string message = "MES|ShowTipBox|" + OpName + "|该工件为返工工件!";
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
if(OpName != "J07ET040")
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 设置一个标识点表示这个是ET040 返修件
|
||||
isBackWork = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(OpName == "J07ET060")
|
||||
{
|
||||
DataTable ET060BackWorkDt = BaseDataSystemMES.Get_IsET060BackWork(EngineID);
|
||||
if (backWorkDt.Rows[0]["result"].ToString() == "1")
|
||||
{
|
||||
// 写返修点并且退出方法
|
||||
MIS_BASE.WritePLC(33, OpName, true);
|
||||
string message = "MES|ShowTipBox|" + OpName + "|该工件为返工工件!";
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
//显示当前订单信息
|
||||
//SendMessage.ShowMoby(OpName);
|
||||
// ET030 无屏幕 不判断是否重复工作过
|
||||
|
||||
//判断该订单数据是否已经工作过,有的话则在WEB跳出弹窗选择 并同时禁止工作
|
||||
DataTable dt2 = BaseDataSystemMES.EngineIsTwoWork(OpName, OrderForm, EngineID);
|
||||
if (dt2.Rows[0]["result"].ToString() == "1" && isBackWork == 0) //已完成
|
||||
{
|
||||
//不允许工作
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
//通知WEB校验重新工作还是跳过 点重新工作给允许工作,点跳过给工作完成
|
||||
string message = "MES|Engine_Is_TwoWork|" + OpName + "|1";
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
//正常传递机型流程
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(2, e, "Fun1052", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FalseGO(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
//不合格放行信号
|
||||
//MIS_BASE.Write_FalseGO(OpName, true);
|
||||
//总合格标志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,54 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeat(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//返写在MES心跳中
|
||||
//MIS_BASE.WritePLC(15, OpName, tagValue);
|
||||
|
||||
if (OpName == "J07MA010")
|
||||
{
|
||||
// 给MA010工位推送实时温度
|
||||
SendMessageFun.SendInfomation("MA010Temperature", MIS_BASE.ReadPLC(110, OpName).ToString(), OpName);
|
||||
// 读取MA010MES写入温度发送到码块
|
||||
DataTable dt;
|
||||
BaseDataSystemMES.Get_TempData(OpName, "温度", out dt);
|
||||
MIS_BASE.WritePLC(111, OpName, dt.Rows[0]["数值"]);
|
||||
}
|
||||
|
||||
// 获取登录状态
|
||||
if (tagValue == 1)
|
||||
{
|
||||
//DataTable tempDt;
|
||||
//BaseDataSystemMES.Get_TempData(OpName, "登陆状态", out tempDt);
|
||||
//if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, OpName, tempDt.Rows[0]["数值"]);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using bizFacade;
|
||||
using Function1052.SaveCode;
|
||||
using MesServerWork;
|
||||
using MesWork;
|
||||
using System;
|
||||
using System.Data;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许保存(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
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);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int qualityMask;
|
||||
|
||||
//先去判断是否需要弹出弹窗,若弹出,点确认后给PLC发一个点表示点过了
|
||||
DataTable WordOver = BaseDataSystemMES.WorkOver_IsShowWindow(OpName, EngineTypeID);
|
||||
if (Convert.ToInt32(WordOver.Rows[0]["result"]) == 1)
|
||||
{
|
||||
string message = "MES|WorkOver_Is_ShowWindow|" + OpName + "|" + WordOver.Rows[0]["msg"];
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
//MIS_BASE.WritePLC(35, OpName, 1);
|
||||
}
|
||||
|
||||
// MA080 需要保存铭牌二维码信息
|
||||
if (OpName == "J07MA080")
|
||||
{
|
||||
SaveCode_J07MA080.SaveCode(OpName);
|
||||
}
|
||||
|
||||
// 保存质量数据
|
||||
qualityMask = MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
// 保存物料数据
|
||||
BaseDataSystemMES.Material_Insert(OpName, qualityMask);
|
||||
|
||||
// 测量数据发动机在线状态
|
||||
BaseDataSystemMES.WorkStartInsert(OpName, qualityMask);
|
||||
|
||||
// 推送质量数据到MES的页面
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
|
||||
// ET030 需要保存试验台信息
|
||||
if (OpName == "J07ET030")
|
||||
{
|
||||
BaseDataSystemMES.TestStandDataSave();
|
||||
// 判断如果合格标志是不合格那就添加到返工记录里去 }
|
||||
if(qualityMask == 2)
|
||||
{
|
||||
BaseDataSystemMES.TestStandBackWorkData(EngineID, EngineType, OrderForm);
|
||||
}
|
||||
}
|
||||
|
||||
//对应手动工位的
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(3, e, "Fun1052", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesReadOver(object e)
|
||||
{
|
||||
//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,40 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES保存实时质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesSaveNowData(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
// 直接发送实时的 质量数据
|
||||
string message = MisDataSaveDateMesRead.Funtion.GetRealTimeQualityData(OpName);
|
||||
//推送质量数据到MES的页面
|
||||
SendMessage.AsyncSendMessage("MES|ShowTimelyQuality_Resources|" + OpName + "|" + message);
|
||||
//SendMessageFun.SendMessageMESToWEB("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,429 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
//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
|
||||
{
|
||||
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_EngineTypeID == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
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;
|
||||
string strValue;
|
||||
int intValue;
|
||||
|
||||
//根据请求的命令处理逻辑
|
||||
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);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ConfirmOkGo(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);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_FalseGO(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);
|
||||
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 "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;
|
||||
case "twoWorkSkip"://重新工作工件跳过工作(重新工作工件)
|
||||
//工作完成
|
||||
EngineTypeGetOver_PLC_Work_Skip(OpName);
|
||||
break;
|
||||
case "twoWork"://重新工作工件重新工作(重新工作工件)
|
||||
//允许工作
|
||||
EngineTypeGetOver_PLC_Work_two(OpName);
|
||||
break;
|
||||
case "WorkOver_Is_ShowWindow"://重新走保存逻辑
|
||||
if (OpName == "J07MA140")
|
||||
{
|
||||
MIS_BASE.WritePLC(35, OpName, 1);
|
||||
}
|
||||
break;
|
||||
case "FaultBackWork"://返修工件
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(34, OpName, true);
|
||||
break;
|
||||
case "FaultBackWorkUnpack"://返修 拆解返工
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(24, OpName, 1);
|
||||
break;
|
||||
case "FaultBackWorkSelect"://返修 选择工位返工
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(24, OpName, 2);
|
||||
break;
|
||||
case "remedyWork"://补拧工件
|
||||
// 接受传来的补拧程序号 补拧数量 拆分
|
||||
string[] arr = m_Value.ToString().Split('&');
|
||||
string codeNumber = arr[0];
|
||||
string workCount = arr[1];
|
||||
// 写入地址 在工件离开后清空
|
||||
MIS_BASE.WritePLC(77, OpName, codeNumber);
|
||||
MIS_BASE.WritePLC(88, OpName, workCount);
|
||||
// 若这个点被置0了说明PLC那补拧结束了
|
||||
MIS_BASE.WritePLC(30, OpName, true);
|
||||
break;
|
||||
case "remedyWorkEnd"://补拧工件
|
||||
MIS_BASE.WritePLC(77, OpName, 0);
|
||||
MIS_BASE.WritePLC(88, OpName, 0);
|
||||
MIS_BASE.WritePLC(30, OpName, false);
|
||||
break;
|
||||
case "boltSpotCheck"://螺栓抽检
|
||||
// 接受传来的补拧程序号 补拧数量 拆分
|
||||
arr = m_Value.ToString().Split('&');
|
||||
codeNumber = arr[0];
|
||||
workCount = arr[1];
|
||||
// 写入地址 在工件离开后清空
|
||||
MIS_BASE.WritePLC(77, OpName, codeNumber);
|
||||
MIS_BASE.WritePLC(88, OpName, workCount);
|
||||
// 若这个点被置0了说明PLC那抽检结束了
|
||||
MIS_BASE.WritePLC(31, OpName, true);
|
||||
break;
|
||||
case "boltSpotCheckEnd"://螺栓抽检结束
|
||||
MIS_BASE.WritePLC(77, OpName, 0);
|
||||
MIS_BASE.WritePLC(88, OpName, 0);
|
||||
MIS_BASE.WritePLC(31, OpName, false);
|
||||
break;
|
||||
case "againGetNowData":
|
||||
strValue = MIS_BASE.ReadPLC(40, OpName).ToString();
|
||||
//通知前端显示铭牌信息
|
||||
if (OpName == "J07MA080")
|
||||
{
|
||||
SendMessageFun.SendInfomation("WatchMA080barCode", strValue, OpName);
|
||||
}
|
||||
break;
|
||||
case "againGetWorkPosition"://前端请求再次获取拧紧数据
|
||||
// 接收到请求后读取这两个点的数据发给前台
|
||||
// 查询螺丝号是否存在 存在则发送给前端
|
||||
string CodeNumber;
|
||||
MIS_BASE.Read_TagTypeID(125, OpName, out CodeNumber);
|
||||
SendMessageFun.SendInfomation("CodeNumber", CodeNumber, OpName);
|
||||
|
||||
// 查询螺丝号下拧紧排序是否存在 存在则发送给前端
|
||||
string CodeNumberWorkNumber;
|
||||
MIS_BASE.Read_TagTypeID(126, OpName, out CodeNumberWorkNumber);
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", CodeNumberWorkNumber, OpName);
|
||||
break;
|
||||
case "closeWebWindow":// 前端窗口关闭
|
||||
// 将持久化存储表中工位的登陆状态设置为接受值
|
||||
BaseDataSystemMES.Set_TempData(OpName, "登陆状态", m_Value);
|
||||
MIS_BASE.WritePLC(54, OpName, false);
|
||||
break;
|
||||
case "SkipDiskBearing":// 跳过盘轴
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.WritePLC(32, OpName, false);
|
||||
break;
|
||||
case "QuitEngineTypeCheck":// 发送给服务器换型请求,等待服务器换型判断发送到页面端
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.EngineTypeChange(OpName, m_Value);
|
||||
//提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
// 写入MOBY 写入机型信息与清空总成号
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, mesValue);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, "");
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("5", "1", OpName);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WebSubmit");
|
||||
}
|
||||
}
|
||||
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>
|
||||
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);
|
||||
|
||||
DataTable tempDt;
|
||||
BaseDataSystemMES.Get_TempData(Opname, "登陆状态", out tempDt);
|
||||
if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, Opname, tempDt.Rows[0]["数值"]);
|
||||
|
||||
Sendmessage("135", "1111", Opname);
|
||||
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
if (Convert.ToInt32(S_plcStatus) == 0)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
|
||||
string strValue = MIS_BASE.ReadPLC(40, Opname).ToString();
|
||||
//通知前端显示铭牌信息
|
||||
if (Opname == "J07MA080")
|
||||
{
|
||||
SendMessageFun.SendInfomation("WatchMA080barCode", strValue, Opname);
|
||||
}
|
||||
|
||||
// 查询螺丝号是否存在 存在则发送给前端
|
||||
string CodeNumber;
|
||||
MIS_BASE.Read_TagTypeID(125, Opname, out CodeNumber);
|
||||
if (CodeNumber != "0")
|
||||
{
|
||||
SendMessageFun.SendInfomation("CodeNumber", CodeNumber,Opname);
|
||||
}
|
||||
|
||||
// 查询螺丝号下拧紧排序是否存在 存在则发送给前端
|
||||
string CodeNumberWorkNumber;
|
||||
MIS_BASE.Read_TagTypeID(126, Opname, out CodeNumberWorkNumber);
|
||||
if (CodeNumberWorkNumber != "0")
|
||||
{
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", CodeNumberWorkNumber,Opname);
|
||||
}
|
||||
|
||||
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), 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);
|
||||
}
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
Sendmessage("2", "1111", Opname);
|
||||
//SendMessage.ShowMoby(Opname);
|
||||
// 直接发送实时的 质量数据
|
||||
string message = MisDataSaveDateMesRead.Funtion.GetRealTimeQualityData(Opname);
|
||||
//推送质量数据到MES的页面
|
||||
SendMessage.AsyncSendMessage("MES|ShowTimelyQuality_Resources|" + Opname + "|" + message);
|
||||
}
|
||||
InitAlarm(Opname);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工位合格标志
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void IsOk(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int qualityMask;
|
||||
MIS_BASE.Read_QualityMask(OpName, out qualityMask);
|
||||
//判断是否合格
|
||||
if (qualityMask == 1)
|
||||
{
|
||||
qualityMask = 1;
|
||||
} else {
|
||||
qualityMask = 0;
|
||||
}
|
||||
//通知WEB修改状态
|
||||
string message = "MES|QualityMask|" + OpName + "|" + qualityMask.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Threading;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void WorkStart(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue > 0)
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStart, tagValue.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
Thread.Sleep(500);
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
//补拧工件 写入地址 在工件离开后清空
|
||||
MIS_BASE.WritePLC(77, OpName, 0);
|
||||
MIS_BASE.WritePLC(88, OpName, 0);
|
||||
// 是否返修点
|
||||
MIS_BASE.WritePLC(33, OpName, false);
|
||||
MIS_BASE.WritePLC(34, OpName, false);
|
||||
MIS_BASE.WritePLC(35, OpName, false);
|
||||
if (OpName == "J07MA070")
|
||||
{
|
||||
MIS_BASE.WritePLC(124, OpName, 0);
|
||||
MIS_BASE.WritePLC(112, OpName, 0);
|
||||
}
|
||||
// 清除程序号那些BYTE点
|
||||
for (int i = 1;i <= 40; i++)
|
||||
{
|
||||
MIS_BASE.WritePLC(127+i, OpName, 0);
|
||||
}
|
||||
if(OpName == "J07MA080")
|
||||
{
|
||||
MIS_BASE.WritePLC(168, OpName, 0);
|
||||
MIS_BASE.WritePLC(53, OpName, 0);
|
||||
}
|
||||
if (OpName == "J07ET030")
|
||||
{
|
||||
MIS_BASE.WritePLC(99, OpName, 0);
|
||||
MIS_BASE.WritePLC(53, OpName, false);
|
||||
MIS_BASE.WritePLC(114, OpName, 0);
|
||||
}
|
||||
if(OpName == "J07MA140")
|
||||
{
|
||||
MIS_BASE.WritePLC(35, OpName, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WorkStart");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Function02")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("苏州宏软信息技术有限公司")]
|
||||
[assembly: AssemblyProduct("Function02")]
|
||||
[assembly: AssemblyCopyright("Copyright © 苏州宏软信息技术有限公司 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("47710f2c-e141-4252-8d13-701bf4c1c027")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 内部版本号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
using bizFacade;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Function1052.SaveCode
|
||||
{
|
||||
public class SaveCode_J07MA080
|
||||
{
|
||||
public static Boolean SaveCode(String OpName)
|
||||
{
|
||||
|
||||
bool result = false;
|
||||
try
|
||||
{
|
||||
//北汽福田_TCU_增加
|
||||
//铭牌号 物料码
|
||||
String nameplate;
|
||||
//总成码
|
||||
String EngineID;
|
||||
//机型代码
|
||||
String EngineTypeID;
|
||||
|
||||
|
||||
//获取物料码
|
||||
nameplate = DtWebApi.ReadWritePLC.ReadPLC("40", OpName).ToString();
|
||||
//变速器总成码
|
||||
EngineID = DtWebApi.ReadWritePLC.ReadPLC("10", OpName).ToString();
|
||||
EngineTypeID = DtWebApi.ReadWritePLC.ReadPLC("11", OpName).ToString();
|
||||
|
||||
BaseDataSystemMES.TCU_Add(OpName, nameplate, EngineID, EngineTypeID);
|
||||
result = true;
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
MisDataFunction/MesServer.Function/Function1052/app.config
Normal file
19
MisDataFunction/MesServer.Function/Function1052/app.config
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MQTTnet" publicKeyToken="b69712f52770c0a7" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.13.0" newVersion="3.0.13.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,5 @@
|
||||
SCC = This is a Source Code Control file
|
||||
|
||||
[Function02.csproj]
|
||||
SCC_Aux_Path = "\\192.168.0.100\vss\MES4.0"
|
||||
SCC_Project_Name = "$/MisData/MisData/MisData/MesServer.Function/Function02", ILHAAAAA
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
|
||||
<package id="MQTTnet" version="3.0.13" targetFramework="net461" />
|
||||
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.13" targetFramework="net461" />
|
||||
<package id="NETStandard.Library" version="2.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
|
||||
<package id="System.Net.Security" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" requireReinstallation="true" />
|
||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
|
||||
</packages>
|
||||
BIN
MisDataFunction/MesServer.Function/Function1052/vssver2.scc
Normal file
BIN
MisDataFunction/MesServer.Function/Function1052/vssver2.scc
Normal file
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class Function1053
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
74
MisDataFunction/MesServer.Function/Function1053/Db.cs
Normal file
74
MisDataFunction/MesServer.Function/Function1053/Db.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DataLinkMesWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public class Db
|
||||
{
|
||||
/// <summary>
|
||||
/// 北汽福田变速器序列号总线上线_获得机型信息
|
||||
/// </summary>
|
||||
/// <param name="partSn"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="IsRepeatedNumber"> 0 不重号;1 重号;2:失败</param>
|
||||
/// <returns></returns>
|
||||
public static bool GetEngineType(string partSn, out int EngineTypeID, out string EngineType, out string EngineID,out int IsRepeatedNumber)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
EngineTypeID = 0;
|
||||
EngineType = "";
|
||||
EngineID = "";
|
||||
IsRepeatedNumber = 2;
|
||||
string produceName = "北汽福田变速器序列号总线上线_获得机型信息";
|
||||
SqlParameter[] thisParms = new SqlParameter[1];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@变速器序列号", partSn);
|
||||
|
||||
thisParms[2].Direction = ParameterDirection.Output;
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms,out dt))
|
||||
{
|
||||
if(dt.Rows.Count > 0)
|
||||
{
|
||||
IsRepeatedNumber = Convert.ToInt32( dt.Rows[0]["IsRepeatedNumber"]);
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["EngineTypeID"]);
|
||||
EngineType = dt.Rows[0]["EngineType"].ToString();
|
||||
EngineID = partSn;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 北汽福田变速器序列号总线上线_增加
|
||||
/// </summary>
|
||||
/// <param name="partSn"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="OpName"></param>
|
||||
/// <returns></returns>
|
||||
public static bool UpLoadOpNameInsert(string partSn, int EngineTypeID, string EngineType, string OpName)
|
||||
{
|
||||
|
||||
string produceName = "北汽福田变速器序列号总线上线_增加";
|
||||
SqlParameter[] thisParms = new SqlParameter[4];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@变速器序列号", partSn);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@基本型号代码", EngineTypeID);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@基本型号", EngineType);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@工位号", OpName);
|
||||
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
|
||||
}
|
||||
|
||||
// ALTER PROCEDURE[dbo].[北汽福田变速器序列号总线上线_增加]
|
||||
// @变速器序列号 nvarchar(50)='1333 050 062 0001*146012023*12345678',--'1333 050 062 0001'
|
||||
//@基本型号代码 int=1,
|
||||
//@基本型号 nvarchar(50)='1333 050 062 0001',
|
||||
//@工位号 nvarchar(50) = 'J05PA010'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = "relative:MesServer.Function\\Function02"
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
<?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>{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Function1053</RootNamespace>
|
||||
<AssemblyName>Function1053</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>..\..\..\dll_fun\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<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="MQTTnet">
|
||||
<HintPath>..\..\..\Common\dll\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient">
|
||||
<HintPath>..\..\..\Common\dll\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>..\..\..\Common\dll\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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="Db.cs" />
|
||||
<Compile Include="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="Methods\SubmitToMisweb.cs" />
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="MesServerFunction\Fun_1053.cs" />
|
||||
<Compile Include="Methods\UDP.Send.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\ConfirmOkGo.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\FalseGO.cs" />
|
||||
<Compile Include="OpcServer\HeartBeat.cs" />
|
||||
<Compile Include="OpcServer\J07PA010WorkStart.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\MesReadOver.cs" />
|
||||
<Compile Include="OpcServer\PartLoad.cs" />
|
||||
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
||||
<Compile Include="OpcServer\WebSubmit.cs" />
|
||||
<Compile Include="OpcServer\WorkIsOk.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\00MesWorkMqtt\MesWorkMqtt\00MesWorkMqtt.csproj">
|
||||
<Project>{f55da1a0-a982-4479-8c47-0d9a5aaf3e18}</Project>
|
||||
<Name>00MesWorkMqtt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\01DoWhatPlc\01_01DoWhatPlc.csproj">
|
||||
<Project>{0d1af432-439a-4920-8692-43ae139f5530}</Project>
|
||||
<Name>01_01DoWhatPlc</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\02WebApiCall\02_02WebApiCallPLC.csproj">
|
||||
<Project>{3e6d1dd5-01c9-435f-9941-61f906ce35bb}</Project>
|
||||
<Name>02_02WebApiCallPLC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\04DataBaseAccess\DataBaseAccess\04-DataBaseAccess.csproj">
|
||||
<Project>{f434e066-4c59-47c8-aa82-6f48cc84501a}</Project>
|
||||
<Name>04-DataBaseAccess</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\07WebBusinessFacade\BusinessFacade\07BusinessFacade.csproj">
|
||||
<Project>{f0a0c525-03fd-428a-9b17-7f54aa0e4475}</Project>
|
||||
<Name>07BusinessFacade</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\08WebFun_base\WebFun_base\08-WebFun_base.csproj">
|
||||
<Project>{d98be764-adeb-488d-9714-61e308aa8201}</Project>
|
||||
<Name>08-WebFun_base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\09MesDataFunction\MesDataFunction\09-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MisDataFun\SendMessageToWebMqtt\12SendMessageToWeb.csproj">
|
||||
<Project>{e4eb6420-906d-4672-947a-ca33ddcdadfc}</Project>
|
||||
<Name>12SendMessageToWeb</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MIS_FuntionSaveData\MIS_FuntionSaveData\13.3MIS_FuntionSaveData.csproj">
|
||||
<Project>{55b510c1-59e9-4bfd-ae84-d76d46f6e365}</Project>
|
||||
<Name>02-13.3MIS_FuntionSaveData</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>
|
||||
@@ -0,0 +1,337 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DoWhatPlc.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = DoWhatPlc.MessageText.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();
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs e = new DoWhatPlc.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DoWhatPlc.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<DoWhatPlc.CustomeEvetnArgs>(m_Value);
|
||||
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 "43":
|
||||
fun_PartLoad(e);
|
||||
break;
|
||||
//PLC 允许保存质量数据
|
||||
case "19":
|
||||
fun_MesRead(e);
|
||||
break;
|
||||
//MES 保存数据完成
|
||||
case "20":
|
||||
fun_MesReadOver(e);
|
||||
break;
|
||||
//PLC 工位合格标志
|
||||
case "22":
|
||||
fun_IsOk(e);
|
||||
break;
|
||||
//PLC PA010走流程点 6s1
|
||||
case "25":
|
||||
if(m_OpName == "J07PA010")
|
||||
{
|
||||
e.TagTypeID = 0;
|
||||
e.TagTypeCodeID = 30; // 写入报警点变量位置
|
||||
fun_J07PA010_WorkStart(e);
|
||||
}
|
||||
break;
|
||||
//PLC PA010走流程点 6s2
|
||||
case "26":
|
||||
if (m_OpName == "J07PA010")
|
||||
{
|
||||
e.TagTypeID = 1;
|
||||
e.TagTypeCodeID = 31; // 写入报警点变量位置
|
||||
//fun_J07PA010_WorkStart(e);
|
||||
}
|
||||
break;
|
||||
//PLC PA010走流程点 6s3
|
||||
case "27":
|
||||
if (m_OpName == "J07PA010")
|
||||
{
|
||||
e.TagTypeID = 1;
|
||||
//e.TagTypeID = 2;
|
||||
e.TagTypeCodeID = 31; // 写入报警点变量位置
|
||||
//e.TagTypeCodeID = 32; // 写入报警点变量位置
|
||||
fun_J07PA010_WorkStart(e);
|
||||
}
|
||||
break;
|
||||
//PLC PA010走流程点 5s1
|
||||
case "28":
|
||||
if (m_OpName == "J07PA010")
|
||||
{
|
||||
e.TagTypeID = 0;
|
||||
e.TagTypeCodeID = 33; // 写入报警点变量位置
|
||||
fun_J07PA010_WorkStart(e);
|
||||
}
|
||||
break;
|
||||
//PLC PA010走流程点 5s2
|
||||
case "29":
|
||||
if (m_OpName == "J07PA010")
|
||||
{
|
||||
e.TagTypeID = 1;
|
||||
e.TagTypeCodeID = 34; // 写入报警点变量位置
|
||||
fun_J07PA010_WorkStart(e);
|
||||
}
|
||||
break;
|
||||
//PLC PA010走流程点 5s3
|
||||
case "35":
|
||||
if (m_OpName == "J07PA010")
|
||||
{
|
||||
e.TagTypeID = 2;
|
||||
e.TagTypeCodeID = 36; // 写入报警点变量位置
|
||||
fun_J07PA010_WorkStart(e);
|
||||
}
|
||||
break;
|
||||
//PLC 螺栓补拧结束
|
||||
case "30":
|
||||
int value = Convert.ToInt32(MIS_BASE.ReadPLC(30, m_OpName));
|
||||
if (value == 0)
|
||||
{
|
||||
MIS_BASE.WritePLC(77, m_OpName, 0);
|
||||
MIS_BASE.WritePLC(88, m_OpName, 0);
|
||||
//先修改按钮显示
|
||||
BaseDataSystemMES.SetButtomShouOrHide(m_OpName, "MES_BoltAddWorkStart", 1, 1, "MES_BoltAddWorkEnd", 0);
|
||||
//通知前端刷新按钮
|
||||
SendMessageFun.SendInfomation("SetButtomShouOrHide", "1", m_OpName);
|
||||
}
|
||||
break;
|
||||
//PLC 传递机型
|
||||
case "44":
|
||||
fun_EngineTypeGetOverPLC(e);
|
||||
break;
|
||||
//MES 合格放行
|
||||
case "51":
|
||||
fun_ConfirmOkGo(e);
|
||||
break;
|
||||
//MES 不合格放行
|
||||
case "8":
|
||||
fun_FalseGo(e);
|
||||
break;
|
||||
//MES保存实时质量数据
|
||||
case "65":
|
||||
fun_MesSaveNowData(e);
|
||||
break;
|
||||
//MES 系统健康心跳
|
||||
case "14":
|
||||
fun_HeartBeatMIS(e);
|
||||
break;
|
||||
case "63":
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
MIS_BASE.Read_TagTypeID(63, m_OpName, out S_plcStatus);
|
||||
if (Convert.ToInt32(S_plcStatus) == 0)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", m_OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", m_OpName);
|
||||
}
|
||||
break;
|
||||
// PLC 程序号
|
||||
case "125":
|
||||
// 将程序号转发给前端页面
|
||||
SendMessageFun.SendInfomation("CodeNumber", e.TagValue.ToString(), m_OpName);
|
||||
break;
|
||||
// PLC 程序号的第几颗螺丝
|
||||
case "126":
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", e.TagValue.ToString(), m_OpName);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//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>
|
||||
/// PA010 工作流程开始
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_J07PA010_WorkStart(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(J07PA010WorkStart, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
///
|
||||
public void fun_Barcode(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatMIS(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(HeartBeat, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许保存
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WorkStart, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 申请上线 43
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_PartLoad(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(PartLoad, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
public void fun_WebSubmit(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WebSubmit, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES实时保存质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesSaveNowData(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesSaveNowData, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工位是否合格
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_IsOk(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(IsOk, e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <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;
|
||||
//string OrderForm = "";//订单号
|
||||
//DataTable dt;
|
||||
|
||||
if (EngineTypeID <= 0 || EngineID.Length == 0 || EngineType.Length == 0 || OrderForm.Length == 0)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
|
||||
return;
|
||||
}
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOverBQ(OpName);
|
||||
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("1235", "1111", OpName);
|
||||
MIS_BASE.Read_PalletInfo(OpName, out MES_QualityMask);//合格标志
|
||||
MIS_BASE.Read_RepairStatus_PLC(OpName, out RepairPartStatusPLC);//返修标志
|
||||
SendMessageFun.SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);//显示合格标志
|
||||
SendMessageFun.SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);//显示返修标志
|
||||
|
||||
if (MES_QualityMask == 2)
|
||||
{
|
||||
//// 工作完成
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//SendMessageFun.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
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_two(string OpName)
|
||||
{
|
||||
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);
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, Convert.ToInt32(PartPallet_Code), OrderForm);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 跳过二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_Skip(string OpName)
|
||||
{
|
||||
//MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返修件需要工作
|
||||
/// </summary>
|
||||
/// <param name="OpName">工位号</param>
|
||||
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,127 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 此类用于向WEB发送各种类型消息
|
||||
/// </summary>
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <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>
|
||||
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,53 @@
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using DataLinkMesWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 发送信息到MES通讯服务器或者其他的
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private string AsyncSendMessage(string Message)
|
||||
{
|
||||
return MIS_BASE.asyncSendMessage(Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送提示消息
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
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>
|
||||
/// 发送信息到打印机
|
||||
/// </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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
///1.扫描配送单号,用于接收物料,扫描单号的时候,将接收的物料信息显示在“物料拉动”Tab区域
|
||||
///2.扫描料箱标签/看板卡,用于追溯物料批次信息
|
||||
///3.扫描零件条码,根据零件图号进行防错
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void Barcode(object e)
|
||||
{
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
SendMessageFun.SendInfomation("BarCodeData", barcode, OpName); // 将扫码值发送给前端
|
||||
string AlarmStr = "";
|
||||
bool isShowBarNGTipBox;
|
||||
|
||||
int IsAllowWork;
|
||||
bool IsSuccess = false;
|
||||
bool EngineGetOver_PLC_NextWorkStep;
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
//传递机型是否到位
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
|
||||
if (!EngineGetOver_PLC_NextWorkStep)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC未传递机型");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
//物料验证
|
||||
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||||
if (!IsSuccess)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
}
|
||||
|
||||
//获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//此处逻辑有问题 需要考虑到批次扫描 提示PLC未传递机型的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
|
||||
//更新订单完工数量及物料
|
||||
SendMessageFun.SendMessage("24", "11", OpName);
|
||||
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "扫码完成,请开始工作!");
|
||||
BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(4, e, "Fun1053", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:Barcode");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void ConfirmOkGo(object e)
|
||||
{
|
||||
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,108 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
string OrderForm_MES;
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_MES;//工件编号
|
||||
|
||||
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);
|
||||
|
||||
// 测试的时候用的 plc读取订单号有问题
|
||||
// OrderForm = BaseDataSystemMES.GetOrderDataBySn(EngineID);
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( EngineID_MES == EngineID & EngineType_MES == EngineType)
|
||||
{
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.EngineTypeChange(OpName, EngineType);
|
||||
//提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, EngineType);
|
||||
if ((OpName == "J07PA040" && Convert.ToBoolean(MIS_BASE.ReadPLC(64, OpName))) || OpName == "J07PA030")
|
||||
{
|
||||
// 在保存后才将托盘号置位为1
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, EngineID+"-2");
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, EngineID);
|
||||
}
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm, OrderForm);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.PartPallet_Code, PartPallet_Code.ToString());
|
||||
|
||||
//显示当前订单信息
|
||||
SendMessage.ShowMoby(OpName);
|
||||
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "PLC机型与MES机型不匹配!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(2, e, "Fun1053", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FalseGO(object e)
|
||||
{
|
||||
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,66 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeat(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//返写在MES心跳中
|
||||
//MIS_BASE.WritePLC(15, OpName, tagValue);
|
||||
|
||||
// 获取登录状态
|
||||
//if (tagValue == 1)
|
||||
//{
|
||||
//DataTable tempDt;
|
||||
//BaseDataSystemMES.Get_TempData(OpName, "登陆状态", out tempDt);
|
||||
//if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, OpName, tempDt.Rows[0]["数值"]);
|
||||
//}
|
||||
|
||||
//PA010 需要将当前选中订单的状态发送给PLC
|
||||
if (OpName == "J07PA010")
|
||||
{
|
||||
DataTable workDt;
|
||||
BaseDataSystemMES.Get_NowWorkOrder(OpName, out workDt);
|
||||
// 获取数据 判断有没有条数 没有就全置0 有的话根据机型给 71 5s 72 6s
|
||||
MIS_BASE.WritePLC(71, OpName, false);
|
||||
MIS_BASE.WritePLC(72, OpName, false);
|
||||
if (workDt.Rows.Count > 0)
|
||||
{
|
||||
if (Convert.ToInt32(workDt.Rows[0]["机型代码"]) == 1 || Convert.ToInt32(workDt.Rows[0]["机型代码"]) == 2)
|
||||
{
|
||||
// 5s
|
||||
MIS_BASE.WritePLC(71, OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(72, OpName, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
// 触发J07PA010流程
|
||||
private void J07PA010WorkStart(object e)
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
int EngineTypeID;
|
||||
string EngineType;
|
||||
string EngineID;
|
||||
int PartPallet_Code;
|
||||
string OrderForm;
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
int tagTypeID = Convert.ToInt32(msgEvent.TagTypeID); // 1. 计数1 2.计数2
|
||||
int TagTypeCodeID = Convert.ToInt32(msgEvent.TagTypeCodeID); // 报警点位置
|
||||
|
||||
//25 ~34 10个地址
|
||||
//25 26 27 为6s 触发
|
||||
//28 29 为5s触发
|
||||
//30 31 32 为6s报警
|
||||
//33 34 5s报警
|
||||
|
||||
// 35 5S 3 触发
|
||||
// 36 5S 3 报警
|
||||
if (tagValue == 1)
|
||||
{
|
||||
List<int> errorPositonList = new List<int> {30,31,32,33,34,36};
|
||||
|
||||
for (int i = 0;i < errorPositonList.Count; i++) {
|
||||
int itemErrorPositon = errorPositonList[i];
|
||||
MIS_BASE.WritePLC(itemErrorPositon, OpName, false); // 清空报警信号
|
||||
}
|
||||
|
||||
// 只用于PA010工位的逻辑循环
|
||||
// 1.将报警变量置位为0
|
||||
// 2.判断当前有没有选择订单号 若没有选择订单号则不工作,提示选择订单号
|
||||
// 只需要 订单号,总成号,机型号 托盘编号为0
|
||||
//北汽福田工位状态监控MOBY_查询_订单下达用
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.GetNowWorkOrderData(OpName, tagTypeID);
|
||||
if(dt.Rows.Count > 0)
|
||||
{
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
EngineType = dt.Rows[0]["零件号"].ToString();
|
||||
EngineID = dt.Rows[0]["变速箱总成号"].ToString();
|
||||
OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
|
||||
// 如果有订单但按钮按的位置与机型对不上则退出方法
|
||||
if(EngineTypeID == 1 || EngineTypeID == 2)
|
||||
{
|
||||
if(TagTypeCodeID != 33 && TagTypeCodeID != 34 && TagTypeCodeID != 36)
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "请选择与机型相对应的按钮进行操作!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有订单但按钮按的位置与机型对不上则退出方法
|
||||
if (EngineTypeID == 4 || EngineTypeID == 8)
|
||||
{
|
||||
if (TagTypeCodeID != 30 && TagTypeCodeID != 31 && TagTypeCodeID != 32)
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "请选择与机型相对应的按钮进行操作!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
////将产品信息写入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);
|
||||
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
// 将数据保存到监控MOBY中
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, EngineID);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm, OrderForm);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.PartPallet_Code, tagTypeID.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType_MES, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm_MES, OrderForm);
|
||||
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOverBQ(OpName);
|
||||
|
||||
// 4.将这些数据推送到前端进行显示
|
||||
//显示当前订单信息
|
||||
SendMessage.ShowMoby(OpName);
|
||||
SendMessageFun.SendMessage("12345", "11111", OpName);
|
||||
// 5.保存过站数据
|
||||
//测量数据发动机在线状态
|
||||
BaseDataSystemMES.WorkStartInsert(OpName, 1);
|
||||
// 6.该订单计数加一
|
||||
BaseDataSystemMES.newAddOrderCount(OpName, EngineID, OrderForm, tagTypeID);
|
||||
// 7.发送保存完成信号,结束本次循环
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
SendMessageFun.SendInfomation("FlushOverWorkList", "1", OpName);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(TagTypeCodeID, OpName, true); // 计数12是否超过条码数 超过发1退出循环给PLC信号
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单已生产完毕或无选中的生产订单,请选择其他订单进行生产!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <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;
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
|
||||
//保存数据到线首表 先保存到 北汽福田变速器序列号总线上线 用于之前判断是否重号
|
||||
if (Db.UpLoadOpNameInsert(EngineID, EngineTypeID, EngineType, OpName))
|
||||
{
|
||||
//保存质量数据
|
||||
int qualityMask = MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
//保存物料数据
|
||||
BaseDataSystemMES.Material_Insert(OpName, qualityMask);
|
||||
|
||||
//保存过站数据
|
||||
BaseDataSystemMES.WorkStartInsert(OpName, qualityMask);
|
||||
// 是否二次工作
|
||||
int isTowWork = 0;
|
||||
if (OpName == "J07PA040")
|
||||
{
|
||||
isTowWork = Convert.ToInt32(MIS_BASE.ReadPLC(64, OpName));
|
||||
}
|
||||
// 根据二次压装来判断计数编号是哪个
|
||||
// 6.该订单计数加一
|
||||
BaseDataSystemMES.newAddOrderCount(OpName, EngineID, OrderForm, isTowWork);
|
||||
SendMessageFun.SendInfomation("FlushOverWorkList", "1", OpName);
|
||||
|
||||
// 是否为5s工件 5s走二次压装
|
||||
bool is5SWork = false;
|
||||
if (EngineTypeID == 2 || EngineTypeID == 4) is5SWork = true;
|
||||
|
||||
//// 只有PA020 与 PA040 的5s 一次压装 不设为1
|
||||
//if (OpName != "J07PA020" && !(OpName == "J07PA040" && isTowWork == 0 && is5SWork))
|
||||
//{
|
||||
// // 在保存后才将托盘号置位为1
|
||||
// BaseDataSystemMES.Set_TrayID(OpName, EngineID+"-2");
|
||||
// // 同时将对于上一个设备将其托盘号设为1
|
||||
// BaseDataSystemMES.Set_TrayID(OpName, EngineID);
|
||||
// //BaseDataSystemMES.Set_TrayIDByBackWork(OpName, EngineID);
|
||||
//}
|
||||
//推送质量数据到MES的页面
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
//统计在线产量,在线节拍
|
||||
SendMessage.SendActuallyCount(OpName, tagValue);
|
||||
|
||||
//通知设备,MES的质量数据(和物料数据)保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
//MES工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "保存上线数据失败!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(3, e, "Fun1053", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesReadOver(object e)
|
||||
{
|
||||
//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,43 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES保存实时质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesSaveNowData(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 直接发送实时的 质量数据
|
||||
string message = MisDataSaveDateMesRead.Funtion.GetRealTimeQualityData(OpName);
|
||||
//推送质量数据到MES的页面
|
||||
SendMessage.AsyncSendMessage("MES|ShowTimelyQuality_Resources|" + OpName + "|" + message);
|
||||
//SendMessageFun.SendMessageMESToWEB("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线 43
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
|
||||
string OrderForm;
|
||||
|
||||
int PLCRcipe;
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
|
||||
//+*************DbName*****************
|
||||
string DbName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
int workGetOrderType = 0;
|
||||
|
||||
if (tagValue > 0)
|
||||
{
|
||||
// 是否为二次压装
|
||||
if(OpName == "J07PA040")
|
||||
{
|
||||
if (Convert.ToBoolean(MIS_BASE.ReadPLC(64, OpName)))
|
||||
{
|
||||
workGetOrderType = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
|
||||
//开始上线前清空交互区数据
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
|
||||
//工作类型 0 正常件 1 PA30 件 2 PA40 返回件
|
||||
//int workType = 0;
|
||||
|
||||
//if (OpName == "J07PA030")
|
||||
//{
|
||||
// //该工件是PA30工件
|
||||
// workType = 1;
|
||||
//}
|
||||
|
||||
////判断 是否为二次加工件 (64)
|
||||
//if (OpName == "J07PA040" && workGetOrderType == 1)
|
||||
//{
|
||||
// //该工件是PA40二次加工件
|
||||
// workType = 2;
|
||||
//}
|
||||
|
||||
//if (workType == 0)
|
||||
//{
|
||||
// 正常逻辑 获得机型信息、配方号
|
||||
//获取到的5s 6s 工件条码
|
||||
//北汽福田工位状态监控MOBY_查询_订单下达用
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.GetNowWorkOrderData(OpName, workGetOrderType);
|
||||
if(dt.Rows.Count > 0)
|
||||
{
|
||||
if (Convert.ToInt32(dt.Rows[0]["线首是否完成工作"]) == 4)
|
||||
{
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单所有总成号已在MA010工作完毕,不允许继续工作,请联系班长进行修改完工状态!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
EngineType = dt.Rows[0]["零件号"].ToString();
|
||||
EngineID = dt.Rows[0]["变速箱总成号"].ToString();
|
||||
OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
MIS_BASE.WritePLC(32, OpName, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单已生产完毕或无选中的生产订单,请选择其他订单进行生产!");
|
||||
return;
|
||||
}
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// DataTable dt2;
|
||||
// if (workType == 1)
|
||||
// {
|
||||
// // PA30逻辑 从PA20获得机型信息、配方号、
|
||||
// dt2 = BaseDataSystemMES.lineOutTowBackWork_GetData("J07PA020", 1);
|
||||
// }
|
||||
// else //workType == 2
|
||||
// {
|
||||
// // PA40Back逻辑 从PA40获得机型信息、配方号、
|
||||
// dt2 = BaseDataSystemMES.lineOutTowBackWork_GetData("J07PA040", 0);
|
||||
// }
|
||||
|
||||
// EngineTypeID = Convert.ToInt32(dt2.Rows[0]["机型代码"]);
|
||||
// //配方号暂时没保存
|
||||
// EngineType = dt2.Rows[0]["机型"].ToString();
|
||||
// OrderForm = dt2.Rows[0]["订单号"].ToString();
|
||||
// EngineID = dt2.Rows[0]["总成号"].ToString();
|
||||
//}
|
||||
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
|
||||
// 将产品信息写入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);
|
||||
|
||||
// 获得配方数据
|
||||
//BaseDataSystemMES.PLCRcipeByOpName(OpName, out byte[] bytes, out string tagStartAdr, PLCRcipe);
|
||||
// 写入配方数据
|
||||
//DtWebApi.ReadWritePLC.Write_TagValueByTagTypeID("94", OpName, System.Text.Encoding.ASCII.GetString(bytes));
|
||||
// MES传递机型
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
//清除上线信息
|
||||
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.WritePLC(115, OpName, "");
|
||||
//空挡开关检测
|
||||
MIS_BASE.WritePLC(95, OpName, 0);
|
||||
//倒挡开关检测
|
||||
MIS_BASE.WritePLC(96, OpName, 0);
|
||||
//里程表检测
|
||||
MIS_BASE.WritePLC(97, OpName, 0);
|
||||
//大机型扩展
|
||||
MIS_BASE.WritePLC(98, OpName, 0);
|
||||
//TCU
|
||||
MIS_BASE.WritePLC(122, OpName, 0);
|
||||
//注油量
|
||||
MIS_BASE.WritePLC(123, OpName, 0);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(1, e, "Fun1053", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,357 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
//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
|
||||
{
|
||||
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);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ConfirmOkGo(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);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_FalseGO(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);
|
||||
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 "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;
|
||||
case "twoWorkSkip"://重新工作工件跳过工作(重新工作工件)
|
||||
//工作完成
|
||||
EngineTypeGetOver_PLC_Work_Skip(OpName);
|
||||
break;
|
||||
case "twoWork"://重新工作工件重新工作(重新工作工件)
|
||||
//允许工作
|
||||
EngineTypeGetOver_PLC_Work_two(OpName);
|
||||
break;
|
||||
case "FaultBackWork"://返修工件
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(33, OpName, true);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.WritePLC(33, OpName, false);
|
||||
break;
|
||||
case "remedyWork"://补拧工件
|
||||
// 接受传来的补拧程序号 补拧数量 拆分
|
||||
string[] arr = m_Value.ToString().Split('&');
|
||||
string codeNumber = arr[0];
|
||||
string workCount = arr[1];
|
||||
// 写入地址 在工件离开后清空
|
||||
MIS_BASE.WritePLC(77, OpName, codeNumber);
|
||||
MIS_BASE.WritePLC(88, OpName, workCount);
|
||||
// 若这个点被置0了说明PLC那补拧结束了
|
||||
MIS_BASE.WritePLC(30, OpName, true);
|
||||
break;
|
||||
case "remedyWorkEnd"://补拧工件
|
||||
MIS_BASE.WritePLC(77, OpName, 0);
|
||||
MIS_BASE.WritePLC(88, OpName, 0);
|
||||
MIS_BASE.WritePLC(30, OpName, false);
|
||||
break;
|
||||
case "closeWebWindow":// 前端窗口关闭
|
||||
// 将持久化存储表中工位的登陆状态设置为接受值
|
||||
BaseDataSystemMES.Set_TempData(OpName, "登陆状态", m_Value);
|
||||
MIS_BASE.WritePLC(54, OpName, false);
|
||||
break;
|
||||
case "QuitEngineTypeCheck":// 发送给服务器换型请求,等待服务器换型判断发送到页面端
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.EngineTypeChange(OpName, m_Value);
|
||||
//提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
// 写入MOBY 写入机型信息与清空总成号
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, mesValue);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, "");
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("5", "1", OpName);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WebSubmit");
|
||||
}
|
||||
}
|
||||
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>
|
||||
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);
|
||||
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
if (Convert.ToInt32(S_plcStatus) == 0)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
|
||||
DataTable tempDt;
|
||||
BaseDataSystemMES.Get_TempData(Opname, "登陆状态", out tempDt);
|
||||
if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, Opname, tempDt.Rows[0]["数值"]);
|
||||
|
||||
Sendmessage("135", "1111", Opname);
|
||||
|
||||
// 查询螺丝号是否存在 存在则发送给前端
|
||||
string CodeNumber;
|
||||
MIS_BASE.Read_TagTypeID(125, Opname, out CodeNumber);
|
||||
if (CodeNumber != "0")
|
||||
{
|
||||
SendMessageFun.SendInfomation("CodeNumber", CodeNumber,Opname);
|
||||
}
|
||||
|
||||
// 查询螺丝号下拧紧排序是否存在 存在则发送给前端
|
||||
string CodeNumberWorkNumber;
|
||||
MIS_BASE.Read_TagTypeID(126, Opname, out CodeNumberWorkNumber);
|
||||
if (CodeNumberWorkNumber != "0")
|
||||
{
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", CodeNumberWorkNumber,Opname);
|
||||
}
|
||||
|
||||
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("2", "1111", Opname);
|
||||
//SendMessage.ShowMoby(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);
|
||||
}
|
||||
InitAlarm(Opname);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工位合格标志
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void IsOk(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int qualityMask;
|
||||
MIS_BASE.Read_QualityMask(OpName, out qualityMask);
|
||||
//判断是否合格
|
||||
if (qualityMask == 1)
|
||||
{
|
||||
qualityMask = 1;
|
||||
} else {
|
||||
qualityMask = 0;
|
||||
}
|
||||
//通知WEB修改状态
|
||||
string message = "MES|QualityMask|" + OpName + "|" + qualityMask.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Data;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void WorkStart(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
for (int i = 1; i <= 40; i++)
|
||||
{
|
||||
MIS_BASE.WritePLC(127 + i, OpName, 0);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WorkStart");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Function02")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("苏州宏软信息技术有限公司")]
|
||||
[assembly: AssemblyProduct("Function02")]
|
||||
[assembly: AssemblyCopyright("Copyright © 苏州宏软信息技术有限公司 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("47710f2c-e141-4252-8d13-701bf4c1c027")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 内部版本号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Binary file not shown.
19
MisDataFunction/MesServer.Function/Function1053/app.config
Normal file
19
MisDataFunction/MesServer.Function/Function1053/app.config
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MQTTnet" publicKeyToken="b69712f52770c0a7" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.13.0" newVersion="3.0.13.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,5 @@
|
||||
SCC = This is a Source Code Control file
|
||||
|
||||
[Function02.csproj]
|
||||
SCC_Aux_Path = "\\192.168.0.100\vss\MES4.0"
|
||||
SCC_Project_Name = "$/MisData/MisData/MisData/MesServer.Function/Function02", ILHAAAAA
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
|
||||
<package id="MQTTnet" version="3.0.13" targetFramework="net461" />
|
||||
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.13" targetFramework="net461" />
|
||||
<package id="NETStandard.Library" version="2.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
|
||||
<package id="System.Net.Security" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" requireReinstallation="true" />
|
||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
|
||||
</packages>
|
||||
BIN
MisDataFunction/MesServer.Function/Function1053/vssver2.scc
Normal file
BIN
MisDataFunction/MesServer.Function/Function1053/vssver2.scc
Normal file
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class Function1052
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = "relative:MesServer.Function\\Function02"
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
<?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>{CC45D613-11B9-48AF-B073-6523D6273525}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Function1054</RootNamespace>
|
||||
<AssemblyName>Function1054</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>..\..\..\dll_fun\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<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="MQTTnet">
|
||||
<HintPath>..\..\..\Common\dll\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient">
|
||||
<HintPath>..\..\..\Common\dll\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>..\..\..\Common\dll\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="Methods\SubmitToMisweb.cs" />
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="MesServerFunction\Fun_1054.cs" />
|
||||
<Compile Include="Methods\UDP.Send.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\ConfirmOkGo.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\FalseGO.cs" />
|
||||
<Compile Include="OpcServer\HeartBeat.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\MesReadOver.cs" />
|
||||
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
||||
<Compile Include="OpcServer\WebSubmit.cs" />
|
||||
<Compile Include="OpcServer\WorkIsOk.cs" />
|
||||
<Compile Include="OpcServer\WorkStartOutSide.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\00MesWorkMqtt\MesWorkMqtt\00MesWorkMqtt.csproj">
|
||||
<Project>{f55da1a0-a982-4479-8c47-0d9a5aaf3e18}</Project>
|
||||
<Name>00MesWorkMqtt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\01DoWhatPlc\01_01DoWhatPlc.csproj">
|
||||
<Project>{0d1af432-439a-4920-8692-43ae139f5530}</Project>
|
||||
<Name>01_01DoWhatPlc</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\02WebApiCall\02_02WebApiCallPLC.csproj">
|
||||
<Project>{3e6d1dd5-01c9-435f-9941-61f906ce35bb}</Project>
|
||||
<Name>02_02WebApiCallPLC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\04DataBaseAccess\DataBaseAccess\04-DataBaseAccess.csproj">
|
||||
<Project>{f434e066-4c59-47c8-aa82-6f48cc84501a}</Project>
|
||||
<Name>04-DataBaseAccess</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\07WebBusinessFacade\BusinessFacade\07BusinessFacade.csproj">
|
||||
<Project>{f0a0c525-03fd-428a-9b17-7f54aa0e4475}</Project>
|
||||
<Name>07BusinessFacade</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\08WebFun_base\WebFun_base\08-WebFun_base.csproj">
|
||||
<Project>{d98be764-adeb-488d-9714-61e308aa8201}</Project>
|
||||
<Name>08-WebFun_base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\09MesDataFunction\MesDataFunction\09-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MisDataFun\SendMessageToWebMqtt\12SendMessageToWeb.csproj">
|
||||
<Project>{e4eb6420-906d-4672-947a-ca33ddcdadfc}</Project>
|
||||
<Name>12SendMessageToWeb</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MIS_FuntionSaveData\MIS_FuntionSaveData\13.3MIS_FuntionSaveData.csproj">
|
||||
<Project>{55b510c1-59e9-4bfd-ae84-d76d46f6e365}</Project>
|
||||
<Name>02-13.3MIS_FuntionSaveData</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>
|
||||
@@ -0,0 +1,244 @@
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DoWhatPlc.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = DoWhatPlc.MessageText.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();
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs e = new DoWhatPlc.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DoWhatPlc.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<DoWhatPlc.CustomeEvetnArgs>(m_Value);
|
||||
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 "3":
|
||||
WorkStartOutSide(e);
|
||||
break;
|
||||
//PLC 允许保存质量数据
|
||||
case "19":
|
||||
fun_MesRead(e);
|
||||
break;
|
||||
//MES 保存数据完成
|
||||
case "20":
|
||||
fun_MesReadOver(e);
|
||||
break;
|
||||
//PLC 工位合格标志
|
||||
case "22":
|
||||
fun_IsOk(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 "65":
|
||||
fun_MesSaveNowData(e);
|
||||
break;
|
||||
////MES 系统健康心跳
|
||||
//case "14":
|
||||
// fun_HeartBeatMIS(e);
|
||||
// break;
|
||||
case "63":
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
MIS_BASE.Read_TagTypeID(63, m_OpName, out S_plcStatus);
|
||||
if (Convert.ToInt32(S_plcStatus) == 0)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", m_OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", m_OpName);
|
||||
}
|
||||
break;
|
||||
// PLC 程序号
|
||||
case "125":
|
||||
// 将程序号转发给前端页面
|
||||
SendMessageFun.SendInfomation("CodeNumber", e.TagValue.ToString(), m_OpName);
|
||||
break;
|
||||
// PLC 程序号的第几颗螺丝
|
||||
case "126":
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", e.TagValue.ToString(), m_OpName);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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>
|
||||
public void fun_Barcode(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatMIS(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(HeartBeat, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许保存
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DoWhatPlc.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(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WebSubmit, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES实时保存质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesSaveNowData(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesSaveNowData, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 工位是否合格
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_IsOk(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(IsOk, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <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;
|
||||
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.EngineTypeChange(OpName, EngineType);
|
||||
//提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
|
||||
// 6S 判断 档位刻度 反馈给前端具体刻度值
|
||||
if(EngineTypeID == 4 || EngineTypeID == 8)
|
||||
{
|
||||
DataTable dt2 = BaseDataSystemMES.EngineTypeChange_MA020_KeDu(OpName, EngineType);
|
||||
if(Convert.ToInt32(dt2.Rows[0]["result"]) != 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(70, OpName, true);
|
||||
string message2 = "MES|ShowTipBox|" + OpName + "|" + dt2.Rows[0]["msg"].ToString();
|
||||
SendMessage.AsyncSendMessage(message2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 先判断差异,后将当前工件信息进行记录,不然永远查不出来
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, EngineID);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm, OrderForm);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.PartPallet_Code, PartPallet_Code.ToString());
|
||||
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOverBQ(OpName);
|
||||
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("123", "111", OpName);
|
||||
MIS_BASE.Read_PalletInfo(OpName, out MES_QualityMask);//合格标志
|
||||
MIS_BASE.Read_RepairStatus_PLC(OpName, out RepairPartStatusPLC);//返修标志
|
||||
SendMessageFun.SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);//显示合格标志
|
||||
SendMessageFun.SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);//显示返修标志
|
||||
|
||||
if (MES_QualityMask == 2)
|
||||
{
|
||||
//工作完成
|
||||
// MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//SendMessageFun.SendInfomation("NgGO", "1", OpName);//显示不合格标志
|
||||
//return;
|
||||
}
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "工件到位,请扫描前壳码进行工作!");
|
||||
//第三步,用于工件离开后工数量统计及工件编号追溯
|
||||
//BaseDataSystemMES.MaterialPush_EngineIDStatus_Insert(OpName);//更新订单产量
|
||||
|
||||
//第四步,获取是否允许工作
|
||||
//BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
//MIS_BASE.Write_FixAllow(OpName, true);
|
||||
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
//if (IsAllowWork == 1)
|
||||
//{
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 返修件需要工作
|
||||
/// </summary>
|
||||
/// <param name="OpName">工位号</param>
|
||||
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,127 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 此类用于向WEB发送各种类型消息
|
||||
/// </summary>
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <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>
|
||||
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,53 @@
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using DataLinkMesWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 发送信息到MES通讯服务器或者其他的
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private string AsyncSendMessage(string Message)
|
||||
{
|
||||
return MIS_BASE.asyncSendMessage(Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送提示消息
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
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>
|
||||
/// 发送信息到打印机
|
||||
/// </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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user