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

236 lines
11 KiB
C#
Raw Normal View History

2019-06-16 05:12:09 +00:00
using System;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Collections;
using System.Data;
using Cosmos.Win;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 세트 메뉴 변경
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Win
{
public partial class frmSetMenuChg : Form
{
#region
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
private TranStatus m_cTrnStatus = new TranStatus(); // 거래정보 참조
private DeviceStatus m_cDevStatus = null; // 디바이스 관리
private PosOLEDevice.DelegateOlePos delegatePos;
private ISalePluItemUs m_cPluService = null; // 판매 등록 관리
/// <summary>
/// 상품 선택 행
/// </summary>
private string m_sSelRow = "0";
public string SetSelectRow { set { this.m_sSelRow = value; } }
#endregion
#region & &
public frmSetMenuChg()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
m_cPluService = (ISalePluItemUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_PLU_ITEM);
delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
}
private void frmSetMenuChg_Load(object sender, EventArgs e)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
InitControl();
}
private void frmSetMenuChg_Activated(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(delegatePos);
}
private void frmSetMenuChg_Deactivate(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
private void frmSetMenuChg_FormClosing(object sender, FormClosingEventArgs 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);
}
/// <summary>
/// 폼 컨트롤 초기화
/// </summary>
private void InitControl()
{
try
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
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);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0497);
lblPluName.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0498);
SetMenuDisplay();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
private void SetMenuDisplay()
{
try
{
// 상품 아이템
ArrayList alPluItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
Column.TR_PLU.DATA cPluItem = (Column.TR_PLU.DATA)alPluItem[CmUtil.IntParse(m_sSelRow)];
txtPluName.Text = cPluItem.ITEM_NAME;
// 세트메뉴 그룹 상세 로딩
DataTable dtSetMenuDetail = m_cPluService.SearchMenuMaster("MST_ITEM_SET_GRP_CHANGE", cPluItem.SUB_SHOP_CD, cPluItem.SET_PLU_SET_GROUP_CODE);
// 세트 그룹 상세 로딩
btnSetMenu.SetFuncButtonCount(4, 6); // 버튼갯수 설정
btnSetMenu.VisibleUpDown = true;
btnSetMenu.ClearFuncButtonInfo(); // 설정된 정보 초기화
if (dtSetMenuDetail != null)
{
foreach (DataRow dr in dtSetMenuDetail.Rows)
{
Cosmos.UI.CsmFunc.FuncBtnInfo cFuncInfo = new Cosmos.UI.CsmFunc.FuncBtnInfo();
cFuncInfo.sGroupCode = "00"; // 분류코드
cFuncInfo.nSeqNo = CmUtil.GetDataRowInt(dr, PosMst.MST_ITEM_SET_GRP.DATA.SEQ_NO); // 표시순번
cFuncInfo.sFuncCode = CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_ITEM_SET_GRP.DATA.SUB_STOR_CD), 10)
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_ITEM_SET_GRP.DATA.SET_ITEM_CD), 20)
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_ITEM_SET_GRP.DATA.LABEL_NM), 50)
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_ITEM_SET_GRP.DATA.SET_ITEM_UP_PRC), 20); // 코드+업차지금액
cFuncInfo.sFuncText = CmUtil.GetDataRowStr(dr, PosMst.MST_ITEM_SET_GRP.DATA.LABEL_NM) + "\n" +
m_cPosStatus.Global.m_stCultureMaster.strCurrencySymbol +
m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, PosMst.MST_ITEM_SET_GRP.DATA.SET_ITEM_UP_PRC));
cFuncInfo.cBackColor = Color.LightGray; // 백 컬러
cFuncInfo.cForeColor = CmUtil.GetColorToString(CmUtil.GetDataRowStr(dr, PosMst.MST_ITEM_SET_GRP.DATA.FONT_COLOR)); // 명 컬러
cFuncInfo.fFontSize = CmUtil.GetDataRowFloat(dr, PosMst.MST_ITEM_SET_GRP.DATA.FONT_SIZE); // 명 폰트 사이즈
cFuncInfo.nButtonSize = 0; // 버튼 사이즈(0:일반,1:가로확대,2:세로확대,3:가로세로확대)
btnSetMenu.AddFuncButtonInfo(cFuncInfo);
}
}
btnSetMenu.DisplayFuncButton("00"); // 메뉴 버튼 표시
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
/// <summary>
/// 세트메뉴 선택 이벤트 처리
/// </summary>
/// <param name="sender"></param>
/// <param name="sFuncCode"></param>
private void btnSetMenu_FuncClickHandler(object sender, string sFuncCode)
{
try
{
if (sFuncCode == "") return;
string sMenuCode = CmUtil.MidH(sFuncCode, 10, 20).Trim();
string sMenuName = CmUtil.MidH(sFuncCode, 30, 50).Trim();
string sMenuPrc = CmUtil.MidH(sFuncCode,80, 20).Trim();
// 세트메뉴 상품 변경 처리
string nStat = m_cPluService.SetSetMenuItemChange(m_sSelRow, sMenuCode, sMenuName, sMenuPrc);
if (nStat == UserCom.RST_OK)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
try
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#region DeviceEvent
/// <summary>
/// DeviceEvent 관련
/// </summary>
/// <param name="sDevice"></param>
/// <param name="sData1"></param>
/// <param name="sData2"></param>
/// <param name="sData3"></param>
public void OnDeviceEvent(string sDevice, string sData1, string sData2, string sData3)
{
try
{
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
}
}