Exemple #1
0
        private void Validate(Book.Model.InvoiceCO invoice)
        {
            if (invoice.Supplier == null)
            {
                throw new Helper.RequireValueException("Company");
            }

            if (invoice.Details.Count == 0)
            {
                throw new Helper.RequireValueException("Details");
            }
            else
            {
                if (string.IsNullOrEmpty(invoice.Details[0].ProductId))
                {
                    if (invoice.Details.Count <= 1)
                    {
                        throw new Helper.RequireValueException("Details");
                    }
                }
            }
            //foreach (Model.InvoiceCODetail detail in invoice.Details)
            //{
            //    if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId)) continue;
            //    //if (detail.InvoiceCODetailPrice == 0)
            //    //{
            //    //    throw new Helper.RequireValueException("Price");
            //    //}
            //}
        }
 public void Delete(Book.Model.InvoiceCO invoice)
 {
     sqlmapper.Delete("InvoiceCODetail.delete_by_invoiceid", invoice.InvoiceId);
 }
 public IList <Book.Model.InvoiceCODetail> Select(Book.Model.InvoiceCO invoice)
 {
     return(sqlmapper.QueryForList <Model.InvoiceCODetail>("InvoiceCODetail.select_by_invoiceid", invoice.InvoiceId));
 }
Exemple #4
0
 public IList <Book.Model.InvoiceCGDetail> SelectCount(Book.Model.InvoiceCO invoice)
 {
     return(sqlmapper.QueryForList <Model.InvoiceCGDetail>("InvoiceCGDetail.select_count", invoice.InvoiceId));
 }
Exemple #5
0
 public void UpdateAccess(Book.Model.InvoiceCO invoiceCO)
 {
     accessor.Updates(invoiceCO);
 }
Exemple #6
0
        //private void AddDataRows()
        //{
        //    Model.PCOtherCheckDetail pcocDetail = new Book.Model.PCOtherCheckDetail();
        //    pcocDetail.PCOtherCheckDetailId = Guid.NewGuid().ToString();
        //    pcocDetail.PCOtherCheckId = this._PCOtherCheck.PCOtherCheckId;
        //    this._PCOtherCheck.Detail.Add(pcocDetail);

        //    this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(pcocDetail);
        //}
        #endregion

        //选择采购入库单据
        private void btnSelectCaiGou_Click(object sender, EventArgs e)
        {
            Book.UI.Invoices.CG.SearchCGDetail cgform = new Book.UI.Invoices.CG.SearchCGDetail();
            if (cgform.ShowDialog() == DialogResult.OK)
            {
                if (cgform.selectItems.Count > 0)
                {
                    BL.InvoiceCOManager mCOM = new Book.BL.InvoiceCOManager();
                    //Model.InvoiceCO co = cgform.Invoice;
                    //清空数据
                    if (this._PCOtherCheck.FromPCType < 0)
                    {
                        this._PCOtherCheck.Detail.Clear();
                    }
                    this._PCOtherCheck.FromPCType = 1;
                    //this.lcDanJuId.Text = "採購入庫單編號:";
                    //对控件进行赋值
                    //this.textInvoiceCusXOId.Text = mCOM.Get(cgform.selectItems[0].InvoiceCOId) == null ? "" : mCOM.Get(cgform.selectItems[0].InvoiceCOId).InvoiceCustomXOId;//客户订单编号
                    this.Ncc_Supplier.EditValue = cgform.selectItems[0].Invoice == null ? null : cgform.selectItems[0].Invoice.Supplier;//厂商

                    //this.textInvoiceCusXOId.Text = cgform.key[0].Invoice.InvoiceCustomXOId;     //客户订单编号
                    //this.Ncc_Supplier.EditValue = cgform.key[0].Invoice.Supplier;               //厂商

                    Model.InvoiceCO co = new Book.Model.InvoiceCO();
                    foreach (Model.InvoiceCGDetail item in cgform.selectItems)
                    {
                        Model.PCOtherCheckDetail detail = new Model.PCOtherCheckDetail();                                //详细
                        detail.PCOtherCheckDetailId = Guid.NewGuid().ToString();                                         //详细本身编号
                        detail.PCOtherCheckId       = this._PCOtherCheck.PCOtherCheckId;                                 //头编号
                        detail.FromInvoiceDetailID  = item.InvoiceCGDetailId;                                            //来源详细本身编号
                        detail.FromInvoiceID        = item.InvoiceId;                                                    //来源详细头编号
                        detail.ProceduresId         = null;                                                              //工序编号
                        detail.Procedures           = null;                                                              //加工
                        detail.ProductId            = item.ProductId;                                                    //商品编号
                        detail.Product = item.Product;                                                                   //品名
                        detail.PCOtherCheckDetailDesc     = item.Product == null ? "" : item.Product.ProductDescription; //说明
                        detail.PCOtherCheckDetailQuantity = 0;                                                           //数量
                        detail.ProductUnit = item.InvoiceProductUnit;                                                    //单位

                        co = mCOM.Get(item.InvoiceCOId);
                        if (co == null)
                        {
                            detail.PerspectiveRate = "";
                            detail.DeliveryDate    = null;
                        }
                        else
                        {
                            try
                            {
                                detail.PerspectiveRate = co.Customer == null ? "" : mCOM.Get(cgform.selectItems[0].InvoiceCOId).Customer.CheckedStandard;//透视率
                            }
                            catch
                            {
                                detail.PerspectiveRate = "";
                            }
                            detail.DeliveryDate = co.InvoiceYjrq;//交期
                        }

                        detail.InQuantity  = item.InvoiceCGDetailQuantity;                      //进厂数量
                        detail.OutQuantity = 0;                                                 //出厂数量
                        detail.Determinant = "";                                                //判定
                        detail.PCOtherCheckDetailFromPC = "1";                                  //来源于 采购入库订单

                        //客户订单编号
                        detail.InvoiceCusXOId = co == null ? "" : co.InvoiceCustomXOId;
                        this._PCOtherCheck.Detail.Add(detail);
                    }
                    this.gridControl1.RefreshDataSource();
                }
            }
            cgform.Dispose();
            GC.Collect();
        }
