同步现场最新程序
This commit is contained in:
97
MisDataFunction/Function1062/OpcServer/EngineGetOver.cs
Normal file
97
MisDataFunction/Function1062/OpcServer/EngineGetOver.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockBarcodeEngineTypeGetOver = new object();
|
||||
|
||||
/// <summary>
|
||||
/// OP431 PLC 回传机型后,校验 PAD 确认信息并调用工厂 MES 进站。
|
||||
/// </summary>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
lock (lockBarcodeEngineTypeGetOver)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string opName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue != 1)
|
||||
{
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC传递机型取消!");
|
||||
MIS_BASE.Write_FixAllow(opName, false);
|
||||
return;
|
||||
}
|
||||
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC传递机型!");
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
||||
|
||||
MIS_BASE.GetEngineTypeFromPLC(opName, out int engineTypeID, out string engineType, out string engineID, out int palletCode, out string orderForm);
|
||||
MIS_BASE.GetEngineTypeFromPLC_MES(opName, out int engineTypeIDMes, out string engineTypeMes, out string engineIDMes, out string orderFormMes);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(engineID) || engineTypeID <= 0)
|
||||
{
|
||||
WriteManualStaticEngineError(opName, "PLC产品码或机型为空,产品码:" + engineID + ",机型代码:" + engineTypeID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(engineIDMes) || engineTypeIDMes <= 0)
|
||||
{
|
||||
WriteManualStaticEngineError(opName, "未查询到PAD确认上线信息,请先在PAD确认上线");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.Equals(engineID.Trim(), engineIDMes.Trim(), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
WriteManualStaticEngineError(opName, "PLC产品码与PAD确认产品码不一致,PLC:" + engineID + ",PAD:" + engineIDMes);
|
||||
return;
|
||||
}
|
||||
|
||||
if (engineTypeID != engineTypeIDMes)
|
||||
{
|
||||
WriteManualStaticEngineError(opName, "PLC机型与PAD确认机型不一致,PLC:" + engineTypeID + ",PAD:" + engineTypeIDMes);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryGetManualStaticOutProduct(engineID, out ManualStaticOutProduct product, out string productMessage))
|
||||
{
|
||||
WriteManualStaticEngineError(opName, productMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
CallWebService.Call_miFindCustomAndSfcData(opName, engineID, out string code, out string message);
|
||||
if (code != "0")
|
||||
{
|
||||
WriteManualStaticEngineError(opName, "进站失败:" + engineID + ",code:" + code + ",message:" + message);
|
||||
return;
|
||||
}
|
||||
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MOM", "进站成功:" + engineID);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(opName, product.EngineTypeID, product.EngineType, product.EngineID, palletCode, product.OrderForm, 0, 0, "");
|
||||
|
||||
MIS_BASE.Write_FixAllow(opName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】进站成功,允许PLC工作:" + engineID);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("Function1062.EngineTypeGetOver", err.Message);
|
||||
MisDataFun.LogRecording_OP(ManualStaticOutOpName, "ERROR", "EngineTypeGetOver", err.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteManualStaticEngineError(string opName, string message)
|
||||
{
|
||||
MIS_BASE.Write_FixAllow(opName, false);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】" + message);
|
||||
MisDataFun.LogRecording_OP(opName, "ERROR", "EngineTypeGetOver", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
56
MisDataFunction/Function1062/OpcServer/HeartBeat.cs
Normal file
56
MisDataFunction/Function1062/OpcServer/HeartBeat.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using MesServerWork;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeatMES(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//返写在MES心跳中
|
||||
MIS_BASE.Write_TagValueByTagTypeID(15, OpName, tagValue);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("Function1062.HeartBeatMES", err.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeatPLC(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int HeartBeatPLC;
|
||||
//读取PLC心跳数据
|
||||
HeartBeatPLC = Convert.ToInt32(MIS_BASE.Read_TagValueByTagTypeID(14, OpName));
|
||||
//通知WEB修改状态
|
||||
string message = "MES|HeartBeatPLC|" + OpName + "|" + HeartBeatPLC.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("Function1062.HeartBeatPLC", err.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
109
MisDataFunction/Function1062/OpcServer/MesRead.cs
Normal file
109
MisDataFunction/Function1062/OpcServer/MesRead.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// OP431 保存:按 PLC 允许保存时间生成静置质量数据,正常过站后带质量数据出站。
|
||||
/// </summary>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string opName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue != 1)
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(opName, false);
|
||||
MIS_BASE.Write_MesWorkFinish(opName, false);
|
||||
MIS_BASE.Write_OpNameIsOk(opName, -99);
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC允许保存数据取消!");
|
||||
return;
|
||||
}
|
||||
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC允许保存OP431静置数据!");
|
||||
|
||||
MIS_BASE.GetEngineTypeFromPLC(opName, out int engineTypeID, out string engineType, out string engineID, out int palletCode, out string orderForm);
|
||||
if (string.IsNullOrWhiteSpace(engineID))
|
||||
{
|
||||
WriteManualStaticMesReadError(opName, "PLC产品码为空,无法保存静置数据");
|
||||
return;
|
||||
}
|
||||
|
||||
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out engineType, out engineTypeID);
|
||||
if (engineTypeID <= 0)
|
||||
{
|
||||
WriteManualStaticMesReadError(opName, "未查询到产品执行信息:" + engineID);
|
||||
return;
|
||||
}
|
||||
|
||||
MIS_BASE.Read_QualityMask(opName, out int qualityMask);
|
||||
qualityMask = NormalizeManualStaticQualityMask(qualityMask);
|
||||
|
||||
if (!TryBuildManualStaticOutData(engineID, qualityMask, out ManualStaticOutData staticOutData, out string message))
|
||||
{
|
||||
WriteManualStaticMesReadError(opName, message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WriteManualStaticOutQualityData(opName, engineID, staticOutData, out message))
|
||||
{
|
||||
WriteManualStaticMesReadError(opName, message);
|
||||
return;
|
||||
}
|
||||
|
||||
MisDataFun.WorkStartInsert(opName, qualityMask);
|
||||
MisDataFun.GetPartQualityGroupParams(opName, engineID, out DataTable dtQuality);
|
||||
if (dtQuality == null || dtQuality.Rows.Count == 0)
|
||||
{
|
||||
WriteManualStaticMesReadError(opName, "未查询到OP431静置质量数据组,禁止静默出站:" + engineID);
|
||||
return;
|
||||
}
|
||||
|
||||
CallWebService.Call_dataCollectForSfcEx(opName, engineID, dtQuality, qualityMask, out string code, out string momMessage);
|
||||
if (code == "0")
|
||||
{
|
||||
MIS_BASE.Write_OpNameIsOk(opName, qualityMask);
|
||||
}
|
||||
else if (code == "13921")
|
||||
{
|
||||
qualityMask = 2;
|
||||
MIS_BASE.Write_OpNameIsOk(opName, qualityMask);
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MOM", engineID + " 工厂MES质量判定不合格,按不合格完成OP431过站");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteManualStaticMesReadError(opName, "出站失败:" + engineID + ",错误代码:" + code + ",消息:" + momMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
MIS_BASE.Write_MesWorkFinish(opName, true);
|
||||
MIS_BASE.Write_MesReadOver(opName, true);
|
||||
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "MES保存OP431静置数据完成!");
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "MES工作完成!");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("Function1062.MesRead", err.Message);
|
||||
MisDataFun.LogRecording_OP(ManualStaticOutOpName, "ERROR", "MesRead", err.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteManualStaticMesReadError(string opName, string message)
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(opName, false);
|
||||
MIS_BASE.Write_MesWorkFinish(opName, false);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】" + message);
|
||||
MisDataFun.LogRecording_OP(opName, "ERROR", "MesRead", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
44
MisDataFunction/Function1062/OpcServer/PartLoad.cs
Normal file
44
MisDataFunction/Function1062/OpcServer/PartLoad.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// OP431 申请上线:只记录 PLC 申请状态,等待 PAD 扫描已有产品。
|
||||
/// </summary>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string opName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC申请上线,等待PAD扫描已有产品!");
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
||||
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】PLC已申请上线,请PAD扫描产品码");
|
||||
// PAD 页面可能未打开,申请上线状态由 PadScanQuery 当前读取后返回。
|
||||
SendMessageFun.SendInfomation("PartLoad", "1", opName);
|
||||
return;
|
||||
}
|
||||
|
||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC申请上线取消!");
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(opName, false);
|
||||
MIS_BASE.Write_FixAllow(opName, false);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
||||
// 不向 OP431PAD 发送实时取消消息,避免 PAD 依赖可能丢失的 MQTT 状态。
|
||||
SendMessageFun.SendInfomation("PartLoad", "0", opName);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("Function1062.PartLoad", err.Message);
|
||||
MisDataFun.LogRecording_OP(ManualStaticOutOpName, "ERROR", "PartLoad", err.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
183
MisDataFunction/Function1062/OpcServer/WebSubmit.cs
Normal file
183
MisDataFunction/Function1062/OpcServer/WebSubmit.cs
Normal file
@@ -0,0 +1,183 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理 PAD/MQTT 发送到 Function1062 的 WEB 命令。
|
||||
/// 消息外层格式由通讯层统一为:WEB|命令|工位号|参数。
|
||||
/// 命令名不增加 OP431 前缀,工位归属统一通过 opName 判断,避免同一业务出现多套命令名。
|
||||
/// </summary>
|
||||
private void WebSubmit(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string opName = Convert.ToString(msgEvent.OpName);
|
||||
string content = Convert.ToString(msgEvent.TagValue);
|
||||
|
||||
// Function 入口已将 MQTT 的 Command 和 Value 合并为“命令|参数”。
|
||||
// 参数支持“产品码”或“产品码^最小静置分钟数”,订单、机型等业务信息必须由后端重新查询。
|
||||
string[] dataArray = content.Split('|');
|
||||
if (dataArray.Length != 2)
|
||||
{
|
||||
MisDataFun.LogRecording_OP(opName, "ERROR", "WEB", "PAD命令格式错误,内容:" + content);
|
||||
return;
|
||||
}
|
||||
|
||||
string command = dataArray[0].Trim();
|
||||
string value = dataArray[1].Trim();
|
||||
|
||||
switch (command)
|
||||
{
|
||||
// PAD 扫码查询:只查询产品、前序离开时间和静置分钟数,不写 PLC,也不调用工厂 MES 进站。
|
||||
case "PadScanQuery":
|
||||
{
|
||||
if (!TryGetManualStaticPadRequest(opName, "PadScanQuery", value, out string engineID, out decimal minStaticMinutes))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool success = QueryManualStaticOutProduct(opName, engineID, minStaticMinutes, out string message);
|
||||
SendManualStaticOutResult(opName, "PadScanQuery", success, message);
|
||||
MisDataFun.LogRecording_OP(opName, success ? "INFO" : "WARNING", "PadScanQuery", message);
|
||||
break;
|
||||
}
|
||||
// PAD 确认上线:重新校验托盘到位、PLC申请上线和前端配置的最小静置时间,通过后写 PLC 产品区。
|
||||
case "PadConfirmOnline":
|
||||
{
|
||||
if (!TryGetManualStaticPadRequest(opName, "PadConfirmOnline", value, out string engineID, out decimal minStaticMinutes))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool success = ConfirmManualStaticOutProduct(opName, engineID, minStaticMinutes, out string message);
|
||||
SendManualStaticOutResult(opName, "PadConfirmOnline", success, message);
|
||||
MisDataFun.LogRecording_OP(opName, success ? "INFO" : "ERROR", "PadConfirmOnline", message);
|
||||
break;
|
||||
}
|
||||
// 页面刷新或 PAD 重新订阅 MQTT 后,用当前 PLC/MES 状态恢复界面显示。
|
||||
case "IniSingalToWeb":
|
||||
InitializeSingalToWeb(opName);
|
||||
break;
|
||||
default:
|
||||
MisDataFun.LogRecording_OP(opName, "WARNING", "WebSubmit", "不支持的PAD命令:" + command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("Function1062.WebSubmit", err.Message);
|
||||
MisDataFun.LogRecording_OP(ManualStaticOutOpName, "ERROR", "WebSubmit", err.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetManualStaticPadRequest(string opName, string command, string value, out string engineID, out decimal minStaticMinutes)
|
||||
{
|
||||
engineID = "";
|
||||
minStaticMinutes = DefaultManualStaticMinutes;
|
||||
string requestValue = Convert.ToString(value).Trim();
|
||||
|
||||
// PAD 上传产品码和可选最小静置分钟数。订单、机型、静置开始时间等信息全部从 MES 数据库重新取。
|
||||
if (string.IsNullOrWhiteSpace(requestValue))
|
||||
{
|
||||
string message = "PAD命令参数为空,格式:" + command + "|产品码 或 " + command + "|产品码^最小静置分钟数";
|
||||
SendManualStaticOutResult(opName, command, false, message);
|
||||
MisDataFun.LogRecording_OP(opName, "ERROR", "WEB", message);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (requestValue.Contains("&"))
|
||||
{
|
||||
string message = "PAD命令参数格式错误,格式:" + command + "|产品码 或 " + command + "|产品码^最小静置分钟数,收到:" + value;
|
||||
SendManualStaticOutResult(opName, command, false, message);
|
||||
MisDataFun.LogRecording_OP(opName, "ERROR", "WEB", message);
|
||||
return false;
|
||||
}
|
||||
|
||||
string[] requestItems = requestValue.Split('^');
|
||||
if (requestItems.Length > 2)
|
||||
{
|
||||
string message = "PAD命令参数格式错误,格式:" + command + "|产品码 或 " + command + "|产品码^最小静置分钟数,收到:" + value;
|
||||
SendManualStaticOutResult(opName, command, false, message);
|
||||
MisDataFun.LogRecording_OP(opName, "ERROR", "WEB", message);
|
||||
return false;
|
||||
}
|
||||
|
||||
engineID = requestItems[0].Trim();
|
||||
if (string.IsNullOrWhiteSpace(engineID))
|
||||
{
|
||||
string message = "PAD命令产品码为空,格式:" + command + "|产品码 或 " + command + "|产品码^最小静置分钟数";
|
||||
SendManualStaticOutResult(opName, command, false, message);
|
||||
MisDataFun.LogRecording_OP(opName, "ERROR", "WEB", message);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (requestItems.Length == 2)
|
||||
{
|
||||
string minStaticMinutesText = requestItems[1].Trim();
|
||||
if (!decimal.TryParse(minStaticMinutesText, out minStaticMinutes) || minStaticMinutes < 0)
|
||||
{
|
||||
string message = "PAD命令最小静置分钟数无效,收到:" + minStaticMinutesText;
|
||||
SendManualStaticOutResult(opName, command, false, message);
|
||||
MisDataFun.LogRecording_OP(opName, "ERROR", "WEB", message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页面重新登录或 PAD 重新订阅时恢复关键状态。
|
||||
/// 这里发送的是通用命令名,工位由 opName 区分。
|
||||
/// </summary>
|
||||
private void InitializeSingalToWeb(string opName)
|
||||
{
|
||||
MIS_BASE.GetEngineTypeFromDB(opName, out int engineTypeID, out string engineType, out string engineID, out int partPalletCode);
|
||||
|
||||
MIS_BASE.Read_WorkStart(opName, out bool workStart);
|
||||
MIS_BASE.Read_PartLoad(opName, out bool partLoad);
|
||||
MIS_BASE.Read_EngineGetOver_PLC(opName, out bool engineGetOver);
|
||||
MIS_BASE.Read_FixAllow(opName, out bool fixAllow);
|
||||
MIS_BASE.Read_QualityData_Read_CF(opName, out bool mesRead);
|
||||
MIS_BASE.Read_MesReadOver(opName, out bool readOver);
|
||||
MIS_BASE.Read_MaterialVerifyOver(opName, out bool workFinish);
|
||||
MIS_BASE.Read_QualityMask(opName, out int qualityMask);
|
||||
MIS_BASE.Read_FalseGo(opName, out bool falseGo);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(engineID))
|
||||
{
|
||||
SendMessageFun.SendMessage("5123", "1111", opName);
|
||||
}
|
||||
|
||||
// 以下状态沿用通用 MES 页面命令,PAD 或页面通过 opName 判断属于哪个工位。
|
||||
SendMessageFun.SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(workStart)), opName);
|
||||
SendMessageFun.SendInfomation("PartLoad", Convert.ToString(Convert.ToInt32(partLoad)), opName);
|
||||
SendMessageFun.SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(engineGetOver)), opName);
|
||||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(fixAllow)), opName);
|
||||
SendMessageFun.SendInfomation("MesRead", Convert.ToString(Convert.ToInt32(mesRead)), opName);
|
||||
SendMessageFun.SendInfomation("MesReadOver", Convert.ToString(Convert.ToInt32(readOver)), opName);
|
||||
SendMessageFun.SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(workFinish)), opName);
|
||||
SendMessageFun.SendInfomation("QualityMask", Convert.ToString(qualityMask), opName);
|
||||
SendMessageFun.SendInfomation("FalseGO", Convert.ToString(Convert.ToInt32(falseGo)), opName);
|
||||
SendMessageFun.SendInfomation("CurrentProduct", engineID + "^" + engineTypeID + "^" + engineType + "^" + partPalletCode, opName);
|
||||
|
||||
InitAlarm(opName);
|
||||
}
|
||||
|
||||
private void InitAlarm(string opName)
|
||||
{
|
||||
FuntionMesRead.Alarm_InitAlarm_Send(opName, out Hashtable ht);
|
||||
foreach (DictionaryEntry kv in ht)
|
||||
{
|
||||
FuntionMesRead.Send_AlarmMsg(kv.Key.ToString(), kv.Value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
56
MisDataFunction/Function1062/OpcServer/WorkStart.cs
Normal file
56
MisDataFunction/Function1062/OpcServer/WorkStart.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
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
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string tagValue = msgEvent.TagValue.ToString();
|
||||
|
||||
if (tagValue == "1")
|
||||
{
|
||||
string msg = "工件到位!";
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", msg);
|
||||
MisDataFun.MOBY_TrayStart_Update(OpName); // 记录托盘到达时间
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, OpName, false); // MES报警点
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "工件离开!";
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", msg);
|
||||
// 清除工位数据
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false); // 传递机型(MES)
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, false); // 工作完成(MES)
|
||||
MIS_BASE.Write_FalseGO(OpName, false); // 不合格放行(MES)
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false); // 合格放行(MES)
|
||||
MIS_BASE.Write_FixAllow(OpName, false); // 允许PLC工作(MES)
|
||||
MIS_BASE.Write_MesReadOver(OpName, false); // MES保存完数据(MES)
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0); // 机型标志(MES)
|
||||
MIS_BASE.Write_EngineID_MES(OpName, ""); // 工件编号(MES)
|
||||
MIS_BASE.Write_EngineType_MES(OpName, ""); // 产品型号(MES)
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, ""); // 订单号(MES)
|
||||
MIS_BASE.Write_MesErrorType(OpName, 0); // MES报警点
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataFun.LogRecording_OP("Function1062", "ERROR", "WorkStart", err.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1062/OpcServer/vssver2.scc
Normal file
BIN
MisDataFunction/Function1062/OpcServer/vssver2.scc
Normal file
Binary file not shown.
Reference in New Issue
Block a user