Ejemplo n.º 1
0
        private void Validate(Model.MPSheader mPSheader)
        {
            if (string.IsNullOrEmpty(mPSheader.Id))
            {
                throw new Helper.RequireValueException(Model.MPSheader.PRO_Id);
            }
            if (mPSheader.MPSStartDate == null)
            {
                throw new Helper.RequireValueException(Model.MPSheader.PRO_MPSStartDate);
            }
            if (mPSheader.MPSEndDate == null)
            {
                throw new Helper.RequireValueException(Model.MPSheader.PRO_MPSEndDate);
            }
            bool IsNullOrZero = false;

            foreach (var item in mPSheader.Details)
            {
                if (item.MPSdetailssum != null && item.MPSdetailssum.Value > 0)
                {
                    IsNullOrZero = true;
                }
            }

            if (IsNullOrZero == false)
            {
                throw new Helper.MessageValueException("數量不能為空或者零!");
            }
        }
Ejemplo n.º 2
0
        public bool ExistsExcept(Model.MPSheader e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.MPSheaderId) == null?null:Get(e.MPSheaderId).Id);
            return(sqlmapper.QueryForObject <bool>("MPSheader.existsexcept", paras));
        }
Ejemplo n.º 3
0
 public Model.MPSheader GetDetails(string mPSheaderId)
 {
     Model.MPSheader mPSheader = accessor.Get(mPSheaderId);
     if (mPSheader != null)
     {
         mPSheader.Details = MPSdetailsAccessor.Select(mPSheader);
     }
     return(mPSheader);
 }
Ejemplo n.º 4
0
        public RO1(string mPSheaderId)
        {
            InitializeComponent();

            this.mPSheader = this.mPSheaderManager.Get(mPSheaderId);

            if (this.mPSheader == null)
            {
                return;
            }

            this.mPSheader.Details = this.mPSdetailsManager.Select(this.mPSheader);

            this.DataSource = this.mPSheader.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.MPSdetails;
            this.xrLabelDate.Text           += DateTime.Now.ToShortDateString();
            //计划信息
            this.xrLabelMPSheaderId.Text = this.mPSheader.Id;
            //this.xrLabelMPSheaderName.Text=this.mPSheader.MPSheaderName;
            this.xrLabelMPSStartDate.Text = this.mPSheader.MPSStartDate.Value.ToString("yyyy-MM-dd");
            this.xrLabelMPSEndDate.Text   = this.mPSheader.MPSEndDate.Value.ToString("yyyy-MM-dd");
            this.xrLabelZhiJian.Text      = this.mPSheader.MPSheaderState;
            Model.InvoiceXO InvoiceXO = new BL.InvoiceXOManager().Get(this.mPSheader.InvoiceXOId);
            if (InvoiceXO != null)
            {
                this.xrLabelCustomer.Text = InvoiceXO.Customer.CustomerShortName;
                this.xrLabelZhiJian.Text  = InvoiceXO.xocustomer.CustomerShortName;
                this.xrLabelCusXOId.Text  = InvoiceXO.CustomerInvoiceXOId;
                this.xrLabelZhiJian.Text  = InvoiceXO.xocustomer.CheckedStandard;
            }
            // this.xrLabelMPSheaderDesc.Text=this.mPSheader.MPSheaderDesc;
            if (this.mPSheader.Employee0 != null)
            {
                this.xrLabelEmployee0.Text = this.mPSheader.Employee0.EmployeeName;
            }
            if (this.mPSheader.AuditEmp != null)
            {
                this.xrLabelEmployee1.Text = this.mPSheader.AuditEmp.EmployeeName;
            }

            //明细信息
            this.xrTableCell3.DataBindings.Add("Text", this.DataSource, Model.MPSdetails.PRO_Inumber);
            // this.xrTableProductId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id);
            this.xrTableProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            this.xrTableMPSdetailssum.DataBindings.Add("Text", this.DataSource, Model.MPSdetails.PRO_MPSdetailssum);
            this.xrTableProductUnit.DataBindings.Add("Text", this.DataSource, Model.MPSdetails.PRO_ProductUnit);
            // this.xrTableCellProductSpecification.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            this.xrTableMPSdetailsdes.DataBindings.Add("Text", this.DataSource, Model.MPSdetails.PRO_MPSdetailsdes);
            this.xrTableCusPro.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
            this.xrTableGuiGe.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            //this.xrTableCellCusPro.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Update a MPSheader.
 /// </summary>
 public void UpdateMPS(Model.MPSheader mPSheader)
 {
     //
     // todo: add other logic here.
     //
     Validate(mPSheader);
     if (this.ExistsExcept(mPSheader))
     {
         throw new Helper.InvalidValueException(Model.MPSheader.PRO_Id);
     }
     mPSheader.UpdateTime = DateTime.Now;
     accessor.Update(mPSheader);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Delete MPSheader by primary key.
        /// </summary>
        public void Delete(string mPSheaderId)
        {
            //
            // todo:add other logic here
            //
            Model.MPSheader model         = this.Get(mPSheaderId);
            string          invoiceKind   = this.GetInvoiceKind().ToLower();
            string          sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));

            SequenceManager.Decrement(sequencekey_d);

            accessor.Delete(mPSheaderId);
        }
