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 frmExpiryDateCheckList : Form { #region 변수 선언 private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출 private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체) private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조 private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스 private IStoreCheck m_cStoreCheck = null; // 점검리스트 가지고 오기 // 상황에 맞는 화면을 띄워주기 위한 설정값 // 판매준비점검(유통기한 점검/식품안전의날) private string m_sSearchInfo = ""; public string SearchInfo { set { m_sSearchInfo = value; } get { return m_sSearchInfo; } } // 점검일자 private string m_sSaleDateInfo = ""; public string DateInfo { set { m_sSaleDateInfo = value; } get { return m_sSaleDateInfo; } } // 점검코드 private string m_sCheckCode = ""; public string CheckCode { set { m_sCheckCode = value; } get { return m_sCheckCode; } } // 등록 여부 확인 private string sInsertUpdate = string.Empty; #endregion 변수 선언 public frmExpiryDateCheckList() { InitializeComponent(); base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true); //this.UpdateStyles(); m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보 m_cStoreCheck = (IStoreCheck)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.STORE_CHECK); } private void frmExpiryDateCheckList_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(); // 등록여부 확인 SaveCheck(m_sSaleDateInfo, m_sCheckCode); // 체크리스트 표시 LoadDataGridView(); } private void frmExpiryDateCheckList_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); } #region 폼 컨트롤 초기화 /// /// 폼 컨트롤 초기화 /// private void InitControl() { string sSaleDate = string.Empty; 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.lblBox1, 137, 68, 220, 40); FormManager.SetControlSize(this.lblBox2, 137, 107, 220, 40); FormManager.SetControlSize(this.label2, 16, 160, 992, 2); FormManager.SetControlSize(this.lblSaleDate, 16, 68, 122, 40); FormManager.SetControlSize(this.lblCashier, 16, 107, 122, 40); FormManager.SetControlSize(this.btnSave, 908, 642, 100, 40); FormManager.SetControlSize(this.lblMemo, 370, 67, 638, 78); FormManager.SetControlSize(this.dgvCheckList, 16, 161, 992, 472); FormManager.SetControlSize(this.txtSaleDate, 153, 75, 188, 26); FormManager.SetControlSize(this.label03, 16, 67, 341, 2); FormManager.SetControlSize(this.cbCashierName, 153, 114, 188, 26); FormManager.SetControlSize(this.btnUp, 125, 634, 105, 48); FormManager.SetControlSize(this.btnDn, 234, 634, 105, 48); FormManager.SetControlSize(this.txtCheckList, 449, 336, 126, 19); FormManager.SetControlSize(this.btnPgUp, 16, 634, 105, 48); FormManager.SetControlSize(this.btnPgDn, 343, 634, 105, 48); } 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.lblBox1, 143, 68, 190, 40); FormManager.SetControlSize(this.lblBox2, 143, 107, 190, 40); FormManager.SetControlSize(this.label2, 22, 160, 756, 2); FormManager.SetControlSize(this.lblSaleDate, 22, 68, 122, 40); FormManager.SetControlSize(this.lblCashier, 22, 107, 122, 40); FormManager.SetControlSize(this.btnSave, 672, 538, 100, 40); FormManager.SetControlSize(this.lblMemo, 346, 67, 432, 78); FormManager.SetControlSize(this.dgvCheckList, 22, 161, 756, 367); FormManager.SetControlSize(this.txtSaleDate, 159, 75, 158, 26); FormManager.SetControlSize(this.label03, 22, 67, 311, 2); FormManager.SetControlSize(this.cbCashierName, 159, 114, 158, 26); FormManager.SetControlSize(this.btnUp, 131, 531, 105, 48); FormManager.SetControlSize(this.btnDn, 240, 531, 105, 48); FormManager.SetControlSize(this.txtCheckList, 449, 336, 126, 19); FormManager.SetControlSize(this.btnPgUp, 22, 531, 105, 48); FormManager.SetControlSize(this.btnPgDn, 349, 531, 105, 48); } 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); //picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE); //버튼이미지 적용 btnUp.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_105X48_UP1_BASIC); btnUp.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_105X48_UP1_PRESS); btnUp.BorderStyle = BorderStyle.None; btnDn.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_105X48_DOWN1_BASIC); btnDn.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_105X48_DOWN1_PRESS); btnDn.BorderStyle = BorderStyle.None; btnPgUp.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_105X48_UP2_BASIC); btnPgUp.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_105X48_UP2_PRESS); btnPgUp.BorderStyle = BorderStyle.None; btnPgDn.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_105X48_DOWN2_BASIC); btnPgDn.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_105X48_DOWN2_PRESS); btnPgDn.BorderStyle = BorderStyle.None; if (btnUp.DefaultImage != null) btnUp.Text = ""; if (btnDn.DefaultImage != null) btnDn.Text = ""; if (btnPgUp.DefaultImage != null) btnPgUp.Text = ""; if (btnPgDn.DefaultImage != null) btnPgDn.Text = ""; // 식품안전의날/유통기한 점검 시에는 저장버튼만 있고 닫기 버튼은 없다. btnExit.Text = ""; btnExit.Enabled = false; //btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE); //if (btnExit.Image != null) btnExit.Text = ""; // 라벨 이름 설정 lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0744); txtSaleDate.InputTypeFormat = m_cPosStatus.Global.m_stCultureMaster.strDatePattern; txtSaleDate.Text = m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate); // 버튼 이름 설정 btnSave.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0225); // 내용 lblMemo.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0452).Replace("\\r\\n", "\r\n").Replace("\\r", "\r").Replace("\\n", "\n"); // 캐셔 이름 설정 CashierComboBoxAdd(); DataGridSetting(); } 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 그리드 설정 및 사용 private void DataGridSetting() { try { int[] arColumnsWidth = { 0, 660, 110, 110, 110, 0, 0, 0, 0, 0, 0 }; int[] arColumnsAlignment = { 1, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2 }; if (m_cPosStatus.Sale.ScreenSizeUser == 800) { arColumnsWidth[1] = 424; } dgvCheckList.Columns.Clear(); dgvCheckList.Rows.Clear(); // 0:구분,1:점검항목명,2:점검여부(선택항목1),3:(선택항목2),4:(선택항목3),5:대분류코드,6:점검항목코드,7:입력구분,8:선택된NO,9:선택항목명,10:점수 dgvCheckList.Columns.Add("CheckGrpNm", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0532)); dgvCheckList.Columns.Add("CheckInfo", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0747)); dgvCheckList.Columns.Add("CheckFlag1", ""); dgvCheckList.Columns.Add("CheckFlag2", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0748)); dgvCheckList.Columns.Add("CheckFlag3", ""); dgvCheckList.Columns.Add("CheckLClssCd", ""); dgvCheckList.Columns.Add("CheckEntry", ""); dgvCheckList.Columns.Add("CheckDiv", ""); dgvCheckList.Columns.Add("CheckEntryNo", ""); dgvCheckList.Columns.Add("CheckEntryNm", ""); dgvCheckList.Columns.Add("CheckEntryScore", ""); dgvCheckList.ColumnHeadersHeight = 30; dgvCheckList.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dgvCheckList.RowHeadersVisible = false; dgvCheckList.AllowUserToAddRows = false; dgvCheckList.Font = new Font(m_cPosStatus.Base.FONT, 12); dgvCheckList.RowTemplate.Height = 40; for (int nLoop = 0; nLoop < dgvCheckList.Columns.Count; nLoop++) { dgvCheckList.Columns[nLoop].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvCheckList.Columns[nLoop].Width = arColumnsWidth[nLoop]; dgvCheckList.Columns[nLoop].Resizable = DataGridViewTriState.False; if (nLoop == 1) { dgvCheckList.Columns[nLoop].DefaultCellStyle.WrapMode = DataGridViewTriState.True; dgvCheckList.Columns[nLoop].ReadOnly = true; } else if (nLoop == 0 || nLoop >= 5) { dgvCheckList.Columns[nLoop].Visible = false; } switch (arColumnsAlignment[nLoop]) { case 0: dgvCheckList.Columns[nLoop].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; break; case 1: dgvCheckList.Columns[nLoop].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; break; default: dgvCheckList.Columns[nLoop].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; break; } dgvCheckList.Columns[nLoop].SortMode = DataGridViewColumnSortMode.NotSortable; } } 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 /// /// 캐셔 설정 /// private void CashierComboBoxAdd() { DataTable dtCashierInfo = new DataTable(); try { cbCashierName.Items.Clear(); // 캐셔마스터 조회 IMasterUs cService = (IMasterUs)sManager.InitServiceInstance(ServiceLists.ASV_MASTER.DLL, ServiceLists.ASV_MASTER.CASHIER_MASTER); dtCashierInfo = cService.Select(new string[] { }); if (dtCashierInfo != null && dtCashierInfo.Rows.Count > 0) { for (int nLoop = 0; nLoop < dtCashierInfo.Rows.Count; nLoop++) { cbCashierName.Items.Add(CmUtil.GetDataRowStr(dtCashierInfo.Rows[nLoop], PosMst.MST_USER.DATA.CASHIER_NM).PadRight(50) + CmUtil.GetDataRowStr(dtCashierInfo.Rows[nLoop], PosMst.MST_USER.DATA.CASHIER_ID)); //cbCashierName.Items.Add(CmUtil.GetDataRowStr(dtCashierInfo.Rows[nLoop], PosMst.MST_USER.DATA.CASHIER_NM)); //cbCashierName.ValueMember = CmUtil.GetDataRowStr(dtCashierInfo.Rows[nLoop], PosMst.MST_USER.DATA.CASHIER_ID); } cbCashierName.SelectedIndex = 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 Control Event private void btnExit_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } private void btnSave_Click(object sender, EventArgs e) { // 빠짐없이 입력됐는지 체크 if (AllCheck() == true) { // Loacl 저장 StoreCheckSave(); } } #region 업/다운 클릭 이벤트 /// /// 조회 그리드 업/다운 클릭 이벤트 /// /// /// private void btnSelProc_Click(object sender, EventArgs e) { try { if (dgvCheckList.Rows.Count == 0) return; int nRow = dgvCheckList.CurrentRow.Index; if ((UI.CsmButton)sender == btnUp) // 상단 그리드 Up { if (nRow > 0) { nRow--; dgvCheckList.Rows[nRow].Selected = true; dgvCheckList.Rows[nRow].Cells[dgvCheckList.CurrentCell.ColumnIndex].Selected = true; } } else if ((UI.CsmButton)sender == btnDn) // 상단 그리드 Down { if (nRow < dgvCheckList.Rows.Count - 1) { nRow++; dgvCheckList.Rows[nRow].Selected = true; dgvCheckList.Rows[nRow].Cells[dgvCheckList.CurrentCell.ColumnIndex].Selected = true; } } if ((UI.CsmButton)sender == btnPgUp) // 상단 그리드 PageUp { if (nRow > 0) { nRow -= 11; if (nRow < 0) nRow = 0; dgvCheckList.Rows[nRow].Selected = true; dgvCheckList.Rows[nRow].Cells[dgvCheckList.CurrentCell.ColumnIndex].Selected = true; } } else if ((UI.CsmButton)sender == btnPgDn) // 상단 그리드 PageDown { if (nRow < dgvCheckList.Rows.Count - 1) { nRow += 11; if (nRow >= dgvCheckList.Rows.Count) nRow = dgvCheckList.Rows.Count - 1; dgvCheckList.Rows[nRow].Selected = true; dgvCheckList.Rows[nRow].Cells[dgvCheckList.CurrentCell.ColumnIndex].Selected = true; } } txtCheckList.Visible = false; } 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 업/다운 클릭 이벤트 private void dgvCheckList_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvCheckList.RowCount <= 0 || e.RowIndex < 0) return; int nRow = e.RowIndex; // 0:구분,1:점검항목명,2:점검여부(선택항목1),3:(선택항목2),4:(선택항목3),5:대분류코드,6:점검항목코드,7:입력구분,8:선택된NO,9:선택항목명,10:점수 if (dgvCheckList.Rows[nRow].Cells[7].Value.ToString() == "2") { // 라디오 박스 int nCol = e.ColumnIndex; if ((nCol == 2 || nCol == 3 || nCol == 4) && dgvCheckList.Rows[nRow].Cells[nCol].Value.ToString() != "") { string[] sEntryName = dgvCheckList.Rows[nRow].Cells[9].Value.ToString().Split('|'); if (sEntryName[0] != "") dgvCheckList.Rows[nRow].Cells[2].Value = (nCol == 2 ? "● " : "○ ") + sEntryName[0]; if (sEntryName[1] != "") dgvCheckList.Rows[nRow].Cells[3].Value = (nCol == 3 ? "● " : "○ ") + sEntryName[1]; if (sEntryName[2] != "") dgvCheckList.Rows[nRow].Cells[4].Value = (nCol == 4 ? "● " : "○ ") + sEntryName[2]; dgvCheckList.Rows[nRow].Cells[8].Value = nCol - 1; } txtCheckList.Visible = false; } else { txtCheckList.Tag = nRow; txtCheckList.Visible = true; txtCheckList.Text = dgvCheckList.Rows[nRow].Cells[2].Value.ToString(); int nPos = nRow - dgvCheckList.FirstDisplayedScrollingRowIndex; if (m_cPosStatus.Sale.ScreenSizeUser == 1024) { txtCheckList.Location = new Point(dgvCheckList.Left + 660 + 5, dgvCheckList.Top + (nPos * 40) + 30 + 13); txtCheckList.Size = new Size(320, 25); } else { txtCheckList.Location = new Point(dgvCheckList.Left + 424 + 5, dgvCheckList.Top + (nPos * 40) + 30 + 13); txtCheckList.Size = new Size(320, 25); } txtCheckList.Update(); txtCheckList.BringToFront(); txtCheckList.Focus(); } } 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 dgvCheckList_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { try { if (e.RowIndex < dgvCheckList.RowCount - 1) e.AdvancedBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.None; else e.AdvancedBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.Single; if (e.RowIndex == 0 || (e.ColumnIndex != 0 && e.ColumnIndex != 1)) { e.AdvancedBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.Single; } else { if (e.Value.ToString() == "") { e.AdvancedBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None; } else { e.AdvancedBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.Single; } } if (e.ColumnIndex == 2 || e.ColumnIndex == 3) { e.AdvancedBorderStyle.Right = DataGridViewAdvancedCellBorderStyle.None; } if (e.ColumnIndex == 3 || e.ColumnIndex == 4) { e.AdvancedBorderStyle.Left = DataGridViewAdvancedCellBorderStyle.None; } } 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 Control Event /// /// 체크리스트 데이터 연동 /// private void LoadDataGridView() { string sInspctEntryLClssNm = ""; try { dgvCheckList.Rows.Clear(); DataTable dtData = m_cStoreCheck.StoreNoticeDTL(m_sCheckCode); if (dtData == null || dtData.Rows.Count == 0) { this.DialogResult = DialogResult.Cancel; this.Close(); return; } for (int nLoop = 0; nLoop < dtData.Rows.Count; nLoop++) { // 0:구분,1:점검항목명,2:점검여부(선택항목1),3:(선택항목2),4:(선택항목3),5:대분류코드,6:점검항목코드,7:입력구분,8:선택된NO,9:선택항목명,10:점수 string sInputDiv = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INPUT_DIV); if (sInputDiv == "2") { if (CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SEL_ENTRY_1") == "") continue; // 라디오 박스 int iRow = dgvCheckList.Rows.Add(); // 0:구분 if (sInspctEntryLClssNm != CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_GRP.DATA.INSPCT_ENTRY_L_CLSS_NM)) { dgvCheckList.Rows[iRow].Cells[0].Value = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_GRP.DATA.INSPCT_ENTRY_L_CLSS_NM); } else { dgvCheckList.Rows[iRow].Cells[0].Value = ""; } // 1:점검항목명 dgvCheckList.Rows[iRow].Cells[1].Value = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INSPCT_ENTRY_NM); int nRadioCnt = CmUtil.GetDataRowInt(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.SEL_ENTRY_CNT); string sEntryName = "", sScore = ""; if (nRadioCnt >= 1) { sEntryName = CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SEL_ENTRY_1") + "|"; sScore = CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SCORE_1") + "|"; // 2:점검여부(선택항목) dgvCheckList.Rows[iRow].Cells[2].Value = "○ " + CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SEL_ENTRY_1"); dgvCheckList.Rows[iRow].Cells[2].ReadOnly = true; } else { dgvCheckList.Rows[iRow].Cells[2].Value = ""; } if (nRadioCnt >= 2) { sEntryName += CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SEL_ENTRY_2") + "|"; sScore += CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SCORE_2") + "|"; // 3:점검여부(선택항목2) dgvCheckList.Rows[iRow].Cells[3].Value = "○ " + CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SEL_ENTRY_2"); dgvCheckList.Rows[iRow].Cells[3].ReadOnly = true; } else { dgvCheckList.Rows[iRow].Cells[3].Value = ""; } if (nRadioCnt >= 3) { sEntryName += CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SEL_ENTRY_3") + "|"; sScore += CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SCORE_3") + "|"; // 4:점검여부(선택항목3) dgvCheckList.Rows[iRow].Cells[4].Value = "○ " + CmUtil.GetDataRowStr(dtData.Rows[nLoop], "SEL_ENTRY_3"); dgvCheckList.Rows[iRow].Cells[4].ReadOnly = true; } else { dgvCheckList.Rows[iRow].Cells[4].Value = ""; } // 5:대분류코드 dgvCheckList.Rows[iRow].Cells[5].Value = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INSPCT_ENTRY_L_CLSS_CD); // 6:점검항목코드 dgvCheckList.Rows[iRow].Cells[6].Value = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INSPCT_ENTRY); // 7:입력구분 dgvCheckList.Rows[iRow].Cells[7].Value = sInputDiv; // 8:선택항목NO dgvCheckList.Rows[iRow].Cells[8].Value = ""; // 9:선택항목명 dgvCheckList.Rows[iRow].Cells[9].Value = sEntryName; // 10:점수 dgvCheckList.Rows[iRow].Cells[10].Value = sScore; } else { // 입력 박스 int iRow = dgvCheckList.Rows.Add(); // 0:구분 if (sInspctEntryLClssNm != CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_GRP.DATA.INSPCT_ENTRY_L_CLSS_NM)) { dgvCheckList.Rows[iRow].Cells[0].Value = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_GRP.DATA.INSPCT_ENTRY_L_CLSS_NM); } else { dgvCheckList.Rows[iRow].Cells[0].Value = ""; } // 1:점검항목명 dgvCheckList.Rows[iRow].Cells[1].Value = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INSPCT_ENTRY_NM); // 2:점검여부(선택항목) dgvCheckList.Rows[iRow].Cells[2].Value = ""; dgvCheckList.Rows[iRow].Cells[3].Value = ""; dgvCheckList.Rows[iRow].Cells[4].Value = ""; // 5:대분류코드 dgvCheckList.Rows[iRow].Cells[5].Value = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INSPCT_ENTRY_L_CLSS_CD); // 6:점검항목코드 dgvCheckList.Rows[iRow].Cells[6].Value = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INSPCT_ENTRY); // 7:입력구분 dgvCheckList.Rows[iRow].Cells[7].Value = sInputDiv; // 8:선택항목NO dgvCheckList.Rows[iRow].Cells[8].Value = ""; // 9:선택항목명 dgvCheckList.Rows[iRow].Cells[9].Value = ""; // 10:점수 dgvCheckList.Rows[iRow].Cells[10].Value = ""; } sInspctEntryLClssNm = CmUtil.GetDataRowStr(dtData.Rows[nLoop], PosMst.MST_SALESORG_INSPCT_GRP.DATA.INSPCT_ENTRY_L_CLSS_NM); } txtCheckList.Visible = false; } 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 bool AllCheck() { bool bRet = false; int nCnt = 0; try { if (dgvCheckList.RowCount <= 0) { this.DialogResult = DialogResult.Cancel; this.Close(); return false; } // 0:구분,1:점검항목명,2:점검여부(선택항목1),3:(선택항목2),4:(선택항목3),5:대분류코드,6:점검항목코드,7:입력구분,8:선택된NO,9:선택항목명,10:점수 for (int iRow = 0; iRow < dgvCheckList.RowCount; iRow++) { if (dgvCheckList.Rows[iRow].Cells[7].Value.ToString() == "2") { // 라디오 버튼 if (CmUtil.LongParse(dgvCheckList.Rows[iRow].Cells[8].Value.ToString()) == 0) { nCnt++; } } else { // 입력 박스 if (dgvCheckList.Rows[iRow].Cells[2].EditedFormattedValue == null || dgvCheckList.Rows[iRow].Cells[2].EditedFormattedValue.ToString() == "") { nCnt++; } } } if (nCnt > 0) { WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0436)); return bRet; } bRet = true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return bRet; } /// /// 저장여부 확인 /// /// /// private void SaveCheck(string sSaleDate, string sInspctEntryGrpCd) { bool bRet = false; try { bRet = m_cStoreCheck.StoreSaveCheckLoacl(sSaleDate, sInspctEntryGrpCd); if (bRet == true) { sInsertUpdate = "1"; } else { sInsertUpdate = "0"; } } 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 StoreCheckSave() { string sRet = UserCom.RST_ERR; //string sInsertUpdate = string.Empty; try { if (dgvCheckList.RowCount <= 0) { this.DialogResult = DialogResult.Cancel; this.Close(); return; } string sRegUserId = cbCashierName.Text.Substring(50); // 선택된 판매원 // 점포 점검 리스트(헤더) DataTable dtData1 = new DataTable(); dtData1.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.INSPCT_ENTRY_GRP_CD, typeof(string))); dtData1.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.START_DT, typeof(string))); dtData1.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.ETC_CTNTS_1, typeof(string))); dtData1.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.ETC_CTNTS_2, typeof(string))); dtData1.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.ETC_CTNTS_3, typeof(string))); dtData1.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.REG_USER_ID, typeof(string))); // 점포 점검 리스트(디테일) DataTable dtData2 = new DataTable(); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.INSPCT_ENTRY_GRP_CD, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.INSPCT_ENTRY_L_CLSS_CD, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.INSPCT_ENTRY, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.START_DT, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_1_YN, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_2_YN, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_3_YN, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_4_YN, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_5_YN, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_1, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_2, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_3, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_4, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_5, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_1_CTNTS, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_2_CTNTS, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_3_CTNTS, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_4_CTNTS, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_5_CTNTS, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.NOTE, typeof(string))); dtData2.Columns.Add(new DataColumn(Column.ETC_STOR_INSPCT_ANSWR.NAME.REG_USER_ID, typeof(string))); // 점포점검 마스터 헤더 값 설정 DataRow dr1 = dtData1.NewRow(); dr1[Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.INSPCT_ENTRY_GRP_CD] = m_sCheckCode; dr1[Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.START_DT] = m_cPosStatus.Global.CultureToDate(txtSaleDate.Text); dr1[Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.REG_USER_ID] = sRegUserId; dr1[Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.ETC_CTNTS_1] = ""; dr1[Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.ETC_CTNTS_2] = ""; dr1[Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.ETC_CTNTS_3] = ""; dtData1.Rows.Add(dr1); // 0:구분,1:점검항목명,2:점검여부(선택항목1),3:(선택항목2),4:(선택항목3),5:대분류코드,6:점검항목코드,7:입력구분,8:선택된NO,9:선택항목명,10:점수 for (int i = 0; i < dgvCheckList.RowCount; i++) { DataRow dr2 = dtData2.NewRow(); dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.INSPCT_ENTRY_GRP_CD] = m_sCheckCode; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.INSPCT_ENTRY_L_CLSS_CD] = ((string)dgvCheckList.Rows[i].Cells[5].Value); dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.INSPCT_ENTRY] = ((string)dgvCheckList.Rows[i].Cells[6].Value); dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.START_DT] = m_cPosStatus.Global.CultureToDate(txtSaleDate.Text); dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_1_YN] = "0"; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_2_YN] = "0"; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_3_YN] = "0"; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_4_YN] = "0"; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_5_YN] = "0"; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_1] = 0; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_2] = 0; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_3] = 0; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_4] = 0; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_5] = 0; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_1_CTNTS] = ""; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_2_CTNTS] = ""; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_3_CTNTS] = ""; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_4_CTNTS] = ""; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_5_CTNTS] = ""; dr2[Column.ETC_STOR_INSPCT_ANSWR_STOR.NAME.REG_USER_ID] = sRegUserId; //cbCashierName.ValueMember; if (dgvCheckList.Rows[i].Cells[7].Value.ToString() == "2") { // 라디오 버튼 string sSelNo = dgvCheckList.Rows[i].Cells[8].Value.ToString(); string[] sEntryScore = dgvCheckList.Rows[i].Cells[10].Value.ToString().Split('|'); dr2["SEL_ENTRY_" + sSelNo + "_YN"] = "1"; dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SCORE_1] = sEntryScore[CmUtil.IntParse(sSelNo) - 1]; } else { // 입력 박스 dr2[Column.ETC_STOR_INSPCT_ANSWR.NAME.SEL_ENTRY_1_CTNTS] = (string)dgvCheckList.Rows[i].Cells[2].EditedFormattedValue; } dtData2.Rows.Add(dr2); } sRet = m_cStoreCheck.StoreCheckSave(sInsertUpdate, dtData1, dtData2); if (sRet == 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 txtCheckList_TextChanged(object sender, EventArgs e) { try { int nRow = CmUtil.IntParse(txtCheckList.Tag.ToString()); dgvCheckList.Rows[nRow].Cells[2].Value = txtCheckList.Text; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } } }