コード例 #1
0
        /// <summary>
        /// 计算防盗标签费
        /// </summary>
        /// <param name="soLine"></param>
        /// <returns></returns>
        public static decimal GetLabelling(SM.SO.SOLine soLine, OrderBomBE.OrderBomHead.EntityList orderBom)
        {
            decimal labelling = 0;
            //BOM中防盗标签子件,则根据【防盗标签】最近一次采购价,币种,不退税。
            //BOM中没有防盗标签子件,则手工输入。
            //中类需要一个字段来标识需要防盗标签,子件通过物料分类来区分防盗标签
            //销售行防盗标签费扩展字段
            //if (soLine.DescFlexField.PrivateDescSeg7 == "")
            //{
            //    //throw new Exception("请维护销售单" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应的防盗标签费");
            //}
            decimal purchasePrice = 0;//采购价
            DataSet ds            = new DataSet();
            string  sql           = "";

            if (orderBom != null)
            {
                foreach (OrderBomHead line in orderBom)
                {
                    ds  = new DataSet();
                    sql = "";
                    if (line.SubKey != null && line.SubKey.Code == "FDBQ")
                    {
                        //取最近采购价
                        sql = "select top 1 B.OrderPriceTC,A.TC from PM_POLine b left join PM_PurchaseOrder a on b.PurchaseOrder=a.id where b.ItemInfo_ItemID=" + line.SubKey.ID + " and Org=" + UFIDA.U9.Base.Context.LoginOrg.ID + " order by a.BusinessDate desc";
                        UFSoft.UBF.Util.DataAccess.DataAccessor.RunSQL(UFSoft.UBF.Util.DataAccess.DataAccessor.GetConn(), sql, null, out ds);
                        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["OrderPriceTC"].ToString() != "")
                        {
                            purchasePrice = Convert.ToDecimal(ds.Tables[0].Rows[0]["OrderPriceTC"].ToString());
                            if (Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) != soLine.SO.TC.ID)//币种不同,汇率转换为销售订单币种
                            {
                                //purchasePrice =
                                UFIDA.U9.Cust.CBO.RateBE.OperationalRateLine rateLine = UFIDA.U9.Cust.CBO.RateBE.OperationalRateLine.Finder.Find("StartDate<='" + DateTime.Now + "' and EndDate>='" + DateTime.Now + "'" +
                                                                                                                                                 "and OperationalRateHead.IsCurrency=" + Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) + " and OperationalRateHead.NotCurrency=" + soLine.SO.TC.ID + " and OperationalRateHead.Org=" + UFIDA.U9.Base.Context.LoginOrg.ID);
                                if (rateLine == null)
                                {
                                    UFIDA.U9.Base.Currency.Currency isCurenty = UFIDA.U9.Base.Currency.Currency.Finder.FindByID(Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()));
                                    throw new Exception("原币" + isCurenty.Name + "对目标币" + soLine.SO.TC.Name + "的汇率未设置,请在基础设置-业务汇率表中设置");
                                }
                                purchasePrice = purchasePrice * rateLine.Parities;
                            }
                        }
                        labelling += purchasePrice * line.NeedNumber;
                    }
                }
            }
            if (labelling == 0)//未取到防盗标签费,取销售订单行
            {
                labelling = decimal.Parse(soLine.DescFlexField.PrivateDescSeg7);
            }

            return(labelling);
        }
