From c54f6b33f874ceb90521f29a94648e02547f50e0 Mon Sep 17 00:00:00 2001 From: dengyu Date: Thu, 1 Aug 2024 14:49:58 +0800 Subject: [PATCH] 20240801_1 --- .../Enums/ContainerManagementEnum.cs | 37 +++++++++++-- .../Logs/internal-nlog.txt | 42 +++++++++++++++ .../Dtos/CM_CurrentStateReq.cs | 4 ++ .../Dtos/CM_State_ChangeReq.cs | 15 ++++-- .../Entity/CM_CurrentState.cs | 8 +-- .../Method/CMServiceBase.cs | 1 + .../Method/CM_State_ChangeService.cs | 52 +++++++++++++++---- .../DS.WMS.Test/ContainerManagementTest.cs | 3 +- 8 files changed, 141 insertions(+), 21 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs b/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs index df7455d5..3ced7c0c 100644 --- a/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs +++ b/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs @@ -30,11 +30,10 @@ namespace DS.Module.Core.Enums 下线 = -1, } - /// - /// 箱管 当前业务类型 + /// 箱管 箱来源 /// - public enum CM_CtnBizStateEnum + public enum CM_CtnSourceEnum { /// /// 自有箱 @@ -51,6 +50,28 @@ namespace DS.Module.Core.Enums /// [Description("长租租入")] 长租租入 = 2, + } + + /// + /// 箱管 当前业务类型 + /// + public enum CM_CtnBizStateEnum + { + ///// + ///// 自有箱 + ///// + //[Description("自有箱")] + //自有箱 = 0, + /// + /// 短租租入 + /// + [Description("短租租入")] + 短租租入 = 1, + /// + /// 长租租入 + /// + [Description("长租租入")] + 长租租入 = 2, /// /// 单程业务 /// @@ -66,6 +87,16 @@ namespace DS.Module.Core.Enums /// [Description("卖箱")] 卖箱 = 5, + /// + /// 短租租出 + /// + [Description("短租租出")] + 短租租出 = 6, + /// + /// 长租租入 + /// + [Description("长租租出")] + 长租租出 = 7, } /// diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.ContainerManagementApi/Logs/internal-nlog.txt index feeb18a7..438960d2 100644 --- a/ds-wms-service/DS.WMS.ContainerManagementApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Logs/internal-nlog.txt @@ -68,3 +68,45 @@ 2024-08-01 09:37:27.7196 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config 2024-08-01 09:37:27.7196 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-08-01 09:37:27.7340 Info Configuration initialized. +2024-08-01 11:49:29.9055 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-08-01 11:49:29.9264 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-08-01 11:49:29.9264 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-08-01 11:49:29.9484 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-01 11:49:29.9484 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-08-01 11:49:29.9484 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-08-01 11:49:29.9684 Info Configuration initialized. +2024-08-01 13:39:23.4958 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-08-01 13:39:23.5142 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-08-01 13:39:23.5142 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-08-01 13:39:23.5336 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-01 13:39:23.5336 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-08-01 13:39:23.5437 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-08-01 13:39:23.5437 Info Configuration initialized. +2024-08-01 13:57:42.1376 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-08-01 13:57:42.1552 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-08-01 13:57:42.1552 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-08-01 13:57:42.1806 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-01 13:57:42.1889 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-08-01 13:57:42.1889 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-08-01 13:57:42.2000 Info Configuration initialized. +2024-08-01 14:00:00.0741 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-08-01 14:00:00.0942 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-08-01 14:00:00.0942 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-08-01 14:00:00.1696 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-01 14:00:00.1696 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-08-01 14:00:00.1821 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-08-01 14:00:00.1821 Info Configuration initialized. +2024-08-01 14:02:33.5932 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-08-01 14:02:33.6506 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-08-01 14:02:33.6561 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-08-01 14:02:33.6740 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-01 14:02:33.6740 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-08-01 14:02:33.6840 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-08-01 14:02:33.6840 Info Configuration initialized. +2024-08-01 14:34:44.6940 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-08-01 14:34:44.7323 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-08-01 14:34:44.7323 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-08-01 14:34:44.7718 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-01 14:34:44.7827 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-08-01 14:34:44.7827 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-08-01 14:34:44.7999 Info Configuration initialized. 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 e9464b66..6f1d221b 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 @@ -136,6 +136,10 @@ public class CM_CurrentStateReq /// public decimal? CtnValue_Base { get; set; } = 0; + /// + /// 箱初期成本 + /// + public decimal? CtnValue_BuyingPrice { get; set; } = 0; } /// 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 ac9ee7bb..351188c0 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 @@ -139,6 +139,12 @@ public class CM_State_ChangeReq /// 箱初期成本 /// public decimal? CtnValue_Base { get; set; } = 0; + + + /// + /// 箱初期成本 + /// + public decimal? CtnValue_BuyingPrice { get; set; } = 0; } @@ -170,9 +176,12 @@ public class CM_State_ChangeReq_Multi : CM_State_ChangeReq { if (cntrnoList != null && cntrnoList.Count > 0) { foreach (var cntrno in cntrnoList) { - var newrec = this.Adapt(); - newrec.Cntrno = cntrno; - result.Add(newrec); + if (!result.Exists(x => x.Cntrno == cntrno)) + { + var newrec = this.Adapt(); + newrec.Cntrno = cntrno; + result.Add(newrec); + } } } 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 2c625cd1..0f6ba7f7 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 @@ -49,7 +49,7 @@ public class CM_CurrentState : BaseOrgModel /// /// Desc:箱业务状态: 短租租出 长租租出 单程 卖箱 /// - [SugarColumn(ColumnDescription = "箱业务状态", DefaultValue = "")] + [SugarColumn(ColumnDescription = "箱业务状态", IsNullable = true, DefaultValue = "")] public string CtnBizState { get; set; } = "0"; /// @@ -61,7 +61,7 @@ public class CM_CurrentState : BaseOrgModel /// /// Desc:关联放箱单号 /// - [SugarColumn(ColumnDescription = "关联放箱单号", Length = 50)] + [SugarColumn(ColumnDescription = "关联放箱单号", IsNullable = true, Length = 50)] public string CtnReleaseNo { get; set; } /// @@ -79,13 +79,13 @@ public class CM_CurrentState : BaseOrgModel /// /// Desc:是否上线(是否管理中) /// - [SugarColumn(ColumnDescription = "是否上线", IsNullable = false, DefaultValue = "0")] + [SugarColumn(ColumnDescription = "是否上线", IsNullable = true, DefaultValue = "0")] public Int16? IsOnline { get; set; } = 0; /// /// Desc:空重箱 /// - [SugarColumn(ColumnDescription = "空重箱", IsNullable = false, DefaultValue = "0")] + [SugarColumn(ColumnDescription = "空重箱", IsNullable = true, DefaultValue = "0")] public bool? IsHeavy { get; set; } = false; /// diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CMServiceBase.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CMServiceBase.cs index c9b70e68..26408798 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CMServiceBase.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CMServiceBase.cs @@ -17,6 +17,7 @@ namespace DS.WMS.ContainerManagement.Info.Method /// public abstract class CMServiceBase { + /// /// 人民币代码 /// diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_ChangeService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_ChangeService.cs index 1a3f4a59..7439fe5d 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_ChangeService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_ChangeService.cs @@ -88,6 +88,8 @@ public class CM_State_ChangeService : CMServiceBase, ICM_State_ChangeService var entity = TenantDb.Insertable(data).ExecuteReturnEntity(); + UpdateCM_CurrentStateAsync(data); + return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); } else @@ -117,19 +119,20 @@ public class CM_State_ChangeService : CMServiceBase, ICM_State_ChangeService foreach (var item in datalist) { - item.Id = 0; - item.ChangeSource = "手动批量更新"; - item.ChangeTime = DateTime.Now; - TenantDb.Insertable(item).ExecuteReturnEntity(); + var _addrec = item.Adapt(); + _addrec.Id = 0; + _addrec.ChangeSource = "手动批量更新"; + //_addrec.ChangeTime = DateTime.Now; + TenantDb.Insertable(_addrec).ExecuteReturnEntity(); - //查找 + UpdateCM_CurrentStateAsync(item); } return DataResult.Successed("添加成功!", null, MultiLanguageConst.DataCreateSuccess); } catch (Exception ex) { - var msg = JsonConvert.SerializeObject(ex); + var msg = JsonConvert.SerializeObject(ex); return DataResult.Successed($"更新失败:{msg}", MultiLanguageConst.DataUpdateFailed); } } @@ -187,10 +190,10 @@ public class CM_State_ChangeService : CMServiceBase, ICM_State_ChangeService /// /// /// - public async Task UpdateCM_CurrentStateAsync(CM_State_Change change) + public async Task UpdateCM_CurrentStateAsync(CM_State_ChangeReq change) { //找到该箱号的当前状态 如果没有 新建一条 - var CurrState = await TenantDb.Queryable().Where(x => x.Cntrno == change.Cntrno).FirstAsync(); + var CurrState = TenantDb.Queryable().Where(x => x.Cntrno == change.Cntrno).First(); if (CurrState == null) { @@ -273,8 +276,15 @@ public class CM_State_ChangeService : CMServiceBase, ICM_State_ChangeService newCurrState.ETA = change.ETA; } newCurrState.StateTime = change.ChangeTime; - var entity = TenantDb.Insertable(newCurrState).ExecuteReturnEntity(); + try + { + var entity = TenantDb.Insertable(newCurrState).ExecuteReturnEntity(); + var _r = DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); + } + catch (Exception ex) { + //return DataResult.Failed("添加失败!" + ex.Message); + } } else { @@ -358,6 +368,30 @@ public class CM_State_ChangeService : CMServiceBase, ICM_State_ChangeService await TenantDb.Updateable(CurrState).ExecuteCommandAsync(); } + var ctnbase= TenantDb.Queryable().Where(x => x.Cntrno == change.Cntrno).First(); + if (ctnbase == null) + { + + var newBaseinfo = new CM_BaseInfo(); + newBaseinfo.Cntrno = change.Cntrno; + newBaseinfo.Ctnall = change.Ctnall; + newBaseinfo.ProductionDate = null; + newBaseinfo.CtnValue_Base = change.CtnValue_Base==null?0:change.CtnValue_Base; + + + newBaseinfo.CtnValue_BuyingPrice = change.CtnValue_BuyingPrice == null ? 0 : change.CtnValue_BuyingPrice; + + try + { + var entity = TenantDb.Insertable(newBaseinfo).ExecuteReturnEntity(); + var _r = DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); + } + catch (Exception ex) + { + //return DataResult.Failed("添加失败!" + ex.Message); + } + } + return DataResult.Success; } diff --git a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs index 05514b69..7c37c915 100644 --- a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs +++ b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs @@ -87,8 +87,7 @@ 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(BookingStatusLog));