Example #1
0
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.ProduceOtherInDepotDetail> details = this.bindingSourceDetails.DataSource as IList <Model.ProduceOtherInDepotDetail>;

            if (details == null || details.Count < 1)
            {
                return;
            }

            Model.ProduceOtherInDepotDetail detail = details[e.ListSourceRowIndex];
            switch (e.Column.Name)
            {
            case "ColProductId":
                if (detail == null)
                {
                    return;
                }
                e.DisplayText = string.IsNullOrEmpty(detail.Product.Id) ? "" : detail.Product.Id;
                break;
                //case "gridColumn15":    //未到货数量,订单数量-截止到该入库单所有已进货数量
                //    double hasInQty = produceOtherInDepotDetailManager.SelectHasInQty(detail.ProduceOtherCompactDetailId, detail.ProduceOtherInDepotId);
                //    double noInQty = detail.OrderQuantity.HasValue ? detail.OrderQuantity.Value - hasInQty : 0;

                //    e.DisplayText = (noInQty < 0 ? 0 : noInQty).ToString();
                //break;
            }
        }
Example #2
0
        private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            Model.ProduceOtherInDepotDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.ProduceOtherInDepotDetail;

            if (e.Column == this.ColProductId || e.Column == this.gridColumnCustomPro || e.Column == this.gridColumn2)
            {
                if (detail != null)
                {
                    Model.Product p = productManager.Get(e.Value.ToString());
                    detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                    detail.ProduceQuantity             = 0;
                    detail.ProducePrice = 0;
                    detail.ProduceMoney = 0;
                    detail.ProcessPrice = 0;
                    detail.Product      = p;
                    detail.ProductId    = p.ProductId;

                    detail.ProductUnit  = p.MainUnit == null ? "" : p.MainUnit.CnName;
                    detail.ProductGuige = p.ProductSpecification;

                    this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                }
                this.gridControl1.RefreshDataSource();
            }
            //if (e.Column == this.gridColumn7)
            //{
            //    detail.DepotPosition = null;
            //}
        }
Example #3
0
 protected override void AddNew()
 {
     this.newChooseContorlDepot.EditValue         = null;
     this.bindingSourceDepotPositionId.DataSource = null;
     this._produceOtherInDepot = new Model.ProduceOtherInDepot();
     this._produceOtherInDepot.ProduceOtherInDepotDate = DateTime.Now;
     this._produceOtherInDepot.PayDate = DateTime.Now;
     this._produceOtherInDepot.ProduceOtherInDepotId = this.produceOtherInDepotManager.GetId();// Guid.NewGuid().ToString();
     this._produceOtherInDepot.Employee0             = BL.V.ActiveOperator.Employee;
     this._produceOtherInDepot.Details = new List <Model.ProduceOtherInDepotDetail>();
     if (this.action == "insert")
     {
         Model.ProduceOtherInDepotDetail detail = new Model.ProduceOtherInDepotDetail();
         detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
         detail.ProduceQuantity             = 0;
         detail.ProducePrice = 0;
         detail.ProductGuige = "";
         detail.ProduceMoney = 0;
         detail.ProcessPrice = 0;
         detail.ProductUnit  = "";
         detail.Product      = new Book.Model.Product();
         this._produceOtherInDepot.Details.Add(detail);
         this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
     }
 }
Example #4
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (this.bindingSourceDetails.Current != null)
            {
                this._produceOtherInDepot.Details.Remove(this.bindingSourceDetails.Current as Book.Model.ProduceOtherInDepotDetail);

                if (this._produceOtherInDepot.Details.Count == 0)
                {
                    Model.ProduceOtherInDepotDetail detail = new Model.ProduceOtherInDepotDetail();
                    detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                    detail.ProduceQuantity             = 0;
                    detail.ProducePrice = 0;
                    detail.ProductGuige = "";
                    detail.ProduceMoney = 0;
                    detail.ProcessPrice = 0;
                    detail.ProductUnit  = "";
                    detail.Product      = new Book.Model.Product();
                    this._produceOtherInDepot.Details.Add(detail);
                    this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                }

                decimal d = 0;
                foreach (Model.ProduceOtherInDepotDetail model in this._produceOtherInDepot.Details)
                {
                    d += Convert.ToDecimal(model.ProduceMoney);
                }
                this.txt_Sum.Text   = d.ToString();
                this.txt_Tax.Text   = (Convert.ToDouble(d) * 0.05).ToString();
                this.txt_Total.Text = (Convert.ToDouble(d) * (1.05)).ToString();

                this.gridControl1.RefreshDataSource();
            }
        }
 /// <summary>
 /// Update a ProduceOtherInDepotDetail.
 /// </summary>
 public void Update(Model.ProduceOtherInDepotDetail produceOtherInDepotDetail)
 {
     //
     // todo: add other logic here.
     //
     accessor.Update(produceOtherInDepotDetail);
 }
 /// <summary>
 /// Insert a ProduceOtherInDepotDetail.
 /// </summary>
 public void Insert(Model.ProduceOtherInDepotDetail produceOtherInDepotDetail)
 {
     //
     // todo:add other logic here
     //
     accessor.Insert(produceOtherInDepotDetail);
 }
