..
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using NetOffice.OutlookApi;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@@ -16,7 +17,7 @@ namespace FPJ0000
|
||||
public fProjectPartToPurchaseCR(int pidx, List<int> idxlist)
|
||||
{
|
||||
InitializeComponent();
|
||||
// dv1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
// dv1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
IDXList = idxlist;
|
||||
this.ProjectIndex = pidx;
|
||||
this.KeyPreview = true;
|
||||
@@ -37,7 +38,7 @@ namespace FPJ0000
|
||||
int Col_amt = -1;
|
||||
private void Dv1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if(e.ColumnIndex == Col_Price || e.ColumnIndex == Col_Qty)
|
||||
if (e.ColumnIndex == Col_Price || e.ColumnIndex == Col_Qty)
|
||||
{
|
||||
var o_price = dv1.Rows[e.RowIndex].Cells[Col_Price].Value;
|
||||
var o_qty = dv1.Rows[e.RowIndex].Cells[Col_Qty].Value;
|
||||
@@ -50,8 +51,8 @@ namespace FPJ0000
|
||||
dv1.EndEdit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//newdr.pumprice = (decimal)item.Cells["dvc_price"].Value;
|
||||
//newdr.pumqty = (int)item.Cells["dvc_qty"].Value;
|
||||
}
|
||||
@@ -66,8 +67,8 @@ namespace FPJ0000
|
||||
foreach (dsPRJ.ProjectsPartRow dr in orderdata)
|
||||
{
|
||||
if (this.IDXList.Contains(dr.idx) == false) continue;
|
||||
|
||||
if(dr.IsItemSidNull() || dr.ItemSid.Length != 9)
|
||||
|
||||
if (dr.IsItemSidNull() || dr.ItemSid.Length != 9)
|
||||
{
|
||||
emptycount += 1;
|
||||
continue;
|
||||
@@ -91,10 +92,10 @@ namespace FPJ0000
|
||||
var supplyname = dr.ItemSupply.Trim();
|
||||
}
|
||||
|
||||
// this.listView1.ResumeLayout();
|
||||
// this.listView1.ResumeLayout();
|
||||
this.dv1.AutoResizeColumns();
|
||||
showSummary();
|
||||
if(emptycount > 0)
|
||||
if (emptycount > 0)
|
||||
{
|
||||
FCOMMON.Util.MsgE($"{emptycount} 개의 데이터는 SID가 없어 추가되지 않았습니다.");
|
||||
}
|
||||
@@ -180,7 +181,7 @@ namespace FPJ0000
|
||||
cn.Close();
|
||||
cn.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
FCOMMON.Util.MsgE("User List Error\n\n" + ex.Message);
|
||||
}
|
||||
@@ -193,7 +194,7 @@ namespace FPJ0000
|
||||
|
||||
|
||||
this.Show();
|
||||
Application.DoEvents();
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +219,7 @@ namespace FPJ0000
|
||||
{
|
||||
this.Validate();
|
||||
|
||||
if(this.dv1.Rows.Count < 1)
|
||||
if (this.dv1.Rows.Count < 1)
|
||||
{
|
||||
FCOMMON.Util.MsgE("자료가 없습니다");
|
||||
return false;
|
||||
@@ -282,13 +283,11 @@ namespace FPJ0000
|
||||
//}
|
||||
|
||||
var fProg = new FCOMMON.fProgress();
|
||||
fProg.Title = "CR구매파트 자료 등록 중";
|
||||
fProg.Title = "CR구매파트 자료 집계 중";
|
||||
fProg.SetProgress(0, itemCount);
|
||||
fProg.Show();
|
||||
fProg.Refresh();
|
||||
|
||||
// int iCnt = 0;
|
||||
|
||||
//데이터를 넣는다
|
||||
var ta = new dsPurchaseTableAdapters.EETGW_PurchaseCRTableAdapter();
|
||||
var dt = new dsPurchase.EETGW_PurchaseCRDataTable();
|
||||
@@ -296,23 +295,19 @@ namespace FPJ0000
|
||||
foreach (DataGridViewRow item in dv1.Rows)
|
||||
{
|
||||
var dr = item.Tag as dsPRJ.ProjectsPartRow;
|
||||
var sid = dr.ItemSid.Replace(" ", "").Trim();
|
||||
|
||||
bool newadd = false;
|
||||
var newdr = dt.Where(t => t.sid == sid).FirstOrDefault();
|
||||
//insert query
|
||||
var newdr = dt.NewEETGW_PurchaseCRRow();
|
||||
if (newdr == null)
|
||||
{
|
||||
newdr = dt.NewEETGW_PurchaseCRRow();
|
||||
newadd = true;
|
||||
}
|
||||
// newdr.asset = cbEQModel.Text.Trim();
|
||||
// newdr.dept = cbEQModel.Text.Trim();
|
||||
///newdr.manuproc = cbManuProc.Text.Trim();
|
||||
newdr.gcode = FCOMMON.info.Login.gcode;
|
||||
newdr.pdate = dtPdate.Value.ToShortDateString();
|
||||
newdr.state = "---";// cmbState.Text.Trim();
|
||||
//newdr.process = cbProcess.Text.Trim();
|
||||
newdr.request = userNo.Trim();
|
||||
newdr.sid = dr.ItemSid.Replace(" ", "").Trim();
|
||||
newdr.pumname = dr.ItemName.Trim();
|
||||
newdr.pumidx = dr.Item;
|
||||
newdr.pumscale = dr.ItemModel;
|
||||
newdr.pumunit = dr.ItemUnit;
|
||||
|
||||
var o_price = item.Cells[Col_Price].Value;
|
||||
var o_qty = item.Cells[Col_Qty].Value;
|
||||
decimal v_price = 0;
|
||||
@@ -320,11 +315,44 @@ namespace FPJ0000
|
||||
if (o_price != null) v_price = decimal.Parse(o_price.ToString());
|
||||
if (o_qty != null) v_qty = int.Parse(o_qty.ToString());
|
||||
|
||||
newdr.pumprice = v_price;// (decimal)item.Cells[Col_Price].Value;//dr.price;
|
||||
|
||||
if (newadd)
|
||||
{
|
||||
newdr.gcode = FCOMMON.info.Login.gcode;
|
||||
newdr.pdate = dtPdate.Value.ToShortDateString();
|
||||
newdr.state = "---";// cmbState.Text.Trim();
|
||||
newdr.request = userNo.Trim();
|
||||
newdr.sid = dr.ItemSid.Replace(" ", "").Trim();
|
||||
newdr.pumname = dr.ItemName.Trim();
|
||||
newdr.pumidx = dr.Item;
|
||||
newdr.pumscale = dr.ItemModel;
|
||||
newdr.pumunit = dr.ItemUnit;
|
||||
newdr.pumprice = v_price;// (decimal)item.Cells[Col_Price].Value;//dr.price;
|
||||
newdr.pumqty = v_qty;// (int)item.Cells[Col_Qty].Value;// dr.qty; //SQL = SQL.Replace("{qty}", dr.qty.ToString()); //일반수량이 아닌 필요수량으로
|
||||
newdr.pumamt = v_price * v_qty;// (decimal)item.Cells["dvc_amt"].Value;// dr.amt; //SQL = SQL.Replace("{amt}", dr.amt.ToString());
|
||||
newdr.supply = dr.ItemSupply.Trim();
|
||||
newdr.supplyidx = dr.ItemSupplyidx;
|
||||
newdr.project = tbProject.Text.Trim();
|
||||
newdr.projectidx = int.Parse(tbProjectIndex.Text);
|
||||
newdr.import = true;
|
||||
newdr.wuid = FCOMMON.info.Login.no;
|
||||
newdr.wdate = DateTime.Now;
|
||||
newdr.orderno = tbCr.Text.Trim();
|
||||
newdr.bigo = item.Cells["dvc_remark"].Value.ToString();//dr.memo.Trim();
|
||||
newdr.EndEdit();
|
||||
dt.AddEETGW_PurchaseCRRow(newdr);
|
||||
}
|
||||
else
|
||||
{
|
||||
newdr.pumqty += v_qty;// (int)item.Cells[Col_Qty].Value;// dr.qty; //SQL = SQL.Replace("{qty}", dr.qty.ToString()); //일반수량이 아닌 필요수량으로
|
||||
newdr.pumamt += v_price * v_qty;// (decimal)item.Cells["dvc_amt"].Value;// dr.amt; //SQL = SQL.Replace("{amt}", dr.amt.ToString());
|
||||
newdr.bigo += "," + item.Cells["dvc_remark"].Value.ToString();//dr.memo.Trim();
|
||||
newdr.EndEdit();
|
||||
}
|
||||
|
||||
//if (radioButton1.Checked)
|
||||
//
|
||||
newdr.pumqty = v_qty;// (int)item.Cells[Col_Qty].Value;// dr.qty; //SQL = SQL.Replace("{qty}", dr.qty.ToString()); //일반수량이 아닌 필요수량으로
|
||||
newdr.pumamt = v_price * v_qty;// (decimal)item.Cells["dvc_amt"].Value;// dr.amt; //SQL = SQL.Replace("{amt}", dr.amt.ToString());
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
@@ -332,24 +360,15 @@ namespace FPJ0000
|
||||
// newdr.pumqty = dr.qtybuy;
|
||||
// newdr.pumamt = dr.qtybuy * dr.price;
|
||||
//}
|
||||
newdr.supply = dr.ItemSupply.Trim();
|
||||
newdr.supplyidx = dr.ItemSupplyidx;
|
||||
newdr.project = tbProject.Text.Trim();
|
||||
newdr.projectidx = int.Parse(tbProjectIndex.Text);
|
||||
newdr.bigo = item.Cells["dvc_remark"].Value.ToString();//dr.memo.Trim();
|
||||
newdr.import = true;
|
||||
newdr.wuid = FCOMMON.info.Login.no;
|
||||
newdr.wdate = DateTime.Now;
|
||||
newdr.orderno = tbCr.Text.Trim();
|
||||
newdr.EndEdit();
|
||||
dt.AddEETGW_PurchaseCRRow(newdr);
|
||||
|
||||
|
||||
|
||||
// Console.WriteLine(SQL);
|
||||
fProg.IncProgress();
|
||||
ta.Update(dt);
|
||||
}
|
||||
|
||||
FCOMMON.Util.MsgI(string.Format("{0}건의 자료가 생성 되었습니다.\n\n구매등록 화면에서 내용을 확인하세요.", itemCount));
|
||||
}
|
||||
var addcnt = ta.Update(dt);
|
||||
FCOMMON.Util.MsgI(string.Format("{0}/{1}건의 자료가 생성 되었습니다.\n\n구매등록 화면에서 내용을 확인하세요.", addcnt, itemCount));
|
||||
fProg.Close();
|
||||
fProg.Dispose();
|
||||
|
||||
@@ -364,14 +383,14 @@ namespace FPJ0000
|
||||
if (dlg != DialogResult.Yes) return;
|
||||
|
||||
var rows = this.dv1.SelectedCells;
|
||||
if(rows.Count < 1)
|
||||
if (rows.Count < 1)
|
||||
{
|
||||
FCOMMON.Util.MsgE("선택된 줄이 없습니다");
|
||||
return;
|
||||
}
|
||||
|
||||
List<int> delrows = new List<int>();
|
||||
foreach(DataGridViewCell cel in rows)
|
||||
foreach (DataGridViewCell cel in rows)
|
||||
{
|
||||
if (delrows.Contains(cel.RowIndex) == false)
|
||||
delrows.Add(cel.RowIndex);
|
||||
@@ -382,7 +401,7 @@ namespace FPJ0000
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(var r in delrows.OrderByDescending(t=>t))
|
||||
foreach (var r in delrows.OrderByDescending(t => t))
|
||||
{
|
||||
this.dv1.Rows.RemoveAt(r);
|
||||
}
|
||||
@@ -393,7 +412,7 @@ namespace FPJ0000
|
||||
showSummary();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void toolStripButton4_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -403,6 +422,6 @@ namespace FPJ0000
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user