주문내역 엑셀 업로드기능에서 공백제거 추가, 주문내역에서 품목정보 생성하는 기능 추가(관리자)

This commit is contained in:
chi
2024-01-26 11:33:04 +09:00
parent 5d7945d5c9
commit d2c5ed6bd4
39 changed files with 1198 additions and 968 deletions

View File

@@ -89,6 +89,7 @@ namespace FPJ0000
row.Cells[col++].Value = dr.price;
row.Cells[col].Tag = dr.qty;
row.Cells[col++].Value = dr.qty;
row.Cells[col++].Value = dr.qty;
row.Cells[col++].Value = dr.price * dr.qty;
// row.Cells[col++].Value = 0;
row.Cells[col++].Value = "";
@@ -219,7 +220,13 @@ namespace FPJ0000
decimal sumAmt = 0;
foreach (DataGridViewRow item in dv1.Rows)
{
sumAmt += (decimal)item.Cells["dvc_amt"].Value;
var v = item.Cells["dvc_amt"].Value;
if (v != null)
{
if (decimal.TryParse(v.ToString(), out decimal vv))
sumAmt += vv;
}
}
this.tbSum.Text = sumAmt.ToString("N0");
@@ -237,6 +244,9 @@ namespace FPJ0000
FCOMMON.Util.MsgE("SPM검사가 완료되지 않았습니다");
return false;
}
}
if (this.dv1.Rows.Count < 1)
@@ -317,11 +327,28 @@ namespace FPJ0000
var dtCR = new dsPurchase.EETGW_PurchaseCRDataTable();
var dtNR = new dsPurchase.PurchaseDataTable();
var skipcnt = 0;
foreach (DataGridViewRow item in dv1.Rows)
{
var dr = item.Tag as dsPRJ.ProjectsPartRow;
var sid = dr.ItemSid.Replace(" ", "").Trim();
var o_price = item.Cells[Col_Price].Value;
var o_qty = item.Cells[Col_Qty].Value;
decimal v_price = 0;
int v_qty = 0;
if (o_price != null) v_price = decimal.Parse(o_price.ToString());
if (o_qty != null) v_qty = int.Parse(o_qty.ToString());
if (v_qty < 1)
{
skipcnt += 1;
fProg.IncProgress();
continue;
}
bool newadd = false;
if (isCR)
{
@@ -335,12 +362,7 @@ namespace FPJ0000
// newdr.asset = cbEQModel.Text.Trim();
// newdr.dept = cbEQModel.Text.Trim();
///newdr.manuproc = cbManuProc.Text.Trim();
var o_price = item.Cells[Col_Price].Value;
var o_qty = item.Cells[Col_Qty].Value;
decimal v_price = 0;
int v_qty = 0;
if (o_price != null) v_price = decimal.Parse(o_price.ToString());
if (o_qty != null) v_qty = int.Parse(o_qty.ToString());
if (newadd)
@@ -403,12 +425,7 @@ namespace FPJ0000
// newdr.asset = cbEQModel.Text.Trim();
// newdr.dept = cbEQModel.Text.Trim();
///newdr.manuproc = cbManuProc.Text.Trim();
var o_price = item.Cells[Col_Price].Value;
var o_qty = item.Cells[Col_Qty].Value;
decimal v_price = 0;
int v_qty = 0;
if (o_price != null) v_price = decimal.Parse(o_price.ToString());
if (o_qty != null) v_qty = int.Parse(o_qty.ToString());
if (newadd)
@@ -476,6 +493,25 @@ namespace FPJ0000
addcnt = ta.Update(dtNR);
}
//비고를 업데이트한다.
foreach (DataGridViewRow row in this.dv1.Rows)
{
var drpart = row.Tag as dsPRJ.ProjectsPartRow;
var vmemo = row.Cells["dvc_remark"].Value;
if (vmemo != null)
{
drpart.memo = vmemo.ToString();
drpart.EndEdit();
}
}
if (skipcnt > 0)
{
FCOMMON.Util.MsgE($"{skipcnt}건은 수량이 없어 등록되지 않았습니다");
}
FCOMMON.Util.MsgI(string.Format("{0}/{1}건의 자료가 생성 되었습니다.\n\n구매등록 화면에서 내용을 확인하세요.", addcnt, itemCount));
fProg.Close();
fProg.Dispose();
@@ -586,7 +622,7 @@ namespace FPJ0000
if (col.Name == "dvc_spm")
{
//site검색 해야한다
var sid = dv1.Rows[e.RowIndex].Cells["dvc_spm"].Value.ToString();// dr.sid;
var sid = dv1.Rows[e.RowIndex].Cells["dvc_sid"].Value.ToString();// dr.sid;
if (sid.Length != 9 || sid.StartsWith("10") == false)
{
dv1.Rows[e.RowIndex].Cells["dvc_spm"].Value = "SID오류";
@@ -600,15 +636,59 @@ namespace FPJ0000
dv1.Rows[e.RowIndex].Cells["dvc_spm"].Value = $"{dt.Result.Rows.Count}건";
dv1.Rows[e.RowIndex].Cells["dvc_spm"].Tag = dt.Result.Rows.Count;
var f = new FCM0000.fSIDListSelect(sid, dt.Result);
f.ShowDialog();
if (f.ShowDialog() == DialogResult.OK)
{
var oldvalue = dv1.Rows[e.RowIndex].Cells["dvc_remark"].Value;
if (oldvalue == null)
dv1.Rows[e.RowIndex].Cells["dvc_remark"].Value = "SPM:" + f.selectbatch;
else
dv1.Rows[e.RowIndex].Cells["dvc_remark"].Value = oldvalue.ToString() + ",SPM:" + f.selectbatch;
}
}
else
{
dv1.Rows[e.RowIndex].Cells["dvc_sid"].Value = "없음";
dv1.Rows[e.RowIndex].Cells["dvc_sid"].Tag = 0;
dv1.Rows[e.RowIndex].Cells["dvc_spm"].Value = "없음";
dv1.Rows[e.RowIndex].Cells["dvc_spm"].Tag = 0;
}
}
}
}
private void toolStripButton5_Click(object sender, EventArgs e)
{
var url = @"https://atknet.amkor.co.kr/#/department/ee/spm";
FCOMMON.Util.RunExplorer(url);
}
private void dv1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0) return;
var colr = "dvc_qtyreq";
var col = "dvc_qty";
//dv1.Rows[e.RowIndex].Cells[e.ColumnIndex]
}
private void dv1_CellEndEdit_1(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0) return;
var coli = dv1.Columns["dvc_qty"].Index;
var colr = dv1.Columns["dvc_qtyreq"].Index;
if (e.ColumnIndex != coli && e.ColumnIndex != colr) return;
var vqty = dv1.Rows[e.RowIndex].Cells[coli].Value;
var vqtr = dv1.Rows[e.RowIndex].Cells[colr].Value;
if (vqty != null && vqtr != null)
{
if (vqty.ToString() != vqtr.ToString())
{
dv1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightSkyBlue;
}
else
{
dv1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
}
}
else dv1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.DimGray;
}
}
}