private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.RowIndex >= 0) { KB.DAL.DBHelper db = new KB.DAL.DBHelper(); try { Data0017Ptr = decimal.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); DATA0017BLL bll = new DATA0017BLL(db); inventory = bll.getDATA0017ByRKEYWithNolock(Data0017Ptr); this.DialogResult = DialogResult.OK; } catch (Exception ex) { KB.FUNC.log.RecordInfo(ex); MessageBox.Show(ex.ToString()); } finally { db.CloseConnection(); } } }
public void BinData(string strWhere) { try { DATA0017BLL bll = new DATA0017BLL(Frm.DBConnection); DataTable tb; DataTable tb_GridView1; DataRow dr; string s_SQL; tb_GridView1 = new DataTable(); tb_GridView1.Columns.Add("rkey"); tb_GridView1.Columns.Add("序"); tb_GridView1.Columns.Add("制造部件编码"); tb_GridView1.Columns.Add("制造部件描述"); tb_GridView1.Columns.Add("UnitBomRKEY"); tb_GridView1.Columns.Add("UnitBomCODE"); tb_GridView1.Columns.Add("UnitBomNAME"); tb_GridView1.Columns.Add("UnitWHRKEY"); tb_GridView1.Columns.Add("UnitWHCODE"); tb_GridView1.Columns.Add("UnitWHNAME"); tb_GridView1.Columns.Add("PM"); tb_GridView1.Columns.Add("可用库存"); tb_GridView1.Columns.Add("寄售库存"); s_SQL = @" select top 300 *, d02Bom.rkey as d02BomRkey,d02Bom.UNIT_CODE as d02BomUNIT_CODE,d02Bom.UNIT_NAME as d02BomUNIT_NAME, d02WH.rkey as d02WHRkey, d02WH.UNIT_CODE as d02WHUNIT_CODE, d02WH.UNIT_NAME as d02WHUNIT_NAME from data0017 with (nolock) left join data0002 d02Bom with (nolock) on d02Bom.rkey = data0017.BOM_UNIT_PTR left join data0002 d02WH with (nolock) on d02WH.rkey = data0017.STOCK_UNIT_PTR where (" + strWhere + @") and P_M = 'P' order by inv_part_number "; tb = bll.getDataSet(s_SQL); for (int i = 0; i < tb.Rows.Count; i++) { dr = tb_GridView1.NewRow(); dr[0] = tb.Rows[i]["RKEY"].ToString().Trim(); dr[2] = tb.Rows[i]["INV_PART_NUMBER"].ToString().Trim(); dr[3] = tb.Rows[i]["INV_PART_DESCRIPTION"].ToString().Trim(); dr[4] = tb.Rows[i]["d02BomRkey"].ToString().Trim(); dr[5] = tb.Rows[i]["d02BomUNIT_CODE"].ToString().Trim(); dr[6] = tb.Rows[i]["d02BomUNIT_NAME"].ToString().Trim(); dr[7] = tb.Rows[i]["d02WHRkey"].ToString().Trim(); dr[8] = tb.Rows[i]["d02WHUNIT_CODE"].ToString().Trim(); dr[9] = tb.Rows[i]["d02WHUNIT_NAME"].ToString().Trim(); dr[10] = tb.Rows[i]["P_M"].ToString().Trim(); if (tb.Rows[i]["QUAN_ON_HAND"].ToString().Trim().Length > 0) { dr[11] = decimal.Parse(tb.Rows[i]["QUAN_ON_HAND"].ToString().Trim()).ToString("#0.00"); } else { dr[11] = "0.00"; } if (tb.Rows[i]["CONSIGN_ONHAND_QTY"].ToString().Trim().Length > 0) { dr[12] = decimal.Parse(tb.Rows[i]["CONSIGN_ONHAND_QTY"].ToString().Trim()).ToString("#0.00"); } else { dr[12] = "0.00"; } tb_GridView1.Rows.Add(dr); } tb_GridView1 = tb_GridView1.DefaultView.ToTable(); for (int i = 0; i < tb_GridView1.Rows.Count; i++) { tb_GridView1.Rows[i][1] = (i + 1).ToString("000000"); } //dataGridView1.Columns.Clear(); Frm.dataGridView1.DataSource = tb_GridView1; Frm.dataGridView1.Columns[0].Visible = false; Frm.dataGridView1.Columns[1].Width = 50; Frm.dataGridView1.Columns[1].ReadOnly = true; Frm.dataGridView1.Columns[2].Width = 130; Frm.dataGridView1.Columns[2].ReadOnly = true; Frm.dataGridView1.Columns[3].Width = 270; Frm.dataGridView1.Columns[3].ReadOnly = true; Frm.dataGridView1.Columns[4].Visible = false; Frm.dataGridView1.Columns[5].Visible = false; Frm.dataGridView1.Columns[6].Visible = false; Frm.dataGridView1.Columns[7].Visible = false; Frm.dataGridView1.Columns[8].Visible = false; Frm.dataGridView1.Columns[9].Visible = false; Frm.dataGridView1.Columns[10].Width = 50; Frm.dataGridView1.Columns[10].ReadOnly = true; Frm.dataGridView1.Columns[11].Width = 100; Frm.dataGridView1.Columns[11].ReadOnly = true; Frm.dataGridView1.Columns[12].Width = 100; Frm.dataGridView1.Columns[12].ReadOnly = true; } catch (Exception e1) { log.PrintInfo(e1); return; } }
public void BinData(string strWhere) { try { DATA0017BLL bll = new DATA0017BLL(Frm.DBConnection); DataTable tb; DataTable tb_GridView1; DataRow dr; tb_GridView1 = new DataTable(); tb_GridView1.Columns.Add("rkey"); tb_GridView1.Columns.Add("序"); tb_GridView1.Columns.Add("制造部件编码"); tb_GridView1.Columns.Add("制造部件描述"); tb_GridView1.Columns.Add("PM"); tb_GridView1.Columns.Add("可用库存"); tb_GridView1.Columns.Add("寄售库存"); tb = bll.getDataSet("select top 300 * from data0017 with (nolock) where (" + strWhere + ") and P_M = 'M' order by inv_part_number "); for (int i = 0; i < tb.Rows.Count; i++) { dr = tb_GridView1.NewRow(); dr[0] = tb.Rows[i]["RKEY"].ToString().Trim(); dr[2] = tb.Rows[i]["INV_PART_NUMBER"].ToString().Trim(); dr[3] = tb.Rows[i]["INV_PART_DESCRIPTION"].ToString().Trim(); dr[4] = tb.Rows[i]["P_M"].ToString().Trim(); if (tb.Rows[i]["QUAN_ON_HAND"].ToString().Trim().Length > 0) { dr[5] = decimal.Parse(tb.Rows[i]["QUAN_ON_HAND"].ToString().Trim()).ToString("#0.00"); } else { dr[5] = "0.00"; } if (tb.Rows[i]["CONSIGN_ONHAND_QTY"].ToString().Trim().Length > 0) { dr[6] = decimal.Parse(tb.Rows[i]["CONSIGN_ONHAND_QTY"].ToString().Trim()).ToString("#0.00"); } else { dr[6] = "0.00"; } tb_GridView1.Rows.Add(dr); } tb_GridView1.DefaultView.Sort = "制造部件编码 ASC"; tb_GridView1 = tb_GridView1.DefaultView.ToTable(); for (int i = 0; i < tb_GridView1.Rows.Count; i++) { tb_GridView1.Rows[i][1] = (i + 1).ToString("000000"); } //dataGridView1.Columns.Clear(); Frm.dataGridView1.DataSource = tb_GridView1; Frm.dataGridView1.Columns[0].Visible = false; Frm.dataGridView1.Columns[1].Width = 50; Frm.dataGridView1.Columns[1].ReadOnly = true; Frm.dataGridView1.Columns[2].Width = 110; Frm.dataGridView1.Columns[2].ReadOnly = true; Frm.dataGridView1.Columns[3].Width = 200; Frm.dataGridView1.Columns[3].ReadOnly = true; Frm.dataGridView1.Columns[4].Width = 40; Frm.dataGridView1.Columns[4].ReadOnly = true; Frm.dataGridView1.Columns[5].Width = 90; Frm.dataGridView1.Columns[5].ReadOnly = true; Frm.dataGridView1.Columns[6].Width = 90; Frm.dataGridView1.Columns[6].ReadOnly = true; } catch (Exception e1) { log.PrintInfo(e1); return; } }
public void BinData(string strWhere) { try { DATA0017BLL bll = new DATA0017BLL(Frm.DBConnection); DATA0002BLL bllD02 = new DATA0002BLL(Frm.DBConnection); DATA0002 infoD02 = new DATA0002(); DataTable tb, tb2; DataTable tb_GridView1; DataRow dr; string s_SQL; tb_GridView1 = new DataTable(); tb_GridView1.Columns.Add("地点"); tb_GridView1.Columns.Add("可用库存"); tb_GridView1.Columns.Add("已分配库存"); tb = bll.getDataSet("select * from data0017 with (nolock) where rkey = " + Frm.id_rkey.ToString()); infoD02 = bllD02.getDATA0002ByRKEY(decimal.Parse(tb.Rows[0]["STOCK_UNIT_PTR"].ToString().Trim())); Frm.textBoxInv_Part_Number.Text = tb.Rows[0]["inv_part_number"].ToString().Trim(); Frm.labelInv_Part_Desc.Text = tb.Rows[0]["INV_PART_DESCRIPTION"].ToString().Trim(); Frm.labelInv_Unit.Text = infoD02.UNIT_NAME.Trim(); s_SQL = @" select data0016.CODE, data0016.LOCATION, data0019.QUAN_ON_HAND, data0019.QUAN_ALLOCATED from DATA0019 with (nolock),DATA0017 with (nolock),DATA0018 with (nolock),data0016 with (nolock) where data0019.INVENTORY_PTR = data0017.RKEY and data0019.INV_WHOUSE_PTR = data0018.RKEY and data0019.LOCATION_PTR = data0016.RKEY and data0017.rkey = " + Frm.id_rkey.ToString() + @" order by data0016.CODE "; tb = bll.getDataSet(s_SQL); s_SQL = @" SELECT (SUM(D467.QUAN_ORD) - SUM(D467.QUAN_RECD) + SUM(D467.QUAN_RETN) + SUM(D467.QUAN_IN_INSP)) AS ROQTY FROM DATA0467 D467 WITH (NOLOCK) , DATA0466 D466 WITH (NOLOCK) WHERE D467.RO_PTR = D466.RKEY AND D467.INVT_PTR = " + Frm.id_rkey.ToString() + @" AND (D467.QUAN_ORD) - (D467.QUAN_RECD) + (D467.QUAN_RETN) + (D467.QUAN_IN_INSP) > 0.0 AND D466.STATUS = 1 "; tb2 = bll.getDataSet(s_SQL); for (int i = 0; i < tb.Rows.Count; i++) { dr = tb_GridView1.NewRow(); dr[0] = tb.Rows[i]["LOCATION"].ToString().Trim(); dr[1] = decimal.Parse(tb.Rows[0]["QUAN_ON_HAND"].ToString().Trim()).ToString("#0.00"); dr[2] = decimal.Parse(tb.Rows[0]["QUAN_ALLOCATED"].ToString().Trim()).ToString("#0.00"); tb_GridView1.Rows.Add(dr); } Frm.dataGridView1.DataSource = tb_GridView1; Frm.dataGridView1.Columns[0].Width = 150; Frm.dataGridView1.Columns[0].ReadOnly = true; Frm.dataGridView1.Columns[1].Width = 150; Frm.dataGridView1.Columns[1].ReadOnly = true; } catch (Exception e1) { log.PrintInfo(e1); return; } }
public void BinData(string strWhere) { try { DATA0017BLL bll = new DATA0017BLL(Frm.DBConnection); DATA0002BLL bllD02 = new DATA0002BLL(Frm.DBConnection); DATA0002 infoD02 = new DATA0002(); DataTable tb, tb2; DataTable tb_GridView1, tb_GridView2; DataRow dr; string s_SQL; tb_GridView1 = new DataTable(); tb_GridView1.Columns.Add("名称"); tb_GridView1.Columns.Add("库存"); tb_GridView2 = new DataTable(); tb_GridView2.Columns.Add("名称"); tb_GridView2.Columns.Add("库存"); tb = bll.getDataSet("select * from data0017 with (nolock) where rkey = " + Frm.id_rkey.ToString()); infoD02 = bllD02.getDATA0002ByRKEY(decimal.Parse(tb.Rows[0]["STOCK_UNIT_PTR"].ToString().Trim())); Frm.textBoxInv_Part_Number.Text = tb.Rows[0]["inv_part_number"].ToString().Trim(); Frm.labelInv_Part_Desc.Text = tb.Rows[0]["INV_PART_DESCRIPTION"].ToString().Trim(); Frm.labelInv_Unit.Text = infoD02.UNIT_NAME.Trim(); s_SQL = @" SELECT isnull((SUM(D467.QUAN_ORD) - SUM(D467.QUAN_RECD) + SUM(D467.QUAN_RETN) + SUM(D467.QUAN_IN_INSP)),0) AS ROQTY FROM DATA0467 D467 WITH (NOLOCK) , DATA0466 D466 WITH (NOLOCK) WHERE D467.RO_PTR = D466.RKEY AND D467.INVT_PTR = " + Frm.id_rkey.ToString() + @" AND (D467.QUAN_ORD) - (D467.QUAN_RECD) + (D467.QUAN_RETN) + (D467.QUAN_IN_INSP) > 0.0 AND D466.STATUS = 1 "; tb2 = bll.getDataSet(s_SQL); Frm.groupBox1.Text = "仓库总库存:" + decimal.Parse(tb.Rows[0]["QUAN_ON_HAND"].ToString()).ToString("#0.00"); Frm.groupBox2.Text = "寄售仓总库存:" + decimal.Parse(tb.Rows[0]["CONSIGN_ONHAND_QTY"].ToString()).ToString("#0.00"); #region 仓库 dr = tb_GridView1.NewRow(); dr[0] = "在途数量"; dr[1] = decimal.Parse(tb.Rows[0]["QUAN_IN_TRANSIT"].ToString().Trim()).ToString("#0.00"); tb_GridView1.Rows.Add(dr); dr = tb_GridView1.NewRow(); dr[0] = "在检数量"; dr[1] = decimal.Parse(tb.Rows[0]["QUAN_IN_INSP"].ToString().Trim()).ToString("#0.00"); tb_GridView1.Rows.Add(dr); dr = tb_GridView1.NewRow(); dr[0] = "待入库数量"; dr[1] = decimal.Parse(tb.Rows[0]["QUAN_BACKLOG"].ToString().Trim()).ToString("#0.00"); tb_GridView1.Rows.Add(dr); dr = tb_GridView1.NewRow(); dr[0] = "可用库存"; dr[1] = (decimal.Parse(tb.Rows[0]["QUAN_ON_HAND"].ToString().Trim()) - decimal.Parse(tb.Rows[0]["QUAN_ALLOCATED"].ToString().Trim())).ToString("#0.00"); tb_GridView1.Rows.Add(dr); dr = tb_GridView1.NewRow(); dr[0] = "已分配库存"; dr[1] = decimal.Parse(tb.Rows[0]["QUAN_ALLOCATED"].ToString().Trim()).ToString("#0.00"); tb_GridView1.Rows.Add(dr); #endregion #region 寄售 dr = tb_GridView2.NewRow(); dr[0] = "待检数量"; dr[1] = decimal.Parse(tb.Rows[0]["CONSIGN_QTY_IN_INSP"].ToString().Trim()).ToString("#0.00"); tb_GridView2.Rows.Add(dr); dr = tb_GridView2.NewRow(); dr[0] = "开立RO数量"; if (tb2.Rows.Count > 0) { dr[1] = decimal.Parse(tb2.Rows[0]["ROQTY"].ToString().Trim()).ToString("#0.00"); } else { dr[1] = "0"; } tb_GridView2.Rows.Add(dr); #endregion Frm.dataGridView1.DataSource = tb_GridView1; Frm.dataGridView1.Columns[0].Width = 150; Frm.dataGridView1.Columns[0].ReadOnly = true; Frm.dataGridView1.Columns[1].Width = 150; Frm.dataGridView1.Columns[1].ReadOnly = true; Frm.dataGridView2.DataSource = tb_GridView2; Frm.dataGridView2.Columns[0].Width = 150; Frm.dataGridView2.Columns[0].ReadOnly = true; Frm.dataGridView2.Columns[1].Width = 150; Frm.dataGridView2.Columns[1].ReadOnly = true; } catch (Exception e1) { log.PrintInfo(e1); return; } }