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

            if (details == null || details.Count < 1)
            {
                return;
            }
            Model.BomParentPartInfo detail = details[e.ListSourceRowIndex].Bom;
            if (detail == null)
            {
                return;
            }
            switch (e.Column.Name)
            {
            case "gridColumnProductId":

                e.DisplayText = string.IsNullOrEmpty(detail.Product.CustomerProductName) ? detail.Product.ProductName : detail.Product.ProductName + "{" + detail.Product.CustomerProductName + "}";
                break;
            }
        }
        private List <Model.BomComponentInfo> GetBomComponetList(Model.BomParentPartInfo _bomParmentPartInfo, double outQty)
        {
            List <Model.BomComponentInfo> _comDetailss = new List <Book.Model.BomComponentInfo>();

            //foreach (Model.BomComponentInfo bomcon in this.bomComponentInfoManager.Select(_bomParmentPartInfo))   //第一层子件
            foreach (Model.BomComponentInfo bomcon in this.bomComponentInfoManager.SelectSimpleForHandBook(_bomParmentPartInfo))   //第一层子件
            {
                //商品类型为:自制或者外购 才会带出,其他一律不需要
                //if (bomcon.Product.IsProcee == false && bomcon.Product.TrustOut == false && (bomcon.Product.HomeMade == true || bomcon.Product.OutSourcing == true))
                //{
                //bomcon.UseQuantity = bomcon.UseQuantity * outQty * (1 + (bomcon.SubLoseRate.HasValue ? bomcon.SubLoseRate.Value * 0.01 : 0));
                bomcon.UseQuantity = bomcon.UseQuantity * outQty;
                _comDetailss.Add(bomcon);
                //}

                GetBomComponetByParent(bomcon, _comDetailss);     //第一层以下子件
            }

            List <Model.BomComponentInfo> needList = new List <Book.Model.BomComponentInfo>(); //商品类型为:自制或者外购 才会带出,其他一律不需要

            foreach (var bomcon in _comDetailss)
            {
                if (bomcon.Product.IsProcee == false && bomcon.Product.TrustOut == false && (bomcon.Product.HomeMade == true || bomcon.Product.OutSourcing == true))
                {
                    needList.Add(bomcon);
                }
            }

            return(needList);
        }
Exemple #3
0
        private List <Model.BomComponentInfo> GetBomComponetList(Model.BomParentPartInfo _bomParmentPartInfo)
        {
            List <Model.BomComponentInfo> _comDetailss = new List <Book.Model.BomComponentInfo>();

            _comDetailss.Clear();

            Model.BomComponentInfo comm = new Model.BomComponentInfo();
            comm.Jibie       = 0;
            comm.UseQuantity = 1;
            comm.Product     = _bomParmentPartInfo.Product;


            comm.Product.ProductName = string.IsNullOrEmpty(_bomParmentPartInfo.Product.CustomerProductName) ? _bomParmentPartInfo.Product.ProductName : _bomParmentPartInfo.Product.ProductName + "{" + _bomParmentPartInfo.Product.CustomerProductName + "}";
            comm.ProductId           = _bomParmentPartInfo.ProductId;
            comm.Customer            = _bomParmentPartInfo.Customer;

            _comDetailss.Add(comm);
            foreach (Model.BomComponentInfo bomcon in this.bomComponentInfoManager.Select(_bomParmentPartInfo))
            {
                bomcon.Jibie = 1;
                bomcon.Product.ProductName = " ".PadLeft(bomcon.Jibie * 2, ' ') + (string.IsNullOrEmpty(bomcon.Product.CustomerProductName) ? bomcon.Product.ProductName : bomcon.Product.ProductName + "{" + bomcon.Product.CustomerProductName + "}");

                _comDetailss.Add(bomcon);

                GetBomComponetByParent(bomcon, _comDetailss);
            }

            return(_comDetailss);
        }
Exemple #4
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            string productid = e.Node.Tag.ToString();

            if (e.Node != null)
            {
                if (e.Node.Tag.ToString().IndexOf("customer") >= 0)
                {
                    this._product   = this.productManager.Get(productid.Substring(0, productid.IndexOf("customer")));
                    this._bomparent = this.BomparentManager.Get(this.productManager.Get(productid.Substring(0, productid.IndexOf("customer"))), this.customerManager.Get(productid.Substring(productid.IndexOf("customer") + 8)));
                }
                else
                {
                    // this.action = "view";
                    this._product   = productManager.Get(e.Node.Tag.ToString());
                    this._bomparent = this.BomparentManager.Get(this._product);
                }

                this._comDetails.Clear();
                // if ( this._bomparent!= null)
                //{

                this._comDetails = bomComponenmtInfoByBom(this._bomparent);
                this.bindingSource1.DataSource = this._comDetails;
                this.gridControl1.RefreshDataSource();
                //}
            }
        }
