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.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 ProductManager : CommonMDI
{
public ProductManager()
{
InitializeComponent();
textEdit_Search.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
searchProc();
}
};
gridView_Main.FocusedRowChanged += (sender, e) =>
{
DataRow row = gridView_Main.GetFocusedDataRow();
gridView_Main.Columns["ITEM_CD"].OptionsColumn.AllowEdit = row != null && (row.RowState == DataRowState.Added || row.RowState == DataRowState.Detached);
};
this.Shown += (sender, e) =>
{
GetLookupData();
searchProc();
};
}
private void GetLookupData()
{
try
{
SerializedSqlParam[] aParam;
ResultData data;
aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("MENU_ID", SqlDbType.NVarChar, this.m_MenuID),
ClientClass.CreateSqlParameter("USR_ID", SqlDbType.NVarChar, ConstClass._USR_ID)
};
data = ClientClass.GetData("GetCompanyListByMenuUser", aParam);
if (data.isError)
{
throw new Exception(data.ResultValue);
}
UtilClass.SetLookup(lookUpEdit_COMP_CD, data.TableData, "COMP_CD", "COMP_NM", true);
aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, lookUpEdit_COMP_CD.EditValue)
};
data = ClientClass.GetData("GetRoutingForLookup", aParam);
if (data.isError)
{
throw new Exception(data.ResultValue);
}
UtilClass.SetLookup(lookUpEdit_ROUT_CD, data.TableData, "ROUT_CD", "ROUT_NM", true);
data = ClientClass.GetData("GetRoutingManagerForLookup", aParam);
if (data.isError)
{
throw new Exception(data.ResultValue);
}
UtilClass.SetLookup(repositoryItemLookUpEdit_ROUT_CD, data.TableData, "ROUT_CD", "ROUT_NM", true);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
this.Close();
}
}
public override void searchProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
gridControl_Main.DataSource = null;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, lookUpEdit_COMP_CD.EditValue),
ClientClass.CreateSqlParameter("ROUT_CD", SqlDbType.NVarChar, lookUpEdit_ROUT_CD.EditValue),
ClientClass.CreateSqlParameter("SEARCH", SqlDbType.NVarChar, textEdit_Search.Text)
};
ResultData result = ClientClass.GetData("GetProductManager", aParam);
if (result.isError)
{
throw new Exception(result.ResultValue);
}
gridControl_Main.DataSource = result.TableData;
lookUpEdit_COMP_CD.Tag = lookUpEdit_COMP_CD.EditValue;
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
public override void newProc()
{
gridView_Main.PostEditor();
gridView_Main.UpdateCurrentRow();
gridView_Main.AddNewRow();
gridView_Main.GetFocusedDataRow()["COMP_CD"] = UtilClass.toStr(lookUpEdit_COMP_CD.Tag);
gridView_Main.GetFocusedDataRow()["ITEM_KIND"] = "01";
gridView_Main.Focus();
gridView_Main.FocusedColumn = gridView_Main.Columns["ITEM_CD"];
}
public override void deleteProc()
{
gridView_Main.PostEditor();
gridView_Main.UpdateCurrentRow();
Application.DoEvents();
DataTable data = gridControl_Main.DataSource as DataTable;
DataRow[] rows = data.Select("SEL_YN = 'Y'");
if (rows == null || rows.Length < 1)
{
MessageBox.Show("삭제할 항목을 선택하십시오.");
return;
}
foreach (DataRow row in rows)
{
row.Delete();
}
}
public override void saveProc()
{
try
{
if (gridControl_Main.DataSource == null)
{
return;
}
this.Cursor = Cursors.WaitCursor;
gridView_Main.PostEditor();
gridView_Main.UpdateCurrentRow();
Application.DoEvents();
DataRow row = gridView_Main.GetFocusedDataRow();
string item_nm = "";
if (row != null)
{
item_nm = UtilClass.toStr(row["ITEM_NM"]);
}
DataTable aData = gridControl_Main.DataSource as DataTable;
ResultData[] dataList = null;
ResultData data1 = new ResultData();
DataTable dtData1 = UtilClass.GetDataTable(aData, true,
"ITEM_CD", "ROUT_CD", "ITEM_NM", "ITEM_KIND", "ITEM_W", "ITEM_T", "ITEM_L",
"UNIT_WT", "PO_UNIT_MY", "UNIT_MY", "STOCK_MGR_YN", "SAFE_STOCK_QTY", "ITEM_RMK", "DEL_YN", "DEL_DT"
);
dtData1.TableName = "ADATA";
data1.TableData = dtData1;
for (int i = 0; i < dtData1.Rows.Count; i++)
{
if (UtilClass.isNull(dtData1.Rows[i]["ITEM_NM"]))
{
throw new Exception("작업명이 입력되지 않았습니다.");
}
}
dataList = new ResultData[] { data1 };
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, lookUpEdit_COMP_CD.Tag),
ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID),
ClientClass.CreateSqlParameter("RESULT_STR", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData result = ClientClass.SetTableData("SaveProductManager", dataList, aParam);
if (result.isError)
{
throw new Exception(result.ResultValue);
}
MessageBox.Show("정상적으로 저장하였습니다.");
searchProc();
if (!UtilClass.isNull(item_nm))
{
for (int i = 0; i < gridView_Main.RowCount; i++)
{
if (UtilClass.isEqual(item_nm, gridView_Main.GetDataRow(i)["ITEM_NM"]))
{
gridView_Main.FocusedRowHandle = i;
break;
}
}
}
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
}
}