コード例 #2
0
        /// <summary>
        /// 计算防盗标签费,已包含进包材采购成本
        /// </summary>
        /// <param name="soLine"></param>
        /// <returns></returns>
        public static decimal GetLabelling(GS.FT.ShipPlanDetailBE.ShipPlanDetailLine shipLine, OrderBomBE.OrderBomHead.EntityList orderBom)
        {
            decimal labelling = 0;
            //一段时间内,防盗标签子件对应的已出运确认的明细单中对应的中类实际使用的防盗标签子件数量报表,
            //如果生产的即生产领用消耗数量,如果是委外则是委外发料消耗数量。

            decimal purchasePrice = 0;//采购价
            DataSet ds            = new DataSet();
            string  sql           = "";

            if (orderBom != null)
            {
                foreach (OrderBomHead line in orderBom)
                {
                    ds  = new DataSet();
                    sql = "";
                    if (line.SubKey != null && line.SubKey.Code == "FDBQ")
                    {
                        //取最近采购价
                        sql = "select top 1 B.OrderPriceTC,A.TC from PM_POLine b left join PM_PurchaseOrder a on b.PurchaseOrder=a.id where b.ItemInfo_ItemID=" + line.SubKey.ID + " and Org=" + UFIDA.U9.Base.Context.LoginOrg.ID + " order by a.BusinessDate desc";
                        UFSoft.UBF.Util.DataAccess.DataAccessor.RunSQL(UFSoft.UBF.Util.DataAccess.DataAccessor.GetConn(), sql, null, out ds);
                        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["OrderPriceTC"].ToString() != "")
                        {
                            purchasePrice = Convert.ToDecimal(ds.Tables[0].Rows[0]["OrderPriceTC"].ToString());
                            if (Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) != shipLine.ShipPlanDetailHead.Currency.ID)//币种不同,汇率转换为销售订单币种
                            {
                                //purchasePrice =
                                UFIDA.U9.Cust.CBO.RateBE.OperationalRateLine rateLine = UFIDA.U9.Cust.CBO.RateBE.OperationalRateLine.Finder.Find("StartDate<='" + DateTime.Now + "' and EndDate>='" + DateTime.Now + "'" +
                                                                                                                                                 "and OperationalRateHead.IsCurrency=" + Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) + " and OperationalRateHead.NotCurrency=" + shipLine.ShipPlanDetailHead.Currency.ID + " and OperationalRateHead.Org=" + UFIDA.U9.Base.Context.LoginOrg.ID);
                                if (rateLine == null)
                                {
                                    UFIDA.U9.Base.Currency.Currency isCurenty = UFIDA.U9.Base.Currency.Currency.Finder.FindByID(Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()));
                                    throw new Exception("原币" + isCurenty.Name + "对目标币" + shipLine.ShipPlanDetailHead.Currency.Name + "的汇率未设置,请在基础设置-业务汇率表中设置");
                                }
                                purchasePrice = purchasePrice * rateLine.Parities;
                            }
                        }
                        labelling += purchasePrice * line.NeedNumber;
                    }
                }
            }
            return(labelling);
        }
