//外部(Mainwindow)內的分頁改變了磁碟映射後,需要刷新物件的可用選擇
        //提供PrinterWindow呼叫
        public void RefreshLocalDrives()
        {
            var vm = this.DataContext as SharedFolderSettingVM;

            vm.InSharedFolder  = WmiDiskHelper.GetDiskNames().ToObservableCollection();
            vm.OutSharedFolder = WmiDiskHelper.GetDiskNames().ToObservableCollection();
        }
        /// <summary>
        /// Initializes a new instance of the SharedFolderSettingVM class.
        /// </summary>
        public SharedFolderSettingVM()
        {
            _IsInEnable = _IsOutEnable = false;

            _InSharedFolder  = WmiDiskHelper.GetDiskNames().ToObservableCollection();
            _OutSharedFolder = WmiDiskHelper.GetDiskNames().ToObservableCollection();
        }
示例#3
0
 private void CreateExecute()
 {
     Log4.PrinterLogger.Info("[A][Tool Page]Press Create button.");
     NetworkDriveWrapper.MappingNetDrive(WmiDiskHelper.ExtractDiskID(NetDriveM.DriveInfo), NetDriveM.ShareFolder, NetDriveM.UserName, NetDriveM.Password);
     if (NetworkDriveMappingChangedEvent != null)
     {
         NetworkDriveMappingChangedEvent(this, new NetworkDriveMappingChangedEventArgs(WmiDiskHelper.ExtractDiskID(NetDriveM.DriveInfo)));
     }
 }
示例#4
0
        public override void Activate()
        {
            //InDriveInfo Z:(\\IP\Folder)格式,WmiDiskHelper.ExtractDiskID取 "Z:"
            //但當選取的InDriveInfo是 D:格式,WmiDiskHelper.ExtractDiskID取"D:"
            //可是當送給DirectoryWatcher時 因D:本質是Disk Volume而不是Folder
            //而Z:是以建立共享資料夾的虛擬網路硬碟 (可以想成Z:是一個代號),本質上他還是個Folder,所以可以監控
            //因此,為了避免選成Disk,故加一個@"\"
            target = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.InDriveInfo) + @"\"; //Disk mapping
            var des = WmiDiskHelper.ExtractProviderName(PrinterSFSetting.InDriveInfo); //ui顯示用

            WatchedFolder = PrinterManager.getInstance().AddWatcher(target, LaneID, des);
        }
示例#5
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            var    _Minami_PrinterData = (Minami_PrinterData)file;
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            string path = netDrive + String.Format("{0:yyyyMMddHHmmss}.xml", currentPanel.InspectStartTime);

            try
            {
                DateTime t       = currentPanel.InspectStartTime;
                string   strTime = string.Format("{0:0000}-{1:00}-{2:00}T{3:00}:{4:00}:{5:00}.{6:00}",
                                                 t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second, t.Millisecond);

                XElement root = new XElement("SpiData"
                                             , new XElement("ModelName", _Minami_PrinterData.ModelName)
                                             , new XElement("InspectTime", strTime)
                                             , new XElement("SN", _Minami_PrinterData.SN)
                                             , new XElement("Barcode", _Minami_PrinterData.Barcode)
                                             , new XElement("Direction", _Minami_PrinterData.PrintDirection)
                                             , new XElement("Board", new XAttribute("ID", "1")
                                                            , new XElement("FidMarkList", CreateFidElements(currentPanel)
                                                                           , new XElement("Correction"
                                                                                          , new XAttribute("RotCx", Math.Round((_RotationResult.Center.X * 0.001), 6).ToString())
                                                                                          , new XAttribute("RotCy", Math.Round((_RotationResult.Center.Y * 0.001), 6).ToString())
                                                                                          , new XElement("X", Math.Round((_CenterOffsetResult.Dx * 0.001), 6).ToString())
                                                                                          , new XElement("Y", Math.Round((_CenterOffsetResult.Dy * 0.001), 6).ToString())
                                                                                          , new XElement("Theta", Math.Round(_RotationResult.Theta, 6).ToString())
                                                                                          , new XElement("Stretch", Math.Round(_StretchResult.Stretch, 6).ToString())
                                                                                          )
                                                                           )
                                                            )
                                             );

                root.Save(path);
                Log4.PrinterLogger.InfoFormat("Save @ {0} [Minami]", path);
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.InfoFormat("Save @ {0} Exception [Minami]", path);
                Log4.PrinterLogger.InfoFormat("{0}", e.Message);
                throw new OutputException(e.Message);
                //return false;
            }
            return(true);
        }
