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

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 (msgEvent.TagValue.ToString() == "1")
                {
                    MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC传递机型！");
                    EngineTypeGetOver_PLC_Work(OpName);
                }
                else
                {
                    MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC传递机型取消！");

                    MIS_BASE.Write_TagValueByTagTypeID(114, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(115, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(116, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(117, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(118, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(119, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(120, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(121, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(7, OpName, 0);
                    MIS_BASE.Write_TagValueByTagTypeID(66, OpName, 0);
                }


            }
            catch (Exception err)
            {
                // 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
                MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1053", err);
                ////ApplicationLog.WriteLog(err, "Function02:EngineTypeGetOver_PLC");
            }
        }

    }
}
