jianghaiqing 4 months ago
commit 1692ed8999

@ -33,6 +33,11 @@ public static class MultiLanguageConst
[Description("查询成功")]
public const string DataQuerySuccess = "Data_Query_Success";
/// <summary>
/// 查询无数据
/// </summary>
[Description("查询无数据")]
public const string DataQueryNoData = "Data_Query_NoData";
/// <summary>
/// 新增成功
/// </summary>
[Description("新增成功")]
@ -424,6 +429,9 @@ public static class MultiLanguageConst
[Description("用户邮箱设置不存在")]
public const string UserEmailNotExist = "UserEmail_Not_Exist";
[Description("未配置个人邮箱账号")]
public const string UserEmailNotSet = "UserEmail_Not_Set";
[Description("列表字段设置已存在")]
public const string ColumnSetExist = "Column_Set_Exist";
[Description("表单复制字段设置已存在")]

@ -14,5 +14,15 @@
/// 租户Id
/// </summary>
public const string TenantId = "TenantId";
/// <summary>
/// BC文件
/// </summary>
public const string BCFile = "BCFile";
/// <summary>
/// BC修改文件
/// </summary>
public const string AmendmentFile = "AmendmentFile";
}
}

@ -5,12 +5,12 @@
/// </summary>
public class TaskFlowDataContext
{
private readonly Dictionary<string, object> dataContext = new();
private readonly Dictionary<string, object?> dataContext = new();
/// <summary>
///
/// </summary>
public TaskFlowDataContext(string key, object value)
public TaskFlowDataContext(string key, object? value)
{
dataContext.Add(key, value);
}
@ -18,7 +18,7 @@
/// <summary>
///
/// </summary>
public TaskFlowDataContext(params (string key, object value)[] keyValues)
public TaskFlowDataContext(params (string key, object? value)[] keyValues)
{
foreach (var item in keyValues)
{
@ -29,7 +29,7 @@
/// <summary>
///
/// </summary>
public void Set(string key, object value)
public void Set(string key, object? value)
{
if (ContainsKey(key))
{

@ -46,10 +46,7 @@ namespace DS.Module.Core.Filters
&& x.ApiSecret == secret
&& x.ApiCode == apiUser.ApiCode
&& x.IsDisable == false).First();
var sql = db.Queryable<SysApiAuth>().Where(x => x.ApiKey == key
&& x.ApiSecret == secret
&& x.ApiCode == apiUser.ApiCode
&& x.IsDisable == false).ToSqlString();
if (auth != null && (!auth.ExpireDate.HasValue || auth.ExpireDate > DateTime.Now))
{
//var tenant = db.Queryable<SysTenant>().First(x => x.Id == auth.TenantId);

@ -58,6 +58,10 @@ namespace DS.WMS.Core.Code.Dtos
/// 发件SSL
/// </summary>
public bool? SmtpSSL { get; set; } = false;
/// <summary>
/// 是否为公司账号
/// </summary>
public bool IsCompany { get; set; } = false;
/// <summary>
/// 状态 0启用 1禁用

@ -60,5 +60,10 @@ namespace DS.WMS.Core.Code.Dtos
/// 状态 0启用 1禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 是否为公司账号
/// </summary>
public bool IsCompany { get; set; } = false;
}
}

@ -71,5 +71,11 @@ namespace DS.WMS.Core.Code.Entity
/// </summary>
[SugarColumn(ColumnDescription = "状态", DefaultValue = "0")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 是否为公司账号
/// </summary>
[SugarColumn(ColumnDescription = "是否为公司账号", DefaultValue = "0")]
public bool IsCompany { get; set; } = false;
}
}

@ -46,4 +46,11 @@ public interface IUserEmailService
/// <param name="req"></param>
/// <returns></returns>
public DataResult BatchDelUserEmail(IdModel req);
/// <summary>
/// 获取用户邮箱配置
/// </summary>
/// <returns></returns>
public Task<DataResult<CodeUserEmailRes>> GetUserEmailSetInfo();
}

@ -125,4 +125,32 @@ public class CodeUserEmailService : IUserEmailService
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
/// <summary>
/// 获取用户邮箱配置
/// </summary>
/// <returns></returns>
public async Task<DataResult<CodeUserEmailRes>> GetUserEmailSetInfo()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = await tenantDb.Queryable<CodeUserEmail>()
.Where(a => a.IsCompany == false && a.CreateBy == long.Parse(user.UserId))
.Select<CodeUserEmailRes>()
.FirstAsync();
if (data == null)
{
data = await tenantDb.Queryable<CodeThirdParty>()
.Where(a => a.IsCompany == true)
.Select<CodeUserEmailRes>()
.FirstAsync();
}
if (data == null)
return DataResult<CodeUserEmailRes>.Failed("未配置个人邮箱账号", MultiLanguageConst.UserEmailNotSet);
return DataResult<CodeUserEmailRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
}

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.DjyServiceStatus;
using DS.WMS.Core.Op.Dtos;
using Microsoft.AspNetCore.Http;
@ -24,6 +25,12 @@ namespace DS.WMS.Core.Op.Interface
/// <returns></returns>
Task<DataResult<long>> ApiReceive(string jsonData, IFormFile file = null, IFormFile modifyFile = null);
/// <summary>
/// 舱位接收保存、取消接口(任务台使用)
/// </summary>
Task<DataResult<long>> ApiReceiveTask(TaskFlowDataContext dataContext);
/// <summary>
/// 获取舱位详情
/// </summary>

