コード例 #1
0
        /// <summary>
        /// 创建特价申请单
        /// </summary>
        /// <param name="SoLineList"></param>
        public void CreateySoOrderSale(List <SM.SO.SOLine.EntityKey> SoLineList)
        {
            List <SM.SO.SOLine.EntityKey> SoLineListKey = SoLineList; //销售订单行 key集合

            SM.SO.SO SoEntity = SoLineListKey[0].GetEntity().SO;      //得到销售订单头实体

            using (ISession session = Session.Open())
            {
                UFIDA.U9.Cust.GS.FT.AllFormTypeBE.AllFormType docType = UFIDA.U9.Cust.GS.FT.AllFormTypeBE.AllFormType.Finder.Find("DocumentsType=1");
                if (docType == null)
                {
                    throw new Exception("没有预设销售订单特价申请单单据类型,或者单据类型的上游单据推出未勾选!");
                }
                #region 特价申请单头
                SoOrderSaleHead SoOrderSale = SoOrderSaleHead.Create();                                                                                                        //创建实体
                SoOrderSale.DocumentType  = docType;                                                                                                                           //单据类型
                SoOrderSale.BusinessDate  = DateTime.Now;
                SoOrderSale.SourceType    = UFIDA.U9.Cust.GS.FT.AllEnumBE.SourceTypeEnum.SoOrder;                                                                              //来源类型
                SoOrderSale.CurrencyKey   = SoEntity.TCKey;                                                                                                                    //币种
                SoOrderSale.SalesManKey   = SoEntity.SellerKey;                                                                                                                //业务员
                SoOrderSale.GetOrderOrg   = UFIDA.U9.Base.Organization.Organization.Finder.Find("Code=@Code", new OqlParam("Code", SoEntity.DescFlexField.PrivateDescSeg14));; //接单组织,销售订单扩展字段
                SoOrderSale.ClientKey     = SoEntity.OrderBy.CustomerKey;                                                                                                      //客户
                SoOrderSale.DepartmentKey = SoEntity.SaleDepartmentKey;                                                                                                        //部门
                SoOrderSale.SourceOrderID = SoEntity;
                //SoOrderSale.Org   组织,默认当前组织
                #endregion
                #region 特价申请单行
                int lineNum = 10;
                foreach (SOLine.EntityKey SoLineKey in SoLineListKey)
                {
                    SOLine SoLineEntity = SoLineKey.GetEntity();
                    if (SoLineEntity != null)
                    {
                        SoOrderSaleLine SoOrderSaleLine = SoOrderSaleLine.Create(SoOrderSale);//创建特价申请单行
                        SoOrderSaleLine.RowNo = lineNum;
                        lineNum = lineNum + 10;
                        //行号处理,
                        SoOrderSaleLine.SoruceRowNo = SoLineEntity.DocLineNo;                  //来源行号

                        SoOrderSaleLine.SourceLineID   = SoLineEntity.ID;                      //来源行ID
                        SoOrderSaleLine.SourceOrderID  = SoLineEntity.SO.ID;                   //来源单据ID
                        SoOrderSaleLine.SourceOrderKey = SoLineEntity.SO.Key;                  //来源单号
                        SoOrderSaleLine.CustomerItem   = SoLineEntity.CustomerItemName;        //.ItemInfo.ItemIDKey;   //(料品)客户料号=>销售订单行上面有客户料号,客户品名
                        SoOrderSaleLine.ItemCodeKey    = SoLineEntity.ItemInfo.ItemIDKey;      //料号
                        SoOrderSaleLine.ItemName       = SoLineEntity.ItemInfo.ItemName;       //品名
                        SoOrderSaleLine.Qty            = SoLineEntity.OrderByQtyTU;            //数量
                        SoOrderSaleLine.ListAmount     = SoLineEntity.OrderPriceTC;            //定价
                        SoOrderSaleLine.Amount         = SoOrderSaleLine.Qty * SoOrderSaleLine.ListAmount;
                        if (!string.IsNullOrEmpty(SoLineEntity.DescFlexField.PrivateDescSeg5)) //申请后单价 原销售订单外销价,可改
                        {
                            SoOrderSaleLine.AfterPrices = decimal.Parse(SoLineEntity.DescFlexField.PrivateDescSeg5);
                            SoOrderSaleLine.AfterAmount = SoOrderSaleLine.AfterPrices * SoOrderSaleLine.Qty; //申请后金额=单价*数量
                        }
                        SoOrderSaleLine.MeasureUomKey = SoLineEntity.TUKey;                                  //计量单位
                        if (!string.IsNullOrEmpty(SoLineEntity.DescFlexField.PubDescSeg11))
                        {
                            SoOrderSaleLine.BinningMode = UFIDA.U9.Cust.GS.FT.AllEnumBE.BinningModeEnum.GetFromValue(SoLineEntity.DescFlexField.PubDescSeg11);//装箱方式 扩展字段
                        }
                        // SoOrderSaleLine.Memo;//备注
                        SoOrderSaleLine.PriceWhy = SoLineEntity.DescFlexField.PrivateDescSeg2;//调价原因
                    }
                }
                #endregion

                session.Commit();
            }
        }