示例#6
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            string             path = netDrive + String.Format("{0:yyyyMMddHHmmss}.xml", currentPanel.InspectStartTime);
            INOTIS_PrinterData _INOTIS_PrinterData = file as INOTIS_PrinterData;

            try
            {
                XElement root = new XElement("Data",
                                             new XElement(
                                                 "Process",
                                                 new XElement("Direction", _INOTIS_PrinterData.sPrint_Direction),
                                                 new XElement("Offset_Correction",
                                                              new XElement("X", Math.Round((_CenterOffsetResult.Dx * 0.001), 6)),
                                                              new XElement("Y", Math.Round((_CenterOffsetResult.Dy * 0.001), 6)),
                                                              new XElement("Theta", new XAttribute("CoR_X", Math.Round((_RotationResult.Center.X * 0.001), 6)),
                                                                           new XAttribute("CoR_Y", Math.Round((_RotationResult.Center.Y * 0.001), 6)),
                                                                           Math.Round(_RotationResult.Theta, 6)),
                                                              new XElement("Stretch", Math.Round(_StretchResult.Stretch, 6))
                                                              ) //Offset_Correction
                                                 )              //Process
                                             );
                root.Save(path);
                Log4.PrinterLogger.InfoFormat("Save @ {0} [INOTIS]", path);
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.InfoFormat("Save @ {0} Exception [INOTIS]", path);
                Log4.PrinterLogger.InfoFormat("{0}", e.Message);
                throw new OutputException(e.Message);
                //return false;
            }

            return(true);
        }
示例#7
0
        private bool CheckSharedFolder(string folder, string type)
        {
            Log4.PrinterLogger.Info("Checking " + type + " SharedFolder...");
            bool   ret      = true;
            string diskID   = WmiDiskHelper.ExtractDiskID(folder);
            string provider = WmiDiskHelper.ExtractProviderName(folder);

            if (String.IsNullOrEmpty(diskID) || String.IsNullOrWhiteSpace(diskID))
            {
                _window.lbStatusReporter.Items.Add("(" + type + ")" + "@DISK".Translate() + " " + "@INVALID".Translate());
                Log4.PrinterLogger.Info(type + " SharedFolder Invalid!");
                ret = false;
            }
            if (String.IsNullOrEmpty(provider) || String.IsNullOrWhiteSpace(provider))
            {
                _window.lbStatusReporter.Items.Add("(" + type + ")" + "@SHARED_FOLDER".Translate() + " " + "@INVALID".Translate());
                Log4.PrinterLogger.Info(type + " SharedFolder Invalid!");
                ret = false;
            }
            return(ret);
        }
示例#8
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            var    _Hanwha_PrinterData = (Hanwha_PrinterData)file;
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            string path = netDrive + String.Format("{0:yyyyMMddHHmmss}.xml", currentPanel.InspectStartTime);

            try
            {
                XElement root = new XElement(
                    "ResultInsp",
                    HEADER_SECTION(currentPanel, _Hanwha_PrinterData),
                    PROCESS_SECTION(currentPanel, _Hanwha_PrinterData),
                    PANEL_SECTION(currentPanel, _Hanwha_PrinterData),
                    MEASUREMENTS_SECTION(_Hanwha_PrinterData),
                    DEFECT_SECTION(currentPanel, _Hanwha_PrinterData),
                    OPTIONAL_SECTION()
                    );
                root.Save(path);
                Log4.PrinterLogger.InfoFormat("Save @ {0} [Hanwha]", path);
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.InfoFormat("Save @ {0} Exception [Hanwha]", path);
                Log4.PrinterLogger.InfoFormat("{0}", e.Message);
                throw new OutputException(e.Message);
                //return false;
            }

            return(true);
        }
示例#9
0
        static public SharedFolderSettingVM ToSharedFolderSettingVM(this XElement root)
        {
            SharedFolderSettingVM ret = null;

            try
            {
                ret            = new SharedFolderSettingVM();
                ret.IsInEnable = bool.Parse(root.getValue("In"));
                string _driveletter   = root.getAttributeValue("In", "DriveLetter");
                string _driveprovider = root.getAttributeValue("In", "DriveProvider");

                ret.InDriveInfo = _driveletter + "(" + _driveprovider + ")";
                //檢查有否有此driveinfo,若沒有,則create 一個
                var  _lstCurrentDrives = WmiDiskHelper.GetDiskNames();
                bool bExist            = _lstCurrentDrives.Exists(X => X.DiskID == _driveletter && X.DiskProviderName == _driveprovider);
                if (!bExist)
                {
                    NetworkDriveWrapper.MappingNetDrive(_driveletter, _driveprovider, "", "");
                }
                ret.IsOutEnable = bool.Parse(root.getValue("Out"));
                _driveletter    = root.getAttributeValue("Out", "DriveLetter");
                _driveprovider  = root.getAttributeValue("Out", "DriveProvider");

                ret.OutDriveInfo = _driveletter + "(" + _driveprovider + ")";
                //檢查有否有此driveinfo,若沒有,則create 一個
                _lstCurrentDrives = WmiDiskHelper.GetDiskNames();
                bExist            = _lstCurrentDrives.Exists(X => X.DiskID == _driveletter && X.DiskProviderName == _driveprovider);
                if (!bExist)
                {
                    NetworkDriveWrapper.MappingNetDrive(_driveletter, _driveprovider, "", "");
                }
            }
            catch
            {
                return(null);
            }
            return(ret);
        }
