spc-kiosk-pb/Service/BsvSale/Svr2Tran.cs

1125 lines
61 KiB
C#
Raw Permalink Normal View History

2019-06-16 05:12:09 +00:00
using System;
using System.Text;
using System.Collections;
using System.Data;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.BaseFrame;
//#20180605 해피오더 개선 start
using Newtonsoft.Json;
using System.Net;
using System.IO;
//#20180605 해피오더 개선 end
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 영수증 반품 / 서버 시간 조회 처리
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
class Svr2Tran : SaleTranCallBase, ISvr2Tran
{
#region
private ISaleCompleteUs m_cTranService = null;
private ISignPadUs m_cDeviceSignPad = null; // 서명패드
/// <summary>
/// 생성자
/// </summary>
public Svr2Tran()
{
m_cTranService = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
m_cDeviceSignPad = (ISignPadUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_SIGNPAD);
}
#endregion
#region ,
/// <summary>
/// 최종 거래번호, 등록번호 조회
/// </summary>
/// <param name="sSaleDate"></param>
/// <param name="sPosNo"></param>
/// <param name="sLastTradeNo"></param>
/// <param name="sLastRegNo"></param>
/// <returns></returns>
public string SearchLastTranNo(string sSaleDate, string sPosNo, ref string sLastTradeNo, ref string sLastRegNo)
{
string sRet = UserCom.RST_ERR;
Hashtable htRecvData = new Hashtable();
Hashtable htSendData = new Hashtable();
try
{
// 거래 데이터 서버 조회
htSendData.Add(Column.IQ_TRAN_LASTNO_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.LAST_TRANNO_INQ);
htSendData.Add(Column.IQ_TRAN_LASTNO_REQ.DATA.SALE_DT, sSaleDate);
htSendData.Add(Column.IQ_TRAN_LASTNO_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo);
htSendData.Add(Column.IQ_TRAN_LASTNO_REQ.DATA.POS_NO, sPosNo);
htSendData.Add(Column.IQ_TRAN_LASTNO_REQ.DATA.TRADE_NO, "");
htSendData.Add(Column.IQ_TRAN_LASTNO_REQ.DATA.REG_NO, "");
htSendData.Add(Column.IQ_TRAN_LASTNO_REQ.DATA.RES_CD, "");
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, 10000, htSendData, ref htRecvData, false);
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0259);
return sRet;
}
if (htRecvData[Column.IQ_TRAN_LASTNO_REQ.DATA.RES_CD].ToString() != "00")
{
//WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0259) + "\n\r ERROR CODE => " + htRecvData[Column.IQ_TRAN_LASTNO_REQ.DATA.RES_CD]);
sRet = UserCom.RST_ERR;
}
else
{
sLastTradeNo = htRecvData[Column.IQ_TRAN_LASTNO_REQ.DATA.TRADE_NO].ToString();
sLastRegNo = htRecvData[Column.IQ_TRAN_LASTNO_REQ.DATA.REG_NO].ToString();
sRet = UserCom.RST_OK;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 영수증 반품 대상 거래 데이터 서버 조회
/// </summary>
/// <param name="sSaleDate"></param>
/// <param name="sPosNo"></param>
/// <param name="sTradeNo"></param>
/// <param name="SaleTime"></param>
/// <returns></returns>
public string SearchServerTran(string sSaleDate, string sPosNo, string sTradeNo, string SaleTime)
{
string sRet = UserCom.RST_ERR;
bool bRet = false;
string sJuurnal = "";
try
{
// --------------------------------------------------------------------------------------------------------------------------------
// 거래 데이터 서버 조회
// --------------------------------------------------------------------------------------------------------------------------------
Hashtable htRecvData = new Hashtable();
sRet = ExecServerTranCallIrt(ItemConst.IRT_INQ_TYPE.TRAN_CALL, sSaleDate, sPosNo, sTradeNo, SaleTime, ref htRecvData, false);
if (sRet != UserCom.RST_OK)
{
return sRet;
}
if (htRecvData[Column.IQ_TRAN_CALL_REQ.DATA.RES_CD].ToString() != "00" && htRecvData[Column.IQ_TRAN_CALL_REQ.DATA.RES_CD].ToString() != "01")
{
return UserCom.RST_ERR;
}
// 거래데이터
string sTranData = htRecvData[Column.IQ_TRAN_CALL_REQ.DATA.TRAN_DATA].ToString();
m_cDataService.TranComplete();
m_cTrnStatus.Head.CmpCd = m_cPosStatus.Base.CmpCd; // CMP_CD
m_cTrnStatus.Head.StoreCd = m_cPosStatus.Base.StoreNo; // STOR_CD
m_cTrnStatus.Head.SaleDate = sSaleDate; // SALE_DT
m_cTrnStatus.Head.PosNo = sPosNo; // POS_NO
m_cTrnStatus.Head.TradeNo = htRecvData[Column.IQ_TRAN_CALL_REQ.DATA.TRADE_NO].ToString(); // TRADE_NO
// 거래 분해 처리
string[] aTranData = sTranData.Split(new string[] { "#~" }, StringSplitOptions.None);
for (int i = 0; i < aTranData.Length; i++ )
{
if (aTranData[i].StartsWith(ItemConst.IRT_TRAN_TYPE.TranHeader))
bRet = TranParserToHeader(aTranData[i]);
else if (aTranData[i].StartsWith(ItemConst.IRT_TRAN_TYPE.TranDetail))
bRet = TranParserToDetail(aTranData[i]);
else if (aTranData[i].StartsWith(ItemConst.IRT_TRAN_TYPE.TranPay))
bRet = TranParserToPayment(aTranData[i]);
else if (aTranData[i].StartsWith(ItemConst.IRT_TRAN_TYPE.TranCpiRslt))
bRet = TranParserToCampaign(aTranData[i]);
else if (aTranData[i].StartsWith(ItemConst.IRT_TRAN_TYPE.TranEtc))
bRet = TranParserToEtc(aTranData[i]);
else if (aTranData[i].StartsWith(ItemConst.IRT_TRAN_TYPE.TranDpst))
bRet = TranParserToDpst(aTranData[i]);
else if (aTranData[i].StartsWith(ItemConst.IRT_TRAN_TYPE.TranAdmt))
bRet = TranParserToAdmt(aTranData[i]);
else if (aTranData[i].StartsWith(ItemConst.IRT_TRAN_TYPE.TranGuestCnt))
bRet = TranParserToGuestCnt(aTranData[i]);
if (bRet == false)
{
m_cDataService.TranComplete();
return sRet;
}
}
// --------------------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------------------
// 저널 데이터 서버 조회
// --------------------------------------------------------------------------------------------------------------------------------
htRecvData = new Hashtable();
sRet = ExecServerTranCallIrt(ItemConst.IRT_INQ_TYPE.JOURNAL_CALL, sSaleDate, sPosNo, sTradeNo, "", ref htRecvData, false);
if (sRet == UserCom.RST_OK)
{
if (htRecvData[Column.IQ_TRAN_CALL_REQ.DATA.RES_CD].ToString() == "00")
{
sJuurnal = htRecvData[Column.IQ_TRAN_CALL_REQ.DATA.TRAN_DATA].ToString();
}
}
// --------------------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------------------
// 거래 저장
// --------------------------------------------------------------------------------------------------------------------------------
sRet = m_cTranService.TranDataRestore(new string[] { sJuurnal });
if (sRet != 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 + "() SaveTran.", sRet);
return sRet;
}
// --------------------------------------------------------------------------------------------------------------------------------
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
m_cDataService.TranComplete();
}
return sRet;
}
#endregion
#region
/// <summary>
/// 서버 시간 조회
/// </summary>
/// <returns></returns>
public string ServerSysDateTime()
{
Hashtable htRecvData = new Hashtable();
Hashtable htSendData = new Hashtable();
string sRet = UserCom.RST_ERR;
string sGetDate = "";
try
{
// 서버 조회
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.SYSDATETIME);
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.RES_CD, "");
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.POS_HOUR, "");
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.REG_NO, "");
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.TRADE_NO, "");
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.SYS_YMDHMS, "");
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 5000, htSendData, ref htRecvData, false);
if (sRet == UserCom.RST_OK)
{
if (htRecvData[Column.IQ_SYSDATE_REQ.DATA.RES_CD].ToString() == "00")
{
sGetDate = htRecvData[Column.IQ_SYSDATE_REQ.DATA.SYS_YMDHMS].ToString();
// 서버시간 동기화 로그 추가(2017.07.12)
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
"Synchronizing local DateTime with serverside datetime(" + sGetDate + ") ... " );
if (sGetDate.Trim().Length == 14) BsUtil.SetSystemDateTime(sGetDate);
sRet = UserCom.RST_OK;
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 프로그램 업데이트 목록 조회
/// </summary>
/// <param name="sKind"></param>
/// <param name="sDownDiv"></param>
/// <param name="aRecvData"></param>
/// <param name="htRecvData"></param>
/// <returns></returns>
public string PGMUpdate(string sKind, string sDownDiv, ref string[] aRecvData, ref Hashtable htRecvData)
{
Hashtable htSendData = new Hashtable();
string sRet = UserCom.RST_ERR;
try
{
// 서버 조회
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.PGMUPDATE);
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.FILE_GROUP, CmUtil.MidH(sKind, 0, 2));
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.FILE_KIND, CmUtil.MidH(sKind, 2, 2));
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.FILE_APP_TY, "0");
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.FILE_YMDHMS, DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.ToString("HHmmss"));
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.DOWN_DIV, sDownDiv);
//sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 10000, htSendData, ref htRecvData, false);
//sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CmsSvrIp, (int)m_cPosStatus.Base.KioskPort, 10000, htSendData, ref htRecvData, false);
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CmsSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 10000, htSendData, ref htRecvData, false);
/*
htRecvData["VALUE"] = @"10|11|0|20190514|/data/Nftp_nhs/dev/CMBO/CDP/ITEM/|PCKR_002_ITEM_2019051400001.zip|2019051400001|1|20190514|0818|0000|20190514"
+@"#~10|12|0|20190502|/data/Nftp_nhs/dev/CMBO/CDP/OPTN/|PCKR_002_OPTN_2019050200001.zip|2019050200001|1|20190502|0818|0000|20190502"
+ @"#~10|14|0|20190401|/data/Nftp_nhs/dev/CMBO/CDP/CATE/|PCKR_002_CATE_2019040100001.zip|2019040100001|1|20190401|0818|0000|20190401";
*/
if (sRet == UserCom.RST_OK)
{
if (htRecvData[Column.IQ_PGMUPDATE_RSP.DATA.RES_CD].ToString() == "00")
{
aRecvData = htRecvData[Column.IQ_PGMUPDATE_RSP.DATA.VALUE].ToString().Split(new string[] { "#~" }, StringSplitOptions.None);
sRet = UserCom.RST_OK;
}
else
{
sRet = UserCom.RST_ERR;
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 파일 변경 완료 요청
/// </summary>
/// <param name="sKind"></param>
/// <param name="sAppType"></param>
/// <param name="sFileName"></param>
/// <param name="sFileSeq"></param>
/// <param name="sFileVer"></param>
/// <param name="sDownDiv"></param>
/// <param name="sDeployDate"></param>
/// <param name="sDeployDT"></param>
/// <returns></returns>
/// 2019-03-29 - 1997fx11 : FTP에서 다운받은 내용의 수신상태를 전송 (참조)
public string PGMUpdate_Complete(string sKind, string sAppType, string sFileName, string sFileSeq, string sFileVer, string sDownDiv, string sDeployDate, string sDeployDT)
{
Hashtable htSendData = new Hashtable();
Hashtable htRecvData = new Hashtable();
string sRet = UserCom.RST_ERR;
try
{
if (sFileVer.Trim() == "") return sRet;
// 서버 조회
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.PGMUPDATECOMPLTE);
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_GROUP, CmUtil.MidH(sKind, 0, 2));
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_KIND, CmUtil.MidH(sKind, 2, 2));
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_APP_TY, sAppType);
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_NM, sFileName);
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_VER, sFileVer);
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_SEQ, sFileSeq);
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.RES_CD, "");
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.DOWN_DIV, sDownDiv);
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.DEPLOY_DT, sDeployDate);
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.REG_DT, sDeployDT);
// 2019-05-15 - 1997fx11 : IP, Port 변경.
//sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 10000, htSendData, ref htRecvData, false);
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CmsSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 10000, htSendData, ref htRecvData, false);
if (sRet == UserCom.RST_OK)
{
if (htRecvData[Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.RES_CD].ToString() == "00")
{
sRet = UserCom.RST_OK;
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 프로그램 이력 관리
/// </summary>
/// <param name="sKind"></param>
/// <param name="sFileSeq"></param>
/// <param name="sFileVer"></param>
/// <param name="sFileNm"></param>
/// <param name="sApplyDate"></param>
/// <param name="sApplyTime"></param>
/// <param name="sApplyType"></param>
/// <param name="sDeployDate"></param>
/// <param name="sDeployTime"></param>
/// <param name="sFTP_IP"></param>
/// <param name="sFTP_Port"></param>
/// <param name="sFTP_ID"></param>
/// <param name="sFTP_Pwd"></param>
/// <param name="sFTP_FILEPATH"></param>
/// <param name="sDOWN_DIV"></param>
/// <param name="sDeployDT"></param>
/// <param name="sUseYn"></param>
/// <returns></returns>
/// 2019-03-28 - 1997fx11 : FTP 에서 Down받은 내용의 이력을 저장 (참조)
public string PGMUpdate_History_Isert(string sKind, string sFileSeq, string sFileVer, string sFileNm, string sApplyDate, string sApplyTime, string sApplyType, string sDeployDate, string sDeployTime, string sFTP_IP, string sFTP_Port, string sFTP_ID, string sFTP_Pwd, string sFTP_FILEPATH, string sDOWN_DIV, string sDeployDT, string sUseYn)
{
string sRet = UserCom.RST_ERR;
int iRet = -1;
string sLogData = "";
string sAppTypeData = "";
try
{
#region Log
try
{
switch (sApplyType)
{
case ItemConst.PGM_DOWN_STATE.DownLoad_OK:
sAppTypeData = "DownLoad_OK";
break;
case ItemConst.PGM_DOWN_STATE.DownLoad_Fail:
sAppTypeData = "DownLoad_Fail";
break;
case ItemConst.PGM_DOWN_STATE.Update_OK:
sAppTypeData = "Update_OK";
break;
case ItemConst.PGM_DOWN_STATE.Update_Fail:
sAppTypeData = "Update_Fail";
break;
}
sLogData = string.Format("FileName:{0}, FileVersion:{1}, FileSeq:{2}, ApplyDate:{3}, ApplyTime:{4}, State:{5}", sFileNm, sFileVer, sFileSeq, sApplyDate, sApplyTime, sAppTypeData);
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sLogData);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
#endregion
string sQuery = "";
sQuery = "";
sQuery += "IF EXISTS(SELECT CMP_CD \n";
sQuery += " FROM POSMST..MST_PGM_VER_NEW \n";
sQuery += " WHERE \n";
sQuery += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n";
sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n";
sQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n";
sQuery += " AND KIND = '" + sKind.Trim() + "' \n";
sQuery += " AND FILE_SEQ = '" + sFileSeq.Trim() + "' \n";
sQuery += " AND FILE_VER = '" + sFileVer.Trim() + "') \n";
sQuery += " BEGIN \n";
sQuery += " UPDATE POSMST..MST_PGM_VER_NEW \n";
sQuery += " SET \n";
sQuery += " FILE_NM = '" + sFileNm.Trim() + "' \n";
sQuery += " , APPLY_DATE = '" + sApplyDate.Trim() + "' \n";
sQuery += " , APPLY_TIME = '" + sApplyTime.Trim() + "' \n";
sQuery += " , APP_TYPE = '" + sApplyType + "' \n";
sQuery += " , DEPLOY_DATE = '" + sDeployDate.Trim() + "' \n";
sQuery += " , DEPLOY_TIME = '" + sDeployTime.Trim() + "' \n";
sQuery += " , FTP_IP = '" + sFTP_IP.Trim() + "' \n";
sQuery += " , FTP_PORT = '" + sFTP_Port.Trim() + "' \n";
sQuery += " , FTP_ID = '" + sFTP_ID.Trim() + "' \n";
sQuery += " , FTP_PWD = '" + sFTP_Pwd.Trim() + "' \n";
sQuery += " , FTP_FILEPATH = '" + sFTP_FILEPATH.Trim() + "' \n";
sQuery += " , DOWN_DIV = '" + sDOWN_DIV.Trim() + "' \n";
sQuery += " , UPD_DT = CONVERT(VARCHAR(8), GETDATE(), 112) + REPLACE(CONVERT(VARCHAR(8), GETDATE(), 108), ':', '') \n";
sQuery += " , DEPLOY_DT = '" + sDeployDT.Trim() + "' \n";
sQuery += " , USE_YN = '" + sUseYn.Trim() + "' \n";
sQuery += " WHERE \n"; ;
sQuery += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n";
sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n";
sQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n";
sQuery += " AND KIND = '" + sKind.Trim() + "' \n";
sQuery += " AND FILE_SEQ = '" + sFileSeq.Trim() + "' \n";
sQuery += " AND FILE_VER = '" + sFileVer.Trim() + "' \n";
sQuery += " END \n";
sQuery += "ELSE \n";
sQuery += " BEGIN \n";
sQuery += " INSERT INTO POSMST..MST_PGM_VER_NEW \n";
sQuery += " (CMP_CD, STOR_CD, POS_NO, KIND, FILE_SEQ, FILE_VER, FILE_NM, APPLY_DATE, APPLY_TIME, APP_TYPE, DEPLOY_DATE, DEPLOY_TIME, FTP_IP, FTP_PORT, FTP_ID, FTP_PWD, FTP_FILEPATH, DOWN_DIV, REG_DT, DEPLOY_DT, USE_YN) \n";
sQuery += " VALUES( \n";
sQuery += " '" + m_cPosStatus.Base.CmpCd + "' \n";
sQuery += " , '" + m_cPosStatus.Base.StoreNo + "' \n";
sQuery += " , '" + m_cPosStatus.Base.PosNo + "' \n";
sQuery += " , '" + sKind.Trim() + "' \n";
sQuery += " , '" + sFileSeq.Trim() + "' \n";
sQuery += " , '" + sFileVer.Trim() + "' \n";
sQuery += " , '" + sFileNm.Trim() + "' \n";
sQuery += " , '" + sApplyDate.Trim() + "' \n";
sQuery += " , '" + sApplyTime.Trim() + "' \n";
sQuery += " , '" + sApplyType + "' \n";
sQuery += " , '" + sDeployDate.Trim() + "' \n";
sQuery += " , '" + sDeployTime.Trim() + "' \n";
sQuery += " , '" + sFTP_IP.Trim() + "' \n";
sQuery += " , '" + sFTP_Port.Trim() + "' \n";
sQuery += " , '" + sFTP_ID.Trim() + "' \n";
sQuery += " , '" + sFTP_Pwd.Trim() + "' \n";
sQuery += " , '" + sFTP_FILEPATH.Trim() + "' \n";
sQuery += " , '" + sDOWN_DIV.Trim() + "' \n";
sQuery += " , CONVERT(VARCHAR(8), GETDATE(), 112) + REPLACE(CONVERT(VARCHAR(8), GETDATE(), 108), ':', '') \n";
sQuery += " , '" + sDeployDT.Trim() + "' \n";
sQuery += " , '" + sUseYn.Trim() + "' \n";
sQuery += " ) \n";
sQuery += " END \n";
sQuery = sQuery.Replace("\t", " ");
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
iRet = m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery });
if (iRet == 1) sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 결락 조회
/// </summary>
/// <param name="sSaleDate"></param>
/// <param name="sPosNo"></param>
/// <param name="sTranDiv"></param>
/// <param name="sLastTradeNo"></param>
/// <param name="sMissTranNo"></param>
/// <returns></returns>
public string SearchMissTran(string sSaleDate, string sPosNo, string sTranDiv, string sLastTradeNo, ref string sMissTranNo)
{
string sRet = UserCom.RST_ERR;
Hashtable htRecvData = new Hashtable();
Hashtable htSendData = new Hashtable();
try
{
// 거래 데이터 서버 조회
htSendData.Add(Column.IQ_MISS_TRANNO_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.MISS_TRAN_INQ);
htSendData.Add(Column.IQ_MISS_TRANNO_REQ.DATA.SALE_DT, sSaleDate);
htSendData.Add(Column.IQ_MISS_TRANNO_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo);
htSendData.Add(Column.IQ_MISS_TRANNO_REQ.DATA.POS_NO, sPosNo);
htSendData.Add(Column.IQ_MISS_TRANNO_REQ.DATA.TRADE_DIV, sTranDiv);
htSendData.Add(Column.IQ_MISS_TRANNO_REQ.DATA.REG_NO, sLastTradeNo);
htSendData.Add(Column.IQ_MISS_TRANNO_REQ.DATA.REG_NO_DATA, "");
htSendData.Add(Column.IQ_MISS_TRANNO_REQ.DATA.RES_CD, "");
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.MissChkPort, 10000, htSendData, ref htRecvData, false);
if (sRet != UserCom.RST_OK)
{
return sRet;
}
if (htRecvData[Column.IQ_MISS_TRANNO_REQ.DATA.RES_CD].ToString() != "00")
{
sRet = UserCom.RST_ERR;
}
else
{
sMissTranNo = htRecvData[Column.IQ_MISS_TRANNO_REQ.DATA.REG_NO_DATA].ToString().Trim();
sRet = UserCom.RST_OK;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 결락 거래번호 재전송 설정
/// </summary>
/// <param name="sTranDiv"></param>
/// <param name="sCmpCD"></param>
/// <param name="sStorCD"></param>
/// <param name="sSaleDate"></param>
/// <param name="sPosNo"></param>
/// <param name="sTradeNo"></param>
/// <returns></returns>
public string SetMissTran(string sTranDiv, string sCmpCD, string sStorCD, string sSaleDate, string sPosNo, string sTradeNo)
{
string sRet = UserCom.RST_ERR;
int iRet = -1;
try
{
string sQuery = "";
sQuery = "";
if (sTranDiv == "0")
{
// 일반거래
sQuery += "UPDATE POSLOG..TR_SALE_HEADER \n";
sQuery += "SET SEND_YN = '0' \n";
sQuery += ", UPD_DATE = CONVERT(VARCHAR(8), GETDATE(), 112) + REPLACE(CONVERT(VARCHAR(8), GETDATE(), 114), ':', '') \n";
sQuery += "WHERE \n";
sQuery += " CMP_CD = '" + sCmpCD + "' \n";
sQuery += "AND STOR_CD = '" + sStorCD + "' \n";
sQuery += "AND SALE_DT = '" + sSaleDate + "' \n";
sQuery += "AND POS_NO = '" + sPosNo + "' \n";
sQuery += "AND TRADE_NO = '" + sTradeNo + "' \n";
}
else
{
// 기타거래
sQuery += "UPDATE POSLOG..ETC_SALE_HEADER \n";
sQuery += "SET SEND_YN = '0' \n";
sQuery += ", UPD_DATE = CONVERT(VARCHAR(8), GETDATE(), 112) + REPLACE(CONVERT(VARCHAR(8), GETDATE(), 114), ':', '') \n";
sQuery += "WHERE \n";
sQuery += " CMP_CD = '" + sCmpCD + "' \n";
sQuery += "AND STOR_CD = '" + sStorCD + "' \n";
sQuery += "AND SALE_DT = '" + sSaleDate + "' \n";
sQuery += "AND POS_NO = '" + sPosNo + "' \n";
sQuery += "AND REG_NO = '" + sTradeNo + "' \n";
}
sQuery = sQuery.Replace("\t", " ");
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
iRet = m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery });
if (iRet == 1) sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
//#20180418 고객 구매이력 정보 표시 및 해피쿠폰 발송 start
#region
/// <summary>
/// 고객 구매이력 정보 조회
/// </summary>
/// <returns></returns>
//#20180524 구매이력조회 단골여부 전문추가 start,phj
//기존
//public string ServerBuyHist(string sHppMembNo, ref string sGetData)
//변경
//#20180418 고객 구매이력 정보 표시 및 해피쿠폰 발송 start, 20180528
//쿠폰 발송 횟수 제한 기능
//기존
//public string ServerBuyHist(string sHppMembNo, string sRegularYN, ref string sGetData)
//변경
public string ServerBuyHist(string sHppMembNo, string sRegularYN, string sCpnSendCnt, ref string sGetData)
//#20180418 고객 구매이력 정보 표시 및 해피쿠폰 발송 end, 20180528
//#20180524 구매이력조회 단골여부 전문추가 end,phj
{
Hashtable htRecvData = new Hashtable();
Hashtable htSendData = new Hashtable();
string sRet = UserCom.RST_ERR;
try
{
// 서버 조회
htSendData.Add(Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.HPMEMB_BUY_HIST);
htSendData.Add(Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.RES_CD, "");
htSendData.Add(Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.HP_MEMB_NO, sHppMembNo);
//#20180524 구매이력조회 단골여부 전문추가 start,phj
htSendData.Add(Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.HP_REGULAR_YN, sRegularYN);
//#20180524 구매이력조회 단골여부 전문추가 end,phj
//#20180418 고객 구매이력 정보 표시 및 해피쿠폰 발송 start, 20180528
//쿠폰 발송 횟수 제한 기능
htSendData.Add(Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.CPN_SEND_CNT, sCpnSendCnt);
//#20180418 고객 구매이력 정보 표시 및 해피쿠폰 발송 end, 20180528
//htSendData.Add(Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.HP_MEMB_NO, "1039055252");
htSendData.Add(Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.BUYDATA, "");
//#15525 고객구매이력 수정 요청 start
//TEST
//sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, "10.0.40.134", (int)m_cPosStatus.Base.SysInfoPort, 5000, htSendData, ref htRecvData, true);
//REAL
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 5000, htSendData, ref htRecvData, false);
//#15525 고객구매이력 수정 요청 end
//sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, "10.0.40.134", (int)m_cPosStatus.Base.SysInfoPort, 5000, htSendData, ref htRecvData, true);
if (sRet == UserCom.RST_OK)
{
if (htRecvData[Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.RES_CD].ToString() == "00")
{
sGetData = htRecvData[Column.IQ_HPPMEMB_BUY_HIST_REQ.DATA.BUYDATA].ToString();
if (sGetData.Trim().Length > 0)
{
sRet = UserCom.RST_OK;
}
}
else
{
sRet = UserCom.RST_ERR;
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
//#20180418 고객 구매이력 정보 표시 및 해피쿠폰 발송 end
//#20180605 해피오더 개선 start
//즉시주문, 예약주문 알림
#region
/// <summary>
/// 해피오더 건수 조회
/// </summary>
/// <returns></returns>
public int HappyOrderCntChk(string sSaleDate = "")
{
string sReqData = string.Empty;
string sRespData = string.Empty;
string sReturn = string.Empty;
string m_sHappyOrderURL = string.Empty;
int iOrderCnt = 0;
int iRet = 0;
Hashtable htRspData = null;
try
{
// 승인업체 코드 조회
string sVanCD = PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.ORDER_ITEM, ItemConst.TR_ITEM_ID.ORDER.HAPPYORDER_PAY, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD);
// 승인 URL 조회
m_sHappyOrderURL = PosMstManager.GetMstVan(sVanCD, PosMst.MST_VAN.DATA.IP);
//sReqData = string.Format("storeCode={0}&deviceType=POS", "11101");
//일자가 있는 경우 해당 일자 건수 조회
if (sSaleDate != "")
{
sReqData = string.Format("storeCode={0}&deviceType=POS&orderDate={1}", m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.SaleDate);
}
else
{
sReqData = string.Format("storeCode={0}&deviceType=POS", m_cPosStatus.Base.StoreNo);
}
//#20180605 해피오더 개선 start - 20180618
//기존
/*
iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData, ref htRspData);
*/
//변경
if (m_cPosStatus.Base.BrandCd == PosConst.MST_BRAND_CODE.PC_PB)
{
iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT_PB, sReqData, ref sRespData, ref htRspData);
}
else
{
iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData, ref htRspData);
}
//#20180605 해피오더 개선 end - 20180618
if (iRet == BaseCom.OK)
{
iOrderCnt = this.SelectHappyOrderCountByOrderStatus(JsonConvert.DeserializeObject<Hashtable[]>(sRespData), ref htRspData);
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return iOrderCnt;
}
#endregion
#region Http
/// <summary>
/// 해피오더 GET방식 Request
/// </summary>
/// <param name="sUrl">URL</param>
/// <param name="sWorkType">메시지 타입</param>
/// <param name="sReqData">요청Data</param>
/// <param name="sRespJsonData">응답Data(Json)</param>
/// <returns></returns>
public int HttpJsonGET_SendReceive(string sUrl, string sWorkType, string sReqData, ref string sRespJsonData, ref Hashtable htRspData)
{
int iRet = BaseCom.NG;
string sRespString = string.Empty;
try
{
if (sUrl.Trim() == "") return iRet;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType + "?" + sReqData);
req.Method = "GET";
using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
{
Stream stream = resp.GetResponseStream();
StreamReader streamReader = new StreamReader(stream, Encoding.GetEncoding("UTF-8"));
sRespString = streamReader.ReadToEnd();
}
//건수 조회 응답값 로그 추가
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
UserCom.WARNING_LEVEL,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
sRespString);
Hashtable temp = JsonConvert.DeserializeObject<Hashtable>(sRespString);
foreach (string key in temp.Keys)
{
string jsonString = temp[key].ToString();
if (key.Equals("status"))
{
Hashtable htHeader = JsonConvert.DeserializeObject<Hashtable>(jsonString);
if (htHeader["status"].ToString().Equals("200"))
{
iRet = BaseCom.OK;
}
}
// 20180306 수신 데이터 sample
// http://api.celectory.com/api/ // 리얼
// {"status":{"status":200,"code":"20000","message":"조회 완료","devMessage":"success","moreInfo":null,"orderNum":null},"orderStatusCount":[{"status":"0","count":1,"type":"5"},{"status":"8","count":110,"type":"1"},{"status":"8","count":453,"type":"2"},{"status":"8","count":223,"type":"3"},{"status":"8","count":122,"type":"6"},{"status":"2000","count":2,"type":"5"},{"status":"2008","count":31,"type":"2"},{"status":"2008","count":10,"type":"3"},{"status":"2008","count":46,"type":"6"},{"status":"9007","count":8,"type":"5"},{"status":"9009","count":126,"type":"5"},{"status":"300000","count":42,"type":"1"},{"status":"300000","count":177,"type":"2"},{"status":"300000","count":501,"type":"3"},{"status":"300000","count":279,"type":"5"},{"status":"300000","count":110,"type":"6"}]}
// http://121.254.240.198:8092/api/ // 개발
// {"status":{"status":200,"code":"20000","message":"조회 완료","devMessage":"success","moreInfo":null,"orderNum":null},"orderStatusCount":[{"status":"8","count":1,"type":"3"},{"status":"2008","count":1,"type":"3"},{"status":"9007","count":3,"type":"5"},{"status":"9009","count":12,"type":"5"},{"status":"300000","count":25,"type":"3"},{"status":"300000","count":8,"type":"5"}],"deliverySupport":"Y"}
else if (key.Equals("deliverySupport"))
{
if (CmUtil.IsNull(htRspData))
{
htRspData = new Hashtable();
}
htRspData.Add(key.ToString(), temp[key].ToString());
}
else if (key.Equals("orderStatusCount"))
{
sRespJsonData = jsonString;
}
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
ex.ToString());
}
return iRet;
}
#endregion
#region
/// <summary>
/// 해피오더 주문 건수 파싱
/// </summary>
/// <param name="sRespData"></param>
/// <returns></returns>
public int SelectHappyOrderCountByOrderStatus(Hashtable[] htOrderStatus, ref Hashtable htRspData)
{
// 주문접수-일반
int iOrderRegNormalCnt = 0;
// 주문접수-배달
int iOrderRegDeliveryCnt = 0;
// 주문접수-예약
int iOrderRegReservedCnt = 0;
// 총 주문접수 건수
int iTotOrderRegCnt = 0;
int iProductReadyCnt = 0;
int iPreReservedCnt = 0;
int iPickupWaitCnt = 0;
int iPickupDelayCnt = 0;
int iNoPickupAndDelayCnt = 0;
int iDeliveryRequestCnt = 0;
int iDeliveryRegCnt = 0;
int iDeliveryingCnt = 0;
int iDeliveryDirectCnt = 0;
//즉시픽업 건수
int iOrdCnt_Direct = 0;
//즉시배달 건수
int iOrdCnt_Reserv = 0;
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
int iDeliveryProductReadyCnt = 0;
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
int iRtnCnt = 0;
try
{
foreach (Hashtable htData in htOrderStatus)
{
string sOrderType = htData["type"].ToString();
switch (htData["status"].ToString())
{
case ItemConst.HAPPYORDER_STATUS.ORDER_REG: // "4" : 주문접수
// 일반 주문건수 계산
if (sOrderType == ItemConst.ORDER_TYPE.SHOP_DIRECT ||
sOrderType == ItemConst.ORDER_TYPE.SHOP_TIME)
{
iOrderRegNormalCnt += int.Parse(htData["count"].ToString());
}
// 배달 주문건수 계산
else if (sOrderType == ItemConst.ORDER_TYPE.INNER_DELIVERY ||
sOrderType == ItemConst.ORDER_TYPE.OUTTER_DELIVERY)
{
iOrderRegDeliveryCnt += int.Parse(htData["count"].ToString());
}
// 예약 주문건수 계산
else if (sOrderType == ItemConst.ORDER_TYPE.RESERVED_ORDER ||
sOrderType == ItemConst.ORDER_TYPE.PRE_RESERVED)
{
iOrderRegReservedCnt += int.Parse(htData["count"].ToString());
}
// 즉시픽업 건수 계산
else if (sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER)
{
iOrdCnt_Direct += int.Parse(htData["count"].ToString());
}
// 즉시배달 건수 계산
else if (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)
{
iOrdCnt_Reserv += int.Parse(htData["count"].ToString());
}
break;
case ItemConst.HAPPYORDER_STATUS.PRODUCT_READY: // "5" : 상품준비
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
//기존
//iProductReadyCnt += int.Parse(htData["count"].ToString());
//변경
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY)
{
iProductReadyCnt += int.Parse(htData["count"].ToString());
}
else
{
iDeliveryProductReadyCnt += int.Parse(htData["count"].ToString());
}
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
break;
case ItemConst.HAPPYORDER_STATUS.PRE_RESERVED: // "6" : 사전예약
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
iPreReservedCnt += int.Parse(htData["count"].ToString());
break;
case ItemConst.HAPPYORDER_STATUS.PICKUP_WAIT: // "7" : 픽업대기
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
iPickupWaitCnt += int.Parse(htData["count"].ToString());
break;
case ItemConst.HAPPYORDER_STATUS.PICKUP_DELAY: // "2000" : 픽업지연
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
iPickupDelayCnt += int.Parse(htData["count"].ToString());
break;
case ItemConst.HAPPYORDER_STATUS.NO_PICKUP_AND_DELAY: // "2018" : 픽업지연미픽업
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
iNoPickupAndDelayCnt += int.Parse(htData["count"].ToString());
break;
case ItemConst.HAPPYORDER_STATUS.DELIVERY_REQ: // "9004" : 배달요청
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY) continue;
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
iDeliveryRequestCnt += int.Parse(htData["count"].ToString());
break;
case ItemConst.HAPPYORDER_STATUS.DELIVERY_REG: // "9005" : 배달접수
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY) continue;
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
iDeliveryRegCnt += int.Parse(htData["count"].ToString());
break;
case ItemConst.HAPPYORDER_STATUS.DELIVERY_ING: // "9007" : 배달중
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY) continue;
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
iDeliveryingCnt += int.Parse(htData["count"].ToString());
break;
case ItemConst.HAPPYORDER_STATUS.DELIVERY_DIRECT: // "9003" : 직접배달
//#20180905 즉시픽업,즉시배달 제외 start
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
//#20180905 즉시픽업,즉시배달 제외 end
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY) continue;
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
iDeliveryDirectCnt += int.Parse(htData["count"].ToString());
break;
}
}
iRtnCnt = iOrderRegNormalCnt + iOrderRegDeliveryCnt + iOrderRegReservedCnt +
iProductReadyCnt +
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
iDeliveryProductReadyCnt +
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
iPreReservedCnt + iPickupWaitCnt + iPickupDelayCnt +
iNoPickupAndDelayCnt + iDeliveryRequestCnt + iDeliveryRegCnt + iDeliveryingCnt;
iTotOrderRegCnt = iOrderRegNormalCnt + iOrderRegDeliveryCnt + iOrderRegReservedCnt;
// 해피오더 일반 주문접수 건수 갱신
m_cPosStatus.Sale.HappyOrderRegCnt = Convert.ToString(iOrderRegNormalCnt);
// 해피오더 예약 주문접수 건수 갱신
m_cPosStatus.Sale.HappyOrderReservedRegCnt = Convert.ToString(iOrderRegReservedCnt);
// 해피오더 배달 주문접수 건수 갱신
m_cPosStatus.Sale.HappyOrderDeliveryOrderRegCnt = Convert.ToString(iOrderRegDeliveryCnt);
// 해피오더 총 주문접수 건수 갱신
m_cPosStatus.Sale.HappyOrderTotRegCnt = Convert.ToString(iTotOrderRegCnt);
// 해피오더 상품준비 건수 갱신
m_cPosStatus.Sale.HappyOrderProductReadyCnt = Convert.ToString(iProductReadyCnt);
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
m_cPosStatus.Sale.HappyOrderDeliveryProductReadyCnt = Convert.ToString(iDeliveryProductReadyCnt);
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
// 해피오더 픽업대기 건수 갱신
m_cPosStatus.Sale.HappyOrderPickupWaitCnt = Convert.ToString(iPickupWaitCnt);
// 해피오더 픽업지연 건수 갱신
m_cPosStatus.Sale.HappyOrderPickupDelayCnt = Convert.ToString(iPickupDelayCnt);
// 해피오더 픽업지연미픽업 건수 갱신
m_cPosStatus.Sale.HappyOrderNoPickupAndDelayCnt = Convert.ToString(iNoPickupAndDelayCnt);
// 해피오더 배달요청 건수 갱신
m_cPosStatus.Sale.HappyOrderDeliveryRequestCnt = Convert.ToString(iDeliveryRequestCnt);
// 해피오더 배달접수 건수 갱신
m_cPosStatus.Sale.HappyOrderDeliveryRegCnt = Convert.ToString(iDeliveryRegCnt);
// 해피오더 직접배달 건수 갱신
m_cPosStatus.Sale.HappyOrderDeliveryDirectCnt = Convert.ToString(iDeliveryDirectCnt);
// 해피오더 배달중 건수 갱신
m_cPosStatus.Sale.HappyOrderDeliveryingCnt = Convert.ToString(iDeliveryingCnt);
//grayber@20180306 해피오더 주문가능 상태 추가 start - 해피오더 배달 가능 상태 전역변수에 값 설정
m_cPosStatus.Sale.DeliverySupport = string.Empty; // 기본값 string.Empty
if (CmUtil.IsNull(htRspData) != true)
{
if (CmUtil.IsNull(htRspData["deliverySupport"]) != true)
{// 전역변수에 값 추가
m_cPosStatus.Sale.DeliverySupport = htRspData["deliverySupport"].ToString(); // Y:N
}
}
//System.Diagnostics.Debug.WriteLine(DateTime.Now.ToShortTimeString() + " ▶▶▶ m_cPosStatus.Sale.DeliverySupport:" + m_cPosStatus.Sale.DeliverySupport); // Debug output console
//grayber@20180306 해피오더 주문가능 상태 추가 end
// 즉시픽업 건수
m_cPosStatus.Sale.HappyOrderDirectCnt = Convert.ToString(iOrdCnt_Direct);
// 즉시배달 건수
m_cPosStatus.Sale.HappyOrderReservCnt = Convert.ToString(iOrdCnt_Reserv);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return iRtnCnt;
}
#endregion
//#20180605 해피오더 개선 end
}
}