Esempio n. 1
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            if (this._pCAssemblyInspection.Details == null || this._pCAssemblyInspection.Details.Count == 0)
            {
                MessageBox.Show("请先从加工单拉取第一条内容。", this.Text, MessageBoxButtons.OK);
                return;
            }
            else
            {
                Model.PCAssemblyInspectionDetail detail = new Book.Model.PCAssemblyInspectionDetail();
                detail.PCAssemblyInspectionDetailId   = Guid.NewGuid().ToString();
                detail.PCAssemblyInspectionId         = this._pCAssemblyInspection.PCAssemblyInspectionId;
                detail.PCAssemblyInspectionDetailDate = DateTime.Now;
                detail.Product   = this._pCAssemblyInspection.Details[0].Product;
                detail.ProductId = this._pCAssemblyInspection.Details[0].ProductId;

                //if (detail.Product != null)
                //{
                //    if (detail.Product.IsQiangHua == true)
                //        detail.Jiagongbie = "強化";
                //    else if (detail.Product.IsFangWu == true)
                //        detail.Jiagongbie = "防霧";
                //    else if (detail.Product.IsNoQiangFang == true)
                //        detail.Jiagongbie = "無強化防霧";
                //}

                //if (this._pCAssemblyInspection.PronoteHeader != null)
                //    detail.CustomerId = (this._pCAssemblyInspection.PronoteHeader.InvoiceXO == null ? null : this._pCAssemblyInspection.PronoteHeader.InvoiceXO.CustomerId);

                this._pCAssemblyInspection.Details.Add(detail);
                this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
            }

            this.gridControl1.RefreshDataSource();
        }
Esempio n. 2
0
        private void barPronoteHeader_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm pronoForm = new Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm(null, 0);
            if (pronoForm.ShowDialog(this) == DialogResult.OK)
            {
                if (pronoForm.SelectItems == null || pronoForm.SelectItems.Count == 0)
                {
                    Model.PronoteHeader currentModel = pronoForm.SelectItem;
                    if (currentModel != null)
                    {
                        this.txt_PronoteHeaderId.Text            = currentModel.PronoteHeaderID;
                        this._pCAssemblyInspection.PronoteHeader = currentModel;
                        Model.InvoiceXO xo = new BL.InvoiceXOManager().Get(currentModel.InvoiceXOId);
                        if (xo != null)
                        {
                            currentModel.InvoiceXO     = xo;
                            this.txt_InvoiceCusId.Text = xo.CustomerInvoiceXOId;
                        }
                        //this.txt_Model.Text = (currentModel.Product) == null ? "" : (currentModel.Product).CustomerProductName;
                        Model.Product p = new BL.ProductManager().Get(currentModel.ProductId);
                        Model.PCAssemblyInspectionDetail detail = new Book.Model.PCAssemblyInspectionDetail();
                        detail.PCAssemblyInspectionDetailId   = Guid.NewGuid().ToString();
                        detail.PCAssemblyInspectionDetailDate = DateTime.Now;
                        detail.PCAssemblyInspectionId         = this._pCAssemblyInspection.PCAssemblyInspectionId;
                        detail.Product    = p;
                        detail.ProductId  = currentModel.ProductId;
                        detail.CustomerId = xo == null ? null : xo.CustomerId;

                        if (p.IsQiangHua == true)
                        {
                            detail.Jiagongbie = "強化";
                        }
                        else if (p.IsFangWu == true)
                        {
                            detail.Jiagongbie = "防霧";
                        }
                        else if (p.IsNoQiangFang == true)
                        {
                            detail.Jiagongbie = "無強化防霧";
                        }

                        this._pCAssemblyInspection.Details.Add(detail);
                        this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
                    }
                }
                else
                {
                    foreach (var item in pronoForm.SelectItems)
                    {
                        Model.Product p = new BL.ProductManager().Get(item.ProductId);
                        Model.PCAssemblyInspectionDetail detail = new Book.Model.PCAssemblyInspectionDetail();
                        detail.PCAssemblyInspectionDetailId   = Guid.NewGuid().ToString();
                        detail.PCAssemblyInspectionDetailDate = DateTime.Now;
                        detail.PCAssemblyInspectionId         = this._pCAssemblyInspection.PCAssemblyInspectionId;
                        detail.Product   = p;
                        detail.ProductId = item.ProductId;
                        //detail.CustomerId = xo == null ? null : xo.CustomerId;

                        if (p.IsQiangHua == true)
                        {
                            detail.Jiagongbie = "強化";
                        }
                        else if (p.IsFangWu == true)
                        {
                            detail.Jiagongbie = "防霧";
                        }
                        else if (p.IsNoQiangFang == true)
                        {
                            detail.Jiagongbie = "無強化防霧";
                        }

                        this._pCAssemblyInspection.Details.Add(detail);
                        this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
            pronoForm.Dispose();
            GC.Collect();
        }