using YLErp.DBModels.Consts; namespace YLErp.BLL.GenerateDocument { public class BatchGenerateFactory { public static BatchGenerateDocs GetInstance(IEnumerable tradeIds, int optId, string optName, string contractTypeEnum, string docType = FileTypeEnum.Pdf, List tradeCashIds = null) { string className = ""; switch (contractTypeEnum) { case ContractTypeEnum.Trade: className = "BatchGenerateConfirmBook"; break; case ContractTypeEnum.Clearing: className = "BatchGenerateSettleBill"; break; case ContractTypeEnum.UnWind: className = "BatchGenerateUnwindReport"; break; } var typeFullName = $"YLErp.BLL.GenerateDocument.{PS.Config.CompanyAbbreviation}.{className}"; var type = Type.GetType(typeFullName, false, true); if (type == null) { typeFullName = $"YLErp.BLL.GenerateDocument.General{className}"; type = Type.GetType(typeFullName, false, true); } if (type == null) { throw new ServiceException("此功能暂不支持"); } return Activator.CreateInstance(type, tradeIds, docType, optId, optName, tradeCashIds) as BatchGenerateDocs; } } }