コード例 #3
0
        /// <summary>
        /// 获取采购单价
        /// </summary>
        /// <param name="type">取采购单价类型,因为不同字段取值采购单价校验不同(主要区分币种),用type字段区分,0计算退税率,1计算包装采购成本,3计算工具采购成本</param>
        /// <param name="soLine"></param>
        /// <param name="bomLine"></param>
        /// <param name="ds"></param>
        /// <returns></returns>
        private static decimal CalculatePurchasePrice(int type, SM.SO.SOLine soLine, OrderBomLine bomLine, DataSet ds, ref int currencyType)
        {
            decimal purchasePrice = 0;

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["OrderPriceTC"].ToString() != "")
            {
                purchasePrice = Convert.ToDecimal(ds.Tables[0].Rows[0]["OrderPriceTC"].ToString());
                if (type == 0 && Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) == 9)//采购币种为美元,不退税
                {
                    return(0);
                }
                else if (type == 1 && Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) != 1)//采购币种不为人民币,不计算计算包装采购成本
                {
                    return(0);
                }
                else
                {
                    if (type == 2)                                                       //工具采购成本计算结果根据币种不同需要保存到不同字段,此处记录币种为人民币/美元
                    {
                        if (Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) == 1) //人民币
                        {
                            currencyType = 1;
                        }
                        else if (Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) == 9)//美元
                        {
                            currencyType = 9;
                        }
                    }
                    else if (Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) != soLine.SO.TC.ID)//币种不同,汇率转换为销售订单币种
                    {
                        //purchasePrice =
                        UFIDA.U9.Cust.CBO.RateBE.OperationalRateLine rateLine = UFIDA.U9.Cust.CBO.RateBE.OperationalRateLine.Finder.Find("StartDate<='" + DateTime.Now + "' and EndDate>='" + DateTime.Now + "'" +
                                                                                                                                         "and OperationalRateHead.IsCurrency=" + Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()) + " and OperationalRateHead.NotCurrency=" + soLine.SO.TC.ID + " and OperationalRateHead.Org=" + UFIDA.U9.Base.Context.LoginOrg.ID);
                        if (rateLine == null)
                        {
                            UFIDA.U9.Base.Currency.Currency isCurenty = UFIDA.U9.Base.Currency.Currency.Finder.FindByID(Convert.ToInt64(ds.Tables[0].Rows[0]["TC"].ToString()));
                            throw new Exception("原币" + isCurenty.Name + "对目标币" + soLine.SO.TC.Name + "的汇率未设置,请在基础设置-业务汇率表中设置");
                        }
                        purchasePrice = purchasePrice * rateLine.Parities;
                    }
                    return(purchasePrice);
                }
            }
            else //没有取到最近采购价,取厂商价目表
            {
                UFIDA.U9.PPR.PurPriceList.PurPriceLine purPriceLine = null;
                if (bomLine == null) //BOM为空,取成品采购价
                {
                    purPriceLine = UFIDA.U9.PPR.PurPriceList.PurPriceLine.Finder.Find("ItemInfo='" + soLine.ItemInfo.ItemID.ID + "' and FromDate<='" + DateTime.Now + "' and ToDate>='" + DateTime.Now + "'");
                    if (type == 2 && purPriceLine == null) //工具子件取不到价格,取销售订单行成品成本
                    {
                        return(0);
                    }
                    else if (purPriceLine == null)
                    {
                        throw new Exception("销售订单" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应料品" + soLine.ItemInfo.ItemName + "没有取到价格,请手工录入价表");
                    }
                }
                else if (bomLine.SubKey != null)//子件
                {
                    purPriceLine = UFIDA.U9.PPR.PurPriceList.PurPriceLine.Finder.Find("ItemInfo='" + bomLine.SubKey.ID + "' and FromDate<='" + DateTime.Now + "' and ToDate>='" + DateTime.Now + "'");
                    if (type == 2 && purPriceLine == null) //工具子件取不到价格,取销售订单行成品成本
                    {
                        return(0);
                    }
                    else if (purPriceLine == null)
                    {
                        throw new Exception("销售订单" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应料品" + soLine.ItemInfo.ItemName + "子件" + bomLine.SubKey.Name + "没有取到价格,请手工录入价表");
                    }
                }
                if (type == 0 && purPriceLine.PurPriceList.Currency.ID == 9)//币种为美元,不退税
                {
                    return(0);
                }
                else if (type == 1 && purPriceLine.PurPriceList.Currency.ID != 1)//币种不为人民币,不计算计算包装采购成本
                {
                    return(0);
                }
                else
                {
                    if (type == 2)                                      //工具采购成本计算结果根据币种不同需要保存到不同字段,此处记录币种为人民币/美元
                    {
                        if (purPriceLine.PurPriceList.Currency.ID == 1) //人民币
                        {
                            currencyType = 1;
                        }
                        else if (purPriceLine.PurPriceList.Currency.ID == 9)//美元
                        {
                            currencyType = 9;
                        }
                    }
                }
                purchasePrice = purPriceLine.Price;                                                                   //厂商价目表单价
                if (purPriceLine.PurPriceList.Currency != null && purPriceLine.PurPriceList.Currency != soLine.SO.TC) //币种不同,汇率转换为销售订单币种
                {
                    UFIDA.U9.Cust.CBO.RateBE.OperationalRateLine rateLine = UFIDA.U9.Cust.CBO.RateBE.OperationalRateLine.Finder.Find("StartDate<='" + DateTime.Now + "' and EndDate>='" + DateTime.Now + "'" +
                                                                                                                                     "and OperationalRateHead.IsCurrency=" + purPriceLine.PurPriceList.Currency.ID + " and OperationalRateHead.NotCurrency=" + soLine.SO.TC.ID + " and OperationalRateHead.Org=" + UFIDA.U9.Base.Context.LoginOrg.ID);
                    if (rateLine == null)
                    {
                        throw new Exception("原币" + purPriceLine.PurPriceList.Currency.Name + "对目标币" + soLine.SO.TC.Name + "的汇率未设置,请在基础设置-业务汇率表中设置");
                    }
                    purchasePrice = purchasePrice * rateLine.Parities;
                }
                return(purchasePrice);
            }
            //return purchasePrice;
        }
コード例 #4
0
 /// <summary>
 /// Constructor with Full Argument
 /// </summary>
 public CostForecastDTO(System.Int64 iD, System.DateTime createdOn, System.String createdBy, System.DateTime modifiedOn, System.String modifiedBy, System.Int64 sysVersion, UFIDA.U9.Cust.GS.FT.AllEnumBE.CostForecastTypeEnum forecastType, UFIDA.U9.SM.SO.SO sONo, UFIDA.U9.SM.SO.SOLine sOLine, System.DateTime forecastTime, System.String forecastMan, System.Decimal brokerage, System.Decimal discount, System.Decimal oceanFreight, System.Decimal otherFee, System.Decimal taxCredits, System.Decimal procurementCost, System.Decimal labourCharges, System.Decimal productCost, System.Decimal administrativeFee, System.Decimal interest, System.Decimal mouldFee, System.Decimal labelling, System.Decimal creditInsurance, System.Decimal bankCharge, System.Decimal productForecastRate, System.Decimal listForecastRate, System.Decimal productRate, System.Decimal listRate, System.Decimal exchangeRate, UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments descflexfield, System.String demo, UFIDA.U9.Base.Currency.Currency currency, System.Decimal domesticFee, System.Decimal otherDomesticFee, UFIDA.U9.Cust.GS.FT.OrderBomBE.OrderBomHead orderBomHead, System.Decimal managementFee, System.Decimal annualInterest, System.Decimal rMBProductCost, System.Decimal dollorProductCost)
 {
     this.ID                  = iD;
     this.CreatedOn           = createdOn;
     this.CreatedBy           = createdBy;
     this.ModifiedOn          = modifiedOn;
     this.ModifiedBy          = modifiedBy;
     this.SysVersion          = sysVersion;
     this.ForecastType        = forecastType;
     this.SONo                = sONo;
     this.SOLine              = sOLine;
     this.ForecastTime        = forecastTime;
     this.ForecastMan         = forecastMan;
     this.Brokerage           = brokerage;
     this.Discount            = discount;
     this.OceanFreight        = oceanFreight;
     this.OtherFee            = otherFee;
     this.TaxCredits          = taxCredits;
     this.ProcurementCost     = procurementCost;
     this.LabourCharges       = labourCharges;
     this.ProductCost         = productCost;
     this.AdministrativeFee   = administrativeFee;
     this.Interest            = interest;
     this.MouldFee            = mouldFee;
     this.Labelling           = labelling;
     this.CreditInsurance     = creditInsurance;
     this.BankCharge          = bankCharge;
     this.ProductForecastRate = productForecastRate;
     this.ListForecastRate    = listForecastRate;
     this.ProductRate         = productRate;
     this.ListRate            = listRate;
     this.ExchangeRate        = exchangeRate;
     this.Descflexfield       = descflexfield;
     this.Demo                = demo;
     this.Currency            = currency;
     this.DomesticFee         = domesticFee;
     this.OtherDomesticFee    = otherDomesticFee;
     this.OrderBomHead        = orderBomHead;
     this.ManagementFee       = managementFee;
     this.AnnualInterest      = annualInterest;
     this.RMBProductCost      = rMBProductCost;
     this.DollorProductCost   = dollorProductCost;
 }
コード例 #5
0
        public override object Do(object obj)
        {
            GetCurrencyBP bpObj = (GetCurrencyBP)obj;

            //get business operation context is as follows
            //IContext context = ContextManager.Context

            //auto generating code end,underside is user custom code
            //and if you Implement replace this Exception Code...
            if (bpObj == null)
            {
                return(null);
            }
            CurrencyDTO dto = new CurrencyDTO();

            switch (bpObj.Type)
            {
            case 0:
                //获取默认币种
                break;

            case 1:
                //根据指定币种获取币种信息
                if (bpObj.ID > 0L)
                {
                    UFIDA.U9.Base.Currency.Currency currency = UFIDA.U9.Base.Currency.Currency.Finder.FindByID(bpObj.ID);
                    if (currency != null)
                    {
                        dto.ID     = currency.ID;
                        dto.Code   = currency.Code;
                        dto.Name   = currency.Name;
                        dto.Symbol = currency.Symbol;
                        dto.MoneyRound_Precision  = currency.MoneyRound.Precision;
                        dto.MoneyRound_RoundType  = currency.MoneyRound.RoundType.Value;
                        dto.MoneyRound_RoundValue = currency.MoneyRound.RoundValue;
                        dto.PriceRound_Precision  = currency.PriceRound.Precision;
                        dto.PriceRound_RoundType  = currency.PriceRound.RoundType.Value;
                        dto.PriceRound_RoundValue = currency.PriceRound.RoundValue;
                    }
                }
                break;

            case 2:
                //根据供应商获取币种
                if (bpObj.ID > 0L)
                {
                    UFIDA.U9.CBO.SCM.Supplier.Supplier doc = UFIDA.U9.CBO.SCM.Supplier.Supplier.Finder.FindByID(bpObj.ID);
                    if (doc != null && doc.TradeCurrency != null)
                    {
                        dto.ID     = doc.TradeCurrency.ID;
                        dto.Code   = doc.TradeCurrency.Code;
                        dto.Name   = doc.TradeCurrency.Name;
                        dto.Symbol = doc.TradeCurrency.Symbol;
                        dto.MoneyRound_Precision  = doc.TradeCurrency.MoneyRound.Precision;
                        dto.MoneyRound_RoundType  = doc.TradeCurrency.MoneyRound.RoundType.Value;
                        dto.MoneyRound_RoundValue = doc.TradeCurrency.MoneyRound.RoundValue;
                        dto.PriceRound_Precision  = doc.TradeCurrency.PriceRound.Precision;
                        dto.PriceRound_RoundType  = doc.TradeCurrency.PriceRound.RoundType.Value;
                        dto.PriceRound_RoundValue = doc.TradeCurrency.PriceRound.RoundValue;
                    }
                }
                break;

            case 3:
                //根据客户获取币种
                //获取客户默认币种
                if (bpObj.ID > 0L)
                {
                    UFIDA.U9.CBO.SCM.Customer.Customer doc = UFIDA.U9.CBO.SCM.Customer.Customer.Finder.FindByID(bpObj.ID);
                    if (doc != null && doc.TradeCurrency != null)
                    {
                        dto.ID     = doc.TradeCurrency.ID;
                        dto.Code   = doc.TradeCurrency.Code;
                        dto.Name   = doc.TradeCurrency.Name;
                        dto.Symbol = doc.TradeCurrency.Symbol;
                        dto.MoneyRound_Precision  = doc.TradeCurrency.MoneyRound.Precision;
                        dto.MoneyRound_RoundType  = doc.TradeCurrency.MoneyRound.RoundType.Value;
                        dto.MoneyRound_RoundValue = doc.TradeCurrency.MoneyRound.RoundValue;
                        dto.PriceRound_Precision  = doc.TradeCurrency.PriceRound.Precision;
                        dto.PriceRound_RoundType  = doc.TradeCurrency.PriceRound.RoundType.Value;
                        dto.PriceRound_RoundValue = doc.TradeCurrency.PriceRound.RoundValue;
                    }
                }
                break;

            case 4:
                //根据
                break;
            }
            return(dto);
        }