Exemple #5
0
        public BomXR(Model.BomParentPartInfo bomPart) : this()
        {
            this._bomparentPartInfo = bomPart;

            this.xrLabelCommanyName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text    = Properties.Resources.BomParentInfo;
            if (bomPart.Components.Count == 0)
            {
                return;
            }

            this.DataSource                  = bomPart.Components;
            this.xrLabelBOMid.Text           = bomPart.Product.Id;
            this.xrLabelBOMPartName.Text     = bomPart.Product.ProductName;
            this.xrLabelBomType.Text         = bomPart.BomType;
            this.xrLabelDefaultQuantity.Text = bomPart.DefaultQuantity.ToString();
            this.xrLabelEffectiveDate.Text   = Convert.ToDateTime(bomPart.EffectiveDate).ToShortDateString();
            this.xrLabelParentsModel.Text    = bomPart.Product.ProductSpecification;
            this.xrLabel8BomVersion.Text     = bomPart.BomVersion;
            this.xrLabelLossRate.Text        = bomPart.LossRate.ToString();
            this.xrLabelBomDescription.Text  = bomPart.BomDescription;
            //子件信息
            this.xrTableId.DataBindings.Add("Text", this.DataSource, "Product.Id");
            this.xrTableUserCount.DataBindings.Add("Text", this.DataSource, "UseQuantity");
            this.xrTableUnit.DataBindings.Add("Text", this.DataSource, "Unit");
            this.xrTableName.DataBindings.Add("Text", this.DataSource, "Product.ProductName");
            this.xrTableRemarks.DataBindings.Add("Text", this.DataSource, "Remarks");
            this.xrTableEffectsDate.DataBindings.Add("Text", this.DataSource, "EffectsDate", "{0:yyyy-MM-dd}");
            this.xrTableExpiringDate.DataBindings.Add("Text", this.DataSource, "ExpiringDate", "{0:yyyy-MM-dd}");
            this.xrTableGuiGe.DataBindings.Add("Text", this.DataSource, "Product.ProductSpecification");
            this.xrTableoffset.DataBindings.Add("Text", this.DataSource, "offset");
        }
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.ProceduresPrice> details = this.bindingSource1.DataSource as IList <Model.ProceduresPrice>;

            if (details == null || details.Count < 1)
            {
                return;
            }
            Model.BomParentPartInfo bom = details[e.ListSourceRowIndex].Bom;
            if (bom == null)
            {
                return;
            }
            switch (e.Column.Name)
            {
            case "gridColumnBomId":
                e.DisplayText = bom.Id;
                break;

            case "gridColumnProductName":
                e.DisplayText = bom.Product == null?null:bom.Product.ProductName;
                break;

            case "gridColumnFg":
                e.DisplayText = bom.Product == null ? null : bom.Product.ProductSpecification;
                break;
            }
        }
Exemple #7
0
 public IList <Model.BomComponentInfo> Select(Model.BomParentPartInfo bomParentPartInfo)
 {
     //
     // todo: add other logic here.
     //
     return(accessor.Select(bomParentPartInfo));
 }
Exemple #8
0
        public XRpRrocedure(Model.BomParentPartInfo bomPart) : this()
        {
            this.xrLabelCommanyName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text    = "物料加工生產序號";


            this.DataSource                  = proceduresMana.Select(bomPart);
            this.xrLabelBOMid.Text           = bomPart.Id;
            this.xrLabelProductId.Text       = bomPart.Product.Id;
            this.xrLabelBOMPartName.Text     = bomPart.Product.ProductName;
            this.xrLabelBomType.Text         = bomPart.BomType;
            this.xrLabelDefaultQuantity.Text = bomPart.DefaultQuantity.ToString();
            this.xrLabelEffectiveDate.Text   = Convert.ToDateTime(bomPart.EffectiveDate).ToShortDateString();
            this.xrLabelParentsModel.Text    = bomPart.Product.ProductSpecification;
            this.xrLabel8BomVersion.Text     = bomPart.BomVersion;
            this.xrLabelLossRate.Text        = bomPart.LossRate.ToString();
            this.xrLabelBomDescription.Text  = bomPart.BomDescription;

            //生产序号信息
            this.xrTableIds.DataBindings.Add("Text", this.DataSource, "Id");
            this.xrTableNames.DataBindings.Add("Text", this.DataSource, "Workhouse.Workhousename");
            this.xrTableProcedurenames.DataBindings.Add("Text", this.DataSource, "Procedurename");
            this.xrTableProceduresates.DataBindings.Add("Text", this.DataSource, "Proceduresate");
            this.xrTableProcedureTypes.DataBindings.Add("Text", this.DataSource, "ProcedureType");
            this.xrTableStartdates.DataBindings.Add("Text", this.DataSource, "Startdate", "{0:yyyy-MM-dd}");
            this.xrTableEnddates.DataBindings.Add("Text", this.DataSource, "Enddate", "{0:yyyy-MM-dd}");
            this.xrTableLeadtimes.DataBindings.Add("Text", this.DataSource, "Leadtime");
            this.xrTableProceduredescriptions.DataBindings.Add("Text", this.DataSource, "Proceduredescription");
        }
