예제 #1
0
        private void EndProductId_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            ChooseProductForm form = new ChooseProductForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                this.EndProductId.EditValue = form.SelectedItem;
            }
        }
예제 #2
0
        private void buttonEdit1_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                this.btne_Product.EditValue = f.SelectedItem;
            }
        }
예제 #3
0
        private void buttonEditPro_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            ChooseProductForm form = new ChooseProductForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                this.buttonEditPro.EditValue = form.SelectedItem as Model.Product;
                this.textEditCusPro.Text     = (form.SelectedItem as Model.Product).CustomerProductName;
            }
        }
예제 #4
0
        private void buttonEditProduct1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            ChooseProductForm form = new ChooseProductForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                this.buttonEditProduct1.EditValue = (form.SelectedItem as Model.Product) == null ? null : form.SelectedItem as Model.Product;
                this.buttonEditProduct2.EditValue = (form.SelectedItem as Model.Product) == null ? null : form.SelectedItem as Model.Product;
            }
        }
예제 #5
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this.invoice.Details.Count > 0 && string.IsNullOrEmpty(this.invoice.Details[0].ProductId))
                {
                    this.invoice.Details.RemoveAt(0);
                }
                Model.InvoicePODetail detail = null;

                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail                           = new Book.Model.InvoicePODetail();
                        detail.Invoice                   = this.invoice;
                        detail.InvoicePODetailId         = Guid.NewGuid().ToString();
                        detail.Product                   = product;
                        detail.ProductId                 = product.ProductId;
                        detail.InvoicePODetailJCQuantity = 0;
                        detail.InvoicePODetailWHQuantity = 0;
                        detail.InvoicePODetailYHQuantity = 0;
                        detail.InvoicePODetailNote       = "";
                        if (detail.Product.DepotUnit != null)
                        {
                            detail.InvoiceProductUnit = detail.Product.DepotUnit.ToString();
                        }
                        this.invoice.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.InvoicePODetail();
                    detail.InvoicePODetailId         = Guid.NewGuid().ToString();
                    detail.Product                   = f.SelectedItem as Model.Product;;
                    detail.ProductId                 = detail.Product.ProductId;
                    detail.InvoicePODetailJCQuantity = 0;
                    detail.InvoicePODetailWHQuantity = 0;
                    detail.InvoicePODetailYHQuantity = 0;
                    detail.InvoicePODetailNote       = "";
                    if (detail.Product.DepotUnit != null)
                    {
                        detail.InvoiceProductUnit = detail.Product.DepotUnit.ToString();
                    }
                    this.invoice.Details.Add(detail);
                }
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
            f.Dispose();
            GC.Collect();
        }
