diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/SO7_Proto.cpp b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/SO7_Proto.cpp index d5c3d2f..753d8eb 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/SO7_Proto.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/SO7_Proto.cpp @@ -1889,7 +1889,7 @@ SSI_STATUS_MOTION CSO7_Proto::Load_SevenOcean_Inifile(CString cso7IniFile) //========================================================================================= SSI_STATUS_MOTION CSO7_Proto::Save_So7_Config() { - FILE* m_pOutFile; + FILE* m_pOutFile= NULL; char *outBuff = NULL; CString csAppPath; GetAppPath(csAppPath); diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log index b2065dd..8c4e2e0 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log @@ -1088,3 +1088,18 @@ Construct Cso7_Proto. Destruct Cso7_Proto. Construct Cso7_Proto. Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Release/UtilityDebug.Log b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Release/UtilityDebug.Log index 7dd97e5..90847fb 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Release/UtilityDebug.Log +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Release/UtilityDebug.Log @@ -12,3 +12,7 @@ Construct Cso7_Proto. Destruct Cso7_Proto. Construct Cso7_Proto. Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.cpp index 077afd5..d875b05 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.cpp @@ -220,7 +220,7 @@ void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceSaveLog() CString FileName; CString PathName; - FILE* m_pOutFile; + FileName=_T("LK_G_Data.txt"); CString szFilter=_T("TXT Files(*.txt)|*.txt|CSV Files(*.csv)|*.csv|ALL Files(*.*)|*.*||"); @@ -228,30 +228,42 @@ void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceSaveLog() if( fdlg.DoModal()==IDOK) { - PathName=fdlg.GetPathName(); - _wfopen_s(&m_pOutFile, PathName, _T("wt")); - if (!m_pOutFile) - { - MessageBox( _T("File name Error."), _T("Message"), MB_OK); - }; switch(fdlg.m_ofn.nFilterIndex) { case 1: - { - const char* outBuff=NULL; - CString strOutput; - m_edMSG.GetWindowText(strOutput); - outBuff=T2A(strOutput); - fprintf(m_pOutFile,"%s", outBuff); - fclose(m_pOutFile); - + { + FILE* m_pOutFile; + _wfopen_s(&m_pOutFile, PathName, _T("wt")); + if (!m_pOutFile) + { + MessageBox( _T("File name Error."), _T("Message"), MB_OK); + } + else + { + const char* outBuff=NULL; + CString strOutput; + m_edMSG.GetWindowText(strOutput); + outBuff=T2A(strOutput); + fprintf(m_pOutFile,"%s", outBuff); + fclose(m_pOutFile); + m_OutMessage=_T("[Saving successful] Data Stored into ")+PathName+_T("."); + OutputWithScroll(m_OutMessage,m_edMSG); + } break; } case 2: { - - + BOOL bSTATUS=ExportReportCSV(PathName); + if (bSTATUS) + { + m_OutMessage=_T("[Saving successful] Data Stored into ")+PathName+_T("."); + OutputWithScroll(m_OutMessage,m_edMSG); + } + else + { + MessageBox( _T("File name Error."), _T("Message"), MB_OK); + } break; } } @@ -260,6 +272,61 @@ void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceSaveLog() GetDlgItem(IDC_EDIT_TEST_KEYENCE_SETFOCUS)->SetFocus(); } +//=========================================================== +BOOL CKeyence_UtilDlg::ExportReportCSV(const CString &FilePathName) +{ + FILE* m_pOutFile=NULL; + char *outBuff = NULL; + _wfopen_s(&m_pOutFile, FilePathName, _T("wt")); + if (!m_pOutFile) + { + free(outBuff); + return FALSE; + } + else + { + //Title + for (int i=0;i<8;i++) + { + if(m_LK_G_ProNOState[i]) + { + fprintf(m_pOutFile,"NO.%d,NO.%d,NO.%d,", i,i,i); + } + } + fprintf(m_pOutFile, "\n"); + for (int i=0;i<8;i++) + { + if(m_LK_G_ProNOState[i]) + { + if (i==m_LK_G_CalibrateNO) + { + fprintf(m_pOutFile,"OUT1,OUT2,ANSWER,"); + } + else + { + fprintf(m_pOutFile,"OUT1,OUT2,AVERAGE,"); + } + } + } + //OUTPUT DATA + KeyenceReport TmpReport; + for(size_t i=0;iSetFocus(); diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.h index 66143d4..e79ec79 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.h @@ -41,6 +41,7 @@ public: void Get_LK_G_DATA(); void RunCNC(); void OutputWithScroll(const CString &strNewText,CEdit &edtOutput); + BOOL ExportReportCSV(const CString &FilePathName); afx_msg BOOL PreTranslateMessage(MSG* pMsg); afx_msg void OnBnClickedButtonInitKeyenceLaser(); afx_msg void OnTimer(UINT_PTR nIDEvent); diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo index 54b3d21..bc54acd 100644 Binary files a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo differ