示例#10
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            filename = "";
            var    _GKG_PrinterData = (GKG_PrinterData)file;
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            filename = String.Format("{0:yyyyMMddHHmmss}", currentPanel.InspectStartTime);
            string path = netDrive + filename + ".xml";

            try
            {
                bool     IsWipe = _WipeReason == eWipeStencilReason.NoNeedToWipe? false:true;
                DateTime t      = currentPanel.InspectStartTime;
                string   str    = string.Format("{0:0000}-{1:00}-{2:00}T{3:00}:{4:00}:{5:00}.{6:00}",
                                                t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second, t.Millisecond);
                XElement root = new XElement(
                    "SpiData"
                    //原WriteBasicSection
                    , new XElement("ModelName", currentPanel.Panel.ModelName)
                    , new XElement("InspectTime", str)
                    , new XElement("SN", _GKG_PrinterData.SN)
                    , new XElement("Barcode", _GKG_PrinterData.Barcode)
                    //原WriteUnitSection
                    , new XElement("Units"         //寫死
                                   , new XElement("Distance", "MM")
                                   , new XElement("Angle", "Degree")
                                   , new XElement("Stretch", "%")
                                   )
                    , new XElement("Direction", _GKG_PrinterData.Direction)
                    //原WriteFidMark
                    , new XElement("FidMarkList", CreateFidMark(currentPanel))
                    //原WriteCorrection
                    , new XElement("Correction"
                                   , new XAttribute("RotCx", Math.Round((_RotationResult.Center.X * 0.001), 6).ToString())
                                   , new XAttribute("RotCy", Math.Round((_RotationResult.Center.Y * 0.001), 6).ToString())
                                   , new XElement("X", Math.Round((_CenterOffsetResult.Dx * 0.001), 6).ToString())
                                   , new XElement("Y", Math.Round((_CenterOffsetResult.Dy * 0.001), 6).ToString())
                                   , new XElement("Theta", Math.Round(_RotationResult.Theta, 6).ToString())
                                   , new XElement("Stretch", Math.Round(_StretchResult.Stretch, 6).ToString())
                                   )
                    //原WriteWipe, 暫時not imp
                    , new XElement("Wipe", IsWipe.ToString())
                    );
                root.Save(path);
                Log4.PrinterLogger.InfoFormat("Save @ {0} [GKG]", path);
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.InfoFormat("Save @ {0} Exception [GKG]", path);
                Log4.PrinterLogger.InfoFormat("{0}", e.Message);
                throw new OutputException(e.Message);
                //return false;
            }

            return(true);
        }
