86 lines
3.5 KiB
C#
86 lines
3.5 KiB
C#
using System;
|
||
using MesServerWork;
|
||
using MisDataFunDll;
|
||
//using SystemFramework;
|
||
|
||
namespace MesServerFunctions
|
||
{
|
||
partial class FunctionMES
|
||
{
|
||
/// <summary>
|
||
/// 拧紧完成(PLC)
|
||
/// </summary>
|
||
/// <param name="OpName"></param>
|
||
/// <param name="tagValue"></param>
|
||
private void FixOK(object e)
|
||
{
|
||
try
|
||
{
|
||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||
string OpName = Convert.ToString(msgEvent.OpName);
|
||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||
|
||
#region
|
||
int EngineTypeID;//机型代码
|
||
string EngineType;//机型
|
||
string EngineID;//工件编号
|
||
int PartPallet_Code;//托盘编号
|
||
MIS_BASE.GetEngineTypeFromDB(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code);///从PLC中获取MOBY信息
|
||
#endregion
|
||
|
||
if (tagValue == 0)
|
||
{
|
||
MIS_BASE.Write_FixOver(OpName, false);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC本次拧紧完成!");
|
||
//1:允许拧紧清零
|
||
MIS_BASE.Write_FixAllow(OpName, false);
|
||
if (MIS_BASE.hashtable_WorkGroupIndex == null)
|
||
{
|
||
MIS_BASE.InitHashtable_MesServerCode();
|
||
}
|
||
//获取当前拧紧序号
|
||
int ProcessCode = 1;
|
||
if (MIS_BASE.hashtable_WorkGroupIndex.ContainsKey(OpName))
|
||
{
|
||
ProcessCode = Convert.ToInt32(MIS_BASE.hashtable_WorkGroupIndex[OpName]);
|
||
}
|
||
//获取当前组号拧紧的合格标志及保存质量数据
|
||
int isOK = GetTagValue(OpName, EngineTypeID, EngineType, EngineID, ProcessCode, PartPallet_Code);
|
||
|
||
//发动UDP,通知读取质量数据,实时显示质量数据,最后一段为合格标志(根据合格标志显示哭脸笑脸,2对应哭脸,1对应笑脸)
|
||
SendInfomation("ShowTimelyQuality_Tight", ProcessCode.ToString() + "&" + isOK.ToString(), OpName);
|
||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC本次拧紧结果!" + isOK.ToString());
|
||
//更新拧紧位置临时表
|
||
bool IsFinish = true;
|
||
MisDataFun.MesServer_ShaftPosition_Update(OpName, ProcessCode, isOK, out IsFinish);
|
||
|
||
//通知PLC接到拧紧数据
|
||
MIS_BASE.Write_FixOver(OpName, true);
|
||
if (MIS_BASE.hashtable_QualityMesRead == null)
|
||
{
|
||
MIS_BASE.InitHashtable_MesServerCode();
|
||
}
|
||
//记录拧紧/压装过程中的合格标志
|
||
if (MIS_BASE.hashtable_QualityMesRead.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_QualityMesRead[OpName] = isOK;
|
||
}
|
||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存本次拧紧数据完成!");
|
||
}
|
||
|
||
}
|
||
catch (Exception err)
|
||
{
|
||
////ApplicationLog.WriteLog(err, "Function04:FixOK");
|
||
}
|
||
}
|
||
|
||
|
||
|
||
}
|
||
}
|