3987 lines
240 KiB
C#
3987 lines
240 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
|
|
using Cosmos.Common;
|
|
using Cosmos.BaseFrame;
|
|
using Cosmos.UserFrame;
|
|
using Cosmos.CommonManager;
|
|
using Cosmos.ServiceProvider;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace Cosmos.KPS
|
|
{
|
|
public class KPSMain : IKPSMain
|
|
{
|
|
/// <summary>
|
|
/// StateServer Object (StateServer 객체)
|
|
/// </summary>
|
|
private StateServer StateObject = (StateServer)StateServer.GetInstance();
|
|
|
|
/// <summary>
|
|
/// POS Status Value (POS 상태값)
|
|
/// </summary>
|
|
private PosStatus m_cPosStatus = null;
|
|
|
|
private TranStatus m_cTrnStatus = null;
|
|
private DeviceStatus m_cDevStatus = null;
|
|
|
|
/// <summary>
|
|
/// KPS Thread (KPS 스레드)
|
|
/// </summary>
|
|
private Thread m_tKPSProc = null;
|
|
|
|
/// <summary>
|
|
/// KPS Proc Operation Yes/No (KPS Proc 작동여부)
|
|
/// </summary>
|
|
private bool m_KPSProcRunning = true;
|
|
|
|
/// <summary>
|
|
/// MSSQL DB 관련 객체
|
|
/// </summary>
|
|
private static SqlDB sqlDb = null;
|
|
|
|
// 대기시간
|
|
//private int WAIT_TIME = 3000;
|
|
//private int WAIT_TIME = 2000;
|
|
private int WAIT_TIME = 1000;
|
|
|
|
private Hashtable m_htFloor;
|
|
private Hashtable m_htTable;
|
|
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
private LabelPrinter m_cLabelPrtDevice = null;
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
|
|
|
|
public KPSMain()
|
|
{
|
|
m_cPosStatus = (PosStatus)StateObject.POS;
|
|
m_cTrnStatus = (TranStatus)StateObject.TRAN;
|
|
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
|
|
|
|
m_htFloor = new Hashtable();
|
|
m_htTable = new Hashtable();
|
|
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
m_cLabelPrtDevice = new LabelPrinter();
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
|
|
}
|
|
|
|
public void StartKPS()
|
|
{
|
|
try
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
|
"KPS Start");
|
|
|
|
// Database Connection
|
|
sqlDb = new SqlDB(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
|
|
|
|
m_tKPSProc = new Thread(new ThreadStart(KPSExecuteProc));
|
|
m_KPSProcRunning = true;
|
|
m_tKPSProc.Start();
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Floor Master
|
|
/// </summary>
|
|
/// <param name="sqlDB"></param>
|
|
private void SelectFloor()
|
|
{
|
|
string sQuery = string.Empty;
|
|
DataTable dtData = null;
|
|
try
|
|
{
|
|
m_htFloor.Clear();
|
|
sQuery = "SELECT FLOOR_CD, FLOOR_NM FROM POSMST..MST_FLOOR WITH(NOLOCK) "
|
|
+ " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "
|
|
+ " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "
|
|
+ " ORDER BY FLOOR_CD ";
|
|
|
|
// 조회
|
|
if (sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (SqlParameter[])null, out dtData) == UserCom.OK)
|
|
{
|
|
foreach (DataRow dr in dtData.Rows)
|
|
{
|
|
m_htFloor.Add(CmUtil.GetDataRowStr(dr, "FLOOR_CD"), CmUtil.GetDataRowStr(dr, "FLOOR_NM"));
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Floor Name
|
|
/// </summary>
|
|
/// <param name="sFloorCd"></param>
|
|
/// <returns></returns>
|
|
private String GetFloorName(string sFloorCd)
|
|
{
|
|
string sFloorName = sFloorCd;
|
|
|
|
try
|
|
{
|
|
if (m_htFloor.Contains(sFloorCd))
|
|
{
|
|
sFloorName = (string)m_htFloor[sFloorCd];
|
|
}
|
|
}
|
|
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 sFloorName;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Table Master
|
|
/// </summary>
|
|
/// <param name="sqlDB"></param>
|
|
private void SelectTable()
|
|
{
|
|
string sQuery = string.Empty;
|
|
DataTable dtData = null;
|
|
|
|
try
|
|
{
|
|
m_htTable.Clear();
|
|
sQuery = "SELECT FLOOR_CD, TBL_NO, TBL_NM, TBL_DISP_DIV "
|
|
+ " FROM POSMST..MST_TBL WITH(NOLOCK) "
|
|
+ " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "
|
|
+ " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "
|
|
+ " AND TRAIN_MODE_YN = '" + ItemConst.TRAINING_FLAG.TRAINING_NO + "' "
|
|
+ " ORDER BY FLOOR_CD, TBL_NO ";
|
|
|
|
// 조회
|
|
if (sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (SqlParameter[])null, out dtData) == UserCom.OK)
|
|
{
|
|
foreach (DataRow dr in dtData.Rows)
|
|
{
|
|
TableMaster cTableMaster = new TableMaster();
|
|
cTableMaster.sFloorCd = CmUtil.GetDataRowStr(dr, "FLOOR_CD");
|
|
cTableMaster.sTableNo = CmUtil.GetDataRowStr(dr, "TBL_NO");
|
|
cTableMaster.sTableNm = CmUtil.GetDataRowStr(dr, "TBL_NM");
|
|
cTableMaster.sTableDispDiv = CmUtil.GetDataRowStr(dr, "TBL_DISP_DIV");
|
|
|
|
//if (string.IsNullOrWhiteSpace(cTableMaster.sTableDispDiv)) cTableMaster.sTableDispDiv = PosConst.TABLE_DISP_FLAG.TABLE_NAME;
|
|
cTableMaster.sTableDispDiv = PosConst.TABLE_DISP_FLAG.TABLE_NAME;
|
|
if (string.IsNullOrWhiteSpace(cTableMaster.sTableNm)) cTableMaster.sTableNm = cTableMaster.sTableNo;
|
|
|
|
m_htTable.Add(m_htTable.Count, cTableMaster);
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Table Name
|
|
/// </summary>
|
|
/// <param name="sFloorCd"></param>
|
|
/// <param name="sTableNo"></param>
|
|
/// <returns></returns>
|
|
private string GetTableName(string sFloorCd, string sTableNo)
|
|
{
|
|
string sTableName = sTableNo;
|
|
|
|
try
|
|
{
|
|
for (int nLoop = 0; nLoop < m_htTable.Count; nLoop++)
|
|
{
|
|
TableMaster cTableMaster = (TableMaster)m_htTable[nLoop];
|
|
|
|
if (cTableMaster.sFloorCd == sFloorCd && cTableMaster.sTableNo == sTableNo)
|
|
{
|
|
//switch(cTableMaster.sTableDispDiv)
|
|
//{
|
|
// case TABLE_DISP_FLAG.TABLE_NO:
|
|
// sTableName = cTableMaster.sTableNo;
|
|
// break;
|
|
// case TABLE_DISP_FLAG.TABLE_NAME:
|
|
// sTableName = cTableMaster.sTableNm;
|
|
// break;
|
|
// case TABLE_DISP_FLAG.TABLE_NO_NAME:
|
|
// sTableName = cTableMaster.sTableNo + cTableMaster.sTableNm;
|
|
// break;
|
|
//}
|
|
sTableName = cTableMaster.sTableNm;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
|
ex.Message);
|
|
}
|
|
|
|
return sTableName;
|
|
}
|
|
|
|
private string GetCustInfo(string trainMode, 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) "
|
|
+ " WHERE TRAIN_MODE_YN = '" + trainMode + "' "
|
|
+ " AND CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "
|
|
+ " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "
|
|
+ " AND FLOOR_CD = '" + floorCd + "' "
|
|
+ " AND TBL_NO = '" + tableNo + "' "
|
|
;
|
|
if (sqlDb.DBDataTableSelect(sql, CommandType.Text, (SqlParameter[])null, 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 void KPSExecuteProc()
|
|
{
|
|
int nSelectCount = 60;
|
|
|
|
while (m_KPSProcRunning)
|
|
{
|
|
try
|
|
{
|
|
string ktchErrorCode = string.Empty;
|
|
Hashtable htKPSSendingItem = new Hashtable();
|
|
Hashtable htKtchDeviceStatus = new Hashtable();
|
|
|
|
// Set Wait Time
|
|
//Thread.Sleep(WAIT_TIME);
|
|
//nSelectCount += (WAIT_TIME / 1000);
|
|
|
|
// Get Print Message
|
|
if (nSelectCount >= 60)
|
|
{
|
|
if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT)
|
|
{
|
|
//SelectFloor();
|
|
//SelectTable();
|
|
}
|
|
nSelectCount = 0;
|
|
}
|
|
|
|
// KPS Send Item Make
|
|
KPSSendItemMake();
|
|
|
|
// Get item sending to KPS
|
|
htKPSSendingItem = new Hashtable();
|
|
GetKPSSendItem(ref htKPSSendingItem);
|
|
|
|
if (htKPSSendingItem.Count > 0)
|
|
{
|
|
// KPS Print
|
|
htKtchDeviceStatus = new Hashtable();
|
|
KPSPrintProc(ref htKPSSendingItem, ref htKtchDeviceStatus, ref ktchErrorCode);
|
|
|
|
// KPS Print Status Update
|
|
KPSPrintStatusUpdate(htKPSSendingItem, htKtchDeviceStatus);
|
|
}
|
|
|
|
// Get KPS Order Message
|
|
htKPSSendingItem = new Hashtable();
|
|
GetKPSOrderMessage(ref htKPSSendingItem);
|
|
|
|
if (htKPSSendingItem.Count > 0)
|
|
{
|
|
// KPS Order Message Print
|
|
htKtchDeviceStatus = new Hashtable();
|
|
KPSOrderMessagePrintProc(ref htKPSSendingItem, ref htKtchDeviceStatus, ref ktchErrorCode);
|
|
|
|
// KPS Order Message
|
|
KPSOrderMessagePrintStatusDelete(htKPSSendingItem, htKtchDeviceStatus);
|
|
}
|
|
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
// Get item sending to Label print
|
|
|
|
if (m_cDevStatus.LabelPrinter.UseYn == true)
|
|
{
|
|
htKPSSendingItem = new Hashtable();
|
|
GetLBLPRTSendItem(ref htKPSSendingItem);
|
|
|
|
if (htKPSSendingItem.Count > 0)
|
|
{
|
|
// Label Print
|
|
htKtchDeviceStatus = new Hashtable();
|
|
LBLPRTPrintProc(ref htKPSSendingItem);
|
|
|
|
// KPS Print Status Update
|
|
LBLPRTPrintStatusUpdate(htKPSSendingItem, htKtchDeviceStatus);
|
|
}
|
|
}
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
|
|
// Add, 2017.02.15, 영수증프린터로 주문서 출력을 위해 장치오류코드 설정
|
|
if (string.IsNullOrWhiteSpace(ktchErrorCode) == false)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(m_cPosStatus.Sale.KtchPrintErrorCode) || m_cPosStatus.Sale.KtchPrintErrorCode == "XXXX")
|
|
{
|
|
m_cPosStatus.Sale.KtchPrintErrorCode = ktchErrorCode;
|
|
}
|
|
}
|
|
|
|
int nNowSleepTerm = 0;
|
|
while (nNowSleepTerm < WAIT_TIME)
|
|
{
|
|
if (m_KPSProcRunning == false) break;
|
|
Thread.Sleep(100);
|
|
nNowSleepTerm += 100;
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void StopKPS()
|
|
{
|
|
try
|
|
{
|
|
m_KPSProcRunning = false;
|
|
|
|
int count = 0;
|
|
while (count < 10)
|
|
{
|
|
if (m_tKPSProc != null && m_tKPSProc.IsAlive) m_KPSProcRunning = false;
|
|
else break;
|
|
|
|
count++;
|
|
Thread.Sleep(100);
|
|
}
|
|
|
|
if (count == 10)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|
UserCom.INFO_LEVEL,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
|
"Force KPS Agent Stop!!!");
|
|
m_tKPSProc.Abort();
|
|
}
|
|
|
|
// DB Close
|
|
sqlDb.DBClose();
|
|
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
|
"KPS Stop");
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
private bool KPSSendItemMake()
|
|
{
|
|
bool bRet = false;
|
|
string sQuery = string.Empty;
|
|
|
|
Hashtable htKPSSendingItem = new Hashtable();
|
|
|
|
try
|
|
{
|
|
#region (주석) 수동출력옵션 적용 이전버전
|
|
//sQuery = "SELECT A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, B.KTCH_SYS_CD, A.SEQ ";
|
|
//sQuery += " , A.TRADE_NO, A.POS_TYPE, A.ITEM_CD, A.ITEM_DIV, A.SHTCUT_ITEMNM ";
|
|
//sQuery += " , A.SALE_QTY, A.PACK_DIV, A.SET_MENU_CD, A.ORD_TIME, A.CANCEL_DIV, A.SUB_MEMO_DIV ";
|
|
//sQuery += " , A.RESEND_YN, C.KTCH_SYS_USE_DIV, C.KTCH_PRINTER_COMM_PORT, C.KTCH_PRINTER_COMM_SPEED, C.KTCH_PRINTER_OPOS_NM ";
|
|
//sQuery += " , C.KTCH_PRINTER_IP, C.KTCH_PRINTER_PORT, C.KTCH_PRINTER_BAK1, C.KTCH_PRINTER_BAK2, C.KTCH_PRINTER_BAK3 ";
|
|
//sQuery += " , C.KTCH_PRINTER_BAK4, C.KTCH_PRINTER_BAK5, C.KTCH_PRINTER_BAK6, C.FILLER1, C.FILLER2 ";
|
|
//sQuery += " , C.FILLER3, C.FILLER4, C.FILLER5 ";
|
|
//sQuery += " FROM POSMST..MST_KTCH_ORD_MSG A ";
|
|
//sQuery += " , POSMST..MST_KTCH_DEVICE_ITEM B ";
|
|
//sQuery += " , POSMST..MST_KTCH_DEVICE C ";
|
|
//sQuery += " WHERE A.SEND_YN = '0' ";
|
|
//sQuery += " AND A.ITEM_DIV IN ('0', '1', '2', '3', '4') "; // '0':일반, '1':세트, '2':세트자식, '3':부가상품, '4':세트할인
|
|
//sQuery += " AND B.ITEM_CD = A.ITEM_CD ";
|
|
//sQuery += " AND (B.FLOOR_CD = A.FLOOR_CD OR B.FLOOR_CD = '999') ";
|
|
//sQuery += " AND B.KTCH_SYS_CD = C.KTCH_SYS_CD ";
|
|
//sQuery += " AND C.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' ";
|
|
//sQuery += " AND C.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ";
|
|
//sQuery += " AND C.KTCH_SYS_DIV = '1' "; // '1':KPS, '2':KVS
|
|
//sQuery += " AND C.USE_YN = '1' ";
|
|
#endregion
|
|
|
|
#region (주석) 복합매장 적용 이전 버전
|
|
// 주방프린터 자동출력 여부 0:자동 1:수동(프린터선택, 99:전체) 2:수동(상품선택)
|
|
//if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "1")
|
|
//{
|
|
// 1:수동(프린터선택, 99:전체)
|
|
// sQuery = "SELECT A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, C.KTCH_SYS_CD, A.SEQ \n"
|
|
// + " , A.TRADE_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, A.SUB_MEMO_DIV \n"
|
|
// + " , A.RESEND_YN, C.KTCH_SYS_USE_DIV, C.KTCH_PRINTER_COMM_PORT, C.KTCH_PRINTER_COMM_SPEED, C.KTCH_PRINTER_OPOS_NM \n"
|
|
// + " , C.KTCH_PRINTER_IP, C.KTCH_PRINTER_PORT, C.KTCH_PRINTER_BAK1, C.KTCH_PRINTER_BAK2, C.KTCH_PRINTER_BAK3, C.KTCH_PRINTER_BAK4, C.KTCH_PRINTER_BAK5, C.KTCH_PRINTER_BAK6 \n"
|
|
// //+ " , C.FILLER1, C.FILLER2, C.FILLER3, C.FILLER4, C.FILLER5 \n"
|
|
// + " , C.FILLER1, C.FILLER3, C.FILLER4, C.FILLER5 \n"
|
|
// + " , A.MSG1, A.MSG2, A.MSG3, A.FILLER2 AS ETC_ORD_FLAG \n"
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE_ITEM B \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE C \n"
|
|
// + " WHERE A.SEND_YN = '0' \n"
|
|
// + " AND A.ITEM_DIV IN ('0', '1', '2', '3', '4') \n" // '0':일반, '1':세트, '2':세트자식, '3':부가상품, '4':세트할인
|
|
// + " AND B.ITEM_CD = A.ITEM_CD \n"
|
|
// + " AND (B.FLOOR_CD = A.FLOOR_CD OR B.FLOOR_CD = '999') \n"
|
|
|
|
// //+ " AND B.KTCH_SYS_CD = A.FILLER1 \n"
|
|
// //+ " AND CASE WHEN A.FILLER1 = '99' THEN 1 ELSE B.KTCH_SYS_CD END \n"
|
|
// //+ " = CASE WHEN A.FILLER1 = '99' THEN 1 ELSE C.KTCH_SYS_CD END \n"
|
|
// + " AND B.SUB_STOR_CD + B.KTCH_SYS_CD = A.FILLER1 \n"
|
|
// + " AND CASE WHEN A.FILLER1 = '99' THEN 1 ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n"
|
|
// + " = CASE WHEN A.FILLER1 = '99' THEN 1 ELSE C.SUB_STOR_CD + C.KTCH_SYS_CD END \n"
|
|
|
|
// + " AND C.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
// + " AND C.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
// + " AND C.KTCH_SYS_DIV = '1' \n" // '1':KPS, '2':KVS
|
|
// + " AND C.USE_YN = '1' \n"
|
|
// + " AND B.USE_YN = '1' \n"
|
|
// + " AND C.KTCH_SYS_CD <> '99' \n"
|
|
// ;
|
|
//}
|
|
//else if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "2")
|
|
//{
|
|
// 2:수동(상품선택)
|
|
// sQuery = "SELECT A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, B.KTCH_SYS_CD, A.SEQ \n"
|
|
// + " , A.TRADE_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, A.SUB_MEMO_DIV \n"
|
|
// + " , A.RESEND_YN, C.KTCH_SYS_USE_DIV, C.KTCH_PRINTER_COMM_PORT, C.KTCH_PRINTER_COMM_SPEED, C.KTCH_PRINTER_OPOS_NM \n"
|
|
// + " , C.KTCH_PRINTER_IP, C.KTCH_PRINTER_PORT, C.KTCH_PRINTER_BAK1, C.KTCH_PRINTER_BAK2, C.KTCH_PRINTER_BAK3, C.KTCH_PRINTER_BAK4, C.KTCH_PRINTER_BAK5, C.KTCH_PRINTER_BAK6 \n"
|
|
// //+ " , C.FILLER1, C.FILLER2, C.FILLER3, C.FILLER4, C.FILLER5 \n"
|
|
// + " , C.FILLER1, C.FILLER3, C.FILLER4, C.FILLER5 \n"
|
|
// + " , A.MSG1, A.MSG2, A.MSG3, A.FILLER2 AS ETC_ORD_FLAG \n"
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE_ITEM B \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE C \n"
|
|
// + " WHERE A.SEND_YN = '0' \n"
|
|
// + " AND A.ITEM_DIV IN ('0', '1', '2', '3', '4') \n" // '0':일반, '1':세트, '2':세트자식, '3':부가상품, '4':세트할인
|
|
// + " AND B.ITEM_CD = A.ITEM_CD \n"
|
|
// + " AND (B.FLOOR_CD = A.FLOOR_CD OR B.FLOOR_CD = '999') \n"
|
|
|
|
// + " AND B.SUB_STOR_CD = C.SUB_STOR_CD \n"
|
|
// + " AND B.KTCH_SYS_CD = C.KTCH_SYS_CD \n"
|
|
|
|
// + " AND C.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
// + " AND C.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
// + " AND C.KTCH_SYS_DIV = '1' \n" // '1':KPS, '2':KVS
|
|
// + " AND C.USE_YN = '1' \n"
|
|
// + " AND B.USE_YN = '1' \n"
|
|
|
|
// //+ " AND A.ITEM_CD = A.FILLER1 \n" // 선택한 상품만 출력
|
|
// + " AND A.SUB_STOR_CD + A.ITEM_CD = A.FILLER1 \n" // 선택한 상품만 출력
|
|
|
|
// + " AND B.KTCH_SYS_CD <> '99' \n" // 99번 장치관련 상품은 출력하지 않는다.
|
|
// + " AND C.KTCH_SYS_CD <> '99' \n"
|
|
// ;
|
|
//}
|
|
//else
|
|
//{
|
|
// 0:자동
|
|
// sQuery = "SELECT A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, B.KTCH_SYS_CD, A.SEQ \n"
|
|
// + " , A.TRADE_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, A.SUB_MEMO_DIV \n"
|
|
// + " , A.RESEND_YN, C.KTCH_SYS_USE_DIV, C.KTCH_PRINTER_COMM_PORT, C.KTCH_PRINTER_COMM_SPEED, C.KTCH_PRINTER_OPOS_NM \n"
|
|
// + " , C.KTCH_PRINTER_IP, C.KTCH_PRINTER_PORT, C.KTCH_PRINTER_BAK1, C.KTCH_PRINTER_BAK2, C.KTCH_PRINTER_BAK3, C.KTCH_PRINTER_BAK4, C.KTCH_PRINTER_BAK5, C.KTCH_PRINTER_BAK6 \n"
|
|
// //+ " , C.FILLER1, C.FILLER2, C.FILLER3, C.FILLER4, C.FILLER5 \n"
|
|
// + " , C.FILLER1, C.FILLER3, C.FILLER4, C.FILLER5 \n"
|
|
// + " , A.MSG1, A.MSG2, A.MSG3, A.FILLER2 AS ETC_ORD_FLAG \n"
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE_ITEM B \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE C \n"
|
|
// + " WHERE A.SEND_YN = '0' \n"
|
|
// + " AND A.ITEM_DIV IN ('0', '1', '2', '3', '4') \n" // '0':일반, '1':세트, '2':세트자식, '3':부가상품, '4':세트할인
|
|
// //+ " AND B.ITEM_CD = A.ITEM_CD \n"
|
|
// + " AND A.SUB_STOR_CD = B.SUB_STOR_CD \n"
|
|
// + " AND A.ITEM_CD = B.ITEM_CD \n"
|
|
// + " AND (B.FLOOR_CD = A.FLOOR_CD OR B.FLOOR_CD = '999') \n"
|
|
// + " AND B.KTCH_SYS_CD = C.KTCH_SYS_CD \n"
|
|
// + " AND C.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
// + " AND C.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
// + " AND C.KTCH_SYS_DIV = '1' \n" // '1':KPS, '2':KVS
|
|
// + " AND C.USE_YN = '1' \n"
|
|
// + " AND B.USE_YN = '1' \n"
|
|
// //+ " AND B.KTCH_SYS_CD <> '99' \n" // 99번 장치관련 상품은 출력하지 않는다.
|
|
// + " AND C.KTCH_SYS_CD <> '99' \n"
|
|
// ;
|
|
//}
|
|
#endregion
|
|
|
|
|
|
#region (주석) 기존 POS 로직
|
|
|
|
// 주방프린터 자동출력 여부 0:자동 1:수동(프린터선택, 99:전체) 2:수동(상품선택)
|
|
//if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "1")
|
|
//{
|
|
// // 1:수동(프린터선택, 99:전체)
|
|
// sQuery = "SELECT DISTINCT \n"
|
|
// //+ " A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.TRADE_NO, A.POS_TYPE, A.ITEM_CD, A.ITEM_DIV, A.SHTCUT_ITEMNM \n" // Add, 2017.03.03, 연습모드
|
|
// + " A.TRAIN_MODE_YN, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.TRADE_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, A.SUB_MEMO_DIV, A.RESEND_YN \n"
|
|
// + " , A.MSG1, A.MSG2, A.MSG3, A.FILLER2 AS ETC_ORD_FLAG, A.FILLER3 AS ADD_ORD_FLAG \n"
|
|
// + " , C.POS_NO \n" // Add, 2017.06.14 POS별 주방프린터 설정
|
|
// + " , C.SUB_STOR_CD, C.KTCH_SYS_CD \n"
|
|
// + " , C.KTCH_SYS_USE_DIV, C.KTCH_PRINTER_COMM_PORT, C.KTCH_PRINTER_COMM_SPEED, C.KTCH_PRINTER_OPOS_NM, C.KTCH_PRINTER_IP, C.KTCH_PRINTER_PORT \n"
|
|
// + " , C.FILLER1, C.FILLER3, C.FILLER4, C.FILLER5, ISNULL(C.PRT_CNT, 1) AS PRT_CNT \n"
|
|
// + " , A.KTCH_MSG \n" // Add, 2017.03.21
|
|
// + " , A.ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
// + " , A.ORG_QTY \n" // Add, 2017.03.31
|
|
// + " , A.ORD_POS_NO \n" // Add, 2017.04.10
|
|
// + " , A.FILLER5 AS ORDER_SEQ \n" // Add, 2017.04.11
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE C WITH(NOLOCK) \n"
|
|
// + " WHERE A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.ITEM_CD = B.ITEM_CD \n"
|
|
// + " AND (A.FLOOR_CD = B.FLOOR_CD OR '999' = B.FLOOR_CD) \n"
|
|
|
|
// //#20180221 복합매장인 경우 주방출력상품을 장치코드 99에 등록하면 여러장 출력되는 증상 수정 start
|
|
// //기존
|
|
// //+ " AND B.CMP_CD = C.CMP_CD AND B.STOR_CD = C.STOR_CD \n"
|
|
// //변경
|
|
// + " AND B.CMP_CD = C.CMP_CD AND B.STOR_CD = C.STOR_CD AND B.SUB_STOR_CD = C.SUB_STOR_CD \n"
|
|
// //#20180221 복합매장인 경우 주방출력상품을 장치코드 99에 등록하면 여러장 출력되는 증상 수정 end
|
|
|
|
// + " AND CASE WHEN B.KTCH_SYS_CD = '99' OR A.FILLER1 = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n"
|
|
// + " = CASE WHEN B.KTCH_SYS_CD = '99' OR A.FILLER1 = '99' THEN '1' ELSE C.SUB_STOR_CD + C.KTCH_SYS_CD END \n"
|
|
// + " AND CASE WHEN A.FILLER1 = '99' THEN '1' ELSE A.FILLER1 END \n" // 선택장치조건
|
|
// + " = CASE WHEN A.FILLER1 = '99' THEN '1' ELSE C.SUB_STOR_CD + C.KTCH_SYS_CD END \n"
|
|
// + " AND A.TRAIN_MODE_YN IN ('0', '1') " // Add, 2017.03.03, 연습모드
|
|
// + " AND A.ORD_DIV = '0' \n"
|
|
// + " AND A.SEND_YN = '0' \n"
|
|
// + " AND A.ITEM_DIV IN ('0', '1', '2', '3', '4') \n"
|
|
// + " AND A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
// + " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
// + " AND A.ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n" // Add, 2017.04.10
|
|
// + " AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
// + " AND C.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
// + " AND C.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n"
|
|
// + " AND C.KTCH_SYS_CD <> '99' \n"
|
|
// + " ORDER BY C.SUB_STOR_CD, C.KTCH_SYS_CD \n"
|
|
// ;
|
|
//}
|
|
//else if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "2")
|
|
//{
|
|
// // 2:수동(상품선택)
|
|
// sQuery = "SELECT DISTINCT \n"
|
|
// //+ " A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.TRADE_NO, A.POS_TYPE, A.ITEM_CD, A.ITEM_DIV, A.SHTCUT_ITEMNM \n" // Add, 2017.03.03, 연습모드
|
|
// + " A.TRAIN_MODE_YN, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.TRADE_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, A.SUB_MEMO_DIV, A.RESEND_YN \n"
|
|
// + " , A.MSG1, A.MSG2, A.MSG3, A.FILLER2 AS ETC_ORD_FLAG, A.FILLER3 AS ADD_ORD_FLAG \n"
|
|
// + " , C.POS_NO \n" // Add, 2017.06.14 POS별 주방프린터 설정
|
|
// + " , C.SUB_STOR_CD, C.KTCH_SYS_CD \n"
|
|
// + " , C.KTCH_SYS_USE_DIV, C.KTCH_PRINTER_COMM_PORT, C.KTCH_PRINTER_COMM_SPEED, C.KTCH_PRINTER_OPOS_NM, C.KTCH_PRINTER_IP, C.KTCH_PRINTER_PORT \n"
|
|
// + " , C.FILLER1, C.FILLER3, C.FILLER4, C.FILLER5, ISNULL(C.PRT_CNT, 1) AS PRT_CNT \n"
|
|
// + " , A.KTCH_MSG \n" // Add, 2017.03.21
|
|
// + " , A.ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
// + " , A.ORG_QTY \n" // Add, 2017.03.31
|
|
// + " , A.ORD_POS_NO \n" // Add, 2017.04.10
|
|
// + " , A.FILLER5 AS ORDER_SEQ \n" // Add, 2017.04.11
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE C WITH(NOLOCK) \n"
|
|
// + " WHERE A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.ITEM_CD = B.ITEM_CD \n"
|
|
// + " AND (A.FLOOR_CD = B.FLOOR_CD OR '999' = B.FLOOR_CD) \n"
|
|
|
|
// //#20180221 복합매장인 경우 주방출력상품을 장치코드 99에 등록하면 여러장 출력되는 증상 수정 start
|
|
// //기존
|
|
// //+ " AND B.CMP_CD = C.CMP_CD AND B.STOR_CD = C.STOR_CD \n"
|
|
// //변경
|
|
// + " AND B.CMP_CD = C.CMP_CD AND B.STOR_CD = C.STOR_CD AND B.SUB_STOR_CD = C.SUB_STOR_CD \n"
|
|
// //#20180221 복합매장인 경우 주방출력상품을 장치코드 99에 등록하면 여러장 출력되는 증상 수정 end
|
|
|
|
// + " AND CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n"
|
|
// + " = CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE C.SUB_STOR_CD + C.KTCH_SYS_CD END \n"
|
|
// + " AND A.FILLER1 = 'PRINT' \n" // 선택한 상품만 출력
|
|
// + " AND A.TRAIN_MODE_YN IN ('0', '1') " // Add, 2017.03.03, 연습모드
|
|
// + " AND A.ORD_DIV = '0' \n"
|
|
// + " AND A.SEND_YN = '0' \n"
|
|
// + " AND A.ITEM_DIV IN ('0', '1', '2', '3', '4') \n"
|
|
// + " AND A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
// + " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
// + " AND A.ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n" // Add, 2017.04.10
|
|
// + " AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
// + " AND C.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
// + " AND C.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n"
|
|
// + " AND C.KTCH_SYS_CD <> '99' \n"
|
|
// + " ORDER BY C.SUB_STOR_CD, C.KTCH_SYS_CD \n"
|
|
// ;
|
|
//}
|
|
//else
|
|
//{
|
|
// // 0:자동
|
|
// sQuery = "SELECT DISTINCT \n"
|
|
// //+ " A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.TRADE_NO, A.POS_TYPE, A.ITEM_CD, A.ITEM_DIV, A.SHTCUT_ITEMNM \n" // Add, 2017.03.03, 연습모드
|
|
// + " A.TRAIN_MODE_YN, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.TRADE_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, A.SUB_MEMO_DIV, A.RESEND_YN \n"
|
|
// + " , A.MSG1, A.MSG2, A.MSG3, A.FILLER2 AS ETC_ORD_FLAG, A.FILLER3 AS ADD_ORD_FLAG \n"
|
|
// + " , C.POS_NO \n" // Add, 2017.06.12, POS별 주방프린터 설정
|
|
// + " , C.SUB_STOR_CD, C.KTCH_SYS_CD \n"
|
|
// + " , C.KTCH_SYS_USE_DIV, C.KTCH_PRINTER_COMM_PORT, C.KTCH_PRINTER_COMM_SPEED, C.KTCH_PRINTER_OPOS_NM, C.KTCH_PRINTER_IP, C.KTCH_PRINTER_PORT \n"
|
|
// + " , C.FILLER1, C.FILLER3, C.FILLER4, C.FILLER5, ISNULL(C.PRT_CNT, 1) AS PRT_CNT \n"
|
|
// + " , A.KTCH_MSG \n" // Add, 2017.03.21
|
|
// + " , A.ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
// + " , A.ORG_QTY \n" // Add, 2017.03.31
|
|
// + " , A.ORD_POS_NO \n" // Add, 2017.04.10
|
|
// + " , A.FILLER5 AS ORDER_SEQ \n" // Add, 2017.04.11
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE C WITH(NOLOCK) \n"
|
|
// + " WHERE A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.ITEM_CD = B.ITEM_CD \n"
|
|
// + " AND (A.FLOOR_CD = B.FLOOR_CD OR '999' = B.FLOOR_CD) \n"
|
|
|
|
// //#20180221 복합매장인 경우 주방출력상품을 장치코드 99에 등록하면 여러장 출력되는 증상 수정 start
|
|
// //기존
|
|
// //+ " AND B.CMP_CD = C.CMP_CD AND B.STOR_CD = C.STOR_CD \n"
|
|
// //변경
|
|
// + " AND B.CMP_CD = C.CMP_CD AND B.STOR_CD = C.STOR_CD AND B.SUB_STOR_CD = C.SUB_STOR_CD \n"
|
|
// //#20180221 복합매장인 경우 주방출력상품을 장치코드 99에 등록하면 여러장 출력되는 증상 수정 end
|
|
|
|
// + " AND CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n"
|
|
// + " = CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE C.SUB_STOR_CD + C.KTCH_SYS_CD END \n"
|
|
// + " AND A.TRAIN_MODE_YN IN ('0', '1') " // Add, 2017.03.03, 연습모드
|
|
// + " AND A.ORD_DIV = '0' \n"
|
|
// + " AND A.SEND_YN = '0' \n"
|
|
// + " AND A.ITEM_DIV IN ('0', '1', '2', '3', '4') \n"
|
|
// + " AND A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
// + " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
// + " AND A.ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n" // Add, 2017.04.10
|
|
// + " AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
// + " AND C.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
// + " AND C.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n"
|
|
// + " AND C.KTCH_SYS_CD <> '99' \n"
|
|
// + " ORDER BY C.SUB_STOR_CD, C.KTCH_SYS_CD \n"
|
|
// ;
|
|
//}
|
|
#endregion
|
|
|
|
|
|
#region 해피스테이션 로직
|
|
|
|
sQuery = "SELECT DISTINCT \n"
|
|
+ " A.TRAIN_MODE_YN, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.TRADE_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, A.SUB_MEMO_DIV, A.RESEND_YN \n"
|
|
+ " , A.MSG1, A.MSG2, A.MSG3, A.FILLER2 AS ETC_ORD_FLAG, A.FILLER3 AS ADD_ORD_FLAG \n"
|
|
+ " , C.POS_NO \n" // Add, 2017.06.12, POS별 주방프린터 설정
|
|
+ " , C.SUB_STOR_CD, C.KTCH_SYS_CD \n"
|
|
+ " , C.KTCH_SYS_USE_DIV, C.KTCH_PRINTER_COMM_PORT, C.KTCH_PRINTER_COMM_SPEED, C.KTCH_PRINTER_OPOS_NM, C.KTCH_PRINTER_IP, C.KTCH_PRINTER_PORT \n"
|
|
+ " , C.FILLER1, C.FILLER3, C.FILLER4, C.FILLER5, ISNULL(C.PRT_CNT, 1) AS PRT_CNT \n"
|
|
+ " , A.KTCH_MSG \n" // Add, 2017.03.21
|
|
+ " , A.ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
+ " , A.ORG_QTY \n" // Add, 2017.03.31
|
|
+ " , A.ORD_POS_NO \n" // Add, 2017.04.10
|
|
+ " , A.FILLER5 AS ORDER_SEQ \n" // Add, 2017.04.11
|
|
+ " FROM POSMST..MST_KTCH_ORD_MSG A \n"
|
|
+ " , POSMST..MST_KTCH_DEVICE_ITEM B WITH(NOLOCK) \n"
|
|
+ " , POSMST..MST_KTCH_DEVICE C WITH(NOLOCK) \n"
|
|
+ " WHERE A.CMP_CD = B.CMP_CD AND A.STOR_CD = B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.ITEM_CD = B.ITEM_CD \n"
|
|
+ " AND (A.FLOOR_CD = B.FLOOR_CD OR '999' = B.FLOOR_CD) \n"
|
|
|
|
+ " AND B.CMP_CD = C.CMP_CD AND B.STOR_CD = C.STOR_CD AND B.SUB_STOR_CD = C.SUB_STOR_CD \n"
|
|
|
|
+ " AND CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE B.SUB_STOR_CD + B.KTCH_SYS_CD END \n"
|
|
+ " = CASE WHEN B.KTCH_SYS_CD = '99' THEN '1' ELSE C.SUB_STOR_CD + C.KTCH_SYS_CD END \n"
|
|
+ " AND A.TRAIN_MODE_YN IN ('0', '1') " // Add, 2017.03.03, 연습모드
|
|
+ " AND A.ORD_DIV = '0' \n"
|
|
+ " AND A.SEND_YN = '0' \n"
|
|
+ " AND A.ITEM_DIV IN ('0', '1', '2', '3', '4') \n"
|
|
+ " AND A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
|
|
+ " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
|
|
+ " AND A.ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n" // Add, 2017.04.10
|
|
+ " AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
+ " AND C.USE_YN = '" + PosConst.MST_USE_YN.YES + "' \n"
|
|
+ " AND C.KTCH_SYS_DIV = '" + PosConst.KTCH_SYS_DIV.KPS + "' \n"
|
|
+ " AND C.KTCH_SYS_CD <> '99' \n"
|
|
+ " ORDER BY C.SUB_STOR_CD, C.KTCH_SYS_CD \n"
|
|
;
|
|
#endregion
|
|
|
|
// 조회
|
|
DataTable dtData = null;
|
|
if (sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (SqlParameter[])null, out dtData) != UserCom.OK)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if(dtData == null || dtData.Rows.Count == 0)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
DataRow[] arRows = null;
|
|
arRows = dtData.Select("POS_NO = '" + m_cPosStatus.Base.PosNo + "'");
|
|
if (arRows.Length == 0)
|
|
arRows = dtData.Select("POS_NO = '00'");
|
|
|
|
|
|
//foreach (DataRow dr in dtData.Rows)
|
|
foreach (DataRow dr in arRows)
|
|
{
|
|
KPSItem cKPSItem = new KPSItem();
|
|
|
|
cKPSItem.sTrainMode = CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN"); // Add, 2017.03.03, 연습모드
|
|
|
|
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");
|
|
cKPSItem.sKtchSysCd = CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD");
|
|
|
|
cKPSItem.nSeq = CmUtil.GetDataRowInt(dr, "SEQ");
|
|
cKPSItem.sOrderNo = CmUtil.GetDataRowStr(dr, "TRADE_NO");
|
|
|
|
if (string.IsNullOrWhiteSpace(CmUtil.GetDataRowStr(dr, "ORDER_SEQ")) == false) // Add, 2017.04.11, 후불테이블 일때 주문번호-주문차수 처리
|
|
{
|
|
cKPSItem.sOrderNo = CmUtil.GetDataRowStr(dr, "TRADE_NO") + "-" + CmUtil.GetDataRowStr(dr, "ORDER_SEQ");
|
|
}
|
|
|
|
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");
|
|
|
|
// Mod, 2017.03.31
|
|
//cKPSItem.nQty = CmUtil.GetDataRowInt(dr, "SALE_QTY");
|
|
cKPSItem.nQty = CmUtil.GetDataRowInt(dr, "SALE_QTY") - CmUtil.GetDataRowInt(dr, "ORG_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.sResendYn = CmUtil.GetDataRowStr(dr, "RESEND_YN");
|
|
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.sFiller1 = CmUtil.GetDataRowStr(dr, "PRT_CNT"); // Add, 2017.01.10, 출력횟수
|
|
cKPSItem.sFiller2 = CmUtil.GetDataRowStr(dr, "ETC_ORD_FLAG"); // Add, 2017.01.26, 기타주문구분 1:후불일반판매, 2:해피오더
|
|
cKPSItem.sFiller3 = CmUtil.GetDataRowStr(dr, "ADD_ORD_FLAG"); // Add, 2017.02.09, 추가주문구분 (NEW,ADD,DEL)
|
|
cKPSItem.sFiller4 = CmUtil.GetDataRowStr(dr, "FILLER4");
|
|
cKPSItem.sFiller5 = CmUtil.GetDataRowStr(dr, "FILLER5");
|
|
|
|
|
|
// 부가메뉴구분이 속성이면, 수량=0으로변경, 주문서에 수량을 출력 하지 않는다. // Add, 2017.02.09
|
|
// 부가메뉴구분(1:속성,2:업차지,3:선택메뉴)
|
|
//if (CmUtil.GetDataRowStr(dr, "SUB_MEMO_DIV") == "1") cKPSItem.nQty = 0; // Mod, 2017.04.13, 속성도 수량출력 :: 커피웍스
|
|
|
|
#region Mod, 2017.04.25, 주방메모 출력
|
|
// Add, 2017.01.23
|
|
// 주방프린터 수동출력(상품선택) 옵션처리
|
|
//cKPSItem.sKtchMemo = string.Empty;
|
|
//if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "2")
|
|
//{
|
|
// cKPSItem.sKtchMemo = CmUtil.GetDataRowStr(dr, "KTCH_MSG"); // Mod, 2017.03.21
|
|
//}
|
|
#endregion
|
|
|
|
|
|
cKPSItem.sKtchMemo = CmUtil.GetDataRowStr(dr, "KTCH_MSG").Trim();
|
|
|
|
cKPSItem.sItemMemo = (CmUtil.GetDataRowStr(dr, "MSG1") + " "
|
|
+ CmUtil.GetDataRowStr(dr, "MSG2") + " "
|
|
+ CmUtil.GetDataRowStr(dr, "MSG3")).Trim(); // Add, 2017.03.21
|
|
cKPSItem.sOrdPicNm = CmUtil.GetDataRowStr(dr, "ORD_PIC_NM").Trim(); // Add, 2017.03.28, 주문담당자
|
|
cKPSItem.sOrdPosNo = CmUtil.GetDataRowStr(dr, "ORD_POS_NO").Trim(); // Add, 2017.04.10
|
|
|
|
cKPSItem.sSendYn = "0";
|
|
cKPSItem.sErrorCd = "0000";
|
|
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
cKPSItem.sLblSendYn = "0";
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
|
|
htKPSSendingItem.Add(htKPSSendingItem.Count, cKPSItem);
|
|
}
|
|
|
|
// 주방인쇄상품 존재시
|
|
if (htKPSSendingItem.Count > 0)
|
|
{
|
|
sqlDb.DBBeginTransaction();
|
|
|
|
for (int nLoop = 0; nLoop < htKPSSendingItem.Count; nLoop++)
|
|
{
|
|
KPSItem cKPSItem = (KPSItem)htKPSSendingItem[nLoop];
|
|
|
|
#region (주석) 기존코드
|
|
//sQuery = " INSERT INTO POSMST..MST_KPS_ORD_MSG ";
|
|
//sQuery += " ( ORD_DIV, FLOOR_CD, TBL_NO, KTCH_SYS_CD, SEQ ";
|
|
//sQuery += " , ORDER_NO, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM ";
|
|
//sQuery += " , SALE_QTY, PACK_DIV, SET_MENU_CD, ORD_TIME, CANCEL_DIV ";
|
|
//sQuery += " , SEND_YN, RESEND_YN, KTCH_SYS_USE_DIV, KTCH_PRINTER_COMM_PORT, KTCH_PRINTER_COMM_SPEED ";
|
|
//sQuery += " , KTCH_PRINTER_OPOS_NM, KTCH_PRINTER_IP, KTCH_PRINTER_PORT, ERROR_CD, KTCH_PRINTER_BAK1 ";
|
|
//sQuery += " , KTCH_PRINTER_BAK2, KTCH_PRINTER_BAK3, KTCH_PRINTER_BAK4, KTCH_PRINTER_BAK5, KTCH_PRINTER_BAK6 ";
|
|
//sQuery += " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 ";
|
|
//sQuery += " , UPD_DT, REG_DT ) ";
|
|
//sQuery += " VALUES ";
|
|
//sQuery += " ( '" + cKPSItem.sOrderType +"' ";
|
|
//sQuery += " , '" + cKPSItem.sFloorCd + "' ";
|
|
//sQuery += " , '" + cKPSItem.sTableNo + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKtchSysCd + "' ";
|
|
//sQuery += " , " + cKPSItem.nSeq + " ";
|
|
//sQuery += " , '" + cKPSItem.sOrderNo + "' ";
|
|
//sQuery += " , '" + cKPSItem.sPosType + "' ";
|
|
//sQuery += " , '" + cKPSItem.sItemCd + "' ";
|
|
//sQuery += " , '" + cKPSItem.sItemDiv + "' ";
|
|
//sQuery += " , N'" + cKPSItem.sItemNm + "' ";
|
|
//sQuery += " , " + cKPSItem.nQty + " ";
|
|
//sQuery += " , '" + cKPSItem.sPackDiv + "' ";
|
|
//sQuery += " , '" + cKPSItem.sSetMenuCd + "' ";
|
|
//sQuery += " , '" + cKPSItem.sOrdTime + "' ";
|
|
//sQuery += " , '" + cKPSItem.sCancelDiv + "' ";
|
|
//sQuery += " , '0' ";
|
|
//sQuery += " , '" + cKPSItem.sResendYn + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKtchSysUseDiv + "' ";
|
|
//sQuery += " , " + cKPSItem.nKpsComPort + " ";
|
|
//sQuery += " , " + cKPSItem.nKpsComBaudrate + " ";
|
|
//sQuery += " , '" + cKPSItem.sKpsOposName + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKpsIp + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKpsPort + "' ";
|
|
//sQuery += " , '" + cKPSItem.sErrorCd + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKpsCdBackup1 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKpsCdBackup2 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKpsCdBackup3 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKpsCdBackup4 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKpsCdBackup5 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sKpsCdBackup6 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sFiller1 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sFiller2 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sFiller3 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sFiller4 + "' ";
|
|
//sQuery += " , '" + cKPSItem.sFiller5 + "' ";
|
|
//sQuery += " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' ";
|
|
//sQuery += " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' ) ";
|
|
|
|
//if(sqlDb.DBExecuteNonQuery(new string[] {sQuery}, CommandType.Text, (SqlParameter[])null) != UserCom.OK)
|
|
//{
|
|
// sQuery = " UPDATE POSMST..MST_KPS_ORD_MSG ";
|
|
// sQuery += " SET SEND_YN = '0' ";
|
|
// sQuery += " , RESEND_YN = '1' ";
|
|
// sQuery += " , PACK_DIV = '" + cKPSItem.sPackDiv + "' ";
|
|
// sQuery += " , CANCEL_DIV = '" + cKPSItem.sCancelDiv + "' ";
|
|
// sQuery += " , KTCH_PRINTER_BAK1 = '" + cKPSItem.sKpsCdBackup1 + "' ";
|
|
// sQuery += " , KTCH_PRINTER_BAK2 = '" + cKPSItem.sKpsCdBackup2 + "' ";
|
|
// sQuery += " , KTCH_PRINTER_BAK3 = '" + cKPSItem.sKpsCdBackup3 + "' ";
|
|
// sQuery += " , KTCH_PRINTER_BAK4 = '" + cKPSItem.sKpsCdBackup4 + "' ";
|
|
// sQuery += " , KTCH_PRINTER_BAK5 = '" + cKPSItem.sKpsCdBackup5 + "' ";
|
|
// sQuery += " , KTCH_PRINTER_BAK6 = '" + cKPSItem.sKpsCdBackup6 + "' ";
|
|
// sQuery += " , FILLER1 = '" + cKPSItem.sFiller1 + "' ";
|
|
// sQuery += " , FILLER2 = '" + cKPSItem.sFiller2 + "' ";
|
|
// sQuery += " , FILLER3 = '" + cKPSItem.sFiller3 + "' ";
|
|
// sQuery += " , FILLER4 = '" + cKPSItem.sFiller4 + "' ";
|
|
// sQuery += " , FILLER5 = '" + cKPSItem.sFiller5 + "' ";
|
|
// sQuery += " , UPD_DT = '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' ";
|
|
// sQuery += " WHERE ORD_DIV = '" + cKPSItem.sOrderType + "' ";
|
|
// sQuery += " AND FLOOR_CD = '" + cKPSItem.sFloorCd + "' ";
|
|
// sQuery += " AND TBL_NO = '" + cKPSItem.sTableNo + "' ";
|
|
// sQuery += " AND KTCH_SYS_CD = '" + cKPSItem.sKtchSysCd + "' ";
|
|
// sQuery += " AND SEQ = " + cKPSItem.nSeq + " ";
|
|
|
|
// if(sqlDb.DBExecuteNonQuery(new string[] {sQuery}, CommandType.Text, (SqlParameter[])null) != UserCom.OK)
|
|
// {
|
|
// // Rollback
|
|
// sqlDb.DBTransactionRollback();
|
|
|
|
// return;
|
|
// }
|
|
//}
|
|
|
|
//sQuery = " UPDATE POSMST..MST_KTCH_ORD_MSG ";
|
|
//sQuery += " SET SEND_YN = '1' ";
|
|
//sQuery += " WHERE ORD_DIV = '" + cKPSItem.sOrderType + "' ";
|
|
//sQuery += " AND FLOOR_CD = '" + cKPSItem.sFloorCd + "' ";
|
|
//sQuery += " AND TBL_NO = '" + cKPSItem.sTableNo + "' ";
|
|
//sQuery += " AND SEQ = " + cKPSItem.nSeq + " ";
|
|
|
|
//if (sqlDb.DBExecuteNonQuery(new string[] { sQuery }, CommandType.Text, (SqlParameter[])null) != UserCom.OK)
|
|
//{
|
|
// // Rollback
|
|
// sqlDb.DBTransactionRollback();
|
|
|
|
// return;
|
|
//}
|
|
#endregion
|
|
|
|
string[] sql = new string[2];
|
|
|
|
#region (삭제)
|
|
//sql[0] = "UPDATE POSMST..MST_KPS_ORD_MSG \n"
|
|
// + " SET SEND_YN = '0' \n"
|
|
// + " , RESEND_YN = '0' \n"
|
|
// + " , PACK_DIV = '" + cKPSItem.sPackDiv + "' \n"
|
|
// + " , CANCEL_DIV = '" + cKPSItem.sCancelDiv + "' \n"
|
|
// + " , SALE_QTY = " + cKPSItem.nQty + "\n" // Add, 2017.03.29, 이런 !!!
|
|
// //+ " , KTCH_PRINTER_BAK1 = '" + cKPSItem.sKpsCdBackup1 + "' \n" // Del, 2017.02.09
|
|
// //+ " , KTCH_PRINTER_BAK2 = '" + cKPSItem.sKpsCdBackup2 + "' \n"
|
|
// //+ " , KTCH_PRINTER_BAK3 = '" + cKPSItem.sKpsCdBackup3 + "' \n"
|
|
// //+ " , KTCH_PRINTER_BAK4 = '" + cKPSItem.sKpsCdBackup4 + "' \n"
|
|
// //+ " , KTCH_PRINTER_BAK5 = '" + cKPSItem.sKpsCdBackup5 + "' \n"
|
|
// //+ " , KTCH_PRINTER_BAK6 = '" + cKPSItem.sKpsCdBackup6 + "' \n"
|
|
// + " , FILLER1 = '" + cKPSItem.sFiller1 + "' \n"
|
|
// + " , FILLER2 = '" + cKPSItem.sFiller2 + "' \n"
|
|
// + " , FILLER3 = '" + cKPSItem.sFiller3 + "' \n"
|
|
// + " , FILLER4 = '" + cKPSItem.sFiller4 + "' \n"
|
|
// + " , FILLER5 = '" + cKPSItem.sFiller5 + "' \n"
|
|
// //+ " , MSG = N'" + cKPSItem.sKtchMemo + "' \n"
|
|
// + " , MSG = N'" + ConvertDBStr(cKPSItem.sItemMemo) + "' \n" // Mod, 2017.03.21
|
|
// + " , KTCH_MSG = N'" + ConvertDBStr(cKPSItem.sKtchMemo) + "' \n" // Add, 2017.03.21
|
|
// + " , ORD_PIC_NM = N'" + ConvertDBStr(cKPSItem.sOrdPicNm) + "' \n" // Add, 2017.03.27, 주문담당자
|
|
// + " , UPD_DT = '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n"
|
|
// + " WHERE TRAIN_MODE_YN = '" + cKPSItem.sTrainMode + "' \n" // Add, 2017.03.03, 연습모드
|
|
// + " AND ORD_DIV = '" + cKPSItem.sOrderType + "' \n"
|
|
// + " AND FLOOR_CD = '" + cKPSItem.sFloorCd + "' \n"
|
|
// + " AND TBL_NO = '" + cKPSItem.sTableNo + "' \n"
|
|
// + " AND SUB_STOR_CD = '" + cKPSItem.sSubShopCd + "' \n" // Add, 2017.02.07
|
|
// + " AND KTCH_SYS_CD = '" + cKPSItem.sKtchSysCd + "' \n"
|
|
// + " AND SEQ = " + cKPSItem.nSeq + " \n"
|
|
// + "IF @@ROWCOUNT = 0 \n"
|
|
// + " INSERT INTO POSMST..MST_KPS_ORD_MSG ( \n"
|
|
// //+ " ORD_DIV, FLOOR_CD, TBL_NO, KTCH_SYS_CD, SEQ \n"
|
|
// //+ " ORD_DIV, FLOOR_CD, TBL_NO, SUB_STOR_CD, KTCH_SYS_CD, SEQ \n" // Add, 2017.02.07
|
|
// + " TRAIN_MODE_YN, ORD_DIV, FLOOR_CD, TBL_NO, SUB_STOR_CD, KTCH_SYS_CD, SEQ \n" // Add, 2017.03.03, 연습모드
|
|
// + " , 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, KTCH_PRINTER_BAK1 \n"
|
|
// //+ " , KTCH_PRINTER_BAK2, KTCH_PRINTER_BAK3, KTCH_PRINTER_BAK4, KTCH_PRINTER_BAK5, KTCH_PRINTER_BAK6 \n"
|
|
// + " , KTCH_PRINTER_OPOS_NM, KTCH_PRINTER_IP, KTCH_PRINTER_PORT, ERROR_CD \n"
|
|
|
|
// + " , FILLER1, FILLER2, FILLER3, FILLER4, FILLER5 \n"
|
|
// + " , MSG \n"
|
|
// + " , KTCH_MSG \n" // Add, 2017.03.21
|
|
// + " , ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
// + " , UPD_DT, REG_DT \n"
|
|
// + " ) VALUES ( \n"
|
|
// + " '" + cKPSItem.sTrainMode + "' \n" // Add, 2017.03.03, 연습모드
|
|
// + " , '" + cKPSItem.sOrderType + "' \n"
|
|
// + " , '" + cKPSItem.sFloorCd + "' \n"
|
|
// + " , '" + cKPSItem.sTableNo + "' \n"
|
|
|
|
// + " , '" + cKPSItem.sSubShopCd + "' \n" // Add, 2017.02.07
|
|
// + " , '" + cKPSItem.sKtchSysCd + "' \n"
|
|
|
|
// + " , " + cKPSItem.nSeq + " \n"
|
|
// + " , '" + cKPSItem.sOrderNo + "' \n"
|
|
// + " , '" + cKPSItem.sPosType + "' \n"
|
|
// + " , '" + cKPSItem.sItemCd + "' \n"
|
|
// + " , '" + cKPSItem.sItemDiv + "' \n"
|
|
// + " , N'" + cKPSItem.sItemNm + "' \n"
|
|
// + " , " + cKPSItem.nQty + " \n"
|
|
// + " , '" + cKPSItem.sPackDiv + "' \n"
|
|
// + " , '" + cKPSItem.sSetMenuCd + "' \n"
|
|
// + " , '" + cKPSItem.sOrdTime + "' \n"
|
|
// + " , '" + cKPSItem.sCancelDiv + "' \n"
|
|
|
|
// + " , '" + cKPSItem.sSendYn + "' \n"
|
|
|
|
// + " , '" + cKPSItem.sResendYn + "' \n"
|
|
// + " , '" + cKPSItem.sKtchSysUseDiv + "' \n"
|
|
// + " , " + cKPSItem.nKpsComPort + " \n"
|
|
// + " , " + cKPSItem.nKpsComBaudrate + " \n"
|
|
// + " , '" + cKPSItem.sKpsOposName + "' \n"
|
|
// + " , '" + cKPSItem.sKpsIp + "' \n"
|
|
// + " , '" + cKPSItem.sKpsPort + "' \n"
|
|
// + " , '" + cKPSItem.sErrorCd + "' \n"
|
|
// + " , '" + cKPSItem.sFiller1 + "' \n"
|
|
// + " , '" + cKPSItem.sFiller2 + "' \n"
|
|
// + " , '" + cKPSItem.sFiller3 + "' \n"
|
|
// + " , '" + cKPSItem.sFiller4 + "' \n"
|
|
// + " , '" + cKPSItem.sFiller5 + "' \n"
|
|
// + " , N'" + ConvertDBStr(cKPSItem.sItemMemo) + "' \n" // Add, 2017.03.21
|
|
// + " , N'" + ConvertDBStr(cKPSItem.sKtchMemo) + "' \n"
|
|
// + " , N'" + ConvertDBStr(cKPSItem.sOrdPicNm) + "' \n" // Add, 2017.03.28, 주문담당자
|
|
// + " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n"
|
|
// + " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' ) "
|
|
// ;
|
|
#endregion
|
|
|
|
#region ### POSMST..MST_KPS_ORD_MSG
|
|
|
|
sql[0] = " INSERT INTO POSMST..MST_KPS_ORD_MSG ( \n"
|
|
+ " TRAIN_MODE_YN, ORD_DIV, FLOOR_CD, TBL_NO, SUB_STOR_CD, KTCH_SYS_CD, SEQ \n" // Add, 2017.03.03, 연습모드
|
|
+ " , 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 \n"
|
|
+ " , MSG \n"
|
|
+ " , KTCH_MSG \n" // Add, 2017.03.21
|
|
+ " , ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
+ " , ORD_POS_NO \n" // Add, 2017.04.10
|
|
+ " , UPD_DT, REG_DT \n"
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
+ " , LBLSEND_YN \n"
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
+ " ) SELECT \n"
|
|
+ " '" + cKPSItem.sTrainMode + "' \n" // Add, 2017.03.03, 연습모드
|
|
+ " , '" + cKPSItem.sOrderType + "' \n"
|
|
+ " , '" + cKPSItem.sFloorCd + "' \n"
|
|
+ " , '" + cKPSItem.sTableNo + "' \n"
|
|
+ " , '" + cKPSItem.sSubShopCd + "' \n" // Add, 2017.02.07
|
|
+ " , '" + cKPSItem.sKtchSysCd + "' \n"
|
|
//+ " , " + cKPSItem.nSeq + " \n"
|
|
+ " , (SELECT ISNULL(MAX(SEQ), 0) + 1 FROM POSMST..MST_KPS_ORD_MSG \n"
|
|
+ " WHERE TRAIN_MODE_YN = '" + cKPSItem.sTrainMode + "' \n"
|
|
+ " AND ORD_DIV = '" + cKPSItem.sOrderType + "' \n"
|
|
+ " AND FLOOR_CD = '" + cKPSItem.sFloorCd + "' \n"
|
|
+ " AND TBL_NO = '" + cKPSItem.sTableNo + "' \n"
|
|
+ " AND SUB_STOR_CD = '" + cKPSItem.sSubShopCd + "' \n"
|
|
+ " AND KTCH_SYS_CD = '" + cKPSItem.sKtchSysCd + "') \n"
|
|
+ " , '" + cKPSItem.sOrderNo + "' \n"
|
|
+ " , '" + cKPSItem.sPosType + "' \n"
|
|
+ " , '" + cKPSItem.sItemCd + "' \n"
|
|
+ " , '" + cKPSItem.sItemDiv + "' \n"
|
|
+ " , N'" + cKPSItem.sItemNm + "' \n"
|
|
+ " , " + cKPSItem.nQty + " \n"
|
|
+ " , '" + cKPSItem.sPackDiv + "' \n"
|
|
+ " , '" + cKPSItem.sSetMenuCd + "' \n"
|
|
+ " , '" + cKPSItem.sOrdTime + "' \n"
|
|
+ " , '" + cKPSItem.sCancelDiv + "' \n"
|
|
+ " , '" + cKPSItem.sSendYn + "' \n"
|
|
+ " , '" + cKPSItem.sResendYn + "' \n"
|
|
+ " , '" + cKPSItem.sKtchSysUseDiv + "' \n"
|
|
+ " , " + cKPSItem.nKpsComPort + " \n"
|
|
+ " , " + cKPSItem.nKpsComBaudrate + " \n"
|
|
+ " , '" + cKPSItem.sKpsOposName + "' \n"
|
|
+ " , '" + cKPSItem.sKpsIp + "' \n"
|
|
+ " , '" + cKPSItem.sKpsPort + "' \n"
|
|
+ " , '" + cKPSItem.sErrorCd + "' \n"
|
|
+ " , '" + cKPSItem.sFiller1 + "' \n"
|
|
+ " , '" + cKPSItem.sFiller2 + "' \n"
|
|
+ " , '" + cKPSItem.sFiller3 + "' \n"
|
|
+ " , '" + cKPSItem.sFiller4 + "' \n"
|
|
+ " , '" + cKPSItem.sFiller5 + "' \n"
|
|
+ " , N'" + ConvertDBStr(cKPSItem.sItemMemo) + "' \n" // Add, 2017.03.21
|
|
+ " , N'" + ConvertDBStr(cKPSItem.sKtchMemo) + "' \n"
|
|
+ " , N'" + ConvertDBStr(cKPSItem.sOrdPicNm) + "' \n" // Add, 2017.03.28, 주문담당자
|
|
+ " , '" + cKPSItem.sOrdPosNo + "' \n" // Add, 2017.04.10
|
|
+ " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n"
|
|
+ " , '" + DateTime.Now.ToString("yyyyMMddHHmmss") + "' \n"
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
+ " , '" + cKPSItem.sLblSendYn + "' \n"
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
;
|
|
#endregion
|
|
|
|
#region ### POSMST..MST_KTCH_ORD_MSG
|
|
sql[1] = "UPDATE POSMST..MST_KTCH_ORD_MSG \n"
|
|
+ " SET SEND_YN = '1' \n"
|
|
+ " WHERE TRAIN_MODE_YN = '" + cKPSItem.sTrainMode + "' \n"
|
|
+ " AND ORD_DIV = '" + cKPSItem.sOrderType + "' \n"
|
|
+ " AND FLOOR_CD = '" + cKPSItem.sFloorCd + "' \n"
|
|
+ " AND TBL_NO = '" + cKPSItem.sTableNo + "' \n"
|
|
+ " AND SEQ = " + cKPSItem.nSeq + " \n"
|
|
;
|
|
#endregion
|
|
|
|
if (sqlDb.DBExecuteNonQuery(sql, CommandType.Text, (SqlParameter[])null) != UserCom.OK)
|
|
{
|
|
// Rollback
|
|
sqlDb.DBTransactionRollback();
|
|
return false;
|
|
}
|
|
}
|
|
// Commit
|
|
sqlDb.DBTransactionCommit();
|
|
}
|
|
|
|
bRet = true;
|
|
}
|
|
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 bRet;
|
|
}
|
|
|
|
private void GetKPSSendItem(ref Hashtable htKPSSendingItem)
|
|
{
|
|
string sQuery = string.Empty;
|
|
|
|
DataTable dtData = null;
|
|
|
|
try
|
|
{
|
|
#region (주석) 복합매장 적용 이전
|
|
//sQuery = " SELECT ORD_DIV, FLOOR_CD, TBL_NO, KTCH_SYS_CD, SEQ ";
|
|
//sQuery += " , ORDER_NO, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM ";
|
|
//sQuery += " , SALE_QTY, PACK_DIV, SET_MENU_CD, ORD_TIME, CANCEL_DIV ";
|
|
//sQuery += " , SEND_YN, RESEND_YN, KTCH_SYS_USE_DIV, KTCH_PRINTER_COMM_PORT, KTCH_PRINTER_COMM_SPEED ";
|
|
//sQuery += " , KTCH_PRINTER_OPOS_NM, KTCH_PRINTER_IP, KTCH_PRINTER_PORT, ERROR_CD, KTCH_PRINTER_BAK1, KTCH_PRINTER_BAK2 ";
|
|
//sQuery += " , KTCH_PRINTER_BAK3, KTCH_PRINTER_BAK4, KTCH_PRINTER_BAK5, KTCH_PRINTER_BAK6, FILLER1 ";
|
|
//sQuery += " , FILLER2, FILLER3, FILLER4, FILLER5 ";
|
|
//sQuery += " , MSG ";
|
|
//sQuery += " FROM POSMST..MST_KPS_ORD_MSG ";
|
|
//sQuery += " WHERE SEND_YN = '0' ";
|
|
//sQuery += " ORDER BY KTCH_SYS_CD, ORD_DIV, FLOOR_CD, TBL_NO, CANCEL_DIV, SEQ ";
|
|
#endregion
|
|
|
|
#region (주석) 연습모드 적용 이전, 2017.03.03
|
|
//sQuery = "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 = '0' \n"
|
|
// + " ORDER BY SUB_STOR_CD, KTCH_SYS_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ \n"
|
|
// ;
|
|
#endregion
|
|
|
|
#region (주석)
|
|
// Mod, 2017.03.03, 연습모드
|
|
//sQuery = "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, KTCH_MSG \n"
|
|
// + " , ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
// + " FROM POSMST..MST_KPS_ORD_MSG \n"
|
|
// + " WHERE SEND_YN = '0' \n"
|
|
// + " ORDER BY TRAIN_MODE_YN, SUB_STOR_CD, KTCH_SYS_CD, ORD_DIV, FLOOR_CD, TBL_NO, SEQ \n"
|
|
// ;
|
|
#endregion
|
|
|
|
#region (주석) 이전코드 2017.09.06
|
|
/*
|
|
sQuery = "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"
|
|
+ " , B.POS_NO \n" // Add, 2017.06.13, POS별 주방프린터 설정
|
|
+ " , A.KTCH_MSG \n"
|
|
+ " , A.ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
+ " , B.KTCH_SYS_NM \n" // Add, 2017.04.07
|
|
+ " , A.ORD_POS_NO \n" // Add, 2017.04.10
|
|
+ " 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별 주방프린터 설정
|
|
+ " WHERE A.SEND_YN = '0' \n"
|
|
+ " AND A.ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n" // Add, 2017.04.10
|
|
+ " 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"
|
|
;
|
|
*/
|
|
#endregion
|
|
|
|
sQuery = "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"
|
|
+ " , B.POS_NO \n" // Add, 2017.06.13, POS별 주방프린터 설정
|
|
+ " , A.KTCH_MSG \n"
|
|
+ " , A.ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
|
|
+ " , B.KTCH_SYS_NM \n" // Add, 2017.04.07
|
|
+ " , 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 = '0' \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
|
|
|
|
if (sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (SqlParameter[])null, out dtData) != UserCom.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
string itemKey = string.Empty;
|
|
|
|
Hashtable htKPSSendingItemTemp = new Hashtable();
|
|
|
|
DataRow[] arRows = null;
|
|
arRows = dtData.Select("POS_NO = '" + m_cPosStatus.Base.PosNo + "'");
|
|
if (arRows.Length == 0)
|
|
arRows = dtData.Select("POS_NO = '00'");
|
|
|
|
//foreach (DataRow dr in dtData.Rows)
|
|
foreach (DataRow dr in arRows)
|
|
{
|
|
KPSItem cKPSItem = new KPSItem();
|
|
|
|
cKPSItem.sTrainMode = CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN"); // Add, 2017.03.03, 연습모드
|
|
|
|
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.sKtchSysNm = CmUtil.GetDataRowStr(dr, "KTCH_SYS_NM"); // Add, 2017.04.07
|
|
|
|
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.sResendYn = CmUtil.GetDataRowStr(dr, "RESEND_YN");
|
|
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.sItemMemo = CmUtil.GetDataRowStr(dr, "MSG"); // Mod, 2017.03.21
|
|
cKPSItem.sKtchMemo = CmUtil.GetDataRowStr(dr, "KTCH_MSG"); // Add, 2017.03.21
|
|
cKPSItem.sOrdPicNm = CmUtil.GetDataRowStr(dr, "ORD_PIC_NM"); // Add, 2017.03.27, 주문담당자
|
|
cKPSItem.sOrdPosNo = CmUtil.GetDataRowStr(dr, "ORD_POS_NO"); // Add, 2017.04.10
|
|
//2017.09.06 레시피 추가.
|
|
cKPSItem.sRecipe = CmUtil.GetDataRowStr(dr, "ITEM_INFO"); // Add, 2017.09.06
|
|
|
|
cKPSItem.sSendYn = "0";
|
|
|
|
// Mod, 2017.03.03, 연습모드
|
|
//string checkKey = cKPSItem.sSubShopCd + cKPSItem.sKtchSysCd + cKPSItem.sFloorCd + cKPSItem.sTableNo;
|
|
string checkKey = cKPSItem.sTrainMode + cKPSItem.sSubShopCd + cKPSItem.sKtchSysCd + cKPSItem.sFloorCd + cKPSItem.sTableNo;
|
|
if (itemKey != checkKey)
|
|
{
|
|
if (htKPSSendingItemTemp.Count != 0)
|
|
{
|
|
htKPSSendingItem.Add(htKPSSendingItem.Count, htKPSSendingItemTemp);
|
|
}
|
|
itemKey = checkKey;
|
|
|
|
htKPSSendingItemTemp = new Hashtable();
|
|
}
|
|
|
|
htKPSSendingItemTemp.Add(htKPSSendingItemTemp.Count, cKPSItem);
|
|
}
|
|
|
|
if (htKPSSendingItemTemp.Count != 0)
|
|
{
|
|
htKPSSendingItem.Add(htKPSSendingItem.Count, htKPSSendingItemTemp);
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 주방 주문서 출력
|
|
/// </summary>
|
|
/// <param name="htKPSSendingItem"></param>
|
|
/// <param name="htKtchDeviceStatus"></param>
|
|
/// <param name="ktchErrorCode"></param>
|
|
private void KPSPrintProc(ref Hashtable htKPSSendingItem, ref Hashtable htKtchDeviceStatus ,ref string ktchErrorCode)
|
|
{
|
|
try
|
|
{
|
|
var nReturn = 0;
|
|
var nPrintOkIndex = 0;
|
|
var bKtchDeviceStatusSerchFlag = false;
|
|
|
|
//string sCancelFlag = string.Empty;
|
|
//string sResendFlag = string.Empty;
|
|
|
|
for (int nLoop = 0; nLoop < htKPSSendingItem.Count; nLoop++)
|
|
{
|
|
Hashtable htKPSSendingItemTemp = (Hashtable)htKPSSendingItem[nLoop];
|
|
|
|
if (htKPSSendingItemTemp.Count == 0)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
KPSItem cKPSItem = (KPSItem)htKPSSendingItemTemp[0];
|
|
var sTrainMode = cKPSItem.sTrainMode; // Add, 2017.03.03, 연습모드
|
|
var sSubShopCd = cKPSItem.sSubShopCd;
|
|
var sKtchSysCd = cKPSItem.sKtchSysCd;
|
|
var sKtchUseDiv = cKPSItem.sKtchSysUseDiv;
|
|
var nKpsComPort = cKPSItem.nKpsComPort;
|
|
var nKpsComBaudrate = cKPSItem.nKpsComBaudrate;
|
|
var sKpsIp = cKPSItem.sKpsIp;
|
|
var sKpsPort = cKPSItem.sKpsPort;
|
|
var sResendFlag = "0";
|
|
|
|
// Add, 2017.02.14, 주방프린트와 영수증프린트(시리얼)가 동일장비 인경우
|
|
if (m_cDevStatus.Printer.UseYn == true)
|
|
{
|
|
bool isEquals = true;
|
|
|
|
if (m_cPosStatus.Base.OlePosPrinterController != PosConst.POS_DEVICE_CONTROLLER.RS232) isEquals = false;
|
|
if (cKPSItem.sKtchSysUseDiv != PosConst.KTCH_SYS_USE_DIV.RS232) isEquals = false;
|
|
if (m_cPosStatus.Base.OlePosPrinterSerialPortNumber.ToUpper().Trim() != "COM" + cKPSItem.nKpsComPort.ToString()) isEquals = false;
|
|
|
|
if (isEquals)
|
|
{
|
|
for (var i = 0; i < htKPSSendingItemTemp.Count; i ++)
|
|
{
|
|
((KPSItem)htKPSSendingItemTemp[i]).sSendYn = "7";
|
|
}
|
|
if (string.IsNullOrWhiteSpace(ktchErrorCode)) ktchErrorCode = "XXXX";
|
|
|
|
continue;
|
|
}
|
|
}
|
|
|
|
// 지정취소
|
|
var sCancelFlag = cKPSItem.sCancelDiv;
|
|
|
|
// Add, 2017.02.10, 반복출력횟수
|
|
var prtCnt = CmUtil.IntParse(cKPSItem.sFiller1);
|
|
if (prtCnt == 0) prtCnt = 1;
|
|
|
|
nPrintOkIndex = -1;
|
|
if (sKtchUseDiv == PosConst.KTCH_SYS_USE_DIV.RS232) // Serial
|
|
{
|
|
nReturn = KPSSerialPrintProc(sCancelFlag, sResendFlag, nKpsComPort, nKpsComBaudrate, prtCnt, ref nPrintOkIndex, ref htKPSSendingItemTemp);
|
|
}
|
|
else if (sKtchUseDiv == PosConst.KTCH_SYS_USE_DIV.SOCK) // LAN
|
|
{
|
|
nReturn = KPSLanPrintProc(sCancelFlag, sResendFlag, sKpsIp, sKpsPort, prtCnt, ref nPrintOkIndex, ref htKPSSendingItemTemp);
|
|
}
|
|
|
|
bKtchDeviceStatusSerchFlag = false;
|
|
for (int i = 0; i < htKtchDeviceStatus.Count; i++)
|
|
{
|
|
KTCH_SYS_STATUS cKtchSysStatus = (KTCH_SYS_STATUS)htKtchDeviceStatus[i];
|
|
|
|
//if(cKtchSysStatus.sKtchSysCd == sKtchSysCd)
|
|
if (cKtchSysStatus.sSubShopCd == sSubShopCd || cKtchSysStatus.sKtchSysCd == sKtchSysCd)
|
|
{
|
|
cKtchSysStatus.nErrorCd = nReturn;
|
|
htKtchDeviceStatus[i] = cKtchSysStatus;
|
|
bKtchDeviceStatusSerchFlag = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (bKtchDeviceStatusSerchFlag == false)
|
|
{
|
|
KTCH_SYS_STATUS cKtchSysStatus = new KTCH_SYS_STATUS();
|
|
cKtchSysStatus.sSubShopCd = sSubShopCd;
|
|
cKtchSysStatus.sKtchSysCd = sKtchSysCd;
|
|
cKtchSysStatus.nErrorCd = nReturn;
|
|
htKtchDeviceStatus.Add(htKtchDeviceStatus.Count, cKtchSysStatus);
|
|
}
|
|
|
|
if (nReturn != 0 && nPrintOkIndex >= 0)
|
|
{
|
|
for (int i = 0; i <= nPrintOkIndex; i++)
|
|
{
|
|
if (htKPSSendingItemTemp.Contains(i) == true)
|
|
{
|
|
KPSItem cKPSTemp = (KPSItem)htKPSSendingItemTemp[i];
|
|
cKPSTemp.sSendYn = "1";
|
|
cKPSTemp.sErrorCd = "0000";
|
|
htKPSSendingItemTemp[i] = cKPSTemp;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (nReturn == 0) // 정상
|
|
{
|
|
for (int i = 0; i < htKPSSendingItemTemp.Count; i++)
|
|
{
|
|
if (htKPSSendingItemTemp.Contains(i) == true)
|
|
{
|
|
KPSItem cKPSTemp = (KPSItem)htKPSSendingItemTemp[i];
|
|
cKPSTemp.sSendYn = "1";
|
|
cKPSTemp.sErrorCd = "0000";
|
|
htKPSSendingItemTemp[i] = cKPSTemp;
|
|
}
|
|
}
|
|
}
|
|
else // 에러
|
|
{
|
|
for (int i = nPrintOkIndex + 1; i < htKPSSendingItemTemp.Count; i++)
|
|
{
|
|
KPSItem cKPSTemp = (KPSItem)htKPSSendingItemTemp[i];
|
|
|
|
// Mod, 2017.02.14
|
|
//cKPSTemp.sSendYn = "0";
|
|
cKPSTemp.sSendYn = (cKPSTemp.sSendYn == "0") ? "8" : cKPSTemp.sSendYn;
|
|
|
|
if (string.IsNullOrWhiteSpace(cKPSTemp.sErrorCd) || cKPSTemp.sErrorCd == "0000")
|
|
{
|
|
switch (nReturn)
|
|
{
|
|
case -1: cKPSTemp.sErrorCd = "0001"; break; // Print Open Error
|
|
case -2: cKPSTemp.sErrorCd = "0002"; break; // Print Claim Error
|
|
case -3: cKPSTemp.sErrorCd = "0003"; break; // Print Power Off Error
|
|
case -4: cKPSTemp.sErrorCd = "0004"; break; // Cover Open Error
|
|
case -5: cKPSTemp.sErrorCd = "0005"; break; // No Paper Error
|
|
default: cKPSTemp.sErrorCd = "9999"; break; // Etc Error
|
|
}
|
|
}
|
|
|
|
// Add, 2017.02.15
|
|
//ktchErrorCode = cKPSTemp.sErrorCd;
|
|
ktchErrorCode = string.Format("{0}|{1}|{2}", cKPSTemp.sErrorCd, cKPSTemp.sKtchSysCd, cKPSTemp.sKtchSysNm);
|
|
|
|
htKPSSendingItemTemp[i] = cKPSTemp;
|
|
}
|
|
}
|
|
|
|
htKPSSendingItem[nLoop] = htKPSSendingItemTemp;
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 주방 메시지 출력
|
|
/// </summary>
|
|
/// <param name="htKPSSendingItem"></param>
|
|
/// <param name="htKtchDeviceStatus"></param>
|
|
/// <param name="ktchErrorCode"></param>
|
|
private void KPSOrderMessagePrintProc(ref Hashtable htKPSSendingItem, ref Hashtable htKtchDeviceStatus, ref string ktchErrorCode)
|
|
{
|
|
try
|
|
{
|
|
var nPrintOkIndex = 0;
|
|
var nReturn = 0;
|
|
|
|
var bKtchDeviceStatusSearchFlag = false;
|
|
htKtchDeviceStatus = new Hashtable();
|
|
|
|
for (int nLoop = 0; nLoop < htKPSSendingItem.Count; nLoop++)
|
|
{
|
|
Hashtable htKPSSendingITemp = (Hashtable)htKPSSendingItem[nLoop];
|
|
if (htKPSSendingITemp.Count == 0) continue;
|
|
|
|
KPSOrderMessage cKPSOrderMessage = (KPSOrderMessage)htKPSSendingITemp[0];
|
|
|
|
var sSubShopCd = cKPSOrderMessage.sSubShopCd; // Add, 2017.02.07
|
|
var sKtchSysCd = cKPSOrderMessage.sKtchSysCd;
|
|
var sKtchSysUseDiv = cKPSOrderMessage.sKtchSysUseDiv;
|
|
var sKpsIp = cKPSOrderMessage.sKpsIp;
|
|
var sKpsPort = cKPSOrderMessage.sKpsPort;
|
|
var nKpsComPort = cKPSOrderMessage.nKpsComPort;
|
|
var nKpsComBaudrate = cKPSOrderMessage.nKpsComBaudrate;
|
|
var sResendFlag = "0";
|
|
|
|
// Add, 2017.02.14, 주방프린트와 영수증프린트(시리얼)가 동일장비 인경우
|
|
if (m_cDevStatus.Printer.UseYn == true)
|
|
{
|
|
bool isEquals = true;
|
|
|
|
if (m_cPosStatus.Base.OlePosPrinterController != PosConst.POS_DEVICE_CONTROLLER.RS232) isEquals = false;
|
|
if (cKPSOrderMessage.sKtchSysUseDiv != PosConst.KTCH_SYS_USE_DIV.RS232) isEquals = false;
|
|
if (m_cPosStatus.Base.OlePosPrinterSerialPortNumber.ToUpper().Trim() != "COM" + cKPSOrderMessage.nKpsComPort.ToString()) isEquals = false;
|
|
|
|
if (isEquals)
|
|
{
|
|
for (var i = 0; i < htKPSSendingITemp.Count; i++)
|
|
{
|
|
((KPSOrderMessage)htKPSSendingITemp[i]).sSendYn = "7";
|
|
}
|
|
if (string.IsNullOrWhiteSpace(ktchErrorCode)) ktchErrorCode = "XXXX";
|
|
|
|
continue;
|
|
}
|
|
}
|
|
|
|
nPrintOkIndex = -1;
|
|
|
|
if (sKtchSysUseDiv == PosConst.KTCH_SYS_USE_DIV.RS232) // Serial
|
|
{
|
|
nReturn = KPSOrderMessageSerialPrintProc(sResendFlag, nKpsComPort, nKpsComBaudrate, cKPSOrderMessage.printCount, ref nPrintOkIndex, ref htKPSSendingITemp);
|
|
}
|
|
else if (sKtchSysUseDiv == PosConst.KTCH_SYS_USE_DIV.SOCK) // LAN
|
|
{
|
|
nReturn = KPSOrderMessageLanPrintProc(sResendFlag, sKpsIp, sKpsPort, cKPSOrderMessage.printCount, ref nPrintOkIndex, ref htKPSSendingITemp);
|
|
}
|
|
|
|
bKtchDeviceStatusSearchFlag = false;
|
|
for (int i = 0; i < htKtchDeviceStatus.Count; i++)
|
|
{
|
|
KTCH_SYS_STATUS cKtchSysStatus = (KTCH_SYS_STATUS)htKtchDeviceStatus[i];
|
|
|
|
//if (cKtchSysStatus.sKtchSysCd == sKtchSysCd)
|
|
if (cKtchSysStatus.sSubShopCd != sSubShopCd || cKtchSysStatus.sKtchSysCd != sKtchSysCd) // Add, 2017.02.07
|
|
{
|
|
cKtchSysStatus.nErrorCd = nReturn;
|
|
htKtchDeviceStatus[i] = cKtchSysStatus;
|
|
bKtchDeviceStatusSearchFlag = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (bKtchDeviceStatusSearchFlag == false)
|
|
{
|
|
KTCH_SYS_STATUS cKtchSysStatus = new KTCH_SYS_STATUS();
|
|
cKtchSysStatus.sSubShopCd = sSubShopCd;
|
|
cKtchSysStatus.sKtchSysCd = sKtchSysCd;
|
|
cKtchSysStatus.nErrorCd = nReturn;
|
|
htKtchDeviceStatus.Add(htKtchDeviceStatus.Count, cKtchSysStatus);
|
|
}
|
|
|
|
if (nReturn != 0 && nPrintOkIndex >= 0)
|
|
{
|
|
for (var i = 0; i <= nPrintOkIndex; i++)
|
|
{
|
|
if (htKPSSendingITemp.Contains(i))
|
|
{
|
|
KPSOrderMessage cTemp = (KPSOrderMessage)htKPSSendingITemp[i];
|
|
cTemp.sSendYn = "1";
|
|
cTemp.sErrorCd = "0000";
|
|
htKPSSendingITemp[i] = cTemp;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (nReturn == 0) // 정상
|
|
{
|
|
for (var i = 0; i < htKPSSendingITemp.Count; i++)
|
|
{
|
|
if (htKPSSendingITemp.Contains(i))
|
|
{
|
|
KPSOrderMessage cTemp = (KPSOrderMessage)htKPSSendingITemp[i];
|
|
cTemp.sSendYn = "1";
|
|
cTemp.sErrorCd = "0000";
|
|
htKPSSendingITemp[i] = cTemp;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (var i = nPrintOkIndex + 1; i < htKPSSendingITemp.Count; i++)
|
|
{
|
|
KPSOrderMessage cTemp = (KPSOrderMessage)htKPSSendingITemp[i];
|
|
|
|
// Mod, 2017.02.14
|
|
//cTemp.sSendYn = "0";
|
|
cTemp.sSendYn = (cTemp.sSendYn == "0") ? "8" : cTemp.sSendYn;
|
|
|
|
if (string.IsNullOrWhiteSpace(cTemp.sErrorCd) || cTemp.sErrorCd == "0000")
|
|
{
|
|
switch (nReturn)
|
|
{
|
|
case -1: cTemp.sErrorCd = "0001"; break; // Print Open Error
|
|
case -2: cTemp.sErrorCd = "0002"; break; // Print Claim Error
|
|
case -3: cTemp.sErrorCd = "0003"; break; // Print Power Off Error
|
|
case -4: cTemp.sErrorCd = "0004"; break; // Cover Open Error
|
|
case -5: cTemp.sErrorCd = "0005"; break; // No Paper Error
|
|
default: cTemp.sErrorCd = "9999"; break; // Etc Error
|
|
}
|
|
}
|
|
|
|
// Add, 2017.02.15
|
|
//ktchErrorCode = cTemp.sErrorCd;
|
|
ktchErrorCode = string.Format("{0}|{1}|{2}", cTemp.sErrorCd, cTemp.sKtchSysCd, cTemp.sKtchSysNm);
|
|
|
|
htKPSSendingITemp[i] = cTemp;
|
|
}
|
|
}
|
|
htKPSSendingItem[nLoop] = htKPSSendingITemp;
|
|
|
|
if (nReturn != 0)
|
|
{
|
|
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 + "()",
|
|
string.Format("Print Error = [{0}][{1}]", cKPSOrderMessage.sKtchSysUseDiv, nReturn));
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// KPS Status Update
|
|
/// </summary>
|
|
/// <param name="htKPSSendingItem"></param>
|
|
/// <param name="htKtchDeviceStatus"></param>
|
|
private void KPSPrintStatusUpdate(Hashtable htKPSSendingItem, Hashtable htKtchDeviceStatus)
|
|
{
|
|
try
|
|
{
|
|
// KPS 인쇄 데이터 전송상태 갱신
|
|
for(int nLoop = 0;nLoop < htKPSSendingItem.Count;nLoop++)
|
|
{
|
|
Hashtable htKPSSendingItemTemp = (Hashtable)htKPSSendingItem[nLoop];
|
|
|
|
for(int nLoop2 = 0;nLoop2 < htKPSSendingItemTemp.Count;nLoop2++)
|
|
{
|
|
KPSItem cKPSItem = (KPSItem)htKPSSendingItemTemp[nLoop2];
|
|
|
|
string sQuery = "UPDATE POSMST..MST_KPS_ORD_MSG \n"
|
|
+ " SET SEND_YN = '" + cKPSItem.sSendYn + "' \n"
|
|
+ " , RESEND_YN = '" + cKPSItem.sResendYn + "' \n"
|
|
+ " , ERROR_CD = '" + cKPSItem.sErrorCd + "' \n"
|
|
+ " WHERE TRAIN_MODE_YN = '" + cKPSItem.sTrainMode + "' \n" // Add, 2017.03.03, 연습모드
|
|
+ " AND ORD_DIV = '" + cKPSItem.sOrderType + "' \n"
|
|
+ " AND FLOOR_CD = '" + cKPSItem.sFloorCd + "' \n"
|
|
+ " AND TBL_NO = '" + cKPSItem.sTableNo + "' \n"
|
|
+ " AND SUB_STOR_CD = '" + cKPSItem.sSubShopCd + "' \n" // Add, 2017.02.07
|
|
+ " AND KTCH_SYS_CD = '" + cKPSItem.sKtchSysCd + "' \n"
|
|
+ " AND SEQ = " + cKPSItem.nSeq.ToString() + "\n"
|
|
;
|
|
if (sqlDb.DBExecuteNonQuery(new string[] { sQuery }, CommandType.Text, (SqlParameter[])null, true) != UserCom.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 + "()",
|
|
"Query=" + sQuery);
|
|
}
|
|
}
|
|
}
|
|
|
|
for(int nLoop = 0;nLoop < htKtchDeviceStatus.Count;nLoop++)
|
|
{
|
|
KTCH_SYS_STATUS cKtchSysStatus = (KTCH_SYS_STATUS)htKtchDeviceStatus[nLoop];
|
|
|
|
string sErrorCd = "0000";
|
|
if(cKtchSysStatus.nErrorCd != 0)
|
|
{
|
|
switch(cKtchSysStatus.nErrorCd)
|
|
{
|
|
case -1: sErrorCd = "0001"; break; // Print Open Error
|
|
case -2: sErrorCd = "0002"; break; // Print Claim Error
|
|
case -3: sErrorCd = "0003"; break; // Print Power Off Error
|
|
case -4: sErrorCd = "0004"; break; // Cover Open Error
|
|
case -5: sErrorCd = "0005"; break; // No Paper Error
|
|
default: sErrorCd = "9999"; break; // Etc Error
|
|
}
|
|
}
|
|
string sQuery = "UPDATE POSMST..MST_KTCH_DEVICE \n"
|
|
+ " SET FILLER1 = '" + sErrorCd + "' \n"
|
|
+ " WHERE KTCH_SYS_CD = '" + cKtchSysStatus.sKtchSysCd + "' \n"
|
|
+ " AND SUB_STOR_CD = '" + cKtchSysStatus.sSubShopCd + "' \n" // Add, 2017.02.07
|
|
;
|
|
if (sqlDb.DBExecuteNonQuery(new string[] { sQuery }, CommandType.Text, (SqlParameter[])null, true) != UserCom.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 + "()",
|
|
"Query=" + sQuery);
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
private void KPSOrderMessagePrintStatusDelete(Hashtable htKPSSendingItem, Hashtable htKtchDeviceStatus)
|
|
{
|
|
try
|
|
{
|
|
for(var i = 0; i < htKPSSendingItem.Count;i++)
|
|
{
|
|
Hashtable htTemp = (Hashtable)htKPSSendingItem[i];
|
|
|
|
for (var j= 0; j < htTemp.Count; j++)
|
|
{
|
|
string sql = string.Empty;
|
|
KPSOrderMessage cKPSOrderMessage = (KPSOrderMessage)htTemp[j];
|
|
if (cKPSOrderMessage.sSendYn != "1")
|
|
{
|
|
sql = "UPDATE POSMST..MST_KTCH_ORD_MSG_ADD \n"
|
|
+ " SET SEND_YN = '" + cKPSOrderMessage.sSendYn + "' \n"
|
|
+ " WHERE TRAIN_MODE_YN = '" + cKPSOrderMessage.sTrainMode + "' \n" // Add, 2017.03.03, 연습모드
|
|
+ " AND ORD_DIV = '" + cKPSOrderMessage.sOrderType + "' \n"
|
|
+ " AND FLOOR_CD = '" + cKPSOrderMessage.sFloorCd + "' \n"
|
|
+ " AND TBL_NO = '" + cKPSOrderMessage.sTableNo + "' \n"
|
|
+ " AND SEQ = " + cKPSOrderMessage.nSeq + " \n"
|
|
;
|
|
}
|
|
else
|
|
{
|
|
sql = "DELETE FROM POSMST..MST_KTCH_ORD_MSG_ADD \n"
|
|
+ " WHERE TRAIN_MODE_YN = '" + cKPSOrderMessage.sTrainMode + "' \n" // Add, 2017.03.03, 연습모드
|
|
+ " AND ORD_DIV = '" + cKPSOrderMessage.sOrderType + "' \n"
|
|
+ " AND FLOOR_CD = '" + cKPSOrderMessage.sFloorCd + "' \n"
|
|
+ " AND TBL_NO = '" + cKPSOrderMessage.sTableNo + "' \n"
|
|
+ " AND SEQ = " + cKPSOrderMessage.nSeq + " \n"
|
|
;
|
|
}
|
|
|
|
if(sqlDb.DBExecuteNonQuery(new string[] {sql}, CommandType.Text, (SqlParameter[])null, true) != UserCom.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 + "()",
|
|
"Query=" + sql);
|
|
}
|
|
}
|
|
}
|
|
|
|
for(int nLoop = 0;nLoop < htKtchDeviceStatus.Count;nLoop++)
|
|
{
|
|
KTCH_SYS_STATUS cKtchSysStatus = (KTCH_SYS_STATUS)htKtchDeviceStatus[nLoop];
|
|
|
|
string sErrorCode = "0000";
|
|
if(cKtchSysStatus.nErrorCd != 0)
|
|
{
|
|
switch(cKtchSysStatus.nErrorCd)
|
|
{
|
|
case -1: sErrorCode = "0001"; break; // Print Open Error
|
|
case -2: sErrorCode = "0002"; break; // Print Claim Error
|
|
case -3: sErrorCode = "0003"; break; // Print Power Off Error
|
|
case -4: sErrorCode = "0004"; break; // Cover Open Error
|
|
case -5: sErrorCode = "0005"; break; // No Paper Error
|
|
default: sErrorCode = "9999"; break; // Etc Error
|
|
}
|
|
}
|
|
|
|
string sQuery = " UPDATE POSMST..MST_KTCH_DEVICE \n"
|
|
+ " SET FILLER1 = '" + sErrorCode + "' \n"
|
|
+ " WHERE KTCH_SYS_CD = '" + cKtchSysStatus.sKtchSysCd + "' \n"
|
|
+ " AND SUB_STOR_CD = '" + cKtchSysStatus.sSubShopCd + "' \n" // Add, 2017.02.07
|
|
;
|
|
if (sqlDb.DBExecuteNonQuery(new string[] { sQuery }, CommandType.Text, (SqlParameter[])null, true) != UserCom.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 + "()",
|
|
"Query=" + sQuery);
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get KPS Order Message
|
|
/// </summary>
|
|
/// <param name="htKPSSendingItem"></param>
|
|
private void GetKPSOrderMessage(ref Hashtable htKPSSendingItem)
|
|
{
|
|
string sQuery = string.Empty;
|
|
|
|
DataTable dtData = null;
|
|
|
|
try
|
|
{
|
|
#region (주석) 복합매장 적용 이전 버전
|
|
//sQuery = " SELECT A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ, A.KTCH_SYS_CD ";
|
|
//sQuery += " , A.ITEM_CD, A.SHTCUT_ITEMNM, A.MSG_DIV, A.MSG1, A.MSG2 ";
|
|
//sQuery += " , A.MSG3, A.MSG_REG_TIME, B.KTCH_SYS_USE_DIV, B.KTCH_PRINTER_COMM_PORT, B.KTCH_PRINTER_COMM_SPEED ";
|
|
//sQuery += " , B.KTCH_PRINTER_OPOS_NM, B.KTCH_PRINTER_IP, B.KTCH_PRINTER_PORT, B.KTCH_PRINTER_BAK1, B.KTCH_PRINTER_BAK2 ";
|
|
//sQuery += " , B.KTCH_PRINTER_BAK3, B.KTCH_PRINTER_BAK4, B.KTCH_PRINTER_BAK5, B.KTCH_PRINTER_BAK6 ";
|
|
//sQuery += " FROM POSMST..MST_KTCH_ORD_MSG_ADD A ";
|
|
//sQuery += " , POSMST..MST_KTCH_DEVICE B ";
|
|
//sQuery += " WHERE A.SEND_YN = '0' ";
|
|
//sQuery += " AND A.KTCH_SYS_CD = B.KTCH_SYS_CD ";
|
|
//sQuery += " AND B.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' ";
|
|
//sQuery += " AND B.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ";
|
|
//sQuery += " AND B.KTCH_SYS_DIV = '1' ";
|
|
//sQuery += " ORDER BY B.KTCH_SYS_CD, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SEQ ";
|
|
#endregion
|
|
|
|
#region (주석) 연습모드 적용 이전 버전, 2017.03.03
|
|
//sQuery = " 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"
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG_ADD A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE B \n"
|
|
// + " WHERE A.SEND_YN = '0' \n"
|
|
// + " AND A.SUB_STOR_CD = B.SUB_STOR_CD \n" // Add, 2017.02.06
|
|
// + " 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
|
|
|
|
#region (주석)
|
|
// Mod, 2017.03.03, 연습모드
|
|
//sQuery = " 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"
|
|
// + " FROM POSMST..MST_KTCH_ORD_MSG_ADD A \n"
|
|
// + " , POSMST..MST_KTCH_DEVICE B WITH(NOLOCK) \n"
|
|
// + " WHERE A.SEND_YN = '0' \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 = '" + 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"
|
|
// ;
|
|
#endregion
|
|
|
|
sQuery = " 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"
|
|
+ " , 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 = '0' \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"
|
|
+ " 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, 20170612 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"
|
|
;
|
|
|
|
|
|
if (sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (SqlParameter[])null, out dtData) != UserCom.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var itemKey = string.Empty;
|
|
|
|
Hashtable htTemp = new Hashtable();
|
|
foreach (DataRow dr in dtData.Rows)
|
|
{
|
|
KPSOrderMessage cKPSOrderMsg = new KPSOrderMessage();
|
|
|
|
cKPSOrderMsg.sTrainMode = CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN"); // Add, 2017.03.03, 연습모드
|
|
|
|
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 = "0";
|
|
|
|
// Add, 2017.02.14, 반복출력횟수
|
|
cKPSOrderMsg.printCount = CmUtil.GetDataRowInt(dr, "PRT_CNT");
|
|
if (cKPSOrderMsg.printCount == 0) cKPSOrderMsg.printCount = 1;
|
|
|
|
//cKPSOrderMsg.sKpsCdBackup1 = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_BAK1");
|
|
//cKPSOrderMsg.sKpsCdBackup2 = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_BAK2");
|
|
//cKPSOrderMsg.sKpsCdBackup3 = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_BAK3");
|
|
//cKPSOrderMsg.sKpsCdBackup4 = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_BAK4");
|
|
//cKPSOrderMsg.sKpsCdBackup5 = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_BAK5");
|
|
//cKPSOrderMsg.sKpsCdBackup6 = CmUtil.GetDataRowStr(dr, "KTCH_PRINTER_BAK6");
|
|
|
|
// Add, 2017.02.14
|
|
var temp = CmUtil.GetDataRowStr(dr, "REG_DT").Trim();
|
|
cKPSOrderMsg.sRegDate = temp.Length > 8 ? temp.Substring(0, 8) : m_cPosStatus.Base.SaleDate;
|
|
|
|
// Mod, 2017.02.10
|
|
//htKPSSendingItem.Add(htKPSSendingItem.Count, cKPSOrderMsg);
|
|
//var checkKey = cKPSOrderMsg.sSubShopCd + cKPSOrderMsg.sKtchSysCd + cKPSOrderMsg.sFloorCd + cKPSOrderMsg.sTableNo + cKPSOrderMsg.sMsgId;
|
|
//var 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:
|
|
default:
|
|
checkKey = cKPSOrderMsg.sTrainMode + cKPSOrderMsg.sSubShopCd + cKPSOrderMsg.sKtchSysCd + cKPSOrderMsg.sFloorCd + cKPSOrderMsg.sTableNo + cKPSOrderMsg.sMsgId;
|
|
break;
|
|
}
|
|
|
|
if (itemKey != checkKey)
|
|
{
|
|
if (htTemp.Count != 0)
|
|
{
|
|
htKPSSendingItem.Add(htKPSSendingItem.Count, htTemp);
|
|
}
|
|
|
|
itemKey = checkKey;
|
|
|
|
htTemp = new Hashtable();
|
|
}
|
|
htTemp.Add(htTemp.Count, cKPSOrderMsg);
|
|
}
|
|
|
|
if (htTemp.Count != 0)
|
|
{
|
|
htKPSSendingItem.Add(htKPSSendingItem.Count, htTemp);
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get KPS Send Ok Count (미사용)
|
|
/// </summary>
|
|
/// <param name="strConnectionString"></param>
|
|
/// <param name="strOrderType"></param>
|
|
/// <param name="strFloorCd"></param>
|
|
/// <param name="strTableNo"></param>
|
|
/// <returns></returns>
|
|
private int GetKpsSendOkCount(string sOrderType, string sFloorCd, string sTableNo)
|
|
{
|
|
int nKpsSendCount = 0;
|
|
string sDbSource = string.Empty;
|
|
string sDbCatalog = string.Empty;
|
|
string sDbUserId = string.Empty;
|
|
string sDbPassword = string.Empty;
|
|
DataTable dtData = null;
|
|
try
|
|
{
|
|
|
|
string sQuery = string.Empty;
|
|
sQuery = " SELECT COUNT(1) AS COUNT";
|
|
sQuery += " FROM POSMST..MST_KTCH_ORD_MSG ";
|
|
sQuery += " WHERE ORD_DIV = '" + sOrderType + "' ";
|
|
sQuery += " AND FLOOR_CD = '" + sFloorCd + "' ";
|
|
sQuery += " AND TBL_NO = '" + sTableNo + "' ";
|
|
sQuery += " AND SEND_YN = '1' ";
|
|
|
|
// 조회
|
|
if (sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (SqlParameter[])null, out dtData) == UserCom.OK)
|
|
{
|
|
nKpsSendCount = CmUtil.GetDataRowInt(dtData.Rows[0], "COUNT");
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
|
ex.Message);
|
|
}
|
|
|
|
return nKpsSendCount;
|
|
}
|
|
|
|
private int KPSSerialPrintProc(string sCancelFlag, string sResendFlag, int iKpsComPort, int iKpsComBaudrate, int prtCount, ref int nPrintOkIndex, ref Hashtable htKPSSendingItem)
|
|
{
|
|
var iRet = -99;
|
|
|
|
var sPrtBar1 = new string('-', 42);
|
|
var sPrtBar2 = new string('=', 42);
|
|
var sPrtDat1 = string.Empty;
|
|
var sPrtDat2 = string.Empty;
|
|
|
|
SerialPrint cPrint = new SerialPrint();
|
|
|
|
try
|
|
{
|
|
nPrintOkIndex = -1;
|
|
|
|
cPrint.DeviceOpen("COM" + iKpsComPort.ToString(), iKpsComBaudrate);
|
|
|
|
if (cPrint.IsPortOpened == false)
|
|
{
|
|
cPrint.DeviceClose();
|
|
return -9;
|
|
}
|
|
|
|
// Cover Check
|
|
iRet = cPrint.PrinterStatusCheckBySerial("CHK1");
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.DeviceClose();
|
|
return -4;
|
|
}
|
|
|
|
// Paper Check
|
|
iRet = cPrint.PrinterStatusCheckBySerial("CHK2");
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.DeviceClose();
|
|
return -5;
|
|
}
|
|
|
|
for (var cnt = 0; cnt < prtCount; cnt++)
|
|
{
|
|
var itemKey = string.Empty;
|
|
var ktchMemo = string.Empty;
|
|
var orderNo1 = string.Empty;
|
|
var orderNo2 = string.Empty;
|
|
|
|
// 주문상품 인쇄
|
|
for (int nLoop = 0; nLoop < htKPSSendingItem.Count; nLoop++)
|
|
{
|
|
KPSItem cKPSItem = (KPSItem)htKPSSendingItem[nLoop];
|
|
|
|
// 이미 전송 완료 건 제외
|
|
if (cKPSItem.sSendYn == "1")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// Add, 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)
|
|
{
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.CutPaper(4);
|
|
|
|
// 인쇄 완료 인덱스
|
|
nPrintOkIndex = nLoop - 1;
|
|
}
|
|
|
|
// 원정보 설정
|
|
itemKey = checkKey;
|
|
|
|
// 제목
|
|
sPrtDat1 = string.Format("<< {0} >>", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0154));
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_2, true);
|
|
|
|
// 연습모드 // Add, 2017.03.03,
|
|
if (cKPSItem.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtDat1 = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
|
|
// 복합매장-서브매장명
|
|
if (string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNm) == false)
|
|
{
|
|
sPrtDat1 = m_cPosStatus.Base.SubShopNm;
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// 반복횟수
|
|
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);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// 주문번호
|
|
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}", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0156), cKPSItem.sOrderNo);
|
|
}
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// 주문담당자
|
|
if (string.IsNullOrWhiteSpace(cKPSItem.sOrdPicNm) == false)
|
|
{
|
|
sPrtDat1 = string.Format("{0} : {1}", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0189), cKPSItem.sOrdPicNm.Trim());
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
|
|
// 인원
|
|
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);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
|
|
// 주문번호/테이블
|
|
// 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 = string.Format("{0}-{1}", GetFloorName(cKPSItem.sFloorCd), GetTableName(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);
|
|
}
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
cPrint.TextPrint(sPrtDat2, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_2
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
#region (주문번호 하단 출력)
|
|
|
|
if (cKPSItem.sPosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && string.IsNullOrWhiteSpace(cKPSItem.sFiller2))
|
|
{
|
|
orderNo1 = string.Format("{0}-{1}", GetFloorName(cKPSItem.sFloorCd), GetTableName(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));
|
|
}
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
// 상품/수량
|
|
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);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
//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);
|
|
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
foreach(var dt in RecipeData)
|
|
{
|
|
cPrint.TextPrint(dt.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
|
|
// Add, 2017.03.21, 상품메모
|
|
if (string.IsNullOrWhiteSpace(cKPSItem.sItemMemo) == false)
|
|
{
|
|
var lst = this.GetParserMemo(cKPSItem.sItemMemo);
|
|
foreach (var msg in lst)
|
|
{
|
|
cPrint.TextPrint(" " + msg.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
|
|
// Add, 2017.04.10, 상품구분라인
|
|
var nextIdx = nLoop + 1;
|
|
if (nextIdx < htKPSSendingItem.Count)
|
|
{
|
|
var NextItemDiv = ((KPSItem)htKPSSendingItem[nextIdx]).sItemDiv;
|
|
switch (NextItemDiv)
|
|
{
|
|
case ItemConst.PLU_ITEM_DIV.NORMAL:
|
|
case ItemConst.PLU_ITEM_DIV.SET_MAIN:
|
|
case ItemConst.PLU_ITEM_DIV.SET_DIS:
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
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)
|
|
{
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint("Memo: ", PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
var lst = this.GetParserMemo(ktchMemo);
|
|
foreach (var msg in lst)
|
|
{
|
|
cPrint.TextPrint(" " + msg.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
|
|
// Add, 2017.04.07
|
|
if (string.IsNullOrWhiteSpace(orderNo1) == false)
|
|
{
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(orderNo1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_2
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
cPrint.TextPrint(orderNo2, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
|
|
// Cutting
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.CutPaper(4);
|
|
}
|
|
|
|
// 인쇄 완료 인덱스 설정
|
|
nPrintOkIndex = htKPSSendingItem.Count - 1;
|
|
|
|
// Port Close
|
|
cPrint.DeviceClose();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
cPrint.DeviceClose();
|
|
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 -99;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
private int KPSOrderMessageSerialPrintProc(string sResendFlag, int iKpsComPort, int iKpsComBaudrate, int prtCount, ref int nPrintOkIndex, ref Hashtable htKPSOrderMessage)
|
|
{
|
|
var iRet = UserCom.NG;
|
|
|
|
var sPrtBar1 = new string('-', 42);
|
|
var sPrtData = string.Empty;
|
|
|
|
SerialPrint cPrint = new SerialPrint();
|
|
|
|
try
|
|
{
|
|
nPrintOkIndex = -1;
|
|
|
|
iRet = cPrint.DeviceOpen("COM" + iKpsComPort.ToString(), iKpsComBaudrate);
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.DeviceClose();
|
|
return -9;
|
|
}
|
|
|
|
// Cover Check
|
|
iRet = cPrint.PrinterStatusCheckBySerial("CHK1");
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.DeviceClose();
|
|
return -4;
|
|
}
|
|
|
|
// Paper Check
|
|
iRet = cPrint.PrinterStatusCheckBySerial("CHK2");
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.DeviceClose();
|
|
return -5;
|
|
}
|
|
|
|
|
|
for (var cnt = 0; cnt < prtCount; cnt++)
|
|
{
|
|
var itemKey = string.Empty;
|
|
|
|
for (int nLoop = 0; nLoop < htKPSOrderMessage.Count; nLoop++)
|
|
{
|
|
KPSOrderMessage cKPSMessage = (KPSOrderMessage)htKPSOrderMessage[nLoop];
|
|
|
|
if (cKPSMessage.sSendYn == "1")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
var checkKey = cKPSMessage.sTrainMode + cKPSMessage.sOrderType + cKPSMessage.sFloorCd + cKPSMessage.sTableNo + cKPSMessage.sMsgId;
|
|
if (itemKey != checkKey)
|
|
{
|
|
if (itemKey != "")
|
|
{
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.CutPaper(4);
|
|
|
|
// 인쇄 완료 인덱스
|
|
nPrintOkIndex = nLoop - 1;
|
|
}
|
|
|
|
itemKey = checkKey;
|
|
|
|
|
|
#region ### 헤더 출력
|
|
string sPrintTitle = 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}]", sPrintTitle, (sResendFlag == "1") ? " (R)" : "");
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// 연습모드 // Add, 2017.03.03,
|
|
if (cKPSMessage.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtData = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
sPrtData = sPrintTitle + " : "
|
|
+ GetFloorName(cKPSMessage.sFloorCd) + "-" + GetTableName(cKPSMessage.sFloorCd, cKPSMessage.sTableNo) + " -> "
|
|
+ GetFloorName(cKPSMessage.sMsg1) + "-" + GetTableName(cKPSMessage.sMsg1, cKPSMessage.sMsg2);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
default:
|
|
sPrtData = string.Format("[{0}{1}]", sPrintTitle, (sResendFlag == "1") ? " (R)" : "");
|
|
if (cKPSMessage.sMsgId == PosConst.KPS_ORD_MSG_ID.FIRE_KEY)
|
|
{
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.ReverseMode, true);
|
|
}
|
|
else
|
|
{
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
|
|
// 연습모드 // Add, 2017.03.03,
|
|
if (cKPSMessage.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtData = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
sPrtData = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0176) + " : "
|
|
+ GetFloorName(cKPSMessage.sFloorCd) + "-" + GetTableName(cKPSMessage.sFloorCd, cKPSMessage.sTableNo);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
}
|
|
#endregion
|
|
|
|
#region ### 상품정보 출력
|
|
switch (cKPSMessage.sMsgId)
|
|
{
|
|
case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO:
|
|
//case PosConst.KPS_ORD_MSG_ID.FIRE_KEY:
|
|
cPrint.TextPrint(cKPSMessage.sItemNm.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
|
|
case PosConst.KPS_ORD_MSG_ID.FIRE_KEY: // Add, 2017.03.22
|
|
for (var i = nLoop; i < htKPSOrderMessage.Count; i++)
|
|
{
|
|
KPSOrderMessage cKPSOrderSubMsg = (KPSOrderMessage)htKPSOrderMessage[i];
|
|
|
|
sPrtData = string.Format("{0}{1}", CmUtil.RPadH(cKPSOrderSubMsg.sItemNm, 37), CmUtil.LPadH(cKPSOrderSubMsg.sMsg1, 5));
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// Main Index 동기화
|
|
nLoop = i;
|
|
}
|
|
break;
|
|
|
|
case PosConst.KPS_ORD_MSG_ID.MENU_MOVE:
|
|
for (var i = nLoop; i < htKPSOrderMessage.Count; i++)
|
|
{
|
|
KPSOrderMessage cKPSOrderSubMsg = (KPSOrderMessage)htKPSOrderMessage[i];
|
|
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));
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
//// 전송완료설정
|
|
//cKPSOrderSubMsg.sSendYn = "1";
|
|
|
|
// Main Index 동기화
|
|
nLoop = i;
|
|
}
|
|
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
}
|
|
#endregion
|
|
|
|
#region ### 메시지 출력
|
|
switch (cKPSMessage.sMsgId)
|
|
{
|
|
case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO:
|
|
//case PosConst.KPS_ORD_MSG_ID.FIRE_KEY: // Del, 2017.03.22
|
|
case PosConst.KPS_ORD_MSG_ID.SEAT_MEMO:
|
|
if (cKPSMessage.sMsg1.Trim() != "")
|
|
{
|
|
cPrint.TextPrint(" " + cKPSMessage.sMsg1.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
if (cKPSMessage.sMsg2.Trim() != "")
|
|
{
|
|
cPrint.TextPrint(" " + cKPSMessage.sMsg2.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
if (cKPSMessage.sMsg3.Trim() != "")
|
|
{
|
|
cPrint.TextPrint(" " + cKPSMessage.sMsg3.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
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);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
#endregion
|
|
|
|
// Cutting
|
|
cPrint.CutPaper(4);
|
|
}
|
|
//// 전송완료설정
|
|
//cKPSMessage.sSendYn = "1";
|
|
}
|
|
}
|
|
|
|
// 인쇄 완료 인덱스
|
|
nPrintOkIndex = htKPSOrderMessage.Count - 1;
|
|
|
|
// Port Close
|
|
Thread.Sleep(200);
|
|
cPrint.DeviceClose();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
cPrint.DeviceClose();
|
|
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 -99;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
private int KPSLanPrintProc(string sCancelFlag, string sResendFlag, string sKpsIp, string sKpsPort, int prtCount, ref int nPrintOkIndex, ref Hashtable htKPSSendingItem)
|
|
{
|
|
var iRet = UserCom.NG;
|
|
|
|
var sPrtBar1 = new string('-', 42);
|
|
var sPrtBar2 = new string('=', 42);
|
|
var sPrtDat1 = string.Empty;
|
|
var sPrtDat2 = string.Empty;
|
|
|
|
LANPrint cPrint = new LANPrint();
|
|
|
|
try
|
|
{
|
|
iRet = cPrint.OpenDevice(sKpsIp, int.Parse(sKpsPort));
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.CloseDevice();
|
|
return -9;
|
|
}
|
|
|
|
// Cover Check
|
|
iRet = cPrint.PrinterStatusCheckByLan("CHK1");
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.CloseDevice();
|
|
return -4;
|
|
}
|
|
|
|
// Paper Check
|
|
iRet = cPrint.PrinterStatusCheckByLan("CHK2");
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.CloseDevice();
|
|
return -5;
|
|
}
|
|
|
|
for (var cnt = 0; cnt < prtCount; cnt++)
|
|
{
|
|
var ktchMemo = string.Empty;
|
|
var itemKey = string.Empty;
|
|
var orderNo1 = string.Empty;
|
|
var orderNo2 = string.Empty;
|
|
|
|
// 주문상품 인쇄(주방장치코드가 같은 상품들)
|
|
for (int nLoop = 0; nLoop < htKPSSendingItem.Count; nLoop++)
|
|
{
|
|
KPSItem cKPSItem = (KPSItem)htKPSSendingItem[nLoop];
|
|
|
|
// 이미 전송 완료 건 제외
|
|
if (cKPSItem.sSendYn == "1")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// Add, 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)
|
|
{
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.CutPaper(4);
|
|
|
|
// 인쇄 완료 인덱스
|
|
nPrintOkIndex = nLoop - 1;
|
|
}
|
|
|
|
// 원정보 설정
|
|
itemKey = checkKey;
|
|
|
|
// 제목
|
|
sPrtDat1 = string.Format("<< {0} >>", "주 문 서"); //MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0154));
|
|
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_2, true);
|
|
|
|
cPrint.TextPrint(cKPSItem.sOrderNo, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_3, PrinterCommand.CharactersizeH.H_3
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
|
|
|
|
// 연습모드 Add, 2017.03.03,
|
|
if (cKPSItem.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtDat1 = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
|
|
// 복합매장-서브매장명
|
|
if (string.IsNullOrWhiteSpace(m_cPosStatus.Base.SubShopNm) == false)
|
|
{
|
|
sPrtDat1 = m_cPosStatus.Base.SubShopNm;
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// 반복횟수
|
|
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);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// 주문번호
|
|
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}", "주문번호"// MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0156)
|
|
, cKPSItem.sOrderNo);
|
|
}
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// 주문담당자
|
|
if (string.IsNullOrWhiteSpace(cKPSItem.sOrdPicNm) == false)
|
|
{
|
|
sPrtDat1 = string.Format("{0} : {1}", MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0189), cKPSItem.sOrdPicNm.Trim());
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
|
|
// 인원
|
|
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);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
|
|
// 주문번호/테이블
|
|
// 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 = string.Format("{0}-{1}", GetFloorName(cKPSItem.sFloorCd), GetTableName(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);
|
|
}
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
cPrint.TextPrint(sPrtDat2, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_2
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
#region (주문번호 하단 출력)
|
|
if (cKPSItem.sPosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && string.IsNullOrWhiteSpace(cKPSItem.sFiller2))
|
|
{
|
|
orderNo1 = string.Format("{0}-{1}", GetFloorName(cKPSItem.sFloorCd), GetTableName(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));
|
|
}
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
// 상품/수량
|
|
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);
|
|
cPrint.TextPrint(sPrtDat1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
|
|
//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);
|
|
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
foreach (var dt in RecipeData)
|
|
{
|
|
cPrint.TextPrint(dt.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Add, 2017.03.21, 상품메모
|
|
if (string.IsNullOrWhiteSpace(cKPSItem.sItemMemo) == false)
|
|
{
|
|
var lst = this.GetParserMemo(cKPSItem.sItemMemo);
|
|
foreach (var msg in lst)
|
|
{
|
|
cPrint.TextPrint(" " + msg.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
|
|
// Add, 2017.04.10, 상품구분라인
|
|
var nextIdx = nLoop + 1;
|
|
if (nextIdx < htKPSSendingItem.Count)
|
|
{
|
|
var NextItemDiv = ((KPSItem)htKPSSendingItem[nextIdx]).sItemDiv;
|
|
switch (NextItemDiv)
|
|
{
|
|
case ItemConst.PLU_ITEM_DIV.NORMAL:
|
|
case ItemConst.PLU_ITEM_DIV.SET_MAIN:
|
|
case ItemConst.PLU_ITEM_DIV.SET_DIS:
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
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)
|
|
{
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint("Memo: ", PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
var lst = this.GetParserMemo(ktchMemo);
|
|
foreach (string msg in lst)
|
|
{
|
|
cPrint.TextPrint(" " + msg.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
|
|
// Add, 2017.04.07
|
|
if (string.IsNullOrWhiteSpace(orderNo1) == false)
|
|
{
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(orderNo1, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_3, PrinterCommand.CharactersizeH.H_3
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
cPrint.TextPrint(orderNo2, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
|
|
// Cutting
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
cPrint.CutPaper(12);
|
|
}
|
|
|
|
// 인쇄 완료 인덱스 설정
|
|
nPrintOkIndex = htKPSSendingItem.Count - 1;
|
|
|
|
// Port Close
|
|
|
|
|
|
cPrint.CloseDevice();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
cPrint.CloseDevice();
|
|
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 -99;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
private int KPSOrderMessageLanPrintProc(string sResendFlag, string sKpsIp, string sKpsPort, int prtCount, ref int nPrintOkIndex, ref Hashtable htKPSOrderMessage)
|
|
{
|
|
var iRet = UserCom.NG;
|
|
|
|
var sPrtBar1 = new string('-', 42);
|
|
var sPrtBar2 = new string('=', 42);
|
|
var sPrtData = string.Empty;
|
|
|
|
LANPrint cPrint = new LANPrint();
|
|
|
|
try
|
|
{
|
|
nPrintOkIndex = -1;
|
|
|
|
iRet = cPrint.OpenDevice(sKpsIp, int.Parse(sKpsPort));
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.CloseDevice();
|
|
return -9;
|
|
}
|
|
|
|
// Cover Check
|
|
iRet = cPrint.PrinterStatusCheckByLan("CHK1");
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.CloseDevice();
|
|
return -4;
|
|
}
|
|
|
|
// Paper Check
|
|
iRet = cPrint.PrinterStatusCheckByLan("CHK2");
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
cPrint.CloseDevice();
|
|
return -5;
|
|
}
|
|
|
|
for (var cnt = 0; cnt < prtCount; cnt++)
|
|
{
|
|
var itemKey = string.Empty;
|
|
|
|
for (int nLoop = 0; nLoop < htKPSOrderMessage.Count; nLoop++)
|
|
{
|
|
KPSOrderMessage cKPSMessage = (KPSOrderMessage)htKPSOrderMessage[nLoop];
|
|
|
|
if (cKPSMessage.sSendYn == "1")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
var checkKey = cKPSMessage.sTrainMode + cKPSMessage.sOrderType + cKPSMessage.sFloorCd + cKPSMessage.sTableNo + cKPSMessage.sMsgId;
|
|
if (itemKey != checkKey)
|
|
{
|
|
if (itemKey != "")
|
|
{
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.CutPaper(4);
|
|
|
|
// 인쇄 완료 인덱스
|
|
nPrintOkIndex = nLoop - 1;
|
|
}
|
|
|
|
itemKey = checkKey;
|
|
|
|
#region ### 헤더 출력
|
|
string sPrintTitle = 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}]", sPrintTitle, (sResendFlag == "1") ? " (R)" : "");
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// 연습모드 Add, 2017.03.03,
|
|
if (cKPSMessage.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtData = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
sPrtData = sPrintTitle + " : " + GetFloorName(cKPSMessage.sFloorCd) + "-" + GetTableName(cKPSMessage.sFloorCd, cKPSMessage.sTableNo) + " -> "
|
|
+ GetFloorName(cKPSMessage.sMsg1) + "-" + GetTableName(cKPSMessage.sMsg1, cKPSMessage.sMsg2);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
default:
|
|
sPrtData = string.Format("[{0}{1}]", sPrintTitle, (sResendFlag == "1") ? " (R)" : "");
|
|
if (cKPSMessage.sMsgId == PosConst.KPS_ORD_MSG_ID.FIRE_KEY)
|
|
{
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.ReverseMode, true);
|
|
}
|
|
else
|
|
{
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
|
|
// 연습모드 Add, 2017.03.03,
|
|
if (cKPSMessage.sTrainMode == ItemConst.TRAINING_FLAG.TRAINING_YES)
|
|
{
|
|
sPrtData = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0033);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1
|
|
, PrinterCommand.TextBold.Bold, PrinterCommand.TextUnderLine.Nomal, true);
|
|
}
|
|
|
|
cPrint.TextPrint("", PrinterCommand.Alignment.Center, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
sPrtData = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0176) + " : "
|
|
+ GetFloorName(cKPSMessage.sFloorCd) + "-" + GetTableName(cKPSMessage.sFloorCd, cKPSMessage.sTableNo);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar2, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
}
|
|
#endregion
|
|
|
|
#region ### 상품정보 출력
|
|
switch (cKPSMessage.sMsgId)
|
|
{
|
|
case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO:
|
|
//case PosConst.KPS_ORD_MSG_ID.FIRE_KEY:
|
|
cPrint.TextPrint(cKPSMessage.sItemNm.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
|
|
case PosConst.KPS_ORD_MSG_ID.FIRE_KEY: // Add, 2017.03.22
|
|
for (var i = nLoop; i < htKPSOrderMessage.Count; i++)
|
|
{
|
|
KPSOrderMessage cKPSOrderSubMsg = (KPSOrderMessage)htKPSOrderMessage[i];
|
|
sPrtData = string.Format("{0}{1}", CmUtil.RPadH(cKPSOrderSubMsg.sItemNm, 37), CmUtil.LPadH(cKPSOrderSubMsg.sMsg1, 5));
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
// Main Index 동기화
|
|
nLoop = i;
|
|
}
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
|
|
case PosConst.KPS_ORD_MSG_ID.MENU_MOVE:
|
|
for (var i = nLoop; i < htKPSOrderMessage.Count; i++)
|
|
{
|
|
KPSOrderMessage cKPSOrderSubMsg = (KPSOrderMessage)htKPSOrderMessage[i];
|
|
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));
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
|
|
//// 전송완료설정
|
|
//cKPSOrderSubMsg.sSendYn = "1";
|
|
|
|
// Main Index 동기화
|
|
nLoop = i;
|
|
}
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
break;
|
|
}
|
|
#endregion
|
|
|
|
#region ### 메시지 출력
|
|
switch (cKPSMessage.sMsgId)
|
|
{
|
|
case PosConst.KPS_ORD_MSG_ID.ITEM_MEMO:
|
|
//case PosConst.KPS_ORD_MSG_ID.FIRE_KEY: // Del, 2017.03.22
|
|
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)
|
|
{
|
|
cPrint.TextPrint(" " + msg.Trim(), PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_2, PrinterCommand.CharactersizeH.H_1, true);
|
|
}
|
|
}
|
|
cPrint.TextPrint(sPrtBar1, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
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);
|
|
cPrint.TextPrint(sPrtData, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, true);
|
|
#endregion
|
|
|
|
// Cutting
|
|
cPrint.CutPaper(4);
|
|
}
|
|
//// 전송완료설정
|
|
//cKPSMessage.sSendYn = "1";
|
|
}
|
|
}
|
|
|
|
// 인쇄 완료 인덱스
|
|
nPrintOkIndex = htKPSOrderMessage.Count - 1;
|
|
|
|
// Port Close
|
|
Thread.Sleep(200);
|
|
cPrint.CloseDevice();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
cPrint.CloseDevice();
|
|
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 -99;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
private int PrinterStatusCheckByLan(TcpSocket socket, string sType)
|
|
{
|
|
int iRet = 0;
|
|
string sRet = string.Empty;
|
|
|
|
byte[] recvData = null;
|
|
|
|
try
|
|
{
|
|
#region Printer CHK1
|
|
if (sType == "CHK1")
|
|
{
|
|
iRet = socket.SendReceiveFoodPrintData(PosConst.ESCP_COMMAND.TRANSMIT_OFFLINE_STATUS, ref recvData, 5000);
|
|
|
|
if (recvData != null)
|
|
{
|
|
if (recvData[0] == PosConst.ESCP_COMMAND.STATUS_OK[0])
|
|
{
|
|
iRet = UserCom.OK;
|
|
}
|
|
else
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
|
"COVER Opened");
|
|
}
|
|
}
|
|
return iRet;
|
|
}
|
|
#endregion
|
|
|
|
#region Printer CHK2
|
|
if (sType == "CHK2")
|
|
{
|
|
iRet = socket.SendReceiveFoodPrintData(PosConst.ESCP_COMMAND.TRANSMIT_CONTINUOUS_PAPER_DETECTOR_STATUS, ref recvData, 5000);
|
|
|
|
if (recvData != null)
|
|
{
|
|
if (recvData[0] == PosConst.ESCP_COMMAND.STATUS_OK[0])
|
|
{
|
|
iRet = UserCom.OK;
|
|
}
|
|
else
|
|
{
|
|
string sRecvData = Encoding.Default.GetString(recvData);
|
|
|
|
string NEAR_END = Encoding.Default.GetString(new byte[] { 0x1E });
|
|
string NOT_PRESENT = Encoding.Default.GetString(new byte[] { 0x72 });
|
|
|
|
string sErrMsg = string.Empty;
|
|
if (sRecvData == NEAR_END) sErrMsg = "PAPER_NEAR_END";
|
|
else if (sRecvData == NOT_PRESENT) sErrMsg = "PAPER_NOT_PRESENT";
|
|
else sErrMsg = "ETC_ERROR";
|
|
|
|
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 (함수명))
|
|
sErrMsg);
|
|
}
|
|
}
|
|
|
|
return iRet;
|
|
}
|
|
#endregion
|
|
}
|
|
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 + "()",
|
|
"StatusCheck 실패");
|
|
}
|
|
return iRet;
|
|
}
|
|
|
|
public bool KPSLanStatusCheck(string sKpsIp, string sKpsPort)
|
|
{
|
|
int iRet = UserCom.NG;
|
|
|
|
// 용지 센서 상태 송신 명령어
|
|
byte[] ESC_REQ_SUATUS_PAPER_SENSOR = { 0x1D, 0x72, 0x01 };
|
|
byte[] reqByte = new byte[2049];
|
|
|
|
TcpSocket socket = null;
|
|
|
|
try
|
|
{
|
|
socket = new TcpSocket(sKpsIp, CmUtil.IntParse(sKpsPort));
|
|
if (socket == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// 주방프린터 접속 3회 시도
|
|
//for (int nLoop = 0; nLoop < 3; nLoop++)
|
|
for (int nLoop = 0; nLoop < 1; nLoop++)
|
|
{
|
|
try
|
|
{
|
|
iRet = socket.Connect(5000);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
socket.Close();
|
|
continue;
|
|
}
|
|
|
|
// 접속 실패
|
|
if (iRet != UserCom.OK)
|
|
{
|
|
socket.Close();
|
|
continue;
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
if (iRet != UserCom.OK) return false;
|
|
|
|
// 성공하면 주방프린터 상태 체크함
|
|
iRet = socket.SendReceiveFoodPrintData(ESC_REQ_SUATUS_PAPER_SENSOR, ref reqByte, 10);
|
|
return iRet == 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 + "()",
|
|
ex.Message);
|
|
return false;
|
|
}
|
|
finally
|
|
{
|
|
if (socket != null) socket.Close();
|
|
}
|
|
}
|
|
|
|
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 + "()",
|
|
ex.Message);
|
|
}
|
|
return retValue;
|
|
}
|
|
|
|
private string ConvertDBStr(string str)
|
|
{
|
|
return str.Replace("'", "''");
|
|
}
|
|
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
private void GetLBLPRTSendItem(ref Hashtable htKPSSendingItem)
|
|
{
|
|
string sQuery = string.Empty;
|
|
|
|
DataTable dtData = null;
|
|
|
|
try
|
|
{
|
|
sQuery = "WITH LBLTEMP AS \n"
|
|
+ "( \n"
|
|
+ "SELECT A.TRAIN_MODE_YN, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SUB_STOR_CD \n"
|
|
+ " , MAX(A.ORDER_NO) AS ORDER_NO, MAX(A.ITEM_CD) AS ITEM_CD, MAX(A.SHTCUT_ITEMNM) AS SHTCUT_ITEMNM \n"
|
|
+ " , MAX(A.SET_MENU_CD) AS SET_MENU_CD, MAX(A.FILLER2) AS FILLER2 \n"
|
|
+ " , MAX(A.SALE_QTY) AS SALE_QTY, MAX(A.SEQ) AS SEQ, MAX(A.ITEM_DIV) AS ITEM_DIV, MAX(C.ITEM_INFO) AS ITEM_INFO \n"
|
|
+ " , MAX(C.LBL_QRCODE_URL) AS LBL_QRCODE_URL, MAX(C.LBL_QRCODE_MSG) AS LBL_QRCODE_MSG \n"
|
|
+ " , MAX(C.LBL_TOP_MSG) AS LBL_TOP_MSG, MAX(C.LBL_BTM_MSG) AS LBL_BTM_MSG \n"
|
|
+ " 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"
|
|
+ " 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.LBLSEND_YN IN ('0','9') \n"
|
|
+ " AND A.CANCEL_DIV = '0' \n"
|
|
+ " AND A.ORD_POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n"
|
|
+ " GROUP BY A.TRAIN_MODE_YN, A.ORD_DIV, A.FLOOR_CD, A.TBL_NO, A.SUB_STOR_CD, A.SEQ \n"
|
|
+ ") \n"
|
|
|
|
+ "SELECT E.TRAIN_MODE_YN, E.ORD_DIV, E.FLOOR_CD, E.TBL_NO, E.SUB_STOR_CD \n"
|
|
+ " , E.ORDER_NO, E.ITEM_CD, E.SHTCUT_ITEMNM, E.SALE_QTY, E.SEQ \n"
|
|
+ " , E.LBL_QRCODE_URL, E.LBL_QRCODE_MSG, E.LBL_TOP_MSG, E.LBL_BTM_MSG \n"
|
|
+ " , E.ITEM_INFO, E.ITEM_DIV, E.FILLER2 \n"
|
|
+ " , (CASE WHEN E.SET_MENU_CD = '' THEN E.ITEM_CD ELSE E.SET_MENU_CD END) AS SET_MENU_CD \n"
|
|
+ " , (SELECT ISNULL(SUM(SALE_QTY),0) FROM LBLTEMP \n"
|
|
+ " WHERE TRAIN_MODE_YN = E.TRAIN_MODE_YN \n"
|
|
+ " AND ORD_DIV = E.ORD_DIV \n"
|
|
+ " AND FLOOR_CD = E.FLOOR_CD \n"
|
|
+ " AND TBL_NO = E.TBL_NO \n"
|
|
+ " AND SUB_STOR_CD = E.SUB_STOR_CD \n"
|
|
+ " AND ITEM_DIV = '0') AS TOTCNT \n"
|
|
+ " FROM LBLTEMP E \n"
|
|
+ " ORDER BY E.TRAIN_MODE_YN, E.ORD_DIV, E.FLOOR_CD, E.TBL_NO, E.SUB_STOR_CD, E.SEQ \n";
|
|
|
|
if (sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (SqlParameter[])null, out dtData) != UserCom.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
string itemKey = string.Empty;
|
|
|
|
Hashtable htKPSSendingItemTemp = new Hashtable();
|
|
|
|
//if (sqlDb.DBDataTableSelect(sQuery, CommandType.Text, (SqlParameter[])null, out dtData) == UserCom.OK)
|
|
//{
|
|
// foreach (DataRow dr in dtData.Rows)
|
|
// {
|
|
|
|
|
|
//DataRow[] arRows = null;
|
|
//arRows = dtData.Select();
|
|
//arRows = dtData.Select("POS_NO = '" + m_cPosStatus.Base.PosNo + "'");
|
|
//if (arRows.Length == 0)
|
|
// arRows = dtData.Select("POS_NO = '00'");
|
|
|
|
//foreach (DataRow dr in dtData.Rows)
|
|
foreach (DataRow dr in dtData.Rows)
|
|
{
|
|
KPSItem cKPSItem = new KPSItem();
|
|
|
|
cKPSItem.sTrainMode = CmUtil.GetDataRowStr(dr, "TRAIN_MODE_YN");
|
|
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");
|
|
|
|
//cKPSItem.sKtchSysCd = CmUtil.GetDataRowStr(dr, "KTCH_SYS_CD");
|
|
//cKPSItem.sKtchSysNm = CmUtil.GetDataRowStr(dr, "KTCH_SYS_NM");
|
|
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.sResendYn = CmUtil.GetDataRowStr(dr, "RESEND_YN");
|
|
//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.sItemMemo = CmUtil.GetDataRowStr(dr, "MSG");
|
|
//cKPSItem.sKtchMemo = CmUtil.GetDataRowStr(dr, "KTCH_MSG");
|
|
//cKPSItem.sOrdPicNm = CmUtil.GetDataRowStr(dr, "ORD_PIC_NM");
|
|
//cKPSItem.sOrdPosNo = CmUtil.GetDataRowStr(dr, "ORD_POS_NO");
|
|
|
|
cKPSItem.sRecipe = CmUtil.GetDataRowStr(dr, "ITEM_INFO");
|
|
//cKPSItem.sSendYn = "0";
|
|
cKPSItem.sLblSendYn = CmUtil.GetDataRowStr(dr, "LBLSEND_YN"); //라벨프린터 출력여부(0:미전송, 1:전송)
|
|
cKPSItem.iTOTCNT = CmUtil.GetDataRowInt(dr, "TOTCNT"); //라벨프린터 총출력 해야 할 건수
|
|
|
|
cKPSItem.sQrcodeUrl = CmUtil.GetDataRowStr(dr, "LBL_QRCODE_URL"); //라벨프린터 QRCODE URL
|
|
cKPSItem.sQrcodeMsg = CmUtil.GetDataRowStr(dr, "LBL_QRCODE_MSG"); //라벨프린터 QRCODE MSG
|
|
cKPSItem.sTopMsg = CmUtil.GetDataRowStr(dr, "LBL_TOP_MSG"); //라벨프린터 TOP MSG
|
|
cKPSItem.sBtmMsg = CmUtil.GetDataRowStr(dr, "LBL_BTM_MSG"); //라벨프린터 BTM MSG
|
|
|
|
string checkKey = cKPSItem.sTrainMode + cKPSItem.sOrderType + cKPSItem.sFloorCd + cKPSItem.sTableNo + cKPSItem.sSubShopCd + cKPSItem.sSetMenuCd;
|
|
if (itemKey != checkKey)
|
|
{
|
|
if (htKPSSendingItemTemp.Count != 0)
|
|
{
|
|
htKPSSendingItem.Add(htKPSSendingItem.Count, htKPSSendingItemTemp);
|
|
}
|
|
itemKey = checkKey;
|
|
|
|
htKPSSendingItemTemp = new Hashtable();
|
|
}
|
|
|
|
htKPSSendingItemTemp.Add(htKPSSendingItemTemp.Count, cKPSItem);
|
|
}
|
|
|
|
if (htKPSSendingItemTemp.Count != 0)
|
|
{
|
|
htKPSSendingItem.Add(htKPSSendingItem.Count, htKPSSendingItemTemp);
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
/// <summary>
|
|
/// KPS Status Update
|
|
/// </summary>
|
|
/// <param name="htKPSSendingItem"></param>
|
|
/// <param name="htKtchDeviceStatus"></param>
|
|
private void LBLPRTPrintStatusUpdate(Hashtable htKPSSendingItem, Hashtable htKtchDeviceStatus)
|
|
{
|
|
try
|
|
{
|
|
// Label Print 인쇄 데이터 전송상태 갱신
|
|
for (int nLoop = 0; nLoop < htKPSSendingItem.Count; nLoop++)
|
|
{
|
|
Hashtable htKPSSendingItemTemp = (Hashtable)htKPSSendingItem[nLoop];
|
|
|
|
for (int nLoop2 = 0; nLoop2 < htKPSSendingItemTemp.Count; nLoop2++)
|
|
{
|
|
KPSItem cKPSItem = (KPSItem)htKPSSendingItemTemp[nLoop2];
|
|
|
|
string sQuery = "UPDATE POSMST..MST_KPS_ORD_MSG \n"
|
|
+ " SET LBLSEND_YN = '" + cKPSItem.sLblSendYn + "' \n"
|
|
+ " , RESEND_YN = '" + cKPSItem.sResendYn + "' \n"
|
|
+ " , ERROR_CD = '" + cKPSItem.sErrorCd + "' \n"
|
|
+ " WHERE TRAIN_MODE_YN = '" + cKPSItem.sTrainMode + "' \n" // Add, 2017.03.03, 연습모드
|
|
+ " AND ORD_DIV = '" + cKPSItem.sOrderType + "' \n"
|
|
+ " AND FLOOR_CD = '" + cKPSItem.sFloorCd + "' \n"
|
|
+ " AND TBL_NO = '" + cKPSItem.sTableNo + "' \n"
|
|
+ " AND SUB_STOR_CD = '" + cKPSItem.sSubShopCd + "' \n" // Add, 2017.02.07
|
|
//+ " AND KTCH_SYS_CD = '" + cKPSItem.sKtchSysCd + "' \n"
|
|
+ " AND SEQ = " + cKPSItem.nSeq.ToString() + "\n"
|
|
;
|
|
if (sqlDb.DBExecuteNonQuery(new string[] { sQuery }, CommandType.Text, (SqlParameter[])null, true) != UserCom.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 + "()",
|
|
"Query=" + sQuery);
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
for (int nLoop = 0; nLoop < htKtchDeviceStatus.Count; nLoop++)
|
|
{
|
|
KTCH_SYS_STATUS cKtchSysStatus = (KTCH_SYS_STATUS)htKtchDeviceStatus[nLoop];
|
|
|
|
string sErrorCd = "0000";
|
|
if (cKtchSysStatus.nErrorCd != 0)
|
|
{
|
|
switch (cKtchSysStatus.nErrorCd)
|
|
{
|
|
case -1: sErrorCd = "0001"; break; // Print Open Error
|
|
case -2: sErrorCd = "0002"; break; // Print Claim Error
|
|
case -3: sErrorCd = "0003"; break; // Print Power Off Error
|
|
case -4: sErrorCd = "0004"; break; // Cover Open Error
|
|
case -5: sErrorCd = "0005"; break; // No Paper Error
|
|
default: sErrorCd = "9999"; break; // Etc Error
|
|
}
|
|
}
|
|
string sQuery = "UPDATE POSMST..MST_KTCH_DEVICE \n"
|
|
+ " SET FILLER1 = '" + sErrorCd + "' \n"
|
|
+ " WHERE KTCH_SYS_CD = '" + cKtchSysStatus.sKtchSysCd + "' \n"
|
|
+ " AND SUB_STOR_CD = '" + cKtchSysStatus.sSubShopCd + "' \n" // Add, 2017.02.07
|
|
;
|
|
if (sqlDb.DBExecuteNonQuery(new string[] { sQuery }, CommandType.Text, (SqlParameter[])null, true) != UserCom.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 + "()",
|
|
"Query=" + sQuery);
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
/// <summary>
|
|
/// 라벨프린터 출력
|
|
/// </summary>
|
|
/// <param name="htKPSSendingItem"></param>
|
|
private void LBLPRTPrintProc(ref Hashtable htKPSSendingItem)
|
|
{
|
|
try
|
|
{
|
|
bool nReturn = false;
|
|
int LblPrtCnt = 0;
|
|
|
|
for (int nLoop = 0; nLoop < htKPSSendingItem.Count; nLoop++)
|
|
{
|
|
Hashtable htKPSSendingItemTemp = (Hashtable)htKPSSendingItem[nLoop];
|
|
|
|
if (htKPSSendingItemTemp.Count == 0)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// 수량 만큼 출력 하기 위해
|
|
KPSItem cKPSTemp = (KPSItem)htKPSSendingItemTemp[0];
|
|
|
|
for (int i = 1; i <= cKPSTemp.nQty; i++)
|
|
{
|
|
LblPrtCnt = LblPrtCnt + 1;
|
|
|
|
nReturn = LBLPRTSerialPrintProc(htKPSSendingItemTemp, LblPrtCnt);
|
|
|
|
if (nReturn == true)
|
|
{
|
|
cKPSTemp.sLblSendYn = "1";
|
|
htKPSSendingItemTemp[0] = cKPSTemp;
|
|
}
|
|
else
|
|
{
|
|
cKPSTemp.sLblSendYn = "9";
|
|
htKPSSendingItemTemp[0] = cKPSTemp;
|
|
}
|
|
|
|
htKPSSendingItem[nLoop] = htKPSSendingItemTemp;
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
|
|
//#20180515 KPS 출력시 라벨프린터 출력 start
|
|
#region 라벨프린터 출력 함수
|
|
public bool LBLPRTSerialPrintProc(Hashtable htKPSSendingItem, int LblPrtCnt)
|
|
{
|
|
bool bRet = false;
|
|
string sPrtData = "";
|
|
string sEnter = "\r\n";
|
|
|
|
string sOrdGB = "";
|
|
string sCntOfTotCnt = "";
|
|
string sWaitNo = "";
|
|
string sItemNm = "";
|
|
string[] sItemNmA = new string[2];
|
|
string[] sSubItemNmA = new string[3];
|
|
string sQRcode = "";
|
|
string sQRcodeMsg = "";
|
|
string sTopMsgTemp = "";
|
|
string[] sTopMsg = new string[2];
|
|
string[] sTopMsgA = new string[2];
|
|
string sBtmMsg = "";
|
|
string sOptionTemp = "";
|
|
string[] sOption = new string[8];
|
|
string[] sOptionA = new string[8];
|
|
string sPrtTime = "";
|
|
int iSubCnt = 0;
|
|
|
|
try
|
|
{
|
|
// 라벨프린터 Open
|
|
bRet = m_cLabelPrtDevice.OpenLabelPrinter(m_cPosStatus.Base.OlePosLabelPrinterSerialPortNumber, m_cPosStatus.Base.OlePosLabelPrinterSerialBaudRate);
|
|
|
|
if (bRet == false)
|
|
{
|
|
return bRet;
|
|
}
|
|
|
|
// 주문상품 인쇄
|
|
for (int nLoop = 0; nLoop < htKPSSendingItem.Count; nLoop++)
|
|
{
|
|
KPSItem cKPSItem = (KPSItem)htKPSSendingItem[nLoop];
|
|
|
|
//메인 상품
|
|
if (cKPSItem.sItemDiv == "0")
|
|
{
|
|
sOrdGB = (cKPSItem.sFiller2 == "2") ? "> H <" : "> P <";
|
|
sCntOfTotCnt = LblPrtCnt.ToString() + " of " + cKPSItem.iTOTCNT.ToString();
|
|
sWaitNo = cKPSItem.sOrderNo;
|
|
|
|
// 상품명
|
|
sItemNm = cKPSItem.sItemNm;
|
|
if (sItemNm.Length > 12)
|
|
{
|
|
sItemNmA[0] = sItemNm.Substring(0, 12);
|
|
sItemNmA[1] = sItemNm.Substring(12, sItemNm.Length - sItemNmA[0].Length);
|
|
}
|
|
else
|
|
{
|
|
sItemNmA[0] = sItemNm.Substring(0, sItemNm.Length);
|
|
sItemNmA[1] = "";
|
|
}
|
|
|
|
// qr코드
|
|
sQRcode = cKPSItem.sQrcodeUrl;
|
|
|
|
// qr코드 하단 메세지
|
|
/*
|
|
if (cKPSItem.sQrcodeMsg.Length > 12)
|
|
{
|
|
sQRcodeMsg = cKPSItem.sQrcodeMsg.Substring(0, 12);
|
|
}
|
|
*/
|
|
sQRcodeMsg = cKPSItem.sQrcodeMsg;
|
|
|
|
// 주방상품정보
|
|
//sOptionTemp = cKPSItem.sRecipe.Replace("@$", "|");
|
|
//sOption = sOptionTemp.Split('|');
|
|
|
|
sOptionTemp = cKPSItem.sRecipe.Replace("@", "\r").Replace("$", "\n").ToString();
|
|
sOption = sOptionTemp.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.None);
|
|
|
|
// 상단메세지
|
|
//sTopMsgTemp = cKPSItem.sTopMsg.Replace("@$", "|");
|
|
//sTopMsg = sTopMsgTemp.Split('|');
|
|
|
|
sTopMsgTemp = cKPSItem.sTopMsg.Replace("@", "\r").Replace("$", "\n").ToString();
|
|
sTopMsg = sTopMsgTemp.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.None);
|
|
|
|
//하단 메세지
|
|
/*
|
|
if (cKPSItem.sBtmMsg.Length > 12)
|
|
{
|
|
sBtmMsg = cKPSItem.sBtmMsg.Substring(0, 12);
|
|
}
|
|
*/
|
|
sBtmMsg = cKPSItem.sBtmMsg;
|
|
|
|
// 출력시간
|
|
sPrtTime = DateTime.Now.ToString("HH:mm:ss tt");
|
|
}
|
|
|
|
//부가 상품
|
|
if (cKPSItem.sItemDiv == "3")
|
|
{
|
|
/*
|
|
if (cKPSItem.sItemNm.Length > 11)
|
|
{
|
|
sSubItemNmA[iSubCnt] = cKPSItem.sItemNm.Substring(0, 11);
|
|
}
|
|
*/
|
|
sSubItemNmA[iSubCnt] = cKPSItem.sItemNm;
|
|
iSubCnt = iSubCnt + 1;
|
|
}
|
|
}
|
|
|
|
for (int i = sItemNmA.Length; i < 2; i++)
|
|
{
|
|
sItemNmA[i] = "";
|
|
}
|
|
|
|
for (int i = sSubItemNmA.Length; i < 3; i++)
|
|
{
|
|
sSubItemNmA[i] = "";
|
|
}
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
sTopMsgA[i] = "";
|
|
}
|
|
|
|
for (int i = 0; i < sTopMsg.Length; i++)
|
|
{
|
|
sTopMsgA[i] = sTopMsg[i];
|
|
}
|
|
|
|
for (int i = 0; i < 8; i++)
|
|
{
|
|
sOptionA[i] = "";
|
|
}
|
|
|
|
for (int i = 0; i < sOption.Length; i++)
|
|
{
|
|
sOptionA[i] = sOption[i];
|
|
}
|
|
|
|
sPrtData = "CLL";
|
|
sPrtData += sEnter + "NEW";
|
|
sPrtData += sEnter + "SETUP \"MEDIA,MEDIA SIZE,WIDTH,300\"";
|
|
sPrtData += sEnter + "SETUP \"MEDIA,MEDIA SIZE,LENGTH,1200\"";
|
|
sPrtData += sEnter + "SETUP \"MEDIA,MEDIA SIZE,XSTART,0\"";
|
|
|
|
sPrtData += sEnter + "CLIP ON";
|
|
sPrtData += sEnter + "NASC 949";
|
|
|
|
sPrtData += sEnter + "FONT \"HYGothic-Medium\",9";
|
|
sPrtData += sEnter + "PP 5, 360:PT \"" + sWaitNo + "\"";
|
|
|
|
sPrtData += sEnter + "PP 225, 360:PT \"" + sCntOfTotCnt + "\"";
|
|
|
|
sPrtData += sEnter + "PP 5, 350:DIR 1:PL 300,1";
|
|
|
|
sPrtData += sEnter + "PP 0, 315:PT \"" + sItemNmA[0] + "\"";
|
|
sPrtData += sEnter + "PP 0, 285:PT \"" + sItemNmA[1] + "\"";
|
|
|
|
sPrtData += sEnter + "PP 5, 275:DIR 1:PL 300,1";
|
|
|
|
sPrtData += sEnter + "FONT \"HYGothic-Medium\",8";
|
|
sPrtData += sEnter + "PP 5, 240:PT \"" + sSubItemNmA[0] + "\"";
|
|
sPrtData += sEnter + "PP 5, 210:PT \"" + sSubItemNmA[1] + "\"";
|
|
sPrtData += sEnter + "PP 5, 180:PT \"" + sSubItemNmA[2] + "\"";
|
|
|
|
if (sQRcode != "")
|
|
{
|
|
sPrtData += sEnter + "BF OFF";
|
|
sPrtData += sEnter + "PP 5,70";
|
|
sPrtData += sEnter + "BARSET \"QRCODE\",1,1,4,2,2";
|
|
sPrtData += sEnter + "PB \"" + sQRcode + "\"";
|
|
|
|
sPrtData += sEnter + "FONT \"HYGothic-Medium\",7";
|
|
sPrtData += sEnter + "PP 5, 40:PT \"" + sQRcodeMsg + "\"";
|
|
}
|
|
else
|
|
{
|
|
sPrtData += sEnter + "FONT \"HYGothic-Medium\",10";
|
|
sPrtData += sEnter + "PP 5,100:PT \"" + sTopMsgA[0] + "\"";
|
|
sPrtData += sEnter + "PP 5, 70:PT \"" + sTopMsgA[1] + "\"";
|
|
|
|
sPrtData += sEnter + "FONT \"HYGothic-Medium\",7";
|
|
sPrtData += sEnter + "PP 5, 40:PT \"" + sBtmMsg + "\"";
|
|
}
|
|
|
|
sPrtData += sEnter + "PP 5, 40:DIR 1:PL 300,1";
|
|
|
|
sPrtData += sEnter + "FONT \"HYGothic-Medium\",9";
|
|
sPrtData += sEnter + "PP 5,5:PT \"" + sPrtTime + "\"";
|
|
|
|
sPrtData += sEnter + "PP 240,5:PT \"" + sOrdGB + "\"";
|
|
|
|
sPrtData += sEnter + "PP 260,240:PT \"" + sOptionA[0] + "\"";
|
|
sPrtData += sEnter + "PP 260,212:PT \"" + sOptionA[1] + "\"";
|
|
sPrtData += sEnter + "PP 260,184:PT \"" + sOptionA[2] + "\"";
|
|
sPrtData += sEnter + "PP 260,156:PT \"" + sOptionA[3] + "\"";
|
|
sPrtData += sEnter + "PP 260,128:PT \"" + sOptionA[4] + "\"";
|
|
sPrtData += sEnter + "PP 260,100:PT \"" + sOptionA[5] + "\"";
|
|
sPrtData += sEnter + "PP 260,72:PT \"" + sOptionA[6] + "\"";
|
|
sPrtData += sEnter + "PP 260,44:PT \"" + sOptionA[7] + "\"";
|
|
|
|
sPrtData += sEnter + "PF";
|
|
sPrtData += sEnter;
|
|
|
|
UserLog.WriteLogFile(UserCom.LOG_OP,
|
|
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 (함수명))
|
|
"▶▶ LabelPrt: [" + sPrtData + "]");
|
|
|
|
m_cLabelPrtDevice.PrintLabelInfo(sPrtData);
|
|
|
|
UserLog.WriteLogFile(UserCom.LOG_OP,
|
|
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 (함수명))
|
|
"▶▶ [CLOSE]");
|
|
|
|
// 라벨프린터 Close
|
|
bRet = m_cLabelPrtDevice.CloseLabelPrinter();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_OP,
|
|
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 bRet;
|
|
}
|
|
#endregion
|
|
//#20180515 KPS 출력시 라벨프린터 출력 end
|
|
|
|
}
|
|
}
|