/// <summary> /// 저널파일 FTP 전송 /// </summary> /// <returns></returns> private bool SetFTP() { bool bReturn = false; string strFtpMsg = string.Empty; SetMsgBar(osiMsgBar04, OpenItemStatus.None, strMsg16); try { string strServer = ConfigData.Current.AppConfig.PosFTP.FtpSvrIP1; string strUser = ConfigData.Current.AppConfig.PosFTP.User; string strPass = ConfigData.Current.AppConfig.PosFTP.Pass; string strPort = ConfigData.Current.AppConfig.PosFTP.FtpComPort1; string strPath = Path.Combine( FXConsts.JOURNAL.GetFolder(), string.Format("{0}-{1}-{2}.jrn", ConfigData.Current.AppConfig.PosInfo.SaleDate, ConfigData.Current.AppConfig.PosInfo.StoreNo, ConfigData.Current.AppConfig.PosInfo.PosNo) ); FileInfo fi = new FileInfo(strPath); if (fi.Exists) { if (strServer.Length > 0 && strUser.Length > 0 && strPass.Length > 0 && strPort.Length > 0 && strPath.Length > 0) { FtpUtils ftp = new FtpUtils(strServer, strUser, strPass, 10, TypeHelper.ToInt32(strPort)); if (ftp.Login(out strFtpMsg)) { //폴더 검사 string[] arrDir = ftp.GetFileList(string.Format("{0}", ConfigData.Current.AppConfig.PosFTP.JournalPath), out bReturn, out strFtpMsg); if (bReturn) { if (arrDir.Length > 0) { string strDir = string.Format("{0}/{1}", ConfigData.Current.AppConfig.PosFTP.JournalPath, ConfigData.Current.AppConfig.PosInfo.SaleDate); bool bMake = false; foreach (string strTemp in arrDir) { if (strTemp == strDir) { bMake = true; break; } } if (bMake) { //폴더존재시 이동 bReturn = ftp.ChangeDir(strDir, out strFtpMsg); } else { bReturn = ftp.MakeDir(strDir, out strFtpMsg); } } } } if (bReturn) { for (int i = 0; i < 3; i++) { if (ftp.Upload(strPath, out strFtpMsg)) { ftp.Close(); bReturn = true; break; } } } } } else { bReturn = true; } if (!bReturn) { string[] strBtnNm = new string[1]; strBtnNm[0] = WSWD.WmallPos.FX.Shared.ConfigData.Current.SysMessage.GetMessage("00045"); //strBtnNm[1] = WSWD.WmallPos.FX.Shared.ConfigData.Current.SysMessage.GetMessage("00190"); //LogUtils.Instance.LogException(strFtpMsg); //if (ShowMessageBox(MessageDialogType.Warning, null, strMsg22, strBtnNm) == DialogResult.Yes) //{ //} ShowMessageBox(MessageDialogType.Warning, null, strMsg22, strBtnNm); #if DEBUG m_ftpFailedCount++; if (m_ftpFailedCount >= MAX_FTP_COUNT) { bReturn = true; } else { bReturn = SetFTP(); } #else bReturn = SetFTP(); #endif //else //{ // bReturn = false; // //ChildManager.ShowProgress(false); // //SetControlDisable(false); // ////화면 종료 // //this.DialogResult = DialogResult.Cancel; // //if (!_bAuto) // //{ // // //시스템 종료 // // InitiateSystemShutdown("\\\\127.0.0.1", null, 0, false, false); // //} //} } } catch (Exception ex) { LogUtils.Instance.LogException(ex); } finally { SetMsgBar(osiMsgBar04, bReturn ? OpenItemStatus.OK : OpenItemStatus.Error, bReturn ? strMsg17 : strMsg18); } return(bReturn); }
/// <summary> /// 저널파일 FTP 전송 /// </summary> /// <returns></returns> private bool SetFTP() { bool bReturn = false; string strFtpMsg = string.Empty; try { string strServer = ConfigData.Current.AppConfig.PosFTP.FtpSvrIP1; string strUser = ConfigData.Current.AppConfig.PosFTP.User; string strPass = ConfigData.Current.AppConfig.PosFTP.Pass; string strPort = ConfigData.Current.AppConfig.PosFTP.FtpComPort1; string strPath = Path.Combine( FXConsts.JOURNAL.GetFolder(), string.Format("{0}-{1}-{2}.jrn", ConfigData.Current.AppConfig.PosInfo.SaleDate, ConfigData.Current.AppConfig.PosInfo.StoreNo, ConfigData.Current.AppConfig.PosInfo.PosNo) ); FileInfo fi = new FileInfo(strPath); if (strServer.Length > 0 && strUser.Length > 0 && strPass.Length > 0 && strPort.Length > 0 && strPath.Length > 0 && fi.Exists) { FtpUtils ftp = new FtpUtils(strServer, strUser, strPass, 10, TypeHelper.ToInt32(strPort)); if (ftp.Login(out strFtpMsg)) { //폴더 검사 string[] arrDir = ftp.GetFileList("/", out bReturn, out strFtpMsg); if (bReturn) { if (arrDir.Length > 0) { string strDir = string.Format("{0}-{1}-{2}", ConfigData.Current.AppConfig.PosInfo.SaleDate, ConfigData.Current.AppConfig.PosInfo.StoreNo, ConfigData.Current.AppConfig.PosInfo.PosNo); bool bMake = false; foreach (string strTemp in arrDir) { if (strTemp == @"/" + strDir) { bMake = true; break; } } if (bMake) { //폴더존재시 이동 bReturn = ftp.ChangeDir(strDir, out strFtpMsg); } else { bReturn = ftp.MakeDir(strDir, out strFtpMsg); } } } } if (bReturn) { for (int i = 0; i < 3; i++) { if (ftp.Upload(strPath, out strFtpMsg)) { ftp.Close(); bReturn = true; break; } } } } if (!bReturn) { string[] strBtnNm = new string[2]; strBtnNm[0] = "재시도"; strBtnNm[1] = "닫기"; LogUtils.Instance.LogException(strFtpMsg); if (ShowMessageBox(MessageDialogType.Question, null, "재시도", strBtnNm) == DialogResult.Yes) { bReturn = SetFTP(); } else { //화면 종료 this.DialogResult = DialogResult.Cancel; } } } catch (Exception ex) { } finally { } return(bReturn); }