Ejemplo n.º 7
0
        public void Delete(Model.MPSheader mPSheader)
        {
            try
            {
                BL.V.BeginTransaction();

                foreach (Model.MPSdetails mPSdetails in mPSheader.Details)
                {
                    Model.InvoiceXODetail xodetail = this.InvoiceXODetailAccessor.Get(mPSdetails.InvoiceXODetailId);
                    if (xodetail != null)
                    {
                        Model.MPSdetails md = MPSdetailsAccessor.Get(mPSdetails.MPSdetailsId);
                        if (xodetail.InvoiceMPSQuantity == null)
                        {
                            xodetail.InvoiceMPSQuantity = 0;
                        }
                        xodetail.InvoiceMPSQuantity = Convert.ToDouble(xodetail.InvoiceMPSQuantity) - Convert.ToDouble(md.MPSdetailssum);
                        xodetail.InvoiceMPSQuantity = xodetail.InvoiceMPSQuantity < 0 ? 0 : xodetail.InvoiceMPSQuantity;
                        if (xodetail.InvoiceMPSQuantity >= xodetail.InvoiceXODetailQuantity)
                        {
                            xodetail.DetailMPSState = 2;
                        }
                        else
                        {
                            if (xodetail.InvoiceMPSQuantity > 0)
                            {
                                xodetail.DetailMPSState = 1;
                            }
                            else
                            {
                                xodetail.DetailMPSState = 0;
                            }
                        }
                        //invoiceXODetail.InvoiceMPSQuantity = Convert.ToDouble(MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId));
                        invoiceManager.Update(xodetail);
                        UpdateInvoiceXOFlag(xodetail.Invoice);
                    }
                }

                accessor.Delete(mPSheader.MPSheaderId);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Ejemplo n.º 8
0
 private void TiGuiExists(Model.MPSheader model)
 {
     if (this.ExistsPrimary(model.MPSheaderId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));
         string sequencekey   = string.Format(invoiceKind);
         SequenceManager.Increment(sequencekey_y);
         SequenceManager.Increment(sequencekey_m);
         SequenceManager.Increment(sequencekey_d);
         SequenceManager.Increment(sequencekey);
         model.MPSheaderId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
         //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Insert a MPSheader.
        /// </summary>
        public void Insert(Model.MPSheader mPSheader)
        {
            //
            // todo:add other logic here
            //
            Validate(mPSheader);

            try
            {
                BL.V.BeginTransaction();
                mPSheader.InsertTime = DateTime.Now;
                TiGuiExists(mPSheader);
                mPSheader.UpdateTime = DateTime.Now;
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, mPSheader.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, mPSheader.InsertTime.Value.Year, mPSheader.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, mPSheader.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);

                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);

                if (mPSheader.Details != null && mPSheader.Details.Count > 0)
                {
                    mPSheader.InvoiceXOId = mPSheader.Details[0].InvoiceXOId;
                }
                accessor.Insert(mPSheader);

                foreach (Model.MPSdetails mPSdetails in mPSheader.Details)
                {
                    if (mPSdetails.Product == null || string.IsNullOrEmpty(mPSdetails.Product.ProductId))
                    {
                        continue;
                    }
                    mPSdetails.MPSheaderId = mPSheader.MPSheaderId;
                    mPSdetails.MPSEndState = false;
                    invoiceXODetail        = invoiceManager.Get(mPSdetails.InvoiceXODetailId);
                    double ss = MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId);
                    MPSdetailsAccessor.Insert(mPSdetails);

                    if (invoiceXODetail != null)
                    {
                        if (invoiceXODetail.InvoiceMPSQuantity == null)
                        {
                            invoiceXODetail.InvoiceMPSQuantity = 0;
                        }
                        invoiceXODetail.InvoiceMPSQuantity += mPSdetails.MPSdetailssum;
                        if (invoiceXODetail.InvoiceMPSQuantity >= invoiceXODetail.InvoiceXODetailQuantity)
                        {
                            invoiceXODetail.DetailMPSState = 2;
                        }
                        else
                        {
                            if (invoiceXODetail.InvoiceMPSQuantity > 0)
                            {
                                invoiceXODetail.DetailMPSState = 1;
                            }
                            else
                            {
                                invoiceXODetail.DetailMPSState = 0;
                            }
                        }
                        //invoiceXODetail.InvoiceMPSQuantity = Convert.ToDouble(MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId));
                        invoiceManager.Update(invoiceXODetail);
                        UpdateInvoiceXOFlag(invoiceXODetail.Invoice);
                    }
                    //  Model.Product product = productManager.Get(mPSdetails.ProductId);
                    //if (product.MpsStockQuantity == null || product.MpsStockQuantity == 0)
                    //{
                    //    product.MpsStockQuantity = mPSdetails.Product.StocksQuantity;

                    //    ProductAccessor.Update(product);
                    this.UpdateSql("update product set MpsStockQuantity=" + mPSdetails.MPSdetailssum + " where productid='" + mPSdetails.ProductId + "'");
                    // }
                }

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Ejemplo n.º 10
0
        public override void Refresh()
        {
            if (this._produceOtherCompact == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this._produceOtherCompact = this.produceOtherCompactManager.GetDetails(_produceOtherCompact.ProduceOtherCompactId);
                }
            }

            this.textEditProduceOtherCompactId.Text   = this._produceOtherCompact.ProduceOtherCompactId;
            this.textEditProduceOtherCompactDesc.Text = this._produceOtherCompact.ProduceOtherCompactDesc;
            // this.comboBoxOperationType.SelectedIndex =this._produceOtherCompact.OtherOperationType==null?-1: this._produceOtherCompact.OtherOperationType.Value;
            this.comboBoxProduceType.SelectedIndex = this._produceOtherCompact.OtherProduceType == null ? -1 : this._produceOtherCompact.OtherProduceType.Value;
            this.textEditPaymentCondition.Text     = this._produceOtherCompact.PaymentCondition;
            if (global::Helper.DateTimeParse.DateTimeEquls(this._produceOtherCompact.ProduceOtherCompactDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditProduceOtherCompactDate.EditValue = null;
            }
            else
            {
                this.dateEditProduceOtherCompactDate.EditValue = this._produceOtherCompact.ProduceOtherCompactDate;
            }
            //if (global::Helper.DateTimeParse.DateTimeEquls(this._produceOtherCompact.JiaoHuoDate, global::Helper.DateTimeParse.NullDate))
            //{
            //    this.dateEditJHDate.EditValue = null;
            //}
            //else
            //{
            //    this.dateEditJHDate.EditValue = this._produceOtherCompact.JiaoHuoDate;
            //}


            this.newChooseEmployee0Id.EditValue = this._produceOtherCompact.Employee0;
            this.newChooseEmployee1Id.EditValue = this._produceOtherCompact.Employee1;
            this.newChooseSupplierId.EditValue  = this._produceOtherCompact.Supplier;
            if (!string.IsNullOrEmpty(this._produceOtherCompact.MRSHeaderId))
            {
                Model.MRSHeader mRSHeader = this.mRSHeaderManager.Get(this._produceOtherCompact.MRSHeaderId);
                if (mRSHeader != null)
                {
                    Model.MPSheader mPSheader = this.mPSheaderManager.Get(mRSHeader.MPSheaderId);
                    if (mPSheader != null)
                    {
                        this.textEditCustomerXOId.Text = this.invoiceXOManager.Get(mPSheader.InvoiceXOId) == null ? "" : this.invoiceXOManager.Get(mPSheader.InvoiceXOId).CustomerInvoiceXOId;
                    }
                    else
                    {
                        this.textEditCustomerXOId.Text = string.Empty;
                    }
                }
                else
                {
                    this.textEditCustomerXOId.Text = string.Empty;
                }
            }
            else
            {
                this.textEditCustomerXOId.Text = string.Empty;
            }

            this.textEditAuditState.Text = this.GetAuditName(this._produceOtherCompact.AuditState);
            this.txtLotNumber.Text       = this._produceOtherCompact.LotNumber;

            this.EmpAudit.EditValue = this._produceOtherCompact.AuditEmp;
            this.bindingSourceDetails.DataSource  = this._produceOtherCompact.Details;
            this.bindingSourceMaterial.DataSource = this._produceOtherCompact.DetailMaterial;
            base.Refresh();

            switch (this.action)
            {
            case "insert":
                this.barButtonItemProcedures.Enabled    = true;
                this.gridView1.OptionsBehavior.Editable = true;
                this.gridView2.OptionsBehavior.Editable = true;
                break;

            case "update":
                this.barButtonItemProcedures.Enabled    = true;
                this.gridView1.OptionsBehavior.Editable = true;
                this.gridView2.OptionsBehavior.Editable = true;
                break;

            case "view":
                this.barButtonItemProcedures.Enabled    = false;
                this.gridView1.OptionsBehavior.Editable = false;
                this.gridView2.OptionsBehavior.Editable = false;
                break;
            }

            this.textEditProduceOtherCompactId.Properties.ReadOnly = true;
            this.txtLotNumber.Properties.ReadOnly = true;
        }
Ejemplo n.º 11
0
        public OutStockReport(string DepotOutId)
        {
            InitializeComponent();
            this.DepotOut = this.DepotOutManager.Get(DepotOutId);

            if (this.DepotOut == null)
            {
                return;
            }

            this.DepotOut.Details = this.DepotOutDetailManager.GetDepotOutDetailByDepotOutId(this.DepotOut.DepotOutId);

            this.DataSource = this.DepotOut.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.DepotOut;
            this.xrLabelPrintDate.Text       = "列表日期:" + DateTime.Now.ToShortDateString();

            this.xrLabelDepotOutId.Text   = this.DepotOut.DepotOutId;
            this.xrLabelDepotOutDate.Text = this.DepotOut.DepotOutDate.Value.ToString("yyyy-MM-dd");
            if (this.DepotOut.Employee != null)
            {
                this.xrLabelEmployeeId.Text = this.DepotOut.Employee.EmployeeName;
            }
            if (this.DepotOut.InvioiceEmployee0 != null)
            {
                this.xrLabelInvoiceEmp0.Text = this.DepotOut.InvioiceEmployee0.EmployeeName;
            }
            if (DepotOut.Depot != null)
            {
                this.xrLabelProduceInDepotId.Text = DepotOut.Depot.DepotName;
            }

            if (this.DepotOut.SourceType == "領料單")
            {
                Model.ProduceMaterial ProduceMaterial = this.produceMaterialManager.Get(this.DepotOut.InvioiceId);
                if (ProduceMaterial != null)
                {
                    //Model.PronoteHeader PronoteHeader = this.pronoteHeaderManager.Get(ProduceMaterial.InvoiceId);
                    //if (PronoteHeader != null)
                    //{
                    Model.InvoiceXO InvoiceXO = this.invoiceXOManager.Get(ProduceMaterial.InvoiceXOId);
                    if (InvoiceXO != null)
                    {
                        this.xrLabelCustomXoId.Text = InvoiceXO.CustomerInvoiceXOId;
                        this.lblPiHao.Text          = InvoiceXO.CustomerLotNumber;
                        this.lblXOCustomer.Text     = InvoiceXO.xocustomer == null ? null : InvoiceXO.xocustomer.ToString();
                    }
                    //if (ProduceMaterial.Employee0 != null)
                    //    this.xrLabelInvoiceEmp0.Text = ProduceMaterial.Employee0.ToString();
                    if (ProduceMaterial.WorkHouse != null)
                    {
                        this.xrLabelWorkHouse.Text = ProduceMaterial.WorkHouse.ToString();
                    }
                    // }
                }
            }


            else if (this.DepotOut.SourceType == "委外領料單")
            {
                Model.ProduceOtherMaterial ProduceOtherMaterial = new BL.ProduceOtherMaterialManager().Get(this.DepotOut.InvioiceId);
                if (ProduceOtherMaterial != null)
                {
                    Model.ProduceOtherCompact ProduceOtherCompact = this.produceOtherCompactManager.Get(ProduceOtherMaterial.ProduceOtherCompactId);
                    if (ProduceOtherCompact != null)
                    {
                        if (!string.IsNullOrEmpty(ProduceOtherCompact.MRSHeaderId))
                        {
                            Model.MRSHeader mRSHeader = this.mRSHeaderManager.Get(ProduceOtherCompact.MRSHeaderId);
                            if (mRSHeader != null)
                            {
                                Model.MPSheader mPSheader = this.mPSheaderManager.Get(mRSHeader.MPSheaderId);
                                if (mPSheader != null)
                                {
                                    Model.InvoiceXO InvoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId);
                                    if (InvoiceXO != null)
                                    {
                                        this.xrLabelCustomXoId.Text = InvoiceXO.CustomerInvoiceXOId;
                                        this.lblPiHao.Text          = InvoiceXO.CustomerLotNumber;
                                        this.lblXOCustomer.Text     = InvoiceXO.xocustomer == null ? null : InvoiceXO.xocustomer.ToString();
                                    }
                                }
                            }
                        }
                    }
                    if (ProduceOtherMaterial.WorkHouse != null)
                    {
                        this.xrLabelWorkHouse.Text = ProduceOtherMaterial.WorkHouse.ToString();
                    }
                }
            }
            this.txt_ParentProduct.Text  = DepotOut.ParentProduct;
            this.xrLabelXqlu.Text        = DepotOut.SourceType;
            this.xrLabeldescription.Text = DepotOut.description;
            this.xrLabelXgdj.Text        = DepotOut.InvioiceId;
            this.xrTableCellProductId.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Inumber);
            this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            //this.xrTableCellXH.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            this.xrTableCellCount.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_DepotOutDetailQuantity);
            this.xrTableCellUnit.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_ProductUnit);
            this.xrTableCurrentDepotStock.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_CurrentDepotQuantity);
            this.xrTableCell_CurrentStock.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_CurrentStockQuantity);
            this.xrTableCellDepotId.DataBindings.Add("Text", this.DataSource, "DepotPosition." + Model.DepotPosition.PROPERTY_ID);
            //this.xrTableCellSafeStockQuantity.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.Pro_SafeStockQuantity);
            this.TCPihao.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Pihao);
            this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, Model.DepotOutDetail.Pro_ProductDescription);
            //this.TCPihao.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Pihao);
            this.TCProductCustomerName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
        }