Exemple #7
0
        public EditForm(IList <Model.InvoiceCGDetail> list)
            : this()
        {
            this.AddNew();

            BL.InvoiceCOManager mCOM = new Book.BL.InvoiceCOManager();
            this._PCOtherCheck.FromPCType = 1;
            //this.Ncc_Supplier.EditValue = list[0].Invoice == null ? null : list[0].Invoice.Supplier;//厂商
            this._PCOtherCheck.Supplier = list[0].Invoice == null ? null : list[0].Invoice.Supplier;

            //this.textInvoiceCusXOId.Text = cgform.key[0].Invoice.InvoiceCustomXOId;     //客户订单编号
            //this.Ncc_Supplier.EditValue = cgform.key[0].Invoice.Supplier;               //厂商

            Model.InvoiceCO co = new Book.Model.InvoiceCO();
            foreach (Model.InvoiceCGDetail item in list)
            {
                Model.PCOtherCheckDetail detail = new Model.PCOtherCheckDetail();       //详细
                detail.PCOtherCheckDetailId    = Guid.NewGuid().ToString();             //详细本身编号
                detail.PCOtherCheckId          = this._PCOtherCheck.PCOtherCheckId;     //头编号
                detail.FromInvoiceDetailID     = item.InvoiceCGDetailId;                //来源详细本身编号
                detail.FromInvoiceID           = item.InvoiceId;                        //来源详细头编号
                detail.PCOtherCheckDetailDesc1 = item.InvoiceCOId;
                detail.ProceduresId            = null;                                  //工序编号
                detail.Procedures = null;                                               //加工
                detail.ProductId  = item.ProductId;                                     //商品编号
                detail.Product    = item.Product;                                       //品名
                //detail.PCOtherCheckDetailDesc = item.Product == null ? "" : item.Product.ProductDescription;//说明
                detail.PCOtherCheckDetailQuantity = 0;                                  //数量
                detail.ProductUnit = item.InvoiceProductUnit;                           //单位

                co = mCOM.Get(item.InvoiceCOId);
                if (co == null)
                {
                    detail.PerspectiveRate = "";
                    detail.DeliveryDate    = null;
                }
                else
                {
                    try
                    {
                        detail.PerspectiveRate = co.Customer == null ? "" : mCOM.Get(list[0].InvoiceCOId).Customer.CheckedStandard;//透视率
                    }
                    catch
                    {
                        detail.PerspectiveRate = "";
                    }
                    detail.DeliveryDate = co.InvoiceYjrq;//交期
                }

                detail.InQuantity  = item.InvoiceCGDetailQuantity;                      //进厂数量
                detail.OutQuantity = 0;                                                 //出厂数量
                detail.Determinant = "";                                                //判定
                detail.PCOtherCheckDetailFromPC = "1";                                  //来源于 采购入库订单

                //客户订单编号
                detail.InvoiceCusXOId = co == null ? "" : co.InvoiceCustomXOId;
                this._PCOtherCheck.Detail.Add(detail);
            }
            this.tag    = 1;
            this.action = "insert";
        }