示例#11
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            var    _Ese_PrinterData = (Ese_PrinterData)file;
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            string path = netDrive + String.Format("{0:yyyy-MM-dd-HH_mm_ss}.xml", currentPanel.InspectStartTime);

            try
            {
                bool IsWipe = _WipeReason == eWipeStencilReason.NoNeedToWipe?false:true;
                //DateTime t = currentPanel.InspectStartTime;
                //string str = string.Format("{0:0000}-{1:00}-{2:00}T{3:00}:{4:00}:{5:00}.{6:00}",
                //    t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second, t.Millisecond);

                DateTime printTime;
                DateTime.TryParse(_Ese_PrinterData.PrintTime, out printTime);
                if (printTime == DateTime.MinValue)
                {
                    printTime = currentPanel.InspectStartTime; // If no information of printer, It will be SPI base
                }
                string strDate = printTime.ToString("yyyy_MM_dd");
                string strTime = printTime.ToString("HH_mm_ss");

                XElement root = new XElement(
                    "ResultInsp"
                    //原WriteHeaderSection
                    , new XElement("HEADER"
                                   , new XElement("MachineName", "SPI")
                                   , new XElement("Reference", "BOTTOM_LEFT")
                                   //原WriteHeaderUnitsSection
                                   , new XElement("Units"
                                                  , new XElement("Distance", "mm")
                                                  , new XElement("Angle", "degree")
                                                  , new XElement("Time", "seconds")
                                                  , new XElement("Ratio", "percentage")
                                                  )
                                   , new XElement("DefineDirection", _Ese_PrinterData.DefineDirection)
                                   )
                    //原WriteProcessSection
                    , new XElement("PROCESS"
                                   , new XElement("ProductName", "")                         //原本都是空白 奇怪@@
                                   , new XElement("Date", strDate)
                                   , new XElement("Time", strTime)
                                   , new XElement("PanelState", "INSPECTED")
                                   )
                    //WritePanelSection
                    , new XElement("PANEL"
                                   , new XElement("PanelId", ViewModelLocator.Atom.PrinterWindowVM.SN)                         //sn*
                                   , new XElement("BarcodeId", _Ese_PrinterData.BarcodeId)
                                   , new XElement("Stencil", new XAttribute("thickness", (currentPanel.Panel.StencilThick * 0.001).ToString()))
                                   , new XElement("PanelSize", new XAttribute("width", (currentPanel.Panel.FullCadRect.Width * 0.001).ToString())
                                                  , new XAttribute("height", (currentPanel.Panel.FullCadRect.Height * 0.01).ToString())
                                                  )
                                   //WritePanelFiducialsSection
                                   , new XElement("Fiducials", CreateFiducailElements(currentPanel))

                                   )
                    //WriteMeasurementsSection
                    , new XElement("MEASUREMENTS"
                                   , new XElement("SqueegeeDir", _Ese_PrinterData.SqueegeeDir)
                                   , new XElement("CenterOfRotation"
                                                  , new XAttribute("RotCx", Math.Round((_RotationResult.Center.X * 0.001), 6).ToString())
                                                  , new XAttribute("RotCy", Math.Round((_RotationResult.Center.Y * 0.001), 6).ToString())
                                                  )
                                   , new XElement("Rotation", Math.Round(_RotationResult.Theta, 6).ToString())
                                   , new XElement("OffsetX", Math.Round((_CenterOffsetResult.Dx * 0.001), 6).ToString())
                                   , new XElement("OffsetY", Math.Round((_CenterOffsetResult.Dy * 0.001), 6).ToString())
                                   , new XElement("Height", _PadHAVAvgResult.avgHeight_pct.ToString("F3"))
                                   , new XElement("Area", _PadHAVAvgResult.avgArea_pct.ToString("F3"))
                                   , new XElement("Volume", _PadHAVAvgResult.avgVolume_pct.ToString("F3"))

                                   )
                    //WriteDefectSection
                    , new XElement("DEFECT"
                                   //WriteDefectTotalCountSection
                                   , new XElement("TotalCount", GetTotalBoxCount(currentPanel).ToString())
                                   //WriteDefectDefectCountSection
                                   , new XElement("DefectCount", new XAttribute("count", (currentPanel.FailList().Count).ToString())
                                                  , new XElement("Height", new XAttribute("high", _DefectStatisticResult.HeightDefectOver)
                                                                 , new XAttribute("low", _DefectStatisticResult.HeightDefectUnder)
                                                                 )
                                                  , new XElement("Volume", new XAttribute("high", _DefectStatisticResult.VolumeDefectOver)
                                                                 , new XAttribute("low", _DefectStatisticResult.VolumeDefectUnder)
                                                                 )
                                                  , new XElement("Area", new XAttribute("high", _DefectStatisticResult.AreaDefectOver)
                                                                 , new XAttribute("low", _DefectStatisticResult.AreaDefectUnder)
                                                                 )
                                                  , new XElement("Bridge", new XAttribute("count", _DefectStatisticResult.BridgeDefect))
                                                  )

                                   //WriteDefectWarningCountSection
                                   , new XElement("WarningCount", new XAttribute("count", (currentPanel.WarningList().Count).ToString())
                                                  , new XElement("Height", new XAttribute("count", (_DefectStatisticResult.HeightWarningOver + _DefectStatisticResult.HeightWarningUnder).ToString()))
                                                  , new XElement("Volume", new XAttribute("count", (_DefectStatisticResult.VolumeWarningOver + _DefectStatisticResult.VolumeWarningUnder).ToString()))
                                                  , new XElement("Area", new XAttribute("count", (_DefectStatisticResult.AreaWarningOver + _DefectStatisticResult.AreaWarningUnder).ToString()))
                                                  )
                                   , new XElement("OPTIONAL", new XElement("COMMAND", IsWipe? "CLEANING":string.Empty))
                                   )



                    );
                root.Save(path);
                Log4.PrinterLogger.InfoFormat("Save @ {0} [ESE]", path);
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.InfoFormat("Save @ {0} Exception [ESE]", path);
                Log4.PrinterLogger.InfoFormat("{0}", e.Message);
                throw new OutputException(e.Message);
                //return false;
            }

            return(true);
        }
