Example #1
0
 /// <summary>
 /// Update a ProductMark.
 /// </summary>
 public void Update(Model.ProductMark productMark)
 {
     //
     // todo: add other logic here.
     //
     accessor.Update(productMark);
 }
Example #2
0
 /// <summary>
 /// Insert a ProductMark.
 /// </summary>
 public void Insert(Model.ProductMark productMark)
 {
     //
     // todo:add other logic here
     //
     accessor.Insert(productMark);
 }
Example #3
0
        public bool ExistsExcept(Model.ProductMark e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.Id) == null?null:Get(e.Id).Id);
            return(sqlmapper.QueryForObject <bool>("ProductMark.existsexcept", paras));
        }
Example #4
0
 public void Update(Model.ProductMark e)
 {
     this.Update <Model.ProductMark>(e);
 }
Example #5
0
 public void Insert(Model.ProductMark e)
 {
     this.Insert <Model.ProductMark>(e);
 }
Example #6
0
        private void BindData(IList <Model.PronoteHeader> list)
        {
            foreach (Model.PronoteHeader detail in list)
            {
                if (!string.IsNullOrEmpty(detail.InvoiceXOId))
                {
                    detail.InvoiceXO = this.xomanamager.Get(detail.InvoiceXOId);
                }
                detail.MRSDetails = this.mrsdetailManager.Get(detail.MRSdetailsId);
                if (!string.IsNullOrEmpty(detail.ProductId))
                {
                    detail.Product = new BL.ProductManager().Get(detail.ProductId);

                    if (string.IsNullOrEmpty(detail.CustomerProductName))
                    {
                        detail.CustomerProductName = new Help().GetCustomerProductNameByPronoteHeaderId(detail.PronoteHeaderID, detail.ProductId);
                    }

                    Model.ProductMark mark = productMarkManager.SelectByProductId(detail.ProductId);
                    if (mark != null)
                    {
                        detail.MainMark = mark.MainMark;
                        detail.SideMark = mark.SideMark;
                    }
                }
            }
            this.DataSource = list;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.ZZJiaGong;

            this.xrLabelPrintDate.Text = this.xrLabelPrintDate.Text + DateTime.Now.ToShortDateString();
            this.xrLabelPronoteHeaderID.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_PronoteHeaderID);
            this.xrLabelPronoteDte.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_PronoteDate, "{0:yyyy-MM-dd}");

            this.xrLabelCustomerXOId.DataBindings.Add("Text", this.DataSource, Model.InvoiceXO.PRO_CustomerInvoiceXOId);
            this.xrLabelCustomer.DataBindings.Add("Text", this.DataSource, "CustomerShortName");
            this.xrLabelCheckedStandard.DataBindings.Add("Text", this.DataSource, "CustomerCheckStandard");
            this.xrLabelCustomerProductName.DataBindings.Add("Text", this.DataSource, "CustomerProductName");
            this.xrLabelCount.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_DetailsSum);

            this.xrLabelUnit.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_ProductUnit);
            this.xrLabelXOJHDate.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_InvoiceYjrq, "{0:yyyy-MM-dd}");
            this.xrLabelPiHao.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_CustomerLotNumber);
            //this.xrLabelProductName.DataBindings.Add("Text", this.DataSource, "ProductName");
            this.xrLabelProductName.DataBindings.Add("Text", this.DataSource, "ProductNameWithVersion");
            this.xrRichTextProDesc.DataBindings.Add("Rtf", this.DataSource, "ProductDesc");
            this.xrLabelMRP.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_MRSHeaderId);
            this.xrLabelWorkHouse.DataBindings.Add("Text", this.DataSource, "Workhousename");
            this.xrLabelBeforepPackage.DataBindings.Add("Text", this.DataSource, "MRSDetails.BeforePackageProduct." + Model.Product.PRO_ProductName);
            this.xrLabel14.DataBindings.Add("Text", this.DataSource, "AuditEmpName");
            this.GroupHeader1.GroupFields.Add(new GroupField(Model.PronoteHeader.PRO_PronoteHeaderID));
            // this.GroupFooter1.gr.Add(new GroupField(Model.PronoteHeader.PRO_PronoteHeaderID));
            this.xrLabelPronotedesc.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_Pronotedesc);
            this.xrLabelEmployee.DataBindings.Add("Text", this.DataSource, "Employee0Name");
            this.lbl_MaterialSum.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_Materialprocessum);

            //商品正侧唛单独划分出一张表 2021年7月18日20:28:12
            //this.RichTextZhengMai.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_AttrZhengMai);
            //this.RichTextCeMai.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_AttrCeMai);
            this.RichTextZhengMai.DataBindings.Add("Rtf", this.DataSource, "MainMark");
            this.RichTextCeMai.DataBindings.Add("Rtf", this.DataSource, "SideMark");

            this.xrSubreport1.ReportSource = new RO1();
            this.xrSubreport2.ReportSource = new RO2();

            this.lbl_JIS.DataBindings.Add("Text", this.DataSource, "Lbl_JIS");
        }
