using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.IO; using System.Data; using System.Windows.Forms; namespace NewPosInstaller { public class PosDataMigration : Echo, IProcess { //private bool isStop = false; private bool isExistsKVS = false; public bool Execute() { bool retValue = false; try { ComLog.InstallResult ret = ComLog.InstallResult.Fail; // PosConfig.INI 정보 이행 ret = MigrationConfig(); if (ret != ComLog.InstallResult.Success) return retValue = false; // PosDevice.INI 정보 이행 ret = MigrationDevice(); // PosSale.INI 정보 이행 retValue = MigrationSaleInfo(); // 주방프린터 마스터 이행 (서버전송) // 주방모니터 마스터 이행 (서버전송) ret = MigrationKPSMaster(); // SPCTouchTxt.exe 실행 파라미터는 브랜드코드 점포코드 POS번호 bool isBackup = true; retValue = ExcuteSPCTouchTxt(); // 터치키 마스터 이행 (서버전송) => BR만 이행처리 ret = MigrationTouchKeyMaster(); if (ret == ComLog.InstallResult.Fail) isBackup = false; // 플레이버 마스터 이행 (서버전송) => BR만 이행처리 ret = MigrationFlavorMaster(); if (ret == ComLog.InstallResult.Fail) isBackup = false; // 층/테이블 마스터 이행 (로컬저장, 서버백업) => 후불 ret = MigrationTableMaster(); // 기타코드 이행 (로컬저장) ret = MigrationEtcCode(); // 테이블예약 이행 (로컬저장, 안하기로 했지만 그냥 ) ret = MigrationTableResv(); // LocalTBL backup if (ComLib.ExistDirectory(DirInfo.JinDir) && isBackup) { string backPath = string.Format(DirInfo.JinDirBck, DateTime.Now.ToString("yyyyMMddHHmm")); ComLib.DirectoryCopy(DirInfo.JinDir, backPath); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => JirDir Backup, BackupDir={0}", backPath)); } else { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => JirDir Backup skip")); } BasicInfo.OldPosTransDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // 기타정보 이행 (파일복사, POS터미널 정보 서버전송) ret = MigrationEtcInfo(); // 포스옵션정보 이행 ret = MigratinoPosOption(); return true; } catch (Exception ex) { ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , ex.Message); return false; } } public void Stop() { //this.isStop = true; } /// /// PosConfig.INI 정보 이행 /// /// private ComLog.InstallResult MigrationConfig() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; try { base.OnEcho("Migration POS configuration information."); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); string temp = string.Empty; string value = string.Empty; string posConfigFile = Path.Combine(DirInfo.InstallDir, @"INI\PosConfig.ini"); CmMessage cmConfigInfo = CmMessage.MakeMessageFromFile(posConfigFile); cmConfigInfo.GetMessage("POS ").MakeMessageOverWrite("CmpCd ", BasicInfo.CompCd); cmConfigInfo.GetMessage("POS ").MakeMessageOverWrite("StoreNo ", BasicInfo.StoreNo); cmConfigInfo.GetMessage("POS ").MakeMessageOverWrite("PosNo ", BasicInfo.PosNo); //// 공항공사 관리 공항 입점POS 여부(0:일반, 1:공항공사 관리 공항 입점POS) //temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "AIRPORT_KIMHAE_DIV", "0"); //cmConfigINfo.GetMessage("POS ").MakeMessageOverWrite("KacPos ", temp); //// 공항공사 관리 공항 ERP상의 계약번호 (코너번호) //temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "AIRPORT_KIMHAE_CON_NO", ""); // 0000023884 값으로 추정됨. //cmConfigINfo.GetMessage("POS ").MakeMessageOverWrite("KacConNo ", temp); //// 고속도로 휴게소 입점POS 여부(0:일반, 1:고속도록 휴게소 입점POS) //string ExPos = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "HIWAY_DIV", "0"); //cmConfigINfo.GetMessage("POS ").MakeMessageOverWrite("ExPos ", ExPos); // @ 확인필요 => AS-IS 마스터로 관리 했다고 함. // 고속도로 휴게소 매장코드 (9 byte) //temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "", ""); //if (ExPos == "1" && string.IsNullOrWhiteSpace(temp)) temp = "S00000104"; // S00000104 값으로 추정됨. //cmConfigINfo.GetMessage("POS ").MakeMessageOverWrite("ExStoreCd ", temp); // @ 확인필요 => AS-IS 마스터로 관리 했다고 함. // 고속도로 휴게소 코너코드 (4 byte) //temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "", ""); //if (ExPos == "1" && string.IsNullOrWhiteSpace(temp)) temp = "0008"; // 0008 값으로 추정됨. //cmConfigINfo.GetMessage("POS ").MakeMessageOverWrite("ExCornerCd ", temp); // 디지털메뉴보드 I/F 여부 => 초기값 = 0 cmConfigInfo.GetMessage("POS ").MakeMessageOverWrite("DmbIf ", "0"); cmConfigInfo.GetMessage("POS ").MakeMessageOverWrite("BrandCd ", BasicInfo.BrandCd); cmConfigInfo.GetMessage("POS ").MakeMessageOverWrite("BrandDiv ", BasicInfo.BrandGb); cmConfigInfo.GetMessage("POS ").MakeMessageOverWrite("LogLevel ", "3"); cmConfigInfo.GetMessage("POS ").MakeMessageOverWrite("LogoUpload ", "0"); // 점포정보 cmConfigInfo.GetMessage("STORE").MakeMessageOverWrite("Name", BasicInfo.StoreNm); // Add, 2017.03.03 cmConfigInfo.GetMessage("STORE").MakeMessageOverWrite("Address", BasicInfo.StoreAddr); // Add, 2017.03.03 // 통신서버 IP //cmConfigInfo.GetMessage("SERVER ").MakeMessageOverWrite("CommSvrIp ", ServerInfo.SvrIP); // Mod, 2017.03.21 cmConfigInfo.GetMessage("SERVER ").MakeMessageOverWrite("CommSvrIp ", ServerInfo.SvrName); // 디지털메뉴보드 서버 IP = 기본값 공백 cmConfigInfo.GetMessage("SERVER ").MakeMessageOverWrite("DmbSvrIp ", ""); // Del, 2017.03.01 //// 도로공사 매출전송URL //temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "FHIWAY_TRAN_URL", ""); ////if (string.IsNullOrWhiteSpace(temp)) //// temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "HIWAY_TRAN_URL", @"http://skhiway.com/SvrApp/SL000.java"); //cmConfigINfo.GetMessage("SERVER ").MakeMessageOverWrite("ExTranUrl ", temp); //// 도로공사 마감전송URL //temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "FHIWAY_CALC_URL", ""); ////if (string.IsNullOrWhiteSpace(temp)) //// temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "HIWAY_CALC_URL", @"http://skhiway.com/SvrApp/PS000.java"); //cmConfigINfo.GetMessage("SERVER ").MakeMessageOverWrite("ExCalcUrl ", temp); // Add, 2017.03.01, FTP Mode 0:ActiveMode, 1:PassviceMode(Default) // Mod, 2017.04.21, 삼립(국내)은 PassviceMode 모드로 강제 이행처리 // => 2017.04.21 직)그릭슈바인 양재역점 오픈시 AS-IS POS 설정(ActiveMode)으로 이행 후 FTP 접속오류 발생... if (BasicInfo.CompCd == "SLKR") { value = "1"; } else { temp = IniFile.GetValue(BasicInfo.OldFtpINI, "FTPINFO", "FTPPASSIVE"); value = temp.ToUpper() == "N" ? "0" : "1"; } cmConfigInfo.GetMessage("SERVER ").MakeMessageOverWrite("FtpConnType ", value); // 데이터베이스 정보 (암호화) temp = UserAES.StaticKeyEncrypt(DatabaseInfo.DataSource); cmConfigInfo.GetMessage("DATABASE ").MakeMessageOverWrite("LocalSource ", temp); temp = UserAES.StaticKeyEncrypt("POSMST"); cmConfigInfo.GetMessage("DATABASE ").MakeMessageOverWrite("LocalCatalog ", temp); temp = UserAES.StaticKeyEncrypt(DatabaseInfo.UserId); cmConfigInfo.GetMessage("DATABASE ").MakeMessageOverWrite("LocalUserID ", temp); temp = UserAES.StaticKeyEncrypt(DatabaseInfo.Password); cmConfigInfo.GetMessage("DATABASE ").MakeMessageOverWrite("LocalPassword ", temp); // 글로벌 //cmConfigINfo.GetMessage("GLOBAL ").MakeMessageOverWrite("Country ", BasicInfo._country); //cmConfigINfo.GetMessage("GLOBAL ").MakeMessageOverWrite("CultureID ", BasicInfo._cultureid); //cmConfigINfo.GetMessage("GLOBAL ").MakeMessageOverWrite("Font ", BasicInfo._font); //cmConfigINfo.GetMessage("GLOBAL ").MakeMessageOverWrite("FontFix ", BasicInfo._fontFix); temp = cmConfigInfo.GetMessage("GLOBAL").GetValue("Country "); temp = cmConfigInfo.GetMessage("GLOBAL").GetValue("CultureID"); temp = cmConfigInfo.GetMessage("GLOBAL").GetValue("Font "); temp = cmConfigInfo.GetMessage("GLOBAL").GetValue("FontFix "); // 이미지 미출력시 출력할 글씨 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "PRTHEADER1_PRT", ""); cmConfigInfo.GetMessage("PRINT ").MakeMessageOverWrite("TextLogoMsg1 ", temp); temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "PRTHEADER2_PRT", ""); cmConfigInfo.GetMessage("PRINT ").MakeMessageOverWrite("TextLogoMsg2 ", temp); // 저장 cmConfigInfo.MakeFileFromMessage(posConfigFile); #region ### 기타정보 서버전송 // TPay 사용 유무 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "TPAY_DIV", ""); temp = string.IsNullOrWhiteSpace(temp) ? "0" : temp; value = temp == "1" ? "USED" : "NONE"; if (CheckInfo.TPayUsed != value) { if (ComLog.SendStatus(ComLog.CheckStatus.TPAY_USE, value, "TPay Use")) CheckInfo.TPayUsed = value; } // TPay BLE 사용유무 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "TPAY_BLE_DIV", ""); temp = string.IsNullOrWhiteSpace(temp) ? "0" : temp; value = temp == "1" ? "USED" : "NONE"; if (CheckInfo.TPayBleUsed != value) { if (ComLog.SendStatus(ComLog.CheckStatus.TPAY_BLE_USE, value, "TPay BLE Use")) CheckInfo.TPayBleUsed = value; } #endregion return retValue = ComLog.InstallResult.Success; } catch (Exception ex) { statusMsg = "Exception : " + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); // 상태로그 전송 (04:POS Config info migration ) if (string.IsNullOrWhiteSpace(statusMsg)) statusMsg = string.Format("POS Config info migration. Result={0}", ComLog.InstallResultStr[(int)retValue]); ComLog.SendStatus(ComLog.InstallStatus.ConfigMigration, retValue, statusMsg); } } /// /// PosDevice.INI 정보 이행 /// /// /// /// _PosDevice.INI.sample 참조 /// private ComLog.InstallResult MigrationDevice() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; try { base.OnEcho("Migration POS device information."); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); string temp = string.Empty; string value = string.Empty; string deviceInfoFile = Path.Combine(DirInfo.InstallDir, @"INI\PosDevice.INI"); CmMessage cmDeviceInfo = CmMessage.MakeMessageFromFile(deviceInfoFile); #region ### POSPRINTER (PC,SL / BR 다름) // AS-IS PRINT_TYPE=0 PC = 0:사용안함, 1:LPT, 2:SERIAL, 3:OPOS-IBM // SL = 0:사용안함, 1:LPT, 2:SERIAL // BR = 0:사용안함, 1:EPSON, 2:TOSHIBA // TO-BE 1:RS232, 2:OPOS, 3:LPT temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "PRINT_TYPE", ""); if (BasicInfo.CompCd.StartsWith("BR")) { switch (temp) { case "0": value = ""; break; default: value = "1"; break; } } else { switch (temp) { case "0": value = ""; break; case "1": value = "3"; break; // 1:LPT -> 3:LPT case "2": value = "1"; break; // 2:SERIAL -> 1:RS232 case "3": value = "2"; break; // 3:OPOS -> 2:OPOS default: value = "1"; break; } } cmDeviceInfo.GetMessage("POSPRINTER").MakeMessageOverWrite("Controller", value); // 프린터 모델 if (BasicInfo.CompCd.StartsWith("BR")) { // AS-IS PRINT_TYPE=0 BR = 0:사용안함, 1:EPSON, 2:TOSHIBA // TO-BE 1:EPSON, 2:TOSHIBA, 3:IBM, 5:BIXOLON, 6:P2C temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "PRINT_TYPE", ""); switch (temp) { case "1": value = "1"; break; // 1:EPSON -> 1:EPSON case "2": value = "2"; break; // 2:TOSHIBA -> 2:TOSHIBA default: value = ""; break; } } else { // AS-IS PRINT_KIND=0 PC = 0:EPSON, 1:TOSHIBA, 2:IBM // SL = 0:EPSON, 1:TOSHIBA, 2:IBM // TO-BE 1:EPSON, 2:TOSHIBA, 3:IBM, 5:BIXOLON, 6:P2C temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "PRINT_KIND", ""); switch (temp) { case "0": value = "1"; break; // 0:EPSON -> 1:EPSON case "1": value = "2"; break; // 1:TOSHIBA -> 2:TOSHIBA case "2": value = "3"; break; // 2:IBM -> 3:IBM default: value = temp; break; } } cmDeviceInfo.GetMessage("POSPRINTER").MakeMessageOverWrite("Model", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "PRINT_PORT", ""); cmDeviceInfo.GetMessage("POSPRINTER").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "PRINT_BUAD", ""); cmDeviceInfo.GetMessage("POSPRINTER").MakeMessageOverWrite("SerialBaudRate", value); // 0:미사용, 1:사용 temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "PRINT_TYPE", "0"); value = temp == "0" ? "0" : "1"; cmDeviceInfo.GetMessage("POSPRINTER").MakeMessageOverWrite("UseFlag", value); #endregion #region ### SCANNER (TO-BE 미사용) // To-Be 미사용 //// SCANNER_TYPE 0:사용안함, 1:USB, 2:SERIAL //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SCANNER_TYPE", ""); //cmDeviceInfo.GetMessage("SCANNER").MakeMessageOverWrite("Controller", value); //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SCANNER_PORT", ""); //cmDeviceInfo.GetMessage("SCANNER").MakeMessageOverWrite("SerialPortNumber", value); //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SCANNER_PORT", ""); //cmDeviceInfo.GetMessage("SCANNER").MakeMessageOverWrite("SerialPortNumber", value); #endregion #region ### CDP // CDP_TYPE 1:듀얼모니터, 2:CDP Comport // 1:SERIAL temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CDP_TYPE", ""); switch (temp) { case "2": value = "1"; break; default: value = ""; break; } cmDeviceInfo.GetMessage("CDP").MakeMessageOverWrite("Controller", value); // CDP_KIND 0 : Toshiba CDP, 1 : XN CDP value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CDP_KIND", ""); cmDeviceInfo.GetMessage("CDP").MakeMessageOverWrite("Model", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CDP_PORT", ""); cmDeviceInfo.GetMessage("CDP").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CDP_BAUD", ""); cmDeviceInfo.GetMessage("CDP").MakeMessageOverWrite("SerialBaudRate", value); // CDP_TYPE 1:듀얼모니터, 2:CDP Comport // 0:미사용, 1:사용 temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CDP_TYPE", ""); switch (temp) { case "2": value = "1"; break; default: value = "0"; break; } cmDeviceInfo.GetMessage("CDP").MakeMessageOverWrite("UseFlag", value); #endregion #region ### CASHDRAWER // 1. 2016.12.22(목) 확인 사항 // * 3:DLL-TPS8700, 4:DLL-VPS9700, 5:IBM-본체 제어방식에 대한 개발이 안되어있음 // * 3:DLL-TPS8700, 4:DLL-VPS9700은 벨크리텍 장비로 추정되고 사용하지 않는다고 함. (안호성C 확인) // // AS-IS CASHDRAWER_TYPE=0 0:사용안함, 1:프린터, 2:OPOS-IBM, 3:DLL-TPS8700, 4:DLL-VPS9700, 5:IBM-본체 // TO-BE CashDrawerType 0:OPOS 1:RS232(프린터) 2:IBM본체연결 => 변경됨(2017.02.15) // (TO-BE 변경, 2017.02.15) // TO-BE CashDrawerType 1:프린터, 2:OPOS-IBM, 3:DLL-TPS8700, 4:DLL-VPS9700, 5:IBM-본체 //temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CASHDRAWER_TYPE", ""); //switch (temp) //{ // case "0": value = ""; break; // 0:사용안함 // case "1": value = "1"; break; // 1:프린터 -> 1:RS232 // case "2": value = "0"; break; // 2:OPOS-IBM -> 0:OPOS // case "5": value = "2"; break; // 5:IBM-본체 -> 2:IBM본체연결 // default: value = "X" + temp; break; //} value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CASHDRAWER_TYPE", ""); // Mod, 2017.02.15 cmDeviceInfo.GetMessage("CASHDRAWER").MakeMessageOverWrite("CashDrawerType", value); // 0:미사용, 1:사용 temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CASHDRAWER_TYPE", ""); value = temp == "0" ? "0" : "1"; cmDeviceInfo.GetMessage("CASHDRAWER").MakeMessageOverWrite("UseFlag", value); // PORT value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CASHDRAWER_PORT", ""); // Add, 2017.02.15 cmDeviceInfo.GetMessage("CASHDRAWER").MakeMessageOverWrite("SerialPortNumber", value); // BaudRate value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CASHDRAWER_BAUD", ""); // Add, 2017.02.15 cmDeviceInfo.GetMessage("CASHDRAWER").MakeMessageOverWrite("SerialBaudRate", value); #endregion #region ### MSR // AS-IS의 모든 설정값을 이행 한다. // Keybord Wedge 방식만 있다고 SPC에서 지랄함. // Toshiba pos 는 D:\ST-A20.A00 Program\NEW ST-A20 OPOS WinV1007\TECMCR.exe 시작프로그램으로 구동 OPOS to keybord wedge 변환 처리 // AS-IS MSR_TYPE PC = 0:사용안함, 1:USB, 2:SERIAL, 3:OPOS-IBM, 4:IBM-SERIAL, 5:IC-보안 // SL = 0:사용안함, 1:USB, 2:SERIAL, 3:E70-SERIAL, 4:IC-보안 // BR = 0:사용안함, 1:USB, 2:SERIAL, 3:SERIAL[FUJITSU], 4:IC, 5:SERIAL[IBM-SERIAL] // TO-BE 1:USB(KeybordWedge), 2:Serial(에뮬레이터제어) #region (주석) 2017.04.17, 시리얼 장비가 존재한다. //temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_TYPE", ""); //// MSR 사용구분 0:미사용, 1:사용 //string msrUse = string.Empty; //// AS-IS MSR_TYPE이 IC-보안이면, TO-BE UseFlag 미사용 //if (temp == "0") // msrUse = "0"; //else if (BasicInfo.CompCd.StartsWith("PC") && temp == "5") // msrUse = "0"; //else if (BasicInfo.CompCd.StartsWith("SL") && temp == "4") // msrUse = "0"; //else if (BasicInfo.CompCd.StartsWith("BR") && temp == "4") // msrUse = "0"; //else // msrUse = "1"; //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("UseFlag", msrUse); //// 제어방식, TO-BE는 1:USB(KeybordWedge) 방식만 존재함. //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("Controller", "1"); //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_PORT", ""); //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("SerialPortNumber", value); //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_BAUD", ""); //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("SerialBaudRate", value); //// AS-IS MSR_STYPE 0:NORMAL, 1:TOSHIBA //// TO-BE Model 0:NORMAL, 1:TOSHIBA //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_STYPE", ""); //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("Model", value); //// 황건일C 요청으로 TrackIIData stx, etx 재정의 ////MSR_TRACK=0 SP = 0: ';' 1 byte 제거, 마지막 BYTE '?' 제거 , 1: '?' 1 byte 제거 //// SL = 0: ';' 1 byte 제거, 마지막 BYTE '?' 제거 , 1: '?' 1 byte 제거 //// BR = X //temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_TRACK", ""); //string stx = string.Empty; //string etx = string.Empty; //switch (temp) //{ // case "0": stx = ";"; etx = "?"; break; // case "1": stx = "?"; etx = ""; break; //} //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("STX", stx); //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("ETX", etx); #endregion #region (주석) 2017.04.24, SPCN요청으로 Serial MSR 장비 정보를 레지스트리에서 확인 //// MSR 사용구분 0:미사용, 1:사용 //// MSR 제어구분 1:USB(KeybordWedge), 2:Serial(에뮬레이터제어) //// AS-IS MSR_TYPE이 IC-보안이면, TO-BE UseFlag 미사용 //var msrUse = "0"; //var msrType = string.Empty; //temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_TYPE", "0").Trim(); //if (BasicInfo.CompCd.StartsWith("PC")) //{ // switch (temp) // { // case "1": msrUse = "1"; msrType = "1"; break; // 1:USB(KeybordWedge) // case "2": msrUse = "1"; msrType = "2"; break; // 2:SERIAL // case "3": msrUse = "1"; msrType = "2"; break; // 3:OPOS-IBM // case "4": msrUse = "1"; msrType = "2"; break; // 4:IBM-SERIAL // case "5": msrUse = "0"; msrType = ""; break; // 5:IC-보안 // default: msrUse = "0"; msrType = ""; break; // } //} //else if (BasicInfo.CompCd.StartsWith("SL")) //{ // switch (temp) // { // case "1": msrUse = "1"; msrType = "1"; break; // 1:USB(KeybordWedge) // case "2": msrUse = "1"; msrType = "2"; break; // 2:SERIAL // case "3": msrUse = "1"; msrType = "2"; break; // 3:E70-SERIAL // case "4": msrUse = "0"; msrType = ""; break; // 4:IC-보안 // default: msrUse = "0"; msrType = ""; break; // } //} //else if (BasicInfo.CompCd.StartsWith("BR")) //{ // switch (temp) // { // case "1": msrUse = "1"; msrType = "1"; break; // 1:USB(KeybordWedge) // case "2": msrUse = "1"; msrType = "2"; break; // 2:SERIAL // case "3": msrUse = "1"; msrType = "2"; break; // 3:SERIAL[FUJITSU] // case "4": msrUse = "0"; msrType = ""; break; // 4:IC // case "5": msrUse = "1"; msrType = "2"; break; // 5:SERIAL[IBM-SERIAL] // default: msrUse = "0"; msrType = ""; break; // } //} //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("UseFlag", msrUse); //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("Controller", msrType); //// MSR Port //var msrPort = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_PORT", "").Trim(); //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("SerialPortNumber", msrPort); //// MSR Baudreate //var msrBaud = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_BAUD", "").Trim(); //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("SerialBaudRate", msrBaud); //// MSR Vendor / Model 추가 //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("Model", "ETC"); ////cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("Vendor", "ETC"); // Del, 2017.04.17, 조충연K 삭제요청 //// 황건일C 요청으로 TrackIIData stx, etx 재정의 ////MSR_TRACK=0 SP = 0: ';' 1 byte 제거, 마지막 BYTE '?' 제거 , 1: '?' 1 byte 제거 //// SL = 0: ';' 1 byte 제거, 마지막 BYTE '?' 제거 , 1: '?' 1 byte 제거 //// BR = X //temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_TRACK", ""); //var stx = string.Empty; //var etx = string.Empty; //switch (temp) //{ // case "0": stx = ";"; etx = "?"; break; // case "1": stx = "?"; etx = ""; break; //} //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("STX", stx); //cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("ETX", etx); //// Add, 2017.04.17, O2MSR.Conf 설정 //// SPCN에서 제공한 MSR 리더기 에뮬레이터(SPCN 제공)한 "O2MSR.exe"의 설정파일("O2MSR.Conf") 설정 //// POS H/W 밴더와 MSR 모델을 현재 AS-IS INI 파일에서 알수 없다. //var confPath = Path.Combine(DirInfo.InstallDir, @"BIN\O2MSR.Conf"); //IniFile.SetValue(confPath, "MSRINFO", "COMPORT", msrPort); //IniFile.SetValue(confPath, "MSRINFO", "BAUDRATE", msrBaud); ////IniFile.SetValue(confPath, "MSRINFO", "VENDOR", "ETC"); // Del, 2017.04.17, SPCN 삭제요청 //IniFile.SetValue(confPath, "MSRINFO", "MODEL", "ETC"); #endregion #region ### 2017.04.24 SPCN MSR 정보 이행 요건 ### // ### 2017.04.24 SPCN MSR 정보 이행 요건 ### // [차세대]AS-IS ini 이관 추가 요청 사항 입니다 // 안녕 하세요 진민준 입니다. // 금일 그릭슈바인 MSR 리딩 문제 관련 해결 방안입니다.가맹점 배포시 해당내역을 최소할 할수 있을꺼라 // 생각바 구현 부분에 대한 검토 부탁 드립니다. // 1. 문제 발생 원인 // - AS-IS 이관 내역으로 신규 O2MSR 자동 셋팅해 주는데 AS-IS ini COM 잘못 등록되어 있어서 미구동 되는 현상발생 // - AS-IS ini 확인한 결과 시리얼에 COM3으로 설정되어 있으나 실제로는 TECMCR.exe 사용 COM5 키보드 엣찌로 처리 하고 있었음 // 2. 해결 방안 // - AS-IS ini 파일의 내역을 이관 해서 처리 했으나 AS-IS 등록된 내역이 부정확한 내역이 발생 하는 케이스가 있으니 // reg 확인을 통해 처리 하시기 바랍니다. // AS-IS ini 파일을 이관시 하기 내역 체크후 내역을 갱신 부탁 드립니다. // 3. A20 일경우 // - [HKEY_LOCAL_MACHINE\SOFTWARE\OLEforRetail\ServiceOPOS\MSR\MCRRMS] 확인후 // ==> 해당 내역으로 포트 갱신 "Port"="COM5" // 4. IBM 경우 // - [HKEY_LOCAL_MACHINE\SOFTWARE\OLEforRetail\ServiceOPOS\MSR\POS_MSR] 확인후 // ==> 해당 내역으로 포트 갱신 "ComPort"="5" // ==> 해당 내역으로 속도 갱신 "BaudRate"="19200" // 5. 장비 구분을 할 수 없으니 3번 4번 체크 후 해당 reg 없는 경우 AS-IS ini 기준 으로 처리 해당 // reg있는 경우는 reg 기준으로 정보 갱신 부탁 드립니다. 3,4 같이 존재 하는 Case 없을 것으로 판단 됩니다. #endregion var msrUse = "0"; var msrType = string.Empty; temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_TYPE", "0").Trim(); if (BasicInfo.CompCd.StartsWith("PC")) { switch (temp) { case "1": msrUse = "1"; msrType = "1"; break; // 1:USB(KeybordWedge) case "2": msrUse = "1"; msrType = "2"; break; // 2:SERIAL case "3": msrUse = "1"; msrType = "2"; break; // 3:OPOS-IBM case "4": msrUse = "1"; msrType = "2"; break; // 4:IBM-SERIAL case "5": msrUse = "0"; msrType = ""; break; // 5:IC-보안 default: msrUse = "0"; msrType = ""; break; } } else if (BasicInfo.CompCd.StartsWith("SL")) { switch (temp) { case "1": msrUse = "1"; msrType = "1"; break; // 1:USB(KeybordWedge) case "2": msrUse = "1"; msrType = "2"; break; // 2:SERIAL case "3": msrUse = "1"; msrType = "2"; break; // 3:E70-SERIAL case "4": msrUse = "0"; msrType = ""; break; // 4:IC-보안 default: msrUse = "0"; msrType = ""; break; } } else if (BasicInfo.CompCd.StartsWith("BR")) { switch (temp) { case "1": msrUse = "1"; msrType = "1"; break; // 1:USB(KeybordWedge) case "2": msrUse = "1"; msrType = "2"; break; // 2:SERIAL case "3": msrUse = "1"; msrType = "2"; break; // 3:SERIAL[FUJITSU] case "4": msrUse = "0"; msrType = ""; break; // 4:IC case "5": msrUse = "1"; msrType = "2"; break; // 5:SERIAL[IBM-SERIAL] default: msrUse = "0"; msrType = ""; break; } } cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("UseFlag", msrUse); cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("Controller", msrType); var msrPort = string.Empty; var msrBaud = string.Empty; //var msrModel = "ETC"; var msrEtc = string.Empty; if (string.IsNullOrEmpty(msrPort)) { // HKEY_LOCAL_MACHINE\SOFTWARE\OLEforRetail\ServiceOPOS\MSR\MCRRMS var subKey = @"SOFTWARE\OLEforRetail\ServiceOPOS\MSR\MCRRMS"; var isExsist = Registry.IsExistKey(Microsoft.Win32.Registry.LocalMachine, subKey); if (isExsist) { msrPort = Registry.GetValue(Microsoft.Win32.Registry.LocalMachine, subKey, "Port").Trim(); msrBaud = "9600"; msrEtc = "A20"; } } if (string.IsNullOrEmpty(msrPort)) { // HKEY_LOCAL_MACHINE\SOFTWARE\OLEforRetail\ServiceOPOS\MSR\POS_MSR var subKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\OLEforRetail\ServiceOPOS\MSR\POS_MSR"; var isExsist = Registry.IsExistKey(Microsoft.Win32.Registry.LocalMachine, subKey); if (isExsist) { msrPort = Registry.GetValue(Microsoft.Win32.Registry.LocalMachine, subKey, "ComPort").Trim(); msrBaud = Registry.GetValue(Microsoft.Win32.Registry.LocalMachine, subKey, "BaudRate").Trim(); msrEtc = "IBM"; } } if (string.IsNullOrEmpty(msrPort)) { msrPort = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_PORT", "").Trim(); msrBaud = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_BAUD", "").Trim(); } if (string.IsNullOrEmpty(msrPort) == false) { msrPort = "COM" + msrPort.ToUpper().Replace("COM", "").Trim(); } cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("SerialPortNumber", msrPort); cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("SerialBaudRate", msrBaud); cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("Model", "ETC"); // 황건일C 요청으로 TrackIIData stx, etx 재정의 //MSR_TRACK=0 SP = 0: ';' 1 byte 제거, 마지막 BYTE '?' 제거 , 1: '?' 1 byte 제거 // SL = 0: ';' 1 byte 제거, 마지막 BYTE '?' 제거 , 1: '?' 1 byte 제거 // BR = X temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_TRACK", ""); var stx = string.Empty; var etx = string.Empty; switch (temp) { case "0": stx = ";"; etx = "?"; break; case "1": stx = "?"; etx = ""; break; } cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("STX", stx); cmDeviceInfo.GetMessage("MSR").MakeMessageOverWrite("ETX", etx); // O2MSR.Conf 설정 // SPCN에서 제공한 MSR 리더기 에뮬레이터(SPCN 제공)한 "O2MSR.exe"의 설정파일("O2MSR.Conf") 설정 // POS H/W 밴더와 MSR 모델을 현재 AS-IS INI 파일에서 알수 없다. // NewPosInstaller.exe 에서 O2MSR.conf 관련 손대지말라고 해서 주석 처리(2017.07.24) var confPath = Path.Combine(DirInfo.InstallDir, @"BIN\O2MSR.Conf"); //IniFile.SetValue(confPath, "MSRINFO", "COMPORT", msrPort); //IniFile.SetValue(confPath, "MSRINFO", "BAUDRATE", msrBaud); //IniFile.SetValue(confPath, "MSRINFO", "MODEL", msrModel); // Add, 2017.04.27, 잠바주스 오픈 시 O2MSR.Conf 파일이 없다고 한다. 그래서 백업받기로 했다. // 0014932 삼성타운잠바주스 // 0016912 도곡잠바주스 try { if (File.Exists(confPath) == false) { var msg = "Error creating O2MSR.Conf file [" + confPath + "], File not found"; ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + msg, true); } else { File.Copy(Path.Combine(DirInfo.InstallDir, @"BIN\O2MSR.Conf"), Path.Combine(DirInfo.InstallDir, @"BIN\O2MSR.Conf.bck"), true); Thread.Sleep(100); ComLib.CreateDirectory(DirInfo.BackDir); File.Copy(Path.Combine(DirInfo.InstallDir, @"BIN\O2MSR.Conf"), Path.Combine(DirInfo.BackDir, @"O2MSR.Conf." + DateTime.Now.ToString("yyyyMMddHHmmss")), true); Thread.Sleep(100); var msg = "Successful migration of O2MSR.Conf"; ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + msg, true); } } catch { } #endregion #region ### ICREADER (MSR 항목과 배타적으로 사용됨) // ICReader 사용구분은 MSR과 배타적이다. // MSR 사용구분 0:미사용 이면, ==> IC사용 value = msrUse == "0" ? "1" : "0"; cmDeviceInfo.GetMessage("ICREADER").MakeMessageOverWrite("UseFlag", value); var icPort = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_PORT", ""); cmDeviceInfo.GetMessage("ICREADER").MakeMessageOverWrite("SerialPortNumber", icPort); var icBaud = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "MSR_BAUD", ""); cmDeviceInfo.GetMessage("ICREADER").MakeMessageOverWrite("SerialBaudRate", icBaud); #endregion #region ### CATTERMINAL // 2016.12.28 김광오B(진코퍼레이션) 확인 사항 // CATDEV_* -> 구형 CAT 단말기 (IC불가능) PC,SL // EMV_* -> 신형 CAT 단말기 (IC가능) PC,SL // FEMV_* -> 신형 CAT 단말기 (IC가능) BRK // 2016.12.28 현재 구형 CAT 단말기 사용 유무 및 용도는 불명확 함. // 이행 시 CATTERMINAL Section에 Model 항목을 추가 하여 구분하며, 신형CAT단말기 항목을 우선 한다. var catTermialKind = "1"; // 0:구형(IC불가능), 1:신형(IC가능) if (BasicInfo.CompCd.StartsWith("BR")) { // 사용여부 0:미사용, 1:사용 value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FEMV_TYPE", "0"); cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("UseFlag", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FEMV_PORT", ""); cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FEMV_BAUD", ""); cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("SerialBaudRate", value); // BR은 무조건 신형단말기, 0:구형(IC불가능), 1:신형(IC가능) //cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("Model", "1"); catTermialKind = "1"; } else { // => 일단 신형단말기 항목을 이행하고, // 사용여부 0:미사용, 1:사용 value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "EMV_TYPE", "0"); cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("UseFlag", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "EMV_PORT", ""); cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "EMV_BAUD", ""); cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("SerialBaudRate", value); // Timeout 사용하지 않음. cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("TimeOut", "5"); // 0:구형(IC불가능), 1:신형(IC가능) //cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("Model", "1"); catTermialKind = "1"; #region Del, 2017.06.07, 구형단말기(CATDEV_TYPE 항목)은 사용하지 않는다. 안호성B SPCN에 확인 함. //// => 신형이 미사용이고 구형단말기가 사용이면 덮어 쓴다. //if (IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "EMV_TYPE", "0") == "0" && // IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CATDEV_TYPE", "0") == "1") //{ // value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CATDEV_TYPE", "0"); // cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("UseFlag", value); // value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CATDEV_PORT", ""); // cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("SerialPortNumber", value); // value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "CATDEV_BAUD", ""); // cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("SerialBaudRate", value); // // Timeout 사용하지 않음. // cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("TimeOut", "5"); // // 0:구형(IC불가능), 1:신형(IC가능) // //cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("Model", "0"); // catTermialKind = "0"; //} #endregion } // Add, 2017.04.25, CAT단말기 모델 추가 요건 => "11:국내", "21:샨더", "22:은련" if (BasicInfo.Nation == "CHN") { // 현재(2017.04.25) "21:샨더", "22:은련" 판단기준이 없음. cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("Model", "21"); } else { cmDeviceInfo.GetMessage("CATTERMINAL").MakeMessageOverWrite("Model", "11"); } #endregion #region ### SIGNPAD // 이슈 // 1. 일반서명패드 / 보안서명패드 구분 안됨. => 안해도 된다고 손부장님이 말했다. if (BasicInfo.CompCd.StartsWith("BR")) { // AS-IS SIGNPAD_KIND=3 0:미사용, 1:SSP-100, 2:SN-350P, 3:SN-150P // TO-BE Model 1:OLTMS, 2:OLCSP, 3:SSP-100, 4:SN-350P, 5:SN-150P temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SIGNPAD_TYPE", "0"); switch (temp) { case "1": value = "3"; break; case "2": value = "4"; break; case "3": value = "5"; break; default: value = "0"; break; } if (string.IsNullOrWhiteSpace(value) || value == "0") { // UseFlag 0:미사용, 1:사용 cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("UseFlag", "0"); } else { // UseFlag 0:미사용, 1:사용 cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("UseFlag", "1"); } cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("Model", value); } else { // SIGNPAD_TYPE=1 0:미사용, 1:사용 // UseFlag 0:미사용, 1:사용 value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SIGNPAD_TYPE", "0"); cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("UseFlag", value); // AS-IS SIGNPAD_KIND=3 0:OLTMS, 1:OLCSP, 2:SSP-100, 3:SN-350P, 4:SN-150P // TO-BE Model 1:OLTMS, 2:OLCSP, 3:SSP-100, 4:SN-350P, 5:SN-150P temp = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SIGNPAD_KIND", "0"); switch (temp) { case "0": value = "1"; break; // 0:OLTMS -> 1:OLTMS case "1": value = "2"; break; // 1:OLCSP -> 2:OLCSP case "2": value = "3"; break; // 2:SSP-100 -> 3:SSP-100 case "3": value = "4"; break; // 3:SN-350P -> 4:SN-350P case "4": value = "5"; break; // 4::SN-150P -> 5::SN-150P default: value = ""; break; } cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("Model", value); } value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SIGNPAD_PORT", ""); cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SIGNPAD_BAUD", ""); cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("SerialBaudRate", value); cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("FileDate", ""); // 조충연K 기본값 확인 필요 !!! => 2016.12.26 확인완료 cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("AutoFlag", "1"); cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("MinCnt", "3"); cmDeviceInfo.GetMessage("SIGNPAD").MakeMessageOverWrite("TimeOut", "30"); #endregion #region ### SCALE if (BasicInfo.CompCd.StartsWith("BR")) { // SCALE_TYPE=0 0;사용안함 1: SERIAL value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_TYPE", "0"); cmDeviceInfo.GetMessage("SCALE").MakeMessageOverWrite("UseFlag", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_PORT", ""); cmDeviceInfo.GetMessage("SCALE").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_BAUD", ""); cmDeviceInfo.GetMessage("SCALE").MakeMessageOverWrite("SerialBaudRate", value); } else { // SCALE_TYPE=0 0;사용안함 1: SERIAL value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SCALE_TYPE", "0"); cmDeviceInfo.GetMessage("SCALE").MakeMessageOverWrite("UseFlag", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SCALE_PORT", ""); cmDeviceInfo.GetMessage("SCALE").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "SCALE_BAUD", ""); cmDeviceInfo.GetMessage("SCALE").MakeMessageOverWrite("SerialBaudRate", value); } #endregion #region ### WIRELESSSCALE (아마도 BR만 사용?, FSCALE_POLE_TYPE 일까??) => 삭제 //// FSCALE_POLE_TYPE =0 0;사용안함 1: SERIAL //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_POLE_TYPE", "0"); //cmDeviceInfo.GetMessage("WIRELESSSCALE").MakeMessageOverWrite("UseFlag", value); //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_POLE_PORT", ""); //cmDeviceInfo.GetMessage("WIRELESSSCALE").MakeMessageOverWrite("SerialPortNumber", value); //value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_POLE_BAUD", ""); //cmDeviceInfo.GetMessage("WIRELESSSCALE").MakeMessageOverWrite("SerialBaudRate", value); #endregion #region ### SCALEPOLEDISP (아마도 BR만 사용) // FSCALE_POLE_TYPE =0 0;사용안함 1: SERIAL value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_POLE_TYPE", "0"); cmDeviceInfo.GetMessage("SCALEPOLEDISP").MakeMessageOverWrite("UseFlag", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_POLE_PORT", ""); cmDeviceInfo.GetMessage("SCALEPOLEDISP").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FSCALE_POLE_BAUD", ""); cmDeviceInfo.GetMessage("SCALEPOLEDISP").MakeMessageOverWrite("SerialBaudRate", value); #endregion #region ### LABELPRINTER ( BR 만 사용) // FLABELPRINT_TYPE=1 0;사용안함 1: SERIAL value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FLABELPRINT_TYPE", "0"); cmDeviceInfo.GetMessage("LABELPRINTER").MakeMessageOverWrite("UseFlag", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FLABELPRINT_PORT", ""); cmDeviceInfo.GetMessage("LABELPRINTER").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FLABELPRINT_BAUD", ""); cmDeviceInfo.GetMessage("LABELPRINTER").MakeMessageOverWrite("SerialBaudRate", value); // FLABEL_PAPER_DIV=0 라벨프린터 신규양식지 구분 0; 구양식, 1: 신규양식 value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FLABEL_PAPER_DIV", ""); cmDeviceInfo.GetMessage("LABELPRINTER").MakeMessageOverWrite("Model", value); #endregion #region ### RF DEVICE (LG 사원증 인식용 RF 장비) // FRF_TYPE => LG사원증 인식용 (LG트윈타워 던킨매장에서 만 사용한다고 함) // 2016.12.29 김광오B(진코퍼레이션) 확인 사항 value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FRF_TYPE", "0"); cmDeviceInfo.GetMessage("LGEMPRF").MakeMessageOverWrite("UseFlag", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FRF_PORT", ""); cmDeviceInfo.GetMessage("LGEMPRF").MakeMessageOverWrite("SerialPortNumber", value); value = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", "FRF_BAUD", ""); cmDeviceInfo.GetMessage("LGEMPRF").MakeMessageOverWrite("SerialBaudRate", value); #endregion // 저장 cmDeviceInfo.MakeFileFromMessage(deviceInfoFile); #region ### 주요장치정보 서버전송 // 카드리더기 종류 서버전송 => MSR(USB:KeybordWedge), MSR(Serial:Emulator), IC // MSR 사용구분 0:미사용, 1:사용 string status = string.Empty; var remark = string.Empty; temp = cmDeviceInfo.GetMessage("MSR").GetMessageValue("UseFlag"); temp = temp == null ? string.Empty : temp.Trim(); //value = temp == "1" ? "MSR" : "IC"; if (temp == "1") { temp = cmDeviceInfo.GetMessage("MSR").GetMessageValue("Controller"); temp = temp == null ? string.Empty : temp.Trim(); value = temp == "2" ? "MSR(Serial:Emulator)" : "MSR(USB:KeybordWedge)"; remark = string.Format("Cardreader Type={0}({1}), Port={2}, BoudReate={3} {4}", temp, value, msrPort, msrBaud, msrEtc); } else { value = "IC"; remark = string.Format("Cardreader Type={0}, Port={1}, BoudReate={2}", temp, icPort, icBaud); } if (CheckInfo.CardReader != value) { //if (ComLog.SendStatus(ComLog.CheckStatus.CARD_READER_TYPE, value, remark)) if (ComLog.SendStatus(ComLog.CheckStatus.CARD_READER_TYPE, "MSR", remark)) CheckInfo.CardReader = value; } // CAT단말기 종류 (사용안함, 신형, 구형) remark = string.Empty; temp = cmDeviceInfo.GetMessage("CATTERMINAL").GetMessageValue("UseFlag"); temp = temp == null ? "0" : temp.Trim(); value = "NONE"; if (temp != "0") { //temp = cmDeviceInfo.GetMessage("CATTERMINAL").GetMessageValue("Model"); //temp = temp == null ? "" : temp; //if (temp == "0") value = "OLD"; else if (temp == "1") value = "NEW"; else value = "NONE"; value = catTermialKind == "0" ? "OLD" : "NEW"; temp = cmDeviceInfo.GetMessage("CATTERMINAL").GetMessageValue("Model"); remark = string.Format("CatTermianl Type={0} Model={1}", value, temp); } else { value = "NONE"; remark = string.Format("CatTermianl Type={0}", value); } if (CheckInfo.CatTerminal != value) { if (ComLog.SendStatus(ComLog.CheckStatus.CAT_TERM_TYPE, value, remark)) CheckInfo.CatTerminal = value; } #endregion return retValue = ComLog.InstallResult.Success; } catch (Exception ex) { statusMsg = "Exception : " + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); // 상태로그 전송 (05:POS Device info migration) if (string.IsNullOrWhiteSpace(statusMsg)) statusMsg = string.Format("POS Device info migration. Result={0}", ComLog.InstallResultStr[(int)retValue]); ComLog.SendStatus(ComLog.InstallStatus.ConfigMigration, retValue, statusMsg); } } /// /// SaleInfo, 시스템오픈일자 저장 /// /// private bool MigrationSaleInfo() { bool retValue = false; try { base.OnEcho("Migration POS sale information."); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); string temp = string.Empty; string value = string.Empty; string saleInfoFile = Path.Combine(DirInfo.InstallDir, @"INI\PosSaleInfo.INI"); CmMessage cmSaleInfo = CmMessage.MakeMessageFromFile(saleInfoFile); cmSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("SysOpenDate", BasicInfo.SysOpenDate); // 저장 cmSaleInfo.MakeFileFromMessage(saleInfoFile); return retValue = true; } catch (Exception ex) { ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => Exception : " + ex.Message); return retValue = false; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", retValue ? "Success" : "Failed")); } } /// /// 주방프린터 마스터 이행 (서버전송처리) /// 주방모니터 마스터 이행 (서버전송처리, 2017.04.28 추가) /// /// private ComLog.InstallResult MigrationKPSMaster() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; // 백업대상 데이터 Dictionary backDataList = new Dictionary(); try { base.OnEcho("Migration POS KPS/KVS Master"); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); // 변경여부 bool isModify = false; // 전송대상목록 List kpsSendList = new List(); #region ### KPS Master 추출 for (var i = 1; i <= 15; i++) { // 0:TYPE, 1:IP, 2:PORT, 3:CONT, 4:KIND, 5:BAUD, 6:KIND var kps = new string[7]; var key = string.Format("KPS{0:D2}", i); // TYPE 0:사용안함, 1:IP, 2:SERIAL kps[0] = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", string.Format("NETPRT{0}_TYPE", i), ""); // IP kps[1] = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", string.Format("NETPRT{0}_IP", i), ""); // PORT kps[2] = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", string.Format("NETPRT{0}_PORT", i), ""); // CONT kps[3] = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", string.Format("NETPRT{0}_CONT", i), ""); // KIND kps[4] = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", string.Format("NETPRT{0}_KIND", i), ""); // BAUD kps[5] = IniFile.GetValue(BasicInfo.OldDeviceINI, "DEVICEINFO", string.Format("NETPRT{0}_BAUD", i), ""); // KIND 1:KPS, 2:KVS, 3:KDS kps[6] = "1"; // 변경여부 확인 var oldValue = BasicInfo.GetKPSInfo(key).Trim(); var newValue = string.Join(" ", kps).Trim(); if (oldValue != newValue) isModify = true; // 전송대상목록 kpsSendList.Add(kps); // 여기서 백업하면, 전송실패 시 문제가 된다. //BasicInfo.SetKPSInfo(key, newValue); backDataList.Add(key, newValue); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => KPS master NewValue=[{0}] BckValue=[{1}]", newValue, oldValue)); } #endregion #region ### KVS Master 추출 var kvsip = string.Empty; if (BasicInfo.CompCd.StartsWith("BR")) { kvsip = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "MONITOR_IP").Trim(); } else { kvsip = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "MONITORSEND_IP").Trim(); } if (string.IsNullOrWhiteSpace(kvsip) == false) { // 0:TYPE, 1:IP, 2:PORT, 3:CONT, 4:KIND, 5:BAUD, 6:KIND var kvs = new string[7]; var key = "16"; // TYPE 0:사용안함, 1:IP, 2:SERIAL kvs[0] = "1"; // IP kvs[1] = kvsip; // PORT kvs[2] = "9001"; // CONT kvs[3] = ""; // KIND kvs[4] = ""; // BAUD kvs[5] = ""; // KIND 1:KPS, 2:KVS, 3:KDS kvs[6] = "2"; this.isExistsKVS = true; // 변경여부 확인 var oldValue = BasicInfo.GetKPSInfo(key).Trim(); var newValue = string.Join(" ", kvs).Trim(); if (oldValue != newValue) isModify = true; // 전송대상목록 kpsSendList.Add(kvs); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => KVS master NewValue=[{0}] BckValue=[{1}]", newValue, oldValue)); } #endregion ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => KPS/KVS master Modify={0} ListCount={1}", isModify.ToString(), kpsSendList.Count.ToString())); #region ### 데이터 서버 전송 if (isModify == false) { statusMsg = "KPS/KVS Master, No change data, migration skip"; return retValue = ComLog.InstallResult.Skip; } const string ROW_SPLIT = "#~"; const string COL_SPLIT = "|"; List lstData = new List(); //foreach (string[] kps in kpsSendList) for (var i = 0; i < kpsSendList.Count; i++) { string[] kps = (string[])kpsSendList[i]; // 04:KPS 마스터 // #~장치코드|장치명|장치사용구분(1:Serial, 3:Lan)|ComPort|ComBaudRate|NetIP|NetPort|장치구분 // 0 1 2 3 4 5 6 7 // 데이터가 없으면 전송하지 않는다. if (string.IsNullOrWhiteSpace(string.Join("", kps).Trim())) continue; // TYPE 0:사용안함, 1:IP, 2:SERIAL if (kps[0] == "0") continue; string[] data = new string[8]; // 장치코드 data[0] = (i + 1).ToString("00"); // 장치명 data[1] = data[0]; // 장치사용구분(1:Serial, 3:Lan) switch (kps[0]) { case "1": // Lan data[2] = "3"; // 장치사용구분 data[3] = string.Empty; // 시리얼포트 (COM1...) data[4] = "0"; // 시리얼Baudreate data[5] = kps[1]; // 네트워크 IP data[6] = ComLib.IntParse(kps[2]).ToString(); // 네트워크 PORT data[7] = kps[6]; // 장치구분 1:KPS, 2:KVS, 3:KDS break; case "2": // Serial data[2] = "1"; // 장치사용구분 // COM 문자 제거요청 김용현R //data[3] = kps[2]; // 시리얼포트 (COM1...) data[3] = kps[2].ToUpper().Replace("COM", ""); data[4] = ComLib.IntParse(kps[5]).ToString(); // 시리얼Baudreate data[5] = string.Empty; // 네트워크 IP data[6] = "0"; // 네트워크 PORT data[7] = kps[6]; // 장치구분 1:KPS, 2:KVS, 3:KDS break; default: continue; } string rowData = string.Join(COL_SPLIT, data); lstData.Add(rowData); } if (lstData.Count > 0) { string dataList = string.Join(ROW_SPLIT, lstData.ToArray()); Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); // 통신해더 생성 string commHead = ItemColumn.MakeCommHeader(0, "06"); // 전송데이터 htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.INQ_TYPE, Column.IQ_TMP_POSMST_INQ.MSG_ID); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.STOR_CD, BasicInfo.StoreNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.POS_NO, BasicInfo.PosNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.MST_KIND, Column.IQ_TMP_POSMST_INQ.MSTKIND.KPS); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.DATA_LIST, dataList); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.RES_CD, ""); NetworkJSON irt = new NetworkJSON(); int ret = irt.IRTSendReceive(ServerInfo.SvrIP, ServerInfo.SvrPort, 1000 * 20, commHead, htSendData, ref htRecvData); if (ret != ComLib.OK) { ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => Server communication error"); statusMsg = "Server communication error"; return retValue = ComLog.InstallResult.Fail; } string res = htRecvData[Column.IQ_INSTALL_SCHEDULE_INQ.DATA.RES_CD].ToString().Trim(); statusMsg = string.Format("KPS/KVS info upload. Result={0} IQ_TMP_POSMST_INQ.DATA.RES_CD={1}", ComLog.InstallResultStr[(int)retValue], res); ComLog.WriteLog(res == "00" ? ComLog.Level.trace : ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , statusMsg); return retValue = res == "00" ? ComLog.InstallResult.Success : ComLog.InstallResult.Fail; } else { statusMsg = "KPS/KVS Master, Not exist data"; return retValue = ComLog.InstallResult.Skip; } #endregion } catch (Exception ex) { statusMsg = "Exception=" + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); // 성공시에 데이터 백업 if (retValue != ComLog.InstallResult.Fail) { foreach (var data in backDataList) { BasicInfo.SetKPSInfo(data.Key, data.Value); } } // 상태로그 전송 (06:KPS info upload) if (string.IsNullOrWhiteSpace(statusMsg)) statusMsg = string.Format("KPS info upload. Result={0}", ComLog.InstallResultStr[(int)retValue]); ComLog.SendStatus(ComLog.InstallStatus.KPSInfoUpload, retValue, statusMsg); } } /// /// 진코퍼레이션 제공 마스터 추출 프로그램 실행 /// /// private bool ExcuteSPCTouchTxt() { bool retValue = false; string exeName = "SPCTouchTxt.exe"; try { base.OnEcho(string.Format("Execute external program. ({0})", exeName)); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); string filePath = Path.Combine(Environment.CurrentDirectory, exeName); if (File.Exists(filePath) == false) { ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => File not found. ({0})", exeName)); return retValue = false; } // SPCTouchTxt.exe 실행 파라미터는 브랜드코드 점포코드 POS번호 string arg = string.Format("{0} {1} {2}", BasicInfo.BrandCd, BasicInfo.OldStoreNo, BasicInfo.PosNo); ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => External execute, Path=[{0}], File=[{1}], arg=[{2}]", Environment.CurrentDirectory, exeName, arg)); ComLib.ExecuteWaitProcess(exeName, arg, System.Diagnostics.ProcessWindowStyle.Hidden); if (ComLib.ExistDirectory(DirInfo.JinDir) == false) { ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => External execution failure ({0})", exeName)); return retValue = false; } DirectoryInfo di = new DirectoryInfo(DirInfo.JinDir); FileInfo[] fi = di.GetFiles(); for (var i = 0; i < fi.Length; i++) { ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => Created data file, name={0}", fi[i].FullName)); } if (fi.Length == 0) { ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => Created data file failed", "")); return retValue = false; } return retValue = true; } catch (Exception ex) { ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => Exception :" + ex.Message); return retValue = false; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", retValue ? "Success" : "Failed")); ComLog.SendLog(retValue ? ComLog.Level.trace : ComLog.Level.Error , string.Format("Execute external program. ({0}) Result={1}", exeName, retValue ? "Success" : "Failed")); } } /// /// 터치키 마스터 이행 (서버전송) => BR만 이행처리 /// /// private ComLog.InstallResult MigrationTouchKeyMaster() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; try { if (BasicInfo.CompCd.StartsWith("BR") == false) { statusMsg = string.Format("This store is not a touch key master migration target. [CompCode={0}]", BasicInfo.CompCd); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , statusMsg, true); return retValue = ComLog.InstallResult.Skip; } base.OnEcho("Migration POS TouchKey Master"); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); // 이행 데이터 확인 string fileName = string.Format("{0}_TOUCH_MST.txt", BasicInfo.OldStoreNo); string filePath = Path.Combine(DirInfo.JinDir, fileName); if (File.Exists(filePath) == false) { statusMsg = string.Format("TouchKey Master, File not found [{0}]", filePath); ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } // 백업 데이터 확인 string backDir = GetJinDirBack(); string backPath = Path.Combine(backDir, fileName); if (string.IsNullOrWhiteSpace(backDir) == false && File.Exists(backPath) == true) { // 백업파일 존재하면, 비교로 변경 여부 확인 bool isSame = FileCompare(filePath, backPath); if (isSame) { statusMsg = "TouchKey Master, No change data, migration skip"; ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Skip; } } // 데이터 이행 const string ROW_SPLIT = "#~"; const string COL_SPLIT = "|"; List lstData = new List(); string[] orgText = File.ReadAllLines(filePath, Encoding.Default); if (orgText.Length == 0) { statusMsg = string.Format("TouchKey Master, No data, File={0}", filePath); ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => "+ statusMsg, true); return retValue = ComLog.InstallResult.Fail; } foreach (string line in orgText) { if (string.IsNullOrWhiteSpace(line)) continue; // 0 1 2 3 4 5 6 7 8 // 브랜드코드#$점포코드#$포스번호#$터치키구분#$터치키TYPE#$터치키그룹코드#$터치키상세코드#$메뉴명#$화면위치 string[] temp = line.Split(new string[] { "#$" }, StringSplitOptions.None); // 01:터치키 마스터 // 터치키구분|터치키TYPE|터치키그룹코드|터치키상세코드|메뉴명|화면위치 string[] data = new string[6]; data[0] = temp[3].Replace(ROW_SPLIT, " ").Replace(COL_SPLIT, " ").Trim(); data[1] = temp[4].Replace(ROW_SPLIT, " ").Replace(COL_SPLIT, " ").Trim(); data[2] = temp[5].Replace(ROW_SPLIT, " ").Replace(COL_SPLIT, " ").Trim(); data[3] = temp[6].Replace(ROW_SPLIT, " ").Replace(COL_SPLIT, " ").Trim(); data[4] = temp[7].Replace(ROW_SPLIT, " ").Replace(COL_SPLIT, " ").Trim(); data[5] = ComLib.IntParse(temp[8]).ToString(); string rowData = string.Join(COL_SPLIT, data); lstData.Add(rowData); } string dataList = string.Join(ROW_SPLIT, lstData.ToArray()); Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); // 통신해더 생성 string commHead = ItemColumn.MakeCommHeader(0, "06"); // 전송데이터 htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.INQ_TYPE, Column.IQ_TMP_POSMST_INQ.MSG_ID); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.STOR_CD, BasicInfo.StoreNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.POS_NO, BasicInfo.PosNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.MST_KIND, Column.IQ_TMP_POSMST_INQ.MSTKIND.TOUCHKEY); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.DATA_LIST, dataList); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.RES_CD, ""); NetworkJSON irt = new NetworkJSON(); int ret = irt.IRTSendReceive(ServerInfo.SvrIP, ServerInfo.SvrPort, 1000 * 20, commHead, htSendData, ref htRecvData); if (ret != ComLib.OK) { statusMsg = "Server communication error"; ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } string res = htRecvData[Column.IQ_INSTALL_SCHEDULE_INQ.DATA.RES_CD].ToString().Trim(); statusMsg = string.Format("POS TouchKey Master upload, RespCode={0}, Result={1}", res, res == "00" ? "Success" : "Failed"); ComLog.WriteLog(res != "00" ? ComLog.Level.Error : ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " =>" + statusMsg, true); return retValue = res == "00" ? ComLog.InstallResult.Success : ComLog.InstallResult.Fail; } catch (Exception ex) { statusMsg = "Exception : " + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); // 상태로그 전송 (07:TouchKey info upload ) if (string.IsNullOrWhiteSpace(statusMsg)) statusMsg = string.Format("POS TouchKey Master upload. Result={0}", ComLog.InstallResultStr[(int)retValue]); ComLog.SendStatus(ComLog.InstallStatus.TouchkeyUpload, retValue, statusMsg); } } /// /// 플레이버 마스터 이행 (서버전송) => 아이스크림 가게만 이행(BR) /// /// private ComLog.InstallResult MigrationFlavorMaster() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; try { if (!(BasicInfo.CompCd.StartsWith("BR") && BasicInfo.BrandCd == "3000")) { statusMsg = string.Format("This store is not a flavor master migration target. [CompCode={0}, StoreCode={1}, BrandCode={2}, BrandGB={3}]" , BasicInfo.CompCd, BasicInfo.StoreNo, BasicInfo.BrandCd, BasicInfo.BrandGb); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , statusMsg); return retValue = ComLog.InstallResult.Skip; } base.OnEcho("Migration POS Flavor Master"); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); // 이행 데이터 확인 string fileName = string.Format("{0}_FLAVOR_MST.txt", BasicInfo.OldStoreNo); string filePath = Path.Combine(DirInfo.JinDir, fileName); if (File.Exists(filePath) == false) { statusMsg = string.Format("Flavor Master, File not found [{0}]", filePath); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } // 백업 데이터 확인 string backDir = GetJinDirBack(); string backPath = Path.Combine(backDir, fileName); if (string.IsNullOrWhiteSpace(backDir) == false && File.Exists(backPath) == true) { // 백업파일 존재하면, 비교로 변경 여부 확인 bool isSame = FileCompare(filePath, backPath); if (isSame) { statusMsg = "Flavor Master, No change data, migration skip"; ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Skip; } } // 데이터 이행 const string ROW_SPLIT = "#~"; const string COL_SPLIT = "|"; List lstData = new List(); string[] orgText = File.ReadAllLines(filePath, Encoding.Default); if (orgText.Length == 0) { statusMsg = string.Format("Flavor Master, No data, File={0}", filePath); ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } foreach (string line in orgText) { if (string.IsNullOrWhiteSpace(line)) continue; // 0 1 2 3 4 // 브랜드코드#$점포코드#$포스번호#$상품코드#$화면위치 string[] temp = line.Split(new string[] { "#$" }, StringSplitOptions.None); // 02:플레이버 마스터 // #~상품코드|화면위치 string[] data = new string[2]; data[0] = ComLib.IntParse(temp[4]).ToString(); data[1] = temp[3].Replace(ROW_SPLIT, " ").Replace(COL_SPLIT, " ").Trim(); string rowData = string.Join(COL_SPLIT, data); lstData.Add(rowData); } string dataList = string.Join(ROW_SPLIT, lstData.ToArray()); Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); // 통신해더 생성 string commHead = ItemColumn.MakeCommHeader(0, "06"); // 전송데이터 htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.INQ_TYPE, Column.IQ_TMP_POSMST_INQ.MSG_ID); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.STOR_CD, BasicInfo.StoreNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.POS_NO, BasicInfo.PosNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.MST_KIND, Column.IQ_TMP_POSMST_INQ.MSTKIND.FLAVOR); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.DATA_LIST, dataList); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.RES_CD, ""); NetworkJSON irt = new NetworkJSON(); int ret = irt.IRTSendReceive(ServerInfo.SvrIP, ServerInfo.SvrPort, 1000 * 20, commHead, htSendData, ref htRecvData); if (ret != ComLib.OK) { statusMsg = "Server communication error"; ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } string res = htRecvData[Column.IQ_INSTALL_SCHEDULE_INQ.DATA.RES_CD].ToString().Trim(); statusMsg = string.Format("POS flavor Master upload, RespCode={0}, Result={1}", res, res == "00" ? "Success" : "Failed"); ComLog.WriteLog(res != "00" ? ComLog.Level.Error : ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " =>" + statusMsg, true); return retValue = res == "00" ? ComLog.InstallResult.Success : ComLog.InstallResult.Fail; } catch (Exception ex) { statusMsg = "Exception : " + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); // 상태로그 전송 (07:TouchKey info upload ) if (string.IsNullOrWhiteSpace(statusMsg)) statusMsg = string.Format("POS flavor Master upload. Result={0}", ComLog.InstallResultStr[(int)retValue]); ComLog.SendStatus(ComLog.InstallStatus.FloavorUpload, retValue, statusMsg); } } /// /// 층/테이블정보 이행 (로컬저장, 서버전송) => PB,SL 후불매장, MainPos /// /// private ComLog.InstallResult MigrationTableMaster() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; try { int ret = -99; bool isMigration = true; if (BasicInfo.CompCd.StartsWith("BR")) isMigration = false; if (BasicInfo.StoreType != "1") isMigration = false; if (BasicInfo.OrderType != "0") isMigration = false; if (isMigration == false) { statusMsg = string.Format("This store is not a table master migration target. [CompCode={0}, StoreType={1}, OrderType={2}]" , BasicInfo.CompCd, BasicInfo.StoreType, BasicInfo.OrderType); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , statusMsg); return retValue = ComLog.InstallResult.Skip; } base.OnEcho("Migration POS Floor/Table Master"); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); #region ### 기존 이행여부 확인 => 테이블정보가 변경 되었을 수 있기 때문에 무조건 이행 처리 한다. //using (SqlDB sqlDb = new SqlDB(DatabaseInfo.DataSource, "POSMST", DatabaseInfo.UserId, DatabaseInfo.Password)) //{ // string sql = string.Format("SELECT COUNT(*) CNT FROM POSMST..MST_FLOOR WHERE CMP_CD = '{0}' AND STOR_CD = '{1}'" // , BasicInfo.CompCd, BasicInfo.StoreNo); // DataTable dt = null; // ret = sqlDb.DBDataTableSelect(sql, CommandType.Text, null, out dt); // if (ret != ComLib.OK) // { // statusMsg = "POSMST..MSTFLOOR Table select failed"; // ComLog.WriteLog(ComLog.Level.Error // , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." // + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" // , " => " + statusMsg, true); // return retValue = ComLog.InstallResult.Fail; // } // int cnt = ComLib.IntParse(dt.Rows[0]["CNT"].ToString()); // if (cnt > 0) // { // statusMsg = "Floor&Table Master already exists."; // ComLog.WriteLog(ComLog.Level.trace // , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." // + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" // , " => " + statusMsg, true); // return retValue = ComLog.InstallResult.Skip; // } //} #endregion #region ### 이행데이터(층/테이블) 확인 및 메모리 로드 // 이행 데이터 확인 string fileName = string.Format("{0}_TABLE_INFO.txt", BasicInfo.OldStoreNo); string filePath = Path.Combine(DirInfo.JinDir, fileName); if (File.Exists(filePath) == false) { statusMsg = string.Format("Table Master, File not found [{0}]", filePath); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } // 백업 데이터 확인 string backDir = GetJinDirBack(); string backPath = Path.Combine(backDir, fileName); if (string.IsNullOrWhiteSpace(backDir) == false && File.Exists(backPath) == true) { // 백업파일 존재하면, 비교로 변경 여부 확인 bool isSame = FileCompare(filePath, backPath); if (isSame) { statusMsg = "Table Master, No change data, migration skip"; ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Skip; } } // 데이터 이행 List lstData = new List(); string[] orgText = File.ReadAllLines(filePath, Encoding.Default); if (orgText.Length == 0) { statusMsg = string.Format("Table Master, No data, File={0}", filePath); ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } foreach (string line in orgText) { if (string.IsNullOrWhiteSpace(line)) continue; // 브랜드코드#$점포코드#$포스번호#$층코드#$층명#$테이블번호#$테이블명#$위치X#$위치Y#$width#$height string[] temp = line.Split(new string[] { "#$" }, StringSplitOptions.None); TableInfo tbl = new TableInfo(); tbl.BrandCode = temp[0]; tbl.StroeCode = temp[1]; tbl.PosNo = temp[2]; tbl.FloorCode = temp[3]; tbl.FloorName = temp[4]; tbl.TableNo = temp[5]; tbl.TableName = temp[6]; tbl.X = ComLib.IntParse(temp[7]); tbl.Y = ComLib.IntParse(temp[8]); tbl.W = ComLib.IntParse(temp[9]); tbl.H = ComLib.IntParse(temp[10]); lstData.Add(tbl); } // 층마스터 생성 List mstFloors = new List(); foreach (var f in from x in lstData group x.FloorCode by new { code = x.FloorCode, name = x.FloorName } into g orderby g.Key.code select new { code = g.Key.code, name = g.Key.name }) { MST_FLOOR.DATA floor = new MST_FLOOR.DATA(); floor.FLOOR_CD = f.code.PadLeft(3,'0'); floor.FLOOR_NM = string.IsNullOrWhiteSpace(f.name) ? f.code : f.name; mstFloors.Add(floor); } // 테이블마스터 생성 List mstTables = new List(); foreach (var t in from x in lstData orderby x.FloorCode, x.TableNo select x) { MST_TABLE.DATA table = new MST_TABLE.DATA(); table.FLOOR_CD = t.FloorCode.PadLeft(3, '0'); table.TABLE_NO = t.TableNo.PadLeft(3, '0'); table.TABLE_NM = string.IsNullOrWhiteSpace(t.TableName) ? t.TableNo : t.TableName; table.FONT_NM = BasicInfo._font; table.FONT_SIZE = 10; table.X_COORD = t.X; table.Y_COORD = t.Y; table.WIDTH = t.W; table.HEIGHT = t.H; table.OP_FLAG = "0"; table.USE_FLAG = "0"; table.CUST_CNT = 0; // 테이블 데이터 위치 보정 ( TableBackSize=896,550) int xw = t.X + t.W; int yh = t.Y + t.H; if (xw > 986) table.X_COORD = 986 - t.W; if (yh > 550) table.Y_COORD = 550 - t.H; mstTables.Add(table); } #endregion #region ### 층/테이블 마스터 로컬저장 // 층/테이블 마스터 로컬저장 using (SqlDB sqlDb = new SqlDB(DatabaseInfo.DataSource, "POSMST", DatabaseInfo.UserId, DatabaseInfo.Password)) { List query = new List(); string fmt = string.Empty; string sql = string.Empty; // 층마스터 삭제 fmt = "DELETE FROM POSMST..MST_FLOOR WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' "; sql = string.Format(fmt, BasicInfo.CompCd, BasicInfo.StoreNo); query.Add(sql); // 층마스터 이행 foreach (var f in mstFloors) { fmt = "INSERT INTO POSMST..MST_FLOOR (CMP_CD, STOR_CD, FLOOR_CD, FLOOR_NM, UPD_DT, REG_DT, USE_YN) " + "VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}') "; sql = string.Format(fmt, BasicInfo.CompCd, BasicInfo.StoreNo , f.FLOOR_CD , f.FLOOR_NM , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") , PosConst.MST_USE_YN.YES); query.Add(sql); } // 테이블마스터 삭제 fmt = "DELETE FROM POSMST..MST_TBL WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' "; sql = string.Format(fmt, BasicInfo.CompCd, BasicInfo.StoreNo); query.Add(sql); // 테이블마스터 이행 foreach (var t in mstTables) { fmt = "INSERT INTO POSMST..MST_TBL (CMP_CD, STOR_CD, FLOOR_CD, TBL_NO, TBL_NM, FONT_SIZE, X_COORD, Y_COORD, WIDTH, HGT, UPD_DT, REG_DT, USE_YN) " + "VALUES ('{0}', '{1}', '{2}', '{3}', N'{4}', {5}, {6}, {7}, {8}, {9}, '{10}', '{11}', '{12}') "; sql = string.Format(fmt, BasicInfo.CompCd, BasicInfo.StoreNo , t.FLOOR_CD , t.TABLE_NO , t.TABLE_NM , t.FONT_SIZE , t.X_COORD , t.Y_COORD , t.WIDTH , t.HEIGHT , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") , PosConst.MST_USE_YN.YES); query.Add(sql); } ret = sqlDb.DBExecuteNonQuery(query.ToArray(), System.Data.CommandType.Text, null, true); if (ret != ComLib.OK) { statusMsg = "Table Master, Local Databse Insert Error"; ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } } #endregion #region ### 층/테이블 마스터 서버전송 (실패해도 진행한다.) // 층/테이블 마스터 서버전송 (기존 테이블백업 이용) const string COL_SPLIT = "|"; const string ROW_SPLIT = "#~"; List lstSend = new List(); // 층 정보 생성 foreach (var f in mstFloors) { #region Oracle Table Schema (SPP.POS_MST_FLOOR) //SELECT CMP_CD, STOR_CD, FLOOR_CD, FLOOR_NM, FILLER_1, FILLER_2, FILLER_3, FILLER_4, FILLER_5, USE_YN, REG_USER_ID, REG_DATE, UPD_USER_ID, UPD_DATE //FROM SPP.POS_MST_FLOOR //0 , "01" => Floor Master //1 , CMP_CD //2 , STOR_CD //3 , FLOOR_CD //4 , FLOOR_NM //5 , FILLER_1 //6 , FILLER_2 //7 , FILLER_3 //8 , FILLER_4 //9 , FILLER_5 //10, USE_YN //11, REG_USER_ID //12, REG_DATE //13, UPD_USER_ID //14, UPD_DATE #endregion if (f.UPD_DT.Trim().Length != 14) f.UPD_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); if (f.REG_DT.Trim().Length != 14) f.REG_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); string[] floor = new string[15]; floor[0] = "01"; floor[1] = BasicInfo.CompCd; floor[2] = BasicInfo.StoreNo; floor[3] = f.FLOOR_CD; floor[4] = f.FLOOR_NM; floor[5] = string.Empty; floor[6] = string.Empty; floor[7] = string.Empty; floor[8] = string.Empty; floor[9] = string.Empty; floor[10] = PosConst.MST_USE_YN.YES; floor[11] = "migration"; floor[12] = f.REG_DT; floor[13] = "migration"; floor[14] = f.UPD_DT; string rowData = string.Join(COL_SPLIT, floor); lstSend.Add(rowData); } // 테이블 정보 생성 foreach (var t in mstTables) { #region Oracle Table Schema (SPP.POS_MST_TBL) //SELECT CMP_CD, STOR_CD, FLOOR_CD, TBL_NO, TBL_NM, TBL_TYPE, TBL_SHAPE, BACKGR_COLOR, BACKGR_IMG, FONT_COLOR, FONT_NM, FONT_SIZE, LOC_X, LOC_Y, WIDTH, HGT, DISP_DIV, SEAT_CNT, SEAT_CNT_DISP_DIV, OPERATE_DIV, OPERATE_FLOOR_CD, OPERATE_TBL_NO, ORD_CMPT_COLOR, PAY_CMPT_COLOR, FILLER_1, FILLER_2, FILLER_3, FILLER_4, FILLER_5, USE_YN, REG_USER_ID, REG_DATE, UPD_USER_ID, UPD_DATE //FROM SPP.POS_MST_TBL //0 , "02" => Table Master //1 , CMP_CD //2 , STOR_CD //3 , FLOOR_CD //4 , TBL_NO //5 , TBL_NM //6 , TBL_TYPE //7 , TBL_SHAPE //8 , BACKGR_COLOR //9 , BACKGR_IMG //10, FONT_COLOR //11, FONT_NM //12, FONT_SIZE //13, LOC_X //14, LOC_Y //15, WIDTH //16, HGT //17, DISP_DIV //18, SEAT_CNT //19, SEAT_CNT_DISP_DIV //20, OPERATE_DIV //21, OPERATE_FLOOR_CD //22, OPERATE_TBL_NO //23, ORD_CMPT_COLOR //24, PAY_CMPT_COLOR //25, FILLER_1 //26, FILLER_2 //27, FILLER_3 //28, FILLER_4 //29, FILLER_5 //30, USE_YN //31, REG_USER_ID //32, REG_DATE //33, UPD_USER_ID //34, UPD_DATE #endregion if (t.UPD_DT.Trim().Length != 14) t.UPD_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); if (t.REG_DT.Trim().Length != 14) t.REG_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); t.TABLE_DISP_FLAG = "2"; string[] table = new string[35]; table[0] = "02"; table[1] = BasicInfo.CompCd; //1 CMP_CD table[2] = BasicInfo.StoreNo; //2 , STOR_CD table[3] = t.FLOOR_CD; //3 , FLOOR_CD table[4] = t.TABLE_NO; //4 , TBL_NO table[5] = t.TABLE_NM; //5 , TBL_NM table[6] = ""; //6 , TBL_TYPE (사용안함) table[7] = ""; //7 , TBL_SHAPE (사용안함) table[8] = ""; //8 , BACKGR_COLOR (사용안함) table[9] = ""; //9 , BACKGR_IMG (사용안함) table[10] = ""; //10, FONT_COLOR (사용안함) table[11] = t.FONT_NM; //11, FONT_NM (Default:나눔스퀘어) table[12] = t.FONT_SIZE.ToString(); //12, FONT_SIZE (Default:10) table[13] = t.X_COORD.ToString(); //13, LOC_X table[14] = t.Y_COORD.ToString(); //14, LOC_Y table[15] = t.WIDTH.ToString(); //15, WIDTH table[16] = t.HEIGHT.ToString(); //16, HGT table[17] = t.TABLE_DISP_FLAG; //17, DISP_DIV (사용안함, 2:테이블명 고정) table[18] = ""; //18, SEAT_CNT (사용안함) table[19] = ""; //19, SEAT_CNT_DISP_DIV (사용안함) table[20] = ""; //20, OPERATE_DIV table[21] = ""; //21, OPERATE_FLOOR_CD table[22] = ""; //22, OPERATE_TBL_NO table[23] = ""; //23, ORD_CMPT_COLOR table[24] = ""; //24, PAY_CMPT_COLOR table[25] = ""; //25, FILLER_1 table[26] = ""; //26, FILLER_2 table[27] = ""; //27, FILLER_3 table[28] = ""; //28, FILLER_4 table[29] = ""; //29, FILLER_5 table[30] = PosConst.MST_USE_YN.YES; ; //30, USE_YN table[31] = "migration"; ; //31, REG_USER_ID table[32] = t.REG_DT; //32, REG_DATE table[33] = "migration"; ; //33, UPD_USER_ID table[34] = t.UPD_DT; //34, UPD_DATE string rowData = string.Join(COL_SPLIT, table); lstSend.Add(rowData); } // 전송데이터 string dataList = string.Join(ROW_SPLIT, lstSend.ToArray()); // 층/테이블 마스터 전송 Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); // 통신해더 생성 string commHead = ItemColumn.MakeCommHeader(0, "06"); // 전송데이터 //htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.INQ_TYPE, Column.IQ_TMP_POSMST_INQ.MSG_ID); //htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.STOR_CD, BasicInfo.StoreNo); //htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.POS_NO, BasicInfo.PosNo); //htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.MST_KIND, Column.IQ_TMP_POSMST_INQ.MSTKIND.TABLE); //htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.DATA_LIST, dataList); //htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.RES_CD, ""); // 층/테이블 이행 데이터 서버 전송은 기존 "55"번 전문형식으로 전송한다. htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.INQ_TYPE, Column.IQ_POS_TABLE_MST_INQ.MSG_ID); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.STOR_CD, BasicInfo.StoreNo); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.INQ_DIV, "1"); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.DATA_LIST, dataList); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.RES_CD, ""); // 층/테이블 벡업 PORT 구하기 => 설치프로그램 통신 포트는 각사별 BizInqPort를 사용한다. //CmMessage cmCommPort = CmMessage.MakeMessageFromFile(Path.Combine(DirInfo.InstallDir, @"INI\CommPort.INI")); //var commPort = ComLib.IntParse(ComLib.GetConfigInfo(cmCommPort, "SERVER", "BizInqPort", "")); //var commAddr = ServerInfo.SvrIP; var commPort = ServerInfo.SvrPort; var commAddr = ServerInfo.SvrIP; NetworkJSON irt = new NetworkJSON(); ret = irt.IRTSendReceive(commAddr, commPort, 1000 * 20, commHead, htSendData, ref htRecvData); if (ret != ComLib.OK) { statusMsg = "Server communication error"; ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } string res = htRecvData[Column.IQ_POS_TABLE_MST_INQ.DATA.RES_CD].ToString().Trim(); statusMsg = string.Format("POS Floor/Table Master migratioin & upload, RespCode={0}, Result={1}", res, res == "00" ? "Success" : "Failed"); ComLog.WriteLog(res != "00" ? ComLog.Level.Error : ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " =>" + statusMsg, true); retValue = res == "00" ? ComLog.InstallResult.Success : ComLog.InstallResult.Fail; #endregion return retValue; } catch (Exception ex) { statusMsg = "Exception : " + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); // 상태로그 전송 (07:TouchKey info upload ) if (string.IsNullOrWhiteSpace(statusMsg)) statusMsg = string.Format("POS Floor/Table Master migratioin & upload. Result={0}", ComLog.InstallResultStr[(int)retValue]); ComLog.SendStatus(ComLog.InstallStatus.TableInfoUpload, retValue, statusMsg); } } /// /// 기타코드 이행 (로컬저장) /// /// private ComLog.InstallResult MigrationEtcCode() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; try { // 선불매장, 후불매장 MainPOS만 대상 이지만, 구분없이 모두 이행처리 한다. base.OnEcho("Migration ETC Code Master"); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); #region ### 이행데이터 메모리 로드 // 이행 데이터 확인 string fileName = string.Format("{0}_REASON.txt", BasicInfo.OldStoreNo); string filePath = Path.Combine(DirInfo.JinDir, fileName); if (File.Exists(filePath) == false) { statusMsg = string.Format("ETC Code Master, File not found [{0}]", filePath); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Skip; } // 백업 데이터 확인 string backDir = GetJinDirBack(); string backPath = Path.Combine(backDir, fileName); if (string.IsNullOrWhiteSpace(backDir) == false && File.Exists(backPath) == true) { // 백업파일 존재하면, 비교로 변경 여부 확인 bool isSame = FileCompare(filePath, backPath); if (isSame) { statusMsg = "ETC Code Master, No change data, migration skip"; ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Skip; } } // 데이터 이행 List lstData = new List(); string[] orgText = File.ReadAllLines(filePath, Encoding.Default); if (orgText.Length == 0) { statusMsg = string.Format("ETC Code Master, No data, File={0}", filePath); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Skip; } foreach (string line in orgText) { if (string.IsNullOrWhiteSpace(line)) continue; // 코드분류#$코드#$코드명 string[] temp = line.Split(new string[] { "#$" }, StringSplitOptions.None); EtcCodeInfo etc = new EtcCodeInfo(); etc.GroupCode = temp[0]; etc.EtcCode = temp[1]; if (etc.GroupCode == "VOID") { etc.commCode = PosConst.COMMON_CODE_GROUP.Z0008; etc.EtcName = temp[2].Trim(); } else if (etc.GroupCode == "MEMO") { string memo = temp[2].Trim(); List x = new List(); for (var i = 0; i < 3; i++) { if (ComLib.LenH(memo) > 40) { var v = ComLib.LeftH(memo, 40).TrimEnd(); x.Add(v); memo = memo.Substring(v.Length).Trim(); } else { x.Add(memo); break; } } etc.commCode = PosConst.COMMON_CODE_GROUP.Z0020; etc.EtcName = string.Join(Environment.NewLine, x); } else { continue; } lstData.Add(etc); } #endregion #region ### 기타코드 마스터 로컬저장 if (lstData.Count == 0) { statusMsg = string.Format("ETC Code Master, No data, File={0}", filePath); return retValue = ComLog.InstallResult.Skip; } // 기타코드 마스터 로컬저장 using (SqlDB sqlDb = new SqlDB(DatabaseInfo.DataSource, "POSMST", DatabaseInfo.UserId, DatabaseInfo.Password)) { List query = new List(); string fmt = string.Empty; string sql = string.Empty; // 기타코드 삭제 fmt = "DELETE FROM POSMST..MST_POS_LOCAL WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND GRP_CD IN ('{2}', '{3}') "; sql = string.Format(fmt, BasicInfo.CompCd, BasicInfo.StoreNo, PosConst.COMMON_CODE_GROUP.Z0008, PosConst.COMMON_CODE_GROUP.Z0020); query.Add(sql); // 기타코드 이행 foreach (var t in lstData) { fmt = "INSERT INTO POSMST..MST_POS_LOCAL (CMP_CD, STOR_CD, GRP_CD, ENTRY_CD, ENTRY_NM, DISP_SEQ, USE_YN, UPD_DT, REG_DT) " + "VALUES ('{0}', '{1}', '{2}', '{3}', N'{4}', {5}, '{6}', '{7}', '{8}' ) "; sql = string.Format(fmt, BasicInfo.CompCd, BasicInfo.StoreNo , t.commCode , ComLib.IsNumber(t.EtcCode) ? ComLib.IntParse(t.EtcCode).ToString() : t.EtcCode.Trim() , ConvertDBStr(t.EtcName) , 0 , PosConst.MST_USE_YN.YES , DateTime.Now.ToString("yyyyMMDDHHmmss") , DateTime.Now.ToString("yyyyMMDDHHmmss") ); query.Add(sql); } int ret = sqlDb.DBExecuteNonQuery(query.ToArray(), System.Data.CommandType.Text, null, true); if (ret != ComLib.OK) { statusMsg = "ETC Code Master, Local Databse Insert Error"; ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } } #endregion return retValue = ComLog.InstallResult.Success; } catch (Exception ex) { statusMsg = "Exception : " + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); // 상태로그 전송 (10:Etc info migration) if (string.IsNullOrWhiteSpace(statusMsg)) statusMsg = string.Format("POS Etc Info migration. Result={0}", ComLog.InstallResultStr[(int)retValue]); ComLog.SendStatus(ComLog.InstallStatus.EtcInfoMigration, retValue, statusMsg); } } /// /// 테이블예약 로컬이행 (후불(MainPOS)일때..) /// /// private ComLog.InstallResult MigrationTableResv() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; try { bool isMigration = true; if (BasicInfo.StoreType != "1") isMigration = false; if (BasicInfo.OrderType != "0") isMigration = false; if (isMigration) { statusMsg = string.Format("This store is not a table master migration target. [CompCode={0}, StoreType={1}, OrderType={2}]" , BasicInfo.CompCd, BasicInfo.StoreType, BasicInfo.OrderType); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , statusMsg); return retValue = ComLog.InstallResult.Skip; } base.OnEcho("Migration POS local table reservation"); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); #region ### 이행데이터 메모리 로드 // 이행데이터 확인 string fileName = string.Format("{0}_TABLE_RESV.txt", BasicInfo.OldStoreNo); string filePath = Path.Combine(DirInfo.JinDir, fileName); if (File.Exists(filePath) == false) { statusMsg = string.Format("Table reservation, File not found [{0}]", filePath); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Skip; } // 백업 데이터 확인 string backDir = GetJinDirBack(); string backPath = Path.Combine(backDir, fileName); if (string.IsNullOrWhiteSpace(backDir) == false && File.Exists(backPath) == true) { // 백업파일 존재하면, 비교로 변경 여부 확인 bool isEquals = FileCompare(filePath, backPath); if (isEquals) { statusMsg = "Table reservation, No change data, migration skip"; ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Skip; } } // 데이터 이행 List lstData = new List(); string[] orgText = File.ReadAllLines(filePath); if (orgText.Length == 0) { statusMsg = string.Format("Table reservation, No data, File={0}", filePath); ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } foreach (string line in orgText) { if (string.IsNullOrWhiteSpace(line)) continue; #region 코드분류#$코드#$코드명 // 코드분류#$코드#$코드명 // 8000#$00511#$01#$20161207#$00001#$1930#$MANAGER#$01012341234#$test rest #$00511000#$20161207183425#$00511000#$20161207185042 // 0 BRAND_CD 8000 // 1 STOR_CD 00511 // 2 POSNO01 01 // 3 예약일자 20161207 // 4 예약번호 00001 // 5 예약시간 1930 // 6 담당자 MANAGER // 7 전화번호 01012341234 // 8 예약내용 test rest // 9 등록ID 00511000 // 10 등록일시 20161207183425 // 11 수정ID 00511000 // 12 수정일시 20161207185042 // 13 알람사용 // 14 알람시간 // 15 확인여부 #endregion string[] temp = line.Split(new string[] { "#$" }, StringSplitOptions.None); TableReserv resv = new TableReserv(); // 1612 000001 => Convert 필요함. //int seq = ComLib.IntParse(temp[4]); //resv.ReservNo = string.Format("{0}{1:4D}", resv.ReservDt.Substring(2, 6), seq); resv.ReservNo = temp[4].Trim(); resv.ReservDt = temp[3].Trim(); resv.ReservTm = string.Empty; if (temp[5].Trim().Length == 4 && ComLib.IsNumber(temp[5].Trim())) { resv.ReservTm = temp[5].Trim(); } else { resv.ReservTm = "0000"; } resv.Cashier = temp[6].Trim(); resv.TelNo = ComLib.LeftH(temp[7], 16).Trim(); resv.Note = string.Empty; if (resv.ReservTm == "0000") { resv.Note = temp[5].Trim() + Environment.NewLine; } resv.Note += temp[8].Trim(); resv.InsID = temp[9].Trim(); resv.InsDt = temp[10].Trim(); resv.UpdID = temp[11].Trim(); resv.UpdDt = temp[12].Trim(); // 이부분은 진과 약속되지 않았다. resv.AlarmYn = "N"; if (temp.Length >= 16) { resv.AlarmYn = temp[13].Trim(); resv.AlarmTm = temp[14].Trim(); resv.Comfirm = temp[15].Trim(); } lstData.Add(resv); } #endregion #region ### 테이블예약 마스터 로컬저장 // 테이블예약 마스터 로컬저장 using (SqlDB sqlDb = new SqlDB(DatabaseInfo.DataSource, "POSMST", DatabaseInfo.UserId, DatabaseInfo.Password)) { List query = new List(); string fmt = string.Empty; string sql = string.Empty; // 예약정보 삭제 fmt = "DELETE FROM POSMST..MST_RESERV WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' "; sql = string.Format(fmt, BasicInfo.CompCd, BasicInfo.StoreNo); query.Add(sql); // 예약정보 이행 var dt = string.Empty; var seq = 0; foreach (var r in from x in lstData orderby x.ReservDt, x.ReservNo select x) { seq = dt != r.ReservDt.Substring(2, 4) ? 1 : seq + 1; dt = r.ReservDt.Substring(2, 4); string resvNo = string.Format("{0}{1:000000}", r.ReservDt.Substring(2, 4), seq); fmt = "INSERT INTO POSMST..MST_RESERV (CMP_CD, STOR_CD, RESERV_NO, RESERV_DT, RESERV_TM, CASHIER_NM, TEL_NO, NOTE, ALARM_YN, ALARM_TM, CONFIRM, UPD_ID, UPD_DT, REG_ID, REG_DT, FILLER1) " + "VALUES ('{0}', '{1}', '{2}' , '{3}', '{4}', N'{5}', '{6}', N'{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '0') "; sql = string.Format(fmt, BasicInfo.CompCd, BasicInfo.StoreNo , resvNo, r.ReservDt, r.ReservTm, r.Cashier, r.TelNo, ConvertDBStr(r.Note), r.AlarmYn, r.AlarmTm, r.Comfirm, r.UpdID, r.UpdDt, r.InsID, r.InsDt); query.Add(sql); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("{0}_{1}_{2} => {3}", resvNo, r.ReservDt, r.ReservTm, sql)); } int ret = sqlDb.DBExecuteNonQuery(query.ToArray(), System.Data.CommandType.Text, null, true); if (ret != ComLib.OK) { statusMsg = "Table reservation, Local Databse Insert Error"; ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } statusMsg = "Migration POS local table reservation success"; retValue = ComLog.InstallResult.Success; } #endregion return retValue; } catch (Exception ex) { statusMsg = "Exception : " + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); ComLog.SendLog(ComLog.Level.trace , string.Format("Migration POS local table reservation, Result={0}, Status={1}" , ComLog.InstallResultStr[(int)retValue], statusMsg)); } } /// /// 기타정보 이행 (파일복사, POS터미널 정보 서버전송) /// /// private ComLog.InstallResult MigrationEtcInfo() { string statusMsg = string.Empty; ComLog.InstallResult retValue = ComLog.InstallResult.Fail; try { base.OnEcho("Migration ETC Infomation."); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); #region ### TPay 관련 ini 복사 // TPay 관련 ini 복사 string fileName = "PAYGLECFG.INI"; if (File.Exists(Path.Combine(Environment.CurrentDirectory, fileName))) { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => The file already exists. file={0}", fileName), true); } else { bool ret1 = false; if (File.Exists(Path.Combine(Environment.CurrentDirectory, fileName))) { ret1 = ComLib.FileCopy(Path.Combine(Environment.CurrentDirectory, fileName), Path.Combine(DirInfo.InstallDir, fileName), false); } ComLog.WriteLog(ret1 ? ComLog.Level.trace : ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => Copy result {0}, File={1}", ret1 ? "success" : "failed", fileName), true); } #endregion string checkData = GetPosTerminalInfo(); if (string.IsNullOrWhiteSpace(checkData)) { statusMsg = "POS Terminal Information Failed to Read"; ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); retValue = ComLog.InstallResult.Fail; } // 데이터 서버전송 Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); // 통신해더 생성 string commHead = ItemColumn.MakeCommHeader(0, "06"); // 전송데이터 htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.INQ_TYPE, Column.IQ_TMP_POSMST_INQ.MSG_ID); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.STOR_CD, BasicInfo.StoreNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.POS_NO, BasicInfo.PosNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.MST_KIND, Column.IQ_TMP_POSMST_INQ.MSTKIND.POSINFO); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.DATA_LIST, checkData); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.RES_CD, ""); NetworkJSON irt = new NetworkJSON(); int ret2 = irt.IRTSendReceive(ServerInfo.SvrIP, ServerInfo.SvrPort, 1000 * 20, commHead, htSendData, ref htRecvData); if (ret2 != ComLib.OK) { statusMsg = "Server communication error"; ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg, true); return retValue = ComLog.InstallResult.Fail; } string res = htRecvData[Column.IQ_INSTALL_SCHEDULE_INQ.DATA.RES_CD].ToString().Trim(); statusMsg = string.Format("POS Terminal Information upload, RespCode={0}, Result={1}", res, res == "00" ? "Success" : "Failed"); ComLog.WriteLog(res != "00" ? ComLog.Level.Error : ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " =>" + statusMsg, true); return retValue = res == "00" ? ComLog.InstallResult.Success : ComLog.InstallResult.Fail; } catch (Exception ex) { ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => Exception : " + ex.Message); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); ComLog.SendLog(ComLog.Level.trace , string.Format("Migration POS ETC Infomation, Result={0}, Status={1}", ComLog.InstallResultStr[(int)retValue], statusMsg)); } } /// /// 포스터미널 정보 서버전송 /// /// POSIP|POS구분|메인여부|화면크기|카드리더기종류|CAT단말기종류 private string GetPosTerminalInfo() { string retValue = string.Empty; try { // Format => POSIP|POS구분|메인여부|화면크기|카드리더기종류|CAT단말기종류 string[] data = new string[6]; // POS IP data[0] = ComLib.GetLocalIpAddress(); // 선후불 구분 OLD[0:선불, 1:후불] => NEW[1:선불, 2:후불] data[1] = BasicInfo.StoreType == "1" ? "2" : "1"; // 주문 구분 OLD[0:정산,1:주문] => NEW[0:SUB, 1:MAIN] data[2] = BasicInfo.OrderType == "1" ? "0" : "1"; data[3] = string.Format("{0}x{1}", Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); data[4] = CheckInfo.CardReader; data[5] = CheckInfo.CatTerminal; return retValue = string.Join("|", data); } catch (Exception ex) { ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => Exception : " + ex.Message); return string.Empty; } } /// /// 포스옵션정보 서버전송 /// /// private ComLog.InstallResult MigratinoPosOption() { var statusMsg = string.Empty; var retValue = ComLog.InstallResult.Fail; var dicOptInfo = new Dictionary(); try { base.OnEcho("Migration Pos Option Infomation."); ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Start"); var temp = string.Empty; var optValue = string.Empty; #region ### OPT008, OPT042 대기번호사용/대기번호자동채번사용 // OPT008 대기번호사용여부 (0:미사용, 1:사용) // OPT042 대기번호 자동채번 사용 여부 (0:사용안함, 1:사용함) if (BasicInfo.CompCd.StartsWith("BR")) { // WAIT_DIV 0:미사용, 1:사용(수동), 2:사용(자동) temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "WAIT_DIV").Trim(); if (temp == "1") { dicOptInfo.Add("OPT008", "1"); dicOptInfo.Add("OPT042", "0"); } else if (temp == "2") { dicOptInfo.Add("OPT008", "1"); dicOptInfo.Add("OPT042", "1"); } else { dicOptInfo.Add("OPT008", "0"); dicOptInfo.Add("OPT042", "1"); } } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // STANBYNO_DIV 0:미사용, 1:사용 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "STANBYNO_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT008", optValue); dicOptInfo.Add("OPT042", "1"); } #endregion #region ### OPT105 제품 이미지 DISPLAY 유무 // OPT105 제품이미지 화면표시여부 0:미사용, 1:사용 if (BasicInfo.CompCd.StartsWith("BR")) { // IMAGE_GB 0:미사용, 1:사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "IMAGE_GB").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT105", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT404 신용카드 승인 영수증 매수 설정 // OPT404 신용카드 영수증 매수 0:미출력 그외 출력매수 if (BasicInfo.CompCd.StartsWith("BR")) { // CARDPRINT_CNT 0 : 1장출력, 1. 2장출력, 2 : 3장출력 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "CARDPRINT_CNT").Trim(); switch (temp) { case "2": optValue = "3"; break; case "1": optValue = "2"; break; default: optValue = "1"; break; } dicOptInfo.Add("OPT404", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 없음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // CARDPRINT_CNT 0 : 1장출력, 1. 2장출력, 2 : 3장출력 temp = IniFile.GetValue(BasicInfo.OldSaleINI, "SALEINFO", "CARDPRINT_CNT").Trim(); switch (temp) { case "2": optValue = "3"; break; case "1": optValue = "2"; break; default: optValue = "1"; break; } dicOptInfo.Add("OPT404", optValue); } #endregion #region ### OPT203 담당자 선택 (후불) // OPT203 주문 시 담당자 선택(0:미사용, 1:사용) if (BasicInfo.CompCd.StartsWith("BR")) { // CLERK_CHECK 0 : 사용안함, 1: 사용(담당자선택)후불 ==> 존재하는가? temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "CLERK_CHECK").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT203", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // CLERK_CHECK 0 : 사용안함, 1: 사용(담당자선택)후불 temp = IniFile.GetValue(BasicInfo.OldSaleINI, "SALEINFO", "CLERK_CHECK").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT203", optValue); } #endregion #region ### OPT506 주방프린터 사용여부 // OPT506 주방프린터 0 : 미사용 1:사용 optValue = string.Empty; if (BasicInfo.CompCd.StartsWith("BR")) { // ORDERPRINT_DIV 0 : 미사용 1:사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "ORDERPRINT_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "1"; else optValue = temp; dicOptInfo.Add("OPT506", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // ORDERPRINT_DIV 0 : 미사용 1:사용 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "ORDERPRINT_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "1"; else optValue = temp; dicOptInfo.Add("OPT506", optValue); } #endregion #region ★★★ 대기번호 사용 보정처리 // 주방프린터를 사용하거나 KVS장치가 존재하면, 대기번호를 사용으로 처리 한다. if (optValue == "1" || this.isExistsKVS) { if (dicOptInfo.ContainsKey("OPT008")) { dicOptInfo["OPT008"] = "1"; } else { dicOptInfo.Add("OPT008", "1"); } } #endregion #region ### OPT016 추후적립 // OPT016 추후적립 0 : 미사용 1:사용 if (BasicInfo.CompCd.StartsWith("BR")) { // HP_AFTERSAVE_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "HP_AFTERSAVE_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "1"; else optValue = temp; dicOptInfo.Add("OPT016", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // HP_AFTERSAVE_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "HP_AFTERSAVE_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "1"; else optValue = temp; dicOptInfo.Add("OPT016", optValue); } #endregion #region ### OPT040 환율수신여부 // OPT040 환율수신여부 0 : 미사용 1:사용 if (BasicInfo.CompCd.StartsWith("BR")) { // EXCHANG_RCV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "EXCHANG_RCV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT040", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // EXCHANG_RCV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "EXCHANG_RCV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT040", optValue); } #endregion #region ### OPT302 익일개점허용 // OPT302 익일 개점 허용 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // ADV_OPEN_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "ADV_OPEN_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT302", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // ADV_OPEN_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "ADV_OPEN_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT302", optValue); } #endregion #region ### OPT409 프린터상단이미지출력 // OPT409 프린터상단이미지출력 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // PRTHEADERIMG_PRT 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "PRTHEADERIMG_PRT").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "1"; else optValue = temp; dicOptInfo.Add("OPT409", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PRTHEADERIMG_PRT 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "PRTHEADERIMG_PRT").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "1"; else optValue = temp; dicOptInfo.Add("OPT409", optValue); } #endregion #region ### OPT410 프린터하단이미지출력 // OPT410 프린터하단이미지출력 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // PRTBOTTOMIMG_PRT 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "PRTBOTTOMIMG_PRT").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "1"; else optValue = temp; dicOptInfo.Add("OPT410", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PRTBOTTOMIMG_PRT 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "PRTBOTTOMIMG_PRT").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "1"; else optValue = temp; dicOptInfo.Add("OPT410", optValue); } #endregion #region ### OPT305 외화결제 사용 // OPT305 외화결제 사용 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // EXCHANGE_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "EXCHANGE_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT305", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // EXCHANGE_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreINI, "SHOPINFO", "EXCHANGE_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT305", optValue); } #endregion #region ### OPT307 직원근태허용유무 // OPT307 직원근태허용유무 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // CLERKIO_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "CLERKIO_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT307", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT308 직원방문입력 허용 유무 // OPT308 직원방문입력 허용 유무 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // EMPLOYEEIO_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "EMPLOYEEIO_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT308", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT104 메뉴단가표시 ==> 협의/확인 // OPT104 메뉴단가표시 0:안함 1:표시 if (BasicInfo.CompCd.StartsWith("BR")) { // UNITDISP_GB 0:안함, 1:표시 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "UNITDISP_GB").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT104", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT425 주방프린터 자동/수동 여부 // OPT425 주방프린터 0:자동 1:수동(프린터선택,BR용) 2:수동(상품선택,SL용) if (BasicInfo.CompCd.StartsWith("BR")) { // ORDERPRTAUTO_DIV 0 :자동, 1: 수동 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "ORDERPRTAUTO_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = "1"; dicOptInfo.Add("OPT425", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT427 영수증프린터 분류별 정렬여부 ==> 협의 // OPT427 영수증프린터 분류별 정렬여부 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // PRINT_CLASS_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "PRINT_CLASS_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT427", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT009 마감시 권종별 현금시재 입력여부 // OPT009 마감-권종별 현금 시재 입력 여부(0 : 총액 입력, 1 : 권종별 입력) if (BasicInfo.CompCd.StartsWith("BR")) { // CLOSE_CASH_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "CLOSE_CASH_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT009", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT109 던킨 이달의 행사 알립 팝업 ==> 협의 // OPT109 던킨 이달의 행사 알립 팝업 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // FDDEVENTPOP_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "FDDEVENTPOP_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT109", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT407 EMV 단말기 사용시 출력 유무 // OPT407 EMV 단말기 사용시 출력 유무 0 : 사용 안 함, 1 : 사용 if (BasicInfo.CompCd.StartsWith("BR")) { // FEMV_PRT_DIV 0 : 사용 안 함, 1 : 사용 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "FEMV_PRT_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT407", optValue); } else if (BasicInfo.CompCd.StartsWith("SL")) { // SL 이행대상 항목 결정되지 않음 } else if (BasicInfo.CompCd.StartsWith("PC")) { // PC 이행대상 항목 결정되지 않음 } #endregion #region ### OPT422 BR 마감시 재고현황 출력옵션 // OPT422 BR 마감시 재고현황 출력옵션 0:출력, 1:미출력 if (BasicInfo.CompCd.StartsWith("BR")) { // FINVENTORY_DIV 0:출력, 1:미출력 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "FINVENTORY_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT422", optValue); } #endregion #region ### OPT428 DD 영수증 출력옵션 // OPT428 DD 영수증 출력옵션 0:전체, 1:구매내역 미출력 if (BasicInfo.CompCd.StartsWith("BR")) { // FINVENTORY_DIV 0:전체, 1:구매내역 미출력 temp = IniFile.GetValue(BasicInfo.OldStoreOptINI, "OPTIONINFO", "FINVENTORY_DIV").Trim(); if (string.IsNullOrWhiteSpace(temp)) optValue = "0"; else optValue = temp; dicOptInfo.Add("OPT428", optValue); } #endregion #region ### 포스옵션 서버전송 var isModify = false; foreach (var data in dicOptInfo) { var key = data.Key; var newValue = data.Value; var oldValue = BasicInfo.GetPosOptionInfo(key); if (oldValue != newValue) isModify = true; } if (isModify == false) { statusMsg = "Pos Optoin Master, No change data, migration skip"; return retValue = ComLog.InstallResult.Skip; } const string ROW_SPLIT = "#~"; const string COL_SPLIT = "|"; List lstData = new List(); foreach (var opt in dicOptInfo) { //05:포스옵션 //#~옵션코드|옵션값 var rowData = string.Join(COL_SPLIT, new string[] { opt.Key.Trim(), opt.Value.Trim() }); lstData.Add(rowData); } if (lstData.Count > 0) { var dataList = string.Join(ROW_SPLIT, lstData.ToArray()); Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); // 통신해더 생성 string commHead = ItemColumn.MakeCommHeader(0, "06"); // 전송데이터 htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.INQ_TYPE, Column.IQ_TMP_POSMST_INQ.MSG_ID); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.STOR_CD, BasicInfo.StoreNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.POS_NO, BasicInfo.PosNo); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.MST_KIND, Column.IQ_TMP_POSMST_INQ.MSTKIND.POSOPT); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.DATA_LIST, dataList); htSendData.Add(Column.IQ_TMP_POSMST_INQ.DATA.RES_CD, ""); NetworkJSON irt = new NetworkJSON(); int ret = irt.IRTSendReceive(ServerInfo.SvrIP, ServerInfo.SvrPort, 1000 * 20, commHead, htSendData, ref htRecvData); if (ret != ComLib.OK) { ComLog.WriteLog(ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => Server communication error"); statusMsg = "Server communication error"; return retValue = ComLog.InstallResult.Fail; } var res = htRecvData[Column.IQ_INSTALL_SCHEDULE_INQ.DATA.RES_CD].ToString().Trim(); statusMsg = string.Format("Pos Option info upload. Result={0} IQ_TMP_POSMST_INQ.DATA.RES_CD={1}", ComLog.InstallResultStr[(int)retValue], res); ComLog.WriteLog(res == "00" ? ComLog.Level.trace : ComLog.Level.Error , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , statusMsg); return retValue = res == "00" ? ComLog.InstallResult.Success : ComLog.InstallResult.Fail; } else { statusMsg = "Pos Option Master, Not exist data"; return retValue = ComLog.InstallResult.Skip; } #endregion } catch (Exception ex) { statusMsg = "Exception=" + ex.Message; ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => " + statusMsg); return retValue = ComLog.InstallResult.Fail; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format("End, Result={0}", ComLog.InstallResultStr[(int)retValue])); // 성공시에 데이터 백업 if (retValue != ComLog.InstallResult.Fail) { foreach (var data in dicOptInfo) { BasicInfo.SetPosOptionInfo(data.Key, data.Value); } } // 상태로그 전송 (12:PosOtion info upload) if (string.IsNullOrWhiteSpace(statusMsg)) statusMsg = string.Format("PosOptoin info upload. Result={0}", ComLog.InstallResultStr[(int)retValue]); ComLog.SendStatus(ComLog.InstallStatus.PosOptionUpload, retValue, statusMsg); } } /// /// 진 마지막 백업디렉토리 찾기 /// /// private string GetJinDirBack() { string retValue = string.Empty; try { if (ComLib.ExistDirectory(DirInfo.BackDir) == false) return retValue = string.Empty; DirectoryInfo[] di = new DirectoryInfo(DirInfo.BackDir).GetDirectories(); foreach(var d in from x in di where x.Name.ToUpper().StartsWith("LocalTBL_".ToUpper()) == true orderby x.Name descending select x) { retValue = d.FullName; break; } return retValue; } catch (Exception ex) { ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => Exception : " + ex.Message); return retValue = string.Empty; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => JinBackDire Find Reuslt={0} BackDir={1}", string.IsNullOrWhiteSpace(retValue) ? "Failed" : "Success", retValue)); } } /// /// 파일비교 (true=같음, false=다름) /// /// /// /// private bool FileCompare(string file1, string file2) { bool retValue = false; try { int file1byte, file2byte; //FileStream fs1, fs2; if (file1 == file2) { return retValue = true; } if (File.Exists(file1) == false || File.Exists(file2) == false) { return retValue = false; } using (FileStream fs1 = new FileStream(file1, FileMode.Open)) { using (FileStream fs2 = new FileStream(file2, FileMode.Open)) { if (fs1.Length != fs2.Length) { return retValue = false; } do { file1byte = fs1.ReadByte(); file2byte = fs2.ReadByte(); } while ((file1byte == file2byte) && (file1byte != -1)); } } return retValue = ((file1byte - file2byte) == 0); } catch (Exception ex) { ComLog.WriteLog(ComLog.Level.Exception , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , " => Exception : " + ex.Message); return retValue = false; } finally { ComLog.WriteLog(ComLog.Level.trace , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , string.Format(" => FileCompare Result={0} File1={1} File2={2}", retValue ? "Success" : "Failed", file1, file2)); } } private string ConvertDBStr(string str) { return str.Replace("'", "''"); } } }