362 lines
16 KiB
C#
362 lines
16 KiB
C#
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
using Cosmos.Common;
|
|||
|
using Cosmos.CommonManager;
|
|||
|
using Cosmos.ServiceProvider;
|
|||
|
using Cosmos.UserFrame;
|
|||
|
|
|||
|
namespace Cosmos.Service
|
|||
|
{
|
|||
|
class SchEvt : IDataServiceUs
|
|||
|
{
|
|||
|
#region 변수 선언
|
|||
|
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
|||
|
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
|
|||
|
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
|||
|
protected IDataCommonUs m_cDataCommon = null; // 판매공통 모듈
|
|||
|
protected Column.POS_REQ_SERVER_INTERFACE.DATA m_cCustItem = null;
|
|||
|
|
|||
|
private ArrayList aCustItem = null;
|
|||
|
private ArrayList m_sPrintData = null;
|
|||
|
private IPosPrinterUs m_cPrinterUs = null;
|
|||
|
#endregion 변수 선언
|
|||
|
|
|||
|
public SchEvt()
|
|||
|
{
|
|||
|
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
|
|||
|
m_cPrinterUs = (IPosPrinterUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER);
|
|||
|
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 행사 주문 내역 조회
|
|||
|
/// </summary>
|
|||
|
/// <param name="aParam"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public object GetData(string[] aParam)
|
|||
|
{
|
|||
|
string sRet = string.Empty;
|
|||
|
|
|||
|
if (aParam[0] == "1")
|
|||
|
{
|
|||
|
// 내역조회
|
|||
|
sRet = SearchEventList(aParam[1], aParam[2]);
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// 상세조회
|
|||
|
sRet = SearchEventDetail(aParam[1]);
|
|||
|
return m_sPrintData;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 행사 주문 취합 내역 조회 리스트
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
private string SearchEventList(string sDateFrom, string sDateTo)
|
|||
|
{
|
|||
|
string sRet = UserCom.RST_ERR;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
Hashtable htSendData = new Hashtable();
|
|||
|
Hashtable htRecvData = new Hashtable();
|
|||
|
|
|||
|
//INQ_TYPE
|
|||
|
htSendData.Add("INQ_TYPE", ItemConst.IRT_INQ_TYPE.SERVER_INTERFACE_SCH);
|
|||
|
// STOR_CD
|
|||
|
htSendData.Add("STOR_CD", m_cPosStatus.Base.StoreNo);
|
|||
|
// POS_NO
|
|||
|
htSendData.Add("POS_NO", m_cPosStatus.Base.PosNo);
|
|||
|
// STOR_TY
|
|||
|
htSendData.Add("STOR_TY", "10");
|
|||
|
// PRT_DIV
|
|||
|
htSendData.Add("PRT_DIV", ItemConst.IRT_PRT_DIV.EVENT_ORDER);
|
|||
|
// START_DT
|
|||
|
htSendData.Add("START_DT", sDateFrom);
|
|||
|
// END_DT
|
|||
|
htSendData.Add("END_DT", sDateTo);
|
|||
|
// ORD_SEQ
|
|||
|
htSendData.Add("ORD_SEQ", "");
|
|||
|
// ORD_GRP
|
|||
|
htSendData.Add("ORD_GRP", "");
|
|||
|
// DATA_CNT
|
|||
|
htSendData.Add("DATA_CNT", "0");
|
|||
|
// RES_DATA
|
|||
|
htSendData.Add("RES_DATA", "");
|
|||
|
|
|||
|
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, 10000, htSendData, ref htRecvData);
|
|||
|
if (sRet != UserCom.RST_OK)
|
|||
|
{
|
|||
|
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0326));
|
|||
|
sRet = UserCom.RST_ERR;
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
|
|||
|
if (htRecvData["DATA_CNT"].ToString() != "0")
|
|||
|
{
|
|||
|
return htRecvData["RES_DATA"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0302));
|
|||
|
sRet = UserCom.RST_ERR;
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|||
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|||
|
}
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 행사 주문 취합 내역 조회 상세(출력메세지)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
private string SearchEventDetail(string sDateFrom)
|
|||
|
{
|
|||
|
string sRet = UserCom.RST_ERR;
|
|||
|
|
|||
|
string[] sCol = null;
|
|||
|
string[] sRow = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
Hashtable htSendData = new Hashtable();
|
|||
|
Hashtable htRecvData = new Hashtable();
|
|||
|
|
|||
|
m_sPrintData = new ArrayList();
|
|||
|
|
|||
|
//INQ_TYPE
|
|||
|
htSendData.Add("INQ_TYPE", ItemConst.IRT_INQ_TYPE.SERVER_INTERFACE_SCH);
|
|||
|
// STOR_CD
|
|||
|
htSendData.Add("STOR_CD", m_cPosStatus.Base.StoreNo);
|
|||
|
// POS_NO
|
|||
|
htSendData.Add("POS_NO", m_cPosStatus.Base.PosNo);
|
|||
|
// STOR_TY
|
|||
|
htSendData.Add("STOR_TY", "10");
|
|||
|
// PRT_DIV
|
|||
|
htSendData.Add("PRT_DIV", ItemConst.IRT_PRT_DIV.EVENT_ORDER_DETAIL);
|
|||
|
// START_DT
|
|||
|
htSendData.Add("START_DT", sDateFrom);
|
|||
|
// END_DT
|
|||
|
htSendData.Add("END_DT", sDateFrom);
|
|||
|
// ORD_SEQ
|
|||
|
htSendData.Add("ORD_SEQ", "");
|
|||
|
// ORD_GRP
|
|||
|
htSendData.Add("ORD_GRP", "");
|
|||
|
// DATA_CNT
|
|||
|
htSendData.Add("DATA_CNT", "0");
|
|||
|
// RES_DATA
|
|||
|
htSendData.Add("RES_DATA", "");
|
|||
|
|
|||
|
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, 10000, htSendData, ref htRecvData);
|
|||
|
if (sRet != UserCom.RST_OK)
|
|||
|
{
|
|||
|
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0326));
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
|
|||
|
if (htRecvData["DATA_CNT"].ToString() != "0")
|
|||
|
{
|
|||
|
if (htRecvData.Count > 0)
|
|||
|
{
|
|||
|
sCol = htRecvData["RES_DATA"].ToString().Split(new string[] { "#~" }, StringSplitOptions.RemoveEmptyEntries);
|
|||
|
|
|||
|
aCustItem = (ArrayList)StateObject.GetItemObject(Column.POS_REQ_SERVER_INTERFACE.ITEM);
|
|||
|
|
|||
|
aCustItem.Clear();
|
|||
|
|
|||
|
for (int i = 0; i < sCol.Count(); i++)
|
|||
|
{
|
|||
|
m_cCustItem = new Column.POS_REQ_SERVER_INTERFACE.DATA();
|
|||
|
|
|||
|
sRow = sCol[i].Split('|');
|
|||
|
|
|||
|
m_cCustItem.FIELD_01 = sRow[0];
|
|||
|
m_cCustItem.FIELD_02 = sRow[1];
|
|||
|
m_cCustItem.FIELD_03 = sRow[2];
|
|||
|
m_cCustItem.FIELD_04 = sRow[3];
|
|||
|
m_cCustItem.FIELD_05 = sRow[4];
|
|||
|
|
|||
|
aCustItem.Add(m_cCustItem);
|
|||
|
}
|
|||
|
|
|||
|
sRet = DisplayEventDetail(sDateFrom);
|
|||
|
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0302));
|
|||
|
sRet = UserCom.RST_ERR;
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
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 null;
|
|||
|
}
|
|||
|
|
|||
|
private string DisplayEventDetail(string sSchDate)
|
|||
|
{
|
|||
|
string sRet = UserCom.RST_ERR;
|
|||
|
|
|||
|
string sPrintData = string.Empty;
|
|||
|
string sPrtDate = string.Empty;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (sSchDate != "" && sSchDate.Length >= 8)
|
|||
|
{
|
|||
|
sPrtDate = sSchDate.Substring(0, 4) + "." + sSchDate.Substring(4, 2) + "." + sSchDate.Substring(6, 2);
|
|||
|
}
|
|||
|
|
|||
|
// 프린트 헤더
|
|||
|
AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, new string[] { "**" + MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0100) + "**" });
|
|||
|
AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, new string[] { "[ " + MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0075) + " ] " + sPrtDate });
|
|||
|
AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "=" });
|
|||
|
//AddPrintData(PosConst.PRT_HDR.PRT_NOR, "", new string[] { MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0101), MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0102),
|
|||
|
// MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0103), MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0091) });
|
|||
|
//AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" });
|
|||
|
|
|||
|
for (int iRow = 0; iRow < aCustItem.Count; iRow++)
|
|||
|
{
|
|||
|
Column.POS_REQ_SERVER_INTERFACE.DATA cCustItem = (Column.POS_REQ_SERVER_INTERFACE.DATA)aCustItem[iRow];
|
|||
|
if (iRow == 0)
|
|||
|
{
|
|||
|
AddPrintData(PosConst.PRT_HDR.PRT_NOR, "", new string[] { cCustItem.FIELD_02, cCustItem.FIELD_03, cCustItem.FIELD_04, cCustItem.FIELD_05 });
|
|||
|
AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "=" });
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
AddPrintData(PosConst.PRT_HDR.PRT_NOR, "", new string[] { cCustItem.FIELD_02, m_cPosStatus.Global.NumericTOCurrency(Convert.ToDouble(cCustItem.FIELD_03)), m_cPosStatus.Global.NumericTOCurrency(Convert.ToDouble(cCustItem.FIELD_04)), m_cPosStatus.Global.NumericTOCurrency(Convert.ToDouble(cCustItem.FIELD_05)) });
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "=" });
|
|||
|
AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, new string[] { "** " + MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0075) + " : " + DateTime.Now.ToString("yyyyMMddHHmmss") + " **" });
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
#region 영수증 출력데이터 생성
|
|||
|
/// <summary>
|
|||
|
/// 영수증 출력데이터 생성
|
|||
|
/// </summary>
|
|||
|
/// <param name="sPrtHead">출력형태</param>
|
|||
|
/// <param name="sPrtFmt">출력포맷</param>
|
|||
|
/// <param name="sData">Data</param>
|
|||
|
private void AddPrintData(string sPrtHead, string sPrtFmt, string[] aData)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
string sPrtData = "";
|
|||
|
|
|||
|
if (sPrtFmt == PosConst.PRT_FMT.F100) // 선귿기
|
|||
|
{
|
|||
|
for (int i = 1; i <= 42; i++) sPrtData += aData[0];
|
|||
|
}
|
|||
|
|
|||
|
else if (sPrtFmt == PosConst.PRT_FMT.F101) // 왼쪽정렬
|
|||
|
{
|
|||
|
sPrtData = aData[0];
|
|||
|
}
|
|||
|
else if (sPrtFmt == PosConst.PRT_FMT.F102) // 오른쪽 정렬
|
|||
|
{
|
|||
|
sPrtData = CmUtil.LPadH(aData[0], 42);
|
|||
|
}
|
|||
|
else if (sPrtFmt == PosConst.PRT_FMT.F103) // 중앙정렬
|
|||
|
{
|
|||
|
if (sPrtHead == PosConst.PRT_HDR.PRT_HOR || sPrtHead == PosConst.PRT_HDR.PRT_BIG)
|
|||
|
{
|
|||
|
if (CmUtil.LenH(aData[0]) <= 21) sPrtData = CmUtil.LPadH("", 10 - (CmUtil.LenH(aData[0]) / 2)) + aData[0];
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (CmUtil.LenH(aData[0]) <= 42) sPrtData = CmUtil.LPadH("", 21 - (CmUtil.LenH(aData[0]) / 2)) + aData[0];
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
switch (aData.Length)
|
|||
|
{
|
|||
|
case 5:
|
|||
|
sPrtData = CmUtil.RPadH(aData[0].ToString(), 13) + CmUtil.LPadH(aData[1].ToString(), 5) + CmUtil.LPadH(aData[2].ToString(), 5) + CmUtil.RPadH(aData[3].ToString(), 5) + CmUtil.LPadH(aData[4].ToString(), 14);
|
|||
|
break;
|
|||
|
case 4:
|
|||
|
sPrtData = CmUtil.RPadH(aData[0].ToString(), 12) + CmUtil.LPadH(aData[1].ToString(), 9) + CmUtil.LPadH(aData[2].ToString(), 10) + CmUtil.LPadH(aData[3].ToString(), 11);
|
|||
|
break;
|
|||
|
case 3:
|
|||
|
sPrtData = CmUtil.RPadH(aData[0].ToString(), 23) + CmUtil.LPadH(aData[1].ToString(), 7) + CmUtil.LPadH(aData[2].ToString(), 11);
|
|||
|
break;
|
|||
|
default:
|
|||
|
sPrtData = aData[0].ToString();
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
m_sPrintData.Add(sPrtHead + sPrtData);
|
|||
|
}
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public string SetData(object oParam)
|
|||
|
{
|
|||
|
string bReturn = UserCom.RST_ERR;
|
|||
|
try
|
|||
|
{
|
|||
|
ArrayList alPrintData = (ArrayList)oParam;
|
|||
|
|
|||
|
string[] arPrintData = (string[])alPrintData.ToArray(typeof(string));
|
|||
|
|
|||
|
m_cPrinterUs.ReceiptPrinter(arPrintData);
|
|||
|
}
|
|||
|
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 bReturn;
|
|||
|
}
|
|||
|
|
|||
|
public string Execute(string[] aParam)
|
|||
|
{
|
|||
|
throw new NotImplementedException();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|