private void buttonoutport_Click(object sender, EventArgs e) { //BaseAccess dbhelper = BaseAccess.CreateDataBase(); //DataGridView dataGrid = new DataGridView(); //DataTable dt = new DataTable(); //dt = dbhelper.GetDataTable("".AsSQLQuery() + "select * from view_ZBO"); //var list = dbhelper.GetList<MaterialStatus>("".AsSQLQuery() + "select * from view_ZBO"); //dataGridView1.DataSource = dt; // ExportDataToExce(); var alllist = dbhelper.GetList <MaterialStatus>("".AsSQLQuery() + "select * from View_ZBO"); ExportToExecl(alllist); }
public void Datalistview() { List <WMS_IO_Task> list = new List <WMS_IO_Task>(); BaseAccess dbhelper = BaseAccess.CreateDataBase(); string sql = "select * from wms_IO_task where status=1 and tasktype='2' and binding_flag=3 and taskId='" + textBox2.Text + "'"; list = dbhelper.GetList <WMS_IO_Task>("".AsSQLQuery() + sql); if (list.Count <= 0) { MessageBox.Show("未查询到该抽盘任务,请确认任务是否满足"); } else { this.listView2.Items.Clear(); if (list.Count > 0) { Invoke(new Action(() => { for (int i = 0; i < list.Count; i++) { ListViewItem item = new ListViewItem(); item.Tag = list[i]; item.Text = list[i].TaskId; item.SubItems.Add(list[i].PalletNo); item.SubItems.Add(list[i].SourceLoc); item.SubItems.Add(list[i].TargetLoc); item.SubItems.Add(list[i].CratedTime); item.SubItems.Add(list[i].EditUser); item.SubItems.Add(list[i].EditTime); listView2.Items.Add(item); } })); } } }
private void button1_Click(object sender, EventArgs e) { PageCondition.Visible = true; BaseAccess dbhelper = BaseAccess.CreateDataBase(); dbhelper.ExecuteNonQuerySQL("".AsSQLQuery() + "delete ZBO"); if (dbhelper.Insert <Excel>(excels) > 0) { lvw.Clear(); lvw.Items.Clear(); lvw.Columns.AddRange(new ColumnHeader[] { new ColumnHeader { Text = "物料编码", Width = 100, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "物料名称", Width = 100, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "在库数量", Width = 100, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "待验收数量", Width = 100, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "一次验收完成数量", Width = 110, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "二次验收完成数量", Width = 110, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "入库待处理数量", Width = 110, TextAlign = HorizontalAlignment.Center }, }); PageCondition.PageSize = 50; PageCondition.SqlSort = "order by MaterialId"; listTask = dbhelper.GetList <MaterialStatus>("".AsSQLQuery() + "select * from View_ZBO", PageCondition.PageCondition); page = listTask.rows.Count(); PageCondition.DataQuery(new Func <int>(() => { if (listTask != null && listTask.rows != null && listTask.rows.Count > 0) { Invoke(new Action(() => { lvw.Items.Clear(); for (int i = 0; i < listTask.rows.Count; i++) { ListViewItem item = new ListViewItem(); item.Tag = listTask.rows[i]; item.Text = listTask.rows[i].MaterialId; item.SubItems.Add(listTask.rows[i].MaterialName); item.SubItems.Add(listTask.rows[i].AllQuantity); item.SubItems.Add(listTask.rows[i].Checkquantity); item.SubItems.Add(listTask.rows[i].FCheckquantity); item.SubItems.Add(listTask.rows[i].SCheckquantity); item.SubItems.Add(listTask.rows[i].Inquantity); lvw.Items.Add(item); } })); } return(listTask == null ? 0 : listTask.total); }), true); } else { MessageBox.Show("请重试", "提示"); } buttonoutport.Visible = true; }