Exemple #9
0
        public BOMPackageXR(Model.BomParentPartInfo bomPart)
            : this()
        {
            this.xrLabelProductID.Text   = bomPart.Product.Id;
            this.xrLabelProductName.Text = bomPart.Product.ProductName;
            this.xrLabelDataName.Text    = bomPart.Product.ProductName + Properties.Resources.BomPackage;


            this.xrLabel1.Text = BL.Settings.CompanyChineseName;

            this.xrLabelLossRate.Text = bomPart.LossRate.ToString();
            this.xrLabelSpec.Text     = bomPart.Product.ProductSpecification;
            if (bomPart.Customer != null)
            {
                this.xrLabelCustomer.Text            = bomPart.Customer.CustomerShortName;
                this.xrLabelCustomerProductName.Text = bomPart.CustomerProductName;
            }

            this.xrLabelDate.Text = DateTime.Now.ToShortDateString();;


            //包装信息
            //  this.DataSource =packageDetailManager.GetByPackageId( bomPart.CustomerPackage.CustomerPackageId);

            this.xrTablePackageProductId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id);
            //  this.xrTablePackageProductName.DataBindings.Add("Text", this.DataSource, "Product."+Model.Product.PRO_ProductName); this.xrTablePackageProductRate.DataBindings.Add("Text", this.DataSource, Model.CustomerPackageDetail.PROPERTY_CONSUMERATE);
            //this.xrTablePackageRemarks.DataBindings.Add("Text", this.DataSource,Model.CustomerPackageDetail.PROPERTY_DESCRIPTION);
            //this.xrTablePackageProductCount.DataBindings.Add("Text",this.DataSource, Model.CustomerPackageDetail.PROPERTY_QUANTITY);
            //this.xrTablePackageEffectsDate.DataBindings.Add("Text", this.DataSource,Model.CustomerPackageDetail.PROPERTY_EFFECTSDATE, "{0:yyyy-MM-dd}");
            //this.xrTablePackageExpiringDate.DataBindings.Add("Text",this.DataSource, Model.CustomerPackageDetail.PROPERTY_EXPIRINGDATE, "{0:yyyy-MM-dd}");
        }
Exemple #10
0
        private static void GetParentProductInfo(string productId, List <string> parentProductIds)
        {
            IList <Model.BomComponentInfo> bomComponentList = bomComponentInfoManager.SelectBomIdAndUseQty(productId);

            if (bomComponentList == null || bomComponentList.Count == 0)
            {
                return;
            }

            string bomIds = "";

            foreach (var component in bomComponentList)
            {
                bomIds += "'" + component.BomId + "',";
            }
            bomIds = bomIds.TrimEnd(',');

            IList <Model.BomParentPartInfo> bomParentList = bomParentPartInfoManager.SelectProducts(bomIds);
            string productIds = "";

            foreach (var comInfo in bomComponentList)
            {
                Model.BomParentPartInfo parent = bomParentList.First(P => P.BomId == comInfo.BomId);
                productIds += "'" + parent.ProductId + "',";

                if (!parentProductIds.Contains(parent.ProductId))
                {
                    parentProductIds.Add(parent.ProductId);
                }
            }

            productIds = productIds.TrimEnd(',');

            GetParentProductInfo(productIds, parentProductIds);   //递归调用
        }
Exemple #11
0
        public BomProcessXR(Model.BomParentPartInfo bomPart)
            : this()
        {
            this.xrLabelCommanyName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text    = Properties.Resources.BomPackage;
            if (bomPart.Components.Count == 0)
            {
                return;
            }
            this.DataSource                  = bomPart.Components;
            this.xrLabelBOMid.Text           = bomPart.Product.Id;
            this.xrLabelBOMPartName.Text     = bomPart.Product.ProductName;
            this.xrLabelBomType.Text         = bomPart.BomType;
            this.xrLabelDefaultQuantity.Text = bomPart.DefaultQuantity.ToString();
            this.xrLabelEffectiveDate.Text   = Convert.ToDateTime(bomPart.EffectiveDate).ToShortDateString();
            this.xrLabelParentsModel.Text    = bomPart.Product.ProductSpecification;
            this.xrLabel8BomVersion.Text     = bomPart.BomVersion;
            this.xrLabelLossRate.Text        = bomPart.LossRate.ToString();
            this.xrLabelBomDescription.Text  = bomPart.BomDescription;

            //包装信息
            this.DataSource = bomPart.BOMProductProcess;

            this.xrTableProcessId.DataBindings.Add("Text", this.DataSource, "BOMProductProcessId");
            this.xrTableProcessNote.DataBindings.Add("Text", this.DataSource, "Process.Description");
            this.xrTableProcessType.DataBindings.Add("Text", this.DataSource, "ProcessCategory.ProcessCategoryName");
            this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, "Process.Content");
        }
