91 lines
3.7 KiB
C#
91 lines
3.7 KiB
C#
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);
|
||
|
||
if (tagValue == 1)
|
||
{
|
||
int EngineTypeID;//机型代码
|
||
int PartPallet_Code;//托盘编号
|
||
|
||
string EngineType;//机型
|
||
string EngineID;//工件编号
|
||
string OrderForm;
|
||
string OrderForm_MES;
|
||
|
||
int EngineTypeID_MES;//机型代码
|
||
string EngineType_MES;//机型
|
||
string EngineID_MES;//工件编号
|
||
|
||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||
MIS_BASE.GetEngineTypeFromPLC_MES(OpName, out EngineTypeID_MES, out EngineType_MES, out EngineID_MES, out OrderForm_MES);
|
||
|
||
// 测试的时候用的 plc读取订单号有问题
|
||
// OrderForm = BaseDataSystemMES.GetOrderDataBySn(EngineID);
|
||
|
||
if (EngineTypeID_MES == EngineTypeID & EngineID_MES == EngineID & EngineType_MES == EngineType)
|
||
{
|
||
DataTable dt;
|
||
dt = BaseDataSystemMES.EngineTypeChange(OpName, EngineType);
|
||
//提示机型发生变化
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||
SendMessage.AsyncSendMessage(message);
|
||
}
|
||
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);
|
||
|
||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||
}
|
||
else
|
||
{
|
||
SendMessage.AsyncSendMessage_Notice(OpName, "PLC机型与MES机型不匹配!");
|
||
}
|
||
|
||
|
||
|
||
}
|
||
}
|
||
catch (Exception err)
|
||
{
|
||
////ApplicationLog.WriteLog(err, "Function02:EngineTypeGetOver_PLC");
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
}
|
||
}
|