File name
Commit message
Commit date
File name
Commit message
Commit date
using ClientLib;
using ClientLib.CommonService2;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
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_SALE
{
public partial class OrderManager : PublicLib.CommonMDI
{
Timer m_Timer;
private string m_ORDER_NO;
public OrderManager()
{
InitializeComponent();
textEdit_CUST_NM.ImeMode = System.Windows.Forms.ImeMode.Hangul;
textEdit_ITEM_NM.ImeMode = System.Windows.Forms.ImeMode.Hangul;
m_Timer = new Timer();
m_Timer.Enabled = false;
m_ORDER_NO = "";
dateEdit_SDATE.DateTime = DateTime.Now;
dateEdit_FDATE.DateTime = DateTime.Now;
labelControl_SDATE_YO.Text = GetDay(DateTime.Now) + "부터";
labelControl_FDATE_YO.Text = GetDay(DateTime.Now) + "까지";
gridControl_Main.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridControl_Main.LookAndFeel.UseDefaultLookAndFeel = false;
gridView_Main.Appearance.HeaderPanel.BackColor = Color.FromArgb(170, 204, 255);
simpleButton_ITEM_Search.Click += (sender, e) =>
{
selectItemProc();
};
simpleButton_OUT_EXT_DATE.Click += (sender, e) =>
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (row == null)
{
return;
}
string order_no = UtilClass.toStr(row["ORDER_NO"]);
int ln_seq = UtilClass.toInt(row["LN_SEQ"]);
SelectFinishForm form = new SelectFinishForm(order_no, ln_seq);
if (form.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
{
searchProc();
}
};
simpleButton_ALARM.Click += (sender, e) =>
{
AlarmMessageForm form = new AlarmMessageForm();
form.ShowDialog();
};
simpleButton_UP.Click += (sender, e) =>
{
if (XtraMessageBox.Show("최근 수정으로 올리시겠습니까?", "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
saveInputTimeProc();
}
};
comboBoxEdit_ORDER_BY.EditValueChanged += (sender, e) =>
{
searchProc();
};
lookUpEdit_ROUT_CD.EditValueChanged += (sender, e) =>
{
searchProc();
};
dateEdit_SDATE.EditValueChanged += (sender, e) =>
{
labelControl_SDATE_YO.Text = GetDay(dateEdit_SDATE.DateTime) + "부터";
};
dateEdit_FDATE.EditValueChanged += (sender, e) =>
{
labelControl_FDATE_YO.Text = GetDay(dateEdit_FDATE.DateTime) + "까지";
};
simpleButton_Cust_Search.Click += (sender, e) =>
{
selectCustProc();
};
textEdit_CUST_NM.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
selectCustProc();
}
};
textEdit_CUST_NM.EditValueChanged += (sender, e) =>
{
if (UtilClass.isNull(textEdit_CUST_NM.Text))
{
labelControl_CUST_CD.Text = "";
}
};
textEdit_ITEM_NM.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
selectItemProc();
}
};
textEdit_ITEM_NM.EditValueChanged += (sender, e) =>
{
if (UtilClass.isNull(textEdit_ITEM_NM.Text))
{
labelControl_ITEM_CD.Text = "";
}
};
gridView_Main.CustomDrawCell += (sender, e) =>
{
DataRow row = gridView_Main.GetDataRow(e.RowHandle);
if (!UtilClass.isEqual(row["BILL_NO"], ""))
{
e.Appearance.BackColor = Color.FromArgb(206, 254, 188);
e.Appearance.ForeColor = Color.DarkBlue;
}
};
gridView_Main.DoubleClick += (sender, e) =>
{
Point aPT = gridControl_Main.PointToClient(Control.MousePosition);
GridHitInfo aInfo = gridView_Main.CalcHitInfo(aPT);
if (aInfo.InRowCell)
{
DataRow aRow = gridView_Main.GetFocusedDataRow();
string bill_no = UtilClass.toStr(aRow["BILL_NO"]);
if(!UtilClass.isNull(bill_no))
{
string message = "계산서번호 " + bill_no + " 로 계산서 발행된 자료입니다.\r\r" +
"수정 및 삭제작업을 할 수 없습니다.\r\r" +
"계산서 발행을 취소한 후에 작업하시기 바랍니다.";
XtraMessageBox.Show(message);
return;
}
updateProc();
}
};
gridView_Main.FocusedRowChanged += (sender, e) =>
{
};
dateEdit_FDATE.KeyPress += (sender, e) =>
{
searchProc();
};
m_Timer.Tick += (sender, e) =>
{
DateTime dt = DateTime.Now;
string datePart = dt.ToString("yyyy-MM-dd HH:mm:ss");
labelControl_Time.Text = datePart;
};
simpleButton_New.Click += (sender, e) =>
{
newProc();
};
simpleButton_Search.Click += (sender, e) =>
{
searchProc();
};
simpleButton_Print.Click += (sender, e) =>
{
printProc();
};
simpleButton_Excel_Save.Click += (sender, e) =>
{
excelProc();
};
simpleButton_Close.Click += (sender, e) =>
{
this.Close();
};
//gridView_Main.FormatConditions.Clear();
//StyleFormatCondition sfc = new StyleFormatCondition(FormatConditionEnum.NotEqual, gridView_Main.Columns["ECOUNT_NO"], null, "");
//sfc.ApplyToRow = true;
//sfc.Appearance.BackColor = Color.WhiteSmoke;
//gridView_Main.FormatConditions.Add(sfc);
this.Shown += (sender, e) =>
{
dateEdit_SDATE.Focus();
//시간 설정.
m_Timer.Interval = 100;
m_Timer.Enabled = true;
try
{
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD)
};
ResultData result = ClientClass.GetData("GetRoutingManager", aParam);
if (result.isError)
{
throw new Exception(result.ResultValue);
}
UtilClass.SetLookup(lookUpEdit_ROUT_CD, result.TableData, "ROUT_CD", "ROUT_NM", true, true);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
searchProc();
};
}
private void selectCustProc()
{
SelectCustomerForm form = new SelectCustomerForm(textEdit_CUST_NM.Text);
if (form.ShowDialog() != System.Windows.Forms.DialogResult.Yes)
{
return;
}
textEdit_CUST_NM.Text = form.m_CUST_NN;
labelControl_CUST_CD.Text = form.m_CUST_CD;
searchProc();
}
private void selectItemProc()
{
SelectItemForm form = new SelectItemForm(textEdit_ITEM_NM.Text);
form.TopMost = true;
if (form.ShowDialog() != System.Windows.Forms.DialogResult.Yes)
{
return;
}
labelControl_ITEM_CD.Text = form.m_ITEM_CD;
textEdit_ITEM_NM.Text = form.m_ITEM_NM;
textEdit_ITEM_NM.Focus();
searchProc();
}
public override void searchProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
gridControl_Main.DataSource = null;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text),
ClientClass.CreateSqlParameter("SDATE", SqlDbType.NVarChar, dateEdit_SDATE.DateTime.ToString("yyyy-MM-dd")),
ClientClass.CreateSqlParameter("FDATE", SqlDbType.NVarChar, dateEdit_FDATE.DateTime.ToString("yyyy-MM-dd")),
ClientClass.CreateSqlParameter("ROUT_CD", SqlDbType.NVarChar, lookUpEdit_ROUT_CD.EditValue),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, labelControl_ITEM_CD.Text),
ClientClass.CreateSqlParameter("ORDER_BY", SqlDbType.Int, comboBoxEdit_ORDER_BY.SelectedIndex)
};
// kang 19.06.06 : GetOrderManager => GetOrderManagerNew
ResultData resultData = ClientClass.GetData("GetOrderManagerNew", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
DataTable aData = resultData.TableData;
string last_order_no = "";
foreach (DataRow arow in aData.Rows)
{
//if (UtilClass.isEqual(arow["LN_SEQ"], "01"))
//{
// continue;
//}
if (UtilClass.isEqual(arow["ORDER_NO"], last_order_no) == false)
{
last_order_no = UtilClass.toStr(arow["ORDER_NO"]);
continue;
}
arow["FILE_NM"] = "";
arow["PRINT_POS"] = "";
arow["OUT_POS"] = "";
arow["IN_FIN_YN"] = "";
arow["IN_USR_NM"] = "";
arow["IN_DATE"] = "";
arow["OUT_YN"] = "";
arow["OUT_USR_NM"] = "";
arow["OUT_DATE"] = "";
}
gridControl_Main.DataSource = aData;
aData.AcceptChanges();
gridView_Main.SortInfo.Clear();
this.Cursor = Cursors.Arrow;
if (!UtilClass.isNull(m_ORDER_NO))
{
for (int i = 0; i < gridView_Main.RowCount; i++)
{
if (UtilClass.isEqual(gridView_Main.GetDataRow(i)["ORDER_NO"], m_ORDER_NO))
{
gridView_Main.FocusedRowHandle = i;
break;
}
}
}
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
public override void newProc()
{
try
{
OrderManagerPopup form = new OrderManagerPopup(this);
form.initProc("");
form.TopMost = true;
form.Show();
}
catch (Exception ex)
{
XtraMessageBox.Show(ex.Message);
}
}
public override void updateProc()
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (row == null)
{
return;
}
string order_no = UtilClass.toStr(row["ORDER_NO"]);
OrderManagerPopup form = new OrderManagerPopup(this);
string str = form.initProc(order_no);
if (!UtilClass.isNull(str))
{
XtraMessageBox.Show(str);
return;
}
form.TopMost = true;
form.Show();
}
public override void deleteProc()
{
}
public override void printProc()
{
DataTable data = gridControl_Main.DataSource as DataTable;
WorkManagerReport report = new WorkManagerReport();
report.SetData(data,
dateEdit_SDATE.Text,
dateEdit_FDATE.Text
);
}
public override void excelProc()
{
this.ExportExcelGrid(gridControl_Main);
}
public override void saveProc()
{
}
private void saveInputTimeProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
DataRow aRow = gridView_Main.GetFocusedDataRow();
string order_no = UtilClass.toStr(aRow["ORDER_NO"]);
SerializedSqlParam[] aParam = new SerializedSqlParam[]
{
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("ORDER_NO", SqlDbType.NVarChar, order_no),
};
ResultData resultData = ClientClass.SetData("SaveOrderInputDateUp", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
private string GetDay(DateTime dt)
{
string strDay = "";
switch (dt.DayOfWeek)
{
case DayOfWeek.Monday:
strDay = "월요일";
break;
case DayOfWeek.Tuesday:
strDay = "화요일";
break;
case DayOfWeek.Wednesday:
strDay = "수요일";
break;
case DayOfWeek.Thursday:
strDay = "목요일";
break;
case DayOfWeek.Friday:
strDay = "금요일";
break;
case DayOfWeek.Saturday:
strDay = "토요일";
break;
case DayOfWeek.Sunday:
strDay = "일요일";
break;
}
return strDay;
}
}
}