using System;
using System.Data;
using System.Collections;

using System.Windows.Forms;
//using bizFacade;
using System.Collections.Specialized;
//using MesWork;
//using SystemFramework;

namespace MesServerWork
{
    public partial class MIS_BASE
    {
        static object lockerMesReadOver = new object();

        /// <summary>
        /// 保存完成(针对半自动和手动压装工位)
        /// </summary>
        /// <param name="OpName"></param>
        /// <param name="tagValue"></param>
        static public void MesReadOver(object e)
        {
            lock (lockerMesReadOver)
            {
                try
                {
                    DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
                    string OpName = Convert.ToString(msgEvent.OpName);
                    var tagValue = msgEvent.TagValue.ToString();

                    if (tagValue == "1" | tagValue.ToLower() == "true")
                    {
                        int qualityMask;
                        MIS_BASE.Read_QualityMask(OpName, out qualityMask);

                        SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);//发给Web页面显示质量数据

                        if (qualityMask == 1)//全部OK，给出合格放行
                        {
                            //如果存在线外扫描工位，根据扫描条码绑定线外数据     需要时解除禁用
                            //BaseDataSystemMES.TransLaunchDataByMainMaterial(OpName, EngineType, EngineID, EngineTypeID);

                            //如果存在线外排队工位，根据排队编号绑定线外数据     需要时解除禁用
                            ////BaseDataSystemMES.MailLineAndSubLineData_InsertByEngineID_Subline(OpName,EngineID, EngineTypeID, EngineType);

                            MIS_BASE.Write_ConfirmOkGo(OpName, true);
                            //MIS_BASE.Write_FalseGO(OpName, false);
                        }
                        else
                        {
                            //MIS_BASE.Write_ConfirmOkGo(OpName, false);
                            MIS_BASE.Write_FalseGO(OpName, true);
                        }

                    }
                }
                catch (Exception err)
                {
                    ////ApplicationLog.WriteLog(err, "Function02:MesReadOver");
                }
            }
       
        }
    }
}