Exemple #12
0
        public bool ExistsExcept(Model.BomParentPartInfo e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.BomId).Id);
            return(sqlmapper.QueryForObject <bool>("BomParentPartInfo.existsexcept", paras));
        }
Exemple #13
0
        /// <summary>
        /// Insert a BomParentPartInfo.
        /// </summary>
        public void Insert(Model.BomParentPartInfo bomParentPartInfo)
        {
            //
            // todo:add other logic here
            //
            Validate(bomParentPartInfo);
            if (this.Exists(bomParentPartInfo.Id))
            {
                bomParentPartInfo.Id = this.GetId();

                // throw new Helper.InvalidValueException("Id");
            }
            string sql = " ProductId= '" + bomParentPartInfo.ProductId + "'";

            if (this.Exists_Field(sql))
            {
                throw new Helper.InvalidValueException(Model.BomParentPartInfo.PRO_ProductId);
            }
            bomParentPartInfo.BomId = Guid.NewGuid().ToString();

            try
            {
                BL.V.BeginTransaction();
                bomParentPartInfo.InsertTime = DateTime.Now;
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, bomParentPartInfo.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, bomParentPartInfo.InsertTime.Value.Year, bomParentPartInfo.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, bomParentPartInfo.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);
                bomParentPartInfo.EmployeeAddId = BL.V.ActiveOperator.EmployeeId;
                //if (bomParentPartInfo.Status == 0 &&!string.IsNullOrEmpty( bomParentPartInfo.Product.CustomerBeforeProductName))
                //    this.UpdateSql("UPDATE bomParentPartInfo set Status=1 where productid in(select productid from product where CustomerProductName=  '" + bomParentPartInfo.Product.CustomerProductName + "')");
                _Insert(bomParentPartInfo);
                ////添加物料加工工序
                //if (!string.IsNullOrEmpty(bomParentPartInfo.TechonlogyHeaderId))
                //{
                //    Model.ManProcedure manProceduce = new Model.ManProcedure();
                //    manProceduce.ManProcedureId = Guid.NewGuid().ToString();
                //    manProceduce.BomId = bomParentPartInfo.BomId;
                //    if (bomParentPartInfo.Customer != null)
                //        manProceduce.CustomerId = bomParentPartInfo.Customer.CustomerId;
                //    manProceduce.InsertTime = DateTime.Now;
                //    manProceduce.UpdateTime = DateTime.Now;
                //    manProceduce.TechonlogyHeaderId = bomParentPartInfo.TechonlogyHeaderId;
                //}

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Exemple #14
0
 public Book.Model.BomParentPartInfo Get(Book.Model.Product product, Model.Customer customer)
 {
     Model.BomParentPartInfo par = accessor.Get(product, customer);
     if (par != null)
     {
         par.Components = bomComponentInfoAccessor.Select(par);
     }
     return(par);
 }
Exemple #15
0
 // private static readonly DA.IManProcedureAccessor manProcedureAccessor = (DA.IManProcedureAccessor)Accessors.Get("ManProcedureAccessor");
 /// <summary>
 /// Select by primary key.
 /// </summary>
 public Model.BomParentPartInfo Get(string bomId)
 {
     Model.BomParentPartInfo par = accessor.Get(bomId);
     if (par != null)
     {
         par.Components = bomComponentInfoAccessor.Select(par);
     }
     return(par);
 }
        public void MyClick(ref ChooseItem item)
        {
            ChooseBomParentPartInfoForm f = new ChooseBomParentPartInfoForm();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.BomParentPartInfo BomParentPartInfo = f.SelectedItem as Model.BomParentPartInfo;
                item = new ChooseItem(BomParentPartInfo, BomParentPartInfo.Id, BomParentPartInfo.Product.ProductName);
            }
        }
        private void btn_OK_Click(object sender, EventArgs e)
        {
            if (this.date_Start.EditValue == null || this.date_End.EditValue == null)
            {
                MessageBox.Show("日期区间不完整", this.Text, MessageBoxButtons.OK);
                return;
            }
            if (string.IsNullOrEmpty(this.ccb_bgHandBook.Text))
            {
                MessageBox.Show("手册不能为空", this.Text, MessageBoxButtons.OK);
                return;
            }
            DateTime startDate = this.date_Start.DateTime;
            DateTime endDate   = this.date_End.DateTime;

            string bgHandBookId = "";

            string[] bgHandBookIds = this.ccb_bgHandBook.Text.Split(',');
            foreach (var item in bgHandBookIds)
            {
                bgHandBookId += "'" + item.Trim() + "',";
            }
            bgHandBookId = bgHandBookId.TrimEnd(',');

            string bgProductId = this.txt_BGProductId.Text;
            string productId   = (this.btn_Product.EditValue as Model.Product) == null ? null : (this.btn_Product.EditValue as Model.Product).ProductId;
            string cusXOId     = this.txt_CusXOId.Text;

            IList <Model.InvoiceXSDetail> xsList = invoiceXSDetailManager.SelectByBGHandBook(startDate, endDate, bgHandBookId, bgProductId, productId, cusXOId);

            if (xsList == null || xsList.Count < 1)
            {
                MessageBox.Show("无数据", this.Text, MessageBoxButtons.OK);
                return;
            }
            Dictionary <Model.InvoiceXSDetail, List <Model.BomComponentInfo> > dic = new Dictionary <Book.Model.InvoiceXSDetail, List <Book.Model.BomComponentInfo> >();

            foreach (var xsDetail in xsList)
            {
                xsDetail.Product           = new Book.Model.Product();
                xsDetail.Product.ProductId = xsDetail.ProductId;
                Model.BomParentPartInfo bomParent = this.bomParentPartInfoManager.Get(xsDetail.Product);
                if (bomParent != null)
                {
                    dic.Add(xsDetail, GetBomComponetList(bomParent, xsDetail.InvoiceXSDetailQuantity.Value));
                }
                else
                {
                    dic.Add(xsDetail, new List <Book.Model.BomComponentInfo>());
                }
            }

            ExportExcel(dic);
        }
        private void GetParentProductInfo(string productId, Dictionary <string, double> parentProductDic)
        {
            IList <Model.BomComponentInfo> bomComponentList = bomComponentInfoManager.SelectBomIdAndUseQty(productId);

            if (bomComponentList == null || bomComponentList.Count == 0)
            {
                return;
            }

            string bomIds = "";

            foreach (var component in bomComponentList)
            {
                bomIds += "'" + component.BomId + "',";
            }
            bomIds = bomIds.TrimEnd(',');

            IList <Model.BomParentPartInfo> bomParentList = bomParentPartInfoManager.SelectProducts(bomIds);
            string productIds = "";

            #region 新版,一个子件没母件引用N次,叠加计算
            foreach (var comInfo in bomComponentList)
            {
                Model.BomParentPartInfo parent = bomParentList.First(P => P.BomId == comInfo.BomId);
                productIds += "'" + parent.ProductId + "',";

                if (!parentProductDic.Keys.Contains(parent.ProductId))
                {
                    double value = Convert.ToDouble(comInfo.UseQuantity);
                    if (parentProductDic.Keys.Contains(comInfo.ProductId))
                    {
                        value = value * parentProductDic[comInfo.ProductId];
                    }

                    parentProductDic.Add(parent.ProductId, value);
                }
                else
                {
                    double value = Convert.ToDouble(comInfo.UseQuantity);
                    if (parentProductDic.Keys.Contains(comInfo.ProductId))
                    {
                        value = value * parentProductDic[comInfo.ProductId];
                    }

                    parentProductDic[parent.ProductId] = parentProductDic[parent.ProductId] + value;
                }
            }
            #endregion

            productIds = productIds.TrimEnd(',');

            GetParentProductInfo(productIds, parentProductDic);   //递归调用
        }
 public void MyLeave(ref ChooseItem item)
 {
     BL.BomParentPartInfoManager manager           = new Book.BL.BomParentPartInfoManager();
     Model.BomParentPartInfo     BomParentPartInfo = manager.GetById(item.ButtonText);
     if (BomParentPartInfo != null)
     {
         item.EditValue  = BomParentPartInfo;
         item.LabelText  = BomParentPartInfo.Product.ProductName;
         item.ButtonText = BomParentPartInfo.Id;
     }
     else
     {
         item.ErrorMessage = "BOM单錯誤";
     }
 }