Ejemplo n.º 12
0
        public RO(string produceOtherCompactId)
        {
            InitializeComponent();
            this.produceOtherCompact = this.produceOtherCompactManager.Get(produceOtherCompactId);

            if (this.produceOtherCompact == null)
            {
                return;
            }

            this.produceOtherCompact.Details = this.produceOtherCompactdetailManager.Select(this.produceOtherCompact);

            this.DataSource = this.produceOtherCompact.Details;
            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.ProduceOtherCompactDetail;
            this.xrLabelDate.Text           += DateTime.Now.ToShortDateString();

            //外发合同
            this.xrLabelProduceOtherCompactId.Text   = this.produceOtherCompact.ProduceOtherCompactId;
            this.xrLabelProduceOtherCompactDate.Text = this.produceOtherCompact.ProduceOtherCompactDate.Value.ToString("yyyy-MM-dd");
            if (this.produceOtherCompact.Employee0 != null)
            {
                this.xrLabelEmployee0.Text = this.produceOtherCompact.Employee0.EmployeeName;
            }
            if (this.produceOtherCompact.Supplier != null)
            {
                this.xrLabelSupplierId.Text = this.produceOtherCompact.Supplier.SupplierFullName;
            }
            this.xrLabelProduceOtherCompactDesc.Text = this.produceOtherCompact.ProduceOtherCompactDesc;
            //if (global::Helper.DateTimeParse.DateTimeEquls(this.produceOtherCompact.JiaoHuoDate, global::Helper.DateTimeParse.NullDate) || this.produceOtherCompact.JiaoHuoDate==null)
            //{
            //    this.xrLabelJhDate.Text = string.Empty;
            //}
            //else
            //{
            //    this.xrLabelJhDate.Text = this.produceOtherCompact.JiaoHuoDate.Value.ToString("yyyy-MM-dd");
            //}

            if (!string.IsNullOrEmpty(this.produceOtherCompact.MRSHeaderId))
            {
                Model.MRSHeader mRSHeader = this.mRSHeaderManager.Get(this.produceOtherCompact.MRSHeaderId);
                if (mRSHeader != null)
                {
                    Model.MPSheader mPSheader = this.mPSheaderManager.Get(mRSHeader.MPSheaderId);
                    if (mPSheader != null)
                    {
                        Model.InvoiceXO invoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId);
                        if (invoiceXO != null)
                        {
                            this.xrLabelCustomerXoId.Text = invoiceXO.CustomerInvoiceXOId;
                            this.xrLabelCustomer.Text     = invoiceXO.xocustomer == null ? null : invoiceXO.xocustomer.CustomerShortName;
                            this.xrLabelCheck.Text        = invoiceXO.xocustomer == null ? null : invoiceXO.xocustomer.CheckedStandard;
                        }
                    }
                }
            }

            //明细
            // this.xrTableCellProductId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id);
            this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            this.xrTableCellUnit.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherCompactDetail.PRO_ProductUnit);
            this.xrTableCellOtherCompactSum.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherCompactDetail.PRO_OtherCompactCount);
            // this.xrTableCellStock.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_StocksQuantity,"{0:0.####}");
            //this.xrTableCell5.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            this.xrTableJiaoQi.DataBindings.Add("Text", this.DataSource, "ProduceOtherCompact.InvoiceXO." + Model.InvoiceXO.PRO_InvoiceYjrq, "{0:yyyy-MM-dd}");
            this.xrTableDesc.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherCompactDetail.PRO_Description);
            this.TCNextWorkHouse.DataBindings.Add("Text", this.DataSource, "WorkHouseNext." + Model.WorkHouse.PROPERTY_WORKHOUSENAME);
            this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, "ProductDesc");
        }
