1515 lines
82 KiB
C#
1515 lines
82 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
using Cosmos.BaseFrame;
|
|
using Cosmos.UserFrame;
|
|
using Cosmos.Common;
|
|
using Cosmos.CommonManager;
|
|
using Cosmos.ServiceProvider;
|
|
|
|
namespace Cosmos.Service
|
|
{
|
|
/// <summary>
|
|
/// 주문서-영수증프린터 출력
|
|
/// </summary>
|
|
class PosReceiptOrderSheet : PosReceiptBase, IServiceUs
|
|
{
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
public PosReceiptOrderSheet()
|
|
{
|
|
m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL);
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="aParam">
|
|
/// "ORDER_REPRINT" : 주방프린터 오류시 영수증프린터로 재출력처리 => 8
|
|
/// "ORDER_SHEET" : 주방프린터와 영수증프린터가 동일장비 일때 => 7
|
|
/// "CANCEL_BILLPRT": 영수증프리터 재출력 취소 (다시 주방프린터로 재시도)
|
|
/// </param>
|
|
/// <returns></returns>
|
|
public string Execute(string[] aParam)
|
|
{
|
|
// 주방장치 출력여부 확인
|
|
if (PosMstManager.GetPosOption(POS_OPTION.OPT506) != "1") return UserCom.RST_OK;
|
|
|
|
// 영수증프린터 사용여부 확인
|
|
if (m_cDevStatus.Printer.UseYn == false) return UserCom.RST_OK;
|
|
|
|
// Mod, 2017.04.10, 주문포스도 주방출력 처리 한다.
|
|
// KPS 데몬실행여부 확인
|
|
//if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType != PosConst.MAIN_POS_DIV.MAIN_POS)
|
|
// return UserCom.RST_OK;
|
|
|
|
if (aParam != null && aParam.Length > 0 && aParam[0] == "ORDER_REPRINT")
|
|
{
|
|
return this.ExecutePrint("8");
|
|
}
|
|
else if (aParam != null && aParam.Length > 0 && aParam[0] == "ORDER_SHEET")
|
|
{
|
|
return this.ExecutePrint("7");
|
|
}
|
|
else if (aParam != null && aParam.Length > 0 && aParam[0] == "CANCEL_BILLPRT")
|
|
{
|
|
return this.CancelBillPrintStatus();
|
|
}
|
|
else
|
|
{
|
|
return UserCom.RST_ERR;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 합석 - 영수증프린터 출력 => 미사용
|
|
/// </summary>
|
|
/// <param name="aParam">
|
|
/// 0:PosConst.KPS_ORD_MSG_ID.TABLE_COMBINE
|
|
///
|
|
/// 1:From Floor
|
|
/// 2:From Table
|
|
/// 3:To Floor
|
|
/// 4:To Table
|
|
/// </param>
|
|
/// <returns></returns>
|
|
private string ExecutePrintTableAdd(string[] aParam)
|
|
{
|
|
try
|
|
{
|
|
if (aParam[0] != PosConst.KPS_ORD_MSG_ID.TABLE_COMBINE) return UserCom.RST_ERR;
|
|
|
|
// 프린터 버퍼 초기화
|
|
base.PrintBufClear();
|
|
|
|
// 합석정보 생성
|
|
KPSOrderMessage cKPSOrderMsg = new KPSOrderMessage();
|
|
cKPSOrderMsg.sTrainMode = m_cPosStatus.Base.TrainingFlag;
|
|
cKPSOrderMsg.sOrderType = PosConst.ORDER_TYPE.NORMAL;
|
|
cKPSOrderMsg.sFloorCd = aParam[1]; // From Floor
|
|
cKPSOrderMsg.sTableNo = aParam[2]; // From Table
|
|
cKPSOrderMsg.nSeq = 1;
|
|
cKPSOrderMsg.sSubShopCd = string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNo)
|
|
? m_cPosStatus.Base.StoreNo
|
|
: m_cPosStatus.Base.SubShopNo;
|
|
cKPSOrderMsg.sKtchSysCd = "LocalBillPrinter";
|
|
cKPSOrderMsg.sItemCd = string.Empty;
|
|
cKPSOrderMsg.sItemNm = string.Empty;
|
|
cKPSOrderMsg.sMsgId = PosConst.KPS_ORD_MSG_ID.TABLE_COMBINE;
|
|
cKPSOrderMsg.sMsg1 = aParam[3]; // To Floor
|
|
cKPSOrderMsg.sMsg2 = aParam[4]; // To Table
|
|
cKPSOrderMsg.sMsg3 = string.Empty;
|
|
cKPSOrderMsg.sRegDate = m_cPosStatus.Base.SaleDate;
|
|
cKPSOrderMsg.sMsgRegTime = DateTime.Now.ToString("HHmmss");
|
|
cKPSOrderMsg.sSendYn = "0";
|
|
cKPSOrderMsg.sResend = "0";
|
|
|
|
Hashtable htKPSOderMessageItme = new Hashtable();
|
|
htKPSOderMessageItme.Add(htKPSOderMessageItme.Count, cKPSOrderMsg);
|
|
|
|
MakeOrderAddMessage(1, ref htKPSOderMessageItme);
|
|
|
|
// 프린터 출력
|
|
bool isSuccess = base.PrintExecute(false, true, false);
|
|
|
|
return isSuccess ? UserCom.RST_OK : UserCom.RST_ERR;
|
|
}
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 합석 - 영수증프린터 출력 => 미사용
|
|
/// </summary>
|
|
/// <param name="aParam">
|
|
/// 0:PosConst.KPS_ORD_MSG_ID.TABLE_COMBINE
|
|
/// 1:From Floor
|
|
/// 2:From Table
|
|
/// 3:To Floor
|
|
/// 4:To Table
|
|
/// 5:CrossYN
|
|
/// </param>
|
|
/// <returns></returns>
|
|
private string ExecutePrintTableMove(string[] aParam)
|
|
{
|
|
try
|
|
{
|
|
if (aParam[0] != PosConst.KPS_ORD_MSG_ID.TABLE_MOVE) return UserCom.RST_ERR;
|
|
|
|
// 프린터 버퍼 초기화
|
|
base.PrintBufClear();
|
|
|
|
Hashtable htKPSOderMessageItme = new Hashtable();
|
|
|
|
// 합석정보 생성 (1st)
|
|
KPSOrderMessage cOrdMsg1st = new KPSOrderMessage();
|
|
cOrdMsg1st.sTrainMode = m_cPosStatus.Base.TrainingFlag;
|
|
cOrdMsg1st.sOrderType = PosConst.ORDER_TYPE.NORMAL;
|
|
cOrdMsg1st.sFloorCd = aParam[1]; // From Floor
|
|
cOrdMsg1st.sTableNo = aParam[2]; // From Table
|
|
cOrdMsg1st.nSeq = 1;
|
|
cOrdMsg1st.sSubShopCd = string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNo)
|
|
? m_cPosStatus.Base.StoreNo
|
|
: m_cPosStatus.Base.SubShopNo;
|
|
cOrdMsg1st.sKtchSysCd = "LocalBillPrinter";
|
|
cOrdMsg1st.sItemCd = string.Empty;
|
|
cOrdMsg1st.sItemNm = string.Empty;
|
|
cOrdMsg1st.sMsgId = PosConst.KPS_ORD_MSG_ID.TABLE_MOVE;
|
|
cOrdMsg1st.sMsg1 = aParam[3]; // To Floor
|
|
cOrdMsg1st.sMsg2 = aParam[4]; // To Table
|
|
cOrdMsg1st.sMsg3 = string.Empty;
|
|
cOrdMsg1st.sRegDate = m_cPosStatus.Base.SaleDate;
|
|
cOrdMsg1st.sMsgRegTime = DateTime.Now.ToString("HHmmss");
|
|
cOrdMsg1st.sSendYn = "0";
|
|
cOrdMsg1st.sResend = "0";
|
|
|
|
htKPSOderMessageItme.Add(htKPSOderMessageItme.Count, cOrdMsg1st);
|
|
|
|
// 합석정보 생성 (2nd)
|
|
if (string.IsNullOrWhiteSpace(aParam[5]))
|
|
{
|
|
KPSOrderMessage cOrdMsg2nd = new KPSOrderMessage();
|
|
cOrdMsg2nd.sTrainMode = m_cPosStatus.Base.TrainingFlag;
|
|
cOrdMsg2nd.sOrderType = PosConst.ORDER_TYPE.NORMAL;
|
|
cOrdMsg2nd.sFloorCd = aParam[3]; // From Floor
|
|
cOrdMsg2nd.sTableNo = aParam[4]; // From Table
|
|
cOrdMsg2nd.nSeq = 1;
|
|
cOrdMsg2nd.sSubShopCd = string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNo)
|
|
? m_cPosStatus.Base.StoreNo
|
|
: m_cPosStatus.Base.SubShopNo;
|
|
cOrdMsg2nd.sKtchSysCd = "LocalBillPrinter";
|
|
cOrdMsg2nd.sItemCd = string.Empty;
|
|
cOrdMsg2nd.sItemNm = string.Empty;
|
|
cOrdMsg2nd.sMsgId = PosConst.KPS_ORD_MSG_ID.TABLE_MOVE;
|
|
cOrdMsg2nd.sMsg1 = aParam[1]; // To Floor
|
|
cOrdMsg2nd.sMsg2 = aParam[2]; // To Table
|
|
cOrdMsg2nd.sMsg3 = string.Empty;
|
|
cOrdMsg2nd.sRegDate = m_cPosStatus.Base.SaleDate;
|
|
cOrdMsg1st.sMsgRegTime = DateTime.Now.ToString("HHmmss");
|
|
cOrdMsg2nd.sSendYn = "0";
|
|
cOrdMsg2nd.sResend = "0";
|
|
}
|
|
|
|
MakeOrderAddMessage(1, ref htKPSOderMessageItme);
|
|
|
|
// 프린터 출력
|
|
bool isSuccess = base.PrintExecute(false, true, false);
|
|
|
|
return isSuccess ? UserCom.RST_OK : UserCom.RST_ERR;
|
|
}
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 주문서-영수증프린트 출력
|
|
/// </summary>
|
|
/// <param name="sendType">
|
|
///
|
|
/// </param>
|
|
/// <returns></returns>
|
|
private string ExecutePrint(string sendType)
|
|
{
|
|
try
|
|
{
|
|
// 프린터 버퍼 초기화
|
|
base.PrintBufClear();
|
|
|
|
// 주방주문서 생성
|
|
Hashtable htKPSOrderSheetItem = new Hashtable();
|
|
GetKPSOrderSheetItem(sendType, ref htKPSOrderSheetItem);
|
|
if (htKPSOrderSheetItem.Count > 0)
|
|
{
|
|
for (var i = 0; i < htKPSOrderSheetItem.Count; i++)
|
|
{
|
|
Hashtable htKPSOrderSheetTemp = (Hashtable)htKPSOrderSheetItem[i];
|
|
|
|
if (htKPSOrderSheetTemp.Count == 0) continue;
|
|
|
|
KPSItem cKPSItem = (KPSItem)htKPSOrderSheetTemp[0];
|
|
var prtCnt = CmUtil.IntParse(cKPSItem.sFiller1);
|
|
if (prtCnt == 0) prtCnt = 1;
|
|
|
|
MakeOrderSheet(prtCnt, ref htKPSOrderSheetTemp);
|
|
}
|
|
}
|
|
|
|
// 주방 부가메시지 생성
|
|
Hashtable htKPSOrderMessageItem = new Hashtable();
|
|
GetKPSOrderMessageItem(sendType, ref htKPSOrderMessageItem);
|
|
if (htKPSOrderMessageItem.Count > 0)
|
|
{
|
|
for (var i = 0; i < htKPSOrderMessageItem.Count; i++)
|
|
{
|
|
Hashtable htKPSOrderMessageTemp = (Hashtable)htKPSOrderMessageItem[i];
|
|
|
|
if (htKPSOrderMessageTemp.Count == 0) continue;
|
|
|
|
KPSOrderMessage cKPSMsgItem = (KPSOrderMessage)htKPSOrderMessageTemp[0];
|
|
var prtCnt = cKPSMsgItem.printCount;
|
|
if (prtCnt == 0) prtCnt = 1;
|
|
|
|
MakeOrderAddMessage(prtCnt, ref htKPSOrderMessageTemp);
|
|
}
|
|
}
|
|
|
|
// 프린터 출력 영수증 프린터에 출력되는 현상 제거(2019.05.08)
|
|
bool isSuccess = base.PrintExecute(false, true, false);
|
|
|
|
// 출력 성공시 출력데이터 업데이트 (성공여부)
|
|
UpdatePrintStatus(isSuccess, htKPSOrderSheetItem, htKPSOrderMessageItem);
|
|
|
|
return isSuccess ? UserCom.RST_OK : UserCom.RST_ERR;
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 출력대상 주방주문서 정보 조회
|
|
/// </summary>
|
|
/// <param name="sendType"></param>
|
|
/// <param name="htKPSOrderSheetItem"></param>
|
|
/// <returns></returns>
|
|
private void GetKPSOrderSheetItem(string sendType, ref Hashtable htKPSOrderSheetItem)
|
|
{
|
|
try
|
|
{
|
|
DataTable dt = null;
|
|
|
|
#region (주석) 연습모드 적용 이전
|
|
//string sql = "SELECT ORD_DIV, FLOOR_CD, TBL_NO, SUB_STOR_CD, KTCH_SYS_CD, SEQ \n"
|
|
// + " , ORDER_NO, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM \n"
|
|
// + " , SALE_QTY, PACK_DIV, SET_MENU_CD, ORD_TIME, CANCEL_DIV \n"
|
|
// + " , SEND_YN, RESEND_YN, KTCH_SYS_USE_DIV, KTCH_PRINTER_COMM_PORT, KTCH_PRINTER_COMM_SPEED \n"
|
|
// + " , KTCH_PRINTER_OPOS_NM, KTCH_PRINTER_IP, KTCH_PRINTER_PORT, ERROR_CD \n"
|
|
// + " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, MSG \n"
|
|
// + " FROM POSMST..MST_KPS_ORD_MSG \n"
|
|
// + " WHERE SEND_YN = '" + sendType + "' \n"
|
|
// + " ORDER BY SUB_STOR_CD, KTCH_SYS_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ \n"
|
|
// ;
|
|
#endregion
|
|
|
|
#region (주석) 장치명 추가 이전
|
|
//string sql = "SELECT TRAIN_MODE_YN, ORD_DIV, FLOOR_CD, TBL_NO, SUB_STOR_CD, KTCH_SYS_CD, SEQ \n"
|
|
// + " , ORDER_NO, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM \n"
|
|
// + " , SALE_QTY, PACK_DIV, SET_MENU_CD, ORD_TIME, CANCEL_DIV \n"
|
|
// + " , SEND_YN, RESEND_YN, KTCH_SYS_USE_DIV, KTCH_PRINTER_COMM_PORT, KTCH_PRINTER_COMM_SPEED \n"
|
|
// + " , KTCH_PRINTER_OPOS_NM, KTCH_PRINTER_IP, KTCH_PRINTER_PORT, ERROR_CD \n"
|
|
// + " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, MSG \n"
|
|
// + " , KTCH_MSG \n"
|
|
// + " , ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
// + " FROM POSMST..MST_KPS_ORD_MSG \n"
|
|
// + " WHERE SEND_YN = '" + sendType + "' \n"
|
|
// + " ORDER BY TRAIN_MODE_YN, SUB_STOR_CD, KTCH_SYS_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ \n"
|
|
// ;
|
|
#endregion
|
|
|
|
var sql = "SELECT A.TRAIN_MODE_YN, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SUB_STOR_CD, A.KTCH_SYS_CD, A.SEQ \n"
|
|
+ " , A.ORDER_NO, A.POS_TYPE, A.ITEM_CD, A.ITEM_DIV, A.SHTCUT_ITEMNM \n"
|
|
+ " , A.SALE_QTY, A.PACK_DIV, A.SET_MENU_CD, A.ORD_TIME, A.CANCEL_DIV \n"
|
|
+ " , A.SEND_YN, A.RESEND_YN, A.KTCH_SYS_USE_DIV, A.KTCH_PRINTER_COMM_PORT, A.KTCH_PRINTER_COMM_SPEED \n"
|
|
+ " , A.KTCH_PRINTER_OPOS_NM, A.KTCH_PRINTER_IP, A.KTCH_PRINTER_PORT, A.ERROR_CD \n"
|
|
+ " , A.FILLER1, A.FILLER2, A.FILLER3, A.FILLER4, A.FILLER5, A.MSG \n"
|
|
+ " , A.KTCH_MSG \n"
|
|
+ " , B.POS_NO \n" // Add, 2017.06.13, POS별 주방프린터 설정
|
|
+ " , A.ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
+ " , B.KTCH_SYS_NM \n" // Add, 2017.04.06
|
|
+ " , A.ORD_POS_NO \n" // Add, 2017.04.10
|
|
+ " , C.ITEM_INFO \n" // Add, 2017.09.06 레시피 추가
|
|
+ " FROM POSMST..MST_KPS_ORD_MSG A \n"
|
|
+ " LEFT JOIN POSMST..MST_KTCH_DEVICE B WITH(NOLOCK) \n"
|
|
+ " ON A.SUB_STOR_CD = B.SUB_STOR_CD \n"
|
|
+ " AND A.KTCH_SYS_CD = B.KTCH_SYS_CD \n"
|
|
+ " AND B.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
+ " AND B.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
+ " AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n" // Add, 2017.06.12 POS별 주방프린터 설정
|
|
+ " LEFT JOIN POSMST..MST_KTCH_ITEM_INFO C WITH(NOLOCK) \n"
|
|
+ " ON A.ITEM_CD = C.ITEM_CD \n"
|
|
+ " AND C.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
+ " WHERE A.SEND_YN = '" + sendType + "' \n"
|
|
+ " AND A.ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n" // Add, 2017.04.10
|
|
//#20171102 start
|
|
|
|
//#20171103 주방영수증 출력시 부가메뉴가 위로 출력되는 증상 start
|
|
//기존
|
|
//+ " ORDER BY A.TRAIN_MODE_YN, A.SUB_STOR_CD, A.KTCH_SYS_CD, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ DESC \n";
|
|
//변경
|
|
+ " ORDER BY A.TRAIN_MODE_YN, A.SUB_STOR_CD, A.KTCH_SYS_CD, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ \n";
|
|
//#20171103 주방영수증 출력시 부가메뉴가 위로 출력되는 증상 end
|
|
|
|
//1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음
|
|
if (m_cSqlDbService.DBSelect(sql, out dt) != UserCom.OK) return;
|
|
|
|
string itemKey = string.Empty;
|
|
Hashtable htKPSOrderSheetTemp = new Hashtable();
|
|
|
|
DataRow[] arRows = null;
|
|
arRows = dt.Select("POS_NO = '" + m_cPosStatus.Base.PosNo + "'");
|
|
if (arRows.Length == 0)
|
|
arRows = dt.Select("POS_NO = '00'");
|
|
|
|
//foreach (DataRow dr in dt.Rows)
|
|
foreach (DataRow dr in arRows)
|
|
{
|
|
KPSItem cKPSItem = new KPSItem();
|
|
|
|
cKPSItem.sTrainMode = CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN"); // Add, 2017.03.05, 연습모드
|
|
cKPSItem.sOrderType = CmUtil.GetDataRowStr(dr, "ORD_DIV");
|
|
cKPSItem.sFloorCd = CmUtil.GetDataRowStr(dr, "FLOOR_CD");
|
|
cKPSItem.sTableNo = CmUtil.GetDataRowStr(dr, "TBL_NO");
|
|
|
|
cKPSItem.sSubShopCd = CmUtil.GetDataRowStr(dr, "SUB_STOR_CD"); // Add, 2017.02.07
|
|
cKPSItem.sKtchSysCd = CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD");
|
|
|
|
cKPSItem.nSeq = CmUtil.GetDataRowInt(dr, "SEQ");
|
|
cKPSItem.sOrderNo = CmUtil.GetDataRowStr(dr, "ORDER_NO");
|
|
cKPSItem.sPosType = CmUtil.GetDataRowStr(dr, "POS_TYPE");
|
|
cKPSItem.sItemCd = CmUtil.GetDataRowStr(dr, "ITEM_CD");
|
|
cKPSItem.sItemDiv = CmUtil.GetDataRowStr(dr, "ITEM_DIV");
|
|
cKPSItem.sItemNm = CmUtil.GetDataRowStr(dr, "SHTCUT_ITEMNM");
|
|
cKPSItem.nQty = CmUtil.GetDataRowInt(dr, "SALE_QTY");
|
|
cKPSItem.sPackDiv = CmUtil.GetDataRowStr(dr, "PACK_DIV");
|
|
cKPSItem.sSetMenuCd = CmUtil.GetDataRowStr(dr, "SET_MENU_CD");
|
|
cKPSItem.sOrdTime = CmUtil.GetDataRowStr(dr, "ORD_TIME");
|
|
cKPSItem.sCancelDiv = CmUtil.GetDataRowStr(dr, "CANCEL_DIV");
|
|
cKPSItem.sKtchSysUseDiv = CmUtil.GetDataRowStr(dr, "KTCH_SYS_USE_DIV");
|
|
cKPSItem.nKpsComPort = CmUtil.GetDataRowInt(dr, "KTCH_PRINTER_COMM_PORT");
|
|
cKPSItem.nKpsComBaudrate = CmUtil.GetDataRowInt(dr, "KTCH_PRINTER_COMM_SPEED");
|
|
cKPSItem.sKpsOposName = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_OPOS_NM");
|
|
cKPSItem.sKpsIp = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_IP");
|
|
cKPSItem.sKpsPort = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_PORT");
|
|
cKPSItem.sErrorCd = CmUtil.GetDataRowStr(dr, "ERROR_CD");
|
|
|
|
cKPSItem.sFiller1 = CmUtil.GetDataRowStr(dr, "FILLER1");
|
|
cKPSItem.sFiller2 = CmUtil.GetDataRowStr(dr, "FILLER2");
|
|
cKPSItem.sFiller3 = CmUtil.GetDataRowStr(dr, "FILLER3");
|
|
cKPSItem.sFiller4 = CmUtil.GetDataRowStr(dr, "FILLER4");
|
|
cKPSItem.sFiller5 = CmUtil.GetDataRowStr(dr, "FILLER5");
|
|
|
|
//cKPSItem.sKtchMemo = CmUtil.GetDataRowStr(dr, "MSG");
|
|
cKPSItem.sKtchMemo = CmUtil.GetDataRowStr(dr, "KTCH_MSG"); // Mod, 2017.03.21
|
|
cKPSItem.sItemMemo = CmUtil.GetDataRowStr(dr, "MSG"); // Add, 2017.03.21
|
|
cKPSItem.sOrdPicNm = CmUtil.GetDataRowStr(dr, "ORD_PIC_NM"); // Add, 2017.03.28, 주문담당자
|
|
cKPSItem.sOrdPosNo = CmUtil.GetDataRowStr(dr, "ORD_POS_NO"); // Add, 2017.04.10
|
|
|
|
cKPSItem.sSendYn = CmUtil.GetDataRowStr(dr, "SEND_YN");
|
|
cKPSItem.sResendYn = sendType == "8" ? "1" : CmUtil.GetDataRowStr(dr, "RESEND_YN");
|
|
cKPSItem.sKtchSysNm = CmUtil.GetDataRowStr(dr, "KTCH_SYS_NM"); // Add, 2017.04.06
|
|
cKPSItem.sRecipe = CmUtil.GetDataRowStr(dr, "ITEM_INFO"); // Add 2017.09.14
|
|
|
|
var checkKey = cKPSItem.sTrainMode + cKPSItem.sSubShopCd + cKPSItem.sKtchSysCd + cKPSItem.sFloorCd + cKPSItem.sTableNo;
|
|
if (itemKey != checkKey)
|
|
{
|
|
if (htKPSOrderSheetTemp.Count != 0)
|
|
{
|
|
htKPSOrderSheetItem.Add(htKPSOrderSheetItem.Count, htKPSOrderSheetTemp);
|
|
}
|
|
itemKey = checkKey;
|
|
|
|
htKPSOrderSheetTemp = new Hashtable();
|
|
}
|
|
|
|
htKPSOrderSheetTemp.Add(htKPSOrderSheetTemp.Count, cKPSItem);
|
|
}
|
|
|
|
if (htKPSOrderSheetTemp.Count != 0)
|
|
{
|
|
htKPSOrderSheetItem.Add(htKPSOrderSheetItem.Count, htKPSOrderSheetTemp);
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 출력대상 주방부가메시지 정보 조회
|
|
/// </summary>
|
|
/// <param name="sendType"></param>
|
|
/// <param name="htKPSOderMessageItme"></param>
|
|
private void GetKPSOrderMessageItem(string sendType, ref Hashtable htKPSOderMessageItme)
|
|
{
|
|
try
|
|
{
|
|
DataTable dt = null;
|
|
|
|
#region (주석) 연습모드 적용 이전
|
|
//string sql = " SELECT A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.SUB_STOR_CD, A.KTCH_SYS_CD \n"
|
|
// + " , A.ITEM_CD, A.SHTCUT_ITEMNM, A.MSG_DIV, A.MSG1, A.MSG2 \n"
|
|
// + " , A.MSG3, A.MSG_REG_TIME, B.KTCH_SYS_USE_DIV, B.KTCH_PRINTER_COMM_PORT, B.KTCH_PRINTER_COMM_SPEED \n"
|
|
// + " , B.KTCH_PRINTER_OPOS_NM, B.KTCH_PRINTER_IP, B.KTCH_PRINTER_PORT, ISNULL(B.PRT_CNT, 1) PRT_CNT, A.REG_DT \n"
|
|
// + " , A.SEND_YN, A.RESEND_YN \n"
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG_ADD A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE B \n"
|
|
// + " WHERE A.SEND_YN = '" + sendType + "' \n"
|
|
// + " AND A.SUB_STOR_CD = B.SUB_STOR_CD \n"
|
|
// + " AND A.KTCH_SYS_CD = B.KTCH_SYS_CD \n"
|
|
// + " AND B.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
// + " AND B.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
// + " AND B.KTCH_SYS_DIV = '1' \n"
|
|
// + " AND B.KTCH_SYS_CD <> '99' \n"
|
|
// + " ORDER BY A.SUB_STOR_CD, B.KTCH_SYS_CD, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ \n"
|
|
// ;
|
|
#endregion
|
|
|
|
string sql = " SELECT A.TRAIN_MODE_YN, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.SUB_STOR_CD, A.KTCH_SYS_CD \n"
|
|
+ " , A.ITEM_CD, A.SHTCUT_ITEMNM, A.MSG_DIV, A.MSG1, A.MSG2 \n"
|
|
+ " , A.MSG3, A.MSG_REG_TIME, B.KTCH_SYS_USE_DIV, B.KTCH_PRINTER_COMM_PORT, B.KTCH_PRINTER_COMM_SPEED \n"
|
|
+ " , B.KTCH_PRINTER_OPOS_NM, B.KTCH_PRINTER_IP, B.KTCH_PRINTER_PORT, ISNULL(B.PRT_CNT, 1) PRT_CNT, A.REG_DT \n"
|
|
+ " , A.SEND_YN, A.RESEND_YN \n"
|
|
+ " , B.KTCH_SYS_NM \n"
|
|
+ " , A.ORD_POS_NO \n"
|
|
+ " FROM POSMST..MST_KTCH_ORD_MSG_ADD A \n"
|
|
+ " , POSMST..MST_KTCH_DEVICE B WITH(NOLOCK) \n"
|
|
+ " WHERE A.SEND_YN = '" + sendType + "' \n"
|
|
+ " AND A.SUB_STOR_CD = B.SUB_STOR_CD \n"
|
|
+ " AND A.KTCH_SYS_CD = B.KTCH_SYS_CD \n"
|
|
+ " AND A.ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n" // Add, 2017.04.10
|
|
+ " AND B.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
+ " AND B.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
+ " AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n" // Add, 2017.06.12 POS별 주방프린터 설정
|
|
+ " AND B.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n"
|
|
+ " AND B.KTCH_SYS_CD <> '99' \n"
|
|
+ " ORDER BY A.TRAIN_MODE_YN, A.SUB_STOR_CD, B.KTCH_SYS_CD, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ \n"
|
|
;
|
|
|
|
//1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음
|
|
if (m_cSqlDbService.DBSelect(sql, out dt) != UserCom.OK) return;
|
|
|
|
string itemKey = string.Empty;
|
|
Hashtable htKPSOderMessageTemp = new Hashtable();
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
KPSOrderMessage cKPSOrderMsg = new KPSOrderMessage();
|
|
|
|
cKPSOrderMsg.sTrainMode = CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN"); // Add, 2017.03.05, 연습모드
|
|
cKPSOrderMsg.sOrderType = CmUtil.GetDataRowStr(dr, "ORD_DIV");
|
|
cKPSOrderMsg.sFloorCd = CmUtil.GetDataRowStr(dr, "FLOOR_CD");
|
|
cKPSOrderMsg.sTableNo = CmUtil.GetDataRowStr(dr, "TBL_NO");
|
|
cKPSOrderMsg.nSeq = CmUtil.GetDataRowInt(dr, "SEQ");
|
|
|
|
cKPSOrderMsg.sSubShopCd = CmUtil.GetDataRowStr(dr, "SUB_STOR_CD"); // Add, 2017.02.06
|
|
cKPSOrderMsg.sKtchSysCd = CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD");
|
|
cKPSOrderMsg.sKtchSysNm = CmUtil.GetDataRowStr(dr, "KTCH_SYS_NM"); // Add, 2017.04.07
|
|
|
|
cKPSOrderMsg.sItemCd = CmUtil.GetDataRowStr(dr, "ITEM_CD");
|
|
cKPSOrderMsg.sItemNm = CmUtil.GetDataRowStr(dr, "SHTCUT_ITEMNM");
|
|
cKPSOrderMsg.sMsgId = CmUtil.GetDataRowStr(dr, "MSG_DIV");
|
|
cKPSOrderMsg.sMsg1 = CmUtil.GetDataRowStr(dr, "MSG1");
|
|
cKPSOrderMsg.sMsg2 = CmUtil.GetDataRowStr(dr, "MSG2");
|
|
cKPSOrderMsg.sMsg3 = CmUtil.GetDataRowStr(dr, "MSG3");
|
|
cKPSOrderMsg.sMsgRegTime = CmUtil.GetDataRowStr(dr, "MSG_REG_TIME");
|
|
cKPSOrderMsg.sKtchSysUseDiv = CmUtil.GetDataRowStr(dr, "KTCH_SYS_USE_DIV");
|
|
cKPSOrderMsg.nKpsComPort = CmUtil.GetDataRowInt(dr, "KTCH_PRINTER_COMM_PORT");
|
|
cKPSOrderMsg.nKpsComBaudrate = CmUtil.GetDataRowInt(dr, "KTCH_PRINTER_COMM_SPEED");
|
|
cKPSOrderMsg.sKpsOposName = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_OPOS_NM");
|
|
cKPSOrderMsg.sKpsIp = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_IP");
|
|
cKPSOrderMsg.sKpsPort = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_PORT");
|
|
|
|
cKPSOrderMsg.sSendYn = CmUtil.GetDataRowStr(dr, "SEND_YN");
|
|
cKPSOrderMsg.sResend = sendType == "8" ? "1" : CmUtil.GetDataRowStr(dr, "RESEND_YN");
|
|
|
|
cKPSOrderMsg.printCount = CmUtil.GetDataRowInt(dr, "PRT_CNT");
|
|
if (cKPSOrderMsg.printCount == 0) cKPSOrderMsg.printCount = 1;
|
|
|
|
var temp = CmUtil.GetDataRowStr(dr, "REG_DT").Trim();
|
|
cKPSOrderMsg.sRegDate = temp.Length > 8 ? temp.Substring(0, 8) : m_cPosStatus.Base.SaleDate;
|
|
|
|
cKPSOrderMsg.sOrdPosNo = CmUtil.GetDataRowStr(dr, "ORD_POS_NO"); // Add, 2017.04.10
|
|
|
|
|
|
//string checkKey = cKPSOrderMsg.sTrainMode + cKPSOrderMsg.sSubShopCd + cKPSOrderMsg.sKtchSysCd + cKPSOrderMsg.sFloorCd + cKPSOrderMsg.sTableNo + cKPSOrderMsg.sMsgId;
|
|
var checkKey = string.Empty;
|
|
switch (cKPSOrderMsg.sMsgId)
|
|
{
|
|
case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO:
|
|
//case PosConst.KPS_ORD_MSG_ID.FIRE_KEY:
|
|
checkKey = cKPSOrderMsg.sTrainMode + cKPSOrderMsg.sSubShopCd + cKPSOrderMsg.sKtchSysCd + cKPSOrderMsg.sFloorCd + cKPSOrderMsg.sTableNo + cKPSOrderMsg.sMsgId + cKPSOrderMsg.sItemCd;
|
|
break;
|
|
|
|
case PosConst.KPS_ORD_MSG_ID.FIRE_KEY: // Add, 2017.03.22
|
|
default:
|
|
checkKey = cKPSOrderMsg.sTrainMode + cKPSOrderMsg.sSubShopCd + cKPSOrderMsg.sKtchSysCd + cKPSOrderMsg.sFloorCd + cKPSOrderMsg.sTableNo + cKPSOrderMsg.sMsgId;
|
|
break;
|
|
}
|
|
if (itemKey != checkKey)
|
|
{
|
|
if (htKPSOderMessageTemp.Count != 0)
|
|
{
|
|
htKPSOderMessageItme.Add(htKPSOderMessageItme.Count, htKPSOderMessageTemp);
|
|
}
|
|
|
|
itemKey = checkKey;
|
|
|
|
htKPSOderMessageTemp = new Hashtable();
|
|
}
|
|
htKPSOderMessageTemp.Add(htKPSOderMessageTemp.Count, cKPSOrderMsg);
|
|
}
|
|
|
|
if (htKPSOderMessageTemp.Count != 0)
|
|
{
|
|
htKPSOderMessageItme.Add(htKPSOderMessageItme.Count, htKPSOderMessageTemp);
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 주방 주문서 생성
|
|
/// </summary>
|
|
/// <param name="prtCount"></param>
|
|
/// <param name="htKPSOrderSheetTemp"></param>
|
|
private void MakeOrderSheet(int prtCount, ref Hashtable htKPSOrderSheetTemp)
|
|
{
|
|
try
|
|
{
|
|
var sPrtID = PosConst.PRT_ITEM.ETC;
|
|
var sPrtDat1 = string.Empty;
|
|
var sPrtDat2 = string.Empty;
|
|
|
|
// 반복출력
|
|
for (var cnt = 0; cnt < prtCount; cnt++)
|
|
{
|
|
var itemKey = string.Empty;
|
|
var ktchMemo = string.Empty;
|
|
|
|
var reprtMsg = string.Empty;
|
|
var orderNo1 = string.Empty;
|
|
var orderNo2 = string.Empty;
|
|
|
|
for (var i = 0; i < htKPSOrderSheetTemp.Count; i++)
|
|
{
|
|
KPSItem cKPSItem = (KPSItem)htKPSOrderSheetTemp[i];
|
|
|
|
if (cKPSItem.sSendYn == "1") continue;
|
|
|
|
// Mod, 2017.03.03, 연습모드
|
|
//var checkKey = cKPSItem.sOrderType + cKPSItem.sFloorCd + cKPSItem.sTableNo;
|
|
var checkKey = cKPSItem.sTrainMode + cKPSItem.sOrderType + cKPSItem.sFloorCd + cKPSItem.sTableNo;
|
|
if (itemKey != checkKey)
|
|
{
|
|
//if (sOrgOrderType != "")
|
|
if (string.IsNullOrWhiteSpace(itemKey) == false)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_CUT, "");
|
|
}
|
|
|
|
// 원정보 설정
|
|
itemKey = checkKey; // Add, 2017.03.03
|
|
|
|
// 제목
|
|
sPrtDat1 = string.Format("<< {0}{1} >>", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0154), cKPSItem.sResendYn != "0" ? " (R)" : "");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BIG, PosConst.PRT_FMT.F103, sPrtDat1);
|
|
|
|
// 연습모드 // Add, 2017.03.03, 연습모드
|
|
if (cKPSItem.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtDat1 = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VRB, PosConst.PRT_FMT.F103, sPrtDat1);
|
|
}
|
|
|
|
// 복합매장-서브매장명
|
|
if (string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNm) == false)
|
|
{
|
|
sPrtDat1 = m_cPosStatus.Base.SubShopNm;
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BLD, PosConst.PRT_FMT.F103, sPrtDat1);
|
|
}
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, string.Empty);
|
|
|
|
// 반복횟수
|
|
var prtCnt = prtCount > 1 ? string.Format(" ({0}/{1})", cnt + 1, prtCount) : string.Empty;
|
|
// 주문시간
|
|
sPrtDat1 = string.Format("{0} : {1} {2} {3}", "주문시간" //MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0155)
|
|
, m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate)
|
|
, CmUtil.StrToTime(cKPSItem.sOrdTime)
|
|
, prtCnt);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, sPrtDat1);
|
|
|
|
// 주문번호
|
|
if (cKPSItem.sFiller2 == "2")
|
|
{
|
|
// 해피오더
|
|
sPrtDat1 = string.Format("{0} : {1}", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0158), cKPSItem.sOrderNo);
|
|
}
|
|
//else if (cKPSItem.sPosType == PosConst.POS_TYPE.DEFERRED_PAYMENT)
|
|
//{
|
|
// // 후불
|
|
// sPrtDat1 = string.Format("{0} : {1}-{2}", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0156), cKPSItem.sFloorCd, cKPSItem.sTableNo);
|
|
//}
|
|
else
|
|
{
|
|
sPrtDat1 = string.Format("{0} : {1}", "주문번호", cKPSItem.sOrderNo); //MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0156), cKPSItem.sOrderNo);
|
|
}
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, sPrtDat1);
|
|
|
|
// 주문담당자
|
|
if (string.IsNullOrWhiteSpace(cKPSItem.sOrdPicNm) == false)
|
|
{
|
|
sPrtDat1 = string.Format("{0} : {1}", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0189), cKPSItem.sOrdPicNm.Trim());
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, sPrtDat1);
|
|
}
|
|
|
|
// 인원
|
|
if (cKPSItem.sPosType == PosConst.POS_TYPE.DEFERRED_PAYMENT)
|
|
{
|
|
sPrtDat1 = GetCustInfo(cKPSItem.sTrainMode, cKPSItem.sFloorCd, cKPSItem.sTableNo);
|
|
if (string.IsNullOrWhiteSpace(sPrtDat1) == false)
|
|
{
|
|
sPrtDat1 = string.Format("{0} : {1}", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0157), sPrtDat1);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, sPrtDat1);
|
|
}
|
|
}
|
|
|
|
// 주문번호/테이블
|
|
// Mod, 2017.05.08, 주분번호 후불=상단, 선불=하단 출력
|
|
sPrtDat1 = string.Empty;
|
|
sPrtDat2 = string.Empty;
|
|
orderNo1 = string.Empty;
|
|
orderNo2 = string.Empty;
|
|
if (cKPSItem.sPosType == PosConst.POS_TYPE.DEFERRED_PAYMENT)
|
|
{
|
|
#region (주문번호 상단 출력)
|
|
|
|
if (cKPSItem.sPosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && string.IsNullOrWhiteSpace(cKPSItem.sFiller2))
|
|
{
|
|
sPrtDat1 = string.Format("[ {0} ]", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0148));
|
|
sPrtDat2 = GetFloorAndTableName(cKPSItem.sFloorCd, cKPSItem.sTableNo);
|
|
}
|
|
else if (string.IsNullOrWhiteSpace(cKPSItem.sOrderNo) == false)
|
|
{
|
|
sPrtDat1 = string.Format("[ {0} ]", "주문대기번호");// MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0097));
|
|
sPrtDat2 = string.Format("{0}", cKPSItem.sOrderNo);
|
|
}
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BLD, PosConst.PRT_FMT.F103, sPrtDat1);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BIG, PosConst.PRT_FMT.F103, sPrtDat2);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
#region (주문번호 하단 출력)
|
|
if (cKPSItem.sPosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && string.IsNullOrWhiteSpace(cKPSItem.sFiller2))
|
|
{
|
|
orderNo1 = GetFloorAndTableName(cKPSItem.sFloorCd, cKPSItem.sTableNo);
|
|
orderNo2 = string.Format("[ {0} ]", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0148));
|
|
}
|
|
else if (string.IsNullOrWhiteSpace(cKPSItem.sOrderNo) == false)
|
|
{
|
|
orderNo1 = string.Format("{0}", cKPSItem.sOrderNo);
|
|
orderNo2 = string.Format("[ {0} ]", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0097));
|
|
}
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");
|
|
#endregion
|
|
}
|
|
|
|
// 재출력시 주방장치코드/명 출력
|
|
if (cKPSItem.sResendYn == "1")
|
|
{
|
|
reprtMsg = CmUtil.MidH(string.Format("# Kitchen Printer No. [{0}] {1}", cKPSItem.sKtchSysCd.Trim(), cKPSItem.sKtchSysNm.Trim()), 0, 42).Trim();
|
|
}
|
|
}
|
|
|
|
// 상품/수량
|
|
var sign = cKPSItem.sCancelDiv == "1" ? -1 : 1;
|
|
var type = GetAddOrderString(cKPSItem.sFiller3);
|
|
var qty = cKPSItem.nQty == 0 ? string.Empty : (sign * cKPSItem.nQty).ToString();
|
|
sPrtDat1 = CmUtil.RPadH(cKPSItem.sItemNm, 30) + CmUtil.RPadH(type, 5) + CmUtil.LPadH(qty, 6);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F101, sPrtDat1);
|
|
|
|
//2017.09.07 레시피 출력
|
|
if (cKPSItem.sRecipe.ToString().Trim().Length > 0)
|
|
{
|
|
string Recipe = cKPSItem.sRecipe.Replace("@", "\r").Replace("$", "\n").ToString();
|
|
string[] RecipeData = Recipe.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.None);
|
|
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
foreach (var dt in RecipeData)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, dt.Trim());
|
|
}
|
|
}
|
|
|
|
// Add, 2017.03.21, 상품메모
|
|
if (string.IsNullOrWhiteSpace(cKPSItem.sItemMemo) == false)
|
|
{
|
|
var lst = this.GetParserMemo(cKPSItem.sItemMemo);
|
|
foreach (var msg in lst)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, " " + msg.Trim());
|
|
}
|
|
}
|
|
|
|
// Add, 2017.04.10, 상품구분라인
|
|
var nextIdx = i + 1;
|
|
if (nextIdx < htKPSOrderSheetTemp.Count)
|
|
{
|
|
var NextItemDiv = ((KPSItem)htKPSOrderSheetTemp[nextIdx]).sItemDiv;
|
|
switch (NextItemDiv)
|
|
{
|
|
case ItemConst.PLU_ITEM_DIV.NORMAL:
|
|
case ItemConst.PLU_ITEM_DIV.SET_MAIN:
|
|
case ItemConst.PLU_ITEM_DIV.SET_DIS:
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
break;
|
|
}
|
|
}
|
|
|
|
#region Mod, 2017.04.25, 주방메모 출력
|
|
//// Add, 2017.01.23
|
|
//// 주방프린터 수동출력(상품선택) 옵션 처리
|
|
//if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "2")
|
|
//{
|
|
// ktchMemo = cKPSItem.sKtchMemo;
|
|
//}
|
|
#endregion
|
|
ktchMemo = cKPSItem.sKtchMemo;
|
|
}
|
|
|
|
// Add, 2017.01.23, 수동출력옵션 시 주방메모 출력
|
|
if (string.IsNullOrWhiteSpace(ktchMemo) == false)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BLD, PosConst.PRT_FMT.F101, "Memo:");
|
|
var lst = this.GetParserMemo(ktchMemo);
|
|
foreach (string msg in lst)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F101, " " + msg.Trim());
|
|
}
|
|
}
|
|
|
|
// Add, 2017.04.07
|
|
if (string.IsNullOrWhiteSpace(orderNo1) == false)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BIG, PosConst.PRT_FMT.F103, orderNo1);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BLD, PosConst.PRT_FMT.F103, orderNo2);
|
|
}
|
|
|
|
// 재출력시 주방장치코드/명 출력
|
|
if (string.IsNullOrWhiteSpace(reprtMsg) == false)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BLD, PosConst.PRT_FMT.F101, reprtMsg);
|
|
}
|
|
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_CUT, "");
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 주방 부가메시지 생성
|
|
/// </summary>
|
|
/// <param name="prtCount"></param>
|
|
/// <param name="htKPSOrderMessageTemp"></param>
|
|
private void MakeOrderAddMessage(int prtCount, ref Hashtable htKPSOrderMessageTemp)
|
|
{
|
|
try
|
|
{
|
|
string sPrtID = PosConst.PRT_ITEM.ETC;
|
|
string sPrtData = string.Empty;
|
|
|
|
// 반복출력
|
|
for (var cnt = 0; cnt < prtCount; cnt++)
|
|
{
|
|
var itemKey = string.Empty;
|
|
var reprtMsg = string.Empty;
|
|
|
|
for (var i = 0; i < htKPSOrderMessageTemp.Count; i++)
|
|
{
|
|
KPSOrderMessage cKPSMessage = (KPSOrderMessage)htKPSOrderMessageTemp[i];
|
|
|
|
if (cKPSMessage.sSendYn == "1") continue;
|
|
|
|
string checkKey = cKPSMessage.sTrainMode + cKPSMessage.sOrderType + cKPSMessage.sFloorCd + cKPSMessage.sTableNo + cKPSMessage.sMsgId;
|
|
if (itemKey != checkKey)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(itemKey) == false)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_CUT, "");
|
|
}
|
|
|
|
itemKey = checkKey;
|
|
|
|
#region ### 헤더 출력
|
|
string sPrtTitle = this.GetOrderMessageTitle(cKPSMessage.sMsgId);
|
|
|
|
switch (cKPSMessage.sMsgId)
|
|
{
|
|
case PosConst.KPS_ORD_MSG_ID.TABLE_COMBINE:
|
|
case PosConst.KPS_ORD_MSG_ID.TABLE_MOVE:
|
|
case PosConst.KPS_ORD_MSG_ID.MENU_MOVE:
|
|
sPrtData = string.Format("[{0}{1}]", sPrtTitle, cKPSMessage.sResend != "0" ? " (R)" : "");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F103, sPrtData);
|
|
|
|
// 연습모드 // Add, 2017.03.03, 연습모드
|
|
if (cKPSMessage.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtData = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VRB, PosConst.PRT_FMT.F103, sPrtData);
|
|
}
|
|
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, "");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
sPrtData = string.Format("{0} : {1} -> {2}", sPrtTitle
|
|
, GetFloorAndTableName(cKPSMessage.sFloorCd, cKPSMessage.sTableNo)
|
|
, GetFloorAndTableName(cKPSMessage.sMsg1, cKPSMessage.sMsg2));
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F101, sPrtData);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
break;
|
|
default:
|
|
sPrtData = string.Format("[{0}{1}]", sPrtTitle, cKPSMessage.sResend != "0" ? " (R)" : "");
|
|
if (cKPSMessage.sMsgId == PosConst.KPS_ORD_MSG_ID.FIRE_KEY)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VRE, PosConst.PRT_FMT.F103, sPrtData);
|
|
}
|
|
else
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F103, sPrtData);
|
|
}
|
|
|
|
// 연습모드 // Add, 2017.03.03, 연습모드
|
|
if (cKPSMessage.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtData = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VRB, PosConst.PRT_FMT.F103, sPrtData);
|
|
}
|
|
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, "");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
sPrtData = string.Format("{0} : {1}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0176)
|
|
, GetFloorAndTableName(cKPSMessage.sFloorCd, cKPSMessage.sTableNo));
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F101, sPrtData);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
break;
|
|
}
|
|
|
|
// 재출력시 주방장치코드/명 출력
|
|
if (cKPSMessage.sResend == "1")
|
|
{
|
|
reprtMsg = CmUtil.MidH(string.Format("# Kitchen Printer No. [{0}] {1}", cKPSMessage.sKtchSysCd.Trim(), cKPSMessage.sKtchSysNm.Trim()), 0, 42).Trim();
|
|
}
|
|
#endregion
|
|
|
|
#region ### 상품정보 출력
|
|
switch (cKPSMessage.sMsgId)
|
|
{
|
|
case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO:
|
|
//case PosConst.KPS_ORD_MSG_ID.FIRE_KEY:
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F101, cKPSMessage.sItemNm.Trim());
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
break;
|
|
|
|
case PosConst.KPS_ORD_MSG_ID.FIRE_KEY:
|
|
for (var j = 0; j < htKPSOrderMessageTemp.Count; j++)
|
|
{
|
|
KPSOrderMessage cKPSOrderSubMsg = (KPSOrderMessage)htKPSOrderMessageTemp[j];
|
|
|
|
sPrtData = string.Format("{0}{1}", CmUtil.RPadH(cKPSOrderSubMsg.sItemNm, 37), CmUtil.LPadH(cKPSOrderSubMsg.sMsg1, 5));
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F101, sPrtData);
|
|
|
|
i = j;
|
|
}
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
break;
|
|
|
|
case PosConst.KPS_ORD_MSG_ID.MENU_MOVE:
|
|
for (var j = 0; j < htKPSOrderMessageTemp.Count; j++)
|
|
{
|
|
KPSOrderMessage cKPSOrderSubMsg = (KPSOrderMessage)htKPSOrderMessageTemp[j];
|
|
if (cKPSOrderSubMsg.sSendYn == "1") break; ;
|
|
if (cKPSMessage.sMsgId != cKPSOrderSubMsg.sMsgId) break;
|
|
if (cKPSMessage.sFloorCd != cKPSOrderSubMsg.sFloorCd) break;
|
|
if (cKPSMessage.sTableNo != cKPSOrderSubMsg.sTableNo) break;
|
|
if (cKPSMessage.sOrderType != cKPSOrderSubMsg.sOrderType) break;
|
|
if (cKPSMessage.sKtchSysCd != cKPSOrderSubMsg.sKtchSysCd) break;
|
|
if (cKPSMessage.sMsg1.Trim() != cKPSOrderSubMsg.sMsg1.Trim()) break;
|
|
if (cKPSMessage.sMsg2.Trim() != cKPSOrderSubMsg.sMsg2.Trim()) break;
|
|
|
|
// 메뉴이동 상품정보 출력
|
|
sPrtData = string.Format("{0}{1}", CmUtil.RPadH(cKPSOrderSubMsg.sItemNm, 37), CmUtil.LPadH(cKPSOrderSubMsg.sMsg3, 5));
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F101, sPrtData);
|
|
i = j;
|
|
}
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
break;
|
|
}
|
|
#endregion
|
|
|
|
#region ### 메시지 출력
|
|
switch (cKPSMessage.sMsgId)
|
|
{
|
|
case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO:
|
|
//case PosConst.KPS_ORD_MSG_ID.FIRE_KEY:
|
|
case PosConst.KPS_ORD_MSG_ID.SEAT_MEMO:
|
|
var memo = (string.IsNullOrWhiteSpace(cKPSMessage.sMsg1) ? "" : cKPSMessage.sMsg1.Trim() + Environment.NewLine)
|
|
+ (string.IsNullOrWhiteSpace(cKPSMessage.sMsg2) ? "" : cKPSMessage.sMsg2.Trim() + Environment.NewLine)
|
|
+ (string.IsNullOrWhiteSpace(cKPSMessage.sMsg3) ? "" : cKPSMessage.sMsg3.Trim());
|
|
if (string.IsNullOrWhiteSpace(memo) == false)
|
|
{
|
|
var lst = GetParserMemo(memo.Trim());
|
|
foreach (var msg in lst)
|
|
{
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F101, " " + msg.Trim());
|
|
}
|
|
}
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
|
|
|
|
break;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ### 꼬리 출력
|
|
// 반복횟수
|
|
var prtCnt = prtCount > 1 ? string.Format(" ({0}/{1})", cnt + 1, prtCount) : string.Empty;
|
|
// 주문시간
|
|
sPrtData = string.Format("{0} : {1} {2} {3}", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0085)
|
|
, m_cPosStatus.Global.DateToCulture(cKPSMessage.sRegDate)
|
|
, CmUtil.StrToTime(cKPSMessage.sMsgRegTime)
|
|
, prtCnt);
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, sPrtData);
|
|
|
|
// 재출력시 주방장치코드/명 출력
|
|
if (string.IsNullOrWhiteSpace(reprtMsg) == false)
|
|
{
|
|
//AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_BLD, PosConst.PRT_FMT.F101, reprtMsg);
|
|
}
|
|
#endregion
|
|
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");
|
|
AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_CUT, "");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 출력오류 주문서 영수증프린터 출력 취소
|
|
/// (주방프리터 출력 재시도)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private string CancelBillPrintStatus()
|
|
{
|
|
try
|
|
{
|
|
string[] sql = new string[] { "UPDATE POSMST..MST_KPS_ORD_MSG SET SEND_YN = '0' WHERE SEND_YN = '8' "
|
|
, "UPDATE POSMST..MST_KTCH_ORD_MSG_ADD SET SEND_YN = '0' WHERE SEND_YN = '8' "};
|
|
|
|
// 주방주문서 영수증프린트
|
|
int ret = m_cSqlDbService.DBExecuteNonQuery(sql, true);
|
|
|
|
return ret == UserCom.OK ? UserCom.RST_OK : UserCom.RST_ERR;
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 출력상태 업데이트
|
|
/// </summary>
|
|
/// <param name="isSuccess"></param>
|
|
/// <param name="htKPSOrderSheetItem"></param>
|
|
/// <param name="htKPSOrderMessageItem"></param>
|
|
private bool UpdatePrintStatus(bool isSuccess, Hashtable htKPSOrderSheetItem, Hashtable htKPSOrderMessageItem)
|
|
{
|
|
try
|
|
{
|
|
string fmt = string.Empty;
|
|
List<string> lstQuery = new List<string>();
|
|
|
|
fmt = "UPDATE POSMST..MST_KPS_ORD_MSG \n"
|
|
+ " SET SEND_YN = '{7}' \n"
|
|
+ " , RESEND_YN = '{7}' \n"
|
|
+ " , ERROR_CD = '{8}' \n"
|
|
+ " WHERE TRAIN_MODE_YN = '{0}' \n" // Add, 2017.03.05, 연습모드
|
|
+ " AND ORD_DIV = '{1}' \n"
|
|
+ " AND FLOOR_CD = '{2}' \n"
|
|
+ " AND TBL_NO = '{3}' \n"
|
|
+ " AND SUB_STOR_CD = '{4}' \n"
|
|
+ " AND KTCH_SYS_CD = '{5}' \n"
|
|
+ " AND SEQ = {6}";
|
|
for (var i = 0; i < htKPSOrderSheetItem.Count; i++)
|
|
{
|
|
Hashtable htKPSOrderSheetTemp = (Hashtable)htKPSOrderSheetItem[i];
|
|
|
|
for (var j = 0; j < htKPSOrderSheetTemp.Count; j++)
|
|
{
|
|
KPSItem cKPSItem = (KPSItem)htKPSOrderSheetTemp[j];
|
|
|
|
string sql = string.Format(fmt, cKPSItem.sTrainMode // Add, 2017.03.05, 연습모드
|
|
, cKPSItem.sOrderType
|
|
, cKPSItem.sFloorCd
|
|
, cKPSItem.sTableNo
|
|
, cKPSItem.sSubShopCd
|
|
, cKPSItem.sKtchSysCd
|
|
, cKPSItem.nSeq
|
|
, isSuccess ? "1" : cKPSItem.sSendYn
|
|
, isSuccess ? cKPSItem.sResendYn : "1"
|
|
, isSuccess ? "0000" : cKPSItem.sErrorCd);
|
|
lstQuery.Add(sql);
|
|
}
|
|
}
|
|
|
|
if (isSuccess)
|
|
{
|
|
fmt = "DELETE FROM POSMST..MST_KTCH_ORD_MSG_ADD \n"
|
|
+ " WHERE TRAIN_MODE_YN = '{0}' \n" // Add, 2017.03.05, 연습모드
|
|
+ " AND ORD_DIV = '{1}' \n"
|
|
+ " AND FLOOR_CD = '{2}' \n"
|
|
+ " AND TBL_NO = '{3}' \n"
|
|
+ " AND SEQ = {4} ";
|
|
for (var i = 0; i < htKPSOrderMessageItem.Count; i++)
|
|
{
|
|
Hashtable htKPSOrderMessageTemp = (Hashtable)htKPSOrderMessageItem[i];
|
|
|
|
for (var j = 0; j < htKPSOrderMessageTemp.Count; j++)
|
|
{
|
|
KPSOrderMessage cKPSOrderMessage = (KPSOrderMessage)htKPSOrderMessageTemp[j];
|
|
|
|
string sql = string.Format(fmt, cKPSOrderMessage.sTrainMode // Add, 2017.03.05, 연습모드
|
|
, cKPSOrderMessage.sOrderType
|
|
, cKPSOrderMessage.sFloorCd
|
|
, cKPSOrderMessage.sTableNo
|
|
, cKPSOrderMessage.nSeq);
|
|
lstQuery.Add(sql);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fmt = "UPDATE POSMST..MST_KTCH_ORD_MSG_ADD \n"
|
|
+ " SET RESEND_YN = '{5}' \n"
|
|
+ " WHERE TRAIN_MODE_YN = '{0}' \n" // Add, 2017.03.05, 연습모드
|
|
+ " AND ORD_DIV = '{1}' \n"
|
|
+ " AND FLOOR_CD = '{2}' \n"
|
|
+ " AND TBL_NO = '{3}' \n"
|
|
+ " AND SEQ = {4} ";
|
|
for (var i = 0; i < htKPSOrderMessageItem.Count; i++)
|
|
{
|
|
Hashtable htKPSOrderMessageItemTemp = (Hashtable)htKPSOrderMessageItem[i];
|
|
|
|
for (var j = 0; j < htKPSOrderMessageItemTemp.Count; j++)
|
|
{
|
|
KPSOrderMessage cKPSOrderMessage = (KPSOrderMessage)htKPSOrderMessageItemTemp[j];
|
|
|
|
string sql = string.Format(fmt, cKPSOrderMessage.sTrainMode // Add, 2017.03.05, 연습모드
|
|
, cKPSOrderMessage.sOrderType
|
|
, cKPSOrderMessage.sFloorCd
|
|
, cKPSOrderMessage.sTableNo
|
|
, cKPSOrderMessage.nSeq
|
|
, isSuccess ? cKPSOrderMessage.sResend : "1");
|
|
lstQuery.Add(sql);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (lstQuery.Count == 0) return true;
|
|
|
|
// 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러
|
|
string[] aQuery = lstQuery.ToArray();
|
|
int ret = m_cSqlDbService.DBExecuteNonQuery(aQuery, 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 GetCustInfo(string trainMdoe, string floorCd, string tableNo)
|
|
{
|
|
string retValue = string.Empty;
|
|
try
|
|
{
|
|
retValue = MessageManager.GetLabelMessage(POS_MESSAGE.PRINT.MSG_0159);
|
|
int totCnt = 0;
|
|
int mCnt = 0;
|
|
int fCnt = 0;
|
|
|
|
DataTable dtData = null;
|
|
string sql = "SELECT CUST_CNT, FILLER2 FROM POSMST..MST_TBL WITH(NOLOCK) \n"
|
|
+ " WHERE TRAIN_MODE_YN = '" + trainMdoe + "' \n"
|
|
+ " AND 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.05, 연습모드
|
|
+ " AND FLOOR_CD = '" + floorCd + "' \n"
|
|
+ " AND TBL_NO = '" + tableNo + "' \n"
|
|
;
|
|
if (m_cSqlDbService.DBSelect(sql, out dtData) == UserCom.OK)
|
|
{
|
|
var temp = string.Empty;
|
|
|
|
temp = CmUtil.GetDataRowStr(dtData.Rows[0], "CUST_CNT");
|
|
if (string.IsNullOrWhiteSpace(temp) == false)
|
|
{
|
|
totCnt = CmUtil.IntParse(temp);
|
|
}
|
|
|
|
temp = CmUtil.GetDataRowStr(dtData.Rows[0], "FILLER2");
|
|
if (string.IsNullOrWhiteSpace(temp) == false)
|
|
{
|
|
totCnt = 0;
|
|
var custList = temp.Split('|');
|
|
for (var i = 0; i < custList.Count(); i++)
|
|
{
|
|
int cnt = CmUtil.IntParse(custList[i]);
|
|
totCnt += cnt;
|
|
if (i < 6) mCnt += cnt; else fCnt += cnt;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (totCnt > 0 && mCnt + fCnt == 0)
|
|
{
|
|
retValue = totCnt.ToString();
|
|
}
|
|
else
|
|
{
|
|
retValue = string.Format(MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0159), totCnt, mCnt, fCnt);
|
|
}
|
|
}
|
|
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 + "()",
|
|
ex.Message);
|
|
}
|
|
return retValue;
|
|
}
|
|
|
|
private string GetAddOrderString(string type)
|
|
{
|
|
string retValue = type;
|
|
try
|
|
{
|
|
switch (m_cPosStatus.Base.Country + type)
|
|
{
|
|
case "ko-KRNEW": retValue = "신규"; break;
|
|
case "ko-KRADD": retValue = "추가"; break;
|
|
case "ko-KRDEL": retValue = "취소"; break;
|
|
}
|
|
}
|
|
catch { }
|
|
return retValue;
|
|
}
|
|
|
|
private string GetFloorAndTableName(string floorCd, string tableNo)
|
|
{
|
|
string retValue = string.Format("{0}-{1}", floorCd, tableNo);
|
|
try
|
|
{
|
|
ITableUs tableService = (ITableUs)sManager.InitServiceInstance(ServiceLists.BSV_TABLE.DLL, ServiceLists.BSV_TABLE.TABLE_SERVICE);
|
|
DataTable dt= null;
|
|
if (tableService.SelectFloorAndTableName(floorCd.Trim(), tableNo.Trim(), out dt) == UserCom.RST_OK)
|
|
{
|
|
DataRow dr = dt.Rows[0];
|
|
string floorNm = CmUtil.GetDataRowStr(dr, "FLOOR_NM").Trim();
|
|
string tableNm = CmUtil.GetDataRowStr(dr, "TBL_NM").Trim();
|
|
if (string.IsNullOrWhiteSpace(floorNm)) floorNm = floorCd;
|
|
if (string.IsNullOrWhiteSpace(tableNm)) tableNm = tableNo;
|
|
|
|
retValue = string.Format("{0}-{1}", floorNm, tableNm);
|
|
}
|
|
}
|
|
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;
|
|
}
|
|
|
|
private string GetOrderMessageTitle(string msgId)
|
|
{
|
|
string retValue = string.Empty;
|
|
try
|
|
{
|
|
switch (msgId)
|
|
{
|
|
//case PosConst.KPS_ORD_MSG_ID.TRADE_STOP: retValue = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0232); break;
|
|
case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO: retValue = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0233); break;
|
|
case PosConst.KPS_ORD_MSG_ID.SEAT_MEMO: retValue = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0234); break;
|
|
case PosConst.KPS_ORD_MSG_ID.TABLE_COMBINE: retValue = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0235); break;
|
|
case PosConst.KPS_ORD_MSG_ID.TABLE_MOVE: retValue = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0236); break;
|
|
case PosConst.KPS_ORD_MSG_ID.MENU_MOVE: retValue = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0124); break;
|
|
case PosConst.KPS_ORD_MSG_ID.FIRE_KEY: retValue = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0628); break;
|
|
}
|
|
}
|
|
catch { }
|
|
return retValue;
|
|
}
|
|
|
|
private List<string> GetParserMemo(string memo, string headChar = "")
|
|
{
|
|
List<string> retValue = new List<string>();
|
|
try
|
|
{
|
|
const int COL_LEN = 40;
|
|
|
|
var tmp = memo;
|
|
var lines = tmp.Trim().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
|
|
|
|
for (var i = 0; i < lines.Length; i++)
|
|
{
|
|
var line = lines[i].Trim();
|
|
while (string.IsNullOrWhiteSpace(line) == false)
|
|
{
|
|
var msg = CmUtil.LeftH(line, COL_LEN).Trim();
|
|
if (string.IsNullOrWhiteSpace(msg) == false) retValue.Add(msg);
|
|
|
|
var start = CmUtil.LenH(msg);
|
|
var length = CmUtil.LenH(line) - CmUtil.LenH(msg);
|
|
line = CmUtil.MidH(line, start, length);
|
|
}
|
|
}
|
|
}
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// KPS_ORD_MSG ITEM
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// KPS.Common 모듈에 중복 선언됨
|
|
/// </remarks>
|
|
internal class KPSItem
|
|
{
|
|
public string sTrainMode; // Add, 2017.03.05, 연습모드
|
|
public string sOrderType;
|
|
public string sFloorCd;
|
|
public string sTableNo;
|
|
public string sSubShopCd; // Add, 2017.02.06
|
|
public string sKtchSysCd;
|
|
public int nSeq;
|
|
public string sOrderNo;
|
|
public string sPosType;
|
|
public string sItemCd;
|
|
public string sItemNm;
|
|
/// <summary>
|
|
/// 상품구분(0:일반, 1:세트, 2:세트자식, 3:부가상품, 4:세트할인, 5:상품권(추가))
|
|
/// </summary>
|
|
public string sItemDiv;
|
|
public int nQty;
|
|
public string sPackDiv;
|
|
public string sSetMenuCd;
|
|
public string sOrdTime;
|
|
public string sCancelDiv;
|
|
/// <summary>
|
|
/// 0:정상 1:재전송
|
|
/// </summary>
|
|
public string sResendYn;
|
|
public string sKtchSysUseDiv;
|
|
public int nKpsComPort;
|
|
public int nKpsComBaudrate;
|
|
public string sKpsOposName;
|
|
public string sKpsIp;
|
|
public string sKpsPort;
|
|
|
|
/// <summary>
|
|
/// 0:미전송 1:전송
|
|
/// </summary>
|
|
public string sSendYn;
|
|
/// <summary>
|
|
/// 0000 : 정상
|
|
///
|
|
/// </summary>
|
|
public string sErrorCd;
|
|
|
|
//public string sKpsCdBackup1;
|
|
//public string sKpsCdBackup2;
|
|
//public string sKpsCdBackup3;
|
|
//public string sKpsCdBackup4;
|
|
//public string sKpsCdBackup5;
|
|
//public string sKpsCdBackup6;
|
|
|
|
/// <summary>
|
|
/// 반복출력 횟수
|
|
/// </summary>
|
|
public string sFiller1;
|
|
/// <summary>
|
|
/// 기타주문구분
|
|
/// 1:후불일반판매, 2:해피오더
|
|
/// </summary>
|
|
public string sFiller2;
|
|
/// <summary>
|
|
/// 추가주문구분 (NEW,ADD,DEL)
|
|
/// </summary>
|
|
public string sFiller3;
|
|
/// <summary>
|
|
/// 부가메뉴구분 (SUBPRC_MENU_KEY_DIV)
|
|
///
|
|
/// </summary>
|
|
public string sFiller4;
|
|
public string sFiller5;
|
|
|
|
/// <summary>
|
|
/// 수동출력일때 주방메모
|
|
/// </summary>
|
|
public string sKtchMemo = string.Empty;
|
|
/// <summary>
|
|
/// 상품메모
|
|
/// </summary>
|
|
public string sItemMemo = string.Empty;
|
|
/// <summary>
|
|
/// 주문담당자
|
|
/// </summary>
|
|
public string sOrdPicNm = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 주방장치명
|
|
/// </summary>
|
|
public string sKtchSysNm = string.Empty; // Add, 2017.04.06
|
|
/// <summary>
|
|
/// 마자막주문POS
|
|
/// </summary>
|
|
public string sOrdPosNo = string.Empty; // Add, 2017.04.10
|
|
// 2017.09.06 레시피 추가
|
|
/// <summary>
|
|
/// 레시피
|
|
/// </summary>
|
|
public string sRecipe = string.Empty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// KPS_ORD_MSG_ADD ITEM
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// KPS.Common 모듈에 중복 선언됨
|
|
/// </remarks>
|
|
internal class KPSOrderMessage
|
|
{
|
|
public string sTrainMode; // Add, 2017.03.05, 연습모드
|
|
public string sOrderType;
|
|
public string sFloorCd;
|
|
public string sTableNo;
|
|
public int nSeq;
|
|
public string sSubShopCd; // Add, 2017.02.06
|
|
public string sKtchSysCd;
|
|
public string sItemCd;
|
|
public string sItemNm;
|
|
public string sMsgId;
|
|
public string sMsg1;
|
|
public string sMsg2;
|
|
public string sMsg3;
|
|
public string sMsgRegTime;
|
|
public string sKtchSysUseDiv;
|
|
public int nKpsComPort;
|
|
public int nKpsComBaudrate;
|
|
public string sKpsOposName;
|
|
public string sKpsIp;
|
|
public string sKpsPort;
|
|
public string sSendYn;
|
|
public string sResend;
|
|
public string sErrorCd;
|
|
public int printCount = 1;
|
|
|
|
//public string sKpsCdBackup1;
|
|
//public string sKpsCdBackup2;
|
|
//public string sKpsCdBackup3;
|
|
//public string sKpsCdBackup4;
|
|
//public string sKpsCdBackup5;
|
|
//public string sKpsCdBackup6;
|
|
|
|
public string sRegDate;
|
|
/// <summary>
|
|
/// 주방장치명
|
|
/// </summary>
|
|
public string sKtchSysNm = string.Empty; // Add, 2017.04.06
|
|
/// <summary>
|
|
/// 마지막주문POS
|
|
/// </summary>
|
|
public string sOrdPosNo = string.Empty; // Add, 2017.04.10
|
|
}
|
|
}
|