Exemple #20
0
 private void _Insert(Model.BomParentPartInfo bomParentPartInfo)
 {
     // bomParentPartInfo.CustomerBOMInProductId = product.ProductId;
     foreach (Model.BomComponentInfo component in bomParentPartInfo.Components)
     {
         if (bomParentPartInfo.ProductId == component.ProductId)
         {
             throw new global::Helper.MessageValueException("主鍵不能與母鍵相同!");
         }
     }
     if (bomParentPartInfo.Status == 0 && !string.IsNullOrEmpty(bomParentPartInfo.Product.CustomerBeforeProductName))
     {
         this.UpdateSql("UPDATE bomParentPartInfo set Status=1 where productid in(select productid from product where CustomerProductName=  '" + bomParentPartInfo.Product.CustomerProductName + "')");
     }
     accessor.Insert(bomParentPartInfo);
     foreach (Model.BomComponentInfo component in bomParentPartInfo.Components)
     {
         if (string.IsNullOrEmpty(component.ProductId) && component.Product == null)
         {
             continue;
         }
         component.PriamryKeyId       = Guid.NewGuid().ToString();
         component.BasicUseQuantity   = 1;
         component.BomId              = bomParentPartInfo.BomId;
         component.FoundationQuantity = 1;
         if (string.IsNullOrEmpty(component.ProductId))
         {
             if (component.Product != null)
             {
                 component.ProductId = component.Product.ProductId;
             }
         }
         bomComponentInfoAccessor.Insert(component);
     }
     if (bomParentPartInfo.BomPackageDetails != null)
     {
         foreach (Model.BomPackageDetails bomPackageDetails in bomParentPartInfo.BomPackageDetails)
         {
             if (bomPackageDetails != null)
             {
                 bomPackageDetails.BomPackageDetailsId = Guid.NewGuid().ToString();
                 bomPackageDetails.BomId = bomParentPartInfo.BomId;
                 bomPackageDetailsAccessor.Insert(bomPackageDetails);
             }
         }
     }
 }
