/// <summary> /// 创建供应计划 /// </summary> /// <param name="so"></param> public static void CreateSupplyPlan(UFIDA.U9.SM.SO.SO so) { UFIDA.U9.Cust.GS.SP.SupplyPlanBP.CreateSupplyPlanBP Proxy = new UFIDA.U9.Cust.GS.SP.SupplyPlanBP.CreateSupplyPlanBP(); Proxy.SrcDocTypeEnum = UFIDA.U9.Cust.GS.SP.SupplyPlanBE.SrcDocTypeEnum.SO; Proxy.SOID = so.ID; Proxy.Do(); }
/// <summary> /// 根据销售订单号获取项目号,如果项目号不存在,则自动创建一个编码等于销售订单单号的项目档案 /// </summary> /// <param name="so"></param> /// <returns></returns> public static UFIDA.U9.CBO.SCM.ProjectTask.Project GetProject(UFIDA.U9.SM.SO.SO so) { UFIDA.U9.CBO.SCM.ProjectTask.Project project = UFIDA.U9.CBO.SCM.ProjectTask.Project.Finder.Find("Code=@Code and Org=@Org", new OqlParam("Code", so.DocNo), new OqlParam("Org", so.Org.ID)); if (project == null) { project = CreateProject(so.DocNo, so.BusinessDate, so.CustomerPONo, so.Org.Code); } return(project); }
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.SO so = (UFIDA.U9.SM.SO.SO)key.GetEntity(); if (so == null) { return; } else { if (so.Org.Code == "300" && so.DescFlexField.PrivateDescSeg1.Contains("PO")) { try { DataParamList dp = new DataParamList(); dp.Add(DataParamFactory.Create("SODocNo", so.DocNo, ParameterDirection.Input, DbType.String, 50)); dp.Add(DataParamFactory.Create("PoDocNo", so.DescFlexField.PrivateDescSeg1, ParameterDirection.Input, DbType.String, 50)); dp.Add(DataParamFactory.CreateOutput("Result", DbType.String)); DataAccessor.RunSP("sp_Auctus_BE_SOAI", dp); string result = dp["Result"].Value.ToString(); if (result != "0") { throw new Exception(result); } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
/// <summary> /// 创建订单费用表:销售订单BE插件调用入口方法 /// 如果销售订单界面上的国际运输费用、国内运输费用、国内其他费用、国际其他费用有值,并且值发生了改变,则创建或者订单费用 /// </summary> /// <param name="so"></param> public static void CreateSOFee(UFIDA.U9.SM.SO.SO so) { if (string.IsNullOrEmpty(so.DescFlexField.PrivateDescSeg5) == false && so.OriginalData.DescFlexField.PrivateDescSeg5 != so.DescFlexField.PrivateDescSeg5)//国内运费 { UFIDA.U9.CBO.SCM.Item.ItemCategory feeEntity = GetItemCategory("104"); if (feeEntity == null) { throw new Exception("没有预设国内运输费用的费用项目!"); } CreateSOFeeEntity(feeEntity, decimal.Parse(so.DescFlexField.PrivateDescSeg5), so); } if (string.IsNullOrEmpty(so.DescFlexField.PrivateDescSeg6) == false && so.OriginalData.DescFlexField.PrivateDescSeg6 != so.DescFlexField.PrivateDescSeg6)//国际运费 { UFIDA.U9.CBO.SCM.Item.ItemCategory feeEntity = GetItemCategory("105"); if (feeEntity == null) { throw new Exception("没有预设国际运费的费用项目!"); } CreateSOFeeEntity(feeEntity, decimal.Parse(so.DescFlexField.PrivateDescSeg6), so); } if (string.IsNullOrEmpty(so.DescFlexField.PrivateDescSeg7) == false && so.OriginalData.DescFlexField.PrivateDescSeg7 != so.DescFlexField.PrivateDescSeg7)//国内其他费用 { UFIDA.U9.CBO.SCM.Item.ItemCategory feeEntity = GetItemCategory("106"); if (feeEntity == null) { throw new Exception("没有预设国内其他费用的费用项目!"); } CreateSOFeeEntity(feeEntity, decimal.Parse(so.DescFlexField.PrivateDescSeg7), so); } if (string.IsNullOrEmpty(so.DescFlexField.PrivateDescSeg8) == false && so.OriginalData.DescFlexField.PrivateDescSeg8 != so.DescFlexField.PrivateDescSeg8)//国际其他费用 { UFIDA.U9.CBO.SCM.Item.ItemCategory feeEntity = GetItemCategory("107"); if (feeEntity == null) { throw new Exception("没有预设国际其他费用的费用项目!"); } CreateSOFeeEntity(feeEntity, decimal.Parse(so.DescFlexField.PrivateDescSeg8), so); } }
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.InvDoc.TransferIn.TransferIn transferIn = (UFIDA.U9.InvDoc.TransferIn.TransferIn)key.GetEntity(); UFIDA.U9.SM.SO.SO entity = (UFIDA.U9.SM.SO.SO)key.GetEntity(); if (entity == null) { return; } else { try { if (entity.SysState == UFSoft.UBF.PL.Engine.ObjectState.Inserted)//插入操作 { //清空复制的OA流程扩展字段字段内容 entity.DescFlexField.PrivateDescSeg2 = ""; entity.DescFlexField.PrivateDescSeg3 = ""; entity.DescFlexField.PrivateDescSeg4 = ""; } } catch (Exception ex) { throw new Exception(ex.Message); } } }
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.SO so = key.GetEntity() as UFIDA.U9.SM.SO.SO;//销售订单实体 if (so == null) { return; } //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心 if (!UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.IsTradeCenterOrg()) { return; //组织必须等于贸易中心 } }
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.SO so = key.GetEntity() as UFIDA.U9.SM.SO.SO;//销售订单实体 if (so == null) { return; } //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心 if (!UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.IsTradeCenterOrg()) { return; //组织必须等于贸易中心 } List <UFIDA.U9.SM.SO.SOLine> sssessTypeList = new List <SM.SO.SOLine>(); //需要创建大货评估的订单行 List <UFIDA.U9.SM.SO.SOLine> adjustPriceList = new List <UFIDA.U9.SM.SO.SOLine>(); //需要创建的调价单集合 List <long> specilPriceList = new List <long>(); ////需要创建的特价申请单集合 UFIDA.U9.CBO.SCM.ProjectTask.Project project = null; foreach (UFIDA.U9.SM.SO.SOLine soLine in so.SOLines) { #region 校验 //提交时校验 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving) { } //审核时校验 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved) { if (!soLine.DescFlexField.PrivateDescSeg6.ToUpper().Contains("TRUE")) { throw new Exception("第" + soLine.DocLineNo.ToString() + "行还未生成佣金!"); } } //弃审时校验 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open) { } #endregion if (project == null) { project = PubHelperExtend.GetProject(so);//创建或者查找已存在的项目号 } if (soLine.Project == null) { soLine.Project = project;//如果项目号为空,给项目号赋值 } #region 判断是否需要创建大货评估 bool isAssess = CreateSOAssessTypeExtend.CheckAssessType(soLine); if (isAssess) { sssessTypeList.Add(soLine); } #endregion #region 判断是否需要创建特价申请单 if (string.IsNullOrEmpty(soLine.DescFlexField.PrivateDescSeg5)) { throw new Exception("外销价不能为空!"); } decimal ePrice = decimal.Parse(soLine.DescFlexField.PrivateDescSeg5); if (ePrice <= 0) { throw new Exception("外销价必须大于0!"); } if (ePrice < soLine.OrderPriceTC && soLine.DescFlexField.PrivateDescSeg1.ToUpper().Contains("TRUE") == false) { throw new Exception("当特价未勾选时,外销价必须大于等于定价!"); } if (ePrice > soLine.OrderPriceTC && soLine.DescFlexField.PrivateDescSeg1.ToUpper().Contains("TRUE") == true) { throw new Exception("当特价勾选时,外销价不能高于定价!"); } if (ePrice < soLine.OrderPriceTC && soLine.DescFlexField.PrivateDescSeg1.ToUpper().Contains("TRUE") == true) { specilPriceList.Add(soLine.ID); } #endregion #region 判断是否已做成本预测 //销售订单如果修改或者变更外销价,如果是将价格改低,则需要检查销售订单是否已做订单成本预测, //如果已做,则必须先手工删除该订单的成本预测后才允许进行修改或者变更 if (soLine.OriginalData.DescFlexField.PrivateDescSeg5 != "" && ePrice < decimal.Parse(soLine.OriginalData.DescFlexField.PrivateDescSeg5)) { UFIDA.U9.Cust.GS.FT.CostForecastBE.CostForecast costForecast = UFIDA.U9.Cust.GS.FT.CostForecastBE.CostForecast.Finder.Find("SOLine= " + soLine.ID + ""); if (costForecast != null) { throw new Exception("销售订单" + so.DocNo + "行" + soLine.DocLineNo + "已做成本预测,请删除成本预测结果"); } } //如果销售订单已做成本预测,订单发生更改,则预测状态变为M if (soLine.DescFlexField.PrivateDescSeg18 == "Y") { soLine.DescFlexField.PrivateDescSeg18 = "M"; } #endregion #region 判断是否需要创建调价单 if (soLine.SO.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved && ePrice > soLine.OrderPriceTC && soLine.PriceListID > 0L) { adjustPriceList.Add(soLine); } #endregion } //非审核的情况下 if (so.Status != UFIDA.U9.SM.SO.SODocStatusEnum.Approved) { CreateSOFeeExtend.CreateSOFee(so);//创建费用项目 if (sssessTypeList.Count > 0) { CreateSOAssessTypeExtend.CreateAssessType(sssessTypeList);//创建评估类型子表-大货评估 } } #region 提交、审核、弃审 //提交 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving) { //创建特价申请单 if (specilPriceList.Count > 0) { PubHelperExtend.CreateSoOrderSale(specilPriceList); } } //审核 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved) { //校验特价申请单是否已审核 SOValidateExtend.ValidateSOSalePriceForApproved(so.ID); //创建调价单 if (adjustPriceList.Count > 0) { PubHelperExtend.CreateAdjustPrice(adjustPriceList); } //销售订单类型为标准订单、预告订单/客户备库、巨星自备、汇总订单时,并且业务类型是普通订单,审核时产生供应计划 if ((so.DocType.Code == "SO1" || so.DocType.Code == "SO2" || so.DocType.Code == "SO3" || so.DocType.Code == "SO4") && so.DescFlexField.PrivateDescSeg2 == "03") { PubHelperExtend.CreateSupplyPlan(so);//创建供应计划 } } //弃审 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open) { SOValidateExtend.ValidateSOSupply(so.DocNo); SOValidateExtend.ValidateSOPrice(so.ID); } #endregion }
/// <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; }
/// <summary> /// 创建订单费用,如果销售订单+费用项目编码不存在,则创建,否则更新费用金额 /// </summary> /// <param name="feeEntity"></param> /// <param name="feeMoney"></param> /// <param name="so"></param> private static void CreateSOFeeEntity(UFIDA.U9.CBO.SCM.Item.ItemCategory feeEntity, decimal feeMoney, UFIDA.U9.SM.SO.SO so) { using (ISession session = Session.Open()) { UFIDA.U9.Cust.GS.FT.OrderCostBE.OrderCost entity = UFIDA.U9.Cust.GS.FT.OrderCostBE.OrderCost.Finder.Find("SellOrderID=@SO and CostItem.Code=@Code", new OqlParam("SO", so.ID), new OqlParam("Code", feeEntity.Code)); if (entity == null) { entity = UFIDA.U9.Cust.GS.FT.OrderCostBE.OrderCost.Create(); } entity.SellOrderID = so.ID; entity.SellOrderRowNo = so.DocNo; entity.CostItem = feeEntity; entity.CostMonery = feeMoney; entity.FeeCurrency = GetCurrency(feeEntity.DescFlexField.PrivateDescSeg1); session.Commit(); } }
/// <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; }