From 2b8131cc44458c28d8d36985a5e7aebeb3f69221 Mon Sep 17 00:00:00 2001 From: cjy Date: Fri, 9 Aug 2024 14:01:15 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BA=8C=E7=B4=9A=E7=B7=A9=E5=AD=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Code/Method/CodeGoodsService.cs | 8 ++--- .../Code/Method/CodePackageService.cs | 12 +++---- .../Code/Method/CodeVesselService.cs | 10 +++--- .../Code/Method/CodeVoynoService.cs | 8 ++--- .../Info/Method/ClientInfoService.cs | 6 ++-- .../Sys/Method/ClientCommonService.cs | 32 +++++++++---------- .../DS.WMS.Core/Sys/Method/CommonService.cs | 2 +- .../DS.WMS.Core/Sys/Method/UserService.cs | 6 ++-- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeGoodsService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeGoodsService.cs index 09d79c58..a574d19a 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodeGoodsService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeGoodsService.cs @@ -103,7 +103,7 @@ public class CodeGoodsService:ICodeGoodsService var data = req.Adapt(); - var entity = tenantDb.Insertable(data).RemoveDataCache(SqlSugarCacheConst.Goods + user.TenantId).ExecuteReturnEntity(); + var entity = tenantDb.Insertable(data).RemoveDataCache($"{SqlSugarCacheConst.Goods}{user.TenantId}").ExecuteReturnEntity(); return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess); } @@ -113,7 +113,7 @@ public class CodeGoodsService:ICodeGoodsService info = req.Adapt(info); - tenantDb.Updateable(info).RemoveDataCache(SqlSugarCacheConst.Goods + user.TenantId).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + tenantDb.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.Goods}{user.TenantId}").IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess); } } @@ -157,7 +157,7 @@ public class CodeGoodsService:ICodeGoodsService return DataResult.Failed("存在已导入的商品!",MultiLanguageConst.CodeGoodsImportAlready); } - tenantDb.Insertable(list).RemoveDataCache(SqlSugarCacheConst.Goods + user.TenantId).ExecuteCommand(); + tenantDb.Insertable(list).RemoveDataCache($"{SqlSugarCacheConst.Goods}{user.TenantId}").ExecuteCommand(); return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess); } @@ -180,7 +180,7 @@ public class CodeGoodsService:ICodeGoodsService var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList(); if (list.Count > 0) { - tenantDb.Deleteable(list).RemoveDataCache(SqlSugarCacheConst.Goods + user.TenantId).ExecuteCommand(); + tenantDb.Deleteable(list).RemoveDataCache($"{SqlSugarCacheConst.Goods}{user.TenantId}").ExecuteCommand(); } return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); } diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodePackageService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodePackageService.cs index 58328bd1..c72592ca 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodePackageService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodePackageService.cs @@ -53,7 +53,7 @@ public class CodePackageService:ICodePackageService var data = req.Adapt(); - var entity = db.Insertable(data).RemoveDataCache(SqlSugarCacheConst.Package + user.TenantId).ExecuteReturnEntity(); + var entity = db.Insertable(data).RemoveDataCache($"{SqlSugarCacheConst.Package}{user.TenantId}").ExecuteReturnEntity(); return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess); } @@ -63,7 +63,7 @@ public class CodePackageService:ICodePackageService info = req.Adapt(info); - db.Updateable(info).RemoveDataCache(SqlSugarCacheConst.Package + user.TenantId).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + db.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.Package}{user.TenantId}").IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess); } } @@ -101,7 +101,7 @@ public class CodePackageService:ICodePackageService var data = req.Adapt(); - var entity = tenantDb.Insertable(data).RemoveDataCache(SqlSugarCacheConst.Package + user.TenantId).ExecuteReturnEntity(); + var entity = tenantDb.Insertable(data).RemoveDataCache($"{SqlSugarCacheConst.Package}{user.TenantId}").ExecuteReturnEntity(); return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess); } @@ -111,7 +111,7 @@ public class CodePackageService:ICodePackageService info = req.Adapt(info); - tenantDb.Updateable(info).RemoveDataCache(SqlSugarCacheConst.Package + user.TenantId).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + tenantDb.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.Package}{user.TenantId}").IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess); } } @@ -154,7 +154,7 @@ public class CodePackageService:ICodePackageService return DataResult.Failed("存在已导入的包装类型!",MultiLanguageConst.CodePackageImportAlready); } - tenantDb.Insertable(list).RemoveDataCache(SqlSugarCacheConst.Package + user.TenantId).ExecuteCommand(); + tenantDb.Insertable(list).RemoveDataCache($"{SqlSugarCacheConst.Package}{user.TenantId}").ExecuteCommand(); return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess); } @@ -176,7 +176,7 @@ public class CodePackageService:ICodePackageService var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList(); if (list.Count > 0) { - tenantDb.Deleteable(list).RemoveDataCache(SqlSugarCacheConst.Package + user.TenantId).ExecuteCommand(); + tenantDb.Deleteable(list).RemoveDataCache($"{SqlSugarCacheConst.Package}{user.TenantId}").ExecuteCommand(); } return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); } diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeVesselService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeVesselService.cs index c78371ff..bf725a02 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodeVesselService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeVesselService.cs @@ -110,7 +110,7 @@ public class CodeVesselService : ICodeVesselService var data = req.Adapt(); - var entity = tenantDb.Insertable(data).RemoveDataCache(SqlSugarCacheConst.Vessel + user.TenantId).ExecuteReturnEntity(); + var entity = tenantDb.Insertable(data).RemoveDataCache($"{SqlSugarCacheConst.Vessel}{user.TenantId}").ExecuteReturnEntity(); _sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeVessel, "DS8").GetAwaiter().GetResult(); @@ -122,7 +122,7 @@ public class CodeVesselService : ICodeVesselService info = req.Adapt(info); - tenantDb.Updateable(info).RemoveDataCache(SqlSugarCacheConst.Vessel + user.TenantId).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + tenantDb.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.Vessel}{user.TenantId}").IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); _sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeVessel, "DS8").GetAwaiter().GetResult(); @@ -168,7 +168,7 @@ public class CodeVesselService : ICodeVesselService return DataResult.Failed("存在已导入的船名信息!", MultiLanguageConst.CodeVesselImportAlready); } - tenantDb.Insertable(list).RemoveDataCache(SqlSugarCacheConst.Vessel + user.TenantId).ExecuteCommand(); + tenantDb.Insertable(list).RemoveDataCache($"{SqlSugarCacheConst.Vessel}{user.TenantId}").ExecuteCommand(); _sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeVessel, "DS8").GetAwaiter().GetResult(); @@ -195,8 +195,8 @@ public class CodeVesselService : ICodeVesselService { var voynos = tenantDb.Queryable().Where(x => req.Ids.Contains(x.VesselId)).ToList(); if (voynos.Count > 0) - tenantDb.Deleteable(voynos).RemoveDataCache(SqlSugarCacheConst.Voyno + user.TenantId).ExecuteCommand(); - tenantDb.Deleteable(list).RemoveDataCache(SqlSugarCacheConst.Vessel + user.TenantId).ExecuteCommand(); + tenantDb.Deleteable(voynos).RemoveDataCache($"{SqlSugarCacheConst.Voyno}{user.TenantId}").ExecuteCommand(); + tenantDb.Deleteable(list).RemoveDataCache($"{SqlSugarCacheConst.Vessel}{user.TenantId}").ExecuteCommand(); } return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); } diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeVoynoService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeVoynoService.cs index 40da6324..22a4fc7e 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodeVoynoService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeVoynoService.cs @@ -103,7 +103,7 @@ public class CodeVoynoService:ICodeVoynoService var data = req.Adapt(); - var entity = tenantDb.Insertable(data).RemoveDataCache(SqlSugarCacheConst.Voyno + user.TenantId).ExecuteReturnEntity(); + var entity = tenantDb.Insertable(data).RemoveDataCache($"{SqlSugarCacheConst.Voyno}{user.TenantId}").ExecuteReturnEntity(); return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess); } @@ -113,7 +113,7 @@ public class CodeVoynoService:ICodeVoynoService info = req.Adapt(info); - tenantDb.Updateable(info).RemoveDataCache(SqlSugarCacheConst.Voyno + user.TenantId).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + tenantDb.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.Voyno}{user.TenantId}").IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess); } } @@ -158,7 +158,7 @@ public class CodeVoynoService:ICodeVoynoService return DataResult.Failed("存在已导入的航次信息!",MultiLanguageConst.CodeVoynoImportAlready); } - tenantDb.Insertable(list).RemoveDataCache(SqlSugarCacheConst.Voyno + user.TenantId).ExecuteCommand(); + tenantDb.Insertable(list).RemoveDataCache($"{SqlSugarCacheConst.Voyno}{user.TenantId}").ExecuteCommand(); return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess); } @@ -181,7 +181,7 @@ public class CodeVoynoService:ICodeVoynoService var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList(); if (list.Count > 0) { - tenantDb.Deleteable(list).RemoveDataCache(SqlSugarCacheConst.Voyno + user.TenantId).ExecuteCommand(); + tenantDb.Deleteable(list).RemoveDataCache($"{SqlSugarCacheConst.Voyno}{user.TenantId}").ExecuteCommand(); } return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); } diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs index 928989fa..2a6aa029 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs @@ -75,7 +75,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService var entity = TenantDb.InsertNav(data).Include(x => x.InvoiceHeaders).ExecuteReturnEntity(); tag.ClientId = entity.Id; - TenantDb.Insertable(tag).RemoveDataCache(SqlSugarCacheConst.InfoClient + User.TenantId).ExecuteCommand(); + TenantDb.Insertable(tag).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").ExecuteCommand(); return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); } else @@ -86,7 +86,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService info = req.Adapt(info); tag = req.ClientTag.Adapt(tag); - TenantDb.Updateable(info).RemoveDataCache(SqlSugarCacheConst.InfoClient + User.TenantId).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand(); + TenantDb.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand(); TenantDb.Updateable(tag).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand(); //创建或更新发票抬头 @@ -186,7 +186,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService //收发货人 await TenantDb.Deleteable().Where(x => req.Ids.Contains(x.ClientId)).ExecuteCommandAsync(); //删除客户信息 - await TenantDb.Deleteable().RemoveDataCache(SqlSugarCacheConst.InfoClient + User.TenantId).Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync(); + await TenantDb.Deleteable().RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync(); await TenantDb.Ado.CommitTranAsync(); return DataResult.Success; diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index 7b467c81..f8d78b8c 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -76,7 +76,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.GoodsCode.Contains(queryKey) || a.GoodName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.Goods + user.TenantId) + .WithCache($"{SqlSugarCacheConst.Goods}{user.TenantId}") .ToListAsync(); return await Task.FromResult(DataResult>.Success("获取数据成功!", list)); } @@ -105,7 +105,7 @@ public class ClientCommonService : IClientCommonService .Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && ids.Contains(a.Id)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToListAsync(); return await Task.FromResult(DataResult>.Success(data)); } @@ -134,7 +134,7 @@ public class ClientCommonService : IClientCommonService Value = a.Id, }) .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToListAsync(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1005,7 +1005,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); if (list.Count > 0) { @@ -1110,7 +1110,7 @@ public class ClientCommonService : IClientCommonService BLContent = a.BLContent, PinYinCode = a.ShortName + "(" + a.CodeName + ")" } - ).Take(20).WithCache(SqlSugarCacheConst.InfoClient + user.TenantId).ToListAsync(); + ).Take(20).WithCache($"{SqlSugarCacheConst.InfoClient}{user.TenantId}").ToListAsync(); return await Task.FromResult(DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess)); } /// @@ -1590,7 +1590,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.PackageName.Contains(queryKey) || a.EdiCode.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.Package + user.TenantId) + .WithCache($"{SqlSugarCacheConst.Package}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1606,7 +1606,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.VesselName.Contains(queryKey) || a.EdiCode.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.Vessel + user.TenantId) + .WithCache($"{SqlSugarCacheConst.Vessel}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1622,7 +1622,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.VoyNo.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.Voyno + user.TenantId) + .WithCache($"{SqlSugarCacheConst.Voyno}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1663,7 +1663,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1679,7 +1679,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1694,7 +1694,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1710,7 +1710,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1726,7 +1726,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1742,7 +1742,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1758,7 +1758,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } @@ -1773,7 +1773,7 @@ public class ClientCommonService : IClientCommonService .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) .Select() .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") .ToList(); return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); } diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs index 1153b7e9..514cedfa 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs @@ -936,7 +936,7 @@ public class CommonService : ICommonService Value = a.Id, }) .Take(20) - .WithCache(SqlSugarCacheConst.User + user.TenantId).ToList(); + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}").ToList(); return DataResult>.Success("获取数据成功!", list); } diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/UserService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/UserService.cs index 6ffa6a4b..d1bb8dc3 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/UserService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/UserService.cs @@ -131,7 +131,7 @@ public class UserService : IUserService data.PinYinCode = data.UserName + "(" + PinYinUtil.GetFristLetter(data.UserName) + ")"; data.MD5Password = MD5Helper.MD5Encrypt(data.Password); - var entity = db.Insertable(data).RemoveDataCache(SqlSugarCacheConst.User + user.TenantId).ExecuteReturnEntity(); + var entity = db.Insertable(data).RemoveDataCache($"{SqlSugarCacheConst.User}{user.TenantId}").ExecuteReturnEntity(); if (model.RoleIds.IsNotNull() && model.RoleIds.Count() > 0) { @@ -180,7 +180,7 @@ public class UserService : IUserService info = model.MapTo(); info.PinYinCode = info.UserName + "(" + PinYinUtil.GetFristLetter(info.UserName) + ")"; - db.Updateable(info).RemoveDataCache(SqlSugarCacheConst.User + user.TenantId).IgnoreColumns(it => new { it.TenantId,it.TenantName, it.Password,it.MD5Password }).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + db.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.User}{user.TenantId}").IgnoreColumns(it => new { it.TenantId,it.TenantName, it.Password,it.MD5Password }).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); #region 处理用户角色 @@ -302,7 +302,7 @@ public class UserService : IUserService if (userLanes.Count > 0) await db.Deleteable(userLanes).ExecuteCommandAsync(); } - await db.Deleteable(list).RemoveDataCache(SqlSugarCacheConst.User + user.TenantId).ExecuteCommandAsync(); + await db.Deleteable(list).RemoveDataCache($"{SqlSugarCacheConst.User}{user.TenantId}").ExecuteCommandAsync(); } return await Task.FromResult(DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess)); From c5d33fbe7c093a334c91a09fd22e88821eebd071 Mon Sep 17 00:00:00 2001 From: cjy Date: Fri, 9 Aug 2024 14:20:24 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E9=9B=86=E8=A3=85=E7=AE=B1=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7-=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BusinessCtnPriceController.cs | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 ds-wms-service/DS.WMS.OpApi/Controllers/BusinessCtnPriceController.cs diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/BusinessCtnPriceController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/BusinessCtnPriceController.cs new file mode 100644 index 00000000..eda61fef --- /dev/null +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/BusinessCtnPriceController.cs @@ -0,0 +1,53 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Code.Interface; +using DS.WMS.Core.Op.Dtos; +using DS.WMS.Core.Op.Interface; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.OpApi.Controllers; + +/// +/// 集装箱报价-服务 +/// +public class BusinessCtnPriceController : ApiController +{ + private readonly IBusinessCtnPriceService _invokeService; + + /// + /// 构造函数 + /// + /// + public BusinessCtnPriceController(IBusinessCtnPriceService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 列表 + /// + /// + /// + [HttpPost] + [Route("GetBusinessCtnPriceList")] + public async Task>> GetBusinessCtnPriceList([FromBody] PageRequest request) + { + var res = await _invokeService.GetListByPage(request); + return res; + } + + + /// + /// 批量删除 + /// + /// + /// + [HttpPost] + [Route("BatchDelBusinessCtnPrice")] + public async Task BatchDelBusinessCtnPrice([FromBody] IdModel req) + { + var res = await _invokeService.BatchDelBusinessCtnPrice(req); + return res; + } +} \ No newline at end of file From 011b1002f6e531a3f1fe82ea5d187ea75de1b4c3 Mon Sep 17 00:00:00 2001 From: cjy Date: Fri, 9 Aug 2024 14:34:18 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs | 4 ++-- ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs | 4 ++++ ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs | 4 ++-- ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs | 7 ++++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs index 059682a1..e8cffd6a 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs @@ -175,9 +175,9 @@ public class UserReq public string SourceName { get; set; } = ""; /// - /// 签名照片Url + /// 签名 /// - public string SignatureUrl { get; set; } = ""; + public string SignatureHtml { get; set; } = ""; } /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs index adb05fd3..5d680afc 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs @@ -66,4 +66,8 @@ public class UserSelectRes /// 财务软件代码 /// public string FinanceSoftCode { get; set; } + /// + /// 签名 + /// + public string SignatureHtml { get; set; } = ""; } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs index c3158c94..48b6da55 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs @@ -192,7 +192,7 @@ public class UserViewModel public string SourceName { get; set; } = ""; /// - /// 签名照片Url + /// 签名 /// - public string SignatureUrl { get; set; } = ""; + public string SignatureHtml { get; set; } = ""; } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs index 76ce7276..baa4aaca 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs @@ -205,5 +205,10 @@ public class SysUser : UserTenantModel /// [Description("是否派车调度人员")] public bool IsDispatcher { get; set; } = false; - + + /// + /// 邮件签名 + /// + [Description("邮件签名")] + public string SignatureHtml { get; set; } } \ No newline at end of file From 33251e1a3f6e2f905293bc77bbe19ff168922d48 Mon Sep 17 00:00:00 2001 From: cjy Date: Fri, 9 Aug 2024 14:38:24 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs | 6 +++++- ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs | 6 +++++- ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs | 6 +++++- ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs | 5 +++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs index e8cffd6a..ed8920a3 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs @@ -175,7 +175,11 @@ public class UserReq public string SourceName { get; set; } = ""; /// - /// 签名 + /// 签名图片 + /// + public string SignatureUrl { get; set; } = ""; + /// + /// 邮件签名 /// public string SignatureHtml { get; set; } = ""; } diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs index 5d680afc..31f8ce76 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserSelectRes.cs @@ -67,7 +67,11 @@ public class UserSelectRes /// public string FinanceSoftCode { get; set; } /// - /// 签名 + /// 签名图片 + /// + public string SignatureUrl { get; set; } = ""; + /// + /// 邮件签名 /// public string SignatureHtml { get; set; } = ""; } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs index 48b6da55..408bb4da 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs @@ -192,7 +192,11 @@ public class UserViewModel public string SourceName { get; set; } = ""; /// - /// 签名 + /// 签名图片 + /// + public string SignatureUrl { get; set; } = ""; + /// + /// 邮件签名 /// public string SignatureHtml { get; set; } = ""; } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs index baa4aaca..b7fb0a4e 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs @@ -206,6 +206,11 @@ public class SysUser : UserTenantModel [Description("是否派车调度人员")] public bool IsDispatcher { get; set; } = false; + /// + /// 签名图片 + /// + [Description("签名图片")] + public string SignatureUrl { get; set; } /// /// 邮件签名 /// From 131c6d50d0a1fa24f34efcac859492b7bdd26342 Mon Sep 17 00:00:00 2001 From: dengyu Date: Fri, 9 Aug 2024 15:00:54 +0800 Subject: [PATCH 5/8] 20240809_2 ddlucky --- .../Constants/MultiLanguageConst.cs | 3 ++ .../Enums/ContainerManagementEnum.cs | 49 +++++++++++++++---- .../Controllers/CM_RentInController.cs | 13 +++++ .../DS.WMS.ContainerManagementApi/Program.cs | 2 + .../Dtos/CM_CurrentStateReq.cs | 18 ++++++- .../Dtos/CM_CurrentStateRes.cs | 9 ++++ .../Dtos/CM_State_ChangeReq.cs | 11 +++++ .../Dtos/CM_State_ChangeRes.cs | 15 +++++- .../Entity/CM_CurrentState.cs | 6 +-- .../Entity/CM_State_Change.cs | 17 +++++-- .../Interface/ICM_RentInService.cs | 7 +++ .../Method/CM_RentInService.cs | 47 +++++++++++++++++- .../DS.WMS.Test/ContainerManagementTest.cs | 16 +++--- ds-wms-service/DS.WMS.Test/DS.WMS.Test.csproj | 3 +- ds-wms-service/DS.WMS.Test/Startup.cs | 2 + 15 files changed, 188 insertions(+), 30 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index 0fe81db3..ebe79b3b 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -1607,5 +1607,8 @@ public static class MultiLanguageConst [Description("该业务存在费用信息")] public const string CM_FeeExist = "CM_FeeExist"; + [Description("此业务该状态下不能生成费用")] + public const string CM_CanNotMakeFee = "This Bill can not make fee in this state."; + #endregion } \ No newline at end of file diff --git a/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs b/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs index d51564e9..b2bfb743 100644 --- a/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs +++ b/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs @@ -181,22 +181,51 @@ namespace DS.Module.Core.Enums } /// - /// 箱管 箱可用状态 + /// 箱管 箱运行状态 /// - public enum CMUsedStateEnum + public enum CMCtnFlowStateEnum { /// - /// 旧箱 + /// 重箱卸船到码头:DlF- Discharge Inbound Full container at TML /// - [Description("可用")] - AV = 1, - [Description("损坏")] - DM = -1, + [Description("DIF")] + DIF = 0, /// - /// 新箱 + /// 收货人提箱卸货: + /// DCF - C/NEE pick up container from TML and unloading cargo in their warehous or at TML directly /// - [Description("新箱")] - REP = 0, + [Description("DCF")] + DCF = 1, + /// + /// 收货人还空箱:GlM - C/NEE empty return our container to our Local Depot + /// + [Description("GLM")] + GLM = 2, + /// + /// 坏箱维修计划确认:RPM - Container upload Estimate and confirm to repair at our Local Depot. + /// + [Description("RPM")] + RPM = 3, + /// + /// 修箱完成进场:GlM - Container competed repair and available to pick up with sound status. + /// + [Description("GIM")] + GIM = 4, + /// + /// 发货人提空箱:DSM - Container picked up by shipper for export by our good service. + /// + [Description("DSM")] + DSM = 5, + /// + /// 重箱返场:OBF - Container gate-in Terminal and ready for loading. + /// + [Description("OBF")] + OBF = 6, + /// + /// 重箱装船:LDF- Container loading on board successful. + /// + [Description("LDF")] + LDF = 7, } /// diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentInController.cs b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentInController.cs index a2872e4e..bc26d553 100644 --- a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentInController.cs +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentInController.cs @@ -107,4 +107,17 @@ public class CM_RentInController : ApiController var res = _invokeService.CM_RentIn_Cancel(id); return res; } + + /// + /// 租箱租入_生成费用 + /// + /// + /// + [HttpPost] + [Route("CM_RentIn_MakeFee")] + public Task CM_RentIn_MakeFee([FromBody] string id) + { + var res = _invokeService.CM_RentIn_MakeFee(id); + return res; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Program.cs b/ds-wms-service/DS.WMS.ContainerManagementApi/Program.cs index 6bc37b0c..ee852739 100644 --- a/ds-wms-service/DS.WMS.ContainerManagementApi/Program.cs +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Program.cs @@ -6,6 +6,7 @@ using DS.Module.Core.Extensions; using DS.Module.Core.ServiceExtensions; using DS.Module.Jwt; using DS.Module.MultiLanguage; +using DS.Module.RedisModule; using DS.Module.SqlSugar; using DS.Module.Swagger; using DS.Module.UserModule; @@ -32,6 +33,7 @@ builder.Host builder.Services.AddAppWebInstal(); builder.Services.AddCorsInstall(); builder.Services.AddUserModuleInstall(); //û +builder.Services.AddRedisModuleInstall();//redis builder.Services.AddSqlSugarInstall(); builder.Services.AddSwaggerInstall(); builder.Services.AddJwtInstall(); diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs index 425dbe32..a569d7a8 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs @@ -79,7 +79,8 @@ public class CM_CurrentStateReq /// public string CtnReleaseNo { get; set; } - + + /// /// /// Desc:箱状态Id /// @@ -89,10 +90,23 @@ public class CM_CurrentStateReq /// public string CtnState => CtnStateId?.GetDescription(); + /// + /// Desc:箱流转状态Id + /// + public CMCtnFlowStateEnum? CtnFlowStateId { get; set; } + /// + /// Desc:箱流转状态 + /// + public string CtnFlowState => CtnFlowStateId?.GetDescription(); + + /// + /// Desc:箱损坏/维修状态Id + /// + public CMCtnBreakStateEnum? CtnBreakStateId { get; set; } /// /// Desc:箱损坏/维修状态 /// - public string CtnBreakState { get; set; } + public string CtnBreakState => CtnBreakStateId?.GetDescription(); /// diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs index 85cf5bd0..35b3f614 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs @@ -86,6 +86,15 @@ public class CM_CurrentStateRes /// public string CtnState => CtnStateId?.GetDescription(); + /// + /// Desc:箱流转状态Id + /// + public CMCtnFlowStateEnum? CtnFlowStateId { get; set; } + /// + /// Desc:箱流转状态 + /// + public string CtnFlowState => CtnFlowStateId?.GetDescription(); + /// /// Desc:箱损坏/维修状态Id /// diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeReq.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeReq.cs index 38b18ad2..1c1481ef 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeReq.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeReq.cs @@ -96,6 +96,17 @@ public class CM_State_ChangeReq /// public string CtnState => CtnStateId?.GetDescription(); + + /// + /// Desc:箱流转状态Id + /// + public CMCtnFlowStateEnum? CtnFlowStateId { get; set; } + /// + /// Desc:箱流转状态 + /// + public string CtnFlowState => CtnFlowStateId?.GetDescription(); + + /// /// Desc:箱损坏/维修状态Id /// diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeRes.cs index c181f930..ac086f0e 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeRes.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeRes.cs @@ -83,10 +83,23 @@ public class CM_State_ChangeRes /// public string CtnState => CtnStateId?.GetDescription(); + /// + /// Desc:箱流转状态Id + /// + public CMCtnFlowStateEnum? CtnFlowStateId { get; set; } + /// + /// Desc:箱流转状态 + /// + public string CtnFlowState => CtnFlowStateId?.GetDescription(); + + /// + /// Desc:箱损坏/维修状态Id + /// + public CMCtnBreakStateEnum? CtnBreakStateId { get; set; } /// /// Desc:箱损坏/维修状态 /// - public string CtnBreakState { get; set; } + public string CtnBreakState => CtnBreakStateId?.GetDescription(); /// /// Desc:空重箱 diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs index fb9cfa5b..da11dc38 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs @@ -102,10 +102,10 @@ public class CM_CurrentState : BaseOrgModel [SugarColumn(ColumnDescription = "箱状态Id", IsNullable = true)] public CMCtnStateEnum? CtnStateId { get; set; } /// - /// Desc:箱状态 + /// Desc:箱流转状态Id /// - //[SugarColumn(ColumnDescription = "箱状态", IsNullable = true, Length = 20)] - //public string CtnState { get; set; } + [SugarColumn(ColumnDescription = "箱流转状态Id", IsNullable = true)] + public CMCtnStateEnum? CtnFlowStateId { get; set; } /// /// Desc:箱损坏/维修状态 diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change.cs index 73283550..64f8ece5 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change.cs @@ -103,15 +103,26 @@ public class CM_State_Change : BaseOrgModel [SugarColumn(ColumnDescription = "箱状态Id", IsNullable = true, Length = 20)] public CMCtnStateEnum? CtnStateId { get; set; } /// - /// Desc:箱状态 + /// Desc:箱状态 AV可用 /// [SugarColumn(ColumnDescription = "箱状态", IsNullable = true, Length = 20)] public string CtnState { get; set; } /// - /// Desc:箱损坏/维修状态 + /// Desc:箱流转状态Id /// - [SugarColumn(ColumnDescription = "箱损坏/维修状态Id", IsNullable = true, Length = 20)] + [SugarColumn(ColumnDescription = "箱流转状态Id", IsNullable = true)] + public CMCtnStateEnum? CtnFlowStateId { get; set; } + /// + /// Desc:箱流转状态 + /// + [SugarColumn(ColumnDescription = "箱流转状态", IsNullable = true, Length = 20)] + public string CtnFlowState { get; set; } + + /// + /// Desc:箱可用状态 损坏/维修状态 AV BK REP + /// + [SugarColumn(ColumnDescription = "箱可用状态Id", IsNullable = true, Length = 20)] public CMCtnBreakStateEnum? CtnBreakStateId { get; set; } /// diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentInService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentInService.cs index 48f5b535..d487ce00 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentInService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentInService.cs @@ -50,4 +50,11 @@ public interface ICM_RentInService /// /// Task CM_RentIn_Cancel(string id); + + /// + /// 租箱租入_生成费用 + /// + /// + /// + Task CM_RentIn_MakeFee(string id); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentInService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentInService.cs index c8e4cbf5..71bf01ff 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentInService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentInService.cs @@ -24,6 +24,7 @@ using AngleSharp.Dom; using NPOI.Util; using DS.WMS.Core.Sys.Method; using DS.WMS.Core.Sys.Interface; +using DS.WMS.Core.Fee.Interface; namespace DS.WMS.ContainerManagement.Info.Method; @@ -35,7 +36,7 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService private readonly IUser user; private readonly ISaasDbService saasService; private readonly ICommonService commonService; - + readonly IFeeRecordService _feeService; /// /// /// @@ -48,6 +49,8 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService saasService = _serviceProvider.GetRequiredService(); commonService = _serviceProvider.GetRequiredService(); + + _feeService = _serviceProvider.GetRequiredService(); } /// @@ -202,7 +205,7 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService .First(); //20240808 首先判断该箱号能否 - + data.BillState = "Confirm"; data.IsBusinessLocking = true; var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess)); @@ -221,8 +224,48 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService .Where(a => a.Id == long.Parse(id)) .Select() .First(); + data.BillState = ""; data.IsBusinessLocking = false; var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess)); } + + /// + /// 租箱租入_生成费用 + /// + /// + /// + public async Task CM_RentIn_MakeFee(string id) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = tenantDb.Queryable() + .Where(a => a.Id == long.Parse(id)) + .Select() + .First(); + + if (data.BillState != "Confirm") + { + + + return await Task.FromResult(DataResult.Failed("添加失败!", MultiLanguageConst.CM_CanNotMakeFee)); + } + else { + var newFee = new FeeRecord(); + + newFee.Id = 0; + newFee.FeeType = FeeType.Payable; + newFee.FeeName = "提箱费"; + newFee.TaxUnitPrice = 10; + newFee.Amount = 10; + newFee.TaxRate = 0; + newFee.Quantity = 1; + + var feeDetail = new List(); + feeDetail.Add(newFee); + + return await _feeService.SaveAsync(feeDetail); + } + //根据 + //return await Task.FromResult(DataResult.Successed("添加成功!", data.Id, MultiLanguageConst.DataCreateSuccess)); + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs index e24ba656..8abbcc51 100644 --- a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs +++ b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs @@ -87,15 +87,15 @@ public class ContainerManagementTest tenantDb.CodeFirst.InitTables(typeof(CM_CurrentState)); - tenantDb.CodeFirst.InitTables(typeof(CM_BaseInfo)); + //tenantDb.CodeFirst.InitTables(typeof(CM_BaseInfo)); tenantDb.CodeFirst.InitTables(typeof(CM_State_Change)); - tenantDb.CodeFirst.InitTables(typeof(CM_RentIn)); - tenantDb.CodeFirst.InitTables(typeof(CM_RentIn_Detail)); - tenantDb.CodeFirst.InitTables(typeof(CM_RentOut)); - tenantDb.CodeFirst.InitTables(typeof(CM_RentOut_Detail)); - tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay)); - tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_Detail)); + //tenantDb.CodeFirst.InitTables(typeof(CM_RentIn)); + //tenantDb.CodeFirst.InitTables(typeof(CM_RentIn_Detail)); + //tenantDb.CodeFirst.InitTables(typeof(CM_RentOut)); + //tenantDb.CodeFirst.InitTables(typeof(CM_RentOut_Detail)); + //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay)); + //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_Detail)); @@ -145,7 +145,7 @@ public class ContainerManagementTest { var tenantList = db.Queryable().ToList(); var ass = Assembly.Load("DS.WMS.Core"); - var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.TaskPlat.Entity") == true).ToArray(); + //var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.ContainerManagement.Entity") == true).ToArray(); foreach (var item in tenantList) { var tenantDb = saasService.GetBizDbScopeById(item.TenantId).CopyNew(); diff --git a/ds-wms-service/DS.WMS.Test/DS.WMS.Test.csproj b/ds-wms-service/DS.WMS.Test/DS.WMS.Test.csproj index 06db10a7..cfb1d8af 100644 --- a/ds-wms-service/DS.WMS.Test/DS.WMS.Test.csproj +++ b/ds-wms-service/DS.WMS.Test/DS.WMS.Test.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -29,6 +29,7 @@ + diff --git a/ds-wms-service/DS.WMS.Test/Startup.cs b/ds-wms-service/DS.WMS.Test/Startup.cs index 5278ff57..3905d24f 100644 --- a/ds-wms-service/DS.WMS.Test/Startup.cs +++ b/ds-wms-service/DS.WMS.Test/Startup.cs @@ -4,6 +4,7 @@ using DS.Module.AutofacModule; using DS.Module.PrintModule; using DS.Module.SqlSugar; using DS.Module.UserModule; +using DS.Module.RedisModule; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -51,6 +52,7 @@ public class Startup { // services.AddTransient(); services.AddUserModuleInstall(); //用户服务 + services.AddRedisModuleInstall();//redis services.AddSqlSugarInstall(); services.AddSaasDbInstall(); services.AddPrintModuleInstall(); From fdb520f9c42da810f38e3f7e89202aa38660b289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Fri, 9 Aug 2024 15:28:59 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/TaskFlowDataContext.cs | 20 ++ ds-wms-service/DS.Module.Core/Utils/ApiFox.cs | 6 +- .../DS.Module.Nuget/DS.Module.Nuget.csproj | 6 +- .../TaskInteraction/BusinessTaskAttachment.cs | 6 +- .../TaskInteraction/BusinessTaskMail.cs | 8 +- .../TaskInteraction/BusinessTaskMailServer.cs | 42 --- .../TaskInteraction/IActionManagerService.cs | 5 +- .../DS.WMS.Core/Op/MailTemplate.cshtml | 24 +- .../Method/TaskInteraction/ActionExecutor.cs | 45 --- .../TaskInteraction/ActionManagerService.cs | 24 ++ .../TaskInteraction/MailActionExecutor.cs | 271 +++++++++++------- .../Method/TaskInteraction/TaskMailService.cs | 11 +- .../DS.WMS.Core/Sys/Entity/SysUser.cs | 26 +- .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 7 + .../FolderProfile1.pubxml.user | 2 +- .../Controllers/TaskMailController.cs | 32 ++- ds-wms-service/DS.WMS.OpApi/appsettings.json | 159 +++++----- 17 files changed, 390 insertions(+), 304 deletions(-) delete mode 100644 ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskMailServer.cs delete mode 100644 ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor.cs diff --git a/ds-wms-service/DS.Module.Core/Data/TaskFlowDataContext.cs b/ds-wms-service/DS.Module.Core/Data/TaskFlowDataContext.cs index 29004542..02fb3b2c 100644 --- a/ds-wms-service/DS.Module.Core/Data/TaskFlowDataContext.cs +++ b/ds-wms-service/DS.Module.Core/Data/TaskFlowDataContext.cs @@ -73,6 +73,26 @@ namespace DS.Module.Core.Data return default; } + /// + /// + /// + public T? GetOrDefault(string key) + { + if (dataContext.TryGetValue(key, out var value)) + { + if (value is T t) + { + return t; + } + else if (value != null) + { + return (T)Convert.ChangeType(value, typeof(T)); + } + } + + return default; + } + /// /// /// diff --git a/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs b/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs index c5f4811f..a2c996b8 100644 --- a/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs +++ b/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs @@ -168,12 +168,14 @@ namespace DS.Module.Core } else if (method == HttpMethod.Post) { - var jsonRequest = new StringContent(JsonConvert.SerializeObject(requestParams), Encoding.UTF8, "application/json"); + string json = JsonConvert.SerializeObject(requestParams); + var jsonRequest = new StringContent(json, Encoding.UTF8, "application/json"); response = await http.PostAsync(reqUri, jsonRequest); } else if (method == HttpMethod.Put) { - var jsonRequest = new StringContent(JsonConvert.SerializeObject(requestParams), Encoding.UTF8, "application/json"); + string json = JsonConvert.SerializeObject(requestParams); + var jsonRequest = new StringContent(json, Encoding.UTF8, "application/json"); response = await http.PutAsync(reqUri, jsonRequest); } else if (method == HttpMethod.Delete) diff --git a/ds-wms-service/DS.Module.Nuget/DS.Module.Nuget.csproj b/ds-wms-service/DS.Module.Nuget/DS.Module.Nuget.csproj index 1b5a659e..5b526759 100644 --- a/ds-wms-service/DS.Module.Nuget/DS.Module.Nuget.csproj +++ b/ds-wms-service/DS.Module.Nuget/DS.Module.Nuget.csproj @@ -18,11 +18,11 @@ - + - + @@ -31,7 +31,7 @@ - + diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskAttachment.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskAttachment.cs index e43fd789..04eafadc 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskAttachment.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskAttachment.cs @@ -21,9 +21,9 @@ namespace DS.WMS.Core.Op.Entity.TaskInteraction public long TemplateId { get; set; } /// - /// 附件获取接口的URL + /// 附件文件名 /// - [SugarColumn(ColumnDescription = "附件获取接口的URL", Length = 255, IsNullable = false)] - public string RequestURL { get; set; } = string.Empty; + [SugarColumn(ColumnDescription = "附件文件名", Length = 50, IsNullable = true)] + public string? FileName { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskMail.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskMail.cs index f43f9316..ac2c0604 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskMail.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskMail.cs @@ -48,15 +48,9 @@ namespace DS.WMS.Core.Op.Entity.TaskInteraction /// /// 服务器设置ID /// - [SugarColumn(ColumnDescription = "任务类型", IsNullable = false)] + [SugarColumn(ColumnDescription = "服务器设置ID", IsNullable = false)] public long ServerId { get; set; } - /// - /// 服务器设置 - /// - [Navigate(NavigateType.OneToOne, nameof(ServerId))] - public BusinessTaskMailServer? Server { get; set; } - /// /// 接收人设置 /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskMailServer.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskMailServer.cs deleted file mode 100644 index 288b0809..00000000 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTaskMailServer.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DS.Module.Core.Data; -using SqlSugar; - -namespace DS.WMS.Core.Op.Entity.TaskInteraction -{ - /// - /// 任务邮件服务器配置 - /// - [SugarTable("business_task_mail_server", "任务邮件服务器配置")] - public class BusinessTaskMailServer : BaseOrgModelV2 - { - /// - /// 服务器地址 - /// - [SugarColumn(ColumnDescription = "服务器地址", Length = 200, IsNullable = false)] - public string Host { get; set; } = string.Empty; - - /// - /// 端口号 - /// - [SugarColumn(ColumnDescription = "端口号")] - public int Port { get; set; } - - /// - /// 使用SSL连接 - /// - [SugarColumn(ColumnDescription = "使用SSL连接", DefaultValue = "1")] - public bool UseSSL { get; set; } = true; - - /// - /// 登录账号 - /// - [SugarColumn(ColumnDescription = "登录账号", Length = 200, IsNullable = true)] - public string? LoginName { get; set; } - - /// - /// 登录密码 - /// - [SugarColumn(ColumnDescription = "登录密码", Length = 200, IsNullable = true)] - public string? Password { get; set; } - } -} diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs index 7d427c53..e22ce8bb 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs @@ -1,4 +1,5 @@ -using DS.Module.Core.Data; +using DS.Module.Core; +using DS.Module.Core.Data; using DS.WMS.Core.Op.Entity.TaskInteraction; namespace DS.WMS.Core.Op.Interface.TaskInteraction @@ -21,5 +22,7 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction /// 任务信息 /// Task TriggerAction(BusinessTask businessTask); + + Task TriggerTest(TaskBaseTypeEnum taskType, long? id); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/MailTemplate.cshtml b/ds-wms-service/DS.WMS.Core/Op/MailTemplate.cshtml index bb6c5272..044eeb10 100644 --- a/ds-wms-service/DS.WMS.Core/Op/MailTemplate.cshtml +++ b/ds-wms-service/DS.WMS.Core/Op/MailTemplate.cshtml @@ -1,9 +1,23 @@ -@model DS.WMS.Core.Op.Dtos.TaskInteraction.MailTemplateModel - -@{ +@{ var item = Model.Primary; } + +