예제 #6
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this.invoice.Details.Count > 0 && this.invoice.Details[0] != null && string.IsNullOrEmpty(this.invoice.Details[0].ProductId))
                {
                    this.invoice.Details.RemoveAt(0);
                }
                Model.InvoiceCJDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail                         = new Book.Model.InvoiceCJDetail();
                        detail.Inumber                 = this.invoice.Details.Count + 1;
                        detail.InvoiceCJDetailId       = Guid.NewGuid().ToString();
                        detail.Invoice                 = this.invoice;
                        detail.Product                 = product;
                        detail.ProductId               = product.ProductId;
                        detail.InvoiceCJDetailQuantity = 1;
                        detail.InvoiceCJDetailPrice    = detail.Product.NewestCost == null ? 0 : detail.Product.NewestCost.Value;
                        detail.InvoiceCJDetailMoney    = detail.InvoiceCJDetailPrice;
                        detail.InvoiceCJDetailNote     = "";

                        detail.InvoiceProductUnit = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName;
                        this.invoice.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail                         = new Book.Model.InvoiceCJDetail();
                    detail.Inumber                 = this.invoice.Details.Count + 1;
                    detail.InvoiceCJDetailId       = Guid.NewGuid().ToString();
                    detail.Invoice                 = this.invoice;
                    detail.Product                 = f.SelectedItem as Model.Product;
                    detail.ProductId               = (f.SelectedItem as Model.Product).ProductId;
                    detail.InvoiceCJDetailQuantity = 1;
                    detail.InvoiceCJDetailPrice    = detail.Product.NewestCost == null ? 0 : detail.Product.NewestCost.Value;
                    detail.InvoiceCJDetailMoney    = detail.InvoiceCJDetailPrice;
                    detail.InvoiceCJDetailNote     = "";
                    detail.InvoiceProductUnit      = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName;
                    this.invoice.Details.Add(detail);
                }
                this.gridControl1.RefreshDataSource();
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
                // this.bindingSource2.DataSource = this.productManager.Select();
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #7
0
        //"+"
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this.produceOtherExitMaterial.Details.Count > 0 && this.produceOtherExitMaterial.Details[0] != null && string.IsNullOrEmpty(this.produceOtherExitMaterial.Details[0].ProductId))
                {
                    this.produceOtherExitMaterial.Details.RemoveAt(0);
                }
                Model.ProduceOtherExitDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherExitDetail();
                        detail.ProduceOtherExitDetailId = Guid.NewGuid().ToString();
                        detail.Product                = product;
                        detail.ProductId              = product.ProductId;
                        detail.ProductSpecification   = product.ProductSpecification;
                        detail.ProductUnit            = product.ProduceUnit == null ? null : product.ProduceUnit.CnName;
                        detail.ProduceQuantity        = 0;
                        detail.ProduceAllUserQuantity = 0;
                        detail.CriterionUserQuantity  = 0;
                        detail.ProductStock           = product.StocksQuantity;
                        this.produceOtherExitMaterial.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    Model.Product product = f.SelectedItem as Model.Product;
                    detail = new Book.Model.ProduceOtherExitDetail();
                    detail.ProduceOtherExitDetailId = Guid.NewGuid().ToString();
                    detail.Product                = f.SelectedItem as Model.Product;
                    detail.ProductId              = (f.SelectedItem as Model.Product).ProductId;
                    detail.ProductSpecification   = (f.SelectedItem as Model.Product).ProductSpecification;
                    detail.ProductUnit            = detail.Product.ProduceUnit == null ? null : detail.Product.ProduceUnit.CnName;
                    detail.ProduceQuantity        = 0;
                    detail.ProduceAllUserQuantity = 0;
                    detail.CriterionUserQuantity  = 0;
                    detail.ProductStock           = (f.SelectedItem as Model.Product).StocksQuantity;
                    this.produceOtherExitMaterial.Details.Add(detail);
                }



                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
                //this.bindingSourceProductId.DataSource = productManager.Select();
            }
        }
예제 #8
0
        //快速查询选择商品
        private void btnEdit_SearchALLProduct_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                this._QuickSearchProduct = f.SelectedItem as Model.Product;
                if (this._QuickSearchProduct != null)
                {
                    this.btnEdit_SearchALLProduct.EditValue = this._QuickSearchProduct;
                    this.bsQuickSearch.DataSource           = this._SupplierProductManager.SelectALLRefProduct(this._QuickSearchProduct.ProductId);
                }
            }
        }
예제 #9
0
        private void simple_Append_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._produceOtherReturnMaterial.Details.Count > 0 && this._produceOtherReturnMaterial.Details[0] != null && string.IsNullOrEmpty(this._produceOtherReturnMaterial.Details[0].ProductId))
                {
                    this._produceOtherReturnMaterial.Details.RemoveAt(0);
                }
                Model.ProduceOtherReturnDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherReturnDetail();
                        detail.ProduceOtherReturnDetailId   = Guid.NewGuid().ToString();
                        detail.ProduceOtherReturnMaterialId = this._produceOtherReturnMaterial.ProduceOtherReturnMaterialId;
                        detail.Product     = this.productManager.Get(product.ProductId);
                        detail.ProductId   = product.ProductId;
                        detail.ProductUnit = product.DepotUnit.ToString();
                        detail.Quantity    = 0;
                        this._produceOtherReturnMaterial.Details.Add(detail);
                    }
                }

                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.ProduceOtherReturnDetail();
                    detail.ProduceOtherReturnDetailId   = Guid.NewGuid().ToString();
                    detail.ProduceOtherReturnMaterialId = this._produceOtherReturnMaterial.ProduceOtherReturnMaterialId;
                    detail.Product     = this.productManager.Get((f.SelectedItem as Model.Product).ProductId);
                    detail.ProductId   = detail.Product.ProductId;
                    detail.ProductUnit = (f.SelectedItem as Model.Product).DepotUnit.ToString();
                    detail.Quantity    = 0;
                    this._produceOtherReturnMaterial.Details.Add(detail);
                }

                this.bindingSourceProduceOtherReturnDetail.Position = this.bindingSourceProduceOtherReturnDetail.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #10
