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

namespace MesServerFunctions
{
    partial class Functions_BASE_WebSubmit
    {
        /// <summary>
        /// 保存完成(针对半自动和手动压装工位)
        /// </summary>
        /// <param name="OpName"></param>
        /// <param name="tagValue"></param>
        private void MesRead(object e)
        {
            try
            {
                int EngineTypeID;
                string EngineType;
                string EngineID;
                int PartPallet_Code;
                string OrderForm;
                DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
                string OpName = Convert.ToString(msgEvent.OpName);
                int tagValue = Convert.ToInt32(msgEvent.TagValue);

                if (tagValue == 1)
                {
                    MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
                    //保存数据到线首表
                    if (Db.UpLoadOpNameInsert(EngineID, EngineTypeID, EngineType, OpName))
                    {
                        MIS_BASE.Write_MesReadOver(OpName, true);
                        SendMessage.SendActuallyCount(OpName, tagValue);//统计在线产量，在线节拍
                    }
                    else
                    {
                        SendMessage.AsyncSendMessage_Notice(OpName, "保存上线数据失败！");
                    }
                }
            }
            catch (Exception err)
            {
                ////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
            }
        }
    }
}
