...
This commit is contained in:
@@ -13,17 +13,24 @@ namespace FEQ0000
|
||||
public partial class fPurchase_excelimport : Form
|
||||
{
|
||||
BindingSource bsModel;
|
||||
bool crmode = false;
|
||||
public fPurchase_excelimport(bool cr)
|
||||
eImporttype crmode;
|
||||
|
||||
public enum eImporttype
|
||||
{
|
||||
NR,
|
||||
CR,
|
||||
EB
|
||||
}
|
||||
public fPurchase_excelimport(eImporttype cr)
|
||||
{
|
||||
InitializeComponent();
|
||||
Properties.Settings.Default["gwcs"] = FCOMMON.info.CS;
|
||||
Properties.Settings.Default["EEEntities"] = FCOMMON.info.CS;
|
||||
this.FormClosed += __Closed;
|
||||
crmode = cr;
|
||||
this.Text = $"구매내역 가져오기({(crmode ? "CR" : "NR")})";
|
||||
|
||||
if (cr == true)
|
||||
this.Text = $"구매내역 가져오기({crmode})";
|
||||
|
||||
if (cr == eImporttype.CR)
|
||||
{
|
||||
cbProcess.Enabled = false;
|
||||
cbManuProc.Enabled = false;
|
||||
@@ -77,8 +84,10 @@ namespace FEQ0000
|
||||
|
||||
loadsetting(this);
|
||||
|
||||
if (crmode)
|
||||
if (crmode == eImporttype.CR)
|
||||
textBox1.Text = FCOMMON.Setting.system.Xml.get_Data(this.Name, "FILE_CR");
|
||||
else if (crmode == eImporttype.EB)
|
||||
textBox1.Text = FCOMMON.Setting.system.Xml.get_Data(this.Name, "FILE_EB");
|
||||
else
|
||||
textBox1.Text = FCOMMON.Setting.system.Xml.get_Data(this.Name, "FILE_NR");
|
||||
|
||||
@@ -112,8 +121,7 @@ namespace FEQ0000
|
||||
if (typestr.Contains("UpDownEdit"))
|
||||
{
|
||||
var nud = ctrls.Parent as NumericUpDown;
|
||||
var section = "input_" + this.Name;
|
||||
if (crmode) section += "_CR";
|
||||
var section = "input_" + this.Name + $"_{crmode}";
|
||||
var value = FCOMMON.Setting.system.Xml.get_Data(section, "nud_" + nud.Name, "0");
|
||||
var n = decimal.Parse(value);
|
||||
if (n >= nud.Minimum) nud.Value = decimal.Parse(value);
|
||||
@@ -135,8 +143,7 @@ namespace FEQ0000
|
||||
if (typestr.Contains("UpDownEdit"))
|
||||
{
|
||||
var nud = ctrls.Parent as NumericUpDown;
|
||||
var section = "input_" + this.Name;
|
||||
if (crmode) section += "_CR";
|
||||
var section = "input_" + this.Name + $"{crmode}";
|
||||
FCOMMON.Setting.system.Xml.set_Data(section, "nud_" + nud.Name, nud.Value.ToString());
|
||||
}
|
||||
}
|
||||
@@ -217,7 +224,7 @@ namespace FEQ0000
|
||||
var itemCount = 0;
|
||||
foreach (ListViewItem lv in this.listView1.Items)
|
||||
{
|
||||
if (crmode)
|
||||
if (crmode == eImporttype.CR)
|
||||
{
|
||||
var dr = lv.Tag as dsPurchase.EETGW_PurchaseCRRow;
|
||||
if (lv.Checked == false) dr.AcceptChanges();
|
||||
@@ -237,9 +244,29 @@ namespace FEQ0000
|
||||
itemAmt += dr.pumamt;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (crmode == eImporttype.NR)
|
||||
{
|
||||
var dr = lv.Tag as dsPurchase.PurchaseRow;
|
||||
var dr = lv.Tag as dsPurchase.EETGW_PurchaseEBRow;
|
||||
if (lv.Checked == false) dr.AcceptChanges();
|
||||
else
|
||||
{
|
||||
itemCount += 1;
|
||||
// dr.request = userNo;
|
||||
dr.asset = cbEQModel.Text;
|
||||
dr.dept = cbEQManu.Text;
|
||||
dr.manuproc = cbManuProc.Text;
|
||||
dr.process = cbProcess.Text.Trim();
|
||||
dr.state = cmbState.Text.Trim();
|
||||
// dr.pdate = dtPdate.Value.ToShortDateString();
|
||||
dr.project = tbProject.Text.Trim();
|
||||
dr.AcceptChanges();
|
||||
dr.SetAdded();
|
||||
itemAmt += dr.pumamt;
|
||||
}
|
||||
}
|
||||
else if (crmode == eImporttype.EB)
|
||||
{
|
||||
var dr = lv.Tag as dsPurchase.EETGW_PurchaseEBRow;
|
||||
if (lv.Checked == false) dr.AcceptChanges();
|
||||
else
|
||||
{
|
||||
@@ -261,14 +288,16 @@ namespace FEQ0000
|
||||
}
|
||||
|
||||
//part 목록을 조회해서 NR에 등록해줘야 함
|
||||
var dlg2 = FCOMMON.Util.MsgQ($"해당 파트리스트를 ({(crmode ? "CR":"NR")})구매 목록에 등록 하시겠습니까?\n" +
|
||||
var dlg2 = FCOMMON.Util.MsgQ($"해당 파트리스트를 ({crmode})구매 목록에 등록 하시겠습니까?\n" +
|
||||
itemCount.ToString() + "건 " + itemAmt.ToString("N0") + "원");
|
||||
if (dlg2 != System.Windows.Forms.DialogResult.Yes) return;
|
||||
|
||||
if (crmode)
|
||||
if (crmode == eImporttype.CR)
|
||||
taCR.Update(this.dsPRJ.EETGW_PurchaseCR);
|
||||
else
|
||||
else if (crmode == eImporttype.NR)
|
||||
taNR.Update(this.dsPRJ.Purchase);
|
||||
else if (crmode == eImporttype.EB)
|
||||
taEB.Update(this.dsPRJ.EETGW_PurchaseEB);
|
||||
|
||||
dsPRJ.AcceptChanges();
|
||||
FCOMMON.Util.MsgI("Save OK");
|
||||
@@ -277,7 +306,7 @@ namespace FEQ0000
|
||||
bool checkCombo()
|
||||
{
|
||||
|
||||
if (crmode == false && cbProcess.Text.isEmpty() == true)
|
||||
if (crmode != eImporttype.CR && cbProcess.Text.isEmpty() == true)
|
||||
{
|
||||
FCOMMON.Util.MsgE("프로세스를 선택하세요.");
|
||||
cbProcess.Focus();
|
||||
@@ -293,7 +322,7 @@ namespace FEQ0000
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (crmode == false && this.cbProcess.Text.isEmpty() == true)
|
||||
if (crmode != eImporttype.CR && this.cbProcess.Text.isEmpty() == true)
|
||||
{
|
||||
|
||||
{
|
||||
@@ -306,7 +335,7 @@ namespace FEQ0000
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (crmode == false && cbManuProc.Text.isEmpty() == true)
|
||||
if (crmode != eImporttype.CR && cbManuProc.Text.isEmpty() == true)
|
||||
{
|
||||
|
||||
{
|
||||
@@ -319,7 +348,7 @@ namespace FEQ0000
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (crmode == false && this.cbEQManu.Text.isEmpty() == true)
|
||||
if (crmode != eImporttype.CR && this.cbEQManu.Text.isEmpty() == true)
|
||||
{
|
||||
|
||||
{
|
||||
@@ -352,7 +381,7 @@ namespace FEQ0000
|
||||
return;
|
||||
}
|
||||
|
||||
if(nudPdate.Value <1 || nudSid.Value < 1 || nudPumName.Value < 1)
|
||||
if (nudPdate.Value < 1 || nudSid.Value < 1 || nudPumName.Value < 1)
|
||||
{
|
||||
Util.MsgE($"요청일/SID/품명은 반드시 설정되어야 합니다");
|
||||
return;
|
||||
@@ -612,7 +641,7 @@ namespace FEQ0000
|
||||
newitem.SubItems.Add(구매승인);
|
||||
|
||||
//데이터도 추가를 해준다
|
||||
if (crmode)
|
||||
if (crmode == eImporttype.CR)
|
||||
{
|
||||
var newdr = this.dsPRJ.EETGW_PurchaseCR.NewEETGW_PurchaseCRRow();
|
||||
newdr.wuid = FCOMMON.info.Login.no;
|
||||
@@ -642,7 +671,7 @@ namespace FEQ0000
|
||||
newitem.Tag = newdr;
|
||||
this.dsPRJ.EETGW_PurchaseCR.AddEETGW_PurchaseCRRow(newdr);
|
||||
}
|
||||
else
|
||||
else if(crmode == eImporttype.NR)
|
||||
{
|
||||
var newdr = this.dsPRJ.Purchase.NewPurchaseRow();
|
||||
newdr.wuid = FCOMMON.info.Login.no;
|
||||
@@ -672,6 +701,36 @@ namespace FEQ0000
|
||||
newitem.Tag = newdr;
|
||||
this.dsPRJ.Purchase.AddPurchaseRow(newdr);
|
||||
}
|
||||
else if (crmode == eImporttype.EB)
|
||||
{
|
||||
var newdr = this.dsPRJ.EETGW_PurchaseEB.NewEETGW_PurchaseEBRow();
|
||||
newdr.wuid = FCOMMON.info.Login.no;
|
||||
newdr.wdate = DateTime.Now;
|
||||
newdr.gcode = FCOMMON.info.Login.gcode;
|
||||
newdr.sc = SC;
|
||||
newdr.orderno = CRCF;
|
||||
newdr.sid = SID;
|
||||
newdr.pumname = 품명;
|
||||
newdr.pumscale = 규격;
|
||||
newdr.pumqty = d_qty;
|
||||
newdr.pumprice = d_price;
|
||||
newdr.pumamt = d_amt;
|
||||
newdr.supply = v_공급처;
|
||||
newdr.supplyidx = v_공급처코드;
|
||||
newdr.po = PO;
|
||||
newdr.bigo = 비고;
|
||||
newdr.indate = 입고일;
|
||||
newdr.pdate = 요청일;
|
||||
newdr.request = 요청인;
|
||||
newdr.receive = 수령인;
|
||||
newdr.import = true;
|
||||
newdr.costcenter = CostCode;
|
||||
newdr.linecode = LIneCode;
|
||||
newdr.purchase_manager = 구매담당;
|
||||
newdr.purchase_admin = 구매승인;
|
||||
newitem.Tag = newdr;
|
||||
this.dsPRJ.EETGW_PurchaseEB.AddEETGW_PurchaseEBRow(newdr);
|
||||
}
|
||||
sumamt += d_amt;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user