Example #7
0
        /// <summary>
        /// Insert a Product.
        /// </summary>
        public void Insert(Model.Product product, Model.ProductMark productMark)
        {
            this.Validate(product);
            //if (this.Exists(product.Id))
            //{
            //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
            TiGuiExists(product);
            //  }

            if (this.ExistsNameInsert(product.ProductName))
            {
                throw new Helper.InvalidValueException(Model.Product.PRO_ProductName);
            }

            //设置KEY值
            string sequencekey = product.ProductCategory.Id;

            SequenceManager.Increment(sequencekey);

            StringBuilder strBU = new StringBuilder();

            string PrId = Guid.NewGuid().ToString();

            product.ProductId = PrId;
            if (product.BasedUnitGroup != null)
            {
                product.BasedUnitGroupId = product.BasedUnitGroup.UnitGroupId;
            }
            if (product.BuyEmployee != null)
            {
                product.BuyEmployeeId = product.BuyEmployee.EmployeeId;
            }
            if (product.BuyUnit != null)
            {
                product.BuyUnitId = product.BuyUnit.ProductUnitId;
            }
            if (product.CustomInspectionRule != null)
            {
                product.CustomInspectionRuleId = product.CustomInspectionRule.CustomInspectionRuleId;
            }
            if (product.Depot != null)
            {
                product.DepotId = product.Depot.DepotId;
            }
            if (product.DepotPosition != null)
            {
                product.DepotPositionId = product.DepotPosition.DepotPositionId;
            }
            if (product.DepotUnit != null)
            {
                product.DepotUnitId = product.DepotUnit.ProductUnitId;
            }
            //if (product.InsteadOfProductId != null) product.InsteadOfProductId = product.InsteadOfProduct.ProductId;
            if (product.MainUnit != null)
            {
                product.MainUnitId = product.MainUnit.ProductUnitId;
            }
            // if (product.PackageType != null) product.PackageTypeId = product.PackageType.PackageTypeId;
            if (product.ProduceUnit != null)
            {
                product.ProduceUnitId = product.ProduceUnit.ProductUnitId;
            }
            if (product.ProductCategory != null)
            {
                product.ProductCategoryId = product.ProductCategory.ProductCategoryId;
            }
            if (product.QualityTestPlan != null)
            {
                product.QualityTestPlanId = product.QualityTestPlan.QualityTestPlanId;
            }
            if (product.QualityTestUnit != null)
            {
                product.QualityTestUnitId = product.QualityTestUnit.ProductUnitId;
            }
            if (product.SellUnit != null)
            {
                product.SellUnitId = product.SellUnit.ProductUnitId;
            }
            // if (product.Supplier != null) product.SupplierId = product.Supplier.SupplierId;
            product.SupplierId = product.Supplier == null ? null : product.Supplier.SupplierId;
            if (product.VolumeUnit != null)
            {
                product.VolumeUnitId = product.VolumeUnit.ProductUnitId;
            }
            if (product.VolumeUnitGroup != null)
            {
                product.VolumeUnitGroupId = product.VolumeUnitGroup.UnitGroupId;
            }
            if (product.WeightUnit != null)
            {
                product.WeightUnitId = product.WeightUnit.ProductUnitId;
            }
            if (product.WeightUnitGroup != null)
            {
                product.WeightUnitGroupId = product.WeightUnitGroup.UnitGroupId;
            }

            if (product.ProductCategory != null)
            {
                product.ProductCategoryId = product.ProductCategory.ProductCategoryId;
            }
            if (product.ProductCategory2 != null)
            {
                product.ProductCategoryId2 = product.ProductCategory2.ProductCategoryId;
            }
            if (product.ProductCategory3 != null)
            {
                product.ProductCategoryId3 = product.ProductCategory3.ProductCategoryId;
            }

            product.InsertTime = DateTime.Now;
            //product.UpdateTime = DateTime.Now;

            accessor.Insert(product);
            //ProductProcessAccessor.Delete(product);
            foreach (Model.ProductMouldDetail Pro in product.ProductMouldDetail)
            {
                if (string.IsNullOrEmpty(Pro.ProductMouldDetailId))
                {
                    continue;
                }
                Pro.ProductId = product.ProductId;
                ProductMouldDetailAccessor.Insert(Pro);
            }

            //商品唛头  2021年8月22日23:12:14
            if (!string.IsNullOrEmpty(productMark.MainMark) || !string.IsNullOrEmpty(productMark.SideMark))
            {
                productMark.Id        = Guid.NewGuid().ToString();
                productMark.ProductId = product.ProductId;

                productMarkAccessor.Insert(productMark);
            }

            //foreach (Model.ProductProcess Pro in product.ProductProcess)
            //{
            //    if (string.IsNullOrEmpty(Pro.ProcessCategoryId)) continue;
            //    //strBU.Append(Pro.ProcessCategory.ProcessCategoryName);
            //    Pro.ProductProcessId = Guid.NewGuid().ToString();
            //    Pro.ProductId = product.ProductId;
            //    Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;

            //    Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
            //    ProductProcessAccessor.Insert(Pro);
            //}



            //加工后名称添加
            ////if (product.ProductProcess!=null)
            ////{
            ////    if (product.ProductProcess.Count > 0)
            ////    {
            ////        product.ProductId = Guid.NewGuid().ToString();
            ////        ////product.ProductName = product.ProProcessName;0827
            ////        ProductProcessAccessor.Delete(product);
            ////        product.ProceebeforeProductId = PrId;
            ////        product.IsProcee = true;
            ////        accessor.Insert(product);
            ////        foreach (Model.ProductProcess Pro in product.ProductProcess)
            ////        {
            ////            if (Pro.ProcessCategory == null) continue;
            ////            Pro.ProductProcessId = Guid.NewGuid().ToString();
            ////            Pro.ProductId = product.ProductId;
            ////            Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;
            ////            Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
            ////            ProductProcessAccessor.Insert(Pro);
            ////        }
            ////    }
            ////}
            //}
        }
