Ejemplo n.º 1
0
        public bool IsBarcodeMatched(object fileobj, string barcode)
        {
            Ese_PrinterData data = fileobj as Ese_PrinterData;

            if (data.BarcodeId == barcode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public override object Match(InspectedPanel currentPanel)
        {
            Ese_PrinterData tmpTool = new Ese_PrinterData();

            return((Ese_PrinterData)Match(currentPanel, (IParser)tmpTool, WatchedFolder));
        }
Ejemplo n.º 3
0
        public object Parse(string filepath)
        {
            Ese_PrinterData ret = new Ese_PrinterData();



            try
            {
                XElement GKG = XElement.Load(filepath);
                //取得四大Element,因為有重複的Element,直接下去使用Extension內的getValue會錯誤
                XElement _HEADER   = GKG.getElement("HEADER");
                XElement _PROCESS  = GKG.getElement("PROCESS");
                XElement _PANEL    = GKG.getElement("PANEL");
                XElement _OPTIONAL = GKG.getElement("OPTIONAL");
                //HEADER
                ret.MachineName     = _HEADER.getValue("MachineName");
                ret.Reference       = _HEADER.getValue("Reference");
                ret.UnitDistance    = _HEADER.getValue("Distance");
                ret.UnitAngle       = _HEADER.getValue("Angle");
                ret.UnitTime        = _HEADER.getValue("Time");
                ret.DefineDirection = _HEADER.getValue("DefineDirection");
                //PROCESS
                ret.ProductName = _PROCESS.getValue("ProductName");
                ret.Date        = _PROCESS.getValue("Date");
                ret.PrintTime   = _PROCESS.getValue("Time");
                ret.PanelState  = _PROCESS.getValue("PanelState");
                //PANEL
                ret.BarcodeId   = _PANEL.getValue("BarcodeId");
                ret.SqueegeeDir = _PANEL.getValue("SqueegeeDir");
                string sWidth, sHeight;
                double width, height;
                sWidth = _PANEL.getAttributeValue("PanelSize", "width");
                Double.TryParse(sWidth, out width);
                ret.Width = width;
                sHeight   = _PANEL.getAttributeValue("PanelSize", "height");
                Double.TryParse(sHeight, out height);
                ret.Height = height;
                //PANEL-Fid
                List <XElement> elFMs = _PANEL.getElements("Fiducial");
                foreach (var fm in elFMs)
                {
                    string name = fm.getAttributeValue("id");
                    string x = fm.getAttributeValue("pox_x");
                    string y = fm.getAttributeValue("pox_y");
                    double dX, dY;
                    Double.TryParse(x, out dX);
                    Double.TryParse(y, out dY);
                    var eseFM = new EseFM();
                    eseFM.Name = name;
                    eseFM.P.X  = dX;
                    eseFM.P.Y  = dY;
                    ret.EseFMs.Add(eseFM);
                }

                ret.CenterOfRotation = _PANEL.getValue("CenterOfRotation");

                //OPTIONAL
                string sPrintSpeed, sPrintPressure;
                double printspeed, printpressure;
                sPrintSpeed = _PANEL.getValue("PrintSpeed");
                Double.TryParse(sPrintSpeed, out printspeed);
                ret.PrintSpeed = printspeed;
                sPrintPressure = _PANEL.getValue("PrintPressure");
                Double.TryParse(sPrintPressure, out printpressure);
                ret.PrintPressure = printpressure;
            }
            catch (Exception exception)
            {
                Log4.PrinterLogger.ErrorFormat("GKG Printer Data Pasre Exception: {0}", filepath);
                Log4.PrinterLogger.ErrorFormat("Message: {0}", exception.Message);
                return(null);
            }
            return(ret);
        }