Ejemplo n.º 13
0
 public Model.MPSheader GetPrev(Model.MPSheader e)
 {
     return(sqlmapper.QueryForObject <Model.MPSheader>("MPSheader.get_prev", e));
 }
Ejemplo n.º 14
0
        public RO1Update(string mRSheaderId)
        {
            InitializeComponent();
            this.mRSheader = this.mRSheaderManager.GetDetails(mRSheaderId);

            if (this.mRSheader == null)
            {
                return;
            }

            // this.mRSheader.Details = this.mRSdetailsManager.Select(this.mRSheader);

            foreach (var item in this.mRSheader.Details)
            {
                item.Materialprocessum = produceMaterialdetailsManager.SelectMaterialprocessum(item.MRSdetailsId);
            }

            this.DataSource = this.mRSheader.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.MRSDetails;
            this.xrLabelDate.Text           += DateTime.Now.ToString("yyyy-MM-dd");
            //物料需求计划
            this.xrLabelMRSHeaderId.Text = this.mRSheader.MRSHeaderId;

            Model.MPSheader mps = mPSheaderManager.Get(this.mRSheader.MPSheaderId);
            if (mps != null)
            {
                Model.InvoiceXO xo = this.invoiceXOManager.Get(mps.InvoiceXOId);
                if (xo != null)
                {
                    this.xrLabelXOCusId.Text     = xo.CustomerInvoiceXOId;
                    xrLabelXOJiaoQi.Text         = xo.InvoiceYjrq == null ? null : xo.InvoiceYjrq.Value.ToString("yyyy-MM-dd");
                    this.xrLabelMRSCustomer.Text = xo.xocustomer == null ? null : xo.xocustomer.CustomerShortName;
                    this.xrLabelPiHao.Text       = xo.CustomerLotNumber;

                    if (xo.xocustomer != null && !string.IsNullOrEmpty(xo.xocustomer.CheckedStandard))
                    {
                        if (xo.xocustomer.CheckedStandard.ToLower().Contains("jis") && xo.xocustomer.CustomerFullName.ToUpper().Contains("MIDORI"))
                        {
                            //CreateTagLable("JIS");

                            this.lbl_JIS.Text = "JIS";
                        }
                        else if (xo.xocustomer.CheckedStandard.ToLower().Contains("as"))
                        {
                            //CreateTagLable("AS");

                            this.lbl_JIS.Text = "AS";
                        }
                    }
                }
            }


            this.xrLabelMRSHeadername.Text = this.mRSheader.MPSheaderId;
            this.xrLabelMRSstate.Text      = this.mRSheader.MRSstate;
            if (this.mRSheader.MRSstartdate != null)
            {
                this.xrLabelMRSstartdate.Text = this.mRSheader.MRSstartdate.Value.ToString("yyyy-MM-dd");
                // this.xrLabelMRSenddate.Text = this.mRSheader.MPSheaderId.Value.ToString("yyyy-MM-dd");
            }
            if (this.mRSheader.Employee0 != null)
            {
                this.xrLabelEmp0.Text = this.mRSheader.Employee0.EmployeeName;
            }
            if (this.mRSheader.Employee1 != null)
            {
                this.xrLabelEmployee0.Text = this.mRSheader.Employee1.EmployeeName;
            }
            this.xrLabelMRSheaderDesc.Text = this.mRSheader.MRSheaderDesc;

            xrLabelTpye.Text           = this.mRSheader.GetSourceType;
            this.xrLabelEmployee1.Text = this.mRSheader.AuditEmp == null ? "" : this.mRSheader.AuditEmp.EmployeeName;



            //明细信息
            this.xrTableCell5.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_Inumber);
            // this.xrTableMRSdetailsId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id);
            this.xrTableProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            this.xrTableCellCusPro.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
            //this.xrTableCellOnWay.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_OrderOnWayQuantity);
            // this.xrTableMRSstartdate.DataBindings.Add("Text", this.DataSource, Model.MRSHeader.PROPERTY_MRSSTARTDATE);
            this.xrTableMRSdetailssum.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_MRSdetailssum);
            this.xrTableMRSdetailsQuantity.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_MRSdetailsQuantity);
            // this.xrTableCellProductSpecification.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            //  this.xrTableCustomer.DataBindings.Add("Text", this.DataSource, "Customer.CustomerShortName");
            this.xrTableProductUnit.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_ProductUnit);
            this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_ProductDescription);
            //this.xrTableStock.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_MRSStockQuantity, "{0:0.####}");
            this.xrTableStock.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_StocksQuantity);
            this.xrTableMaterialDistributioned.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProduceMaterialDistributioned, "{0:0.####}");   //原為“已分配量”
            //this.xrTableMaterialDistributioned.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_Materialprocessum, "{0:0.####}");
            this.lbl_lingliaoliang.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_Materialprocessum, "{0:0.####}");

            this.xrLabeOtherFenPei.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_OtherMaterialDistributioned, "{0:0.####}");
            this.xrTableSullier.DataBindings.Add("Text", this.DataSource, "Supplier." + Model.Supplier.PROPERTY_SUPPLIERSHORTNAME);
            this.xrLabelJiaoQi.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_JiaoHuoDate, "{0:yyyy-MM-dd}");
            this.xrTableWorkHouseNext.DataBindings.Add("Text", this.DataSource, "WorkHouseNext." + Model.WorkHouse.PROPERTY_WORKHOUSENAME);
            //this.tcJiaoqi.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_JiaoHuoDate, "{0:yyyy-MM-dd}");
            //原为交期 改为 已定未入量
            this.tcJiaoqi.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_OrderOnWayQuantity, "{0:0.####}");
        }
