Ejemplo n.º 1
0
        private void ValidateRepeat()
        {
            StringBuilder sb = new StringBuilder(200);

            sb.Append(" Prefix=@Prefix");
            sb.Append(" and Center=@Center");
            sb.Append(" and ID!=@ID");
            sb.Append(" and Org=@Org");
            sb.Append(" and ((@FromValue >= BillNoStart and @FromValue<=BillNoEnd) or (@ToValue>=BillNoStart and @ToValue <=BillNoEnd) or (BillNoStart >=@FromValue and BillNoStart <= @FromValue) or (BillNoEnd >=@ToValue and BillNoEnd<=@ToValue))");
            // 2015-04-20 add by wf; ex by wf (稳定优先)
            //sb.Append(" and not (@FromValue > BillNoEnd or @ToValue < BillNoStart)");

            OqlParam[] appOqlparm = new OqlParam[] {
                new OqlParam("Prefix", this.Prefix.Value),
                new OqlParam("Center", this.Center.Value),
                new OqlParam("ID", this.ID),
                new OqlParam("Org", this.Org.ID),
                new OqlParam("FromValue", this.BillNoStart),
                new OqlParam("ToValue", this.BillNoEnd)
            };
            bool isExists = FTBillNoRuleBE.BillNoRule.Finder.IsExists(sb.ToString(), appOqlparm);

            if (isExists)
            {
                throw new Exception("前缀+中段+流水号起止出现重复!");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查找汇率,如果没有查到当前日期的汇率,则查找失效日期最近的一次汇率
        /// </summary>
        /// <param name="fromCurrency"></param>
        /// <param name="toCurrency"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public static decimal GetRate(string fromCurrency, string toCurrency, DateTime date)
        {
            decimal rate = 1;

            OqlParam[] appOqlparm = new OqlParam[] {
                new OqlParam("FromCurrency", fromCurrency),
                new OqlParam("ToCurrency", toCurrency),
                new OqlParam("ExchangeRateType", UFIDA.U9.Base.Currency.ExchangeRateTypesEnum.Buy.Value),
                new OqlParam("Date", date)
            };

            UFIDA.U9.Base.Currency.ExchangeRateDef entity = UFIDA.U9.Base.Currency.ExchangeRateDef.Finder.Find("ExchangeRateTable.FromCurrency.Code=@FromCurrency and ExchangeRateTable.ToCurrency.Code=@ToCurrency and ExchangeRateTable.ExchangeRateType=@ExchangeRateType and ExchangeRateTable.Compiled=1 and  FromDate<=@Date and ToDate>=@Date", appOqlparm);

            if (entity == null)//如果没有维护当前汇率,则查找上一次的汇率
            {
                entity = UFIDA.U9.Base.Currency.ExchangeRateDef.Finder.Find("ExchangeRateTable.FromCurrency.Code=@FromCurrency and ExchangeRateTable.ToCurrency.Code=@ToCurrency and ExchangeRateTable.ExchangeRateType=@ExchangeRateType and ExchangeRateTable.Compiled=1 and ToDate<@Date order by ToDate desc", appOqlparm);
                if (entity != null)
                {
                    rate = entity.Rate;
                }
            }
            else
            {
                rate = entity.Rate;
            }
            return(0);
        }
Ejemplo n.º 3
0
        private void ValidateLine()
        {
            foreach (BrokerageLine line in this.BrokerageLine)
            {
                StringBuilder sb = new StringBuilder(200);
                sb.Append(" BrokerageHead.Custmer.Code=@Customer");
                sb.Append(" and BrokerageHead.Product.Code=@Item");
                sb.Append(" and Valid='true'");
                sb.Append(" and BrokerageHead.Org=@Org");
                sb.Append(" and BrokerageType != @BrokerageType");
                sb.Append(" and ID != @LineID");
                sb.Append(" and ((@FromValue >= ValidDate and @FromValue<=UnValidDate) or (@ToValue>=ValidDate and @ToValue <=UnValidDate) or (ValidDate >=@FromValue and ValidDate <= @FromValue) or (UnValidDate >=@ToValue and UnValidDate<=@ToValue))");
                OqlParam[] appOqlparm = new OqlParam[] {
                    new OqlParam("Customer", this.Custmer.Code),
                    new OqlParam("Item", this.Product.Code),
                    new OqlParam("Org", this.Org.ID),
                    new OqlParam("BrokerageType", line.BrokerageType.Value),
                    new OqlParam("LineID", line.ID),
                    new OqlParam("FromValue", line.ValidDate),
                    new OqlParam("ToValue", line.UnValidDate)
                };
                bool isEx = UFIDA.U9.Cust.GS.FT.BrokerageBE.BrokerageLine.Finder.IsExists(sb.ToString(), appOqlparm);
                if (isEx)
                {
                    throw new Exception("第" + line.RowID.ToString() + "行:在当前有效期范围内出现其他佣金类型的佣金行!");
                }

                if (line.BrokerageType == AllEnumBE.DiscountTypeEnum.FixedValues)
                {
                    StringBuilder sb1 = new StringBuilder(200);
                    sb.Append(" BrokerageHead.Custmer.Code=@Customer");
                    sb.Append(" and BrokerageHead.Product.Code=@Item");
                    sb.Append(" and Valid='true'");
                    sb.Append(" and BrokerageHead.Org=@Org");
                    sb.Append(" and BrokerageType = @BrokerageType");
                    sb.Append(" and Currenty = @Currency");
                    sb.Append(" and ID != @LineID");
                    sb.Append(" and ((@FromValue >= ValidDate and @FromValue<=UnValidDate) or (@ToValue>=ValidDate and @ToValue <=UnValidDate) or (ValidDate >=@FromValue and ValidDate <= @FromValue) or (UnValidDate >=@ToValue and UnValidDate<=@ToValue))");
                    OqlParam[] appOqlparm1 = new OqlParam[] {
                        new OqlParam("Customer", this.Custmer.Code),
                        new OqlParam("Item", this.Product.Code),
                        new OqlParam("Org", this.Org.ID),
                        new OqlParam("BrokerageType", line.BrokerageType.Value),
                        new OqlParam("Currency", line.Currenty.ID),
                        new OqlParam("LineID", line.ID),
                        new OqlParam("FromValue", line.ValidDate),
                        new OqlParam("ToValue", line.UnValidDate)
                    };
                    bool isEx1 = UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine.Finder.IsExists(sb1.ToString(), appOqlparm1);
                    if (isEx)
                    {
                        throw new Exception("第" + line.RowID.ToString() + "行:在当前有效期范围内出现相同佣金类型相同币种的佣金行!");
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void ModifySOPrice(long so)
        {
            //通过销售订单ID将销售订单查询出来,然后再修改销售订单的最终价
            List <UFIDA.U9.ISV.SM.SaleOrderDTOData> soDtoList = QuerySOByDocNo(so);

            foreach (UFIDA.U9.ISV.SM.SaleOrderDTOData soHead in soDtoList)
            {
                UFIDA.U9.SM.SO.SO soDoc = UFIDA.U9.SM.SO.SO.Finder.FindByID(soHead.ID);

                //soHead.DescFlexField.PrivateDescSeg1 = "True";
                foreach (UFIDA.U9.ISV.SM.SOLineDTOData soLineDto in soHead.SOLines)
                {
                    if (String.IsNullOrEmpty(soLineDto.DescFlexField.PrivateDescSeg19))
                    {
                        #region 第一次生成折扣
                        soLineDto.DescFlexField.PrivateDescSeg19 = "True";
                        decimal price = 0;//外销价

                        if (string.IsNullOrEmpty(soLineDto.DescFlexField.PrivateDescSeg5))
                        {
                            soLineDto.DescFlexField.PrivateDescSeg5 = soLineDto.OrderPriceTC.ToString();
                        }
                        price = decimal.Parse(soLineDto.DescFlexField.PrivateDescSeg5);

                        soLineDto.PriceCalField  = "FinallyPrice";//价格来源改为手工
                        soLineDto.FinallyPriceTC = price;
                        #region 折扣
                        string     strWhere   = "DiscountHead.Custmor.Code=@Customer  and DiscountHead.Product.Code=@Item and ValidDate<=@Date and UnValidDate>=@Date and DiscountHead.Org=@Org and DiscountHead.States=2";
                        OqlParam[] appOqlparm = new OqlParam[] {
                            new OqlParam("Customer", soHead.OrderBy.Code),
                            new OqlParam("Item", soLineDto.ItemInfo.ItemCode),
                            new OqlParam("Date", soHead.BusinessDate),
                            new OqlParam("Org", Context.LoginOrg.ID)
                        };
                        UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine.EntityList DiscountList = UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine.Finder.FindAll(strWhere, appOqlparm);

                        foreach (UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine Discount in DiscountList)
                        {
                            bool isBreak = false;
                            if (Discount.DiscountType == AllEnumBE.DiscountTypeEnum.PercentValues)//百分比
                            {
                                //如果是百分比,则使用外销价*百分比
                                soLineDto.FinallyPriceTC = price - price * Discount.Discount;
                                isBreak = true;
                            }
                            if (Discount.DiscountType == AllEnumBE.DiscountTypeEnum.FixedValues && soHead.TC.ID == Discount.CurrencyType.ID)//固定值
                            {
                                //如果是固定值,并且币种相同,则使用外销价-固定值设定的单价
                                // update Bug:96 Ldward 20150205
                                if (price < Discount.Prices)
                                {
                                    throw new Exception("固定折扣小于外销价生成折扣失败,请确认!");
                                }
                                soLineDto.FinallyPriceTC = price - Discount.Prices;
                                isBreak = true;
                            }

                            if (isBreak)
                            {
                                soLineDto.DescFlexField.PrivateDescSeg21 = (price * soLineDto.OrderByQtyTU - soLineDto.FinallyPriceTC * soLineDto.OrderByQtyTU).ToString();

                                CreateSODicount(Discount, Discount.DiscountType, Discount.Prices, Discount.Discount, soLineDto.ID, soLineDto.FinallyPriceTC * soLineDto.OrderByQtyTU, price * soLineDto.OrderByQtyTU - soLineDto.FinallyPriceTC * soLineDto.OrderByQtyTU, price, soDoc.Key);
                                break;
                            }
                        }
                        #endregion
                        #endregion
                    }
                    else
                    {
                        #region 生成折扣后清除
                        soLineDto.DescFlexField.PrivateDescSeg19 = "";
                        UFIDA.U9.Cust.GS.FT.SODiscountBE.SODiscount soDis = UFIDA.U9.Cust.GS.FT.SODiscountBE.SODiscount.Finder.Find("SOLine=@SOLine", new OqlParam("SOLine", soLineDto.ID));
                        if (soDis != null)
                        {
                            soLineDto.PriceCalField  = "FinallyPrice";//价格来源改为手工
                            soLineDto.FinallyPriceTC = soDis.ExportPrice;
                            soLineDto.DescFlexField.PrivateDescSeg5  = soDis.ExportPrice + "";
                            soLineDto.DescFlexField.PrivateDescSeg21 = "";
                        }
                        #endregion
                    }
                }
            }
            UFIDA.U9.ISV.SM.Proxy.CommonModifySOSRVProxy sv = new ISV.SM.Proxy.CommonModifySOSRVProxy();
            sv.SOs           = soDtoList;
            sv.TargetOrgCode = Context.LoginOrg.Code;
            sv.Do();
        }
Ejemplo n.º 5
0
        private void ModifySOPrice(long so, List <ReturnDiscountDTO> dtoList)
        {
            List <UFIDA.U9.ISV.SM.SaleOrderDTOData> soDtoList = QuerySOByDocNo(so);

            foreach (UFIDA.U9.ISV.SM.SaleOrderDTOData soHead in soDtoList)
            {
                UFIDA.U9.SM.SO.SO soDoc = UFIDA.U9.SM.SO.SO.Finder.FindByID(soHead.ID);

                soHead.DescFlexField.PrivateDescSeg1 = "True";

                foreach (ReturnDiscountDTO dto in dtoList)
                {
                    UFIDA.U9.ISV.SM.SOLineDTOData soLineDto = soHead.SOLines.Find(delegate(UFIDA.U9.ISV.SM.SOLineDTOData dtoTemp)
                    {
                        return(dtoTemp.ID == dto.SoLineID);
                    });
                    if (soLineDto == null)
                    {
                        continue;
                    }

                    UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine discountLine = UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine.Finder.FindByID(dto.DiscountID);

                    decimal price = 0;//外销价

                    if (string.IsNullOrEmpty(soLineDto.DescFlexField.PrivateDescSeg5))
                    {
                        soLineDto.DescFlexField.PrivateDescSeg5 = soLineDto.OrderPriceTC.ToString();
                    }
                    price = decimal.Parse(soLineDto.DescFlexField.PrivateDescSeg5);

                    decimal DiscountRatio = 0;
                    decimal DiscountPrice = 0;
                    AllEnumBE.DiscountTypeEnum DiscountType = AllEnumBE.DiscountTypeEnum.Empty;
                    if (!dto.IsReset)
                    {
                        DiscountRatio = dto.DiscountRatio;
                        DiscountPrice = dto.DiscountPrices;
                        DiscountType  = dto.DiscountType;
                    }
                    else
                    {
                        #region 重新读取折扣信息
                        string     strWhere   = "DiscountHead.Custmor.Code=@Customer  and DiscountHead.Product.Code=@Item and ValidDate<=@Date and UnValidDate>=@Date and DiscountHead.Org=@Org and DiscountHead.States=2";
                        OqlParam[] appOqlparm = new OqlParam[] {
                            new OqlParam("Customer", soHead.OrderBy.Code),
                            new OqlParam("Item", soLineDto.ItemInfo.ItemCode),
                            new OqlParam("Date", soHead.BusinessDate),
                            new OqlParam("Org", Context.LoginOrg.ID)
                        };
                        UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine.EntityList DiscountList = UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine.Finder.FindAll(strWhere, appOqlparm);
                        foreach (UFIDA.U9.Cust.GS.FT.DiscountBE.DiscountLine Discount in DiscountList)
                        {
                            bool isBreak = false;
                            if (Discount.DiscountType == AllEnumBE.DiscountTypeEnum.PercentValues)//百分比
                            {
                                //如果是百分比,则使用外销价*百分比
                                DiscountRatio = Discount.Discount;
                                isBreak       = true;
                            }
                            if (Discount.DiscountType == AllEnumBE.DiscountTypeEnum.FixedValues && soHead.TC.ID == Discount.CurrencyType.ID)//固定值
                            {
                                //如果是固定值,并且币种相同,则使用外销价-固定值设定的单价
                                DiscountPrice = Discount.Prices;
                                isBreak       = true;
                            }
                            DiscountType = Discount.DiscountType;

                            discountLine = Discount;

                            if (isBreak)
                            {
                                break;
                            }
                        }
                        #endregion
                    }
                    soLineDto.FinallyPriceTC = price;
                    if (DiscountType == AllEnumBE.DiscountTypeEnum.PercentValues)//百分比
                    {
                        //如果是百分比,则使用外销价*百分比
                        soLineDto.FinallyPriceTC = price - price * DiscountRatio;
                    }
                    if (DiscountType == AllEnumBE.DiscountTypeEnum.FixedValues)//固定值
                    {
                        //如果是固定值,并且币种相同,则使用外销价-固定值设定的单价
                        // update Bug:96 Ldward 20150205
                        if (price < DiscountPrice)
                        {
                            throw new Exception("固定折扣小于外销价生成折扣失败,请确认!");
                        }
                        soLineDto.FinallyPriceTC = price - DiscountPrice;
                    }
                    soLineDto.DescFlexField.PrivateDescSeg19 = "True";
                    soLineDto.PriceCalField = "FinallyPrice";//价格来源改为手工
                    soLineDto.DescFlexField.PrivateDescSeg21 = (price * soLineDto.OrderByQtyTU - soLineDto.FinallyPriceTC * soLineDto.OrderByQtyTU).ToString();

                    CreateSODicount(discountLine, DiscountType, DiscountPrice, DiscountRatio, soLineDto.ID, soLineDto.FinallyPriceTC * soLineDto.OrderByQtyTU, price * soLineDto.OrderByQtyTU - soLineDto.FinallyPriceTC * soLineDto.OrderByQtyTU, price, soDoc.Key);
                }
            }
            UFIDA.U9.ISV.SM.Proxy.CommonModifySOSRVProxy sv = new ISV.SM.Proxy.CommonModifySOSRVProxy();
            sv.SOs           = soDtoList;
            sv.TargetOrgCode = Context.LoginOrg.Code;
            sv.Do();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取料品的BOM清单
        /// </summary>
        /// <param name="soLine">销售订单行实体</param>
        /// <param name="itemCode">母件料号</param>
        /// <param name="date">日期</param>
        /// <param name="uom">母件的生产单位</param>
        /// <param name="orderByQtyTU">销售数量</param>
        /// <param name="saleUom">销售单位</param>
        /// <param name="demandQty">需求数量</param>
        /// <param name="entityList">随单BOM-DTO集合</param>
        /// <param name="i">层级</param>
        private void GetBomMaster(UFIDA.U9.SM.SO.SOLine soLine, string itemCode, DateTime date, long uom, decimal orderByQtyTU, UOM saleUom, decimal demandQty, List <UFIDA.U9.Cust.GS.FT.OrderBomBE.OrderBomHeadDTO> entityList, string i)
        {
            string strWhere = "ItemMaster.Code=@ItemCode and Org.Code=@Org and Status=2 and @Date >=EffectiveDate and @Date <=DisableDate and ProductUOM=@UOM";

            OqlParam[] appOqlparm = new OqlParam[] {
                new OqlParam("ItemCode", itemCode),
                new OqlParam("Org", "J001"),
                new OqlParam("Date", date),
                new OqlParam("UOM", uom)
            };
            UFIDA.U9.CBO.MFG.BOM.BOMMaster bom = UFIDA.U9.CBO.MFG.BOM.BOMMaster.Finder.Find(strWhere, appOqlparm);
            if (bom != null)
            {
                int n = 0;
                foreach (UFIDA.U9.CBO.MFG.BOM.BOMComponent bomCom in bom.BOMComponents)
                {
                    n++;
                    UFIDA.U9.Cust.GS.FT.OrderBomBE.OrderBomHeadDTO dto = new OrderBomBE.OrderBomHeadDTO();
                    dto.Tier = i.ToString() + "." + n.ToString();

                    #region 赋值
                    UFIDA.U9.CBO.SCM.Item.ItemMaster subItemMaster = GetItemMaster(bomCom.ItemMaster.Code);//子件
                    dto.SubKey     = subItemMaster;
                    dto.SubkeyType = subItemMaster.StockCategory;
                    //如果子件的库存分类为工具类子件,则自动勾选确认状态
                    if (subItemMaster.StockCategory != null && subItemMaster.StockCategory.Code == "02")
                    {
                        dto.ArrirmState = true;
                    }
                    dto.OrderHead  = soLine.SO;
                    dto.OrderLine  = soLine;
                    dto.ParentPart = GetItemMaster(bom.ItemMaster.Code);//母件
                    dto.BomMaster  = bom;
                    dto.BomCompont = bomCom;
                    dto.Dosage     = bomCom.UsageQty;                                                  //用量
                    dto.DosageUnit = bomCom.IssueUOM;                                                  //用量单位
                    dto.SellNumber = orderByQtyTU;                                                     //销售数量
                    dto.SellUnit   = saleUom;                                                          //销售单位
                    dto.Loss       = bomCom.FixedScrap;                                                //固定损耗

                    dto.NeedNumber   = Math.Ceiling(demandQty * (bomCom.UsageQty / bomCom.ParentQty)); //需求数量=母件的需求数量*子件用量/母件底数
                    dto.SourceType   = AllEnumBE.SourceTypeEnum.HandWork;
                    dto.OrderBomLine = new List <OrderBomBE.OrderBomLineDTO>();
                    if (subItemMaster.PurchaseInfo.Buyer != null)
                    {
                        OrderBomBE.OrderBomLineDTO lineDto = new OrderBomBE.OrderBomLineDTO();
                        lineDto.SalesMan = subItemMaster.PurchaseInfo.Buyer;
                        if (subItemMaster.PurchaseInfo.Buyer.Dept != null)
                        {
                            lineDto.Department = subItemMaster.PurchaseInfo.Buyer.Dept;
                        }
                        lineDto.SubKey         = subItemMaster;
                        lineDto.NeedNumber     = dto.NeedNumber;
                        lineDto.NeedUom        = dto.DosageUnit;
                        lineDto.ProcurementQty = dto.NeedNumber;
                        dto.OrderBomLine.Add(lineDto);
                    }
                    entityList.Add(dto);
                    #endregion

                    GetBomMaster(soLine, bomCom.ItemMaster.Code, date, bomCom.IssueUOM.ID, orderByQtyTU, saleUom, dto.NeedNumber, entityList, dto.Tier);
                }
            }
        }
Ejemplo n.º 7
0
        private void CreateSOBrokerage(UFIDA.U9.SM.SO.SOLine soline)
        {
            string strWhere = "BrokerageHead.Custmer.Code=@Customer and BrokerageHead.Product.Code=@Item and BrokerageHead.States=2 and BrokerageHead.Org=@Org and Valid=1 and @Date >= ValidDate and @Date <= UnValidDate";

            OqlParam[] appOqlparm = new OqlParam[] {
                new OqlParam("Customer", soline.SO.OrderBy.Code),
                new OqlParam("Item", soline.ItemInfo.ItemCode),
                new OqlParam("Org", soline.SO.Org.ID),
                new OqlParam("Date", soline.SO.BusinessDate)
            };
            UFIDA.U9.Cust.GS.FT.BrokerageBE.BrokerageLine.EntityList list = UFIDA.U9.Cust.GS.FT.BrokerageBE.BrokerageLine.Finder.FindAll(strWhere, appOqlparm);
            foreach (UFIDA.U9.Cust.GS.FT.BrokerageBE.BrokerageLine line in list)
            {
                UFIDA.U9.Cust.GS.FT.OrderLineBrokerageBE.OrderLineBrokerage doc = UFIDA.U9.Cust.GS.FT.OrderLineBrokerageBE.OrderLineBrokerage.Finder.Find("OrderLineID=@SOLine and Payee=@Payee", new OqlParam("SOLine", soline.ID), new OqlParam("Payee", line.PayMan.ID));
                if (doc == null)
                {
                    doc = UFIDA.U9.Cust.GS.FT.OrderLineBrokerageBE.OrderLineBrokerage.Create();
                }
                doc.ClientKey      = line.BrokerageHead.CustmerKey;
                doc.ProductKey     = line.BrokerageHead.ProductKey;
                doc.BrokerageType  = line.BrokerageType;
                doc.Prices         = line.Prices;
                doc.BrokerageRatio = line.Brokerage;
                doc.PayeeKey       = line.PayManKey;
                if (line.BrokerageType == AllEnumBE.DiscountTypeEnum.FixedValues)//固定值
                {
                    doc.PayAmount      = line.Prices * soline.OrderByQtyTU;
                    doc.PayCurrencyKey = line.CurrentyKey;
                    doc.Descflexfield  = new Base.FlexField.DescFlexField.DescFlexSegments();
                    doc.Descflexfield.PrivateDescSeg30 = line.Prices + "";
                }
                if (line.BrokerageType == AllEnumBE.DiscountTypeEnum.PercentValues)
                {
                    doc.PayCurrencyKey = soline.SO.TCKey;
                    doc.Descflexfield  = new Base.FlexField.DescFlexField.DescFlexSegments();
                    doc.Descflexfield.PrivateDescSeg30 = line.Brokerage + "";
                    if (line.Computes == AllEnumBE.ComputeEnum.IsPlan)//折扣前,取外销价进行计算
                    {
                        decimal soPrice = 0;
                        if (!string.IsNullOrEmpty(soline.DescFlexField.PrivateDescSeg5))
                        {
                            soPrice = decimal.Parse(soline.DescFlexField.PrivateDescSeg5);
                        }
                        doc.PayAmount = soPrice * soline.OrderByQtyTU * line.Brokerage;
                    }
                    else
                    {
                        doc.PayAmount = soline.TotalMoneyTC * line.Brokerage;//折扣后,取最终价进行计算
                    }
                }
                if (doc.PayAmount < doc.OutPayment)
                {
                    throw new Exception("第 " + soline.DocLineNo.ToString() + " 行在计算佣金时发生错误,错误原因:支付金额小于已付款金额!");
                }
                doc.OrderCurrencyKey = soline.SO.TCKey;

                doc.OrgKey           = soline.SO.OrgKey;
                doc.SourceType       = AllEnumBE.SourceTypeEnum.HandWork;
                doc.OrderLineIDKey   = soline.Key;
                doc.OrderLineRowNo   = soline.DocLineNo;
                doc.SrcBrokerageLine = line;
            }
            soline.DescFlexField.PrivateDescSeg6 = "True";
        }