0
        private void simpleButton_Appent_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._depotIn.Details.Count > 0 && string.IsNullOrEmpty(this._depotIn.Details[0].ProductId))
                {
                    this._depotIn.Details.RemoveAt(0);
                }
                Model.DepotInDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.DepotInDetail();
                        detail.DepotInDetailId = Guid.NewGuid().ToString();
                        detail.Inumber         = this._depotIn.Details.Count + 1;
                        detail.DepotInId       = this._depotIn.DepotInId;
                        detail.Product         = product;
                        detail.ProductId       = product.ProductId;
                        detail.ProductUnit     = product.DepotUnit == null ? "" : product.DepotUnit.CnName;
                        detail.Description     = product.ProductDescription;
                        this._depotIn.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.DepotInDetail();
                    detail.DepotInDetailId = Guid.NewGuid().ToString();
                    detail.Inumber         = this._depotIn.Details.Count + 1;
                    detail.DepotInId       = this._depotIn.DepotInId;
                    detail.Product         = f.SelectedItem as Model.Product;
                    detail.ProductId       = (f.SelectedItem as Model.Product).ProductId;
                    detail.ProductUnit     = (f.SelectedItem as Model.Product).DepotUnit == null ? "" : (f.SelectedItem as Model.Product).DepotUnit.CnName;
                    detail.Description     = (f.SelectedItem as Model.Product).ProductDescription;
                    this._depotIn.Details.Add(detail);
                }
                this.gridControl1.RefreshDataSource();
                this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #11
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.Product product = f.SelectedItem as Model.Product;
                Model.ProduceTransferDetail detail = new Book.Model.ProduceTransferDetail();
                detail.ProduceTransferDetailId = Guid.NewGuid().ToString();
                detail.Product          = f.SelectedItem as Model.Product;
                detail.ProductId        = (f.SelectedItem as Model.Product).ProductId;
                detail.ProductUnit      = (f.SelectedItem as Model.Product).ProduceUnit.CnName;
                detail.ScrapQuantity    = 0;
                detail.TransferQuantity = 0;
                this.produceTransfer.Details.Add(detail);
                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
        }
예제 #12
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();

                detail.StockCheckDetailId = Guid.NewGuid().ToString();
                detail.StockCheckId       = _stockCheck.StockCheckId;
                detail.StockCheck         = _stockCheck;
                detail.Product            = f.SelectedItem as Model.Product;
                detail.ProductId          = (f.SelectedItem as Model.Product).ProductId;
                detail.StockCheckQuantity = 1;
                detail.ProductUnitName    = (f.SelectedItem as Model.Product).DepotUnit == null ? null : (f.SelectedItem as Model.Product).DepotUnit.CnName;
                _stockCheck.Details.Add(detail);
                this.bindingSourceStockCheckDetail.Position = this.bindingSourceStockCheckDetail.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
        }
예제 #13
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.PronoteProceduresAbilityDetail detail = new Book.Model.PronoteProceduresAbilityDetail();

                detail.PronoteProceduresAbilityDetailId = Guid.NewGuid().ToString();
                detail.PronoteProceduresAbility         = this._pronoteProceduresAbility;

                detail.Product       = f.SelectedItem as Model.Product;
                detail.ProductId     = (f.SelectedItem as Model.Product).ProductId;
                detail.TimeConsuming = 0;
                detail.UnitOutput    = 0;
                detail.ProductUnit   = detail.Product.ProduceUnit == null ? "" : detail.Product.ProduceUnit.CnName;
                this._pronoteProceduresAbility.Details.Add(detail);
                this.gridControl1.RefreshDataSource();
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
            }
        }
