示例#1
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            Invoices.ChooseProductForm f = new Invoices.ChooseProductForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (Invoices.ChooseProductForm.ProductList != null && Invoices.ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in Invoices.ChooseProductForm.ProductList)
                    {
                        Model.PCEarplugsStayWireCheckDetail detail = new Book.Model.PCEarplugsStayWireCheckDetail();
                        detail.PCEarplugsStayWireCheckDetailId = Guid.NewGuid().ToString();
                        detail.Number    = (this._pCEarplugsStayWireCheck.Details.Count + 1).ToString();
                        detail.Product   = product;
                        detail.ProductId = product.ProductId;
                        this._pCEarplugsStayWireCheck.Details.Add(detail);
                        this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
                    }
                }
                else if (Invoices.ChooseProductForm.ProductList == null || Invoices.ChooseProductForm.ProductList.Count == 0)
                {
                    Model.PCEarplugsStayWireCheckDetail detail = new Book.Model.PCEarplugsStayWireCheckDetail();
                    detail.PCEarplugsStayWireCheckDetailId = Guid.NewGuid().ToString();
                    detail.Product   = f.SelectedItem as Model.Product;
                    detail.ProductId = (f.SelectedItem as Model.Product).ProductId;
                    this._pCEarplugsStayWireCheck.Details.Add(detail);
                    this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
                }

                this.gridControl1.RefreshDataSource();
            }
        }
示例#2
0
        //选择加工单
        private void btn_PronoteHeader_Click(object sender, EventArgs e)
        {
            PronoteHeader.ChoosePronoteHeaderDetailsForm f = new Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (f.SelectItems != null)
                {
                    foreach (var item in f.SelectItems)
                    {
                        Model.PCEarplugsStayWireCheckDetail detail = new Book.Model.PCEarplugsStayWireCheckDetail();
                        detail.PCEarplugsStayWireCheckDetailId = Guid.NewGuid().ToString();
                        detail.Number            = (this._pCEarplugsStayWireCheck.Details.Count + 1).ToString();
                        detail.FromId            = item.PronoteHeaderID;
                        detail.Product           = item.Product;
                        detail.ProductId         = item.ProductId;
                        detail.ProductUnit       = item.ProductUnit;
                        detail.InvoiceXOId       = item.InvoiceXOId;
                        detail.InvoiceXOQuantity = item.InvoiceXODetailQuantity;

                        Model.InvoiceXO xo = invoiceXOManager.Get(detail.InvoiceXOId);
                        if (xo != null)
                        {
                            detail.InvoiceXO = xo;
                        }


                        this._pCEarplugsStayWireCheck.Details.Add(detail);
                    }

                    this.gridControl1.RefreshDataSource();
                }
            }
        }
示例#3
0
        //委外加工單
        private void btn_SelectOtherCompact_Click(object sender, EventArgs e)
        {
            ProduceOtherCompact.ChooseOutContract f = new Book.UI.produceManager.ProduceOtherCompact.ChooseOutContract();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (f.key != null)
                {
                    foreach (var item in f.key)
                    {
                        Model.PCEarplugsStayWireCheckDetail detail = new Book.Model.PCEarplugsStayWireCheckDetail();
                        detail.PCEarplugsStayWireCheckDetailId = Guid.NewGuid().ToString();
                        detail.Number      = (this._pCEarplugsStayWireCheck.Details.Count + 1).ToString();
                        detail.FromId      = item.ProduceOtherCompactId;
                        detail.Product     = item.Product;
                        detail.ProductId   = item.ProductId;
                        detail.ProductUnit = item.ProductUnit;
                        if (!string.IsNullOrEmpty(item.ProduceOtherCompactId))
                        {
                            Model.ProduceOtherCompact model = new BL.ProduceOtherCompactManager().Get(item.ProduceOtherCompactId);
                            if (model != null)
                            {
                                detail.InvoiceXOId = model.InvoiceXOId;
                            }
                        }
                        detail.InvoiceXOQuantity = item.OtherCompactCount.HasValue ? item.OtherCompactCount.Value : 0;

                        Model.InvoiceXO xo = invoiceXOManager.Get(detail.InvoiceXOId);
                        if (xo != null)
                        {
                            detail.InvoiceXO = xo;
                        }

                        this._pCEarplugsStayWireCheck.Details.Add(detail);
                    }

                    this.gridControl1.RefreshDataSource();
                }
                f.Dispose();
                GC.Collect();
            }
        }