コード例 #2
0
        /// <summary>
        /// 为实体Dto赋值
        /// </summary>
        /// <param name="SO">销售订单集合</param>
        /// <param name="SoLine">销售订单行集合与销售订单集合互斥</param>
        /// <param name="dotList">成本预测实体DTo</param>
        private List <CostForecastBE.CostForecastDTO> SetCostDto(List <SM.SO.SO.EntityKey> SO, List <SM.SO.SOLine.EntityKey> SoLine)
        {
            List <CostForecastBE.CostForecastDTO> dtoList = new List <CostForecastBE.CostForecastDTO>();//订单成本预测实体集合

            #region 参数声明
            CostForecastBE.CostForecastDTO dto    = null; //订单成本预测实体dto
            CostForecastBE.CostForecastDTO dtoOne = null; //成品成本预测实体dto
            //获取所需预置参数
            CalculateDtoFieldExtend.GetPresetParameter();
            #endregion

            //整单成本预测
            if (SO != null && SO.Count > 0)
            {
                //从UI得到的销售订单应该是已经按照销售订单过滤了的
                SM.SO.SO soEntity = null;
                using (ISession session = Session.Open())
                {
                    foreach (SM.SO.SO.EntityKey soKey in SO)                        //遍历销售订单集合
                    {
                        //得到对应销售订单
                        soEntity = soKey.GetEntity();
                        if (soEntity == null)
                        {
                            throw new Exception("请确认查询方式是否设置为整单成本预测");
                            //continue;
                        }
                        dto              = new CostForecastBE.CostForecastDTO();
                        dto.SONo         = soEntity;                                       //赋值销售订单
                        dto.ForecastType = AllEnumBE.CostForecastTypeEnum.AllCostForecast; //预测类型整单成本预测
                        if (soEntity.DescFlexField.PrivateDescSeg6 != "")
                        {
                            dto.OceanFreight = decimal.Parse(soEntity.DescFlexField.PrivateDescSeg6);//国际费用
                        }
                        if (soEntity.DescFlexField.PrivateDescSeg8 != "")
                        {
                            dto.OtherFee = decimal.Parse(soEntity.DescFlexField.PrivateDescSeg8);//其他国外费用
                        }
                        if (soEntity.DescFlexField.PrivateDescSeg5 != "")
                        {
                            dto.DomesticFee = decimal.Parse(soEntity.DescFlexField.PrivateDescSeg5);//国内运费
                        }
                        if (soEntity.DescFlexField.PrivateDescSeg7 != "")
                        {
                            dto.OtherDomesticFee = decimal.Parse(soEntity.DescFlexField.PrivateDescSeg7);//其他国内费用
                        }
                        #region 计算整单体积
                        decimal allVolume = 0;
                        foreach (SM.SO.SOLine soLineEntity in soEntity.SOLines)    //遍历销售订单行集合计算整单体积
                        {
                            //bool isCalculateFreight = 0;//
                            //单行的体积=单行的箱数*料品.体积
                            //单行的箱数=订单数量/料品.装箱数量
                            //判断料品的装箱数量与装箱体积是否为空
                            UFIDA.U9.Cust.GS.FT.ItemSubTableBE.ItemSubTable itemSub = UFIDA.U9.Cust.GS.FT.ItemSubTableBE.ItemSubTable.Finder.Find("ItemMaster=" + soLineEntity.ItemInfo.ItemID.ID + "");
                            //if (itemSub == null)
                            //{
                            //    throw new Exception("请录入" + soLineEntity.SO.DocNo + "行" + soLineEntity.DocLineNo + "对应料品的装箱数量");
                            //}
                            //if(itemSub.BoxNumber ==0)
                            //{
                            //    throw new Exception("请录入" + soLineEntity.SO.DocNo + "行" + soLineEntity.DocLineNo + "对应料品的装箱数量");
                            //}
                            //if (itemSub.GrossWeight == 0)
                            //{
                            //    throw new Exception("请录入" + soLineEntity.SO.DocNo + "行" + soLineEntity.DocLineNo + "对应料品的毛重");
                            //}
                            //if (itemSub.BoxLong == 0)
                            //{
                            //    throw new Exception("请录入" + soLineEntity.SO.DocNo + "行" + soLineEntity.DocLineNo + "对应料品的装箱长度");
                            //}
                            //if (itemSub.BoxWidth == 0)
                            //{
                            //    throw new Exception("请录入" + soLineEntity.SO.DocNo + "行" + soLineEntity.DocLineNo + "对应料品的装箱宽度");
                            //}
                            //if (itemSub.BoxHight == 0)
                            //{
                            //    throw new Exception("请录入" + soLineEntity.SO.DocNo + "行" + soLineEntity.DocLineNo + "对应料品的装箱高度");
                            //}
                            //decimal itemQty = decimal.Parse(soLineEntity.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg3);//料品装箱数量
                            //decimal itemRough = decimal.Parse(soLineEntity.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg2);//料品毛重
                            if (itemSub != null)
                            {
                                decimal itemVolume = itemSub.BoxLong * itemSub.BoxWidth * itemSub.BoxHight;//料品体积
                                if (itemSub.BoxNumber == 0)
                                {
                                    allVolume += soLineEntity.OrderByQtyTU * itemVolume;//整单体积
                                }
                                else
                                {
                                    allVolume += (soLineEntity.OrderByQtyTU / itemSub.BoxNumber) * itemVolume;//整单体积
                                }
                            }
                        }
                        #endregion

                        #region 遍历得到销售订单行
                        string dtoDemo = "";
                        foreach (SM.SO.SOLine soLineEntity in soEntity.SOLines)    //遍历销售订单行集合
                        {
                            string dtoOneDemo = "";
                            UFIDA.U9.Cust.GS.FT.ItemSubTableBE.ItemSubTable itemSub = UFIDA.U9.Cust.GS.FT.ItemSubTableBE.ItemSubTable.Finder.Find("ItemMaster=" + soLineEntity.ItemInfo.ItemID.ID + "");
                            //计算共用值
                            decimal itemQty    = 0; //料品装箱数量
                            decimal itemRough  = 0; //料品毛重
                            decimal itemVolume = 0; //料品体积
                            if (itemSub != null)
                            {
                                itemQty    = itemSub.BoxNumber;                                     //料品装箱数量
                                itemRough  = itemSub.GrossWeight;                                   //料品毛重
                                itemVolume = itemSub.BoxLong * itemSub.BoxWidth * itemSub.BoxHight; //料品体积
                            }
                            decimal rmbCost    = 0;                                                 //工具人民币采购成本
                            decimal dollorCost = 0;                                                 //工具美元采购成本
                            decimal allFee     = 0;                                                 //成品各项费用

                            dtoOne = new CostForecastBE.CostForecastDTO();
                            dtoOne.ForecastType = AllEnumBE.CostForecastTypeEnum.OneCostForecast;     //预测类型
                            dtoOne.SONo         = soEntity;                                           //销售订单
                            dtoOne.SOLine       = soLineEntity;                                       //销售订单行
                            dtoOne.Brokerage    = CalculateDtoFieldExtend.GetBrokerage(soLineEntity); //佣金
                            dtoOne.Discount     = CalculateDtoFieldExtend.GetDiscount(soLineEntity);  //折扣
                            if (itemQty == 0 || itemRough == 0 || itemVolume == 0)
                            {
                                dtoOne.OceanFreight = 0;
                                dtoOne.DomesticFee  = 0;
                            }
                            else
                            {
                                dtoOne.OceanFreight = CalculateDtoFieldExtend.GetOceanFreight(itemQty, itemRough, itemVolume, soLineEntity);           //海运费
                                dtoOne.DomesticFee  = CalculateDtoFieldExtend.GetDomesticFee(itemQty, itemRough, itemVolume, allVolume, soLineEntity); //国内运费
                            }
                            dtoOne.OtherFee         = CalculateDtoFieldExtend.GetOtherOceanFreight(soLineEntity);                                      //其他国外费
                            dtoOne.OtherDomesticFee = CalculateDtoFieldExtend.GetOtherOceanFreight(soLineEntity);                                      //其他国内费

                            //随单BOM
                            OrderBomBE.OrderBomHead.EntityList orderBom = OrderBomBE.OrderBomHead.Finder.FindAll("OrderLine=@SOLine", new OqlParam(soLineEntity.ID));
                            dtoOne.TaxCredits        = CalculateDtoFieldExtend.GetTaxCredits(soLineEntity, orderBom);                               //退税额
                            dtoOne.ProcurementCost   = CalculateDtoFieldExtend.GetProcurementCost(soLineEntity, orderBom);                          //包装采购成本
                            dtoOne.LabourCharges     = CalculateDtoFieldExtend.GetLabourCharges(soLineEntity);                                      //包装人工费用
                            dtoOne.ProductCost       = CalculateDtoFieldExtend.GetProductCost(soLineEntity, ref rmbCost, ref dollorCost, orderBom); //产品采购成本
                            dtoOne.RMBProductCost    = rmbCost;                                                                                     //工具人民币采购成本
                            dtoOne.DollorProductCost = dollorCost;                                                                                  //工具美元采购成本
                            dtoOne.AdministrativeFee = CalculateDtoFieldExtend.GetAdministrativeFee(soLineEntity);                                  //管理费
                            dtoOne.Interest          = CalculateDtoFieldExtend.GetInterest(soLineEntity);                                           //利息
                            dtoOne.MouldFee          = CalculateDtoFieldExtend.GetMouldFee(soLineEntity);                                           //模具费‘
                            dtoOne.Labelling         = CalculateDtoFieldExtend.GetLabelling(soLineEntity, orderBom);                                //防盗标签费
                            dtoOne.CreditInsurance   = CalculateDtoFieldExtend.GetCreditInsurance(soLineEntity);                                    //信用保险费
                            dtoOne.BankCharge        = CalculateDtoFieldExtend.GetBankCharge(soLineEntity);                                         //银行费用

                            //dtoOne.OrderBomHead = orderBom;//随单Bom
                            dtoOne.ForecastTime = DateTime.Now;
                            dtoOne.ForecastMan  = UFIDA.U9.Base.Context.LoginUser;

                            //成品预测利润:各中类成品外销额-成品各项费用+成品退税额
                            allFee = dtoOne.Brokerage + dtoOne.Discount + dtoOne.OceanFreight + dtoOne.OtherFee + dtoOne.DomesticFee + dtoOne.OtherDomesticFee +
                                     dtoOne.ProcurementCost + dtoOne.LabourCharges + dtoOne.ProductCost + dtoOne.AdministrativeFee + dtoOne.Interest + dtoOne.MouldFee +
                                     dto.Labelling + dtoOne.CreditInsurance + dtoOne.BankCharge;
                            dtoOne.ProductForecastRate = soLineEntity.TotalMoneyTC - allFee + dto.TaxCredits;
                            dtoOne.ProductRate         = dto.ProductForecastRate / soLineEntity.TotalMoneyTC;
                            //备注
                            dtoOne.Demo = dtoOneDemo;
                            dtoList.Add(dtoOne);

                            #region 汇总到整单成本预测
                            dto.Brokerage         += dtoOne.Brokerage;
                            dto.Discount          += dtoOne.Discount;
                            dto.OceanFreight      += dtoOne.OceanFreight;//海运费
                            dto.TaxCredits        += dtoOne.TaxCredits;
                            dto.ProcurementCost   += dtoOne.ProcurementCost;
                            dto.LabourCharges     += dtoOne.LabourCharges;
                            dto.ProductCost       += dtoOne.ProductCost;
                            dto.RMBProductCost    += dtoOne.RMBProductCost;
                            dto.DollorProductCost += dtoOne.DollorProductCost;
                            dto.AdministrativeFee += dtoOne.AdministrativeFee;
                            dto.Interest          += dtoOne.Interest;
                            dto.MouldFee          += dtoOne.MouldFee;
                            dto.Labelling         += dtoOne.Labelling;
                            dto.CreditInsurance   += dtoOne.CreditInsurance;
                            dto.BankCharge        += dtoOne.BankCharge;
                            dto.ListForecastRate  += dto.ProductForecastRate;
                            //备注
                            dto.Demo = "";
                            //dto.SOLine = soLineEntity;
                            //随单BOM


                            #endregion
                            //得到销售订单行soLineEntity
                            #region 计算成本预测字段值
                            //根据销售订单行得到随单Bom表
                            OrderBomHead bomHead = OrderBomHead.Finder.Find("");
                            #endregion
                        }
                        dto.ListRate     = dto.ProductForecastRate / soEntity.TotalMoneyAC; //整单利润率
                        dto.ForecastTime = DateTime.Now;                                    //预测时间
                        dto.ForecastMan  = UFIDA.U9.Base.Context.LoginUser;                 //预测人

                        dtoList.Add(dto);

                        //soEntity.DescFlexField.PrivateDescSeg7 = dto.OceanFreight.ToString();
                        #endregion
                    }
                    session.Commit();
                }
            }
            else if (SoLine != null && SoLine.Count > 0)
            {
                using (Session seesion = Session.Open())
                {
                    //成品成本预测
                    //从UI得到的销售订单行应该是已经按照销售订单行过滤了的
                    foreach (SM.SO.SOLine.EntityKey soLineKey in SoLine)          //遍历销售订单行集合
                    {
                        //得到销售订单行
                        //SM.SO.SOLine soLineEntity = soLineKey.GetEntity();
                        SM.SO.SOLine line = SM.SO.SOLine.Finder.FindByID(soLineKey.ID);
                        if (line == null)
                        {
                            throw new Exception("请确认查询方案设置为成品成本预测");
                        }
                        SM.SO.SOLine soLineEntity = line;

                        #region 计算整单体积
                        decimal allVolume = 0;
                        foreach (SM.SO.SOLine soLine in soLineEntity.SO.SOLines)    //遍历销售订单行集合计算整单体积
                        {
                            //单行的体积=单行的箱数*料品.体积
                            //单行的箱数=订单数量/料品.装箱数量
                            //判断料品的装箱数量与装箱体积是否为空

                            ItemSubTable itemsub = ItemSubTable.Finder.Find("ItemMaster=" + soLine.ItemInfo.ItemID.ID);
                            //if(itemsub == null)
                            //    throw new Exception("请维护" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应料品子表装箱长度、装箱宽度、装箱高度、装箱数量、毛重字段");
                            //if(itemsub.BoxNumber == 0)
                            //{
                            //    throw new Exception("请录入" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应料品的装箱数量");
                            //}
                            //if (itemsub.GrossWeight ==0 )
                            //{
                            //    throw new Exception("请录入" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应料品的毛重");
                            //}
                            //if (itemsub.BoxLong == 0)
                            //{
                            //    throw new Exception("请录入" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应料品的装箱长度");
                            //}
                            //if (itemsub.BoxWidth == 0)
                            //{
                            //    throw new Exception("请录入" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应料品的装箱宽度");
                            //}
                            //if (itemsub.BoxHight == 0)
                            //{
                            //    throw new Exception("请录入" + soLine.SO.DocNo + "行" + soLine.DocLineNo + "对应料品的装箱高度");
                            //}
                            if (itemsub != null)
                            {
                                decimal itemQty    = itemsub.BoxNumber;                                     //料品装箱数量
                                decimal itemRough  = itemsub.GrossWeight;                                   //料品毛重
                                decimal itemVolume = itemsub.BoxLong * itemsub.BoxWidth * itemsub.BoxHight; //料品体积
                                allVolume += (soLine.OrderByQtyTU / itemQty) * itemVolume;                  //整单体积
                            }
                        }
                        #endregion

                        #region 计算成本预测字段值
                        //根据销售订单行得到随单Bom表
                        //计算共用值
                        ItemSubTable itemsub1    = ItemSubTable.Finder.Find("ItemMaster=" + soLineEntity.ItemInfo.ItemID.ID);
                        int          itemQty1    = 0; //料品装箱数量
                        decimal      itemRough1  = 0; //料品毛重
                        decimal      itemVolume1 = 0; //料品体积
                        if (itemsub1 != null)
                        {
                            itemQty1    = itemsub1.OutBoxNumber;                             //料品装箱数量
                            itemRough1  = itemsub1.GrossWeight;                              //料品毛重
                            itemVolume1 = itemsub1.Length * itemsub1.Width * itemsub1.Hight; //料品体积
                        }
                        decimal rmbCost    = 0;                                              //工具人民币采购成本
                        decimal dollorCost = 0;                                              //工具美元采购成本
                        decimal allFee     = 0;                                              //成品各项费用

                        dtoOne = new CostForecastBE.CostForecastDTO();
                        dtoOne.ForecastType = AllEnumBE.CostForecastTypeEnum.OneCostForecast;     //预测类型
                        dtoOne.SONo         = soLineEntity.SO;                                    //销售订单
                        dtoOne.SOLine       = soLineEntity;                                       //销售订单行
                        dtoOne.Brokerage    = CalculateDtoFieldExtend.GetBrokerage(soLineEntity); //佣金
                        dtoOne.Discount     = CalculateDtoFieldExtend.GetDiscount(soLineEntity);  //折扣
                        if (itemQty1 == 0 || itemRough1 == 0 || itemVolume1 == 0)
                        {
                            dtoOne.OceanFreight = 0;
                            dtoOne.DomesticFee  = 0;
                        }
                        else
                        {
                            dtoOne.OceanFreight = CalculateDtoFieldExtend.GetOceanFreight(itemQty1, itemRough1, itemVolume1, soLineEntity);           //海运费
                            dtoOne.DomesticFee  = CalculateDtoFieldExtend.GetDomesticFee(itemQty1, itemRough1, itemVolume1, allVolume, soLineEntity); //国内运费
                        }
                        dtoOne.OtherFee         = CalculateDtoFieldExtend.GetOtherOceanFreight(soLineEntity);                                         //其他国外费
                        dtoOne.OtherDomesticFee = CalculateDtoFieldExtend.GetOtherOceanFreight(soLineEntity);                                         //其他国内费
                        //随单BOM
                        OrderBomBE.OrderBomHead.EntityList orderBom = OrderBomBE.OrderBomHead.Finder.FindAll("OrderLine=@BomMaster", new OqlParam(soLineEntity.ID));
                        dtoOne.TaxCredits        = CalculateDtoFieldExtend.GetTaxCredits(soLineEntity, orderBom);                               //退税额
                        dtoOne.ProcurementCost   = CalculateDtoFieldExtend.GetProcurementCost(soLineEntity, orderBom);                          //包装采购成本
                        dtoOne.LabourCharges     = CalculateDtoFieldExtend.GetLabourCharges(soLineEntity);                                      //包装人工费用
                        dtoOne.ProductCost       = CalculateDtoFieldExtend.GetProductCost(soLineEntity, ref rmbCost, ref dollorCost, orderBom); //产品采购成本
                        dtoOne.RMBProductCost    = rmbCost;                                                                                     //工具人民币采购成本
                        dtoOne.DollorProductCost = dollorCost;                                                                                  //工具美元采购成本
                        dtoOne.AdministrativeFee = CalculateDtoFieldExtend.GetAdministrativeFee(soLineEntity);                                  //管理费
                        dtoOne.Interest          = CalculateDtoFieldExtend.GetInterest(soLineEntity);                                           //利息
                        dtoOne.MouldFee          = CalculateDtoFieldExtend.GetMouldFee(soLineEntity);                                           //模具费‘
                        dtoOne.Labelling         = CalculateDtoFieldExtend.GetLabelling(soLineEntity, orderBom);                                //防盗标签费
                        dtoOne.CreditInsurance   = CalculateDtoFieldExtend.GetCreditInsurance(soLineEntity);                                    //信用保险费
                        dtoOne.BankCharge        = CalculateDtoFieldExtend.GetBankCharge(soLineEntity);                                         //银行费用

                        //dtoOne.OrderBomHead = orderBom;//随单Bom
                        dtoOne.ForecastTime = DateTime.Now;
                        dtoOne.ForecastMan  = UFIDA.U9.Base.Context.LoginUser;

                        //成品预测利润:各中类成品外销额-成品各项费用+成品退税额
                        allFee = dtoOne.Brokerage + dtoOne.Discount + dtoOne.OceanFreight + dtoOne.OtherFee + dtoOne.DomesticFee + dtoOne.OtherDomesticFee +
                                 dtoOne.ProcurementCost + dtoOne.LabourCharges + dtoOne.ProductCost + dtoOne.AdministrativeFee + dtoOne.Interest + dtoOne.MouldFee +
                                 dtoOne.Labelling + dtoOne.CreditInsurance + dtoOne.BankCharge;
                        dtoOne.ProductForecastRate = soLineEntity.TotalMoneyTC - allFee + dtoOne.TaxCredits;
                        dtoOne.ProductRate         = dtoOne.ProductForecastRate / soLineEntity.TotalMoneyTC;

                        //反写销售订单行预测状态
                        if (soLineEntity.DescFlexField.PrivateDescSeg18 == "")
                        {
                            soLineEntity.DescFlexField.PrivateDescSeg18 = "Y";
                        }
                        //else if (soLineEntity.DescFlexField.PrivateDescSeg18 == "N")
                        //{
                        //    soLineEntity.DescFlexField.PrivateDescSeg18 = "M";
                        //}
                        dtoList.Add(dtoOne);
                        #endregion
                    }
                    seesion.Commit();
                }
            }
            else
            {
                throw new Exception("未选择任何需要预测的订单");
            }
            return(dtoList);
            //CreatEntity(dtoList);
        }