@ -48,6 +48,8 @@ using DS.WMS.Core.Code.Method;
using DS.WMS.Core.Map.Method;
using DS.Module.Core.Extensions;
using DS.Module.Core.Constants;
using DS.Module.Core.Data;
using DS.WMS.Core.TaskPlat.Dtos;
namespace DS.WMS.Core.Op.Method
{
@ -125,6 +127,7 @@ namespace DS.WMS.Core.Op.Method
_codeCtnService = _serviceProvider.GetRequiredService<ICodeCtnService>();
_codePortService = _serviceProvider.GetRequiredService<ICodePortService>();
_mappingPortService = _serviceProvider.GetRequiredService<IMappingPortService>();
_mappingCarrierService = _serviceProvider.GetRequiredService<IMappingCarrierService>();
_codeCountryService = _serviceProvider.GetRequiredService<ICodeCountryService>();
bcCompareUrl = AppSetting.app(new string[] { "BCCompare", "Url" });
@ -189,7 +192,7 @@ namespace DS.WMS.Core.Op.Method
var delCtnList = tenantDb.Queryable<BookingSlotCtn>().Where(x => x.SlotId == model.Id).ToList();
if(delCtnList.Count > 0)
if (delCtnList.Count > 0)
await tenantDb.Deleteable<BookingSlotCtn>(delCtnList).ExecuteCommandAsync();
if (input.CtnList != null)
@ -554,7 +557,7 @@ namespace DS.WMS.Core.Op.Method
{
Logger.Log(NLog.LogLevel.Error, $"自动生成舱位标签失败,原因:{e.Message}");
return DataResult<string>.Failed(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotSlotBookingNoExists)),e.Message));
return DataResult<string>.Failed(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotSlotBookingNoExists)), e.Message));
}
return DataResult<string>.Success(string.Empty);
@ -800,6 +803,118 @@ namespace DS.WMS.Core.Op.Method
return DataResult<long>.Success(id);
}
/// <summary>
/// 舱位接收保存、取消接口(任务台使用)
/// </summary>
public async Task<DataResult<long>> ApiReceiveTask(TaskFlowDataContext dataContext)
{
var a = user.UserId;
var b = user.UserName;
var c = user.TenantId;
var messageInfo = dataContext.Get<TaskManageOrderMessageInfo>(TaskFlowDataNameConst.TaskManageOrderMessageInfo);
if (messageInfo == null)
{
throw new ArgumentNullException($"缺少参数:{TaskFlowDataNameConst.TaskManageOrderMessageInfo}");
}
DynameFileInfo bcFileInfo = null;
DynameFileInfo bcNoticeFileInfo = null;
var bcfile = dataContext.Get<IFormFile>(TaskFlowDataNameConst.BCFile);
if (bcfile != null)
{
bcFileInfo = new DynameFileInfo
{
FileBytes = bcfile.ToByteArray(),
FileName = bcfile.FileName
};
}
var bcNoticeFile = dataContext.Get<IFormFile>(TaskFlowDataNameConst.AmendmentFile);
if (bcNoticeFile != null)
{
bcNoticeFileInfo = new DynameFileInfo
{
FileBytes = bcNoticeFile.ToByteArray(),
FileName = bcNoticeFile.FileName
};
}
var taskBCInfoDto = messageInfo.Main.BCInfo;
var allMapCarrierList = await _mappingCarrierService.GetAllList();
MappingCarrierRes? carrierInfo = null;
if (allMapCarrierList.Succeeded)
{
//carrierInfo = allMapCarrierList.Data.FirstOrDefault(t => t.LinkId == taskBCInfoDto.CarrierId && t.Module == CONST_MAPPING_CARRIER_MODULE);
carrierInfo = allMapCarrierList.Data.Where(t => t.MapCode.Equals(taskBCInfoDto.CarrierId, StringComparison.OrdinalIgnoreCase) && t.Module == CONST_MAPPING_CARRIER_MODULE).FirstOrDefault();
}
BookingSlotBaseApiDto slotModel = new BookingSlotBaseApiDto
{
DataObj = new BookingSlotBaseApiSaveDto
{
CarrierId = carrierInfo?.LinkId,
CarrierCode = carrierInfo?.Code,
SlotBookingNo = taskBCInfoDto.MBLNo,
BookingParty = taskBCInfoDto.BookingParty,
BookingSlotType = taskBCInfoDto.BookingSlotType,
BookingSlotTypeName = taskBCInfoDto.BookingSlotTypeName,
Vessel = taskBCInfoDto.Vessel,
Voyno = taskBCInfoDto.VoyNo,
VGMSubmissionCutDate = taskBCInfoDto.VGMCutoffTime,
//WeekAt = taskBCInfoDto.WeekAt,
CarriageType = taskBCInfoDto.CarriageType,
CarriageTypeName = taskBCInfoDto.CarriageTypeName,
ContractNo = taskBCInfoDto.ContractNo,
CtnStat = taskBCInfoDto.CtnStat,
CYCutDate = taskBCInfoDto.CYCutoffTime,
DetensionFreeDays = taskBCInfoDto.DetensionFreeDays,
ETD = taskBCInfoDto.ETD,
ETA = taskBCInfoDto.ETA,
LaneCode = taskBCInfoDto.LaneCode,
LaneName = taskBCInfoDto.LaneName,
ManifestCutDate = taskBCInfoDto.ManifestCutDate,
MDGFCutDate = taskBCInfoDto.MDGFCutDate,
PlaceDelivery = taskBCInfoDto.PlaceDelivery,
PlaceReceipt = taskBCInfoDto.PlaceReceipt,
PortDischarge = taskBCInfoDto.PortDischarge,
PortLoad = taskBCInfoDto.Portload,
SICutDate = taskBCInfoDto.SICutDate,
//CustomSICutDate = taskBCInfoDto.CustomSICutDate,
TransferPort1 = taskBCInfoDto.TransferPort1,
TransferPort2 = taskBCInfoDto.TransferPort2,
PriceCalculationDate = taskBCInfoDto.PriceCalculationDate,
CtnList = new List<BookingSlotCtnSaveInput>()
},
OpType = "add"
};
if (int.TryParse(taskBCInfoDto.WeekAt, out int week))
{
slotModel.DataObj.WeekAt = week;
}
if (taskBCInfoDto.CtnList.Count > 0)
{
taskBCInfoDto.CtnList.ForEach(t =>
{
BookingSlotCtnSaveInput ctn = new BookingSlotCtnSaveInput
{
CtnAll = t.CtnALL,
CtnNum = t.CTNNUM.HasValue ? t.CTNNUM.Value : 1
};
slotModel.DataObj.CtnList.Add(ctn);
});
}
var rlt = await InnerApiReceive(slotModel, bcFileInfo, bcNoticeFileInfo);
return rlt;
}
#endregion
#region 舱位接收保存、取消接口(内部接口)
@ -816,6 +931,8 @@ namespace DS.WMS.Core.Op.Method
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var slotBase = await tenantDb.Queryable<BookingSlotBase>().Where(x => x.Id == 1814212362220212224).ToListAsync();
//接口方法直接调用save、delete等方法会报错可能因为非token授权登录导致故重写一遍保存、删除代码
if (dto.OpType == "add" || dto.OpType == "update" || dto.OpType == "del" || dto.OpType == "cancellation")
{
@ -957,7 +1074,7 @@ namespace DS.WMS.Core.Op.Method
{
var allCountryCodeList = await _codeCountryService.GetAllList();
if(allCountryCodeList.Succeeded)
if (allCountryCodeList.Succeeded)
{
var countryInfo = allCountryCodeList.Data.FirstOrDefault(p => p.Id == portInfo.Data.CountryId);
@ -975,7 +1092,7 @@ namespace DS.WMS.Core.Op.Method
}
else
{
Logger.Log(NLog.LogLevel.Info, $"交货地分割后得到的城市名称为空,订舱编号:{ dto.DataObj.SlotBookingNo}");
Logger.Log(NLog.LogLevel.Info, $"交货地分割后得到的城市名称为空,订舱编号:{dto.DataObj.SlotBookingNo}");
}
}
else
@ -1314,7 +1431,7 @@ namespace DS.WMS.Core.Op.Method
}
if(id == 0)
if (id == 0)
return DataResult<long>.FailedData(id);
return DataResult<long>.Success(id);
@ -1863,7 +1980,7 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回附件列表</returns>
public async Task<DataResult<List<OpFileRes>>> GetFile(long id)
{
return _opFileService.GetOpFileList(id.ToString()) ;
return _opFileService.GetOpFileList(id.ToString());
}
#endregion
@ -1977,7 +2094,7 @@ namespace DS.WMS.Core.Op.Method
if (model.CustomerContactList != null && model.CustomerContactList.Count > 0)
{
//取委托客户下面所有的联系人列表
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = model.CustomerId.Value,IsController = true }).GetAwaiter().GetResult().Data;
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = model.CustomerId.Value, IsController = true }).GetAwaiter().GetResult().Data;
if (djyCustomerInfo == null)
{
@ -2073,7 +2190,7 @@ namespace DS.WMS.Core.Op.Method
InnerVoyno = bookingSlotBase.Voyno?.ToUpper()?.Trim(),
ETD = bookingSlotBase.ETD,
ETA = bookingSlotBase.ETA,
SaleId = generateModel.SaleId.HasValue? generateModel.SaleId.Value:0,
SaleId = generateModel.SaleId.HasValue ? generateModel.SaleId.Value : 0,
Sale = generateModel.SaleName,
OperatorId = generateModel.OpId.HasValue ? generateModel.OpId.Value : 0,
//op = generateModel.OpName,
@ -2092,7 +2209,7 @@ namespace DS.WMS.Core.Op.Method
//CUSTSERVICE = generateModel.CustServiceName,
LoadPort = bookingSlotBase.PortLoad,
LoadPortId = bookingSlotBase.PortLoadId.HasValue? bookingSlotBase.PortLoadId.Value:0,
LoadPortId = bookingSlotBase.PortLoadId.HasValue ? bookingSlotBase.PortLoadId.Value : 0,
DischargePortId = bookingSlotBase.PortDischargeId.HasValue ? bookingSlotBase.PortLoadId.Value : 0,
DischargePort = bookingSlotBase.PortDischarge,
@ -2239,7 +2356,8 @@ namespace DS.WMS.Core.Op.Method
if (id > 0)
{
////对应订舱和舱位关系
var allocRlt = await ImportSlots(new ImportSlotsDto {
var allocRlt = await ImportSlots(new ImportSlotsDto
{
slots = importSlots,
bookingOrderId = id,
isCheck = false,
@ -2512,7 +2630,7 @@ namespace DS.WMS.Core.Op.Method
await _bookingSlotStockService.BookingSlotStock(new BookingSlotStockUpdateModel
{
BookingSlotType = latestSlot.BookingSlotType,
CarrierId = latestSlot.CarrierId.HasValue? latestSlot.CarrierId.Value:0,
CarrierId = latestSlot.CarrierId.HasValue ? latestSlot.CarrierId.Value : 0,
ContractNo = latestSlot.ContractNo,
Vessel = latestSlot.Vessel,
Voyno = latestSlot.Voyno,

@ -2244,11 +2244,12 @@ namespace DS.WMS.Core.Op.Method
throw new ArgumentNullException($"提单号为空");
}
var tenantId = dataContext.Get<long>(TaskFlowDataNameConst.TenantId);
if (tenantId == 0)
{
throw new ArgumentNullException($"缺少参数:TenantId");
}
var tenantId = long.Parse(user.TenantId);
//var tenantId = dataContext.Get<long>(TaskFlowDataNameConst.TenantId);
//if (tenantId == 0)
//{
// throw new ArgumentNullException($"缺少参数:TenantId");
//}
string type = messageInfo.Main.TaskType switch
{

@ -14,6 +14,7 @@ namespace DS.WMS.Core.Sys.Interface;
/// </summary>
public interface IClientCommonService
{
/// <summary>
/// 根据类型获取用户下拉列表
/// </summary>

@ -43,6 +43,7 @@ public class ClientCommonService : IClientCommonService
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
/// 根据类型获取用户下拉列表
/// </summary>

@ -24,10 +24,10 @@ namespace DS.WMS.Core.TaskPlat.Entity
public string? TaskType { get; set; }
/// <summary>
/// 所在命名空间
/// Assembly名称
/// </summary>
[SugarColumn(ColumnDescription = "所在命名空间", IsNullable = true, Length = 255)]
public string? NameSpace { get; set; }
[SugarColumn(ColumnDescription = "Assembly名称", IsNullable = true, Length = 255)]
public string? AssemblyName { get; set; }
/// <summary>
/// Interface名称

@ -24,27 +24,31 @@ namespace DS.WMS.Core.TaskPlat.Method
private readonly ISaasDbService saasDbService;
private readonly IServiceProvider serviceProvider;
private readonly IWebHostEnvironment environment;
//private readonly ICodeCtnService _codeCtnService;
public TaskManageService(ILogger<TaskManageService> logger,
ISaasDbService saasDbService,
IServiceProvider serviceProvider,
IUser user,
IWebHostEnvironment environment)
IWebHostEnvironment environment
//ICodeCtnService codeCtnService
)
{
_logger = logger;
this.saasDbService = saasDbService;
this.serviceProvider = serviceProvider;
this.user = user;
this.environment = environment;
//_codeCtnService = codeCtnService;
}
public async Task<DataResult> InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null)
{
string batchNo = Guid.NewGuid().ToString();
var a = user.UserId;
var b = user.UserName;
var c = user.TenantId;
var d = user.OrgId;
//var a = user.UserId;
//var b = user.UserName;
//var c = user.TenantId;
//var d = user.OrgId;
try
{
_logger.LogInformation("批次={no} 接收到创建任务报文 报文={msg}", batchNo, JsonConvert.SerializeObject(info));
@ -438,6 +442,68 @@ namespace DS.WMS.Core.TaskPlat.Method
}
#endregion
#region SI反馈入库
//SI反馈入库
//if (info.Main.TaskType == TaskBaseTypeEnum.SI_FEEDBACK)
//{
// if (info.Main.SIFeedBack == null)
// throw new Exception($"任务类型={info.Main.TaskType.ToString()} SIFeedBack信息必传");
// TaskSiSubmitted taskSISubmitted = info.Main.SIFeedBack.Adapt<TaskSiSubmitted>();
// taskSISubmitted.Id = SnowFlakeSingle.Instance.NextId();
// taskSISubmitted.TASK_ID = taskInfo.Id;
// taskSISubmitted.CreateTime = taskInfo.CreateTime;
// taskSISubmitted.CreateBy = taskInfo.CreateBy;
// await tenantDb.Insertable(taskSISubmitted).ExecuteCommandAsync();
// //SI反馈箱信息入库
// if (info.Main.SIFeedBack.ContaList != null && info.Main.SIFeedBack.ContaList.Count > 0)
// {
// var codeCtnCache = (await _codeCtnService.GetAllList())?.Data ?? new List<Code.Dtos.CodeCtnRes>();
// info.Main.SIFeedBack.ContaList.ForEach(ctn =>
// {
// var contaInfo = ctn.Adapt<TaskSiSubmittedCtn>();
// //contaInfo.PK_ID = IDGen.NextID().ToString();
// //contaInfo.P_PKID = taskSISubmitted.PK_ID;
// //contaInfo.CreatedTime = taskInfo.CreatedTime;
// //contaInfo.UpdatedTime = taskInfo.CreatedTime;
// //contaInfo.CreatedUserId = taskInfo.CreatedUserId;
// //contaInfo.CreatedUserName = taskInfo.CreatedUserName;
// //contaInfo.TenantId = taskInfo.TenantId;
// //contaInfo.TenantName = taskInfo.TenantName;
// //if (string.IsNullOrWhiteSpace(contaInfo.CTNCODE) && !string.IsNullOrWhiteSpace(contaInfo.CTNALL))
// //{
// // if (ediCtnList != null && ediCtnList.Count > 0)
// // {
// // var ctnCodeInfo = ediCtnList.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.Name)
// // && x.Name.Equals(contaInfo.CTNALL, StringComparison.OrdinalIgnoreCase));
// // if (ctnCodeInfo != null)
// // {
// // contaInfo.CTNCODE = ctnCodeInfo.Code;
// // }
// // }
// //}
// //_taskSISubmittedCtnRepository.Insert(contaInfo);
// });
// }
// var siService = _namedtaskSISubmittedServiceProvider
// .GetService<ITransient>(nameof(TaskManageSISubmittedService));
// await siService.ProcessSISubmitted(taskSISubmitted.TASK_ID);
//}
#endregion
#region BC 任务
if (info.Main.TaskType == TaskBaseTypeEnum.BC
@ -482,27 +548,28 @@ namespace DS.WMS.Core.TaskPlat.Method
2@
*/
//(TaskFlowDataNameConst.TenantId, long.Parse(user.TenantId)),
// 执行自动化操作
TaskFlowDataContext dataContext = new(
(TaskFlowDataNameConst.TaskManageOrderMessageInfo, info),
(TaskFlowDataNameConst.TenantId, long.Parse(user.TenantId))
(TaskFlowDataNameConst.BCFile, file),
(TaskFlowDataNameConst.AmendmentFile, modifyFile)
);
TaskFlowRuner taskFlow = new TaskFlowRuner(tenantDb, serviceProvider);
await taskFlow.Run(info.Main.TaskType, taskInfo.Id, dataContext);
if (info.Main.TaskType == TaskBaseTypeEnum.BC)
{
}
else if (info.Main.TaskType == TaskBaseTypeEnum.CANCELLATION)
{
}
else if (info.Main.TaskType == TaskBaseTypeEnum.BC_MODIFY)
{
}
//if (info.Main.TaskType == TaskBaseTypeEnum.BC)
//{
//}
//else if (info.Main.TaskType == TaskBaseTypeEnum.CANCELLATION)
//{
//}
//else if (info.Main.TaskType == TaskBaseTypeEnum.BC_MODIFY)
//{
//}
}
#endregion
@ -566,7 +633,7 @@ namespace DS.WMS.Core.TaskPlat.Method
string? dirAbs;
if (string.IsNullOrEmpty(basePath))
{
dirAbs = Path.Combine(environment.WebRootPath, relativePath);
dirAbs = Path.Combine(environment.WebRootPath ?? "", relativePath);
}
else
{

@ -207,20 +207,20 @@ namespace DS.WMS.Core.TaskPlat
throw new Exception($"未找到指定流程配置ExecuteModuleId{configItem.ExecuteModuleId}");
}
Assembly assembly;
if (module.NameSpace!.StartsWith("DS.WMS.Core"))
if (module.AssemblyName!.StartsWith("DS.WMS.Core"))
{
//assembly = Assembly.GetEntryAssembly()!;
assembly = Assembly.GetExecutingAssembly();
}
else
{
assembly = Assembly.Load(module.NameSpace!);
assembly = Assembly.Load(module.AssemblyName!);
}
//var interfaceType2 = assembly.GetType(module.InterfaceName!);
var interfaceType = assembly.DefinedTypes.FirstOrDefault(x => x.Name == module.InterfaceName!);
if (interfaceType == null)
{
throw new Exception($"在命名空间【{module.NameSpace}】下未找到Interface【{module.InterfaceName}】");
throw new Exception($"在程序集【{module.AssemblyName}】下未找到Interface【{module.InterfaceName}】");
}
object? imp = serviceProvider.GetService(interfaceType);
if (imp == null)
@ -257,6 +257,13 @@ namespace DS.WMS.Core.TaskPlat
flowLog.IsSuccess = false;
}
}
else if (resultTemp is Task result3)
{
if (result3.Exception != null && result3.IsFaulted)
{
throw result3.Exception;
}
}
stopwatch.Stop();
flowLogDetail.ElapsedMillisecond = stopwatch.ElapsedMilliseconds;
flowLogDetail.IsComplete = true;

@ -75,4 +75,17 @@ public class UserEmailController : ApiController
var res = _invokeService.BatchDelUserEmail(req);
return res;
}
/// <summary>
/// 获取用户邮箱配置
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetUserEmailSetInfo")]
public async Task<DataResult<CodeUserEmailRes>> GetUserEmailSetInfo()
{
var res = await _invokeService.GetUserEmailSetInfo();
return res;
}
}

@ -23,7 +23,7 @@ namespace DS.WMS.PrintApi.Controllers
}
/// <summary>
/// 获取Json打印信息
/// 根据模板Id获取Json打印信息
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
@ -35,5 +35,19 @@ namespace DS.WMS.PrintApi.Controllers
var res = await _invokeService.GetOpenJsonPrintInfo(req);
return res;
}
/// <summary>
/// 根据模板Code获取Json打印信息
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
[Route("GetOpenJsonPrintInfoByTemplateCode")]
public async Task<PrintDataResult> GetOpenJsonPrintInfoByTemplateCode([FromBody] OpenJsonPrintByCodeReq req)
{
var res = await _invokeService.GetOpenJsonPrintInfoByTemplateCode(req);
return res;
}
}
}

