spc-kiosk-pb/Window/WinOpenClose/frmPrepStorNotice.cs
2019-06-16 14:12:09 +09:00

423 lines
20 KiB
C#

using System;
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.Common;
using Cosmos.CommonManager;
using Cosmos.ServiceProvider;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
namespace Cosmos.Win
{
public partial class frmPrepStorNotice : Form
{
#region
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
private IDataServiceUs m_cPrepStorNotice = null; // 준비점검 조회 서비스
private DataTable m_dtItemInit; // 조회 데이터 리스트
private bool bNotDoubleClik = false; // 더블 클릭 방지용
// 점검코드
private string m_sCheckCode = "";
public string CheckCode { set { m_sCheckCode = value; } get { return m_sCheckCode; } }
#endregion
#region &
public frmPrepStorNotice()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
m_cPrepStorNotice = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.PREP_STOR_NOTICE);
}
private void frmPrepStorNotice_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();
// 준비점검공지사항조회
GetPrepStorNoticeList();
}
private void frmPrepStorNotice_FormClosing(object sender, FormClosingEventArgs e)
{
vScrollbar.Attach(null);
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
}
#endregion &
#region
/// <summary>
/// 폼 컨트롤 초기화
/// </summary>
private void InitControl()
{
try
{
if (m_cPosStatus.Sale.ScreenSizeUser == 1024)
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE);
//this.Size = new Size(1024, 696);
//this.Location = new Point(0, 50);
FormManager.SetControlSize(picBack, 0, 0, 1024, 696);
FormManager.SetControlSize(this, 0, 50, picBack.Size.Width, picBack.Size.Height);
FormManager.SetControlSize(this.lblTitle, 16, 1, 950, 50);
FormManager.SetControlSize(this.btnExit, 965, 1, 58, 50);
FormManager.SetControlSize(this.btnPrint, 908, 640, 100, 40);
FormManager.SetControlSize(this.txtChkMessage, 450, 68, 546, 565);
FormManager.SetControlSize(this.btnUp, 16, 632, 210, 48);
FormManager.SetControlSize(this.btnDw, 226, 632, 210, 48);
FormManager.SetControlSize(this.dgvData, 16, 68, 420, 565);
FormManager.SetControlSize(this.label5, 16, 67, 420, 2);
FormManager.SetControlSize(this.label1, 450, 67, 558, 2);
FormManager.SetControlSize(this.vScrollbar, 978, 69, 30, 564);
btnDw.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_BASIC);
btnDw.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_PRESS);
btnUp.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_BASIC);
btnUp.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_PRESS);
}
else
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
FormManager.SetControlSize(picBack, 0, 0, 800, 600);
FormManager.SetControlSize(this, 0, 0, picBack.Size.Width, picBack.Size.Height);
FormManager.SetControlSize(this.lblTitle, 16, 1, 728, 50);
FormManager.SetControlSize(this.btnExit, 741, 1, 58, 50);
FormManager.SetControlSize(this.btnPrint, 678, 538, 100, 40);
FormManager.SetControlSize(this.txtChkMessage, 364, 68, 402, 463);
FormManager.SetControlSize(this.btnUp, 22, 530, 164, 48);
FormManager.SetControlSize(this.btnDw, 186, 530, 164, 48);
FormManager.SetControlSize(this.dgvData, 22, 68, 328, 463);
FormManager.SetControlSize(this.label5, 22, 67, 328, 2);
FormManager.SetControlSize(this.label1, 364, 67, 414, 2);
FormManager.SetControlSize(this.vScrollbar, 748, 69, 30, 462);
btnDw.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_164X48_DOWN1_BASIC);
btnDw.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_164X48_DOWN1_PRESS);
btnUp.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_164X48_UP1_BASIC);
btnUp.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_164X48_UP1_PRESS);
}
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);
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
vScrollbar.Attach(txtChkMessage);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
// 라벨 이름 설정
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0589);
// 버튼 이름 설정
btnPrint.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0257);
// 그리드 설정
SetListColumn();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// DataGridView 초기화
/// </summary>
private void SetListColumn()
{
try
{
// 준비점검 공지사항 정보
dgvData.CsmGridColumnHeadersVisible = true; //DataGridView 자체의 컬럼 헤더 Visible 여부
dgvData.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 12, FontStyle.Bold); //DataGridView 자체의 컬럼 헤더 폰트
dgvData.CsmGridColumnCount = 3; //그리드의 컬럼수
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.CsmGridAlignment(new int[] { 0, 2, 2 }); //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
if (m_cPosStatus.Sale.ScreenSizeUser == 1024)
{
dgvData.CsmGridColumnHeadersHeight = 31; //DataGridView 자체의 컬럼 헤더 높이
dgvData.CsmGridRowsHeight = 38;
dgvData.CsmGridShowPageRowsCount = 14; //그리드의 한 화면에 보이는 로우수
dgvData.CsmGridSetColumnWidth(new int[] { 420, 0, 0 }); //컬럼넓이 지정(420)
}
else
{
dgvData.CsmGridColumnHeadersHeight = 43; //DataGridView 자체의 컬럼 헤더 높이
dgvData.CsmGridRowsHeight = 38;
dgvData.CsmGridShowPageRowsCount = 11; //그리드의 한 화면에 보이는 로우수
dgvData.CsmGridSetColumnWidth(new int[] { 328, 0, 0 }); //컬럼넓이 지정(328)
}
//각 컬럼별 이름 지정
dgvData.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0489));
dgvData.CsmGridColumnName(1, "그룹코드");
dgvData.CsmGridColumnName(2, "대분류코드");
//그리드 초기화 테이블
m_dtItemInit = new DataTable("INIT");
m_dtItemInit.Columns.Add(new DataColumn("NOTICE", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("INSPCT_ENTRY_GRP_CD", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("INSPCT_ENTRY_L_CLSS_CD", typeof(string)));
m_dtItemInit.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 Control Event
#region /
/// <summary>
/// 조회 그리드 업/다운 클릭 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelProc_Click(object sender, EventArgs e)
{
try
{
if (bNotDoubleClik) return;
bNotDoubleClik = true;
if ((UI.CsmButton)sender == btnUp)
{
dgvData.CsmGridScroll("UP");
}
else if ((UI.CsmButton)sender == btnDw)
{
dgvData.CsmGridScroll("DOWN");
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
bNotDoubleClik = false;
}
#endregion /
private void btnPrint_Click(object sender, EventArgs e)
{
try
{
if (dgvData.CsmGridRowsCount <= 0)
{
return;
}
GetPrepStorNoticePrint();
}
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)
{
this.Close();
}
private void dgvData_GridClickEvent(object sender, string rowIndex)
{
GetPrepStorNoticeDetail();
}
#endregion Control Event
#region User Method
private string GetPrepStorNoticeList()
{
try
{
DataTable dtData = new DataTable();
dtData = (DataTable)m_cPrepStorNotice.GetData(new string[] { "1", m_sCheckCode });
if (dtData != null && dtData.Rows.Count > 0)
{
//그리드 적용!
dgvData.CsmGridDataSource = dtData;
dgvData.CsmGridSelectRow(0);
//상세조회
GetPrepStorNoticeDetail();
}
else
{
//데이터 없음!
dgvData.CsmGridDataSource = m_dtItemInit;
}
}
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 UserCom.RST_OK;
}
private string GetPrepStorNoticeDetail()
{
int nCnt = 0;
string sChkData = string.Empty;
string sRet = UserCom.RST_ERR;
try
{
if (dgvData.CsmGridRowsCount <= 0)
{
return sRet;
}
if (dgvData.CsmGridSelectedRowIndex < 0)
{
return sRet;
}
txtChkMessage.Text = "";
sChkData = "";
DataTable dtData = new DataTable();
dtData = (DataTable)m_cPrepStorNotice.GetData(new string[] { "2", dgvData.CsmGridGetCell(dgvData.CsmGridSelectedRowIndex, 1), dgvData.CsmGridGetCell(dgvData.CsmGridSelectedRowIndex, 2) });
if (dtData != null && dtData.Rows.Count > 0)
{
sChkData += "[ " + CmUtil.GetDataRowStr(dtData.Rows[0], PosMst.MST_SALESORG_INSPCT_GRP.DATA.INSPCT_ENTRY_L_CLSS_NM) + " ]";
sChkData += "\r\n";
sChkData += "\r\n";
for (int nLoop = 0; nLoop < dtData.Rows.Count; nLoop++)
{
nCnt = CmUtil.GetDataRowInt(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.SEL_ENTRY_CNT);
sChkData += CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INSPCT_ENTRY_NM);
sChkData += "\r\n";
//dgvDataList.Rows.Clear();
for (int nLoop2 = 0; nLoop2 < nCnt; nLoop2++)
{
string sCellIndex = Convert.ToString(nLoop2 + 1);
//if (nLoop == 0)
//{
//txtChkMessage.Text = CmUtil.GetDataRowStr(dtData.Rows[0], PosMst.MST_SALESORG_INSPCT.DATA.SEL_ENTRY_ + CmUtil.GetValueToStr(nCnt));
//txtChkMessage.Text = txtChkMessage.Text + CmUtil.GetDataRowStr(dtData.Rows[0], "SEL_ENTRY_" + sCellIndex);
//}
//else
//{
//sChkData += "\r\n";
sChkData += CmUtil.GetDataRowStr(dtData.Rows[0], "SEL_ENTRY_" + sCellIndex);
sChkData += "\r\n";
//}
}
}
sRet = UserCom.RST_OK;
}
//else
//{
//WinManager.ErrorMessage("조회데이터가 없습니다.");
//}
txtChkMessage.Text = sChkData;
}
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 sRet;
}
// 프린트 출력
private string GetPrepStorNoticePrint()
{
int nCnt = 0;
string sChkData = string.Empty;
string sRet = UserCom.RST_ERR;
try
{
if (dgvData.CsmGridRowsCount <= 0)
{
return sRet;
}
if (dgvData.CsmGridSelectedRowIndex < 0)
{
return sRet;
}
DataTable dtData = new DataTable();
sRet = m_cPrepStorNotice.Execute(new string[] { });
}
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 sRet;
}
#endregion User Method
}
}