spc-kiosk-pb/Window/WinSale/frmHappyOrderMsg.cs

337 lines
17 KiB
C#
Raw Normal View History

2019-06-16 05:12:09 +00:00
//#16401 해피오더)주문내역 바코드 리딩 시 자동 완료처리 start
//#16401 해피오더)주문내역 바코드 리딩 시 자동 완료처리 end
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
namespace Cosmos.Win
{
public partial class frmHappyOrderMsg : Form
{
private SManager sManager = new SManager(); //이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); //StateObject : StateServer Object(객체)
private PosStatus m_cPosStatus;
//private TranStatus m_cTrnStatus; //거래정보 참조
//private DeviceStatus m_cDevStatus = null;
private IHoldDeal m_cHoldDeal = null;
private IHappyOrderList m_cHappyOrder = null;
private IFormHappyOrderMainUs m_cHappyOrderList = null;
private IDataCommonUs m_cDataCommon = null;
/// <summary>
/// 해피오더 리스트 TAB ("01":내점, "02":배달", "03":사전예약, "04":오더폼내점, "05":오더폼배달)
/// </summary>
private string m_sPosMenuKeyIn;
public string PosMenuKeyIn { set { m_sPosMenuKeyIn = value; } get { return m_sPosMenuKeyIn; } }
/// <summary>
/// 주문번호
/// </summary>
private string m_HPOrderNo;
public string HPOrderNo { set { this.m_HPOrderNo = value; } }
/// <summary>
/// 픽업/배달 구분
/// </summary>
private string m_HPOrderType;
public string HPOrderType { set { this.m_HPOrderType = value; } }
/// <summary>
/// 상품 리스트
/// </summary>
private ArrayList alHappOrderItem;
private DataTable m_dtGrid;
public frmHappyOrderMsg()
{
try
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
m_cPosStatus = (PosStatus)StateObject.POS; //POS 기본정보
//m_cTrnStatus = (TranStatus)StateObject.TRAN; //거래정보
//m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
m_cHoldDeal = (IHoldDeal)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.HOLD_DEAL);
m_cHappyOrder = (IHappyOrderList)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.HAPPY_ORDER_LIST);
m_cHappyOrderList = (IFormHappyOrderMainUs)FormManager.GetForm(FormManager.FORM_SAL_HPORD);
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
}
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);
}
}
private void frmHappyOrderMsg_Load(object sender, EventArgs e)
{
try
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
InitControls();
}
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);
}
}
private void frmHappyOrderMsg_FormClosed(object sender, FormClosedEventArgs e)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
lblTitle.Text);
}
private void InitControls()
{
try
{
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
FormManager.SetTextBoxGlobalInfo(this,
m_cPosStatus.Global.m_stCultureMaster.nGroupingDigits,
m_cPosStatus.Global.m_stCultureMaster.strGroupingSymbol,
m_cPosStatus.Global.m_stCultureMaster.nDecimalDigits,
m_cPosStatus.Global.m_stCultureMaster.strDecimalSymbol);
this.Location = new Point((1024 - this.Size.Width) / 2, (768 - this.Size.Height) / 2);
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1181);
btnYes.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0025);
btnNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0026);
lbMsg1.Text = "주문번호 :" + m_HPOrderNo;
if (m_HPOrderType != "5" && m_HPOrderType != "6") // 내점
{
//픽업건
lbMsg2.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0798);
}
else
{
//배달건
lbMsg2.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0799);
}
// 해피오더 상품 리스트
alHappOrderItem = m_cHappyOrderList.HappyOrderItem;
// 그리드 초기화
SetListColumn();
// 그리드 값 셋팅
RegisterItemOnGrid();
//#16401 해피오더)주문내역 바코드 리딩 시 자동 완료처리 start - 20180829
//btnUp.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BUTTON_GRID_UP_ARROW);
//btnUp.ImageAlign = ContentAlignment.MiddleCenter;
//#16401 해피오더)주문내역 바코드 리딩 시 자동 완료처리 end - 20180829
btnUp.BorderStyle = BorderStyle.None;
//#16401 해피오더)주문내역 바코드 리딩 시 자동 완료처리 start - 20180829
//btnDw.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BUTTON_GRID_DOWN_ARROW);
//btnDw.ImageAlign = ContentAlignment.MiddleCenter;
//#16401 해피오더)주문내역 바코드 리딩 시 자동 완료처리 end - 20180829
btnDw.BorderStyle = BorderStyle.None;
//사이즈 및 위치조정
btnUp.Top = dgvData.Top;
btnUp.Height = dgvData.Height / 2;
btnDw.Top = btnUp.Top + btnUp.Height;
btnDw.Height = dgvData.Height / 2;
lbMsg1.Left = dgvData.Left;
lbMsg2.Left = dgvData.Left;
}
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);
}
}
#region
private void SetListColumn()
{
try
{
dgvData.CsmGridColumnHeadersVisible = true; //DataGridView 자체의 컬럼 헤더 Visible 여부
dgvData.CsmGridColumnHeadersHeight = 37; //DataGridView 자체의 컬럼 헤더 높이
dgvData.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 12, FontStyle.Bold); //DataGridView 자체의 컬럼 헤더 폰트
dgvData.CsmGridRowsHeight = 35;
dgvData.CsmGridColumnCount = 5; //그리드의 컬럼수(5)
dgvData.CsmGridShowPageRowsCount = 5; //그리드의 한 화면에 보이는 로우수
dgvData.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색
dgvData.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정
dgvData.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정
dgvData.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러
dgvData.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러
dgvData.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러
dgvData.CsmGridSetColumnWidth(new int[] { 65, 150, 300, 150, 50 }); //컬럼넓이 지정(715)
dgvData.CsmGridAlignment(new int[] { 1, 1, 0, 1, 2 }); //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
//각 컬럼별 이름 지정
dgvData.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0014));
dgvData.CsmGridColumnName(1, "상품코드");
dgvData.CsmGridColumnName(2, "상품명");
dgvData.CsmGridColumnName(3, "수량");
dgvData.CsmGridColumnName(4, "비고");
//
m_dtGrid = new DataTable();
m_dtGrid.Columns.Add(new DataColumn("NO", typeof(string)));
m_dtGrid.Columns.Add(new DataColumn("ITEM_CD", typeof(string)));
m_dtGrid.Columns.Add(new DataColumn("ITEM_NM", typeof(string)));
m_dtGrid.Columns.Add(new DataColumn("ITEM_QTY", typeof(string)));
m_dtGrid.Columns.Add(new DataColumn("ETC", typeof(string)));
m_dtGrid.Clear();
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
}
#endregion
#region
private void RegisterItemOnGrid()
{
try
{
m_dtGrid.Clear();
for (int nLoop = 0; nLoop < alHappOrderItem.Count; nLoop++)
{
Column.TR_HPORD.HPORD_ITEM item = (Column.TR_HPORD.HPORD_ITEM)alHappOrderItem[nLoop];
DataRow drNew = m_dtGrid.NewRow();
drNew["NO"] = nLoop + 1;
drNew["ITEM_CD"] = item.GoodsCode;
if (CmUtil.StringNullEmpty(item.FlavourFlag).Equals("N") == false)
{
drNew["ITEM_NM"] = " >" +item.GoodsName;
}
else
{
drNew["ITEM_NM"] = item.GoodsName;
}
drNew["ITEM_QTY"] = item.Qty;
m_dtGrid.Rows.Add(drNew);
}
dgvData.CsmGridDataSource = m_dtGrid;
dgvData.CsmGridSelectRow(0);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
}
#endregion
#region /
/// <summary>
/// 조회 그리드 업/다운 클릭 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelProc_Click(object sender, EventArgs e)
{
if ((UI.CsmButton)sender == btnUp)
{
dgvData.CsmGridScroll("UP");
}
else if ((UI.CsmButton)sender == btnDw)
{
dgvData.CsmGridScroll("DOWN");
}
}
#endregion
#region
//예/아니오 버튼
private void btnProc_Click(object sender, EventArgs e)
{
try
{
if ((Cosmos.UI.CsmButton)sender == btnYes) // 등록
{
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
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);
}
}
//닫기버튼
private void btnExit_Click(object sender, EventArgs e)
{
try
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
}
#endregion
}
}