예제 #14
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                //报损项
                Model.InvoiceBSDetail detail = new Book.Model.InvoiceBSDetail();
                detail.InvoiceBSDetailId       = Guid.NewGuid().ToString();
                detail.Product                 = f.SelectedItem as Model.Product;
                detail.ProductId               = (f.SelectedItem as Model.Product).ProductId;
                detail.InvoiceBSDetailNote     = "";
                detail.InvoiceBSDetailQuantity = 1;
                //detail.InvoiceProductUnit = detail.Product.ProductBaseUnit;
                this.invoice.Details.Add(detail);
                this.gridControl1.RefreshDataSource();

                this.bindingSourceInvoiceBSDetail.Position = this.bindingSourceInvoiceBSDetail.IndexOf(detail);

                this.bindingSourceProduct.DataSource = this.productManager.Select();
            }
        }
        //商品选择商品
        private void btnEditProcProduct_Click(object sender, EventArgs e)
        {
            if (this.action != "view")
            {
                ChooseProductForm f = new ChooseProductForm();
                if (f.ShowDialog(this) == DialogResult.OK)
                {
                    this._SupplierProduct.Product = f.SelectedItem as Model.Product;
                    if (this._SupplierProduct.Product != null)
                    {
                        this._SupplierProduct.ProductId = this._SupplierProduct.Product.ProductId;
                    }
                    this._SupplierProduct.Supplier = this._CurrentSupplier;
                    if (this._SupplierProduct.Supplier != null)
                    {
                        this._SupplierProduct.SupplierId = this._SupplierProduct.Supplier.SupplierId;
                    }

                    foreach (Model.SupplierProduct sp in this.bsSupplierProduct.DataSource as IList <Model.SupplierProduct> )
                    {
                        if (this._SupplierProduct.SupplierId == sp.SupplierId && this._SupplierProduct.ProductId == sp.ProductId)
                        {
                            MessageBox.Show("有重複商品輸入", "提示");
                            break;
                        }
                    }

                    this._SupplierProduct.IsNewTemp = true; //临时
                    this._SupplierProduct.SupplierProductPriceRange = "1/999999999999/0";
                    this.btnEditProcProduct.EditValue = this._SupplierProduct.Product;

                    this.AnalyzePriceRange(this._SupplierProduct.SupplierProductPriceRange);
                    this.bsPriceAndRange.DataSource = this._priceRangeList;
                    this.grdConSupProductPric.RefreshDataSource();
                }
            }
        }
