//using SystemFramework;
using MesServerWork;
using MisDataFunDll;
using System;
using System.Data;
using System.Windows.Forms;
using System.Xml.Linq;

namespace MesServerFunctions
{
    partial class FunctionMES
    {
        /// <summary>
        /// PLC传递机型处理
        /// </summary>
        /// <param name="OpName"></param>
        /// <param name="tagValue"></param>
        private void EngineTypeGetOver_PLC(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传递机型！");
                        EngineTypeGetOver_PLC_Work(OpName);
                    }
                    else
                    {
                        MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC传递机型取消！");
                        // 允许PLC拧紧工作（MES）
                        MIS_BASE.Write_TagValueByTagTypeID(66, OpName, false);
                        // 保存完成（MES）
                        MIS_BASE.Write_TagValueByTagTypeID(20, OpName, false);
                        // 工作完成（MES）
                        MIS_BASE.Write_TagValueByTagTypeID(7, OpName, false);
                    }
                }
                catch (Exception err)
                {
                    ////ApplicationLog.WriteLog(err, "Function02:EngineTypeGetOver_PLC");
                }
            }


        }

    }
}