Example #7
0
        //选择委外合同
        private void simpleButtonOther_Click_1(object sender, EventArgs e)
        {
            ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract();
            if (f.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            if (f.key == null || f.key.Count == 0)
            {
                return;
            }
            Model.ProduceOtherCompact OtherCompact = f.key[0].ProduceOtherCompact;

            if (this._produceOtherInDepot.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId))
            {
                this._produceOtherInDepot.Details.RemoveAt(0);
            }

            this.newChooseContorlSipu.EditValue = OtherCompact.Supplier;
            //this.textEditCusXOId.Text = OtherCompact.CustomerInvoiceXOId;
            //if (!string.IsNullOrEmpty(OtherCompact.MRSHeaderId))
            //{
            //    Model.MRSHeader mrsHeader = this.mRSHeaderManager.Get(OtherCompact.MRSHeaderId);
            //    if (mrsHeader != null)
            //    {
            //        Model.MPSheader mPSheader = this.mPSheaderManager.Get(mrsHeader.MPSheaderId);
            //        if (mPSheader != null)
            //        {
            //            Model.InvoiceXO invoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId);
            //            this.textEditCusXOId.Text = invoiceXO == null ? string.Empty : invoiceXO.CustomerInvoiceXOId;
            //        }
            //    }
            //}
            foreach (Model.ProduceOtherCompactDetail item in f.key)
            {
                Model.ProduceOtherInDepotDetail detail = new Model.ProduceOtherInDepotDetail();
                detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                detail.ProduceOtherCompactDetailId = item.OtherCompactDetailId;
                detail.CustomerId              = item.ProduceOtherCompact.CustomerId;
                detail.InvoiceCusId            = item.CustomInvoiceXOId;
                detail.Product                 = item.Product;
                detail.ProductId               = item.ProductId;
                detail.ProductUnit             = item.ProductUnit;
                detail.ProduceQuantity         = item.OtherCompactCount - Convert.ToDouble(item.InDepotCount);
                detail.ProduceInDepotQuantity  = 0;
                detail.ProduceTransferQuantity = 0;
                detail.ProcessPrice            = 0;
                detail.Description             = item.Description;
                detail.ProduceOtherCompactId   = item.ProduceOtherCompactId;
                detail.HandbookId              = item.HandbookId;
                detail.HandbookProductId       = item.HandbookProductId;

                //客户订单编号
                detail.InvoiceCusId = item.CustomInvoiceXOId;
                this._produceOtherInDepot.Details.Add(detail);
            }
            this.gridControl1.RefreshDataSource();
        }
