Example #1
0
        private void simpleButtonXO_Click(object sender, EventArgs e)
        {
            _produceOtherCompactDetail.Clear();
            ProduceOtherCompact.ChooseOutContract f = new Book.UI.produceManager.ProduceOtherCompact.ChooseOutContract();
            if (f.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            if (_produceOtherCompactDetail.Count != 0)
            {
                this._produceOtherMaterial.Details.Clear();

                if (_produceOtherCompactDetail != null)
                {
                    foreach (Model.ProduceOtherCompactDetail ProduceOtherCompactDetail in _produceOtherCompactDetail)
                    {
                        Model.ProduceOtherMaterialDetail produceOtherMaterialDetail = new Book.Model.ProduceOtherMaterialDetail();
                        produceOtherMaterialDetail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString();
                        if (ProduceOtherCompactDetail.Product != null)
                        {
                            produceOtherMaterialDetail.Product      = ProduceOtherCompactDetail.Product;
                            produceOtherMaterialDetail.ProductId    = ProduceOtherCompactDetail.Product.ProductId;
                            produceOtherMaterialDetail.ProductStock = ProduceOtherCompactDetail.Product.StocksQuantity;
                            if (ProduceOtherCompactDetail.Product.MainUnit != null)
                            {
                                produceOtherMaterialDetail.ProductUnit = ProduceOtherCompactDetail.Product.MainUnit.CnName;
                            }
                            produceOtherMaterialDetail.ProductSpecification = ProduceOtherCompactDetail.Product.ProductSpecification;
                        }
                        produceOtherMaterialDetail.MPSheaderId                  = ProduceOtherCompactDetail.MPSheaderId;
                        produceOtherMaterialDetail.OtherMaterialQuantity        = ProduceOtherCompactDetail.OtherCompactCount;
                        produceOtherMaterialDetail.OtherMaterialALLUserQuantity = ProduceOtherCompactDetail.OtherCompactCount;
                        produceOtherMaterialDetail.ProduceOtherMaterial         = this._produceOtherMaterial;
                        produceOtherMaterialDetail.ProduceOtherMaterialId       = this._produceOtherMaterial.ProduceOtherMaterialId;

                        produceOtherMaterialDetail.InvoiceXOId       = ProduceOtherCompactDetail.InvoiceXOId;
                        produceOtherMaterialDetail.InvoiceXODetailId = ProduceOtherCompactDetail.InvoiceXODetailId;
                        this._produceOtherMaterial.Details.Add(produceOtherMaterialDetail);
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
        }
Example #2
0
 private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Model.ProduceOtherMaterialDetail detail;
     ProduceOtherInDepot.ChooseProduceOtherCompactForm form = new Book.UI.produceManager.ProduceOtherInDepot.ChooseProduceOtherCompactForm("material");
     if (form.ShowDialog(this) == DialogResult.OK)
     {
         this._produceOtherMaterial.Details.Clear();
         this.textEditOtherCompact.Text = _compact.ProduceOtherCompactId;
         foreach (var item in produceOhterCompactMaterialManager.SelectIsInDepotMaterialDetail(_compact))
         {
             detail = new Book.Model.ProduceOtherMaterialDetail();
             detail.ProduceOtherMaterialDetailId  = Guid.NewGuid().ToString();
             detail.OtherMaterialQuantity         = item.ProduceQuantity;
             detail.ProduceOtherMaterialId        = this._produceOtherMaterial.ProduceOtherMaterialId;
             detail.ProduceOtherCompactMaterialId = item.ProduceOtherCompactMaterialId;
             detail.ProductUnit = item.ProductUnit;
             detail.ProductId   = item.ProductId;
             //detail.ProductStock = item.ProductStock;
             detail.Product = item.Product;
             this._produceOtherMaterial.Details.Add(detail);
         }
         this.gridControl1.RefreshDataSource();
     }
 }
Example #3
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();
        }