@ -0,0 +1,28 @@
namespace DS.WMS.PrintApi.Model
{
/// <summary>
/// Json打印请求数据
/// </summary>
public class OpenJsonPrintByCodeReq
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 模板Code
/// </summary>
public string Code { get; set; }
/// <summary>
/// Json数据
/// </summary>
public string JsonDataStr { get; set; }
/// <summary>
/// 打印类型 1. PDF 2.EXCEL 2.WORD
/// </summary>
public string PrintType { get; set; }
}
}

@ -20,6 +20,11 @@ namespace DS.WMS.PrintApi.Model
/// </summary>
public long ModuleId { get; set; }
/// <summary>
///打印模板唯一编码
/// </summary>
[Description("打印模板唯一编码")]
public string TemplateCode { get; set; }
/// <summary>
///打印模板名称
/// </summary>
[Description("打印模板名称")]

@ -11,5 +11,13 @@ namespace DS.WMS.PrintApi.Service
/// <param name="req"></param>
/// <returns></returns>
public Task<PrintDataResult> GetOpenJsonPrintInfo(OpenJsonPrintReq req);
/// <summary>
/// 根据打印模板代码获取Json打印信息
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public Task<PrintDataResult> GetOpenJsonPrintInfoByTemplateCode(OpenJsonPrintByCodeReq req);
}
}