Exemple #21
0
        private void Validate(Model.BomParentPartInfo bom)
        {
            if (string.IsNullOrEmpty(bom.Id))
            {
                throw new Helper.RequireValueException(Model.BomParentPartInfo.PRO_Id);
            }

            //if (string.IsNullOrEmpty(bom.ProductId))
            //{
            //    throw new  Exception("請選擇母件");
            //}

            if (bom.Product == null && string.IsNullOrEmpty(bom.ProductId))
            {
                throw new Helper.RequireValueException(Model.BomParentPartInfo.PRO_ProductId);
            }
        }
Exemple #22
0
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BomManagerForm2_Load(object sender, EventArgs e)
        {
            // this.WindowState = FormWindowState.Maximized;
            band();


            if (treeList1.Nodes.Count != 0)
            {
                this._product   = productManager.Get(treeList1.Nodes[0].Tag.ToString());
                this._bomparent = this.BomparentManager.Get(this._product);
                this._comDetails.Clear();

                this._comDetails = bomComponenmtInfoByBom(this._bomparent);
                this.bindingSource1.DataSource = this._comDetails;
                this.gridControl1.RefreshDataSource();
            }
        }
Exemple #23
0
        public void Delete(Model.BomParentPartInfo bomParentPartInfo)
        {
            //
            // todo:add other logic here
            //

            try
            {
                V.BeginTransaction();
                this.Delete(bomParentPartInfo.BomId);

                //productAccessor.Delete(bomParentPartInfo.CustomerBOMInProductId);

                V.CommitTransaction();
            }
            catch
            {
                V.RollbackTransaction();
                throw;
            }
        }
Exemple #24
0
 public override void updates()
 {
     if (!string.IsNullOrEmpty(eTag))
     {
         this._product   = productManager.Get(eTag);
         this._bomparent = this.BomparentManager.Get(this._product);
         if (this._bomparent != null)
         {
             BomEdit bomEdit = new BomEdit(this._bomparent);
             if (bomEdit != null)
             {
                 if (bomEdit.ShowDialog() == DialogResult.OK)
                 {
                     RefreshData();
                     this.barStaticItem1.Caption = string.Format("{0}项", this.bindingSource1.Count);
                 }
                 this.bindingSource1.Position = this.bindingSource1.IndexOf(bomEdit.EditedItem);
             }
         }
     }
 }