示例#12
0
 private void DiagnosisExecute()
 {
     Log4.PrinterLogger.Info("[A][Tool Page]Press Diagnosis button.");
     NetworkDriveWrapper.ShowNetDriveDisconnectionDialog(App.Current.MainWindow);
     if (NetworkDriveMappingChangedEvent != null)
     {
         NetworkDriveMappingChangedEvent(this, new NetworkDriveMappingChangedEventArgs(WmiDiskHelper.ExtractDiskID(NetDriveM.DriveInfo)));
     }
 }
示例#13
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            string path = netDrive + String.Format("{0:yyyyMMddHHmmss}.csv", currentPanel.InspectStartTime);

            //撰寫SPEC定義的
            //CSV format
            //Rows starting with "//" are skipped as comments.
            //Data rows are defined as below
            //Column 1: Character string which indicates Board ID(Up to 256 Char)
            //Column 2: Correction value X(float, rounded to 3 decimal places)
            //Column 3: Correction value Y(float, rounded to 3 decimal places)
            //Column 4: Correction value R(float, rounded to 3 decimal places)
            //Column 5: Total number of pads(Positive integer)
            //Column 6: Number of NG pads(Positive integer)
            //Column 7: Average area ratio(Positive integer)
            //Column 8: Average volume ratio(Positive integer)
            //Column 9: Average height(Positive integer)

            //Sample "Board ID",1.020,2.0e-2,-0.0023e3,1000,10,120,120,0

            try
            {
                if (!System.IO.File.Exists(path))
                {
                    string dir = Path.GetDirectoryName(path);
                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }
                    System.IO.File.Create(path).Close();
                }
                //Log.Info("CSV file write start.");
                using (System.IO.TextWriter tw = new StreamWriter(path))
                {
                    string line = String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}",
                                                //GetBarcode(Panel),
                                                currentPanel.Panel.PanelBarcode,
                                                _CenterOffsetResult.Dx,
                                                _CenterOffsetResult.Dy,
                                                _RotationResult.Theta,
                                                _PadHAVAvgResult.totalPads,
                                                _PadHAVAvgResult.totalNGPads,
                                                _PadHAVAvgResult.avgArea_pct,
                                                _PadHAVAvgResult.avgVolume_pct,
                                                _PadHAVAvgResult.avgHeight_pct
                                                );
                    tw.WriteLine(line);
                }
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.Error(e.Message);
                throw new OutputException(e.Message);
                //return false;
            }

            return(true);
        }
        public XElement ToXml()
        {
            XElement root = new XElement("SharedFolderSetting"
                                         , new XElement("In", IsInEnable.ToString()
                                                        , new XAttribute("DriveLetter", WmiDiskHelper.ExtractDiskID(InDriveInfo))
                                                        , new XAttribute("DriveProvider", WmiDiskHelper.ExtractProviderName(InDriveInfo))
                                                        )
                                         , new XElement("Out", IsOutEnable.ToString()
                                                        , new XAttribute("DriveLetter", WmiDiskHelper.ExtractDiskID(OutDriveInfo))
                                                        , new XAttribute("DriveProvider", WmiDiskHelper.ExtractProviderName(OutDriveInfo))
                                                        )
                                         );


            return(root);
        }
