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


namespace MesServerFunctions
{
    partial class FunctionMES
    {

        /// <summary>
        /// 切换配方 初始化数据
        /// </summary>
        /// <param name="OpName"></param>
        /// <param name="tagValue"></param>
        private void ChengeRepice(object e)
        {
            try
            {
                DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
                string OpName = Convert.ToString(msgEvent.OpName);
                int tagValue = Convert.ToInt32(msgEvent.TagValue);
                string OpName_mes = Convert.ToString(msgEvent.OpName) + "_mes";

                //int EngineTypeID;//机型代码
                //int PartPallet_Code;//托盘编号

                //string EngineType;//机型
                //string EngineID;//工件编号

                //int EngineTypeID_MES;//机型代码
                //string EngineType_MES;//机型
                //string EngineID_MES;//工件编号
                //string OrderForm;//订单号

                //MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);

                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);

                // 发送切换信号 前端关闭手动拧紧指导
                SendMessageFun.SendInfomation("CutRecipe", "1", OpName);

                // 将配方号写入到MOBY表中 然后拉去页面工艺数据
                BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID, tagValue.ToString());
                SendMessageFun.SendMessage("13", "111", OpName);

            }
            catch (Exception err)
            {
                ////ApplicationLog.WriteLog(err, "Function08:FalseGO");
            }
        }
    }
}