Exemple #25
0
        private void RO1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            if (this.pronoteHeader == null)
            {
                return;
            }
            this.pronoteHeader.DetailsMaterial = pronotedetailsMaterialManager.GetByHeader(this.pronoteHeader);
            this._bomParmentPartInfo           = this.bomParmentInfoManager.Get(this.pronoteHeader.Product);
            IList <Model.MRSdetails> mrsdetailList;

            for (int i = 0; i < this.pronoteHeader.DetailsMaterial.Count; i++)
            {
                mrsdetailList = mrsdetailsManager.GetByMRSIDAndProId(this.pronoteHeader.DetailsMaterial[i].PronoteHeader.MRSHeaderId, this.pronoteHeader.DetailsMaterial[i].ProductId);
                if (mrsdetailList != null && mrsdetailList.Count > 0)
                {
                    this.pronoteHeader.DetailsMaterial[i].JiaoQi = mrsdetailList[0].JiaoHuoDate;
                }
            }
            //  this.DataSource = XRband();
            this.DataSource = this.pronoteHeader.DetailsMaterial;
        }
Exemple #26
0
        private void GetBomComponetByParent(Model.BomComponentInfo componet, List <Model.BomComponentInfo> _comDetailss)
        {
            Model.BomParentPartInfo _bomparent = bomParentPartInfoManager.Get(componet.Product);
            if (_bomparent != null)
            {
                IList <Model.BomComponentInfo> comList = this.bomComponentInfoManager.Select(_bomparent);
                if (comList != null && comList.Count > 0)
                {
                    foreach (var item in comList)
                    {
                        item.Jibie = componet.Jibie + 1;
                        item.Product.ProductName = " ".PadLeft(item.Jibie * 2, ' ') + (string.IsNullOrEmpty(item.Product.CustomerProductName) ? item.Product.ProductName : item.Product.ProductName + "{" + item.Product.CustomerProductName + "}");

                        _comDetailss.Add(item);

                        //递归调用
                        GetBomComponetByParent(item, _comDetailss);
                    }
                }
            }
        }
Exemple #27
0
        /// <summary>
        /// 选择货品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonEditProduct_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            Invoices.ChooseProductForm f = new Book.UI.Invoices.ChooseProductForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.Product product = f.SelectedItem as Model.Product;
                if (product != null)
                {
                    this.buttonEditProduct.Text   = product.Id;
                    this.textEditProductName.Text = string.IsNullOrEmpty(product.CustomerProductName) ? product.ProductName : product.ProductName + "{" + product.CustomerProductName + "}";

                    if (!string.IsNullOrEmpty(product.CustomerProductName))
                    {
                        this.textEditCustomerPro.Text = product.CustomerProductName;
                    }

                    if (product.IsCustomerProduct == true && !string.IsNullOrEmpty(product.CustomerProductName))
                    {
                        this._bomParentPartInfo = bomParentPartInfo.Get(this.productManager.Get(product.CustomerBeforeProductId));
                        // this.textEditCustomProduct.Text = product.CustomerProductName;
                        this.newChooseContorlCustomer.EditValue = product.Customer;
                    }
                    else
                    {
                        this._bomParentPartInfo = bomParentPartInfo.Get(product);
                        // this.textEditCustomProduct.Text = "";
                        this.newChooseContorlCustomer.EditValue = null;
                    }
                    this._manprocedure.Bom = this._bomParentPartInfo;
                    if (this._bomParentPartInfo != null)
                    {
                        this.textEditBOMID.EditValue = this._bomParentPartInfo.Id;
                        // this.textEditBOMType.EditValue = this._bomParentPartInfo.MaterialType;
                    }
                }
            }
            f.Dispose();
            GC.Collect();
        }
Exemple #28
0
        private void buttonEditBom_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            Settings.ProduceManager.ChooseBomParentPartInfoForm f = new ChooseBomParentPartInfoForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.BomParentPartInfo bom = f.SelectedItem as Model.BomParentPartInfo;
                if (bom != null)
                {
                    this.buttonEditBom.EditValue = bom;
                    if (bom.Product != null)
                    {
                        this.textEditBomCode.Text = bom.Product.Id;
                        this.textEditBom.Text     = bom.Product.ProductName;
                        this.textEdit4.Text       = bom.Product.ProductSpecification;

                        this.comboBoxEditPriceUnit.Properties.Items.Clear();

                        if (!string.IsNullOrEmpty(bom.Product.BasedUnitGroupId))
                        {
                            BL.ProductUnitManager     unitManager = new Book.BL.ProductUnitManager();
                            IList <Model.ProductUnit> unitList    = unitManager.Select(bom.Product.BasedUnitGroup);
                            foreach (Model.ProductUnit item in unitList)
                            {
                                this.comboBoxEditPriceUnit.Properties.Items.Add(item.CnName);
                                this.comboBoxEditUnit.Properties.Items.Add(item.CnName);
                            }
                        }
                        this.comboBoxEditUnit.EditValue      = bom.Product.ProduceUnit == null?null: bom.Product.ProduceUnit.CnName;
                        this.comboBoxEditPriceUnit.EditValue = bom.Product.ProduceUnit == null ? null : bom.Product.ProduceUnit.CnName;
                        this.spinEditConversionRate.Value    = 1;
                    }
                }
            }
            f.Dispose();
            System.GC.Collect();
        }
        private void GetBomComponetByParent(Model.BomComponentInfo componet, List <Model.BomComponentInfo> _comDetailss)
        {
            Model.BomParentPartInfo _bomparent = bomParentPartInfoManager.Get(componet.Product);
            if (_bomparent != null)
            {
                IList <Model.BomComponentInfo> comList = this.bomComponentInfoManager.SelectSimpleForHandBook(_bomparent);
                if (comList != null && comList.Count > 0)
                {
                    foreach (var item in comList)
                    {
                        //商品类型为:自制或者外购 才会带出,其他一律不需要
                        //if (item.Product.IsProcee == false && item.Product.TrustOut == false && (item.Product.HomeMade == true || item.Product.OutSourcing == true))
                        //{
                        //item.UseQuantity = componet.UseQuantity * item.UseQuantity * (1 + (item.SubLoseRate.HasValue ? item.SubLoseRate.Value * 0.01 : 0));
                        item.UseQuantity = componet.UseQuantity * item.UseQuantity;
                        _comDetailss.Add(item);
                        //}

                        //递归调用
                        GetBomComponetByParent(item, _comDetailss);
                    }
                }
            }
        }
