Files
52-NingdePDC-MesProject/MisDataFunction/Function1062/OpcServer/PartLoad.cs
2026-05-31 10:22:04 +08:00

45 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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);
}
}
}
}