예제 #16
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                foreach (Model.Product item in ChooseProductForm.ProductList)
                {
                    if (this._productClassify.Details.Any(D => D.ProductId == item.ProductId))
                    {
                        MessageBox.Show("商品:" + item.ProductName + " 已添加", this.Text, MessageBoxButtons.OK);
                        continue;
                    }
                    else
                    {
                        Model.ProductClassifyDetail detail = this._detailManager.GetByProductId(item.ProductId);
                        if (detail == null)
                        {
                            detail = new Book.Model.ProductClassifyDetail();
                            detail.ProductClassifyDetailId = Guid.NewGuid().ToString();
                            detail.ProductClassifyId       = this._productClassify.ProductClassifyId;
                            detail.ProductId = item.ProductId;
                            detail.Product   = item;
                            detail.Inumber   = (this._productClassify.Details.Count + 1).ToString();
                            this._productClassify.Details.Add(detail);
                        }
                        else
                        {
                            MessageBox.Show("商品:" + item.ProductName + " 已属于关键字 " + detail.ProductClassify.KeyWord, this.Text, MessageBoxButtons.OK);
                            continue;
                        }
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
        }
예제 #17
0
        private void simpleButton1_Click_1(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._produceOtherMaterial.Details.Count > 0 && this._produceOtherMaterial.Details[0] != null && string.IsNullOrEmpty(this._produceOtherMaterial.Details[0].ProductId))
                {
                    this._produceOtherMaterial.Details.RemoveAt(0);
                }
                Model.ProduceOtherMaterialDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherMaterialDetail();
                        detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString();
                        detail.Product                      = this.productManager.Get(product.ProductId);
                        detail.ProductId                    = product.ProductId;
                        detail.ProductSpecification         = detail.Product.ProductSpecification;
                        detail.OtherMaterialQuantity        = 0;
                        detail.OtherMaterialALLUserQuantity = 0;
                        detail.ProductStock                 = detail.Product.StocksQuantity;
                        if (!detail.Product.ProduceMaterialDistributioned.HasValue)
                        {
                            detail.Product.ProduceMaterialDistributioned = 0;
                        }
                        if (!detail.Product.OtherMaterialDistributioned.HasValue)
                        {
                            detail.Product.OtherMaterialDistributioned = 0;
                        }
                        detail.Distributioned = detail.Product.ProduceMaterialDistributioned + detail.Product.OtherMaterialDistributioned;
                        detail.Inumber        = this._produceOtherMaterial.Details.Count + 1;
                        this._produceOtherMaterial.Details.Add(detail);
                    }
                }

                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.ProduceOtherMaterialDetail();
                    detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString();
                    detail.Product                      = this.productManager.Get((f.SelectedItem as Model.Product).ProductId);
                    detail.ProductId                    = detail.Product.ProductId;
                    detail.ProductSpecification         = detail.Product.ProductSpecification;
                    detail.OtherMaterialQuantity        = 0;
                    detail.OtherMaterialALLUserQuantity = 0;
                    detail.ProductStock                 = detail.Product.StocksQuantity;
                    if (!detail.Product.ProduceMaterialDistributioned.HasValue)
                    {
                        detail.Product.ProduceMaterialDistributioned = 0;
                    }
                    if (!detail.Product.OtherMaterialDistributioned.HasValue)
                    {
                        detail.Product.OtherMaterialDistributioned = 0;
                    }
                    detail.Distributioned = detail.Product.ProduceMaterialDistributioned + detail.Product.OtherMaterialDistributioned;
                    detail.Inumber        = this._produceOtherMaterial.Details.Count + 1;
                    this._produceOtherMaterial.Details.Add(detail);
                }
                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #18
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._produceOtherCompact.Details.Count > 0 && this._produceOtherCompact.Details[0] != null && string.IsNullOrEmpty(this._produceOtherCompact.Details[0].ProductId))
                {
                    this._produceOtherCompact.Details.RemoveAt(0);
                }
                Model.ProduceOtherCompactDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherCompactDetail();
                        detail.OtherCompactDetailId = Guid.NewGuid().ToString();
                        detail.Product           = this.productManager.Get(product.ProductId);
                        detail.ProductId         = product.ProductId;
                        detail.OtherCompactCount = 0;
                        detail.OtherCompactPrice = 0;
                        detail.InDepotCount      = 0;
                        detail.ProductUnit       = product.DepotUnit == null ? null : product.DepotUnit.CnName;
                        detail.OtherCompactMoney = 0;
                        Model.BomParentPartInfo bompar = this.bomParentPartInfoManager.Get(product);
                        if (bompar != null)
                        {
                            foreach (Model.BomComponentInfo comm in this.bomComponentInfoManager.Select(bompar))
                            {
                                Model.ProduceOtherCompactMaterial mater = new Model.ProduceOtherCompactMaterial();
                                mater.ProduceOtherCompactMaterialId = Guid.NewGuid().ToString();
                                mater.Product         = comm.Product;
                                mater.ProductId       = comm.ProductId;
                                mater.ProductUnit     = comm.Unit;
                                mater.ProduceQuantity = 0;
                                mater.ParentProduct   = product;
                                mater.ParentProductId = product.ProductId;

                                this._produceOtherCompact.DetailMaterial.Add(mater);
                            }
                        }

                        // detail.Inumber = this._produceOtherMaterial.Details.Count + 1;
                        //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName;
                        detail.ProductSpecification = product.ProductSpecification;
                        detail.Inumber = this._produceOtherCompact.Details.Count + 1;
                        this._produceOtherCompact.Details.Add(detail);
                    }
                }

                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.ProduceOtherCompactDetail();
                    detail.OtherCompactDetailId = Guid.NewGuid().ToString();
                    detail.Product           = this.productManager.Get((f.SelectedItem as Model.Product).ProductId);
                    detail.ProductId         = detail.Product.ProductId;
                    detail.OtherCompactCount = 0;
                    detail.OtherCompactPrice = 0;
                    detail.InDepotCount      = 0;
                    detail.OtherCompactMoney = 0;
                    detail.ProductUnit       = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName;
                    Model.BomParentPartInfo bompar = this.bomParentPartInfoManager.Get(detail.Product);
                    if (bompar != null)
                    {
                        foreach (Model.BomComponentInfo comm in this.bomComponentInfoManager.Select(bompar))
                        {
                            Model.ProduceOtherCompactMaterial mater = new Model.ProduceOtherCompactMaterial();
                            mater.ProduceOtherCompactMaterialId = Guid.NewGuid().ToString();
                            mater.Product         = comm.Product;
                            mater.ProductId       = comm.ProductId;
                            mater.ProductUnit     = comm.Unit;
                            mater.ProduceQuantity = 0;
                            mater.ParentProduct   = product;
                            mater.ParentProductId = product.ProductId;
                            this._produceOtherCompact.DetailMaterial.Add(mater);
                        }
                    }

                    // detail.Inumber = this._produceOtherMaterial.Details.Count + 1;
                    //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName;
                    detail.ProductSpecification = (f.SelectedItem as Model.Product).ProductSpecification;
                    detail.Inumber = this._produceOtherCompact.Details.Count + 1;
                    this._produceOtherCompact.Details.Add(detail);
                }

                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                //this.bindingSourceMaterial.Position = this.bindingSourceMaterial.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
                this.gridControl2.RefreshDataSource();
            }
            f.Dispose();
            System.GC.Collect();

            //if (f.ShowDialog(this) == DialogResult.OK)
            //{
            //    Model.Product product = f.SelectedItem as Model.Product;
            //    Model.ProduceOtherCompactDetail detail = new Book.Model.ProduceOtherCompactDetail();
            //    detail.OtherCompactDetailId = Guid.NewGuid().ToString();
            //    detail.Product = f.SelectedItem as Model.Product;
            //    detail.ProductId = (f.SelectedItem as Model.Product).ProductId;
            //    detail.OtherCompactCount = 0;
            //    detail.OtherCompactPrice = 0;
            //    detail.InDepotCount = 0;
            //    detail.OtherCompactMoney = 0;
            //    //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName;
            //    detail.ProductSpecification = (f.SelectedItem as Model.Product).ProductSpecification;
            //    this._produceOtherCompact.Details.Add(detail);
            //    this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
            //    this.gridControl1.RefreshDataSource();

            //}
        }
