diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index 82394e4b..3c227a5e 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -23,7 +23,12 @@ public static class MultiLanguageConst /// [Description("更新成功")] public const string DataUpdateSuccess = "Data_Update_Success"; - + /// + /// 复制成功 + /// + [Description("复制成功")] + public const string DataCopySuccess = "Data_Copy_Success"; + /// /// 删除成功 /// diff --git a/ds-wms-service/DS.Module.Core/Extensions/Extensions.cs b/ds-wms-service/DS.Module.Core/Extensions/Extensions.cs index 9117db2f..aad82593 100644 --- a/ds-wms-service/DS.Module.Core/Extensions/Extensions.cs +++ b/ds-wms-service/DS.Module.Core/Extensions/Extensions.cs @@ -2,11 +2,21 @@ using System.ComponentModel; using System.Reflection; using Newtonsoft.Json.Linq; +using System.Text.RegularExpressions; namespace DS.Module.Core.Extensions; public static partial class Extensions { + /// + /// 字符串转大驼峰写法 + /// + /// + /// + public static string ToUpperCamelCase(this string input) + { + return Regex.Replace(input, "(?:^|_)[a-z]", m => m.Value.ToUpper()); + } /// /// 判断类型是否为Nullable类型 /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs index 816ba3b7..affb8627 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs @@ -13,12 +13,16 @@ public class SeaExportReq /// 主键Id /// public long Id { get; set; } + /// + /// 箱信息 + /// + public List CtnInfo { get; set; } /// /// 主单Id /// public long ParentId { get; set; } = 0; - + /// /// 业务状态 /// @@ -1019,7 +1023,7 @@ public class SeaExportReq /// 备注 /// public string Note { get; set; } = ""; - + } /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs index a59ef209..b1b1f3ff 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs @@ -18,7 +18,7 @@ namespace DS.WMS.Core.Op.Entity /// /// 业务编号 /// - [SqlSugar.SugarColumn(ColumnDescription = "业务编号", IsNullable = false, Length = 100)] + [SqlSugar.SugarColumn(ColumnDescription = "业务编号", IsNullable = true, Length = 100)] public string BSNO { get; set; } /// /// 箱型代码 @@ -41,13 +41,13 @@ namespace DS.WMS.Core.Op.Entity /// /// 箱量 /// - [SugarColumn(ColumnDescription = "箱量", DefaultValue = "0")] + [SugarColumn(ColumnDescription = "箱量", IsNullable = true, DefaultValue = "0")] public int CtnNum { get; set; } /// /// TEU /// - [SugarColumn(ColumnDescription = "TEU", DefaultValue = "0")] + [SugarColumn(ColumnDescription = "TEU", IsNullable = true, DefaultValue = "0")] public int TEU { get; set; } /// @@ -148,19 +148,19 @@ namespace DS.WMS.Core.Op.Entity /// /// 主票业务编号 /// - [SqlSugar.SugarColumn(ColumnDescription = "主票业务编号", IsNullable = false, Length = 100)] + [SqlSugar.SugarColumn(ColumnDescription = "主票业务编号", IsNullable = true, Length = 100)] public string MasterNo { get; set; } /// /// 承运车队 /// - [SqlSugar.SugarColumn(ColumnDescription = "承运车队", IsNullable = false, Length = 20)] + [SqlSugar.SugarColumn(ColumnDescription = "承运车队", IsNullable = true, Length = 20)] public string Trucker { get; set; } /// /// 车号 /// - [SqlSugar.SugarColumn(ColumnDescription = "车号", IsNullable = false, Length = 30)] + [SqlSugar.SugarColumn(ColumnDescription = "车号", IsNullable = true, Length = 30)] public string TruckNo { get; set; } /// /// 运费 @@ -171,12 +171,12 @@ namespace DS.WMS.Core.Op.Entity /// /// 免堆存天数 /// - [SugarColumn(ColumnDescription = "免堆存天数", DefaultValue = "0")] + [SugarColumn(ColumnDescription = "免堆存天数", IsNullable = true, DefaultValue = "0")] public int FreeStorageDay { get; set; } /// /// 堆存天数 /// - [SugarColumn(ColumnDescription = "堆存天数", DefaultValue = "0")] + [SugarColumn(ColumnDescription = "堆存天数", IsNullable = true, DefaultValue = "0")] public int StorageDay { get; set; } /// @@ -193,12 +193,12 @@ namespace DS.WMS.Core.Op.Entity /// /// 免箱使天数 /// - [SugarColumn(ColumnDescription = "免箱使天数", DefaultValue = "0")] + [SugarColumn(ColumnDescription = "免箱使天数", IsNullable = true, DefaultValue = "0")] public int FreeCtnDay { get; set; } /// /// 箱使天数 /// - [SugarColumn(ColumnDescription = "箱使天数", DefaultValue = "0")] + [SugarColumn(ColumnDescription = "箱使天数", IsNullable = true, DefaultValue = "0")] public int CtnDay { get; set; } /// @@ -216,29 +216,29 @@ namespace DS.WMS.Core.Op.Entity /// /// Desc:是否暂出 /// - [SugarColumn(ColumnDescription = "是否暂出", DefaultValue = "0")] + [SugarColumn(ColumnDescription = "是否暂出", IsNullable = true, DefaultValue = "0")] public bool? IsTemp { get; set; } = false; /// /// VGM地址 /// - [SqlSugar.SugarColumn(ColumnDescription = "VGM地址", IsNullable = false, Length = 100)] + [SqlSugar.SugarColumn(ColumnDescription = "VGM地址", IsNullable = true, Length = 100)] public string VGMAddr { get; set; } /// /// VGM邮箱 /// - [SqlSugar.SugarColumn(ColumnDescription = "VGM邮箱", IsNullable = false, Length = 60)] + [SqlSugar.SugarColumn(ColumnDescription = "VGM邮箱", IsNullable = true, Length = 60)] public string VGMEmail { get; set; } /// /// 提箱时间 /// - [SqlSugar.SugarColumn(ColumnDescription = "提箱时间", IsNullable = false, Length = 50)] + [SqlSugar.SugarColumn(ColumnDescription = "提箱时间", IsNullable = true, Length = 50)] public string PickUpTime { get; set; } /// /// 实际到港时间 /// - [SqlSugar.SugarColumn(ColumnDescription = "实际到港时间", IsNullable = false, Length = 50)] + [SqlSugar.SugarColumn(ColumnDescription = "实际到港时间", IsNullable = true, Length = 50)] public string ActualArrivalPortTime { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index c8c6177e..adc266dd 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -1,3 +1,4 @@ +using AngleSharp.Dom; using DS.Module.Core; using DS.Module.Core.Extensions; using DS.Module.SqlSugar; @@ -11,8 +12,11 @@ using DS.WMS.Core.System.Interface; using DS.WMS.Core.System.Method; using Mapster; using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; using Org.BouncyCastle.Ocsp; using SqlSugar; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace DS.WMS.Core.Op.Method; @@ -71,7 +75,7 @@ public class SeaExportService : ISeaExportService return DataResult.Failed("海运出口信息分提单号已存在!", MultiLanguageConst.SeaExportHBLNOExist); } //TODO 会计期间不允许小于已结转期间 - if (req.CloseDocDate.IsNotNull()&& req.CloseDocDate < req.ETD) + if (req.CloseDocDate.IsNotNull() && req.CloseDocDate < req.ETD) { return DataResult.Failed("截单日期不允许小于开船日期!", MultiLanguageConst.SeaExportCloseDocDateLimit); } @@ -89,6 +93,17 @@ public class SeaExportService : ISeaExportService var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); + if (req.CtnInfo.Count > 0) + { + + foreach (var item in req.CtnInfo) + { + var ctn = item.Adapt(); + ctn.BSNO = entity.Id.ToString(); + tenantDb.Insertable(ctn).ExecuteCommand(); + } + } + return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); } else @@ -111,6 +126,20 @@ public class SeaExportService : ISeaExportService return DataResult.Failed("截港日期不允许小于开船日期!", MultiLanguageConst.SeaExportCloseDateLimit); } tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand(); + + + if (req.CtnInfo.Count > 0) + { + var ctnList = tenantDb.Queryable().Where(x => x.BSNO == req.Id.ToString()).ToList(); + foreach (var item in req.CtnInfo) + { + + var ctn = ctnList.First(x => x.Id == item.Id); + ctn = item.Adapt(ctn); + tenantDb.Updateable(ctn).ExecuteCommand(); + } + } + return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); } } @@ -172,7 +201,7 @@ public class SeaExportService : ISeaExportService /// - /// 业务单据复制 + /// 业务单据单票复制 /// /// 业务Id /// @@ -186,32 +215,51 @@ public class SeaExportService : ISeaExportService } //获取表单复制模板 var template = tenantDb.Queryable().Where(x => x.PermissionId == 1772509201441099776).First(); + var sequence = commonService.GetSequenceNext(); + if (!sequence.Succeeded) + { + return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist); + } - var entity = new SeaExport(); + var data = new SeaExport(); if (template.IsNullOrEmpty()) + { + data = info.Adapt(data); + data.Id = 0; + data.ParentId = 0; + data.IsBusinessLocking = false; + data.IsFeeLocking = false; + data.CustomerNo = sequence.Data; + var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); + return DataResult.Successed("复制成功!", entity.Id, MultiLanguageConst.DataCopySuccess); + } + else { - var sequence = commonService.GetSequenceNext(); - if (!sequence.Succeeded) + data = info.Adapt(data); + data.Id = 0; + data.ParentId = 0; + data.IsBusinessLocking = false; + data.IsFeeLocking = false; + data.CustomerNo = sequence.Data; + + var list0 = template.CopyFields.Split(","); + var list1 = new List(); + foreach (var item in list0) { - return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist); + list1.Add(item.ToUpperCamelCase()); } - - entity = info.Adapt(entity); - entity.Id = 0; - entity.ParentId = 0; - entity.IsBusinessLocking = false; - entity.IsFeeLocking = false; - entity.CustomerNo = sequence.Data; + list1.Add("IsBusinessLocking"); + list1.Add("IsFeeLocking"); + list1.Add("CustomerNo"); + var insertColumns = list1.ToArray(); + //insertColumns.AddRange(["Id", "ParentId", "IsBusinessLocking", "IsFeeLocking", "CustomerNo"]); + var entity = tenantDb.Insertable(data).InsertColumns(insertColumns).ExecuteReturnEntity(); + + return DataResult.Successed("复制成功!", entity.Id, MultiLanguageConst.DataCopySuccess); } - info.IsFeeLocking = true; - var partList = tenantDb.Queryable().Where(x => x.ParentId == long.Parse(id)).ToList(); - - - - return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); } #region 删除 @@ -229,7 +277,7 @@ public class SeaExportService : ISeaExportService { return DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist); } - + if (tenantDb.Queryable().Where(x => x.ParentId == long.Parse(id)).Any()) { return DataResult.Failed("海运出口存在分票信息,不能删除!", MultiLanguageConst.SeaExportPartExist); @@ -304,7 +352,7 @@ public class SeaExportService : ISeaExportService item.DeleteBy = long.Parse(user.UserId); tenantDb.Updateable(item).ExecuteCommand(); } - + return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); } #endregion @@ -354,7 +402,7 @@ public class SeaExportService : ISeaExportService info.IsFeeLocking = true; tenantDb.Updateable(info).ExecuteCommand(); - + return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); } diff --git a/ds-wms-service/DS.WMS.Core/System/Method/CommonService.cs b/ds-wms-service/DS.WMS.Core/System/Method/CommonService.cs index 2abcb9e0..457b67c3 100644 --- a/ds-wms-service/DS.WMS.Core/System/Method/CommonService.cs +++ b/ds-wms-service/DS.WMS.Core/System/Method/CommonService.cs @@ -663,8 +663,42 @@ public class CommonService : ICommonService //去重 childs.Distinct(); //排序 - childs = childs.OrderBy(x => x.SortCode).ToList(); + childs = childs.OrderBy(x => x.SortCode).ToList(); + + foreach (var child in childs) + { + var grandsons = db.Queryable().Where(x => + x.MenuType == 2 && x.ParentId == child.Id && x.IsHidden == false && + permissions.Contains(x.Id)) //排除企业用户维护 + .OrderBy(x => x.SortCode) + .Select(a => new RouteItem + { + Id = a.Id, + ParentId = a.ParentId, + Path = a.Url, + Name = a.PermissionName, + Component = a.Component, + Meta = new RouteMeta() + { + Title = a.Title, + Icon = a.Icon, + } + }).ToList(); + if (grandsons.Count > 0) + { + //去重 + grandsons.Distinct(); + //排序 + grandsons = grandsons.OrderBy(x => x.SortCode).ToList(); + child.Children = grandsons; + } + + } + item.Children = childs; + + + } } diff --git a/ds-wms-service/DS.WMS.Core/System/Method/PermissionService.cs b/ds-wms-service/DS.WMS.Core/System/Method/PermissionService.cs index 626ebe64..7172fd9b 100644 --- a/ds-wms-service/DS.WMS.Core/System/Method/PermissionService.cs +++ b/ds-wms-service/DS.WMS.Core/System/Method/PermissionService.cs @@ -185,7 +185,7 @@ public class PermissionService : IPermissionService foreach (var child in childs) { - var buttons = db.Queryable().Where(x => x.MenuType == 3 && x.ParentId == child.Key) + var buttons = db.Queryable().Where(x =>(x.MenuType == 3 || x.MenuType == 2) && x.ParentId == child.Key) .OrderBy(x => x.SortCode) .Select(a => new PermissionTreeList { diff --git a/ds-wms-service/DS.WMS.Core/System/Method/SysRoleService.cs b/ds-wms-service/DS.WMS.Core/System/Method/SysRoleService.cs index a5928a1d..54c38bc2 100644 --- a/ds-wms-service/DS.WMS.Core/System/Method/SysRoleService.cs +++ b/ds-wms-service/DS.WMS.Core/System/Method/SysRoleService.cs @@ -177,7 +177,7 @@ public class SysRoleService : ISysRoleService { foreach (var child in childs) { - var buttons = db.Queryable().Filter(null, true).Where(x => x.MenuType == 3 && x.ParentId == child.Key) + var buttons = db.Queryable().Filter(null, true).Where(x => (x.MenuType == 3 || x.MenuType == 2) && x.ParentId == child.Key) .Select(a => new RolePermissionTree { Title = a.PermissionName, diff --git a/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt index b68acda9..41722e94 100644 --- a/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt @@ -1251,3 +1251,17 @@ 2024-04-24 16:11:01.7409 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config 2024-04-24 16:11:01.7496 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-04-24 16:11:01.7621 Info Configuration initialized. +2024-04-26 15:48:51.1363 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-26 15:48:51.1607 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-26 15:48:51.1678 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-26 15:48:51.1846 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-04-26 15:48:51.1846 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-26 15:48:51.2015 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-26 15:48:51.2113 Info Configuration initialized. +2024-04-26 16:00:39.8384 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-26 16:00:39.8665 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-26 16:00:39.8745 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-26 16:00:39.8912 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-04-26 16:00:39.9054 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-26 16:00:39.9054 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-26 16:00:39.9229 Info Configuration initialized. diff --git a/ds-wms-service/DS.WMS.Test/SaasTest.cs b/ds-wms-service/DS.WMS.Test/SaasTest.cs index 1f045639..5df7600c 100644 --- a/ds-wms-service/DS.WMS.Test/SaasTest.cs +++ b/ds-wms-service/DS.WMS.Test/SaasTest.cs @@ -5,8 +5,11 @@ using DS.Module.SqlSugar; using DS.WMS.Core.Info.Entity; using DS.WMS.Core.System.Entity; using Mapster; +using Masuit.Tools.Strings; using Microsoft.Extensions.DependencyInjection; using Microsoft.Owin.BuilderProperties; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; using Org.BouncyCastle.Ocsp; using SqlSugar; using SqlSugar.IOC; @@ -50,10 +53,10 @@ public class SaasTest { var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); - var info = tenantDb.Queryable().Filter(null,true).Where(x => x.Id == 1772138307266940928).First(); + var info = tenantDb.Queryable().Filter(null, true).Where(x => x.Id == 1772138307266940928).First(); var temp = new ClientTemp - { + { Address = "4", Name = "4", }; @@ -65,6 +68,25 @@ public class SaasTest Assert.True(true); } + [Fact] + + public void CopyColumnTest() + { + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + + var columns = "noBill,enName,copyNoBill"; + + + var list = columns.Split(","); + var list1 = new List(); + foreach (var item in list) + { + list1.Add(item.ToUpperCamelCase()); + } + Console.WriteLine(list1[0]); + Assert.True(true); + } + public class ClientTemp {