/// <summary> /// 点击选择商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bbtnProductAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { //用于存放从 选择商品 选择的StockProduct DataTable table = new DataTable(); ProductSelected ps = new ProductSelected(table, null); ps.ShowDialog(); //传递数据 inoutHelper.SetColumnsValue(dTable, table, skuOuterIDList); //gcProduceInProduct.DataSource = dTable; gvProduceInProduct.BestFitColumns(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 选择商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barBtnSoldOutSelectPro_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { int oldRowCount = gvProSoldOut.RowCount; //用于存放从 选择商品 选择的StockProduct DataTable table = new DataTable(); ProductSelected ps = new ProductSelected(table, null); ps.ShowDialog(); //传递数据 inoutHelper.SetColumnsValue(dTable, table, skuOuterIDList); inoutHelper.DisPlayTax(oldRowCount, gvProSoldOut, gcTaxCode, gcTax); //gcProSoldOut.DataSource = dTable.DefaultView; gvProSoldOut.BestFitColumns(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 选择商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bbtnProductAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA); waitForm.Show(); try { int oldRowCount = gvProductSJ.RowCount; DataTable table = new DataTable(); ProductSelected ps = new ProductSelected(table, null); waitForm.Close(); DialogResult result = ps.ShowDialog(); //DataTable dTable = new DataTable(); //if (gridCtrlProduct.DataSource != null) //{ // dTable = gridCtrlProduct.DataSource as DataTable; //} //else //{ // dTable.Columns.Add("CatName"); // dTable.Columns.Add("ProductName"); // dTable.Columns.Add("SkuOuterID"); // dTable.Columns.Add("StockCatName"); // dTable.Columns.Add("OuterID"); // dTable.Columns.Add("SaleProps"); // dTable.Columns.Add("TotalCount"); // dTable.Columns.Add("TotalMoney"); // dTable.Columns.Add("Op"); // dTable.Columns.Add("PurchaseCode"); // dTable.Columns.Add("StockHouse"); // dTable.Columns.Add("StockLayout"); // dTable.Columns.Add("StockHouseCode"); // dTable.Columns.Add("StockLayoutCode"); //} waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA); waitForm.Show(); foreach (DataRow row in table.Rows) { string sku_outId = row["SkuOuterID"].ToString(); if (!skuOutIdList.Contains(sku_outId)) { skuOutIdList.Add(sku_outId); DataRow dRow = dTable.NewRow(); dRow["CatName"] = row["CatName"]; dRow["ProductName"] = row["Name"]; dRow["SkuOuterID"] = row["SkuOuterID"]; dRow["StockCatName"] = row["StockCatName"]; dRow["OuterID"] = row["OuterID"]; dRow["SaleProps"] = row["SaleProps"]; dRow[gcStockHouseCode.FieldName] = row["HouseCode"]; dRow[gcStockHouse.FieldName] = row["HouseName"]; dRow[gcStockLayout.FieldName] = row["LayoutName"]; dRow[gcStockLayoutCode.FieldName] = row["LayoutCode"]; dRow[gcTaxCode.FieldName] = row["TaxCode"]; dRow[gcPrice.FieldName] = row["SkuPrice"]; dRow[gcModel.FieldName] = row["Model"]; dRow[gcSpecification.FieldName] = row["Specification"]; dRow[gcTaxCode.FieldName] = row["TaxCode"]; dTable.Rows.Add(dRow); } } /*显示税率*/ inoutHelper.DisPlayTax(oldRowCount, gvProductSJ, gcTaxCode, gcTax); waitForm.Close(); gvProductSJ.BestFitColumns(); } catch (Exception ex) { waitForm.Close(); XtraMessageBox.Show(ex.ToString(), Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 获取对应的盘点单及其 /// </summary> /// <returns></returns> //private SortedList<StockCheck, List<StockCheckDetail>> GetStockCheckAndDetails() //{ // SortedList<StockCheck, List<StockCheckDetail>> stockCheckAndDetails = new SortedList<StockCheck, List<StockCheckDetail>>(); // StockCheck stockCheck = new StockCheck(); // //时间 // stockCheck.Created = DateTime.Parse(textEditDate.Text); // if (textOperator.Tag != null) // { // stockCheck.OperatorCode = textOperator.Tag.ToString();/////////////// /////////////// // } // else // { // stockCheck.OperatorCode = string.Empty; // } // //stockCheck.StockCheckCode = textCheckCode.Text; // if (comboBoxStockHouse.Tag != null) // { // string[] codeList = comboBoxStockHouse.Tag.ToString().Split(','); // if (codeList.Length > comboBoxStockHouse.SelectedIndex) // { // stockCheck.StockHouseCode = codeList[comboBoxStockHouse.SelectedIndex]; // } // } // List<StockCheckDetail> checkDetails = new List<StockCheckDetail>(); // for (int i = 0; i < gvProductCheck.RowCount; i++) // { // StockCheckDetail detail = new StockCheckDetail(); // DataRow dRow = gvProductCheck.GetDataRow(i); // if (dRow["CheckQuantity"] != null && dRow["CheckQuantity"].ToString() != string.Empty) // { // detail.CheckQuantity = int.Parse(dRow["CheckQuantity"].ToString()); // } // if (dRow["ProfitType"] != null && dRow["ProfitType"].ToString() != string.Empty) // { // detail.ProfitType = int.Parse(dRow["ProfitType"].ToString()); // } // if (dRow["Quantity"] != null && dRow["Quantity"].ToString() != string.Empty) // { // detail.Quantity = int.Parse(dRow["Quantity"].ToString()); // } // if (dRow["SkuOuterID"] != null && dRow["SkuOuterID"].ToString() != string.Empty) // { // detail.SkuOuterID = dRow["SkuOuterID"].ToString(); // } // if (dRow["SkuQuantity"] != null && dRow["SkuQuantity"].ToString() != string.Empty) // { // detail.SkuQuantity = int.Parse(dRow["SkuQuantity"].ToString()); // } // detail.LayoutCode = ""; // if (gvProductCheck.GetRowCellValue(i, "LayoutCode") != null && gvProductCheck.GetRowCellValue(i, "LayoutCode").ToString() != string.Empty) // { // if (rICBLayout.Tag != null) // { // detail.LayoutCode = gvProductCheck.GetRowCellValue(i, "LayoutCode").ToString(); // } // } // detail.StockCheckCode = textCheckCode.Text; // checkDetails.Add(detail); // } // stockCheckAndDetails.Add(stockCheck, checkDetails); // return stockCheckAndDetails; //} #endregion #region 择,删除商品 /// <summary> /// 选择商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barBtnSelect_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA); waitForm.Show(); try { string stockHouseCode = string.Empty; if (comboBoxStockHouse.Text == string.Empty) { waitForm.Hide(); XtraMessageBox.Show("请选择要盘点的仓库!", Constants.SYSTEM_PROMPT); return; } if (comboBoxStockHouse.Tag != null) { Hashtable tagTable = comboBoxStockHouse.Tag as Hashtable; stockHouseCode = tagTable[comboBoxStockHouse.SelectedIndex].ToString(); } DataTable table = new DataTable(); ProductSelected ps = new ProductSelected(table, stockHouseCode); waitForm.Hide(); ps.ShowDialog(); waitForm.Show(); foreach (DataRow row in table.Rows) { if (row["SkuOuterID"] != null) { //如果包含则表明已经有该product if (skuOuterIDList.Contains(row["SkuOuterID"].ToString())) { continue; } } DataRow dRow = dTable.NewRow(); dRow["Name"] = row["Name"]; dRow["SkuOuterID"] = row["SkuOuterID"];//条形码 dRow["Specification"] = row["Specification"]; dRow["Model"] = row["Model"]; dRow[gcPrice.FieldName] = row["SkuPrice"]; //dRow["LayoutCode"]; //dRow["LayoutName"]; //dRow["StockUnitName"]; //dRow["StockUnitCode"]; dRow["SkuQuantity"] = row["Num"]; dRow["SaleProps"] = row["SaleProps"]; dRow["IsSelected"] = false; dTable.Rows.Add(dRow); skuOuterIDList.Add(row["SkuOuterID"].ToString()); } gridProductCheck.DataSource = dTable; gvProductCheck.BestFitColumns(); gridViewDetail.BestFitColumns(); waitForm.Close(); } catch (Exception ex) { waitForm.Close(); XtraMessageBox.Show(ex.ToString(), Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } }