using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using Cosmos.BaseFrame; using Cosmos.UserFrame; using Cosmos.ServiceProvider; using Cosmos.Common; using Cosmos.CommonManager; namespace Cosmos.Service { class TableService : ITableUs { private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출 private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체) private PosStatus m_cPosStatus; // 기본정보 참조 private TranStatus m_cTrnStatus; // 거래정보 참조 private IDataCommonUs m_cDataCommon = null; // 판매공통 모듈 private IMasterUs m_cMstService = null; // 마스터 인터페이스 private IDatabaseSQL m_cSqlDbService = null; // 데이터베이스 관리 private IDataProcessUs m_cDataSrv = null; // 거래데이터 합계금액 계산 및 관리 private ISalePluItemUs m_cPluService = null; // 판매 등록 관리 private IServiceUs m_cOrderSheetSvr = null; // 주방 주문서 /// /// 주방메시지 /// private ArrayList m_aKtchMsgAdd = new ArrayList(); private class KTCH_MSG_ADD { /// /// 메시지구분 /// (PosConst.KPS_ORD_MSG_ID, 0:거래중지, 1:상품메모, 2:좌석메모, 3:테이블합석, 4:테이블이동, 5:상품이동, 9:FireKey) /// public string sMsgID; /// /// 서브매장코드 /// public string sSubShopCd; /// /// 상품코드 /// public string sItemCode; /// /// 상품명 /// public string sItemName; /// /// 주문메시지1 /// public string sMsg1; /// /// 주문메시지2 /// public string sMsg2; /// /// 주문메시지3 /// public string sMsg3; /// /// 순번 /// public string sItemSeqNo; } public TableService() { m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보 m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보 m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON); m_cMstService = (IMasterUs)sManager.InitServiceInstance(ServiceLists.ASV_MASTER.DLL, ServiceLists.ASV_MASTER.POS_MASTER); m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL); m_cDataSrv = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE); m_cPluService = (ISalePluItemUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_PLU_ITEM); m_cOrderSheetSvr = (IServiceUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.POS_RECEIPT_ORDERSHEET); } /// /// 데이터베이스연결 /// /// public bool DBConnection() { try { // DB Connect return m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource , m_cPosStatus.Base.LocalDbCatalog , m_cPosStatus.Base.LocalDbUserID , m_cPosStatus.Base.LocalDbPassword); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); } return false; } /// /// 테이블 정보 설정 /// /// /// public void SetTableInfo(DataRow drData, ref Column.MST_TABLE.TABLE_DATA cTable) { try { cTable.FLOOR_CD = CmUtil.GetDataRowStr(drData, "FLOOR_CD"); cTable.TABLE_NO = CmUtil.GetDataRowStr(drData, "TBL_NO"); cTable.TABLE_NM = CmUtil.GetDataRowStr(drData, "TBL_NM"); cTable.TABLE_TYPE = CmUtil.GetDataRowStr(drData, "TBL_TYPE"); //cTable.TABLE_TYPE__1640 = CmUtil.GetDataRowStr(drData, "TBL_TYPE_SHAPE"); //cTable.BACK_COLOR = CmUtil.GetDataRowStr(drData, "BACKGRCOLOR"); //cTable.BACK_IMAGE = CmUtil.GetDataRowStr(drData, "BACKGR_IMG"); //cTable.FONT_COLOR = CmUtil.GetDataRowStr(drData, "FONTCOLOR"); //cTable.FONT_NM = CmUtil.GetDataRowStr(drData, "FONT_NM"); cTable.FONT_NM = m_cPosStatus.Base.FONT; cTable.FONT_SIZE = CmUtil.GetDataRowInt(drData, "FONT_SIZE"); cTable.X_COORD = CmUtil.GetDataRowInt(drData, "X_COORD"); cTable.Y_COORD = CmUtil.GetDataRowInt(drData, "Y_COORD"); cTable.WIDTH = CmUtil.GetDataRowInt(drData, "WIDTH"); cTable.HEIGHT = CmUtil.GetDataRowInt(drData, "HGT"); //cTable.TABLE_DISP_FLAG = CmUtil.GetDataRowStr(drData, "TBL_DISP_DIV"); //cTable.SEAT_CNT = CmUtil.GetDataRowInt(drData, "SEAT_CNT"); // 테이블 화면표시 구분, 테이블명으로 고정, 2017.01.31 //cTable.SEAT_DISP_FLAG = CmUtil.GetDataRowStr(drData, "SEAT_CNT_DISP_DIV"); cTable.TABLE_DISP_FLAG = PosConst.TABLE_DISP_FLAG.TABLE_NAME; if (string.IsNullOrWhiteSpace(cTable.TABLE_NM)) cTable.TABLE_NM = cTable.TABLE_NO; cTable.OP_FLAG = CmUtil.GetDataRowStr(drData, "TBL_OP_DIV"); cTable.OP_FLOOR_CD = CmUtil.GetDataRowStr(drData, "OP_FLOOR_CD"); cTable.OP_TABLE_NO = CmUtil.GetDataRowStr(drData, "OP_TBL_NO"); cTable.USE_FLAG = CmUtil.GetDataRowStr(drData, "TBL_USE_DIV"); if (string.IsNullOrWhiteSpace(cTable.USE_FLAG)) cTable.USE_FLAG = PosConst.TABLE_USE_FLAG.NO_USE; cTable.CUST_CNT = CmUtil.GetDataRowInt(drData, "CUST_CNT"); cTable.FIRST_ORDER_TIME = CmUtil.GetDataRowStr(drData, "FIRST_ORD_HOUR"); cTable.ORDER_AMT = CmUtil.GetDataRowDouble(drData, "ORD_AMT"); //cTable.RESERVATION_FLAG = CmUtil.GetDataRowStr(drData, "RESERV_DIV"); //cTable.RESERVATION_TIME = CmUtil.GetDataRowStr(drData, "RESERV_HOUR"); //cTable.ORDER_COLOR = CmUtil.GetDataRowStr(drData, "ORD_COLOR"); //cTable.PAY_COMPLETE_COLOR = CmUtil.GetDataRowStr(drData, "PAY_CMPT_COLOR"); cTable.PAY_COMPLETE_FLAG = CmUtil.GetDataRowStr(drData, "PAY_CMPT_DIV"); //if (cTable.TABLE_TYPE__1640 == string.Empty) cTable.TABLE_TYPE__1640 = PosConst.TABLE_DISP_TYPE.RECTANGLE; if (cTable.WIDTH == 0) cTable.WIDTH = 100; if (cTable.HEIGHT == 0) cTable.HEIGHT = 100; if (cTable.FONT_NM == string.Empty) cTable.FONT_NM = m_cPosStatus.Base.FONT; // "Arial"; if (cTable.FONT_SIZE == 0) cTable.FONT_SIZE = 10; cTable.UPD_DT = CmUtil.GetDataRowStr(drData, "UPD_DT"); cTable.REG_DT = CmUtil.GetDataRowStr(drData, "REG_DT"); cTable.STATUS = PosConst.DB_ROW_STATUS.NONE; cTable.ITEM_LIST = string.Empty; cTable.CUST_AGE = CmUtil.GetDataRowStr(drData, "FILLER1"); cTable.CUST_LST = CmUtil.GetDataRowStr(drData, "FILLER2"); cTable.TABLE_GROUP_INDEX = -1; // Add, 2017.02.17 var temp = CmUtil.GetDataRowInt(drData, "FILLER3"); if (temp > 0) cTable.TABLE_GROUP_INDEX = temp; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); } } /// /// 층명과 테이블명 조회 /// /// /// /// /// public string SelectFloorAndTableName(string sFloorCd, string sTableNo, out DataTable dtData) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; dtData = null; try { sQuery = "SELECT A.FLOOR_NM AS FLOOR_NM, B.TBL_NM AS TBL_NM " + " FROM POSMST..MST_FLOOR A WITH(NOLOCK) " + " , POSMST..MST_TBL B WITH(NOLOCK) " + " WHERE A.CMP_CD = B.CMP_CD " + " AND A.STOR_CD = B.STOR_CD " + " AND A.FLOOR_CD = B.FLOOR_CD " + " AND B.TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.01 + " AND B.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND B.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND B.FLOOR_CD = '" + sFloorCd + "' " + " AND B.TBL_NO = '" + sTableNo + "' " ; if (m_cSqlDbService.DBSelect(sQuery, out dtData) != UserCom.OK) { return UserCom.RST_ERR; } sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 테이블 마스터 조회 /// /// /// /// public string SelectTable(string[] aParam, out DataTable dtData) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; dtData = null; try { sQuery = " SELECT FLOOR_CD, TBL_NO, TBL_NM, TBL_TYPE, TBL_TYPE_SHAPE " + " , BACKGRCOLOR, BACKGR_IMG, FONTCOLOR, FONT_NM, FONT_SIZE " + " , X_COORD, Y_COORD, WIDTH, HGT, TBL_DISP_DIV " + " , SEAT_CNT, SEAT_CNT_DISP_DIV, TBL_OP_DIV, OP_FLOOR_CD, OP_TBL_NO " + " , TBL_USE_DIV, CUST_CNT, FIRST_ORD_HOUR, ORD_AMT, RESERV_DIV " + " , RESERV_HOUR, ORD_COLOR, PAY_CMPT_COLOR, PAY_CMPT_DIV " + " , UPD_DT, REG_DT, USE_YN " + " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 " + " FROM POSMST..MST_TBL " ; switch(aParam[0]) { case PosConst.QueryTagDef.QueryTableDef.TABLE_ALL_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.01 sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; break; case PosConst.QueryTagDef.QueryTableDef.FLOOR_CD_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.01 sQuery += " AND FLOOR_CD = '" + aParam[1] + "' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; break; case PosConst.QueryTagDef.QueryTableDef.TABLE_NO_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.01 sQuery += " AND TBL_NO LIKE '%" + aParam[1] + "%' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; break; case PosConst.QueryTagDef.QueryTableDef.TABLE_NM_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.01 sQuery += " AND USE_YN = '= '" + PosConst.MST_USE_YN.YES + "' "; break; case PosConst.QueryTagDef.QueryTableDef.TABLE_NO_FLOOR_CD_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.01 sQuery += " AND FLOOR_CD = '" + aParam[1] + "' "; sQuery += " AND TBL_NO = '" + aParam[2] + "' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; break; case PosConst.QueryTagDef.QueryTableDef.TABLE_WHERE: sQuery += aParam[1]; sQuery += " AND USE_YN = '1' "; break; case PosConst.QueryTagDef.QueryTableDef.TABLE_GROUP_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.01 + " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' " + " AND OP_FLOOR_CD = '" + aParam[1] + "' " + " AND OP_TBL_NO = '" + aParam[2] + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; break; } sQuery += " ORDER BY CMP_CD, STOR_CD, FLOOR_CD, TBL_NO "; //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start if (aParam[0] == PosConst.QueryTagDef.QueryTableDef.DT_TABLE_ORD_SEARCH) { sQuery = " SELECT TOP 1 CMP_CD, STOR_CD, FLOOR_CD, TBL_NO " + " FROM MST_ORD " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " ORDER BY REG_DT "; } //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end // return -> 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음 int ret = m_cSqlDbService.DBSelect(sQuery, out dtData); if (ret == UserCom.NG) return UserCom.RST_IGNORE; if (ret != UserCom.OK) return UserCom.RST_ERR; sReturn = UserCom.RST_OK; } catch(Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 테이블 결제 완료 상태 Update /// /// /// public string UpdateTableCompletePayment(string[] aParam) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; try { sQuery = "UPDATE POSMST..MST_TBL " + " SET PAY_CMPT_DIV = '" + aParam[2] + "' " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.02, 연습모드 + " AND FLOOR_CD = '" + aParam[0] + "' " + " AND TABLE_NO = '" + aParam[1] + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' " ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }, true) != UserCom.OK) { return UserCom.RST_ERR; } sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 테이블 사용 구분 Update /// /// /// /// /// /// /// /// /// /// public string UpdateTableUse(string pFloorCd, string pTableNo, string pPosNo, string pUseFlag, string pFirstOrderTm, int pCustCount, double pOrderAmount, bool groupCheck = false) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; try { // Begin Transaction m_cSqlDbService.Begin(); // Table Use Flag Update sQuery += " UPDATE POSMST..MST_TBL "; sQuery += " SET TBL_USE_DIV = '" + pUseFlag + "' "; if (pUseFlag == PosConst.TABLE_USE_FLAG.YES_USE) { sQuery += " , PAY_CMPT_DIV = '0' "; } if(pOrderAmount != 0) { sQuery += " , CUST_CNT = " + pCustCount + " "; sQuery += " , FIRST_ORD_HOUR = '" + pFirstOrderTm + "' "; sQuery += " , ORD_AMT = ORD_AMT + " + pOrderAmount + " "; } sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.03, 연습모드 sQuery += " AND FLOOR_CD = '" + pFloorCd + "' "; sQuery += " AND TBL_NO = '" + pTableNo + "' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; if (pUseFlag == PosConst.TABLE_USE_FLAG.YES_USE) { sQuery += " AND (TBL_USE_DIV = '" + PosConst.TABLE_USE_FLAG.NO_USE + "' OR TBL_USE_DIV IS NULL) "; } if(m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } // 그룹된 테이블 모두 업데이트 if (groupCheck) { sQuery = ""; sQuery += "UPDATE POSMST..MST_TBL "; sQuery += " SET TBL_USE_DIV = '" + pUseFlag + "' "; if (pUseFlag == PosConst.TABLE_USE_FLAG.YES_USE) { sQuery += " , PAY_CMPT_DIV = '0' "; } sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; sQuery += " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' "; sQuery += " AND (OP_FLOOR_CD + OP_TBL_NO) "; sQuery += " IN (SELECT OP_FLOOR_CD + OP_TBL_NO FROM MST_TBL "; sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.03, 연습모드 sQuery += " AND FLOOR_CD = '" + pFloorCd + "' "; sQuery += " AND TBL_NO = '" + pTableNo + "' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "') "; if (pUseFlag == PosConst.TABLE_USE_FLAG.YES_USE) { sQuery += " AND (TBL_USE_DIV = '" + PosConst.TABLE_USE_FLAG.NO_USE + "' OR TBL_USE_DIV IS NULL) "; } if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } } // Commit m_cSqlDbService.Commit(); sReturn = UserCom.RST_OK; } catch (Exception ex) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); sReturn = UserCom.RST_ERR; } return sReturn; } /// /// 매장공지사항 조회 /// /// /// /// public string SelectStoreNotice(string[] aParam, out DataTable dtData) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; dtData = null; try { sQuery = " SELECT SEQ, TITLE, CONTENTS, CASHIER_ID, REG_DT FROM POSLOG..TR_STOR_BBS WITH(NOLOCK) "; switch(aParam[0]) { case PosConst.QueryTagDef.QueryStoreNoticeDef.ALL_SEARCH: break; case PosConst.QueryTagDef.QueryStoreNoticeDef.SEQ_SEATCH: sQuery += " WHERE SEQ = " + aParam[1] + " "; break; } sQuery += " ORDER BY SEQ DESC "; if (m_cSqlDbService.DBSelect(sQuery, out dtData) != UserCom.OK) { return UserCom.RST_ERR; } sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 매장공지사항 등록 /// /// /// /// public string RegisterStoreNotice(string sTitle, string sContents) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; string sInsQuery = string.Empty; try { sInsQuery = " INSERT INTO POSLOG..TR_STOR_BBS ( TITLE, CONTENTS, CASHIER_ID, UPD_DT, REG_DT ) " + " VALUES ( N'{0}', N'{1}', '{2}', '{3}', '{4}' ) "; sQuery = string.Format(sInsQuery , sTitle , sContents , m_cPosStatus.Base.CashierNo , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss")); // Begin Transaction m_cSqlDbService.Begin(); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } // Commit m_cSqlDbService.Commit(); sReturn = UserCom.RST_OK; } catch (Exception ex) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 매장공지사항 삭제 /// /// /// public string DeleteStoreNotice(string[] aParam) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; try { sQuery += " DELETE FROM POSLOG..TR_STOR_BBS "; switch (aParam[0]) { case PosConst.QueryTagDef.QueryStoreNoticeDef.SEQ_DELETE: sQuery += " WHERE SEQ = " + aParam[1] + " "; break; case PosConst.QueryTagDef.QueryStoreNoticeDef.DATE_DELETE: sQuery += " WHERE REG_DT <= '" + aParam[1] + "' "; break; case PosConst.QueryTagDef.QueryStoreNoticeDef.ALL_DELETE: break; } // Begin Transaction m_cSqlDbService.Begin(); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } // Commit m_cSqlDbService.Commit(); sReturn = UserCom.RST_OK; } catch (Exception ex) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 층마스터 조회 /// /// /// /// public string SelectFloor(string[] aParam, out DataTable dtData) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; dtData = null; try { sQuery += " SELECT FLOOR_CD, FLOOR_NM, UPD_DT, REG_DT, USE_YN FROM POSMST..MST_FLOOR WITH(NOLOCK) "; switch(aParam[0]) { case PosConst.QueryTagDef.QueryFloorDef.FLOOR_ALL_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; break; case PosConst.QueryTagDef.QueryFloorDef.FLOOR_CD_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND FLOOR_CD LIKE '%" + aParam[1] + "%' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; break; case PosConst.QueryTagDef.QueryFloorDef.FLOOR_NM_SEARCH: sQuery += "WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND FLOOR_NM LIKE '%" + aParam[1] + "%' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; break; } sQuery += " ORDER BY FLOOR_CD "; // return -> 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음 int ret = m_cSqlDbService.DBSelect(sQuery, out dtData); if (ret == UserCom.NG) return UserCom.RST_IGNORE; if (ret != UserCom.OK) return UserCom.RST_ERR; sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// Select Order Information /// /// 주문구분, 층코드, 테이블번호 /// /// public string SelectTableOrderItem(string[] aParam, out DataTable dtData) { string sReturn = UserCom.RST_OK; string sQuery = string.Empty; dtData = null; try { sQuery = "SELECT A.* \n" + " , B.CASHIER_NM AS ORD_PIC_NM \n" // Mod, 2017.03.29, 주문담당자 + " FROM POSMST..MST_ORD A LEFT JOIN POSMST..MST_USER B \n" + " ON A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.ORD_PIC_NO = B.CASHIER_ID \n" + " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND A.TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" + " AND A.ORD_DIV = '" + aParam[0].Trim() + "' \n" + " AND A.FLOOR_CD = '" + aParam[1].Trim() + "' \n" + " AND A.TBL_NO LIKE '" + aParam[2].Trim() + "%' \n" + " ORDER BY A.CMP_CD, A.STOR_CD, A.FLOOR_CD, A.TBL_NO, A.SEQ \n" ; if (m_cSqlDbService.DBSelect(sQuery, out dtData) != UserCom.OK) { return UserCom.RST_ERR; } sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 판매정보 조회 /// /// /// public string SelectTableSaleInfo(out DataTable dtData) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; dtData = null; try { sQuery = "SELECT SUM(A.ORDER_COUNT) AS ORDER_COUNT \n" + " , SUM(A.ORDER_AMT) AS ORDER_AMT \n" + " , SUM(A.CUST_CNT) AS CUST_CNT \n" + " , SUM(A.RESERVED_COUNT) AS RESERVED_COUNT \n" + " FROM (SELECT COUNT(FLOOR_CD) AS ORDER_COUNT \n" + " , SUM(ORD_AMT) AS ORDER_AMT \n" + " , SUM(CUST_CNT) AS CUST_CNT \n" + " , 0 AS RESERVED_COUNT \n" + " FROM POSMST..MST_TBL WITH(NOLOCK) \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" + " AND (ORD_AMT <> 0 OR CUST_CNT <> 0 OR FIRST_ORD_HOUR <> '') \n" + " UNION ALL \n" + " SELECT 0 AS ORDER_COUNT \n" + " , 0 AS ORDER_AMT \n" + " , 0 AS CUST_CNT \n" + " , COUNT(RESERV_NO) AS RESERVED_COUNT \n" + " FROM POSMST..MST_RESERV WITH(NOLOCK) \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND RESERV_DT = '" + DateTime.Now.ToString("yyyyMMdd") + "'\n" + " AND (RESERV_TM = '' OR RESERV_TM >= '" + DateTime.Now.ToString("HHmm") + "') \n" + " AND FILLER1 = '" + m_cPosStatus.Base.TrainingFlag + "' \n" + " ) A \n" ; if (m_cSqlDbService.DBSelect(sQuery, out dtData) != UserCom.OK) { return UserCom.RST_ERR; } sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 주문마스터 기반으로 TRAN 생성 /// /// public string SelectMenuOrder() { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; DataTable dtReturn = new DataTable(); try { // 거래초기화 m_cDataSrv.DeleteTranItem(); if (m_cTrnStatus.Head.TableNo == string.Empty) return UserCom.RST_ERR; var logMsg = string.Format("{0} ==> TYPE:{1} FLOOR:{2} TABLE:{3} TRAING TYPE:{4}" , m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY ? "GROUP PAY START" : "ORDER START" , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , m_cPosStatus.Base.TrainingFlag); UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", logMsg); sQuery = "SELECT A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.ITEM_CD \n" + " , A.ITEM_DIV, A.SHTCUT_ITEMNM, A.SALE_QTY, A.SALE_PRC, A.SALE_AMT, A.BILL_AMT \n" + " , A.DC_DIV, A.DC_RATE, A.ITEM_DC_AMT, A.SUM_DC_AMT, A.CPI_DC_AMT \n" + " , A.COOP_CARD_DC_DIV, A.COOP_CARD_DC_AMT, A.POINT_DC_DIV, A.POINT_DC_AMT, A.CPN_DC_DIV \n" + " , A.CPN_DC_AMT, A.EMP_DC_DIV, A.EMP_DC_AMT, A.SET_DC_AMT, A.ETC_DC_DIV \n" + " , A.ETC_DC, A.EXCEP_DC_DIV, A.EXCEP_DC_AMT, A.PACK_DIV, A.SET_MENU_CD, A.CPI_PRESENT_DIV, A.SUB_MEMO_DIV \n" + " , A.MSG1, A.MSG2, A.MSG3, A.MSG_REG_TIME, A.ORD_TIME \n" + " , A.ORD_COMP_DIV, A.CANCEL_DIV, A.CANCEL_DATE, B.SUB_STOR_CD \n" + " , B.L_CLSS, B.M_CLSS, B.S_CLSS, B.FLAVOUR_DIV, B.FLAVOUR_QTY \n" + " , B.FLAVOUR_STOCK, B.ITEM_NM, B.TAKE_IN_SALE_AMT, B.TAKE_OUT_SALE_AMT \n" + " , B.IF_MENU1, B.IF_MENU2, B.OPEN_ITEM_DIV, B.DISPO_ITEM_DIV, B.SUB_SET_MNG_TYPE \n" + " , B.ITEM_TAX_AMT_DIV, B.TAKE_IN_VAT_CD, B.TAKE_OUT_VAT_CD \n" + " , B.ITEM_COST, B.SALE_PRMT_YN, B.SALE_NOQ, B.FREE_GIFT_YN \n" + " , B.DC_PRMT_YN, B.COOP_CARD_DC_NOADM_YN, B.ACCUM_PRMT_YN, B.SVC_FEE_TRGT_YN \n" + " , B.CAKE_EXCHNG_CPN_USE_POSS_YN \n" + " , B.BTN_ITEM_IMG, B.NEW_ITEM_START_DT, B.NEW_ITEM_FNSH_DT, B.ITEM_TYPE, B.FILLER1 \n" + " , B.FILLER2, B.FILLER3, B.FILLER4, B.FILLER5 \n" + " , B.TAX_AMT_INCLUDE_YN \n" //2018.01.04;미주 상품 부가세 정보 ;girak.kim; + " , A.NOTAX_DIV \n" + " , A.FILLER1 AS SUB_MENU_MAIN_CD \n" // Add, 2017.03.15, 부가메뉴메인상품코드 + " , A.ORD_PIC_NO, C.CASHIER_NM AS ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자 + " , A.DC_TYPE \n" // Add, 2017.03.30 + " , A.FILLER2 AS ORDER_NO \n" // Add, 2017.04.11 + " , A.FILLER3 AS ORDER_SEQ \n" // Add, 2017.04.11 + " FROM POSMST..MST_ORD A \n" //#20170926 복합 매장인 경우 동일 상품코드가 있으면 2개가 생성되어 서브점포코드까지 JOIN start //기존 //+ " LEFT JOIN POSMST..MST_ITEM B ON A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.ITEM_CD = B.ITEM_CD \n" //변경 + " LEFT JOIN POSMST..MST_ITEM B ON A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.ITEM_CD = B.ITEM_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD \n" //#20170926 복합 매장인 경우 동일 상품코드가 있으면 2개가 생성되어 서브점포코드까지 JOIN end + " LEFT JOIN POSMST..MST_USER C ON A.CMP_CD = C.CMP_CD AND A.STOR_CD = C.STOR_CD AND A.ORD_PIC_NO = C.CASHIER_ID \n" + " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND A.TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02 + " AND A.ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' \n" ; if (m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) { sQuery += " AND A.FLOOR_CD + A.TBL_NO IN \n" + " (SELECT FLOOR_CD + TBL_NO FROM POSMST..MST_TBL \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02 + " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' \n" + " AND OP_FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' \n" + " AND OP_TBL_NO = '" + m_cTrnStatus.Head.TableNo + "') \n" ; } else { sQuery += " AND A.FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' \n" + " AND A.TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' \n" ; } sQuery += " ORDER BY A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ "; m_cSqlDbService.DBSelect(sQuery, out dtReturn); if (dtReturn != null && dtReturn.Rows.Count > 0) { ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); foreach (DataRow dr in dtReturn.Rows) { // 상품 정보 생성 Column.TR_PLU.DATA cPluItem = new Column.TR_PLU.DATA(); cPluItem.ORD_TIME = dr["ORD_TIME"].ToString(); cPluItem.FLOOR_CD = dr["FLOOR_CD"].ToString(); cPluItem.TBL_NO = dr["TBL_NO"].ToString(); cPluItem.CANCEL_DIV = dr["CANCEL_DIV"].ToString(); cPluItem.CANCEL_DATE = dr["CANCEL_DATE"].ToString(); cPluItem.ITEM_PLU_CD = dr["ITEM_CD"].ToString(); cPluItem.ITEM_BRAND_CD = m_cPosStatus.Base.BrandCd; cPluItem.SUB_SHOP_CD = dr["SUB_STOR_CD"].ToString(); cPluItem.ITEM_DIV = dr["ITEM_DIV"].ToString(); cPluItem.SUB_SET_MNG_TYPE = dr["SUB_SET_MNG_TYPE"].ToString(); cPluItem.ITEM_NAME = dr["SHTCUT_ITEMNM"].ToString().Replace("'", "").Replace(",", "").Trim(); cPluItem.SALE_QTY = long.Parse(dr["SALE_QTY"].ToString()); cPluItem.ORG_QTY = cPluItem.SALE_QTY; // Add, 2017.03.31 cPluItem.SALE_PRC = double.Parse(dr["SALE_PRC"].ToString()); cPluItem.SALE_AMT = double.Parse(dr["SALE_AMT"].ToString()); cPluItem.BILL_AMT = double.Parse(dr["BILL_AMT"].ToString()); cPluItem.ITEM_INPUT_DIV = "0"; cPluItem.ITEM_BAR_CD = dr["ITEM_CD"].ToString(); cPluItem.ITEM_TAX_DIV = dr["ITEM_TAX_AMT_DIV"].ToString(); cPluItem.NOTAX_DIV = dr["NOTAX_DIV"].ToString().Trim(); // Add, 2017.02.15 if (string.IsNullOrWhiteSpace(cPluItem.NOTAX_DIV)) cPluItem.NOTAX_DIV = PosConst.ITEM_NOTAX_DIV.NO; // 2018.01.04;미주 상품별 부가세 적용 처리;girak.kim;Start //기존 소스 //cPluItem.TAX_AMT_INCLUDE_YN = m_cPosStatus.Mst.TaxAmtIncludeYn; if (m_cPosStatus.Base.CmpCd.ToUpper().Equals(PosConst.POS_COMPANY_CODE.PCUS)) { cPluItem.TAX_AMT_INCLUDE_YN = dr["TAX_AMT_INCLUDE_YN"].ToString(); } else { cPluItem.TAX_AMT_INCLUDE_YN = m_cPosStatus.Mst.TaxAmtIncludeYn; } // 2018.01.04;미주 상품별 부가세 적용 처리;girak.kim;End cPluItem.DC_DIV = dr["DC_DIV"].ToString(); cPluItem.DC_TYPE = CmUtil.GetDataRowStr(dr, "DC_TYPE"); // Add, 2017.03.30 cPluItem.DC_RATE = double.Parse(dr["DC_RATE"].ToString()); if (dr["DC_RATE"].ToString().Trim().Length > 5) cPluItem.DC_RATE = double.Parse(dr["DC_RATE"].ToString().Trim().Substring(0, 5)); cPluItem.ITEM_DC_AMT = double.Parse(dr["ITEM_DC_AMT"].ToString()); cPluItem.SUM_DC_AMT = double.Parse(dr["SUM_DC_AMT"].ToString()); cPluItem.CPI_DC_AMT = double.Parse(dr["CPI_DC_AMT"].ToString()); cPluItem.COOP_CARD_DC_DIV = dr["COOP_CARD_DC_DIV"].ToString(); cPluItem.COOP_CARD_DC_AMT = double.Parse(dr["COOP_CARD_DC_AMT"].ToString()); cPluItem.POINT_DC_DIV = dr["POINT_DC_DIV"].ToString(); cPluItem.POINT_DC_AMT = double.Parse(dr["POINT_DC_AMT"].ToString()); cPluItem.CPN_DC_DIV = dr["CPN_DC_DIV"].ToString(); cPluItem.CPN_DC_AMT = double.Parse(dr["CPN_DC_AMT"].ToString()); cPluItem.EMP_DC_DIV = dr["EMP_DC_DIV"].ToString(); cPluItem.EMP_DC_AMT = double.Parse(dr["EMP_DC_AMT"].ToString()); cPluItem.SET_DC_AMT = double.Parse(dr["SET_DC_AMT"].ToString()); cPluItem.ETC_DC_DIV = dr["ETC_DC_DIV"].ToString(); cPluItem.ETC_DC_AMT = double.Parse(dr["ETC_DC"].ToString()); cPluItem.EXCEP_DC_DIV = dr["EXCEP_DC_DIV"].ToString(); cPluItem.EXCEP_DC_AMT = double.Parse(dr["EXCEP_DC_AMT"].ToString()); cPluItem.ORDER_OK_FLAG = PosConst.PLU_ORDER_OK_FLAG.ORDER_OK; cPluItem.PACK_DIV = dr["PACK_DIV"].ToString(); cPluItem.SET_MENU_CD = dr["SET_MENU_CD"].ToString(); cPluItem.CPI_PRESENT_DIV = dr["CPI_PRESENT_DIV"].ToString(); cPluItem.SUBPRC_MENU_KEY_DIV = dr["SUB_MEMO_DIV"].ToString(); // _YN필드시리즈 추가(2017.04.06) cPluItem.CAKE_EXCHNG_CPN_USE_POSS_YN = CmUtil.GetDataRowStr(dr, "CAKE_EXCHNG_CPN_USE_POSS_YN"); cPluItem.DC_PRMT_YN = CmUtil.GetDataRowStr(dr, "DC_PRMT_YN"); cPluItem.COOP_CARD_DC_NOADM_YN = CmUtil.GetDataRowStr(dr, "COOP_CARD_DC_NOADM_YN"); // 상품메시지 cPluItem.ITEM_MEMO_1 = dr["MSG1"].ToString().Trim(); cPluItem.ITEM_MEMO_2 = dr["MSG2"].ToString().Trim(); cPluItem.ITEM_MEMO_3 = dr["MSG3"].ToString().Trim(); cPluItem.SUB_MENU_MAIN_CD = dr["SUB_MENU_MAIN_CD"].ToString().Trim(); // Add, 2017.03.15, 부가메뉴메인상품코드 FILLER1 cPluItem.DISPO_ITEM_DIV = dr["DISPO_ITEM_DIV"].ToString(); cPluItem.ORDER_NO = CmUtil.GetDataRowStr(dr, "ORDER_NO"); // Add, 2017.04.11 cPluItem.ORDER_SEQ = CmUtil.GetDataRowStr(dr, "ORDER_SEQ"); // Add, 2017.04.11 m_cTrnStatus.Head.OrderNo = cPluItem.ORDER_NO; // Add, 2017.04.11 // 주문담당자 m_cTrnStatus.Head.OrderPicNo = CmUtil.GetDataRowStr(dr, "ORD_PIC_NO"); // Add, 2017.03.28, 주문담당자 m_cTrnStatus.Head.OrderPicNm = CmUtil.GetDataRowStr(dr, "ORD_PIC_NM"); //#20170911 외식 캠페인 주문 후 결제 시 적용 안되는 현상 수정 start //라그릴리아 외식 캠페인(2017901) 바로 결제 시 캠페인 적용되나, 주문 후 결제 시 캠페인 적용 안되는 현상 수정 cPluItem.L_CLSS = dr["L_CLSS"].ToString().Trim(); cPluItem.M_CLSS = dr["M_CLSS"].ToString().Trim(); cPluItem.S_CLSS = dr["S_CLSS"].ToString().Trim(); //#20170911 외식 캠페인 주문 후 결제 시 적용 안되는 현상 수정 end aSaleItem.Add(cPluItem); } // 상품 판매가 계산 m_cPluService.ItemAmountExeccute(true, true); } else if (dtReturn != null) { if (m_cTrnStatus.Head.OrderFlag == PosConst.ORDER_TYPE.NORMAL) { // 테이블 마스터 삭제 sQuery = " UPDATE POSMST..MST_TBL "; sQuery += " SET CUST_CNT = 0 "; sQuery += " , FIRST_ORD_HOUR = '' "; sQuery += " , ORD_AMT = 0 "; sQuery += " , FILLER1 = '' "; sQuery += " , FILLER2 = '' "; sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02 sQuery += " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' "; sQuery += " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }, true); } } // 고객정보 및 테이블 정보 획득 sQuery = "SELECT A.FLOOR_CD, B.FLOOR_NM, A.TBL_NO, A.TBL_NM, A.TBL_DISP_DIV, A.CUST_CNT, A.FILLER1, A.FILLER2 "; sQuery += " FROM POSMST..MST_TBL A JOIN POSMST..MST_FLOOR B "; sQuery += " ON A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.FLOOR_CD = B.FLOOR_CD AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND A.TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02 if (m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) { sQuery += " AND A.FLOOR_CD + A.TBL_NO IN (SELECT FLOOR_CD + TBL_NO FROM POSMST..MST_TBL "; sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02 sQuery += " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' "; sQuery += " AND OP_FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' "; sQuery += " AND OP_TBL_NO = '" + m_cTrnStatus.Head.TableNo + "') "; } else { sQuery += " AND A.FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' "; sQuery += " AND A.TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; } sQuery += " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; sQuery += " ORDER BY A.FLOOR_CD, A.TBL_NO "; m_cSqlDbService.DBSelect(sQuery, out dtReturn); if (dtReturn != null && dtReturn.Rows.Count > 0) { ArrayList aGuestItem = (ArrayList)StateObject.GetItemObject(Column.TR_GUEST.ITEM); foreach (DataRow dr in dtReturn.Rows) { m_cTrnStatus.Head.CustCnt += CmUtil.GetDataRowInt(dr, "CUST_CNT") == 0 ? 1 : CmUtil.GetDataRowInt(dr, "CUST_CNT"); m_cTrnStatus.Head.FloorNm = dr["FLOOR_NM"].ToString(); #region 2017.01.31, 테이블표시 구분은 테이블명으로 고정한다. // 2017.01.31, 테이블표시 구분은 테이블명으로 고정한다. //string sDispFlag = dr["TBL_DISP_DIV"].ToString(); //if (sDispFlag == PosConst.TABLE_DISP_FLAG.TABLE_NO) //{ // m_cTrnStatus.Head.TableNm = m_cTrnStatus.Head.TableNo; //} //else if (sDispFlag == PosConst.TABLE_DISP_FLAG.TABLE_NAME) //{ // m_cTrnStatus.Head.TableNm = dr["TBL_NM"].ToString(); //} //else //{ // m_cTrnStatus.Head.TableNm = m_cTrnStatus.Head.TableNo + "【" + dr["TBL_NM"].ToString() + "】"; //} #endregion m_cTrnStatus.Head.TableNm = dr["TBL_NM"].ToString().Trim(); // 객층정보 string[] temp = null; temp = CmUtil.GetDataRowStr(dr, "FILLER1").Split('|'); if (temp.Length > 1) { m_cTrnStatus.Head.PayGndrDiv = temp[0]; m_cTrnStatus.Head.PayAge = CmUtil.IntParse(temp[1]); } // 고객상세정보 temp = CmUtil.GetDataRowStr(dr, "FILLER2").Split('|'); if (temp.Length >= 10) { if (aGuestItem.Count == 0) { aGuestItem.Add(new Column.TR_GUEST.DATA()); } Column.TR_GUEST.DATA custLst = (Column.TR_GUEST.DATA)aGuestItem[0]; custLst.MALE_10L += CmUtil.IntParse(temp[0]); custLst.MALE_20L += CmUtil.IntParse(temp[1]); custLst.MALE_30L += CmUtil.IntParse(temp[2]); custLst.MALE_40L += CmUtil.IntParse(temp[3]); custLst.MALE_50L += CmUtil.IntParse(temp[4]); custLst.FMALE_10L += CmUtil.IntParse(temp[5]); custLst.FMALE_20L += CmUtil.IntParse(temp[6]); custLst.FMALE_30L += CmUtil.IntParse(temp[7]); custLst.FMALE_40L += CmUtil.IntParse(temp[8]); custLst.FMALE_50L += CmUtil.IntParse(temp[9]); m_cTrnStatus.Head.ManCmpnpsnCnt += CmUtil.IntParse(temp[0]) + CmUtil.IntParse(temp[1]) + CmUtil.IntParse(temp[2]) + CmUtil.IntParse(temp[3]) + CmUtil.IntParse(temp[4]); m_cTrnStatus.Head.WomanCmpnpsnCnt += CmUtil.IntParse(temp[5]) + CmUtil.IntParse(temp[6]) + CmUtil.IntParse(temp[7]) + CmUtil.IntParse(temp[8]) + CmUtil.IntParse(temp[9]); } } } sReturn = UserCom.RST_OK; } catch (Exception ex) { m_cDataSrv.DeleteTranItem(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 주문 완료 처리 /// /// public string CompleteMenuOrder() { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; string sInsQuery = string.Empty; string sInsQuery2 = string.Empty; string sUpdQuery = string.Empty; string sUpdQuery2 = string.Empty; bool bUpdate = false; bool bOrdUpdate = false; int iSeq = 0; try { // 층/테이블 정보확인 if (m_cTrnStatus.Head.FloorCd == string.Empty && m_cTrnStatus.Head.TableNo == string.Empty) return UserCom.RST_OK; // 데이블그룹 결제모드이면, 주문을 변경 할 수 없다. if (m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) return UserCom.RST_OK; UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "ORDER COMPLETE ==> TYPE:" + m_cTrnStatus.Head.OrderFlag + " FLOOR:" + m_cTrnStatus.Head.FloorCd + " TABLE:" + m_cTrnStatus.Head.TableNo + " AMT:" + m_cTrnStatus.Sale.NetSaleAmt.ToString()); ArrayList alPluItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); // 주문번호/주문차수 var orderNo = string.Empty; var orderSeq = string.Empty; if (((Column.TR_PLU.DATA)alPluItem[0]).ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) { // 주문번호 발번 orderNo = GetOrderNoForDb(); orderSeq = "01"; } else { orderNo = ((Column.TR_PLU.DATA)alPluItem[0]).ORDER_NO; orderSeq = GetOrderSeq(m_cTrnStatus.Head.FloorCd, m_cTrnStatus.Head.TableNo); } // Begin Transaction m_cSqlDbService.Begin(); if(m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL) { // 주문 데이터 업데이트 if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL && m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT) { #region 주문데이터 업데이트 처리 #region >> Query string format sInsQuery = " INSERT INTO POSMST..MST_ORD \n"; sInsQuery += " ( CMP_CD, STOR_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ, SUB_STOR_CD, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY \n"; sInsQuery += " , SALE_PRC, SALE_AMT, BILL_AMT, DC_DIV, DC_RATE, ITEM_DC_AMT, SUM_DC_AMT, CPI_DC_AMT, COOP_CARD_DC_DIV, COOP_CARD_DC_AMT \n"; sInsQuery += " , POINT_DC_DIV, POINT_DC_AMT, CPN_DC_DIV, CPN_DC_AMT, EMP_DC_DIV, EMP_DC_AMT, SET_DC_AMT, ETC_DC_DIV, ETC_DC, EXCEP_DC_DIV \n"; sInsQuery += " , EXCEP_DC_AMT, PACK_DIV, SET_MENU_CD, CPI_PRESENT_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, ORD_TIME \n"; sInsQuery += " , ORD_COMP_DIV, ORD_PIC_NO , CANCEL_DIV, CANCEL_DATE, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, REG_DT, NOTAX_DIV \n"; sInsQuery += " , TRAIN_MODE_YN \n"; // Add, 2017.03.02 sInsQuery += " , DC_TYPE \n"; // Add, 2017.03.30 sInsQuery += " , ORG_QTY \n"; // Add, 2017.03.31 sInsQuery += " , ORD_POS_NO \n"; // Add, 2017.04.10 sInsQuery += " ) VALUES ( \n"; sInsQuery += " '{0}' , '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', N'{9}' \n"; sInsQuery += " , '{10}' , '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}' \n"; sInsQuery += " , '{20}' , '{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}', '{29}' \n"; sInsQuery += " , '{30}' , '{31}', '{32}', '{33}', '{34}', '{35}', N'{36}', N'{37}', N'{38}', '{39}' \n"; sInsQuery += " , '{40}' , '{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}', '{49}', '{50}', '{51}' \n"; sInsQuery += " , '{52}' \n"; // Add, 2017.03.02 sInsQuery += " , '{53}' \n"; // Add, 2017.03.30 sInsQuery += " , {54} \n"; // Add, 2017.03.31 sInsQuery += " , '{55}' \n"; // Add, 2017.04.10 sInsQuery += " ) "; sUpdQuery = " UPDATE POSMST..MST_ORD \n"; sUpdQuery += " SET SALE_QTY = {0}, SALE_PRC = {1}, SALE_AMT = {2}, BILL_AMT = {3} \n"; sUpdQuery += " , DC_DIV = '{4}', DC_RATE = {5}, ITEM_DC_AMT = {6}, SUM_DC_AMT = {7} \n"; sUpdQuery += " , CPI_DC_AMT = {8}, COOP_CARD_DC_DIV = '{9}' \n"; sUpdQuery += " , COOP_CARD_DC_AMT = {10}, POINT_DC_DIV = '{11}', POINT_DC_AMT = {12}, CPN_DC_DIV = '{13}' \n"; sUpdQuery += " , CPN_DC_AMT = {14}, EMP_DC_DIV = '{15}', EMP_DC_AMT = {16}, SET_DC_AMT = {17} \n"; sUpdQuery += " , ETC_DC_DIV = '{18}', ETC_DC = {19}, EXCEP_DC_DIV = '{20}', EXCEP_DC_AMT = {21} \n"; sUpdQuery += " , PACK_DIV = '{22}', SET_MENU_CD = '{23}' \n"; sUpdQuery += " , CPI_PRESENT_DIV = '{24}', SUB_MEMO_DIV = '{25}', ORD_TIME = '{26}', ORD_COMP_DIV = '{27}' \n"; sUpdQuery += " , CANCEL_DIV = '{28}', CANCEL_DATE = '{29}', FILLER1 = '{30}', FILLER2 = '{31}' \n"; sUpdQuery += " , FILLER3 = '{32}', FILLER4 = '{33}', FILLER5 = '{34}', UPD_DT = '{35}' \n"; sUpdQuery += " , NOTAX_DIV = '{42}' \n"; sUpdQuery += " , DC_TYPE = '{44}' \n"; // Add, 2017.03.30 sUpdQuery += " , ORG_QTY = {45} \n"; // Add, 2017.03.31 sUpdQuery += " , ORD_POS_NO = '{46}' \n"; // Add, 2017.04.10 sUpdQuery += " WHERE CMP_CD = '{36}' AND STOR_CD = '{37}' AND ORD_DIV = '{38}' AND FLOOR_CD = '{39}' AND TBL_NO = '{40}' AND SEQ = {41} \n"; sUpdQuery += " AND TRAIN_MODE_YN = '{43}' "; // Add, 2017.03.02 #endregion iSeq = 0; foreach(Column.TR_PLU.DATA cPluItem in alPluItem) { if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cPluItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) cPluItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL; // 주문데이터 업데이트 if (cPluItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) { if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) continue; cPluItem.ORDER_NO = orderNo; // Add, 2017.04.11, 주문번호 cPluItem.ORDER_SEQ = orderSeq; // Add, 2017.04.11, 주문차수 #region ## INSERT INTO POSMST..MST_ORD sQuery = string.Format(sInsQuery , m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , (iSeq + 1).ToString() , cPluItem.SUB_SHOP_CD // Add, 2017.02.02, 서브매장코드 , cPluItem.ITEM_PLU_CD , cPluItem.ITEM_DIV , CmUtil.LeftH(cPluItem.ITEM_NAME, 30) , cPluItem.SALE_QTY.ToString() , cPluItem.SALE_PRC.ToString() , cPluItem.SALE_AMT.ToString() , cPluItem.BILL_AMT.ToString() , cPluItem.DC_DIV , cPluItem.DC_RATE.ToString() , cPluItem.ITEM_DC_AMT.ToString() , cPluItem.SUM_DC_AMT.ToString() , cPluItem.CPI_DC_AMT.ToString() , cPluItem.COOP_CARD_DC_DIV , cPluItem.COOP_CARD_DC_AMT.ToString() , cPluItem.POINT_DC_DIV , cPluItem.POINT_DC_AMT.ToString() , cPluItem.CPN_DC_DIV , cPluItem.CPN_DC_AMT.ToString() , cPluItem.EMP_DC_DIV , cPluItem.EMP_DC_AMT.ToString() , cPluItem.SET_DC_AMT.ToString() , cPluItem.ETC_DC_DIV , cPluItem.ETC_DC_AMT.ToString() , cPluItem.EXCEP_DC_DIV , cPluItem.EXCEP_DC_AMT.ToString() , cPluItem.PACK_DIV , cPluItem.SET_MENU_CD , cPluItem.CPI_PRESENT_DIV , cPluItem.SUBPRC_MENU_KEY_DIV , ConvertDBStr(cPluItem.ITEM_MEMO_1) // MSG1 , ConvertDBStr(cPluItem.ITEM_MEMO_2) // MSG2 , ConvertDBStr(cPluItem.ITEM_MEMO_3) // MSG3 , string.IsNullOrWhiteSpace(cPluItem.ITEM_MEMO_1 + cPluItem.ITEM_MEMO_2 + cPluItem.ITEM_MEMO_3) ? string.Empty : DateTime.Now.ToString("HHmmss") // MSG_REG_TIME , cPluItem.ORD_TIME , cPluItem.ORDER_OK_FLAG , m_cTrnStatus.Head.OrderPicNo , cPluItem.CANCEL_DIV , cPluItem.CANCEL_DATE , cPluItem.SUB_MENU_MAIN_CD // Add, 2017.03.15, 부가메뉴메인상품코드 FILLER1 , cPluItem.ORDER_NO // Add, 2017.04.11, 주문번호 , cPluItem.ORDER_SEQ // Add, 2017.04.11, 주문차수 , string.Empty , string.Empty , DateTime.Now.ToString("yyyyMMddHHmmss") , cPluItem.NOTAX_DIV // Add, 2017.02.15 , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , cPluItem.DC_TYPE // Add, 2017.03.30 , cPluItem.ORG_QTY // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } bUpdate = true; bOrdUpdate = true; #endregion } else if (cPluItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_MOD) { #region ## UPDATE POSMST..MST_ORD sQuery = string.Format(sUpdQuery , cPluItem.SALE_QTY.ToString() , cPluItem.SALE_PRC.ToString() , cPluItem.SALE_AMT.ToString() , cPluItem.BILL_AMT.ToString() , cPluItem.DC_DIV , cPluItem.DC_RATE , cPluItem.ITEM_DC_AMT.ToString() , cPluItem.SUM_DC_AMT.ToString() , cPluItem.CPI_DC_AMT.ToString() , cPluItem.COOP_CARD_DC_DIV , cPluItem.COOP_CARD_DC_AMT.ToString() , cPluItem.POINT_DC_DIV , cPluItem.POINT_DC_AMT.ToString() , cPluItem.CPN_DC_DIV , cPluItem.CPN_DC_AMT.ToString() , cPluItem.EMP_DC_DIV , cPluItem.EMP_DC_AMT.ToString() , cPluItem.SET_DC_AMT.ToString() , cPluItem.ETC_DC_DIV , cPluItem.ETC_DC_AMT.ToString() , cPluItem.EXCEP_DC_DIV , cPluItem.EXCEP_DC_AMT.ToString() , cPluItem.PACK_DIV , cPluItem.SET_MENU_CD , cPluItem.CPI_PRESENT_DIV , cPluItem.SUBPRC_MENU_KEY_DIV , cPluItem.ORD_TIME , cPluItem.ORDER_OK_FLAG , cPluItem.CANCEL_DIV , cPluItem.CANCEL_DATE , cPluItem.SUB_MENU_MAIN_CD // Add, 2017.03.15, 부가메뉴메인상품코드 FILLER1 , cPluItem.ORDER_NO // Add, 2017.04.11, 주문번호 FILLER2 , cPluItem.ORDER_SEQ // Add, 2017.04.11, 주문차수 FILLER3 , string.Empty , string.Empty , DateTime.Now.ToString("yyyyMMddHHmmss") , m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , iSeq + 1 , cPluItem.NOTAX_DIV // Add, 2017.02.15 , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , cPluItem.DC_TYPE // Add, 2017.03.30 , cPluItem.ORG_QTY // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); if(m_cSqlDbService.DBExecuteNonQuery(new string[] {sQuery}) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) bUpdate = true; bOrdUpdate = true; #endregion } iSeq++; } #endregion //if((bUpdate == true || bOrdUpdate == true) && m_cTrnStatus.Head.OrderFlag == PosConst.ORDER_TYPE.NORMAL) if (m_cTrnStatus.Head.OrderFlag == PosConst.ORDER_TYPE.NORMAL) { #region 테이블 마스터 업데이트 처리 (주문완료) // 주문시간 var sOrderTime = DateTime.Now.ToString("yyyyMMddHHmmss"); // 객층/객수 var custCnt = m_cTrnStatus.Head.CustCnt; var custAge = string.Format("{0}|{1}", m_cTrnStatus.Head.PayGndrDiv, m_cTrnStatus.Head.PayAge); var custLst = string.Empty; ArrayList aGuestItem = (ArrayList)StateObject.GetItemObject(Column.TR_GUEST.ITEM); if (aGuestItem.Count > 0) { var custArray = new int[10]; Column.TR_GUEST.DATA cGuestItem = (Column.TR_GUEST.DATA)aGuestItem[0]; custArray[0] = cGuestItem.MALE_10L; custArray[1] = cGuestItem.MALE_20L; custArray[2] = cGuestItem.MALE_30L; custArray[3] = cGuestItem.MALE_40L; custArray[4] = cGuestItem.MALE_50L; custArray[5] = cGuestItem.FMALE_10L; custArray[6] = cGuestItem.FMALE_20L; custArray[7] = cGuestItem.FMALE_30L; custArray[8] = cGuestItem.FMALE_40L; custArray[9] = cGuestItem.FMALE_50L; custLst = string.Join("|", custArray); } sQuery = " UPDATE POSMST..MST_TBL \n"; sQuery += " SET TBL_USE_DIV = '" + PosConst.TABLE_USE_FLAG.NO_USE + "' \n"; sQuery += " , CUST_CNT = " + custCnt.ToString() + " \n"; sQuery += " , FILLER1 = '" + custAge + "' \n"; sQuery += " , FILLER2 = '" + custLst + "' \n"; sQuery += " , FIRST_ORD_HOUR = CASE WHEN RTRIM(ISNULL(FIRST_ORD_HOUR, '')) = '' THEN '" + sOrderTime + "' ELSE FIRST_ORD_HOUR END \n"; sQuery += " , ORD_AMT = " + m_cTrnStatus.Sale.NetSaleAmt.ToString() + " \n"; sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; sQuery += " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n"; // Add, 2017.03.02, 연습모드 sQuery += " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' \n"; sQuery += " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' \n"; sQuery += " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"; if(m_cSqlDbService.DBExecuteNonQuery(new string[] {sQuery}) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } #endregion } } } // 주방출력 데이터 업데이트 if(m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT) { #region 주방출력 데이터 업데이트 if (m_cTrnStatus.Head.TradeDiv != ItemConst.TRAN_DIV.NORMAL) { sQuery = " UPDATE POSMST..MST_KTCH_ORD_MSG "; sQuery += " SET CANCEL_DIV = '" + PosConst.CANCEL_DIV.CANCEL +"' "; sQuery += " , SEND_YN = CASE WHEN SEND_YN = '0' THEN '9' ELSE '0' END "; sQuery += " , SEND_CONFIRM_DIV = '0' "; sQuery += " , RESEND_YN = '0' "; sQuery += " , ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' "; // Add, 2017.04.08 sQuery += " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02 sQuery += " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' "; sQuery += " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' "; sQuery += " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; if(m_cSqlDbService.DBExecuteNonQuery(new string[] {sQuery}) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } } else { #region ### 주방데이터 초기화 // 주방데이터 초기화 if (((Column.TR_PLU.DATA)alPluItem[0]).ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) { // 주방데이터 삭제 sQuery = " DELETE FROM POSMST..MST_KTCH_ORD_MSG "; sQuery += " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02 sQuery += " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' "; sQuery += " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' "; sQuery += " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } // 추가 주방데이터 삭제 sQuery = " DELETE FROM POSMST..MST_KTCH_ORD_MSG_ADD "; sQuery += " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02 sQuery += " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' "; sQuery += " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' "; sQuery += " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } // KPS 주방데이터 삭제 sQuery = " DELETE FROM POSMST..MST_KPS_ORD_MSG "; sQuery += " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02 sQuery += " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' "; sQuery += " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' "; sQuery += " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } // 좌석메모 데이터 삭제 sQuery = " DELETE FROM POSMST..MST_SEAT_MEMO " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.02 + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' " + " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } } #endregion #region ### Query string format sInsQuery = " INSERT INTO POSMST..MST_KTCH_ORD_MSG "; sInsQuery += " ( ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV "; sInsQuery += " , SET_MENU_CD, ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO "; sInsQuery += " , ORG_BILLDT, ORG_BILL_NO, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT, SUB_STOR_CD "; sInsQuery += " , TRAIN_MODE_YN "; // Add, 2017.03.02, 연습모드 sInsQuery += " , KTCH_MSG "; // Add, 2017.03.21 sInsQuery += " , ORD_PIC_NM "; // Add, 2017.03.28, 주문담당자 sInsQuery += " , ORG_QTY "; // Add, 2017.03.31 sInsQuery += " , ORD_POS_NO "; // Add, 2017.04.10 sInsQuery += " , KDS_SEND_YN "; // Add, 2017.04.26, KDS 전송구분 sInsQuery += " ) VALUES ( "; sInsQuery += " '{0}', '{1}', '{2}', {3}, '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', N'{13}', {14}, '{15}' "; sInsQuery += " , '{16}', '{17}', '{18}', '{19}', N'{20}', N'{21}', N'{22}', '{23}', '{24}' "; sInsQuery += " , '{25}', '{26}', '{27}', '{28}', '{29}', '{30}', '{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}' "; sInsQuery += " , '{38}' "; // Add, 2017.03.02, 연습모드 sInsQuery += " , N'{39}' "; // Add, 2017.03.21 sInsQuery += " , N'{40}' "; // Add, 2017.03.28, 주문담당자 sInsQuery += " , {41} "; // Add, 2017.03.31 sInsQuery += " , '{42}' "; // Add, 2017.04.10 sInsQuery += " , '{43}' "; // Add, 2017.04.26, KDS 전송구분 sInsQuery += " ) "; sUpdQuery = " UPDATE POSMST..MST_KTCH_ORD_MSG "; sUpdQuery += " SET SALE_QTY = {0} "; sUpdQuery += " , PACK_DIV = '{1}' "; sUpdQuery += " , CANCEL_DIV = '{2}' "; sUpdQuery += " , SUB_MEMO_DIV = '{3}' "; sUpdQuery += " , MSG1 = N'{4}' "; sUpdQuery += " , MSG2 = N'{5}' "; sUpdQuery += " , MSG3 = N'{6}' "; sUpdQuery += " , MSG_REG_TIME = '{7}' "; sUpdQuery += " , SEND_YN = CASE WHEN SEND_YN = '0' THEN '9' ELSE '0' END "; sUpdQuery += " , SEND_CONFIRM_DIV = '{8}' "; sUpdQuery += " , RESEND_YN = '{9}' "; sUpdQuery += " , UPD_DT = '{10}' "; sUpdQuery += " , FILLER1 = '{15}' "; // Add, 2017.01.18, 수동출력 sUpdQuery += " , FILLER3 = '{16}' "; // Add, 2017.02.29, 신규/추가/삭제 주문구분 sUpdQuery += " , KTCH_MSG = N'{18}' "; // Add, 2017.03.21 sUpdQuery += " , ORG_QTY = {19} "; // Add, 2017.03.31 sUpdQuery += " , ORD_POS_NO = '{20}' "; // Add, 2017.04.10 sUpdQuery += " WHERE ORD_DIV = '{11}' AND FLOOR_CD = '{12}' AND TBL_NO = '{13}' AND SEQ = {14} "; sUpdQuery += " AND TRAIN_MODE_YN = '{17}' "; // Add, 2017.03.01, 연습모드 sUpdQuery2 = " UPDATE POSMST..MST_KTCH_ORD_MSG "; sUpdQuery2 += " SET SALE_QTY = {0} "; sUpdQuery2 += " , PACK_DIV = '{1}' "; sUpdQuery2 += " , CANCEL_DIV = '{2}' "; sUpdQuery2 += " , SUB_MEMO_DIV = '{3}' "; sUpdQuery2 += " , MSG1 = N'{4}' "; sUpdQuery2 += " , MSG2 = N'{5}' "; sUpdQuery2 += " , MSG3 = N'{6}' "; sUpdQuery2 += " , MSG_REG_TIME = '{7}' "; sUpdQuery2 += " , SEND_YN = '0' "; sUpdQuery2 += " , SEND_CONFIRM_DIV = '{8}' "; sUpdQuery2 += " , RESEND_YN = '{9}' "; sUpdQuery2 += " , UPD_DT = '{10}' "; sUpdQuery2 += " , FILLER1 = '{15}' "; // Add, 2017.01.18, 수동출력 sUpdQuery2 += " , FILLER3 = '{16}' "; // Add, 2017.02.29, 신규/추가/삭제 주문구분 sUpdQuery2 += " , KTCH_MSG = N'{18}' "; // Add, 2017.03.21 sUpdQuery2 += " , ORG_QTY = {19} "; // Add, 2017.03.31 sUpdQuery2 += " , ORD_POS_NO = '{20}' "; // Add, 2017.04.10 sUpdQuery2 += " WHERE ORD_DIV = '{11}' AND FLOOR_CD = '{12}' AND TBL_NO = '{13}' AND SEQ = {14} "; sUpdQuery2 += " AND TRAIN_MODE_YN = '{17}' "; // Add, 2017.03.01, 연습모드 #endregion int iSeq2 = 0; for(int nLoop = 0;nLoop < alPluItem.Count;nLoop++) { Column.TR_PLU.DATA cPluItem = (Column.TR_PLU.DATA)alPluItem[nLoop]; var itemMemoRegTime = string.Empty; var temp = cPluItem.ITEM_MEMO_1 + cPluItem.ITEM_MEMO_2 + cPluItem.ITEM_MEMO_3; if (string.IsNullOrWhiteSpace(temp) == false) itemMemoRegTime = DateTime.Now.ToString("HHmmss"); // 주방프린트 수동출력 사용자 선택값 (add, 2017.01.18) var menualOrderValue = string.Empty; var menualMsgRegTime = string.Empty; var menualOrderMemo = string.Empty; if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "1") { // 장치코드 또는 NOPRINT menualOrderValue = string.IsNullOrWhiteSpace(m_cTrnStatus.Sale.MenualOrderValue) ? "NOPRINT" : m_cTrnStatus.Sale.MenualOrderValue; } else if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "2") { // 선택상품코드 또는 NOPRINT int idx = m_cTrnStatus.Sale.MenualOrderValue.IndexOf(nLoop.ToString()); menualOrderValue = idx < 0 ? "NOPRINT" : "PRINT"; // Del, 2017.04.25, 주방메모 출력 (대기번호 입력) // 주방메모 //if (menualOrderValue != "NOPRINT" && string.IsNullOrWhiteSpace(m_cTrnStatus.Sale.MenualOrderMemo) == false) //{ // menualOrderMemo = m_cTrnStatus.Sale.MenualOrderMemo.Trim(); // menualMsgRegTime = DateTime.Now.ToString("HHmmss"); //} } // Add, 2017.04.25, 주방메모 출력 (대기번호 입력) if (menualOrderValue != "NOPRINT" && string.IsNullOrWhiteSpace(m_cTrnStatus.Sale.MenualOrderMemo) == false) { menualOrderMemo = m_cTrnStatus.Sale.MenualOrderMemo.Trim(); menualMsgRegTime = DateTime.Now.ToString("HHmmss"); } // 신규,추가,삭제 구분 체크 string addOrdFlag = string.Empty; if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) { addOrdFlag = "DEL"; } // Mod, 2017.04.24, 주문완료 후 할인(무료) 등록 시 주방출력되는 버그 수정 //else if (cPluItem.SALE_QTY - cPluItem.ORG_QTY < 0) //{ // addOrdFlag = "DEL"; //} //else if (cPluItem.ORG_QTY > 0) //{ // addOrdFlag = "ADD"; //} else if (cPluItem.ORG_QTY > 0) { if (cPluItem.SALE_QTY - cPluItem.ORG_QTY < 0) { addOrdFlag = "DEL"; } else if (cPluItem.SALE_QTY - cPluItem.ORG_QTY > 0) { addOrdFlag = "ADD"; } else if (cPluItem.SALE_QTY - cPluItem.ORG_QTY == 0) { // 수량변경이 없는 상품은 KPS/KDS(MST_KTCH_ORD_MSG)에 변경처리 하지 않는다. if (cPluItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_MOD) cPluItem.ORDER_OK_FLAG = PosConst.PLU_ORDER_OK_FLAG.ORDER_OK; } } else if (cPluItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.NORMAL || cPluItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.SET_MAIN) { for (var i = 0; i < nLoop; i++) { Column.TR_PLU.DATA checkItem = (Column.TR_PLU.DATA)alPluItem[i]; if (checkItem.ITEM_DIV != ItemConst.PLU_ITEM_DIV.NORMAL && checkItem.ITEM_DIV != ItemConst.PLU_ITEM_DIV.SET_MAIN) continue; if (checkItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) continue; if (checkItem.ITEM_PLU_CD == cPluItem.ITEM_PLU_CD) { addOrdFlag = "ADD"; break; } } if (string.IsNullOrWhiteSpace(addOrdFlag)) addOrdFlag = "NEW"; } if (cPluItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) { if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) continue; #region >> INSERT INTO POSMST..MST_KTCH_ORD_MSG sQuery = string.Format(sInsQuery , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , (iSeq2 + 1).ToString() , m_cTrnStatus.Head.CmpCd // CMP_CD , m_cPosStatus.Base.BrandCd // BRAND_CD , m_cTrnStatus.Head.StoreCd // STOR_CD , m_cTrnStatus.Head.PosNo // POS_NO //, m_cTrnStatus.Head.TradeNo // TRADE_NO , cPluItem.ORDER_NO // Mod, 2017.04.11, 주문번호 , m_cTrnStatus.Head.SaleDate // SALE_DT , m_cPosStatus.Base.PosType //, (cPluItem.SUBPRC_MENU_KEY_DIV != "1" ? cPluItem.ITEM_PLU_CD : ((Column.TR_PLU.DATA)alPluItem[iSeq2 - 1]).ITEM_PLU_CD) , cPluItem.SUBPRC_MENU_KEY_DIV == "1" ? cPluItem.SUB_MENU_MAIN_CD : cPluItem.ITEM_PLU_CD , cPluItem.ITEM_DIV , CmUtil.LeftH(cPluItem.ITEM_NAME, 30) , cPluItem.SALE_QTY.ToString() , cPluItem.PACK_DIV , cPluItem.SET_MENU_CD , cPluItem.ORD_TIME // 주문시간 , cPluItem.CANCEL_DIV , cPluItem.SUBPRC_MENU_KEY_DIV , ConvertDBStr(cPluItem.ITEM_MEMO_1) , ConvertDBStr(cPluItem.ITEM_MEMO_2) , ConvertDBStr(cPluItem.ITEM_MEMO_3) , itemMemoRegTime , string.Empty , string.Empty , string.Empty , cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL ? "9" : "0" , "0" , "0" , menualOrderValue // FILLER1 Add, 2017.01.18, 수동출력 , string.Empty // FILLER2 기타주문구분 , addOrdFlag // FILLER3 Add, 2017.02.29, 추가주문구분 NEW,ADD,DEL , string.Empty // FILLER4 VIP 구분 (KDS에서 사용) , cPluItem.ORDER_SEQ // FILLER5 Add, 2017.04.11, 주문차수 , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") , cPluItem.SUB_SHOP_CD // Add, 2017.02.02, 서버매장코드 , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , ConvertDBStr(menualOrderMemo) // Add, 2017.03.21 , m_cTrnStatus.Head.OrderPicNm // Add, 2017.03.28, 주문담당자 , cPluItem.ORG_QTY // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 , "0" // Add, 2017.04.26, KDS 전송구분 ); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } #endregion } else if (cPluItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_MOD) { #region >> UPDATE POSMST..MST_KTCH_ORD_MSG if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) { sQuery = string.Format(sUpdQuery , cPluItem.ORG_QTY , cPluItem.PACK_DIV , cPluItem.CANCEL_DIV , cPluItem.SUBPRC_MENU_KEY_DIV , ConvertDBStr(cPluItem.ITEM_MEMO_1) , ConvertDBStr(cPluItem.ITEM_MEMO_2) , ConvertDBStr(cPluItem.ITEM_MEMO_3) , itemMemoRegTime , "0" , "0" , DateTime.Now.ToString("yyyyMMddHHmmss") , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , (iSeq2 + 1).ToString() , menualOrderValue // Add, 2017.01.18, 수동출력 , addOrdFlag // Add, 2017.02.29, 추가주문구분 NEW,ADD,DEL , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , ConvertDBStr(menualOrderMemo) // Add, 2017.03.21 , 0 // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); } else { sQuery = string.Format(sUpdQuery2 , cPluItem.SALE_QTY.ToString() , cPluItem.PACK_DIV , cPluItem.CANCEL_DIV , cPluItem.SUBPRC_MENU_KEY_DIV , ConvertDBStr(cPluItem.ITEM_MEMO_1) , ConvertDBStr(cPluItem.ITEM_MEMO_2) , ConvertDBStr(cPluItem.ITEM_MEMO_3) , itemMemoRegTime , "0" , "0" , DateTime.Now.ToString("yyyyMMddHHmmss") , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , (iSeq2 + 1).ToString() , menualOrderValue // Add, 2017.01.18, 수동출력 , addOrdFlag // Add, 2017.02.29, 추가주문구분 NEW,ADD,DEL , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , ConvertDBStr(menualOrderMemo) // Add, 2017.03.21 , cPluItem.ORG_QTY // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); } if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } #endregion } cPluItem.ORDER_OK_FLAG = PosConst.PLU_ORDER_OK_FLAG.ORDER_OK; iSeq2++; } } #endregion } // Commit m_cSqlDbService.Commit(); // 추가 주방메시지 테이블 저장 처리 UpdateKtchOrderMsgExecute(); if ((bUpdate == true || bOrdUpdate == true) && m_cTrnStatus.Head.OrderFlag == PosConst.ORDER_TYPE.NORMAL) { // 주문 내역서 출력 처리 ISaleCompleteUs cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE); sReturn = cSaleComplete.ExecuteOrderBillReceipt(); } sReturn = UserCom.RST_OK; } catch (Exception ex) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 테이블그룹 관련 테이블마스터 Update (다중선택) /// /// /// public string UpdateTableGroup(string selectedTables) { try { string[] tables = selectedTables.Split(','); if (tables.Length < 2) { return UserCom.RST_IGNORE + POS_MESSAGE.ERROR.MSG_0142; } string[] t = tables[0].Trim().Split('-'); string opFloorCd = t[0].Trim(); string opTableNo = t[1].Trim(); for (var i = 0; i < tables.Length; i++) { tables[i] = string.Format("'{0}'", tables[i]); } string inString = string.Join(",", tables); string sql = string.Empty; string fmt = string.Empty; // Transaction Begin m_cSqlDbService.Begin(); // Add, 2017.02.17 fmt = "SELECT MAX(FILLER3) AS SEQ FROM MST_TBL \n" + " WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' AND TBL_OP_DIV = '{3}' AND ISNUMERIC(FILLER3) = 1 "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , PosConst.TABLE_OP_FLAG.OP_GROUP); DataTable dt = null; if (m_cSqlDbService.DBSelect(sql, out dt) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sql + "[ERROR]"); return UserCom.RST_ERR; } var groupSeq = CmUtil.GetDataRowInt(dt.Rows[0], "SEQ") + 1; fmt = "UPDATE POSMST..MST_TBL \n" + " SET TBL_OP_DIV = '{5}' \n" + " , OP_FLOOR_CD = '{6}' \n" + " , OP_TBL_NO = '{7}' \n" + " , FILLER3 = '{8}' \n" + " WHERE CMP_CD = '{0}' \n" + " AND STOR_CD = '{1}' \n" + " AND TRAIN_MODE_YN = '{2}' \n" // Add, 2017.03.02, 연습모드 + " AND FLOOR_CD + '-' + TBL_NO IN ( {3} ) \n" + " AND USE_YN = '{4}' \n"; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , inString , PosConst.MST_USE_YN.YES , PosConst.TABLE_OP_FLAG.OP_GROUP , opFloorCd , opTableNo , groupSeq.ToString() ); if (m_cSqlDbService.DBExecuteNonQuery(sql) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sql + "[ERROR]"); return UserCom.RST_ERR; } // Commit m_cSqlDbService.Commit(); return UserCom.RST_OK; } catch (Exception ex) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return UserCom.RST_ERR + ex.Message; } } /// /// 테이블그룹 해제 (전체해제) /// /// /// /// public string UpdateTableGroupClear(string opGroupFloorCd, string opGroupTableNo) { try { string fmt = "UPDATE POSMST..MST_TBL \n" + " SET TBL_OP_DIV = '{6}' \n" + " , OP_FLOOR_CD = '' \n" + " , OP_TBL_NO = '' \n" + " , FILLER3 = '' \n" + " WHERE CMP_CD = '{0}' \n" + " AND STOR_CD = '{1}' \n" + " AND TRAIN_MODE_YN = '{2}' \n" // Add, 2017.03.02, 연습모드 + " AND OP_FLOOR_CD = '{3}' \n" + " AND OP_TBL_NO = '{4}' \n" + " AND USE_YN = '{5}' " ; string sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , opGroupFloorCd , opGroupTableNo , PosConst.MST_USE_YN.YES , PosConst.TABLE_OP_FLAG.OP_NONE); // Transaction Begin m_cSqlDbService.Begin(); if (m_cSqlDbService.DBExecuteNonQuery(sql) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sql + "[ERROR]"); return UserCom.RST_ERR; } // Commit m_cSqlDbService.Commit(); return UserCom.RST_OK; } catch (Exception ex) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return UserCom.RST_ERR + ex.Message; } } /// /// 테이블합석 /// /// From Floor /// From Table /// To Floor /// To Table /// public string UpdateTableAdd(string sFromFloorCd, string sFromTableNo, string sToFloorCd, string sToTableNo) { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; int nMaxSeqNo = 0; try { DataTable dtReturn = null; Column.MST_TABLE.TABLE_DATA cFromTable = new Column.MST_TABLE.TABLE_DATA(); // 원본데이블 정보 조회 dtReturn = null; if (this.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_NO_FLOOR_CD_SEARCH, sFromFloorCd, sFromTableNo }, out dtReturn) != UserCom.RST_OK) { return UserCom.RST_ERR; } this.SetTableInfo(dtReturn.Rows[0], ref cFromTable); // 주방장치조회 List lstKps = new List(); dtReturn = null; int cnt = this.GetKtchDivece(sFromFloorCd, sFromTableNo, string.Empty, out dtReturn); if (cnt > 0) { foreach(DataRow dr in dtReturn.Rows) { var devKey = string.Format("{0},{1}", CmUtil.GetDataRowStr(dr, "SUB_STOR_CD"), CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD")); lstKps.Add(devKey); } } // Max Sequence MST_KTCH_ORD_MSG_ADD sQuery = "SELECT ISNULL(MAX(SEQ), 0) AS SEQ \n" + " FROM POSMST..MST_KTCH_ORD_MSG_ADD \n" + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' \n" + " AND FLOOR_CD = '" + sFromFloorCd + "' \n" + " AND TBL_NO = '" + sFromTableNo + "' "; dtReturn = null; if(m_cSqlDbService.DBSelect(sQuery, out dtReturn) == UserCom.OK) { if(dtReturn != null && dtReturn.Rows.Count > 0) { nMaxSeqNo = CmUtil.GetDataRowInt(dtReturn.Rows[0], "SEQ"); } } nMaxSeqNo++; // 객층 및 고객상세 정보 var custAge = string.Empty; var custLst = string.Empty; var groupIdx = string.Empty; int[] custArray = null; sQuery = "SELECT CASE WHEN FLOOR_CD + TBL_NO = '" + sToFloorCd + sToTableNo + "' THEN 0 ELSE 1 END SEQ \n" + " , FLOOR_CD, TBL_NO, CUST_CNT, FILLER1, FILLER2 \n" + " FROM POSMST..MST_TBL \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND FLOOR_CD + TBL_NO IN ('" + sFromFloorCd + sFromTableNo + "','" + sToFloorCd + sToTableNo + "' ) \n" + " ORDER BY SEQ DESC "; dtReturn = null; if (m_cSqlDbService.DBSelect(sQuery, out dtReturn) == UserCom.OK) { foreach(DataRow dr in dtReturn.Rows) { // 객층 if (string.IsNullOrWhiteSpace(custAge)) { custAge = CmUtil.GetDataRowStr(dr, "FILLER1").Trim(); } // 고객정보 var temp = CmUtil.GetDataRowStr(dr, "FILLER2").Split('|'); if (temp.Length >= 10) { if (custArray == null) custArray = new int[10]; for (var i = 0; i < custArray.Length; i++) { custArray[i] += CmUtil.IntParse(temp[i]); } } } } if (custArray != null) { custLst = string.Join("|", custArray); } // Transaction Begin m_cSqlDbService.Begin(); // Source Table Init sQuery = "UPDATE POSMST..MST_TBL \n" + " SET TBL_USE_DIV = '" + PosConst.TABLE_USE_FLAG.NO_USE + "' \n" + " , CUST_CNT = 0 \n" + " , FIRST_ORD_HOUR = '' \n" + " , ORD_AMT = 0 \n" + " , TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_NONE + "' \n" + " , OP_FLOOR_CD = '' \n" + " , OP_TBL_NO = '' \n" + " , FILLER1 = '' \n" + " , FILLER2 = '' \n" + " , FILLER3 = '' \n" // 테이블그룹 인덱스 + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND FLOOR_CD = '" + sFromFloorCd + "' \n" + " AND TBL_NO = '" + sFromTableNo + "' \n" + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n" ; if(m_cSqlDbService.DBExecuteNonQuery(new string[] {sQuery}) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } // Combine Table Update sQuery = "UPDATE POSMST..MST_TBL \n" + " SET ORD_AMT = ORD_AMT + " + cFromTable.ORDER_AMT.ToString() + " \n" + " , CUST_CNT = CUST_CNT + " + cFromTable.CUST_CNT.ToString() + " \n" + " , TBL_OP_DIV = '" + cFromTable.OP_FLAG + "' \n" + " , OP_FLOOR_CD = '" + cFromTable.OP_FLOOR_CD + "' \n" + " , OP_TBL_NO = '" + cFromTable.OP_TABLE_NO + "' \n" + " , FILLER1 = '" + custAge + "' \n" + " , FILLER2 = '" + custLst + "' \n" //+ " , FILLER3 = '" + cFromTable.TABLE_GROUP_INDEX + "' \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND FLOOR_CD = '" + sToFloorCd + "' \n" + " AND TBL_NO = '" + sToTableNo + "' \n" + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n" ; if(m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } // Combine Table Order Item Insert sQuery = "INSERT INTO POSMST..MST_ORD \n" + " ( CMP_CD, STOR_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ, SUB_STOR_CD \n" + " , ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, SALE_PRC, SALE_AMT, BILL_AMT, DC_DIV, DC_RATE, ITEM_DC_AMT, SUM_DC_AMT \n" + " , CPI_DC_AMT, COOP_CARD_DC_DIV, COOP_CARD_DC_AMT, POINT_DC_DIV, POINT_DC_AMT, CPN_DC_DIV, CPN_DC_AMT, EMP_DC_DIV \n" + " , EMP_DC_AMT, SET_DC_AMT, ETC_DC_DIV, ETC_DC, EXCEP_DC_DIV, EXCEP_DC_AMT, PACK_DIV, SET_MENU_CD, CPI_PRESENT_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3 \n" + " , MSG_REG_TIME, ORD_TIME, ORD_COMP_DIV, ORD_PIC_NO, CANCEL_DIV, CANCEL_DATE, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 \n" //+ " , UPD_DT, REG_DT, NOTAX_DIV ) \n" + " , UPD_DT, REG_DT, NOTAX_DIV, TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 + " , DC_TYPE \n" // Add, 2017.03.30 + " , ORG_QTY \n" // Add, 2017.03.31 + " , ORD_POS_NO \n" // Add, 2017.04.10 + " ) \n" + "SELECT CMP_CD, STOR_CD, ORD_DIV \n" + " , '" + sToFloorCd + "' \n" + " , '" + sToTableNo + "' \n" + " , (SELECT ISNULL(MAX(SEQ), 0) FROM POSMST..MST_ORD WHERE ORD_DIV = '0' AND FLOOR_CD = '" + sToFloorCd + "' AND TBL_NO = '" + sToTableNo + "') + SEQ AS SEQ \n" + " , SUB_STOR_CD \n" + " , ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, SALE_PRC, SALE_AMT, BILL_AMT, DC_DIV, DC_RATE, ITEM_DC_AMT, SUM_DC_AMT \n" + " , CPI_DC_AMT, COOP_CARD_DC_DIV, COOP_CARD_DC_AMT, POINT_DC_DIV, POINT_DC_AMT, CPN_DC_DIV, CPN_DC_AMT, EMP_DC_DIV \n" + " , EMP_DC_AMT, SET_DC_AMT, ETC_DC_DIV, ETC_DC, EXCEP_DC_DIV, EXCEP_DC_AMT, PACK_DIV, SET_MENU_CD, CPI_PRESENT_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3 \n" + " , MSG_REG_TIME, ORD_TIME, ORD_COMP_DIV, ORD_PIC_NO, CANCEL_DIV, CANCEL_DATE, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 \n" + " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n" + " , REG_DT, NOTAX_DIV \n" + " , TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 + " , DC_TYPE \n" // Add, 2017.03.30 + " , ORG_QTY \n" // Add, 2017.03.31 + " , '" + m_cPosStatus.Base.PosNo + "' \n" // Add, 2017.04.10 + " FROM POSMST..MST_ORD \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' " + " AND FLOOR_CD = '" + sFromFloorCd + "' \n" + " AND TBL_NO = '" + sFromTableNo + "' \n" + " ORDER BY SEQ \n" ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } // Source Table Order Item Delete sQuery = "DELETE FROM POSMST..MST_ORD \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' \n" + " AND FLOOR_CD = '" + sFromFloorCd + "' \n" + " AND TBL_NO = '" + sFromTableNo + "' \n" ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } // Kitchen Order Message Insert sQuery = "INSERT INTO POSMST..MST_KTCH_ORD_MSG \n" + " ( ORD_DIV, FLOOR_CD, TBL_NO, SEQ \n" + " , CMP_CD, BRAND_CD, STOR_CD, SUB_STOR_CD, POS_NO, TRADE_NO, SALE_DT \n" + " , POS_TYPE , ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD, ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV \n" + " , MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO, ORG_BILLDT, ORG_BILL_NO, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 \n" //+ " , UPD_DT, REG_DT ) \n" //+ " , UPD_DT, REG_DT, TRAIN_MODE_YN ) \n" // Add, 2017.03.02, 연습모드 + " , UPD_DT, REG_DT, TRAIN_MODE_YN, KTCH_MSG \n" // Add, 2017.03.21 + " , ORG_QTY \n" // Add, 2017.03.31 + " , ORD_POS_NO \n" // Add, 2017.04.10 + " , ORD_PIC_NM \n" // Add, 2017.04.26, 주문담당자 + " , KDS_SEND_YN \n" // Add, 2017.04.26, KDS 전송구분 + " ) \n" + "SELECT ORD_DIV, '" + sToFloorCd + "', '" + sToTableNo + "' \n" + " , (SELECT ISNULL(MAX(SEQ), 0) FROM POSMST..MST_KTCH_ORD_MSG WHERE ORD_DIV = '0' AND FLOOR_CD = '" + sToFloorCd + "' AND TBL_NO = '" + sToTableNo + "') + SEQ AS SEQ \n" + " , CMP_CD, BRAND_CD, STOR_CD, SUB_STOR_CD, POS_NO, TRADE_NO, SALE_DT \n" + " , POS_TYPE , ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD, ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV \n" + " , MSG1, MSG2, MSG3, MSG_REG_TIME, '', '', '', SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 \n" + " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n" + " , REG_DT \n" + " , TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 + " , KTCH_MSG \n" // Add, 2017.03.21 + " , ORG_QTY \n" // Add, 2017.03.31 + " , ORD_POS_NO \n" // Add, 2017.04.10 + " , ORD_PIC_NM \n" // Add, 2017.04.26, 주문담당자 + " , KDS_SEND_YN \n" // Add, 2017.04.26, KDS 전송구분 + " FROM POSMST..MST_KTCH_ORD_MSG \n" + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' \n" + " AND FLOOR_CD = '" + sFromFloorCd + "' \n" + " AND TBL_NO = '" + sFromTableNo + "' \n" + " ORDER BY SEQ \n" ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } // Kitchen Order Message Delete sQuery = "DELETE FROM POSMST..MST_KTCH_ORD_MSG \n" + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연스모드 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' \n" + " AND FLOOR_CD = '" + sFromFloorCd + "' \n" + " AND TBL_NO = '" + sFromTableNo + "' \n" ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } // 좌석메모 이동 string fmt = "UPDATE POSMST..MST_SEAT_MEMO \n" + " SET FLOOR_CD = '{6}' \n" + " , TBL_NO = '{7}' \n" + " , SEQ = SEQ + (SELECT ISNULL(MAX(SEQ), 0) FROM MST_SEAT_MEMO \n" + " WHERE CMP_CD = '{0}' \n" + " AND STOR_CD = '{1}' \n" + " AND TRAIN_MODE_YN = '{2}' \n" + " AND ORD_DIV = '{3}' \n" + " AND FLOOR_CD = '{6}' \n" + " AND TBL_NO = '{7}')\n" + " WHERE CMP_CD = '{0}' \n " + " AND STOR_CD = '{1}' \n" + " AND TRAIN_MODE_YN = '{2}' \n " + " AND ORD_DIV = '{3}' \n" + " AND FLOOR_CD = '{4}' \n" + " AND TBL_NO = '{5}' " ; sQuery = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL , sFromFloorCd, sFromTableNo, sToFloorCd, sToTableNo); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } // Kitchen Order Message for (int i = 0; i < lstKps.Count; i++) { string[] ktchDev = lstKps[i].Split(','); if (ktchDev.Length < 2) continue; sQuery = " INSERT INTO POSMST..MST_KTCH_ORD_MSG_ADD "; sQuery += " ( TRAIN_MODE_YN "; // Add, 2017.03.02, 연습모드 sQuery += " , ORD_DIV "; sQuery += " , FLOOR_CD "; sQuery += " , TBL_NO "; sQuery += " , SEQ "; sQuery += " , SUB_STOR_CD "; sQuery += " , KTCH_SYS_CD "; sQuery += " , MSG_DIV "; sQuery += " , MSG1 "; sQuery += " , MSG2 "; sQuery += " , MSG3 "; sQuery += " , MSG_REG_TIME "; sQuery += " , SEND_YN "; sQuery += " , SEND_CONFIRM_DIV "; sQuery += " , RESEND_YN "; sQuery += " , FILLER1 "; sQuery += " , FILLER2 "; sQuery += " , FILLER3 "; sQuery += " , FILLER4 "; sQuery += " , FILLER5 "; sQuery += " , UPD_DT "; sQuery += " , REG_DT "; sQuery += " , ORD_POS_NO "; // Add, 2017.04.10 sQuery += " ) "; sQuery += " VALUES "; sQuery += " ( '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02, 연습모드 sQuery += " , '" + PosConst.ORDER_TYPE.NORMAL + "' "; sQuery += " , '" + sFromFloorCd + "' "; sQuery += " , '" + sFromTableNo + "' "; sQuery += " , " + nMaxSeqNo + " "; sQuery += " , '" + ktchDev[0].Trim() + "' "; sQuery += " , '" + ktchDev[1].Trim() + "' "; sQuery += " , '" + PosConst.KPS_ORD_MSG_ID.TABLE_COMBINE + "' "; sQuery += " , '" + sToFloorCd + "' "; sQuery += " , '" + sToTableNo + "' "; sQuery += " , '' "; sQuery += " , '" + DateTime.Now.ToString("HHmmss") + "' "; sQuery += " , '0' "; sQuery += " , '0' "; sQuery += " , '0' "; sQuery += " , '' "; sQuery += " , '' "; sQuery += " , '' "; sQuery += " , '' "; sQuery += " , '' "; sQuery += " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' "; sQuery += " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' "; sQuery += " , '" + m_cPosStatus.Base.PosNo + "' "; // Add, 2017.04.10 sQuery += ")"; // 주방출력삭제(2017.05.24) //m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }); nMaxSeqNo++; } // Commit m_cSqlDbService.Commit(); // 합석테이블 주문내역서 출력 this.ExecuteOrderBillReceipt(sToFloorCd, sToTableNo); sReturn = UserCom.RST_OK; } catch (Exception ex) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 테이블이동 /// /// /// /// /// /// public string UpdateTableMove(string sFromFloorCd, string sFromTableNo, string sToFloorCd, string sToTableNo) { string sReturn = UserCom.RST_ERR; try { string fmt = string.Empty; string sql = string.Empty; DataTable dtReturn = null; List lstQuery = new List(); #region 이동테이블 정보 조회 // 1st 테이블 dtReturn = null; Column.MST_TABLE.TABLE_DATA cTable1st = new Column.MST_TABLE.TABLE_DATA(); if (SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_NO_FLOOR_CD_SEARCH, sFromFloorCd, sFromTableNo }, out dtReturn) != UserCom.RST_OK) { return UserCom.RST_ERR; } this.SetTableInfo(dtReturn.Rows[0], ref cTable1st); // 2nd 테이블 dtReturn = null; Column.MST_TABLE.TABLE_DATA cTable2nd = new Column.MST_TABLE.TABLE_DATA(); if (SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_NO_FLOOR_CD_SEARCH, sToFloorCd, sToTableNo }, out dtReturn) != UserCom.RST_OK) { return UserCom.RST_ERR; } this.SetTableInfo(dtReturn.Rows[0], ref cTable2nd); // 미주문 테이블 확인 if (cTable2nd.ORDER_AMT == 0 && cTable2nd.CUST_CNT == 0 && string.IsNullOrWhiteSpace(cTable2nd.FIRST_ORDER_TIME)) { cTable2nd = null; } #endregion #region 주방장치 정보 조회 List lstKps = new List(); dtReturn = null; if (this.GetKtchDivece(sFromFloorCd, sFromTableNo, string.Empty, out dtReturn) > 0) { foreach (DataRow dr in dtReturn.Rows) { var devKey = string.Format("{0},{1}", CmUtil.GetDataRowStr(dr, "SUB_STOR_CD"), CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD")); if (lstKps.Contains(devKey) == false) lstKps.Add(devKey); } } dtReturn = null; if (this.GetKtchDivece(sToFloorCd, sToTableNo, string.Empty, out dtReturn) > 0) { foreach (DataRow dr in dtReturn.Rows) { var devKey = string.Format("{0},{1}", CmUtil.GetDataRowStr(dr, "SUB_STOR_CD"), CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD")); if (lstKps.Contains(devKey) == false) lstKps.Add(devKey); } } #endregion #region 주문 정보 조회 // 주문정보 int ret = -9; DataTable dtOrder1st = null; DataTable dtOrder2nd = null; fmt = "SELECT * FROM POSMST..MST_ORD WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' AND ORD_DIV = '{3}' AND FLOOR_CD = '{4}' AND TBL_NO = '{5}' "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sFromFloorCd, sFromTableNo); ret = m_cSqlDbService.DBSelect(sql, out dtOrder1st); if (ret != UserCom.OK) return UserCom.RST_ERR; if (cTable2nd != null) { sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sToFloorCd, sToTableNo); ret = m_cSqlDbService.DBSelect(sql, out dtOrder2nd); if (ret != UserCom.OK && ret != UserCom.NG) return UserCom.RST_ERR; } #endregion #region 주방메시지 정보 조회 DataTable dtKtchMsg1st = null; DataTable dtKtchMsg2nd = null; fmt = "SELECT * FROM POSMST..MST_KTCH_ORD_MSG WHERE TRAIN_MODE_YN = '{0}' AND ORD_DIV = '{1}' AND FLOOR_CD = '{2}' AND TBL_NO = '{3}' "; sql = string.Format(fmt, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sFromFloorCd, sFromTableNo); ret = m_cSqlDbService.DBSelect(sql, out dtKtchMsg1st); if (ret != UserCom.OK && ret != UserCom.NG) return UserCom.RST_ERR; if (cTable2nd != null) { sql = string.Format(fmt, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sToFloorCd, sToTableNo); ret = m_cSqlDbService.DBSelect(sql, out dtKtchMsg2nd); if (ret != UserCom.OK && ret != UserCom.NG) return UserCom.RST_ERR; } #endregion #region 좌석메모 정보 조회 // 좌석메모 정보 조회 DataTable dtSeatMsg1st = null; DataTable dtSeatMsg2nd = null; fmt = "SELECT * FROM POSMST..MST_SEAT_MEMO WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' AND ORD_DIV = '{3}' AND FLOOR_CD = '{4}' AND TBL_NO = '{5}' "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sFromFloorCd, sFromTableNo); ret = m_cSqlDbService.DBSelect(sql, out dtSeatMsg1st); if (cTable2nd != null) { sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sToFloorCd, sToTableNo); ret = m_cSqlDbService.DBSelect(sql, out dtSeatMsg2nd); } #endregion #region 테이블정보 업데이트 // 테이블정보 업데이트 fmt = "UPDATE POSMST..MST_TBL \n" + " SET TBL_USE_DIV = '{5}' \n" + " , CUST_CNT = {6} \n" + " , FIRST_ORD_HOUR = '{7}' \n" + " , ORD_AMT = {8} \n" + " , TBL_OP_DIV = '{9}' \n" + " , OP_FLOOR_CD = '{10}' \n" + " , OP_TBL_NO = '{11}' \n" + " , FILLER1 = '{12}' \n" + " , FILLER2 = '{13}' \n" + " , FILLER3 = '{14}' \n" + " WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' AND FLOOR_CD = '{3}' AND TBL_NO = '{4}' \n"; // 1st Table sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , sFromFloorCd, sFromTableNo , PosConst.TABLE_USE_FLAG.NO_USE , cTable2nd == null ? 0 : cTable2nd.CUST_CNT , cTable2nd == null ? "" : cTable2nd.FIRST_ORDER_TIME , cTable2nd == null ? 0 : cTable2nd.ORDER_AMT , cTable2nd == null ? "" : cTable2nd.OP_FLAG , cTable2nd == null ? "" : cTable2nd.OP_FLOOR_CD , cTable2nd == null ? "" : cTable2nd.OP_TABLE_NO , cTable2nd == null ? "" : cTable2nd.CUST_AGE , cTable2nd == null ? "" : cTable2nd.CUST_LST , cTable2nd == null ? "" : cTable2nd.GetGroupIndex() ); lstQuery.Add(sql); // 2nd Table sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , sToFloorCd, sToTableNo , PosConst.TABLE_USE_FLAG.NO_USE , cTable1st.CUST_CNT , cTable1st.FIRST_ORDER_TIME , cTable1st.ORDER_AMT , cTable1st.OP_FLAG , cTable1st.OP_FLOOR_CD , cTable1st.OP_TABLE_NO , cTable1st.CUST_AGE , cTable1st.CUST_LST , cTable1st.GetGroupIndex() ); lstQuery.Add(sql); #endregion #region 주문정보 업데이트 // 주문정보 초기화 fmt = "DELETE FROM POSMST..MST_ORD WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' AND ORD_DIV = '{3}' AND FLOOR_CD = '{4}' AND TBL_NO = '{5}' "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sFromFloorCd, sFromTableNo); lstQuery.Add(sql); sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sToFloorCd, sToTableNo); lstQuery.Add(sql); #region >> INSERT INTO POSMST..MST_ORD fmt = "INSERT INTO POSMST..MST_ORD ( \n" + " CMP_CD, STOR_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ, SUB_STOR_CD, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM\n" + " , SALE_QTY, SALE_PRC, SALE_AMT, BILL_AMT, DC_DIV, DC_RATE, ITEM_DC_AMT, SUM_DC_AMT, CPI_DC_AMT \n" + " , COOP_CARD_DC_DIV, COOP_CARD_DC_AMT, POINT_DC_DIV, POINT_DC_AMT, CPN_DC_DIV, CPN_DC_AMT \n" + " , EMP_DC_DIV, EMP_DC_AMT, SET_DC_AMT, ETC_DC_DIV, ETC_DC, EXCEP_DC_DIV, EXCEP_DC_AMT \n" + " , PACK_DIV, SET_MENU_CD, CPI_PRESENT_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME \n" + " , ORD_TIME, ORD_COMP_DIV, ORD_PIC_NO, CANCEL_DIV, CANCEL_DATE \n" + " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT, NOTAX_DIV \n" + " , TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 + " , DC_TYPE \n" // Add, 2017.03.30 + " , ORG_QTY \n" // Add, 2017.03.31 + " , ORD_POS_NO \n" // Add, 2017.04.10 + " ) VALUES ( \n" + " '{0}' \n" //@cmp_cd + " , '{1}' \n" //@stor_cd + " , '{2}' \n" //@ord_div + " , '{3}' \n" //@floor_cd + " , '{4}' \n" //@tbl_no + " , '{5}' \n" //@seq + " , '{6}' \n" //@sub_stor_cd + " , '{7}' \n" //@item_cd + " , '{8}' \n" //@item_div + " , '{9}' \n" //@shtcut_itemnm + " , {10} \n" //@sale_qty + " , {11} \n" //@sale_prc + " , {12} \n" //@sale_amt + " , {13} \n" //@bill_amt + " , '{14}' \n" //@dc_div + " , {15} \n" //@dc_rate + " , {16} \n" //@item_dc_amt + " , {17} \n" //@sum_dc_amt + " , {18} \n" //@cpi_dc_amt + " , '{19}' \n" //@coop_card_dc_div + " , {20} \n" //@coop_card_dc_amt + " , '{21}' \n" //@point_dc_div + " , {22} \n" //@point_dc_amt + " , '{23}' \n" //@cpn_dc_div + " , {24} \n" //@cpn_dc_amt + " , '{25}' \n" //@emp_dc_div + " , {26} \n" //@emp_dc_amt + " , {27} \n" //@set_dc_amt + " , '{28}' \n" //@etc_dc_div + " , {29} \n" //@etc_dc + " , '{30}' \n" //@excep_dc_div + " , {31} \n" //@excep_dc_amt + " , '{32}' \n" //@pack_div + " , '{33}' \n" //@set_menu_cd + " , '{34}' \n" //@cpi_present_div + " , '{35}' \n" //@sub_memo_div + " , '{36}' \n" //@msg1 + " , '{37}' \n" //@msg2 + " , '{38}' \n" //@msg3 + " , '{39}' \n" //@msg_reg_time + " , '{40}' \n" //@ord_time + " , '{41}' \n" //@ord_comp_div + " , '{42}' \n" //@ord_pic_no + " , '{43}' \n" //@cancel_div + " , '{44}' \n" //@cancel_date + " , '{45}' \n" //@filler1 + " , '{46}' \n" //@filler2 + " , '{47}' \n" //@filler3 + " , '{48}' \n" //@filler4 + " , '{49}' \n" //@filler5 + " , '{50}' \n" //@upd_dt + " , '{51}' \n" //@reg_dt + " , '{52}' \n" //@notax_div + " , '{53}' \n" // Add, 2017.03.02, 연습모드 + " , '{54}' \n" // Add, 2017.03.30 + " , {55} \n" // Add, 2017.03.31 + " , '{56}' \n" // Add, 2017.04.10 + " ) "; #endregion #region >> 주문정보 이동 (1st -> 2nd) if (dtOrder1st != null) { foreach (DataRow dr in dtOrder1st.Rows) { sql = string.Format(fmt, CmUtil.GetDataRowStr(dr, "CMP_CD ".Trim()) //@cmp_cd , CmUtil.GetDataRowStr(dr, "STOR_CD ".Trim()) //@stor_cd , CmUtil.GetDataRowStr(dr, "ORD_DIV ".Trim()) //@ord_div , sToFloorCd //@floor_cd , sToTableNo //@tbl_no , CmUtil.GetDataRowStr(dr, "SEQ ".Trim()) //@seq , CmUtil.GetDataRowStr(dr, "SUB_STOR_CD ".Trim()) //@sub_stor_cd , CmUtil.GetDataRowStr(dr, "ITEM_CD ".Trim()) //@item_cd , CmUtil.GetDataRowStr(dr, "ITEM_DIV ".Trim()) //@item_div , CmUtil.GetDataRowStr(dr, "SHTCUT_ITEMNM ".Trim()) //@shtcut_itemnm , CmUtil.GetDataRowStr(dr, "SALE_QTY ".Trim()) //@sale_qty , CmUtil.GetDataRowStr(dr, "SALE_PRC ".Trim()) //@sale_prc , CmUtil.GetDataRowStr(dr, "SALE_AMT ".Trim()) //@sale_amt , CmUtil.GetDataRowStr(dr, "BILL_AMT ".Trim()) //@bill_amt , CmUtil.GetDataRowStr(dr, "DC_DIV ".Trim()) //@dc_div , CmUtil.GetDataRowStr(dr, "DC_RATE ".Trim()) //@dc_rate , CmUtil.GetDataRowStr(dr, "ITEM_DC_AMT ".Trim()) //@item_dc_amt , CmUtil.GetDataRowStr(dr, "SUM_DC_AMT ".Trim()) //@sum_dc_amt , CmUtil.GetDataRowStr(dr, "CPI_DC_AMT ".Trim()) //@cpi_dc_amt , CmUtil.GetDataRowStr(dr, "COOP_CARD_DC_DIV ".Trim()) //@coop_card_dc_div , CmUtil.GetDataRowStr(dr, "COOP_CARD_DC_AMT ".Trim()) //@coop_card_dc_amt , CmUtil.GetDataRowStr(dr, "POINT_DC_DIV ".Trim()) //@point_dc_div , CmUtil.GetDataRowStr(dr, "POINT_DC_AMT ".Trim()) //@point_dc_amt , CmUtil.GetDataRowStr(dr, "CPN_DC_DIV ".Trim()) //@cpn_dc_div , CmUtil.GetDataRowStr(dr, "CPN_DC_AMT ".Trim()) //@cpn_dc_amt , CmUtil.GetDataRowStr(dr, "EMP_DC_DIV ".Trim()) //@emp_dc_div , CmUtil.GetDataRowStr(dr, "EMP_DC_AMT ".Trim()) //@emp_dc_amt , CmUtil.GetDataRowStr(dr, "SET_DC_AMT ".Trim()) //@set_dc_amt , CmUtil.GetDataRowStr(dr, "ETC_DC_DIV ".Trim()) //@etc_dc_div , CmUtil.GetDataRowStr(dr, "ETC_DC ".Trim()) //@etc_dc , CmUtil.GetDataRowStr(dr, "EXCEP_DC_DIV ".Trim()) //@excep_dc_div , CmUtil.GetDataRowStr(dr, "EXCEP_DC_AMT ".Trim()) //@excep_dc_amt , CmUtil.GetDataRowStr(dr, "PACK_DIV ".Trim()) //@pack_div , CmUtil.GetDataRowStr(dr, "SET_MENU_CD ".Trim()) //@set_menu_cd , CmUtil.GetDataRowStr(dr, "CPI_PRESENT_DIV ".Trim()) //@cpi_present_div , CmUtil.GetDataRowStr(dr, "SUB_MEMO_DIV ".Trim()) //@sub_memo_div , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG1")) //@msg1 , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG2")) //@msg2 , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG3")) //@msg3 , CmUtil.GetDataRowStr(dr, "MSG_REG_TIME ".Trim()) //@msg_reg_time , CmUtil.GetDataRowStr(dr, "ORD_TIME ".Trim()) //@ord_time , CmUtil.GetDataRowStr(dr, "ORD_COMP_DIV ".Trim()) //@ord_comp_div , CmUtil.GetDataRowStr(dr, "ORD_PIC_NO ".Trim()) //@ord_pic_no , CmUtil.GetDataRowStr(dr, "CANCEL_DIV ".Trim()) //@cancel_div , CmUtil.GetDataRowStr(dr, "CANCEL_DATE ".Trim()) //@cancel_date , CmUtil.GetDataRowStr(dr, "FILLER1 ".Trim()) //@filler1 , CmUtil.GetDataRowStr(dr, "FILLER2 ".Trim()) //@filler2 , CmUtil.GetDataRowStr(dr, "FILLER3 ".Trim()) //@filler3 , CmUtil.GetDataRowStr(dr, "FILLER4 ".Trim()) //@filler4 , CmUtil.GetDataRowStr(dr, "FILLER5 ".Trim()) //@filler5 , DateTime.Now.ToString("yyyyMMddHHmmss") //@upd_dt , CmUtil.GetDataRowStr(dr, "REG_DT ".Trim()) //@reg_dt , CmUtil.GetDataRowStr(dr, "NOTAX_DIV ".Trim()) //@notax_div , CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN") // Add, 2017.03.02 연습모드 , CmUtil.GetDataRowStr(dr, "DC_TYPE") // Add, 2017.03.30 , CmUtil.GetDataRowStr(dr, "ORG_QTY") // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); lstQuery.Add(sql); } } #endregion #region >> 주문정보 이동 (2nd -> 1st) if (dtOrder2nd != null) { foreach (DataRow dr in dtOrder2nd.Rows) { sql = string.Format(fmt, CmUtil.GetDataRowStr(dr, "CMP_CD ".Trim()) //@cmp_cd , CmUtil.GetDataRowStr(dr, "STOR_CD ".Trim()) //@stor_cd , CmUtil.GetDataRowStr(dr, "ORD_DIV ".Trim()) //@ord_div , sFromFloorCd //@floor_cd , sFromTableNo //@tbl_no , CmUtil.GetDataRowStr(dr, "SEQ ".Trim()) //@seq , CmUtil.GetDataRowStr(dr, "SUB_STOR_CD ".Trim()) //@sub_stor_cd , CmUtil.GetDataRowStr(dr, "ITEM_CD ".Trim()) //@item_cd , CmUtil.GetDataRowStr(dr, "ITEM_DIV ".Trim()) //@item_div , CmUtil.GetDataRowStr(dr, "SHTCUT_ITEMNM ".Trim()) //@shtcut_itemnm , CmUtil.GetDataRowStr(dr, "SALE_QTY ".Trim()) //@sale_qty , CmUtil.GetDataRowStr(dr, "SALE_PRC ".Trim()) //@sale_prc , CmUtil.GetDataRowStr(dr, "SALE_AMT ".Trim()) //@sale_amt , CmUtil.GetDataRowStr(dr, "BILL_AMT ".Trim()) //@bill_amt , CmUtil.GetDataRowStr(dr, "DC_DIV ".Trim()) //@dc_div , CmUtil.GetDataRowStr(dr, "DC_RATE ".Trim()) //@dc_rate , CmUtil.GetDataRowStr(dr, "ITEM_DC_AMT ".Trim()) //@item_dc_amt , CmUtil.GetDataRowStr(dr, "SUM_DC_AMT ".Trim()) //@sum_dc_amt , CmUtil.GetDataRowStr(dr, "CPI_DC_AMT ".Trim()) //@cpi_dc_amt , CmUtil.GetDataRowStr(dr, "COOP_CARD_DC_DIV ".Trim()) //@coop_card_dc_div , CmUtil.GetDataRowStr(dr, "COOP_CARD_DC_AMT ".Trim()) //@coop_card_dc_amt , CmUtil.GetDataRowStr(dr, "POINT_DC_DIV ".Trim()) //@point_dc_div , CmUtil.GetDataRowStr(dr, "POINT_DC_AMT ".Trim()) //@point_dc_amt , CmUtil.GetDataRowStr(dr, "CPN_DC_DIV ".Trim()) //@cpn_dc_div , CmUtil.GetDataRowStr(dr, "CPN_DC_AMT ".Trim()) //@cpn_dc_amt , CmUtil.GetDataRowStr(dr, "EMP_DC_DIV ".Trim()) //@emp_dc_div , CmUtil.GetDataRowStr(dr, "EMP_DC_AMT ".Trim()) //@emp_dc_amt , CmUtil.GetDataRowStr(dr, "SET_DC_AMT ".Trim()) //@set_dc_amt , CmUtil.GetDataRowStr(dr, "ETC_DC_DIV ".Trim()) //@etc_dc_div , CmUtil.GetDataRowStr(dr, "ETC_DC ".Trim()) //@etc_dc , CmUtil.GetDataRowStr(dr, "EXCEP_DC_DIV ".Trim()) //@excep_dc_div , CmUtil.GetDataRowStr(dr, "EXCEP_DC_AMT ".Trim()) //@excep_dc_amt , CmUtil.GetDataRowStr(dr, "PACK_DIV ".Trim()) //@pack_div , CmUtil.GetDataRowStr(dr, "SET_MENU_CD ".Trim()) //@set_menu_cd , CmUtil.GetDataRowStr(dr, "CPI_PRESENT_DIV ".Trim()) //@cpi_present_div , CmUtil.GetDataRowStr(dr, "SUB_MEMO_DIV ".Trim()) //@sub_memo_div , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG1")) //@msg1 , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG2")) //@msg2 , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG3")) //@msg3 , CmUtil.GetDataRowStr(dr, "MSG_REG_TIME ".Trim()) //@msg_reg_time , CmUtil.GetDataRowStr(dr, "ORD_TIME ".Trim()) //@ord_time , CmUtil.GetDataRowStr(dr, "ORD_COMP_DIV ".Trim()) //@ord_comp_div , CmUtil.GetDataRowStr(dr, "ORD_PIC_NO ".Trim()) //@ord_pic_no , CmUtil.GetDataRowStr(dr, "CANCEL_DIV ".Trim()) //@cancel_div , CmUtil.GetDataRowStr(dr, "CANCEL_DATE ".Trim()) //@cancel_date , CmUtil.GetDataRowStr(dr, "FILLER1 ".Trim()) //@filler1 , CmUtil.GetDataRowStr(dr, "FILLER2 ".Trim()) //@filler2 , CmUtil.GetDataRowStr(dr, "FILLER3 ".Trim()) //@filler3 , CmUtil.GetDataRowStr(dr, "FILLER4 ".Trim()) //@filler4 , CmUtil.GetDataRowStr(dr, "FILLER5 ".Trim()) //@filler5 , DateTime.Now.ToString("yyyyMMddHHmmss") //@upd_dt , CmUtil.GetDataRowStr(dr, "REG_DT ".Trim()) //@reg_dt , CmUtil.GetDataRowStr(dr, "NOTAX_DIV ".Trim()) //@notax_div , CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN") // Add, 2017.03.02 연습모드 , CmUtil.GetDataRowStr(dr, "DC_TYPE") // Add, 2017.03.30 , CmUtil.GetDataRowStr(dr, "ORG_QTY") // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); lstQuery.Add(sql); } } #endregion #endregion #region 주방메시지정보 업데이트 // 주방메시지정보 초기화 fmt = "DELETE FROM POSMST..MST_KTCH_ORD_MSG WHERE TRAIN_MODE_YN = '{0}' AND ORD_DIV = '{1}' AND FLOOR_CD = '{2}' AND TBL_NO = '{3}' "; sql = string.Format(fmt, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sFromFloorCd, sFromTableNo); lstQuery.Add(sql); sql = string.Format(fmt, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sToFloorCd, sToTableNo); lstQuery.Add(sql); #region >> INSERT INTO POSMST..MST_KTCH_ORD_MSG fmt = "INSERT INTO POSMST..MST_KTCH_ORD_MSG ( \n" + " ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, SUB_STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE \n" + " , ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD, ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV \n" + " , MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO, ORG_BILLDT, ORG_BILL_NO, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN \n" + " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT \n" + " , TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 + " , KTCH_MSG \n" // Add, 2017.03.21 + " , ORG_QTY \n" // Add, 2017.03.31 + " , ORD_POS_NO \n" // Add, 2017.04.10 + " , ORD_PIC_NM \n" // Add, 2017.04.26, 주문담당자 + " , KDS_SEND_YN \n" // Add, 2017.04.26, KDS 전송구분 + " ) VALUES ( \n" + " '{0}' \n" //@ord_div + " , '{1}' \n" //@floor_cd + " , '{2}' \n" //@tbl_no + " , '{3}' \n" //@seq + " , '{4}' \n" //@cmp_cd + " , '{5}' \n" //@brand_cd + " , '{6}' \n" //@stor_cd + " , '{7}' \n" //@sub_stor_cd + " , '{8}' \n" //@pos_no + " , '{9}' \n" //@trade_no + " , '{10}' \n" //@sale_dt + " , '{11}' \n" //@pos_type + " , '{12}' \n" //@item_cd + " , '{13}' \n" //@item_div + " ,N'{14}' \n" //@shtcut_itemnm + " , '{15}' \n" //@sale_qty + " , '{16}' \n" //@pack_div + " , '{17}' \n" //@set_menu_cd + " , '{18}' \n" //@ord_time + " , '{19}' \n" //@cancel_div + " , '{20}' \n" //@sub_memo_div + " ,N'{21}' \n" //@msg1 + " ,N'{22}' \n" //@msg2 + " ,N'{23}' \n" //@msg3 + " , '{24}' \n" //@msg_reg_time + " , '{25}' \n" //@org_bill_posno + " , '{26}' \n" //@org_billdt + " , '{27}' \n" //@org_bill_no + " , '{28}' \n" //@send_yn + " , '{29}' \n" //@send_confirm_div + " , '{30}' \n" //@resend_yn + " , '{31}' \n" //@filler1 + " , '{32}' \n" //@filler2 + " , '{33}' \n" //@filler3 + " , '{34}' \n" //@filler4 + " , '{35}' \n" //@filler5 + " , '{36}' \n" //@upd_dt + " , '{37}' \n" //@reg_dt + " , '{38}' \n" // Add, 2017.03.02, 연습모드 + " ,N'{39}' \n" // Add, 2017.03.21 + " , {40} \n" // Add, 2017.03.31 + " , '{41}' \n" // Add, 2017.04.10 + " ,N'{42}' \n" // Add, 2017.04.26, 주문담당자 + " , '{43}' \n" // Add, 2017.04.26, KDS 전송구분 + " ) " ; #endregion #region >> 주방메시지정보 이동 (1st -> 2nd) if (dtKtchMsg1st != null) { foreach (DataRow dr in dtKtchMsg1st.Rows) { sql = string.Format(fmt, CmUtil.GetDataRowStr(dr, "ORD_DIV ".Trim()) , sToFloorCd , sToTableNo , CmUtil.GetDataRowStr(dr, "SEQ ".Trim()) , CmUtil.GetDataRowStr(dr, "CMP_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "BRAND_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "STOR_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "SUB_STOR_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "POS_NO ".Trim()) , CmUtil.GetDataRowStr(dr, "TRADE_NO ".Trim()) , CmUtil.GetDataRowStr(dr, "SALE_DT ".Trim()) , CmUtil.GetDataRowStr(dr, "POS_TYPE ".Trim()) , CmUtil.GetDataRowStr(dr, "ITEM_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "ITEM_DIV ".Trim()) , CmUtil.GetDataRowStr(dr, "SHTCUT_ITEMNM ".Trim()) , CmUtil.GetDataRowStr(dr, "SALE_QTY ".Trim()) , CmUtil.GetDataRowStr(dr, "PACK_DIV ".Trim()) , CmUtil.GetDataRowStr(dr, "SET_MENU_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "ORD_TIME ".Trim()) , CmUtil.GetDataRowStr(dr, "CANCEL_DIV ".Trim()) , CmUtil.GetDataRowStr(dr, "SUB_MEMO_DIV ".Trim()) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG1")) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG2")) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG3")) , CmUtil.GetDataRowStr(dr, "MSG_REG_TIME ".Trim()) , CmUtil.GetDataRowStr(dr, "ORG_BILL_POSNO ".Trim()) , CmUtil.GetDataRowStr(dr, "ORG_BILLDT ".Trim()) , CmUtil.GetDataRowStr(dr, "ORG_BILL_NO ".Trim()) , CmUtil.GetDataRowStr(dr, "SEND_YN ".Trim()) , CmUtil.GetDataRowStr(dr, "SEND_CONFIRM_DIV".Trim()) , CmUtil.GetDataRowStr(dr, "RESEND_YN ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER1 ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER2 ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER3 ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER4 ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER5 ".Trim()) , DateTime.Now.ToString("yyyyMMddHHmmss") , CmUtil.GetDataRowStr(dr, "REG_DT ".Trim()) , CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN") // Add, 2017.03.02, 연습모드 , ConvertDBStr(CmUtil.GetDataRowStr(dr, "KTCH_MSG")) // Add, 2017.03.21 , CmUtil.GetDataRowStr(dr, "ORG_QTY") // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 , CmUtil.GetDataRowStr(dr, "ORD_PIC_NM") // Add, 2017.04.26, 주문담당자 , CmUtil.GetDataRowStr(dr, "KDS_SEND_YN") // Add, 2017.04.26, KDS 전송구분 ); lstQuery.Add(sql); } } #endregion #region >> 주방메시지정보 이동 (2nd -> 1st) if (dtKtchMsg2nd != null) { foreach (DataRow dr in dtKtchMsg2nd.Rows) { sql = string.Format(fmt, CmUtil.GetDataRowStr(dr, "ORD_DIV ".Trim()) , sFromFloorCd , sFromTableNo , CmUtil.GetDataRowStr(dr, "SEQ ".Trim()) , CmUtil.GetDataRowStr(dr, "CMP_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "BRAND_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "STOR_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "SUB_STOR_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "POS_NO ".Trim()) , CmUtil.GetDataRowStr(dr, "TRADE_NO ".Trim()) , CmUtil.GetDataRowStr(dr, "SALE_DT ".Trim()) , CmUtil.GetDataRowStr(dr, "POS_TYPE ".Trim()) , CmUtil.GetDataRowStr(dr, "ITEM_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "ITEM_DIV ".Trim()) , CmUtil.GetDataRowStr(dr, "SHTCUT_ITEMNM ".Trim()) , CmUtil.GetDataRowStr(dr, "SALE_QTY ".Trim()) , CmUtil.GetDataRowStr(dr, "PACK_DIV ".Trim()) , CmUtil.GetDataRowStr(dr, "SET_MENU_CD ".Trim()) , CmUtil.GetDataRowStr(dr, "ORD_TIME ".Trim()) , CmUtil.GetDataRowStr(dr, "CANCEL_DIV ".Trim()) , CmUtil.GetDataRowStr(dr, "SUB_MEMO_DIV ".Trim()) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG1")) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG2")) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG3")) , CmUtil.GetDataRowStr(dr, "MSG_REG_TIME ".Trim()) , CmUtil.GetDataRowStr(dr, "ORG_BILL_POSNO ".Trim()) , CmUtil.GetDataRowStr(dr, "ORG_BILLDT ".Trim()) , CmUtil.GetDataRowStr(dr, "ORG_BILL_NO ".Trim()) , CmUtil.GetDataRowStr(dr, "SEND_YN ".Trim()) , CmUtil.GetDataRowStr(dr, "SEND_CONFIRM_DIV".Trim()) , CmUtil.GetDataRowStr(dr, "RESEND_YN ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER1 ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER2 ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER3 ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER4 ".Trim()) , CmUtil.GetDataRowStr(dr, "FILLER5 ".Trim()) , DateTime.Now.ToString("yyyyMMddHHmmss") , CmUtil.GetDataRowStr(dr, "REG_DT ".Trim()) , CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN") // Add, 2017.03.02, 연습모드 , ConvertDBStr(CmUtil.GetDataRowStr(dr, "KTCH_MSG")) // Add, 2017.03.21 , CmUtil.GetDataRowStr(dr, "ORG_QTY") // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 , CmUtil.GetDataRowStr(dr, "ORD_PIC_NM") // Add, 2017.04.26, 주문담당자 , CmUtil.GetDataRowStr(dr, "KDS_SEND_YN") // Add, 2017.04.26, KDS 전송구분 ); lstQuery.Add(sql); } } #endregion #endregion #region 좌석메모 정보 업데이트 // 좌석메모정보 삭제 fmt = "DELETE FROM POSMST..MST_SEAT_MEMO WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' AND ORD_DIV = '{3}' AND FLOOR_CD = '{4}' AND TBL_NO = '{5}' "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sFromFloorCd, sFromTableNo); lstQuery.Add(sql); sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, sToFloorCd, sToTableNo); lstQuery.Add(sql); #region >> INSERT INTO dbo.MST_SEAT_MEMO fmt = "INSERT INTO POSMST..MST_SEAT_MEMO ( \n" + " CMP_CD, STOR_CD, TRAIN_MODE_YN, ORD_DIV, FLOOR_CD, TBL_NO, SEQ, MSG1, MSG2, MSG3, CASHIER_ID, REG_TIME, REG_DT \n" + " ) VALUES ( \n" + " '{0}' \n" //@cmp_cd + " , '{1}' \n" //@stor_cd + " , '{2}' \n" // // Add, 2017.03.02, 연습모드 + " , '{3}' \n" //@ord_div + " , '{4}' \n" //@floor_cd + " , '{5}' \n" //@tbl_no + " , {6} \n" //@seq + " ,N'{7}' \n" //@msg1 + " ,N'{8}' \n" //@msg2 + " ,N'{9}' \n" //@msg3 + " , '{10}' \n" //@cashier_id + " , '{11}' \n" //@reg_time + " , '{12}' \n" //@reg_dt + " ) " ; #endregion #region >> 좌석메모정보 이동 (1st -> 2nd) if (dtSeatMsg1st != null) { foreach (DataRow dr in dtSeatMsg1st.Rows) { sql = string.Format(fmt, CmUtil.GetDataRowStr(dr, "CMP_CD") , CmUtil.GetDataRowStr(dr, "STOR_CD") , CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN") // Add, 2017.03.06, 연습모드 , CmUtil.GetDataRowStr(dr, "ORD_DIV") , sToFloorCd , sToTableNo , CmUtil.GetDataRowStr(dr, "SEQ") , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG1")) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG2")) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG3")) , CmUtil.GetDataRowStr(dr, "CASHIER_ID") , CmUtil.GetDataRowStr(dr, "REG_TIME") , CmUtil.GetDataRowStr(dr, "REG_DT") ); lstQuery.Add(sql); } } #endregion #region >> 좌석메모정보 이동 (2nd -> 1st) if (dtSeatMsg2nd != null) { foreach (DataRow dr in dtSeatMsg2nd.Rows) { sql = string.Format(fmt, CmUtil.GetDataRowStr(dr, "CMP_CD") , CmUtil.GetDataRowStr(dr, "STOR_CD") , CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN") // Add, 2017.03.06, 연습모드 , CmUtil.GetDataRowStr(dr, "ORD_DIV") , sFromFloorCd , sFromTableNo , CmUtil.GetDataRowStr(dr, "SEQ") , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG1")) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG2")) , ConvertDBStr(CmUtil.GetDataRowStr(dr, "MSG3")) , CmUtil.GetDataRowStr(dr, "CASHIER_ID") , CmUtil.GetDataRowStr(dr, "REG_TIME") , CmUtil.GetDataRowStr(dr, "REG_DT") ); lstQuery.Add(sql); } } #endregion #endregion #region 주방부가메시지 출력 #region >> INSERT INTO POSMST..MST_KTCH_ORD_MSG_ADD fmt = "INSERT INTO POSMST..MST_KTCH_ORD_MSG_ADD \n" + "( ORD_DIV, FLOOR_CD, TBL_NO, SEQ, SUB_STOR_CD, KTCH_SYS_CD, MSG_DIV, MSG1, MSG2, MSG_REG_TIME, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN \n" + ", FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT \n" + ", TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 + ", ORD_POS_NO \n" // Add, 2017.04.10 + " ) \n" + "SELECT \n" + " '{0}' \n" //ORD_DIV + ", '{1}' \n" //FLOOR_CD + ", '{2}' \n" //TBL_NO //SEQ + ", (SELECT ISNULL(MAX(SEQ), 0) + 1 FROM POSMST..MST_KTCH_ORD_MSG_ADD WHERE TRAIN_MODE_YN = '{19}' AND ORD_DIV = '{0}' AND FLOOR_CD = '{1}' AND TBL_NO = '{2}') \n" + ", '{3}' \n" //SUB_STOR_CD + ", '{4}' \n" //KTCH_SYS_CD + ", '{5}' \n" //MSG_DIV + ",N'{6}' \n" //MSG1 + ",N'{7}' \n" //MSG2 + ", '{8}' \n" //MSG_REG_TIME + ", '{9}' \n" //SEND_YN + ", '{10}' \n" //SEND_CONFIRM_DIV + ", '{11}' \n" //RESEND_YN + ", '{12}' \n" //FILLER1 + ", '{13}' \n" //FILLER2 + ", '{14}' \n" //FILLER3 + ", '{15}' \n" //FILLER4 + ", '{16}' \n" //FILLER5 + ", '{17}' \n" //UPD_DT + ", '{18}' \n" //REG_DT + ", '{19}' \n" // Add, 2017.03.02, 연습모드 + ", '{20}' \n" // Add, 2017.04.10 ; #endregion #region >> 주방메시지 출력 (1st -> 2nd) if (cTable1st != null) { for (var i = 0; i < lstKps.Count; i++) { var ktchDev = lstKps[i].Split(','); sql = string.Format(fmt, PosConst.ORDER_TYPE.NORMAL , sFromFloorCd , sFromTableNo , ktchDev[0].Trim() , ktchDev[1].Trim() , PosConst.KPS_ORD_MSG_ID.TABLE_MOVE , sToFloorCd , sToTableNo , DateTime.Now.ToString("HHmmss") , "0" , "0" , "0" , "" , "" , "" , "" , "" , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); // 주방출력삭제(2017.05.24) //lstQuery.Add(sql); } } #endregion #region >> 주방메시지 출력 (2nd -> 1st) if (cTable2nd != null) { for (var i = 0; i < lstKps.Count; i++) { var ktchDev = lstKps[i].Split(','); sql = string.Format(fmt, PosConst.ORDER_TYPE.NORMAL , sToFloorCd , sToTableNo , ktchDev[0].Trim() , ktchDev[1].Trim() , PosConst.KPS_ORD_MSG_ID.TABLE_MOVE , sFromFloorCd , sFromTableNo , DateTime.Now.ToString("HHmmss") , "0" , "0" , "0" , "" , "" , "" , "" , "" , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); // 주방출력삭제(2017.05.24) //lstQuery.Add(sql); } } #endregion #endregion ret = m_cSqlDbService.DBExecuteNonQuery(lstQuery.ToArray(), true); sReturn = ret == UserCom.OK ? UserCom.RST_OK : UserCom.RST_ERR; //Rhee, #2017/10/26 중국후불매장의 경우 테이블이동후 주문내역서 출력 기능 정지. Start if (m_cPosStatus.Base.CmpCd.ToUpper() != "PCCN") { // 이동테이블 주문내역서 출력 if (sReturn == UserCom.RST_OK) { this.ExecuteOrderBillReceipt(sFromFloorCd, sFromTableNo); this.ExecuteOrderBillReceipt(sToFloorCd, sToTableNo); } } //Rhee, #2017/10/26 중국후불매장의 경우 테이블이동후 주문내역서 출력 기능 정지. End } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 메뉴이동 /// /// public string UpdateMenuItemMove() { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; string sInsFmt = string.Empty; string sSelFmt = string.Empty; int iSeq = 0; int leftItemCnt = 0; int rightItemCnt = 0; double dTableOrderAmt = 0; bool bIsFirstOrder = false; try { // 이동 상품정보 var cFormTableItemMoveUs = (IFormTableItemMoveUs)FormManager.GetForm(FormManager.FORM_ETC_TABLE_ITEM_MOVE); var dtLeftGrid = cFormTableItemMoveUs.LeftGrid; var dtRightGrid = cFormTableItemMoveUs.RightGrid; if (dtLeftGrid == null || dtRightGrid == null) return UserCom.RST_ERR; // 이동 대상 층/테이블 정보 var s1stFloorCd = cFormTableItemMoveUs.FirstSelectedFloorCd; var s1stTableNo = cFormTableItemMoveUs.FirstSelectedTableNo; var s2ndFloorCd = cFormTableItemMoveUs.SecondSelectedFloorCd; var s2ndTableNo = cFormTableItemMoveUs.SecondSelectedTableNo; // 주문 마스터 Backup DataTable dtBackUpOrd1 = null; DataTable dtBackUpOrd2 = null; this.SelectTableOrderItem(new string[] { "0", s1stFloorCd, s1stTableNo }, out dtBackUpOrd1); this.SelectTableOrderItem(new string[] { "0", s2ndFloorCd, s2ndTableNo }, out dtBackUpOrd2); // 주방주문메시지 마스터 Backup DataTable dtBackUpOrdMsg1 = null; DataTable dtBackUpOrdMsg2 = null; #region (주석) //sSelFmt = "SELECT ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, SUB_STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE \n" // + " , ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD, ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV \n" // + " , MSG1, MSG2, MSG3, MSG_REG_TIME, SEND_YN, ORG_BILL_POSNO, ORG_BILLDT, ORG_BILL_NO \n" // + " , SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT \n" // + " , TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 // + " , KTCH_MSG \n" // Add, 2017.03.21 // + " , ORG_QTY \n" // Add, 2017.03.31 // + " FROM POSMST..MST_KTCH_ORD_MSG \n" // + " WHERE TRAIN_MODE_YN = '{0}' AND ORD_DIV = '{1}' AND FLOOR_CD = '{2}' AND TBL_NO = '{3}' " // ; #endregion sSelFmt = "SELECT * FROM POSMST..MST_KTCH_ORD_MSG \n" + " WHERE TRAIN_MODE_YN = '{0}' AND ORD_DIV = '{1}' AND FLOOR_CD = '{2}' AND TBL_NO = '{3}' " ; sQuery = string.Format(sSelFmt, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, s1stFloorCd, s1stTableNo); m_cSqlDbService.DBSelect(sQuery, out dtBackUpOrdMsg1); sQuery = string.Format(sSelFmt, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL, s2ndFloorCd, s2ndTableNo); m_cSqlDbService.DBSelect(sQuery, out dtBackUpOrdMsg2); // 상품별 주방프린터 마스터 백업 DataTable dtData = null; Dictionary lstKps = new Dictionary(); if (GetKtchDiveceItem(s1stFloorCd, s1stTableNo, out dtData) > 0) { foreach (DataRow dr in dtData.Rows) { var key = CmUtil.GetDataRowStr(dr, "SUB_STOR_CD").Trim() + CmUtil.GetDataRowStr(dr, "ITEM_CD").Trim() + CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD").Trim(); var dev = CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD").Trim(); if (lstKps.ContainsKey(key) == false) lstKps.Add(key, dev); } } if (GetKtchDiveceItem(s2ndFloorCd, s2ndTableNo, out dtData) > 0) { foreach (DataRow dr in dtData.Rows) { var key = CmUtil.GetDataRowStr(dr, "SUB_STOR_CD").Trim() + CmUtil.GetDataRowStr(dr, "ITEM_CD").Trim() + CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD").Trim(); var dev = CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD").Trim(); if (lstKps.ContainsKey(key) == false) lstKps.Add(key, dev); } } // 두번째 테이블 최초주문 여부 확인 dtData = null; sReturn = this.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_NO_FLOOR_CD_SEARCH, s2ndFloorCd, s2ndTableNo }, out dtData); if (sReturn != UserCom.RST_OK) { UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } if (CmUtil.GetDataRowInt(dtData.Rows[0], "CUST_CNT") == 0 && CmUtil.GetDataRowDouble(dtData.Rows[0], "ORD_AMT") == 0 && CmUtil.GetDataRowStr(dtData.Rows[0], "FIRST_ORD_HOUR").Trim() == "") { bIsFirstOrder = true; } // Transaction Begin m_cSqlDbService.Begin(); #region ### 왼쪽 그리드 변경 데이터 Update iSeq = 0; leftItemCnt = 0; dTableOrderAmt = 0; #region 주문마스터 삭제 (DELETE FROM POSMST..MST_ORD) sQuery = " DELETE FROM POSMST..MST_ORD \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' \n" + " AND FLOOR_CD = '" + s1stFloorCd + "' \n" + " AND TBL_NO = '" + s1stTableNo + "' \n" ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region 주방주문메시지 마스터 삭제 (DELETE FROM POSMST..MST_KTCH_ORD_MSG) sQuery = " DELETE FROM POSMST..MST_KTCH_ORD_MSG \n" + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' \n" + " AND FLOOR_CD = '" + s1stFloorCd + "' \n" + " AND TBL_NO = '" + s1stTableNo + "' "; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion foreach (DataRow dr in dtLeftGrid.Rows) { if (CmUtil.GetDataRowStr(dr, "CANCEL_DIV") != PosConst.CANCEL_DIV.CANCEL) { leftItemCnt++; dTableOrderAmt += CmUtil.GetDataRowDouble(dr, "BILL_AMT"); } // sKeys[0]:ORD_DIV, sKeys[1]:FLOOR_CD, sKeys[2]:TBL_NO, sKeys[3]:SEQ(GridRowNo) var sKeys = CmUtil.GetDataRowStr(dr, "REF").Split(new char[] { '|' }); var saleQty = CmUtil.GetDataRowInt(dr, "QTY"); var saleAmt = CmUtil.GetDataRowDouble(dr, "SALE_PRC") * saleQty; var billAmt = CmUtil.GetDataRowDouble(dr, "BILL_AMT"); #region 왼쪽그리드 상품이동 (POSMST..MST_ORD) #region >> INSERT INTO POSMST..MST_ORD sInsFmt = " INSERT INTO POSMST..MST_ORD ( " + " CMP_CD, STOR_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ, ITEM_CD " + " , ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, SALE_PRC, SALE_AMT " + " , BILL_AMT, DC_DIV, DC_RATE, ITEM_DC_AMT, SUM_DC_AMT " + " , CPI_DC_AMT, COOP_CARD_DC_DIV, COOP_CARD_DC_AMT, POINT_DC_DIV, POINT_DC_AMT " + " , CPN_DC_DIV, CPN_DC_AMT, EMP_DC_DIV, EMP_DC_AMT, SET_DC_AMT " + " , ETC_DC_DIV, ETC_DC, EXCEP_DC_DIV, EXCEP_DC_AMT, PACK_DIV, SET_MENU_CD, CPI_PRESENT_DIV " + " , SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME " + " , ORD_TIME, ORD_COMP_DIV, ORD_PIC_NO, CANCEL_DIV, CANCEL_DATE " + " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 " //+ " , UPD_DT, REG_DT " //+ " , UPD_DT, REG_DT, SUB_STOR_CD " // Mod, 2017.02.08 //+ " , UPD_DT, REG_DT, SUB_STOR_CD, NOTAX_DIV " // Mod, 2017.02.15 + " , UPD_DT, REG_DT, SUB_STOR_CD, NOTAX_DIV, TRAIN_MODE_YN " // Mod, 2017.03.02, 연습모드 + " , DC_TYPE " // Add, 2017.03.30 + " , ORG_QTY " // Add, 2017.03.31 + " , ORD_POS_NO " // Add, 2017.04.10 + " ) VALUES ( " + " '{0}' " + " , '{1}' " + " , '{2}' " + " , '{3}' " + " , '{4}' " + " , {5} " + " , '{6}' " + " , '{7}' " + " ,N'{8}' " + " , {9} " + " , {10} " + " , {11} " + " , {12} " + " , '{13}' " + " , {14} " + " , {15} " + " , {16} " + " , {17} " + " , '{18}' " + " , {19} " + " , '{20}' " + " , {21} " + " , '{22}' " + " , {23} " + " , '{24}' " + " , {25} " + " , {26} " + " , '{27}' " + " , {28} " + " , '{29}' " + " , {30} " + " , '{31}' " + " , '{32}' " + " , '{33}' " + " , '{34}' " + " ,N'{35}' " + " ,N'{36}' " + " ,N'{37}' " + " , '{38}' " + " , '{39}' " + " , '{40}' " + " , '{41}' " + " , '{42}' " + " , '{43}' " + " , '{44}' " + " , '{45}' " + " , '{46}' " + " , '{47}' " + " , '{48}' " + " , '{49}' " + " , '{50}' " + " , '{51}' " // Add, 2017.02.08 + " , '{52}' " // Add, 2017.02.15 + " , '{53}' " // Add, 2017.03.02, 연습모드 + " , '{54}' " // Add, 2017.03.30 + " , {55} " // Add, 2017.03.31 + " , '{56}' " // Add, 2017.04.10 + " ) "; #endregion if (s1stFloorCd == sKeys[1] && s1stTableNo == sKeys[2]) { #region >> 이동되지 않은 상품 var drBackOrder1 = dtBackUpOrd1.Rows[int.Parse(sKeys[3]) - 1]; sQuery = string.Format(sInsFmt , m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , drBackOrder1["ORD_DIV"].ToString() , s1stFloorCd , s1stTableNo , (iSeq + 1).ToString() , drBackOrder1["ITEM_CD"].ToString() , drBackOrder1["ITEM_DIV"].ToString() , drBackOrder1["SHTCUT_ITEMNM"].ToString() , saleQty //, drBackOrder1["SALE_QTY"].ToString() , drBackOrder1["SALE_PRC"].ToString() , saleAmt //, drBackOrder1["SALE_AMT"].ToString() , billAmt //, drBackOrder1["BILL_AMT"].ToString() , drBackOrder1["DC_DIV"].ToString() , drBackOrder1["DC_RATE"].ToString() , drBackOrder1["ITEM_DC_AMT"].ToString() , drBackOrder1["SUM_DC_AMT"].ToString() , drBackOrder1["CPI_DC_AMT"].ToString() , drBackOrder1["COOP_CARD_DC_DIV"].ToString() , drBackOrder1["COOP_CARD_DC_AMT"].ToString() , drBackOrder1["POINT_DC_DIV"].ToString() , drBackOrder1["POINT_DC_AMT"].ToString() , drBackOrder1["CPN_DC_DIV"].ToString() , drBackOrder1["CPN_DC_AMT"].ToString() , drBackOrder1["EMP_DC_DIV"].ToString() , drBackOrder1["EMP_DC_AMT"].ToString() , drBackOrder1["SET_DC_AMT"].ToString() , drBackOrder1["ETC_DC_DIV"].ToString() , drBackOrder1["ETC_DC"].ToString() , drBackOrder1["EXCEP_DC_DIV"].ToString() , drBackOrder1["EXCEP_DC_AMT"].ToString() , drBackOrder1["PACK_DIV"].ToString() , drBackOrder1["SET_MENU_CD"].ToString() , drBackOrder1["CPI_PRESENT_DIV"].ToString() , drBackOrder1["SUB_MEMO_DIV"].ToString() , ConvertDBStr(drBackOrder1["MSG1"].ToString()) , ConvertDBStr(drBackOrder1["MSG2"].ToString()) , ConvertDBStr(drBackOrder1["MSG3"].ToString()) , drBackOrder1["MSG_REG_TIME"].ToString() , drBackOrder1["ORD_TIME"].ToString() , drBackOrder1["ORD_COMP_DIV"].ToString() , drBackOrder1["ORD_PIC_NO"].ToString() , drBackOrder1["CANCEL_DIV"].ToString() , drBackOrder1["CANCEL_DATE"].ToString() , drBackOrder1["FILLER1"].ToString() , drBackOrder1["FILLER2"].ToString() , drBackOrder1["FILLER3"].ToString() , drBackOrder1["FILLER4"].ToString() , drBackOrder1["FILLER5"].ToString() , drBackOrder1["UPD_DT"].ToString() , drBackOrder1["REG_DT"].ToString() , drBackOrder1["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrder1["NOTAX_DIV"].ToString() // Add, 2017.02.08 , drBackOrder1["TRAIN_MODE_YN"].ToString() // Add, 2017.03.02, 연습모드 , drBackOrder1["DC_TYPE"].ToString() // Add, 2017.03.30 , drBackOrder1["ORG_QTY"].ToString() // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); #endregion } else { #region >> 이동된 상품 이면 var drBackOrder2 = dtBackUpOrd2.Rows[int.Parse(sKeys[3]) - 1]; sQuery = string.Format(sInsFmt , m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , drBackOrder2["ORD_DIV"].ToString() , s1stFloorCd , s1stTableNo , (iSeq + 1).ToString() , drBackOrder2["ITEM_CD"].ToString() , drBackOrder2["ITEM_DIV"].ToString() , drBackOrder2["SHTCUT_ITEMNM"].ToString() , saleQty //, drBackOrder2["SALE_QTY"].ToString() , drBackOrder2["SALE_PRC"].ToString() , saleAmt //, drBackOrder2["SALE_AMT"].ToString() , billAmt //, drBackOrder2["BILL_AMT"].ToString() , drBackOrder2["DC_DIV"].ToString() , drBackOrder2["DC_RATE"].ToString() , drBackOrder2["ITEM_DC_AMT"].ToString() , drBackOrder2["SUM_DC_AMT"].ToString() , drBackOrder2["CPI_DC_AMT"].ToString() , drBackOrder2["COOP_CARD_DC_DIV"].ToString() , drBackOrder2["COOP_CARD_DC_AMT"].ToString() , drBackOrder2["POINT_DC_DIV"].ToString() , drBackOrder2["POINT_DC_AMT"].ToString() , drBackOrder2["CPN_DC_DIV"].ToString() , drBackOrder2["CPN_DC_AMT"].ToString() , drBackOrder2["EMP_DC_DIV"].ToString() , drBackOrder2["EMP_DC_AMT"].ToString() , drBackOrder2["SET_DC_AMT"].ToString() , drBackOrder2["ETC_DC_DIV"].ToString() , drBackOrder2["ETC_DC"].ToString() , drBackOrder2["EXCEP_DC_DIV"].ToString() , drBackOrder2["EXCEP_DC_AMT"].ToString() , drBackOrder2["PACK_DIV"].ToString() , drBackOrder2["SET_MENU_CD"].ToString() , drBackOrder2["CPI_PRESENT_DIV"].ToString() , drBackOrder2["SUB_MEMO_DIV"].ToString() , ConvertDBStr(drBackOrder2["MSG1"].ToString()) , ConvertDBStr(drBackOrder2["MSG2"].ToString()) , ConvertDBStr(drBackOrder2["MSG3"].ToString()) , drBackOrder2["MSG_REG_TIME"].ToString() , drBackOrder2["ORD_TIME"].ToString() , drBackOrder2["ORD_COMP_DIV"].ToString() , drBackOrder2["ORD_PIC_NO"].ToString() , drBackOrder2["CANCEL_DIV"].ToString() , drBackOrder2["CANCEL_DATE"].ToString() , drBackOrder2["FILLER1"].ToString() , drBackOrder2["FILLER2"].ToString() , drBackOrder2["FILLER3"].ToString() , drBackOrder2["FILLER4"].ToString() , drBackOrder2["FILLER5"].ToString() , drBackOrder2["UPD_DT"].ToString() , drBackOrder2["REG_DT"].ToString() , drBackOrder2["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrder2["NOTAX_DIV"].ToString() // Add, 2017.02.15 , drBackOrder2["TRAIN_MODE_YN"].ToString() // Add, 2017.03.02, 연습모드 , drBackOrder2["DC_TYPE"].ToString() // Add, 2017.03.30 , drBackOrder2["ORG_QTY"].ToString() // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); #endregion } if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region 왼쪽그리드 주문메시지 이동 (POSMST..MST_KTCH_ORD_MSG) #region >> INSERT INTO POSMST..MST_KTCH_ORD_MSG sInsFmt = " INSERT INTO POSMST..MST_KTCH_ORD_MSG ( " + " ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE, ITEM_CD " + ", ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD " + ", ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO " + ", ORG_BILLDT, ORG_BILL_NO, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2 " + ", FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT, SUB_STOR_CD " // Mod, 2017.02.08 + ", TRAIN_MODE_YN " // Add, 2017.03.02, 연습모드 + ", KTCH_MSG " // Add, 2017.03.21 + ", ORG_QTY " // Add, 2017.03.31 + ", ORD_POS_NO " // Add, 2017.04.10 + ", ORD_PIC_NM \n" // Add, 2017.04.26, 주문담당자 + ", KDS_SEND_YN \n" // Add, 2017.04.26, KDS 전송구분 + ") VALUES ( " + " '{0}' " + ", '{1}' " + ", '{2}' " + ", {3} " + ", '{4}' " + ", '{5}' " + ", '{6}' " + ", '{7}' " + ", '{8}' " + ", '{9}' " + ", '{10}' " + ", '{11}' " + ", '{12}' " + ",N'{13}' " + ", {14} " + ", '{15}' " + ", '{16}' " + ", '{17}' " + ", '{18}' " + ", '{19}' " + ",N'{20}' " + ",N'{21}' " + ",N'{22}' " + ", '{23}' " + ", '{24}' " + ", '{25}' " + ", '{26}' " + ", '{27}' " + ", '{28}' " + ", '{29}' " + ", '{30}' " + ", '{31}' " + ", '{32}' " + ", '{33}' " + ", '{34}' " + ", '{35}' " + ", '{36}' " + ", '{37}' " // Add, 2017.02.08 + ", '{38}' " // Add, 2017.03.02, 연습모드 + ",N'{39}' " // Add, 2017.03.21 + ", {40} " // Add, 2017.03.31 + ", '{41}' " // Add, 2017.04.10 + ",N'{42}' " // Add, 2017.04.26, 주문담당자 + ", '{43}' " // Add, 2017.04.26, KDS 전송구분 + " ) "; #endregion if (s1stFloorCd == sKeys[1] && s1stTableNo == sKeys[2]) { #region >> 이동되지 않은 상품 var drBackOrdMsg1 = dtBackUpOrdMsg1.Rows[int.Parse(sKeys[3]) - 1]; sQuery = string.Format(sInsFmt , drBackOrdMsg1["ORD_DIV"].ToString() , s1stFloorCd , s1stTableNo , (iSeq + 1).ToString() , drBackOrdMsg1["CMP_CD"].ToString() , drBackOrdMsg1["BRAND_CD"].ToString() , drBackOrdMsg1["STOR_CD"].ToString() , drBackOrdMsg1["POS_NO"].ToString() , drBackOrdMsg1["TRADE_NO"].ToString() , drBackOrdMsg1["SALE_DT"].ToString() , drBackOrdMsg1["POS_TYPE"].ToString() , drBackOrdMsg1["ITEM_CD"].ToString() , drBackOrdMsg1["ITEM_DIV"].ToString() , drBackOrdMsg1["SHTCUT_ITEMNM"].ToString() , saleQty //, drBackOrdMsg1["SALE_QTY"].ToString() , drBackOrdMsg1["PACK_DIV"].ToString() , drBackOrdMsg1["SET_MENU_CD"].ToString() , drBackOrdMsg1["ORD_TIME"].ToString() , drBackOrdMsg1["CANCEL_DIV"].ToString() , drBackOrdMsg1["SUB_MEMO_DIV"].ToString() , ConvertDBStr(drBackOrdMsg1["MSG1"].ToString()) , ConvertDBStr(drBackOrdMsg1["MSG2"].ToString()) , ConvertDBStr(drBackOrdMsg1["MSG3"].ToString()) , drBackOrdMsg1["MSG_REG_TIME"].ToString() , drBackOrdMsg1["ORG_BILL_POSNO"].ToString() , drBackOrdMsg1["ORG_BILLDT"].ToString() , drBackOrdMsg1["ORG_BILL_NO"].ToString() , drBackOrdMsg1["SEND_YN"].ToString() , drBackOrdMsg1["SEND_CONFIRM_DIV"].ToString() , drBackOrdMsg1["RESEND_YN"].ToString() , drBackOrdMsg1["FILLER1"].ToString() // 수동주방출력 관련 구분값 , drBackOrdMsg1["FILLER2"].ToString() , drBackOrdMsg1["FILLER3"].ToString() , drBackOrdMsg1["FILLER4"].ToString() , drBackOrdMsg1["FILLER5"].ToString() , drBackOrdMsg1["UPD_DT"].ToString() , drBackOrdMsg1["REG_DT"].ToString() , drBackOrdMsg1["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrdMsg1["TRAIN_MODE_YN"].ToString() // Add, 2017.03.02, 연습모드 , ConvertDBStr(drBackOrdMsg1["KTCH_MSG"].ToString()) // Add, 2017.03.21 , drBackOrdMsg1["ORG_QTY"].ToString() // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 , ConvertDBStr(drBackOrdMsg1["ORD_PIC_NM"].ToString()) // Add, 2017.04.26, 주문담당자 , drBackOrdMsg1["KDS_SEND_YN"].ToString() // Add, 2017.04.26, KDS 전송구분 ); #endregion } else { #region >> 이동된 상품 var drBackOrdMsg2 = dtBackUpOrdMsg2.Rows[int.Parse(sKeys[3]) - 1]; sQuery = string.Format(sInsFmt , drBackOrdMsg2["ORD_DIV"].ToString() , s1stFloorCd , s1stTableNo , (iSeq + 1).ToString() , drBackOrdMsg2["CMP_CD"].ToString() , drBackOrdMsg2["BRAND_CD"].ToString() , drBackOrdMsg2["STOR_CD"].ToString() , drBackOrdMsg2["POS_NO"].ToString() , drBackOrdMsg2["TRADE_NO"].ToString() , drBackOrdMsg2["SALE_DT"].ToString() , drBackOrdMsg2["POS_TYPE"].ToString() , drBackOrdMsg2["ITEM_CD"].ToString() , drBackOrdMsg2["ITEM_DIV"].ToString() , drBackOrdMsg2["SHTCUT_ITEMNM"].ToString() , saleQty //, drBackOrdMsg2["SALE_QTY"].ToString() , drBackOrdMsg2["PACK_DIV"].ToString() , drBackOrdMsg2["SET_MENU_CD"].ToString() , drBackOrdMsg2["ORD_TIME"].ToString() , drBackOrdMsg2["CANCEL_DIV"].ToString() , drBackOrdMsg2["SUB_MEMO_DIV"].ToString() , ConvertDBStr(drBackOrdMsg2["MSG1"].ToString()) , ConvertDBStr(drBackOrdMsg2["MSG2"].ToString()) , ConvertDBStr(drBackOrdMsg2["MSG3"].ToString()) , drBackOrdMsg2["MSG_REG_TIME"].ToString() , drBackOrdMsg2["ORG_BILL_POSNO"].ToString() , drBackOrdMsg2["ORG_BILLDT"].ToString() , drBackOrdMsg2["ORG_BILL_NO"].ToString() , drBackOrdMsg2["SEND_YN"].ToString() , drBackOrdMsg2["SEND_CONFIRM_DIV"].ToString() , drBackOrdMsg2["RESEND_YN"].ToString() , drBackOrdMsg2["FILLER1"].ToString() , drBackOrdMsg2["FILLER2"].ToString() , drBackOrdMsg2["FILLER3"].ToString() , drBackOrdMsg2["FILLER4"].ToString() , drBackOrdMsg2["FILLER5"].ToString() , drBackOrdMsg2["UPD_DT"].ToString() , drBackOrdMsg2["REG_DT"].ToString() , drBackOrdMsg2["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrdMsg2["TRAIN_MODE_YN"].ToString() // Add, 2017.03.02, 연습모드 , ConvertDBStr(drBackOrdMsg2["KTCH_MSG"].ToString()) // Add, 2017.03.21 , drBackOrdMsg2["ORG_QTY"].ToString() // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 , ConvertDBStr(drBackOrdMsg2["ORD_PIC_NM"].ToString()) // Add, 2017.04.26, 주문담당자 , drBackOrdMsg2["KDS_SEND_YN"].ToString() // Add, 2017.04.26, KDS 전송구분 ); #endregion } if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region 왼쪽그리드 이동상품 주방부가메시지 추가 (MST_KTCH_ORD_MSG_ADD) var isAddmsg = true; if (s1stFloorCd == sKeys[1] && s1stTableNo == sKeys[2]) isAddmsg = false; if (CmUtil.GetDataRowStr(dr, "CANCEL_DIV") == PosConst.CANCEL_DIV.CANCEL) isAddmsg = false; if (isAddmsg) { var drBackOrder2 = dtBackUpOrd2.Rows[int.Parse(sKeys[3]) - 1]; sInsFmt = " INSERT INTO POSMST..MST_KTCH_ORD_MSG_ADD ( \n" + " ORD_DIV, FLOOR_CD, TBL_NO, SEQ, KTCH_SYS_CD, ITEM_CD, SHTCUT_ITEMNM, MSG_DIV \n" + ", MSG1, MSG2, MSG3, MSG_REG_TIME, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN \n" + ", FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT \n" + ", SUB_STOR_CD \n" // Add, 2017.02.08 + ", TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 + ", ORD_POS_NO \n" // Add, 2017.04.10 + ") \n" + " SELECT '{0}', '{1}', '{2}' \n" + " , (SELECT ISNULL(MAX(SEQ), 0) + 1 FROM POSMST..MST_KTCH_ORD_MSG_ADD WHERE ORD_DIV = '{0}' AND FLOOR_CD = '{1}' AND TBL_NO = '{2}') \n" + " , '{3}', '{4}', N'{5}', '{6}', N'{7}', N'{8}', N'{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}' \n" + " , '{21}' \n" + " , '{22}' \n" // Add, 2017.03.02, 연습모드 + " , '{23}' \n" // Add, 2017.04.10 ; var itemKey = drBackOrder2["SUB_STOR_CD"].ToString().Trim() + (drBackOrder2["SUB_MEMO_DIV"].ToString().Trim() == "1" ? drBackOrder2["FILLER1"].ToString().Trim() : drBackOrder2["ITEM_CD"].ToString().Trim()); foreach (var tmpKps in from x in lstKps where x.Key.StartsWith(itemKey) select x) { sQuery = string.Format(sInsFmt , drBackOrder2["ORD_DIV"].ToString() , s2ndFloorCd // From Floor , s2ndTableNo // From Table , tmpKps.Value , drBackOrder2["ITEM_CD"].ToString() , drBackOrder2["SHTCUT_ITEMNM"].ToString() , PosConst.KPS_ORD_MSG_ID.MENU_MOVE , s1stFloorCd // MSG1 To Floor , s1stTableNo // MSG2 To Table , saleQty // MSG3 //, drBackOrder2["SALE_QTY"].ToString() , DateTime.Now.ToString("HHmmss") , "0" , "0" , "0" , string.Empty , string.Empty , string.Empty , string.Empty , string.Empty , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") , drBackOrder2["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrder2["TRAIN_MODE_YN"].ToString() // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); // 주방출력삭제(2017.05.24) //if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) //{ // m_cSqlDbService.Rollback(); // UserLog.WriteLogFile(UserCom.LOG_ERROR, // UserCom.WARNING_LEVEL, // System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // sQuery + "[ERROR]"); // return UserCom.RST_ERR; //} } } #endregion iSeq++; } #region 테이블 마스터 업데이트 (UPDATE POSMST..MST_TBL) sQuery = " UPDATE POSMST..MST_TBL " + " SET ORD_AMT = " + dTableOrderAmt.ToString() + " , FIRST_ORD_HOUR = " + (leftItemCnt == 0 ? "''" : "FIRST_ORD_HOUR") + " , CUST_CNT = " + (leftItemCnt == 0 ? "0" : "CUST_CNT") + " , FILLER1 = " + (leftItemCnt == 0 ? "''" : "FILLER1") + " , FILLER2 = " + (leftItemCnt == 0 ? "''" : "FILLER2") + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.02, 연습모드 + " AND FLOOR_CD = '" + s1stFloorCd + "' " + " AND TBL_NO = '" + s1stTableNo + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' " ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #endregion #region ### 오른쪽 그리드 변경 데이터 Update iSeq = 0; rightItemCnt = 0; dTableOrderAmt = 0; #region 주문마스터 삭제 (DELETE FROM POSMST..MST_ORD) sQuery = " DELETE FROM POSMST..MST_ORD " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' " + " AND FLOOR_CD = '" + s2ndFloorCd + "' " + " AND TBL_NO = '" + s2ndTableNo + "' "; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region 주방주문메시지 마스터 삭제 (DELETE FROM POSMST..MST_KTCH_ORD_MSG) sQuery = " DELETE FROM POSMST..MST_KTCH_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + PosConst.ORDER_TYPE.NORMAL + "' " + " AND FLOOR_CD = '" + s2ndFloorCd + "' " + " AND TBL_NO = '" + s2ndTableNo + "' " ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion // 주문마스터 Update foreach (DataRow dr in dtRightGrid.Rows) { if (CmUtil.GetDataRowStr(dr, "CANCEL_DIV") != PosConst.CANCEL_DIV.CANCEL) { rightItemCnt++; dTableOrderAmt += CmUtil.GetDataRowDouble(dr, "BILL_AMT"); } // sKeys[0]:ORD_DIV, sKeys[1]:FLOOR_CD, sKeys[2]:TBL_NO, sKeys[3]:SEQ(GridRowNo) var sKeys = CmUtil.GetDataRowStr(dr, "REF").Split(new char[] { '|' }); var saleQty = CmUtil.GetDataRowInt(dr, "QTY"); var saleAmt = CmUtil.GetDataRowDouble(dr, "SALE_PRC") * saleQty; var billAmt = CmUtil.GetDataRowDouble(dr, "BILL_AMT"); #region 오른쪽 그리드 상품이동 #region >> INSERT INTO POSMST..MST_ORD sInsFmt = " INSERT INTO POSMST..MST_ORD ( " + " CMP_CD, STOR_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ, ITEM_CD " + " , ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, SALE_PRC, SALE_AMT " + " , BILL_AMT, DC_DIV, DC_RATE, ITEM_DC_AMT, SUM_DC_AMT " + " , CPI_DC_AMT, COOP_CARD_DC_DIV, COOP_CARD_DC_AMT, POINT_DC_DIV, POINT_DC_AMT " + " , CPN_DC_DIV, CPN_DC_AMT, EMP_DC_DIV, EMP_DC_AMT, SET_DC_AMT " + " , ETC_DC_DIV, ETC_DC, EXCEP_DC_DIV, EXCEP_DC_AMT, PACK_DIV, SET_MENU_CD, CPI_PRESENT_DIV " + " , SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME " + " , ORD_TIME, ORD_COMP_DIV, ORD_PIC_NO, CANCEL_DIV, CANCEL_DATE " + " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 " //+ " , UPD_DT, REG_DT " //+ " , UPD_DT, REG_DT, SUB_STOR_CD " // Mod, 2017.02.08 //+ " , UPD_DT, REG_DT, SUB_STOR_CD, NOTAX_DIV " // Mod, 2017.02.15 + " , UPD_DT, REG_DT, SUB_STOR_CD, NOTAX_DIV, TRAIN_MODE_YN " // Mod, 2017.03.02, 연습모드 + " , DC_TYPE " // Add, 2017.03.30 + " , ORG_QTY " // Add, 2017.03.31 + " , ORD_POS_NO " // Add, 2017.04.10 + " ) VALUES ( " + " '{0}' " + " , '{1}' " + " , '{2}' " + " , '{3}' " + " , '{4}' " + " , {5} " + " , '{6}' " + " , '{7}' " + " ,N'{8}' " + " , {9} " + " , {10} " + " , {11} " + " , {12} " + " , '{13}' " + " , {14} " + " , {15} " + " , {16} " + " , {17} " + " , '{18}' " + " , {19} " + " , '{20}' " + " , {21} " + " , '{22}' " + " , {23} " + " , '{24}' " + " , {25} " + " , {26} " + " , '{27}' " + " , {28} " + " , '{29}' " + " , {30} " + " , '{31}' " + " , '{32}' " + " , '{33}' " + " , '{34}' " + " ,N'{35}' " + " ,N'{36}' " + " ,N'{37}' " + " , '{38}' " + " , '{39}' " + " , '{40}' " + " , '{41}' " + " , '{42}' " + " , '{43}' " + " , '{44}' " + " , '{45}' " + " , '{46}' " + " , '{47}' " + " , '{48}' " + " , '{49}' " + " , '{50}' " + " , '{51}' " // Add, 2017.02.08 + " , '{52}' " // Add, 2017.02.15 + " , '{53}' " // Add, 2017.03.02, 연습모드 + " , '{54}' " // Add, 2017.03.30 + " , {55} " // Add, 2017.03.31 + " , '{56}' " // Add, 2017.04.10 + " ) "; #endregion if (s2ndFloorCd == sKeys[1] && s2ndTableNo == sKeys[2]) { #region >> 이동되지 않은 상품 var drBackOrder2 = dtBackUpOrd2.Rows[int.Parse(sKeys[3]) - 1]; sQuery = string.Format(sInsFmt , m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , drBackOrder2["ORD_DIV"].ToString() , s2ndFloorCd , s2ndTableNo , (iSeq + 1).ToString() , drBackOrder2["ITEM_CD"].ToString() , drBackOrder2["ITEM_DIV"].ToString() , drBackOrder2["SHTCUT_ITEMNM"].ToString() , saleQty //, drBackOrder2["SALE_QTY"].ToString() , drBackOrder2["SALE_PRC"].ToString() , saleAmt //, drBackOrder2["SALE_AMT"].ToString() , billAmt //, drBackOrder2["BILL_AMT"].ToString() , drBackOrder2["DC_DIV"].ToString() , drBackOrder2["DC_RATE"].ToString() , drBackOrder2["ITEM_DC_AMT"].ToString() , drBackOrder2["SUM_DC_AMT"].ToString() , drBackOrder2["CPI_DC_AMT"].ToString() , drBackOrder2["COOP_CARD_DC_DIV"].ToString() , drBackOrder2["COOP_CARD_DC_AMT"].ToString() , drBackOrder2["POINT_DC_DIV"].ToString() , drBackOrder2["POINT_DC_AMT"].ToString() , drBackOrder2["CPN_DC_DIV"].ToString() , drBackOrder2["CPN_DC_AMT"].ToString() , drBackOrder2["EMP_DC_DIV"].ToString() , drBackOrder2["EMP_DC_AMT"].ToString() , drBackOrder2["SET_DC_AMT"].ToString() , drBackOrder2["ETC_DC_DIV"].ToString() , drBackOrder2["ETC_DC"].ToString() , drBackOrder2["EXCEP_DC_DIV"].ToString() , drBackOrder2["EXCEP_DC_AMT"].ToString() , drBackOrder2["PACK_DIV"].ToString() , drBackOrder2["SET_MENU_CD"].ToString() , drBackOrder2["CPI_PRESENT_DIV"].ToString() , drBackOrder2["SUB_MEMO_DIV"].ToString() , ConvertDBStr(drBackOrder2["MSG1"].ToString()) , ConvertDBStr(drBackOrder2["MSG2"].ToString()) , ConvertDBStr(drBackOrder2["MSG3"].ToString()) , drBackOrder2["MSG_REG_TIME"].ToString() , drBackOrder2["ORD_TIME"].ToString() , drBackOrder2["ORD_COMP_DIV"].ToString() , drBackOrder2["ORD_PIC_NO"].ToString() , drBackOrder2["CANCEL_DIV"].ToString() , drBackOrder2["CANCEL_DATE"].ToString() , drBackOrder2["FILLER1"].ToString() , drBackOrder2["FILLER2"].ToString() , drBackOrder2["FILLER3"].ToString() , drBackOrder2["FILLER4"].ToString() , drBackOrder2["FILLER5"].ToString() , drBackOrder2["UPD_DT"].ToString() , drBackOrder2["REG_DT"].ToString() , drBackOrder2["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrder2["NOTAX_DIV"].ToString() // Add, 2017.02.08 , drBackOrder2["TRAIN_MODE_YN"].ToString() // Add, 2017.03.02, 연습모드 , drBackOrder2["DC_TYPE"].ToString() // Add, 2017.03.30 , drBackOrder2["ORG_QTY"].ToString() // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); #endregion } else { #region >> 이동된 상품 이면 var drBackOrder1 = dtBackUpOrd1.Rows[int.Parse(sKeys[3]) - 1]; sQuery = string.Format(sInsFmt , m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , drBackOrder1["ORD_DIV"].ToString() , s2ndFloorCd , s2ndTableNo , (iSeq + 1).ToString() , drBackOrder1["ITEM_CD"].ToString() , drBackOrder1["ITEM_DIV"].ToString() , drBackOrder1["SHTCUT_ITEMNM"].ToString() , saleQty //, drBackOrder1["SALE_QTY"].ToString() , drBackOrder1["SALE_PRC"].ToString() , saleAmt //, drBackOrder1["SALE_AMT"].ToString() , billAmt //, drBackOrder1["BILL_AMT"].ToString() , drBackOrder1["DC_DIV"].ToString() , drBackOrder1["DC_RATE"].ToString() , drBackOrder1["ITEM_DC_AMT"].ToString() , drBackOrder1["SUM_DC_AMT"].ToString() , drBackOrder1["CPI_DC_AMT"].ToString() , drBackOrder1["COOP_CARD_DC_DIV"].ToString() , drBackOrder1["COOP_CARD_DC_AMT"].ToString() , drBackOrder1["POINT_DC_DIV"].ToString() , drBackOrder1["POINT_DC_AMT"].ToString() , drBackOrder1["CPN_DC_DIV"].ToString() , drBackOrder1["CPN_DC_AMT"].ToString() , drBackOrder1["EMP_DC_DIV"].ToString() , drBackOrder1["EMP_DC_AMT"].ToString() , drBackOrder1["SET_DC_AMT"].ToString() , drBackOrder1["ETC_DC_DIV"].ToString() , drBackOrder1["ETC_DC"].ToString() , drBackOrder1["EXCEP_DC_DIV"].ToString() , drBackOrder1["EXCEP_DC_AMT"].ToString() , drBackOrder1["PACK_DIV"].ToString() , drBackOrder1["SET_MENU_CD"].ToString() , drBackOrder1["CPI_PRESENT_DIV"].ToString() , drBackOrder1["SUB_MEMO_DIV"].ToString() , ConvertDBStr(drBackOrder1["MSG1"].ToString()) , ConvertDBStr(drBackOrder1["MSG2"].ToString()) , ConvertDBStr(drBackOrder1["MSG3"].ToString()) , drBackOrder1["MSG_REG_TIME"].ToString() , drBackOrder1["ORD_TIME"].ToString() , drBackOrder1["ORD_COMP_DIV"].ToString() , drBackOrder1["ORD_PIC_NO"].ToString() , drBackOrder1["CANCEL_DIV"].ToString() , drBackOrder1["CANCEL_DATE"].ToString() , drBackOrder1["FILLER1"].ToString() , drBackOrder1["FILLER2"].ToString() , drBackOrder1["FILLER3"].ToString() , drBackOrder1["FILLER4"].ToString() , drBackOrder1["FILLER5"].ToString() , drBackOrder1["UPD_DT"].ToString() , drBackOrder1["REG_DT"].ToString() , drBackOrder1["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrder1["NOTAX_DIV"].ToString() // Add, 2017.02.08 , drBackOrder1["TRAIN_MODE_YN"].ToString() // Add, 2017.02.08 , drBackOrder1["DC_TYPE"].ToString() // Add, 2017.02.30 , drBackOrder1["ORG_QTY"].ToString() // Add, 2017.02.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); #endregion } if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region 오른쪽 그리드 주문메시지 이동 #region INSERT INTO POSMST..MST_KTCH_ORD_MSG sInsFmt = " INSERT INTO POSMST..MST_KTCH_ORD_MSG ( " + " ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE, ITEM_CD " + ", ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD " + ", ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO " + ", ORG_BILLDT, ORG_BILL_NO, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2 " //+ ", FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT " + ", FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT, SUB_STOR_CD " // Mod, 2017.02.08 + ", TRAIN_MODE_YN " // Add, 2017.03.02, 연습모드 + ", KTCH_MSG " // Add, 2017.03.21 + ", ORG_QTY " // Add, 2017.03.31 + ", ORD_POS_NO " // Add, 2017.04.10 + ", ORD_PIC_NM \n" // Add, 2017.04.26, 주문담당자 + ", KDS_SEND_YN \n" // Add, 2017.04.26, KDS 전송구분 + ") VALUES ( " + " '{0}' " + ", '{1}' " + ", '{2}' " + ", {3} " + ", '{4}' " + ", '{5}' " + ", '{6}' " + ", '{7}' " + ", '{8}' " + ", '{9}' " + ", '{10}' " + ", '{11}' " + ", '{12}' " + ",N'{13}' " + ", {14} " + ", '{15}' " + ", '{16}' " + ", '{17}' " + ", '{18}' " + ", '{19}' " + ",N'{20}' " + ",N'{21}' " + ",N'{22}' " + ", '{23}' " + ", '{24}' " + ", '{25}' " + ", '{26}' " + ", '{27}' " + ", '{28}' " + ", '{29}' " + ", '{30}' " + ", '{31}' " + ", '{32}' " + ", '{33}' " + ", '{34}' " + ", '{35}' " + ", '{36}' " + ", '{37}' " // Add, 2017.02.08 + ", '{38}' " // Add, 2017.03.02, 연습모드 + ",N'{39}' " // Add, 2017.03.21 + ", {40} " // Add, 2017.03.31 + ", '{41}' " // Add, 2017.04.10 + ",N'{42}' " // Add, 2017.04.26, 주문담당자 + ", '{43}' " // Add, 2017.04.26, KDS 전송구분 + " ) "; #endregion if (s2ndFloorCd == sKeys[1] && s2ndTableNo == sKeys[2]) { #region >> 이동되지 않은 상품 var drBackOrdMsg2 = dtBackUpOrdMsg2.Rows[int.Parse(sKeys[3]) - 1]; sQuery = string.Format(sInsFmt , drBackOrdMsg2["ORD_DIV"].ToString() , s2ndFloorCd , s2ndTableNo , (iSeq + 1).ToString() , drBackOrdMsg2["CMP_CD"].ToString() , drBackOrdMsg2["BRAND_CD"].ToString() , drBackOrdMsg2["STOR_CD"].ToString() , drBackOrdMsg2["POS_NO"].ToString() , drBackOrdMsg2["TRADE_NO"].ToString() , drBackOrdMsg2["SALE_DT"].ToString() , drBackOrdMsg2["POS_TYPE"].ToString() , drBackOrdMsg2["ITEM_CD"].ToString() , drBackOrdMsg2["ITEM_DIV"].ToString() , drBackOrdMsg2["SHTCUT_ITEMNM"].ToString() , saleQty //, drBackOrdMsg2["SALE_QTY"].ToString() , drBackOrdMsg2["PACK_DIV"].ToString() , drBackOrdMsg2["SET_MENU_CD"].ToString() , drBackOrdMsg2["ORD_TIME"].ToString() , drBackOrdMsg2["CANCEL_DIV"].ToString() , drBackOrdMsg2["SUB_MEMO_DIV"].ToString() , ConvertDBStr(drBackOrdMsg2["MSG1"].ToString()) , ConvertDBStr(drBackOrdMsg2["MSG2"].ToString()) , ConvertDBStr(drBackOrdMsg2["MSG3"].ToString()) , drBackOrdMsg2["MSG_REG_TIME"].ToString() , drBackOrdMsg2["ORG_BILL_POSNO"].ToString() , drBackOrdMsg2["ORG_BILLDT"].ToString() , drBackOrdMsg2["ORG_BILL_NO"].ToString() , drBackOrdMsg2["SEND_YN"].ToString() , drBackOrdMsg2["SEND_CONFIRM_DIV"].ToString() , drBackOrdMsg2["RESEND_YN"].ToString() , drBackOrdMsg2["FILLER1"].ToString() , drBackOrdMsg2["FILLER2"].ToString() , drBackOrdMsg2["FILLER3"].ToString() , drBackOrdMsg2["FILLER4"].ToString() , drBackOrdMsg2["FILLER5"].ToString() , drBackOrdMsg2["UPD_DT"].ToString() , drBackOrdMsg2["REG_DT"].ToString() , drBackOrdMsg2["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrdMsg2["TRAIN_MODE_YN"].ToString() // Add, 2017.02.08 , ConvertDBStr(drBackOrdMsg2["KTCH_MSG"].ToString()) // Add, 2017.03.21 , drBackOrdMsg2["ORG_QTY"].ToString() // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 , ConvertDBStr(drBackOrdMsg2["ORD_PIC_NM"].ToString()) // Add, 2017.04.26, 주문담당자 , drBackOrdMsg2["KDS_SEND_YN"].ToString() // Add, 2017.04.26, KDS 전송구분 ); #endregion } else { #region >> 이동된 상품 var drBackOrdMsg1 = dtBackUpOrdMsg1.Rows[int.Parse(sKeys[3]) - 1]; sQuery = string.Format(sInsFmt , drBackOrdMsg1["ORD_DIV"].ToString() , s2ndFloorCd , s2ndTableNo , (iSeq + 1).ToString() , drBackOrdMsg1["CMP_CD"].ToString() , drBackOrdMsg1["BRAND_CD"].ToString() , drBackOrdMsg1["STOR_CD"].ToString() , drBackOrdMsg1["POS_NO"].ToString() , drBackOrdMsg1["TRADE_NO"].ToString() , drBackOrdMsg1["SALE_DT"].ToString() , drBackOrdMsg1["POS_TYPE"].ToString() , drBackOrdMsg1["ITEM_CD"].ToString() , drBackOrdMsg1["ITEM_DIV"].ToString() , drBackOrdMsg1["SHTCUT_ITEMNM"].ToString() , saleQty //, drBackOrdMsg1["SALE_QTY"].ToString() , drBackOrdMsg1["PACK_DIV"].ToString() , drBackOrdMsg1["SET_MENU_CD"].ToString() , drBackOrdMsg1["ORD_TIME"].ToString() , drBackOrdMsg1["CANCEL_DIV"].ToString() , drBackOrdMsg1["SUB_MEMO_DIV"].ToString() , ConvertDBStr(drBackOrdMsg1["MSG1"].ToString()) , ConvertDBStr(drBackOrdMsg1["MSG2"].ToString()) , ConvertDBStr(drBackOrdMsg1["MSG3"].ToString()) , drBackOrdMsg1["MSG_REG_TIME"].ToString() , drBackOrdMsg1["ORG_BILL_POSNO"].ToString() , drBackOrdMsg1["ORG_BILLDT"].ToString() , drBackOrdMsg1["ORG_BILL_NO"].ToString() , drBackOrdMsg1["SEND_YN"].ToString() , drBackOrdMsg1["SEND_CONFIRM_DIV"].ToString() , drBackOrdMsg1["RESEND_YN"].ToString() , drBackOrdMsg1["FILLER1"].ToString() , drBackOrdMsg1["FILLER2"].ToString() , drBackOrdMsg1["FILLER3"].ToString() , drBackOrdMsg1["FILLER4"].ToString() , drBackOrdMsg1["FILLER5"].ToString() , drBackOrdMsg1["UPD_DT"].ToString() , drBackOrdMsg1["REG_DT"].ToString() , drBackOrdMsg1["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrdMsg1["TRAIN_MODE_YN"].ToString() // Add, 2017.03.02, 연습모드 , ConvertDBStr(drBackOrdMsg1["KTCH_MSG"].ToString()) // Add, 2017.03.21 , drBackOrdMsg1["ORG_QTY"].ToString() // Add, 2017.03.31 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 , ConvertDBStr(drBackOrdMsg1["ORD_PIC_NM"].ToString()) // Add, 2017.04.26, 주문담당자 , drBackOrdMsg1["KDS_SEND_YN"].ToString() // Add, 2017.04.26, KDS 전송구분 ); #endregion } if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region 오른쪽그리드 이동상품 주방부가메시지 추가 (MST_KTCH_ORD_MSG_ADD) var isAddmsg = true; if (s2ndFloorCd == sKeys[1] && s2ndTableNo == sKeys[2]) isAddmsg = false; if (CmUtil.GetDataRowStr(dr, "CANCEL_DIV") == PosConst.CANCEL_DIV.CANCEL) isAddmsg = false; if (isAddmsg) { var drBackOrder1 = dtBackUpOrd1.Rows[int.Parse(sKeys[3]) - 1]; sInsFmt = " INSERT INTO POSMST..MST_KTCH_ORD_MSG_ADD ( \n" + " ORD_DIV, FLOOR_CD, TBL_NO, SEQ, KTCH_SYS_CD, ITEM_CD, SHTCUT_ITEMNM, MSG_DIV \n" + ", MSG1, MSG2, MSG3, MSG_REG_TIME, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN \n" + ", FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT \n" + ", SUB_STOR_CD \n" // Add, 2017.02.08 + ", TRAIN_MODE_YN \n" // Add, 2017.03.02, 연습모드 + ", ORD_POS_NO \n" // Add, 2017.04.10 + ") \n" + " SELECT '{0}', '{1}', '{2}' \n" + " , (SELECT ISNULL(MAX(SEQ), 0) + 1 FROM POSMST..MST_KTCH_ORD_MSG_ADD WHERE ORD_DIV = '{0}' AND FLOOR_CD = '{1}' AND TBL_NO = '{2}') \n" + " , '{3}', '{4}', N'{5}', '{6}', N'{7}', N'{8}', N'{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}' \n" + " , '{21}' \n" + " , '{22}' \n" // Add, 2017.03.02, 연습모드 + " , '{23}' \n" // Add, 2017.04.10 ; var itemKey = drBackOrder1["SUB_STOR_CD"].ToString().Trim() + (drBackOrder1["SUB_MEMO_DIV"].ToString().Trim() == "1" ? drBackOrder1["FILLER1"].ToString().Trim() : drBackOrder1["ITEM_CD"].ToString().Trim()); foreach (var tmpKps in from x in lstKps where x.Key.StartsWith(itemKey) select x) { sQuery = string.Format(sInsFmt , drBackOrder1["ORD_DIV"].ToString() , s1stFloorCd // From Floor , s1stTableNo // From Table , tmpKps.Value , drBackOrder1["ITEM_CD"].ToString() , drBackOrder1["SHTCUT_ITEMNM"].ToString() , PosConst.KPS_ORD_MSG_ID.MENU_MOVE , s2ndFloorCd // MSG1 To Floor , s2ndTableNo // MSG2 To Table , saleQty // MSG3 , drBackOrder1["SALE_QTY"].ToString() , DateTime.Now.ToString("HHmmss") , "0" , "0" , "0" , string.Empty , string.Empty , string.Empty , string.Empty , string.Empty , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") , drBackOrder1["SUB_STOR_CD"].ToString() // Add, 2017.02.08 , drBackOrder1["TRAIN_MODE_YN"].ToString() // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); // 주방출력삭제(2017.05.24) //if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) //{ // m_cSqlDbService.Rollback(); // UserLog.WriteLogFile(UserCom.LOG_ERROR, // UserCom.WARNING_LEVEL, // System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // sQuery + "[ERROR]"); // return UserCom.RST_ERR; //} } } #endregion iSeq++; } #region 테이블 마스터 업데이트 (UPDATE POSMST..MST_TBL) //if (bIsFirstOrder == true && dtRightGrid.Rows.Count > 0) if (bIsFirstOrder == true && rightItemCnt > 0) { sQuery = " UPDATE POSMST..MST_TBL " + " SET CUST_CNT = 1 " + " , FIRST_ORD_HOUR = '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' " + " , ORD_AMT = " + dTableOrderAmt.ToString() + " " + " , FILLER1 = '' " + " , FILLER2 = '' " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.02, 연습모드 + " AND FLOOR_CD = '" + s2ndFloorCd + "' " + " AND TBL_NO = '" + s2ndTableNo + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; } else { // 테이블마스터 주문금액 수정 sQuery = " UPDATE POSMST..MST_TBL " + " SET ORD_AMT = " + dTableOrderAmt.ToString() + " " + " , FIRST_ORD_HOUR = " + (rightItemCnt == 0 ? "''" : "FIRST_ORD_HOUR") + " , CUST_CNT = " + (rightItemCnt == 0 ? "0" : "CUST_CNT") + " , FILLER1 = " + (rightItemCnt == 0 ? "0" : "FILLER1") + " , FILLER2 = " + (rightItemCnt == 0 ? "0" : "FILLER2") + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.02, 연습모드 + " AND FLOOR_CD = '" + s2ndFloorCd + "' " + " AND TBL_NO = '" + s2ndTableNo + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; } if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #endregion #region ### 좌석메모 // 주방출력 상품에 따라 이동 해야 하지만, 어떤 상품에 등록된 좌석메모 인지 알수가 없기 때문에 모른척 한다. //if (dtLeftGrid.Rows.Count == 0 || dtRightGrid.Rows.Count == 0) if (leftItemCnt == 0 || rightItemCnt == 0) { string fmt = "UPDATE POSMST..MST_SEAT_MEMO \n" + " SET FLOOR_CD = '{6}' \n" + " , TBL_NO = '{7}' \n" + " , SEQ = SEQ + (SELECT ISNULL(MAX(SEQ), 0) FROM MST_SEAT_MEMO \n" + " WHERE CMP_CD = '{0}' \n" + " AND STOR_CD = '{1}' \n" + " AND TRAIN_MODE_YN = '{2}' \n" + " AND ORD_DIV = '{3}' \n" + " AND FLOOR_CD = '{6}' \n" + " AND TBL_NO = '{7}')\n" + " WHERE CMP_CD = '{0}' \n " + " AND STOR_CD = '{1}' \n" + " AND TRAIN_MODE_YN = '{2}' \n " + " AND ORD_DIV = '{3}' \n" + " AND FLOOR_CD = '{4}' \n" + " AND TBL_NO = '{5}' " ; if (dtLeftGrid.Rows.Count == 0) { sQuery = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL , s1stFloorCd, s1stTableNo, s2ndFloorCd, s2ndTableNo); } else { sQuery = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, PosConst.ORDER_TYPE.NORMAL , s2ndFloorCd, s2ndTableNo, s1stFloorCd, s1stTableNo); } if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } } #endregion #region ### 유효하지 않는 테이블 주문 초기화 // 이건 아닌거 같은데 .. var isClear = new bool[] { true, true }; var lstQuery = new List(); foreach (DataRow dr in dtLeftGrid.Rows) { if (CmUtil.GetDataRowStr(dr, "CANCEL_DIV") != PosConst.CANCEL_DIV.CANCEL) { isClear[0] = false; break; } } foreach (DataRow dr in dtRightGrid.Rows) { if (CmUtil.GetDataRowStr(dr, "CANCEL_DIV") != PosConst.CANCEL_DIV.CANCEL) { isClear[1] = false; break; } } if (isClear[0] || isClear[1]) { if (isClear[0]) { sQuery = "UPDATE POSMST..MST_TBL " + " SET TBL_USE_DIV = '" + PosConst.TABLE_USE_FLAG.NO_USE + "' " + " , CUST_CNT = 0 " + " , FIRST_ORD_HOUR = '' " + " , ORD_AMT = 0 " + " , FILLER1 = '' " + " , FILLER2 = '' " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND FLOOR_CD = '" + s1stFloorCd + "' " + " AND TBL_NO = '" + s1stTableNo + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; lstQuery.Add(sQuery); sQuery = "DELETE FROM POSMST..MST_ORD " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + s1stFloorCd + "' " + " AND TBL_NO = '" + s1stTableNo + "' " ; lstQuery.Add(sQuery); sQuery = "DELETE FROM POSMST..MST_KTCH_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + s1stFloorCd + "' " + " AND TBL_NO = '" + s1stTableNo + "' " ; lstQuery.Add(sQuery); sQuery = "DELETE FROM POSMST..MST_KPS_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + s1stFloorCd + "' " + " AND TBL_NO = '" + s1stTableNo + "' " ; lstQuery.Add(sQuery); } if (isClear[1]) { sQuery = "UPDATE POSMST..MST_TBL " + " SET TBL_USE_DIV = '" + PosConst.TABLE_USE_FLAG.NO_USE + "' " + " , CUST_CNT = 0 " + " , FIRST_ORD_HOUR = '' " + " , ORD_AMT = 0 " + " , FILLER1 = '' " + " , FILLER2 = '' " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND FLOOR_CD = '" + s2ndFloorCd + "' " + " AND TBL_NO = '" + s2ndTableNo + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; lstQuery.Add(sQuery); sQuery = "DELETE FROM POSMST..MST_ORD " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + s2ndFloorCd + "' " + " AND TBL_NO = '" + s2ndTableNo + "' " ; lstQuery.Add(sQuery); sQuery = "DELETE FROM POSMST..MST_KTCH_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + s2ndFloorCd + "' " + " AND TBL_NO = '" + s2ndTableNo + "' " ; lstQuery.Add(sQuery); sQuery = "DELETE FROM POSMST..MST_KPS_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + s2ndFloorCd + "' " + " AND TBL_NO = '" + s2ndTableNo + "' " ; lstQuery.Add(sQuery); } } if (lstQuery.Count > 0) { if (m_cSqlDbService.DBExecuteNonQuery(lstQuery.ToArray()) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } } #endregion // Commit m_cSqlDbService.Commit(); sReturn = UserCom.RST_OK; // 메뉴이동테이블 주문내역서 출력 this.ExecuteOrderBillReceipt(s1stFloorCd, s1stTableNo); this.ExecuteOrderBillReceipt(s2ndFloorCd, s2ndTableNo); } catch (Exception ex) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 좌석메모/상품메모 관련 임시 메모 클래스 Update /// /// /// /// /// /// /// public string UpdateKtchOrderMessage(string sMsgId, int iItemRow, string sMsg1, string sMsg2, string sMsg3) { string sReturn = UserCom.RST_ERR; try { KTCH_MSG_ADD cKtchMsg = new KTCH_MSG_ADD(); switch (sMsgId) { case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO: case PosConst.KPS_ORD_MSG_ID.FIRE_KEY : ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iItemRow]; // Add, 2017.03.21 if (sMsgId == PosConst.KPS_ORD_MSG_ID.ITEM_MEMO) { cSaleItem.ITEM_MEMO_1 = sMsg1; cSaleItem.ITEM_MEMO_2 = sMsg2; cSaleItem.ITEM_MEMO_3 = sMsg3; // 신규,수정 상품의 메모는 주문서에서 출력한다. if (cSaleItem.ORDER_OK_FLAG != PosConst.PLU_ORDER_OK_FLAG.ORDER_OK) { sReturn = UserCom.RST_OK; break; } } cKtchMsg.sMsgID = sMsgId; cKtchMsg.sMsg1 = sMsg1; cKtchMsg.sMsg2 = sMsg2; cKtchMsg.sMsg3 = sMsg3; cKtchMsg.sSubShopCd = cSaleItem.SUB_SHOP_CD; cKtchMsg.sItemCode = cSaleItem.ITEM_PLU_CD; cKtchMsg.sItemName = cSaleItem.ITEM_NAME; cKtchMsg.sItemSeqNo = (iItemRow + 1).ToString(); for(int i = 0;i < m_aKtchMsgAdd.Count;i++) { KTCH_MSG_ADD cKtchMsg2 = (KTCH_MSG_ADD)m_aKtchMsgAdd[i]; if(cKtchMsg.sMsgID == cKtchMsg2.sMsgID && cKtchMsg.sItemCode == cKtchMsg2.sItemCode && cKtchMsg.sMsg1 == cKtchMsg2.sMsg1 && cKtchMsg.sMsg2 == cKtchMsg2.sMsg2 && cKtchMsg.sMsg3 == cKtchMsg2.sMsg3) { return UserCom.RST_OK; } } m_aKtchMsgAdd.Add(cKtchMsg); sReturn = UserCom.RST_OK; break; default: cKtchMsg.sMsgID = sMsgId; cKtchMsg.sMsg1 = sMsg1; cKtchMsg.sMsg2 = sMsg2; cKtchMsg.sMsg3 = sMsg3; m_aKtchMsgAdd.Add(cKtchMsg); sReturn = this.UpdateKtchOrderMsgExecute(); break; } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 추가 주방메시지 테이블 저장 처리 /// /// private string UpdateKtchOrderMsgExecute(bool isTransction = false) { string sInsQuery = string.Empty; string sUpdQuery = string.Empty; string sUpdQuery2 = string.Empty; string sQuery = string.Empty; string sReturn = UserCom.RST_ERR; int nSeqNo = 0; try { if (m_aKtchMsgAdd.Count <= 0) return UserCom.RST_OK; DataTable dtReturn = null; // 주방장치조회 dtReturn = null; Dictionary lstKps = new Dictionary(); if (GetKtchDiveceItem(m_cTrnStatus.Head.FloorCd, m_cTrnStatus.Head.TableNo, out dtReturn) > 0) { foreach (DataRow dr in dtReturn.Rows) { var key = CmUtil.GetDataRowStr(dr, "SUB_STOR_CD").Trim() + "|" + CmUtil.GetDataRowStr(dr, "ITEM_CD").Trim() + "|" + CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD").Trim(); var dev = CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD").Trim(); if (lstKps.ContainsKey(key) == false) lstKps.Add(key, dev); } } // MST_KTCH_ORD_MSG_ADD 일련번호 sQuery = " SELECT ISNULL(MAX(SEQ),0) SEQ FROM POSMST..MST_KTCH_ORD_MSG_ADD "; sQuery += " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' "; // Add, 2017.03.02, 연습모드 sQuery += " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' "; sQuery += " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' "; sQuery += " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; dtReturn = null; m_cSqlDbService.DBSelect(sQuery, out dtReturn); if (dtReturn != null && dtReturn.Rows.Count > 0) { nSeqNo = int.Parse(dtReturn.Rows[0]["SEQ"].ToString()); } nSeqNo++; //sInsQuery = " INSERT INTO POSMST..MST_KTCH_ORD_MSG_ADD "; //sInsQuery += " ( ORD_DIV, FLOOR_CD, TBL_NO, SEQ, KTCH_SYS_CD, ITEM_CD, SHTCUT_ITEMNM, MSG_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT ) "; //sInsQuery += " VALUES "; //sInsQuery += " ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', N'{6}', '{7}', N'{8}', N'{9}', N'{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}' ) "; sInsQuery = " INSERT INTO POSMST..MST_KTCH_ORD_MSG_ADD "; sInsQuery += " ( ORD_DIV, FLOOR_CD, TBL_NO, SEQ, KTCH_SYS_CD, ITEM_CD, SHTCUT_ITEMNM, MSG_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT, SUB_STOR_CD "; sInsQuery += " , TRAIN_MODE_YN "; // Add, 2017.03.02, 연습모드 sInsQuery += " , ORD_POS_NO "; // Add, 2017.04.10 sInsQuery += " ) "; sInsQuery += " VALUES "; sInsQuery += " ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', N'{6}', '{7}', N'{8}', N'{9}', N'{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}'"; sInsQuery += " , '{23}' "; // Add, 2017.03.02, 연습모드 sInsQuery += " , '{24}' "; // Add, 2017.04.10 sInsQuery += " ) "; sUpdQuery = " UPDATE POSMST..MST_ORD \n"; sUpdQuery += " SET MSG1 =N'{0}' \n"; sUpdQuery += " , MSG2 =N'{1}' \n"; sUpdQuery += " , MSG3 =N'{2}' \n"; sUpdQuery += " , MSG_REG_TIME = '{3}' \n"; sUpdQuery += " , ORD_POS_NO = '{11}'\n"; // Add, 2017.04.10 sUpdQuery += " WHERE CMP_CD = '{4}' \n"; sUpdQuery += " AND STOR_CD = '{5}' \n"; sUpdQuery += " AND TRAIN_MODE_YN = '{6}' \n"; // Add, 2017.03.02, 연습모드 sUpdQuery += " AND ORD_DIV = '{7}' \n"; sUpdQuery += " AND FLOOR_CD = '{8}' \n"; sUpdQuery += " AND TBL_NO = '{9}' \n"; sUpdQuery += " AND SEQ = {10} \n"; sUpdQuery2 = " UPDATE POSMST..MST_KTCH_ORD_MSG \n"; sUpdQuery2 += " SET MSG1 =N'{0}' \n"; sUpdQuery2 += " , MSG2 =N'{1}' \n"; sUpdQuery2 += " , MSG3 =N'{2}' \n"; sUpdQuery2 += " , ORD_POS_NO = '{9}' \n"; // Add, 2017.04.10 sUpdQuery2 += " , MSG_REG_TIME = '{3}' \n"; sUpdQuery2 += " WHERE TRAIN_MODE_YN = '{4}' \n"; // Add, 2017.03.02, 연습모드 sUpdQuery2 += " AND ORD_DIV = '{5}' \n"; sUpdQuery2 += " AND FLOOR_CD = '{6}' \n"; sUpdQuery2 += " AND TBL_NO = '{7}' \n"; sUpdQuery2 += " AND SEQ = {8} \n"; // Transaction Begin m_cSqlDbService.Begin(); for (int i = 0; i < m_aKtchMsgAdd.Count; i++) { KTCH_MSG_ADD cKtchMsg = (KTCH_MSG_ADD)m_aKtchMsgAdd[i]; var itemKey = cKtchMsg.sSubShopCd + "|" + cKtchMsg.sItemCode; if (string.IsNullOrWhiteSpace(cKtchMsg.sSubShopCd + cKtchMsg.sItemCode)) itemKey = string.Empty; foreach(var tmpKps in from x in lstKps where x.Key.StartsWith(itemKey) select x) { string[] kpsInfo = tmpKps.Key.Split('|'); if (cKtchMsg.sMsgID == PosConst.KPS_ORD_MSG_ID.ITEM_MEMO) { #region ### 상품메모 #region >> INSERT INTO POSMST..MST_KTCH_ORD_MSG_ADD sQuery = string.Format(sInsQuery , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , nSeqNo.ToString() , tmpKps.Value , cKtchMsg.sItemCode , cKtchMsg.sItemName , cKtchMsg.sMsgID , ConvertDBStr(cKtchMsg.sMsg1) , ConvertDBStr(cKtchMsg.sMsg2) , ConvertDBStr(cKtchMsg.sMsg3) , DateTime.Now.ToString("HHmmss") , "0" , "0" , "0" , string.Empty , string.Empty , string.Empty , string.Empty , string.Empty , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") //, cKtchMsg.sSubShopCd // Add, 2017.02.07, 서브매장코드 , kpsInfo[0] // Add, 2017.02.07, 서브매장코드 , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } #endregion #region >> UPDATE POSMST..MST_ORD sQuery = string.Format(sUpdQuery , ConvertDBStr(cKtchMsg.sMsg1) , ConvertDBStr(cKtchMsg.sMsg2) , ConvertDBStr(cKtchMsg.sMsg3) , DateTime.Now.ToString("HHmmss") , m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , cKtchMsg.sItemSeqNo , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } #endregion #region >> UPDATE POSMST..MST_KTCH_ORD_MSG // 주방프린터 수동출력(상품선택) 옵션 시 주방메모와 충돌 if (PosMstManager.GetPosOption(POS_OPTION.OPT425) != "2") { sQuery = string.Format(sUpdQuery2 , ConvertDBStr(cKtchMsg.sMsg1) , ConvertDBStr(cKtchMsg.sMsg2) , ConvertDBStr(cKtchMsg.sMsg3) , DateTime.Now.ToString("HHmmss") , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , cKtchMsg.sItemSeqNo , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } } #endregion // 상품메모 업데이트 ArrayList alPluItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); Column.TR_PLU.DATA cPluItem = (Column.TR_PLU.DATA)alPluItem[CmUtil.IntParse(cKtchMsg.sItemSeqNo) - 1]; cPluItem.ITEM_MEMO_1 = cKtchMsg.sMsg1; cPluItem.ITEM_MEMO_2 = cKtchMsg.sMsg2; cPluItem.ITEM_MEMO_3 = cKtchMsg.sMsg3; #endregion } else if (cKtchMsg.sMsgID == PosConst.KPS_ORD_MSG_ID.FIRE_KEY) { #region ### FireKey sQuery = string.Format(sInsQuery , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , nSeqNo.ToString() , tmpKps.Value // CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD") , cKtchMsg.sItemCode , cKtchMsg.sItemName , cKtchMsg.sMsgID , ConvertDBStr(cKtchMsg.sMsg1) , ConvertDBStr(cKtchMsg.sMsg2) , ConvertDBStr(cKtchMsg.sMsg3) , DateTime.Now.ToString("HHmmss") , "0" , "0" , "0" , string.Empty , string.Empty , string.Empty , string.Empty , string.Empty , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") //, cKtchMsg.sSubShopCd // Add, 2017.02.07, 서브매장코드 , kpsInfo[0] // Add, 2017.02.07, 서브매장코드 , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } #endregion } else { #region ### 0:거래중지, 2:좌석메모 sQuery = string.Format(sInsQuery , m_cTrnStatus.Head.OrderFlag , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , nSeqNo.ToString() , tmpKps.Value // CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD") , string.Empty , string.Empty , cKtchMsg.sMsgID , ConvertDBStr(cKtchMsg.sMsg1) , ConvertDBStr(cKtchMsg.sMsg2) , ConvertDBStr(cKtchMsg.sMsg3) , DateTime.Now.ToString("HHmmss") , "0" , "0" , "0" , string.Empty , string.Empty , string.Empty , string.Empty , string.Empty , DateTime.Now.ToString("yyyyMMddHHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") //, cKtchMsg.sSubShopCd // Add, 2017.02.07, 서브매장코드 , kpsInfo[0] // Add, 2017.02.07, 서브매장코드 , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , m_cPosStatus.Base.PosNo // Add, 2017.04.10 ); if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Query=" + sQuery); return UserCom.RST_ERR; } #endregion } nSeqNo++; } #region ### 좌석메모이력 (MST_SEAT_MEMO) // (PosConst.KPS_ORD_MSG_ID, 0:거래중지, 1:상품메모, 2:좌석메모, 3:테이블합석, 4:테이블이동, 5:상품이동, 9:FierKey) if (cKtchMsg.sMsgID == PosConst.KPS_ORD_MSG_ID.SEAT_MEMO) { string fmt = "INSERT INTO POSMST..MST_SEAT_MEMO (CMP_CD, STOR_CD, TRAIN_MODE_YN, ORD_DIV, FLOOR_CD, TBL_NO, SEQ, MSG1, MSG2, MSG3, CASHIER_ID, REG_TIME, REG_DT) \n" + "SELECT '{0}', '{1}', '{2}', '{3}', '{4}', '{5}' \n" + " , (SELECT ISNULL(MAX(SEQ) + 1, 1) FROM POSMST..MST_SEAT_MEMO A \n" + " WHERE A.CMP_CD = '{0}' AND A.STOR_CD = '{1}' AND A.TRAIN_MODE_YN = '{2}' AND A.ORD_DIV = '{3}' AND A.FLOOR_CD = '{4}' AND A.TBL_NO = '{5}') \n" + " , N'{6}', N'{7}', N'{8}', '{9}', '{10}', '{11}' " ; sQuery = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , m_cPosStatus.Base.TrainingFlag // Add, 2017.03.02, 연습모드 , PosConst.ORDER_TYPE.NORMAL , m_cTrnStatus.Head.FloorCd , m_cTrnStatus.Head.TableNo , ConvertDBStr(cKtchMsg.sMsg1) , ConvertDBStr(cKtchMsg.sMsg2) , ConvertDBStr(cKtchMsg.sMsg3) , m_cTrnStatus.Head.CashierId , DateTime.Now.ToString("HHmmss") , DateTime.Now.ToString("yyyyMMddHHmmss") ); if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (클래스명) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (함수명) "Query=" + sQuery); return UserCom.RST_ERR; } } #endregion } // Commit m_cSqlDbService.Commit(); m_aKtchMsgAdd.Clear(); sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR + ex.Message; } return sReturn; } /// /// 테이블 주문상품의 주방장치코드 갯수 가져오기 /// /// 주문상태 (0:주문중, 1:주문완료, 2:주문수정) /// /// /// 서브매장코드 + 상품코드 /// public int GetKtchDiveceCount(string orderFlag, string floorCd, string tableNo, string itemCode = "") { try { var ret = UserCom.NG; DataTable dtData = null; if (orderFlag == PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) { var fmt = "SELECT A.SUB_STOR_CD, A.KTCH_SYS_CD \n" + " FROM POSMST..MST_KTCH_DEVICE A WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n" + " WHERE A.CMP_CD = B.CMP_CD \n" + " AND A.STOR_CD = B.STOR_CD \n" + " AND CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n" + " AND A.CMP_CD = '{0}' \n" + " AND A.STOR_CD = '{1}' \n" + " AND A.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n" + " AND A.KTCH_SYS_CD <> '99' \n" + " AND A.USE_YN = '{2}' \n" + " AND B.USE_YN = '{2}' \n" + " AND B.FLOOR_CD IN ('999', '{3}') \n" + " AND B.SUB_STOR_CD + B.ITEM_CD LIKE '{4}%' \n" ; var sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , PosConst.MST_USE_YN.YES , floorCd , itemCode); // return -> 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음 ret = m_cSqlDbService.DBSelect(sql, out dtData); } else { ret = GetKtchDivece(floorCd, tableNo, itemCode, out dtData); } if (ret != UserCom.OK) return 0; return dtData.Rows.Count; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return 0; } } /// /// 주방장치목록 가져오기 /// /// /// /// /// 서브매장코드+상품코드 /// /// /// /// 99번 = 가상장치 전체 /// private int GetKtchDivece(string floorCd, string tableNo, string itemCode, out DataTable dtData) { dtData = null; try { var fmt = string.Empty; var sql = string.Empty; #region (주방출력 선택 옵션 이전 코드) //switch (msgId) //{ // case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO: // case PosConst.KPS_ORD_MSG_ID.MENU_MOVE: // case PosConst.KPS_ORD_MSG_ID.FIRE_KEY: // fmt = "SELECT DISTINCT A.SUB_STOR_CD, A.KTCH_SYS_CD " // + " FROM POSMST..MST_KTCH_DEVICE A JOIN POSMST..MST_KTCH_DEVICE_ITEM B " // + " ON A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.KTCH_SYS_CD = B.KTCH_SYS_CD " // + " WHERE A.CMP_CD = '{0}' " // + " AND A.STOR_CD = '{1}' " // + " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' " // + " AND A.KTCH_SYS_CD <> '99' " // Add, 2017.01.18 // + " AND B.FLOOR_CD IN ('999','{2}') " // + " AND B.SUB_STOR_CD + B.ITEM_CD = '{3}' " // ; // sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, floorCd, itemCode); // break; // default: // fmt = "SELECT DISTINCT A.SUB_STOR_CD, A.KTCH_SYS_CD \n" // + " FROM POSMST..MST_KTCH_DEVICE A \n" // + " JOIN POSMST..MST_KTCH_DEVICE_ITEM B ON A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.KTCH_SYS_CD = B.KTCH_SYS_CD \n" // + " WHERE A.CMP_CD = '{0}' \n" // + " AND A.STOR_CD = '{1}' \n" // + " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n" // + " AND A.KTCH_SYS_CD <> '99' \n" // Add, 2017.01.18 // + " AND B.FLOOR_CD IN ('999','{3}') \n" // + " AND B.ITEM_CD IN (SELECT ITEM_CD FROM MST_KTCH_ORD_MSG WITH(NOLOCK) WHERE ORD_DIV = '{2}' AND FLOOR_CD = '{3}' AND TBL_NO = '{4}') "; // //sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cTrnStatus.Head.OrderFlag, floorCd, tableNo); // break; //} #endregion if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "1") { fmt = "SELECT DISTINCT A.SUB_STOR_CD, A.KTCH_SYS_CD \n" + " FROM POSMST..MST_KTCH_DEVICE A WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_ORD_MSG C \n" + " WHERE A.CMP_CD = B.CMP_CD \n" + " AND A.STOR_CD = B.STOR_CD \n" + " AND CASE WHEN B.KTCH_SYS_CD = '99' OR C.FILLER1= '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN B.KTCH_SYS_CD = '99' OR C.FILLER1= '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n" + " AND B.SUB_STOR_CD = C.SUB_STOR_CD \n" + " AND B.ITEM_CD = C.ITEM_CD \n" + " AND CASE WHEN C.FILLER1 = '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN C.FILLER1 = '99' THEN '1' ELSE C.FILLER1 END \n" + " AND A.CMP_CD = '{0}' \n" + " AND A.STOR_CD = '{1}' \n" + " AND A.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n" + " AND A.KTCH_SYS_CD <> '99' \n" + " AND A.USE_YN = '{2}' \n" + " AND B.USE_YN = '{2}' \n" + " AND B.FLOOR_CD IN ('999', '{5}') \n" + " AND C.TRAIN_MODE_YN = '{3}' \n" // Add, 2017.03.02, 연습모드 + " AND C.ORD_DIV = '{4}' \n" + " AND C.FLOOR_CD = '{5}' \n" + " AND C.TBL_NO = '{6}' \n" + " AND C.SUB_STOR_CD + C.ITEM_CD LIKE '{7}%' \n" ; } else if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "2") { fmt = "SELECT DISTINCT A.SUB_STOR_CD, A.KTCH_SYS_CD \n" + " FROM POSMST..MST_KTCH_DEVICE A WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_ORD_MSG C \n" + " WHERE A.CMP_CD = B.CMP_CD \n" + " AND A.STOR_CD = B.STOR_CD \n" + " AND CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n" + " AND B.SUB_STOR_CD = C.SUB_STOR_CD \n" + " AND B.ITEM_CD = C.ITEM_CD \n" + " AND A.CMP_CD = '{0}' \n" + " AND A.STOR_CD = '{1}' \n" + " AND A.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n" + " AND A.KTCH_SYS_CD <> '99' \n" + " AND A.USE_YN = '{2}' \n" + " AND B.USE_YN = '{2}' \n" + " AND B.FLOOR_CD IN ('999', '{5}') \n" + " AND C.TRAIN_MODE_YN = '{3}' \n" // Add, 2017.03.02, 연습모드 + " AND C.ORD_DIV = '{4}' \n" + " AND C.FLOOR_CD = '{5}' \n" + " AND C.TBL_NO = '{6}' \n" + " AND C.FILLER1 = 'PRINT' \n" + " AND C.SUB_STOR_CD + C.ITEM_CD LIKE '{7}%' \n" ; } else { fmt = "SELECT DISTINCT A.SUB_STOR_CD, A.KTCH_SYS_CD \n" + " FROM POSMST..MST_KTCH_DEVICE A WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_ORD_MSG C \n" + " WHERE A.CMP_CD = B.CMP_CD \n" + " AND A.STOR_CD = B.STOR_CD \n" + " AND CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n" + " AND B.SUB_STOR_CD = C.SUB_STOR_CD \n" + " AND B.ITEM_CD = C.ITEM_CD \n" + " AND A.CMP_CD = '{0}' \n" + " AND A.STOR_CD = '{1}' \n" + " AND A.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n" + " AND A.KTCH_SYS_CD <> '99' \n" + " AND A.USE_YN = '{2}' \n" + " AND B.USE_YN = '{2}' \n" + " AND B.FLOOR_CD IN ('999', '{5}') \n" + " AND C.TRAIN_MODE_YN = '{3}' \n" // Add, 2017.03.02, 연습모드 + " AND C.ORD_DIV = '{4}' \n" + " AND C.FLOOR_CD = '{5}' \n" + " AND C.TBL_NO = '{6}' \n" + " AND C.SUB_STOR_CD + C.ITEM_CD LIKE '{7}%' \n" ; } sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , PosConst.MST_USE_YN.YES , m_cPosStatus.Base.TrainingFlag , m_cTrnStatus.Head.OrderFlag , floorCd , tableNo , itemCode); // return -> 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음 int ret = m_cSqlDbService.DBSelect(sql, out dtData); return ret; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return -3; } } /// /// 상품별 주방장치목록 가져오기 (메뉴이동시 사용) /// /// /// /// /// private int GetKtchDiveceItem(string floorCd, string tableNo, out DataTable dtData) { dtData = null; try { var fmt = string.Empty; var sql = string.Empty; if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "1") { fmt = "SELECT DISTINCT A.SUB_STOR_CD, A.KTCH_SYS_CD, C.ITEM_CD \n" + " FROM POSMST..MST_KTCH_DEVICE A WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_ORD_MSG C \n" + " WHERE A.CMP_CD = B.CMP_CD \n" + " AND A.STOR_CD = B.STOR_CD \n" + " AND CASE WHEN B.KTCH_SYS_CD = '99' OR C.FILLER1= '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN B.KTCH_SYS_CD = '99' OR C.FILLER1= '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n" + " AND B.SUB_STOR_CD = C.SUB_STOR_CD \n" + " AND B.ITEM_CD = C.ITEM_CD \n" + " AND CASE WHEN C.FILLER1 = '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN C.FILLER1 = '99' THEN '1' ELSE C.FILLER1 END \n" + " AND A.CMP_CD = '{0}' \n" + " AND A.STOR_CD = '{1}' \n" //+ " AND A.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n" + " AND A.KTCH_SYS_CD <> '99' \n" + " AND A.USE_YN = '{2}' \n" + " AND B.USE_YN = '{2}' \n" + " AND B.FLOOR_CD IN ('999', '{5}') \n" + " AND C.TRAIN_MODE_YN = '{3}' \n" // Add, 2017.03.02, 연습모드 + " AND C.ORD_DIV = '{4}' \n" + " AND C.FLOOR_CD = '{5}' \n" + " AND C.TBL_NO = '{6}' \n" ; } else if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "2") { fmt = "SELECT DISTINCT A.SUB_STOR_CD, A.KTCH_SYS_CD, C.ITEM_CD \n" + " FROM POSMST..MST_KTCH_DEVICE A WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_ORD_MSG C \n" + " WHERE A.CMP_CD = B.CMP_CD \n" + " AND A.STOR_CD = B.STOR_CD \n" + " AND CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n" + " AND B.SUB_STOR_CD = C.SUB_STOR_CD \n" + " AND B.ITEM_CD = C.ITEM_CD \n" + " AND A.CMP_CD = '{0}' \n" + " AND A.STOR_CD = '{1}' \n" //+ " AND A.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n" + " AND A.KTCH_SYS_CD <> '99' \n" + " AND A.USE_YN = '{2}' \n" + " AND B.USE_YN = '{2}' \n" + " AND B.FLOOR_CD IN ('999', '{5}') \n" + " AND C.TRAIN_MODE_YN = '{3}' \n" // Add, 2017.03.02, 연습모드 + " AND C.ORD_DIV = '{4}' \n" + " AND C.FLOOR_CD = '{5}' \n" + " AND C.TBL_NO = '{6}' \n" + " AND C.FILLER1 = 'PRINT' \n" ; } else { fmt = "SELECT DISTINCT A.SUB_STOR_CD, A.KTCH_SYS_CD, C.ITEM_CD \n" + " FROM POSMST..MST_KTCH_DEVICE A WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n" + " , POSMST..MST_KTCH_ORD_MSG C \n" + " WHERE A.CMP_CD = B.CMP_CD \n" + " AND A.STOR_CD = B.STOR_CD \n" + " AND CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE A.SUB_STOR_CD + A.KTCH_SYS_CD END \n" + " = CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n" + " AND B.SUB_STOR_CD = C.SUB_STOR_CD \n" + " AND B.ITEM_CD = C.ITEM_CD \n" + " AND A.CMP_CD = '{0}' \n" + " AND A.STOR_CD = '{1}' \n" //+ " AND A.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n" + " AND A.KTCH_SYS_CD <> '99' \n" + " AND A.USE_YN = '{2}' \n" + " AND B.USE_YN = '{2}' \n" + " AND B.FLOOR_CD IN ('999', '{5}') \n" + " AND C.TRAIN_MODE_YN = '{3}' \n" // Add, 2017.03.02, 연습모드 + " AND C.ORD_DIV = '{4}' \n" + " AND C.FLOOR_CD = '{5}' \n" + " AND C.TBL_NO = '{6}' \n" ; } sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , PosConst.MST_USE_YN.YES , m_cPosStatus.Base.TrainingFlag , m_cTrnStatus.Head.OrderFlag , floorCd , tableNo ); // return -> 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음 int ret = m_cSqlDbService.DBSelect(sql, out dtData); return ret; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return -3; } } /// /// 거래 완료 처리 /// /// public string CompleteSaleOrder() { string sReturn = UserCom.RST_ERR; string sQuery = string.Empty; try { if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT) return UserCom.RST_OK; // 판매상품 정보 ArrayList alPluItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); // 완료테이블 정보 DataTable dtTable = null; Column.MST_TABLE.TABLE_DATA cTable = null; sReturn = this.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_NO_FLOOR_CD_SEARCH, m_cTrnStatus.Head.FloorCd, m_cTrnStatus.Head.TableNo }, out dtTable); if (sReturn == UserCom.RST_OK && dtTable != null && dtTable.Rows.Count > 0) { cTable = new Column.MST_TABLE.TABLE_DATA(); this.SetTableInfo(dtTable.Rows[0], ref cTable); } // 일괄 취소 if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.LOG.STOP) { // 테이블그룹결제 모드에서는 일괄취소 불가능 if (((Column.TR_PLU.DATA)alPluItem[0]).ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) { return UserCom.RST_OK; } #region ### 주방데이터 삭제 sQuery = "UPDATE POSMST..MST_KTCH_ORD_MSG " + " SET CANCEL_DIV = '" + PosConst.CANCEL_DIV.CANCEL + "' " + " , KTCH_MSG = '' " // 주방출력 수동옵션(상품선택) 시 메모정보 제거 + " , SEND_YN = CASE WHEN SEND_YN = '0' THEN '9' ELSE '0' END " + " , SEND_CONFIRM_DIV = '0' " + " , RESEND_YN = '0' " + " , UPD_DT = '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' " + " , FILLER3 = 'DEL' " // Add, 2017.02.09 + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' " + " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' " + " AND CANCEL_DIV = '" + PosConst.CANCEL_DIV.NORMAL + "' " ; if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion } if (m_cTrnStatus.Head.OrderFlag == PosConst.ORDER_TYPE.NORMAL) { #region ### 주문데이터 삭제 (MST_ORD) if (cTable != null && m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) { sQuery = "DELETE FROM POSMST..MST_ORD " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD + TBL_NO IN (SELECT FLOOR_CD + TBL_NO FROM POSMST..MST_TBL " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' " + " AND OP_FLOOR_CD = '" + cTable.OP_FLOOR_CD + "' " + " AND OP_TBL_NO = '" + cTable.OP_TABLE_NO + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "') "; } else { sQuery = "DELETE FROM POSMST..MST_ORD " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " // Add, 2017.03.02, 연습모드 + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' " + " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; } if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion if (m_cTrnStatus.Head.TradeKind != ItemConst.TRAN_KIND.LOG.STOP || ((Column.TR_PLU.DATA)alPluItem[0]).ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) { #region #### 주방데이터 삭제 (MST_KTCH_ORD_MSG) if (cTable != null && m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) { sQuery = "DELETE FROM POSMST..MST_KTCH_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD + TBL_NO IN (SELECT FLOOR_CD + TBL_NO FROM POSMST..MST_TBL " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' " + " AND OP_FLOOR_CD = '" + cTable.OP_FLOOR_CD + "' " + " AND OP_TBL_NO = '" + cTable.OP_TABLE_NO + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' ) " + " AND SEND_YN <> '0' "; } else { sQuery = "DELETE FROM POSMST..MST_KTCH_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' " + " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' " + " AND SEND_YN <> '0' "; } if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region #### 주방추가데이터 삭제 (MST_KTCH_ORD_MSG_ADD) if (cTable != null && m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) { sQuery = "DELETE FROM POSMST..MST_KTCH_ORD_MSG_ADD " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD + TBL_NO IN (SELECT FLOOR_CD + TBL_NO FROM POSMST..MST_TBL " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' " + " AND OP_FLOOR_CD = '" + cTable.OP_FLOOR_CD + "' " + " AND OP_TBL_NO = '" + cTable.OP_TABLE_NO + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' ) " + " AND SEND_YN <> '0' "; } else { sQuery = "DELETE FROM POSMST..MST_KTCH_ORD_MSG_ADD " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' " + " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' " + " AND SEND_YN <> '0' "; } if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (클래스명) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (함수명) sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region #### KPS 데이터 삭제 (MST_KPS_ORD_MSG) if (cTable != null && m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) { sQuery = "DELETE FROM POSMST..MST_KPS_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD + TBL_NO IN (SELECT FLOOR_CD + TBL_NO FROM POSMST..MST_TBL " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' " + " AND OP_FLOOR_CD = '" + cTable.OP_FLOOR_CD + "' " + " AND OP_TBL_NO = '" + cTable.OP_TABLE_NO + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' ) " + " AND SEND_YN <> '0' "; } else { sQuery = "DELETE FROM POSMST..MST_KPS_ORD_MSG " + " WHERE TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' " + " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' " + " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' " + " AND SEND_YN <> '0' "; } if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion } #region ### 대상 테이블마스터 초기화 (MST_TBL) sQuery = "UPDATE POSMST..MST_TBL " + " SET TBL_USE_DIV = '" + PosConst.TABLE_USE_FLAG.NO_USE + "' " + " , CUST_CNT = 0 " + " , FIRST_ORD_HOUR = '' " + " , ORD_AMT = 0 " //+ " , TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_NONE + "' " // Mod, 2017.02.22, 테이블그룹정보는 초기화 하지 않는다. //+ " , OP_FLOOR_CD = '' " //+ " , OP_TBL_NO = '' " + " , FILLER1 = '' " + " , FILLER2 = '' " //+ " , FILLER3 = '' " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' " + " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion #region ### 테이블연결 정보 초기화 if (cTable != null && m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) { sQuery = "UPDATE POSMST..MST_TBL " + " SET TBL_USE_DIV = '" + PosConst.TABLE_USE_FLAG.NO_USE + "' " + " , CUST_CNT = 0 " + " , FIRST_ORD_HOUR = '' " + " , ORD_AMT = 0 " + " , TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_NONE + "' " + " , OP_FLOOR_CD = '' " + " , OP_TBL_NO = '' " + " , FILLER1 = '' " + " , FILLER2 = '' " + " , FILLER3 = '' " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND OP_FLOOR_CD = '" + cTable.OP_FLOOR_CD + "' " + " AND OP_TBL_NO = '" + cTable.OP_TABLE_NO + "' " + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (클래스명) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (함수명) sQuery + "[ERROR]"); return UserCom.RST_ERR; } } #endregion #region ### 좌석메모 삭제 (MST_SEAT_MEMO) if (cTable != null && m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY) { sQuery = "DELETE FROM POSMST..MST_SEAT_MEMO " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND FLOOR_CD + TBL_NO IN (SELECT FLOOR_CD + TBL_NO FROM POSMST..MST_TBL " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND TBL_OP_DIV = '" + PosConst.TABLE_OP_FLAG.OP_GROUP + "' " + " AND OP_FLOOR_CD = '" + cTable.OP_FLOOR_CD + "' " + " AND OP_TBL_NO = '" + cTable.OP_TABLE_NO + "' " + " ) "; } else { sQuery = "DELETE FROM POSMST..MST_SEAT_MEMO " + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' " + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' " + " AND FLOOR_CD = '" + m_cTrnStatus.Head.FloorCd + "' " + " AND TBL_NO = '" + m_cTrnStatus.Head.TableNo + "' "; } if (m_cSqlDbService.DBExecuteNonQuery(sQuery) != UserCom.OK) { // Rollback m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (클래스명) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (함수명) sQuery + "[ERROR]"); return UserCom.RST_ERR; } #endregion } // Commit m_cSqlDbService.Commit(); sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR; } return sReturn; } /// /// 좌석메모 조회 /// /// /// /// /// public string SelectKtchOrderMessage(string sFloorCd, string sTableNo, out DataTable dtData) { string sReturn = UserCom.RST_ERR; dtData = null; try { var fmt = string.Empty; var sql = string.Empty; var ret = -9; if (string.IsNullOrWhiteSpace(sFloorCd) || string.IsNullOrWhiteSpace(sTableNo)) { fmt = "SELECT A.FLOOR_CD, A.TBL_NO, COUNT(*) CNT " + " FROM POSMST..MST_SEAT_MEMO A " + " WHERE A.CMP_CD = '{0}' AND A.STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' " + " GROUP BY A.FLOOR_CD, A.TBL_NO "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag); // 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음 ret = m_cSqlDbService.DBSelect(sql, out dtData); } else { fmt = "SELECT A.REG_TIME, A.CASHIER_ID, B.CASHIER_NM, A.MSG1, A.MSG2, A.MSG3 " + " FROM POSMST..MST_SEAT_MEMO A " + " LEFT JOIN POSMST..MST_USER B " + " ON A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.CASHIER_ID = B.CASHIER_ID " + " WHERE A.CMP_CD = '{0}' AND A.STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' AND A.FLOOR_CD = '{3}' AND A.TBL_NO = '{4}' " + " ORDER BY A.REG_DT, A.REG_TIME "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.TrainingFlag, sFloorCd, sTableNo); // 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음 ret = m_cSqlDbService.DBSelect(sql, out dtData); } if (ret == UserCom.NG) { return UserCom.RST_IGNORE; } else if (ret != UserCom.OK) { return UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0403); } sReturn = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); sReturn = UserCom.RST_ERR; } return sReturn; } /// /// 층 마스터 데이터베이스 저장 /// /// /// public string FloorMasterSave(List lstMstFloor) { try { List query = new List(); foreach (var tmp in from x in lstMstFloor where x.STATUS != PosConst.DB_ROW_STATUS.NONE select x) { string sql = string.Empty; sql = GetQueryFloorMaster(tmp); if (string.IsNullOrWhiteSpace(sql)) continue; query.Add(sql); if (tmp.STATUS == PosConst.DB_ROW_STATUS.DELETE) { // 층에 속해있는 테이블 정보 삭제 sql = GetQueryTableMasterDelete(tmp.FLOOR_CD, string.Empty); if (string.IsNullOrWhiteSpace(sql)) break; query.Add(sql); } } if (query.Count == 0) return UserCom.RST_IGNORE; // return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음 int ret = m_cSqlDbService.DBExecuteNonQuery(query.ToArray(), true); if (ret != UserCom.OK) { return UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0506); } foreach (var cFloor in lstMstFloor.AsEnumerable().Reverse()) { if (cFloor.STATUS == PosConst.DB_ROW_STATUS.DELETE) lstMstFloor.Remove(cFloor); else cFloor.STATUS = PosConst.DB_ROW_STATUS.NONE; } return UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return UserCom.RST_ERR + ex.Message; } } /// /// 테이블 마스터 데이터베이스 저장 /// /// /// public string TableMasterSave(List lstMstTable) { try { List query = new List(); foreach (var tmp in from x in lstMstTable where x.STATUS != PosConst.DB_ROW_STATUS.NONE select x) { string sql = GetQueryTableMaster(tmp); if (string.IsNullOrWhiteSpace(sql)) continue; query.Add(sql); } if (query.Count == 0) return UserCom.RST_IGNORE; // return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음 int ret = m_cSqlDbService.DBExecuteNonQuery(query.ToArray(), true); if (ret != UserCom.OK) { return UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0507); } foreach (var cTable in lstMstTable.AsEnumerable().Reverse()) { if (cTable.STATUS == PosConst.DB_ROW_STATUS.DELETE) lstMstTable.Remove(cTable); else cTable.STATUS = PosConst.DB_ROW_STATUS.NONE; } return UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return UserCom.RST_ERR + ex.Message; } } /// /// 층/테이블 마스터 데이터베이스 저장 /// /// /// /// public string TableMasterSave(List lstMstFloor, List lstMstTable) { try { List query = new List(); // 층마스터 저장 foreach (var tmp in from x in lstMstFloor where x.STATUS != PosConst.DB_ROW_STATUS.NONE select x) { string sql = string.Empty; sql = GetQueryFloorMaster(tmp); if (string.IsNullOrWhiteSpace(sql)) continue; query.Add(sql); if (tmp.STATUS == PosConst.DB_ROW_STATUS.DELETE) { // 층에 속해있는 테이블 정보 삭제 sql = GetQueryTableMasterDelete(tmp.FLOOR_CD, string.Empty); if (string.IsNullOrWhiteSpace(sql)) break; query.Add(sql); } } // 테이블 마스터 저장 foreach (var tmp in from x in lstMstTable where x.STATUS != PosConst.DB_ROW_STATUS.NONE select x) { string sql = GetQueryTableMaster(tmp); if (string.IsNullOrWhiteSpace(sql)) continue; query.Add(sql); } if (query.Count == 0) return UserCom.RST_IGNORE; try { m_cSqlDbService.Begin(); for (var i = 0; i < query.Count; i++) { int ret = m_cSqlDbService.DBExecuteNonQuery(query[i]); if (ret == UserCom.NG4) continue; if (ret != UserCom.OK) { m_cSqlDbService.Rollback(); return UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0507); } } m_cSqlDbService.Commit(); } catch { m_cSqlDbService.Rollback(); return UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0507); } foreach (var cFloor in lstMstFloor.AsEnumerable().Reverse()) { if (cFloor.STATUS == PosConst.DB_ROW_STATUS.DELETE) lstMstFloor.Remove(cFloor); else cFloor.STATUS = PosConst.DB_ROW_STATUS.NONE; } foreach (var cTable in lstMstTable.AsEnumerable().Reverse()) { if (cTable.STATUS == PosConst.DB_ROW_STATUS.DELETE) lstMstTable.Remove(cTable); else cTable.STATUS = PosConst.DB_ROW_STATUS.NONE; } return UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return UserCom.RST_ERR + ex.Message; } } /// /// 연습모드 테이블 마스터 복제 /// /// 연습모드 테이블 마스터 존재여부 확인 /// public bool CreateTrainingTable(bool checkExist = true) { try { if (m_cPosStatus.Base.PosType != PosConst.POS_TYPE.DEFERRED_PAYMENT) return true; if (m_cPosStatus.Base.TrainingFlag != ItemConst.TRAINING_FLAG.TRAINING_YES) return true; List query = new List(); string sql = string.Empty; // 연습모드 테이블 정보 존재여부 확인 if (checkExist) { sql = "SELECT TRAIN_MODE_YN, COUNT(*) CNT, SUM(X_COORD) XSUM, SUM(Y_COORD) YSUM, SUM(WIDTH) WSUM, SUM(HGT) HSUM \n" + " FROM MST_TBL \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n" + " GROUP BY TRAIN_MODE_YN "; DataTable dtData = null; if (m_cSqlDbService.DBSelect(sql, out dtData) != UserCom.OK) return false; var tableCheck = new long[2, 5]; foreach (DataRow dr in dtData.Rows) { switch (CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN")) { case ItemConst.TRAINING_FLAG.TRAINING_NO: tableCheck[0, 0] = CmUtil.GetDataRowLong(dr, "CNT"); tableCheck[0, 1] = CmUtil.GetDataRowLong(dr, "XSUM"); tableCheck[0, 2] = CmUtil.GetDataRowLong(dr, "YSUM"); tableCheck[0, 3] = CmUtil.GetDataRowLong(dr, "WSUM"); tableCheck[0, 3] = CmUtil.GetDataRowLong(dr, "HSUM"); break; case ItemConst.TRAINING_FLAG.TRAINING_YES: tableCheck[1, 0] = CmUtil.GetDataRowLong(dr, "CNT"); tableCheck[1, 1] = CmUtil.GetDataRowLong(dr, "XSUM"); tableCheck[1, 2] = CmUtil.GetDataRowLong(dr, "YSUM"); tableCheck[1, 3] = CmUtil.GetDataRowLong(dr, "WSUM"); tableCheck[1, 3] = CmUtil.GetDataRowLong(dr, "HSUM"); break; } } var isModify = false; for (var i = 0; i < 2; i++) { if (tableCheck[0, i] != tableCheck[1, i]) { isModify = true; break; } } if (isModify == false) return true; } // 연습모드 테이블 복제 sql = "DELETE FROM MST_TBL \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd+ "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo+ "' \n" + " AND TRAIN_MODE_YN = '" + ItemConst.TRAINING_FLAG.TRAINING_YES + "' "; query.Add(sql); sql = "INSERT INTO dbo.MST_TBL \n" + " (CMP_CD, STOR_CD, TRAIN_MODE_YN, FLOOR_CD, TBL_NO, TBL_NM, TBL_TYPE, TBL_TYPE_SHAPE, BACKGRCOLOR, BACKGR_IMG, FONTCOLOR, FONT_NM, FONT_SIZE, X_COORD, Y_COORD, WIDTH, HGT, TBL_DISP_DIV, SEAT_CNT, SEAT_CNT_DISP_DIV, TBL_OP_DIV, OP_FLOOR_CD, OP_TBL_NO, TBL_USE_DIV, CUST_CNT, FIRST_ORD_HOUR, ORD_AMT, RESERV_DIV, RESERV_HOUR, ORD_COLOR, PAY_CMPT_COLOR, PAY_CMPT_DIV, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, USE_YN, REG_DT) \n" + "SELECT CMP_CD, STOR_CD, '1' , FLOOR_CD, TBL_NO, TBL_NM, TBL_TYPE, TBL_TYPE_SHAPE, BACKGRCOLOR, BACKGR_IMG, FONTCOLOR, FONT_NM, FONT_SIZE, X_COORD, Y_COORD, WIDTH, HGT, TBL_DISP_DIV, SEAT_CNT, SEAT_CNT_DISP_DIV, '' , '' , '' , '0' , 0 , '' , 0 , NULL , NULL , ORD_COLOR, PAY_CMPT_COLOR, '' , NULL , NULL , NULL , NULL , NULL , USE_YN, '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n" + " FROM dbo.MST_TBL \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + ItemConst.TRAINING_FLAG.TRAINING_NO + "' \n" + " AND USE_YN = '" + PosConst.MST_USE_YN.YES + "' "; query.Add(sql); // 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러 int ret = m_cSqlDbService.DBExecuteNonQuery(query.ToArray(), true); return ret == UserCom.OK ? true : false; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return false; } } private string GetQueryFloorMaster(Column.MST_FLOOR.FLOOR_DATA cFloor) { try { string sql = string.Empty; string fmt = string.Empty; cFloor.UPD_DT = cFloor.UPD_DT.Replace("-", "").Replace(":", "").Replace(".", "").Replace(" ", ""); cFloor.REG_DT = cFloor.REG_DT.Replace("-", "").Replace(":", "").Replace(".", "").Replace(" ", ""); if (string.IsNullOrWhiteSpace(cFloor.UPD_DT)) { cFloor.UPD_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); } else if (cFloor.UPD_DT.Trim().Length > 14) { cFloor.UPD_DT = cFloor.UPD_DT.Substring(0, 14); } if (string.IsNullOrWhiteSpace(cFloor.REG_DT)) { cFloor.REG_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); } else if (cFloor.REG_DT.Trim().Length > 14) { cFloor.REG_DT = cFloor.REG_DT.Substring(0, 14); } switch (cFloor.STATUS) { case PosConst.DB_ROW_STATUS.DELETE: //fmt = "UPDATE POSMST..MST_FLOOR USE_YN = '0' WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND FLOOR_CD = '{2}' "; fmt = "DELETE FROM POSMST..MST_FLOOR WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND FLOOR_CD = '{2}' "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, cFloor.FLOOR_CD); break; case PosConst.DB_ROW_STATUS.INSERT: case PosConst.DB_ROW_STATUS.UPDATE: fmt = "UPDATE POSMST..MST_FLOOR SET FLOOR_NM = N'{3}', UPD_DT = '{4}', USE_YN = '{6}'" + " WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND FLOOR_CD = '{2}' " + "IF @@ROWCOUNT = 0 " + "INSERT INTO POSMST..MST_FLOOR (CMP_CD, STOR_CD, FLOOR_CD, FLOOR_NM, UPD_DT, REG_DT, USE_YN) " + "VALUES ('{0}', '{1}', '{2}', N'{3}', '{4}', '{5}', '{6}') "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , cFloor.FLOOR_CD , cFloor.FLOOR_NM , cFloor.UPD_DT , cFloor.REG_DT , PosConst.MST_USE_YN.YES); break; case PosConst.DB_ROW_STATUS.RESTORE: fmt = "INSERT INTO POSMST..MST_FLOOR (CMP_CD, STOR_CD, FLOOR_CD, FLOOR_NM, UPD_DT, REG_DT, USE_YN) " + "VALUES ('{0}', '{1}', '{2}', N'{3}', '{4}', '{5}', '{6}') "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , cFloor.FLOOR_CD , cFloor.FLOOR_NM , cFloor.UPD_DT , cFloor.REG_DT , PosConst.MST_USE_YN.YES); break; default: return string.Empty; } return sql; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return UserCom.RST_ERR + ex.Message; } } private string GetQueryTableMasterDelete(string floorCd, string tableNo) { Column.MST_TABLE.TABLE_DATA cTable = new Column.MST_TABLE.TABLE_DATA(); cTable.FLOOR_CD = floorCd; cTable.TABLE_NO = tableNo; cTable.STATUS = PosConst.DB_ROW_STATUS.DELETE; return GetQueryTableMaster(cTable); } private string GetQueryTableMaster(Column.MST_TABLE.TABLE_DATA cTable) { try { string sql = string.Empty; string fmt = string.Empty; cTable.UPD_DT = cTable.UPD_DT.Replace("-", "").Replace(":", "").Replace(".", "").Replace(" ", ""); cTable.REG_DT = cTable.REG_DT.Replace("-", "").Replace(":", "").Replace(".", "").Replace(" ", ""); if (string.IsNullOrWhiteSpace(cTable.UPD_DT)) { cTable.UPD_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); } else if (cTable.UPD_DT.Trim().Length > 14) { cTable.UPD_DT = cTable.UPD_DT.Substring(0, 14); } if (string.IsNullOrWhiteSpace(cTable.REG_DT)) { cTable.REG_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); } else if (cTable.REG_DT.Trim().Length > 14) { cTable.REG_DT = cTable.REG_DT.Substring(0, 14); } switch (cTable.STATUS) { case PosConst.DB_ROW_STATUS.DELETE: fmt = "DELETE FROM POSMST..MST_TBL WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND FLOOR_CD = '{2}' AND TBL_NO LIKE '{3}%' "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, cTable.FLOOR_CD, cTable.TABLE_NO); break; case PosConst.DB_ROW_STATUS.UPDATE: case PosConst.DB_ROW_STATUS.INSERT: fmt = "UPDATE POSMST..MST_TBL " + " SET TBL_NM = N'{5}' " + " , FONT_NM = N'{6}' " + " , FONT_SIZE = {7} " + " , X_COORD = {8} " + " , Y_COORD = {9} " + " , WIDTH = {10} " + " , HGT = {11} " + " , UPD_DT = '{12}' " + " , USE_YN = '{14}' " + "WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND TRAIN_MODE_YN = '{2}' AND FLOOR_CD = '{3}' AND TBL_NO = '{4}' " + "IF @@ROWCOUNT = 0 " + "INSERT INTO POSMST..MST_TBL (CMP_CD, STOR_CD, TRAIN_MODE_YN, FLOOR_CD, TBL_NO, TBL_NM, FONT_NM, FONT_SIZE, X_COORD, Y_COORD, WIDTH, HGT, UPD_DT, REG_DT, USE_YN) " + "VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', N'{5}', N'{6}', {7}, {8}, {9}, {10}, {11}, '{12}', '{13}', '{14}') "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , ItemConst.TRAINING_FLAG.TRAINING_NO // Add, 2017.03.02, 연습모드 , cTable.FLOOR_CD , cTable.TABLE_NO , cTable.TABLE_NM , cTable.FONT_NM , cTable.FONT_SIZE , cTable.X_COORD , cTable.Y_COORD , cTable.WIDTH , cTable.HEIGHT , cTable.UPD_DT , cTable.REG_DT , PosConst.MST_USE_YN.YES); break; case PosConst.DB_ROW_STATUS.RESTORE: fmt = "INSERT INTO POSMST..MST_TBL (CMP_CD, STOR_CD, TRAIN_MODE_YN, FLOOR_CD, TBL_NO, TBL_NM, FONT_NM, FONT_SIZE, X_COORD, Y_COORD, WIDTH, HGT, UPD_DT, REG_DT, USE_YN) " + "VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', N'{5}', N'{6}', {7}, {8}, {9}, {10}, {11}, '{12}', '{13}', '{14}') "; sql = string.Format(fmt, m_cPosStatus.Base.CmpCd , m_cPosStatus.Base.StoreNo , ItemConst.TRAINING_FLAG.TRAINING_NO // Add, 2017.03.02, 연습모드 , cTable.FLOOR_CD , cTable.TABLE_NO , cTable.TABLE_NM , cTable.FONT_NM , cTable.FONT_SIZE , cTable.X_COORD , cTable.Y_COORD , cTable.WIDTH , cTable.HEIGHT , cTable.UPD_DT , cTable.REG_DT , PosConst.MST_USE_YN.YES); break; default: return string.Empty; } return sql; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return UserCom.RST_ERR + ex.Message; } } /// /// 층/테이블 마스터 백업 (to server) /// /// public string TableMasterBackup(List lstMstFloor, List lstMstTable) { string retValue = UserCom.RST_ERR; const string COL_SPLIT = "|"; const string ROW_SPLIT = "#~"; try { string ret = string.Empty; UserLog.WriteLogFile(UserCom.LOG_IOS , System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "POS Table Master Backup Start "); // Add, 2017.03.13, 복합매장대응 string storeCode = string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNo) ? m_cPosStatus.Base.StoreNo : m_cPosStatus.Base.SubShopNo; // 층/테이블 정보 List lstData = new List(); #region ### 층 정보 생성 foreach (var cFloor in from x in lstMstFloor where x.STATUS != PosConst.DB_ROW_STATUS.DELETE orderby x.FLOOR_CD select x) { #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 (cFloor.UPD_DT.Trim().Length != 14) cFloor.UPD_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); if (cFloor.REG_DT.Trim().Length != 14) cFloor.REG_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); string[] floor = new string[15]; floor[0] = "01"; floor[1] = m_cPosStatus.Base.CmpCd; // Mod, 2017.03.13, 복합매장대응 //floor[2] = m_cPosStatus.Base.StoreNo; floor[2] = storeCode; floor[3] = cFloor.FLOOR_CD; floor[4] = cFloor.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] = m_cPosStatus.Base.CashierNo; floor[12] = cFloor.REG_DT; floor[13] = m_cPosStatus.Base.CashierNo; floor[14] = cFloor.UPD_DT; string rowData = string.Join(COL_SPLIT, floor); lstData.Add(rowData); } #endregion #region ### 테이블 정보 생성 foreach (var cTable in from x in lstMstTable where x.STATUS != PosConst.DB_ROW_STATUS.DELETE orderby x.TABLE_NO select x) { #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 (cTable.UPD_DT.Trim().Length != 14) cTable.UPD_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); if (cTable.REG_DT.Trim().Length != 14) cTable.REG_DT = DateTime.Now.ToString("yyyyMMddhhmmss"); cTable.TABLE_DISP_FLAG = "2"; string[] table = new string[35]; table[0] = "02"; table[1] = m_cPosStatus.Base.CmpCd; //1 CMP_CD // Mod, 2017.03.13, 복합매장대응 //table[2] = m_cPosStatus.Base.StoreNo; //2 , STOR_CD table[2] = storeCode; table[3] = cTable.FLOOR_CD; //3 , FLOOR_CD table[4] = cTable.TABLE_NO; //4 , TBL_NO table[5] = cTable.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] = cTable.FONT_NM; //11, FONT_NM (Default:나눔스퀘어) table[12] = cTable.FONT_SIZE.ToString(); //12, FONT_SIZE (Default:10) table[13] = cTable.X_COORD.ToString(); //13, LOC_X table[14] = cTable.Y_COORD.ToString(); //14, LOC_Y table[15] = cTable.WIDTH.ToString(); //15, WIDTH table[16] = cTable.HEIGHT.ToString(); //16, HGT table[17] = cTable.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] = m_cPosStatus.Base.CashierNo; //31, REG_USER_ID table[32] = cTable.REG_DT; //32, REG_DATE table[33] = m_cPosStatus.Base.CashierNo; //33, UPD_USER_ID table[34] = cTable.UPD_DT; //34, UPD_DATE string rowData = string.Join(COL_SPLIT, table); lstData.Add(rowData); } #endregion // 전송데이터 string dataList = string.Join(ROW_SPLIT, lstData.ToArray()); #region ### 디버깅 모드 if (m_cPosStatus.Base.OlePosPrinterModel == "99") { string logFile = BaseCom.NxLogPath + "TableMasterBackup.log"; CmUtil.FileDelete(logFile); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(logFile)) { sw.WriteLine(dataList); sw.WriteLine(""); for (var i = 0; i < lstData.Count; i++) { sw.WriteLine(lstData[i]); } sw.Flush(); } } #endregion // 층/테이블 마스터 전송 Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.POS_TABLE_MST_INQ); // Mod, 2017.03.13, 복합매장대응 //htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.STOR_CD, storeCode); 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, ""); ret = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, 10000, htSendData, ref htRecvData, false); if (ret != UserCom.RST_OK) { retValue = ret; return retValue; } ret = htRecvData[Column.IQ_POS_TABLE_MST_INQ.DATA.RES_CD].ToString().Trim(); if (ret != "00") { return retValue = UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0520) + "\n(Server error code=" + ret + ")"; } return retValue = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR , System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "Exception." + ex.Message); return retValue = UserCom.RST_ERR + ex.Message; } finally { UserLog.WriteLogFile(UserCom.LOG_IOS , System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "POS Table Master Backup End => " + retValue); } } /// /// 층/테이블 마스터 복원 (from server) /// /// public string TableMasterRestore() { string retValue = UserCom.RST_ERR; const char COL_SPLIT = '|'; const string ROW_SPLIT = "#~"; try { string ret = string.Empty; UserLog.WriteLogFile(UserCom.LOG_IOS , System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "POS Table Master Restore Start "); // 층/테이블 마스터 요청 Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.POS_TABLE_MST_INQ); // Mod, 2017.03.13, 복합매장대응 //htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.STOR_CD, string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNo) ? m_cPosStatus.Base.StoreNo : m_cPosStatus.Base.SubShopNo); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.INQ_DIV, "2"); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.DATA_LIST, string.Empty); htSendData.Add(Column.IQ_POS_TABLE_MST_INQ.DATA.RES_CD, ""); ret = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, 10000, htSendData, ref htRecvData, false); if (ret != UserCom.RST_OK) { // 서버통신 실패 return retValue = ret; } ret = htRecvData[Column.IQ_POS_TABLE_MST_INQ.DATA.RES_CD].ToString().Trim(); if (ret != "00") { retValue = UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0522) + "\n(Server error code=" + ret + ")"; return retValue; } string dataList = htRecvData[Column.IQ_POS_TABLE_MST_INQ.DATA.DATA_LIST].ToString(); if (string.IsNullOrWhiteSpace(dataList)) { retValue = UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0522) + "\n(No Data [1])"; return retValue; } // 층/테이블 마스터 복원 쿼리 List query = new List(); query.Add(string.Format("DELETE FROM POSMST..MST_FLOOR WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' ", m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo)); query.Add(string.Format("DELETE FROM POSMST..MST_TBL WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' ", m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo)); string[] rows = dataList.Split(new string[] { ROW_SPLIT }, StringSplitOptions.None); if (rows.Length == 0) { retValue = UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0522) + "\n(No Data [2])"; return retValue; } #region ### 디버깅 모드 if (m_cPosStatus.Base.OlePosPrinterModel == "99") { string logFile = BaseCom.NxLogPath + "TableMasterRestore.log"; CmUtil.FileDelete(logFile); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(logFile)) { sw.WriteLine(dataList); sw.WriteLine(""); for (var i = 0; i < rows.Length; i++) { sw.WriteLine(rows[i]); } sw.Flush(); } } #endregion for (var i = 0; i < rows.Length; i++) { string sql = string.Empty; string[] data = rows[i].Split(COL_SPLIT); switch (data[0]) { case "01": // Floor Master if (data.Length != 15) return retValue = UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0522) + "\n(Floor master format error)"; Column.MST_FLOOR.FLOOR_DATA cFloor = new Column.MST_FLOOR.FLOOR_DATA(); cFloor.FLOOR_CD = data[3].Trim(); cFloor.FLOOR_NM = data[4].Trim(); cFloor.REG_DT = data[12].Trim(); cFloor.UPD_DT = data[14].Trim(); cFloor.STATUS = PosConst.DB_ROW_STATUS.RESTORE; sql = this.GetQueryFloorMaster(cFloor); break; case "02": // Table Master if (data.Length != 35) return retValue = UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0522) + "\n(Table master format error)"; Column.MST_TABLE.TABLE_DATA cTable = new Column.MST_TABLE.TABLE_DATA(); cTable.FLOOR_CD = data[3].Trim(); cTable.TABLE_NO = data[4].Trim(); cTable.TABLE_NM = data[5].Trim(); cTable.FONT_NM = data[11].Trim(); cTable.FONT_SIZE = CmUtil.IntParse(data[12]); cTable.X_COORD = CmUtil.IntParse(data[13]); cTable.Y_COORD = CmUtil.IntParse(data[14]); cTable.WIDTH = CmUtil.IntParse(data[15]); cTable.HEIGHT = CmUtil.IntParse(data[16]); cTable.TABLE_DISP_FLAG = data[17].Trim(); cTable.REG_DT = data[32].Trim(); cTable.UPD_DT = data[32].Trim(); cTable.STATUS = PosConst.DB_ROW_STATUS.RESTORE; sql = this.GetQueryTableMaster(cTable); break; default: return retValue = UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0522) + "\n(Master delimiter Code format error)"; } if (string.IsNullOrWhiteSpace(sql)) { return retValue = UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0522) + "\n(Local Database query statement Error)"; } query.Add(sql); } // return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음 int dbRet = m_cSqlDbService.DBExecuteNonQuery(query.ToArray(), true); if (dbRet != UserCom.OK) { return UserCom.RST_ERR + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0522) + "\n(Local Database save error)"; } return retValue = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return retValue = UserCom.RST_ERR + ex.Message; } finally { UserLog.WriteLogFile(UserCom.LOG_IOS , System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()" , "POS Table Master Restore End => " + retValue); } } private string ConvertDBStr(string str) { return str.Replace("'", "''"); } /// /// 테이블 합석/이동/메뉴이동 후 주문내역서 출력 처리 /// /// /// /// private string ExecuteOrderBillReceipt(string floorCd, string tableNo) { try { var ret = UserCom.RST_ERR; var floorNm = floorCd; var tableNm = tableNo; DataTable dt = null; if (SelectFloorAndTableName(floorCd, tableNo, out dt) == UserCom.RST_OK) { if (dt != null && dt.Rows.Count > 0) { floorNm = CmUtil.GetDataRowStr(dt.Rows[0], "FLOOR_NM"); tableNo = CmUtil.GetDataRowStr(dt.Rows[0], "TBL_NM"); } } // 거래 초기화 m_cDataSrv.TranComplete(); m_cTrnStatus.Head.OrderFlag = PosConst.ORDER_TYPE.NORMAL; // 층 및 테이블 정보 설정 m_cTrnStatus.Head.FloorCd = m_cPosStatus.Sale.SelectFloorCd = floorCd; m_cTrnStatus.Head.TableNo = m_cPosStatus.Sale.SelectTableNo = tableNo; m_cTrnStatus.Head.FloorNm = m_cPosStatus.Sale.SelectFloorNm = floorNm; m_cTrnStatus.Head.TableNm = m_cPosStatus.Sale.SelectTableNm = tableNm; m_cPosStatus.Sale.TableInfo = string.Empty; m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.NORMAL; // 주문데이터 로드 ret = this.SelectMenuOrder(); if (ret != UserCom.RST_OK) return ret; ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); if (aSaleItem.Count == 0) return UserCom.RST_IGNORE; m_cPosStatus.Sale.SaleFlow = PosConst.SALE_FLOW.SALE_DOING; // 주문 내역서 출력 처리 ISaleCompleteUs cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE); ret = cSaleComplete.ExecuteOrderBillReceipt(); return UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return UserCom.RST_ERR + ex.Message; } finally { // 판매부가정보 초기화 m_cPosStatus.Sale.TableInfo = string.Empty; m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.NORMAL; m_cPosStatus.Sale.SelectFloorCd = string.Empty; m_cPosStatus.Sale.SelectTableNo = string.Empty; m_cPosStatus.Sale.SelectFloorNm = string.Empty; m_cPosStatus.Sale.SelectTableNm = string.Empty; // 거래 초기화 m_cDataSrv.TranComplete(); m_cTrnStatus.Head.OrderFlag = PosConst.ORDER_TYPE.NORMAL; } } public int GetOrderDataCount(string floorCd = "", string tableNo = "") { try { DataTable dtData = null; var sql = "SELECT FLOOR_CD, TBL_NO, COUNT(*) ORDCNT FROM POSMST..MST_ORD \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + ItemConst.TRAINING_FLAG.TRAINING_NO + "' \n" + " AND FLOOR_CD LIKE '" + floorCd + "%' \n" + " AND TBL_NO LIKE '" + tableNo + "%' \n" + " GROUP BY FLOOR_CD, TBL_NO \n" ; if (m_cSqlDbService.DBSelect(sql, out dtData) != UserCom.OK) return 0; if (dtData == null || dtData.Rows.Count == 0) return 0; var cnt = dtData.Rows.Count; return cnt; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); return 0; } } /// /// 주문번호 자동 채번 (후불POS 전용) /// /// public string GetOrderNoForDb() { int orderNo = 1; try { DataTable dtData = null; var subShopNo = string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNo) ? m_cPosStatus.Base.StoreNo : m_cPosStatus.Base.SubShopNo; var sql = "UPDATE POSMST..MST_ORD_SEQ \n" + " SET ORDER_NO = ORDER_NO + 1 \n" + " , UPD_DT = '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" //#20171026 복합매장 메인포스가 아닌 주문포스인 경우 자기POS번호에 설정된 IP로 메인포스 IP 설정 start //적용시 주석 //+ " AND SUB_STOR_CD = '" + subShopNo + "' \n" //#20171026 복합매장 메인포스가 아닌 주문포스인 경우 자기POS번호에 설정된 IP로 메인포스 IP 설정 end + " AND SALE_DATE = '" + m_cPosStatus.Base.SaleDate + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" + "IF @@ROWCOUNT = 0 \n" + "INSERT INTO POSMST..MST_ORD_SEQ ( \n" + " CMP_CD, STOR_CD, SUB_STOR_CD, SALE_DATE, TRAIN_MODE_YN, ORDER_NO, REG_DT, UPD_DT \n" + " ) VALUES ( \n " + " '" + m_cPosStatus.Base.CmpCd + "' \n" // @cmp_cd + ",'" + m_cPosStatus.Base.StoreNo + "' \n" // @stor_cd //#20171026 복합매장 메인포스가 아닌 주문포스인 경우 자기POS번호에 설정된 IP로 메인포스 IP 설정 start //기존 //+ ",'" + subShopNo + "' \n" // @sub_stor_cd //변경 + ",'" + m_cPosStatus.Base.StoreNo + "' \n" // @stor_cd //#20171026 복합매장 메인포스가 아닌 주문포스인 경우 자기POS번호에 설정된 IP로 메인포스 IP 설정 end + ",'" + m_cPosStatus.Base.SaleDate + "' \n" // @sale_date + ",'" + m_cPosStatus.Base.TrainingFlag + "' \n" + ", 1 \n" // @order_id + ",'" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n" // @reg_dt + ",'" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n" // @upd_dt + " ) \n\n" + "SELECT ISNULL(MAX(ORDER_NO), 1) AS ORDER_NO \n" + " FROM MST_ORD_SEQ \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" //#20171026 복합매장 메인포스가 아닌 주문포스인 경우 자기POS번호에 설정된 IP로 메인포스 IP 설정 start //적용시 주석 //+ " AND SUB_STOR_CD = '" + subShopNo + "' \n" //#20171026 복합매장 메인포스가 아닌 주문포스인 경우 자기POS번호에 설정된 IP로 메인포스 IP 설정 end + " AND SALE_DATE = '" + m_cPosStatus.Base.SaleDate + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" ; if (m_cSqlDbService.DBSelect(sql, out dtData) == UserCom.OK) { orderNo = CmUtil.GetDataRowInt(dtData.Rows[0], "ORDER_NO"); } } catch (Exception ex) { m_cSqlDbService.Rollback(); UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); orderNo = 1; } return string.Format("{0:D5}", orderNo); } public string GetOrderSeq(string floorCd, string tableNo) { int orderSeq = 1; try { // SELECT ISNULL(MAX(CONVERT(int,ORDER_NO)),0) var sql = "SELECT ISNULL(MAX(CONVERT(INT, FILLER3)), 0) + 1 AS ORDER_SEQ \n" + " FROM MST_ORD \n" + " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n" + " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n" + " AND TRAIN_MODE_YN = '" + m_cPosStatus.Base.TrainingFlag + "' \n" + " AND ORD_DIV = '" + m_cTrnStatus.Head.OrderFlag + "' \n" + " AND FLOOR_CD = '" + floorCd + "' \n" + " AND TBL_NO = '" + tableNo + "' \n" + " AND ISNUMERIC(FILLER3) = 1 \n" ; DataTable dtData = null; if (m_cSqlDbService.DBSelect(sql, out dtData) == UserCom.OK) { orderSeq = CmUtil.GetDataRowInt(dtData.Rows[0], "ORDER_SEQ"); } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Exception." + ex.Message); orderSeq = 1; } return string.Format("{0:D2}", orderSeq); } } }