Ejemplo n.º 1
0
        /// <summary>
        /// 连续指令结束
        /// </summary>
        /// <param name="iixServer"></param>
        /// <param name="pg"></param>
        /// <returns></returns>
        public static CmdResultCode SequenceEnd(IIXServer iixServer, PgSelectCode pg)
        {
            CmdResultCode cmdRes = CmdResultCode.Other;

            //查询当前屏幕是否在集合中存在
            OLEDPanel panel = Global.ListOLEDPanel.Where(info => info.PanelPos == iixServer.AssociatedPanelPos).FirstOrDefault();

            if (panel != null)
            {
                if (panel.CmdResWork == CmdResultCode.Success)
                {
                    cmdRes = iixServer.DmrSvrApi.SequenceEnd(pg);
                    iixServer.LatestResult = cmdRes.ToString();

                    if (cmdRes == CmdResultCode.Success)
                    {
                        iixServer.SetSequenceEnd(pg);
                        Log.GetInstance().NormalWrite(string.Format("[{0}]连续指令[{1}]结束成功", iixServer.Ip, pg.ToString()));
                    }
                    else
                    {
                        Log.GetInstance().ErrorWrite(string.Format("[{0}]连续指令[{1}]结束失败,Error:{2}", iixServer.Ip, pg.ToString(), cmdRes.ToString()));
                    }
                }
                else
                {
                    cmdRes = panel.CmdResWork;
                    Log.GetInstance().ErrorWrite(string.Format("[{0}]连续指令结束失败,Error:{1}", iixServer.Ip, cmdRes.ToString()));
                }
            }

            Global.UpdateDgv(ip: iixServer.Ip, pgPrimary: OutlineStateCode.Stable.ToString(), latestResult: iixServer.LatestResult);

            return(cmdRes);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取Capture(获取拍摄数据)处理结果
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCaptureResult_Click(object sender, EventArgs e)
        {
            try
            {
                var tasks = new List <Task>();

                foreach (var iixServer in Global.ListIIXSerevr)
                {
                    if (iixServer.IsEnable == false)
                    {
                        continue;
                    }

                    tasks.Add(Task.Factory.StartNew(() =>
                    {
                        PgSelectCode pg = iixServer.SvrType == SvrType.Left ? PgSelectCode.Primary : PgSelectCode.Secondary;
                        IIXExecute.GetCaptureResult(iixServer, pg);
                    }));
                }

                Task.WaitAll(tasks.ToArray());
            }
            catch (Exception ex)
            {
                Log.WriterExceptionLog(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Flash Memory全部删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFlashErase_Click(object sender, EventArgs e)
        {
            try
            {
                var res = MessageBox.Show("你确定要擦除IC里的内容吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (res != DialogResult.OK)
                {
                    return;
                }

                var tasks = new List <Task>();

                foreach (var iixServer in Global.ListIIXSerevr)
                {
                    if (iixServer.IsEnable == false)
                    {
                        continue;
                    }

                    tasks.Add(Task.Factory.StartNew(() =>
                    {
                        PgSelectCode pg = iixServer.SvrType == SvrType.Left ? PgSelectCode.Primary : PgSelectCode.Secondary;
                        IIXExecute.EraseFlashMemory(iixServer, pg);
                    }));
                }

                Task.WaitAll(tasks.ToArray());
            }
            catch (Exception ex)
            {
                Log.WriterExceptionLog(ex.ToString());
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 向Flash Memory写入文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFlashWrite_Click(object sender, EventArgs e)
        {
            try
            {
                FormWriteFlashMemory formWriteFlashMemory = new FormWriteFlashMemory();
                if (formWriteFlashMemory.ShowDialog() == DialogResult.OK)
                {
                    string fileName = "";
                    this.txtFlashWrite.Text = formWriteFlashMemory.FilePath;

                    if (formWriteFlashMemory.FilePath == null || formWriteFlashMemory.FilePath == "")
                    {
                        Log.GetInstance().WarningWrite("File name is empty");
                        return;
                    }

                    if (!File.Exists(formWriteFlashMemory.FilePath))
                    {
                        Log.GetInstance().WarningWrite("File does not exist.path:" + formWriteFlashMemory.FilePath);
                        return;
                    }

                    fileName = Path.GetFileName(formWriteFlashMemory.FilePath);

                    var tasks = new List <Task>();

                    foreach (var iixServer in Global.ListIIXSerevr)
                    {
                        tasks.Add(Task.Factory.StartNew(() =>
                        {
                            if (formWriteFlashMemory.IsUploadFile)
                            {
                                fileName = UploadFileByFtp(formWriteFlashMemory.FilePath, iixServer.Ip);
                            }

                            if (fileName == "")
                            {
                                return;
                            }

                            PgSelectCode pg = iixServer.SvrType == SvrType.Left ? PgSelectCode.Primary : PgSelectCode.Secondary;
                            IIXExecute.WriteFlashMemory(iixServer, pg, fileName);
                        }));
                    }

                    Task.WaitAll(tasks.ToArray());
                }
            }
            catch (Exception ex)
            {
                Log.WriterExceptionLog(ex.ToString());
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 设置Panel显示Raster图像
        /// </summary>
        /// <param name="iixServer"></param>
        /// <param name="pg"></param>
        /// <param name="color"></param>
        /// <param name="isFactory"></param>
        /// <returns></returns>
        public static CmdResultCode SetRasterImage(IIXServer iixServer, PgSelectCode pg, Color color, bool isFactory)
        {
            CmdResultCode cmdRes = CmdResultCode.Other;

            //查询当前屏幕是否在集合中存在
            OLEDPanel panel = Global.ListOLEDPanel.Where(info => info.PanelPos == iixServer.AssociatedPanelPos).FirstOrDefault();

            if (panel != null)
            {
                //如果上一次的检测结果是正确的才继续执行当前的工作
                if (panel.CmdResWork == CmdResultCode.Success)
                {
                    cmdRes = iixServer.DmrSvrApi.SetRasterImage(pg, color.R, color.G, color.B, isFactory);
                    iixServer.LatestResult = cmdRes.ToString();

                    if (cmdRes == CmdResultCode.Success)
                    {
                        Log.GetInstance().NormalWrite(string.Format("设置[{0}]Panel显示Raster图像成功", iixServer.Ip));
                    }
                    else
                    {
                        Log.GetInstance().ErrorWrite(string.Format("设置[{0}]Panel显示Raster图像失败,Error:{1}", iixServer.Ip, cmdRes.ToString()));
                    }

                    //修改执行结果
                    panel.CmdResWork = cmdRes;
                }
                else
                {
                    cmdRes = panel.CmdResWork;

                    Log.GetInstance().ErrorWrite(string.Format("设置[{0}]Panel显示Raster图像失败,Error:{1}", iixServer.Ip, cmdRes.ToString()));
                }
            }

            Global.UpdateDgv(ip: iixServer.Ip, latestResult: iixServer.LatestResult);

            return(cmdRes);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取Capture(获取拍摄数据)处理结果
        /// </summary>
        /// <param name="iixServer"></param>
        /// <param name="pg"></param>
        /// <returns></returns>
        public static CmdResultCode GetCaptureResult(IIXServer iixServer, PgSelectCode pg)
        {
            CmdResultCode cmdRes = CmdResultCode.Other;

            //查询当前屏幕是否在集合中存在
            OLEDPanel panel = Global.ListOLEDPanel.Where(info => info.PanelPos == iixServer.AssociatedPanelPos).FirstOrDefault();

            if (panel != null)
            {
                //如果上一次的检测结果是正确的才继续执行当前的工作
                if (panel.CmdResWork == CmdResultCode.Success)
                {
                    cmdRes = iixServer.DmrSvrApi.GetCaptureResult(pg);
                    iixServer.LatestResult = cmdRes.ToString();

                    if (cmdRes == CmdResultCode.Success)
                    {
                        Log.GetInstance().NormalWrite(string.Format("获取[{0}]Capture(获取拍摄数据)处理结果成功", iixServer.Ip));
                    }
                    else
                    {
                        Log.GetInstance().ErrorWrite(string.Format("获取[{0}]Capture(获取拍摄数据)处理结果失败,Error:{1}", iixServer.Ip, cmdRes.ToString()));
                    }

                    //修改执行结果
                    panel.CmdResWork = cmdRes;
                }
                else
                {
                    cmdRes = panel.CmdResWork;

                    Log.GetInstance().ErrorWrite(string.Format("获取[{0}]Capture(获取拍摄数据)处理结果失败,Error:{1}", iixServer.Ip, cmdRes.ToString()));
                }
            }

            Global.UpdateDgv(ip: iixServer.Ip, latestResult: iixServer.LatestResult);

            return(cmdRes);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 向Flash Memory写入文件
        /// </summary>
        /// <param name="iixServer"></param>
        /// <param name="pg"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static CmdResultCode WriteFlashMemory(IIXServer iixServer, PgSelectCode pg, string fileName)
        {
            CmdResultCode cmdRes = CmdResultCode.Other;

            //查询当前屏幕是否在集合中存在
            OLEDPanel panel = Global.ListOLEDPanel.Where(info => info.PanelPos == iixServer.AssociatedPanelPos).FirstOrDefault();

            if (panel != null)
            {
                //如果上一次的检测结果是正确的才继续执行当前的工作
                if (panel.CmdResWork == CmdResultCode.Success)
                {
                    cmdRes = iixServer.DmrSvrApi.WriteFlashMemory(pg, fileName);
                    iixServer.LatestResult = cmdRes.ToString();

                    if (cmdRes == CmdResultCode.Success)
                    {
                        Log.GetInstance().NormalWrite(string.Format("[{0}]向Flash Memory写入文件[{1}]成功", iixServer.Ip, fileName));
                    }
                    else
                    {
                        Log.GetInstance().ErrorWrite(string.Format("[{0}]向Flash Memory写入文件[{1}]失败,Error:{2}", iixServer.Ip, fileName, cmdRes.ToString()));
                    }

                    //修改执行结果
                    panel.CmdResWork = cmdRes;
                }
                else
                {
                    cmdRes = panel.CmdResWork;

                    Log.GetInstance().ErrorWrite(string.Format("[{0}]向Flash Memory写入文件[{1}]失败,Error:{2}", iixServer.Ip, fileName, cmdRes.ToString()));
                }
            }

            Global.UpdateDgv(ip: iixServer.Ip, latestResult: iixServer.LatestResult);

            return(cmdRes);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// DeMura Check(补正结果确认)开始
        /// </summary>
        /// <param name="iixServer"></param>
        /// <param name="pg"></param>
        /// <returns></returns>
        public static CmdResultCode DeMuraCheckStart(IIXServer iixServer, PgSelectCode pg)
        {
            CmdResultCode cmdRes = CmdResultCode.Other;

            //查询当前屏幕是否在集合中存在
            OLEDPanel panel = Global.ListOLEDPanel.Where(info => info.PanelPos == iixServer.AssociatedPanelPos).FirstOrDefault();

            if (panel != null)
            {
                //如果上一次的检测结果是正确的才继续执行当前的工作
                if (panel.CmdResWork == CmdResultCode.Success)
                {
                    cmdRes = iixServer.DmrSvrApi.DeMuraCheckStart(pg);
                    iixServer.LatestResult = cmdRes.ToString();

                    if (cmdRes == CmdResultCode.Success)
                    {
                        Log.GetInstance().NormalWrite(string.Format("[{0}]DeMura Check(补正结果确认)开始成功", iixServer.Ip));
                    }
                    else
                    {
                        Log.GetInstance().ErrorWrite(string.Format("[{0}]DeMura Check(补正结果确认)开始失败,Error:{1}", iixServer.Ip, cmdRes.ToString()));
                    }

                    //修改执行结果
                    panel.CmdResWork = cmdRes;
                }
                else
                {
                    cmdRes = panel.CmdResWork;

                    Log.GetInstance().ErrorWrite(string.Format("[{0}]DeMura Check(补正结果确认)开始失败,Error:{1}", iixServer.Ip, cmdRes.ToString()));
                }
            }

            return(cmdRes);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 点灯
        /// </summary>
        /// <param name="iixServer"></param>
        /// <param name="pg"></param>
        /// <returns></returns>
        public static CmdResultCode PanelOn(IIXServer iixServer, PgSelectCode pg)
        {
            CmdResultCode cmdRes = CmdResultCode.Other;

            //查询当前屏幕是否在集合中存在
            OLEDPanel panel = Global.ListOLEDPanel.Where(info => info.PanelPos == iixServer.AssociatedPanelPos).FirstOrDefault();

            if (panel != null)
            {
                if (panel.CmdResWork == CmdResultCode.Success)
                {
                    cmdRes = iixServer.DmrSvrApi.PanelOn(pg);
                    iixServer.LatestResult = cmdRes.ToString();

                    if (cmdRes == CmdResultCode.Success)
                    {
                        panel.IsPanelOn     = true;
                        iixServer.IsPanelOn = true;
                        Log.GetInstance().NormalWrite(string.Format("屏[{0}]点灯成功", iixServer.AssociatedPanelPos));
                    }
                    else
                    {
                        iixServer.IsPanelOn = false;
                        Log.GetInstance().ErrorWrite(string.Format("屏[{0}]点灯失败,Error:{1}", iixServer.AssociatedPanelPos, cmdRes.ToString()));
                    }
                }
                else
                {
                    cmdRes = panel.CmdResWork;
                    Log.GetInstance().ErrorWrite(string.Format("屏[{0}]点灯失败,Error:{1}", iixServer.Ip, cmdRes.ToString()));
                }
            }

            Global.UpdateDgv(ip: iixServer.Ip, latestResult: iixServer.LatestResult);

            return(cmdRes);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 设置Panel显示Raster图像
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSetRaster_Click(object sender, EventArgs e)
        {
            try
            {
                FormImageColor formImageColor = new FormImageColor();

                if (formImageColor.ShowDialog() == DialogResult.OK)
                {
                    Color color = formImageColor.Color;
                    this.txtSetRaster.Text  = string.Format("R:{0:D3}, G:{1:D3}, B:{2:D3}", color.R, color.G, color.B);
                    this.pnlColor.BackColor = color;

                    var tasks = new List <Task>();

                    foreach (var iixServer in Global.ListIIXSerevr)
                    {
                        if (iixServer.IsEnable == false)
                        {
                            continue;
                        }

                        tasks.Add(Task.Factory.StartNew(() =>
                        {
                            PgSelectCode pg = iixServer.SvrType == SvrType.Left ? PgSelectCode.Primary : PgSelectCode.Secondary;
                            IIXExecute.SetRasterImage(iixServer, pg, color, formImageColor.IsFactory);
                        }));
                    }

                    Task.WaitAll(tasks.ToArray());
                }
            }
            catch (Exception ex)
            {
                Log.WriterExceptionLog(ex.ToString());
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 关灯
        /// </summary>
        /// <param name="iixServer"></param>
        /// <param name="pg"></param>
        /// <returns></returns>
        public static CmdResultCode PanelOff(IIXServer iixServer, PgSelectCode pg)
        {
            CmdResultCode cmdRes = CmdResultCode.Other;

            //查询当前屏幕是否在集合中存在
            OLEDPanel panel = Global.ListOLEDPanel.Where(info => info.PanelPos == iixServer.AssociatedPanelPos).FirstOrDefault();

            if (panel != null && panel.IsPanelOn)
            {
                cmdRes = iixServer.DmrSvrApi.PanelOff(pg);
                iixServer.LatestResult = cmdRes.ToString();

                if (cmdRes == CmdResultCode.Success)
                {
                    iixServer.IsPanelOn = false;
                    Log.GetInstance().NormalWrite(string.Format("屏[{0}]关灯成功", iixServer.AssociatedPanelPos));
                }
                else
                {
                    iixServer.IsPanelOn = true;
                    Log.GetInstance().ErrorWrite(string.Format("屏[{0}]关灯失败,Error:{1}", iixServer.AssociatedPanelPos, cmdRes.ToString()));
                }

                //如果上一个工位的检测结果是正确的才继续执行当前工位的工作
                if (panel.CmdResWork == CmdResultCode.Success)
                {
                    Global.UpdateDgv(ip: iixServer.Ip, latestResult: iixServer.LatestResult);

                    //修改执行结果
                    panel.CmdResWork = cmdRes;
                    //修改当前的工作位置
                    panel.PanelWorkPos = "工位1";
                }
                else
                {
                    cmdRes             = panel.CmdResWork;
                    panel.PanelWorkPos = "工位1";
                }

                lock (Global.ListOLEDPanel)
                {
                    //将屏从集合中移除
                    Global.ListOLEDPanel.Remove(panel);
                }

                //当所有流程执行完后关灯时添加成功/失败数
                if (panel.bRotated)
                {
                    if (cmdRes == CmdResultCode.Success)
                    {
                        Global.PassNumber++;
                    }
                    else
                    {
                        Global.FailNumber++;
                    }
                }
            }

            Global.SetNumber();

            return(cmdRes);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 将pg的状态修改为Stable
        /// </summary>
        /// <param name="pg"></param>
        public void SetSequenceEnd(PgSelectCode pg)
        {
            int idx = pg.GetArrayIndex();

            this.OutlineState[idx] = OutlineStateCode.Stable;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 将pg的状态修改为PanelChk
        /// </summary>
        /// <param name="pg"></param>
        public void SetSequenceStart(PgSelectCode pg)
        {
            int idx = pg.GetArrayIndex();

            this.OutlineState[idx] = OutlineStateCode.PanelChk;
        }