Exemple #30
0
        public RO2(System.Collections.Generic.IList <Model.MPSdetails> mpsdetail, DateTime dateStart, DateTime dateEnd)
        {
            InitializeComponent();
            this.xrLabelDate.Text            = "自" + dateStart.ToShortDateString() + "至" + dateEnd.ToShortDateString();
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.MRSDetails;
            this.xrLabelNowDate.Text        += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            if (mpsdetail.Count == 0)
            {
                return;
            }

            foreach (Model.MPSdetails MPSdetails in mpsdetail)
            {
                this._bomparent  = this.BomparentManager.Get(MPSdetails.Product);
                this._bomparents = this._bomparent;
                if (_bomparent != null)
                {
                    this._bomcomDetail = this.BomcomManager.Select(_bomparent);
                }
                IList <Model.BomComponentInfo> a = null;
                if (this._bomcomDetail.Count != 0)
                {
                    for (int i = 0; i < this._bomcomDetail.Count; i++)
                    // foreach(Model.BomComponentInfo com in this._bomcomDetail)
                    {    //在物料中查询 是否 存在此子件
                        this._bomparent              = this.BomparentManager.Get(_bomcomDetail[i].Product);
                        _bomcomDetail[i].Customer    = MPSdetails.Customer;
                        _bomcomDetail[i].MPSheader   = MPSdetails.MPSheader;
                        _bomcomDetail[i].InvoiceXOId = MPSdetails.InvoiceXOId;
                        if (_bomcomDetail[i].MPSheader != null)
                        {
                            _bomcomDetail[i].MPSheaderId = _bomcomDetail[i].MPSheader.MPSheaderId;
                        }

                        if (this._bomparent != null)
                        {
                            a = this.BomcomManager.Select(this._bomparent);
                            foreach (Model.BomComponentInfo bom in a)
                            {
                                bom.Jibie = _bomcomDetail[i].Jibie + 1;

                                bom.UseQuantity = _bomcomDetail[i].UseQuantity * bom.UseQuantity;
                                bom.Customer    = MPSdetails.Customer;

                                bom.MPSheader = MPSdetails.MPSheader;



                                if (MPSdetails.MPSheader != null)
                                {
                                    bom.MPSheaderId = MPSdetails.MPSheader.MPSheaderId;
                                }
                                bom.Product.Id = this._bomparent.Product.Id + "/" + bom.Product.Id;
                                this._bomcomDetail.Add(bom);
                            }

                            a.Clear();
                        }
                    }
                }
            }



            this.DataSource = this._bomcomDetail;

            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.xrTableCellGuige.DataBindings.Add("Text", this.DataSource, "Product.ProductSpecification");
            this.xrTableCellMPSheadid.DataBindings.Add("Text", this.DataSource, "MPSheader.MPSheaderId");
            this.xrTableMRSstartdate.DataBindings.Add("Text", this.DataSource, "MPSheader.MPSStartDate", "{0:yyyy-MM-dd}");
            this.xrTableMRSdetailssum.DataBindings.Add("Text", this.DataSource, "UseQuantity");
            this.xrTableCellUnit.DataBindings.Add("Text", this.DataSource, "Unit");

            this.xrTableCustomer.DataBindings.Add("Text", this.DataSource, "Customer.CustomerShortName");

            this.xrTableXO.DataBindings.Add("Text", this.DataSource, "InvoiceXOId");
        }