spc-kiosk-pb/Window/WinBasic/frmPGMDownLoad.cs
2019-06-16 14:12:09 +09:00

2317 lines
120 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Collections;
using System.IO;
using System.Diagnostics;
using System.Net;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 프로그램 다운로드
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Win
{
public partial class frmPGMDownLoad : Form
{
#region Variable
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
private TranStatus m_cTrnStatus = new TranStatus(); // 거래정보 참조
private DeviceStatus m_cDevStatus = new DeviceStatus(); // 기기정보 참조
private IDataProcessUs m_cDataService = null;
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
private ISvr2Tran m_cSvr2Tran = null;
private INetworkFTP m_cNetworkFTP = null;
private IDatabaseSQL m_cSqlDbService = null; // 데이터베이스 관리
private IICReaderUs m_cDeviceICReader = null; // IC 리더기
private IDeviceUpdate m_SignPadUpdate = null; // 서명패드 업데이트
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
private IICReaderUpdate m_ICReaderUpdate = null; // IC 리더기 업데이트
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
private IWatcherBack m_cBackgroundDown = null;
private Hashtable m_hRecvData; // 프로그램 업데이트 FTP 서버 정보
private FluentFTP.FtpClient Fcl = null;
/// <summary>
/// 프로그램 업데이트 FTP 서버정보
/// </summary>
public Hashtable SethRecvData { set { this.m_hRecvData = value; } }
private string[] m_sRecvData; // 프로그램 업데이트 목록
/// <summary>
/// 프로그램 업데이트 목록
/// </summary>
public string[] SetRecvData { set { this.m_sRecvData = value; } }
private string m_sPosMenuKeyIn;
public string PosMenuKeyIn { set { m_sPosMenuKeyIn = value; } get { return m_sPosMenuKeyIn; } }
private bool bNotDoubleClik = false; // 더블 클릭 방지용
private string m_TagImgFileName = "TagImg_{0}_0{1}.png"; // 이미지 파일 이름
string[] sSignPadFile = null;
string m_sFTPDownloadMode = "0"; // FTP 다운로드 모드 (0:Web, 1:TCP/IP)
/// <summary>
/// 자동/수동 모드
/// </summary>
private string m_sManualMode;
public string ManualMode { set { m_sManualMode = value; } get { return m_sManualMode; } }
/// <summary>
/// 강제종료
/// </summary>
private bool m_bStop = false;
/// <summary>
/// 진행중
/// </summary>
private bool m_bStart = false;
/// <summary>
/// FTP Download 상태
/// </summary>
private FTP.DelegateFTP delegateFTP;
/// <summary>
/// Fluent FTP Download 상태
/// </summary>
private FluentFTP.FtpClient.DelegateFTP delegateFluentFTP;
private string m_DownLoadMsg = "";
private string m_PGMUpdateMsg = "";
private DataTable m_dtSignPad = new DataTable();
private string m_cUpDateMode = "";
#endregion
#region &
/// <summary>
/// 생성자
/// </summary>
public frmPGMDownLoad()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보
m_cDevStatus = (DeviceStatus)StateObject.DEVICE; // POS 주변기기정보
m_cDataService = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE);
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
m_cSvr2Tran = (ISvr2Tran)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SVR2TRAN);
m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL);
m_cNetworkFTP = (INetworkFTP)sManager.InitServiceInstance(ServiceLists.AGENT_NETWORK.DLL, ServiceLists.AGENT_NETWORK.NETWORK_FTP);
m_SignPadUpdate = (IDeviceUpdate)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.SIGNPAD_UPDATE);
m_cDeviceICReader = (IICReaderUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_ICREADER);
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
m_ICReaderUpdate = (IICReaderUpdate)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.ICREADER_UPDATE);
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
// 백그라운드 다운 데몬 기동
m_cBackgroundDown = (IWatcherBack)sManager.InitServiceInstance(ServiceLists.AGENT_BACKGROUND_DOWN.DLL, ServiceLists.AGENT_BACKGROUND_DOWN.BACKGROUND_DOWN_MAIN);
delegateFTP = new FTP.DelegateFTP(OnDownloadProgressChanged);
delegateFluentFTP = new FluentFTP.FtpClient.DelegateFTP(OnDownloadProgressChanged);
}
/// <summary>
/// 폼로드
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmPGMDownLoad_Load(object sender, EventArgs e)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
InitControl();
// FTP 다운로드 모드 조회
m_sFTPDownloadMode = GetFTPDownloadMode();
Fcl = new FluentFTP.FtpClient();
FluentFTP.FtpClient.SetEventHandle(delegateFluentFTP);
FTP.SetEventHandle(delegateFTP);
}
/// <summary>
/// 폼클로즈
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmPGMDownLoad_FormClosing(object sender, FormClosingEventArgs e)
{
FTP.ReleaseEventHandle();
FluentFTP.FtpClient.ReleaseEventHandle();
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
}
/// <summary>
/// 폼엑티브
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmPGMDownLoad_Activated(object sender, EventArgs e)
{
//this.TopMost = false;
}
/// <summary>
/// 폼디엑티브
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmPGMDownLoad_Deactivate(object sender, EventArgs e)
{
}
#endregion &
#region
/// <summary>
/// 폼 컨트롤 초기화
/// </summary>
private void InitControl()
{
try
{
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
FormManager.SetTextBoxGlobalInfo(this, m_cPosStatus.Global.m_stCultureMaster.nGroupingDigits, m_cPosStatus.Global.m_stCultureMaster.strGroupingSymbol
, m_cPosStatus.Global.m_stCultureMaster.nDecimalDigits, m_cPosStatus.Global.m_stCultureMaster.strDecimalSymbol);
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
m_bStop = false;
m_bStart = false;
bNotDoubleClik = false;
lblCount.Visible = false;
pbWork.Visible = false;
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0447);
if (lblTitle.Text.Trim() == "") lblTitle.Text = "Program Update";
lblUpdateInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0455);
if (lblUpdateInfo.Text.Trim() == "") lblUpdateInfo.Text = "Checking for program updates . . .\n Please wait a moment.";
m_DownLoadMsg = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0440);
if (m_DownLoadMsg.Trim() == "") m_DownLoadMsg = "File Downloading . . . ({0}%) ";
m_PGMUpdateMsg = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0450);
if (m_PGMUpdateMsg.Trim() == "") m_PGMUpdateMsg = "Updating program . . . ({0}%) ";
if (m_sManualMode != "K")
{
// 이미지 전체 재수신 여부
CmMessage m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
string sIMAGE_ALL_REDOWN_YN = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "IMAGE_ALL_REDOWN_YN"));
string sMstDownDate = CmUtil.MidH(CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "MstDownDate")), 0, 4);
if (CmUtil.DoubleParse(sMstDownDate) <= 2010 && sIMAGE_ALL_REDOWN_YN != "0")
m_cUpDateMode = PosConst.PGM_UPDATE_DOWN_DIV.TOTAL; // 최초시
else if (sIMAGE_ALL_REDOWN_YN == "1")
m_cUpDateMode = PosConst.PGM_UPDATE_DOWN_DIV.TOTAL; // 수동 전체 이미지 수신 요청시
else
m_cUpDateMode = PosConst.PGM_UPDATE_DOWN_DIV.ALL;
}
if (m_sManualMode == "K")
{
m_cUpDateMode = PosConst.PGM_UPDATE_DOWN_DIV.UPDATE;
if (m_cPosStatus.Sale.ScreenSizeUser == 1024)
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE);
FormManager.SetControlSize(picBack, 0, 0, 1024, 696);
FormManager.SetControlSize(this, 0, 50, picBack.Size.Width, picBack.Size.Height);
FormManager.SetControlSize(this.lblTitle, 16, 1, 950, 50);
FormManager.SetControlSize(this.btnExit, 965, 1, 58, 50);
FormManager.SetControlSize(this.lblCount, 84, 579, 175, 14);
FormManager.SetControlSize(this.pbWork, 87, 603, 842, 40);
FormManager.SetControlSize(this.lblUpdateInfo, 112, 503, 800, 70);
FormManager.SetControlSize(this.pnlFunc, 112, 98, 892, 361);
}
else
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
FormManager.SetControlSize(picBack, 0, 0, 800, 600);
FormManager.SetControlSize(this, 0, 0, picBack.Size.Width, picBack.Size.Height);
FormManager.SetControlSize(this.lblTitle, 16, 1, 728, 50);
FormManager.SetControlSize(this.btnExit, 741, 1, 58, 50);
FormManager.SetControlSize(this.lblCount, 50, 519, 175, 14);
FormManager.SetControlSize(this.pbWork, 53, 543, 690, 40);
FormManager.SetControlSize(this.lblUpdateInfo, 0, 443, 800, 70);
FormManager.SetControlSize(this.pnlFunc, 0, 98, 892, 361);
}
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
// 수동모드
this.TopMost = false;
lblUpdateInfo.Visible = false;
btnExit.Visible = true;
pnlFunc.Visible = true;
//picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE);
btnPGM.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0468);
btnRcptLogo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0988);
btnContents.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0941);
btnCustomer.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0942);
btniTem.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0943);
btnCampaign.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0944);
btnTestMode.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0945);
btnMasterAll.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0787);
btnMasterUpdate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0788);
btnCampaignMasterAll.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1026);
btnSignUpdateFile.Visible = false;
if (m_cDevStatus.SignPad.UseYn == true)
{
btnSignUpdateFile.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0529);
btnSignUpdateFile.Visible = true;
}
btnICReaderUpdate.Visible = false;
if (m_cDevStatus.ICReader.UseYn == true)
{
btnICReaderUpdate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1019);
btnICReaderUpdate.Visible = true;
}
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
//GetTagImg(); // 상단 이미지
GetBtnImg(); // 버튼 이미지
btnMasterAll.Visible = true;
btnMasterUpdate.Visible = true;
btnCampaignMasterAll.Visible = true;
if (m_cPosStatus.Base.PosCommunicationType != PosConst.MAIN_POS_DIV.MAIN_POS)
{
// Main Pos가 아닌경우 마스터 수신 불가
btnMasterAll.Visible = false;
btnMasterUpdate.Visible = false;
btnCampaignMasterAll.Visible = false;
}
tmStart.Enabled = false;
}
else
{
// 자동모드
lblUpdateInfo.Visible = true;
this.Size = new Size(788, 212);
lblUpdateInfo.Visible = true;
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MESSAGE_BOX);
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
pnlFunc.Visible = false;
FormManager.SetControlSize(lblTitle, 16, 1, 762, 50);
FormManager.SetControlSize(lblCount, 18, 138, 170, 14);
FormManager.SetControlSize(pbWork, 21, 161, 743, 40);
FormManager.SetControlSize(lblUpdateInfo, 100, 70, 588, 75);
this.TopMost = true;
btnExit.Visible = false;
tmStart.Enabled = true;
}
//this.StartPosition = FormStartPosition.CenterParent;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
private void btnExit_Click(object sender, EventArgs e)
{
string sMsg = "";
try
{
if (m_bStart != false)
{
sMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0277);
if (sMsg.Trim() == "") sMsg = "The POS program is being received. \n" + "Are you sure you want to force it?";
if (WinManager.QuestionMessage(sMsg) != true) return;
}
m_bStop = true;
if (m_sManualMode == "K" && m_cPosStatus.Sale.SysShutDown.Trim() != "")
{
sMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0281);
if (sMsg.Trim() == "") sMsg = "The POS program has been updated. \n" + "Restart the POS program.";
WinManager.ConfirmMessage(sMsg);
}
this.DialogResult = DialogResult.Cancel;
this.Close();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
/// <summary>
/// 프로그램 다운로드
/// </summary>
/// <returns></returns>
private string PGMDownLoad(string sDownDiv, string sFTP_IP, int iFTP_Port, string sFTP_ID, string sFTP_Pwd, string[] sRecvData)
{
string sRet = UserCom.RST_ERR;
string sApplyType = "";
string sLocalPath = BaseCom.NxDownPath;
string sGroup = "";
string sKind = "";
string sApplyDate = "";
string sApplyTime = "";
string sFilePath = "";
string sFileNm = "";
string sFileVer = "";
string sFileSeq = "";
string sDeployDate = "";
string sDeployTime = "";
string sMsg = "";
string sDeployDT = "";
string sUseYn = "";
string sBackupFile = "";
int iConnect = -1;
int iRet = -1;
try
{
#region
DriveInfo drv = new DriveInfo(CmUtil.MidH(BaseCom.NxDownPath, 0, 1));
if (drv.TotalFreeSpace < 10000000)
{
sMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0659);
if (sMsg.Trim() == "") { sMsg = "There is not enough disk space. Please check."; }
WinManager.ErrorMessage(sMsg);
return sRet;
}
#endregion
pbWork.Value = 0;
pbWork.Minimum = 0;
CmUtil.CreateDirectory(sLocalPath);
if (sRecvData.Length > 0)
{
// 프로그램 다운로드
m_bStart = true;
// Connect
// 2019-03-26 - 1997fx11 : FTP 관련 참고
if (m_sFTPDownloadMode == "1") { iConnect = Fluent_Connect(sFTP_IP, iFTP_Port, sFTP_ID, sFTP_Pwd, 3000); } // TCP-IP 모드
else { iConnect = m_cNetworkFTP.Connect(sFTP_IP, sFTP_ID, sFTP_Pwd, 3000, iFTP_Port); } // Web 모드
if (iConnect == 0)
{
for (int iLoop = 0; iLoop < sRecvData.Length; iLoop++)
{
if (sRecvData[iLoop].Trim() == "") { continue; }
string[] aRecvData = sRecvData[iLoop].Split(new string[] { "|" }, StringSplitOptions.None);
aRecvData = sRecvData[iLoop].Split(new string[] { "|" }, StringSplitOptions.None);
sGroup = aRecvData[0].ToString(); // 그룹
sKind = sGroup + aRecvData[1].ToString(); // 배포구분 : 01:프로그램, 02:프로그램(기타), 03:객면 컨텐츠, 04:상품이미지
sApplyDate = aRecvData[3].ToString(); // 적용일자
sApplyTime = aRecvData[10].ToString(); // 적용시간
sFilePath = aRecvData[4].ToString(); // 파일위치
if (CmUtil.RightH(sFilePath, 1) != "/") sFilePath += "/";
sFileNm = aRecvData[5].ToString(); // 파일명
sFileVer = aRecvData[6].ToString(); // 파일버전
sFileSeq = aRecvData[7].ToString(); // 파일Seq
sDeployDate = aRecvData[8].ToString(); // 다운일자
sDeployTime = aRecvData[9].ToString(); // 다운시간
sDeployDT = aRecvData[11].ToString(); // 배포일자
sUseYn = "1"; // 사용유무
string[] aTempPath = sFilePath.Split(new string[] { "/" }, StringSplitOptions.None);
for (int i = 0; aTempPath.Length > i; i++)
{
if (aTempPath[i] == "nftpparis") { continue; }
}
// 이전에 받은파일이 있는지 체크
if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_50
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_60)
{
// 서명패드 백업 위치
sBackupFile = BaseCom.NxBackPath + PosConst.BACKUP_PATH.SIGNPAD;
}
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70)
{
// IC리더기 펌웨어 백업 위치
sBackupFile = BaseCom.NxBackPath + PosConst.BACKUP_PATH.ICREADER;
}
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
// 2019-05-14 - 1997fx11 : KIOSK 백업위치
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10)
{
sBackupFile = BaseCom.NxBackPath + PosConst.BACKUP_PATH.KIOSK;
}
else
{
// PGM 백업 위치
sBackupFile = BaseCom.NxBackPath + PosConst.BACKUP_PATH.PGM;
}
if (CmUtil.Exists(sBackupFile + sFileNm) != true)
{
// FTP 다운로드
CmUtil.FileDelete(sLocalPath + sFileNm);
iRet = -1;
// DownLoad
if (m_sFTPDownloadMode == "1") { iRet = Fluent_Download(sLocalPath, sFilePath, sFileNm); } // TCP-IP 모드
else
{
iRet = m_cNetworkFTP.Download(sFilePath, sLocalPath, sFileNm, ref sMsg, m_cPosStatus.Base.FtpConnType); // Web 모드
}
if (iRet != 0)
{
sApplyType = ItemConst.PGM_DOWN_STATE.DownLoad_Fail;
string sErrMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0282);
if (sErrMsg.Trim() == "") { sErrMsg = "There was an error downloading."; }
WinManager.ErrorMessage(sErrMsg + "\n" + sMsg);
}
else
{
// 다운로드만 적용
sApplyType = ItemConst.PGM_DOWN_STATE.DownLoad_OK;
}
}
else
{
// 다운로드만 적용
sApplyType = ItemConst.PGM_DOWN_STATE.DownLoad_OK;
// 백업된 파일을 다운로드 폴더에 복사
CmUtil.FileCopy(sFileNm, sBackupFile, sLocalPath, "");
}
if (m_sManualMode == "K") { aRecvData[2] = m_cPosStatus.Base.SaleDate; }
// 다운로드 이력 저장
sRet = m_cSvr2Tran.PGMUpdate_History_Isert(sKind, sFileSeq, sFileVer, sFileNm, sApplyDate, sApplyTime, sApplyType, sDeployDate, sDeployTime, sFTP_IP, iFTP_Port.ToString(), sFTP_ID, sFTP_Pwd, sFilePath, "1", sDeployDT, sUseYn);
// 수신 상태 전송
sRet = m_cSvr2Tran.PGMUpdate_Complete(sKind, sApplyType, sFileNm, sFileSeq, sFileVer, sDownDiv, sDeployDate, sDeployDT);
SetProgreeBar(lblCount, pbWork, iLoop + 1, sRecvData.Length, m_DownLoadMsg, sFileNm);
if (sApplyType == ItemConst.PGM_DOWN_STATE.DownLoad_Fail && sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20) { m_bStop = true; }
if (m_bStop == true) { break; }
}
}
//else // 2019-05-16 - 1997fx11 : Connect가 성공하지 못한 경우 강제로 Disconnect
//{
// if (m_sFTPDownloadMode == "1")
// {
// Fcl.Disconnect();
// //if (Fcl != null) { }
// }
//}
}
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
if (m_sFTPDownloadMode == "1")
Fcl.Disconnect();
else
m_cNetworkFTP.Disconnect();
}
m_bStart = false;
return sRet;
}
#endregion
#region
/// <summary>
/// 다운로드 프로그램 적용
/// </summary>
/// <returns></returns>
private string PGMUpdate_Apply(string sDownDiv)
{
string sRet = UserCom.RST_ERR;
string sApplyType = "";
int iRet = -1;
string sUnzip_RCPTLOGO_Path = BaseCom.NxImgPath + @"RCPTLOGO\";
string sUnzip_SIGNPAD_FIRMWARE_Path = BaseCom.NxDonglePath + @"FIRMWARE\";
string sUnzip_SIGNPAD_AVI_Path = BaseCom.NxDonglePath + @"AVI\";
string sUnzip_SIGNPAD_IMG_Path = BaseCom.NxDonglePath + @"IMG\";
string sUnzip_PGM_Path = BaseCom.NxDownPath + @"PGM\";
string sUnzip_IMG_Path = BaseCom.NxDownPath;
string sUnzip_CUSTOMER_Path = BaseCom.NxDownPath + @"CDP\CUSTOMER\";
// 2019-03-29 - 1997fx11 : 기존 POS 상품 경로는 삭제
//string sUnzip_ITEM_Path = BaseCom.NxDownPath + @"CDP\ITEM\";
// 2019-03-29 - 1997fx11 : Kiosk 관련 경로 추가.
string sUnzip_ITEM_Path = BaseCom.NxCDPPath; // + @"CDP\ITEM\";
string sUnzip_OPTN_Path = BaseCom.NxCDPPath; // + @"CDP\OPTN\";
string sUnzip_CAMPN_Path = BaseCom.NxCDPPath; // + @"CDP\CAMPN\";
string sUnzip_CATE_Path = BaseCom.NxCDPPath; // + @"CDP\CATE\";
string sUnzip_SCREEN_Path = BaseCom.NxCDPPath; // + @"CDP\SCREEN\";
string sUnzip_PRESENT_Path = BaseCom.NxCDPPath; // + @"CDP\PRESENT\";
string sUnzip_TAG_Path = BaseCom.NxCDPPath; // + @"CDP\TAG\";
string sUnzip_LOGO_Path = BaseCom.NxCDPPath; // + @"CDP\LOGO\";
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
string sUnzip_ICREADER_FIRMWARE_Path = BaseCom.NxDownPath + @"ICREADER\";
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
//string sDelete_CAMPAIGN_Path = BaseCom.NxDownPath + @"CDP\CAMPAIGN\";
//string sDelete_CDP_COM_Path = BaseCom.NxDownPath + @"CDP\CDP_COM\";
//string sDelete_CUSTOMER_Path = BaseCom.NxDownPath + @"CDP\CUSTOMER\";
//string sDelete_ITEM_Path = BaseCom.NxDownPath + @"CDP\ITEM\";
//string sDelete_TEST_MODE_Path = BaseCom.NxDownPath + @"CDP\TEST_MODE\";
//string sDelete_ETC_Path = BaseCom.NxDownPath + @"CDP\ETC\";
string sUnzipPath = "";
DataTable dtData = new DataTable();
string sGroup = "";
string sKind = "";
int index = 0;
string sFTP_IP = "";
int iFTP_Port = 0;
string sFTP_ID = "";
string sFTP_Pwd = "";
string sApplyDate = "";
string sApplyTime = "";
string sFilePath = "";
string sFileNm = "";
string sFileVer = "";
string sFileSeq = "";
string sDeployDate = "";
string sDeployTime = "";
string sDeployDT = "";
string sUseYn = "";
DataRow drRow = null;
bool bUnZIp = false;
try
{
// DB Connect
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
string sQuery = "";
sQuery = "";
sQuery += "SELECT * \n";
sQuery += " FROM POSMST..MST_PGM_VER_NEW \n";
sQuery += " WHERE \n";
sQuery += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n";
sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n";
sQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n";
sQuery += " AND APP_TYPE = '1' \n"; // 적용구분(1:다운완료, 2:적용완료, F:다운실패, E:적용실패)
//sQuery += " AND ISNULL(APPLY_DATE, '') <= '" + m_cPosStatus.Base.SaleDate + "'\n"; // 영업일로 하게되면 개점 이전에 적용되지 않아 서버에서 받은 시스템 일자로 조회
sQuery += " AND ISNULL(APPLY_DATE, '') + ISNULL(APPLY_TIME, '') <= '" + DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.ToString("HHmm") + "'\n"; // 영업일로 하게되면 개점 이전에 적용되지 않아 서버에서 받은 시스템 일자로 조회
//sQuery += " AND ISNULL(APPLY_DATE, '') + ISNULL(APPLY_TIME, '0000') <= '" + m_cPosStatus.Base.SaleDate + DateTime.Now.ToString("HHmm") + "'\n";
sQuery += " AND ISNULL(USE_YN, '1') = '" + PosConst.MST_USE_YN.YES + "' \n";
sQuery += " ORDER BY APPLY_DATE, APPLY_TIME, FILE_VER, FILE_SEQ, KIND \n";
sQuery = sQuery.Replace("\t", " ");
iRet = m_cSqlDbService.DBSelect(sQuery, out dtData);
if (dtData != null && dtData.Rows.Count > 0)
{
lblUpdateInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0722);
if (lblUpdateInfo.Text.Trim() == "") lblUpdateInfo.Text = "Applying program update . . .\n Please wait a moment.";
lblUpdateInfo.Refresh();
WinManager.ShowSearchMessage(lblUpdateInfo.Text, this);
foreach (DataRow dr in dtData.Rows)
{
sGroup = CmUtil.MidH(CmUtil.GetDataRowStr(dr, PosMst.MST_PGM_VER.DATA.KIND), 0, 2);
sKind = CmUtil.GetDataRowStr(dr, PosMst.MST_PGM_VER.DATA.KIND);
sFTP_IP = CmUtil.GetDataRowStr(dr, "FTP_IP");
iFTP_Port = CmUtil.IntParse(CmUtil.GetDataRowStr(dr, "FTP_PORT"));
sFTP_ID = CmUtil.GetDataRowStr(dr, "FTP_ID");
sFTP_Pwd = CmUtil.GetDataRowStr(dr, "FTP_PWD");
sApplyDate = CmUtil.GetDataRowStr(dr, "APPLY_DATE"); // 적용일자
sApplyTime = CmUtil.GetDataRowStr(dr, "APPLY_TIME"); // 적용시간
sFilePath = CmUtil.GetDataRowStr(dr, "FTP_FILEPATH"); // 파일위치
if (CmUtil.RightH(sFilePath, 1) != "/") sFilePath += "/";
sFileNm = CmUtil.GetDataRowStr(dr, "FILE_NM"); // 파일명
sFileVer = CmUtil.GetDataRowStr(dr, "FILE_VER"); // 파일버전
sFileSeq = CmUtil.GetDataRowStr(dr, "FILE_SEQ"); // 파일Seq
sDeployDate = CmUtil.GetDataRowStr(dr, "DEPLOY_DATE"); // 다운로드일자
sDeployTime = CmUtil.GetDataRowStr(dr, "DEPLOY_TIME"); // 다운로드시간
sDeployDT = CmUtil.GetDataRowStr(dr, "DEPLOY_DT"); // 배포일자
sUseYn = "1"; // 사용유무
SetProgreeBar(lblCount, pbWork, ++index, dtData.Rows.Count, m_PGMUpdateMsg, sFileNm);
if (CmUtil.IsNull(sFileNm) == true || sFileNm.Trim().Length <= 0) continue;
// 적용 폴더 선택
if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11_DIV.CUSTOMER)
{ sUnzipPath = sUnzip_CUSTOMER_Path; } // POS 이미지 (고객면)
// 2019-03-29 - 1997fx11 : 기존 POS 상품 경로는 삭제
//else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11_DIV.ITEM_IMAGE)
//{ sUnzipPath = sUnzip_ITEM_Path; } // POS 이미지 (상품)
// 2019-03-29 - 1997fx11 : Kiosk 관련 수정,추가.
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.ITEM)
{ sUnzipPath = sUnzip_ITEM_Path; }
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.OPTN)
{ sUnzipPath = sUnzip_OPTN_Path; }
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.CAMPN)
{ sUnzipPath = sUnzip_CAMPN_Path; }
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.CATE)
{ sUnzipPath = sUnzip_CATE_Path; }
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.SCREEN)
{ sUnzipPath = sUnzip_SCREEN_Path; }
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.PRESENT)
{ sUnzipPath = sUnzip_PRESENT_Path; }
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.TAG)
{ sUnzipPath = sUnzip_TAG_Path; }
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.LOGO)
{ sUnzipPath = sUnzip_LOGO_Path; }
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20)
{ sUnzipPath = sUnzip_PGM_Path; } // POS 프로그램
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30_DIV.RCPTLOGO_IMAGE)
{ sUnzipPath = sUnzip_RCPTLOGO_Path; } // 영수증 로고 이미지
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40)
{ sUnzipPath = sUnzip_SIGNPAD_FIRMWARE_Path; } // 서명패드 펌웨어
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_50)
{ sUnzipPath = sUnzip_SIGNPAD_AVI_Path; } // 서명패드 동영상
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_60)
{ sUnzipPath = sUnzip_SIGNPAD_IMG_Path; } // 서명패드 이미지
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70)
{ sUnzipPath = sUnzip_ICREADER_FIRMWARE_Path; } // IC리더기 펌웨어
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
else sUnzipPath = sUnzip_PGM_Path; // 프로그램
if (CmUtil.RightH(sFileNm, 3).ToUpper() == "ZIP")
{
// 파일 존재 여부 체크
if (File.Exists(BaseCom.NxDownPath + sFileNm) != true)
{
// 적용 상태
sApplyType = ItemConst.PGM_DOWN_STATE.Update_Fail;
// 다운로드 이력 저장
sRet = m_cSvr2Tran.PGMUpdate_History_Isert(sKind, sFileSeq, sFileVer, sFileNm, sApplyDate, sApplyTime, sApplyType, sDeployDate, sDeployTime, sFTP_IP, iFTP_Port.ToString(), sFTP_ID, sFTP_Pwd, sFilePath, "1", sDeployDT, sUseYn);
if (sRet != UserCom.RST_OK) continue;
// 수신 상태 전송
sRet = m_cSvr2Tran.PGMUpdate_Complete(sKind, sApplyType, sFileNm, sFileSeq, sFileVer, sDownDiv, sDeployDate, sDeployDT);
if (sRet != UserCom.RST_OK) continue;
continue;
}
// 압축 해제
bUnZIp = CmUtil.UnZipFile(sUnzipPath, BaseCom.NxDownPath + sFileNm);
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
// 기존
//if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30 || sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40 || sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_50 || sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_60) bUnZIp = false;
// 프로그램 재기동 안함
if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 || sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30 || sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40 || sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_50 || sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_60 || sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70) { bUnZIp = false; }
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
//#20180919 IC/MSR 폴더 삭제 후 배포받은 파일로 다시 생성해주기 start
FolderDelete_ReCreate(sGroup);
//#20180919 IC/MSR 폴더 삭제 후 배포받은 파일로 다시 생성해주기 end
// 압축 파일 BACKUP으로 이동
if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20)
{
if (!Directory.Exists(BaseCom.NxBackPath + PosConst.BACKUP_PATH.PGM))
Directory.CreateDirectory(BaseCom.NxBackPath + PosConst.BACKUP_PATH.PGM);
// PGM인 경우 차후 복구용으로 별도 위치로 이동한다.
CmUtil.FileMove(BaseCom.NxDownPath + sFileNm, BaseCom.NxBackPath + PosConst.BACKUP_PATH.PGM + sFileNm);
// POSSTART.EXE가 존재하면 BIN폴더에 덮어쓴다.
CmUtil.FileCopy("PosStart.exe", sUnzipPath, BaseCom.NxBinPath, "");
}
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_50
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_60)
{
// 차후 복구용으로 별도 위치로 이동한다.
if (!Directory.Exists(BaseCom.NxBackPath + PosConst.BACKUP_PATH.SIGNPAD))
Directory.CreateDirectory(BaseCom.NxBackPath + PosConst.BACKUP_PATH.SIGNPAD);
CmUtil.FileMove(BaseCom.NxDownPath + sFileNm, BaseCom.NxBackPath + PosConst.BACKUP_PATH.SIGNPAD + sFileNm);
}
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70)
{
// 차후 복구용으로 별도 위치로 이동한다.
if (!Directory.Exists(BaseCom.NxBackPath + PosConst.BACKUP_PATH.ICREADER))
Directory.CreateDirectory(BaseCom.NxBackPath + PosConst.BACKUP_PATH.ICREADER);
CmUtil.FileMove(BaseCom.NxDownPath + sFileNm, BaseCom.NxBackPath + PosConst.BACKUP_PATH.ICREADER + sFileNm);
}
// 2019-05-16 -1997fx11 : Kiosk용 백업경로
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10)
{
if (!Directory.Exists(BaseCom.NxBackPath + PosConst.BACKUP_PATH.KIOSK)) { Directory.CreateDirectory(BaseCom.NxBackPath + PosConst.BACKUP_PATH.KIOSK); }
CmUtil.FileMove(BaseCom.NxDownPath + sFileNm, BaseCom.NxBackPath + PosConst.BACKUP_PATH.KIOSK + sFileNm);
}
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
else
{
// 적용후 zip 파일 삭제
CmUtil.FileDelete(BaseCom.NxDownPath + sFileNm);
}
}
else
{
// 압축을 풀 대상 폴더가 존재하지 않으면 생성
if (!Directory.Exists(sUnzipPath))
Directory.CreateDirectory(sUnzipPath);
// 일반 파일이면 적용폴더로 그대로 이동
CmUtil.FileMove(BaseCom.NxDownPath + sFileNm, sUnzipPath + sFileNm);
}
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
// 기존
/*if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_50
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_60)*/
if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_50
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_60
|| sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70)
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
{
// 서명패드 적용상태 체크용 저장
dr["APP_TYPE"] = ItemConst.PGM_DOWN_STATE.Update_Fail;
DataTableCopy(dtData, ref m_dtSignPad);
}
// 적용 상태
sApplyType = ItemConst.PGM_DOWN_STATE.Update_OK;
// 다운로드 이력 저장
sRet = m_cSvr2Tran.PGMUpdate_History_Isert(sKind, sFileSeq, sFileVer, sFileNm, sApplyDate, sApplyTime, sApplyType, sDeployDate, sDeployTime, sFTP_IP, iFTP_Port.ToString(), sFTP_ID, sFTP_Pwd, sFilePath, "1", sDeployDT, sUseYn);
if (sRet != UserCom.RST_OK) continue;
// 수신 상태 전송
sRet = m_cSvr2Tran.PGMUpdate_Complete(sKind, sApplyType, sFileNm, sFileSeq, sFileVer, sDownDiv, sDeployDate, sDeployDT);
if (sRet != UserCom.RST_OK) continue;
if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20)
{
// 이전 파일 삭제
PGM_FileDelete(sKind, sFileVer, sFileSeq);
// 프로그램 버전정보 설정
SetProgramVerIni(sKind, sFileVer, sFileSeq);
}
else if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30_DIV.RCPTLOGO_IMAGE)
{
// 영수증로고 다운로드 후 영수증로고 업로드 함으로 변경
m_cPosStatus.Base.LogoUpload = PosConst.LOGO_UPLOAD_DIV.YES;
// PosConfig.INI 저장
IServiceUs cSaveConfigInfo = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.SAVE_CONFIGINFO);
cSaveConfigInfo = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.SAVE_CONFIGINFO);
cSaveConfigInfo.Execute(new string[] { PosConst.INI_FILE_NAME.PosConfig });
}
}
//if (m_sManualMode == "K")
// WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621));
if (bUnZIp == true) m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMRESTART;
}
else
{
// if (m_sManualMode == "K")
// {
// string sMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0288);
// if (sMsg.Trim() == "") sMsg = "You already have the latest version.";
// WinManager.ConfirmMessage(sMsg);
// }
sRet = UserCom.RST_OK;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
// 수신 상태 전송
sApplyType = ItemConst.PGM_DOWN_STATE.Update_Fail;
sRet = m_cSvr2Tran.PGMUpdate_Complete(sKind, sApplyType, sFileNm, sFileSeq, sFileVer, sDownDiv, sDeployDate, sDeployDT);
}
return sRet;
}
#endregion
#region ( )
/// <summary>
/// 다운로드 프로그램 삭제 (현재 버전과 이전 버전 이외 삭제)
/// </summary>
/// <returns></returns>
private string PGM_FileDelete(string sKind, string sFileVer, string sFileSeq)
{
string sRet = UserCom.RST_ERR;
string sUnzipPath = BaseCom.NxBackPath + PosConst.BACKUP_PATH.PGM;
int iRet = -1;
DataTable dtData = new DataTable();
string sFileNm = "";
try
{
// DB Connect
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource
, m_cPosStatus.Base.LocalDbCatalog
, m_cPosStatus.Base.LocalDbUserID
, m_cPosStatus.Base.LocalDbPassword);
string sQuery = "";
sQuery = "";
sQuery += "SELECT \n";
sQuery += " KIND \n";
sQuery += " , FILE_VER \n";
sQuery += " , FILE_SEQ \n";
sQuery += " , FILE_NM \n";
sQuery += "FROM POSMST..MST_PGM_VER_NEW \n";
sQuery += "WHERE \n";
sQuery += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'\n";
sQuery += "AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "'\n";
sQuery += "AND POS_NO = '" + m_cPosStatus.Base.PosNo + "'\n";
sQuery += "AND KIND = '" + sKind + "'\n";
sQuery += "AND APP_TYPE <> '1' \n"; // 적용구분(1:다운완료, 2:적용완료, F:다운실패, E:적용실패)
sQuery += "AND FILE_VER + CONVERT(VARCHAR(5), FILE_SEQ) < '" + sFileVer + sFileSeq + "'\n";
sQuery += "AND FILE_VER + CONVERT(VARCHAR(5), FILE_SEQ) NOT IN(SELECT ISNULL(MAX(FILE_VER + CONVERT(VARCHAR(5), FILE_SEQ)), 0) \n";
sQuery += " FROM POSMST..MST_PGM_VER_NEW \n";
sQuery += " WHERE \n";
sQuery += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'\n";
sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "'\n";
sQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "'\n";
sQuery += " AND KIND = '" + sKind + "'\n";
sQuery += " AND APP_TYPE <> '1' \n"; // 적용구분(1:다운완료, 2:적용완료, F:다운실패, E:적용실패)
sQuery += " AND FILE_VER + CONVERT(VARCHAR(5), FILE_SEQ) <> '" + sFileVer + sFileSeq + "'\n";
sQuery += " AND ISNULL(USE_YN, '1') = '" + PosConst.MST_USE_YN.YES + "' \n";
sQuery += " ) \n";
sQuery += " AND ISNULL(USE_YN, '1') = '" + PosConst.MST_USE_YN.YES + "' \n";
sQuery += "ORDER BY 1, 2, 3 \n";
sQuery = sQuery.Replace("\t", " ");
iRet = m_cSqlDbService.DBSelect(sQuery, out dtData);
if (dtData != null && dtData.Rows.Count > 0)
{
pbWork.Minimum = 0;
pbWork.Maximum = dtData.Rows.Count;
foreach (DataRow dr in dtData.Rows)
{
sKind = CmUtil.GetDataRowStr(dr, PosMst.MST_PGM_VER.DATA.KIND);
sFileNm = CmUtil.GetDataRowStr(dr, PosMst.MST_PGM_VER.DATA.FILE_NM);
if (sFileNm.Trim() == "") continue;
// 이전 파일 삭제
CmUtil.FileDelete(sUnzipPath + sFileNm);
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 버튼 입력 처리
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnProc_Click(object sender, EventArgs e)
{
string sRet = UserCom.RST_ERR;
string sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_ALL;
string sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_ALL_DIV.ALL_PGM;
string sSignPadKind = "";
string[] sKind_Param = new string[10];
string sMsg = "";
try
{
if (bNotDoubleClik) return;
bNotDoubleClik = true;
// 백그라운드 다운 데몬 중지
if (m_sManualMode == "K")
m_cBackgroundDown.Stop();
m_cUpDateMode = (m_sManualMode == "K" ? PosConst.PGM_UPDATE_DOWN_DIV.UPDATE : PosConst.PGM_UPDATE_DOWN_DIV.ALL);
lblCount.Text = "";
lblCount.Visible = false;
pbWork.Visible = false;
this.Update();
if (((Cosmos.UI.CsmButton)sender) == btnPGM) // POS 프로그램 다운로드
{
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20;
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20_DIV.ALL_PGM;
}
else if (((Cosmos.UI.CsmButton)sender) == btnRcptLogo) // 영수증 로고 이미지 다운로드
{
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30;
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30_DIV.RCPTLOGO_IMAGE;
}
else if (((Cosmos.UI.CsmButton)sender) == btnSignUpdateFile) // 서명패드 업데이트 파일 다운로드
{
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40;
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.ALL_PGM;
// 처리상태
m_dtSignPad.Clear();
}
else if (((Cosmos.UI.CsmButton)sender) == btnMasterAll) // 마스터 전체
{
sKind = "";
// 마스터 DB 수신
string sType = PosConst.MASTER_DOWN_OP.ALL;
WinBasic.ShowForm(new string[] { FormManager.FORM_PROGRAM_START, sType, PosConst.POS_PERIPHERAL_CHECK.NO_CHECK, m_sManualMode });
// POS 마스터 로딩
IServiceUs cLoadMstSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.LOAD_MASTER_INFO);
cLoadMstSrv.Execute(new string[] { });
if (m_sManualMode == "K")
WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621));
}
else if (((Cosmos.UI.CsmButton)sender) == btnMasterUpdate) // 마스터 변경분
{
sKind = "";
// 마스터 DB 수신
string sType = PosConst.MASTER_DOWN_OP.CHANGED;
WinBasic.ShowForm(new string[] { FormManager.FORM_PROGRAM_START, sType, PosConst.POS_PERIPHERAL_CHECK.NO_CHECK, m_sManualMode });
// POS 마스터 로딩
IServiceUs cLoadMstSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.LOAD_MASTER_INFO);
cLoadMstSrv.Execute(new string[] { });
if (m_sManualMode == "K")
WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621));
}
else if(((Cosmos.UI.CsmButton)sender) == btnCampaignMasterAll) // 마스터 캠페인-전체
{
sKind = "";
// 캠페인 마스터 수신
string sType = PosConst.MASTER_DOWN_OP.ALL_CAMPAIGN;
WinBasic.ShowForm(new string[] { FormManager.FORM_PROGRAM_START, sType, PosConst.POS_PERIPHERAL_CHECK.NO_CHECK, m_sManualMode });
// POS 마스터 로딩
IServiceUs cLoadMstSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.LOAD_MASTER_INFO);
cLoadMstSrv.Execute(new string[] { });
if (m_sManualMode == "K")
WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621));
}
else if (((Cosmos.UI.CsmButton)sender) == btnCustomer) // 고객화면 이미지 다운로드
{
//////if (m_sManualMode == "K")
//////{
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11;
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11_DIV.CUSTOMER;
//////}
//////else
//////{
////// // 이미지 전체 재수신 (자동모드이면서 PosSaleInfo의 이미지 재수신이면)
////// sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10;
////// sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.ALL_PGM;
//////}
}
else if (((Cosmos.UI.CsmButton)sender) == btniTem) // 상품 이미지 다운로드
{
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10;
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.ITEM_IMAGE;
}
else if (((Cosmos.UI.CsmButton)sender) == btnTestMode) // TEST 모드
{
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10;
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.TEST_MODE;
}
else if (((Cosmos.UI.CsmButton)sender) == btnContents) // 컨텐츠
{
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10;
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.CONTENTS;
}
else if (((Cosmos.UI.CsmButton)sender) == btnCampaign) // 캠페인
{
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10;
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.CAMPAIGN;
}
else if (((Cosmos.UI.CsmButton)sender) == btnICReaderUpdate) // IC리더기 업데이트
{
#region IC리더기
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
// 기존
/*sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70;
sKind = "";
sMsg = "";
if (m_cDevStatus.ICReader.UseYn == true)
{
this.TopMost = false;
if (m_cDeviceICReader.SetDE_DownloadFW(2, 2, 0, null, ref sMsg) != true)
{
if (sMsg.Trim() == "") sMsg = "There was an error updating the IC reader firmware.";
WinManager.ConfirmMessage(sMsg);
}
else
{
if (m_sManualMode == "K")
{
sMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621);
if (sMsg.Trim() == "") sMsg = "The download is complete.";
WinManager.ConfirmMessage(sMsg);
}
}
}*/
WinManager.ShowSearchMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0723), this);
m_dtSignPad.Clear();
sGroup = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70;
if (m_cDevStatus.ICReader.UseYn == true)
{
// IC리더기 모델 SR-440P인 경우만 펌웨어 업데이트
if (m_ICReaderUpdate.ICReaderModelCheck())
{
m_dtSignPad = new DataTable();
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70_DIV.IC_READER_01;
if (sKind.Trim() != "")
{
sRet = PGMUpdateCheck_Manual(PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_70 + sKind, m_cUpDateMode, false);
}
WinManager.HideSearchMessage(this);
if (m_dtSignPad.Rows.Count > 0)
{
if (m_sManualMode == "K")
{
lblCount.Visible = false;
pbWork.Visible = false;
}
// IC리더기 펌웨어 업데이트
frmICReaderUpdate fForm = (frmICReaderUpdate)FormManager.GetForm(FormManager.FORM_ICREADER_UPDATE);
if (fForm == null)
{
fForm = new frmICReaderUpdate();
FormManager.AddForm(FormManager.FORM_ICREADER_UPDATE, fForm);
}
fForm.SetDataTable = m_dtSignPad;
if (fForm.ShowDialog() == DialogResult.OK)
{
sRet = UserCom.RST_OK;
}
else
{
sRet = UserCom.RST_ERR;
}
// 처리상태 저장
foreach (DataRow dr in m_dtSignPad.Rows)
{
// 다운로드 이력 저장
sRet = m_cSvr2Tran.PGMUpdate_History_Isert(dr["KIND"].ToString(), dr["FILE_SEQ"].ToString(), dr["FILE_VER"].ToString(), dr["FILE_NM"].ToString(), dr["APPLY_DATE"].ToString(), dr["APPLY_TIME"].ToString(), dr["APP_TYPE"].ToString(), dr["DEPLOY_DATE"].ToString(), dr["DEPLOY_TIME"].ToString(), dr["FTP_IP"].ToString(), dr["FTP_PORT"].ToString(), dr["FTP_ID"].ToString(), dr["FTP_PWD"].ToString(), dr["FTP_FILEPATH"].ToString(), "1", dr["DEPLOY_DT"].ToString(), "1");
if (sRet != UserCom.RST_OK) continue;
// 수신 상태 전송
sRet = m_cSvr2Tran.PGMUpdate_Complete(dr["KIND"].ToString(), dr["APP_TYPE"].ToString(), dr["FILE_NM"].ToString(), dr["FILE_SEQ"].ToString(), dr["FILE_VER"].ToString(), m_cUpDateMode, dr["DEPLOY_DATE"].ToString(), dr["DEPLOY_DT"].ToString());
if (sRet != UserCom.RST_OK) continue;
}
return;
}
else
{
sRet = UserCom.RST_ERR;
}
}
}
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
#endregion
}
// 프로그램 업데이트 있는지 조회 요청후 다운로드
if (sKind.Trim() != "")
{
WinManager.ShowSearchMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0723), this);
#region
if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40 && sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.ALL_PGM)
{
if (m_cDevStatus.SignPad.UseYn == true)
{
// 서명패드일 경우 펌웨어, 동영상, 이미지를 다운 받는다.
m_dtSignPad = new DataTable();
// 서명패드 정보 조회
string sSingPadModel = "";
sKind = "";
sSignPadKind = "";
sSingPadModel = m_SignPadUpdate.SignPadModelCheck();
switch (sSingPadModel)
{
case PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_MODEL_SSP_100:
if (m_cDevStatus.ICReader.UseYn == true)
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_01;
else
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_51;
sSignPadKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_01;
break;
case PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_MODEL_SN_350P:
if (m_cDevStatus.ICReader.UseYn == true)
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_02;
else
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_52;
sSignPadKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_02;
break;
case PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_MODEL_SN_150P:
if (m_cDevStatus.ICReader.UseYn == true)
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_03;
else
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_53;
sSignPadKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_03;
break;
case PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_MODEL_SR_170P:
if (m_cDevStatus.ICReader.UseYn == true)
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_04;
else
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_54;
sSignPadKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_04;
break;
case PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_MODEL_OLTMS:
if (m_cDevStatus.ICReader.UseYn == true)
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_05;
else
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_55;
sSignPadKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_05;
break;
case PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_MODEL_OLCSP:
if (m_cDevStatus.ICReader.UseYn == true)
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_06;
else
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_56;
sSignPadKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40_DIV.SIGNPAD_06;
break;
}
if (sKind.Trim() != "")
{
sKind_Param = new string[] { PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_40 + sKind
, PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_50 + sSignPadKind
, PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_60 + sSignPadKind };
for (int i = 0; i < sKind_Param.Length; i++)
{
sRet = PGMUpdateCheck_Manual(sKind_Param[i], m_cUpDateMode, false);
}
}
WinManager.HideSearchMessage(this);
//if (m_SignPadUpdate.SignPadUpdateCnt(ref sImgFile, ref sAviFile, ref sFirmFile) > 0)
if (m_dtSignPad.Rows.Count > 0)
{
if (m_sManualMode == "K")
{
lblCount.Visible = false;
pbWork.Visible = false;
}
// 서명패드 업데이트
frmSignPadUpdate fForm = (frmSignPadUpdate)FormManager.GetForm(FormManager.FORM_SIGNPAD_UPDATE);
if (fForm == null)
{
fForm = new frmSignPadUpdate();
FormManager.AddForm(FormManager.FORM_SIGNPAD_UPDATE, fForm);
}
fForm.SetDataTable = m_dtSignPad;
if (fForm.ShowDialog() == DialogResult.OK)
{
sRet = UserCom.RST_OK;
}
else
{
sRet = UserCom.RST_ERR;
}
// 처리상태 저장
foreach (DataRow dr in m_dtSignPad.Rows)
{
// 다운로드 이력 저장
sRet = m_cSvr2Tran.PGMUpdate_History_Isert(dr["KIND"].ToString(), dr["FILE_SEQ"].ToString(), dr["FILE_VER"].ToString(), dr["FILE_NM"].ToString(), dr["APPLY_DATE"].ToString(), dr["APPLY_TIME"].ToString(), dr["APP_TYPE"].ToString(), dr["DEPLOY_DATE"].ToString(), dr["DEPLOY_TIME"].ToString(), dr["FTP_IP"].ToString(), dr["FTP_PORT"].ToString(), dr["FTP_ID"].ToString(), dr["FTP_PWD"].ToString(), dr["FTP_FILEPATH"].ToString(), "1", dr["DEPLOY_DT"].ToString(), "1");
if (sRet != UserCom.RST_OK) continue;
// 수신 상태 전송
sRet = m_cSvr2Tran.PGMUpdate_Complete(dr["KIND"].ToString(), dr["APP_TYPE"].ToString(), dr["FILE_NM"].ToString(), dr["FILE_SEQ"].ToString(), dr["FILE_VER"].ToString(), m_cUpDateMode, dr["DEPLOY_DATE"].ToString(), dr["DEPLOY_DT"].ToString());
if (sRet != UserCom.RST_OK) continue;
}
return;
}
else
{
sRet = UserCom.RST_ERR;
}
}
}
#endregion
#region
else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 && sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.ITEM_IMAGE)
{
sKind_Param = new string[] { PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + sKind
, PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11 + sKind };
for (int i = 0; i < sKind_Param.Length; i++)
{
sRet = PGMUpdateCheck_Manual(sKind_Param[i], m_cUpDateMode, false);
}
}
#endregion
//////#region 이미지 재수신요청
//////else if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 && sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.ALL_PGM)
//////{
////// sKind_Param = new string[] { PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.ITEM_IMAGE
////// , PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.CAMPAIGN
////// , PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.TEST_MODE
////// , PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_10_DIV.ITEM_IMAGE
////// , PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11_DIV.ITEM_IMAGE
////// , PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_11_DIV.CUSTOMER
////// };
////// for (int i = 0; i < sKind_Param.Length; i++)
////// {
////// sRet = PGMUpdateCheck_Manual(sKind_Param[i], "U", false);
////// }
////// if (sRet == UserCom.RST_OK)
////// {
////// // PosSaleInfo.INI 저장
////// CmMessage cmPosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
////// cmPosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("IMAGE_ALL_REDOWN_YN", "0");
////// cmPosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
////// }
//////}
//////#endregion
else
{
sRet = PGMUpdateCheck_Manual(sGroup + sKind, m_cUpDateMode, false);
}
WinManager.HideSearchMessage(this);
#region
// 전체 수신후 메시지 표시
if (sRet == UserCom.RST_OK)
{
// 영수증 이미지 로고 다운로드 후 영수증프린터에 Uploading
if (sGroup == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30 && sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_30_DIV.RCPTLOGO_IMAGE) SetRcptLogo();
if (m_sManualMode == "K")
{
lblCount.Visible = false;
pbWork.Visible = false;
sMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621);
if (sMsg.Trim() == "") sMsg = "The download is complete.";
WinManager.ConfirmMessage(sMsg);
}
}
else
{
if (m_sManualMode == "K")
{
lblCount.Visible = false;
pbWork.Visible = false;
sMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0288);
if (sMsg.Trim() == "") sMsg = "You already have the latest version.";
WinManager.ConfirmMessage(sMsg);
}
}
#endregion
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
bNotDoubleClik = false;
}
finally
{
WinManager.HideSearchMessage(this);
lblCount.Visible = false;
pbWork.Visible = false;
// 백그라운드 다운 데몬 시작
if (m_sManualMode == "K")
m_cBackgroundDown.Start();
bNotDoubleClik = false;
}
}
#endregion
#region -
/// <summary>
/// 프로그램 업데이트 있는지 조회 요청 - 수동
/// </summary>
/// <param name="sKind"></param>
/// <returns></returns>
private string PGMUpdateCheck_Manual(string sKind, string sDownDiv, bool bView)
{
string sRet = UserCom.RST_OK;
string sMsg = "";
try
{
if (m_cSvr2Tran.PGMUpdate(sKind, sDownDiv, ref m_sRecvData, ref m_hRecvData) == UserCom.RST_OK)
{
// FTP 수신
if (bView == true) WinManager.ShowSearchMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0723), this);
string sFTP_IP = m_hRecvData[Column.IQ_PGMUPDATE_RSP.DATA.FTP_IP].ToString();
int iFTP_Port = CmUtil.IntParse(m_hRecvData[Column.IQ_PGMUPDATE_RSP.DATA.FTP_PORT].ToString());
string sFTP_ID = m_hRecvData[Column.IQ_PGMUPDATE_RSP.DATA.FTP_ID].ToString();
string sFTP_Pwd = m_hRecvData[Column.IQ_PGMUPDATE_RSP.DATA.FTP_PWD].ToString();
PGMDownLoad(sDownDiv, sFTP_IP, iFTP_Port, sFTP_ID, sFTP_Pwd, m_sRecvData);
if (bView == true) WinManager.HideSearchMessage(this);
}
// 프로그램 적용
sMsg = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0722);
if (sMsg.Trim() == "") sMsg = "Applying program update.";
if (bView == true) WinManager.ShowSearchMessage(sMsg, this);
sRet = PGMUpdate_Apply(sDownDiv);
if (bView == true) WinManager.HideSearchMessage(this);
if (m_sManualMode != "K")
{
if (m_cPosStatus.Sale.SysShutDown.Trim() != "")
{
// 수동모드가 아닌경우 화면 닫기
if (sRet == UserCom.RST_OK)
{
this.DialogResult = DialogResult.OK;
}
else
{
this.DialogResult = DialogResult.Cancel;
}
this.Close();
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
sRet = UserCom.RST_ERR;
}
finally
{
if (bView == true) WinManager.HideSearchMessage(this);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 프로그램 업데이트 있는지 조회 요청
/// </summary>
/// <param name="sKind"></param>
/// <returns></returns>
private string PGMUpdateCheck(string sKind, string sDownDiv)
{
string sRet = UserCom.RST_OK;
bool bReDown = false;
try
{
sRet = m_cSvr2Tran.PGMUpdate(sKind, sDownDiv, ref m_sRecvData, ref m_hRecvData);
if (sRet != UserCom.RST_OK)
{
// 최신버전을 받을게 없을 경우 로컬버전과 서버버전 체크
CmMessage m_PosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
sKind = PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20_DIV.ALL_PGM;
sRet = m_cSvr2Tran.PGMUpdate(sKind, "U", ref m_sRecvData, ref m_hRecvData);
if (sRet== UserCom.RST_OK)
{
for (int iLoop = 0; iLoop < m_sRecvData.Length; iLoop++)
{
if (m_sRecvData[iLoop].Trim() == "") continue;
string[] aRecvData = m_sRecvData[iLoop].Split(new string[] { "|" }, StringSplitOptions.None);
if (aRecvData.Length <= 0) continue;
aRecvData = m_sRecvData[iLoop].Split(new string[] { "|" }, StringSplitOptions.None);
string sLocalVer = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "PGMVER", "ProgramVer" + aRecvData[1].Trim().ToString()));
// 서버에서 받은 최종 적용버전과 로컬적용 버전이 다른경우 프로그램 재수신
if (aRecvData[6].Trim().ToString() != sLocalVer.Trim() || sLocalVer.Trim().Length <= 0)
{
// 재수신 하도록 설정
bReDown = true;
}
else
{
// 다시 받지 않아도 되도록 삭제
m_sRecvData[iLoop] = "";
}
}
}
// bReDown이 True가 아니면 Skip
sRet = UserCom.RST_ERR;
}
if (sRet == UserCom.RST_OK || bReDown == true)
{
// FTP 수신
lblUpdateInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0723);
if (lblUpdateInfo.Text.Trim() == "") lblUpdateInfo.Text = "Downloading program updates . . .\n Please wait a moment.";
lblUpdateInfo.Refresh();
string sFTP_IP = m_hRecvData[Column.IQ_PGMUPDATE_RSP.DATA.FTP_IP].ToString();
int iFTP_Port = CmUtil.IntParse(m_hRecvData[Column.IQ_PGMUPDATE_RSP.DATA.FTP_PORT].ToString());
string sFTP_ID = m_hRecvData[Column.IQ_PGMUPDATE_RSP.DATA.FTP_ID].ToString();
string sFTP_Pwd = m_hRecvData[Column.IQ_PGMUPDATE_RSP.DATA.FTP_PWD].ToString();
PGMDownLoad(sDownDiv, sFTP_IP, iFTP_Port, sFTP_ID, sFTP_Pwd, m_sRecvData);
//WinManager.HideSearchMessage(this);
}
// 프로그램 적용
lblUpdateInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0455);
if (lblUpdateInfo.Text.Trim() == "") lblUpdateInfo.Text = "Checking for program updates . . .\n Please wait a moment.";
lblUpdateInfo.Refresh();
WinManager.ShowSearchMessage(lblUpdateInfo.Text, this);
sRet = PGMUpdate_Apply(sDownDiv);
WinManager.HideSearchMessage(this);
//#20171016 IC리더기 펌웨어 업데이트 Start, srlee
// IC리더기 펌웨어 업데이트 - 수동만 가능하도록
//btnProc_Click(btnICReaderUpdate, null);
// 2019-05-16 - 1997fx11 : 임시로 막음.
//btnProc_Click(btnICReaderUpdate, null);
//#20171016 IC리더기 펌웨어 업데이트 End, srlee
// 서명패드 업데이트
// 2019-05-16 - 1997fx11 : 임시로 막음.
//btnProc_Click(btnSignUpdateFile, null);
//////// 이미지 전체 재수신 여부 체크
//////try
//////{
////// string sIMAGE_ALL_REDOWN_YN = null;
////// CmMessage cPosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
////// sIMAGE_ALL_REDOWN_YN = CmUtil.StringNullEmpty(GetConfigInfo(cPosSaleInfo, "POSOPEN", "IMAGE_ALL_REDOWN_YN"));
////// if (sIMAGE_ALL_REDOWN_YN != "0")
////// {
////// // 이미지 전체 재수신
////// btnProc_Click(btnCustomer, null);
////// }
//////}
//////catch (Exception ex)
//////{
////// WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
////// System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
//////}
if (m_sManualMode != "K" || m_cPosStatus.Sale.SysShutDown.Trim() != "")
{
// 수동모드가 아닌경우 화면 닫기
if (sRet == UserCom.RST_OK)
{
// 이미지 전체 재수신 여부 설정
CmMessage m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
m_PosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("IMAGE_ALL_REDOWN_YN", "0");
m_PosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
this.DialogResult = DialogResult.OK;
}
else
{
this.DialogResult = DialogResult.Cancel;
}
this.Close();
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
sRet = UserCom.RST_OK;
}
finally
{
WinManager.HideSearchMessage(this);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 태크 이미지 로드
/// </summary>
private void GetTagImg()
{
try
{
string sTmpImg = "";
//bool bImg = false;
for (int iRow = 1; iRow <= 3; iRow++)
{
sTmpImg = string.Format(m_TagImgFileName, PosKey.MENU_KEY.POS_SETTING, iRow);
string sPicName = "picTabImg" + iRow.ToString();
Control[] ctrls = pnlFunc.Controls.Find(sPicName, false);
if (ctrls != null && ctrls[0] is Cosmos.UI.CsmPictureBox)
{
((Cosmos.UI.CsmPictureBox)ctrls[0]).Image = CmUtil.LoadImage(BaseCom.NxImgPath + sTmpImg);
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
/// <summary>
/// 버튼이미지 로드
/// </summary>
private void GetBtnImg()
{
try
{
// 다운로드
btnPGM.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_BASIC);
btnPGM.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_PRESS);
// 영수증 로고 이미지
btnRcptLogo.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_BASIC);
btnRcptLogo.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_PRESS);
// 서명패드 업데이트 파일
btnSignUpdateFile.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_BASIC);
btnSignUpdateFile.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_PRESS);
// IC리더기 업데이트
btnICReaderUpdate.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_BASIC);
btnICReaderUpdate.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_PRESS);
// POS 운영 이미지
btnContents.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_BASIC);
btnContents.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_PRESS);
// 고객면 이미지
btnCustomer.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_BASIC);
btnCustomer.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_PRESS);
// 상품이미지
btniTem.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_BASIC);
btniTem.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_PRESS);
// 캠페인 이미지
btnCampaign.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_BASIC);
btnCampaign.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_PRESS);
// 시험모드 이미지
btnTestMode.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_BASIC);
btnTestMode.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_PRESS);
// 마스터(전체)
btnMasterAll.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_GREEN_BASIC);
btnMasterAll.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_GREEN_PRESS);
// 마스터(변경분)
btnMasterUpdate.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_GREEN_BASIC);
btnMasterUpdate.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_GREEN_PRESS);
// 마스터(캠페인-전체)
btnCampaignMasterAll.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_GREEN_BASIC);
btnCampaignMasterAll.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_GREEN_PRESS);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
/// <summary>
/// 상태 진행바
/// </summary>
/// <param name="iMaxPercent"></param>
private void SetProgreeBar(Label lblLabel, ProgressBar pbProgreeBar, long nValue, long nMaxValue, string sMsgCD, string sFileName)
{
string sViewFileName = sFileName;
string[] sData = null;
double nPercent = 0;
try
{
if (nMaxValue > 0)
{
nPercent = CmUtil.DoubleMultiplication(CmUtil.DoubleDivision(nValue, nMaxValue), 100);
}
pbProgreeBar.Visible = true;
pbProgreeBar.Minimum = 0;
pbProgreeBar.Maximum = 100;
pbProgreeBar.Value = (int)Math.Round(nPercent, 0, MidpointRounding.AwayFromZero);
pbProgreeBar.Update();
sData = sFileName.Split(new string[] { @"/" }, StringSplitOptions.None);
if (sData.Length > 0) sViewFileName = sData[sData.Length - 1];
lblLabel.Visible = true;
lblLabel.Text = string.Format(sMsgCD + " (" + m_cPosStatus.Global.NumericToQuantity(nValue) + " / " + m_cPosStatus.Global.NumericToQuantity(nMaxValue) + ")", Math.Round(nPercent, 0, MidpointRounding.AwayFromZero).ToString()) + " >>> " + sViewFileName;
lblLabel.Update();
this.Update();
Application.DoEvents();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region FTP DownLoad ProgressBar Event
/// <summary>
/// FTP DownLoad ProgressBar Event
/// </summary>
/// <param name="sDevice"></param>
/// <param name="sData1"></param>
/// <param name="sData2"></param>
/// <param name="sData3"></param>
public void OnDownloadProgressChanged(string sFileName, long nDownSize, long nTotalSize)
{
try
{
SetProgreeBar(lblCount, pbWork, nDownSize, nTotalSize, m_DownLoadMsg, sFileName);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
/// <summary>
/// 영수증 로고 파일 관리
/// </summary>
private void SetRcptLogo()
{
try
{
if (m_cPosStatus.Base.OlePosPrinterModel != "99")
{
string sTopLogoTargetFile = BaseFrame.BaseCom.NxImgPath + @"RCPTLOGO\" + m_cPosStatus.Base.BrandDiv + "_TOP.bmp";
string sBotLogoTargetFile = BaseFrame.BaseCom.NxImgPath + @"RCPTLOGO\" + m_cPosStatus.Base.BrandDiv + "_BOT.bmp";
string sTopLogoFile = BaseFrame.BaseCom.NxImgPath + m_cPosStatus.Base.BrandDiv + "_TOP.bmp";
string sBotLogoFile = BaseFrame.BaseCom.NxImgPath + m_cPosStatus.Base.BrandDiv + "_BOT.bmp";
// 새로 다운 받은 영수증로고 이미지 폴더에서 자기 상단영수증로고를 image 폴더로 copy
if (File.Exists(sTopLogoTargetFile))
{
foreach (string file in Directory.EnumerateFiles(BaseFrame.BaseCom.NxImgPath, "??_TOP.bmp"))
{
File.Delete(file);
}
File.Copy(sTopLogoTargetFile, sTopLogoFile, true);
}
// 새로 다운 받은 영수증로고 이미지 폴더에서 자기 하단영수증로고를 image 폴더로 copy
if (File.Exists(sBotLogoTargetFile))
{
foreach (string file in Directory.EnumerateFiles(BaseFrame.BaseCom.NxImgPath, "??_BOT.bmp"))
{
File.Delete(file);
}
File.Copy(sBotLogoTargetFile, sBotLogoFile, true);
}
// 새로 다운 받은 영수증로고 이미지 폴더를 삭제
DirectoryInfo di = new DirectoryInfo(BaseFrame.BaseCom.NxImgPath + @"RCPTLOGO\");
if (di.Exists == true)
{
di.Delete(true);
}
// 로고 이미지 Printer Upload
if (m_cPosStatus.Base.LogoUpload != PosConst.LOGO_UPLOAD_DIV.NO)
{
IPosPrinterUs cPosPrinterUs = (IPosPrinterUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER);
cPosPrinterUs.OpenDevice(PosConst.OPOS_DEVICE.POSPRINTER, PosConst.OPOS_LDN.POSPRINTER);
bool bCheckPrinter = true;
//#20171212 프린터 상태 체크 여부 추가 start
//0: 체크, 1: 체크안함
//기존
/*
if (m_cPosStatus.Base.OlePosPrinterModel == PosConst.POS_DEVICE_LIST.POS_PRINTER._1_EPSON)
{
bCheckPrinter = cPosPrinterUs.CheckPrinter();
}
*/
//변경
if (m_cPosStatus.Base.OlePosPrinterModel == PosConst.POS_DEVICE_LIST.POS_PRINTER._1_EPSON &&
m_cPosStatus.Base.OlePosPrinterCheckYn == "0")
{
bCheckPrinter = cPosPrinterUs.CheckPrinter();
}
//#20171212 프린터 상태 체크 여부 추가 end
//if (cPosPrinterUs.CheckPrinter() == true)
if(bCheckPrinter == true)
{
if (cPosPrinterUs.SetLogoBmp() == true)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR
, UserCom.INFO_LEVEL
, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "BMP Logo update successed!");
// 영수증로고 수정일자 PosSaleInfo.ini 저장
IServiceUs cSaveConfigInfo = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.SAVE_CONFIGINFO);
string sRet = cSaveConfigInfo.Execute(new string[] { PosConst.INI_FILE_NAME.PosSaleInfo });
//DirectoryInfo di = new DirectoryInfo(BaseFrame.BaseCom.NxImgPath + "rcpt_logo\\");
//if (di.Exists == true)
//{
// di.Delete(true);
//}
if (m_cPosStatus.Base.LogoUpload == PosConst.LOGO_UPLOAD_DIV.YES)
{
// 영수증로고 업로드 후 영수증로고 업로드 안 함으로 변경
m_cPosStatus.Base.LogoUpload = PosConst.LOGO_UPLOAD_DIV.NO;
// PosConfig.INI 저장
cSaveConfigInfo = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.SAVE_CONFIGINFO);
cSaveConfigInfo.Execute(new string[] { PosConst.INI_FILE_NAME.PosConfig });
}
}
else
{
UserLog.WriteLogFile(UserCom.LOG_ERROR
, UserCom.INFO_LEVEL
, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "BMP Logo update failed...");
}
//cPosPrinterUs.CloseDevice();
}
cPosPrinterUs.CloseDevice();
}
else
{
// Upload 아니더라도 OPOS는 항상 Upload 후 사용
if (m_cPosStatus.Base.OlePosPrinterController == PosConst.POS_DEVICE_CONTROLLER.OPOS)
{
IPosPrinterUs cPosPrinterUs = (IPosPrinterUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER);
cPosPrinterUs.OpenDevice(PosConst.OPOS_DEVICE.POSPRINTER, PosConst.OPOS_LDN.POSPRINTER);
if (cPosPrinterUs.SetLogoBmp() == true)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR
, UserCom.INFO_LEVEL
, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "(OPOS)BMP Logo update successed!");
// 영수증로고 수정일자 PosSaleInfo.ini 저장
IServiceUs cSaveConfigInfo = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.SAVE_CONFIGINFO);
string sRet = cSaveConfigInfo.Execute(new string[] { PosConst.INI_FILE_NAME.PosSaleInfo });
}
else
{
UserLog.WriteLogFile(UserCom.LOG_ERROR
, UserCom.INFO_LEVEL
, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "(OPOS)BMP Logo update failed...");
}
}
}
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
"영수증로고Upload 실패:" + ex.Message);
}
}
#endregion
#region ini
private string SetProgramVerIni(string sKind, string sVer, string sSeq)
{
string sRet = UserCom.RST_ERR;
try
{
CmMessage cmPosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
// 프로그램 버전정보 설정
if (sKind == PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20 + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20_DIV.POS_PGM10)
{
//m_cPosStatus.Ver.ProgramVer = sVer;
//m_cPosStatus.Ver.ProgramVerSeq = sSeq;
// 프로그램 버전 INI 파일 설정
cmPosConfig.GetMessage("PGMVER").MakeMessageOverWrite("ProgramVer_Update", sVer);
cmPosConfig.GetMessage("PGMVER").MakeMessageOverWrite("ProgramVerSeq_Update", sSeq);
// 실제 적용시점 (Start)에 버전적용
}
else
{
// 프로그램 버전 INI 파일 설정
cmPosConfig.GetMessage("PGMVER").MakeMessageOverWrite("ProgramVer" + CmUtil.MidH(sKind, 2, 2), sVer);
cmPosConfig.GetMessage("PGMVER").MakeMessageOverWrite("ProgramVerSeq" + CmUtil.MidH(sKind, 2, 2), sSeq);
}
cmPosConfig.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region ini
private string GetProgramVerIni(string sKind, bool bVerOnly)
{
string sRet = "";
try
{
CmMessage cmPosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
// 프로그램 버전정보 읽기
string sProgramVer = CmUtil.StringNullEmpty(cmPosConfig.GetMessage("PGMVER").GetMessageValue("ProgramVer" + CmUtil.MidH(sKind, 2, 2)));
string sProgramVerSeq = CmUtil.StringNullEmpty(cmPosConfig.GetMessage("PGMVER").GetMessageValue("ProgramVerSeq" + CmUtil.MidH(sKind, 2, 2)));
sRet = sProgramVer + (bVerOnly == true ? sProgramVerSeq : "");
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 설정 파일 읽기
/// </summary>
/// <param name="cCfgInfo"></param>
/// <param name="sGroup"></param>
/// <param name="sValueName"></param>
/// <param name="sDefault"></param>
/// <returns></returns>
private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName, string sDefault = "")
{
try
{
string sValue = cCfgInfo.GetMessage(sGroup).GetMessageValue(sValueName);
//if (sValue == null)
if (string.IsNullOrWhiteSpace(sValue))
return sDefault;
else
return sValue;
}
catch { }
return sDefault;
}
#endregion
#region DataTable
/// <summary>
/// DataTable 복사
/// </summary>
/// <param name="sourceTable">소스 테이블</param>
/// <param name="targetTable">타겟 테이블</param>
public void DataTableCopy(DataTable sourceTable, ref DataTable targetTable)
{
try
{
if (targetTable.Rows.Count <= 0)
targetTable = sourceTable.Clone();
for (int i = 0; i < sourceTable.Rows.Count; i++)
{
object array = sourceTable.Rows[i].ItemArray.Clone();
DataRow targetRow = targetTable.NewRow();
targetRow.ItemArray = (object[])array;
targetTable.Rows.Add(targetRow);
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region TCP/IP Mode DownLaod
/// <summary>
/// Fluent_Connect
/// </summary>
/// <param name="sServerIP"></param>
/// <param name="sServerPort"></param>
/// <param name="sUserID"></param>
/// <param name="sPassword"></param>
/// <returns></returns>
private int Fluent_Connect(string sServerIP, int iServerPort, string sUserID, string sPassword, int nTimeOut)
{
bool bRet = false;
int iRet = -1;
try
{
// 접속정보 설정
Fcl.Host = sServerIP.Trim();
// 2019-05-13 - 1997fx11 : 테스트환경에서는 SFTP, but 모든 POS는 FTP를 사용하기때문에 임시로 적용.
//Fcl.Port = iServerPort;
Fcl.SslProtocols = System.Security.Authentication.SslProtocols.Default;
// 2019-05-13 - 1997fx11 : 테스트환경에서는 SFTP, but 모든 POS는 FTP를 사용하기때문에 임시로 적용.
Fcl.Credentials = new NetworkCredential(sUserID.Trim(), sPassword.Trim());
Fcl.ConnectTimeout = nTimeOut;
Fcl.ReadTimeout = nTimeOut;
Fcl.Connect();
// 접속 불가시 Skip
bRet = Fcl.IsConnected;
if (bRet == true) { iRet = 0; }
else { iRet = -1; }
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return iRet;
}
/// <summary>
/// Fluent_Download
/// </summary>
/// <param name="sLocalPath"></param>
/// <param name="sServerPath"></param>
/// <param name="sFileName"></param>
/// <returns></returns>
private int Fluent_Download(string sLocalPath, string sServerPath, string sFileName)
{
bool bRet = false;
int iRet = -1;
try
{
// 로컬 디렉토리 생성
if (Directory.Exists(sLocalPath.Trim()) != true) Directory.CreateDirectory(sLocalPath.Trim());
// 로컬 파일 삭제
if (File.Exists(sLocalPath.Trim() + @"\" + sFileName.Trim()) != true) File.Delete(sLocalPath.Trim() + @"\" + sFileName.Trim());
// 접속정보 설정
if (Fcl.IsConnected != true)
{
// 재접속
Fcl.Connect();
// 접속 불가시 Skip
if (Fcl.IsConnected != true) { return iRet; }
}
// 다운로드 진행
bRet = Fcl.DownloadFile(sLocalPath.Trim() + @"\" + sFileName.Trim(), sServerPath.Trim() + @"\" + sFileName.Trim());
if (bRet == true) iRet = 0;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return iRet;
}
/// <summary>
/// FTP 다운로드 유형 (TCP/IP) 조회
/// </summary>
/// <returns></returns>
private string GetFTPDownloadMode()
{
string sRet = "";
try
{
CmMessage cmPosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
string sFTPDownLoadTCPMode = CmUtil.StringNullEmpty(GetConfigInfo(cmPosConfig, "SERVER", "FTPDownLoadTCPMode"));
if (sFTPDownLoadTCPMode == null || sFTPDownLoadTCPMode.Length <= 0)
{
cmPosConfig.GetMessage("SERVER").MakeMessageOverWrite("FTPDownLoadTCPMode", "0");
cmPosConfig.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
sFTPDownLoadTCPMode = "0";
}
sRet = sFTPDownLoadTCPMode;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 프로그램 업데이트 있는지 조회 요청후 다운로드
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tmStart_Tick(object sender, EventArgs e)
{
string sRet = UserCom.RST_ERR;
try
{
tmStart.Enabled = false;
// 프로그램 업데이트 있는지 조회 요청후 다운로드
sRet = PGMUpdateCheck(PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_ALL + PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_ALL_DIV.ALL_PGM, m_cUpDateMode);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
//#20180919 IC/MSR 폴더 삭제 후 배포받은 파일로 다시 생성해주기 start
#region IC/MSR
private void FolderDelete_ReCreate(string sGroup)
{
try
{
// 프로그램 파일 다운로드일 때만!!
if (sGroup != PosConst.PGM_UPDATE_TYPE.POSDOWN_GROUP_20) return;
// 현재 디렉토리
DirectoryInfo dirParent = Directory.GetParent(Directory.GetCurrentDirectory());
string sTargetDirectory = "";
// IC 버전인지 MSR 버전인지 체크
CmMessage cmDeviceInfo = CmMessage.MakeMessageFromFile(dirParent.FullName + @"\INI\PosDevice.INI");
string sICReaderUseYn = cmDeviceInfo.GetMessage("ICREADER").GetMessageValue("UseFlag");
// IC 버전
if (sICReaderUseYn == "1")
{
// ic폴더 안에있는 파일 삭제
sTargetDirectory = dirParent.FullName + @"\BIN\IC\";
}
// MSR 버전
else
{
// msr폴더 안에있는 파일 삭제
sTargetDirectory = dirParent.FullName + @"\BIN\MSR\";
}
// 해당 경로의 하위파일 모두 삭제
string[] fFilePath = Directory.GetFiles(sTargetDirectory);
foreach (string fFileName in fFilePath)
{
File.Delete(fFileName);
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
ex.Message);
}
}
#endregion
//#20180919 IC/MSR 폴더 삭제 후 배포받은 파일로 다시 생성해주기 end
}
}