@ -97,5 +97,91 @@ namespace DS.WMS.PrintApi.Service
return await Task.FromResult(PrintDataResult.Failed(ex.Message));
}
}
public async Task<PrintDataResult> GetOpenJsonPrintInfoByTemplateCode(OpenJsonPrintByCodeReq req)
{
try
{
using (var db = SqlSugarUtil.GetInstance())
{
var template = db.Queryable<SysPrintTemplate>().Filter(null, true).Where(x => x.TemplateCode == req.Code && x.TenantId == req.TenantId).First();
if (template == null)
{
return await Task.FromResult(PrintDataResult.Failed("打印模板编码:["+ req.Code+"]的打印格式不存在!"));
}
if (template.IsUseDataSource)
{
return await Task.FromResult(PrintDataResult.Failed("非Json打印接口!"));
}
try
{
var basePath = String.Empty;
var savePath = "wwwroot/PrintTempFile";
var fileName = DateTime.Now.Ticks;
var printFileName = $"{fileName}.frx";
var printFile = Path.Combine(savePath, printFileName);
//写入CRX文件
using (FileStream fs = new FileStream(printFile, FileMode.Create))
{
Byte[] info = new UTF8Encoding(true).GetBytes(template.PrintJsonContent);
fs.Write(info, 0, info.Length);
}
//生成报表
FastReport.Report report = new FastReport.Report();
report.Load(printFile);
var dataSource = report.Dictionary.Connections[0] as JsonDataSourceConnection;
var str = new FastReport.Data.JsonConnection.JsonDataSourceConnectionStringBuilder();
str.Json = req.JsonDataStr;
dataSource.ConnectionString = str.ConnectionString;
report.Prepare();
var printName = string.Empty;
var saveFile = string.Empty;
//var saveFile = Path.Combine(savePath, printName);
if (req.PrintType == "1")
{
printName = $"{fileName}.pdf";
saveFile = Path.Combine(savePath, printName);
PDFExport pdfExport = new PDFExport();
pdfExport.Export(report, saveFile);
}
else if (req.PrintType == "2")
{
printName = $"{fileName}.xlsx";
saveFile = Path.Combine(savePath, printName);
Excel2007Export excelExport = new Excel2007Export();
excelExport.Export(report, saveFile);
}
else if (req.PrintType == "3")
{
printName = $"{fileName}.doc";
saveFile = Path.Combine(savePath, printName);
Word2007Export wordExport = new Word2007Export();
wordExport.Export(report, saveFile);
}
else
{
return await Task.FromResult(PrintDataResult.Failed("非法打印格式!"));
}
return await Task.FromResult(PrintDataResult.OK(printName));
}
catch (Exception e)
{
return await Task.FromResult(PrintDataResult.Failed(e.Message));
}
}
}
catch (Exception ex)
{
//Logger.Warn(ex, "方法: GetOpenJsonPrintInfo");
return await Task.FromResult(PrintDataResult.Failed(ex.Message));
}
}
}
}