示例#15
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            var    _Dek_PrinterData = (Dek_PrinterData)file;
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            string path = netDrive + String.Format("{0:yyyyMMddHHmmss}.xml", currentPanel.InspectStartTime);

            DateTime t       = currentPanel.InspectStartTime;
            string   strTime = string.Format("{0:0000}{1:00}{2:00}{3:00}{4:00}{5:00}",
                                             t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second);

            //bool bWipe = false;//=>須補,目前寫死
            bool bPcbResult = _DefectStatisticResult.DefectNum > 0 ? true : false;//true:NG false:GOOD

            string reference = "Bottom_Left";

            if (PrinterCommonSetting.IsQuadrent1)
            {
                reference = "Bottom_Left";
            }
            else if (PrinterCommonSetting.IsQuadrent2)
            {
                reference = "Bottom_Right";
            }
            else if (PrinterCommonSetting.IsQuadrent3)
            {
                reference = "Top_Right";
            }
            else if (PrinterCommonSetting.IsQuadrent4)
            {
                reference = "Top_Left";
            }
            try
            {
                XElement root = new XElement(
                    "Data"
                    #region 原WriteMessage
                    , new XElement("Message"
                                   , new XAttribute("version", "1.0")
                                   , new XElement("Date_and_Time", strTime)
                                   )
                    #endregion
                    #region 原WriteEquipment
                    , new XElement("Equipment"
                                   , new XAttribute("version", "1.0")
                                   , new XAttribute("reference", reference)
                                   , new XElement("Name", "TRI_SPI")
                                   )
                    #endregion
                    #region 原WriteProcess
                    , new XElement("Process"
                                   , new XElement("Product_ID", _Dek_PrinterData.Product_ID)
                                   , new XElement("Panel_ID"
                                                  , new XElement("Panel", PrinterCommonSetting.MatchingBasis == UI.CommonSetting.eMatchingBasis.Barcode ? _Dek_PrinterData.Panel_ID : "NO_CODE")
                                                  )
                                   , new XElement("Batch_Count", ViewModelLocator.Atom.PrinterWindowVM.SN)
                                   , new XElement("Panel_Status", "Inspected")//固定,後可能需要改
                                   , new XElement("Inspected_Date_and_Time", strTime)
                                   , new XElement("Direction", _Dek_PrinterData.Print_Direction)
                                   , new XElement("Units"
                                                  , new XElement("Distance", _Dek_PrinterData.UnitDistance)
                                                  , new XElement("Angle", _Dek_PrinterData.UnitAngle)
                                                  , new XElement("Time", _Dek_PrinterData.UnitTime)
                                                  , new XElement("Stretch", "%")
                                                  )
                                   , new XElement("Offset_Correction"
                                                  , new XElement("X", Math.Round((_CenterOffsetResult.Dx * 0.001), 6).ToString())
                                                  , new XElement("Y", Math.Round((_CenterOffsetResult.Dy * 0.001), 6).ToString())
                                                  , new XElement("Theta"
                                                                 , new XAttribute("CoR_X", Math.Round((_RotationResult.Center.X * 0.001), 6).ToString())
                                                                 , new XAttribute("CoR_Y", Math.Round((_RotationResult.Center.Y * 0.001), 6).ToString())
                                                                 , Math.Round(_RotationResult.Theta, 6).ToString()
                                                                 )
                                                  , new XElement("Stretch", Math.Round(_StretchResult.Stretch, 6).ToString())
                                                  )

                                   , CreateFiducalElement(currentPanel)
                                   , new XElement("Warning"
                                                  , new XAttribute("TotalNum", _DefectStatisticResult.TotalTestNum)
                                                  , new XAttribute("DefectNum", _DefectStatisticResult.WarningNum)
                                                  , new XElement("Volume"
                                                                 , new XAttribute("Num", _DefectStatisticResult.VolumeWarningOver + _DefectStatisticResult.VolumeWarningUnder)
                                                                 , new XElement("High", _DefectStatisticResult.VolumeWarningOver)
                                                                 , new XElement("Low", _DefectStatisticResult.VolumeWarningUnder)
                                                                 )
                                                  , new XElement("Height"
                                                                 , new XAttribute("Num", _DefectStatisticResult.HeightWarningOver + _DefectStatisticResult.HeightWarningUnder)
                                                                 , new XAttribute("High", _DefectStatisticResult.HeightWarningOver)
                                                                 , new XAttribute("Low", _DefectStatisticResult.HeightWarningUnder)
                                                                 )
                                                  , new XElement("Area"
                                                                 , new XAttribute("Num", _DefectStatisticResult.AreaWarningOver + _DefectStatisticResult.AreaWarningUnder)
                                                                 , new XElement("High", _DefectStatisticResult.AreaWarningOver)
                                                                 , new XElement("Low", _DefectStatisticResult.AreaWarningUnder)
                                                                 )
                                                  , new XElement("Bridge", "0")
                                                  , new XElement("NoPaste", "0")
                                                  )
                                   , new XElement("Alarm"
                                                  , new XAttribute("TotalNum", _DefectStatisticResult.TotalTestNum)
                                                  , new XAttribute("DefectNum", _DefectStatisticResult.DefectNum)
                                                  , new XElement("Volume"
                                                                 , new XAttribute("Num", _DefectStatisticResult.VolumeDefectOver + _DefectStatisticResult.VolumeDefectUnder)
                                                                 , new XElement("High", _DefectStatisticResult.VolumeDefectOver)
                                                                 , new XElement("Low", _DefectStatisticResult.VolumeDefectUnder)
                                                                 )
                                                  , new XElement("Height"
                                                                 , new XAttribute("Num", _DefectStatisticResult.HeightDefectOver + _DefectStatisticResult.HeightDefectUnder)
                                                                 , new XElement("High", _DefectStatisticResult.HeightDefectOver)
                                                                 , new XElement("Low", _DefectStatisticResult.HeightDefectUnder)
                                                                 )
                                                  , new XElement("Area"
                                                                 , new XAttribute("Num", _DefectStatisticResult.AreaDefectOver + _DefectStatisticResult.AreaDefectUnder)
                                                                 , new XElement("High", _DefectStatisticResult.AreaDefectOver)
                                                                 , new XElement("Low", _DefectStatisticResult.AreaDefectUnder)
                                                                 )
                                                  , new XElement("Bridge", _DefectStatisticResult.DefectNum)
                                                  , new XElement("NoPaste", _DefectStatisticResult.NoPasteDefect)
                                                  )
                                   )
                    #endregion
                    #region 原WriteCommand

                    /*
                     * 缺Wipe的演算法
                     */
                    , CreateCmdElement()
                    #endregion

                    );
                root.Save(path);
                Log4.PrinterLogger.InfoFormat("Save @ {0} [Dek]", path);
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.InfoFormat("Save @ {0} Exception [Dek]", path);
                Log4.PrinterLogger.InfoFormat("{0}", e.Message);
                throw new OutputException(e.Message);
                //return false;
            }
            return(true);
        }