测试邮件-@item.MBLNO@item.CustomerNo

@@ -14,3 +28,7 @@
订单创建时间:@item.CreateTime.ToString("yyyy年MM月dd日 HH:mm:ss")
+ +
+
+
\ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor.cs deleted file mode 100644 index 81a503ef..00000000 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor.cs +++ /dev/null @@ -1,45 +0,0 @@ -using DS.Module.Core; -using DS.WMS.Core.Op.Entity.TaskInteraction; -using DS.WMS.Core.Op.Interface.TaskInteraction; -using Microsoft.Extensions.DependencyInjection; - -namespace DS.WMS.Core.Op.Method.TaskInteraction -{ - public class ActionExecutor : ServiceBase - { - //任务日志服务 - //readonly ITaskLogService LogService; - - /// - /// 初始化 - /// - /// - public ActionExecutor(IServiceProvider provider) : base(provider) - { - //LogService = provider.GetRequiredService(); - } - - ///// - ///// 执行特定任务类型的邮件服务 - ///// - ///// 任务 - ///// - ///// 为null - //public async Task ExecuteAsync(BusinessTask task) - //{ - // ArgumentNullException.ThrowIfNull(task, nameof(task)); - - // var list = await TenantDb.Queryable().Where(x => x.TaskType == task.TaskType && x.TaskStatus == task.TaskStatus) - // .Select(x => new - // { - // TemplateIds = x.Attachments.Select(x => x.TemplateId), - // x.Receiver, - // x.Sender, - // x.Title, - // x.Content - // }).ToListAsync(); - - - //} - } -} diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs index b323c407..d8851223 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs @@ -1,9 +1,11 @@ using DS.Module.Core; using DS.Module.Core.Data; using DS.WMS.Core.Op.Dtos.TaskInteraction; +using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity.TaskInteraction; using DS.WMS.Core.Op.Interface.TaskInteraction; using DS.WMS.Core.TaskPlat; +using SqlSugar; namespace DS.WMS.Core.Op.Method.TaskInteraction { @@ -65,6 +67,28 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction await executor.ExecuteAsync(context); } } + + public async Task TriggerTest(TaskBaseTypeEnum taskType, long? id) + { + var task = await TenantDb.Queryable() + .Where(t => t.TaskType == taskType + //&& SqlFunc.Subqueryable().Where(s => t.BusinessId == s.Id && s.BillSubmitStatus == AuditStatusEnum.Approve).Any() + ) + //.Where(x => x.TaskStatus == TaskStatusEnum.Complete) + .WhereIF(id.HasValue, x => x.BusinessId == id) + .OrderByDescending(t => SqlFunc.GetRandom()).Take(1).FirstAsync(); + if (task != null) + { + TaskFlowDataContext dataContext = new( + (TaskFlowDataNameConst.BusinessTask, task), + ("ActionType", 1), + ("Name", "订舱代理通知") + ); + + TaskFlowRuner taskFlow = new(TenantDb, ServiceProvider); + await taskFlow.RunWithBsno(task.TaskType, task.BusinessId, dataContext); + } + } } /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/MailActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/MailActionExecutor.cs index f1f6f919..b479f451 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/MailActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/MailActionExecutor.cs @@ -2,17 +2,19 @@ using DS.Module.PrintModule; using DS.Module.SqlSugar; using DS.Module.UserModule; +using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos.TaskInteraction; +using DS.WMS.Core.Op.Entity.TaskInteraction; using DS.WMS.Core.Op.Interface; using DS.WMS.Core.Op.Interface.TaskInteraction; using DS.WMS.Core.Sys.Entity; -using MailKit.Net.Smtp; +using HtmlAgilityPack; using Masuit.Tools; using Masuit.Tools.Systems; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using MimeKit; using Newtonsoft.Json; using RazorEngineCore; using SqlSugar; @@ -47,159 +49,222 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction var logService = context.ServiceProvider.GetRequiredService(); var seService = context.ServiceProvider.GetRequiredService(); - var mailName = context.AdditionalData["MailName"] as string; - if (mailName.IsNullOrEmpty()) + var config = context.ServiceProvider.GetRequiredService(); + + BusinessTaskMail? mailConfig = null; + if (context.AdditionalData.TryGetValue(nameof(BusinessTaskMail.Id), out var id)) { - await logService.WriteLogAsync(context.TaskInfo, $"未配置【{context.TaskInfo.TaskType.GetDescription()}】任务的邮件设置"); - return; + if (id == null) + { + await logService.WriteLogAsync(context.TaskInfo, $"未配置【{context.TaskInfo.TaskType.GetDescription()}】任务的邮件设置"); + return; + } + var idVal = (long)Convert.ChangeType(id, typeof(long)); + mailConfig = (await service.GetAsync(idVal)).Data; + } + else if (context.AdditionalData.TryGetValue(nameof(BusinessTaskMail.Name), out var name)) + { + var mailName = name as string; + if (mailName.IsNullOrEmpty()) + { + await logService.WriteLogAsync(context.TaskInfo, $"未配置【{context.TaskInfo.TaskType.GetDescription()}】任务的邮件设置"); + return; + } + mailConfig = await service.GetAsync(mailName); } - var mailConfig = await service.GetAsync(mailName); + if (mailConfig == null) { - await logService.WriteLogAsync(context.TaskInfo, $"未能获取名为【{mailName}】的邮件配置"); + await logService.WriteLogAsync(context.TaskInfo, $"未能根据任务配置值获取邮件模板设置"); return; } var result = seService.GetSeaExportInfo(context.TaskInfo.BusinessId.ToString()); - if (!result.Succeeded) + if (!result.Succeeded || result.Data == null) { await logService.WriteLogAsync(context.TaskInfo, $"未能获取Id={context.TaskInfo.BusinessId}的{context.TaskInfo.BusinessType.GetDescription()}数据"); return; } + string title, content = string.Empty; var templateModel = new MailTemplateModel { Primary = result.Data }; IRazorEngine razorEngine = new RazorEngine(); - var titleTemplate = razorEngine.Compile>>(mailConfig.Title); - string title = titleTemplate.Run(x => - { - x.Model = templateModel; - }); - var contentTemplate = razorEngine.Compile>>(mailConfig.Content); - string content = contentTemplate.Run(x => - { - x.Model = templateModel; - }); - var textPart = new TextPart("plain") { Text = content }; - var message = new MimeMessage + try { - Subject = title, - }; + var titleTemplate = razorEngine.Compile>>(mailConfig.Title); + title = await titleTemplate.RunAsync(x => + { + x.Model = templateModel; + }); - //设置发件人 - List senderIds = new List(); - if (mailConfig.Sender.IsSale) - { - senderIds.Add(templateModel.Primary.SaleId); + var contentTemplate = razorEngine.Compile>>(mailConfig.Content); + content = await contentTemplate.RunAsync(x => + { + x.Model = templateModel; + }); } - if (mailConfig.Sender.IsOperator) + catch (Exception ex) { - senderIds.Add(templateModel.Primary.OperatorId); + await ex.LogAsync(db); + await logService.WriteLogAsync(context.TaskInfo, $"渲染邮件模板({mailConfig.Id})时出错,请检查模板是否有语法错误"); + return; } - if (mailConfig.Sender.IsCustomerService) + + //设置发件人 + long senderId = 0; + if (mailConfig.Sender.IsSale) + senderId = templateModel.Primary.SaleId; + else if (mailConfig.Sender.IsOperator) + senderId = templateModel.Primary.OperatorId; + else if (mailConfig.Sender.IsCustomerService) + senderId = templateModel.Primary.CustomerService; + else if (mailConfig.Sender.IsVouchingClerk) + senderId = templateModel.Primary.Doc; + + var sender = await db.Queryable().Where(x => x.Id == senderId).Select( + x => new { x.UserName, x.SignatureHtml }).FirstAsync(); + if (sender == null) { - senderIds.Add(templateModel.Primary.CustomerService); + await logService.WriteLogAsync(context.TaskInfo, "未设置发件人"); + return; } - if (mailConfig.Sender.IsVouchingClerk) + var senderConfig = await tenantDb.Queryable().FirstAsync(x => x.CreateBy == senderId); + if (senderConfig == null) { - senderIds.Add(templateModel.Primary.Doc); + await logService.WriteLogAsync(context.TaskInfo, $"发件人用户:{sender.UserName} 未设置SMTP发件信息"); + return; } - var senderList = await db.Queryable().Where(x => senderIds.Contains(x.Id) && x.Email != null && x.Email != string.Empty) - .Select(x => new { x.UserName, x.UserEnName, x.Email }).ToListAsync(); - foreach (var sender in senderList) - message.From.Add(new MailboxAddress(sender.UserName, sender.Email)); + + //插入发件人签名 + var htmlDoc = new HtmlDocument(); + htmlDoc.LoadHtml(content); + var node = htmlDoc.GetElementbyId("sign"); + if (node != null) + node.InnerHtml = sender.SignatureHtml; + + StringWriter writer = new(); + htmlDoc.Save(writer); + content = writer.ToString(); //设置收件人 - List receiverIds = new List(); + List receiverIds = []; if (mailConfig.Receiver.IsCarrier) - { receiverIds.Add(templateModel.Primary.CarrierId); - } + if (mailConfig.Receiver.IsBooking) - { - //receiverIds.Add(templateModel.Primary.CarrierId); - } + receiverIds.Add(templateModel.Primary.CarrierId); + if (mailConfig.Receiver.IsYard) - { receiverIds.Add(templateModel.Primary.YardId); - } + if (mailConfig.Receiver.IsTruck) - { receiverIds.Add(templateModel.Primary.TruckerId); - } + if (mailConfig.Receiver.IsController) - { receiverIds.Add(templateModel.Primary.CustomerId); - } + var receiverList = await tenantDb.Queryable().Where(x => receiverIds.Contains(x.Id) && x.Email != null && x.Email != string.Empty) .Select(x => new { x.ShortName, x.EnShortName, x.Email }).ToListAsync(); - foreach (var item in receiverList) - message.To.Add(new MailboxAddress(item.ShortName, item.Email)); - //需要上传附件 - if (mailConfig.Attachments?.Count > 0) + var attachmentList = mailConfig.Attachments == null ? [] : new List>(mailConfig.Attachments.Count); + try { - var multipart = new Multipart("mixed"); - multipart.Add(textPart); - - if (api.DefaultHeaders.Contains("Authorization")) - api.DefaultHeaders.Remove("Authorization"); + //需要上传附件 + if (mailConfig.Attachments?.Count > 0) + { + if (api.DefaultHeaders.Contains("Authorization")) + api.DefaultHeaders.Remove("Authorization"); - api.DefaultHeaders.Add("Authorization", "Bearer " + user.GetToken()); + api.DefaultHeaders.Add("Authorization", "Bearer " + user.GetToken()); - long tenantId = long.Parse(user.TenantId); - foreach (var item in mailConfig.Attachments) - { - var req = new OpenPrintReq - { - ParamJsonStr = JsonConvert.SerializeObject(new { Id = context.TaskInfo.BusinessId }), - PrintType = "1", - TemplateId = item.TemplateId, - TenantId = tenantId - }; - var reqResult = await api.PostAsync(item.RequestURL, req); - if (!reqResult.Succeeded) + long tenantId = long.Parse(user.TenantId); + string requestUrl = config["TaskMail:FileBaseUrl"] + config["TaskMail:SQLPrint"]; + foreach (var item in mailConfig.Attachments) { - await logService.WriteLogAsync(context.TaskInfo, $"未能获取打印API生成的文件,请求地址:{item.RequestURL}"); - return; + var req = new OpenPrintReq + { + ParamJsonStr = JsonConvert.SerializeObject(new { Id = context.TaskInfo.BusinessId }), + PrintType = ((int)FileFormat.PDF).ToString(), + TemplateId = item.TemplateId, + TenantId = tenantId + }; + var reqResult = await api.PostAsync(requestUrl, req); + if (!reqResult.Succeeded) + { + await logService.WriteLogAsync(context.TaskInfo, $"未能获取打印API生成的文件,请求地址:{requestUrl}"); + return; + } + + string url = config["TaskMail:FileBaseUrl"] + @"/PrintTempFile/" + reqResult.Data.Data; + var fileResult = await api.SendRequestAsync(HttpMethod.Get, url); + if (!fileResult.Succeeded) + { + await logService.WriteLogAsync(context.TaskInfo, $"未能获取打印API生成的文件,附件地址:{url}"); + return; + } + + string fileName = item.FileName.IsNullOrEmpty() ? Path.GetFileName(reqResult.Data.Data) : item.FileName; + var bytes = await fileResult.Data.Content.ReadAsByteArrayAsync(); + string base64Str = Convert.ToBase64String(bytes); + attachmentList.Add(new Tuple(fileName, base64Str)); } - Uri uri = new Uri(item.RequestURL); - string url = uri.Scheme + "://" + uri.Host - + ((uri.Port == 80 || uri.Port == 443) ? string.Empty : ":" + uri.Port) - + "//PrintTempFile//" + reqResult.Data; - //var attachment = new MimePart("image", "gif") - //{ - // Content = new MimeContent(File.OpenRead(path), ContentEncoding.Default), - // ContentDisposition = new ContentDisposition(ContentDisposition.Attachment), - // ContentTransferEncoding = ContentEncoding.Base64, - // FileName = Path.GetFileName(path) - //}; } - } - else - { - message.Body = textPart; - } - var client = new SmtpClient(); - try - { - client.Connect(mailConfig.Server.Host, mailConfig.Server.Port, mailConfig.Server.UseSSL); - if (!mailConfig.Server.LoginName.IsNullOrEmpty() && !mailConfig.Server.Password.IsNullOrEmpty()) + dynamic[] mailParams = [new + { + SendTo = string.Join(",", receiverList.Select(x => x.Email)), + Title = title, + Body = content, + ShowName = senderConfig.ShowName.IsNullOrEmpty() ? sender.UserName : senderConfig.ShowName, + Account = senderConfig.MailAccount, + senderConfig.Password, + Server = senderConfig.SmtpServer, + Port = senderConfig.SmtpPort.GetValueOrDefault(), + UseSSL = senderConfig.SmtpSSL.GetValueOrDefault(), + Attaches = attachmentList.Select(x => new + { + AttachName = x.Item1, + AttachContent = x.Item2 + }).ToList() + }]; + var mailResult = await api.SendRequestAsync(HttpMethod.Post, config["TaskMail:MailApiUrl"], mailParams); + if (mailResult.Data.IsSuccessStatusCode) { - client.Authenticate(mailConfig.Server.LoginName, mailConfig.Server.Password); + await logService.WriteLogAsync(context.TaskInfo, $"已发邮件(委托单:{templateModel.Primary.CustomerNo}),收件人:" + + string.Join(",", receiverList.Select(x => x.Email)) + "发件人:" + senderConfig.MailAccount); + } + else + { + await logService.WriteLogAsync(context.TaskInfo, $"邮件发送失败(委托单:{templateModel.Primary.CustomerNo}),收件人:" + + string.Join(",", receiverList.Select(x => x.Email)) + "发件人:" + senderConfig.MailAccount); } - - client.Send(message); - client.Disconnect(true); } catch (Exception ex) { await ex.LogAsync(db); } - finally - { - client?.Dispose(); - } } + + } + + /// + /// 文件格式 + /// + public enum FileFormat + { + /// + /// PDF + /// + PDF = 1, + + /// + /// Excel + /// + Xlsx = 2, + + /// + /// Word + /// + Docx = 3 } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskMailService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskMailService.cs index 173340b4..04e431a1 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskMailService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskMailService.cs @@ -39,7 +39,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction public async Task> GetAsync(long id) { var entity = await TenantDb.Queryable() - .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Server).Includes(x => x.Attachments) + .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Attachments) .Where(x => x.Id == id).FirstAsync(); return DataResult.Success(entity); @@ -53,7 +53,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction public async Task GetAsync(string name) { return await TenantDb.Queryable() - .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Server).Includes(x => x.Attachments) + .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Attachments) .Where(x => x.Name == name).FirstAsync(); } @@ -71,13 +71,12 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction { taskMail.Receiver ??= new(); taskMail.Sender ??= new(); - taskMail.Server ??= new(); - taskMail = await TenantDb.InsertNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Server).ExecuteReturnEntityAsync(); + taskMail = await TenantDb.InsertNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).ExecuteReturnEntityAsync(); } else { - await TenantDb.UpdateNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Server).ExecuteCommandAsync(); + await TenantDb.UpdateNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).ExecuteCommandAsync(); } if (taskMail.Attachments?.Count > 0) @@ -113,7 +112,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction try { await TenantDb.DeleteNav(x => model.Ids.Contains(x.Id)) - .Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Server).Include(x => x.Attachments) + .Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Attachments) .ExecuteCommandAsync(); await TenantDb.Ado.CommitTranAsync(); diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs index b7fb0a4e..e9fd271f 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs @@ -1,4 +1,5 @@ using DS.Module.Core.Data; +using SqlSugar; using System.ComponentModel; namespace DS.WMS.Core.Sys.Entity; @@ -6,9 +7,9 @@ namespace DS.WMS.Core.Sys.Entity; /// /// 用户实体 /// -[SqlSugar.SugarTable("sys_user")] +[SugarTable("sys_user")] public class SysUser : UserTenantModel -{ +{ /// /// 登陆账号 /// @@ -118,7 +119,7 @@ public class SysUser : UserTenantModel [Description("大简云用户id")] public string DjyUserId { get; set; } - + /// /// 用户类型 0-超管 1-管理员 2-普通用户 3- 租户申请 /// @@ -142,8 +143,8 @@ public class SysUser : UserTenantModel /// [Description("公司Id")] public string CompanyId { get; set; } - - + + /// /// 默认机构Id /// @@ -166,25 +167,25 @@ public class SysUser : UserTenantModel ///
[Description("是否操作")] public bool IsOperator { get; set; } = false; - + /// /// 是否单证 /// [Description("是否单证")] public bool IsVouchingClerk { get; set; } = false; - + /// /// 是否销售 /// [Description("是否销售")] public bool IsSale { get; set; } = false; - + /// /// 是否报关员 /// [Description("是否报关员")] public bool IsCustom { get; set; } = false; - + /// /// 是否财务 /// @@ -216,4 +217,11 @@ public class SysUser : UserTenantModel ///
[Description("邮件签名")] public string SignatureHtml { get; set; } + + /// + /// 邮件签名Html代码 + /// + [SugarColumn(ColumnDescription = "SignatureHtml", Length = 255, IsNullable = true)] + public string? SignatureHtml { get; set; } + } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt index bf95c4f7..a2d6236b 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -110,3 +110,10 @@ 2024-08-08 19:59:15.1322 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config 2024-08-08 19:59:15.1322 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-08-08 19:59:15.1461 Info Configuration initialized. +2024-08-09 09:16:39.0114 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-08-09 09:16:39.0238 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-08-09 09:16:39.0238 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-08-09 09:16:39.0383 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-08-09 09:16:39.0383 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-08-09 09:16:39.0383 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-08-09 09:16:39.0514 Info Configuration initialized. diff --git a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user index 3437dc22..da1782b6 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>D:\Publish\DS8\FeeApi - True|2024-08-09T00:45:38.7858906Z||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;True|2024-07-24T15:48:52.0128987+08:00||;True|2024-07-23T17:41:01.7494842+08:00||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; + True|2024-08-09T01:18:05.8484398Z||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;True|2024-07-24T15:48:52.0128987+08:00||;True|2024-07-23T17:41:01.7494842+08:00||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs index a0a21775..a69e4130 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs @@ -1,4 +1,5 @@ -using DS.Module.Core; +using System.Net; +using DS.Module.Core; using DS.WMS.Core.Op.Entity.TaskInteraction; using DS.WMS.Core.Op.Interface.TaskInteraction; using Microsoft.AspNetCore.Mvc; @@ -21,6 +22,31 @@ namespace DS.WMS.OpApi.Controllers this.service = service; } + /// + /// 运行测试 + /// + /// + /// 任务类型 + /// 业务ID + /// + [HttpGet, Route("RunTest")] + public async Task RunTestAsync([FromServices] IActionManagerService actionManager, + [FromQuery] TaskBaseTypeEnum taskype, [FromQuery] long? id) + { + HttpStatusCode statusCode; + try + { + await actionManager.TriggerTest(taskype, id); + statusCode = HttpStatusCode.NoContent; + } + catch + { + statusCode = HttpStatusCode.InternalServerError; + } + + return new StatusCodeResult((int)statusCode); + } + /// /// 获取分页列表 /// @@ -38,7 +64,7 @@ namespace DS.WMS.OpApi.Controllers /// ID /// [HttpGet, Route("Edit")] - public async Task>GetAsync(long id) + public async Task> GetAsync(long id) { return await service.GetAsync(id); } @@ -49,7 +75,7 @@ namespace DS.WMS.OpApi.Controllers /// 邮件配置 /// [HttpPost, Route("Edit")] - public async Task EditAsync(BusinessTaskMail taskMail) + public async Task EditAsync(BusinessTaskMail taskMail) { if (taskMail.Receiver == null) return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskMailReceiverNotNull)); diff --git a/ds-wms-service/DS.WMS.OpApi/appsettings.json b/ds-wms-service/DS.WMS.OpApi/appsettings.json index 9982e71a..efa550f2 100644 --- a/ds-wms-service/DS.WMS.OpApi/appsettings.json +++ b/ds-wms-service/DS.WMS.OpApi/appsettings.json @@ -1,64 +1,64 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - "JwtSettings": { - "Issuer": "vol.core.owner", - "Audience": "vol.core", - "User": "C5ABA9E202D94C43A3CA66002BF77FAF", - "SecretKey": "sdfsdfsrty45634kkhllghtdgdfss345t678fs" - }, - "Cors": { - "PolicyName": "WMSCore.API", - "Url": "http://localhost:8000,http://localhost:5999,http://localhost:8088,http://localhost:5173,http://0.0.0.0:5999,http://0.0.0.0:9995,http://localhost:9995,http://rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com:9995,http://localhost:3000,https://localhost:3100,http://47.104.255.182:3100,http://47.104.255.182:3110,https://localhost:3110,http://localhost:8080,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084" - }, - "DBInfo": { - "DefaultDbConnId": "1288018625843826688", - "DefaultDbType": 0, - "DefaultDbString": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_dev", - "DBS": [ - { - "ConnId": "1288018625843826680", - "DBType": 0, - "Enabled": false, - "HitRate": 40, - "Connection": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_log" - } - ] - }, - "SwaggerDoc": { - "ContactName": "WmsOpAPI", - "ContactEmail": "Wms API.Core@xxx.com", - "ContactUrl": "https://www.xxx.com", - "Version": "1.0", - "Title": "Wms Op API", - "Description": "Wms Op API" - }, - "Middleware": { - "RecordAccessLogs": { - "Enabled": true, - "IgnoreApis": "/api/permission/getnavigationbar,/api/monitor/getids4users,/api/monitor/getaccesslogs,/api/monitor/server,/api/monitor/getactiveusers,/api/monitor/server," - } - }, - "FileSettings": { - "BasePath": "", //基础路径,不配置则使用当前系统目录 - "RelativePath": "LinkAttach", - "FileType": [ ".xls", ".xlsx", ".pdf", ".jpg", ".png", ".txt", ".pms" ] - }, - //打印模板 - "PrintTemplate": { - "BasePath": "", //基础路径,不配置则使用当前系统目录 - "RelativePath": "Upload/PrintTemplate", - "FileType": [ ".frx", ".xls" ] - }, - "TempFile": { - "Path": "TempFiles", - "RemainHours": 2 - }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "JwtSettings": { + "Issuer": "vol.core.owner", + "Audience": "vol.core", + "User": "C5ABA9E202D94C43A3CA66002BF77FAF", + "SecretKey": "sdfsdfsrty45634kkhllghtdgdfss345t678fs" + }, + "Cors": { + "PolicyName": "WMSCore.API", + "Url": "http://localhost:8000,http://localhost:5999,http://localhost:8088,http://localhost:5173,http://0.0.0.0:5999,http://0.0.0.0:9995,http://localhost:9995,http://rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com:9995,http://localhost:3000,https://localhost:3100,http://47.104.255.182:3100,http://47.104.255.182:3110,https://localhost:3110,http://localhost:8080,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084" + }, + "DBInfo": { + "DefaultDbConnId": "1288018625843826688", + "DefaultDbType": 0, + "DefaultDbString": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_dev", + "DBS": [ + { + "ConnId": "1288018625843826680", + "DBType": 0, + "Enabled": false, + "HitRate": 40, + "Connection": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_log" + } + ] + }, + "SwaggerDoc": { + "ContactName": "WmsOpAPI", + "ContactEmail": "Wms API.Core@xxx.com", + "ContactUrl": "https://www.xxx.com", + "Version": "1.0", + "Title": "Wms Op API", + "Description": "Wms Op API" + }, + "Middleware": { + "RecordAccessLogs": { + "Enabled": true, + "IgnoreApis": "/api/permission/getnavigationbar,/api/monitor/getids4users,/api/monitor/getaccesslogs,/api/monitor/server,/api/monitor/getactiveusers,/api/monitor/server," + } + }, + "FileSettings": { + "BasePath": "", //基础路径,不配置则使用当前系统目录 + "RelativePath": "LinkAttach", + "FileType": [ ".xls", ".xlsx", ".pdf", ".jpg", ".png", ".txt", ".pms" ] + }, + //打印模板 + "PrintTemplate": { + "BasePath": "", //基础路径,不配置则使用当前系统目录 + "RelativePath": "Upload/PrintTemplate", + "FileType": [ ".frx", ".xls" ] + }, + "TempFile": { + "Path": "TempFiles", + "RemainHours": 2 + }, "PrintService": { "IP": "60.209.125.238", "Port": "3009", @@ -82,27 +82,34 @@ "CancelServiceStatusUrl": "/EmbedProjectGoodsStatus/CancelServiceStatus", "GetEnableProjectDictTreeList": "/EmbedProjectGoodsStatus/GetEnableProjectDictTreeList" }, - "ExcuteRuleService": { - "IP": "47.104.73.97", - "Port": "7115", - "SenderKey": "SEFBZkh5V3R1TGxtdlBIcTF4QmNMWURCS08vb2EvTzVxS0F0eDFKdlgyS3lKVUx6K3JRRE94Q2kvcWZMRytZeWxyVkhLdk9hRGpzVStPamhIUXd5NU9FMjhFTktwUlZ2eThJZGlQd3p5dUk9", - "SendUrl": "/api/RulesEngineManage/ExcuteWorkFlow", - "RulesEngineSender": "Dongsheng8", - "RulesEngineSenderName": "东胜8" - }, - "MSKAPIService": { - "UserKey": "wu", - "UserSecret": "123456", - "Environment": "TEST" - }, + "ExcuteRuleService": { + "IP": "47.104.73.97", + "Port": "7115", + "SenderKey": "SEFBZkh5V3R1TGxtdlBIcTF4QmNMWURCS08vb2EvTzVxS0F0eDFKdlgyS3lKVUx6K3JRRE94Q2kvcWZMRytZeWxyVkhLdk9hRGpzVStPamhIUXd5NU9FMjhFTktwUlZ2eThJZGlQd3p5dUk9", + "SendUrl": "/api/RulesEngineManage/ExcuteWorkFlow", + "RulesEngineSender": "Dongsheng8", + "RulesEngineSenderName": "东胜8" + }, + "MSKAPIService": { + "UserKey": "wu", + "UserSecret": "123456", + "Environment": "TEST" + }, "RedisInfo": { "RedisConfig": "127.0.0.1:6379,password=,defaultDatabase=15" }, - "BCCompare": { - "Url": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare" - }, + "BCCompare": { + "Url": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare" + }, "ShippingOrderCompare": { "Url": "http://47.104.73.97:7115/api/TaskShippingOrderCompare/ExcuteShippingOrderCompare", "ResultUrl": "http://47.104.73.97:7115/api/TaskShippingOrderCompare/CompareResult" + }, + "TaskMail": { + "FileBaseUrl": "http://118.190.144.189:3008", + "JsonPrint": "/printApi/OpenPrint/GetOpenJsonPrintInfoAsync", + "JsonPrintByCode": "/printApi/OpenPrint/GetOpenJsonPrintInfoByTemplateCode", + "SQLPrint": "/printApi/OpenPrint/GetOpenSqlPrintInfo", + "MailApiUrl": "http://47.104.73.97:8801/mail/send" } } From 2d5c060e3f241b9a4b223f79f502cfe609044415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Fri, 9 Aug 2024 15:36:19 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E7=AD=BE=E5=90=8DHtml=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs index e9fd271f..109542e8 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs @@ -212,11 +212,6 @@ public class SysUser : UserTenantModel ///
[Description("签名图片")] public string SignatureUrl { get; set; } - /// - /// 邮件签名 - /// - [Description("邮件签名")] - public string SignatureHtml { get; set; } /// /// 邮件签名Html代码 From 10699aafa49f0d798d8afe6f7fd92ebffcd8ffd1 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Fri, 9 Aug 2024 15:47:09 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=9F=BA=E7=A1=80=E8=A1=A8=E6=9C=BA=E6=9E=84?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskPlat/Method/TaskManageService.cs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs index 4f89c746..c1ec1228 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -70,7 +70,7 @@ namespace DS.WMS.Core.TaskPlat.Method { SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); - TaskBaseInfo taskInfo = await tenantDb.Queryable() + TaskBaseInfo taskInfo = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .OrderByDescending(a => a.Id) .FirstAsync(t => t.OUT_BS_NO == bsno && t.TASK_TYPE == taskBaseTypeEnum.ToString()); @@ -120,7 +120,7 @@ namespace DS.WMS.Core.TaskPlat.Method { SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); - TaskBaseInfo taskInfo = await tenantDb.Queryable() + TaskBaseInfo taskInfo = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .OrderByDescending(a => a.Id) .FirstAsync(t => t.OUT_BS_NO == bsno && t.TASK_TYPE == taskBaseTypeEnum.ToString()); @@ -182,7 +182,7 @@ namespace DS.WMS.Core.TaskPlat.Method SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); try { - var taskId = await tenantDb.Queryable() + var taskId = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .Where(t => t.OUT_BS_NO == bsno && t.TASK_TYPE == taskBaseTypeEnum.ToString()) .OrderByDescending(a => a.Id) .Select(t => t.Id) @@ -251,7 +251,7 @@ namespace DS.WMS.Core.TaskPlat.Method // 如果业务主键不为空,则通过业务主键进行重复判断 if (info.Head.BSNO is not null or 0) { - taskInfo = await tenantDb.Queryable() + taskInfo = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .Where(t => t.OUT_BS_NO == info.Head.BSNO) .WhereIF(info.Main.IsCheckExistsByTaskType, t => t.TASK_TYPE == info.Main.TaskType.ToString()) .OrderByDescending(a => a.Id) @@ -260,7 +260,7 @@ namespace DS.WMS.Core.TaskPlat.Method // 否则通过Head.GID进行判断 else { - taskInfo = await tenantDb.Queryable() + taskInfo = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .Where(t => t.OUT_BUSI_NO == $"{info.Head.SenderId}_{info.Head.GID}") .WhereIF(info.Main.IsCheckExistsByTaskType, t => t.TASK_TYPE == info.Main.TaskType.ToString()) .OrderByDescending(a => a.Id) @@ -411,7 +411,7 @@ namespace DS.WMS.Core.TaskPlat.Method taskInfo.NeedArriveTime = info.Main.TruckInfo.NeedArriveTime; } - if(string.IsNullOrWhiteSpace(info.Main.TaskBatchNo)) + if (string.IsNullOrWhiteSpace(info.Main.TaskBatchNo)) { info.Main.TaskBatchNo = SnowFlakeSingle.Instance.NextId().ToString(); } @@ -1625,7 +1625,7 @@ namespace DS.WMS.Core.TaskPlat.Method - var taskNo = await tenantDb.Queryable().Where(a => a.Id == taskInfo.Id).Select(a => a.TASK_NO).FirstAsync(); + var taskNo = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)).Where(a => a.Id == taskInfo.Id).Select(a => a.TASK_NO).FirstAsync(); //回写任务号 var result = new DataResult(ResultCode.Success, "新增任务成功", data: taskNo); @@ -2190,6 +2190,7 @@ namespace DS.WMS.Core.TaskPlat.Method var userId = long.Parse(user.UserId); //任务列表分组统计 var groupList = await tenantDb.Queryable() + .ClearFilter(typeof(IOrgId)) .LeftJoin((t, a) => t.Id == a.TaskId) .Where(whereList) .Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (t.CreateBy == userId || a.UserId == userId))) @@ -2421,7 +2422,7 @@ namespace DS.WMS.Core.TaskPlat.Method var userId = long.Parse(user.UserId); string batchNo = Guid.NewGuid().ToString(); - var taskList = await tenantDb.Queryable() + var taskList = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .Where(x => ids.Contains(x.Id)).ToListAsync(); @@ -2607,7 +2608,7 @@ namespace DS.WMS.Core.TaskPlat.Method var userId = long.Parse(user.UserId); string batchNo = Guid.NewGuid().ToString(); - var taskList = await tenantDb.Queryable() + var taskList = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .Where(x => ids.Contains(x.Id)).ToListAsync(); @@ -2673,7 +2674,7 @@ namespace DS.WMS.Core.TaskPlat.Method string status, long userId) { - queryable.Where(whereList) + queryable.ClearFilter(typeof(IOrgId)).Where(whereList) .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString()) .WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == status) .WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 @@ -2692,7 +2693,7 @@ namespace DS.WMS.Core.TaskPlat.Method string status, long userId) { - queryable.Where(whereList) + queryable.ClearFilter(typeof(IOrgId)).Where(whereList) .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString()) .WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == status) .WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0