Example #8
0
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column == this.gridColProduceQuantity || e.Column == this.gridColProcessPrice)
            {
                decimal price    = decimal.Zero;
                decimal quantity = decimal.Zero;

                if (e.Column == this.gridColProcessPrice)
                {
                    decimal.TryParse(e.Value == null ? "0" : e.Value.ToString(), out price);
                    decimal.TryParse(this.gridView1.GetRowCellValue(e.RowHandle, this.gridColProduceQuantity).ToString(), out quantity);
                }
                if (e.Column == this.gridColProduceQuantity)
                {
                    //2022年4月3日09:04:44:委外入库单价从委外合同获取,不能抓厂商商品单价
                    Model.ProduceOtherInDepotDetail detail = this.bindingSourceDetails.Current as Model.ProduceOtherInDepotDetail;
                    price = Convert.ToDecimal(detail.ProcessPrice);
                    if (price == decimal.Zero)
                    {
                        decimal.TryParse(this.gridView1.GetRowCellValue(e.RowHandle, this.gridColProcessPrice) == null ? "0" : this.gridView1.GetRowCellValue(e.RowHandle, this.gridColProcessPrice).ToString(), out price);
                    }
                    decimal.TryParse(this.gridView1.GetRowCellValue(e.RowHandle, this.gridColProduceQuantity).ToString(), out quantity);

                    //decimal.TryParse(e.Value == null ? "0" : e.Value.ToString(), out quantity);
                    //string PriceRange = string.Empty;
                    //Model.ProduceOtherInDepotDetail detail = this.bindingSourceDetails.Current as Model.ProduceOtherInDepotDetail;
                    //if ((this.newChooseContorlSipu.EditValue as Model.Supplier) == null)
                    //    MessageBox.Show("廠商為空,不能計算商品單價!", this.Text);
                    //else
                    //    PriceRange = (new BL.SupplierProductManager()).GetPriceRangeForSupAndProduct((this.newChooseContorlSipu.EditValue as Model.Supplier).SupplierId, detail.ProductId);
                    //if (string.IsNullOrEmpty(PriceRange))
                    //{
                    //    decimal.TryParse(this.gridView1.GetRowCellValue(e.RowHandle, this.gridColProcessPrice).ToString(), out price);
                    //}
                    //else
                    //{
                    //    price = BL.SupplierProductManager.CountPrice(PriceRange, Convert.ToDouble(quantity));
                    //    this.gridView1.SetRowCellValue(e.RowHandle, this.gridColProcessPrice, price);
                    //}
                }

                this.gridView1.SetRowCellValue(e.RowHandle, this.ColProduceMoney, price * quantity);
                decimal d = 0;
                foreach (Model.ProduceOtherInDepotDetail model in this._produceOtherInDepot.Details)
                {
                    d += Convert.ToDecimal(model.ProduceMoney);
                }
                this.txt_Sum.Text   = d.ToString();
                this.txt_Tax.Text   = (Convert.ToDouble(d) * 0.05).ToString();
                this.txt_Total.Text = (Convert.ToDouble(d) * (1.05)).ToString();
            }
            //this.gridControl1.RefreshDataSource();
        }
Example #9
0
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column == this.gridColProduceQuantity || e.Column == this.gridColProcessPrice)
            {
                decimal price    = decimal.Zero;
                decimal quantity = decimal.Zero;

                if (e.Column == this.gridColProcessPrice)
                {
                    decimal.TryParse(e.Value == null ? "0" : e.Value.ToString(), out price);
                    decimal.TryParse(this.gridView1.GetRowCellValue(e.RowHandle, this.gridColProduceQuantity).ToString(), out quantity);
                }
                if (e.Column == this.gridColProduceQuantity)
                {
                    decimal.TryParse(e.Value == null ? "0" : e.Value.ToString(), out quantity);
                    string PriceRange = string.Empty;
                    Model.ProduceOtherInDepotDetail detail = this.bindingSourceDetails.Current as Model.ProduceOtherInDepotDetail;

                    if ((this.newChooseContorlSipu.EditValue as Model.Supplier) == null)
                    {
                        MessageBox.Show("廠商為空,不能計算商品單價!", this.Text);
                    }
                    else
                    {
                        PriceRange = (new BL.SupplierProductManager()).GetPriceRangeForSupAndProduct((this.newChooseContorlSipu.EditValue as Model.Supplier).SupplierId, detail.ProductId);
                    }
                    if (string.IsNullOrEmpty(PriceRange))
                    {
                        decimal.TryParse(this.gridView1.GetRowCellValue(e.RowHandle, this.gridColProcessPrice).ToString(), out price);
                    }
                    else
                    {
                        price = BL.SupplierProductManager.CountPrice(PriceRange, Convert.ToDouble(quantity));
                        this.gridView1.SetRowCellValue(e.RowHandle, this.gridColProcessPrice, price);
                    }
                }
                this.gridView1.SetRowCellValue(e.RowHandle, this.ColProduceMoney, price * quantity);

                UpdateMoneyFields();
            }
        }
Example #10
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (this.bindingSourceDetails.Current != null)
            {
                this._produceOtherInDepot.Details.Remove(this.bindingSourceDetails.Current as Book.Model.ProduceOtherInDepotDetail);

                if (this._produceOtherInDepot.Details.Count == 0)
                {
                    Model.ProduceOtherInDepotDetail detail = new Model.ProduceOtherInDepotDetail();
                    detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                    detail.ProduceQuantity             = 0;
                    detail.ProducePrice = 0;
                    detail.ProductGuige = "";
                    detail.ProduceMoney = 0;
                    detail.ProcessPrice = 0;
                    detail.ProductUnit  = "";
                    detail.Product      = new Book.Model.Product();
                    this._produceOtherInDepot.Details.Add(detail);
                    this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                }

                this.gridControl1.RefreshDataSource();
            }
        }