@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\DS.Module.AutofacModule\DS.Module.AutofacModule.csproj" />
<ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" />
<ProjectReference Include="..\DS.Module.DjyRulesEngine\DS.Module.DjyRulesEngine.csproj" />
<ProjectReference Include="..\DS.Module.ExcelModule\DS.Module.ExcelModule.csproj" />
<ProjectReference Include="..\DS.Module.Jwt\DS.Module.Jwt.csproj" />
<ProjectReference Include="..\DS.Module.MultiLanguage\DS.Module.MultiLanguage.csproj" />

@ -15,6 +15,7 @@ using NLog.Web;
using Swashbuckle.AspNetCore.SwaggerUI;
using DS.Module.PrintModule;
using DS.Module.DjyRulesEngine;
using DS.Module.RedisModule;
var builder = WebApplication.CreateBuilder(args);
var environment = builder.Environment.EnvironmentName;
@ -42,7 +43,8 @@ builder.Services.AddJwtInstall();
builder.Services.AddSaasDbInstall();//分库服务
builder.Services.AddMultiLanguageInstall();//多语言服务
builder.Services.AddDjyModuleInstall();//Djy服务
//builder.Services.AddRuleEngineModuleInstall();//Djy¹æÔòÒýÇæУÑé·þÎñ
builder.Services.AddRuleEngineModuleInstall();//Djy¹æÔòÒýÇæУÑé·þÎñ
builder.Services.AddRedisModuleInstall();//redis
// builder.Services.AddEndpointsApiExplorer();
// builder.Services.AddSwaggerGen();

@ -241,12 +241,12 @@ public class SaasTest
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持
//var ass = Assembly.Load("DS.WMS.Core");
//var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.TaskPlat.Entity") == true).ToArray();
//tenantDb.CodeFirst.InitTables(types);
var ass = Assembly.Load("DS.WMS.Core");
var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.TaskPlat.Entity") == true).ToArray();
tenantDb.CodeFirst.InitTables(types);
tenantDb.CodeFirst.InitTables(typeof(TaskFlowLog));
tenantDb.CodeFirst.InitTables(typeof(TaskFlowLogDetail));
//tenantDb.CodeFirst.InitTables(typeof(TaskFlowLog));
//tenantDb.CodeFirst.InitTables(typeof(TaskFlowLogDetail));
Assert.True(true);
}
}
Loading…
Cancel
Save