Exemplo n.º 1
0
        public void Notify(params object[] args)
        {
            if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent))
            {
                return;
            }
            BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey;

            if (key == null)
            {
                return;
            }
            UFIDA.U9.SM.SO.SOLine soLine = key.GetEntity() as UFIDA.U9.SM.SO.SOLine;//销售订单实体
            if (soLine == null)
            {
                return;
            }
            //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心
            if (!UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.IsTradeCenterOrg())
            {
                return;                                                                            //组织必须等于贸易中心
            }
            UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.IsSoOrderSale(soLine);
            using (ISession session = Session.Open())
            {
                UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteBrokerage(soLine);    //删除佣金
                UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteSOBom(soLine);        //删除BOM
                UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteSODiscount(soLine);   //删除折扣
                UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteSOAssessType(soLine); //删除评估任务
                session.Commit();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 判断是否需要创建大货评估
        /// </summary>
        /// <param name="soline"></param>
        /// <returns></returns>
        public static bool CheckAssessType(UFIDA.U9.SM.SO.SOLine soline)
        {
            bool    isAssess = false;
            decimal rate     = 1;//汇率,默认为1

            if (soline.SO.TC.Code != "C009")
            {
                rate = UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.GetRate(soline.SO.TC.Code, "C009", soline.SO.BusinessDate);
            }
            decimal itemMoney = 0;

            if (!string.IsNullOrEmpty(soline.ItemInfo.ItemID.DescFlexField.PrivateDescSeg2))
            {
                itemMoney = decimal.Parse(soline.ItemInfo.ItemID.DescFlexField.PrivateDescSeg2);
            }
            if (soline.TotalMoneyTC * rate > itemMoney)
            {
                UFIDA.U9.Cust.GS.FT.AssessTypeBE.AssessType entity = UFIDA.U9.Cust.GS.FT.AssessTypeBE.AssessType.Finder.Find("AssessTypes=1 and SoLineID=@SOLine", new OqlParam("SOLine", soline.ID));
                if (entity == null)
                {
                    isAssess = true;
                }
            }
            return(isAssess);
        }
Exemplo n.º 3
0
        public override object Do(object obj)
        {
            CreateSOBomBP bpObj = (CreateSOBomBP)obj;

            if (bpObj == null)
            {
                return(false);
            }

            List <UFIDA.U9.Cust.GS.FT.OrderBomBE.OrderBomHeadDTO> entityList = new List <OrderBomBE.OrderBomHeadDTO>();

            foreach (UFIDA.U9.SM.SO.SOLine.EntityKey solineKey in bpObj.SOLineKeyList)
            {
                UFIDA.U9.SM.SO.SOLine soline = solineKey.GetEntity();
                if (soline != null)
                {
                    //如果包装工厂不等于外厂包装,则生成随单BOM,否则生成一行料品等于销售订单行料品的中类的随单BOM行
                    if (soline.DescFlexField.PubDescSeg18 != "02")
                    {
                        string i = "1";

                        GetBomMaster(soline, soline.ItemInfo.ItemCode, soline.SO.BusinessDate, soline.ItemInfo.ItemID.ManufactureUOM.ID, soline.OrderByQtyTU, soline.TU, soline.OrderByQtyTU, entityList, i);
                    }
                    else
                    {
                    }
                    CreateSOBom(entityList);
                }
            }

            return(true);
        }
Exemplo n.º 4
0
        public void Notify(params object[] args)
        {
            if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent))
            {
                return;
            }

            //将入口参数列表中第一个参数,转成EntityEvent,并取EntityKey存入key
            UFSoft.UBF.Business.BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey;
            //key的有效性判断
            if (key == null)
            {
                return;
            }
            //转成所需实体,同时判断有效性
            UFIDA.U9.SM.SO.SOLine soLine = (UFIDA.U9.SM.SO.SOLine)key.GetEntity();

            if (soLine == null)
            {
                return;
            }
            else
            {
                if (soLine.Org.Code == "300")
                {
                    try
                    {
                        DataParamList dp = new DataParamList();
                        dp.Add(DataParamFactory.Create("SOID", soLine.SO.ID, ParameterDirection.Input, DbType.String, 50));
                        dp.Add(DataParamFactory.Create("DocLineNo", soLine.DocLineNo, ParameterDirection.Input, DbType.String, 20));
                        dp.Add(DataParamFactory.CreateOutput("Result", DbType.String));
                        DataAccessor.RunSP("sp_Auctus_BE_SOLineAD", dp);
                        string result = dp["Result"].Value.ToString();
                        if (result != "0")
                        {
                            throw new Exception(result);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 5
0
        public override object Do(object obj)
        {
            CreateSOBrokerageBP bpObj = (CreateSOBrokerageBP)obj;

            if (bpObj == null)
            {
                return(false);
            }

            using (ISession session = Session.Open())
            {
                foreach (UFIDA.U9.SM.SO.SOLine.EntityKey solineKey in bpObj.SOLineKey)
                {
                    UFIDA.U9.SM.SO.SOLine soline = solineKey.GetEntity();
                    if (soline != null)
                    {
                        CreateSOBrokerage(soline);
                    }
                }
                session.Commit();
            }
            return(true);
        }
Exemplo n.º 6
0
        private List <ShipPlanIDDTO> CreatShipPlanList(CreatShipPlan bpObj)
        {
            List <ShipPlanIDDTO> listShip = new List <ShipPlanIDDTO>();

            using (ISession session = Session.Open())
            {
                ShipPlanDetailBE.ShipPlanDetailHead shipPlan = ShipPlanDetailBE.ShipPlanDetailHead.Create();
                ShipDetailTypeBE.ShipDetailType     formType = ShipDetailTypeBE.ShipDetailType.Finder.Find("IsCreatedByPush=1");
                if (formType == null)
                {
                    throw new Exception("未设置出运明细单生单的单据类型,请设置出运明细单单据类型为“上游单据推出”");
                }
                shipPlan.DocumnetType       = formType;
                shipPlan.SourceDocumnetType = AllEnumBE.SourceTypeEnum.SoOrder;
                shipPlan.Status             = AllEnumBE.DocumnetSate.OpenState;        //单据状态
                shipPlan.ShipPlanState      = AllEnumBE.ShipPlanStateEnum.NotShipPlan; //出运状态
                shipPlan.BusinessDate       = DateTime.Now;
                //设置默认行号
                GetProfileValueProxy lineNo = new GetProfileValueProxy();
                lineNo.ProfileCode = "SysLineNo";
                PVDTOData pVTDOData = lineNo.Do();
                string    row       = pVTDOData.ProfileValue;

                //财务费率
                decimal fiFeeRate           = 0;
                GetProfileValueProxy bpObj1 = new GetProfileValueProxy();
                bpObj1.ProfileCode = "FTFIFee";
                bpObj1.ProfileOrg  = Base.Context.LoginOrg.ID;
                PVDTOData pVDTOData = bpObj1.Do();
                if (pVDTOData != null && pVDTOData.ProfileValue != null)
                {
                    fiFeeRate = decimal.Parse(pVDTOData.ProfileValue);
                }

                string docNo = "", shipplingType = "", soLine = "";
                long   customer = 0, currenty = 0;
                int    count = 1;


                foreach (SOLineIDDTO lineDto in bpObj.SOLineIDDTO)
                {
                    UFIDA.U9.SM.SO.SOLine line = SM.SO.SOLine.Finder.FindByID(lineDto.SOLine);
                    if (line == null)
                    {
                        continue;
                    }
                    //不同的客户、币种、装箱方式不允许拉式生成同一个出运明细单
                    if (count > 1)
                    {
                        if (customer != 0 && customer != line.SO.OrderBy.Customer.ID)
                        {
                            throw new Exception("销售订单" + line.SO.DocNo + "的客户与单号" + docNo + "的客户不一致,不能生成同一个出运明细单");
                        }
                        if (currenty != 0 && currenty != line.SO.TC.ID)
                        {
                            throw new Exception("销售订单" + line.SO.DocNo + "的币种与单号" + docNo + "的币种不一致,不能生成同一个出运明细单");
                        }
                        if (shipplingType != "" && shipplingType != line.DescFlexField.PubDescSeg11)
                        {
                            throw new Exception("销售订单" + line.SO.DocNo + "行号" + line.DocLineNo + "的装箱方式与单号" + docNo + "行号" + soLine + "装箱方式不一致,不能生成同一个出运明细单");
                        }
                    }
                    docNo         = line.SO.DocNo;
                    customer      = line.SO.OrderBy.Customer.ID;
                    currenty      = line.SO.TC.ID;
                    shipplingType = line.DescFlexField.PubDescSeg11;
                    soLine        = line.DocLineNo.ToString();

                    //赋值表头信息
                    shipPlan.SaleMan = line.SO.Seller;           //业务员
                    shipPlan.Client  = line.SO.OrderBy.Customer; //客户
                    if (line.SO.OrderBy.Customer != null)
                    {
                        // shipPlan.Consignee = line.SO.OrderBy.Customer.a
                        //提箱港区	地区档案	从销售订单带出,从客户带出
                        if (line.SO.OrderBy.Customer.Territory != null)
                        {
                            shipPlan.CargoPort = line.SO.OrderBy.Customer.Territory;//
                        }
                    }
                    if (line.SO.ShipToSite != null && line.SO.ShipToSite.CustomerSite != null)//收货位置
                    {
                        //shipPlan.
                    }
                    shipPlan.Department = line.SO.SaleDepartment; //部门
                    shipPlan.Currency   = line.SO.TC;             //币种
                    shipPlan.DealMode   = line.SO.BargainMode;    //成交方式
                    //贸易国别	国家\地区档案	从销售订单带出
                    //shipPlan.Country = line.SO.
                    shipPlan.Transportation = line.SO.TransMode;
                    //
                    if (line.SO.DescFlexField.PrivateDescSeg14 != "")
                    {
                        Base.Organization.Organization org = Base.Organization.Organization.FindByCode(line.SO.DescFlexField.PrivateDescSeg14);
                        if (org != null)
                        {
                            shipPlan.GetOrderOrg = org;
                        }
                        else
                        {
                            throw new Exception("销售订单" + line.SO.DocNo + "接单组织为空,不能生成出运明细单");
                        }
                    }
                    else
                    {
                        throw new Exception("销售订单" + line.SO.DocNo + "接单组织为空,不能生成出运明细单");
                    }

                    //出口口岸	港口档案	从销售订单带出
                    shipPlan.ExportPort = line.SO.ShippingPort;
                    //进港区	地区档案	从销售订单带出
                    //shipPlan.IntoPort
                    //目的口岸	港口档案	从销售订单带出
                    shipPlan.DestinationPort = line.SO.AimPort;
                    //运输方式
                    shipPlan.Transportation = line.SO.TransMode;
                    //贸易方式
                    shipPlan.TradeMode = line.SO.TradeMode;
                    //收汇天数,从销售订单公共扩展字段1带出
                    if (line.SO.OrderBy.CustomerKey.GetEntity().DescFlexField.PubDescSeg1 == "")
                    {
                        shipPlan.NumberDay = 0;
                    }
                    else
                    {
                        shipPlan.NumberDay = Convert.ToInt32(line.SO.OrderBy.CustomerKey.GetEntity().DescFlexField.PubDescSeg1);
                    }

                    //赋值表体信息
                    ShipPlanDetailBE.ShipPlanDetailLine shipLine = ShipPlanDetailBE.ShipPlanDetailLine.Create(shipPlan);
                    //包装工厂	值集值	从销售订单行带出
                    //Base.FlexField.ValueSet.DefineValue flexField = Base.FlexField.ValueSet.DefineValue.Finder.Find("Code='Z022'");
                    if (line.DescFlexField.PrivateDescSeg18 != "")
                    {
                        Base.FlexField.ValueSet.DefineValue flexField = Base.FlexField.ValueSet.DefineValue.Finder.Find("ValueSetDef.Code='Z002' and Code='" + line.DescFlexField.PrivateDescSeg18 + "'");
                        // flexField.ValueSetDef.CodeAttribute
                        shipLine.PackingHouse = flexField;
                    }

                    if (line.DescFlexField.PrivateDescSeg12 != "") //验货方式直接
                    {
                        Base.FlexField.ValueSet.DefineValue flexField = Base.FlexField.ValueSet.DefineValue.Finder.Find("ValueSetDef.Code='Z009' and Code='" + line.DescFlexField.PrivateDescSeg12 + "'");
                        shipLine.ExamineCargoMode = flexField;
                        //shipLine.ExamineCargoMode = AllEnumBE.ExamineCargoModeEnum.GetFromValue(line.DescFlexField.PrivateDescSeg12);
                    }
                    //else
                    //    shipLine.ExamineCargoMode = AllEnumBE.ExamineCargoModeEnum.Empty;
                    shipLine.RowNo     = Convert.ToInt32(row);
                    shipLine.SrcSO     = line.SO;
                    shipLine.SrcDocNo  = line.SO.DocNo;
                    shipLine.SrcLineID = line.ID;
                    shipLine.SrcLineNo = line.DocLineNo.ToString();
                    //shipLine.SrcSOKey  = line.
                    if (line.ItemInfo == null || line.ItemInfo.ItemID == null)
                    {
                        throw new Exception("销售订单" + line.SO.DocNo + "行" + line.DocLineNo + "找不见对应料品信息,不能生成出运明细单");
                    }
                    shipLine.Item       = line.ItemInfo.ItemID;
                    shipLine.Standard   = line.ItemInfo.ItemID.SPECS;
                    shipLine.NumberUom  = line.TU;
                    shipLine.Ultimately = line.FinallyPriceTC;//最终价
                    //外销价	十进制	销售订单带出
                    if (line.DescFlexField.PrivateDescSeg5 != "")
                    {
                        shipLine.ExportSales = decimal.Parse(line.DescFlexField.PrivateDescSeg5);//外销价
                    }
                    shipLine.Qty            = lineDto.ShipQty;
                    shipPlan.FinancialCost += shipPlan.FinancialCost + (shipLine.ExportSales * shipLine.Qty * fiFeeRate / 100);
                    //反写销售订单已出运数量
                    //if (line.DescFlexField.PrivateDescSeg8 != "")
                    //{
                    //    line.DescFlexField.PrivateDescSeg8 = (decimal.Parse(line.DescFlexField.PrivateDescSeg8) + lineDto.ShipQty).ToString();//反写销售订单行的已出运数量
                    //}
                    //else
                    //    line.DescFlexField.PrivateDescSeg8 = lineDto.ShipQty.ToString();

                    //验货方式销售订单行私有字段12

                    //带出料品的总箱数、内箱数、外箱数、毛重、净重、体积、长、宽、高,体积、总体积
                    //料品的字表字段
                    ItemSubTable itemsub = ItemSubTable.Finder.Find("ItemMaster=" + line.ItemInfo.ItemID.ID);
                    if (itemsub != null)
                    {
                        //string sumBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg3;//料品的扩展字段;箱数
                        //string inBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg27;//料品的扩展字段;内箱数
                        //string outerBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg28;//料品的扩展字段;外箱数
                        //string grossWeight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg2;//料品的扩展字段:毛重
                        ////string netWeight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg3;//料品的扩展字段:净重
                        //string length = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg8;//料品的扩展字段:长
                        //string weith = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg9;//料品的扩展字段:宽
                        //string hight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg10;//料品的扩展字段:高

                        //string sumBoxNumber = itemsub.BoxNumber; ;//料品的扩展字段;箱数
                        //string inBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg27;//料品的扩展字段;内箱数
                        //string outerBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg28;//料品的扩展字段;外箱数
                        //string grossWeight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg2;//料品的扩展字段:毛重
                        ////string netWeight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg3;//料品的扩展字段:净重
                        //string length = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg8;//料品的扩展字段:长
                        //string weith = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg9;//料品的扩展字段:宽
                        //string hight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg10;//料品的扩展字段:高

                        shipLine.SumBoxNumber   = itemsub.BoxNumber;
                        shipLine.InBoxNumber    = itemsub.InnerBoxNumber;
                        shipLine.OuterBoxNumber = itemsub.OutBoxNumber;
                        shipLine.GrossWeight    = itemsub.GrossWeight;                 //毛重
                        shipLine.NetWeight      = itemsub.NetWeight;                   //净重
                        shipLine.SumGross       = shipLine.GrossWeight * shipLine.Qty; //总毛重
                        shipLine.Length         = itemsub.BoxLong;
                        shipLine.Weith          = itemsub.BoxWidth;
                        shipLine.Higth          = itemsub.BoxHight;
                        shipLine.Bulks          = shipLine.Length * shipLine.Weith * shipLine.Higth; //体积
                        shipLine.SumBulk        = shipLine.Bulks * shipLine.Qty;                     //总体积
                    }

                    #region 产生佣金表,放到BE里生成
                    //if (line.DescFlexField.PrivateDescSeg6.ToLower() == "true")
                    //{
                    //    OrderLineBrokerage.EntityList brokerage = OrderLineBrokerage.Finder.FindAll("OrderLineID='" + line.ID + "'");
                    //    if (brokerage != null && brokerage.Count > 0)
                    //    {
                    //        OrderLineBrokerage shipLineBroke = null;
                    //        foreach (OrderLineBrokerage orderBrokerage in brokerage)
                    //        {
                    //            shipLineBroke = OrderLineBrokerage.Create();
                    //            shipLineBroke.SourceType = AllEnumBE.SourceTypeEnum.ShipPlanDoc;
                    //            shipLineBroke.ShipPlanLine = shipLine;
                    //            shipLineBroke.ShipPlanRowNo = int.Parse(row);
                    //            shipLineBroke.Client = orderBrokerage.Client;
                    //            shipLineBroke.Product = orderBrokerage.Product;
                    //            shipLineBroke.BrokerageRatio = orderBrokerage.BrokerageRatio;
                    //            shipLineBroke.Payee = orderBrokerage.Payee;
                    //            shipLineBroke.PayAmount = orderBrokerage.PayAmount;
                    //            shipLineBroke.PayCurrency = orderBrokerage.PayCurrency;
                    //            shipLineBroke.OutPayment = orderBrokerage.OutPayment;
                    //            shipLineBroke.OrderCurrency = orderBrokerage.OrderCurrency;
                    //            shipLineBroke.Rate = orderBrokerage.Rate;
                    //        }
                    //    }
                    //}
                    #endregion

                    row = (int.Parse(row) + int.Parse(pVTDOData.ProfileValue)).ToString();
                    count++;
                }
                session.Commit();
                ShipPlanIDDTO shipID = new ShipPlanIDDTO();
                shipID.DocNo    = shipPlan.DocNo;
                shipID.ShipPlan = shipPlan.ID;
                listShip.Add(shipID);
            }
            return(listShip);
        }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
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);
                }
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor with Full Argument
 /// </summary>
 public OrderBomHeadDTO(System.Int64 iD, System.DateTime createdOn, System.String createdBy, System.DateTime modifiedOn, System.String modifiedBy, System.Int64 sysVersion, UFIDA.U9.CBO.MFG.BOM.BOMMaster bomMaster, UFIDA.U9.CBO.MFG.BOM.BOMComponent bomCompont, UFIDA.U9.CBO.SCM.Item.ItemMaster parentPart, UFIDA.U9.CBO.SCM.Item.ItemMaster subKey, System.Decimal dosage, UFIDA.U9.Base.UOM.UOM dosageUnit, System.Decimal sellNumber, UFIDA.U9.Base.UOM.UOM sellUnit, System.Decimal needNumber, UFIDA.U9.SM.SO.SOLine orderLine, UFIDA.U9.SM.SO.SO orderHead, System.Int32 orderLineRow, UFIDA.U9.Cust.GS.FT.AllEnumBE.SourceTypeEnum sourceType, System.String remark, UFIDA.U9.CBO.HR.Operator.Operators salesMan, UFIDA.U9.CBO.MFG.Enums.SupplyTypeEnum supplierType, System.String tier, System.Decimal loss, System.Boolean arrirmState, List <UFIDA.U9.Cust.GS.FT.OrderBomBE.OrderBomLineDTO> orderBomLine, UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments descflexfield, UFIDA.U9.CBO.SCM.Item.ItemCategory subkeyType)
 {
     this.ID            = iD;
     this.CreatedOn     = createdOn;
     this.CreatedBy     = createdBy;
     this.ModifiedOn    = modifiedOn;
     this.ModifiedBy    = modifiedBy;
     this.SysVersion    = sysVersion;
     this.BomMaster     = bomMaster;
     this.BomCompont    = bomCompont;
     this.ParentPart    = parentPart;
     this.SubKey        = subKey;
     this.Dosage        = dosage;
     this.DosageUnit    = dosageUnit;
     this.SellNumber    = sellNumber;
     this.SellUnit      = sellUnit;
     this.NeedNumber    = needNumber;
     this.OrderLine     = orderLine;
     this.OrderHead     = orderHead;
     this.OrderLineRow  = orderLineRow;
     this.SourceType    = sourceType;
     this.Remark        = remark;
     this.SalesMan      = salesMan;
     this.SupplierType  = supplierType;
     this.Tier          = tier;
     this.Loss          = loss;
     this.ArrirmState   = arrirmState;
     this.OrderBomLine  = orderBomLine;
     this.Descflexfield = descflexfield;
     this.SubkeyType    = subkeyType;
 }
Exemplo n.º 10
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";
        }