Example #11
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();
            }
        }
 public void Update(Model.ProduceOtherInDepotDetail e)
 {
     this.Update <Model.ProduceOtherInDepotDetail>(e);
 }
 public void Insert(Model.ProduceOtherInDepotDetail e)
 {
     this.Insert <Model.ProduceOtherInDepotDetail>(e);
 }
Example #14
0
        //选择委外合同
        private void simpleButtonOther_Click_1(object sender, EventArgs e)
        {
            ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract();
            if (f.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            if (f.key == null || f.key.Count == 0)
            {
                return;
            }
            Model.ProduceOtherCompact OtherCompact = f.key[0].ProduceOtherCompact;

            if (this._produceOtherInDepot.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId))
            {
                this._produceOtherInDepot.Details.RemoveAt(0);
            }

            this.newChooseContorlSipu.EditValue = OtherCompact.Supplier;
            //this.textEditCusXOId.Text = OtherCompact.CustomerInvoiceXOId;
            //if (!string.IsNullOrEmpty(OtherCompact.MRSHeaderId))
            //{
            //    Model.MRSHeader mrsHeader = this.mRSHeaderManager.Get(OtherCompact.MRSHeaderId);
            //    if (mrsHeader != null)
            //    {
            //        Model.MPSheader mPSheader = this.mPSheaderManager.Get(mrsHeader.MPSheaderId);
            //        if (mPSheader != null)
            //        {
            //            Model.InvoiceXO invoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId);
            //            this.textEditCusXOId.Text = invoiceXO == null ? string.Empty : invoiceXO.CustomerInvoiceXOId;
            //        }
            //    }
            //}
            foreach (Model.ProduceOtherCompactDetail item in f.key)
            {
                IList <Model.PCOtherCheckDetail> PCOtherCheckDetailList = this.PCOtherCheckDetailManager.SelectByPOCDetailId(item.OtherCompactDetailId);
                Model.PCOtherCheckDetail         PCOtherCheckDetail     = null;
                if (PCOtherCheckDetailList != null && PCOtherCheckDetailList.Count > 0)
                {
                    PCOtherCheckDetail = PCOtherCheckDetailList[0];
                }
                if (PCOtherCheckDetail == null)
                {
                    MessageBox.Show("商品:" + item.Product.ToString() + " 完成進料檢驗的部分已全部入庫,或者未開具進料檢驗單!", this.Text, MessageBoxButtons.OK);
                    continue;
                }

                Model.ProduceOtherInDepotDetail detail = new Model.ProduceOtherInDepotDetail();
                detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                detail.ProduceOtherCompactDetailId = item.OtherCompactDetailId;
                detail.CustomerId   = item.ProduceOtherCompact.CustomerId;
                detail.InvoiceCusId = item.CustomInvoiceXOId;
                detail.Product      = item.Product;
                detail.ProductId    = item.ProductId;
                detail.ProductUnit  = item.ProductUnit;
                //detail.ProduceQuantity = item.OtherCompactCount - Convert.ToDouble(item.InDepotCount);
                detail.ProduceQuantity         = PCOtherCheckDetail.PCOtherCheckDetailQuantity;
                detail.ProduceInDepotQuantity  = 0;
                detail.ProduceTransferQuantity = 0;
                detail.ProcessPrice            = item.OtherCompactPrice;
                detail.Description             = item.Description;
                detail.ProduceOtherCompactId   = item.ProduceOtherCompactId;
                detail.ProduceMoney            = detail.ProcessPrice * Convert.ToDecimal(detail.ProduceQuantity);
                //客户订单编号
                detail.InvoiceCusId         = item.CustomInvoiceXOId;
                detail.PCOtherCheckDetailId = PCOtherCheckDetail.PCOtherCheckDetailId;
                this._produceOtherInDepot.Details.Add(detail);
            }
            this.gridControl1.RefreshDataSource();

            decimal d = 0;

            foreach (Model.ProduceOtherInDepotDetail model in this._produceOtherInDepot.Details)
            {
                d += Convert.ToDecimal(model.ProduceMoney);
            }
            this.txt_Sum.Text   = d.ToString();
            this.txt_Tax.Text   = (Convert.ToDouble(d) * 0.05).ToString();
            this.txt_Total.Text = (Convert.ToDouble(d) * (1.05)).ToString();
        }