|
|
|
@ -78,7 +78,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
BusinessType = bsType
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (taskMail.Provider == null)
|
|
|
|
|
if (taskMail.Type == DataProviderType.Default)
|
|
|
|
|
{
|
|
|
|
|
actionManager ??= ServiceProvider.GetRequiredService<IActionManagerService>();
|
|
|
|
|
model.Primary = await actionManager.GetBusinessDataAsync(bsId, bsType.GetValueOrDefault());
|
|
|
|
@ -86,19 +86,35 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
IDataProvider? dataProvider = null;
|
|
|
|
|
switch (taskMail.Provider.Type)
|
|
|
|
|
BusinessDataProvider? provider1 = null;
|
|
|
|
|
switch (taskMail.Type)
|
|
|
|
|
{
|
|
|
|
|
case DataProviderType.Custom:
|
|
|
|
|
if (string.IsNullOrEmpty(taskMail.Provider.TypeName))
|
|
|
|
|
if (taskMail.ProviderId == null)
|
|
|
|
|
return model;
|
|
|
|
|
|
|
|
|
|
var type = Type.GetType(taskMail.Provider.TypeName, true);
|
|
|
|
|
provider1 = await TenantDb.Queryable<BusinessDataProvider>().Where(x => x.Id == taskMail.ProviderId)
|
|
|
|
|
.Select(x => new BusinessDataProvider
|
|
|
|
|
{
|
|
|
|
|
TypeName = x.TypeName,
|
|
|
|
|
Content = x.Content
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
var type = Type.GetType(provider1.TypeName, true);
|
|
|
|
|
dataProvider = ConstructorExtensions.CreateInstance(type, [ServiceProvider]) as IDataProvider;
|
|
|
|
|
dataProvider ??= ConstructorExtensions.CreateInstance(type) as IDataProvider;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DataProviderType.Fixed:
|
|
|
|
|
model.Primary = JsonConvert.DeserializeObject<dynamic>(taskMail.Content!);
|
|
|
|
|
if (taskMail.ProviderId == null)
|
|
|
|
|
return model;
|
|
|
|
|
|
|
|
|
|
provider1 = await TenantDb.Queryable<BusinessDataProvider>().Where(x => x.Id == taskMail.ProviderId)
|
|
|
|
|
.Select(x => new BusinessDataProvider
|
|
|
|
|
{
|
|
|
|
|
TypeName = x.TypeName,
|
|
|
|
|
Content = x.Content
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
model.Primary = JsonConvert.DeserializeObject<dynamic>(provider1.Content);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DataProviderType.Database:
|
|
|
|
@ -106,7 +122,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DataProviderType.Network:
|
|
|
|
|
|
|
|
|
|
dataProvider = new DefaultNetworkProvider(ServiceProvider);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -117,7 +133,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
ServiceProvider = ServiceProvider,
|
|
|
|
|
BusinessId = bsId,
|
|
|
|
|
BusinessType = bsType,
|
|
|
|
|
Content = taskMail.Content,
|
|
|
|
|
Content = provider1.Content,
|
|
|
|
|
};
|
|
|
|
|
await dataProvider.FetchDataAsync(context);
|
|
|
|
|
model.Primary = context.Data;
|
|
|
|
@ -367,12 +383,14 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
|
|
|
|
|
long tenantId = long.Parse(User.TenantId);
|
|
|
|
|
string requestUrl = config["TaskMail:FileBaseUrl"] + config["TaskMail:SQLPrint"];
|
|
|
|
|
object? obj = templateModel.GetPropertyValue(nameof(MailTemplateModel.Primary), Flags.InstancePublic);
|
|
|
|
|
string json = JsonConvert.SerializeObject(obj ??= new { Id = templateModel.BusinessId });
|
|
|
|
|
|
|
|
|
|
foreach (var item in mailConfig.Attachments)
|
|
|
|
|
{
|
|
|
|
|
object? obj = templateModel.GetPropertyValue(nameof(MailTemplateModel.Primary), Flags.InstancePublic);
|
|
|
|
|
var req = new OpenPrintReq
|
|
|
|
|
{
|
|
|
|
|
ParamJsonStr = JsonConvert.SerializeObject(obj),
|
|
|
|
|
ParamJsonStr = json,
|
|
|
|
|
PrintType = ((int)FileFormat.PDF).ToString(),
|
|
|
|
|
TemplateId = item.TemplateId,
|
|
|
|
|
TenantId = tenantId
|
|
|
|
|