예제 #19
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._produceOtherInDepot.Details.Count > 0 && this._produceOtherInDepot.Details[0] != null && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId))
                {
                    this._produceOtherInDepot.Details.RemoveAt(0);
                }
                Model.ProduceOtherInDepotDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherInDepotDetail();
                        detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                        // detail.Inumber = this._produceMaterial.Details.Count + 1;
                        detail.Product                 = this.productManager.Get(product.ProductId);
                        detail.ProductId               = detail.Product.ProductId;
                        detail.ProductGuige            = (f.SelectedItem as Model.Product).ProductSpecification;
                        detail.ProduceQuantity         = 0;
                        detail.ProducePrice            = 0;
                        detail.ProduceMoney            = 0;
                        detail.ProcessPrice            = 0;
                        detail.ProduceInDepotQuantity  = 0;
                        detail.ProduceTransferQuantity = 0;
                        if (detail.Product.DepotUnit != null)
                        {
                            detail.ProductUnit = detail.Product.DepotUnit.CnName;
                        }
                        this._produceOtherInDepot.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.ProduceOtherInDepotDetail();
                    Model.Product product = f.SelectedItem as Model.Product;
                    //  detail.Inumber = this._produceOtherInDepot.Details.Count + 1;
                    detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                    detail.Product                 = this.productManager.Get(product.ProductId);
                    detail.ProductId               = detail.Product.ProductId;
                    detail.ProductGuige            = detail.Product.ProductSpecification;
                    detail.ProduceQuantity         = 0;
                    detail.ProducePrice            = 0;
                    detail.ProduceMoney            = 0;
                    detail.ProcessPrice            = 0;
                    detail.ProduceInDepotQuantity  = 0;
                    detail.ProduceTransferQuantity = 0;
                    if (detail.Product.DepotUnit != null)
                    {
                        detail.ProductUnit = detail.Product.DepotUnit.CnName;
                    }
                    this._produceOtherInDepot.Details.Add(detail);
                    //this.bindingSourceProductId.DataSource = productManager.Select();
                }
                this.gridControl1.RefreshDataSource();
                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                f.Dispose();
                GC.Collect();
            }
        }
