using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; using System.Threading; using System.Net; using System.IO; using System.Data; using Newtonsoft.Json; using Cosmos.Common; using Cosmos.CommonManager; using Cosmos.BaseFrame; using Cosmos.UserFrame; using Cosmos.ServiceProvider; using ICSharpCode.SharpZipLib.Zip; namespace Cosmos.Network { public class NetworkCheckOver : IWatcher { private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출 /// /// StateServer Object (StateServer 객체) /// private StateServer StateObject = (StateServer)StateServer.GetInstance(); /// /// POS Status Value (POS 상태값) /// private PosStatus m_cPosStatus = null; /// /// Sending Socket (전송 소켓) /// private static TcpSocket m_sendSocket = null; /// /// MSSQL DB 관련 객체 /// private static SqlDB sqlDb = null; private ICheckOverUs m_cCheckOverDetail = null; /// /// 웹정보 서비스 /// private IDataServiceUs m_cWebBiz = null; /// /// Server SEND Thread (Server SEND 스레드) /// private Thread m_tCheckOver = null; /// /// Thread Waiting Time (스레드 대기시간 ms) /// private int m_ThreadSleepTerm = 60000; /// /// Network CheckOver Operation Yes/No (작동여부) /// private bool m_NetworkCheckOverRunning = true; /// /// 해피오더 조회/상태변경/취소 URL /// private string m_sHappyOrderURL; /// /// 빚은몰 주문 건수 조회 URL /// private string m_sBizeunSelectURL; /// /// 이지웰 주문 건수 조회 URL /// private string m_sEzwelSelectURL; /// /// 온도정보 URL /// private string m_sTempURL; //17.08.22 dkshin SS 해피오더 Hashtable[] m_htOrderLists; IHappyOrderList m_cHappyOrder = null;// 해피오더 서비스 처리 private TranStatus m_cTrnStatus;//거래정보 참조 //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 start private IDataCommonUs m_cDataCommon = null; //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 end //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start private int iInventoryDispCnt = -1; //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end public NetworkCheckOver() { m_cPosStatus = (PosStatus)StateObject.POS; m_cWebBiz = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.WEB_POS); m_cCheckOverDetail = new CheckOverDetail(); // 승인업체 코드 조회 string sVanCD = PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.ORDER_ITEM, ItemConst.TR_ITEM_ID.ORDER.HAPPYORDER_PAY, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); // 승인 URL 조회 m_sHappyOrderURL = PosMstManager.GetMstVan(sVanCD, PosMst.MST_VAN.DATA.IP); sVanCD = PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.ETC_INFO_ITEM, ItemConst.TR_ITEM_ID.ETC_INFO.BIZEUN, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); m_sBizeunSelectURL = PosMstManager.GetMstVan(sVanCD, PosMst.MST_VAN.DATA.IP); sVanCD = PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.ETC_INFO_ITEM, ItemConst.TR_ITEM_ID.ETC_INFO.EZWEL, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); m_sEzwelSelectURL = PosMstManager.GetMstVan(sVanCD, PosMst.MST_VAN.DATA.IP); m_sTempURL = (string)m_cWebBiz.GetData(new string[] { PosKey.MENU_KEY.WEB_TMPRT }); //17.08.22 dkshin SS 해피오더 m_cHappyOrder = (IHappyOrderList)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.HAPPY_ORDER_LIST); m_cTrnStatus = (TranStatus)StateObject.TRAN; //거래정보 //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 start m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON); //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 end } #region CheckOver Thread START / STOP public void Start() { try { sqlDb = new SqlDB(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword); m_tCheckOver = new Thread(new ThreadStart(ThreadCheckOverRun)); m_NetworkCheckOverRunning = true; m_tCheckOver.Start(); } catch(Exception ex) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } } public void Stop() { try { // 통신서버 Send Terminated (SC Send 종료) m_NetworkCheckOverRunning = false; int count = 0; while (count < 10) { if (m_tCheckOver != null && m_tCheckOver.IsAlive) m_NetworkCheckOverRunning = false; else break; count++; Thread.Sleep(100); } if (count == 10) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, UserCom.INFO_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "Force NetworkTranSend Service Stop!!!"); m_tCheckOver.Abort(); } // DB Close sqlDb.DBClose(); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } } #endregion CheckOver Thread START / STOP #region CheckOver Main private void ThreadCheckOverRun() { string sReqData = string.Empty; string sRespData = string.Empty; string sReturn = string.Empty; int iRet = 0; int iSubCount_1 = 0; int iSubCount_2 = 0; Hashtable htSendData = null; Hashtable htRecvData = null; try { while (m_NetworkCheckOverRunning) { try { // 해피오더 제일 먼저 조회 - 문성진D 요청 #region 5 - 해피오더 주문 건수 조회 // 4 - 해피오더 if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1") { //#20180228 해피오더 주문 건수 조회 기능 에러시 다른 기능 동작 되도록 수정 start //기존 /* sReqData = string.Format("storeCode={0}&deviceType=POS", m_cPosStatus.Base.StoreNo); //sReqData = string.Format("storeCode={0}&deviceType=POS", "11101"); iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData); if (iRet == BaseCom.OK) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) sRespData); sReturn = m_cCheckOverDetail.SelectHappyOrderCountByOrderStatus(JsonConvert.DeserializeObject(sRespData)); } */ //변경 HappyOrderCntChk(); //#20180228 해피오더 주문 건수 조회 기능 에러시 다른 기능 동작 되도록 수정 end } #endregion #region 1 - 공지사항 요청(점주/알바모드, 위해상품 메시지, 입고등록 확인, 배송정보, 기념일 배송) - 30분 단위 // 1 - 공지사항 요청(점주/알바모드, 위해상품 메시지, 입고등록 확인, 배송정보, 기념일 배송) if (iSubCount_1 == 10) { // 전문 생성 htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.NOTICE_INQ_REQ, null); // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.BizInqPort), (int)5000, htSendData, ref htRecvData); if (iRet == BaseCom.OK) { if (htRecvData[Column.IQ_NOTICE_INQ_RSP.DATA.RES_CD].ToString() == "00") { DataTable dtNotice = ParseMsgValueField(htRecvData[Column.IQ_NOTICE_INQ_RSP.DATA.MSG_VALUE].ToString()); // 서브 업무 처리 DoSubProc(dtNotice); } } } #endregion 1 - 공지사항 요청(점주/알바모드, 위해상품 메시지, 입고등록 확인, 배송정보, 기념일 배송) #region 2 - 일반 공지사항 요청 // 2 - 일반 공지사항 요청 if(iSubCount_2 == 30) { htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.MSG_TRANSFER_REQ, new string[] { "0" , m_cPosStatus.Base.RegularNoticeUpdateDT , m_cPosStatus.Base.EmergencyNoticeUpdateDT , m_cPosStatus.Base.SaleNoticeUpdateDT1 , m_cPosStatus.Base.SaleNoticeUpdateDT2 }); // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.SysInfoPort), (int)5000, htSendData, ref htRecvData); if (iRet == BaseCom.OK) { if (htRecvData[Column.IQ_MSG_SND_RSP.DATA.RES_CD].ToString() == "00") { if (InsertIntoEMG_NOTE(htRecvData) != UserCom.OK) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "Failed to insert into MST_EMG_NOTE ( " + "[MSG_CD]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CD].ToString() + "[MSG_DIV]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV].ToString() + "[MSG_TITLE]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TITLE].ToString() + " )"); } else { // 업데이트 시간 갱신 UpdateNoticesDateTime(htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV].ToString(), htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TYPE].ToString(), htRecvData[Column.IQ_MSG_SND_RSP.DATA.UPD_DATE].ToString()); // MSG_DIV = '00'(긴급) 이고 MSG_TYPE = '1'(마스터) 이면 // 긴급 적용 마스터 리스트 Update if (htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV].ToString() == "00" && htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TYPE].ToString() == "1") { htSendData.Clear(); htSendData = MakePOSMASTERLISTReqData(); // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.BizInqPort), (int)5000, htSendData, ref htRecvData); if (iRet == BaseCom.OK) { if (htRecvData[Column.IQ_POSMASTERLIST_REQ.DATA.DOWN_DIV].ToString() == "2") { string[] arMasterList = (htRecvData[Column.IQ_POSMASTERLIST_REQ.DATA.MASTER_LIST].ToString()).Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (UpdateMasterTableList(arMasterList) != UserCom.OK) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "Failed to update emergency master list [" + htRecvData[Column.IQ_POSMASTERLIST_REQ.DATA.MASTER_LIST].ToString() + "]"); } } } } } } } } #endregion 2 - 긴급 공지 요청(긴급공지, 주문긴급공지, 관공서 방문 점검 공지, 오늘의 할 일) #region 3 - 긴급 공지사항 요청 // 3 - 긴급 공지사항 요청 { htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.MSG_TRANSFER_REQ, new string[] { "2" , m_cPosStatus.Base.RegularNoticeUpdateDT , m_cPosStatus.Base.EmergencyNoticeUpdateDT , m_cPosStatus.Base.SaleNoticeUpdateDT1 , m_cPosStatus.Base.SaleNoticeUpdateDT2 }); // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.SysInfoPort), (int)5000, htSendData, ref htRecvData); if (iRet == BaseCom.OK) { if (htRecvData[Column.IQ_MSG_SND_RSP.DATA.RES_CD].ToString() == "00") { if (InsertIntoEMG_NOTE(htRecvData) != UserCom.OK) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "Failed to insert into MST_EMG_NOTE ( " + "[MSG_CD]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CD].ToString() + "[MSG_DIV]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV].ToString() + "[MSG_TITLE]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TITLE].ToString() + " )"); } else { // 업데이트 시간 갱신 UpdateNoticesDateTime(htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV].ToString(), htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TYPE].ToString(), htRecvData[Column.IQ_MSG_SND_RSP.DATA.UPD_DATE].ToString()); // MSG_DIV = '00'(긴급) 이고 MSG_TYPE = '1'(마스터) 이면 // 긴급 적용 마스터 리스트 Update if (htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV].ToString() == "00" && htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TYPE].ToString() == "1") { htSendData.Clear(); htSendData = MakePOSMASTERLISTReqData(); // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.BizInqPort), (int)5000, htSendData, ref htRecvData); if (iRet == BaseCom.OK) { if (htRecvData[Column.IQ_POSMASTERLIST_REQ.DATA.DOWN_DIV].ToString() == "2") { string[] arMasterList = (htRecvData[Column.IQ_POSMASTERLIST_REQ.DATA.MASTER_LIST].ToString()).Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (UpdateMasterTableList(arMasterList) != UserCom.OK) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "Failed to update emergency master list [" + htRecvData[Column.IQ_POSMASTERLIST_REQ.DATA.MASTER_LIST].ToString() + "]"); } } } } } } } } #endregion 3 - 긴급 공지사항 요청 #region 4 - 영업 공지 요청(오늘의 할 일, 식품 안전 메시지) - 10분 단위 // 3 - 영업 공지 요청(오늘의 할 일, 식품 안전 메시지) 1 if (iSubCount_1 == 10) { htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.MSG_TRANSFER_REQ, new string[] { "1" , m_cPosStatus.Base.RegularNoticeUpdateDT , m_cPosStatus.Base.EmergencyNoticeUpdateDT , m_cPosStatus.Base.SaleNoticeUpdateDT1 , m_cPosStatus.Base.SaleNoticeUpdateDT2 }); // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.SysInfoPort), (int)5000, htSendData, ref htRecvData); if (iRet == BaseCom.OK) { if (htRecvData[Column.IQ_MSG_SND_RSP.DATA.RES_CD].ToString() == "00") { if (InsertIntoEMG_NOTE(htRecvData) != UserCom.OK) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "Failed to insert into MST_EMG_NOTE ( " + "[MSG_CD]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CD].ToString() + "[MSG_DIV]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV].ToString() + "[MSG_TITLE]=" + htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TITLE].ToString() + " )"); } else { // 업데이트 시간 갱신 UpdateNoticesDateTime(htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV].ToString(), htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TYPE].ToString(), htRecvData[Column.IQ_MSG_SND_RSP.DATA.UPD_DATE].ToString()); } } } } #endregion 4 - 영업 공지 요청(오늘의 할 일, 식품 안전 메시지) #region 6 - 빚은몰 주문 건수 조회 // 5 - 빚은몰 if (PosMstManager.GetPosOption(POS_OPTION.OPT036) == "1") { sReqData = string.Format("AMACODE={0}", m_cPosStatus.Base.StoreNo); iRet = this.HttpGET_SendReceive(m_sBizeunSelectURL, string.Empty, sReqData, PosConst.ENCODING_FLAG.KSC, ref sRespData); if (iRet == BaseCom.OK) { sReturn = m_cCheckOverDetail.SelectBizeunOrderCount(sRespData); } } #endregion #region 7 - 이지웰 주문 건수 조회 // 6 - 이지웰 if (PosMstManager.GetPosOption(POS_OPTION.OPT037) == "1") { sReqData = string.Format("AMACODE={0}", m_cPosStatus.Base.StoreNo); iRet = this.HttpGET_SendReceive(m_sEzwelSelectURL, string.Empty, sReqData, PosConst.ENCODING_FLAG.KSC, ref sRespData); if (iRet == BaseCom.OK) { sReturn = m_cCheckOverDetail.SelectEzwelOrderCount(sRespData); } } #endregion if (m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS) //메인포스만 전송 처리! { #region 7 - 점포 방문 이력 전송(제조기사 타임 바코드) { ///////////////////////////////////////////////////////////////// /// 중요! 테이블 컬럼명 갯수와 명칭은 동일 해야함! ///////////////////////////////////////////////////////////////// htSendData = new Hashtable(); //전송 내역 확인 DataTable dt = SelectSendDataList(ItemConst.IRT_INQ_TYPE.STOR_VISIT); if (!(dt == null || dt.Rows.Count == 0)) { DataRow dr = dt.Rows[0]; for (int iRow = 0; iRow < dr.Table.Columns.Count; iRow++) { htSendData.Add(dr.Table.Columns[iRow].ColumnName, dr[iRow].ToString()); } // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.BizInqPort), (int)5000, htSendData, ref htRecvData); string sFlag = "9"; if (iRet == BaseCom.OK) { if (htRecvData["RES_CD"].ToString() == "00") { sFlag = "1"; } } UpdateTableSend(ItemConst.IRT_INQ_TYPE.STOR_VISIT, sFlag, htSendData); } } #endregion 7 - 점포 방문 이력 전송(제조기사 타임 바코드) #region 8 - 근태 등록 요청/응답 { ///////////////////////////////////////////////////////////////// /// 중요! 테이블 컬럼명 갯수와 명칭은 동일 해야함! ///////////////////////////////////////////////////////////////// htSendData = new Hashtable(); //전송 내역 확인 DataTable dt = SelectSendDataList(ItemConst.IRT_INQ_TYPE.EMP_COMMUTE); if (!(dt == null || dt.Rows.Count == 0)) { DataRow dr = dt.Rows[0]; // 전문 생성 for (int iRow = 0; iRow < dr.Table.Columns.Count; iRow++) { htSendData.Add(dr.Table.Columns[iRow].ColumnName, dr[iRow].ToString()); } // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.BizInqPort), (int)5000, htSendData, ref htRecvData); string sFlag = "9"; if (iRet == BaseCom.OK) { if (htRecvData["RES_CD"].ToString() == "00") { sFlag = "1"; } } UpdateTableSend(ItemConst.IRT_INQ_TYPE.EMP_COMMUTE, sFlag, htSendData); } } #endregion 8 - 근태 등록 요청/응답 #region 9 - 점주/알바 모드 전송 { ///////////////////////////////////////////////////////////////// /// 중요! 테이블 컬럼명 갯수와 명칭은 동일 해야함! ///////////////////////////////////////////////////////////////// htSendData = new Hashtable(); //전송 내역 확인 DataTable dt = SelectSendDataList(ItemConst.IRT_INQ_TYPE.ONWER_MODE); if (!(dt == null || dt.Rows.Count == 0)) { DataRow dr = dt.Rows[0]; // 전문 생성 for (int iRow = 0; iRow < dr.Table.Columns.Count; iRow++) { htSendData.Add(dr.Table.Columns[iRow].ColumnName, dr[iRow].ToString()); } // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.BizInqPort), (int)5000, htSendData, ref htRecvData); string sFlag = "9"; if (iRet == BaseCom.OK) { if (htRecvData["RES_CD"].ToString() == "00") { sFlag = "1"; } } UpdateTableSend(ItemConst.IRT_INQ_TYPE.ONWER_MODE, sFlag, htSendData); } } #endregion 9 - 점주/알바 모드 전송 } #region 10 - 유해 상품 읽음 전송 { ///////////////////////////////////////////////////////////////// /// 중요! 테이블 컬럼명 갯수와 명칭은 동일 해야함! ///////////////////////////////////////////////////////////////// htSendData = new Hashtable(); //전송 내역 확인 DataTable dt = SelectSendDataList(ItemConst.IRT_INQ_TYPE.HARMFUL_ITEM_MSG_REQ); if (!(dt == null || dt.Rows.Count == 0)) { DataRow dr = dt.Rows[0]; for (int iRow = 0; iRow < dr.Table.Columns.Count; iRow++) { htSendData.Add(dr.Table.Columns[iRow].ColumnName, dr[iRow].ToString()); } // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.SysInfoPort), (int)5000, htSendData, ref htRecvData); string sFlag = "9"; if (iRet == BaseCom.OK) { if (htRecvData["RES_CD"].ToString() == "00") { sFlag = "2"; } } UpdateTableSend(ItemConst.IRT_INQ_TYPE.HARMFUL_ITEM_MSG_REQ, sFlag, htSendData); } } #endregion 10 - 유해 상품 읽음 전송 #region 11 - 온도정보 조회 // 11 - 온도정보 if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT039), "0") == "1") { string TempURL = string.Empty; if (m_sTempURL.Length > 100) { TempURL = CmUtil.MidH(m_sTempURL, 31, 100).Trim(); sRespData = string.Empty; if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.CN) { if (m_cPosStatus.Base.StoreNo.Length >= 7) sReqData = string.Format("COMP_CD=CP&BRAND_CD={0}&STORE_CD={1}", m_cPosStatus.Base.BrandCd, m_cPosStatus.Base.StoreNo.Substring(2, 5)); else sReqData = string.Format("COMP_CD=CP&BRAND_CD={0}&STORE_CD={1}", m_cPosStatus.Base.BrandCd, m_cPosStatus.Base.StoreNo); // 중국 http://si1.paris.co.kr/posLink?COMP_CD=CP&BRAND_CD=5000&STORE_CD=00001 } else { if (m_cPosStatus.Base.StoreNo.Length >= 7) sReqData = string.Format("COMP_CD={0}&BRAND_CD={1}&STORE_CD={2}", m_cPosStatus.Base.CmpCd.Substring(0, 2), m_cPosStatus.Base.BrandCd, m_cPosStatus.Base.StoreNo.Substring(2, 5)); else sReqData = string.Format("COMP_CD={0}&BRAND_CD={1}&STORE_CD={2}", m_cPosStatus.Base.CmpCd.Substring(0, 2), m_cPosStatus.Base.BrandCd, m_cPosStatus.Base.StoreNo); //iRet = this.HttpGET_SendReceive("http://si1.paris.co.kr", "/posLink", "COMP_CD=PC&BRAND_CD=002&STORE_CD=17496", PosConst.ENCODING_FLAG.UTF, ref sRespData); //iRet = this.HttpGET_SendReceive("http://si1.paris.co.kr", "/posLink", sReqData, PosConst.ENCODING_FLAG.UTF, ref sRespData); //iRet = this.HttpGET_SendReceive("http://si1.paris.co.kr", "/posLink", "COMP_CD=PC&BRAND_CD=002&STORE_CD=17859", PosConst.ENCODING_FLAG.UTF, ref sRespData); } iRet = this.HttpGET_SendReceive(TempURL, string.Empty, sReqData, PosConst.ENCODING_FLAG.UTF, ref sRespData); if (iRet == BaseCom.OK) { sReturn = m_cCheckOverDetail.SelectStoreTempInfo(sRespData); } } } #endregion #region 12 - BR팝업 업무 처리 if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR) BrPopUpBiz(); #endregion #region 13 - LOG 전송 처리 { // 전문 생성 htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.POS_LOGFILE_REQ, new string[] { PosConst.POS_LOGFILE_REQ_TYPE.LOGFILE_REQ, "" }); // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.PayInqPort), (int)5000, htSendData, ref htRecvData); if(iRet == BaseCom.OK) { // 전송할 LOG 데이터 있음 if(htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.RES_CD].ToString() == "00") { string sFileNm = ""; iRet = UploadLogFileProc(htRecvData, ref sFileNm); if(iRet == BaseCom.OK) { // Upload 성공 htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.POS_LOGFILE_REQ, new string[] { PosConst.POS_LOGFILE_REQ_TYPE.LOGFILE_UPLOAD, htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.LOG_DT].ToString() }); } else if(iRet == BaseCom.NG1) { // Upload 파일 존재하지 않음 htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.POS_LOGFILE_REQ, new string[] { PosConst.POS_LOGFILE_REQ_TYPE.NO_LOGFILE, htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.LOG_DT].ToString() }); } else { // Upload 실패 htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.POS_LOGFILE_REQ, new string[] { PosConst.POS_LOGFILE_REQ_TYPE.LOGFILE_UPLOAD_FAIL, htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.LOG_DT].ToString() }); } // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.PayInqPort), (int)5000, htSendData, ref htRecvData); } } } #endregion 13 - LOG 전송 처리 //17.08.22 dkshin SS 해피오더 #region 14 - SS 해피오더 자동 처리 //#20171124 해당 옵션 웹에서 등록 안한 경우 동작 안하도록 수정 start //기존 //if (PosMstManager.GetPosOption(POS_OPTION.OPT048) != "0") //변경 if (PosMstManager.GetPosOption(POS_OPTION.OPT048) != "0" && PosMstManager.GetPosOption(POS_OPTION.OPT048) != "") //#20171124 해당 옵션 웹에서 등록 안한 경우 동작 안하도록 수정 end { SSHappyOrderAutoProcess(); } #endregion //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start #region 해피오더 실시간 재고 알람 //**************************************************************************************** //WEB에서 재고 미등록 상태일 때 포스로 Y값을 내려주고 Y로 내려오면 판매화면 상단에 깜빡이는 패널 생성해줌. //10분마다 조회하고 1분동안 패널 표시해줌 //**************************************************************************************** if (PosMstManager.GetPosOption(POS_OPTION.OPT518) == "1") { //// 타이머시작 //iInventoryDispCnt = iInventoryDispCnt + 1; //// 타이머 전역변수 (초) //m_cPosStatus.Sale.HappyOrderInventoryTime = iInventoryDispCnt.ToString(); //// (처음한번)실시간재고알람Y/N 읽어오기 //if (iInventoryDispCnt == 0) //{ // HappyOrderInventoryAlram(); //} //// (10분마다)실시간재고알람Y/N 읽어오기 //else if (iInventoryDispCnt >= 60 * 10) //{ // iInventoryDispCnt = 0; // HappyOrderInventoryAlram(); //} HappyOrderInventoryAlram(); } #endregion //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "Exception in NetworkCheckOver Thread" + ex.Message); } int nNowSleepTerm = 0; while (nNowSleepTerm < m_ThreadSleepTerm) { if (m_NetworkCheckOverRunning == false) break; Thread.Sleep(100); nNowSleepTerm += 100; } if (iSubCount_1 == 10) iSubCount_1 = 0; else iSubCount_1++; if (iSubCount_2 == 30) iSubCount_2 = 0; else iSubCount_2++; //System.Threading.Thread.Sleep(m_ThreadSleepTerm); } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } } private void UpdateNoticesDateTime(string sMsgDiv, string sMsgType, string sDateTime) { try { // 업데이트 시간 갱신 switch (sMsgDiv) { case "00": // 긴급 공지 m_cPosStatus.Base.EmergencyNoticeUpdateDT = sDateTime; break; case "01": // 일반 공지 m_cPosStatus.Base.RegularNoticeUpdateDT = sDateTime; break; case "02": // 영업 공지 if (sMsgType == "1") { // 오늘의 할 일 m_cPosStatus.Base.SaleNoticeUpdateDT1 = sDateTime; } else { // 식품안전 메시지 m_cPosStatus.Base.SaleNoticeUpdateDT2 = sDateTime; } break; } // PosSaleInfo.ini 저장 IServiceUs cSaveConfigInfo = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.SAVE_CONFIGINFO); string sRet = cSaveConfigInfo.Execute(new string[] { PosConst.INI_FILE_NAME.PosSaleInfo }); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } } //#20180228 해피오더 주문 건수 조회 기능 에러시 다른 기능 동작 되도록 수정 start private void HappyOrderCntChk() { string sReqData = string.Empty; string sRespData = string.Empty; string sReturn = string.Empty; int iRet = 0; //grayber@20180306 해피오더 주문가능 상태 추가 start - HashTable 추가 Hashtable htRspData = null; //grayber@20180306 해피오더 주문가능 상태 추가 end try { sReqData = string.Format("storeCode={0}&deviceType=POS", m_cPosStatus.Base.StoreNo); //sReqData = string.Format("storeCode={0}&deviceType=POS", "11101"); //#20180605 해피오더 개선 start - 20180618 //기존 /* //grayber@20180306 해피오더 주문가능 상태 추가 start - 공통사용 함수가 아닌 NetworkCheckOver class 의 함수를 사용를 수정 // 기존 //iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData); // 변경 iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData, ref htRspData); //grayber@20180306 해피오더 주문가능 상태 추가 end */ //변경 if (m_cPosStatus.Base.BrandCd == PosConst.MST_BRAND_CODE.PC_PB) { iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT_PB, sReqData, ref sRespData, ref htRspData); } else { iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData, ref htRspData); } //#20180605 해피오더 개선 end - 20180618 if (iRet == BaseCom.OK) { //grayber@20180306 해피오더 주문가능 상태 추가 start - 함수 HashTable 값 추가 //기존 //sReturn = m_cCheckOverDetail.SelectHappyOrderCountByOrderStatus(JsonConvert.DeserializeObject(sRespData)); //변경 sReturn = m_cCheckOverDetail.SelectHappyOrderCountByOrderStatus(JsonConvert.DeserializeObject(sRespData) , ref htRspData); //grayber@20180306 해피오더 주문가능 상태 추가 end } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } } //#20180228 해피오더 주문 건수 조회 기능 에러시 다른 기능 동작 되도록 수정 end #endregion CheckOver Main #region 공지사항 조회 - 서브 업무 처리 private void DoSubProc(DataTable dtList) { int iRet = UserCom.NG; try { for (int nLoop = 0; nLoop < dtList.Rows.Count; nLoop++) { DataRow dr = dtList.Rows[nLoop]; switch(CmUtil.GetDataRowStr(dr, "MSG_CODE")) { case "01": // 점주/알바 모드 iRet = InsertIntoNOTICE_MNG(new string[] { "01", CmUtil.GetDataRowStr(dr, "VALUE_1"), CmUtil.GetDataRowStr(dr, "VALUE_2") }); break; case "02": // 위해상품 메시지 등록 if (CmUtil.GetDataRowInt(dr, "VALUE_1") > 0) { iRet = ProcHarmfulItemMsgReg(); } break; case "03": // 입고등록 확인 iRet = InsertIntoNOTICE_MNG(new string[] { "03", CmUtil.GetDataRowStr(dr, "VALUE_3"), CmUtil.GetDataRowStr(dr, "VALUE_4") }); break; case "04": // 배송 정보 iRet = InsertIntoNOTICE_MNG(new string[] { "04", CmUtil.GetDataRowStr(dr, "VALUE_3"), CmUtil.GetDataRowStr(dr, "VALUE_4") }); break; case "05": // 기념일 배송 iRet = InsertIntoNOTICE_MNG(new string[] { "05", CmUtil.GetDataRowStr(dr, "VALUE_1") }); break; } } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } } private int ProcHarmfulItemMsgReg() { int iRet = BaseCom.NG; Hashtable htSendData = null; Hashtable htRecvData = null; try { // 전문 생성 htSendData = this.MakeMessageSendingReqData(ItemConst.IRT_INQ_TYPE.HARMFUL_ITEM_MSG_REQ, null); // 전문 요청 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.SysInfoPort), (int)5000, htSendData, ref htRecvData); if (iRet == BaseCom.OK) { if (htRecvData[Column.IQ_FOODMSG_RSP.DATA.RES_CD].ToString() == "00") { // DB Insert iRet = InsertIntoNOTICE_MNG(new string[] { "02", htRecvData[Column.IQ_FOODMSG_RSP.DATA.ISPCTN_ORGAN_CD].ToString(), htRecvData[Column.IQ_FOODMSG_RSP.DATA.DOC_NO].ToString() , htRecvData[Column.IQ_FOODMSG_RSP.DATA.SEQ].ToString(), htRecvData[Column.IQ_FOODMSG_RSP.DATA.ITEM_NM].ToString() , htRecvData[Column.IQ_FOODMSG_RSP.DATA.BAR_CD].ToString() }); } } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } #endregion #region 공지사항 조회 응답 中 공지사항구분 필드 파싱 처리 private DataTable ParseMsgValueField(string sMsgValue) { DataTable dtMsgValue = null; try { dtMsgValue = new DataTable(); dtMsgValue.Columns.Add(new DataColumn("MSG_CODE", typeof(string))); dtMsgValue.Columns.Add(new DataColumn("VALUE_1", typeof(string))); dtMsgValue.Columns.Add(new DataColumn("VALUE_2", typeof(string))); dtMsgValue.Columns.Add(new DataColumn("VALUE_3", typeof(string))); dtMsgValue.Columns.Add(new DataColumn("VALUE_4", typeof(string))); dtMsgValue.Clear(); string[] sRows = sMsgValue.Split(new string[] { "#~" }, StringSplitOptions.RemoveEmptyEntries); foreach(string sRow in sRows) { string[] sColumns = sRow.Split(new string[] { "|" }, StringSplitOptions.None); DataRow drNew = dtMsgValue.NewRow(); drNew["MSG_CODE"] = sColumns[0]; drNew["VALUE_1"] = sColumns[1]; drNew["VALUE_2"] = sColumns[2]; drNew["VALUE_3"] = sColumns[3]; drNew["VALUE_4"] = sColumns[4]; dtMsgValue.Rows.Add(drNew); } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return dtMsgValue; } #endregion #region IRT 요청 Data 생성 private Hashtable MakeMessageSendingReqData(string sInqType, string[] sParams) { Hashtable htData = new Hashtable(); try { if (sInqType == ItemConst.IRT_INQ_TYPE.MSG_TRANSFER_REQ) { // 01 - INQ 종별("05":공지메시지) htData.Add(Column.IQ_MSG_SND_REQ.DATA.INQ_TYPE, sInqType); // 02 - 영업 일자 htData.Add(Column.IQ_MSG_SND_REQ.DATA.SALE_DT, m_cPosStatus.Base.SaleDate); // 03 - 점포 코드 htData.Add(Column.IQ_MSG_SND_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); // 04 - 사용자 htData.Add(Column.IQ_MSG_SND_REQ.DATA.USER_ID, m_cPosStatus.Base.CashierNo); // 05 - 반환용 메시지 코드 htData.Add(Column.IQ_MSG_SND_REQ.DATA.MSG_CD, string.Empty); // 통신서버 측 조회 쿼리가 무거워서 일반과 긴급을 나눔(2017.07.28) //// 06 - 메시지 구분("0":일반/긴급공지, "1":영업공지) // 06 - 메시지 구분("0":일반공지, "1":영업공지, "2":긴급공지) htData.Add(Column.IQ_MSG_SND_REQ.DATA.MSG_DIV, sParams[0]); // 07 - 업데이트 일자1 htData.Add(Column.IQ_MSG_SND_REQ.DATA.UPD_DT1, sParams[1]); // 08 - 업데이트 일자2 htData.Add(Column.IQ_MSG_SND_REQ.DATA.UPD_DT2, sParams[2]); // 09 - 업데이트 일자3 htData.Add(Column.IQ_MSG_SND_REQ.DATA.UPD_DT3, sParams[3]); // 10 - 업데이트 일자4 htData.Add(Column.IQ_MSG_SND_REQ.DATA.UPD_DT4, sParams[4]); } else if(sInqType == ItemConst.IRT_INQ_TYPE.NOTICE_INQ_REQ) { // 01 - INQ 종별("49":공지사항) htData.Add(Column.IQ_NOTICE_INQ_REQ.DATA.INQ_TYPE, sInqType); // 02 - 점포 코드 htData.Add(Column.IQ_NOTICE_INQ_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); // 03 - 영업 일자 htData.Add(Column.IQ_NOTICE_INQ_REQ.DATA.SALE_DT, m_cPosStatus.Base.SaleDate); // 04 - POS 번호 htData.Add(Column.IQ_NOTICE_INQ_REQ.DATA.POS_NO, m_cPosStatus.Base.PosNo); // 05 - 메시지 등록 코드 htData.Add(Column.IQ_NOTICE_INQ_REQ.DATA.MSG_VALUE, ""); // 06 - 응답 코드 htData.Add(Column.IQ_NOTICE_INQ_REQ.DATA.RES_CD, "00"); } else if(sInqType == ItemConst.IRT_INQ_TYPE.HARMFUL_ITEM_MSG_REQ) { // 01 - INQ 종별("20":공지메시지) htData.Add(Column.IQ_FOODMSG_REQ.DATA.INQ_TYPE, sInqType); // 02 - 영업일자 htData.Add(Column.IQ_FOODMSG_REQ.DATA.SALE_DT, m_cPosStatus.Base.SaleDate); // 03 - 점포코드 htData.Add(Column.IQ_FOODMSG_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); // 04 - 요청구분 htData.Add(Column.IQ_FOODMSG_REQ.DATA.REQ_DIV, "1"); // 05 - 검사 기간코드 htData.Add(Column.IQ_FOODMSG_REQ.DATA.ISPCTN_ORGAN_CD, ""); // 06 - 문서번호 htData.Add(Column.IQ_FOODMSG_REQ.DATA.DOC_NO, ""); // 07 - 일련번호 htData.Add(Column.IQ_FOODMSG_REQ.DATA.SEQ, ""); } else if(sInqType == ItemConst.IRT_INQ_TYPE.POS_LOGFILE_REQ) { // 01 - INQ 종별("69":POS 로그 파일 송신요청) htData.Add(Column.IQ_POS_LOGFILE_REQ.DATA.INQ_TYPE, sInqType); // 02 - 점포코드 htData.Add(Column.IQ_POS_LOGFILE_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); // 03 - POS번호 htData.Add(Column.IQ_POS_LOGFILE_REQ.DATA.POS_NO, m_cPosStatus.Base.PosNo); // 04 - 요청 LOG 일자 htData.Add(Column.IQ_POS_LOGFILE_REQ.DATA.LOG_DT, sParams[1]); // 05 - 요청구분("1":로그요청 확인, "2":POS수신완료, "3":FTP송신완료) htData.Add(Column.IQ_POS_LOGFILE_REQ.DATA.REQ_DIV, sParams[0]); // 06 - 전송할 FTP PATH htData.Add(Column.IQ_POS_LOGFILE_REQ.DATA.FTP_PATH, ""); // 07 - FILE_NM htData.Add(Column.IQ_POS_LOGFILE_REQ.DATA.FILE_NM, ""); // 08 - 응답코드 htData.Add(Column.IQ_POS_LOGFILE_REQ.DATA.RES_CD, "00"); } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return htData; } private Hashtable MakePOSMASTERLISTReqData() { Hashtable htData = new Hashtable(); try { // 01 - INQ 종별 htData.Add(Column.IQ_POSMASTERLIST_REQ.DATA.INQ_TYPE, "44"); // 02 - 다운 구분 htData.Add(Column.IQ_POSMASTERLIST_REQ.DATA.DOWN_DIV, "1"); // 03 - 다운 마스터 항목 htData.Add(Column.IQ_POSMASTERLIST_REQ.DATA.MASTER_LIST, ""); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return htData; } #endregion #region DB 관련 처리 private int InsertIntoNOTICE_MNG(string[] aParam) { int iRet = UserCom.NG; string sUpdQuery = string.Empty; string sInsQuery = string.Empty; string sSeqQuery = string.Empty; string sCntQuery = string.Empty; string sSql = string.Empty; DataTable dtData = null; try { sUpdQuery = " UPDATE POSLOG..ETC_NOTICE_MNG "; sUpdQuery += " SET VAL_ENTRY_01 = N'{0}' "; sUpdQuery += " , VAL_ENTRY_02 = N'{1}' "; sUpdQuery += " , VAL_ENTRY_03 = N'{2}' "; sUpdQuery += " , VAL_ENTRY_04 = N'{3}' "; sUpdQuery += " , VAL_ENTRY_05 = N'{4}' "; sUpdQuery += " , VAL_ENTRY_06 = N'{5}' "; sUpdQuery += " , VAL_ENTRY_07 = N'{6}' "; sUpdQuery += " , VAL_ENTRY_08 = N'{7}' "; sUpdQuery += " , VAL_ENTRY_09 = N'{8}' "; sUpdQuery += " , VAL_ENTRY_10 = N'{9}' "; sUpdQuery += " , SEND_FLAG = '0' "; sUpdQuery += " WHERE CMP_CD = '{10}' "; sUpdQuery += " AND STOR_CD = '{11}' "; sUpdQuery += " AND POS_NO = '{12}' "; sUpdQuery += " AND MSG_DIV = '{13}' "; sSeqQuery = " SELECT MAX(ISNULL(SEQ, 0)) AS SEQ "; sSeqQuery += " FROM POSLOG..ETC_NOTICE_MNG "; sSeqQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sSeqQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sSeqQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' "; sSeqQuery += " AND MSG_DIV = '02' "; sCntQuery = " SELECT COUNT(1) AS CNT "; sCntQuery += " FROM POSLOG..ETC_NOTICE_MNG "; sCntQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sCntQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sCntQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' "; sCntQuery += " AND MSG_DIV = '{0}' "; sInsQuery = " INSERT INTO POSLOG..ETC_NOTICE_MNG "; sInsQuery += " ( CMP_CD, STOR_CD, POS_NO, MSG_DIV, SEQ "; sInsQuery += " , VAL_ENTRY_01, VAL_ENTRY_02, VAL_ENTRY_03, VAL_ENTRY_04, VAL_ENTRY_05 "; sInsQuery += " , VAL_ENTRY_06, VAL_ENTRY_07, VAL_ENTRY_08, VAL_ENTRY_09, VAL_ENTRY_10 "; sInsQuery += " , REG_DATE, UPD_DATE, SEND_FLAG ) "; sInsQuery += " VALUES "; sInsQuery += " ( '{0}', '{1}', '{2}', '{3}', {4} "; sInsQuery += " , N'{5}', N'{6}', N'{7}', N'{8}', N'{9}' "; sInsQuery += " , N'{10}', N'{11}', N'{12}', N'{13}', N'{14}' "; sInsQuery += " , '{15}', '{16}', '0' ) "; switch(aParam[0]) { case "01": // 점주/알바 모드 case "03": // 입고등록 확인 case "04": // 배송정보 sSql = string.Format(sCntQuery, aParam[0]); sqlDb.DBDataTableSelect(sSql, CommandType.Text, (System.Data.SqlClient.SqlParameter[])null, out dtData); if(dtData != null && dtData.Rows.Count > 0) { if(CmUtil.GetDataRowInt(dtData.Rows[0], "CNT") == 0) { sSql = string.Format(sInsQuery, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.PosNo, aParam[0], "1" , aParam[1], aParam[2], "", "", "" , "", "", "", "", "" , DateTime.Now.ToString("yyyyMMddHHmmss"), ""); } else { sSql = string.Format(sUpdQuery, aParam[1], aParam[2], "", "", "", "", "", "", "", "" , m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.PosNo, aParam[0]); } } break; case "02": // 위해상품 메시지 등록 int iSeq = 0; sqlDb.DBDataTableSelect(sSeqQuery, CommandType.Text, (System.Data.SqlClient.SqlParameter[])null, out dtData); if(dtData != null && dtData.Rows.Count > 0) { iSeq = CmUtil.GetDataRowInt(dtData.Rows[0], "SEQ") + 1; } sSql = string.Format(sInsQuery, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.PosNo, aParam[0], iSeq , aParam[1], aParam[2], aParam[3], aParam[4], aParam[5] , "", "", "", "", "" , DateTime.Now.ToString("yyyyMMddHHmmss"), ""); break; case "05": // 기념일 배송 sSql = string.Format(sCntQuery, aParam[0]); sqlDb.DBDataTableSelect(sSql, CommandType.Text, (System.Data.SqlClient.SqlParameter[])null, out dtData); if(dtData != null && dtData.Rows.Count > 0) { if(CmUtil.GetDataRowInt(dtData.Rows[0], "CNT") == 0) { sSql = string.Format(sInsQuery, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.PosNo, aParam[0], "1" , aParam[1], "", "", "", "" , "", "", "", "", "" , DateTime.Now.ToString("yyyyMMddHHmmss"), ""); } else { sSql = string.Format(sUpdQuery, aParam[1], "", "", "", "", "", "", "", "", "" , m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.PosNo, aParam[0]); } } break; } iRet = sqlDb.DBExecuteNonQuery(sSql, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } private int InsertIntoEMG_NOTE(Hashtable htRecvData) { int iRet = UserCom.NG; //string sUpdQuery = string.Empty; //string sInsQuery = string.Empty; string sQuery = string.Empty; string sSql = string.Empty; try { //sUpdQuery = " UPDATE POSMST..MST_EMG_NOTE "; //sUpdQuery += " SET MSG_TITLE = '{0}' "; //sUpdQuery += " , MSG_CONTENTS = '{1}' "; //sUpdQuery += " , POS_EXEC_TYPE = '{2}' "; //sUpdQuery += " , POPUP_YN = '{3}' "; //sUpdQuery += " , FNSH_HOUR = '{4}' "; //sUpdQuery += " , READ_YN = '{5}' "; //sUpdQuery += " , DOWN_YN = '{14}' "; //sUpdQuery += " , UPD_DT = '{6}' "; //sUpdQuery += " WHERE CMP_CD = '{7}' "; //sUpdQuery += " AND STOR_CD = '{8}' "; //sUpdQuery += " AND POS_NO = '{9}' "; //sUpdQuery += " AND START_DT = '{10}' "; //sUpdQuery += " AND MSG_CODE = '{11}' "; //sUpdQuery += " AND MSG_DIV = '{12}' "; //sUpdQuery += " AND MSG_TYPE = '{13}' "; //sInsQuery = "INSERT INTO POSMST..MST_EMG_NOTE "; //sInsQuery += " ( CMP_CD, STOR_CD, POS_NO, START_DT, MSG_CODE "; //sInsQuery += " , MSG_DIV, MSG_TYPE, MSG_TITLE, MSG_CONTENTS, POS_EXEC_TYPE "; //sInsQuery += " , POPUP_YN, FNSH_HOUR, READ_YN, DOWN_YN, UPD_DT, REG_DT ) "; //sInsQuery += "VALUES "; //sInsQuery += " ( '{0}', '{1}', '{2}', '{3}', '{4}' "; //sInsQuery += " , '{5}', '{6}', '{7}', '{8}', '{9}' "; //sInsQuery += " , '{10}', '{11}', '{12}', '{13}', '{14}', '{15}' ) "; sQuery += "UPDATE POSMST..MST_EMG_NOTE "; sQuery += " SET MSG_TITLE = N'{7}' "; sQuery += " , MSG_CONTENTS = N'{8}' "; sQuery += " , POS_EXEC_TYPE = '{9}' "; sQuery += " , POPUP_YN = '{10}' "; sQuery += " , FNSH_HOUR = '{11}' "; sQuery += " , READ_YN = '{12}' "; sQuery += " , DOWN_YN = '{13}' "; sQuery += " , UPD_DT = '{14}' "; sQuery += " , USE_YN = '{15}' "; sQuery += " WHERE CMP_CD = '{0}' "; sQuery += " AND STOR_CD = '{1}' "; sQuery += " AND POS_NO = '{2}' "; sQuery += " AND START_DT = '{3}' "; sQuery += " AND MSG_CODE = '{4}' "; sQuery += " AND MSG_DIV = '{5}' "; sQuery += " AND MSG_TYPE = '{6}' "; sQuery += "IF @@ROWCOUNT = 0 "; sQuery += "INSERT INTO POSMST..MST_EMG_NOTE "; sQuery += " ( CMP_CD, STOR_CD, POS_NO, START_DT, MSG_CODE "; sQuery += " , MSG_DIV, MSG_TYPE, MSG_TITLE, MSG_CONTENTS, POS_EXEC_TYPE "; sQuery += " , POPUP_YN, FNSH_HOUR, READ_YN, DOWN_YN, REG_DT "; sQuery += " , USE_YN ) "; sQuery += "VALUES "; sQuery += " ( '{0}', '{1}', '{2}', '{3}', '{4}' "; sQuery += " , '{5}', '{6}', N'{7}', N'{8}', '{9}' "; sQuery += " , '{10}', '{11}', '{12}', '{13}', '{14}' "; sQuery += " , '{15}' ) "; //sSql = string.Format(sUpdQuery, // htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TITLE], // htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CONT], // htRecvData[Column.IQ_MSG_SND_RSP.DATA.POS_EXEC_TYPE], // htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_POPUP], // htRecvData[Column.IQ_MSG_SND_RSP.DATA.FNSH_DT], // "0", // DateTime.Now.ToString("yyyyMMddHHmmss"), // m_cPosStatus.Base.CmpCd, // htRecvData[Column.IQ_MSG_SND_RSP.DATA.STOR_CD], // m_cPosStatus.Base.PosNo, // htRecvData[Column.IQ_MSG_SND_RSP.DATA.START_DT], // htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CD], // htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV], // htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TYPE], // "0"); //iRet = sqlDb.DBExecuteNonQuery(sSql, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); //if (iRet != UserCom.OK) //{ // sSql = string.Format(sInsQuery, //m_cPosStatus.Base.CmpCd, htRecvData[Column.IQ_MSG_SND_RSP.DATA.STOR_CD], m_cPosStatus.Base.PosNo, htRecvData[Column.IQ_MSG_SND_RSP.DATA.START_DT], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CD], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV], //htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TYPE], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TITLE], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CONT], htRecvData[Column.IQ_MSG_SND_RSP.DATA.POS_EXEC_TYPE], //htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_POPUP], htRecvData[Column.IQ_MSG_SND_RSP.DATA.FNSH_DT], "0", "0", DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString("yyyyMMddHHmmss")); // iRet = sqlDb.DBExecuteNonQuery(sSql, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); //} sSql = string.Format(sQuery, m_cPosStatus.Base.CmpCd, htRecvData[Column.IQ_MSG_SND_RSP.DATA.STOR_CD], m_cPosStatus.Base.PosNo, htRecvData[Column.IQ_MSG_SND_RSP.DATA.START_DT], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CD], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_DIV], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TYPE], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_TITLE], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_CONT], htRecvData[Column.IQ_MSG_SND_RSP.DATA.POS_EXEC_TYPE], htRecvData[Column.IQ_MSG_SND_RSP.DATA.MSG_POPUP], htRecvData[Column.IQ_MSG_SND_RSP.DATA.FNSH_DT], "0", "0", DateTime.Now.ToString("yyyyMMddHHmmss"), htRecvData[Column.IQ_MSG_SND_RSP.DATA.USE_YN]); iRet = sqlDb.DBExecuteNonQuery(sSql, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } private int UpdateMasterTableList(string[] arList) { int iRet = UserCom.NG; string sSql = string.Empty; try { sSql = "UPDATE POSMST..MST_POSMST_TABLE_LST "; sSql += " SET EMG_DIV = '1' "; sSql += " , UPD_DT = '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' "; sSql += " WHERE 1 = 1 "; sSql += " AND MST_TBL_CD IN ("; int i = 0; foreach(string sMasterCd in arList) { if (i == 0) { sSql += " '" + sMasterCd + "'"; } else { sSql += ", '" + sMasterCd + "'"; } i++; } sSql += " )"; iRet = sqlDb.DBExecuteNonQuery(sSql, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } /// /// 전송 내역 조회 /// /// 전문타입 /// private DataTable SelectSendDataList(string sInqType) { string sSQL = string.Empty; string sSerchTableName = ""; string sSearchDate = ""; string sCoumn = ""; DataTable dtData = null; try { //if (sInqType == ItemConst.IRT_INQ_TYPE.HARMFUL_ITEM_MSG_REQ) //유해 상품이면.... //{ // sSQL = " SELECT STOR_CD, '2' AS 'REQ_DIV', '0' AS 'DATA_CNT', VAL_ENTRY_01 AS 'ISPCTN_ORGAN_CD', VAL_ENTRY_02 AS 'DOC_NO' "; // sSQL += " ,VAL_ENTRY_03 AS 'SEQ', VAL_ENTRY_04 AS '', VAL_ENTRY_05 AS 'ITEM_NM', VAL_ENTRY_06 AS 'BAR_CD','' AS RES_CD "; // sSQL += " ,CMP_CD, POS_NO,MSG_DIV,SEQ AS 'DISP_SEQ' "; // sSQL += " FROM POSLOG.dbo.ETC_NOTICE_MNG"; // sSQL += " WHERE CMP_CD = '{0}'"; // sSQL += " AND STOR_CD = '{1}'"; // sSQL += " AND POS_NO = '{2}'"; // sSQL += " AND MSG_DIV IN ('02') "; // sSQL += " AND SUBSTRING(REG_DATE,1,8) BETWEEN CONVERT(VARCHAR,GETDATE() - 31,112) AND CONVERT(VARCHAR,GETDATE(),112) "; // sSQL += " AND SEND_FLAG IN ('1', '9') "; // sSQL += " ORDER BY SEND_FLAG "; // if (sSQL != "") // { // sSQL = string.Format(sSQL, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.PosNo); // sqlDb.DBDataTableSelect(sSQL, CommandType.Text, (System.Data.SqlClient.SqlParameter[])null, out dtData); // } //} //else //{ sSQL = " SELECT TOP 1 '{0}' AS INQ_TYPE, {1} "; sSQL += " FROM {2} "; sSQL += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sSQL += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; if (sInqType == ItemConst.IRT_INQ_TYPE.HARMFUL_ITEM_MSG_REQ) //유해상품이면 { sSQL += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' "; sSQL += " AND MSG_DIV IN ('02') "; sSQL += " AND SUBSTRING(REG_DATE,1,8) BETWEEN CONVERT(VARCHAR,GETDATE() - 31,112) AND CONVERT(VARCHAR,GETDATE(),112) "; sSQL += " AND SEND_FLAG IN ('1', '9') "; sSQL += " ORDER BY SEND_FLAG "; } else { sSQL += " AND {3} BETWEEN CONVERT(VARCHAR,GETDATE()-2,112) AND CONVERT(VARCHAR,GETDATE(),112) "; //-2일 전부터 sSQL += " AND SEND_YN <> '1' "; sSQL += " ORDER BY SEND_YN "; } if (sInqType == ItemConst.IRT_INQ_TYPE.STOR_VISIT) //방문,제조기사 타임바코드 { sCoumn = " STOR_CD,VISIT_DT,POS_NO,MNG_CARD_NO,VISIT_START_HOUR,VISIT_FNSH_HOUR,VISIT_USER_ID,JOB_TYPE,PCSMM_SEND_YN,MSR_DIV,ORG_BAR_CD_NO,'' AS SEND_YN "; sSerchTableName = "POSLOG.dbo.TR_STORE_VISIT "; sSearchDate = "VISIT_DT"; } else if (sInqType == ItemConst.IRT_INQ_TYPE.EMP_COMMUTE) //근태 { sCoumn = " STOR_CD,EMP_NO,WORK_DT,ROS_CD,SEQ,HOUR_STAMP,ROS_HOUR,'' AS RES_CD "; sSerchTableName = "POSLOG.dbo.TR_STOR_EMP "; sSearchDate = "WORK_DT"; } else if (sInqType == ItemConst.IRT_INQ_TYPE.ONWER_MODE) //점주,알바 모드 { sCoumn = " STOR_CD,WORK_DT,WORK_HOUR,EMP_DIV,POS_NO,'' AS RES_CD "; sSerchTableName = "POSLOG.dbo.TR_STOR_EMP_WORK "; sSearchDate = "WORK_DT"; } else if (sInqType == ItemConst.IRT_INQ_TYPE.HARMFUL_ITEM_MSG_REQ) //유해 상품이면.... { sCoumn = " STOR_CD, '2' AS REQ_DIV, '0' AS DATA_CNT, VAL_ENTRY_01 AS ISPCTN_ORGAN_CD, VAL_ENTRY_02 AS DOC_NO "; sCoumn += ",VAL_ENTRY_03 AS SEQ, VAL_ENTRY_04 AS ITEM_NM, VAL_ENTRY_05 AS BAR_CD,'' AS RES_CD "; //sCoumn += " ,POS_NO,MSG_DIV,SEQ AS 'DISP_SEQ' "; sSerchTableName = "POSLOG.dbo.ETC_NOTICE_MNG "; sSearchDate = ""; } else { sSQL = ""; } //쿼리 실행! if (sSQL != "") { sSQL = string.Format(sSQL, sInqType, sCoumn, sSerchTableName, sSearchDate); sqlDb.DBDataTableSelect(sSQL, CommandType.Text, (System.Data.SqlClient.SqlParameter[])null, out dtData); } } //} catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return dtData; } /// /// 전송 플래그 업데이트 /// /// 전송구분 /// 파라미터 /// private int UpdateTableSend(string sInqType, string sFlag, Hashtable htSendData) { int iRet = UserCom.NG; string sSQL = string.Empty; try { if (sInqType == ItemConst.IRT_INQ_TYPE.STOR_VISIT) //방문,제조기사 타임바코드 { sSQL = " UPDATE POSLOG.dbo.TR_STORE_VISIT SET SEND_YN = '" + sFlag + "'"; sSQL += " WHERE 1 = 1 "; sSQL += " AND CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sSQL += " AND STOR_CD = '" + htSendData["STOR_CD"] + "'"; sSQL += " AND VISIT_DT = '" + htSendData["VISIT_DT"] + "'"; sSQL += " AND POS_NO = '" + htSendData["POS_NO"] + "'"; sSQL += " AND MNG_CARD_NO = '" + htSendData["MNG_CARD_NO"] + "'"; sSQL += " AND VISIT_START_HOUR = '" + htSendData["VISIT_START_HOUR"] + "'"; } else if (sInqType == ItemConst.IRT_INQ_TYPE.EMP_COMMUTE) //근태 { sSQL = " UPDATE POSLOG.dbo.TR_STOR_EMP SET SEND_YN = '" + sFlag + "'"; sSQL += " WHERE 1 = 1 "; sSQL += " AND CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sSQL += " AND STOR_CD = '" + htSendData["STOR_CD"] + "'"; sSQL += " AND EMP_NO = '" + htSendData["EMP_NO"] + "'"; sSQL += " AND WORK_DT = '" + htSendData["WORK_DT"] + "'"; sSQL += " AND ROS_CD = '" + htSendData["ROS_CD"] + "'"; sSQL += " AND SEQ = '" + htSendData["SEQ"] + "'"; sSQL += " AND HOUR_STAMP = '" + htSendData["HOUR_STAMP"] + "'"; } else if (sInqType == ItemConst.IRT_INQ_TYPE.ONWER_MODE) //점주,알바 모드 { sSQL = " UPDATE POSLOG.dbo.TR_STOR_EMP_WORK SET SEND_YN = '" + sFlag + "'"; sSQL += " WHERE 1 = 1 "; sSQL += " AND CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sSQL += " AND STOR_CD = '" + htSendData["STOR_CD"] + "'"; sSQL += " AND WORK_DT = '" + htSendData["WORK_DT"] + "'"; sSQL += " AND WORK_HOUR = '" + htSendData["WORK_HOUR"] + "'"; sSQL += " AND EMP_DIV = '" + htSendData["EMP_DIV"] + "'"; sSQL += " AND POS_NO = '" + htSendData["POS_NO"] + "'"; } else if (sInqType == ItemConst.IRT_INQ_TYPE.HARMFUL_ITEM_MSG_REQ) //유해상품 { sSQL = " UPDATE POSLOG.dbo.ETC_NOTICE_MNG SET SEND_FLAG = '" + sFlag + "'"; sSQL += " WHERE 1 = 1 "; sSQL += " AND CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sSQL += " AND STOR_CD = '" + htSendData["STOR_CD"] + "'"; sSQL += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "'"; sSQL += " AND MSG_DIV = '02'"; sSQL += " AND VAL_ENTRY_01 = '" + htSendData["ISPCTN_ORGAN_CD"] + "'"; sSQL += " AND VAL_ENTRY_02 = '" + htSendData["DOC_NO"] + "'"; sSQL += " AND VAL_ENTRY_03 = '" + htSendData["SEQ"] + "'"; } else { sSQL = ""; } iRet = sqlDb.DBExecuteNonQuery(sSQL, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } #endregion #region 통신서버 전송 모듈 /// /// IRT Json Send/Recv /// /// /// /// Time to keep the connection(ms) /// /// /// private int IRTSendReceive(string sSvrIp, int iPort, int iTimeout, Hashtable htSendData, ref Hashtable htRecvData) { int nStat = BaseCom.NG; try { // 전송 데이터를 JSON 객체로 변환 string sJsonSendData = JsonConvert.SerializeObject(htSendData); // JSON string 길이를 구하기 위해 byte 변환 Byte[] arTempData = Encoding.UTF8.GetBytes(sJsonSendData); // 통신헤더 전문 생성 string sCommHeader = ItemColumn.MakeCommHeader(arTempData.Length, ItemConst.COMM_MSG_TYPE.POSIRT); string sJsonRecvData = string.Empty; UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명)) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) CmUtil.RPadH("[SEND" + ":" + sSvrIp + ":" + iPort, 27) + "] " + sCommHeader + sJsonSendData); nStat = SendReceiveData(sSvrIp, iPort, iTimeout, sCommHeader + sJsonSendData, ref sJsonRecvData); if (sJsonRecvData != null && sJsonRecvData != "") { string sRecvCommHeader = sJsonRecvData.Substring(0, TcpSocket.COMM_HEAD_LEN); string sRecvData = sJsonRecvData.Substring(TcpSocket.COMM_HEAD_LEN); htRecvData = JsonConvert.DeserializeObject(sRecvData); UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명)) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) CmUtil.RPadH("[RECV" + ":" + sSvrIp + ":" + iPort, 27) + "] " + sJsonRecvData); } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return nStat; } /// /// IRT Send/Receive /// /// /// /// Time to keep the connection(ms) /// /// /// private int SendReceiveData(string sSvrIp, int iPort, int iTimeout, string sSendData, ref string sRecvData) { int nStat = BaseCom.NG; int nRecvLen = 0; try { m_sendSocket = new TcpSocket(sSvrIp, iPort); // Data Send & Receive nRecvLen = m_sendSocket.SendReceiveData(sSendData, ref sRecvData, iTimeout); if(nRecvLen > 0) { nStat = BaseCom.OK; } else { sRecvData = string.Empty; nStat = BaseCom.NG; } } catch(Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } finally { if (m_sendSocket != null) m_sendSocket.Close(); } return nStat; } #endregion #region Http 전송 모듈 /// /// 해피오더 GET방식 Request /// /// URL /// 메시지 타입 /// 요청Data /// 응답Data(Json) /// ///grayber@20180306 해피오더 주문가능 상태 추가 start - 함수 인자 추가 NetworkCheckOver.HttpJsonGET_SendReceive 함수 HashTable 인자추가 /// 기존 /// public int HttpJsonGET_SendReceive(string sUrl, string sWorkType, string sReqData, ref string sRespJsonData) /// 변경 public int HttpJsonGET_SendReceive(string sUrl, string sWorkType, string sReqData, ref string sRespJsonData, ref Hashtable htRspData) //grayber@20180306 해피오더 주문가능 상태 추가 end { int iRet = BaseCom.NG; string sRespString = string.Empty; try { if (sUrl.Trim() == "") return iRet; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType + "?" + sReqData); req.Method = "GET"; using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse()) { Stream stream = resp.GetResponseStream(); StreamReader streamReader = new StreamReader(stream, Encoding.GetEncoding("UTF-8")); sRespString = streamReader.ReadToEnd(); } //#20180228 해피오더 주문 건수 조회 기능 에러시 다른 기능 동작 되도록 수정 start //건수 조회 응답값 로그 추가 UserLog.WriteLogFile(UserCom.LOG_DEBUG, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) sRespString); //#20180228 해피오더 주문 건수 조회 기능 에러시 다른 기능 동작 되도록 수정 end Hashtable temp = JsonConvert.DeserializeObject(sRespString); foreach (string key in temp.Keys) { string jsonString = temp[key].ToString(); if (key.Equals("status")) { Hashtable htHeader = JsonConvert.DeserializeObject(jsonString); if (htHeader["status"].ToString().Equals("200")) { iRet = BaseCom.OK; } } //grayber@20180306 해피오더 주문가능 상태 추가 start - deliverySupport 처리 추가 // 20180306 수신 데이터 sample // http://api.celectory.com/api/ // 리얼 // {"status":{"status":200,"code":"20000","message":"조회 완료","devMessage":"success","moreInfo":null,"orderNum":null},"orderStatusCount":[{"status":"0","count":1,"type":"5"},{"status":"8","count":110,"type":"1"},{"status":"8","count":453,"type":"2"},{"status":"8","count":223,"type":"3"},{"status":"8","count":122,"type":"6"},{"status":"2000","count":2,"type":"5"},{"status":"2008","count":31,"type":"2"},{"status":"2008","count":10,"type":"3"},{"status":"2008","count":46,"type":"6"},{"status":"9007","count":8,"type":"5"},{"status":"9009","count":126,"type":"5"},{"status":"300000","count":42,"type":"1"},{"status":"300000","count":177,"type":"2"},{"status":"300000","count":501,"type":"3"},{"status":"300000","count":279,"type":"5"},{"status":"300000","count":110,"type":"6"}]} // http://121.254.240.198:8092/api/ // 개발 // {"status":{"status":200,"code":"20000","message":"조회 완료","devMessage":"success","moreInfo":null,"orderNum":null},"orderStatusCount":[{"status":"8","count":1,"type":"3"},{"status":"2008","count":1,"type":"3"},{"status":"9007","count":3,"type":"5"},{"status":"9009","count":12,"type":"5"},{"status":"300000","count":25,"type":"3"},{"status":"300000","count":8,"type":"5"}],"deliverySupport":"Y"} // 기존 //else //{ // sRespJsonData = jsonString; //} // 변경 else if (key.Equals("deliverySupport")) { if (CmUtil.IsNull(htRspData)) { htRspData = new Hashtable(); } htRspData.Add(key.ToString(), temp[key].ToString()); } else if (key.Equals("orderStatusCount")) { sRespJsonData = jsonString; } //grayber@20180306 해피오더 주문가능 상태 추가 end } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } return iRet; } /// /// GET방식 Request /// /// 서버URL /// 작업구분 /// 요청Data /// JSON String 형태의 응답 데이터 /// public int HttpGET_SendReceive(string sUrl, string sWorkType, string sReqData, string sEncodingFlag, ref string sRespData) { int iRet = BaseCom.NG; string sRespString = string.Empty; StreamReader streamReader = null; try { HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType + "?" + sReqData); req.Method = "GET"; using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse()) { Stream stream = resp.GetResponseStream(); if (sEncodingFlag == PosConst.ENCODING_FLAG.UTF) { streamReader = new StreamReader(stream, Encoding.GetEncoding("UTF-8")); } else { streamReader = new StreamReader(stream, Encoding.GetEncoding("ks_c_5601-1987")); } sRespString = streamReader.ReadToEnd(); } iRet = BaseCom.OK; sRespData = sRespString; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } return iRet; } #endregion #region BR 팝업메세지 처리 private void BrPopUpBiz() { string sSQL = ""; DataTable dtData = null; try { sSQL = " SELECT * "; sSQL += " FROM POSLOG.dbo.ETC_BR_POPUP"; sSQL += " WHERE CMP_CD = '{0}'"; sSQL += " AND BRAND_CD = '{1}'"; sSQL += " AND SALE_DT = '{2}'"; sSQL += " AND STOR_CD = '{3}'"; sSQL += " AND POS_NO = '{4}'"; sSQL += " AND READ_FLAG = '0'"; sSQL += " AND '{5}' BETWEEN START_TM AND END_TM "; sSQL = string.Format(sSQL , m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.BrandCd , DateTime.Now.ToString("yyyyMMdd") , m_cPosStatus.Base.StoreNo , m_cPosStatus.Base.PosNo , DateTime.Now.ToString("HHmmss")); sqlDb.DBDataTableSelect(sSQL, CommandType.Text, (System.Data.SqlClient.SqlParameter[])null, out dtData); if (dtData == null || dtData.Rows.Count == 0) { //처리없음! } else { foreach (DataRow dr in dtData.Rows) { if (dr["CMM_GRP_CD"].ToString() == PosConst.COMMON_CODE_GROUP.Z0015 || dr["CMM_GRP_CD"].ToString() == PosConst.COMMON_CODE_GROUP.Z0018) { ExecuteHostIrt(dr); } else if (dr["CMM_GRP_CD"].ToString() == PosConst.COMMON_CODE_GROUP.Z0016 || dr["CMM_GRP_CD"].ToString() == PosConst.COMMON_CODE_GROUP.Z0019) { if (dr["CMM_GRP_CD"].ToString() == PosConst.COMMON_CODE_GROUP.Z0016 ) { string[] aStr = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0570).ToString().Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); dr["SHOW_MSG1"] = aStr[0]; dr["SHOW_MSG2"] = aStr[1]; dr["SHOW_MSG3"] = aStr[2]; } else { dr["SHOW_MSG1"] = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0571); } dr["READ_FLAG"] = "1"; BrPopupUpdate(dr); } } } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } } /// /// 디비 업데이트 /// /// /// private bool BrPopupUpdate(DataRow dr) { bool bRet = false; string sSQL = ""; try { sSQL = " UPDATE POSLOG.dbo.ETC_BR_POPUP "; sSQL += " SET READ_FLAG = '" + dr["READ_FLAG"] + "'"; sSQL += " ,SHOW_MSG1 = N'" + dr["SHOW_MSG1"] + "'"; sSQL += " ,SHOW_MSG2 = N'" + dr["SHOW_MSG2"] + "'"; sSQL += " ,SHOW_MSG3 = N'" + dr["SHOW_MSG3"] + "'"; sSQL += " WHERE CMP_CD = '" + dr["CMP_CD"] + "'"; sSQL += " AND BRAND_CD = '" + dr["BRAND_CD"] + "'"; sSQL += " AND SALE_DT = '" + dr["SALE_DT"] + "'"; sSQL += " AND STOR_CD = '" + dr["STOR_CD"] + "'"; sSQL += " AND POS_NO = '" + dr["POS_NO"] + "'"; sSQL += " AND CMM_GRP_CD = '" + dr["CMM_GRP_CD"] + "'"; sSQL += " AND CMM_CD = '" + dr["CMM_CD"] + "'"; int iRet = sqlDb.DBExecuteNonQuery(sSQL, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); if (iRet == 1) bRet = true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return bRet; } /// /// 전문 송수신 /// /// /// /// /// /// /// /// private string ExecuteHostIrt(DataRow dr) { string sRet = UserCom.RST_ERR; Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); try { // 조회 htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.SERVER_INTERFACE_SCH); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.POS_NO, m_cPosStatus.Base.PosNo); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.STOR_TY, m_cPosStatus.Mst.DrtFrcsDiv); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.PRT_DIV, dr["CMM_GRP_CD"].ToString() == PosConst.COMMON_CODE_GROUP.Z0015 ? "100" : "101"); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.START_DT, dr["SALE_DT"].ToString()); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.END_DT, dr["SALE_DT"].ToString()); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.ORD_SEQ, ""); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.ORD_GRP, ""); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.DATA_CNT, "0"); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.RES_DATA, ""); // 전문 요청 int iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.BizInqPort), (int)5000, htSendData, ref htRecvData); if (iRet != BaseCom.OK || htRecvData.Count == 0) { sRet = UserCom.RST_ERR; return ""; } if (CmUtil.DoubleParse(htRecvData[Column.IQ_DATA_SEARCH_REQ.DATA.DATA_CNT].ToString()) <= 0) { //sRet = UserCom.RST_ERR; //return ""; string sLogtemp = string.Format("BizCmmcd : {0}, RecvCount : {1} >> Skip", dr["CMM_GRP_CD"], htRecvData[Column.IQ_DATA_SEARCH_REQ.DATA.DATA_CNT]); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) sLogtemp); } sRet = htRecvData[Column.IQ_DATA_SEARCH_REQ.DATA.RES_DATA].ToString(); if (dr["CMM_GRP_CD"].ToString() == PosConst.COMMON_CODE_GROUP.Z0015) { if (sRet.StartsWith("N") == true) // CmUtil.MidH(sRet, 0, 1) == "N") { dr["SHOW_MSG1"] = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0572); dr["READ_FLAG"] = "1"; } else { dr["READ_FLAG"] = "2"; } } else { if (sRet.StartsWith("Y") == true) { dr["SHOW_MSG1"] = sRet.Substring(2); dr["READ_FLAG"] = "1"; } else { dr["READ_FLAG"] = "2"; } } BrPopupUpdate(dr); sRet = UserCom.RST_OK; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return sRet; } #endregion #region 로그파일 업로드 처리 private int UploadLogFileProc(Hashtable htRecvData, ref string sFileNm) { int iRet = BaseCom.NG; string sUploadedFileNm = ""; ZipFile zip = null; try { // 01 - 요청 받은 로그 파일 압축 string[] sFiles = Directory.GetFiles(BaseCom.NxLogPath, "*" + htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.LOG_DT].ToString().Substring(2) + ".log*"); if(sFiles.Length > 0) { sUploadedFileNm = htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.LOG_DT].ToString() + "_" + m_cPosStatus.Base.StoreNo + "_" + m_cPosStatus.Base.PosNo + ".zip"; zip = ZipFile.Create(BaseCom.NxLogPath + sUploadedFileNm); zip.BeginUpdate(); foreach(string sFile in sFiles) { zip.Add(sFile, Path.GetFileName(sFile)); } zip.CommitUpdate(); zip.Close(); zip = null; } else { // 요청받은 일자의 로그가 없음 return BaseCom.NG1; } // 02 - 압축 파일 Upload string sIp = htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.FTP_IP].ToString(); string sPort = htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.FTP_PORT].ToString(); string sUserId = htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.FTP_ID].ToString(); string sUserPwd = htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.FTP_PWD].ToString(); FTP cFtp = new FTP(sIp, sUserId, sUserPwd); bool bRtn = cFtp.Upload(BaseCom.NxLogPath + sUploadedFileNm, htRecvData[Column.IQ_POS_LOGFILE_REQ.DATA.FTP_PATH].ToString() + @"/" + sUploadedFileNm ); if (bRtn == true) iRet = BaseCom.OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } finally { if (zip != null) zip.Close(); if(File.Exists(BaseCom.NxLogPath + sUploadedFileNm) == true) { File.Delete(BaseCom.NxLogPath + sUploadedFileNm); } } return iRet; } #endregion 로그파일 업로드 처리 //17.08.22 dkshin SS 해피오더 #region SS 해피오더 자동 처리 /// /// 최종 거래번호 설정 /// /// public string LoadLastPosTradeNo(string SSPosno) { string sQuery = ""; string sRet = UserCom.RST_ERR; DataTable dtTradeInfo = null; try { // 최종거래번호 로딩 sQuery = " SELECT ISNULL(MAX(TRADE_NO),0) TRADE_NO FROM POSLOG..TR_SALE_HEADER "; sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND SALE_DT = '" + m_cPosStatus.Base.SaleDate + "' "; sQuery += " AND POS_NO = '" + SSPosno + "' "; //sQuery += " AND TRADE_KINDPER NOT IN('90','91','92','93') "; //DataTable dtTradeInfo = m_cMstService.Select(new string[] { sQuery }); sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (System.Data.SqlClient.SqlParameter[])null, out dtTradeInfo); if (dtTradeInfo != null && dtTradeInfo.Rows.Count > 0) { DataRow dr = dtTradeInfo.Rows[0]; int nTradeNo = (int)CmUtil.LongParse(CmUtil.GetDataRowStr(dr, "TRADE_NO")); //if (CmUtil.LongParse(m_cPosStatus.Base.TradeNo) <= nTradeNo) { m_cPosStatus.Base.TradeNo = string.Format("{0:D5}", nTradeNo + 1); } } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return sRet; } private void SSHappyOrderList() { Hashtable htRequest = new Hashtable(); Hashtable htResponse = new Hashtable(); int iReturn = BaseCom.NG; htRequest.Add("storeCode", m_cPosStatus.Base.StoreNo); htRequest.Add("status", ItemConst.HAPPYORDER_STATUS.ORDER_REG); htRequest.Add("deviceType", "POS"); //해피오더 주문내역 조회 - 픽업시간 m_htOrderLists = null; m_htOrderLists = m_cHappyOrder.SendReceiveForHappyOrder(new object[] { m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_ORDER_LIST, htRequest }, ref htResponse, ref iReturn); if (iReturn != BaseCom.OK) { return; } } private void SSHappyOrderStatusChange(Column.TR_HPORD.HPORD_HEADER cHeader, string statusValue) { Hashtable htRequest = new Hashtable(); Hashtable htResponse = new Hashtable(); int iReturn = BaseCom.NG; ArrayList m_cHappyOrderItem = new ArrayList(); htRequest.Add("deviceType", "POS"); htRequest.Add("orderNum", cHeader.OrderNum); //#12504 해피오더 외부채널 직접 주문 관련 수정 start, phj //htRequest.Add("channel", cHeader.Channel); //#12504 해피오더 외부채널 직접 주문 관련 수정 end, phj htRequest.Add("cancelReasonType", ""); htRequest.Add("status", statusValue); // 주문상태변경 m_cHappyOrder.SendReceiveForHappyOrder(new object[] { m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.UPDATE_STATUS, htRequest }, ref htResponse, ref iReturn); if (htResponse == null || htResponse.ContainsKey("status") == false) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "OrderNum = " + cHeader.OrderNum + ", 상태변경 처리 실패"); //return false; } if (htResponse["status"].ToString().Equals("200") == false) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "OrderNum = " + cHeader.OrderNum + ", 상태변경 처리 실패(" + htResponse["message"].ToString() + ")"); //return false; } else { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "OrderNum = " + cHeader.OrderNum + ", 상태변경 처리 완료"); // 정상 처리 //bReturn = true; //#20171019 SS해피오더 배달 start //기존 //if (statusValue == ItemConst.HAPPYORDER_STATUS.PICKUP_WAIT) //변경 if ((statusValue == ItemConst.HAPPYORDER_STATUS.PICKUP_WAIT) || (statusValue == ItemConst.HAPPYORDER_STATUS.DELIVERY_REQ)) //#20171019 SS해피오더 배달 end { //영양정보 저장? Hashtable[] aResponse = null; Hashtable htRequestForNutrition = new Hashtable(); htResponse = null; htRequestForNutrition.Add("orderNum", cHeader.OrderNum); aResponse = m_cHappyOrder.SendReceiveForHappyOrder(new object[] { m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_PRODUCT_NUTRITION, htRequestForNutrition }, ref htResponse, ref iReturn); if (aResponse != null && aResponse.Length > 0) { string sMsg = m_cHappyOrder.ParseNutritionMsg(aResponse); if (sMsg != "") { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) "OrderNum = " + cHeader.OrderNum + ", 영양정보 = " + sMsg); // 영양정보 저장 //#20180129 SS해피오더 자동처리 DB작업 수정 start //기존 //m_cHappyOrder.UpdateHappyOrderData(new string[] { "Message", sMsg, cHeader.OrderNum, cHeader.OrderDate }); //변경 UpdateHappyOrderData(new string[] { "Message", sMsg, cHeader.OrderNum, cHeader.OrderDate }); //#20180129 SS해피오더 자동처리 DB작업 수정 end } } //grayber@20180202 [BR]해피오더 고객정보 추가 + 원산지 표기 start - 영양정보 호출 함수 처리 //m_cHappyOrder.GetHappyOrderNurtitionListDetail(sOrderNum, m_sHappyOrderURL, sOrderDt); //grayber@20180202 [BR]해피오더 고객정보 추가 + 원산지 표기 end //매출처리 //해피오더 리스트 상세 조회 m_cHappyOrder.GetHappyOrderListDetail(cHeader.OrderNum, m_sHappyOrderURL, ref m_cHappyOrderItem, ref m_htOrderLists); int itemCnt = m_cHappyOrderItem.Count; ArrayList itemList = new ArrayList(); for (int i = 0; i < itemCnt; i++) { Column.TR_HPORD.HPORD_ITEM item = (Column.TR_HPORD.HPORD_ITEM)m_cHappyOrderItem[i]; item.PickupTime = cHeader.PickupTime; itemList.Add(item); } m_cHappyOrderItem.Clear(); m_cHappyOrderItem = new ArrayList(itemList); //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 start //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 start - 20180723 기존 배달 건만이였지만 픽업건도 동일하게 적용하도록 수정 //if (statusValue == ItemConst.HAPPYORDER_STATUS.DELIVERY_REQ) //{ //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 end - 20180723 기존 배달 건만이였지만 픽업건도 동일하게 적용하도록 수정 bool bLandomBoxCheck = false; DataTable dtData = null; for (int nLoop = 0; nLoop < m_cHappyOrderItem.Count; nLoop++) { Column.TR_HPORD.HPORD_ITEM item = (Column.TR_HPORD.HPORD_ITEM)m_cHappyOrderItem[nLoop]; dtData = m_cDataCommon.SeletCommonCode(PosConst.COMMON_CODE_GROUP.T0039, ""); if (dtData != null && dtData.Rows.Count > 0) { foreach (DataRow dr in dtData.Rows) { if (item.GoodsCode == CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01)) { bLandomBoxCheck = true; break; } } } if (bLandomBoxCheck == true) { return; } } //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 start - 20180723 기존 배달 건만이였지만 픽업건도 동일하게 적용하도록 수정 //} //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 end - 20180723 기존 배달 건만이였지만 픽업건도 동일하게 적용하도록 수정 //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 end //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 start //기존 //string sRet = m_cHappyOrder.MakeTranItem((Column.TR_HPORD.HPORD_HEADER)cHeader, m_cHappyOrderItem); //변경 string sRet = m_cHappyOrder.MakeTranItem((Column.TR_HPORD.HPORD_HEADER)cHeader, m_cHappyOrderItem, null); //#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 end if (sRet == UserCom.RST_OK) { m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.FORIGN.O2O; //#20171227 인천공항 포스연동 start, phj - 20180310 해피오더 결제완료 start,phj //m_cPosStatus.Sale.SaleFlow = PosConst.SALE_FLOW.SALE_DOING; //#20171227 인천공항 포스연동 end, phj - 20180310 해피오더 결제완료 end,phj m_cTrnStatus.Head.OrderNo = cHeader.DailyCode;//판매POS의 매출처리시 대기번호도 해당 대기번호로 저장해야 함. String sPosno = m_cPosStatus.Base.PosNo; String sTradeNo = m_cPosStatus.Base.TradeNo; m_cPosStatus.Base.PosNo = PosMstManager.GetPosOption(POS_OPTION.OPT048); LoadLastPosTradeNo(PosMstManager.GetPosOption(POS_OPTION.OPT048));//별도 포스번호별 거래번호 처리 m_cTrnStatus.Sale.SSHappyOrderSalePrint = true;//매출 처리 시 영수증 출력 하지 않음 설정. m_cTrnStatus.Head.HPOrderPickupTime = cHeader.PickupTime;//20170918 dkshin 해피오더 중복 거래 완료처리 수정 IPaymentUs cPaymentUs = (IPaymentUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.HAPPYORDER); //#11054_[공통] 해피오더 외부채널 표시 방식 변경 적용 요청 sRet = cPaymentUs.SetPayment(new string[] { ItemConst.TR_ITEM_ID.ORDER.HAPPYORDER_PAY, ItemConst.TR_ITEM_ID.ORDER_TYPE.PICKUP, cHeader.PayMoney, cHeader.OrderNum, cHeader.OrderDate }); if (sRet != UserCom.RST_OK) return; // 거래 완료 처리 ISaleCompleteUs cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE); sRet = cSaleComplete.PosSaleExecute(new string[] { }); if (sRet != UserCom.RST_OK) return; // 해피오더 데이터 삭제 //#20180129 SS해피오더 자동처리 DB작업 수정 start //기존 //m_cHappyOrder.DeleteSSHappyOrderData(cHeader.DailyCode, cHeader.OrderDate.Substring(0, 10).Replace("-", "")); //변경 DeleteSSHappyOrderData(cHeader.DailyCode, cHeader.OrderDate.Substring(0, 10).Replace("-", "")); //#20180129 SS해피오더 자동처리 DB작업 수정 end // KDS전송 //20170918 dkshin 해피오더 중복 거래 완료처리 수정 // 거래완료처리에서 주방주문 데이타 작성 //m_cHappyOrder.KPSItemProc(ItemConst.TRAN_DIV.NORMAL, m_cHappyOrderItem); // 판매상태 변경 //#20171227 인천공항 포스연동 start, phj - 20180310 해피오더 결제완료 start,phj //m_cPosStatus.Sale.SaleFlow = PosConst.SALE_FLOW.SALE_WAIT; //#20171227 인천공항 포스연동 end, phj - 20180310 해피오더 결제완료 end,phj m_cPosStatus.Base.PosNo = sPosno; m_cPosStatus.Base.TradeNo = sTradeNo; } else { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0638)); } } } } private void SSHappyOrderAutoProcess() { Hashtable htRequest = new Hashtable(); Hashtable htResponse = new Hashtable(); ArrayList m_alPickupLists = new ArrayList(); DateTime pickupTenMinAgo; DateTime pickupSevenMinAgo; DateTime pickuptime; DateTime nowTime = DateTime.Now; //DateTime tenMinAgoTime = DateTime.Now.AddMinutes(-10); //DateTime sevenMinAgoTime = DateTime.Now.AddMinutes(-7); string s_Pickuptime; int yyyy, mm, dd, hh, mi; SSHappyOrderList();//해피오더 주문내역 조회 - 픽업시간 //#20171215, 해피오더 주문리스트 조회 시 해피오더 테이블 데이터 삭제 후 저장하도록 수정 Start // 해피오더 헤더정보 DB 삭제 //#20180129 SS해피오더 자동처리 DB작업 수정 start //기존 //m_cHappyOrder.DeleteHappyOrderAllData(); //변경 DeleteHappyOrderAllData(); //#20180129 SS해피오더 자동처리 DB작업 수정 end //#20171215, 해피오더 주문리스트 조회 시 해피오더 테이블 데이터 삭제 후 저장하도록 수정 End if (m_htOrderLists != null && m_htOrderLists.Length > 0) { foreach (Hashtable htData in m_htOrderLists) { Column.TR_HPORD.HPORD_HEADER header; header = m_cHappyOrder.ParseHappyOrderList(htData); //#20171215, 해피오더 주문리스트 조회 시 해피오더 테이블 데이터 삭제 후 저장하도록 수정 Start // 해피오더 헤더정보 DB 처리 //#20180129 SS해피오더 자동처리 DB작업 수정 start //기존 //m_cHappyOrder.SaveHappyOrderData(header); //변경 SaveHappyOrderData(header); //#20180129 SS해피오더 자동처리 DB작업 수정 end //#20171215, 해피오더 주문리스트 조회 시 해피오더 테이블 데이터 삭제 후 저장하도록 수정 End m_alPickupLists.Add(header); } } Column.TR_HPORD.HPORD_HEADER cHeader; for (int i = 0; i < m_alPickupLists.Count; i++) { s_Pickuptime = ((Column.TR_HPORD.HPORD_HEADER)m_alPickupLists[i]).PickupTime; yyyy = Convert.ToInt32(s_Pickuptime.Substring(0, 4)); mm = Convert.ToInt32(s_Pickuptime.Substring(5, 2)); dd = Convert.ToInt32(s_Pickuptime.Substring(8, 2)); hh = Convert.ToInt32(s_Pickuptime.Substring(14, 2)); mi = Convert.ToInt32(s_Pickuptime.Substring(17, 2)); pickuptime = new DateTime(yyyy, mm, dd, hh, mi, 00); pickupTenMinAgo = pickuptime.AddMinutes(-10); pickupSevenMinAgo = pickuptime.AddMinutes(-7); //픽업시간 10분전 '상품준비'로 상태 변경 if (DateTime.Compare(pickupTenMinAgo, nowTime) < 0) { cHeader = null; cHeader = (Column.TR_HPORD.HPORD_HEADER)m_alPickupLists[i]; if (cHeader.OrderStatus == ItemConst.HAPPYORDER_STATUS.ORDER_REG) SSHappyOrderStatusChange(cHeader, ItemConst.HAPPYORDER_STATUS.PRODUCT_READY); } //픽업시간 7분전 '픽업대기'로 상태 변경 if (DateTime.Compare(pickupSevenMinAgo, nowTime) < 0) { cHeader = null; cHeader = (Column.TR_HPORD.HPORD_HEADER)m_alPickupLists[i]; //OrderStatus 상태값(주문접수:4, 상품준비:5, 픽업대기:7, 픽업완료:8) //'상품준비' 상태가 아니면 '상품준비'로 상태 변경 (픽업시간 10분전을 지나고 판매포스를 킨경우 상태값이 주문접수이므로 상품준비로 변경) if (cHeader.OrderStatus == ItemConst.HAPPYORDER_STATUS.ORDER_REG) { SSHappyOrderStatusChange(cHeader, ItemConst.HAPPYORDER_STATUS.PRODUCT_READY); } //'상품준비' 상태이면 '픽업대기'로 상태 변경 -> 매출처리 -> KDS 전송 if (cHeader.OrderStatus == ItemConst.HAPPYORDER_STATUS.PRODUCT_READY) { //#20171019 SS해피오더 배달 start //기존 //SSHappyOrderStatusChange(cHeader, ItemConst.HAPPYORDER_STATUS.PICKUP_WAIT); //변경 if ((cHeader.OrderType == ItemConst.ORDER_TYPE.INNER_DELIVERY) || (cHeader.OrderType == ItemConst.ORDER_TYPE.OUTTER_DELIVERY)) { SSHappyOrderStatusChange(cHeader, ItemConst.HAPPYORDER_STATUS.DELIVERY_REQ); } else { SSHappyOrderStatusChange(cHeader, ItemConst.HAPPYORDER_STATUS.PICKUP_WAIT); } //#20171019 SS해피오더 배달 end } //if (cHeader.OrderStatus == ItemConst.HAPPYORDER_STATUS.PICKUP_WAIT) { // SSHappyOrderStatusChange(cHeader, ItemConst.HAPPYORDER_STATUS.PICKUP_COMPLETED); } } } } //#20180129 SS해피오더 자동처리 DB작업 수정 start /// /// 해피오더 데이터 갱신 /// /// /// public int UpdateHappyOrderData(string[] aParam) { int iRet = UserCom.NG; string sUpdQuery = ""; try { sUpdQuery = " UPDATE POSMST..MST_HPORD "; if (aParam[0] == "PRINT") { sUpdQuery += "SET PRT_YN = '" + aParam[1] + "' "; } else { //sUpdQuery += "SET NUTRITION_MSG = REPLACE('" + aParam[1] + "', CHAR(10), CHAR(13) + CHAR(10))"; sUpdQuery += "SET NUTRITION_MSG = '" + aParam[1] + "' "; } sUpdQuery += " , UPD_DT = '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' "; sUpdQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sUpdQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sUpdQuery += " AND ORD_DT = '" + aParam[3] + "' "; sUpdQuery += " AND ORD_NO = '" + aParam[2] + "' "; iRet = sqlDb.DBExecuteNonQuery(sUpdQuery, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } /// /// 해피오더 데이터 삭제 MST_HPORD /// /// /// public int DeleteSSHappyOrderData(string sOrderNum, string sOrderDt) { int iRet = UserCom.NG; string sQuery = ""; try { sQuery = " DELETE FROM POSMST..MST_HPORD \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND ORD_DT = '" + sOrderDt + "' \n" + " AND ORD_NO = '" + sOrderNum + "' \n"; iRet = sqlDb.DBExecuteNonQuery(sQuery, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } /// /// 해피오더 데이터 전체 삭제 /// /// public int DeleteHappyOrderAllData() { int iRet = UserCom.NG; string sQuery = ""; try { sQuery = "TRUNCATE TABLE POSMST..MST_HPORD \n"; iRet = sqlDb.DBExecuteNonQuery(sQuery, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } /// /// 해피오더 데이터 저장 /// /// /// public int SaveHappyOrderData(Column.TR_HPORD.HPORD_HEADER header) { int iRet = UserCom.NG; string sQuery = ""; string sSQL = ""; try { sQuery = "UPDATE POSMST..MST_HPORD "; sQuery += " SET ORD_STS = '{0}' "; sQuery += " , UPD_DT = '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' "; sQuery += " WHERE CMP_CD = '{1}' "; sQuery += " AND STOR_CD = '{2}' "; sQuery += " AND ORD_NO = '{3}' "; sQuery += "IF @@ROWCOUNT = 0 "; sQuery += "INSERT INTO POSMST..MST_HPORD "; sQuery += " ( CMP_CD, STOR_CD, ORD_DT, ORD_NO, ORD_STS "; sQuery += " , PRT_YN, NUTRITION_MSG, FILLER1, FILLER2, FILLER3 "; sQuery += " , FILLER4, FILLER5, UPD_DT, REG_DT ) "; sQuery += "VALUES "; sQuery += " ( '{4}', '{5}', '{6}', '{7}', '{8}' "; sQuery += " , '{9}', '{10}', '{11}', '{12}', '{13}' "; sQuery += " , '{14}', '{15}' ,'{16}', '{17}' ) "; //17.08.22 dkshin SS 해피오더 - dailyCode값 대기번호가 TBL_NO으로 저장되므로 ORDER_NO에 대기번호 저장 string orderNum = header.OrderNum; if (PosMstManager.GetPosOption(POS_OPTION.OPT048) != "0" || PosMstManager.GetPosOption(POS_OPTION.OPT049) == "1") { orderNum = header.DailyCode; } sSQL = string.Format(sQuery, header.OrderStatus, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, //17.08.22 dkshin SS 해피오더 //header.OrderNum, orderNum, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, header.OrderDate.Substring(0, 10).Replace("-", ""), //17.08.22 dkshin SS 해피오더 //header.OrderNum, orderNum, header.OrderStatus, "0", "", "", "", "", "", "", DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString("yyyyMMddHHmmss")); iRet = sqlDb.DBExecuteNonQuery(sSQL, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return iRet; } //#20180129 SS해피오더 자동처리 DB작업 수정 end #endregion //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start #region 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 /// /// 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 /// private void HappyOrderInventoryAlram() { Hashtable htRecvData = new Hashtable(); Hashtable htSendData = new Hashtable(); //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 start //기존 //string sRet = UserCom.RST_ERR; //변경 int iRet = 0; //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 end string sHPO_Inventory_YN = ""; try { htSendData.Add(Column.IQ_HPO_INVENTORY_ALRAM.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.HPO_INVENTORY_ALARM); htSendData.Add(Column.IQ_HPO_INVENTORY_ALRAM.DATA.RES_YN, ""); htSendData.Add(Column.IQ_HPO_INVENTORY_ALRAM.DATA.RES_CD, ""); //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 start //기존 //sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 5000, htSendData, ref htRecvData, false); //변경 iRet = IRTSendReceive(m_cPosStatus.Base.CommSvrIp, Convert.ToInt32(m_cPosStatus.Base.SysInfoPort), (int)5000, htSendData, ref htRecvData); //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 end //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 start //기존 //if (sRet == UserCom.RST_OK) //변경 if (iRet == BaseCom.OK) { //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 end //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 start if (htRecvData != null) { //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 end if (htRecvData[Column.IQ_HPO_INVENTORY_ALRAM.DATA.RES_CD].ToString() == "00") { sHPO_Inventory_YN = htRecvData[Column.IQ_HPO_INVENTORY_ALRAM.DATA.RES_YN].ToString(); } //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 start } //#17317 PB 안산성포 외- 포스사용중 [고객센터로 연락주세요] 팝업뜨는 증상 end } m_cPosStatus.Sale.HappyOrderInventoryYN = sHPO_Inventory_YN.Trim(); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } #endregion //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end } }