227 lines
6.9 KiB
C#
227 lines
6.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace FEQ0000
|
|
{
|
|
public partial class fItemin : Form
|
|
{
|
|
public fItemin()
|
|
{
|
|
InitializeComponent();
|
|
ipkolistDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
}
|
|
|
|
private void toolStripButton2_Click(object sender, EventArgs e)
|
|
{
|
|
tbSearch.Text = string.Empty;
|
|
tbSearch.Focus();
|
|
//tbFind.Text = string.Empty;
|
|
//findText();
|
|
tbSearch.Focus();
|
|
}
|
|
|
|
private void toolStripButton1_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void refreshData()
|
|
{
|
|
try
|
|
{
|
|
var dt = DateTime.Now.AddYears(-2);
|
|
this.ta.Fill(this.dsPurchase.Ipkolist, dt.ToShortDateString());
|
|
ipkolistDataGridView.AutoResizeColumn(0);
|
|
ipkolistDataGridView.AutoResizeColumn(1);
|
|
ipkolistDataGridView.AutoResizeColumn(2);
|
|
ipkolistDataGridView.AutoResizeColumn(3);
|
|
ipkolistDataGridView.AutoResizeColumn(4);
|
|
ipkolistDataGridView.AutoResizeColumn(7);
|
|
ipkolistDataGridView.AutoResizeColumn(8);
|
|
ipkolistDataGridView.AutoResizeColumn(9);
|
|
ipkolistDataGridView.AutoResizeColumn(10);
|
|
ipkolistDataGridView.AutoResizeColumn(5);
|
|
|
|
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
System.Windows.Forms.MessageBox.Show(ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
private void btFind_Click(object sender, EventArgs e)
|
|
{
|
|
findText();
|
|
}
|
|
void findText()
|
|
{
|
|
var search = tbFind.Text.Trim();
|
|
if(search.isEmpty())
|
|
{
|
|
bs.Filter = string.Empty;
|
|
tbFind.BackColor = SystemColors.Control;
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
var list = new string[] {"sid","pumname","bigo" };
|
|
var filter = string.Join(" like '%{0}%' or ", list);
|
|
filter += " like '%{0}%'";
|
|
filter = string.Format(filter, search);
|
|
bs.Filter = filter;
|
|
tbFind.BackColor = Color.Lime;
|
|
}
|
|
catch ( Exception ex)
|
|
{
|
|
tbFind.BackColor = Color.Tomato;
|
|
}
|
|
|
|
}
|
|
|
|
ipkolistDataGridView.AutoResizeColumn(0);
|
|
ipkolistDataGridView.AutoResizeColumn(1);
|
|
ipkolistDataGridView.AutoResizeColumn(2);
|
|
ipkolistDataGridView.AutoResizeColumn(3);
|
|
ipkolistDataGridView.AutoResizeColumn(4);
|
|
ipkolistDataGridView.AutoResizeColumn(7);
|
|
ipkolistDataGridView.AutoResizeColumn(8);
|
|
ipkolistDataGridView.AutoResizeColumn(9);
|
|
ipkolistDataGridView.AutoResizeColumn(10);
|
|
ipkolistDataGridView.AutoResizeColumn(5);
|
|
|
|
tbFind.Focus();
|
|
tbFind.SelectAll();
|
|
|
|
}
|
|
|
|
private void tbFind_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
findText();
|
|
}
|
|
|
|
private void toolStripButton3_Click(object sender, EventArgs e)
|
|
{
|
|
refreshData();
|
|
}
|
|
|
|
private void fItemin_Load(object sender, EventArgs e)
|
|
{
|
|
refreshData();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
SearchText();
|
|
|
|
|
|
}
|
|
void SearchText()
|
|
{
|
|
//입력된데이터에서 값을 추출한다
|
|
var buf = tbSearch.Text.Split('#');
|
|
if (buf.Length > 5)
|
|
{
|
|
lbSID.Text = buf[2].Trim();
|
|
var qty = buf[3].Trim();
|
|
lbCOST.Text = buf[5].Trim();
|
|
tbFind.Text = lbSID.Text;
|
|
findText();
|
|
}
|
|
else
|
|
{
|
|
lbCOST.Text = string.Empty;
|
|
lbSID.Text = tbSearch.Text;
|
|
tbFind.Text = lbSID.Text;
|
|
findText();
|
|
}
|
|
tbSearch.Focus();
|
|
tbSearch.SelectAll();
|
|
}
|
|
|
|
private void toolStripButton4_Click(object sender, EventArgs e)
|
|
{
|
|
func_ipgo();
|
|
}
|
|
void func_ipgo()
|
|
{
|
|
var drv = this.bs.Current as DataRowView;
|
|
var dr = drv.Row as dsPurchase.IpkolistRow;
|
|
|
|
int curLevel = Math.Max(FCOMMON.info.Login.level, FCOMMON.DBM.getAuth(FCOMMON.DBM.eAuthType.purchase));
|
|
if (curLevel < 5) //일반사용자 입고 여부
|
|
{
|
|
if (dr.request != FCOMMON.info.Login.no)
|
|
{
|
|
FCOMMON.Util.MsgE("타인의 자료는 입고 처리할 수 없습니다");
|
|
return;
|
|
}
|
|
|
|
if (dr.state != "PO")
|
|
{
|
|
FCOMMON.Util.MsgE("PO 상태의 자료만 입고처리가 가능 합니다");
|
|
return;
|
|
}
|
|
|
|
}
|
|
if(dr.source == "NR")
|
|
{
|
|
var f = new FEQ0000.Purchase.fPurchaseNR_Ipgo(dr.idx);
|
|
if (f.ShowDialog() == DialogResult.OK)
|
|
{
|
|
refreshData();
|
|
tbSearch.Focus();
|
|
tbSearch.SelectAll();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var f = new FEQ0000.Purchase.fPurchaseCR_Ipgo(dr.idx);
|
|
if (f.ShowDialog() == DialogResult.OK)
|
|
{
|
|
refreshData();
|
|
tbSearch.Focus();
|
|
tbSearch.SelectAll();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void toolStripButton5_Click(object sender, EventArgs e)
|
|
{
|
|
tbFind.Text = string.Empty;
|
|
findText();
|
|
}
|
|
|
|
private void ipkolistDataGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void tbSearch_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if(e.KeyCode == Keys.Enter)
|
|
SearchText();
|
|
}
|
|
|
|
private void ipkolistDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0 || e.ColumnIndex < 0) return;
|
|
if(e.ColumnIndex == 0)
|
|
{
|
|
func_ipgo(); ;
|
|
}
|
|
}
|
|
}
|
|
}
|