spc-kiosk-pb/Window/PosMain/frmPosMainStart.cs

2599 lines
123 KiB
C#
Raw Normal View History

2019-06-16 05:12:09 +00:00
 //20180611 프린터 미출력 개선 02Printer.exe start
//O2Printer.exe 통해 프린터 출력
#define PRT_O2PRINTER // 적용시 주석 해제
//20180611 프린터 미출력 개선 02Printer.exe end
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Collections;
using System.IO;
using System.Threading;
using System.Data;
using System.Configuration;
using Microsoft.Win32;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.Win;
using System.Windows.Forms.Integration;
namespace Cosmos.Win
{
public partial class frmPosMainStart : Form
{
#region
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string strClassName, string strWindowName);
[DllImport("user32.dll", SetLastError = true)]
private static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, string lpsz2);
[DllImport("user32.dll", SetLastError = true)]
private static extern int SendMessage(int hWnd, int wMsg, int wParam, int lParam);
const int BM_CLICK = 0x00F5;
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindow(int hWnd, int wCmd);
[DllImport("user32.dll", SetLastError = true)]
private static extern int SetWindowPos(int hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
private const int SWP_SHOWWINDOW = 0x40;
private const int SWP_HIDEWINDOW = 0x80;
[DllImport("User32.dll")]
private static extern bool EnumDisplayDevices(IntPtr lpDevice, int iDevNum, ref DISPLAY_DEVICE lpDisplayDevice, int dwFlags);
[DllImport("User32.dll")]
private static extern bool EnumDisplaySettings(string devName, int modeNum, ref DEVMODE devMode);
[DllImport("user32.dll")]
private static extern int ChangeDisplaySettings(ref DEVMODE devMode, int flags);
[StructLayout(LayoutKind.Sequential)]
public struct DISPLAY_DEVICE
{
public int cb;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string DeviceName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceString;
public int StateFlags;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceID;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceKey;
public DISPLAY_DEVICE(int flags)
{
cb = 0;
StateFlags = flags;
DeviceName = new string((char)32, 32);
DeviceString = new string((char)32, 128);
DeviceID = new string((char)32, 128);
DeviceKey = new string((char)32, 128);
cb = Marshal.SizeOf(this);
}
}
//[StructLayout(LayoutKind.Sequential)]
//public struct DEVMODE
//{
//[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
//public string dmDeviceName;
//public short dmSpecVersion;
//public short dmDriverVersion;
//public short dmSize;
//public short dmDriverExtra;
//public int dmFields;
//public short dmOrientation;
//public short dmPaperSize;
//public short dmPaperLength;
//public short dmPaperWidth;
//public short dmScale;
//public short dmCopies;
//public short dmDefaultSource;
//public short dmPrintQuality;
//public short dmColor;
//public short dmDuplex;
//public short dmYResolution;
//public short dmTTOption;
//public short dmCollate;
//[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
//public string dmFormName;
//public short dmUnusedPadding;
//public short dmBitsPerPel;
//public int dmPelsWidth;
//public int dmPelsHeight;
//public int dmDisplayFlags;
//public int dmDisplayFrequency;
//}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct DEVMODE
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string dmDeviceName;
public short dmSpecVersion;
public short dmDriverVersion;
public short dmSize;
public short dmDriverExtra;
public int dmFields;
public int dmPositionX;
public int dmPositionY;
public int dmDisplayOrientation;
public int dmDisplayFixedOutput;
public short dmColor;
public short dmDuplex;
public short dmYResolution;
public short dmTTOption;
public short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string dmFormName;
public short dmLogPixels;
public short dmBitsPerPel;
public int dmPelsWidth;
public int dmPelsHeight;
public int dmDisplayFlags;
public int dmDisplayFrequency;
public int dmICMMethod;
public int dmICMIntent;
public int dmMediaType;
public int dmDitherType;
public int dmReserved1;
public int dmReserved2;
public int dmPanningWidth;
public int dmPanningHeight;
};
// constants
public const int ENUM_CURRENT_SETTINGS = -1;
public const int DMDO_DEFAULT = 0;
public const int DMDO_90 = 1;
public const int DMDO_180 = 2;
public const int DMDO_270 = 3;
public const int DMDFO_DEFAULT = 0;
public const int DMDFO_STRETCH = 1;
public const int DMDFO_CENTER = 2;
public const int CDS_UPDATEREGISTRY = 0x01;
public const int CDS_FULLSCREEN = 0x04;
/*--------------------------------------------------------------*/
/* ServiceProvider Start : Service Framework Start ( )
/*--------------------------------------------------------------*/
private static Cosmos.ServiceProvider.Activator m_ServiceProvider = new Cosmos.ServiceProvider.Activator();
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object(객체)
private PosStatus m_cPosStatus; // 기본정보 참조
private TranStatus m_cTrnStatus; // 거래정보 참조
private DeviceStatus m_cDevStatus; // 디바이스 관리
private IServiceUs m_cLoadMstSrv;
private IOCBDirect m_OCBDirect = null;
private IDeviceUpdate m_SignPadUpdate; // 서명패드 관리
protected IDataCommonUs m_cDataCommon = null;
private bool m_bChangeDisplay = false; // 해상도 강제변경여부
private bool m_bNeSetupRun = false; // 넥사크로 설치 파일 실행 여부!
private bool m_StartBrake = true; // Kiosk 시작 불가
public frmPosMainStart()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.UserPaint, true);
m_cPosStatus = (PosStatus)StateObject.POS; //POS 기본정보
m_cTrnStatus = (TranStatus)StateObject.TRAN; //POS 거래정보
m_cDevStatus = (DeviceStatus)StateObject.DEVICE; //POS 장치정보
m_cLoadMstSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.LOAD_MASTER_INFO);
m_OCBDirect = (IOCBDirect)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.OCB_DIRECT);
m_SignPadUpdate = (IDeviceUpdate)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.SIGNPAD_UPDATE);
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
}
private void frmPosMainStart_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 + "()", "");
this.Location = new Point(0, 0);
picBack.Image = ImageManager.GetImage(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM, ImageManager.INTRO_BACK);
if (picBack.Image == null)
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_BACK);
#region ,
// 환경설정 파일 읽기
IServiceUs cPgmStart = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.PROGRAM_START);
string sRet = cPgmStart.Execute(new string[] { });
// 화면 해상도 설정
if (m_cPosStatus.Sale.ScreenSizeUser == 0 || m_cPosStatus.Sale.ScreenSizeCust == 0)
{
#if KIOSKSTART_OFF
m_cPosStatus.Sale.ScreenSizeUser = 1024;
m_cPosStatus.Sale.ScreenSizeCust = 800;
#else
m_cPosStatus.Sale.ScreenSizeUser = 1920;
m_cPosStatus.Sale.ScreenSizeCust = 800;
#endif
for (int i = 0; i < Screen.AllScreens.Length; i++)
{
#if KIOSKSTART_OFF
if (Screen.AllScreens[i].Primary == true) // 캐셔화면
{
m_cPosStatus.Sale.ScreenSizeUser = (Screen.AllScreens[i].WorkingArea.Width == 800) ? 800 : 1024;
}
else
{
m_cPosStatus.Sale.ScreenSizeCust = (Screen.AllScreens[i].WorkingArea.Width == 800) ? 800 : 1024;
}
#else
if (Screen.AllScreens[i].Primary == true) // 캐셔화면
{
m_cPosStatus.Sale.ScreenSizeUser = (Screen.AllScreens[i].WorkingArea.Width == 800) ? 800 : 1920;
}
else
{
m_cPosStatus.Sale.ScreenSizeCust = (Screen.AllScreens[i].WorkingArea.Width == 800) ? 800 : 1920;
}
#endif
}
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.INFO_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "SCREEN SIZE : " + m_cPosStatus.Sale.ScreenSizeUser + " * " + m_cPosStatus.Sale.ScreenSizeCust);
}
// 물리적 화면 해상도 변경 처리(800 => 1024)
for (int i = 0; i < Screen.AllScreens.Length; i++)
{
if (Screen.AllScreens[i].Primary == true) // 캐셔화면
{
if(Screen.AllScreens[i].WorkingArea.Width == 800)
{
ChangeDisplayRate(1024); // 화면 해상도 강제 변경 처리
m_bChangeDisplay = true;
break;
}
}
}
if (m_cPosStatus.Sale.ScreenSizeUser == 800)
{
this.Size = new Size(800, 600);
picBack.Size = new Size(800, 600);
}
else
{
#if KIOSKSTART_OFF
this.Size = new Size(1024, 768);
picBack.Size = new Size(1024, 768);
#else
this.Size = new Size(1920, 1080);
picBack.Size = new Size(1920, 1080);
#endif
}
#endregion
tmrStart.Enabled = true;
}
private void frmPosMainStart_FormClosing(object sender, FormClosingEventArgs e)
{
if (m_StartBrake)
{
e.Cancel = true;
}
else
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
}
}
private void frmPosMainStart_FormClosed(object sender, FormClosedEventArgs e)
{
try
{
CmUtil.CreateDirectory(BaseCom.NxDownPath + @"CDP\");
CmUtil.CreateDirectory(BaseCom.NxDownPath + @"CDP\" + PosConst.MST_IMG_PATH.CDP_COM);
CmUtil.FileCopy(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM + m_cPosStatus.ScnMst.MainImg, BaseCom.NxDownPath + @"CDP\" + PosConst.MST_IMG_PATH.CDP_COM + ImageManager.INTRO_BACK, false);
}
catch
{
}
finally
{
Application.Exit();
}
}
#endregion
#region
private void tmrStart_Tick(object sender, EventArgs e)
{
string sRet = UserCom.RST_ERR;
try
{
tmrStart.Enabled = false;
// 프로그램 기동
PosStartProc();
if (m_cPosStatus.Sale.SysShutDown.Trim() == "")
{
CmUtil.WriteTextFile(BaseCom.NxBinPath + "PosMain.txt", "PosMain");
//TODO: Off POS 고객용 화면
#if KIOSKSTART_OFF
ICustDisplayUs m_cCustDisp = (ICustDisplayUs)sManager.InitServiceInstance(ServiceLists.ASV_CUSTDISPLAY.DLL, ServiceLists.ASV_CUSTDISPLAY.CUST_DISPLAY);
if (m_cCustDisp != null)
m_cCustDisp.StartCustDisplay(); // 고객용화면 시작
#endif
#region 01 - => Add, 2017.09.04,
// 서버 점검 데몬 기동
IWatcher cCheckOver = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_NETWORK_CHECKOVER.DLL, ServiceLists.AGENT_NETWORK_CHECKOVER.NetworkCheckOver);
cCheckOver.Start();
#endregion 01 -
#region 08 - Printer => Add, 2017.09.04,
if (m_cPosStatus.Base.OlePosPrinterController == PosConst.POS_DEVICE_CONTROLLER.RS232)
{
IPosPrinterUs cPrinterDaemon = (IPosPrinterUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER);
cPrinterDaemon.StartPrinterDaemon();
}
#endregion 08 - Printer
#if KIOSKSTART_OFF
// 캐셔 로그온
if (WinBasic.ShowForm(new string[] { FormManager.FORM_LOG_ON, PosKey.MENU_KEY.LOG_ON }) != UserCom.RST_ERR)
#else
if (true)
#endif
{
#region 01 - => Del, 2017.09.04, ,
//// 서버 점검 데몬 기동
//IWatcher cCheckOver = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_NETWORK_CHECKOVER.DLL, ServiceLists.AGENT_NETWORK_CHECKOVER.NetworkCheckOver);
//cCheckOver.Start();
#endregion 01 -
#region () Mod, 2017.04.26, KPS + KDS !! !!
// Mod, 2017.04.26, 잠바주스 KPS + KDS 동시사용 !!
//// KPS와 KDS 데몬이 동시에 가동 할 수 없다.
//if (PosMstManager.GetPosOption(POS_OPTION.OPT506) == "1" && (PosMstManager.GetPosOption(POS_OPTION.OPT027) == "1" || PosMstManager.GetPosOption(POS_OPTION.OPT507) == "1"))
//{
// // Mod, 2017.04.10, 메인/주문 POS 모두 KPS 기동
// //if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT ||
// // (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS))
// //{
// // WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0679);
// //}
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0679);
//}
//else
//{
// #region 02 - KPS 데몬 기동
// // KPS 데몬 기동 (선불 또는 후불메인 일때)
// if (PosMstManager.GetPosOption(POS_OPTION.OPT506) == "1")
// {
// // Mod, 2017.04.10, 메인/주문 POS 모두 KPS 기동
// //if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT ||
// // (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS))
// //{
// // IKPSMain cKPSMain = (IKPSMain)sManager.InitServiceInstance(ServiceLists.AGENT_KPS.DLL, ServiceLists.AGENT_KPS.KPS_MAIN);
// // cKPSMain.StartKPS();
// //}
// IKPSMain cKPSMain = (IKPSMain)sManager.InitServiceInstance(ServiceLists.AGENT_KPS.DLL, ServiceLists.AGENT_KPS.KPS_MAIN);
// cKPSMain.StartKPS();
// }
// #endregion 02 - KPS 데몬 기동
// #region 03 - KDS 데몬 기동
// // KDS 데몬 기동 (선불 또는 후불메인 일때)
// if (PosMstManager.GetPosOption(POS_OPTION.OPT027) == "1" || PosMstManager.GetPosOption(POS_OPTION.OPT507) == "1")
// {
// if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT ||
// (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS))
// {
// IWatcher cKDSMain = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_KDS.DLL, ServiceLists.AGENT_KDS.KDS_MAIN);
// cKDSMain.Start();
// }
// }
// #endregion 03 - KDS 데몬 기동
//}
#endregion
#region 02 - KPS
// KPS 데몬 기동
if (PosMstManager.GetPosOption(POS_OPTION.OPT506) == "1")
{
IKPSMain cKPSMain = (IKPSMain)sManager.InitServiceInstance(ServiceLists.AGENT_KPS.DLL, ServiceLists.AGENT_KPS.KPS_MAIN);
cKPSMain.StartKPS();
}
#endregion 02 - KPS
#region 03 - KDS
// KDS 데몬 기동
if (PosMstManager.GetPosOption(POS_OPTION.OPT027) == "1" || PosMstManager.GetPosOption(POS_OPTION.OPT507) == "1")
{
IWatcher cKDSMain = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_KDS.DLL, ServiceLists.AGENT_KDS.KDS_MAIN);
cKDSMain.Start();
}
#endregion 03 - KDS
#region 04 - -
// 저울-라벨프린터 데몬 기동
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR && m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR)
{
if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT ||
(m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS))
{
if (m_cDevStatus.Scale.UseYn == true)
{
IMeasuring cMeasuringMain = (IMeasuring)sManager.InitServiceInstance(ServiceLists.AGENT_MEASURING.DLL, ServiceLists.AGENT_MEASURING.MEASURING_MAIN);
cMeasuringMain.StartMeasuring();
}
}
}
#endregion 04 - -
#region 05 - (/)
// 백그라운드(마스터/프로그램) 다운 데몬 기동
IWatcher cBackgroundDown = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_BACKGROUND_DOWN.DLL, ServiceLists.AGENT_BACKGROUND_DOWN.BACKGROUND_DOWN_MAIN);
cBackgroundDown.Start();
#endregion 05 - (/)
#region 06 - I/F
// 외부 인터페이스 데몬 기동
if (m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_01
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_02
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_03
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_04
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_05
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_06
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_SIN_01
)
{
if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT ||
(m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS))
{
lTranInterfaceOutside cTranInterfaceOutside = (lTranInterfaceOutside)sManager.InitServiceInstance(ServiceLists.AGENT_TranInterfaceOutside.DLL, ServiceLists.AGENT_TranInterfaceOutside.TIFO_MAIN);
cTranInterfaceOutside.Start();
}
}
#endregion 06 - I/F
#region 07 -
// 중국 위쳇페인 데몬 기동(2017.06.05)
WeChatPayApprDeamon(false);
#endregion
#region 08 - Printer => Del, 2017.09.04, ,
//if (m_cPosStatus.Base.OlePosPrinterController == PosConst.POS_DEVICE_CONTROLLER.RS232)
//{
// IPosPrinterUs cPrinterDaemon = (IPosPrinterUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER);
// cPrinterDaemon.StartPrinterDaemon();
//}
#endregion 08 - Printer
#if KIOSKSTART_OFF
//메인화면 실행
frmPosMain fMain = new frmPosMain();
FormManager.AddForm(FormManager.FORM_POS_MAIN, fMain);
fMain.frmMainStart = this;
fMain.ShowDialog();
this.Top = 0;
m_StartBrake = false;
#else
//TODO: 2019-04-17 - 1997fx11 : 마감 및 개점처리
m_cDataCommon.SetSaleEndOpen();
//2019.04.24 연습모드 값 강제 변경
m_cPosStatus.Base.TrainingFlag = ItemConst.TRAINING_FLAG.TRAINING_NO;
if (m_cPosStatus.Base.OlePosNetworkStatus.Equals(UserCom.RST_OK))
{
//if (m_cPosStatus.Base.OlePosPrinterStatus.Equals(UserCom.RST_OK))
//{
//TODO:Kiosk Start
this.Hide();
var newPBWin = new SPC.Kiosk.PB.PBWindow();
newPBWin.ReaderCheck += NewPBWin_ReaderCheck;
newPBWin.RecipetRefund += NewPBWin_RecipetRefund;
newPBWin.RecipetReprint += NewPBWin_RecipetReprint;
newPBWin.ShowDialog();
newPBWin.RecipetReprint -= NewPBWin_RecipetReprint;
newPBWin.ReaderCheck -= NewPBWin_ReaderCheck;
newPBWin.RecipetRefund -= NewPBWin_RecipetRefund;
newPBWin = null;
m_StartBrake = false;
this.Show();
//}
//else
//{
// WinManager.ErrorMessage("프린터 연결 오류");
//}
}
else
{
WinManager.ErrorMessage("네트워크 연결을 확인하세요.");
}
if (m_StartBrake)
{
this.KeyPreview = true;
this.TopMost = true;
this.Focus();
this.KeyPress += FrmPosMainStart_KeyPress;
}
#endif
}
#if KIOSKSTART_OFF
if (m_cCustDisp != null)
m_cCustDisp.CloseCustDisplay(); // 고객용화면 종료
#endif
}
//프로그램 종료
PosEndProc();
}
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
{
this.Close();
}
}
private void FrmPosMainStart_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar.Equals((char)Keys.Escape))
{
m_StartBrake = false;
this.Close();
}
}
private void NewPBWin_RecipetReprint(object sender)
{
using (var RecipetReprint = new frmReJournal())
{
m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.MENU_EXECUTE;
RecipetReprint.SetCallBiz = string.Empty;
RecipetReprint.ShowDialog();
}
}
private void NewPBWin_RecipetRefund(object sender)
{
using (var RecipetRefund = new frmRefundRec())
{
m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.MENU_EXECUTE;
RecipetRefund.ShowDialog();
}
}
private void NewPBWin_ReaderCheck(object sender)
{
using (var IcReaderCheck = new frmIntegrity())
{
IcReaderCheck.SetPosMenuKey = PosKey.MENU_KEY.POS_CERTIFY_INTEGRITY;
IcReaderCheck.SetDeviceType = string.Empty;
IcReaderCheck.SetAutoMode = false;
IcReaderCheck.ShowDialog();
}
}
#endregion
#region POS
/// <summary>
/// POS 프로그램 시작 처리
/// </summary>
private bool PosStartProc()
{
string sRet = "";
try
{
#region
// 기본 정보 체크
if (m_cPosStatus.Base.CmpCd.Trim() == "" || m_cPosStatus.Base.StoreNo.Trim() == "" || m_cPosStatus.Base.PosNo.Trim() == "" || m_cPosStatus.Base.SaleDate.Trim() == "")
{
// POS 환경 설정 프로그램 강제 종료
Process[] arPosPgm = Process.GetProcessesByName("PosConfiguration");
foreach (Process pPosPgm in arPosPgm)
{
pPosPgm.Kill();
Thread.Sleep(1000);
}
// POS 환경 설정 프로그램 실행
ProcessStartInfo startInfo = new ProcessStartInfo("PosConfiguration.exe");
startInfo.WindowStyle = ProcessWindowStyle.Normal;
startInfo.CreateNoWindow = false;
Process.Start(startInfo);
m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMQUIT;
return false;
}
// 데이터베이스 생성
frmDatabaseInit fForm = new frmDatabaseInit();
fForm.PosMenuKey = "SQLDB";
fForm.ShowDialog();
#endregion
#region !
//if (VC2005RedistributableSetup() == true)
//{
// NexacroSetupEngine(true);
//}
#endregion !
#region MPS.dll(OCB) VC++ 2008
//#20171115 2008_vcredist_x86.exe 실행 기능 주석 start
//VC2008RedistributableSetup();
//#20171115 2008_vcredist_x86.exe 실행 기능 주석 end
#endregion MPS.dll(OCB) VC++ 2008
#region OPOS
// 환경설정에서 등록해주던 것을 프로그램에서 해줌(2017.07.10)
if (m_cPosStatus.Base.OlePosPrinterController == PosConst.POS_DEVICE_CONTROLLER.OPOS)
{
string defaultPosPrinter = CmUtil.GetRegistryString("HKEY_LOCAL_MACHINE", @"\SOFTWARE\OLEforRetail\ServiceOPOS\PosPrinter", "DefaultPosPrinter").Trim();
if (defaultPosPrinter.Length == 0)
{
defaultPosPrinter = "POS_PRT";
foreach (var key in PosConst.POS_DEVICE_LIST.POS_PRINTER.htSvcOPOS.Keys)
{
if (key.ToString() == m_cPosStatus.Base.OlePosPrinterModel)
{
defaultPosPrinter = PosConst.POS_DEVICE_LIST.POS_PRINTER.htSvcOPOS[key].ToString();
break;
}
}
CmUtil.SetRegistryString("HKEY_LOCAL_MACHINE", @"\SOFTWARE\OLEforRetail\ServiceOPOS\PosPrinter", "DefaultPosPrinter", defaultPosPrinter);
}
}
if(m_cPosStatus.Base.OlePosCashDrawerType == "2")
{
string defaultCashDrawer = CmUtil.GetRegistryString("HKEY_LOCAL_MACHINE", @"\SOFTWARE\OLEforRetail\ServiceOPOS\CashDrawer", "DefaultCashDrawer").Trim();
if (defaultCashDrawer.Length == 0)
{
defaultCashDrawer = string.Empty;
defaultCashDrawer = PosConst.POS_DEVICE_LIST.CASHDRAWER.SvcOPOS;
CmUtil.SetRegistryString("HKEY_LOCAL_MACHINE", @"\SOFTWARE\OLEforRetail\ServiceOPOS\CashDrawer", "DefaultCashDrawer", defaultCashDrawer);
}
}
#endregion OPOS
#region POS
// POS 기본 마스터 로드
m_cLoadMstSrv.Execute(new string[] { "BASIC_MST_LOAD" });
#if !DEVICE_MSR_VER
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
{
if( m_cDevStatus.ICReader.UseYn == false)
{
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0587) == true)
m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMRESTART;
else
m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMQUIT;
return false;
}
}
#else
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
{
if (m_cDevStatus.ICReader.UseYn == true)
{
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0588) == true)
m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMRESTART;
else
m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMQUIT;
return false;
}
}
#endif
#endregion
#region
DriveInfo drv = new DriveInfo(CmUtil.MidH(BaseCom.NxDownPath, 0, 1));
if (drv.TotalFreeSpace < 10000000)
{
string sMsg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0659);
if (sMsg.Trim() == "") sMsg = "There is not enough disk space. Please check.";
WinManager.ErrorMessage(sMsg);
}
#endregion
#region
SetEmgProgramUpdate();
#endregion
#region
if (m_cPosStatus.Base.OlePosPrinterModel != "99")
{
// 프로그램 다운로드
PosPgmUpdate();
// 프로그램 업데이트 여부 체크
if (m_cPosStatus.Sale.SysShutDown.Trim() != "") return false;
}
#endregion
//20180611 프린터 미출력 개선 02Printer.exe start
//변경
#if (PRT_O2PRINTER)
#region O2Printer.exe
//RunO2Printer(true);
#endregion O2Printer.exe
#endif
//20180611 프린터 미출력 개선 02Printer.exe end
#region
//if (SignPadFileUpdate() == true)
//{
// // 서명패드 업데이트 팝업창 표시
// WinBasic.ShowForm(new string[] { FormManager.FORM_SIGNPAD_UPDATE, "" });
//}
#endregion
#region
//string sLogoModifiedDate = "";
//if(RcptLogoUpdate(ref sLogoModifiedDate) == true)
//{
// SetRcptLogo(sLogoModifiedDate);
//}
SetRcptLogo();
#endregion
#region DB
if (m_cPosStatus.Base.OlePosPrinterModel != "99")
{
// 주변장치 체크 및 마스터 DB 수신
WinBasic.ShowForm(new string[] { FormManager.FORM_PROGRAM_START, PosConst.MASTER_DOWN_OP.CHANGED, PosConst.POS_PERIPHERAL_CHECK.CHECK, "A" });
}
// 기본마스터 재로드
var tmpPosCommunicationType = m_cPosStatus.Base.PosCommunicationType;
m_cLoadMstSrv.Execute(new string[] { "BASIC_MST_LOAD" });
if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType != tmpPosCommunicationType)
{
// 전환후 전체 마스터 수신 가능하게
CmMessage cmPosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
cmPosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("MstDownDate", m_cPosStatus.Mst.ComplexShopType == "0" ? PosConst.BEGINNING_MST_DOWN_DATE : PosConst.BEGINNING_COMPLEX_SHOP_MST_DOWN_DATE);
cmPosSaleInfo.GetMessage("CHECKOVER").MakeMessageOverWrite("MstBatchDownDate", m_cPosStatus.Mst.ComplexShopType == "0" ? PosConst.BEGINNING_MST_DOWN_DATE : PosConst.BEGINNING_COMPLEX_SHOP_MST_DOWN_DATE);
cmPosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMRESTART;
return false;
}
// 데이터베이스 연결정보 메인포스로 변경
m_cLoadMstSrv.Execute(new string[] { "CHANGE_MAINPOS_DB" });
// POS 마스터 전체 로드
m_cLoadMstSrv.Execute(new string[] { });
if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType != tmpPosCommunicationType)
{
// 로컬마스터와 메인마스터가 다르면 ...
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0678);
m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMQUIT;
return false;
}
#endregion
#region ()
//O2MSR 에서 자체적으로 (구)시리얼변환 프로그램 종료 하므로 종료할 필요 없음(2017.07.03)
//SerialMsrToEmul("1");
#endregion
#region X-CHARGE DLL
RegXChargeDll();
#endregion
#region T페이 BLE
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
{
#region
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
{
// KSN Download (IC)
if (m_cDevStatus.ICReader.UseYn == true && m_cPosStatus.Base.KSN_IC_Download.ToUpper().Trim() == "K1")
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.CERTIFICATION, PosConst.POS_CARD_READER_DEVICE_TYPE.IC_READER, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0352), "" });
// KSN Download (Signpad)
if (m_cDevStatus.SignPad.UseYn == true && m_cPosStatus.Base.KSN_SignPad_Download.ToUpper().Trim() == "K1")
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.CERTIFICATION, PosConst.POS_CARD_READER_DEVICE_TYPE.SAIGNPAD, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0383), "" });
// 무결성 검사 (IC)
if (m_cDevStatus.ICReader.UseYn == true)
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.INTEGRITY, PosConst.POS_CARD_READER_DEVICE_TYPE.IC_READER, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0351) });
}
// 서명패드 사용시
if (m_cDevStatus.SignPad.UseYn == true)
{
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
{
// 무결성 검사 (서명패드)
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.INTEGRITY, PosConst.POS_CARD_READER_DEVICE_TYPE.SAIGNPAD, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0381) });
}
// 교통카드 개시거래 진행(2017.06.12)
if (PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.MOBILECASH_ITEM, ItemConst.TR_ITEM_ID.MOBILECASH.T_MONEY, PosMst.MST_PAY_DC.DATA.USE_YN) == "1")
{
// TMoney 개시
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.OPENSTART, PosConst.POS_CARD_READER_DEVICE_TYPE.TMONEY, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0348) });
// TMoney 운영정보
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.BIZDOWNLOAD, PosConst.POS_CARD_READER_DEVICE_TYPE.TMONEY, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0349) });
}
if (PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.MOBILECASH_ITEM, ItemConst.TR_ITEM_ID.MOBILECASH.CASHBEE, PosMst.MST_PAY_DC.DATA.USE_YN) == "1")
{
// CashBee 개시
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.OPENSTART, PosConst.POS_CARD_READER_DEVICE_TYPE.CASHBEE, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0359) });
// CashBee 운영정보
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.BIZDOWNLOAD, PosConst.POS_CARD_READER_DEVICE_TYPE.CASHBEE, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0360) });
}
// PayOn SAM 등록
WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.OPENSTART, PosConst.POS_CARD_READER_DEVICE_TYPE.PAYON, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0350) });
//// TMoney 운영정보
//if (PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.MOBILECASH_ITEM, ItemConst.TR_ITEM_ID.MOBILECASH.T_MONEY, PosMst.MST_PAY_DC.DATA.USE_YN) == "1")
// WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.BIZDOWNLOAD, PosConst.POS_CARD_READER_DEVICE_TYPE.TMONEY, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0349) });
//// CashBee 운영정보
//if (PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.MOBILECASH_ITEM, ItemConst.TR_ITEM_ID.MOBILECASH.CASHBEE, PosMst.MST_PAY_DC.DATA.USE_YN) == "1")
// WinAdmin.ShowForm(new string[] { FormManager.FORM_CERTIFY_INTEGRITY_THREAD, PosConst.SCFBA_BIZ_TYPE.BIZDOWNLOAD, PosConst.POS_CARD_READER_DEVICE_TYPE.CASHBEE, PosConst.SCFBA_PROC_TYPE.AUTO, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0360) });
}
#endregion
#region T페이 BLE (Paygle)
// T페이 BLE 동글 (Paygle) 체크
if (PosMstManager.GetPosOption(POS_OPTION.OPT319) == "1")
{
ITPaygleUs cDeviceTPaygle = (ITPaygleUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_TPAYGLE);
bool ret = cDeviceTPaygle.CheckPaygle();
}
#endregion
#region OCB
if (PosMstManager.GetPosOption(POS_OPTION.OPT326) != "0" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "" && m_cDevStatus.ICReader.UseYn != true) // OCB 직통신
{
string sResMsg = "";
string[] aIrtRspDTL = null;
string sMsg = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1000);
if (sMsg.Trim() == "") sMsg = "OCB merchant authentication.\n Please wait a moment."; // OCB 가맹점 인증중 입니다. 잠시만 기다려 주십시요.
WinManager.ShowSearchMessage(sMsg, this);
// 가맹점 인증
sRet = m_OCBDirect.OCB_Direct_Point(PosConst.CANCEL_DIV.CANCEL, ItemConst.TR_ITEM_ID.POINT_ITEM, ItemConst.TR_ITEM_ID.POINT_USE.OKCASHBACK_POINT, PosConst.POS_OCB_DIRECT.STOR_AUTH, "", "", "0", "", "", "", ref sResMsg, ref aIrtRspDTL);
WinManager.HideSearchMessage(this);
if (sRet != UserCom.RST_OK)
{
string sMsg2 = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0130);
if (WinManager.QuestionMessage(sResMsg + "\n" + sMsg2) == true) // 등록된 할인을 취소 하시겠습니까?
{
string sMsg1 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1001);
if (sMsg1.Trim() == "") sMsg1 = "Registering OCB merchants..\n Please wait a moment."; // OCB 가맹점 등록중 입니다. 잠시만 기다려 주십시요.
WinManager.ShowSearchMessage(sMsg1, this);
// 가맹점 등록 (차후 승인 테스트시 오류 코드 체크해서 "가맹점미등록" 인경우만 처리 - 8830)
sRet = m_OCBDirect.OCB_Direct_Point(PosConst.CANCEL_DIV.CANCEL, ItemConst.TR_ITEM_ID.POINT_ITEM, ItemConst.TR_ITEM_ID.POINT_USE.OKCASHBACK_POINT, PosConst.POS_OCB_DIRECT.STOR_REGISTER, "", "", "0", "", "", "", ref sResMsg, ref aIrtRspDTL);
WinManager.HideSearchMessage(this);
if (sRet == UserCom.RST_OK)
{
WinManager.ShowSearchMessage(sMsg, this);
// 가맹점 인증
sRet = m_OCBDirect.OCB_Direct_Point(PosConst.CANCEL_DIV.CANCEL, ItemConst.TR_ITEM_ID.POINT_ITEM, ItemConst.TR_ITEM_ID.POINT_USE.OKCASHBACK_POINT, PosConst.POS_OCB_DIRECT.STOR_AUTH, "", "", "0", "", "", "", ref sResMsg, ref aIrtRspDTL);
WinManager.HideSearchMessage(this);
}
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(sResMsg);
}
}
}
}
#endregion
}
#endregion
#region // POS SPEC 전송 / 시스템오픈일자 조회
if (m_cPosStatus.Base.OlePosPrinterModel != "99")
{
// 룰파일 다운로드
RuleFileDownLoad();
// POS SPEC 전송
SendPosSpec();
// 시스템오픈일자 조회
GetSysOpenDate();
}
#endregion
#region BR
if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR)
{
IDataCommonUs m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
m_cDataCommon.SetBrPopUpBizMst();
}
#endregion
#region , POS
// 거래송신 프로세스 기동
INetworkTranSend cTranSend = (INetworkTranSend)sManager.InitServiceInstance(ServiceLists.AGENT_NETWORK_TRANSEND.DLL, ServiceLists.AGENT_NETWORK_TRANSEND.NetworkTranSend);
cTranSend.StartTranSend();
try
{
// POS 시작 프로그램 강제 종료
Process[] arPosPgm = Process.GetProcessesByName("PosStart");
foreach (Process pPosPgm in arPosPgm)
{
pPosPgm.Kill();
Thread.Sleep(1000);
}
CmUtil.FileMove("PosStart.exe", BaseCom.NxRootPath + @"DOWN\PGM\BIN\", BaseCom.NxRootPath + @"BIN\", "");
// 서버에서 이미지 재수신을 위해 로컬 사용으로 복사
DirectoryInfo dirParent = Directory.GetParent(Directory.GetCurrentDirectory());
if (File.Exists(dirParent.FullName + @"\CDP\CDP_COM\intro_bimg.png") == true)
{
File.Copy(dirParent.FullName + @"\CDP\CDP_COM\intro_bimg.png", dirParent.FullName + @"\CDP\CDP_COM\" + "intro_bimg000.png", true);
}
}
catch { }
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
{
IcReaderSettingDevice(true);
}
#endregion
#region -
SerialMsrToEmul("2");
#endregion
//#20171017 O2MSR_UPDATE.exe 실행 start
#region O2MSR_UPDATE.exe
SerialMsrToEmul("4");
#endregion
//#20171017 O2MSR_UPDATE.exe 실행 end
//20180718 O2SKIOSK.EXE start
//판매포스 옵션이 사용이면 O2SKIOSK.EXE 실행(실행 되어 있지 않은 경우에만 실행)
//변경
#region O2SKIOSK.EXE
if (PosMstManager.GetPosOption(POS_OPTION.OPT517) == "1")
{
RunO2SKIOSK(true);
}
#endregion O2SKIOSK.EXE
//20180718 O2SKIOSK.EXE end
//#20180711 O2SKIOSK_UPDATE.exe 실행 start
#region O2SKIOSK_UPDATE.exe
RunO2SKIOSK_UPDATE();
#endregion O2SKIOSK_UPDATE.exe
//#20171017 O2SKIOSK_UPDATE.exe 실행 end
#region KAC() Agent
KACAgentStartNKill(true);
#endregion KAC() Agent
#region ZookAgentSetup
if (m_cPosStatus.Base.OlePosPrinterModel != "99")
{
ZookAgentSetup();
}
#endregion
#region
2019-07-05 04:15:37 +00:00
//DualPlayStartNkill(true);
2019-06-16 05:12:09 +00:00
#endregion
//#20170907 넥사크로 캐시 삭제 start
#region
//#11475 넥사크로 캐시삭제 실행 삭제 start - PHJ 20170910
//NexacroCacheUninstall(true);
//#11475 넥사크로 캐시삭제 실행 삭제 end - PHJ 20170910
#endregion
//#20170907 넥사크로 캐시 삭제 end
//#20180223 인천공항T2 사용인 경우 O2IAIRPORT.exe 실행 start
#region O2IAIRPORT.exe
/*
if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT512), "0") == "1")
{
RunO2IAIRPORT();
}
*/
#endregion O2IAIRPORT.exe
//#20180223 인천공항T2 사용인 경우 O2IAIRPORT.exe 실행 end
//// 상품마스터 이미지명 설정
//ISalePluItemUs cPluService = (ISalePluItemUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_PLU_ITEM);
//cPluService.UpdateMstItemImageName();
return true;
}
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
{
WinManager.HideSearchMessage(this);
}
return false;
}
#endregion
#region X-CHARGE DLL
private bool RegXChargeDll()
{
bool bRet = false;
try
{
//옵션 체크
if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT024), "0") == "1")
{
string sFileName = BaseCom.NxBinPath + PosConst.XCHARGE.DLL_FILE;
//파일 체크
if (File.Exists(sFileName) == false)
{
//파일 없음!
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0647);
}
else
{
//파일 등록
Process.Start("regsvr32.exe", "/s \"" + sFileName + "\"");
bRet = true;
}
}
}
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 bRet;
}
#endregion
#region
/// <summary>
/// 동영상 플레이어 가동
/// </summary>
/// <param name="bReStart"></param>
/// <returns></returns>
private bool DualPlayStartNkill(bool bReStart)
{
try
{
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName(PosConst.CUST_PIPE_NAME.CUST_PROCESS);
if (p.GetLength(0) > 0)
{
p[0].Kill();
if (bReStart == true) Thread.Sleep(1000);
}
if (bReStart == true)
{
string strappname = BaseCom.NxBinPath + PosConst.CUST_PIPE_NAME.CUST_PROCESS_EX;
System.Diagnostics.Process.Start(strappname);
}
return true;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return false;
}
#endregion
#region
/// <summary>
/// 넥사크로 설치 및 설치 완료 처리
/// </summary>
/// <param name="bStart"></param>
/// <returns></returns>
private void NexacroSetupEngine(bool bStart)
{
try
{
string sSetupFile = BaseCom.NxBinPath + "nexacro14_SetupEngine.exe"; // 원본파일
string sSetupFileBak = BaseCom.NxBinPath + "nexacro14_SetupEngine.bak"; // 백업파일
if (bStart == true)
{
var isExist = CmUtil.Exists(sSetupFile);
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isExist ? "Nexacro install start [" + sSetupFile + "] " : "Nexacro is already installed");
//실행시 있으면 실행
if (isExist == true)
{
CmUtil.ExecuteProcess(sSetupFile, "/VERYSILENT");
m_bNeSetupRun = true;
}
}
else
{
if (m_bNeSetupRun == true)
{
//종료시 있으면 이름 변경(Move File)
if (CmUtil.Exists(sSetupFile) == true)
{
CmUtil.FileMove(sSetupFile, sSetupFileBak); //이름변경
}
}
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return;
}
/// <summary>
/// VC++ 2005 재배포패키지 설치
/// (Microsoft Visual C++ 2005 Redistributable)
/// </summary>
/// <returns></returns>
/// <remarks>
/// 넥사크로 정상 동작을 위해서 반드시 필요함.
/// </remarks>
private bool VC2005RedistributableSetup()
{
try
{
// VC++ 2005 재배포패키지 설치 유무 확인
var keyName = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{837b34e3-7c30-493c-8f6a-2b0f04e2912c}";
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(keyName))
{
if (key != null)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
"MS VC++ 2005 Redistributable is already installed");
return true;
}
var procName = BaseCom.NxBinPath + "4053_vcredist_x86.exe";
var procArgs = @"/Q";
if (CmUtil.Exists(procName) == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
string.Format("MS VC++ 2005 Redistributable install file not found. [{0}]", procName));
return false;
}
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
string.Format("MS VC++ 2005 Redistributable install Start [{0}]", procName));
this.TopMost = true;
CmUtil.ExecuteWaitProcess(procName, procArgs, ProcessWindowStyle.Hidden, 1000 * 300);
Thread.Sleep(50);
}
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(keyName))
{
var msg = key == null ? "Failed" : "Success";
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
string.Format("MS VC++ 2005 Redistributable install Result [{0}]", msg));
if (key == null) return false;
}
return true;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
return false;
}
finally
{
this.TopMost = false;
this.Update();
}
}
private bool VC2008RedistributableSetup()
{
try
{
// VC++ 2008 재배포패키지 설치 유무 확인
var keyName = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}";
using(RegistryKey key = Registry.LocalMachine.OpenSubKey(keyName))
{
if(key != null)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
"MS VC++ 2008 Redistributable is already installed");
return true;
}
var procName = BaseCom.NxBinPath + "2008_vcredist_x86.exe";
var procArgs = @"/Q";
if (CmUtil.Exists(procName) == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
string.Format("MS VC++ 2008 Redistributable install file not found. [{0}]", procName));
return false;
}
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
string.Format("MS VC++ 2008 Redistributable install Start [{0}]", procName));
this.TopMost = true;
CmUtil.ExecuteWaitProcess(procName, procArgs, ProcessWindowStyle.Hidden, 1000 * 300);
Thread.Sleep(50);
}
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(keyName))
{
var msg = key == null ? "Failed" : "Success";
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
string.Format("MS VC++ 2008 Redistributable install Result [{0}]", msg));
if (key == null) return false;
}
return true;
}
catch(Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
return false;
}
finally
{
this.TopMost = false;
this.Update();
}
}
#endregion
//#20170907 넥사크로 캐시 삭제 start
#region
/// <summary>
/// 넥사크로 캐시 삭제 처리
/// </summary>
/// <param name="bStart"></param>
/// <returns></returns>
//#11475 넥사크로 캐시삭제 실행 삭제 start - PHJ 20170910
/*
private void NexacroCacheUninstall(bool bStart)
{
try
{
string sSetupFile = BaseCom.NxBinPath + "Uninstall_Nexacro_Cache.exe"; // 원본파일
if (bStart == true)
{
var isExist = CmUtil.Exists(sSetupFile);
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isExist ? "Uninstall_Nexacro_Cache start [" + sSetupFile + "] " : "File None");
//실행시 있으면 실행
if (isExist == true)
{
CmUtil.ExecuteProcess(sSetupFile, "/VERYSILENT");
}
}
else
{
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return;
}
*/
//#11475 넥사크로 캐시삭제 실행 삭제 end - PHJ 20170910
#endregion
//#20170907 넥사크로 캐시 삭제 end
#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();
}
//20180611 프린터 미출력 개선 02Printer.exe start
//기존
#if (PRT_O2PRINTER)
#else
cPosPrinterUs.CloseDevice();
#endif
//20180611 프린터 미출력 개선 02Printer.exe end
}
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...");
}
cPosPrinterUs.CloseDevice();
}
}
}
}
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
/// <summary>
/// 시리얼 변환 프로그램 체크
/// </summary>
/// <param name="sStep">1:구프로그램종료,2:가동,3:종료,4:O2MSR_UPDATE 실행</param>
/// <returns></returns>
private bool SerialMsrToEmul(string sStep)
{
try
{
// IC리더기 사용유무도 체크(조성완C 요청, 2017.07.10)
//if (m_cDevStatus.Msr.UseYn == true && m_cPosStatus.Base.OlePosMsrController == "2")
if (m_cDevStatus.Msr.UseYn == true && m_cPosStatus.Base.OlePosMsrController == "2" && m_cDevStatus.ICReader.UseYn == false)
{
if (sStep == "1") //구 프로그램 종료!
{
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName(PosConst.MSR_SERIAL_EMULATOR.OLD_APP_PROCESS);
if (p.GetLength(0) > 0)
{
p[0].Kill();
}
}
else
{
//System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName(PosConst.MSR_SERIAL_EMULATOR.APP_PROCESS);
//if (p.GetLength(0) > 0)
//{
// p[0].Kill();
// if (sStep == "2") Thread.Sleep(1000);
//}
if (sStep == "2")
{
string strappname = BaseCom.NxBinPath + PosConst.MSR_SERIAL_EMULATOR.APP_FILE;
System.Diagnostics.Process.Start(strappname);
}
//#20171017 O2MSR_UPDATE.exe 실행 start
else if (sStep == "4")
{
string sO2MSRUPDATEFile = BaseCom.NxBinPath + "O2MSR_UPDATE.exe";
string sO2MSRNEWFile = BaseCom.NxBinPath + "O2MSR_NEW.EXE";
var isUPExist = CmUtil.Exists(sO2MSRUPDATEFile);
var isNEWExist = CmUtil.Exists(sO2MSRNEWFile);
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isUPExist ? "O2MSR_UPDATE.exe [Exist]" : "O2MSR_UPDATE.exe [None]");
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isNEWExist ? "O2MSR_NEW.exe [Exist]" : "O2MSR_NEW.exe [None]");
//실행시 있으면 실행
if ((isUPExist == true) && (isNEWExist == true))
{
CmUtil.ExecuteProcess(sO2MSRUPDATEFile, "");
}
}
//#20171017 O2MSR_UPDATE.exe 실행 end
}
}
return true;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return false;
}
#endregion
#region KAC() Agent
private bool KACAgentStartNKill(bool bReStart)
{
try
{
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName(PosConst.KAC_AGENT.APP_PROCESS);
if(p.GetLength(0) > 0)
{
p[0].Kill();
if (bReStart == true) Thread.Sleep(1000);
}
if(bReStart == true)
{
if (File.Exists(PosConst.KAC_AGENT.APP_FILE) == true)
{
System.Diagnostics.Process.Start(PosConst.KAC_AGENT.APP_FILE);
}
}
return true;
}
catch(Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return false;
}
#endregion
#region POS
/// <summary>
/// POS 프로그램 종료 처리
/// </summary>
private bool PosEndProc()
{
try
{
this.Refresh();
#region 01 -
// 거래송신 프로세스 종료
INetworkTranSend cTranSend = (INetworkTranSend)sManager.InitServiceInstance(ServiceLists.AGENT_NETWORK_TRANSEND.DLL, ServiceLists.AGENT_NETWORK_TRANSEND.NetworkTranSend);
cTranSend.StopTranSend();
#endregion 01 -
#region 02 -
// 서버 점검 데몬 종료
IWatcher cCheckOver = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_NETWORK_CHECKOVER.DLL, ServiceLists.AGENT_NETWORK_CHECKOVER.NetworkCheckOver);
cCheckOver.Stop();
#endregion 02 -
#region 03 -
// 백그라운드 다운 데몬 종료
IWatcher cBackgroundDown = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_BACKGROUND_DOWN.DLL, ServiceLists.AGENT_BACKGROUND_DOWN.BACKGROUND_DOWN_MAIN);
cBackgroundDown.Stop();
#endregion 03 -
#region 04 -
// 고객화면 동영상 재생기 종료
DualPlayStartNkill(false);
#endregion 04 -
#region 05 -
// 종료시 넥사크로 설치 파일 백업
NexacroSetupEngine(false);
#endregion 05 -
#region 06 - KPS
// KPS 데몬 종료 (선불 또는 메인 일때)
if (PosMstManager.GetPosOption(POS_OPTION.OPT506) == "1")
{
// Mod, 2017.04.10, 메인/주문 POS 모두 KPS 기동
//if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT ||
// (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS))
//{
// IKPSMain cKPSMain = (IKPSMain)sManager.InitServiceInstance(ServiceLists.AGENT_KPS.DLL, ServiceLists.AGENT_KPS.KPS_MAIN);
// cKPSMain.StopKPS();
//}
IKPSMain cKPSMain = (IKPSMain)sManager.InitServiceInstance(ServiceLists.AGENT_KPS.DLL, ServiceLists.AGENT_KPS.KPS_MAIN);
cKPSMain.StopKPS();
}
#endregion 06 - KPS
#region 07 - KDS
// KDS 데몬 종료
if (PosMstManager.GetPosOption(POS_OPTION.OPT027) == "1" || PosMstManager.GetPosOption(POS_OPTION.OPT507) == "1")
{
// Mod, 2017.04.26, 메인/주문 POS 모두 KDS 기동
//if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT ||
// (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS))
//{
// IWatcher cKDSMain = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_KDS.DLL, ServiceLists.AGENT_KDS.KDS_MAIN);
// cKDSMain.Stop();
//}
IWatcher cKDSMain = (IWatcher)sManager.InitServiceInstance(ServiceLists.AGENT_KDS.DLL, ServiceLists.AGENT_KDS.KDS_MAIN);
cKDSMain.Stop();
}
#endregion 07 - KDS
#region 08 - -
// 저울-라벨프린터 데몬 종료
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR && m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR)
{
if (m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS)
{
if (m_cDevStatus.Scale.UseYn == true)
{
IMeasuring cMeasuringMain = (IMeasuring)sManager.InitServiceInstance(ServiceLists.AGENT_MEASURING.DLL, ServiceLists.AGENT_MEASURING.MEASURING_MAIN);
cMeasuringMain.StopMeasuring();
}
}
}
#endregion 08 - -
#region 09 - I/F
// 외부 인터페이스 데몬 종료
if (m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_01
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_02
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_03
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_04
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_05
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_CHN_06
|| m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_SIN_01
)
{
if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT ||
(m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS))
{
lTranInterfaceOutside cTranInterfaceOutside = (lTranInterfaceOutside)sManager.InitServiceInstance(ServiceLists.AGENT_TranInterfaceOutside.DLL, ServiceLists.AGENT_TranInterfaceOutside.TIFO_MAIN);
cTranInterfaceOutside.Stop();
}
}
#endregion 09 - I/F
#region 10 - -
// POS 프로그램 종료 시 O2MSR 종료 안 함.조성완C 요청(2017.07.03)
//SerialMsrToEmul("3");
#endregion
#region 11 - KAC() Agent
KACAgentStartNKill(false);
#endregion 11 - KAC() Agent
#region 12 -
// 중국 위쳇페인 데몬 기동(2017.06.05)
WeChatPayApprDeamon(true);
#endregion
#region 13 - Printer
if (m_cPosStatus.Base.OlePosPrinterController == PosConst.POS_DEVICE_CONTROLLER.RS232)
{
IPosPrinterUs cPrinterDaemon = (IPosPrinterUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER);
cPrinterDaemon.StopPrinterDaemon();
}
#endregion 13 - Printer
//#20170918 기념일 배송 출력 start
#region 14 -
PbillDemonRun();
#endregion 14 -
//#20170918 기념일 배송 출력 end
//20180611 프린터 미출력 개선 02Printer.exe start
//변경
#if (PRT_O2PRINTER)
#region 15 - O2Printer.exe
RunO2Printer(false);
#endregion 15 - O2Printer.exe
#endif
//20180611 프린터 미출력 개선 02Printer.exe end
// 화면해상도 800으로 원복
if (m_bChangeDisplay == true) ChangeDisplayRate(800);
#region //
File.Delete(BaseCom.NxBinPath + "PosMain.txt");
try
{
// POS 시작 프로그램 강제 종료
Process[] arPosPgm = Process.GetProcessesByName("PosStart");
foreach (Process pPosPgm in arPosPgm)
{
pPosPgm.Kill();
Thread.Sleep(1000);
}
}
catch { }
// 프로그램 종료 처리
if (m_cPosStatus.Sale.SysShutDown == PosConst.SYS_SHUTDOWN.POWEROFF)
{
CmUtil.SystemShutDown();
}
else if (m_cPosStatus.Sale.SysShutDown == PosConst.SYS_SHUTDOWN.REBOOT)
{
CmUtil.SystemReboot();
}
else
{
CmUtil.FileMove("PosStart.exe", BaseCom.NxRootPath + @"DOWN\PGM\BIN\", BaseCom.NxRootPath + @"BIN\", "");
if (m_cPosStatus.Sale.SysShutDown == PosConst.SYS_SHUTDOWN.PGMRESTART)
{
// POS 재시작 프로그램 실행
Process.Start("PosStart.exe", "RESTART");
}
//else
//{
// // POS 프로그램 종료
// Process.Start("PosStart.exe", "EXIT");
//}
}
//DualPlayStartNkill(false);
#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);
}
return false;
}
#endregion
#region
/// <summary>
/// 프로그램 업데이트
/// </summary>
/// <returns></returns>
private string PosPgmUpdate()
{
string sRet = UserCom.RST_ERR;
try
{
// 서버 시간 동기화
SetServerSysDateTime();
// PGM 다운로드
sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_PGM_DOWNLOAD, PosKey.MENU_KEY.PGM_DOWNLOAD, "A" });
}
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;
}
/// <summary>
/// POS SPEC 전송
/// </summary>
private void SendPosSpec()
{
try
{
IServiceUs m_cPosSpec = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_ADMIN.DLL, ServiceLists.BSV_ADMIN.POS_SPEC);
m_cPosSpec.Execute(new string[] { });
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 서버 시간 동기화
/// </summary>
private void SetServerSysDateTime()
{
try
{
// 서버 시간 동기화
ISvr2Tran m_cSvr2Tran = (ISvr2Tran)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SVR2TRAN);
string sRet = m_cSvr2Tran.ServerSysDateTime();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 시스템 오픈일자 조회 (전환정보조회)
/// </summary>
/// <remarks>
/// 조회실패 시 설치시 입력된 오픈일자로 판단
/// </remarks>
private void GetSysOpenDate()
{
try
{
IDataCommonUs dataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
Hashtable htSendData = new Hashtable();
Hashtable htRecvData = new Hashtable();
htSendData.Add(Column.IQ_INSTALL_SCHEDULE_INQ.DATA.INQ_TYPE, Column.IQ_INSTALL_SCHEDULE_INQ.MSG_ID);
htSendData.Add(Column.IQ_INSTALL_SCHEDULE_INQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo);
htSendData.Add(Column.IQ_INSTALL_SCHEDULE_INQ.DATA.REQ_TYPE, "2");
htSendData.Add(Column.IQ_INSTALL_SCHEDULE_INQ.DATA.INSTALL_DATE, "");
htSendData.Add(Column.IQ_INSTALL_SCHEDULE_INQ.DATA.INSTALL_TIME, "");
htSendData.Add(Column.IQ_INSTALL_SCHEDULE_INQ.DATA.SYS_OPEN_DATE, "");
htSendData.Add(Column.IQ_INSTALL_SCHEDULE_INQ.DATA.RES_CD, "");
string ret = UserCom.RST_ERR;
for (var i = 0; i < 3; i++)
{
ret = dataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, 5000, htSendData, ref htRecvData, false);
if (ret == UserCom.RST_OK)
{
// RES_CD 00 : 정상
// 01 : NoData, 스캐쥴정보가 없을 때, SYS_OPEN_DATE에 값이 없을 때.
// 02 : 전환완료일자 업데이트 실패
if (htRecvData[Column.IQ_INSTALL_SCHEDULE_INQ.DATA.RES_CD].ToString().Trim() == "02")
{
// 혹시 몰라서 재시도해본다.
Thread.Sleep(300);
continue;
}
break;
}
}
if (ret == UserCom.RST_OK)
{
var resCode = htRecvData[Column.IQ_INSTALL_SCHEDULE_INQ.DATA.RES_CD].ToString().Trim();
if (resCode == "00" || resCode == "02")
{
m_cPosStatus.Base.SysOpenDate = htRecvData[Column.IQ_INSTALL_SCHEDULE_INQ.DATA.SYS_OPEN_DATE].ToString().Trim();
}
else if (resCode == "01")
{
m_cPosStatus.Base.SysOpenDate = "99991231";
}
// PosSaleInfo.ini 저장
IServiceUs cSaveConfigInfo = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.SAVE_CONFIGINFO);
cSaveConfigInfo.Execute(new string[] { PosConst.INI_FILE_NAME.PosSaleInfo });
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 교통카드 운영정보 다운로드
/// </summary>
/// <param name="sCardType"></param>
private void TMoneyDownLoad(string sCardType, ref byte[] rep_array)
{
string sPayDCGrpCD = "";
string sPayDcCd = "";
string sRet = UserCom.RST_ERR;
//byte[] rep_array = new byte[2049];
try
{
// 구분 T:TMoney, E:CashBee
ISignPadUs m_cDeviceSignPad = (ISignPadUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_SIGNPAD);
sPayDCGrpCD = ItemConst.TR_ITEM_ID.MOBILECASH_ITEM;
sPayDcCd = ItemConst.TR_ITEM_ID.MOBILECASH.T_MONEY;
if (sCardType == "E")
sPayDcCd = ItemConst.TR_ITEM_ID.MOBILECASH.CASHBEE;
string sApprID = PosMstManager.GetMstVan(sPayDCGrpCD, sPayDcCd, PosMst.MST_VAN.DATA.APPR_ID);
string sBizNm = PosMstManager.GetMstVan(sPayDCGrpCD, sPayDcCd, PosMst.MST_VAN.DATA.CMP_APPR_ID);
string sDownType = "00";
sRet = m_cDeviceSignPad.TMoneyDownload(sApprID, sBizNm, m_cPosStatus.Base.MsgSeqNo, sCardType, sDownType, ref rep_array);
if (sRet != UserCom.RST_OK)
{
if (sCardType == "T") WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0393);
if (sCardType == "E") WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0394);
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 룰파일 다운로드
/// </summary>
private void RuleFileDownLoad()
{
try
{
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
{
// 룰파일 다운로드
IVanCommonUs cVanSpcn = (IVanCommonUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.VANSPCNCOMMON);
string sRet = cVanSpcn.RuleFileDownLoad(new string[] { });
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
private string GetAppSetting(string strKey, string sDefault)
{
string strValue = "";
try
{
strValue = System.Configuration.ConfigurationManager.AppSettings[strKey];
}
catch { }
if (strValue == null || strValue == "") strValue = sDefault;
return strValue;
}
private void ShowTaskBar(bool bShow)
{
try
{
IntPtr nHWnd = FindWindow("Shell_traywnd", "");
if (bShow == true)
{
SetWindowPos((int)nHWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW);
}
else
{
SetWindowPos((int)nHWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);
}
}
catch { }
}
/// <summary>
/// IC 리더 콜백 함수 가능 설정
/// </summary>
private void IcReaderSettingDevice(bool bEnabled)
{
try
{
IICReaderUs cDeviceICReader = (IICReaderUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_ICREADER);
cDeviceICReader.IcReaderSettingDevice(bEnabled);
}
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 bool SignPadFileUpdate()
//{
// bool bRet = false;
// int nUpdateCnt = 0;
// try
// {
// // 업데이트 가능 건수 확인
// //nUpdateCnt = m_SignPadUpdate.SignPadUpdateCnt();
// if (nUpdateCnt > 0)
// {
// bRet = true;
// }
// }
// 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 bRet;
//}
#endregion
#region Exploer
/// <summary>
/// 화면 해상도 강제변경
/// </summary>
private void ChangeDisplayRate(int nRate)
{
string sDeviceName = "";
bool result = true;
try
{
DISPLAY_DEVICE d = new DISPLAY_DEVICE(0);
int devNum = 0;
do
{
result = EnumDisplayDevices(IntPtr.Zero, devNum, ref d, 0);
if (result)
{
string item = devNum.ToString() + ". " + d.DeviceString.Trim();
if ((d.StateFlags & 4) != 0)
{
sDeviceName = d.DeviceName.Trim();
break;
}
}
devNum++;
} while (result);
if (sDeviceName == "") return;
DEVMODE devMode = new DEVMODE();
int modeNum = 0;
do
{
result = EnumDisplaySettings(sDeviceName, modeNum, ref devMode);
if (result)
{
if (nRate == 1024)
{
// 1024*768 32Bit 60Hz
if (devMode.dmPelsWidth.ToString() == "1024" && devMode.dmPelsHeight.ToString() == "768" && devMode.dmBitsPerPel.ToString() == "32" && devMode.dmDisplayFrequency.ToString() == "60")
{
devMode.dmDisplayOrientation = DMDO_DEFAULT;
devMode.dmDisplayFixedOutput = DMDFO_STRETCH;
ChangeDisplaySettings(ref devMode, CDS_UPDATEREGISTRY | CDS_FULLSCREEN); // 해상도 변경 처리
ChangeExplorerRate(125); // IE 화면 배율 설정
m_cPosStatus.Sale.ScreenSizeUser = 1024;
//if (devMode.dmDefaultSource.ToString() == "1") break;
break;
}
}
else if (nRate == 800)
{
// 800*600 32Bit 60Hz
if (devMode.dmPelsWidth.ToString() == "800" && devMode.dmPelsHeight.ToString() == "600" && devMode.dmBitsPerPel.ToString() == "32" && devMode.dmDisplayFrequency.ToString() == "60")
{
devMode.dmDisplayOrientation = DMDO_DEFAULT;
devMode.dmDisplayFixedOutput = DMDFO_STRETCH;
ChangeDisplaySettings(ref devMode, CDS_UPDATEREGISTRY | CDS_FULLSCREEN); // 해상도 변경 처리
ChangeExplorerRate(100); // IE 화면 배율 설정
//if (devMode.dmDefaultSource.ToString() == "1") break;
break;
}
}
}
modeNum++;
} while (result);
Thread.Sleep(1000);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// Exploer 화면 배율 설정
/// </summary>
private void ChangeExplorerRate(int nRate)
{
try
{
// IE 화면 배율 설정
RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Zoom\", RegistryKeyPermissionCheck.ReadWriteSubTree);
if (regKey == null) return;
regKey.SetValue("ResetTextSizeOnStartup", 0x00000000, RegistryValueKind.DWord);
regKey.SetValue("ResetZoomOnStartup2", 0x00000000, RegistryValueKind.DWord);
regKey.SetValue("ResetTextSizeOnZoom", 0x00000001, RegistryValueKind.DWord);
if (nRate == 75)
{
// 75%
regKey.SetValue("ZoomFactor", 0x00012df8, RegistryValueKind.DWord);
}
else if (nRate == 100)
{
// 100%
regKey.SetValue("ZoomFactor", 0x000186a0, RegistryValueKind.DWord);
}
else if (nRate == 125)
{
// 125%
regKey.SetValue("ZoomFactor", 0x0001e848, RegistryValueKind.DWord);
}
else if (nRate == 150)
{
// 150%
regKey.SetValue("ZoomFactor", 0x000249f0, RegistryValueKind.DWord);
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, 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 SetEmgProgramUpdate()
{
try
{
// 다중 긴급 프로그램 배포가 내려올때 여러번 재부팅되기 때문에 재 가동시
// 긴급공지 메세지를 강제 업데이트 처리함 2017-03-21
IDataServiceUs m_cPosNoticeCom = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.POS_NOTICE_COM);
if (m_cPosNoticeCom != null)
m_cPosNoticeCom.SetData("");
}
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 ZookAgentSetup
/// <summary>
/// ZookAgentSetup 설치(원격 프로그램)
/// </summary>
private void ZookAgentSetup()
{
try
{
string sSetupFile = BaseCom.NxBinPath + "ZOOKAppAgentSetup.exe"; // 원본파일
if (m_cPosStatus.Base.BrandDiv != "" && m_cPosStatus.Base.StoreNo != "" && m_cPosStatus.Base.PosNo != "")
{
//실행시 있으면 실행
if (CmUtil.Exists(sSetupFile) == true)
{
CmUtil.ExecuteProcess(sSetupFile, "");
}
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return;
}
#endregion ZookAgentSetup
#region /
/// <summary>
/// 중국 알리페이/위챗페이 승인 데몬 기동 및 중지
/// </summary>
/// <param name="bClose"></param>
/// <returns></returns>
private string WeChatPayApprDeamon(bool bClose)
{
string sRet = UserCom.RST_ERR;
Process[] arPgm = null;
try
{
// 중국
if (m_cPosStatus.Mst.CntryDiv != ItemConst.CNTRY_DIV.CN) return UserCom.RST_OK;
if (bClose == true)
{
// 승인 데몬 종료
arPgm = Process.GetProcessesByName("fmclient");
foreach (Process pPgm in arPgm)
{
pPgm.Kill();
}
}
else
{
// 승인 데몬 조회
arPgm = Process.GetProcessesByName("fmclient");
foreach (Process pPgm in arPgm)
{
return UserCom.RST_OK;
}
// 승인 데몬 실행
ProcessStartInfo startInfo = new ProcessStartInfo(Directory.GetCurrentDirectory().ToString() + @"\fmclient.exe");
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = false;
Process.Start(startInfo);
}
return 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
//#20170918 기념일 배송 출력 start
#region PBILL
private string PbillDemonRun()
{
string sRet = UserCom.RST_ERR;
Process[] arPgm = null;
Process[] arPgm2 = null;
try
{
// PBILL 종료 시
// WBP 실행 중이면 종료하지 않고
// 구포스 EXE 폴더에 PBILL 파일이 존재하지 않으면
// 종료한다.
//#20180511 기념일배송시 구포스 PBILL 실행되는 증상 수정 start
//주석처리
arPgm2 = Process.GetProcessesByName("WBP");
foreach (Process pPgm in arPgm2)
{
return UserCom.RST_OK;
}
//#20180511 기념일배송시 구포스 PBILL 실행되는 증상 수정 end
/*
//구포스와 동시 사용 매장은 아니지만
//구포스가 설치되어 있으면 종료가 안되므로 주석처리.
if ((File.Exists("C:\\SPCPOS\\EXE\\PBILL.exe") == true) && ((m_cPosStatus.Base.CmpCd == "PCKR")))
{
return UserCom.RST_OK;
}
else if ((File.Exists("C:\\SLPOS\\EXE\\PBILL.exe") == true) && ((m_cPosStatus.Base.CmpCd == "SLKR")))
{
return UserCom.RST_OK;
}
*/
// PBILL 데몬 종료
arPgm = Process.GetProcessesByName("PBILL");
foreach (Process pPgm in arPgm)
{
pPgm.Kill();
}
return 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
//#20170918 기념일 배송 출력 end
//#20180223 인천공항T2 사용인 경우 O2IAIRPORT.exe 실행 start
#region O2IAIRPORT.exe
/*
private bool RunO2IAIRPORT()
{
try
{
string sO2IAIRPORTFile = BaseCom.NxBinPath + "O2IAIRPORT.exe";
var isUPExist = CmUtil.Exists(sO2IAIRPORTFile);
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isUPExist ? "O2IAIRPORT.exe [Exist]" : "O2IAIRPORT.exe [None]");
//실행시 있으면 실행
if (isUPExist == true)
{
CmUtil.ExecuteProcess(sO2IAIRPORTFile, "");
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
return false;
}
return true;
}
*/
#endregion O2IAIRPORT.exe
//#20180223 인천공항T2 사용인 경우 O2IAIRPORT.exe 실행 end
//20180611 프린터 미출력 개선 02Printer.exe start
//변경
#if (PRT_O2PRINTER)
#region O2Printer.exe ,
private bool RunO2Printer(bool bStart)
{
try
{
string sO2PrinterFile = BaseCom.NxBinPath + "O2Printer.exe";
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName("O2Printer");
if (p.GetLength(0) > 0)
{
p[0].Kill();
//if (bReStart == true) Thread.Sleep(1000);
}
if (bStart == true)
{
var isUPExist = CmUtil.Exists(sO2PrinterFile);
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isUPExist ? "O2Printer.exe [Exist]" : "O2Printer.exe [None]");
//실행시 있으면 실행
if (File.Exists(sO2PrinterFile) == true)
{
System.Diagnostics.Process.Start(sO2PrinterFile);
}
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
return false;
}
return true;
}
#endregion O2Printer.exe ,
#endif
//20180611 프린터 미출력 개선 02Printer.exe end
//#20180711 O2SKIOSK_UPDATE.exe 실행 start
#region O2SKIOSK_UPDATE.exe
private bool RunO2SKIOSK_UPDATE()
{
try
{
string sO2KIOSKUPDATEFile = BaseCom.NxBinPath + "O2SKIOSK_UPDATE.EXE";
string sO2KIOSKNEWFile = BaseCom.NxBinPath + "O2skiosk_new.exe";
var isUPExist = CmUtil.Exists(sO2KIOSKUPDATEFile);
var isNEWExist = CmUtil.Exists(sO2KIOSKNEWFile);
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isUPExist ? "O2SKIOSK_UPDATE.exe [Exist]" : "O2SKIOSK_UPDATE.exe [None]");
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isNEWExist ? "O2skiosk_new.exe [Exist]" : "O2skiosk_new.exe [None]");
//실행시 있으면 실행
if ((isUPExist == true) && (isNEWExist == true))
{
CmUtil.ExecuteProcess(sO2KIOSKUPDATEFile, "");
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
return false;
}
return true;
}
#endregion O2SKIOSK_UPDATE.exe
//#20180711 O2SKIOSK_UPDATE.exe 실행 end
//20180718 O2SKIOSK.EXE start
//변경
#region O2SKIOSK.EXE
private bool RunO2SKIOSK(bool bStart)
{
try
{
string sO2SKIOSKFile = BaseCom.NxBinPath + "O2SKIOSK.exe";
if (bStart == true)
{
//실행 중이라면 건너뜀
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName("O2SKIOSK");
if (p.GetLength(0) > 0)
{
return true;
}
var isUPExist = CmUtil.Exists(sO2SKIOSKFile);
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
isUPExist ? "O2SKIOSK.exe [Exist]" : "O2SKIOSK.exe [None]");
//파일이 있으면 실행
if (isUPExist == true)
{
System.Diagnostics.Process.Start(sO2SKIOSKFile);
}
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
return false;
}
return true;
}
#endregion O2SKIOSK.EXE
//20180718 O2SKIOSK.EXE start
}
}