Exemplo n.º 1
0
        /// <summary>
        ///  单击“选择商品”按钮触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataTable       table = new DataTable();
            ProductSelected ps    = new ProductSelected(table, null);

            ps.ShowDialog();
            //下面就是对当前DataTable的赋值
            if (gridControl1.DataSource != null)
            {
                dTable = gridControl1.DataSource as DataTable;
            }
            else
            {
                init();
            }
            int i = 1;

            foreach (DataRow row in table.Rows)
            {
                DataRow dRow = dTable.NewRow();
                // 其余信息量是在商家初始化过程中或者添加商品的过程中加载的
                dRow["IsDelete"]             = false;
                dRow["Line"]                 = i.ToString();
                dRow["SkuOuterID"]           = row["SkuOuterID"];
                dRow["ItemName"]             = row["Name"];
                dRow["ProductSpecification"] = row["Specification"];
                dRow["ProductPrice"]         = 100.00;
                dTable.Rows.Add(dRow);

                i++;
            }
            gridControl1.DataSource = dTable;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 选择商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barBtnSelect_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (comboStockOut.Text == string.Empty)
                {
                    XtraMessageBox.Show("请选择调出仓库", Constants.SYSTEM_PROMPT);
                    return;
                }
                if (comboStockIn.Text == string.Empty)
                {
                    XtraMessageBox.Show("请选择调入仓库", Constants.SYSTEM_PROMPT);
                    return;
                }
                if (comboStockIn.Text == comboStockOut.Text)
                {
                    XtraMessageBox.Show("调出仓库和调入仓库不能相同", Constants.SYSTEM_PROMPT);
                    return;
                }
                string stockHouseCode = string.Empty;
                if (comboStockOut.Tag != null)
                {
                    string[] codeList = comboStockOut.Tag.ToString().Split(',');
                    if (codeList.Length > comboStockOut.SelectedIndex)
                    {
                        stockHouseCode = codeList[comboStockOut.SelectedIndex];
                    }
                }

                DataTable       table = new DataTable();
                ProductSelected ps    = new ProductSelected(table, stockHouseCode);
                ps.ShowDialog();
                foreach (DataRow row in table.Rows)
                {
                    DataRow dRow = dTable.NewRow();
                    dRow["Name"]          = row["Name"];
                    dRow["SkuOuterID"]    = row["SkuOuterID"];
                    dRow["OuterID"]       = row["OuterID"];
                    dRow["Specification"] = row["Specification"];
                    dRow["Model"]         = row["Model"];
                    dRow["SkuQuantity"]   = 0;
                    dRow["SaleProps"]     = row["SaleProps"];
                    dRow["IsSelected"]    = false;

                    dTable.Rows.Add(dRow);
                }
                int rowHandle = gVStockProduct.FocusedRowHandle;
                //gVStockProduct.FocusedRowChanged -= gVStockProduct_FocusedRowChanged;
                gridStockProduct.DataSource = dTable;
                if (rowHandle == 0 && gVStockProduct.FocusedRowHandle > -1)
                {
                    FocusedRowChange();
                }
                //gVStockProduct.FocusedRowChanged += gVStockProduct_FocusedRowChanged;
                gVStockProduct.BestFitColumns();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT);
            }
        }