Exemple #1
0
        private void out_bound(object sender, RoutedEventArgs e)
        {
            ///出库操作
            try
            {
                List <Model.Outbound> lists = (List <Model.Outbound>)datagridoutbound.ItemsSource;


                int i = datagridoutbound.SelectedIndex;

                DataRowView    dataRowView = null;
                Model.Outbound list        = lists[i];

                WPF_OutOfBox wPF_OutOfBox = new WPF_OutOfBox(dataRowView, "input_excel", list);
                string       sql          = "select Box_ID from Material where Material_ID ='" + list.Material_ID + "'";
                DataSet      ds           = MySQLHelper.GetDataSet(MySQLHelper.GetConn(), CommandType.Text, sql, null);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    wPF_OutOfBox.combobox.Items.Add(row["Box_ID"].ToString());;
                }
                wPF_OutOfBox.ShowDialog();
                if (wPF_OutOfBox.DialogResult == true)//第3步,然后对DialogResult进行判断
                {
                    lists.RemoveAt(i);
                    datagridoutbound.ItemsSource = null;
                    datagridoutbound.ItemsSource = lists;
                }
            }
            catch (InvalidCastException a)
            {
                MessageBox.Show("只有导入的出库excel才能进行入库操作");
            }
        }
Exemple #2
0
        private void Input_Excel(object sender, RoutedEventArgs e)
        {
            ///弹出文件选择对话框,选取Excel文件
            ///把Excel文件内容读至数组
            ///把数组添加到表Outbound
            ///
            //DataTable dt = InputExcel.GetTable();
            DataTable dt = InputToExcel.ExcelToDataTable(true);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    List <Model.Outbound> lists = new List <Model.Outbound>();
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Model.Outbound u = new Model.Outbound();
                        u.Outbound_ID        = dt.Rows[i][0].ToString();
                        u.Outbound_Time      = dt.Rows[i][1].ToString();
                        u.Custom_Name        = dt.Rows[i][2].ToString();
                        u.Box_ID             = dt.Rows[i][4].ToString();
                        u.Sale_ID            = dt.Rows[i][3].ToString();
                        u.Material_ID        = dt.Rows[i][5].ToString();
                        u.Material_Spec      = dt.Rows[i][6].ToString();
                        u.Material_SQty      = Convert.ToInt32(dt.Rows[i][7]);
                        u.Material_SerialNum = dt.Rows[i][8].ToString();
                        lists.Add(u);
                    }
                    datagridoutbound.ItemsSource = lists;
                }
            }
            else
            {
                MessageBox.Show("excel表格式错误,请重新导入");
            }
        }