예제 #20
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this.invoice.Details.Count > 0 && string.IsNullOrEmpty(this.invoice.Details[0].ProductId))
                {
                    this.invoice.Details.RemoveAt(0);
                }
                Model.InvoiceXTDetail detail = null;
                if (Book.UI.Invoices.ChooseProductForm.ProductList != null || Book.UI.Invoices.ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in Book.UI.Invoices.ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.InvoiceXTDetail();
                        detail.InvoiceXTDetailId = Guid.NewGuid().ToString();
                        detail.Product           = product;
                        detail.ProductId         = product.ProductId;
                        detail.Invoice           = this.invoice;
                        detail.Inumber           = this.invoice.Details.Count + 1;
                        //detail.InvoiceId = this.invoice.InvoiceId;
                        detail.InvoiceXTDetailDiscount     = decimal.Zero;
                        detail.InvoiceXTDetailDiscountRate = 0;
                        detail.InvoiceXTDetailMoney0       = decimal.Zero;
                        detail.InvoiceXTDetailMoney1       = decimal.Zero;
                        detail.InvoiceXTDetailNote         = "";
                        detail.InvoiceXTDetailPrice        = decimal.Zero;
                        detail.InvoiceXTDetailQuantity     = 1;
                        detail.InvoiceXTDetailTax          = decimal.Zero;
                        detail.InvoiceXTDetailTaxRate      = 0;
                        detail.InvoiceXTDetailZS           = false;
                        detail.InvoiceProductUnit          = detail.Product.SellUnit == null ? null : detail.Product.SellUnit.CnName;
                        this.invoice.Details.Add(detail);
                    }
                }

                if (Book.UI.Invoices.ChooseProductForm.ProductList == null || Book.UI.Invoices.ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.InvoiceXTDetail();
                    detail.InvoiceXTDetailId = Guid.NewGuid().ToString();
                    Model.Product product = f.SelectedItem as Model.Product;
                    detail.Product   = product;
                    detail.ProductId = product.ProductId;
                    detail.Invoice   = this.invoice;
                    detail.Inumber   = this.invoice.Details.Count + 1;
                    //detail.InvoiceId = this.invoice.InvoiceId;
                    detail.InvoiceXTDetailDiscount     = decimal.Zero;
                    detail.InvoiceXTDetailDiscountRate = 0;
                    detail.InvoiceXTDetailMoney0       = decimal.Zero;
                    detail.InvoiceXTDetailMoney1       = decimal.Zero;
                    detail.InvoiceXTDetailNote         = "";
                    detail.InvoiceXTDetailPrice        = decimal.Zero;
                    detail.InvoiceXTDetailQuantity     = 1;
                    detail.InvoiceXTDetailTax          = decimal.Zero;
                    detail.InvoiceXTDetailTaxRate      = 0;
                    detail.InvoiceXTDetailZS           = false;
                    detail.InvoiceProductUnit          = detail.Product.SellUnit == null ? null : detail.Product.SellUnit.CnName;
                    this.invoice.Details.Add(detail);
                }
                this.gridControl1.RefreshDataSource();
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
                f.Dispose();
                System.GC.Collect();
            }
        }