chore: initial commit
This commit is contained in:
16
MisDataFunction/Function1051/DataAccess/DataAccess.cs
Normal file
16
MisDataFunction/Function1051/DataAccess/DataAccess.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1051/DataAccess/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/DataAccess/vssver2.scc
Normal file
Binary file not shown.
15
MisDataFunction/Function1051/Db.cs
Normal file
15
MisDataFunction/Function1051/Db.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public class Db
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
10
MisDataFunction/Function1051/Function08.csproj.vspscc
Normal file
10
MisDataFunction/Function1051/Function08.csproj.vspscc
Normal file
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = "relative:MesServer.Function\\Function08"
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
142
MisDataFunction/Function1051/Function1051.csproj
Normal file
142
MisDataFunction/Function1051/Function1051.csproj
Normal file
@@ -0,0 +1,142 @@
|
||||
<?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="MesWork.DeviceDriver">
|
||||
<HintPath>..\..\dll_common\MesWork.DeviceDriver.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\dll_common\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http">
|
||||
<HintPath>..\..\DLL\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Security, Version=4.0.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.Security.4.3.2\lib\net46\System.Net.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.4.3.0\lib\net46\System.Net.WebSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets.Client, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.Client.4.3.2\lib\net46\System.Net.WebSockets.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="Db.cs" />
|
||||
<Compile Include="MesServerFunction\Function1051.cs" />
|
||||
<Compile Include="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\MaterialsScanOver.cs" />
|
||||
<Compile Include="OpcServer\MaterialsVerify.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\ReqTestResistor.cs" />
|
||||
<Compile Include="OpcServer\ReqEarlyFeeding.cs" />
|
||||
<Compile Include="OpcServer\PartLoad.cs" />
|
||||
<Compile Include="OpcServer\MesReadOver.cs" />
|
||||
<Compile Include="OpcServer\WebSubmit.cs" />
|
||||
<Compile Include="OpcServer\WorkStart.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Common\09MesDataFunction\MesDataFunction\01-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>01-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Interface_WebAPI\SlMesDbIterface\ExternalDataSync.csproj">
|
||||
<Project>{2f33d79d-1dff-4cda-b357-fcd5221cab9a}</Project>
|
||||
<Name>ExternalDataSync</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\MyLog4Net\00_MyLog4Net.csproj">
|
||||
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
|
||||
<Name>00_MyLog4Net</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
317
MisDataFunction/Function1051/MesServerFunction/Function1051.cs
Normal file
317
MisDataFunction/Function1051/MesServerFunction/Function1051.cs
Normal file
@@ -0,0 +1,317 @@
|
||||
using MesServerWork;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using MisDataFunDll;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = MisDataFun.GetCmdStringList(recData);
|
||||
//string[] dataArray = recData.Split('|');
|
||||
//if (dataArray.Count != 4)
|
||||
//return;
|
||||
//消息来源
|
||||
string m_Source = dataArray[0].ToString();
|
||||
//消息类型 Barcode
|
||||
string m_Command = dataArray[1].ToString();
|
||||
//工位号
|
||||
string m_OpName = dataArray[2].ToString();
|
||||
//消息参数
|
||||
string m_Value = dataArray[3].ToString();
|
||||
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs e = new DeviceDriver_BasicData.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string tagValue;
|
||||
switch (m_Source)
|
||||
{
|
||||
case "BarCode":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Value;
|
||||
fun_Barcode(e);
|
||||
|
||||
break;
|
||||
case "WEB":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Command + "|" + m_Value;
|
||||
fun_WebSubmit(e);
|
||||
break;
|
||||
case "PLC":
|
||||
e = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string TagID = e.TagID.ToString();
|
||||
switch (e.TagValue.ToString().ToLower())
|
||||
{
|
||||
case "false":
|
||||
tagValue = "0";
|
||||
break;
|
||||
case "true":
|
||||
tagValue = "1";
|
||||
break;
|
||||
default:
|
||||
tagValue = e.TagValue.ToString();
|
||||
break;
|
||||
}
|
||||
e.TagValue = tagValue;
|
||||
switch (e.TagTypeCodeID.ToString())
|
||||
{
|
||||
//PLC 工件到位
|
||||
case "2":
|
||||
fun_WorkStart(e);
|
||||
break;
|
||||
//PLC 允许保存质量数据
|
||||
case "19":
|
||||
fun_MesRead(e);
|
||||
break;
|
||||
//MES 保存数据完成
|
||||
case "20":
|
||||
fun_MesReadOver(e);
|
||||
break;
|
||||
//PLC 申请上线
|
||||
case "43":
|
||||
PartLoad(e);
|
||||
break;
|
||||
//PLC 传递机型
|
||||
case "44":
|
||||
fun_EngineTypeGetOverPLC(e);
|
||||
break;
|
||||
//MES 合格放行
|
||||
case "51":
|
||||
fun_ConfirmOkGo(e);
|
||||
break;
|
||||
//MES 不合格放行
|
||||
case "8":
|
||||
fun_FalseGo(e);
|
||||
break;
|
||||
// PLC 系统健康心跳
|
||||
case "14":
|
||||
fun_HeartBeatMIS(e);
|
||||
break;
|
||||
//物料扫码完成(弃用!)
|
||||
case "49":
|
||||
fun_MaterislaScanOver(e);
|
||||
break;
|
||||
//物料扫码完成
|
||||
case "65":
|
||||
fun_MaterialsVerify(e);
|
||||
break;
|
||||
// 写入托盘号后通知MES
|
||||
case "48":
|
||||
string write_Pallet_res;
|
||||
MIS_BASE.Read_TagTypeID(48, m_OpName, out write_Pallet_res);
|
||||
if (write_Pallet_res.ToLower() == "true" || write_Pallet_res.ToLower() == "1")
|
||||
{
|
||||
SendMessageFun.SendInfomation("writePallet", "1", m_OpName);
|
||||
}
|
||||
MIS_BASE.WritePLC(70, m_OpName, false);
|
||||
break;
|
||||
case "63":
|
||||
fun_ReqEarlyFeeding(e);
|
||||
break;
|
||||
case "64":
|
||||
fun_ReqTestResistor(e);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//public void FunWork(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
//{
|
||||
// //lock1 = new object();
|
||||
// //lock (lock1)
|
||||
// {
|
||||
// switch (e.TagTypeCodeID.ToString())
|
||||
// {
|
||||
// //PLC 工件到位
|
||||
// case "2":
|
||||
// fun_WorkStart(e);
|
||||
// break;
|
||||
// //PLC 允许保存质量数据
|
||||
// case "19":
|
||||
// fun_MesRead(e);
|
||||
// break;
|
||||
// //MES 保存数据完成
|
||||
// case "20":
|
||||
// fun_MesReadOver(e);
|
||||
// break;
|
||||
// //PLC 传递机型
|
||||
// case "44":
|
||||
// fun_EngineTypeGetOverPLC(e);
|
||||
// break;
|
||||
// //MES 合格放行
|
||||
// case "51":
|
||||
// fun_ConfirmOkGo(e);
|
||||
// break;
|
||||
// //MES 不合格放行
|
||||
// case "8":
|
||||
// fun_FalseGo(e);
|
||||
// break;
|
||||
// //MES 扫描条码
|
||||
// case "Barcode":
|
||||
// fun_Barcode(e);
|
||||
// break;
|
||||
// //WEB 处理页面传递过来的数据
|
||||
// case "WebSubmit":
|
||||
// fun_WebSubmit(e);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
//1.工件到位后,PLC给MES传递机型(DBX0.4)(44),
|
||||
//2.MES判断是否扫描完成
|
||||
//3.若扫描完成,则MES给出合格放行(DBX2.5)(51)
|
||||
/// <summary>
|
||||
/// 扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void fun_Barcode(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
//// ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提前上料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ReqEarlyFeeding(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ReqEarlyFeeding, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求测试电阻 调用电阻仪
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ReqTestResistor(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem( ReqTestResistor, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成 20
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料扫码完成
|
||||
/// </summary>
|
||||
public void fun_MaterislaScanOver(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MaterialsScanOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料扫码完成
|
||||
/// </summary>
|
||||
public void fun_MaterialsVerify(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MaterialsVerify, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成 19
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WorkStart, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
public void fun_WebSubmit(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WebSubmit, e);
|
||||
}
|
||||
|
||||
public int fun_SubLineLoadPartCountMatch()
|
||||
{
|
||||
return SubLineLoadPartCountMatch;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MES系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatMIS(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(HeartBeatMES, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// PLC系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatPLC(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
//ThreadPool.QueueUserWorkItem(HeartBeatPLC, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1051/MesServerFunction/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/MesServerFunction/vssver2.scc
Normal file
Binary file not shown.
291
MisDataFunction/Function1051/Methods/EngineGetOverBaseWork.cs
Normal file
291
MisDataFunction/Function1051/Methods/EngineGetOverBaseWork.cs
Normal file
@@ -0,0 +1,291 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
//using SystemFramework;
|
||||
using WebApi;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 分线上总线的数量
|
||||
/// </summary>
|
||||
public static int SubLineLoadPartCount = 2;
|
||||
/// <summary>
|
||||
/// 分线上总线已经匹配的数量
|
||||
/// </summary>
|
||||
public static int SubLineLoadPartCountMatch = 0;
|
||||
/// <summary>
|
||||
/// 正常逻辑工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="PartPallet_Code"></param>
|
||||
private void EngineTypeGetOver_PLC_Work(string OpName, int EngineTypeID, string EngineType, string EngineID, int PartPallet_Code,string OrderForm)
|
||||
{
|
||||
int IsAllowWork;
|
||||
int RepairPartStatusPLC = 0;
|
||||
int MES_QualityMask = 1;
|
||||
|
||||
if (EngineTypeID <= 0 || EngineID.Length == 0 || EngineType.Length == 0)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "PLC传递机型为空!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
|
||||
return;
|
||||
}
|
||||
|
||||
//初始化物料临时表
|
||||
//第二步,将零件信息转移到零件_临时表中(本地BOM与订单BOM的选择显示关系)
|
||||
//BaseDataSystemMES.MesServer_Process_EngineTypeOver_BQ_FirstOP(OpName);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(OpName);
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(OpName);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(OpName);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(OpName);
|
||||
|
||||
//第四步,获取是否允许工作
|
||||
MisDataFun.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
// 暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
|
||||
//调用工厂MES开工接口
|
||||
WebApi.CALL_Inerface_DataHandle.CALL_Inerface_JobStart(OpName, EngineID, OrderForm);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存MOBY信息
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="engineTypeID"></param>
|
||||
/// <param name="engineType"></param>
|
||||
/// <param name="engineID"></param>
|
||||
private void SaveMobyMessage(string OpName, int engineTypeID, string engineType, string engineID, string orderForm)
|
||||
{
|
||||
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_EngineGetOver_EngineTypeID[OpName] = engineTypeID;
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineType.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_EngineGetOver_EngineType[OpName] = engineType;
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_EngineGetOver_EngineID[OpName] = engineID;
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_OrderForm.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_EngineGetOver_OrderForm[OpName] = orderForm;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返修件需要工作
|
||||
/// </summary>
|
||||
/// <param name="OpName">工位号</param>
|
||||
private void IsNeedRepaire_OK(string OpName)
|
||||
{
|
||||
|
||||
int isRepair;
|
||||
int engineTypeID;
|
||||
|
||||
string engineType = "";
|
||||
string engineID = "";
|
||||
string palletCode = "";
|
||||
string orderForm = "";
|
||||
string repairCode = "";
|
||||
//从监控系统中查询出本工位信息
|
||||
//BaseDataSystemMES.OpName_MIS_Moby_Select(OpName,
|
||||
//out orderForm, out engineTypeID, out engineType,
|
||||
//out engineID, out palletCode, out isRepair, out repairCode);
|
||||
|
||||
//EngineTypeGetOver_PLC_Work(OpName, engineTypeID, engineType, engineID, Convert.ToInt32(palletCode),orderForm);
|
||||
}
|
||||
/// <summary>
|
||||
/// 正常匹配分线和总线
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="engineID">总线工件号</param>
|
||||
/// <param name="engineTypeID">总线工件机型代码</param>
|
||||
/// <param name="engineType">总线工件机型</param>
|
||||
private void Match(string opName, string engineID, int engineTypeID, string engineType, int PartPallet_Code)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool m_EngineGetOver_PLC_SubLine;
|
||||
int engineTypeID_SubLine;
|
||||
int partPallet_Code_SubLine;
|
||||
int PalletInfo = 1;//总线托盘状态
|
||||
|
||||
string opName_SubLine = "";//分线工件信息
|
||||
string engineID_SubLine;
|
||||
string engineType_SubLine;
|
||||
string AlarmStr;
|
||||
if (MIS_BASE.hashtable_OpNameRepair == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
//第一步:获取分线中间交互工位号
|
||||
if (MIS_BASE.hashtable_OpNameRepair.ContainsKey(opName))
|
||||
{
|
||||
opName_SubLine = MIS_BASE.hashtable_OpNameRepair[opName].ToString();
|
||||
}
|
||||
if (opName_SubLine == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//第二步:获取分线传递机型信号
|
||||
MIS_BASE.Read_EngineGetOver_PLC(opName_SubLine, out m_EngineGetOver_PLC_SubLine);
|
||||
if (!m_EngineGetOver_PLC_SubLine) return;//必须工件同时到位才能进行匹配
|
||||
|
||||
//第三步:判断合格标志
|
||||
MIS_BASE.Read_PalletInfo(opName_SubLine, out PalletInfo);
|
||||
if (PalletInfo == 2) return; //若不合格则返回不进行匹配
|
||||
string OrderForm;
|
||||
//第四步:获取分线的信息,匹配验证
|
||||
MIS_BASE.GetEngineTypeFromPLC(opName_SubLine, out engineTypeID_SubLine, out engineType_SubLine, out engineID_SubLine, out partPallet_Code_SubLine,out OrderForm);
|
||||
//判断分线数据是否合格
|
||||
//if (!BaseDataSystemMES.QulityDataVerify(opName, engineID_SubLine, out AlarmStr) && !BaseDataSystemMES.QualityVerifyStatus_Hash_Read(opName))
|
||||
//{
|
||||
// SendInfomation("LineoutAlert", AlarmStr, opName);
|
||||
// return;
|
||||
//}
|
||||
|
||||
//if (engineTypeID_SubLine == engineTypeID)
|
||||
//{
|
||||
// BaseDataSystemMES.SubLineLoadPartCountMatch_Select(opName, out SubLineLoadPartCountMatch);
|
||||
// SubLineLoadPartCountMatch = SubLineLoadPartCountMatch + 1;
|
||||
// BaseDataSystemMES.SubLineLoadPartCountMatch_Update(opName, SubLineLoadPartCountMatch);
|
||||
|
||||
|
||||
// BaseDataSystemMES.MailLineAndSubLineData_Insert(engineID, engineTypeID, engineType, engineID_SubLine);//分线上总线数据转移
|
||||
// MIS_BASE.Write_Match(opName, true);//匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(opName, true);//匹配完成
|
||||
// if(SubLineLoadPartCountMatch== SubLineLoadPartCount)
|
||||
// {
|
||||
// MIS_BASE.Write_FixAllow(opName, true);
|
||||
// SubLineLoadPartCountMatch = 0;
|
||||
// BaseDataSystemMES.SubLineLoadPartCountMatch_Update(opName, SubLineLoadPartCountMatch);
|
||||
|
||||
// }
|
||||
|
||||
// SendMessageFun.SendInfomation("MatchSuccess", "1", opName);
|
||||
// SendMessageFun.SendMessage(opName, 1, "Match");//匹配结果
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MIS_BASE.Write_Match(opName, false);//匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(opName, true);//匹配完成//68:1、取消返修;2、匹配成功 自己监控发送 MES|MatchingCompleted
|
||||
|
||||
// //发送匹配完成和匹配结果信息
|
||||
// SendMessageFun.AsyncSendMessage_Notice(opName,"匹配失败,工件型号不匹配!");
|
||||
// SendMessageFun.SendInfomation("MatchSuccess", "0", opName);
|
||||
// SendMessageFun.SendMessage(opName, 0, "Match");//匹配结果
|
||||
//}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog("Match:" + err.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强制匹配分线和总线
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
private void ForceMatch(string opName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//bool m_EngineGetOver_PLC_SubLine;
|
||||
//bool m_EngineGetOver_PLC;
|
||||
|
||||
//int engineTypeID_SubLine;
|
||||
//int engineTypeID;
|
||||
//int partPallet_Code_SubLine;
|
||||
//int partPallet_Code;
|
||||
|
||||
//string opName_SubLine = "";//分线工件信息
|
||||
//string engineID_SubLine;
|
||||
//string engineType_SubLine;
|
||||
//string engineID;
|
||||
//string engineType;
|
||||
//if (MIS_BASE.hashtable_OpNameRepair == null)
|
||||
//{
|
||||
// MIS_BASE.InitHashtable_MesServerCode();
|
||||
//}
|
||||
////获取分线中间交互工位号
|
||||
//if (MIS_BASE.hashtable_OpNameRepair.ContainsKey(opName))
|
||||
//{
|
||||
// opName_SubLine = MIS_BASE.hashtable_OpNameRepair[opName].ToString();
|
||||
//}
|
||||
//if (opName_SubLine == "")
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
//MIS_BASE.Read_EngineGetOver_PLC(opName_SubLine, out m_EngineGetOver_PLC_SubLine);//1:读取分线工件到位的传递机型信号。
|
||||
|
||||
//if (!m_EngineGetOver_PLC_SubLine) return;//必须工件同时到位才能进行匹配
|
||||
|
||||
//MIS_BASE.Read_EngineGetOver_PLC(opName, out m_EngineGetOver_PLC);//2:读取总线工件到位的传递机型信号。
|
||||
|
||||
//if (!m_EngineGetOver_PLC) return;//必须工件同时到位才能进行匹配
|
||||
//string OrderForm;
|
||||
//MIS_BASE.GetEngineTypeFromPLC(opName_SubLine, out engineTypeID_SubLine, out engineType_SubLine, out engineID_SubLine, out partPallet_Code_SubLine,out OrderForm);//获取分线的信息
|
||||
//MIS_BASE.GetEngineTypeFromPLC(opName, out engineTypeID, out engineType, out engineID, out partPallet_Code, out OrderForm);
|
||||
|
||||
//Mis.MailLineAndSubLineData_Insert(engineID, engineTypeID, engineType, engineID_SubLine);//分线上总线数据转移
|
||||
|
||||
//MIS_BASE.Write_Match(opName, true);//匹配结果
|
||||
//MIS_BASE.Write_MatchingCompleted(opName, true);//匹配完成
|
||||
|
||||
//SendMessageFun.SendInfomation("MatchSuccess", "1", opName);//界面显示匹配成功
|
||||
|
||||
//MIS_BASE.Write_FixAllow(opName, true);//允许PLC工作
|
||||
|
||||
////发送匹配完成和匹配结果信息
|
||||
//sendmessage(opName, 1, "MatchingComplete");//匹配完成
|
||||
//sendmessage(opName, 1, "Match");//匹配结果
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1051/Methods/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/Methods/vssver2.scc
Normal file
Binary file not shown.
236
MisDataFunction/Function1051/OpcServer/Barcode.cs
Normal file
236
MisDataFunction/Function1051/OpcServer/Barcode.cs
Normal file
@@ -0,0 +1,236 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockBarcode = new object();
|
||||
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void Barcode(object e)
|
||||
{
|
||||
lock(lockBarcode)
|
||||
{
|
||||
try
|
||||
{
|
||||
//DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
//string OpName = Convert.ToString(msgEvent.OpName);
|
||||
////+*************DbName*****************
|
||||
//string DbName = Convert.ToString(msgEvent.OpName);
|
||||
//string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
|
||||
//int EngineTypeID;//机型代码
|
||||
//string EngineType;//机型
|
||||
//string EngineID;//工件编号
|
||||
|
||||
//string OrderForm;
|
||||
//int Recipe1;
|
||||
//int Recipe2;
|
||||
|
||||
//bool IsNotRepeatedNumber = false;
|
||||
////1:获得申请上线信息后,扫描条码才处理业务
|
||||
//bool ispartload;
|
||||
////(115)
|
||||
//int PTO;
|
||||
////(118)0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//int NgearSwitch;
|
||||
////(119)0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//int RgearSwitch;
|
||||
////(120)0=不检测;1=检测。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//int SpeedSensor;
|
||||
////(121)例如:5S 400。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//string PartTypeMid;
|
||||
////(122) 0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
//int Tcu_V;
|
||||
////判断工件是否到位
|
||||
//MIS_BASE.Read_WorkStart(OpName, out ispartload);
|
||||
//if (!ispartload)
|
||||
//{
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "请检查设备是否到位(DBX500.1=1)");
|
||||
// return;
|
||||
//}
|
||||
////判断设备是否申请上线
|
||||
//MIS_BASE.Read_PartLoad(OpName, out ispartload);
|
||||
//if (!ispartload)
|
||||
//{
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "请检查设备是否申请上线(DBX500.3=1)");
|
||||
// return;
|
||||
//}
|
||||
//// 判读条码是变速器序列号条码号还是物料号 小机型*日月年* 流水号(给起始号 + 数量)
|
||||
//// 选小机型 从北汽福田BOM中选 得先维护BOM
|
||||
//// 变速器序列号 '1333 050 062*16012023*30000001'
|
||||
|
||||
////扫描完变速器序列号条码号 true
|
||||
//bool isGetOver_PLC = false;
|
||||
////判断上线工位,MES 是否将工件流水号、机型等信息已经写入到PLC了
|
||||
// MIS_BASE.Read_EngineGetOver_PLC(OpName, out isGetOver_PLC);
|
||||
|
||||
////如果工件流水号、机型等信息没有写入PLC,扫描的条码按工件流水号进行验证
|
||||
////否则按装配物料进行验证
|
||||
//if (!isGetOver_PLC)
|
||||
//{
|
||||
|
||||
// if (barcode.Split('*').Length > 2)
|
||||
// {
|
||||
// //2: 判断是否重号, 从数据库获得机型、机型代码等信息
|
||||
// string partSn = barcode;
|
||||
// EngineID = barcode;
|
||||
|
||||
// MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineID_MES, EngineID);
|
||||
|
||||
// //Db.GetEngineType( partSn, out EngineTypeID, out EngineType, out EngineID, out IsRepeatedNumber);
|
||||
// //Db.GetEngineType( partSn, out EngineTypeID, out EngineType, out EngineID, out IsRepeatedNumber);
|
||||
|
||||
// //IsRepeatedNumber true 不重号;false 重号;
|
||||
// IsNotRepeatedNumber = BaseDataSystemMES.EngineTypeID_IsNotRepeatedNumber(partSn);
|
||||
// if (IsNotRepeatedNumber)
|
||||
// {
|
||||
// BaseDataSystemMES.GetEngineTypeUpLoadOpName(partSn, OpName, out EngineTypeID, out EngineType, out OrderForm, out Recipe1, out Recipe2);
|
||||
|
||||
// //MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
// //MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
// //MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
// //MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
|
||||
|
||||
// BaseDataSystemMES.UpLoadPTO(EngineType, out PTO, out NgearSwitch, out RgearSwitch, out SpeedSensor, out PartTypeMid, out Tcu_V);
|
||||
// //PTO
|
||||
// MIS_BASE.WritePLC(115, OpName, PTO);
|
||||
// //空挡开关检测
|
||||
// MIS_BASE.WritePLC(95, OpName, NgearSwitch);
|
||||
// //倒挡开关检测
|
||||
// MIS_BASE.WritePLC(96, OpName, RgearSwitch);
|
||||
// //里程表检测
|
||||
// MIS_BASE.WritePLC(97, OpName, SpeedSensor);
|
||||
// //大机型扩展
|
||||
// MIS_BASE.WritePLC(98, OpName, PartTypeMid);
|
||||
// //TCU
|
||||
// MIS_BASE.WritePLC(122, OpName, Tcu_V);
|
||||
// string tagStartAdr;//= "DB411.10";
|
||||
|
||||
// // 先查询配方号 根据工位号 去moby表查配方号
|
||||
// // 根据配方号 去配方表查配方数据
|
||||
// // 写入配方数据
|
||||
// BaseDataSystemMES.PLCRcipeCurrent(OpName, out byte[] bytes, out tagStartAdr);
|
||||
// DtWebApi.ReadWritePLC.Write_TagValueByTagTypeID("94", OpName, System.Text.Encoding.ASCII.GetString(bytes));
|
||||
// ////将产品信息写入PLC
|
||||
// MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
// MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
// MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
// MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
|
||||
// //写入到数据库的[北汽福田工位状态监控MOBY]表中
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineTypeID_MES, EngineTypeID.ToString());
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineType_MES, EngineType);
|
||||
// MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineID_MES, EngineID);
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.OrderForm_MES, OrderForm);
|
||||
|
||||
|
||||
// // 工位号],[订单号],[产品型号代码],[变速器序列号],[发动机型号],[机型基本代码],[变速器总成号] ,[托盘号]
|
||||
// // [产品型号代码_MES],[变速器序列号_MES],[发动机型号_MES]
|
||||
// // [机床上电],[循环开始],[机床故障],[上料无件],[下料堵塞],[工件到位]
|
||||
// // [传递机型],[申请上件],[允许保存],[保存完成],[合格标志],[前序合格]
|
||||
// // [工号],[班次],[是否返修件],[合格放行],[不合格放行],[扫描条码]
|
||||
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName, "产品型号代码_MES", EngineTypeID.ToString());
|
||||
// //MisDataFun.OpName_MIS_MOBY_Insert(OpName, "发动机型号_MES", EngineType);
|
||||
|
||||
// MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
|
||||
// //Thread.Sleep(5000);
|
||||
// //MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
|
||||
// //等待PLC将数据写入RFID;写入PLC的DB块,通知MES验证RFID机型数据是否正确传递
|
||||
|
||||
// //通知web显示
|
||||
// SendMessage.ShowMoby(OpName);
|
||||
// //SendMessageFun.SendMessage("1235", "1111", OpName);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.SendInfomation("EngineIDRepeat", "partSn", OpName);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "变速器序列号格式不正确,请确认!");
|
||||
|
||||
// }
|
||||
//}
|
||||
//else//验证物料
|
||||
//{
|
||||
// //物料号
|
||||
// {
|
||||
// //读取PLC的传递机型信号
|
||||
// bool tagValue;
|
||||
// MIS_BASE.Read_EngineGetOver_PLC(OpName, out tagValue);
|
||||
// if (tagValue)
|
||||
// {
|
||||
// //验证物料
|
||||
// BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out bool IsSuccess);
|
||||
// if (!IsSuccess)//????
|
||||
// {
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
// }
|
||||
// //判断物料是否验证完成
|
||||
// BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out int IsAllowWork);
|
||||
|
||||
|
||||
// if (IsSuccess)
|
||||
// {
|
||||
// if (IsAllowWork == 1)
|
||||
// {
|
||||
// //移到允许保存信号中
|
||||
// //BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
// ////更新订单完工数量及物料
|
||||
// SendMessageFun.SendMessage("24", "11", OpName);
|
||||
|
||||
// //物料验证完成,通知PLC允许工作,允许工作在保存完成时清空
|
||||
// MIS_BASE.Write_FixAllow(OpName, true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC未传递机型");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SendMessage.AsyncSendMessage_Notice(OpName, "产品上线后,PLC获得变速器序列号后,再验证物料!");
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:Barcode");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
135
MisDataFunction/Function1051/OpcServer/EngineGetOver.cs
Normal file
135
MisDataFunction/Function1051/OpcServer/EngineGetOver.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockBarcodeEngineTypeGetOver = new object();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
lock(lockBarcodeEngineTypeGetOver)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
bool MesRead = false;
|
||||
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_MES;//工件编号
|
||||
string OrderForm_MES;
|
||||
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
|
||||
MIS_BASE.Read_QualityData_Read_CF(OpName, out MesRead);
|
||||
//第一步,判断允许保存和保存完成信号是否全部被清空,若未清空,则通知复位MES&PLC
|
||||
if (MesRead)
|
||||
{
|
||||
//未能清空信号,请求复位
|
||||
string msg = "【" + OpName + "】" + "未能清空MesRead信号,请求复位!";
|
||||
SendMessageFun.SendInfomation("AskReset", "1", OpName);
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
return;
|
||||
}
|
||||
|
||||
string OrderForm;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
MIS_BASE.GetEngineTypeFromPLC_MES(OpName, out EngineTypeID_MES, out EngineType_MES, out EngineID_MES, out OrderForm_MES);
|
||||
|
||||
// 读取MES区数据 校验MES区数据是否符合 同时判断是否此工件已工作过,若已工作过则弹出弹窗提示
|
||||
if (EngineTypeID == EngineTypeID_MES & EngineID == EngineID_MES & EngineType == EngineType_MES & OrderForm == OrderForm_MES)
|
||||
{
|
||||
if (EngineTypeID == 0 || EngineID == "" || EngineType == "" || OrderForm == "")
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "传递机型数据为空!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
DataTable checkTable = MisDataFun.WorkOrderCheck(OpName,EngineID_MES,OrderForm_MES,EngineType_MES);
|
||||
int result = Convert.ToInt32(checkTable.Rows[0]["result"]);
|
||||
string resultMsg = checkTable.Rows[0]["msg"].ToString();
|
||||
if (result != 2)
|
||||
{
|
||||
|
||||
if (result == 3)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + resultMsg;
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
//写入到数据库的[北汽福田工位状态监控MOBY]表中
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineType, EngineType);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineID, EngineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.OrderForm, OrderForm);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.PartPallet_Code, PartPallet_Code.ToString());
|
||||
//MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
//MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineType, EngineType);
|
||||
//MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineID, EngineID);
|
||||
//MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.OrderForm, OrderForm);
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
|
||||
SendMessageFun.SendMessage("5123", "11111", OpName);
|
||||
|
||||
// 将工序数据转入临时表中
|
||||
//BaseDataSystemMES.ProcessDataToTemp(OpName, EngineTypeID, OrderForm, EngineID);
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "【" + OpName + "】" + resultMsg;
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "PLC与MES信息不一致!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
55
MisDataFunction/Function1051/OpcServer/MaterialsScanOver.cs
Normal file
55
MisDataFunction/Function1051/OpcServer/MaterialsScanOver.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料扫码完成
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MaterialsScanOver(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out int EngineTypeID, out string EngineType, out string EngineID, out int PartPallet_Code, out string OrderForm);
|
||||
string materialsCode = MIS_BASE.ReadPLC(40, OpName).ToString();
|
||||
var dt = MisDataFun.Get_MaterialsScanOverRes(OpName, OrderForm, EngineID, materialsCode);
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
if (result == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 1);
|
||||
}
|
||||
else if (result == 2)
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(96, OpName, 0); // 提前上料位置
|
||||
MIS_BASE.WritePLC(33, OpName, false); // 允许提前上料
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
62
MisDataFunction/Function1051/OpcServer/MaterialsVerify.cs
Normal file
62
MisDataFunction/Function1051/OpcServer/MaterialsVerify.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC物料扫码校验
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
public void MaterialsVerify(object e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
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);
|
||||
|
||||
int MaterialsTypeCode = Convert.ToInt32(MIS_BASE.ReadPLC(201, OpName));
|
||||
string MaterialsCode = MIS_BASE.ReadPLC(40, OpName).ToString();
|
||||
|
||||
DataTable dt = MisDataFun.XD_MaterialsVerify(OpName, EngineID, MaterialsCode, MaterialsTypeCode);
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
if (result == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 1); // 物料校验成功
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 2); // 物料校验失败
|
||||
string msg = $"【{OpName}】产品:{EngineID} | 物料码:{MaterialsCode} | 物料类型:{MaterialsTypeCode.ToString()} 物料校验失败!";
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "MaterialsVerify " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 0); // 物料验证结果清空
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
84
MisDataFunction/Function1051/OpcServer/MesRead.cs
Normal file
84
MisDataFunction/Function1051/OpcServer/MesRead.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockMesRead = new object ();
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
int EngineTypeID;
|
||||
string EngineType;
|
||||
string EngineID;
|
||||
int PartPallet_Code;
|
||||
string OrderForm;
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_MES;//工件编号
|
||||
string OrderForm_MES;
|
||||
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int qualityMask;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID,out PartPallet_Code, out OrderForm);
|
||||
|
||||
//保存数据到线首表 先保存到 北汽福田变速器序列号总线上线 用于之前判断是否重号
|
||||
// 保存质量数据
|
||||
qualityMask = MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
|
||||
// 保存物料数据
|
||||
MisDataFun.Material_Insert(OpName, qualityMask);
|
||||
|
||||
// 保存过站信息
|
||||
MisDataFun.WorkStartInsert(OpName, qualityMask);
|
||||
|
||||
// 存追溯表数据 同时质量数据存入 接口表
|
||||
MisDataFun.WorkOrderOpWorkOver(OpName, EngineID, OrderForm);
|
||||
|
||||
// 推送质量数据到MES的页面
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
|
||||
//对应手动工位的
|
||||
//MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
//通知设备,MES的质量数据(和物料数据)保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//统计在线产量,在线节拍
|
||||
SendMessage.SendActuallyCount(OpName, tagValue);
|
||||
//调用工厂MES接口报工
|
||||
WebApi.CALL_Inerface_DataHandle.CALL_Inerface_JobFinished(OpName, EngineID, OrderForm);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
36
MisDataFunction/Function1051/OpcServer/MesReadOver.cs
Normal file
36
MisDataFunction/Function1051/OpcServer/MesReadOver.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesReadOver(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
//string OpName = Convert.ToString(msgEvent.OpName);
|
||||
//int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//if (tagValue == 1)
|
||||
//{
|
||||
|
||||
// BaseDataSystemMES.Material_Insert(OpName, tagValue);
|
||||
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
70
MisDataFunction/Function1051/OpcServer/PartLoad.cs
Normal file
70
MisDataFunction/Function1051/OpcServer/PartLoad.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线(针对上线工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 读取当前选择的计划中的机型,写入PLC
|
||||
// 获取订单的机型
|
||||
MisDataFun.GetEngineType_Order(OpName, out int EngineTypeID, out string EngineType, out string EngineID, out string OrderForm, out int parType, out int isCheckOk,out string msg2);
|
||||
if (isCheckOk == 2)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + msg2;
|
||||
// 判断到线体上有滞留工件 ,让去管理系统进行处理
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "PartLoad " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineTypeID_MES, EngineTypeID.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineType_MES, EngineType);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineID_MES, EngineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.OrderForm_MES, OrderForm);
|
||||
|
||||
// 写入机型代码 (大机型) 机型 发动机号 订单号
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
MIS_BASE.WritePLC(115, OpName, parType); // 托盘类型 1 静 2 动 3 拐
|
||||
|
||||
// MES传递机型
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
73
MisDataFunction/Function1051/OpcServer/ReqEarlyFeeding.cs
Normal file
73
MisDataFunction/Function1051/OpcServer/ReqEarlyFeeding.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请提前上料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void ReqEarlyFeeding(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
var dt = MisDataFun.Get_ReqEarlyFeedingData(OpName);
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
string msg = dt.Rows[0]["msg"].ToString();
|
||||
int EngineTypeID = Convert.ToInt32(dt.Rows[0]["产品型号代码"]);
|
||||
if (result == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(96, OpName, EngineTypeID); // 产品型号
|
||||
MIS_BASE.Write_EngineID_MES(OpName, dt.Rows[0]["工件编号"].ToString());
|
||||
int ReadEngineID = Convert.ToInt32(MIS_BASE.ReadPLC(96, OpName));
|
||||
if (EngineTypeID != ReadEngineID)
|
||||
{
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "ReqEarlyFeeding " + $"写入提前上料机型{EngineTypeID.ToString()} 与 读取到的{ReadEngineID.ToString()}不一致", MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
return;
|
||||
}
|
||||
if (EngineTypeID == 0 || ReadEngineID == 0)
|
||||
{
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "ReqEarlyFeeding " + $"写入提前上料机型{EngineTypeID.ToString()} 与 读取到的{ReadEngineID.ToString()} 其中存在空值", MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
return;
|
||||
}
|
||||
MIS_BASE.WritePLC(33, OpName, true); // 允许提前上料
|
||||
|
||||
}
|
||||
else if (result == 2)
|
||||
{
|
||||
MIS_BASE.WritePLC(33, OpName, false);
|
||||
string msg2 = "【" + OpName + "】" + msg;
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "ReqEarlyFeeding " + msg2, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(96, OpName, 0); // 提前上料位置
|
||||
MIS_BASE.WritePLC(33, OpName, false); // 允许提前上料
|
||||
//MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
238
MisDataFunction/Function1051/OpcServer/ReqTestResistor.cs
Normal file
238
MisDataFunction/Function1051/OpcServer/ReqTestResistor.cs
Normal file
@@ -0,0 +1,238 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
private readonly object _lockObject = new object();
|
||||
private volatile bool _isTestOk = false;
|
||||
private string _opName;
|
||||
private const int DEFAULT_TIMEOUT = 7000; // 默认超时时间(毫秒)
|
||||
private const int MAX_RETRY_COUNT = 10; // 最大重试次数
|
||||
private const int RESULT_LENGTH = 113; // 预期结果长度
|
||||
|
||||
/// <summary>
|
||||
/// 电阻测试
|
||||
/// </summary>
|
||||
private void ReqTestResistor(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
_opName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
TestResistor().GetAwaiter().GetResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetPLCValues();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("电阻测试", $"测试过程发生错误: {err.Message}");
|
||||
ErrPLCValues();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行电阻测试
|
||||
/// </summary>
|
||||
private async Task TestResistor()
|
||||
{
|
||||
TcpClient tcpClient = null;
|
||||
try
|
||||
{
|
||||
string IP = ConfigurationManager.AppSettings["ResistorDeviceIP_"+_opName];
|
||||
string Port = ConfigurationManager.AppSettings["ResistorDevicePort"];
|
||||
|
||||
using (tcpClient = new TcpClient())
|
||||
{
|
||||
var connectTask = tcpClient.ConnectAsync(IP, Convert.ToInt32(Port));
|
||||
if (await Task.WhenAny(connectTask, Task.Delay(DEFAULT_TIMEOUT)) != connectTask)
|
||||
{
|
||||
throw new TimeoutException(_opName+"连接电阻仪超时");
|
||||
}
|
||||
|
||||
if (tcpClient.Connected)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Info(_opName + "电阻测试", "电阻仪链接成功!");
|
||||
await SendCommand(tcpClient, "01 09 64 00 05 00 00 00 00 00 73");
|
||||
|
||||
await Task.Delay(DEFAULT_TIMEOUT);
|
||||
|
||||
var readTask = Task.Run(() => Read(tcpClient));
|
||||
|
||||
int count = 0;
|
||||
while (!_isTestOk && count < MAX_RETRY_COUNT)
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
await SendCommand(tcpClient, "03 01 04");
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count >= MAX_RETRY_COUNT && !_isTestOk)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试", "测试超时,未收到有效结果");
|
||||
ErrPLCValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试", $"测试过程发生错误: {ex.Message}");
|
||||
ErrPLCValues();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tcpClient != null)
|
||||
{
|
||||
tcpClient.Close();
|
||||
MyLog4Net.MyLogHelper.Info(_opName + "电阻测试", "电阻仪链接关闭");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetPLCValues()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 0);
|
||||
MIS_BASE.WritePLC(203, _opName, 0);
|
||||
MIS_BASE.WritePLC(204, _opName, 0);
|
||||
MIS_BASE.WritePLC(34, _opName, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void ErrPLCValues()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 0);
|
||||
MIS_BASE.WritePLC(203, _opName, 0);
|
||||
MIS_BASE.WritePLC(204, _opName, 0);
|
||||
MIS_BASE.WritePLC(34, _opName, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送命令到电阻仪
|
||||
/// </summary>
|
||||
private async Task SendCommand(TcpClient tcpClient, string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 将空格分隔的HEX字符串转换为字节数组
|
||||
string[] hexValues = command.Split(' ');
|
||||
byte[] commandbyte = new byte[hexValues.Length];
|
||||
|
||||
for (int i = 0; i < hexValues.Length; i++)
|
||||
{
|
||||
commandbyte[i] = Convert.ToByte(hexValues[i], 16);
|
||||
}
|
||||
|
||||
// 发送HEX格式的数据
|
||||
await tcpClient.Client.SendAsync(new ArraySegment<byte>(commandbyte), SocketFlags.None);
|
||||
|
||||
// 记录发送的命令
|
||||
MyLog4Net.MyLogHelper.Info(_opName + "电阻测试Send", $"发送命令: {command}");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试Send", $"发送命令失败: {err.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void Read(TcpClient tcpClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (!_isTestOk)
|
||||
{
|
||||
if (tcpClient != null && tcpClient.Connected)
|
||||
{
|
||||
byte[] byteCommand = new byte[1024];
|
||||
int icommand = tcpClient.Client.Receive(byteCommand);
|
||||
string hexString = BitConverter.ToString(byteCommand, 0, icommand).Replace("-", " ");
|
||||
|
||||
if (hexString.Length == RESULT_LENGTH)
|
||||
{
|
||||
DataAnalysis(hexString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试Read", err.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataAnalysis(string hexString)
|
||||
{
|
||||
try
|
||||
{
|
||||
var byteArray = HexStringToByteArray(hexString.Replace(" ", ""));
|
||||
var start = 2;
|
||||
|
||||
var 状态 = BitConverter.ToInt32(byteArray.Skip(start + 0).Take(4).ToArray(), 0);
|
||||
if (状态 != 2) return;
|
||||
var 电压V = BitConverter.ToDouble(byteArray.Skip(start + 4).Take(8).ToArray(), 0);
|
||||
var 电流A = BitConverter.ToDouble(byteArray.Skip(start + 12).Take(8).ToArray(), 0);
|
||||
var 电阻uΩ = BitConverter.ToDouble(byteArray.Skip(start + 20).Take(8).ToArray(), 0) * 1000000;
|
||||
var yyyy = BitConverter.ToUInt16(byteArray.Skip(start + 28).Take(2).ToArray(), 0);
|
||||
var MM = byteArray[start + 30];
|
||||
var dd = byteArray[start + 31];
|
||||
var HH = byteArray[start + 32];
|
||||
var mm = byteArray[start + 33];
|
||||
var ss = byteArray[start + 34];
|
||||
var datetime = $"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";
|
||||
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 电压V);
|
||||
MIS_BASE.WritePLC(203, _opName, 电流A);
|
||||
MIS_BASE.WritePLC(204, _opName, 电阻uΩ);
|
||||
MIS_BASE.WritePLC(34, _opName, true);
|
||||
_isTestOk = true;
|
||||
}
|
||||
|
||||
MyLog4Net.MyLogHelper.Info(_opName + "电阻测试", $"电阻结果写入完毕 【电压】{电压V}【电流】{电流A}【电阻】{电阻uΩ}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error(_opName + "电阻测试DataAnalysis", $"数据分析错误: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] HexStringToByteArray(string hex)
|
||||
{
|
||||
if (hex.Length % 2 != 0)
|
||||
{
|
||||
throw new ArgumentException("十六进制字符串长度必须是偶数");
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[hex.Length / 2];
|
||||
for (int i = 0; i < hex.Length; i += 2)
|
||||
{
|
||||
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
410
MisDataFunction/Function1051/OpcServer/WebSubmit.cs
Normal file
410
MisDataFunction/Function1051/OpcServer/WebSubmit.cs
Normal file
@@ -0,0 +1,410 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
private void WebSubmit(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string Content = Convert.ToString(msgEvent.TagValue);
|
||||
|
||||
string opName_SubLine = "";
|
||||
string engineID = "";//工件信息
|
||||
string[] dataArray = Content.Split('|');
|
||||
|
||||
if (dataArray.Length != 2)
|
||||
return;
|
||||
|
||||
|
||||
string m_Command = dataArray[0].ToString();//消息类型
|
||||
string m_Value = dataArray[1].ToString();//消息参数
|
||||
string[] m_Value_array = m_Value.Split('&');//消息参数数量
|
||||
int m_Value_length = m_Value_array.Length; //消息参数长度
|
||||
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
|
||||
{
|
||||
engineID = MIS_BASE.hashtable_EngineGetOver_EngineID[OpName].ToString();
|
||||
}
|
||||
if (MIS_BASE.hashtable_OpNameRepair == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs _e = new DeviceDriver_BasicData.CustomeEvetnArgs();
|
||||
_e.OpName = OpName;
|
||||
_e.TagValue = m_Value;
|
||||
string msg;
|
||||
bool bolVal;
|
||||
|
||||
//根据请求的命令处理逻辑
|
||||
switch (m_Command)
|
||||
{
|
||||
case "Barcode":
|
||||
if (m_Value_length > 1) return;
|
||||
fun_Barcode(_e);
|
||||
break;
|
||||
case "ConfirmOkGo"://合格放行
|
||||
//修改托盘状态
|
||||
|
||||
//MisDataFun.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
break;
|
||||
case "FalseGO"://返修放行
|
||||
//修改托盘状态
|
||||
//BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
break;
|
||||
case "NgGO"://不合格放行
|
||||
//修改托盘状态
|
||||
//保存不合格信息(必须保存不合格放行信息,由于B5A的Moby没有不合格标志位)
|
||||
//BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Insert(OpName, engineID, "", "");
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
break;
|
||||
case "OnLineState"://在线0、离线1、屏蔽2
|
||||
try
|
||||
{
|
||||
if (m_Value_length > 1) return;
|
||||
int a = Convert.ToInt32(m_Value);
|
||||
if (a <= 2)
|
||||
{
|
||||
//BaseDataSystemMES.IsOnLine_Update(OpName, m_Value.ToString());
|
||||
MIS_BASE.Write_OnLineState(OpName, Convert.ToInt32(m_Value));
|
||||
|
||||
if (a == 2) SendMessage.AsyncSendMessage_Notice(OpName, "屏蔽MES!");
|
||||
if (a == 0) SendMessage.AsyncSendMessage_Notice(OpName, "启用MES!");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "NullWorkGo"://空托盘放行 0不放行 1放行
|
||||
try
|
||||
{
|
||||
int a = Convert.ToInt32(m_Value);
|
||||
//修改地址值
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName, a);
|
||||
if (a == 1)
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "开启空托盘放行!");
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "关闭空托盘放行!");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case "Reset"://复位,将MES所有的信息都复位了
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
|
||||
break;
|
||||
case "FixAllow"://重新拧紧
|
||||
break;
|
||||
case "IsAutoGetEngineID"://自动手动申请编号(线首)
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.Write_IsAutoGetEngineID(OpName, Convert.ToInt32(m_Value));
|
||||
break;
|
||||
case "PartPalletGoOver"://空托盘放行
|
||||
MIS_BASE.Write_RepairUpline_MES(opName_SubLine, true);
|
||||
//MIS_BASE.Write_PalletInfo(opName_SubLine, 4);
|
||||
//MIS_BASE.Write_UpdatePalletOK(opName_SubLine, true);
|
||||
MIS_BASE.Write_MaterialVerifyOver(opName_SubLine, true);
|
||||
break;
|
||||
case "SetMoby"://清空托盘(线首)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
break;
|
||||
case "RepairUplineMES"://返修上线
|
||||
MIS_BASE.Write_RepairUpline_MES(OpName, true);
|
||||
break;
|
||||
case "CancelRepair"://将返修件置为正常件
|
||||
|
||||
break;
|
||||
case "PartPalletCode"://申请写入托盘号
|
||||
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
|
||||
break;
|
||||
case "WritePartPalletCode"://写入托盘号
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.WritePLC(113, OpName, Convert.ToInt32(m_Value));
|
||||
Thread.Sleep(500);
|
||||
MIS_BASE.WritePLC(70, OpName, true);
|
||||
break;
|
||||
case "Normal"://启用正常拧紧工位
|
||||
MIS_BASE.Write_Normal(OpName, 1);
|
||||
MIS_BASE.Write_UnNormal(OpName, 0);
|
||||
break;
|
||||
case "UnNormal"://启用备用拧紧工位
|
||||
MIS_BASE.Write_Normal(OpName, 0);
|
||||
MIS_BASE.Write_UnNormal(OpName, 1);
|
||||
break;
|
||||
case "ResetDevice"://复位设备
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
break;
|
||||
case "IsNeedRepaire"://返修上线(返修上线点)
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
//修改托盘状态
|
||||
MIS_BASE.Write_PalletInfo(OpName, 3);
|
||||
//通知修改成功
|
||||
MIS_BASE.Write_UpdatePalletOK(OpName, true);
|
||||
IsNeedRepaire_OK(OpName);
|
||||
}
|
||||
else if (Convert.ToInt32(m_Value) == 0)
|
||||
{
|
||||
//直接给出工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
break;
|
||||
//强制匹配
|
||||
case "ForceMatch":
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
ForceMatch(OpName);
|
||||
}
|
||||
break;
|
||||
case "PalletGO":
|
||||
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
//直接给出工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(opName_SubLine, true);
|
||||
}
|
||||
break;
|
||||
case "ContinueMatch":
|
||||
//BaseDataSystemMES.QualityVerifyStatus_Hash_Write(OpName, true);
|
||||
fun_EngineTypeGetOverPLC(_e);
|
||||
break;
|
||||
//初始化网页信号
|
||||
case "IniSingalToWeb":
|
||||
InitializeSingalToWeb(OpName);
|
||||
break;
|
||||
// 检查项 检查完成
|
||||
case "checkWorkOver":
|
||||
MIS_BASE.WritePLC(30, OpName,1);
|
||||
msg = "MES|checkWorkOverIsShow|" + OpName + "|" + 0;
|
||||
SendMessage.AsyncSendMessage(msg);
|
||||
break;
|
||||
// 重新申请上线
|
||||
case "againPartLoad":
|
||||
// 判断是否有工件到位
|
||||
MIS_BASE.Read_WorkStart(OpName, out bolVal);
|
||||
if (bolVal)
|
||||
{
|
||||
MIS_BASE.WritePLC(35, OpName, 1);
|
||||
msg = "【" + OpName + "】" + "重新申请上线完成!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "【" + OpName + "】" + "当前无工件到位信号,请确认是否存在工件!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
break;
|
||||
// 跳过交互
|
||||
case "skipWork":
|
||||
// 判断是否有工件到位
|
||||
MIS_BASE.Read_WorkStart(OpName, out bolVal);
|
||||
if (bolVal)
|
||||
{
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true); // 传递机型
|
||||
MIS_BASE.Write_FixAllow(OpName,true); // 允许工作
|
||||
MIS_BASE.WritePLC(30, OpName, 1); // 检查完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true); // 保存完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true); // 工作完成
|
||||
msg = "【" + OpName + "】" + "跳过交互完成!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "【" + OpName + "】" + "当前无工件到位信号,请确认是否存在工件!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:WebSubmit");
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMoby(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//清空Moby时,需要将MES信号清空
|
||||
MIS_BASE.Write_ClearMesMoby(OpName);
|
||||
|
||||
//BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||||
|
||||
SendMessageFun.SendMessage("5123", "1111", OpName);
|
||||
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 网页重现登录,恢复关闭前的页面状态
|
||||
/// </summary>
|
||||
/// <param name="Opname">工位号</param>
|
||||
private void InitializeSingalToWeb(string Opname)
|
||||
{
|
||||
InitOpPosion(Opname);
|
||||
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(Opname);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(Opname);
|
||||
// MOBY数据
|
||||
SendMessageFun.SendMessage("5", "1", Opname);
|
||||
//SendMessageFun.SendMessage("5123", "1111", Opname);
|
||||
// 物料信息 物料信息
|
||||
SendMessage.MaterialList(Opname);
|
||||
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
//MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
InitAlarm(Opname);
|
||||
}
|
||||
|
||||
//分线发送工件到位信号函数
|
||||
private void sendmessage(string OpName, int tagValue, string Command)
|
||||
{
|
||||
string SendMessage;
|
||||
SendMessage = "MES|" + Command + "|" + OpName + "|" + tagValue;
|
||||
SendMessageFun.AsyncSendMessage(SendMessage);
|
||||
|
||||
}
|
||||
private void InitAlarm(string Opname)
|
||||
{
|
||||
FuntionMesRead.Alarm_InitAlarm_Send(Opname, out Hashtable ht);
|
||||
foreach (DictionaryEntry kv in ht)
|
||||
{
|
||||
var TagID = kv.Key.ToString();
|
||||
var TagValue = kv.Value.ToString();
|
||||
FuntionMesRead.Send_AlarmMsg(TagID, TagValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void InitOpPosion(string Opname)
|
||||
{
|
||||
int S_WorkCheckOver = Convert.ToInt32(MIS_BASE.ReadPLC(30, Opname));
|
||||
string S_WorkCheckOver_Msg = "MES|checkWorkOverIsShow|" + Opname + "|" + S_WorkCheckOver;
|
||||
SendMessage.AsyncSendMessage(S_WorkCheckOver_Msg);
|
||||
|
||||
bool S_WorkStart;//工件到位 DBX0.1
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_PartLoad;//申请上线
|
||||
MIS_BASE.Read_PartLoad(Opname, out S_PartLoad);
|
||||
if (S_PartLoad == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PartLoad", Convert.ToString(Convert.ToInt32(S_PartLoad)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_EngineGetOver;//传递机型 DBX0.4
|
||||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(Opname);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_FixAllow;//允许工作 DBX3.1
|
||||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||||
if (S_FixAllow == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_MesRead;//允许保存 DBX3.1
|
||||
MIS_BASE.Read_QualityData_Read_CF(Opname, out S_MesRead);
|
||||
if (S_MesRead == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MesRead", Convert.ToString(Convert.ToInt32(S_MesRead)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_ReadOver;//保存完成
|
||||
MIS_BASE.Read_MesReadOver(Opname, out S_ReadOver);
|
||||
if (S_ReadOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MesReadOver", Convert.ToString(Convert.ToInt32(S_ReadOver)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_MaterialVerifyOver;//工作完成 DBX0.3
|
||||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||||
if (S_MaterialVerifyOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
int S_QualityMask;//合格标志 DBX588
|
||||
MIS_BASE.Read_QualityMask(Opname, out S_QualityMask);
|
||||
if (S_QualityMask == 1)
|
||||
{
|
||||
SendMessageFun.SendInfomation("QualityMask", Convert.ToString(Convert.ToInt32(S_QualityMask)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
string S_plcStatus = "false";//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
if (S_plcStatus.ToLower() == "false")
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
66
MisDataFunction/Function1051/OpcServer/WorkStart.cs
Normal file
66
MisDataFunction/Function1051/OpcServer/WorkStart.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void WorkStart(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//线首显示订单信息
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStart, tagValue.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
|
||||
// 清除工位数据
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, "");
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, "");
|
||||
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
|
||||
MIS_BASE.WritePLC(115, OpName, 0); // 清除小机型
|
||||
|
||||
// 检查项完成
|
||||
MIS_BASE.Write_TagTypeID(30, OpName,0);
|
||||
string message = "MES|checkWorkOverIsShow|" + OpName + "|" + 0;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
|
||||
// 重新申请上线
|
||||
MIS_BASE.WritePLC(35, OpName, 0);
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:WorkStart");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1051/OpcServer/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/OpcServer/vssver2.scc
Normal file
Binary file not shown.
36
MisDataFunction/Function1051/Properties/AssemblyInfo.cs
Normal file
36
MisDataFunction/Function1051/Properties/AssemblyInfo.cs
Normal file
@@ -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")]
|
||||
BIN
MisDataFunction/Function1051/Properties/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/Properties/vssver2.scc
Normal file
Binary file not shown.
27
MisDataFunction/Function1051/app.config
Normal file
27
MisDataFunction/Function1051/app.config
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>
|
||||
5
MisDataFunction/Function1051/mssccprj.scc
Normal file
5
MisDataFunction/Function1051/mssccprj.scc
Normal file
@@ -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
|
||||
15
MisDataFunction/Function1051/packages.config
Normal file
15
MisDataFunction/Function1051/packages.config
Normal file
@@ -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/Function1051/vssver2.scc
Normal file
BIN
MisDataFunction/Function1051/vssver2.scc
Normal file
Binary file not shown.
15
MisDataFunction/Function1052/DataAccess/DataAccess.cs
Normal file
15
MisDataFunction/Function1052/DataAccess/DataAccess.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class Function1052
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1052/DataAccess/vssver2.scc
Normal file
BIN
MisDataFunction/Function1052/DataAccess/vssver2.scc
Normal file
Binary file not shown.
10
MisDataFunction/Function1052/Function02.csproj.vspscc
Normal file
10
MisDataFunction/Function1052/Function02.csproj.vspscc
Normal file
@@ -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"
|
||||
}
|
||||
175
MisDataFunction/Function1052/Function1052.csproj
Normal file
175
MisDataFunction/Function1052/Function1052.csproj
Normal file
@@ -0,0 +1,175 @@
|
||||
<?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="MesWork.DeviceDriver">
|
||||
<HintPath>..\..\dll_common\MesWork.DeviceDriver.dll</HintPath>
|
||||
</Reference>
|
||||
<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>..\..\dll_common\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http">
|
||||
<HintPath>..\..\DLL\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Security, Version=4.0.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.Security.4.3.2\lib\net46\System.Net.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.4.3.0\lib\net46\System.Net.WebSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets.Client, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.Client.4.3.2\lib\net46\System.Net.WebSockets.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="MesServerFunction\Fun_1052.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\MaterialsVerify.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\ReqEarlyFeeding.cs" />
|
||||
<Compile Include="OpcServer\ReqTestResistor.cs" />
|
||||
<Compile Include="OpcServer\WebSubmit.cs" />
|
||||
<Compile Include="OpcServer\WorkStart.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="OpcServer\WorkIsOk.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\01-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Interface_WebAPI\SlMesDbIterface\ExternalDataSync.csproj">
|
||||
<Project>{2f33d79d-1dff-4cda-b357-fcd5221cab9a}</Project>
|
||||
<Name>ExternalDataSync</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>
|
||||
<ProjectReference Include="..\..\Common\MyLog4Net\00_MyLog4Net.csproj">
|
||||
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
|
||||
<Name>00_MyLog4Net</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="SaveCode\" />
|
||||
</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>
|
||||
259
MisDataFunction/Function1052/MesServerFunction/Fun_1052.cs
Normal file
259
MisDataFunction/Function1052/MesServerFunction/Fun_1052.cs
Normal file
@@ -0,0 +1,259 @@
|
||||
using MesServerWork;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = MisDataFun.GetCmdStringList(recData);
|
||||
//string[] dataArray = recData.Split('|');
|
||||
//if (dataArray.Count != 4)
|
||||
//return;
|
||||
//消息来源
|
||||
string m_Source = dataArray[0].ToString();
|
||||
//消息类型 Barcode
|
||||
string m_Command = dataArray[1].ToString();
|
||||
//工位号
|
||||
string m_OpName = dataArray[2].ToString();
|
||||
//消息参数
|
||||
string m_Value = dataArray[3].ToString();
|
||||
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs e = new DeviceDriver_BasicData.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string tagValue;
|
||||
|
||||
switch (m_Source)
|
||||
{
|
||||
case "BarCode":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Value;
|
||||
fun_Barcode(e);
|
||||
break;
|
||||
case "WEB":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Command + "|" + m_Value;
|
||||
fun_WebSubmit(e);
|
||||
break;
|
||||
case "PLC":
|
||||
e = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string TagID = e.TagID.ToString();
|
||||
switch (e.TagValue.ToString().ToLower())
|
||||
{
|
||||
case "false":
|
||||
tagValue = "0";
|
||||
break;
|
||||
case "true":
|
||||
tagValue = "1";
|
||||
break;
|
||||
default:
|
||||
tagValue = e.TagValue.ToString();
|
||||
break;
|
||||
}
|
||||
e.TagValue = tagValue;
|
||||
switch (e.TagTypeCodeID.ToString())
|
||||
{
|
||||
//PLC 工件到位
|
||||
case "2":
|
||||
fun_WorkStart(e);
|
||||
break;
|
||||
//PLC 允许保存质量数据
|
||||
case "19":
|
||||
fun_MesRead(e);
|
||||
break;
|
||||
//MES 保存数据完成
|
||||
case "20":
|
||||
fun_MesReadOver(e);
|
||||
break;
|
||||
//PLC 传递机型
|
||||
case "44":
|
||||
fun_EngineTypeGetOverPLC(e);
|
||||
break;
|
||||
//MES 合格放行
|
||||
case "51":
|
||||
fun_ConfirmOkGo(e);
|
||||
break;
|
||||
//MES 不合格放行
|
||||
case "8":
|
||||
fun_FalseGo(e);
|
||||
break;
|
||||
//PLC 工位合格标志
|
||||
case "21":
|
||||
fun_IsOk(e);
|
||||
break;
|
||||
//物料扫码完成
|
||||
case "65":
|
||||
fun_MaterialsVerify(e);
|
||||
break;
|
||||
//MES 系统健康心跳
|
||||
case "14":
|
||||
fun_HeartBeatMIS(e);
|
||||
break;
|
||||
case "63":
|
||||
fun_ReqEarlyFeeding(e);
|
||||
break;
|
||||
case "64":
|
||||
fun_ReqTestResistor(e);
|
||||
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(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许保存
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提前上料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ReqEarlyFeeding(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ReqEarlyFeeding, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求测试电阻 调用电阻仪
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ReqTestResistor(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ReqTestResistor, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料扫码完成
|
||||
/// </summary>
|
||||
public void fun_MaterialsVerify(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MaterialsVerify, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WorkStart, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
public void fun_WebSubmit(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WebSubmit, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工位是否合格
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_IsOk(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(IsOk, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatMIS(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(HeartBeat, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES实时保存质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesSaveNowData(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(MesSaveNowData, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1052/MesServerFunction/vssver2.scc
Normal file
BIN
MisDataFunction/Function1052/MesServerFunction/vssver2.scc
Normal file
Binary file not shown.
109
MisDataFunction/Function1052/Methods/EngineGetOverBaseWork.cs
Normal file
109
MisDataFunction/Function1052/Methods/EngineGetOverBaseWork.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
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;
|
||||
|
||||
if (EngineTypeID <= 0 || EngineID.Length == 0 || EngineType.Length == 0)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "PLC传递机型为空!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
|
||||
return;
|
||||
}
|
||||
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
MisDataFun.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);//显示返修标志
|
||||
|
||||
//第四步,获取是否允许工作
|
||||
MisDataFun.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
|
||||
//调用工厂MES开工接口
|
||||
WebApi.CALL_Inerface_DataHandle.CALL_Inerface_JobStart(OpName, EngineID, OrderForm);
|
||||
}
|
||||
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 = "";
|
||||
//从监控系统中查询出本工位信息
|
||||
//MisDataFun.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1052/Methods/vssver2.scc
Normal file
BIN
MisDataFunction/Function1052/Methods/vssver2.scc
Normal file
Binary file not shown.
89
MisDataFunction/Function1052/OpcServer/Barcode.cs
Normal file
89
MisDataFunction/Function1052/OpcServer/Barcode.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
string AlarmStr = "";
|
||||
|
||||
int IsAllowWork;
|
||||
bool IsSuccess = false;
|
||||
bool EngineGetOver_PLC_NextWorkStep;
|
||||
//传递机型是否到位
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
|
||||
if (!EngineGetOver_PLC_NextWorkStep)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC未传递机型");
|
||||
return;
|
||||
}
|
||||
//物料验证
|
||||
MisDataFun.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||||
if (!IsSuccess)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取是否允许工作
|
||||
MisDataFun.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);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:Barcode");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
119
MisDataFunction/Function1052/OpcServer/EngineGetOver.cs
Normal file
119
MisDataFunction/Function1052/OpcServer/EngineGetOver.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
bool MesRead = false;
|
||||
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
|
||||
MIS_BASE.Read_QualityData_Read_CF(OpName, out MesRead);
|
||||
//第一步,判断允许保存和保存完成信号是否全部被清空,若未清空,则通知复位MES&PLC
|
||||
if (MesRead)
|
||||
{
|
||||
//未能清空信号,请求复位
|
||||
string msg = "【" + OpName + "】" + "未能清空MesRead信号,请求复位!";
|
||||
SendMessageFun.SendInfomation("AskReset", "1", OpName);
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "PLC传递机型 " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
return;
|
||||
}
|
||||
string OrderForm;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
|
||||
// 读取MES区数据 校验MES区数据是否符合 同时判断是否此工件已工作过,若已工作过则弹出弹窗提示
|
||||
if (EngineID != "" & EngineType != "" & OrderForm != "")
|
||||
{
|
||||
DataTable checkTable = MisDataFun.WorkOrderCheck(OpName, EngineID, OrderForm, EngineType);
|
||||
int result = Convert.ToInt32(checkTable.Rows[0]["result"]);
|
||||
//int result = 1;
|
||||
string resultMsg = checkTable.Rows[0]["msg"].ToString();
|
||||
if (result != 2)
|
||||
{
|
||||
if (result == 3)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + resultMsg;
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "PLC传递机型 "+ msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
}
|
||||
int parType = Convert.ToInt32(checkTable.Rows[0]["小机型"]);
|
||||
EngineTypeID = Convert.ToInt32(checkTable.Rows[0]["型号代码"]);
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
|
||||
MIS_BASE.WritePLC(115, OpName, parType); // 托盘类型 1 静 2 动 3 拐
|
||||
|
||||
//写入到数据库的[北汽福田工位状态监控MOBY]表中
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineType, EngineType);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineID, EngineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.OrderForm, OrderForm);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.PartPallet_Code, PartPallet_Code.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineTypeID_MES, EngineTypeID.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineType_MES, EngineType);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.EngineID_MES, EngineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.OrderForm_MES, OrderForm);
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
SendMessage.ShowMoby(OpName);
|
||||
SendMessageFun.SendMessage("5123", "1111", OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "【" + OpName + "】" + resultMsg;
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "PLC传递机型 " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "读取信息存在空值!";
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "PLC传递机型 " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
62
MisDataFunction/Function1052/OpcServer/MaterialsVerify.cs
Normal file
62
MisDataFunction/Function1052/OpcServer/MaterialsVerify.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC物料扫码校验
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
public void MaterialsVerify(object e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
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);
|
||||
|
||||
int MaterialsTypeCode = Convert.ToInt32(MIS_BASE.ReadPLC(201, OpName));
|
||||
string MaterialsCode = MIS_BASE.ReadPLC(40, OpName).ToString();
|
||||
|
||||
DataTable dt = MisDataFun.XD_MaterialsVerify(OpName, EngineID, MaterialsCode, MaterialsTypeCode);
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
if (result == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 1); // 物料校验成功
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 2); // 物料校验失败
|
||||
string msg = $"【{OpName}】产品:{EngineID} | 物料码:{MaterialsCode} | 物料类型:{MaterialsTypeCode.ToString()} 物料校验失败!";
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "MaterialsVerify " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 0); // 物料验证结果清空
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
89
MisDataFunction/Function1052/OpcServer/MesRead.cs
Normal file
89
MisDataFunction/Function1052/OpcServer/MesRead.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
//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;
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_MES;//工件编号
|
||||
string OrderForm_MES;
|
||||
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int qualityMask;
|
||||
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
//MIS_BASE.GetEngineTypeFromPLC_MES(OpName, out EngineTypeID_MES, out EngineType_MES, out EngineID_MES, out OrderForm_MES);
|
||||
//保存数据到线首表 先保存到 北汽福田变速器序列号总线上线 用于之前判断是否重号
|
||||
// 保存质量数据
|
||||
qualityMask = MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
|
||||
// 保存物料数据
|
||||
MisDataFun.Material_Insert(OpName, qualityMask);
|
||||
|
||||
// 测量数据发动机在线状态
|
||||
MisDataFun.WorkStartInsert(OpName, qualityMask);
|
||||
|
||||
// 存追溯表数据
|
||||
MisDataFun.WorkOrderOpWorkOver(OpName, EngineID, OrderForm);
|
||||
|
||||
// 推送质量数据到MES的页面
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
|
||||
//对应手动工位的
|
||||
//MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
//通知设备,MES的质量数据(和物料数据)保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//统计在线产量,在线节拍
|
||||
SendMessage.SendActuallyCount(OpName, tagValue);
|
||||
|
||||
//调用工厂MES接口报工
|
||||
WebApi.CALL_Inerface_DataHandle.CALL_Inerface_JobFinished(OpName, EngineID, OrderForm);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
72
MisDataFunction/Function1052/OpcServer/ReqEarlyFeeding.cs
Normal file
72
MisDataFunction/Function1052/OpcServer/ReqEarlyFeeding.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请提前上料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void ReqEarlyFeeding(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
var dt = MisDataFun.Get_ReqEarlyFeedingData(OpName);
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
string msg = dt.Rows[0]["msg"].ToString();
|
||||
int EngineTypeID = Convert.ToInt32(dt.Rows[0]["产品型号代码"]);
|
||||
if (result == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(96, OpName, EngineTypeID); // 产品型号
|
||||
MIS_BASE.Write_EngineID_MES(OpName, dt.Rows[0]["工件编号"].ToString());
|
||||
int ReadEngineID = Convert.ToInt32(MIS_BASE.ReadPLC(96, OpName));
|
||||
if (EngineTypeID != ReadEngineID)
|
||||
{
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "ReqEarlyFeeding " + $"写入提前上料机型{EngineTypeID.ToString()} 与 读取到的{ReadEngineID.ToString()}不一致", MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
return;
|
||||
}
|
||||
if (EngineTypeID == 0 || ReadEngineID == 0)
|
||||
{
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "ReqEarlyFeeding " + $"写入提前上料机型{EngineTypeID.ToString()} 与 读取到的{ReadEngineID.ToString()} 其中存在空值", MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
return;
|
||||
}
|
||||
MIS_BASE.WritePLC(33, OpName, true); // 允许提前上料
|
||||
|
||||
}
|
||||
else if (result == 2)
|
||||
{
|
||||
MIS_BASE.WritePLC(33, OpName, false);
|
||||
string msg2 = "【" + OpName + "】" + msg;
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "ReqEarlyFeeding " + msg2, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(96, OpName, 0); // 提前上料位置
|
||||
MIS_BASE.WritePLC(33, OpName, false); // 允许提前上料
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
238
MisDataFunction/Function1052/OpcServer/ReqTestResistor.cs
Normal file
238
MisDataFunction/Function1052/OpcServer/ReqTestResistor.cs
Normal file
@@ -0,0 +1,238 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
private readonly object _lockObject = new object();
|
||||
private volatile bool _isTestOk = false;
|
||||
private string _opName;
|
||||
private const int DEFAULT_TIMEOUT = 7000; // 默认超时时间(毫秒)
|
||||
private const int MAX_RETRY_COUNT = 10; // 最大重试次数
|
||||
private const int RESULT_LENGTH = 113; // 预期结果长度
|
||||
|
||||
/// <summary>
|
||||
/// 电阻测试
|
||||
/// </summary>
|
||||
private void ReqTestResistor(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
_opName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
TestResistor().GetAwaiter().GetResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetPLCValues();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("电阻测试", $"测试过程发生错误: {err.Message}");
|
||||
ErrPLCValues();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行电阻测试
|
||||
/// </summary>
|
||||
private async Task TestResistor()
|
||||
{
|
||||
TcpClient tcpClient = null;
|
||||
try
|
||||
{
|
||||
string IP = ConfigurationManager.AppSettings["ResistorDeviceIP_" + _opName];
|
||||
string Port = ConfigurationManager.AppSettings["ResistorDevicePort"];
|
||||
|
||||
using (tcpClient = new TcpClient())
|
||||
{
|
||||
var connectTask = tcpClient.ConnectAsync(IP, Convert.ToInt32(Port));
|
||||
if (await Task.WhenAny(connectTask, Task.Delay(DEFAULT_TIMEOUT)) != connectTask)
|
||||
{
|
||||
throw new TimeoutException("连接电阻仪超时");
|
||||
}
|
||||
|
||||
if (tcpClient.Connected)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Info("电阻测试", "电阻仪链接成功!");
|
||||
await SendCommand(tcpClient, "01 09 64 00 05 00 00 00 00 00 73");
|
||||
|
||||
await Task.Delay(DEFAULT_TIMEOUT);
|
||||
|
||||
var readTask = Task.Run(() => Read(tcpClient));
|
||||
|
||||
int count = 0;
|
||||
while (!_isTestOk && count < MAX_RETRY_COUNT)
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
await SendCommand(tcpClient, "03 01 04");
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count >= MAX_RETRY_COUNT && !_isTestOk)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("电阻测试", "测试超时,未收到有效结果");
|
||||
ErrPLCValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("电阻测试", $"测试过程发生错误: {ex.Message}");
|
||||
ErrPLCValues();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tcpClient != null)
|
||||
{
|
||||
tcpClient.Close();
|
||||
MyLog4Net.MyLogHelper.Info("电阻测试", "电阻仪链接关闭");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetPLCValues()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 0);
|
||||
MIS_BASE.WritePLC(203, _opName, 0);
|
||||
MIS_BASE.WritePLC(204, _opName, 0);
|
||||
MIS_BASE.WritePLC(34, _opName, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void ErrPLCValues()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 0);
|
||||
MIS_BASE.WritePLC(203, _opName, 0);
|
||||
MIS_BASE.WritePLC(204, _opName, 0);
|
||||
MIS_BASE.WritePLC(34, _opName, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送命令到电阻仪
|
||||
/// </summary>
|
||||
private async Task SendCommand(TcpClient tcpClient, string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 将空格分隔的HEX字符串转换为字节数组
|
||||
string[] hexValues = command.Split(' ');
|
||||
byte[] commandbyte = new byte[hexValues.Length];
|
||||
|
||||
for (int i = 0; i < hexValues.Length; i++)
|
||||
{
|
||||
commandbyte[i] = Convert.ToByte(hexValues[i], 16);
|
||||
}
|
||||
|
||||
// 发送HEX格式的数据
|
||||
await tcpClient.Client.SendAsync(new ArraySegment<byte>(commandbyte), SocketFlags.None);
|
||||
|
||||
// 记录发送的命令
|
||||
MyLog4Net.MyLogHelper.Info("电阻测试Send", $"发送命令: {command}");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("电阻测试Send", $"发送命令失败: {err.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void Read(TcpClient tcpClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (!_isTestOk)
|
||||
{
|
||||
if (tcpClient != null && tcpClient.Connected)
|
||||
{
|
||||
byte[] byteCommand = new byte[1024];
|
||||
int icommand = tcpClient.Client.Receive(byteCommand);
|
||||
string hexString = BitConverter.ToString(byteCommand, 0, icommand).Replace("-", " ");
|
||||
|
||||
if (hexString.Length == RESULT_LENGTH)
|
||||
{
|
||||
DataAnalysis(hexString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("电阻测试Read", err.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataAnalysis(string hexString)
|
||||
{
|
||||
try
|
||||
{
|
||||
var byteArray = HexStringToByteArray(hexString.Replace(" ", ""));
|
||||
var start = 2;
|
||||
|
||||
var 状态 = BitConverter.ToInt32(byteArray.Skip(start + 0).Take(4).ToArray(), 0);
|
||||
if (状态 != 2) return;
|
||||
var 电压V = BitConverter.ToDouble(byteArray.Skip(start + 4).Take(8).ToArray(), 0);
|
||||
var 电流A = BitConverter.ToDouble(byteArray.Skip(start + 12).Take(8).ToArray(), 0);
|
||||
var 电阻uΩ = BitConverter.ToDouble(byteArray.Skip(start + 20).Take(8).ToArray(), 0) * 1000000;
|
||||
var yyyy = BitConverter.ToUInt16(byteArray.Skip(start + 28).Take(2).ToArray(), 0);
|
||||
var MM = byteArray[start + 30];
|
||||
var dd = byteArray[start + 31];
|
||||
var HH = byteArray[start + 32];
|
||||
var mm = byteArray[start + 33];
|
||||
var ss = byteArray[start + 34];
|
||||
var datetime = $"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";
|
||||
|
||||
lock (_lockObject)
|
||||
{
|
||||
MIS_BASE.WritePLC(202, _opName, 电压V);
|
||||
MIS_BASE.WritePLC(203, _opName, 电流A);
|
||||
MIS_BASE.WritePLC(204, _opName, 电阻uΩ);
|
||||
MIS_BASE.WritePLC(34, _opName, true);
|
||||
_isTestOk = true;
|
||||
}
|
||||
|
||||
MyLog4Net.MyLogHelper.Info("电阻测试", $"电阻结果写入完毕 【电压】{电压V}【电流】{电流A}【电阻】{电阻uΩ}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("电阻测试DataAnalysis", $"数据分析错误: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] HexStringToByteArray(string hex)
|
||||
{
|
||||
if (hex.Length % 2 != 0)
|
||||
{
|
||||
throw new ArgumentException("十六进制字符串长度必须是偶数");
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[hex.Length / 2];
|
||||
for (int i = 0; i < hex.Length; i += 2)
|
||||
{
|
||||
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
352
MisDataFunction/Function1052/OpcServer/WebSubmit.cs
Normal file
352
MisDataFunction/Function1052/OpcServer/WebSubmit.cs
Normal file
@@ -0,0 +1,352 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using MisDataFunDll;
|
||||
|
||||
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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.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();
|
||||
}
|
||||
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs _e = new DeviceDriver_BasicData.CustomeEvetnArgs();
|
||||
_e.OpName = OpName;
|
||||
_e.TagValue = m_Value;
|
||||
|
||||
string msg;
|
||||
bool bolVal;
|
||||
|
||||
//根据请求的命令处理逻辑
|
||||
switch (m_Command)
|
||||
{
|
||||
case "Barcode":
|
||||
if (m_Value_length > 1) return;
|
||||
fun_Barcode(_e);
|
||||
break;
|
||||
case "OnLineState"://在线0、离线1、屏蔽2
|
||||
try
|
||||
{
|
||||
if (m_Value_length > 1) return;
|
||||
int a = Convert.ToInt32(m_Value);
|
||||
if (a <= 2)
|
||||
{
|
||||
//MisDataFun.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 "checkWorkOver":
|
||||
MIS_BASE.WritePLC(30, OpName, 1);
|
||||
string message = "MES|checkWorkOverIsShow|" + OpName + "|" + 0;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
break;
|
||||
// 跳过交互
|
||||
case "skipWork":
|
||||
// 判断是否有工件到位
|
||||
MIS_BASE.Read_WorkStart(OpName, out bolVal);
|
||||
if (bolVal)
|
||||
{
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true); // 传递机型
|
||||
MIS_BASE.Write_FixAllow(OpName, true); // 允许工作
|
||||
MIS_BASE.WritePLC(30, OpName, 1); // 检查完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true); // 保存完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true); // 工作完成
|
||||
msg = "【" + OpName + "】" + "跳过交互完成!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "【" + OpName + "】" + "当前无工件到位信号,请确认是否存在工件!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WebSubmit");
|
||||
}
|
||||
}
|
||||
private void SetMoby(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//清空Moby时,需要将MES信号清空
|
||||
MIS_BASE.Write_ClearMesMoby(OpName);
|
||||
|
||||
MisDataFun.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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void sendmessage(string OpName, int tagValue, string Command)
|
||||
{
|
||||
string SendMessage;
|
||||
SendMessage = "MES|" + Command + "|" + OpName + "|" + tagValue;
|
||||
SendMessageFun.AsyncSendMessage(SendMessage);
|
||||
|
||||
}
|
||||
|
||||
/// 网页重现登录,恢复关闭前的页面状态
|
||||
/// </summary>
|
||||
/// <param name="Opname">工位号</param>
|
||||
private void InitializeSingalToWeb(string Opname)
|
||||
{
|
||||
|
||||
InitOpPosion(Opname);
|
||||
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(Opname);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(Opname);
|
||||
// MOBY数据
|
||||
SendMessageFun.SendMessage("5", "1", Opname);
|
||||
// 物料信息 物料信息
|
||||
SendMessage.MaterialList(Opname);
|
||||
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
//MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void InitOpPosion(string Opname)
|
||||
{
|
||||
int S_WorkCheckOver = Convert.ToInt32(MIS_BASE.ReadPLC(30, Opname));
|
||||
string S_WorkCheckOver_Msg = "MES|checkWorkOverIsShow|" + Opname + "|" + S_WorkCheckOver;
|
||||
SendMessage.AsyncSendMessage(S_WorkCheckOver_Msg);
|
||||
|
||||
bool S_WorkStart;//工件到位 DBX0.1
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_PartLoad;//申请上线
|
||||
MIS_BASE.Read_PartLoad(Opname, out S_PartLoad);
|
||||
if (S_PartLoad == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PartLoad", Convert.ToString(Convert.ToInt32(S_PartLoad)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_EngineGetOver;//传递机型 DBX0.4
|
||||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(Opname);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_FixAllow;//允许工作 DBX3.1
|
||||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||||
if (S_FixAllow == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_MesRead;//允许保存 DBX3.1
|
||||
MIS_BASE.Read_QualityData_Read_CF(Opname, out S_MesRead);
|
||||
if (S_MesRead == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MesRead", Convert.ToString(Convert.ToInt32(S_MesRead)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_ReadOver;//保存完成
|
||||
MIS_BASE.Read_MesReadOver(Opname, out S_ReadOver);
|
||||
if (S_ReadOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MesReadOver", Convert.ToString(Convert.ToInt32(S_ReadOver)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_MaterialVerifyOver;//工作完成 DBX2.3
|
||||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||||
if (S_MaterialVerifyOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
int S_QualityMask;//合格标志 DBX588
|
||||
MIS_BASE.Read_QualityMask(Opname, out S_QualityMask);
|
||||
if (S_QualityMask == 1)
|
||||
{
|
||||
SendMessageFun.SendInfomation("QualityMask", Convert.ToString(Convert.ToInt32(S_QualityMask)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
string S_plcStatus = "false";//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
if (S_plcStatus.ToLower() == "false")
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
MisDataFunction/Function1052/OpcServer/WorkIsOk.cs
Normal file
44
MisDataFunction/Function1052/OpcServer/WorkIsOk.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
MisDataFunction/Function1052/OpcServer/WorkStart.cs
Normal file
57
MisDataFunction/Function1052/OpcServer/WorkStart.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue > 0)
|
||||
{
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStart, tagValue.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
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, "");
|
||||
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.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_TagTypeID(30, OpName, 0);
|
||||
string message = "MES|checkWorkOverIsShow|" + OpName + "|" + 0;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WorkStart");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1052/OpcServer/vssver2.scc
Normal file
BIN
MisDataFunction/Function1052/OpcServer/vssver2.scc
Normal file
Binary file not shown.
36
MisDataFunction/Function1052/Properties/AssemblyInfo.cs
Normal file
36
MisDataFunction/Function1052/Properties/AssemblyInfo.cs
Normal file
@@ -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")]
|
||||
BIN
MisDataFunction/Function1052/Properties/vssver2.scc
Normal file
BIN
MisDataFunction/Function1052/Properties/vssver2.scc
Normal file
Binary file not shown.
27
MisDataFunction/Function1052/app.config
Normal file
27
MisDataFunction/Function1052/app.config
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>
|
||||
5
MisDataFunction/Function1052/mssccprj.scc
Normal file
5
MisDataFunction/Function1052/mssccprj.scc
Normal file
@@ -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
|
||||
15
MisDataFunction/Function1052/packages.config
Normal file
15
MisDataFunction/Function1052/packages.config
Normal file
@@ -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/Function1052/vssver2.scc
Normal file
BIN
MisDataFunction/Function1052/vssver2.scc
Normal file
Binary file not shown.
15
MisDataFunction/Function1053/DataAccess/DataAccess.cs
Normal file
15
MisDataFunction/Function1053/DataAccess/DataAccess.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class Function1053
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1053/DataAccess/vssver2.scc
Normal file
BIN
MisDataFunction/Function1053/DataAccess/vssver2.scc
Normal file
Binary file not shown.
16
MisDataFunction/Function1053/Db.cs
Normal file
16
MisDataFunction/Function1053/Db.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public class Db
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
10
MisDataFunction/Function1053/Function02.csproj.vspscc
Normal file
10
MisDataFunction/Function1053/Function02.csproj.vspscc
Normal file
@@ -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"
|
||||
}
|
||||
172
MisDataFunction/Function1053/Function1053.csproj
Normal file
172
MisDataFunction/Function1053/Function1053.csproj
Normal file
@@ -0,0 +1,172 @@
|
||||
<?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="MesWork.DeviceDriver">
|
||||
<HintPath>..\..\dll_common\MesWork.DeviceDriver.dll</HintPath>
|
||||
</Reference>
|
||||
<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>..\..\dll_common\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="MesServerFunction\Fun_1053.cs" />
|
||||
<Compile Include="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\HeartBeat.cs" />
|
||||
<Compile Include="OpcServer\MaterialsVerify.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\PartLoad.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\01-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Interface_WebAPI\SlMesDbIterface\ExternalDataSync.csproj">
|
||||
<Project>{2f33d79d-1dff-4cda-b357-fcd5221cab9a}</Project>
|
||||
<Name>ExternalDataSync</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>
|
||||
<ProjectReference Include="..\..\Common\MyLog4Net\00_MyLog4Net.csproj">
|
||||
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
|
||||
<Name>00_MyLog4Net</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
270
MisDataFunction/Function1053/MesServerFunction/Fun_1053.cs
Normal file
270
MisDataFunction/Function1053/MesServerFunction/Fun_1053.cs
Normal file
@@ -0,0 +1,270 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = MisDataFun.GetCmdStringList(recData);
|
||||
//string[] dataArray = recData.Split('|');
|
||||
//if (dataArray.Count != 4)
|
||||
//return;
|
||||
//消息来源
|
||||
string m_Source = dataArray[0].ToString();
|
||||
//消息类型 Barcode
|
||||
string m_Command = dataArray[1].ToString();
|
||||
//工位号
|
||||
string m_OpName = dataArray[2].ToString();
|
||||
//消息参数
|
||||
string m_Value = dataArray[3].ToString();
|
||||
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs e = new DeviceDriver_BasicData.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string tagValue;
|
||||
|
||||
switch (m_Source)
|
||||
{
|
||||
case "BarCode":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Value;
|
||||
fun_Barcode(e);
|
||||
break;
|
||||
case "WEB":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Command + "|" + m_Value;
|
||||
fun_WebSubmit(e);
|
||||
break;
|
||||
case "PLC":
|
||||
e = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string TagID = e.TagID.ToString();
|
||||
switch (e.TagValue.ToString().ToLower())
|
||||
{
|
||||
case "false":
|
||||
tagValue = "0";
|
||||
break;
|
||||
case "true":
|
||||
tagValue = "1";
|
||||
break;
|
||||
default:
|
||||
tagValue = e.TagValue.ToString();
|
||||
break;
|
||||
}
|
||||
e.TagValue = tagValue;
|
||||
switch (e.TagTypeCodeID.ToString())
|
||||
{
|
||||
//PLC 工件到位
|
||||
case "2":
|
||||
fun_WorkStart(e);
|
||||
break;
|
||||
//PLC 允许保存质量数据
|
||||
case "19":
|
||||
fun_MesRead(e);
|
||||
break;
|
||||
//MES 保存数据完成
|
||||
case "20":
|
||||
fun_MesReadOver(e);
|
||||
break;
|
||||
//PLC 申请上线
|
||||
case "43":
|
||||
PartLoad(e);
|
||||
break;
|
||||
//PLC 传递机型
|
||||
case "44":
|
||||
fun_EngineTypeGetOverPLC(e);
|
||||
break;
|
||||
//MES 合格放行
|
||||
case "51":
|
||||
fun_ConfirmOkGo(e);
|
||||
break;
|
||||
//MES 不合格放行
|
||||
case "8":
|
||||
fun_FalseGo(e);
|
||||
break;
|
||||
//PLC 工位合格标志
|
||||
case "21":
|
||||
fun_IsOk(e);
|
||||
break;
|
||||
//MES 系统健康心跳
|
||||
case "14":
|
||||
fun_HeartBeatMIS(e);
|
||||
break;
|
||||
//空料握手plc
|
||||
case "49":
|
||||
fun_Handshake(e);
|
||||
break;
|
||||
//待上料数量plc
|
||||
case "38":
|
||||
UpdateWait_NUM_PLC(e);
|
||||
break;
|
||||
case "63":
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
MIS_BASE.Read_TagTypeID(63, m_OpName, out S_plcStatus);
|
||||
if (S_plcStatus.ToLower() != "true" || S_plcStatus.ToLower() == "1")
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", m_OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", m_OpName);
|
||||
}
|
||||
break;
|
||||
//物料扫码完成
|
||||
case "65":
|
||||
fun_MaterialsVerify(e);
|
||||
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(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DeviceDriver_BasicData .CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许保存
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料扫码完成
|
||||
/// </summary>
|
||||
public void fun_MaterialsVerify(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MaterialsVerify, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WorkStart, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
public void fun_WebSubmit(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WebSubmit, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工位是否合格
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_IsOk(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(IsOk, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatMIS(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(HeartBeat, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 空料握手plc
|
||||
/// </summary>
|
||||
public void fun_Handshake(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
//ThreadPool.QueueUserWorkItem(Handshake_Fun, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MES实时保存质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesSaveNowData(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
// ThreadPool.QueueUserWorkItem(MesSaveNowData, e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1053/MesServerFunction/vssver2.scc
Normal file
BIN
MisDataFunction/Function1053/MesServerFunction/vssver2.scc
Normal file
Binary file not shown.
115
MisDataFunction/Function1053/Methods/EngineGetOverBaseWork.cs
Normal file
115
MisDataFunction/Function1053/Methods/EngineGetOverBaseWork.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
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;
|
||||
|
||||
if (EngineTypeID <= 0 || EngineID.Length == 0 || EngineType.Length == 0)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + "PLC传递机型为空!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
MisDataFun.MesServer_Process_EngineTypeOverBQ(OpName);
|
||||
|
||||
//通知web显示
|
||||
//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);//显示返修标志
|
||||
|
||||
//第四步,获取是否允许工作
|
||||
MisDataFun.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
MIS_BASE.Write_WorkStart(OpName, true);
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
MIS_BASE.Write_EngineTypeGetOver_PLC(OpName, true);
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.FixAllow, "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
SendMessageFun.SendMessage("1235", "1111", 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 = "";
|
||||
////从监控系统中查询出本工位信息
|
||||
//MisDataFun.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>
|
||||
private void UpdateWait_NUM_PLC(object e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1053/Methods/vssver2.scc
Normal file
BIN
MisDataFunction/Function1053/Methods/vssver2.scc
Normal file
Binary file not shown.
79
MisDataFunction/Function1053/OpcServer/Barcode.cs
Normal file
79
MisDataFunction/Function1053/OpcServer/Barcode.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
string AlarmStr = "";
|
||||
|
||||
int IsAllowWork;
|
||||
bool IsSuccess = false;
|
||||
|
||||
MisDataFun.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||||
if (!IsSuccess)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
}
|
||||
|
||||
//获取是否允许工作
|
||||
MisDataFun.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
// 保存物料信息
|
||||
MisDataFun.Material_Insert(OpName, 1);
|
||||
|
||||
SendMessageFun.SendMessage("24", "11", OpName);
|
||||
|
||||
// 物料验证完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认!");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:Barcode");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
72
MisDataFunction/Function1053/OpcServer/EngineGetOver.cs
Normal file
72
MisDataFunction/Function1053/OpcServer/EngineGetOver.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
//int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if(msgEvent.TagValueUp.ToString() == "6")
|
||||
{
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
string Program_No = "";
|
||||
MisDataFun.GetEngineType_Order(OpName, Program_No, out int EngineTypeID, out string EngineType, out string EngineID, out string OrderForm, out int isCheckOk, out int planCount, out int haveUplaodCount, out int remainingQuantity, out string msg2);
|
||||
if (isCheckOk == 2)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + msg2;
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Error("PartLoad", msg);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, MisDataFun.MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineType, EngineType);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineID, EngineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.OrderForm, OrderForm);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineTypeID_MES, EngineTypeID.ToString());
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineType_MES, EngineType);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.EngineID_MES, EngineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.OrderForm_MES, OrderForm);
|
||||
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, 0, OrderForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1053", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
34
MisDataFunction/Function1053/OpcServer/HeartBeat.cs
Normal file
34
MisDataFunction/Function1053/OpcServer/HeartBeat.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//返写在MES心跳中
|
||||
MIS_BASE.WritePLC(15, OpName, tagValue);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
62
MisDataFunction/Function1053/OpcServer/MaterialsVerify.cs
Normal file
62
MisDataFunction/Function1053/OpcServer/MaterialsVerify.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC物料扫码校验
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
public void MaterialsVerify(object e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
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);
|
||||
|
||||
int MaterialsTypeCode = Convert.ToInt32(MIS_BASE.ReadPLC(201, OpName));
|
||||
string MaterialsCode = MIS_BASE.ReadPLC(40, OpName).ToString();
|
||||
|
||||
DataTable dt = MisDataFun.XD_MaterialsVerify(OpName, EngineID, MaterialsCode, MaterialsTypeCode);
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
if (result == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 1); // 物料校验成功
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 2); // 物料校验失败
|
||||
string msg = $"【{OpName}】产品:{EngineID} | 物料码:{MaterialsCode} | 物料类型:{MaterialsTypeCode.ToString()} 物料校验失败!";
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "MaterialsVerify " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(95, OpName, 0); // 物料验证结果清空
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
88
MisDataFunction/Function1053/OpcServer/MesRead.cs
Normal file
88
MisDataFunction/Function1053/OpcServer/MesRead.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using MesServerWork;
|
||||
using MesWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许保存(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_MES;//工件编号
|
||||
string OrderForm_MES;
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.MesRead, "0");
|
||||
Thread.Sleep(500);
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.MesRead, "1");
|
||||
if (tagValue == 1)
|
||||
{
|
||||
bool isEngineGetOver;
|
||||
DataRow mobyData = MisDataFun.GetMobyTableByOpName(OpName).Rows[0];
|
||||
EngineTypeID_MES = Convert.ToInt32(mobyData["产品型号代码_MES"]);
|
||||
EngineType_MES = mobyData["发动机型号_MES"].ToString();
|
||||
EngineID_MES = mobyData["变速器序列号_MES"].ToString();
|
||||
OrderForm_MES = mobyData["订单号_MES"].ToString();
|
||||
isEngineGetOver = Convert.ToBoolean(mobyData["允许工作"]);
|
||||
|
||||
if (!isEngineGetOver)
|
||||
{
|
||||
string msg2 = "【" + OpName + "】" + "请先开始订单生产后再进行保存,当前未允许工作!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg2);
|
||||
return;
|
||||
}
|
||||
|
||||
// 存追溯表数据
|
||||
MisDataFun.WorkOrderOpWorkOver(OpName, EngineID_MES, OrderForm_MES);
|
||||
|
||||
// 保存物料数据
|
||||
MisDataFun.Material_Insert(OpName, 1);
|
||||
|
||||
// 测量数据发动机在线状态
|
||||
MisDataFun.WorkStartInsert(OpName, 1);
|
||||
|
||||
//通知设备,MES的质量数据(和物料数据)保存完成
|
||||
//统计在线产量,在线节拍
|
||||
SendMessage.SendActuallyCount(OpName, tagValue);
|
||||
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.MesReadOver, "1");
|
||||
Thread.Sleep(1000 * 1);
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.WorkStart, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.EngineTypeGetOverPLC, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.PartLoad, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.MesRead, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.MesReadOver, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.FixAllow, "0");
|
||||
|
||||
|
||||
string msg = "【" + OpName + "】" + "工件数据保存完成!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1053", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
55
MisDataFunction/Function1053/OpcServer/PartLoad.cs
Normal file
55
MisDataFunction/Function1053/OpcServer/PartLoad.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线(针对上线工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
// 清空MOBY表中所有数据
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.WorkStart, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.EngineTypeGetOverPLC, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.PartLoad, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.MesRead, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.MesReadOver, "0");
|
||||
MisDataFun.MobySendWebAndSaveData(OpName, MisDataFun.MobyTagType.FixAllow, "0");
|
||||
Thread.Sleep(500);
|
||||
// 按照生产排序顺序获取订单相关数据
|
||||
// 获取到数据 显示 申请上线、传递机型、允许工作三个点位
|
||||
// 显示对应物料信息、
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
////上线工位清MES传递机型信号
|
||||
//MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//// 清除报警
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1053", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
336
MisDataFunction/Function1053/OpcServer/WebSubmit.cs
Normal file
336
MisDataFunction/Function1053/OpcServer/WebSubmit.cs
Normal file
@@ -0,0 +1,336 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
//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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.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();
|
||||
}
|
||||
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs _e = new DeviceDriver_BasicData.CustomeEvetnArgs();
|
||||
_e.OpName = OpName;
|
||||
_e.TagValue = m_Value;
|
||||
|
||||
//根据请求的命令处理逻辑
|
||||
switch (m_Command)
|
||||
{
|
||||
case "Barcode":
|
||||
if (m_Value_length > 1) return;
|
||||
fun_Barcode(_e);
|
||||
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 "SelectOrderForm"://分线接受前端模拟传递机型
|
||||
_e.TagValueUp = "6";
|
||||
EngineTypeGetOver_PLC(_e);
|
||||
break;
|
||||
case "outLineOpNameWorkOver"://分线接受前端模拟工作完成
|
||||
_e.TagValueUp = "6";
|
||||
_e.TagValue = 1;
|
||||
MesRead(_e);
|
||||
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);
|
||||
|
||||
SendMessageFun.SendMessage("5123", "1111", OpName);
|
||||
|
||||
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 网页重现登录,恢复关闭前的页面状态
|
||||
/// </summary>
|
||||
/// <param name="Opname">工位号</param>
|
||||
private void InitializeSingalToWeb(string OpName)
|
||||
{
|
||||
InitOpPosion(OpName);
|
||||
|
||||
////3显示操作指导图片 PicShow_String_FirstOpName
|
||||
//SendMessage.PicShow_FirstOpName(OpOpNamename);
|
||||
////1(直接在界面通过选择机型确认工序内容)
|
||||
//SendMessage.ProcessList_FirstOpName(OpName);
|
||||
//// MOBY数据
|
||||
//SendMessageFun.SendMessage("5", "1", OpName);
|
||||
//// 物料信息 物料信息
|
||||
//SendMessage.MaterialList(OpName);
|
||||
|
||||
SendMessageFun.SendMessage("315", "111", OpName);
|
||||
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
//MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
InitAlarm(OpName);
|
||||
}
|
||||
|
||||
//分线发送工件到位信号函数
|
||||
private void sendmessage(string OpName, int tagValue, string Command)
|
||||
{
|
||||
string SendMessage;
|
||||
SendMessage = "MES|" + Command + "|" + OpName + "|" + tagValue;
|
||||
SendMessageFun.AsyncSendMessage(SendMessage);
|
||||
|
||||
}
|
||||
private void InitAlarm(string Opname)
|
||||
{
|
||||
FuntionMesRead.Alarm_InitAlarm_Send(Opname, out Hashtable ht);
|
||||
foreach (DictionaryEntry kv in ht)
|
||||
{
|
||||
var TagID = kv.Key.ToString();
|
||||
var TagValue = kv.Value.ToString();
|
||||
FuntionMesRead.Send_AlarmMsg(TagID, TagValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void InitOpPosion(string Opname)
|
||||
{
|
||||
int S_WorkCheckOver = Convert.ToInt32(MIS_BASE.ReadPLC(30, Opname));
|
||||
string S_WorkCheckOver_Msg = "MES|checkWorkOverIsShow|" + Opname + "|" + S_WorkCheckOver;
|
||||
SendMessage.AsyncSendMessage(S_WorkCheckOver_Msg);
|
||||
|
||||
bool S_WorkStart;//工件到位 DBX0.1
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_PartLoad;//申请上线
|
||||
MIS_BASE.Read_PartLoad(Opname, out S_PartLoad);
|
||||
if (S_PartLoad == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PartLoad", Convert.ToString(Convert.ToInt32(S_PartLoad)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_EngineGetOver;//传递机型 DBX0.4
|
||||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(Opname);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_FixAllow;//允许工作 DBX3.1
|
||||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||||
if (S_FixAllow == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_MesRead;//允许保存 DBX3.1
|
||||
MIS_BASE.Read_QualityData_Read_CF(Opname, out S_MesRead);
|
||||
if (S_MesRead == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MesRead", Convert.ToString(Convert.ToInt32(S_MesRead)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_ReadOver;//保存完成
|
||||
MIS_BASE.Read_MesReadOver(Opname, out S_ReadOver);
|
||||
if (S_ReadOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MesReadOver", Convert.ToString(Convert.ToInt32(S_ReadOver)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
bool S_MaterialVerifyOver;//工作完成 DBX2.3
|
||||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||||
if (S_MaterialVerifyOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
int S_QualityMask;//合格标志 DBX588
|
||||
MIS_BASE.Read_QualityMask(Opname, out S_QualityMask);
|
||||
if (S_QualityMask == 1)
|
||||
{
|
||||
SendMessageFun.SendInfomation("QualityMask", Convert.ToString(Convert.ToInt32(S_QualityMask)), Opname);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
string S_plcStatus = "false";//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
if (S_plcStatus.ToLower() == "false")
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
MisDataFunction/Function1053/OpcServer/WorkIsOk.cs
Normal file
44
MisDataFunction/Function1053/OpcServer/WorkIsOk.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
49
MisDataFunction/Function1053/OpcServer/WorkStart.cs
Normal file
49
MisDataFunction/Function1053/OpcServer/WorkStart.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
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
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//if (tagValue > 0)
|
||||
//{
|
||||
// MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
// MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.WorkStart, tagValue.ToString());
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MisDataFun.OpName_MIS_MOBY_Insert(OpName,MisDataFun.MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
// MIS_BASE.Write_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, "");
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WorkStart");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1053/OpcServer/vssver2.scc
Normal file
BIN
MisDataFunction/Function1053/OpcServer/vssver2.scc
Normal file
Binary file not shown.
36
MisDataFunction/Function1053/Properties/AssemblyInfo.cs
Normal file
36
MisDataFunction/Function1053/Properties/AssemblyInfo.cs
Normal file
@@ -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")]
|
||||
BIN
MisDataFunction/Function1053/Properties/vssver2.scc
Normal file
BIN
MisDataFunction/Function1053/Properties/vssver2.scc
Normal file
Binary file not shown.
27
MisDataFunction/Function1053/app.config
Normal file
27
MisDataFunction/Function1053/app.config
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>
|
||||
5
MisDataFunction/Function1053/mssccprj.scc
Normal file
5
MisDataFunction/Function1053/mssccprj.scc
Normal file
@@ -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
|
||||
15
MisDataFunction/Function1053/packages.config
Normal file
15
MisDataFunction/Function1053/packages.config
Normal file
@@ -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/Function1053/vssver2.scc
Normal file
BIN
MisDataFunction/Function1053/vssver2.scc
Normal file
Binary file not shown.
15
MisDataFunction/Function1054/DataAccess/DataAccess.cs
Normal file
15
MisDataFunction/Function1054/DataAccess/DataAccess.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class Function1052
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1054/DataAccess/vssver2.scc
Normal file
BIN
MisDataFunction/Function1054/DataAccess/vssver2.scc
Normal file
Binary file not shown.
15
MisDataFunction/Function1054/Db.cs
Normal file
15
MisDataFunction/Function1054/Db.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public class Db
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
10
MisDataFunction/Function1054/Function02.csproj.vspscc
Normal file
10
MisDataFunction/Function1054/Function02.csproj.vspscc
Normal file
@@ -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"
|
||||
}
|
||||
182
MisDataFunction/Function1054/Function1054.csproj
Normal file
182
MisDataFunction/Function1054/Function1054.csproj
Normal file
@@ -0,0 +1,182 @@
|
||||
<?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="MesWork.DeviceDriver">
|
||||
<HintPath>..\..\dll_common\MesWork.DeviceDriver.dll</HintPath>
|
||||
</Reference>
|
||||
<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>..\..\dll_common\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http">
|
||||
<HintPath>..\..\DLL\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Security, Version=4.0.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.Security.4.3.2\lib\net46\System.Net.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.4.3.0\lib\net46\System.Net.WebSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets.Client, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.Client.4.3.2\lib\net46\System.Net.WebSockets.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Db.cs" />
|
||||
<Compile Include="MesServerFunction\Fun_1054.cs" />
|
||||
<Compile Include="OpcServer\AllowAGVEnter.cs" />
|
||||
<Compile Include="OpcServer\AllowAGVLeave.cs" />
|
||||
<Compile Include="OpcServer\AllowAGVLower.cs" />
|
||||
<Compile Include="OpcServer\AllowAGVRaise.cs" />
|
||||
<Compile Include="OpcServer\CallMaterials.cs" />
|
||||
<Compile Include="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="OpcServer\LoadEmptyTray.cs" />
|
||||
<Compile Include="OpcServer\PointToPoint.cs" />
|
||||
<Compile Include="OpcServer\RequestReturnMaterial.cs" />
|
||||
<Compile Include="OpcServer\RequestReturns.cs" />
|
||||
<Compile Include="OpcServer\ReturnAndRedispatch.cs" />
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="OpcServer\ToolCodeScanOver.cs" />
|
||||
<Compile Include="OpcServer\TransferSequence.cs" />
|
||||
<Compile Include="OpcServer\UnloadEmptyTray.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\01-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\MyLog4Net\00_MyLog4Net.csproj">
|
||||
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
|
||||
<Name>00_MyLog4Net</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Interface_WebAPI\SlMesDbIterface\ExternalDataSync.csproj">
|
||||
<Project>{2f33d79d-1dff-4cda-b357-fcd5221cab9a}</Project>
|
||||
<Name>ExternalDataSync</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>
|
||||
<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>
|
||||
328
MisDataFunction/Function1054/MesServerFunction/Fun_1054.cs
Normal file
328
MisDataFunction/Function1054/MesServerFunction/Fun_1054.cs
Normal file
@@ -0,0 +1,328 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = MisDataFun.GetCmdStringList(recData);
|
||||
//string[] dataArray = recData.Split('|');
|
||||
//if (dataArray.Count != 4)
|
||||
//return;
|
||||
//消息来源
|
||||
string m_Source = dataArray[0].ToString();
|
||||
//消息类型 Barcode
|
||||
string m_Command = dataArray[1].ToString();
|
||||
//工位号
|
||||
string m_OpName = dataArray[2].ToString();
|
||||
//消息参数
|
||||
string m_Value = dataArray[3].ToString();
|
||||
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs e = new DeviceDriver_BasicData.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.CustomeEvetnArgs>(m_Value);
|
||||
string tagValue;
|
||||
string OpName = m_OpName;
|
||||
switch (m_Source)
|
||||
{
|
||||
case "PLC":
|
||||
e = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceDriver_BasicData.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())
|
||||
{
|
||||
// AGV相关变量类型代码处理说明:
|
||||
// 301:AGV请求进入
|
||||
// 302:AGV器具放置完毕
|
||||
// 303:AGV退出光栅
|
||||
// 304:送料信息验证完成
|
||||
// 305:送料信息验证结果
|
||||
// 305:任务发送状态 0 没有 1 发送 2 失败
|
||||
// 311:请求叫料
|
||||
// 312:请求退空
|
||||
// 313:请求退料
|
||||
// 314:允许AGV进入
|
||||
// 315:允许AGV离开
|
||||
// 316:器具码扫描完毕
|
||||
// 317:退回并重新配送
|
||||
// 318:器具号
|
||||
// 319:请求上料机型
|
||||
// 320:收到状态反馈点
|
||||
// 321:转序
|
||||
// 322:下空托盘
|
||||
// 323:上空托盘
|
||||
// 324:点对点
|
||||
// 500:AGV请求下降
|
||||
// 501:AGV请求举升
|
||||
// 550:允许AGV下降
|
||||
// 551:允许AGV举升
|
||||
|
||||
// 请求叫料
|
||||
case "311":
|
||||
fun_CallMaterials(e);
|
||||
break;
|
||||
// 请求退空
|
||||
case "312":
|
||||
fun_RequestReturns(e);
|
||||
break;
|
||||
// 请求退料
|
||||
case "313":
|
||||
fun_RequestReturnMaterial(e);
|
||||
break;
|
||||
// 允许AGV进入
|
||||
case "314":
|
||||
fun_AllowAGVEnter(e);
|
||||
break;
|
||||
// 允许AGV离开
|
||||
case "315":
|
||||
fun_AllowAGVLeave(e);
|
||||
break;
|
||||
// 器具码扫描完毕
|
||||
case "316":
|
||||
fun_ToolCodeScanOver(e);
|
||||
break;
|
||||
// 退回并重新配送
|
||||
case "317":
|
||||
fun_ReturnAndRedispatch(e);
|
||||
break;
|
||||
// 收到任务状态握手
|
||||
case "320":
|
||||
//MIS_BASE.WritePLC(306, m_OpName, 0);
|
||||
break;
|
||||
// 转序
|
||||
case "321":
|
||||
fun_TransferSequence(e);
|
||||
break;
|
||||
// 下空托盘
|
||||
case "322":
|
||||
fun_UnloadEmptyTray(e);
|
||||
break;
|
||||
// 上空托盘
|
||||
case "323":
|
||||
fun_LoadEmptyTray(e);
|
||||
break;
|
||||
// 允许AGV下降
|
||||
case "550":
|
||||
fun_AllowAGVLower(e);
|
||||
break;
|
||||
// 允许AGV举升
|
||||
case "551":
|
||||
fun_AllowAGVRaise(e);
|
||||
break;
|
||||
// AGV插头完成
|
||||
case "400":
|
||||
break;
|
||||
// AGV拔插头完成
|
||||
case "401":
|
||||
break;
|
||||
// MES允许开始磨合
|
||||
case "402":
|
||||
break;
|
||||
// MES反馈磨合结束
|
||||
case "403":
|
||||
break;
|
||||
// 托盘压紧气缸压紧
|
||||
case "404":
|
||||
if (tagValue == "1") MIS_BASE.WritePLC(405, OpName, false);
|
||||
break;
|
||||
// 托盘压紧气缸松开
|
||||
case "405":
|
||||
if (tagValue == "1") MIS_BASE.WritePLC(404, OpName, false);
|
||||
break;
|
||||
// 插头推靠气缸推靠
|
||||
case "406":
|
||||
if (tagValue == "1") MIS_BASE.WritePLC(407, OpName, false);
|
||||
break;
|
||||
// 插头推靠气缸退回
|
||||
case "407":
|
||||
if (tagValue == "1") MIS_BASE.WritePLC(406, OpName, false);
|
||||
break;
|
||||
// 自动模式
|
||||
case "408":
|
||||
if (tagValue == "1") MIS_BASE.WritePLC(409, OpName, false); // 自动掉手动模式
|
||||
break;
|
||||
// 手动模式
|
||||
case "409":
|
||||
if (tagValue == "1") MIS_BASE.WritePLC(408, OpName, false); // 自动掉自动模式
|
||||
break;
|
||||
// 请求上线
|
||||
case "450":
|
||||
MisDataFun.Rrunning_UpdateOpCallStatus(OpName, Convert.ToInt32(tagValue)); // 更新至数据库库位状态
|
||||
break;
|
||||
// 请求下线
|
||||
case "451":
|
||||
break;
|
||||
// 请求插插头
|
||||
case "452":
|
||||
// 需要调用AGV插插头接口 去插
|
||||
break;
|
||||
// 请求拔插头
|
||||
case "453":
|
||||
break;
|
||||
// 开始磨合
|
||||
case "454":
|
||||
break;
|
||||
// 磨合完成
|
||||
case "455":
|
||||
break;
|
||||
// 推靠气缸原位
|
||||
case "456":
|
||||
break;
|
||||
// 推靠气缸到位
|
||||
case "457":
|
||||
break;
|
||||
// 压紧气缸原位
|
||||
case "458":
|
||||
break;
|
||||
// 压紧气缸到位
|
||||
case "459":
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 叫料流程
|
||||
// 1.请求叫料 收到请求叫料后 调用叫料接口 后续收到AGV的
|
||||
// 2.收到工厂 请求进入接口(工厂未开发 跳过) 发给PLC AGV请求进入
|
||||
// 3.收到允许AGV进入 调用接口(未开发 跳过) 允许进入
|
||||
// 4.收到 器具码扫码完成 根据318器具号 调用器具号查询接口 得出校验结果
|
||||
// 5.若器具码校验通过 调用 确认物料配送接口 调用成功后 给PLC发送 送料信息验证结果(1 合格 2 不合格) 和 送料信息验证完成
|
||||
// 6.收到AGV请求离开接口后(未开发 跳过) 发送给PLC请求离开点位
|
||||
// 7.收到PLC允许离开信号后 调用AGV允许离开接口(未开发 跳过)
|
||||
|
||||
// 退空托流程
|
||||
// 1.收到请求退空 调用退空托接口
|
||||
// 2.如叫料AGV请求进入 请求离开。。。。 只不过不需要扫描器具码部分
|
||||
|
||||
|
||||
// AGV相关方法声明(PLC触发的信号)
|
||||
/// <summary>
|
||||
/// 请求叫料
|
||||
/// </summary>
|
||||
public void fun_CallMaterials(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(CallMaterials, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求退空
|
||||
/// </summary>
|
||||
public void fun_RequestReturns(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(RequestReturns, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求退料
|
||||
/// </summary>
|
||||
public void fun_RequestReturnMaterial(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(RequestReturnMaterial, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许AGV进入
|
||||
/// </summary>
|
||||
public void fun_AllowAGVEnter(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(AllowAGVEnter, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许AGV离开
|
||||
/// </summary>
|
||||
public void fun_AllowAGVLeave(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(AllowAGVLeave, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许AGV下降
|
||||
/// </summary>
|
||||
public void fun_AllowAGVLower(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(AllowAGVLower, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许AGV举升
|
||||
/// </summary>
|
||||
public void fun_AllowAGVRaise(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(AllowAGVRaise, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 器具码扫描完毕
|
||||
/// </summary>
|
||||
public void fun_ToolCodeScanOver(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ToolCodeScanOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 退回并重新配送
|
||||
/// </summary>
|
||||
public void fun_ReturnAndRedispatch(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ReturnAndRedispatch, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转序
|
||||
/// </summary>
|
||||
public void fun_TransferSequence(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(TransferSequence, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下空托盘
|
||||
/// </summary>
|
||||
public void fun_UnloadEmptyTray(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(UnloadEmptyTray, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上空托盘
|
||||
/// </summary>
|
||||
public void fun_LoadEmptyTray(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(LoadEmptyTray, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点对点
|
||||
/// </summary>
|
||||
public void fun_PointToPoint(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(PointToPoint, e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1054/MesServerFunction/vssver2.scc
Normal file
BIN
MisDataFunction/Function1054/MesServerFunction/vssver2.scc
Normal file
Binary file not shown.
177
MisDataFunction/Function1054/Methods/EngineGetOverBaseWork.cs
Normal file
177
MisDataFunction/Function1054/Methods/EngineGetOverBaseWork.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
////电子看板_装配零件_临时表_增加_北汽
|
||||
////第二步,将零件信息转移到零件_临时表中
|
||||
//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);//显示返修标志
|
||||
//MIS_BASE.Read_TagTypeID(201, OpName, out string EngineTypeID_QiaoKe);
|
||||
|
||||
//Db.OP50_OPA90_MatchResult(EngineTypeID, Convert.ToInt32(EngineTypeID_QiaoKe), EngineID, OrderForm, out int MatchResult, out string MatchResultStr);
|
||||
//if (MatchResult == 1)
|
||||
//{
|
||||
// // 轮毂线
|
||||
// MIS_BASE.Write_Match(OpName, true);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName, true);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName, true); // 允许工作
|
||||
// return;
|
||||
//}
|
||||
//else if (MatchResult == 2) // 分等待状态 与 报警状态 等待的话就等A60 工作完成时判断清除等待 写入A90 的匹配结果 匹配完成 允许工作
|
||||
//{
|
||||
// MIS_BASE.WritePLC(29, OpName, true); // 开始等待 通知A60 保存完成时更新下等待状态与匹配状态
|
||||
// return;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // 将根据轮毂号 工位号 时间 报错内容 存储到数据库中供查询
|
||||
// BaseDataSystemMES.HeLi_OoNameAlarmRecord_Add(OpName, EngineID, MatchResultStr);
|
||||
// // 匹配结果不成功
|
||||
// MIS_BASE.Write_Match(OpName, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName, true);// 匹配完成
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//// 判断分线是否 传递机型
|
||||
//if (EngineGetOver_SubLine)
|
||||
//{
|
||||
// string EngineTypeID_MainLine;
|
||||
// int EngineTypeID_MainLineQiaoKe;
|
||||
// // 读取主线桥壳机型
|
||||
// MIS_BASE.Read_EngineTypeID(OpName_MainLine, out EngineTypeID_MainLineQiaoKe);
|
||||
// // 读取分线存储的桥壳机型
|
||||
// MIS_BASE.Read_TagTypeID(38, OpName_SubLine, out EngineTypeID_MainLine);
|
||||
|
||||
// if (Convert.ToInt32(EngineTypeID_MainLine) == EngineTypeID)
|
||||
// {
|
||||
// Db.OP50_OPA90_MatchResult(EngineTypeID, Convert.ToInt32(EngineTypeID_MainLine), EngineTypeID_MainLineQiaoKe, out int MatchResult);
|
||||
|
||||
// if (MatchResult == 0) // 不匹配
|
||||
// {
|
||||
// // 主线
|
||||
// MIS_BASE.Write_Match(OpName_MainLine, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_MainLine, false);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_MainLine, false); // 允许工作
|
||||
// // 分线
|
||||
// MIS_BASE.Write_Match(OpName_SubLine, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_SubLine, false);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_SubLine, false); // 允许工作
|
||||
|
||||
// // 写入分线 等待 0
|
||||
// MIS_BASE.WritePLC(29, OpName_SubLine, "0");
|
||||
// }
|
||||
// if (MatchResult == 1) // 允许抓
|
||||
// {
|
||||
// // 主线
|
||||
// MIS_BASE.Write_Match(OpName_MainLine, true);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_MainLine, true);// 匹配完成
|
||||
// // 分线
|
||||
// MIS_BASE.Write_Match(OpName_SubLine, true);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_SubLine, true);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_MainLine, true); // 允许工作
|
||||
|
||||
// // 写入分线 等待 0
|
||||
// MIS_BASE.WritePLC(29, OpName_SubLine, "0");
|
||||
// }
|
||||
// if (MatchResult == 2) // 等待
|
||||
// {
|
||||
// // 写入分线 等待 1
|
||||
// MIS_BASE.WritePLC(29, OpName_SubLine, "1");
|
||||
// }
|
||||
// }
|
||||
// else // 不匹配
|
||||
// {
|
||||
// // 主线
|
||||
// MIS_BASE.Write_Match(OpName_MainLine, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_MainLine, false);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_MainLine, false); // 允许工作
|
||||
// // 分线
|
||||
// MIS_BASE.Write_Match(OpName_SubLine, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_SubLine, false);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_SubLine, false); // 允许工作
|
||||
|
||||
// // 写入分线 等待 0
|
||||
// MIS_BASE.WritePLC(29, OpName_SubLine, "0");
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
/// <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 = "";
|
||||
//从监控系统中查询出本工位信息
|
||||
//MisDataFun.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1054/Methods/vssver2.scc
Normal file
BIN
MisDataFunction/Function1054/Methods/vssver2.scc
Normal file
Binary file not shown.
51
MisDataFunction/Function1054/OpcServer/AllowAGVEnter.cs
Normal file
51
MisDataFunction/Function1054/OpcServer/AllowAGVEnter.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许AGV进入
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void AllowAGVEnter(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
string msg;
|
||||
|
||||
// PLC允许AGV离开信号被置位后,应调用AGV允许进入接口
|
||||
MIS_BASE.Read_EngineID(OpName, out string EngineID);
|
||||
bool isOk = MisDataSaveDate.AGV_BusinessLogic.PassAgvInOut(OpName, EngineID, "apply");
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV进入成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV进入失败!请注意!";
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("AllowAGVLeave", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVEnter", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
MisDataFunction/Function1054/OpcServer/AllowAGVLeave.cs
Normal file
55
MisDataFunction/Function1054/OpcServer/AllowAGVLeave.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许AGV离开
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void AllowAGVLeave(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg = $"【{OpName}】允许AGV离开";
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
|
||||
// PLC允许AGV离开信号被置位后,应调用AGV允许离开接口
|
||||
MIS_BASE.Read_EngineID(OpName,out string EngineID);
|
||||
bool isOk = MisDataSaveDate.AGV_BusinessLogic.PassAgvInOut(OpName, EngineID, "release");
|
||||
|
||||
if (isOk) {
|
||||
msg = $"【{OpName}】允许AGV离开失败!请注意!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV离开成功!";
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("AllowAGVLeave", msg);
|
||||
|
||||
// 记录允许AGV离开状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVLeave", "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVLeave", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
MisDataFunction/Function1054/OpcServer/AllowAGVLower.cs
Normal file
51
MisDataFunction/Function1054/OpcServer/AllowAGVLower.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许AGV下降
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void AllowAGVLower(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
string msg;
|
||||
|
||||
// PLC允许AGV下降信号被置位后,应调用AGV允许下降接口
|
||||
MIS_BASE.Read_EngineID(OpName, out string EngineID);
|
||||
bool isOk = MisDataSaveDate.AGV_BusinessLogic.PassAgvInOut(OpName, EngineID, "lower");
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV下降成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV下降失败!请注意!";
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("AllowAGVLower", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVLower", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
MisDataFunction/Function1054/OpcServer/AllowAGVRaise.cs
Normal file
51
MisDataFunction/Function1054/OpcServer/AllowAGVRaise.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许AGV举升
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void AllowAGVRaise(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
string msg;
|
||||
|
||||
// PLC允许AGV举升信号被置位后,应调用AGV允许举升接口
|
||||
MIS_BASE.Read_EngineID(OpName, out string EngineID);
|
||||
bool isOk = MisDataSaveDate.AGV_BusinessLogic.PassAgvInOut(OpName, EngineID, "raise");
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV举升成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV举升失败!请注意!";
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("AllowAGVRaise", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVRaise", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
MisDataFunction/Function1054/OpcServer/CallMaterials.cs
Normal file
68
MisDataFunction/Function1054/OpcServer/CallMaterials.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Data;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求叫料
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void CallMaterials(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
// 记录叫料请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "CallMaterials", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "2");
|
||||
// 调用叫料接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序
|
||||
DataTable outType = MisDataFun.GetRequestReturnMaterials_Type(OpName, "2");
|
||||
string sendType = outType.Rows[0]["type"].ToString();
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, sendType);
|
||||
if (isOk)
|
||||
{
|
||||
// 发送消息通知
|
||||
msg = $"【{OpName}】请求叫料成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】请求叫料失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("CallMaterials", msg);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "CallMaterials", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
MisDataFunction/Function1054/OpcServer/LoadEmptyTray.cs
Normal file
63
MisDataFunction/Function1054/OpcServer/LoadEmptyTray.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 上空托盘操作
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void LoadEmptyTray(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录上空托盘请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "LoadEmptyTray", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "6");
|
||||
|
||||
// 调用上空托盘接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序,5下空,6上空,7点对点
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "6");
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】上空托盘操作成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】上空托盘操作失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("LoadEmptyTray", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "LoadEmptyTray", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
64
MisDataFunction/Function1054/OpcServer/PointToPoint.cs
Normal file
64
MisDataFunction/Function1054/OpcServer/PointToPoint.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 点对点操作
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void PointToPoint(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录点对点请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "PointToPoint", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "7");
|
||||
|
||||
// 调用点对点接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序,5下空,6上空,7点对点
|
||||
// 注意:终点位置暂时为空,等业务明确后再补充
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "7");
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】点对点操作成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】点对点操作失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("PointToPoint", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "PointToPoint", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
121
MisDataFunction/Function1054/OpcServer/RequestReturnMaterial.cs
Normal file
121
MisDataFunction/Function1054/OpcServer/RequestReturnMaterial.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Data;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求退料
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void RequestReturnMaterial(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录退料请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "RequestReturnMaterial", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "3");
|
||||
|
||||
// 调用退料接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序
|
||||
DataTable outType = MisDataFun.GetRequestReturnMaterials_Type(OpName, "3");
|
||||
string sendType = outType.Rows[0]["type"].ToString();
|
||||
bool isOk;
|
||||
if (sendType == "4")
|
||||
{
|
||||
// 调用转序接口 走转序流程
|
||||
string EngineID = DateTime.Now.ToString("yyyyMMddHHmm");
|
||||
string EngineType = "NONE";
|
||||
DataTable nextDT = MisDataFun.Rrunning_GetNextStoreData(OpName, EngineID, EngineType);
|
||||
string targetStoreCode = nextDT.Rows[0]["目标库位号"].ToString();
|
||||
string targetProcessCode = nextDT.Rows[0]["目标工序号"].ToString();
|
||||
string targetProcess = nextDT.Rows[0]["目标工序"].ToString();
|
||||
|
||||
|
||||
// 1. 调用AGV转序接口
|
||||
var agvResult = CALL_Inerface_DataHandle.CALL_Inerface_MaterialTransfer(OpName, targetStoreCode);
|
||||
int agvCode = 500;
|
||||
int.TryParse(agvResult["code"]?.ToString() ?? "500", out agvCode);
|
||||
|
||||
if (agvCode != 200)
|
||||
{
|
||||
// AGV调度失败
|
||||
isOk = false;
|
||||
msg = $"【{OpName}】AGV调度失败:{agvResult["message"]?.ToString() ?? "未知错误"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 2. AGV调度成功,执行转序存储过程
|
||||
var param = new System.Data.SqlClient.SqlParameter[] {
|
||||
new System.Data.SqlClient.SqlParameter("@库位号", OpName),
|
||||
new System.Data.SqlClient.SqlParameter("@产品编号", EngineID),
|
||||
new System.Data.SqlClient.SqlParameter("@产品型号", EngineType),
|
||||
new System.Data.SqlClient.SqlParameter("@目标库位号", targetStoreCode),
|
||||
new System.Data.SqlClient.SqlParameter("@目标工序", targetProcess),
|
||||
new System.Data.SqlClient.SqlParameter("@目标工序号", targetProcessCode)
|
||||
};
|
||||
|
||||
DataLinkMesWork2.DataAccess2.ExecuteStoredProcedure("XD_磨合_开始下一序", ref param, out string errMessage);
|
||||
|
||||
if (!string.IsNullOrEmpty(errMessage))
|
||||
{
|
||||
isOk = false;
|
||||
msg = $"【{OpName}】AGV调度成功,但XD_磨合_开始下一序存储过程执行失败:{errMessage}";
|
||||
}
|
||||
else
|
||||
{
|
||||
isOk = true;
|
||||
msg = $"【{OpName}】转序操作成功";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, sendType);
|
||||
|
||||
}
|
||||
if (isOk)
|
||||
{
|
||||
// 发送消息通知
|
||||
msg = $"【{OpName}】请求退料成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】请求退料失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("RequestReturnMaterial", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "RequestReturnMaterial", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位 器具放置完毕
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
MisDataFunction/Function1054/OpcServer/RequestReturns.cs
Normal file
68
MisDataFunction/Function1054/OpcServer/RequestReturns.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Data;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求退空
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void RequestReturns(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录退空请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "RequestReturns", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "1");
|
||||
|
||||
// 调用退料接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序
|
||||
DataTable outType = MisDataFun.GetRequestReturnMaterials_Type(OpName, "1");
|
||||
string sendType = outType.Rows[0]["type"].ToString();
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, sendType);
|
||||
if (isOk)
|
||||
{
|
||||
// 发送消息通知
|
||||
msg = $"【{OpName}】请求退空托成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】请求退空托失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("RequestReturns", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "RequestReturns", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位 器具放置完毕
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 退回并重新配送
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void ReturnAndRedispatch(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
//string OpName = Convert.ToString(msgEvent.OpName);
|
||||
//int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//if (tagValue == 1)
|
||||
//{
|
||||
// // 这个流程不太对 具体流程待二次确认
|
||||
// // 记录退回并重新配送状态
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "ReturnAndRedispatch", "1");
|
||||
|
||||
// // 当器具码校验不通过时,PLC会置位此信号
|
||||
// // 需要通知AGV退回当前器具并重新配送正确的物料
|
||||
// // 调用工厂叫料接口,类型为送料(3)
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "3");
|
||||
// CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "3");
|
||||
|
||||
// // 发送消息通知
|
||||
// string msg = $"【{OpName}】请求退回物料,退回并重新配送";
|
||||
// SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
// MyLog4Net.MyLogHelper.Info("ReturnAndRedispatch", msg);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "ReturnAndRedispatch", "0");
|
||||
// MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
// MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
// MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
// MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
// MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
102
MisDataFunction/Function1054/OpcServer/ToolCodeScanOver.cs
Normal file
102
MisDataFunction/Function1054/OpcServer/ToolCodeScanOver.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using WebApi;
|
||||
using MisDataSaveDate.MOM;
|
||||
using System.Linq;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 器具码扫描完毕
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void ToolCodeScanOver(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录器具码扫描完毕状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "ToolCodeScanOver", "1");
|
||||
|
||||
// 获取器具号(318)
|
||||
string containerNo = MIS_BASE.ReadPLC(318, OpName).ToString();
|
||||
|
||||
// 记录器具号
|
||||
if (!string.IsNullOrEmpty(containerNo))
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "器具号", containerNo);
|
||||
}
|
||||
|
||||
// 调用器具信息查询接口
|
||||
DeviceInfoResponse deviceInfoResult = CALL_Inerface_DataHandle.CALL_Inerface_DeviceInfoQuery(OpName, containerNo);
|
||||
|
||||
// 处理器具信息查询结果
|
||||
bool isValid = true;
|
||||
string validationMsg = "";
|
||||
|
||||
//if (deviceInfoResult != null && deviceInfoResult.code == 200 && deviceInfoResult.data != null)
|
||||
//{
|
||||
// isValid = true;
|
||||
|
||||
// if (deviceInfoResult.data.businessdata != null && deviceInfoResult.data.businessdata.Count > 0)
|
||||
// {
|
||||
// var firstMaterial = deviceInfoResult.data.businessdata.First();
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "物料编号", firstMaterial.sku);
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "批次号", firstMaterial.batchno);
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "数量", firstMaterial.qty);
|
||||
|
||||
// validationMsg = $"器具验证成功,物料编号:{firstMaterial.sku}";
|
||||
// }
|
||||
|
||||
// // 调用物料配送确认接口
|
||||
// CALL_Inerface_DataHandle.CALL_Inerface_MaterialConfirm(OpName, containerNo);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // 器具信息查询失败
|
||||
// isValid = false;
|
||||
// validationMsg = deviceInfoResult?.message ?? "器具信息查询失败";
|
||||
//}
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_MaterialConfirm(OpName, containerNo);
|
||||
|
||||
// 根据校验结果写入验证结果
|
||||
// 送料信息验证结果(305):1 合格 2 不合格
|
||||
MIS_BASE.WritePLC(305, OpName, isOk ? "1" : "2");
|
||||
|
||||
// 送料信息验证完成(304)
|
||||
MIS_BASE.WritePLC(304, OpName, true);
|
||||
|
||||
// 更新验证状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "送料验证结果", isOk ? "1" : "2");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "当前状态", validationMsg);
|
||||
|
||||
// 发送消息通知
|
||||
string msg = $"【{OpName}】器具码扫描完毕,器具号:{containerNo},{validationMsg} 验证结果{isOk.ToString()}";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("ToolCodeScanOver", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 清除验证完成信号
|
||||
MIS_BASE.WritePLC(305, OpName, "0");
|
||||
MIS_BASE.WritePLC(304, OpName, false);
|
||||
|
||||
// 记录器具码扫描完毕状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "ToolCodeScanOver", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
MisDataFunction/Function1054/OpcServer/TransferSequence.cs
Normal file
63
MisDataFunction/Function1054/OpcServer/TransferSequence.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 转序操作
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void TransferSequence(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
//// 记录转序请求状态
|
||||
//MisDataFun.Location_MIS_MOBY_Insert(OpName, "TransferSequence", "1");
|
||||
//MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "4");
|
||||
|
||||
//// 调用转序接口
|
||||
//// deliveryType: 1退托盘,2叫料,3送料,4转序,5下空,6上空,7点对点
|
||||
//bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "4");
|
||||
//if (isOk)
|
||||
//{
|
||||
// msg = $"【{OpName}】转序操作成功";
|
||||
// MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// msg = $"【{OpName}】转序操作失败";
|
||||
// MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
//}
|
||||
|
||||
//SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
//MyLog4Net.MyLogHelper.Info("TransferSequence", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "TransferSequence", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位 器具放置完毕
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
MisDataFunction/Function1054/OpcServer/UnloadEmptyTray.cs
Normal file
63
MisDataFunction/Function1054/OpcServer/UnloadEmptyTray.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 下空托盘操作
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void UnloadEmptyTray(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录下空托盘请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "UnloadEmptyTray", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "5");
|
||||
|
||||
// 调用下空托盘接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序,5下空,6上空,7点对点
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "5");
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】下空托盘操作成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】下空托盘操作失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("UnloadEmptyTray", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "UnloadEmptyTray", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1054/OpcServer/vssver2.scc
Normal file
BIN
MisDataFunction/Function1054/OpcServer/vssver2.scc
Normal file
Binary file not shown.
36
MisDataFunction/Function1054/Properties/AssemblyInfo.cs
Normal file
36
MisDataFunction/Function1054/Properties/AssemblyInfo.cs
Normal file
@@ -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")]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user