Ejemplo n.º 15
0
        public RO1(string mRSheaderId)
        {
            InitializeComponent();
            this.mRSheader = this.mRSheaderManager.GetDetails(mRSheaderId);

            if (this.mRSheader == null)
            {
                return;
            }

            // this.mRSheader.Details = this.mRSdetailsManager.Select(this.mRSheader);


            this.DataSource = this.mRSheader.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.MRSDetails;
            this.xrLabelDate.Text           += DateTime.Now.ToString("yyyy-MM-dd");
            //物料需求计划
            this.xrLabelMRSHeaderId.Text = this.mRSheader.MRSHeaderId;

            Model.MPSheader mps = mPSheaderManager.Get(this.mRSheader.MPSheaderId);
            if (mps != null)
            {
                Model.InvoiceXO xo = this.invoiceXOManager.Get(mps.InvoiceXOId);
                if (xo != null)
                {
                    this.xrLabelXOCusId.Text     = xo.CustomerInvoiceXOId;
                    xrLabelXOJiaoQi.Text         = xo.InvoiceYjrq == null ? null : xo.InvoiceYjrq.Value.ToString("yyyy-MM-dd");
                    this.xrLabelMRSCustomer.Text = xo.xocustomer == null ? null : xo.xocustomer.CustomerShortName;
                    this.xrLabelPiHao.Text       = xo.CustomerLotNumber;
                }
            }


            this.xrLabelMRSHeadername.Text = this.mRSheader.MPSheaderId;
            this.xrLabelMRSstate.Text      = this.mRSheader.MRSstate;
            if (this.mRSheader.MRSstartdate != null)
            {
                this.xrLabelMRSstartdate.Text = this.mRSheader.MRSstartdate.Value.ToString("yyyy-MM-dd");
                // this.xrLabelMRSenddate.Text = this.mRSheader.MPSheaderId.Value.ToString("yyyy-MM-dd");
            }
            if (this.mRSheader.Employee0 != null)
            {
                this.xrLabelEmp0.Text = this.mRSheader.Employee0.EmployeeName;
            }
            if (this.mRSheader.Employee1 != null)
            {
                this.xrLabelEmployee0.Text = this.mRSheader.Employee1.EmployeeName;
            }
            this.xrLabelMRSheaderDesc.Text = this.mRSheader.MRSheaderDesc;

            xrLabelTpye.Text           = this.mRSheader.GetSourceType;
            this.xrLabelEmployee1.Text = this.mRSheader.AuditEmp == null ? "" : this.mRSheader.AuditEmp.EmployeeName;


            //明细信息
            this.xrTableCell5.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_Inumber);
            this.TCProId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id);
            this.xrTableProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            this.xrTableCellCusPro.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
            this.xrTableCellOnWay.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_OrderOnWayQuantity);
            // this.xrTableMRSstartdate.DataBindings.Add("Text", this.DataSource, Model.MRSHeader.PROPERTY_MRSSTARTDATE);
            this.xrTableMRSdetailssum.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_MRSdetailssum);
            this.xrTableMRSdetailsQuantity.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_MRSdetailsQuantity);
            // this.xrTableCellProductSpecification.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            //  this.xrTableCustomer.DataBindings.Add("Text", this.DataSource, "Customer.CustomerShortName");
            this.xrTableProductUnit.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_ProductUnit);
            this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_ProductDescription);
            //this.xrTableStock.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_MRSStockQuantity, "{0:0.####}");
            this.xrTableStock.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_StocksQuantity);
            this.xrTableMaterialDistributioned.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProduceMaterialDistributioned, "{0:0.####}");
            this.xrLabeOtherFenPei.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_OtherMaterialDistributioned, "{0:0.####}");
            //this.xrTableSullier.DataBindings.Add("Text", this.DataSource, "Supplier." + Model.Supplier.PROPERTY_SUPPLIERSHORTNAME);
            this.xrLabelJiaoQi.DataBindings.Add("Text", this.DataSource, Model.MRSdetails.PRO_JiaoHuoDate, "{0:yyyy-MM-dd}");
            this.xrTableWorkHouseNext.DataBindings.Add("Text", this.DataSource, "WorkHouseNext." + Model.WorkHouse.PROPERTY_WORKHOUSENAME);
        }
