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.XtraGrid.Views.Grid.ViewInfo;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraEditors;
using PublicLib;
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;
namespace HANMI_MACH
{
public partial class MachineMATManager : PublicLib.CommonMDI
{
public MachineMATManager()
{
InitializeComponent();
textEdit_Search.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
searchProc();
}
};
gridView_MAT.FocusedRowChanged += (sender, e) =>
{
DataRow row = gridView_MAT.GetFocusedDataRow();
gridView_MAT.Columns["MACH_CD"].OptionsColumn.AllowEdit = row != null && (row.RowState == DataRowState.Added || row.RowState == DataRowState.Detached);
};
this.Shown += (sender, e) =>
{
try
{
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD)
};
ResultData resultMACH = ClientClass.GetData("getMachineForLookup", aParam);
if (resultMACH.isError)
{
throw new Exception(resultMACH.ResultValue);
}
UtilClass.SetLookup(lookUpEdit_MACH_CD, resultMACH.DataList.Tables[0], "MACH_CD", "MACH_NM", true);
UtilClass.SetLookup(replookupedit_MACH_CD, resultMACH.DataList.Tables[1], "MACH_CD", "MACH_NM", true);
searchProc();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
this.Close();
}
};
}
public override void searchProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
gridControl_MAT.DataSource = null;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("MACH_CD", SqlDbType.NVarChar, lookUpEdit_MACH_CD.EditValue),
ClientClass.CreateSqlParameter("SEARCH", SqlDbType.NVarChar, textEdit_Search.Text)
};
ResultData resultData = ClientClass.GetData("GetMachineMATManager", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
gridControl_MAT.DataSource = resultData.TableData;
lookUpEdit_MACH_CD.Tag = lookUpEdit_MACH_CD.EditValue;
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
public override void newProc()
{
try
{
gridView_MAT.AddNewRow();
gridView_MAT.GetFocusedDataRow()["COMP_CD"] = ConstClass._COMP_CD;
gridView_MAT.GetFocusedDataRow()["MACH_CD"] = lookUpEdit_MACH_CD.Tag;
gridView_MAT.GetFocusedDataRow()["MAT_CD"] = "AUTO";
gridView_MAT.PostEditor();
gridView_MAT.UpdateCurrentRow();
gridView_MAT.Focus();
if (UtilClass.toStr(lookUpEdit_MACH_CD.Tag) == "ALL")
{
gridView_MAT.FocusedColumn = gridView_MAT.Columns["MACH_CD"];
}
else
{
gridView_MAT.FocusedColumn = gridView_MAT.Columns["MAT_NM"];
}
// gridView_MAT.ShowEditForm();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public override void updateProc()
{
}
public override void deleteProc()
{
gridView_MAT.PostEditor();
gridView_MAT.UpdateCurrentRow();
Application.DoEvents();
DataTable data = gridControl_MAT.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
{
this.Cursor = Cursors.WaitCursor;
gridView_MAT.PostEditor();
gridView_MAT.UpdateCurrentRow();
Application.DoEvents();
DataRow row = gridView_MAT.GetFocusedDataRow();
string MACH_CD = "";
if (row != null)
{
MACH_CD = UtilClass.toStr(row["MACH_CD"]);
}
DataTable bData = gridControl_MAT.DataSource as DataTable;
ResultData[] dataList = null;
ResultData data2 = new ResultData();
DataTable dtData2 = UtilClass.GetDataTable(bData, true,
"COMP_CD", "MACH_CD", "MAT_CD", "MAT_NM",
"MAT_NORM", "UNIT_WT", "UNIT_MY", "AS_LEAD_TIME"
);
dtData2.TableName = "ADATA";
data2.TableData = dtData2;
dataList = new ResultData[] { data2 };
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID),
ClientClass.CreateSqlParameter("RESULT_STR", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData result = ClientClass.SetTableData("[SaveMACHINEMATManager]", dataList, aParam);
if (result.isError || !UtilClass.isNull(result.ResultValue))
{
throw new Exception(result.ResultValue);
}
this.Cursor = Cursors.Arrow;
MessageBox.Show("정상적으로 저장하였습니다.");
searchProc();
//if (!UtilClass.isNull(item_cd))
//{
// for (int i = 0; i < gridView_Main.RowCount; i++)
// {
// if (UtilClass.isEqual(item_cd, gridView_Main.GetDataRow(i)["ITEM_CD"]))
// {
// gridView_Main.FocusedRowHandle = i;
// break;
// }
// }
//}
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
public override void excelProc()
{
this.ExportExcelGrid(gridControl_MAT);
}
}
}