Beispiel #1
0
        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;
        }