Ejemplo n.º 16
0
 public bool HasRowsBefore(Model.MPSheader e)
 {
     return(accessor.HasRowsBefore(e));
 }
Ejemplo n.º 17
0
 public void Insert(Model.MPSheader e)
 {
     this.Insert <Model.MPSheader>(e);
 }
Ejemplo n.º 18
0
 public bool HasRowsAfter(Model.MPSheader e)
 {
     return(accessor.HasRowsAfter(e));
 }
Ejemplo n.º 19
0
 public IList <Book.Model.MPSdetails> Select(Model.MPSheader mPSheader)
 {
     return(sqlmapper.QueryForList <Model.MPSdetails>("MPSdetails.select_byMPSheaderId", mPSheader.MPSheaderId));
 }
Ejemplo n.º 20
0
 public Model.MPSheader GetPrev(Model.MPSheader e)
 {
     return(accessor.GetPrev(e));
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Update a MPSheader.
        /// </summary>
        public void Update(Model.MPSheader mPSheader)
        {
            //
            // todo: add other logic here.
            //
            Validate(mPSheader);
            if (this.ExistsExcept(mPSheader))
            {
                throw new Helper.InvalidValueException(Model.MPSheader.PRO_Id);
            }
            // mPSheader.UpdateTime = DateTime.Now;
            // accessor.Update(mPSheader);

            try
            {
                BL.V.BeginTransaction();
                //this.Delete(mPSheader);
                //mPSheader.UpdateTime = DateTime.Now;
                //this.Insert(mPSheader);
                //以前这种修改是有BUG的,如果用“-”的方式删除一些项目后保存对应的已排单数量不会变,2016年4月7日16:33:55改新版。

                mPSheader.InsertTime = DateTime.Now;
                mPSheader.UpdateTime = DateTime.Now;
                accessor.Update(mPSheader);
                //删除旧数据
                IList <Model.MPSdetails> list = MPSdetailsAccessor.Select(mPSheader);
                foreach (var item in list)
                {
                    Model.InvoiceXODetail xodetail = this.InvoiceXODetailAccessor.Get(item.InvoiceXODetailId);
                    if (xodetail != null)
                    {
                        if (xodetail.InvoiceMPSQuantity == null)
                        {
                            xodetail.InvoiceMPSQuantity = 0;
                        }
                        xodetail.InvoiceMPSQuantity = Convert.ToDouble(xodetail.InvoiceMPSQuantity) - Convert.ToDouble(item.MPSdetailssum);
                        xodetail.InvoiceMPSQuantity = xodetail.InvoiceMPSQuantity < 0 ? 0 : xodetail.InvoiceMPSQuantity;
                        if (xodetail.InvoiceMPSQuantity >= xodetail.InvoiceXODetailQuantity)
                        {
                            xodetail.DetailMPSState = 2;
                        }
                        else
                        {
                            if (xodetail.InvoiceMPSQuantity > 0)
                            {
                                xodetail.DetailMPSState = 1;
                            }
                            else
                            {
                                xodetail.DetailMPSState = 0;
                            }
                        }
                        //invoiceXODetail.InvoiceMPSQuantity = Convert.ToDouble(MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId));
                        invoiceManager.Update(xodetail);
                        UpdateInvoiceXOFlag(xodetail.Invoice);
                    }

                    MPSdetailsAccessor.Delete(item.MPSdetailsId);
                }

                //插入新数据
                foreach (Model.MPSdetails mPSdetails in mPSheader.Details)
                {
                    if (mPSdetails.Product == null || string.IsNullOrEmpty(mPSdetails.Product.ProductId))
                    {
                        continue;
                    }
                    mPSdetails.MPSheaderId = mPSheader.MPSheaderId;
                    mPSdetails.MPSEndState = false;
                    invoiceXODetail        = invoiceManager.Get(mPSdetails.InvoiceXODetailId);
                    //double ss = MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId);
                    MPSdetailsAccessor.Insert(mPSdetails);

                    if (invoiceXODetail != null)
                    {
                        if (invoiceXODetail.InvoiceMPSQuantity == null)
                        {
                            invoiceXODetail.InvoiceMPSQuantity = 0;
                        }
                        invoiceXODetail.InvoiceMPSQuantity += Convert.ToDouble(mPSdetails.MPSdetailssum);
                        if (invoiceXODetail.InvoiceMPSQuantity >= invoiceXODetail.InvoiceXODetailQuantity)
                        {
                            invoiceXODetail.DetailMPSState = 2;
                        }
                        else
                        {
                            if (invoiceXODetail.InvoiceMPSQuantity > 0)
                            {
                                invoiceXODetail.DetailMPSState = 1;
                            }
                            else
                            {
                                invoiceXODetail.DetailMPSState = 0;
                            }
                        }
                        //invoiceXODetail.InvoiceMPSQuantity = Convert.ToDouble(MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId));
                        invoiceManager.Update(invoiceXODetail);
                        UpdateInvoiceXOFlag(invoiceXODetail.Invoice);
                    }
                    this.UpdateSql("update product set MpsStockQuantity=" + mPSdetails.MPSdetailssum + " where productid='" + mPSdetails.ProductId + "'");
                }
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Ejemplo n.º 22
0
 public IList <Book.Model.MPSdetails> Select(Model.MPSheader mPSheader)
 {
     return(accessor.Select(mPSheader));
 }
Ejemplo n.º 23
0
 public bool ExistsExcept(Model.MPSheader e)
 {
     return(accessor.ExistsExcept(e));
 }
Ejemplo n.º 24
0
 public Model.MPSheader GetNext(Model.MPSheader e)
 {
     return(sqlmapper.QueryForObject <Model.MPSheader>("MPSheader.get_next", e));
 }
Ejemplo n.º 25
0
 public void Update(Model.MPSheader e)
 {
     this.Update <Model.MPSheader>(e);
 }
Ejemplo n.º 26
0
 public Model.MPSheader GetNext(Model.MPSheader e)
 {
     return(accessor.GetNext(e));
 }
Ejemplo n.º 27
0
 public bool HasRowsBefore(Model.MPSheader e)
 {
     return(sqlmapper.QueryForObject <bool>("MPSheader.has_rows_before", e));
 }
Ejemplo n.º 28
0
 public bool HasRowsAfter(Model.MPSheader e)
 {
     return(sqlmapper.QueryForObject <bool>("MPSheader.has_rows_after", e));
 }
Ejemplo n.º 29
0
        private void simpleButtonOther_Click(object sender, EventArgs e)
        {
            ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract();
            if (f.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            Model.ProduceOtherCompact OtherCompact = f.SelectItem as Model.ProduceOtherCompact;
            if (OtherCompact == null)
            {
                return;
            }

            if (this._produceOtherMaterial.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherMaterial.Details[0].ProductId))
            {
                this._produceOtherMaterial.Details.RemoveAt(0);
            }
            this._produceOtherMaterial.Details.Clear();
            this.textEditOtherCompact.Text      = OtherCompact.ProduceOtherCompactId;
            this.newChooseContorlSipu.EditValue = OtherCompact.Supplier;
            this.textEditCusXOId.Text           = string.Empty;
            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;
                    }
                }
            }
            //if (ProduceOtherCompact.ChooseOutContract._OtherCompactDetailList.Count == 0) return;
            //if (this._produceOtherInDepot.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId))
            //    this._produceOtherInDepot.Details.RemoveAt(0);
            //this._produceOtherInDepot.Details.Clear();
            //this.textEditOtherCompact.Text = ProduceOtherCompact.ChooseOutContract._OtherCompactDetailList[0].ProduceOtherCompactId;

            //this._produceOtherMaterial.Details = (from p in this.OtherCompactMaterialManager.Select(OtherCompact)
            //           group p by new { p.ProductId, p.ProductUnit } into b
            //           select new Model.ProduceOtherMaterialDetail()
            //           {
            //               ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(),
            //               ProduceOtherCompactMaterialId = (from p in b select p.ProduceOtherCompactMaterialId).ToString(),
            //               ProductId = b.Key.ProductId,
            //               Product = new BL.ProductManager().Get(b.Key.ProductId),
            //               ProductUnit =b.Key.ProductUnit,
            //               OtherMaterialQuantity = (from p in b select p.ProduceQuantity).Sum(),
            //               Description = (from p in b select p.Description).ToString(),
            //           }).ToList();

            foreach (Model.ProduceOtherCompactMaterial item in this.OtherCompactMaterialManager.Select(OtherCompact))
            {
                Model.ProduceOtherMaterialDetail detail = new Model.ProduceOtherMaterialDetail();
                detail.ProduceOtherMaterialDetailId  = Guid.NewGuid().ToString();
                detail.ProduceOtherCompactMaterialId = item.ProduceOtherCompactMaterialId;
                detail.Product               = this.productManager.Get(item.ProductId);
                detail.ProductId             = item.ProductId;
                detail.ProductUnit           = item.ProductUnit;
                detail.OtherMaterialQuantity = item.ProduceQuantity;// - (item.AlreadyOutQuantity == null ? 0 : item.AlreadyOutQuantity);
                if (detail.OtherMaterialQuantity < 0)
                {
                    detail.OtherMaterialQuantity = 0;
                }
                // detail.ProcessPrice = 0;
                detail.Description     = item.Description;
                detail.ParentProductId = item.ParentProductId;
                detail.ParentProduct   = item.ParentProduct;
                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.OtherMaterialDistributioned + detail.Product.ProduceMaterialDistributioned;
                detail.Inumber        = this._produceOtherMaterial.Details.Count + 1;
                this._produceOtherMaterial.Details.Add(detail);
            }
            this.gridControl1.RefreshDataSource();
        }