示例#16
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            var    _Desen_PrinterData = (Desen_PrinterData)file;
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            string path = netDrive + String.Format("{0:yyyyMMddHHmmss}.xml", currentPanel.InspectStartTime);

            if ((Directory.Exists(path)) == false)
            {
                Directory.CreateDirectory(System.IO.Path.GetDirectoryName(path));
            }


            //原本:

            /*
             *  <SpiData>
             *  WriteBasicSection
             *  WriteUnitSection
             *  WriteDirection
             *  WriteFidMark
             *  WriteCorrection
             *  WriteWipe
             *
             */
            try
            {
                DateTime t = currentPanel.InspectStartTime;
                string   sInspectStartTime = string.Format("{0:0000}-{1:00}-{2:00}T{3:00}:{4:00}:{5:00}.{6:00}",
                                                           t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second, t.Millisecond);



                XElement root = new XElement("SpiData",
                                             //WriteBasicSection
                                             new XElement("ModelName", currentPanel.Panel.ModelName),
                                             new XElement("InspectTime", sInspectStartTime),
                                             new XElement("SN", _Desen_PrinterData.PanelSN),
                                             new XElement("Barcode", _Desen_PrinterData.PanelBarcode),
                                             //WriteUnitSection
                                             new XElement("Units",
                                                          new XElement("Distance", _Desen_PrinterData.UnitThickness),
                                                          new XElement("Angle", "Degree"), //"Degree":預設
                                                          new XElement("Stretch", "%")     //%預設
                                                          ),
                                             new XElement("Direction", _Desen_PrinterData.Direction),
                                             //WriteFidMark
                                             GreateFidMarkElement(currentPanel),
                                             //WriteCorrection
                                             new XElement("Correction",
                                                          new XAttribute("RotCx", Math.Round((_RotationResult.Center.X * 0.001), 6).ToString()),
                                                          new XAttribute("RotCy", Math.Round((_RotationResult.Center.Y * 0.001), 6).ToString()),
                                                          new XElement("X", Math.Round((_CenterOffsetResult.Dx * 0.001), 6).ToString()),
                                                          new XElement("Y", Math.Round((_CenterOffsetResult.Dy * 0.001), 6).ToString()),
                                                          new XElement("Theta", Math.Round((_RotationResult.Theta * 0.001), 6).ToString()),
                                                          new XElement("Stretch", Math.Round(_StretchResult.Stretch, 6).ToString())
                                                          ),
                                             //WriteWipe
                                             new XElement("Wipe", _WipeReason == eWipeStencilReason.NoNeedToWipe ? false : true)
                                             );
                root.Save(path);
                Log4.PrinterLogger.InfoFormat("Save @ {0} [Desen]", path);
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.InfoFormat("Save @ {0} Exception [Desen]", path);
                Log4.PrinterLogger.InfoFormat("{0}", e.Message);
                throw new OutputException(e.Message);
                //return false;
            }


            return(true);
        }
