File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
using ClientLib;
using ClientLib.CommonService;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.BandedGrid;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Nodes;
using PublicLib;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HANMI_STD
{
public partial class CurrentMoneyManager : CommonMDI
{
DataView m_Group_View;
DataView m_Code_View;
DataView m_Code_Type;
string m_Item_CD = "";
string m_new_Grp_CD = "";
public CurrentMoneyManager()
{
InitializeComponent();
this.Shown += (sender, e) =>
{
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, "")
};
ResultData result = ClientClass.GetData("U3GetCurrentMoney", aParam);
if (result.isError)
{
throw new Exception(result.ResultValue);
}
textEdit_Search.Text = m_Item_CD;
gridControl_Main.DataSource = result.DataList.Tables[0];
DataRow row = bandedGridView_Main.GetFocusedDataRow();
m_Item_CD = row["ITEM_CD"].ToString();
searchProc();
};
gridControl_Main.DoubleClick += (sender, e) =>
{
DataRow row = bandedGridView_Main.GetFocusedDataRow();
m_Item_CD = row["ITEM_CD"].ToString();
if (row != null)
{
searchProc();
}
};
gridControl_Main.KeyPress += (sender, e) =>
{
DataRow row = bandedGridView_Main.GetFocusedDataRow();
m_Item_CD = row["ITEM_CD"].ToString();
if (e.KeyChar == '\r')
{
searchProc();
}
};
simpleButton_AddMoney.Click += (sender, e) =>
{
bandedGridView_Code.AddNewRow();
bandedGridView_Code.GetFocusedDataRow()["COMP_CD"] = ConstClass._COMP_CD;
bandedGridView_Code.GetFocusedDataRow()["ITEM_CD"] = m_Item_CD;
};
simpleButton_AddGroup.Click += (sender, e) =>
{
try
{
this.Cursor = Cursors.WaitCursor;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_Item_CD),
ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData result = ClientClass.GetData("U3GetMaxCurrentMoneyGroup", aParam);
if (result.isError)
{
throw new Exception(result.ResultValue);
}
if(result!=null && result.TableData.Rows.Count==1 && result.TableData.Rows[0].ItemArray.Length ==1 && m_new_Grp_CD != result.TableData.Rows[0].ItemArray[0].ToString())
{
bandedGridView_Group.AddNewRow();
bandedGridView_Group.GetFocusedDataRow()["COMP_CD"] = ConstClass._COMP_CD;
bandedGridView_Group.GetFocusedDataRow()["ITEM_CD"] = m_Item_CD;
bandedGridView_Group.GetFocusedDataRow()["GRP_CD"] = result.TableData.Rows[0].ItemArray[0].ToString();
m_new_Grp_CD = result.TableData.Rows[0].ItemArray[0].ToString();
bandedGridView_Group.Focus();
}
bandedGridView_Group.Focus();
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
};
simpleButton_DeleteGroup.Click += (sender, e) =>
{
DataRow row = bandedGridView_Group.GetFocusedDataRow();
if (XtraMessageBox.Show(this,"[" + row["GRP_CD"].ToString() + "]\r\n삭제된 데이터는 완전히 지워집니다.\r\n 정말로 삭제하시겠습니까?","Delete", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
this.Cursor = Cursors.WaitCursor;
DataTable aData = new DataTable();
ResultData[] dataList = null;
ResultData data1 = new ResultData();
SerializedSqlParam[] aParam = new SerializedSqlParam[]
{
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_Item_CD),
ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, row["GRP_CD"].ToString()),
ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData result = ClientClass.SetTableData("U3DeleteCurrentMoney", dataList, aParam);
if (result.isError || !UtilClass.isNull(result.ResultValue))
{
throw new Exception(result.ResultValue);
}
searchProc();
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
};
repositoryItemButtonEdit1.ButtonClick += (sender, e) =>
{
DataRow row = bandedGridView_Group.GetFocusedDataRow();
if (row["ITEM_GRP"].ToString() == "")
{
XtraMessageBox.Show("그룹명이 입력되지 않았습니다.");
return;
}
SelectCurrentMoneyGroupForm scmgf = new SelectCurrentMoneyGroupForm("", row["GRP_CD"].ToString(), row["ITEM_CD"].ToString());
if(scmgf.ShowDialog() != DialogResult.No)
{
searchProc();
}
};
bandedGridView_Group.CellValueChanged += (sender, e) =>
{
DataRow row = bandedGridView_Group.GetFocusedDataRow();
try
{
if (row != null)
{
if (bandedGridView_Group.FocusedColumn.FieldName == "ITEM_GRP" && row["ITEM_GRP"].ToString() != "")
{
try
{
this.Cursor = Cursors.WaitCursor;
DataTable aData = new DataTable();
ResultData[] dataList = null;
ResultData data1 = new ResultData();
SerializedSqlParam[] aParam = new SerializedSqlParam[]
{
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_Item_CD),
ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, row["GRP_CD"].ToString()),
ClientClass.CreateSqlParameter("ITEM_GRP", SqlDbType.NVarChar,row["ITEM_GRP"].ToString()),
ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData result = ClientClass.SetTableData("U3SaveCurrentMoneyGroup", dataList, aParam);
if (result.isError || !UtilClass.isNull(result.ResultValue))
{
throw new Exception(result.ResultValue);
}
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
}
}
catch (Exception ex)
{
}
};
bandedGridView_Code.CellValueChanged += (sender, e) =>
{
DataRow row = bandedGridView_Code.GetFocusedDataRow();
try
{
if (row != null)
{
if (row[bandedGridView_Code.FocusedColumn.FieldName].ToString() != row["ITEM_QTY"].ToString() && row["ITEM_QTY"]!= null && row["ITEM_QTY"].ToString() != "" && row["ITEM_QTY"].ToString() != "0")
{
try
{
this.Cursor = Cursors.WaitCursor;
DataTable aData = new DataTable();
ResultData[] dataList = null;
ResultData data1 = new ResultData();
string sfield = "";
if (bandedGridView_Code.FocusedColumn.FieldName == "STANDARD")
{
sfield = "";
}else
{
sfield = bandedGridView_Code.FocusedColumn.FieldName;
}
SerializedSqlParam[] aParam = new SerializedSqlParam[]
{
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_Item_CD),
ClientClass.CreateSqlParameter("ITEM_GRP", SqlDbType.NVarChar, sfield),
ClientClass.CreateSqlParameter("ITEM_QTY", SqlDbType.Int, row["ITEM_QTY"].ToString()),
ClientClass.CreateSqlParameter("ITEM_MY", SqlDbType.Int, row[bandedGridView_Code.FocusedColumn.FieldName].ToString()),
ClientClass.CreateSqlParameter("RESULT_STR", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData result = ClientClass.SetTableData("U3SaveCurrentmoney", dataList, aParam);
if (result.isError || !UtilClass.isNull(result.ResultValue))
{
throw new Exception(result.ResultValue);
}
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
//MessageBox.Show(row[bandedGridView_Code.FocusedColumn.Caption].ToString());
}
}
}
catch (Exception ex)
{
}
};
}
public override void searchProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
m_new_Grp_CD = "";
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_Item_CD)
};
ResultData result = ClientClass.GetData("U3GetCurrentMoney", aParam);
if (result.isError)
{
throw new Exception(result.ResultValue);
}
textEdit_Search.Text = m_Item_CD;
gridControl_Main.DataSource = result.DataList.Tables[0];
m_Group_View = new DataView(result.DataList.Tables[1]);
m_Code_Type = new DataView(result.DataList.Tables[2]);
m_Code_View = new DataView(result.DataList.Tables[3]);
if (result.DataList.Tables[0].Rows.Count > 0)
{
m_Group_View.RowFilter = " ITEM_CD like '%" + m_Item_CD + "%'";
}
gridControl_Group.DataSource = m_Group_View;
gridBand3.Columns.Clear();
bandedGridView_Code.Columns.Clear();
gridBand3.Columns.Add(GetGridColumn("grid_view_COMP_CD", "COMP_CD", "회사코드", false,true,100));
gridBand3.Columns.Add(GetGridColumn("grid_view_ITEM_CD", "ITEM_CD", "작업코드", false, true,100));
gridBand3.Columns.Add(GetGridColumn("grid_view_PrevITEM_QTY", "PrevITEM_QTY", "수량~", true,true,30));
gridBand3.Columns.Add(GetGridColumn("grid_view_ITEM_QTY", "ITEM_QTY", "~수량", true,false,30));
gridBand3.Columns.Add(GetGridColumn("grid_view_ITEM_STANDARD", "STANDARD", "기준값", true,false,50));
if (m_Code_Type != null && m_Code_Type.Count > 0)
{
for (int i = 0; i < m_Code_Type.Table.Rows.Count; i++)
{
gridBand3.Columns.Add(GetGridColumn("grid_view_"+ m_Code_Type.Table.Rows[i].ItemArray[0].ToString(), m_Code_Type.Table.Rows[i].ItemArray[0].ToString(), m_Code_Type.Table.Rows[i].ItemArray[0].ToString(), true,false,50));
}
}
gridControl_Code.DataSource = m_Code_View;
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
private BandedGridColumn GetGridColumn(string name, string fieldName, string caption, bool visible, bool bReadonly, int width)
{
BandedGridColumn column = new BandedGridColumn();
column.Name = name;
column.FieldName = fieldName;
column.Caption = caption;
column.Visible = visible;
column.OptionsColumn.ReadOnly = bReadonly;
column.OptionsColumn.AllowEdit = !bReadonly;
column.Width = width;
return column;
}
public override void newProc()
{
}
public override void deleteProc()
{
}
public override void saveProc()
{
}
}
}