using System;
using bizFacade;
//using SystemFramework;
using MesServerWork;

namespace MesServerFunctions
{
    partial class FunctionMES
    {
        /// <summary>
        /// 申请上线(针对上线工位)
        /// </summary>
        /// <param name="OpName"></param>
        /// <param name="tagValue"></param>
        private void PartLoad(object e)
        {
            try
            {
                DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
                string OpName = Convert.ToString(msgEvent.OpName);
                string OpName_mes = Convert.ToString(msgEvent.OpName) + "_mes";
                int tagValue = Convert.ToInt32(msgEvent.TagValue);

                if (tagValue == 1)
                {

                    BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());

                    MIS_BASE.Write_TagTypeID(201, OpName_mes, 0);
                    MIS_BASE.Write_TagTypeID(202, OpName_mes, 0);
                    MIS_BASE.Write_TagTypeID(203, OpName_mes, 0);
                    MIS_BASE.Write_TagTypeID(204, OpName_mes, 0);
                    MIS_BASE.Write_TagTypeID(205, OpName_mes, 0);
                    MIS_BASE.Write_TagTypeID(206, OpName_mes, 0);
                    MIS_BASE.Write_TagTypeID(207, OpName_mes, 0);
                    MIS_BASE.Write_TagTypeID(208, OpName_mes, 0);
                    MIS_BASE.Write_EngineTypeGetOver_MES(OpName_mes, false);
                    MIS_BASE.Write_TagTypeID(75, OpName_mes, "");
                    MIS_BASE.Write_TagTypeID(20, OpName_mes, 0);

                }
                else
                {
                    //上线工位清MES传递机型信号
                    MIS_BASE.Write_EngineTypeGetOver_MES(OpName_mes, false);
                    MIS_BASE.Write_TagTypeID(5, OpName_mes, false);
                    MIS_BASE.Write_TagTypeID(74, OpName_mes, "");
                    MIS_BASE.Write_TagTypeID(75, OpName_mes, "");
                }
            }
            catch (Exception err)
            {
                ////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
            }
        }
    }
}