示例#17
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            var    _Ekra_PrinterData = (Ekra_PrinterData)file;
            string netDrive;

            if (!PrinterSFSetting.IsOutEnable)
            {
                return(false);
            }
            else
            {
                netDrive = WmiDiskHelper.ExtractDiskID(PrinterSFSetting.OutDriveInfo) + @"\";//Disk mapping;
            }
            string path = netDrive + String.Format("{0:yyyyMMddHHmmss}.xml", currentPanel.InspectStartTime);

            DateTime t       = currentPanel.InspectStartTime;
            string   strTime = string.Format("{0:0000}-{1:00}-{2:00}T{3:00}:{4:00}:{5:00}.{6:00}",
                                             t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second, t.Millisecond);
            bool bByPass    = false;                                              //=>用在PanelStatus(原) 是使用DefectCount來判斷,初始是NonInspected
            bool bWipe      = _WipeReason == eWipeStencilReason.NoNeedToWipe? false:true;
            bool bPcbResult = _DefectStatisticResult.DefectNum > 0 ? true: false; //true:NG false:GOOD

            try
            {
                XElement root = new XElement(
                    "FeedbackInspResult",
                    new XElement("Message" //原WriteMessage
                                 , new XElement("DateAndTime", strTime)
                                 ),
                    new XElement("Machine" //原WriteMachine
                                 , new XElement("Name", "SPI")
                                 , new XElement("Reference", _Ekra_PrinterData.Reference)
                                 ),
                    new XElement("Process"                                                                                                                                                              //原WriteProcess
                                 , new XElement("ProductId", currentPanel.Panel.ModelName)
                                 , new XElement("PanelId", PrinterCommonSetting.MatchingBasis == UI.CommonSetting.eMatchingBasis.Sequence ? _Ekra_PrinterData.PanelId : _Ekra_PrinterData.PanelBarcode) //看情況選SN或barcode
                                 , new XElement("PanelStatus", /*By pass mode*/ bByPass ? "NonInspected" : "Inspected")
                                 , new XElement("Unints"
                                                , new XElement("Distance", _Ekra_PrinterData.UnitsDistance)
                                                , new XElement("Angle", _Ekra_PrinterData.UnitsAngle)
                                                , new XElement("Time", _Ekra_PrinterData.UnitsTime)
                                                , new XElement("Stretch", "%")              //SPI是百分比
                                                )
                                 , new XElement("CorrectionFeedback"
                                                //原WriteFiducials
                                                , new XElement("Fiducials"
                                                               , new XAttribute("Count", _Ekra_PrinterData.EkraFMs.Count)
                                                               , CreateFiducails(_Ekra_PrinterData, _EkraFiducailOffsetResult)                      //WriteFiducail
                                                               )
                                                , new XElement("Stretch", _StretchResult.Stretch)
                                                , new XElement("PrinterSqueegeeDir", _Ekra_PrinterData.PrintDirection)
                                                , new XElement("SpiSqueegeeDir", _Ekra_PrinterData.PrintDirection)              //原作吃一樣資料,來自Printer
                                                )

                                 , new XElement("Defect"        //原WirteDefectStatistic
                                                , new XElement("DefectNum", _DefectStatisticResult.DefectNum)
                                                , new XElement("TotalNum", _DefectStatisticResult.TotalTestNum)
                                                , new XElement("Volume"
                                                               , new XAttribute("Num", (_DefectStatisticResult.VolumeDefectOver + _DefectStatisticResult.VolumeDefectUnder).ToString())
                                                               , new XElement("High", _DefectStatisticResult.VolumeDefectOver)
                                                               , new XElement("Low", _DefectStatisticResult.VolumeDefectUnder)
                                                               )
                                                , new XElement("Height"
                                                               , new XAttribute("Num", (_DefectStatisticResult.HeightDefectOver + _DefectStatisticResult.HeightDefectUnder).ToString())
                                                               , new XElement("High", _DefectStatisticResult.HeightDefectOver)
                                                               , new XElement("Low", _DefectStatisticResult.HeightDefectUnder)
                                                               )
                                                , new XElement("Area"
                                                               , new XAttribute("Num", (_DefectStatisticResult.AreaDefectOver + _DefectStatisticResult.AreaDefectUnder).ToString())
                                                               , new XElement("High", _DefectStatisticResult.AreaDefectOver)
                                                               , new XElement("Low", _DefectStatisticResult.AreaDefectUnder)
                                                               )
                                                , new XElement("Bridge", _DefectStatisticResult.BridgeDefect)
                                                )
                                 , new XElement("Command", bWipe ? "Cleaning" : "NoUse")
                                 , new XElement("PcbResult", bPcbResult?"NG":"GOOD")       //由DefectCount算 "GOOD" and "NG"
                                 )
                    );
                root.Save(path);
                Log4.PrinterLogger.InfoFormat("Save @ {0} [Ekra]", path);
            }
            catch (Exception e)
            {
                Log4.PrinterLogger.InfoFormat("Save @ {0} Exception [Ekra]", path);
                Log4.PrinterLogger.InfoFormat("{0}", e.Message);
                throw new OutputException(e.Message);
                //return false;
            }
            return(true);
        }