Example #8
0
        /// <summary>
        /// Update a Product.
        /// </summary>
        ///


        public void Update(Model.Product product, Model.ProductMark productMark)
        {
            try
            {
                this.Validate(product);
                TiGuiExistsUpdate(product);
                if (this.ExistsNameUpdate(product) && (product.IsCustomerProduct == null || !product.IsCustomerProduct.Value))
                {
                    throw new Helper.InvalidValueException(Model.Product.PRO_ProductName);
                }
                V.BeginTransaction();
                //if (!string.IsNullOrEmpty(product.ProProcessName))
                //{
                //    if (product.IsProcee == true)
                //    {
                //        if (this.ExistsNameUpdate(product))
                //        {
                //            throw new Helper.InvalidValueException(Model.Product.PRO_ProductName);
                //        }
                //    }
                //}

                StringBuilder strBU = new StringBuilder();
                //string PrId = product.ProductId;
                //string name = product.ProductName;
                //double? stock = product.StocksQuantity;
                //string text = product.ProductProcessDescription;
                ////bool? result = product.IsProcee;
                ////string proceebeforeProductId = product.ProceebeforeProductId;
                //string Id = product.Id;
                //string ProductBarCode = product.ProductBarCode;
                //bool? ProductBarCodeIsAuto = product.ProductBarCodeIsAuto;

                if (product.BasedUnitGroup != null)
                {
                    product.BasedUnitGroupId = product.BasedUnitGroup.UnitGroupId;
                }
                if (product.BuyEmployee != null)
                {
                    product.BuyEmployeeId = product.BuyEmployee.EmployeeId;
                }
                if (product.BuyUnit != null)
                {
                    product.BuyUnitId = product.BuyUnit.ProductUnitId;
                }
                if (product.CustomInspectionRule != null)
                {
                    product.CustomInspectionRuleId = product.CustomInspectionRule.CustomInspectionRuleId;
                }
                if (product.Depot != null)
                {
                    product.DepotId = product.Depot.DepotId;
                }
                if (product.DepotPosition != null)
                {
                    product.DepotPositionId = product.DepotPosition.DepotPositionId;
                }
                if (product.DepotUnit != null)
                {
                    product.DepotUnitId = product.DepotUnit.ProductUnitId;
                }
                //if (product.InsteadOfProduct != null) product.InsteadOfProductId = product.InsteadOfProduct.ProductId;
                if (product.MainUnit != null)
                {
                    product.MainUnitId = product.MainUnit.ProductUnitId;
                }
                //  if (product.PackageType != null) product.PackageTypeId = product.PackageType.PackageTypeId;
                if (product.ProduceUnit != null)
                {
                    product.ProduceUnitId = product.ProduceUnit.ProductUnitId;
                }
                if (product.ProductCategory != null)
                {
                    product.ProductCategoryId = product.ProductCategory.ProductCategoryId;
                }
                if (product.QualityTestPlan != null)
                {
                    product.QualityTestPlanId = product.QualityTestPlan.QualityTestPlanId;
                }
                if (product.QualityTestUnit != null)
                {
                    product.QualityTestUnitId = product.QualityTestUnit.ProductUnitId;
                }
                if (product.SellUnit != null)
                {
                    product.SellUnitId = product.SellUnit.ProductUnitId;
                }
                //if (product.Supplier != null) product.SupplierId = product.Supplier.SupplierId;
                product.SupplierId = product.Supplier == null ? null : product.Supplier.SupplierId;
                if (product.VolumeUnit != null)
                {
                    product.VolumeUnitId = product.VolumeUnit.ProductUnitId;
                }
                if (product.VolumeUnitGroup != null)
                {
                    product.VolumeUnitGroupId = product.VolumeUnitGroup.UnitGroupId;
                }
                if (product.WeightUnit != null)
                {
                    product.WeightUnitId = product.WeightUnit.ProductUnitId;
                }
                if (product.WeightUnitGroup != null)
                {
                    product.WeightUnitGroupId = product.WeightUnitGroup.UnitGroupId;
                }

                //if (product.ProductImage == null)
                //    product.ProductImage = pic;
                //if (product.ProductImage1 == null)
                //    product.ProductImage1 = pic;
                //if (product.ProductImage2 == null)
                //    product.ProductImage2 = pic;
                //if (product.ProductImage3 == null)
                //    product.ProductImage3 = pic;

                if (product.ProductCategory != null)
                {
                    product.ProductCategoryId = product.ProductCategory.ProductCategoryId;
                }
                if (product.ProductCategory2 != null)
                {
                    product.ProductCategoryId2 = product.ProductCategory2.ProductCategoryId;
                }
                else
                {
                    product.ProductCategoryId2 = null;
                }
                if (product.ProductCategory3 != null)
                {
                    product.ProductCategoryId3 = product.ProductCategory3.ProductCategoryId;
                }
                else
                {
                    product.ProductCategoryId3 = null;
                }

                product.UpdateTime = DateTime.Now;
                //Model.Product Prdt = product;



                //if (product.IsProcee == true && product.ProductProcess.Count > 0)
                //{
                //    product.Id = string.IsNullOrEmpty(product.ProceId) ? product.Id : product.ProceId;
                //    // product.ProductBarCode = string.IsNullOrEmpty(product.ProceId) ? null : product.ProceId;
                //    product.ProductName = string.IsNullOrEmpty(product.ProProcessName) ? product.ProductName : product.ProProcessName;
                //    product.ProductDescription = product.ProductProcessDescription;
                //}
                //if ((product.IsProcee == null || product.IsProcee == false) && product.ProductProcess.Count > 0)
                //    product.ProductDescription = accessor.Get(product.ProductId).ProductDescription;
                accessor.Update(product);

                ProductMouldDetailAccessor.Delete(product);
                foreach (Model.ProductMouldDetail Pro in product.ProductMouldDetail)
                {
                    if (string.IsNullOrEmpty(Pro.ProductMouldDetailId))
                    {
                        continue;
                    }
                    Pro.ProductId = product.ProductId;
                    ProductMouldDetailAccessor.Insert(Pro);
                }


                //商品唛头  2021年8月22日23:12:01
                Model.ProductMark mark = productMarkAccessor.SelectByProductId(product.ProductId);
                if (mark != null)
                {
                    mark.MainMark = productMark.MainMark;
                    mark.SideMark = productMark.SideMark;

                    productMarkAccessor.Update(mark);
                }
                else if (!string.IsNullOrEmpty(productMark.MainMark) || !string.IsNullOrEmpty(productMark.SideMark))
                {
                    productMark.Id        = Guid.NewGuid().ToString();
                    productMark.ProductId = product.ProductId;

                    productMarkAccessor.Insert(productMark);
                }

                // ProductProcessAccessor.Delete(product);
                //foreach (Model.ProductProcess Pro in product.ProductProcess)
                //{
                //    if (Pro.ProcessCategory == null) continue;
                //    //strBU.Append(Pro.ProcessCategory.ProcessCategoryName);
                //    Pro.ProductProcessId = Guid.NewGuid().ToString();
                //    Pro.ProductId = product.ProductId;
                //    Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;
                //    Pro.ProcessCategoryId = Pro.Procegory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
                //    ProductProcessAccessor.Insert(Pro);essCat
                //}

                //加工后名称添加

                //foreach (Model.ProductProcess Pro in product.ProductProcess)
                //{
                //    if (Pro.ProcessCategory == null) continue;
                //    product.ProceebeforeProductId = PrId;
                //    product.IsProcee = true;
                //    //string a=Pro.Product.ProductName;
                //    if (Pro.ProductId == product.ProductId && Pro.Product!=null)
                //    {
                //        accessor.Update(product);
                //        Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;

                //        Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
                //        Pro.ProcessProductName = product.ProductName;
                //        ProductProcessAccessor.Update(Pro);
                //    }
                //    else
                //    {
                //        product.ProductId = Guid.NewGuid().ToString();
                //        product.ProductName = Pro.ProcessProductName;
                //        accessor.Insert(product);

                //        Pro.ProductProcessId = Guid.NewGuid().ToString();
                //        Pro.ProductId = product.ProductId;
                //        Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;

                //        Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;

                //        ProductProcessAccessor.Insert(Pro);
                //    }
                //}
                //加工后名称添加

                //if (product.ProductProcess.Count > 0&&(product.IsProcee==null||!(bool)(product.IsProcee)))
                //{

                //if ((product.IsProcee == null || !(bool)(product.IsProcee)) && !string.IsNullOrEmpty(product.ProProcessName))
                //{
                //    //复制商品
                //    if (this.ExistsNameUpdate(product))
                //    {
                //        throw new Helper.InvalidValueException(Model.Product.PRO_ProductName);
                //    }
                //    Model.Product product1 = product;

                //    product1.ProductId = Guid.NewGuid().ToString();
                //    product1.ProductName = product.ProProcessName;
                //    product1.StocksQuantity = 0;
                //    product1.ProceebeforeProductId = PrId;
                //    product1.ProductDescription = product.ProductProcessDescription;
                //    product1.IsProcee = true;
                //    product1.Id = string.IsNullOrEmpty(product.ProceId) ? product.Id : product.ProceId;
                //    product1.ProductBarCode = string.IsNullOrEmpty(product.ProceId) ? null : product.ProceId;
                //    product1.ProductBarCodeIsAuto = false;

                //    accessor.Insert(product1);

                //    foreach (Model.ProductProcess Pro in product.ProductProcess)
                //    {
                //        if (Pro.Procedures == null) continue;
                //        Pro.ProductProcessId = Guid.NewGuid().ToString();
                //        Pro.ProductId = product1.ProductId;
                //        Pro.ProcessProductName = product1.ProductName;
                //        //  Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;
                //        //Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
                //        ProductProcessAccessor.Insert(Pro);
                //    }


                //}

                //if (product.IsProcee != null && product.IsProcee.Value && !string.IsNullOrEmpty(product.ProProcessName))
                //{
                //    ProductProcessAccessor.Delete(product);
                //    foreach (Model.ProductProcess Pro in product.ProductProcess)
                //    {
                //        if (Pro.Procedures == null) continue;
                //        Pro.ProductProcessId = Guid.NewGuid().ToString();
                //        Pro.ProductId = product.ProductId;
                //        Pro.ProcessProductName = product.ProductName;
                //        //  Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;
                //        //Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
                //        ProductProcessAccessor.Insert(Pro);
                //    }

                //}

                //返回裸片的值

                //修改时商品为非加工后的
                //if (result == null || result == false)
                //{
                //    product.ProceProductId = product.ProductId;
                //    product.ProductName = name;
                //    product.ProductId = PrId;
                //    product.ProceebeforeProductId = proceebeforeProductId;
                //    product.ProductDescription = text;
                //    product.IsProcee = result;
                //    product.StocksQuantity = stock;
                //    product.Id = Id;
                //    product.ProductBarCode = ProductBarCode;
                //    product.ProductBarCodeIsAuto = ProductBarCodeIsAuto;
                //}
                V.CommitTransaction();
            }
            catch
            {
                V.RollbackTransaction();
                throw;
            }



            //foreach (Model.ProductProcess Pro in product.ProductProcess)
            //{
            //    if (Pro.ProcessCategory == null) continue;
            //    Pro.ProductProcessId = Guid.NewGuid().ToString();
            //    Pro.ProductId = product.ProductId;
            //    Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;
            //    Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
            //    ProductProcessAccessor.Insert(Pro);
            //}
            // }
            //    if (product.IsProcee == true && !string.IsNullOrEmpty(product.ProceduresId))
            //{

            //        ProductProcessAccessor.Delete(product);
            //        foreach (Model.ProductProcess Pro in product.ProductProcess)
            //        {
            //            if (Pro.ProcessCategory == null) continue;
            //            Pro.ProductProcessId = Guid.NewGuid().ToString();
            //            Pro.ProductId = product.ProductId;
            //            Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;
            //            Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;

            //            ProductProcessAccessor.Insert(Pro);
            //        }
        }
