chore: 初始化合力差速器MES采集程序
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class Function1053
|
||||
{
|
||||
//针对“MIS.BizFacade.Dll”中没有的存储过程,在此类中新建
|
||||
//新建原则:所有的函数用private,只允许在内部使用
|
||||
//针对单个工艺特殊,需要新建存储过程,但是存储过程不能被加入到“MIS.BizFacade.Dll”中
|
||||
|
||||
private void aa()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
109
MisDataFunction/MesServer.Function/Function1053/Db.cs
Normal file
109
MisDataFunction/MesServer.Function/Function1053/Db.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DataLinkMesWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public class Db
|
||||
{
|
||||
public static bool GetEngineType_Order(string opName, string 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)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
isCheckOk = 2;
|
||||
EngineTypeID = 0;
|
||||
EngineType = "";
|
||||
EngineID = "";
|
||||
OrderForm = "";
|
||||
planCount = 0;
|
||||
haveUplaodCount = 0;
|
||||
remainingQuantity = 0;
|
||||
string produceName = "合力_生产上线_分线_判断机型订单是否匹配";
|
||||
SqlParameter[] thisParms = new SqlParameter[1];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
//thisParms[1] = new System.Data.SqlClient.SqlParameter("@PLC_机型代码", Program_No);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
|
||||
{
|
||||
if (dt.Rows.Count > 0 && dt.Rows[0]["是否匹配"].ToString() == "1")
|
||||
{
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
EngineType = dt.Rows[0]["机型"].ToString();
|
||||
EngineID = dt.Rows[0]["变速箱总成号"].ToString();
|
||||
OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
isCheckOk = Convert.ToInt32(dt.Rows[0]["是否匹配"]);
|
||||
planCount = Convert.ToInt32(dt.Rows[0]["计划上料数量"]);
|
||||
haveUplaodCount = Convert.ToInt32(dt.Rows[0]["已上料数量"]);
|
||||
remainingQuantity = Convert.ToInt32(dt.Rows[0]["待上料数量"]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool SubLine_WorkFinish(string EngineID, string opName, string OrderForm, int qualityMask)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
string produceName = "合力_分装线上线完成_扣数";
|
||||
SqlParameter[] thisParms = new SqlParameter[4];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@差速器总成号", EngineID);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@订单号", OrderForm);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@合格标志", qualityMask);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool UpdateWait_NUM_PLC(string opName, int Wait_NUM)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
string produceName = "合力_分装线PLC_更新待上线数量";
|
||||
SqlParameter[] thisParms = new SqlParameter[2];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@待上线数量", Wait_NUM);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static bool GethandType_Order(string opName, out int EngineTypeID, out string EngineType, out string EngineID, out string OrderForm, out int isCheckOk, out int planCount, out int haveUplaodCount, out int remainingQuantity)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
isCheckOk = 2;
|
||||
EngineTypeID = 0;
|
||||
EngineType = "";
|
||||
EngineID = "";
|
||||
OrderForm = "";
|
||||
planCount = 0;
|
||||
haveUplaodCount = 0;
|
||||
remainingQuantity = 0;
|
||||
string produceName = "合力_生产上线_分线_判断机型订单是否匹配";
|
||||
SqlParameter[] thisParms = new SqlParameter[1];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
|
||||
{
|
||||
if (dt.Rows.Count > 0 && dt.Rows[0]["是否匹配"].ToString() == "1")
|
||||
{
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
EngineType = dt.Rows[0]["机型"].ToString();
|
||||
EngineID = dt.Rows[0]["变速箱总成号"].ToString();
|
||||
OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
isCheckOk = Convert.ToInt32(dt.Rows[0]["是否匹配"]);
|
||||
planCount = Convert.ToInt32(dt.Rows[0]["计划上料数量"]);
|
||||
haveUplaodCount = Convert.ToInt32(dt.Rows[0]["已上料数量"]);
|
||||
remainingQuantity = Convert.ToInt32(dt.Rows[0]["待上料数量"]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = "relative:MesServer.Function\\Function02"
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{CA8A12C5-7BF0-4489-93FA-180B1C492BBA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Function1053</RootNamespace>
|
||||
<AssemblyName>Function1053</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\dll_fun\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MQTTnet">
|
||||
<HintPath>..\..\..\Common\dll\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient">
|
||||
<HintPath>..\..\..\Common\dll\MQTTnet.Extensions.ManagedClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Common\dll\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http">
|
||||
<HintPath>..\..\DLL\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Security, Version=4.0.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.Security.4.3.2\lib\net46\System.Net.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.4.3.0\lib\net46\System.Net.WebSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets.Client, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Net.WebSockets.Client.4.3.2\lib\net46\System.Net.WebSockets.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Db.cs" />
|
||||
<Compile Include="MesServerFunction\Fun_1053.cs" />
|
||||
<Compile Include="Methods\EngineGetOverBaseWork.cs" />
|
||||
<Compile Include="Methods\SubmitToMisweb.cs" />
|
||||
<Compile Include="DataAccess\DataAccess.cs" />
|
||||
<Compile Include="Methods\UDP.Send.cs" />
|
||||
<Compile Include="OpcServer\Barcode.cs" />
|
||||
<Compile Include="OpcServer\QuitMaterials.cs" />
|
||||
<Compile Include="OpcServer\CallMaterials.cs" />
|
||||
<Compile Include="OpcServer\ConfirmOkGo.cs" />
|
||||
<Compile Include="OpcServer\EngineGetOver.cs" />
|
||||
<Compile Include="OpcServer\FalseGO.cs" />
|
||||
<Compile Include="OpcServer\HeartBeat.cs" />
|
||||
<Compile Include="OpcServer\MesRead.cs" />
|
||||
<Compile Include="OpcServer\MesReadOver.cs" />
|
||||
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
||||
<Compile Include="OpcServer\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\02WebApiCall\02_02WebApiCallPLC.csproj">
|
||||
<Project>{3e6d1dd5-01c9-435f-9941-61f906ce35bb}</Project>
|
||||
<Name>02_02WebApiCallPLC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\04DataBaseAccess\DataBaseAccess\04-DataBaseAccess.csproj">
|
||||
<Project>{f434e066-4c59-47c8-aa82-6f48cc84501a}</Project>
|
||||
<Name>04-DataBaseAccess</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\07WebBusinessFacade\BusinessFacade\07BusinessFacade.csproj">
|
||||
<Project>{f0a0c525-03fd-428a-9b17-7f54aa0e4475}</Project>
|
||||
<Name>07BusinessFacade</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\08WebFun_base\WebFun_base\08-WebFun_base.csproj">
|
||||
<Project>{d98be764-adeb-488d-9714-61e308aa8201}</Project>
|
||||
<Name>08-WebFun_base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\09MesDataFunction\MesDataFunction\09-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MisDataFun\SendMessageToWebMqtt\12SendMessageToWeb.csproj">
|
||||
<Project>{e4eb6420-906d-4672-947a-ca33ddcdadfc}</Project>
|
||||
<Name>12SendMessageToWeb</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MIS_FuntionSaveData\MIS_FuntionSaveData\13.3MIS_FuntionSaveData.csproj">
|
||||
<Project>{55b510c1-59e9-4bfd-ae84-d76d46f6e365}</Project>
|
||||
<Name>02-13.3MIS_FuntionSaveData</Name>
|
||||
</ProjectReference>
|
||||
<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>
|
||||
@@ -0,0 +1,298 @@
|
||||
using MesServerWork;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
public partial class FunctionMES
|
||||
{
|
||||
object lockFunWork;
|
||||
//public void FunWork(DoWhatPlc.CustomeEvetnArgs e)
|
||||
public void FunWork(string recData)
|
||||
{
|
||||
|
||||
|
||||
lockFunWork = new object();
|
||||
lock (lockFunWork)
|
||||
{
|
||||
List<string> dataArray = DoWhatPlc.MessageText.GetCmdStringList(recData);
|
||||
//string[] dataArray = recData.Split('|');
|
||||
//if (dataArray.Count != 4)
|
||||
//return;
|
||||
//消息来源
|
||||
string m_Source = dataArray[0].ToString();
|
||||
//消息类型 Barcode
|
||||
string m_Command = dataArray[1].ToString();
|
||||
//工位号
|
||||
string m_OpName = dataArray[2].ToString();
|
||||
//消息参数
|
||||
string m_Value = dataArray[3].ToString();
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs e = new DoWhatPlc.CustomeEvetnArgs();// = Newtonsoft.Json.JsonConvert.DeserializeObject<DoWhatPlc.CustomeEvetnArgs>(m_Value);
|
||||
string tagValue;
|
||||
|
||||
switch (m_Source)
|
||||
{
|
||||
case "BarCode":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Value;
|
||||
fun_Barcode(e);
|
||||
break;
|
||||
case "WEB":
|
||||
e.OpName = m_OpName;
|
||||
e.TagValue = m_Command + "|" + m_Value;
|
||||
fun_WebSubmit(e);
|
||||
break;
|
||||
case "PLC":
|
||||
e = Newtonsoft.Json.JsonConvert.DeserializeObject<DoWhatPlc.CustomeEvetnArgs>(m_Value);
|
||||
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 "65":
|
||||
fun_MesSaveNowData(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;
|
||||
// 请求叫料 1 206 2 211
|
||||
// 请求退料 1 207 2 212
|
||||
// 允许进入 1 208 2 213
|
||||
// 退料类型 1 209 2 214
|
||||
// 叫料类型 1 210 2 215
|
||||
// 到料类型 1 202 2 205
|
||||
// 请求进入 1 200 2 203
|
||||
// AGV已离开1 201 2 204
|
||||
|
||||
// 请求叫料
|
||||
case "206":
|
||||
case "211":
|
||||
fun_CallMaterials(e);
|
||||
break;
|
||||
// 请求退料
|
||||
case "207":
|
||||
case "212":
|
||||
fun_QuitMaterials(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(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求叫料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_CallMaterials(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(CallMaterials, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 请求离开
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
public void fun_QuitMaterials(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(QuitMaterials, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_EngineTypeGetOverPLC(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(EngineTypeGetOver_PLC, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_ConfirmOkGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(ConfirmOkGo, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_FalseGo(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许保存
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesRead(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesRead, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesReadOver(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesReadOver, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位离开(清空所有的MES信号)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_WorkStart(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WorkStart, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
public void fun_WebSubmit(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(WebSubmit, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工位是否合格
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_IsOk(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(IsOk, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系统健康心跳监测
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_HeartBeatMIS(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(HeartBeat, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 空料握手plc
|
||||
/// </summary>
|
||||
public void fun_Handshake(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Handshake_Fun, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MES实时保存质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public void fun_MesSaveNowData(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(MesSaveNowData, e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,214 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 正常逻辑工作(传递机型)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="PartPallet_Code"></param>
|
||||
private void EngineTypeGetOver_PLC_Work(string OpName, int EngineTypeID, string EngineType, string EngineID, int PartPallet_Code, string OrderForm)
|
||||
{
|
||||
int IsAllowWork;
|
||||
int RepairPartStatusPLC = 0;
|
||||
int MES_QualityMask = 1;
|
||||
|
||||
if (EngineTypeID <= 0 || EngineID.Length == 0 || EngineType.Length == 0)
|
||||
{
|
||||
MIS_BASE.WritePLC(34, OpName, true);
|
||||
string msg = "【" + OpName + "】" + "PLC传递机型为空!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
MIS_BASE.Write_MesReadOver(OpName, false); //保存完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false); //工作完成信号
|
||||
MIS_BASE.Write_FixAllow(OpName, true); // 允许工作
|
||||
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
// BaseDataSystemMES.MesServer_Process_EngineTypeOverBQ(OpName);
|
||||
|
||||
//通知web显示
|
||||
//SendMessageFun.SendMessage("123", "111", OpName);
|
||||
//MIS_BASE.Read_PalletInfo(OpName, out MES_QualityMask);//合格标志 合格标志暂时改为即时响应式的
|
||||
//MIS_BASE.Read_RepairStatus_PLC(OpName, out RepairPartStatusPLC);//返修标志
|
||||
//SendMessageFun.SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);//显示合格标志
|
||||
//SendMessageFun.SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);//显示返修标志
|
||||
|
||||
|
||||
|
||||
//if (MES_QualityMask == 2)
|
||||
//{
|
||||
// 暂时先屏蔽掉
|
||||
////工作完成
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//SendMessageFun.SendInfomation("NgGO", "1", OpName);//显示不合格标志
|
||||
//return;
|
||||
// }
|
||||
|
||||
//第三步,用于工件离开后完工数量统计及工件编号追溯
|
||||
//BaseDataSystemMES.MaterialPush_EngineIDStatus_Insert(OpName);//更新订单产量
|
||||
|
||||
//第四步,获取是否允许工作
|
||||
//BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
//if (IsAllowWork == 1)
|
||||
//{
|
||||
// MIS_BASE.Write_MesReadOver(OpName, false); //允许保存信号
|
||||
// MIS_BASE.Write_MaterialVerifyOver(OpName, false); //工作完成信号
|
||||
// MIS_BASE.Write_FixAllow(OpName, true);
|
||||
|
||||
// // 判断有没有PLC传递机型 没有就不给
|
||||
// //bool isEngine = Convert.ToBoolean(MIS_BASE.ReadPLC(44, OpName));
|
||||
// //if (isEngine)
|
||||
// //{
|
||||
// // //通知PLC允许工作,允许工作在保存完成时清空
|
||||
// // MIS_BASE.Write_FixAllow(OpName, true);
|
||||
// //}
|
||||
// //else
|
||||
// //{
|
||||
// // MyLog4Net.MyLogHelper.Error($"{OpName}给允许工作时无传递机型:", $"Message:");
|
||||
// //}
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_two(string OpName)
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, Convert.ToInt32(PartPallet_Code), OrderForm);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 跳过二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_Skip(string OpName)
|
||||
{
|
||||
//MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返修件需要工作
|
||||
/// </summary>
|
||||
/// <param name="OpName">工位号</param>
|
||||
private void IsNeedRepaire_OK(string OpName)
|
||||
{
|
||||
string orderForm = "";
|
||||
int engineTypeID;
|
||||
string engineType = "";
|
||||
string engineID = "";
|
||||
string palletCode = "";
|
||||
int isRepair;
|
||||
string repairCode = "";
|
||||
//从监控系统中查询出本工位信息
|
||||
BaseDataSystemMES.OpName_MIS_Moby_Select(OpName,
|
||||
out orderForm, out engineTypeID, out engineType,
|
||||
out engineID, out palletCode, out isRepair, out repairCode);
|
||||
|
||||
EngineTypeGetOver_PLC_Work(OpName, engineTypeID, engineType, engineID, Convert.ToInt32(palletCode), orderForm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新待上料数量
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void UpdateWait_NUM_PLC(object e)
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
// 更新待上料数量到数据库
|
||||
Db.UpdateWait_NUM_PLC(OpName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 空料握手plc
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void Handshake_Fun(object e)
|
||||
{
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int planCount = 0; // 计划上料数量
|
||||
int haveUplaodCount = 0; // 已上料数量
|
||||
int remainingQuantity = 0; // 待上料数量
|
||||
Db.GethandType_Order(OpName, out int EngineTypeID,
|
||||
out string EngineType, out string EngineID, out string OrderForm,
|
||||
out int isCheckOk, out planCount, out haveUplaodCount, out remainingQuantity);
|
||||
if (isCheckOk == 2)
|
||||
{
|
||||
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, "");
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, "");
|
||||
|
||||
// 写回空值
|
||||
MIS_BASE.WritePLC(95, OpName, planCount);
|
||||
MIS_BASE.WritePLC(96, OpName, haveUplaodCount);
|
||||
MIS_BASE.WritePLC(97, OpName, remainingQuantity);
|
||||
// 发送MES握手
|
||||
MIS_BASE.WritePLC(35, OpName, true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
|
||||
// 写入机型代码 (大机型) 机型 发动机号 订单号
|
||||
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(95, OpName, planCount);
|
||||
MIS_BASE.WritePLC(96, OpName, haveUplaodCount);
|
||||
MIS_BASE.WritePLC(97, OpName, remainingQuantity);
|
||||
|
||||
// 发送MES握手
|
||||
MIS_BASE.WritePLC(35, OpName, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(35, OpName, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 此类用于向WEB发送各种类型消息
|
||||
/// </summary>
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 批量发送WEB消息(Value为BOOL值)
|
||||
/// </summary>
|
||||
/// <param name="MessageNumm">消息编号组合</param>
|
||||
/// <param name="Value">消息值组合</param>
|
||||
/// <param name="OpName">工位号</param>
|
||||
void Sendmessage(string MessageNumm,string Value, string OpName)
|
||||
{
|
||||
for (int i=0;i<MessageNumm.Length;i++)
|
||||
{
|
||||
Sendmessage(MessageNumm[i], Value[i].ToString(), OpName);
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选择发送给WEB的消息
|
||||
/// </summary>
|
||||
/// <param name="Num">消息类型</param>
|
||||
/// <param name="OpName">消息工位</param>
|
||||
string Sendmessage(char Num,string Value, string OpName)
|
||||
{
|
||||
string SendMessage;
|
||||
string result = "";
|
||||
switch (Num)
|
||||
{
|
||||
case '1':
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage = "MES|ProcessList|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '2':
|
||||
//2显示物料
|
||||
SendMessage = "MES|MaterialList|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '3':
|
||||
//3显示操作指导图片
|
||||
SendMessage = "MES|PicShow|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '4':
|
||||
//4订单完工模块刷新完成数量
|
||||
SendMessage = "MES|OrderFormList|" + OpName + "|" + Value;
|
||||
AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '5':
|
||||
SendMessage = "MES|ShowMoby|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '6':
|
||||
SendMessage = "MES|MaterialCheckPosition|" + OpName + "|" +Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '7':
|
||||
SendMessage = "MES|WorkStart|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '8'://清除MES生成编号
|
||||
|
||||
break;
|
||||
case '9':
|
||||
SendMessage = "MES|ConfirmOkGo|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case 'a':
|
||||
SendMessage = "MES|FixAllow|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 向WEB发送信息(value为字符串)
|
||||
/// </summary>
|
||||
/// <param name="Command">消息种类</param>
|
||||
/// <param name="Value">消息内容</param>
|
||||
/// <param name="OpName">工位号</param>
|
||||
string SendInfomation(string Command, string Value, string OpName)
|
||||
{
|
||||
string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
|
||||
return AsyncSendMessage(SendMessage);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送在线产量、在线节拍
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void SendActuallyCount(string OpName, int tagValue)
|
||||
{
|
||||
//当工件离开时,更新在线产量、在线节拍
|
||||
if (tagValue == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
int opNameCount = 0;//在线产量
|
||||
int opNameCountTime = 0;//在线节拍
|
||||
//基本数据_工作日历_班次产量查询_New
|
||||
BaseDataSystemMES.OpNameCount_New(OpName, out opNameCount, out opNameCountTime);
|
||||
string SendMessage;
|
||||
SendMessage = "MES|ActuallyCount|" + OpName + "|" + opNameCount.ToString() + "&" + opNameCountTime.ToString();
|
||||
AsyncSendMessage(SendMessage);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:SendActuallyCount");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using DataLinkMesWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 发送信息到MES通讯服务器或者其他的
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private string AsyncSendMessage(string Message)
|
||||
{
|
||||
return MIS_BASE.asyncSendMessage(Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送提示消息
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private void AsyncSendMessage_Notice(string opname, string notice)
|
||||
{
|
||||
//通知Web界面
|
||||
BaseDataSystemMES.Web_Notice_Insert(opname, notice);
|
||||
string SendMessage = "MES|Notice|" + opname + "|" + "1";
|
||||
MIS_BASE.asyncSendMessage(SendMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送信息到打印机
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private void asyncSendMessageToMark(string Message)
|
||||
{
|
||||
string messageSend = (string)Message;
|
||||
//UDPClientSend.Send_ALL(ApplicationConfig.MES_MarkPortNum, messageSend);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送信息到LED
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private void asyncSendMessageLED(string OpName)
|
||||
{
|
||||
//发送到大屏幕显示 41104
|
||||
string strMessage = "MIS|" + OpName + "|" + "0" + "|" + "1";
|
||||
//UDPClientSend.Send_ALL(ApplicationConfig.Port_ShowLED_ProductCount, strMessage);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
///1.扫描配送单号,用于接收物料,扫描单号的时候,将接收的物料信息显示在“物料拉动”Tab区域
|
||||
///2.扫描料箱标签/看板卡,用于追溯物料批次信息
|
||||
///3.扫描零件条码,根据零件图号进行防错
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void Barcode(object e)
|
||||
{
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
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;
|
||||
}
|
||||
//物料验证
|
||||
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||||
if (!IsSuccess)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//此处逻辑有问题 需要考虑到批次扫描 提示PLC未传递机型的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
//更新订单完工数量及物料
|
||||
SendMessageFun.SendMessage("24", "11", OpName);
|
||||
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:Barcode");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using WebApiCall;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 叫料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void CallMaterials(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
// 信号名称、库位1变量号、库位2变量号
|
||||
// 请求叫料 1 206 2 211
|
||||
// 请求退料 1 207 2 212
|
||||
// 允许进入 1 208 2 213
|
||||
// 退料类型 1 209 2 214
|
||||
// 叫料类型 1 210 2 215
|
||||
// 到料类型 1 202 2 205
|
||||
// 请求进入 1 200 2 203
|
||||
// AGV已离开1 201 2 204
|
||||
|
||||
int tagType = Convert.ToInt32(msgEvent.TagType);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 根据变量类型代码 获取 位置号 与 叫料类型
|
||||
string positionName = "-1"; // 位置号
|
||||
string engineType = "-1"; // 型号 1 3 吨
|
||||
string type = "叫料"; // 操作类型 分 叫料 退料 退余料
|
||||
|
||||
// 206 库位1
|
||||
if(tagType == 206)
|
||||
{
|
||||
positionName = "H1";
|
||||
engineType = MIS_BASE.ReadPLC(210,OpName).ToString();
|
||||
}
|
||||
// 211 库位2
|
||||
else if (tagType == 211)
|
||||
{
|
||||
positionName = "H2";
|
||||
engineType = MIS_BASE.ReadPLC(215, OpName).ToString();
|
||||
}
|
||||
|
||||
// 1.调用WebApi通知叫料
|
||||
bool isOk = AGVWebApiCall.MES_To_AGV_CallGoods(positionName,engineType);
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
// 2.叫料成功后 记录叫料日志
|
||||
BaseDataSystemMES.Get_AGV_CallRecord(OpName, positionName, engineType, type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tagType == 206)
|
||||
{
|
||||
MIS_BASE.WritePLC(200,OpName,false); // AGV已离开
|
||||
MIS_BASE.WritePLC(201, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(202, OpName, false); // 叫料类型
|
||||
}
|
||||
// 211 库位2
|
||||
else if (tagType == 211)
|
||||
{
|
||||
MIS_BASE.WritePLC(203, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(204, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(205, OpName, false); // 叫料类型
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void ConfirmOkGo(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
//更新订单完工数量及物料
|
||||
Sendmessage("24", "11", OpName);
|
||||
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
// 收到传递机型就不给允许工作了
|
||||
//MIS_BASE.Write_FixAllow(OpName, false);
|
||||
|
||||
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);
|
||||
|
||||
if (EngineTypeID <= 0 || EngineID.Length == 0 || EngineType.Length == 0)
|
||||
{
|
||||
MIS_BASE.WritePLC(34, OpName, true);
|
||||
string msg = "【" + OpName + "】" + "PLC传递机型为空!";
|
||||
MyLog4Net.MyLogHelper.Error("EngineTypeGetOver", msg);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC传递机型为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, EngineID);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm, OrderForm);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.PartPallet_Code, PartPallet_Code.ToString());
|
||||
|
||||
//显示当前订单信息
|
||||
SendMessage.ShowMoby(OpName);
|
||||
//判断该订单数据是否已经工作过,有的话则在WEB跳出弹窗选择 并同时禁止工作
|
||||
//DataTable dt2 = BaseDataSystemMES.EngineIsTwoWork(OpName, OrderForm, EngineID);
|
||||
//if (dt2.Rows[0]["result"].ToString() == "1") //已完成
|
||||
//{
|
||||
// //不允许工作
|
||||
// MIS_BASE.Write_FixAllow(OpName, false);
|
||||
// //通知WEB校验重新工作还是跳过 点重新工作给允许工作,点跳过给工作完成
|
||||
// string message = "MES|Engine_Is_TwoWork|" + OpName + "|1";
|
||||
// SendMessage.AsyncSendMessage(message);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
//}
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
}
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 不合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FalseGO(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
//不合格放行信号
|
||||
//MIS_BASE.Write_FalseGO(OpName, true);
|
||||
//总合格标志2(不合格)
|
||||
|
||||
BaseDataSystemMES.Material_Insert_NG(OpName, 2);
|
||||
|
||||
Sendmessage("24", "11", OpName);
|
||||
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeat(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//返写在MES心跳中
|
||||
MIS_BASE.WritePLC(15, OpName, tagValue);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using MesWork;
|
||||
using System;
|
||||
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
|
||||
{
|
||||
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int qualityMask;
|
||||
// 保存质量数据
|
||||
qualityMask = MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
|
||||
|
||||
MIS_BASE.Read_EngineID(OpName, out string EngineID);
|
||||
MIS_BASE.Read_TagTypeID(39, OpName, out string OrderForm);
|
||||
// 分装线保存 扣数
|
||||
Db.SubLine_WorkFinish(EngineID, OpName, OrderForm, qualityMask);
|
||||
|
||||
|
||||
// 保存物料数据
|
||||
// BaseDataSystemMES.Material_Insert(OpName, qualityMask);
|
||||
|
||||
// 测量数据发动机在线状态 过站信息
|
||||
|
||||
BaseDataSystemMES.WorkStartInsert(OpName, qualityMask);
|
||||
|
||||
// 读取当前选择的计划中的机型,写入PLC
|
||||
// 获取订单的机型
|
||||
string Program_No = "";
|
||||
int planCount = 0; // 计划上料数量
|
||||
int haveUplaodCount = 0; // 已上料数量
|
||||
int remainingQuantity = 0; // 待上料数量
|
||||
Db.GetEngineType_Order(OpName, Program_No, out int EngineTypeID_Program,
|
||||
out string EngineType_Program, out string EngineID_Program, out string OrderForm_Program,
|
||||
out int isCheckOk_Program, out planCount, out haveUplaodCount, out remainingQuantity);
|
||||
if (isCheckOk_Program == 2)
|
||||
{
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, "");
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, "");
|
||||
|
||||
MIS_BASE.WritePLC(95, OpName, planCount);
|
||||
MIS_BASE.WritePLC(96, OpName, haveUplaodCount);
|
||||
MIS_BASE.WritePLC(97, OpName, remainingQuantity);
|
||||
|
||||
//MIS_BASE.WritePLC(34, OpName, true);
|
||||
string msg = "【" + OpName + "】" + "分装线无上线订单,请下达新订单!";
|
||||
MyLog4Net.MyLogHelper.Error("PartLoad", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
|
||||
Thread.Sleep(200);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 写入机型代码 (大机型) 机型 发动机号 订单号
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID_Program);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, EngineID_Program);
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm_Program);
|
||||
|
||||
MIS_BASE.WritePLC(95, OpName, planCount);
|
||||
MIS_BASE.WritePLC(96, OpName, haveUplaodCount);
|
||||
MIS_BASE.WritePLC(97, OpName, remainingQuantity);
|
||||
|
||||
// 通知web显示
|
||||
SendMessage.ShowMoby(OpName);
|
||||
Thread.Sleep(200);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
}
|
||||
|
||||
// 记录手动存储的物料数据
|
||||
int byte1 = Convert.ToInt32(MIS_BASE.ReadPLC(211, OpName));
|
||||
int byte2 = Convert.ToInt32(MIS_BASE.ReadPLC(202, OpName));
|
||||
int byte3 = Convert.ToInt32(MIS_BASE.ReadPLC(203, OpName));
|
||||
int byte4 = Convert.ToInt32(MIS_BASE.ReadPLC(204, OpName));
|
||||
int byte5 = Convert.ToInt32(MIS_BASE.ReadPLC(205, OpName));
|
||||
int byte6 = Convert.ToInt32(MIS_BASE.ReadPLC(206, OpName));
|
||||
int byte7 = Convert.ToInt32(MIS_BASE.ReadPLC(207, OpName));
|
||||
int byte8 = Convert.ToInt32(MIS_BASE.ReadPLC(208, OpName));
|
||||
int byte9 = Convert.ToInt32(MIS_BASE.ReadPLC(209, OpName));
|
||||
int byte10 = Convert.ToInt32(MIS_BASE.ReadPLC(210, OpName));
|
||||
BaseDataSystemMES.HeLi_HMIMaterialFactory_Add(OpName, EngineID, OrderForm, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10);
|
||||
|
||||
// 推送质量数据到MES的页面
|
||||
// SendMessageFun.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
// 对应手动工位的
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
|
||||
|
||||
// 通知设备,MES的质量数据(和物料数据)保存完成
|
||||
|
||||
//统计在线产量,在线节拍
|
||||
// SendMessage.SendActuallyCount(OpName, tagValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 分装上线工位没有托盘到位离开,通过申请上线和保存完成代替
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
|
||||
// 清传递机型时 去判断一下是否申请上线 还有 如果有就不清
|
||||
int isEngineGetOver = Convert.ToInt32(MIS_BASE.ReadPLC(19, OpName));
|
||||
if (isEngineGetOver == 0)
|
||||
{
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("MesRead", OpName + "清传递机型时存在申请上线!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1053", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesReadOver(object e)
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
// string OpName = Convert.ToString(msgEvent.OpName);
|
||||
// var tagValue = msgEvent.TagValue.ToString ();
|
||||
|
||||
// if (tagValue == "1" | tagValue.ToLower () == "true")
|
||||
// {
|
||||
// int qualityMask;
|
||||
// MIS_BASE.Read_QualityMask(OpName, out qualityMask);
|
||||
|
||||
// SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);//发给Web页面显示质量数据
|
||||
|
||||
// if (qualityMask == 1)//全部OK,给出合格放行
|
||||
// {
|
||||
// //如果存在线外扫描工位,根据扫描条码绑定线外数据 需要时解除禁用
|
||||
// //BaseDataSystemMES.TransLaunchDataByMainMaterial(OpName, EngineType, EngineID, EngineTypeID);
|
||||
|
||||
// //如果存在线外排队工位,根据排队编号绑定线外数据 需要时解除禁用
|
||||
// ////BaseDataSystemMES.MailLineAndSubLineData_InsertByEngineID_Subline(OpName,EngineID, EngineTypeID, EngineType);
|
||||
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
// //MIS_BASE.Write_FalseGO(OpName, false);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
// MIS_BASE.Write_FalseGO(OpName, true);
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
//catch (Exception err)
|
||||
//{
|
||||
// ////ApplicationLog.WriteLog(err, "Function02:MesReadOver");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES保存实时质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesSaveNowData(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
// 直接发送实时的 质量数据
|
||||
string message = MisDataSaveDateMesRead.Funtion.GetRealTimeQualityData(OpName);
|
||||
//推送质量数据到MES的页面
|
||||
SendMessage.AsyncSendMessage("MES|ShowTimelyQuality_Resources|" + OpName + "|" + message);
|
||||
//SendMessageFun.SendMessageMESToWEB("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线(针对上线工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
// 清除报警
|
||||
MIS_BASE.WritePLC(34, OpName, false);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int planCount = 0; // 计划上料数量
|
||||
int haveUplaodCount = 0; // 已上料数量
|
||||
int remainingQuantity = 0; // 待上料数量
|
||||
|
||||
// 分装上线工位没有托盘到位离开,通过申请上线和保存完成代替
|
||||
//MIS_BASE.Write_TagTypeID(115, OpName, 0);
|
||||
//MIS_BASE.Write_TagTypeID(95, OpName, 0);
|
||||
//MIS_BASE.Write_TagTypeID(96, OpName, 0);
|
||||
//MIS_BASE.Write_TagTypeID(97, OpName, 0);
|
||||
//MIS_BASE.Write_TagTypeID(98, OpName, "");
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStart, tagValue.ToString());
|
||||
|
||||
// 读取当前选择的计划中的机型,写入PLC
|
||||
// 获取订单的机型
|
||||
string Program_No = "";
|
||||
Db.GetEngineType_Order(OpName, Program_No, out int EngineTypeID,
|
||||
out string EngineType, out string EngineID, out string OrderForm,
|
||||
out int isCheckOk, out planCount, out haveUplaodCount, out remainingQuantity);
|
||||
if (isCheckOk == 2)
|
||||
{
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, "");
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, "");
|
||||
|
||||
MIS_BASE.WritePLC(95, OpName, planCount);
|
||||
MIS_BASE.WritePLC(96, OpName, haveUplaodCount);
|
||||
MIS_BASE.WritePLC(97, OpName, remainingQuantity);
|
||||
|
||||
MIS_BASE.WritePLC(34, OpName, true);
|
||||
string msg = "【" + OpName + "】" + "分装线无上线订单,请下达新订单!";
|
||||
MyLog4Net.MyLogHelper.Error("PartLoad", msg);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
|
||||
// 写入机型代码 (大机型) 机型 发动机号 订单号
|
||||
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(95, OpName, planCount);
|
||||
MIS_BASE.WritePLC(96, OpName, haveUplaodCount);
|
||||
MIS_BASE.WritePLC(97, OpName, remainingQuantity);
|
||||
|
||||
|
||||
// MES传递机型
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
// 通知web显示
|
||||
SendMessage.ShowMoby(OpName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
////上线工位清MES传递机型信号
|
||||
//MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//// 清除报警
|
||||
//MIS_BASE.WritePLC(34, 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using WebApiCall;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求退料
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void QuitMaterials(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int tagType = Convert.ToInt32(msgEvent.TagType);
|
||||
// 根据变量类型代码 获取 位置号 与 叫料类型
|
||||
string positionName; // 位置号
|
||||
string engineType = "-1";
|
||||
string quitType; // 1 退空托 2 退1T余料 3 退3T余料
|
||||
string type = ""; // 操作类型 分 叫料 退料 退余料
|
||||
|
||||
// 206 库位1
|
||||
if (tagType == 207)
|
||||
{
|
||||
positionName = "H1";
|
||||
quitType = MIS_BASE.ReadPLC(209, OpName).ToString();
|
||||
}
|
||||
// 211 库位2 212
|
||||
else
|
||||
{
|
||||
positionName = "H2";
|
||||
quitType = MIS_BASE.ReadPLC(214, OpName).ToString();
|
||||
}
|
||||
|
||||
if (quitType == "1")
|
||||
{
|
||||
type = "退空托";
|
||||
}
|
||||
if (quitType == "2")
|
||||
{
|
||||
type = "退余料";
|
||||
engineType = "1";
|
||||
}
|
||||
if (quitType == "3")
|
||||
{
|
||||
type = "退余料";
|
||||
engineType = "3";
|
||||
}
|
||||
|
||||
|
||||
// 1.调用WebApi通知退料
|
||||
int returnType = 0; // 默认空托退料
|
||||
if (quitType == "2" || quitType == "3") returnType = 1; // 余料退料
|
||||
bool isOk = AGVWebApiCall.MES_To_AGV_ReturnGoods(positionName, engineType, returnType);
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
// 2.叫料成功后 记录叫料日志
|
||||
BaseDataSystemMES.Get_AGV_CallRecord(OpName, positionName, engineType, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName=Convert.ToString(msgEvent.OpName);
|
||||
string Content = Convert.ToString(msgEvent.TagValue);
|
||||
|
||||
string[] dataArray = Content.Split('|');
|
||||
if (dataArray.Length != 2)
|
||||
return;
|
||||
//消息类型
|
||||
string m_Command = dataArray[0].ToString();
|
||||
//消息参数
|
||||
string m_Value = dataArray[1].ToString();
|
||||
//消息参数数量
|
||||
string[] m_Value_array = m_Value.Split('&');
|
||||
//消息参数长度
|
||||
int m_Value_length = m_Value_array.Length;
|
||||
|
||||
//工件信息
|
||||
string engineID = "";
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
|
||||
{
|
||||
engineID = MIS_BASE.hashtable_EngineGetOver_EngineID[OpName].ToString();
|
||||
}
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs _e = new DoWhatPlc.CustomeEvetnArgs();
|
||||
_e.OpName = OpName;
|
||||
_e.TagValue = m_Value;
|
||||
|
||||
//根据请求的命令处理逻辑
|
||||
switch (m_Command)
|
||||
{
|
||||
case "Barcode":
|
||||
if (m_Value_length > 1) return;
|
||||
fun_Barcode(_e);
|
||||
break;
|
||||
case "ConfirmOkGo"://合格放行
|
||||
//删除不合格放行记录
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 1, false);
|
||||
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
break;
|
||||
case "FalseGO"://返修放行
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 3, false);
|
||||
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
break;
|
||||
case "NgGO"://不合格放行
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 2, false);
|
||||
//保存不合格信息(必须保存不合格放行信息,由于B5A的Moby没有不合格标志位)
|
||||
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Insert(OpName, engineID, "", "");
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
break;
|
||||
case "OnLineState"://在线0、离线1、屏蔽2
|
||||
try
|
||||
{
|
||||
if (m_Value_length > 1) return;
|
||||
int a = Convert.ToInt32(m_Value);
|
||||
if (a <= 2)
|
||||
{
|
||||
BaseDataSystemMES.IsOnLine_Update(OpName, m_Value.ToString());
|
||||
MIS_BASE.Write_OnLineState(OpName, Convert.ToInt32(m_Value));
|
||||
if (a == 2) SendMessage.AsyncSendMessage_Notice(OpName, "屏蔽MES!");
|
||||
if (a == 0) SendMessage.AsyncSendMessage_Notice(OpName, "启用MES!");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case "Reset"://复位,将MES所有的信息都复位了
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
break;
|
||||
case "FixAllow"://重新拧紧
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
break;
|
||||
case "IsAutoGetEngineID"://自动手动申请编号(线首)
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.Write_IsAutoGetEngineID(OpName, Convert.ToInt32(m_Value));
|
||||
break;
|
||||
case "PartPalletGoOver"://空托盘放行
|
||||
int Is_PartPalletGoOver;
|
||||
MIS_BASE.Read_PartPalletGoOver(OpName, out Is_PartPalletGoOver);
|
||||
if (Is_PartPalletGoOver == 1)
|
||||
{
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName,0);
|
||||
}
|
||||
break;
|
||||
case "SetMoby"://清空托盘(线首)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
|
||||
break;
|
||||
case "RepairUplineMES"://返修上线
|
||||
MIS_BASE.Write_RepairUpline_MES(OpName, true);
|
||||
break;
|
||||
case "CancelRepair"://将返修件置为正常件
|
||||
|
||||
break;
|
||||
case "PartPalletCode"://申请写入托盘号
|
||||
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
|
||||
break;
|
||||
case "WritePartPalletCode"://写入托盘号
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.Write_PalletCode(OpName, Convert.ToInt32(m_Value));
|
||||
break;
|
||||
case "Normal"://启用正常拧紧工位
|
||||
MIS_BASE.Write_Normal(OpName, 1);
|
||||
MIS_BASE.Write_UnNormal(OpName, 0);
|
||||
break;
|
||||
case "UnNormal"://启用备用拧紧工位
|
||||
MIS_BASE.Write_Normal(OpName, 0);
|
||||
MIS_BASE.Write_UnNormal(OpName, 1);
|
||||
break;
|
||||
case "ResetDevice"://复位设备
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
break;
|
||||
case "IsNeedRepaire"://返修上线(返修上线点)
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
//修改托盘状态
|
||||
MIS_BASE.Write_PalletInfo(OpName, 3);
|
||||
//通知修改成功
|
||||
MIS_BASE.Write_UpdatePalletOK(OpName, true);
|
||||
IsNeedRepaire_OK(OpName);
|
||||
|
||||
}
|
||||
else if (Convert.ToInt32(m_Value) == 0)
|
||||
{
|
||||
//通知修改成功
|
||||
MIS_BASE.Write_UpdatePalletOK(OpName, true);
|
||||
//直接给出工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
else
|
||||
{ }
|
||||
|
||||
break;
|
||||
case "ContinueMatch":
|
||||
BaseDataSystemMES.QualityVerifyStatus_Hash_Write(OpName, true);
|
||||
break;
|
||||
//初始化网页信号
|
||||
case "IniSingalToWeb":
|
||||
InitializeSingalToWeb(OpName);
|
||||
break;
|
||||
case "Reset_Engine"://返修上线(返修上线点)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
//fun_EngineTypeGetOverPLC(OpName, 0);
|
||||
//fun_EngineTypeGetOverPLC(OpName, 1);
|
||||
break;
|
||||
|
||||
case "twoWorkSkip"://重新工作工件跳过工作(重新工作工件)
|
||||
//工作完成
|
||||
EngineTypeGetOver_PLC_Work_Skip(OpName);
|
||||
break;
|
||||
case "twoWork"://重新工作工件重新工作(重新工作工件)
|
||||
//允许工作
|
||||
EngineTypeGetOver_PLC_Work_two(OpName);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WebSubmit");
|
||||
}
|
||||
}
|
||||
private void SetMoby(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//清空Moby时,需要将MES信号清空
|
||||
MIS_BASE.Write_ClearMesMoby(OpName);
|
||||
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||||
|
||||
Sendmessage("5123", "1111", OpName);
|
||||
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/// 网页重现登录,恢复关闭前的页面状态
|
||||
/// </summary>
|
||||
/// <param name="Opname">工位号</param>
|
||||
private void InitializeSingalToWeb(string Opname)
|
||||
{
|
||||
|
||||
//工件到位 DBX0.1
|
||||
bool S_WorkStart;
|
||||
bool S_FixAllow;
|
||||
bool S_EngineGetOver;
|
||||
bool S_MaterialVerifyOver;
|
||||
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||||
|
||||
Sendmessage("13", "1111", Opname);
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
if (S_plcStatus.ToLower() == "false")
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||||
}
|
||||
if (S_FixAllow == true)
|
||||
{
|
||||
SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||||
}
|
||||
if (S_MaterialVerifyOver == true)
|
||||
{
|
||||
SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||||
}
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
Sendmessage("2", "1111", Opname);
|
||||
SendMessage.ShowMoby(Opname);
|
||||
// 直接发送实时的 质量数据
|
||||
string message = MisDataSaveDateMesRead.Funtion.GetRealTimeQualityData(Opname);
|
||||
//推送质量数据到MES的页面
|
||||
SendMessage.AsyncSendMessage("MES|ShowTimelyQuality_Resources|" + Opname + "|" + message);
|
||||
}
|
||||
InitAlarm(Opname);
|
||||
}
|
||||
|
||||
private void InitAlarm(string Opname)
|
||||
{
|
||||
FuntionMesRead.Alarm_InitAlarm_Send(Opname, out Hashtable ht);
|
||||
foreach (DictionaryEntry kv in ht)
|
||||
{
|
||||
var TagID = kv.Key.ToString();
|
||||
var TagValue = kv.Value.ToString();
|
||||
FuntionMesRead.Send_AlarmMsg(TagID, TagValue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工位合格标志
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void IsOk(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int qualityMask;
|
||||
MIS_BASE.Read_QualityMask(OpName, out qualityMask);
|
||||
//判断是否合格
|
||||
if (qualityMask == 1)
|
||||
{
|
||||
qualityMask = 1;
|
||||
} else {
|
||||
qualityMask = 0;
|
||||
}
|
||||
//通知WEB修改状态
|
||||
string message = "MES|QualityMask|" + OpName + "|" + qualityMask.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Threading;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void WorkStart(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue > 0)
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStart, tagValue.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, "");
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, "");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WorkStart");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Function02")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("苏州宏软信息技术有限公司")]
|
||||
[assembly: AssemblyProduct("Function02")]
|
||||
[assembly: AssemblyCopyright("Copyright © 苏州宏软信息技术有限公司 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("47710f2c-e141-4252-8d13-701bf4c1c027")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 内部版本号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Binary file not shown.
19
MisDataFunction/MesServer.Function/Function1053/app.config
Normal file
19
MisDataFunction/MesServer.Function/Function1053/app.config
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MQTTnet" publicKeyToken="b69712f52770c0a7" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.13.0" newVersion="3.0.13.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,5 @@
|
||||
SCC = This is a Source Code Control file
|
||||
|
||||
[Function02.csproj]
|
||||
SCC_Aux_Path = "\\192.168.0.100\vss\MES4.0"
|
||||
SCC_Project_Name = "$/MisData/MisData/MisData/MesServer.Function/Function02", ILHAAAAA
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
|
||||
<package id="MQTTnet" version="3.0.13" targetFramework="net461" />
|
||||
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.13" targetFramework="net461" />
|
||||
<package id="NETStandard.Library" version="2.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
|
||||
<package id="System.Net.Security" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" requireReinstallation="true" />
|
||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
|
||||
</packages>
|
||||
BIN
MisDataFunction/MesServer.Function/Function1053/vssver2.scc
Normal file
BIN
MisDataFunction/MesServer.Function/Function1053/vssver2.scc
Normal file
Binary file not shown.
Reference in New Issue
Block a user