Ejemplo n.º 30
0
        public OutStockReport(string DepotOutId)
        {
            InitializeComponent();
            this.DepotOut = this.DepotOutManager.Get(DepotOutId);

            if (this.DepotOut == null)
            {
                return;
            }

            this.DepotOut.Details = this.DepotOutDetailManager.GetDepotOutDetailByDepotOutId(this.DepotOut.DepotOutId);

            this.DataSource = this.DepotOut.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.DepotOut;
            this.xrLabelPrintDate.Text       = "列表日期:" + DateTime.Now.ToShortDateString();

            this.xrLabelDepotOutId.Text   = this.DepotOut.DepotOutId;
            this.xrLabelDepotOutDate.Text = this.DepotOut.DepotOutDate.Value.ToString("yyyy-MM-dd");
            if (this.DepotOut.Employee != null)
            {
                this.xrLabelEmployeeId.Text = this.DepotOut.Employee.EmployeeName;
            }
            if (this.DepotOut.InvioiceEmployee0 != null)
            {
                this.xrLabelInvoiceEmp0.Text = this.DepotOut.InvioiceEmployee0.EmployeeName;
            }
            if (DepotOut.Depot != null)
            {
                this.xrLabelProduceInDepotId.Text = DepotOut.Depot.DepotName;
            }
            if (this.DepotOut.LingLiaoEmployee != null)
            {
                this.lbl_LingLiaoEmployee.Text = this.DepotOut.LingLiaoEmployee.ToString();
            }

            Model.InvoiceXO InvoiceXO = null;

            if (this.DepotOut.SourceType == "領料單")
            {
                Model.ProduceMaterial ProduceMaterial = this.produceMaterialManager.Get(this.DepotOut.InvioiceId);
                if (ProduceMaterial != null)
                {
                    InvoiceXO = this.invoiceXOManager.Get(ProduceMaterial.InvoiceXOId);
                    if (InvoiceXO != null)
                    {
                        this.xrLabelCustomXoId.Text = InvoiceXO.CustomerInvoiceXOId;
                        this.lblPiHao.Text          = InvoiceXO.CustomerLotNumber;
                        this.lblXOCustomer.Text     = InvoiceXO.xocustomer == null ? null : InvoiceXO.xocustomer.ToString();
                    }

                    //if (ProduceMaterial.WorkHouse != null)
                    //    this.xrLabelWorkHouse.Text = ProduceMaterial.WorkHouse.ToString();

                    //2021年8月29日15:54:11,领料单生产站:先带第一笔领料单的下个生产站,若为空,则带领料单表头生产站
                    if (this.DepotOut.Details != null && this.DepotOut.Details.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(this.DepotOut.Details[0].ProduceMaterialdetailsID))
                        {
                            var produceMaterialDetail = produceMaterialDetailManager.Get(this.DepotOut.Details[0].ProduceMaterialdetailsID);
                            this.xrLabelWorkHouse.Text = produceMaterialDetail.NextWorkHouse == null ? "" : produceMaterialDetail.NextWorkHouse.ToString();
                        }
                    }
                    if (string.IsNullOrEmpty(this.xrLabelWorkHouse.Text))
                    {
                        this.xrLabelWorkHouse.Text = ProduceMaterial.WorkHouse == null ? "" : ProduceMaterial.WorkHouse.ToString();
                    }
                }
            }
            else if (this.DepotOut.SourceType == "委外領料單")
            {
                Model.ProduceOtherMaterial ProduceOtherMaterial = new BL.ProduceOtherMaterialManager().Get(this.DepotOut.InvioiceId);
                if (ProduceOtherMaterial != null)
                {
                    Model.ProduceOtherCompact ProduceOtherCompact = this.produceOtherCompactManager.Get(ProduceOtherMaterial.ProduceOtherCompactId);
                    if (ProduceOtherCompact != null)
                    {
                        if (!string.IsNullOrEmpty(ProduceOtherCompact.MRSHeaderId))
                        {
                            Model.MRSHeader mRSHeader = this.mRSHeaderManager.Get(ProduceOtherCompact.MRSHeaderId);
                            if (mRSHeader != null)
                            {
                                Model.MPSheader mPSheader = this.mPSheaderManager.Get(mRSHeader.MPSheaderId);
                                if (mPSheader != null)
                                {
                                    InvoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId);
                                    if (InvoiceXO != null)
                                    {
                                        this.xrLabelCustomXoId.Text = InvoiceXO.CustomerInvoiceXOId;
                                        this.lblPiHao.Text          = InvoiceXO.CustomerLotNumber;
                                        this.lblXOCustomer.Text     = InvoiceXO.xocustomer == null ? null : InvoiceXO.xocustomer.ToString();
                                    }
                                }
                            }
                        }
                    }
                    if (ProduceOtherMaterial.WorkHouse != null)
                    {
                        this.xrLabelWorkHouse.Text = ProduceOtherMaterial.WorkHouse.ToString();
                    }
                }
            }

            if (InvoiceXO != null && InvoiceXO.xocustomer != null && !string.IsNullOrEmpty(InvoiceXO.xocustomer.CheckedStandard))
            {
                if (InvoiceXO.xocustomer.CheckedStandard.ToLower().Contains("jis") && InvoiceXO.xocustomer.CustomerFullName.ToUpper().Contains("MIDORI"))
                {
                    //CreateTagLable("JIS");

                    this.lbl_JIS.Text = "JIS";
                }
                else if (InvoiceXO.xocustomer.CheckedStandard.ToLower().Contains("as"))
                {
                    //CreateTagLable("AS");

                    this.lbl_JIS.Text = "AS";
                }
            }

            this.txt_ParentProduct.Text  = DepotOut.ParentProduct;
            this.xrLabelXqlu.Text        = DepotOut.SourceType;
            this.xrLabeldescription.Text = DepotOut.description;
            this.xrLabelXgdj.Text        = DepotOut.InvioiceId;
            this.xrTableCellProductId.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Inumber);
            this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            //this.xrTableCellXH.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            this.xrTableCellCount.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_DepotOutDetailQuantity);
            this.xrTableCellUnit.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_ProductUnit);
            this.xrTableCurrentDepotStock.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_CurrentDepotQuantity);
            this.xrTableCell_CurrentStock.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_CurrentStockQuantity);
            this.xrTableCellDepotId.DataBindings.Add("Text", this.DataSource, "DepotPosition." + Model.DepotPosition.PROPERTY_ID);
            //this.xrTableCellSafeStockQuantity.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.Pro_SafeStockQuantity);
            this.TCPihao.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Pihao);
            this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, Model.DepotOutDetail.Pro_ProductDescription);
            //this.TCPihao.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Pihao);
            this.TCProductCustomerName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
        }