Example #9
0
 public bool ExistsExcept(Model.ProductMark e)
 {
     return(accessor.ExistsExcept(e));
 }
Example #10
0
        /// <summary>
        /// Insert a Product.
        /// </summary>
        public void Insert(Model.Product product, Model.ProductMark productMark)
        {
            this.Validate(product);
            //if (this.Exists(product.Id))
            //{
            //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
            TiGuiExists(product);
            //  }

            if (this.ExistsNameInsert(product.ProductName))
            {
                throw new Helper.InvalidValueException(Model.Product.PRO_ProductName);
            }

            //设置KEY值
            string sequencekey = product.ProductCategory.Id;

            SequenceManager.Increment(sequencekey);

            StringBuilder strBU = new StringBuilder();

            string PrId = Guid.NewGuid().ToString();

            product.ProductId = PrId;
            if (product.BasedUnitGroup != null)
            {
                product.BasedUnitGroupId = product.BasedUnitGroup.UnitGroupId;
            }
            if (product.BuyEmployee != null)
            {
                product.BuyEmployeeId = product.BuyEmployee.EmployeeId;
            }
            if (product.BuyUnit != null)
            {
                product.BuyUnitId = product.BuyUnit.ProductUnitId;
            }
            if (product.CustomInspectionRule != null)
            {
                product.CustomInspectionRuleId = product.CustomInspectionRule.CustomInspectionRuleId;
            }
            if (product.Depot != null)
            {
                product.DepotId = product.Depot.DepotId;
            }
            if (product.DepotPosition != null)
            {
                product.DepotPositionId = product.DepotPosition.DepotPositionId;
            }
            if (product.DepotUnit != null)
            {
                product.DepotUnitId = product.DepotUnit.ProductUnitId;
            }
            //if (product.InsteadOfProductId != null) product.InsteadOfProductId = product.InsteadOfProduct.ProductId;
            if (product.MainUnit != null)
            {
                product.MainUnitId = product.MainUnit.ProductUnitId;
            }
            // if (product.PackageType != null) product.PackageTypeId = product.PackageType.PackageTypeId;
            if (product.ProduceUnit != null)
            {
                product.ProduceUnitId = product.ProduceUnit.ProductUnitId;
            }
            if (product.ProductCategory != null)
            {
                product.ProductCategoryId = product.ProductCategory.ProductCategoryId;
            }
            if (product.QualityTestPlan != null)
            {
                product.QualityTestPlanId = product.QualityTestPlan.QualityTestPlanId;
            }
            if (product.QualityTestUnit != null)
            {
                product.QualityTestUnitId = product.QualityTestUnit.ProductUnitId;
            }
            if (product.SellUnit != null)
            {
                product.SellUnitId = product.SellUnit.ProductUnitId;
            }
            // if (product.Supplier != null) product.SupplierId = product.Supplier.SupplierId;
            product.SupplierId = product.Supplier == null ? null : product.Supplier.SupplierId;
            if (product.VolumeUnit != null)
            {
                product.VolumeUnitId = product.VolumeUnit.ProductUnitId;
            }
            if (product.VolumeUnitGroup != null)
            {
                product.VolumeUnitGroupId = product.VolumeUnitGroup.UnitGroupId;
            }
            if (product.WeightUnit != null)
            {
                product.WeightUnitId = product.WeightUnit.ProductUnitId;
            }
            if (product.WeightUnitGroup != null)
            {
                product.WeightUnitGroupId = product.WeightUnitGroup.UnitGroupId;
            }
            //if (product.ProductImage == null)
            //    product.ProductImage = pic;
            //if (product.ProductImage1 == null)
            //    product.ProductImage1 = pic;
            //if (product.ProductImage2 == null)
            //    product.ProductImage2 = pic;
            //if (product.ProductImage3 == null)
            //    product.ProductImage3 = pic;

            product.ProductCategoryId = product.ProductCategory.ProductCategoryId;

            product.InsertTime = DateTime.Now;
            //product.UpdateTime = DateTime.Now;

            accessor.Insert(product);
            //ProductProcessAccessor.Delete(product);
            foreach (Model.ProductMouldDetail Pro in product.ProductMouldDetail)
            {
                if (string.IsNullOrEmpty(Pro.ProductMouldDetailId))
                {
                    continue;
                }
                Pro.ProductId = product.ProductId;
                ProductMouldDetailAccessor.Insert(Pro);
            }


            //雪芬-貼標籤  和  安適康 两家厂商自动带入 厂商商品对照表
            if (product.SupplierId == "e94591ac-aab4-47f0-b5bb-110e72cf155e" || product.SupplierId == "a7622c31-7d70-45de-a407-595dae617d36")
            {
                Model.SupplierProduct supplierProduct = new Book.Model.SupplierProduct();
                supplierProduct.SupplierProductId = Guid.NewGuid().ToString();
                supplierProduct.SupplierId        = product.SupplierId;
                supplierProduct.ProductId         = product.ProductId;
                supplierProduct.InsertTime        = DateTime.Now;
                supplierProduct.UpdateTime        = DateTime.Now;

                if (product.SupplierId == "e94591ac-aab4-47f0-b5bb-110e72cf155e")
                {
                    supplierProduct.SupplierProductPriceRange = "1/999999999999/0.092";
                }
                else
                {
                    supplierProduct.SupplierProductPriceRange = "1/999999999999/0";
                }

                supplierProduct.BuildEmployeeId = BL.V.ActiveOperator.EmployeeId;

                new SupplierProductManager().Insert(supplierProduct);
            }

            //商品唛头  2021年7月18日19:40:18
            if (!string.IsNullOrEmpty(productMark.MainMark) || !string.IsNullOrEmpty(productMark.SideMark))
            {
                productMark.Id        = Guid.NewGuid().ToString();
                productMark.ProductId = product.ProductId;

                productMarkAccessor.Insert(productMark);
            }


            //foreach (Model.ProductProcess Pro in product.ProductProcess)
            //{
            //    if (string.IsNullOrEmpty(Pro.ProcessCategoryId)) continue;
            //    //strBU.Append(Pro.ProcessCategory.ProcessCategoryName);
            //    Pro.ProductProcessId = Guid.NewGuid().ToString();
            //    Pro.ProductId = product.ProductId;
            //    Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;

            //    Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
            //    ProductProcessAccessor.Insert(Pro);
            //}



            //加工后名称添加
            ////if (product.ProductProcess!=null)
            ////{
            ////    if (product.ProductProcess.Count > 0)
            ////    {
            ////        product.ProductId = Guid.NewGuid().ToString();
            ////        ////product.ProductName = product.ProProcessName;0827
            ////        ProductProcessAccessor.Delete(product);
            ////        product.ProceebeforeProductId = PrId;
            ////        product.IsProcee = true;
            ////        accessor.Insert(product);
            ////        foreach (Model.ProductProcess Pro in product.ProductProcess)
            ////        {
            ////            if (Pro.ProcessCategory == null) continue;
            ////            Pro.ProductProcessId = Guid.NewGuid().ToString();
            ////            Pro.ProductId = product.ProductId;
            ////            Pro.ProcessId = Pro.Process == null ? null : Pro.Process.ProcessId;
            ////            Pro.ProcessCategoryId = Pro.ProcessCategory == null ? null : Pro.ProcessCategory.ProcessCategoryId;
            ////            ProductProcessAccessor.Insert(Pro);
            ////        }
            ////    }
            ////}
            //}
        }
Example #11
0
        private void BindData(IList <Model.PronoteHeader> list, int sourcetype)
        {
            foreach (Model.PronoteHeader detail in list)
            {
                if (!string.IsNullOrEmpty(detail.InvoiceXOId))
                {
                    detail.InvoiceXO = this.xomanamager.Get(detail.InvoiceXOId);
                }
                //detail.MRSDetails = this.mrsdetailManager.Get(detail.MRSdetailsId);
                //if (detail.MRSDetails != null)
                //    detail.Plannum = detail.MRSDetails.MRSdetailsQuantity;
                if (!string.IsNullOrEmpty(detail.ProductId))
                {
                    detail.Product = new BL.ProductManager().Get(detail.ProductId);

                    if (string.IsNullOrEmpty(detail.CustomerProductName))
                    {
                        detail.CustomerProductName = CommonHelp.GetCustomerProductNameByPronoteHeaderId(detail, detail.ProductId, detail.HandbookProductId);
                    }

                    Model.ProductMark mark = productMarkManager.SelectByProductId(detail.ProductId);
                    if (mark != null)
                    {
                        detail.MainMark = mark.MainMark;
                        detail.SideMark = mark.SideMark;
                    }
                }
            }
            this.DataSource = list;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            if (sourcetype == 5)
            {
                this.xrLabelDataName.Text = Properties.Resources.GZZhiShi;
            }
            else if (sourcetype == 4)
            {
                this.xrLabelDataName.Text = Properties.Resources.ZZJiaGong;
            }

            this.lblHandBookId.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_HandbookId);
            this.lblHandBookProducrId.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_HandbookProductId);
            this.lblPlanNum.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_InvoiceXODetailQuantity);
            //Model.MRSdetails mrsdetail = this.mRSDetailsManager.Get((this.GetCurrentRow() as Model.PronoteHeader).MRSdetailsId);
            //if (mrsdetail != null)
            //    this.lblPlanNum.Text = mrsdetail.MRSdetailsQuantity.ToString();

            this.xrLabelPrintDate.Text = this.xrLabelPrintDate.Text + DateTime.Now.ToShortDateString();
            this.xrLabelPronoteHeaderID.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_PronoteHeaderID);
            this.xrLabelPronoteDte.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_PronoteDate, "{0:yyyy-MM-dd}");

            //this.xrLabelCustomerXOId.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_InvoiceCusId);
            this.xrLabelCustomerXOId.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_CustomerInvoiceXOId);
            this.xrLabelCustomer.DataBindings.Add("Text", this.DataSource, "CustomerShortName");
            this.xrLabelCheckedStandard.DataBindings.Add("Text", this.DataSource, "CustomerCheckStandard");
            this.xrLabelCustomerProductName.DataBindings.Add("Text", this.DataSource, "CustomerProductName");
            this.xrLabelCount.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_DetailsSum);

            this.xrLabelUnit.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_ProductUnit);
            this.xrLabelXOJHDate.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_InvoiceYjrq, "{0:yyyy-MM-dd}");
            this.xrLabelPiHao.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_CustomerLotNumber);
            this.xrLabelProductName.DataBindings.Add("Text", this.DataSource, "ProductName");
            this.xrRichTextProDesc.DataBindings.Add("Rtf", this.DataSource, "ProductDesc");
            this.xrLabelMRP.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_MRSHeaderId);
            this.xrLabelWorkHouse.DataBindings.Add("Text", this.DataSource, "Workhousename");
            this.xrLabelBeforepPackage.DataBindings.Add("Text", this.DataSource, "MRSDetails.BeforePackageProduct." + Model.Product.PRO_ProductName);
            this.GroupHeader1.GroupFields.Add(new GroupField(Model.PronoteHeader.PRO_PronoteHeaderID));
            // this.GroupFooter1.gr.Add(new GroupField(Model.PronoteHeader.PRO_PronoteHeaderID));
            this.xrLabelPronotedesc.DataBindings.Add("Text", this.DataSource, Model.PronoteHeader.PRO_Pronotedesc);
            this.xrLabelEmployee.DataBindings.Add("Text", this.DataSource, "Employee0Name");

            //商品正侧唛单独划分出一张表 2021年8月22日23:02:39
            //this.RichTextZhengMai.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_AttrZhengMai);
            //this.RichTextCeMai.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_AttrCeMai);
            this.RichTextZhengMai.DataBindings.Add("Rtf", this.DataSource, "MainMark");
            this.RichTextCeMai.DataBindings.Add("Rtf", this.DataSource, "SideMark");

            this.xrSubreport1.ReportSource = new RO1();
            this.xrSubreport2.ReportSource = new RO2();
        }