From 449baf2dfd9e1fb566b1fc138da4b6ac90a6eb23 Mon Sep 17 00:00:00 2001 From: dengyu Date: Mon, 14 Oct 2024 17:18:19 +0800 Subject: [PATCH] =?UTF-8?q?20241014=20=E6=89=B9=E9=87=8F=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=20=E5=A2=9E=E5=8A=A0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=9A=E8=AF=86=E5=88=AB=E4=B8=BA=E5=BE=85=E4=B8=8A=E7=BA=BF?= =?UTF-8?q?=E7=9A=84=EF=BC=8C=E5=BF=85=E9=A1=BB=E9=80=89=E6=88=90=E4=B8=8A?= =?UTF-8?q?=E7=BA=BF=E6=88=96=E4=B8=8B=E7=BA=BF=E6=89=8D=E8=83=BD=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=89=A7=E8=A1=8C=20=E5=8D=95=E7=A8=8B=E7=A7=9F?= =?UTF-8?q?=E5=85=A5=E6=94=B9=E4=B8=BA=E4=B8=8D=E5=85=81=E8=AE=B8=E5=BD=95?= =?UTF-8?q?=E5=85=A5=E8=BF=98=E7=AE=B1=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 3 + .../Controllers/CM_RentOneWayController.cs | 13 ++ .../Dtos/VW_CM_RentOneWay_NeedRentRes.cs | 130 +++++++++++++++++ .../Entity/CM_State_Change_Temp.cs | 7 + .../Entity/VW_CM_RentOneWay_NeedRent.cs | 133 ++++++++++++++++++ .../Interface/ICM_BaseInfoService.cs | 5 +- .../Interface/ICM_RentOneWayService.cs | 8 ++ .../Method/CM_BaseInfoService.cs | 3 +- .../Method/CM_RentOneWayService.cs | 31 ++++ .../Method/CM_RentOneWay_InService.cs | 90 ++++++------ .../CM_State_Change_TemplatImportService.cs | 66 ++++++++- .../Controllers/ExcelController.cs | 6 +- .../DS.WMS.Test/ContainerManagementTest.cs | 4 +- 13 files changed, 445 insertions(+), 54 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOneWay_NeedRentRes.cs create mode 100644 ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/VW_CM_RentOneWay_NeedRent.cs diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index 9b8bb873..62d8b0be 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -1700,5 +1700,8 @@ public static class MultiLanguageConst [Description("箱号无法进行此操作")] public const string CM_CtnCannotDo = "Cntrno can not do this."; + + [Description("还存在未处理上线状态的导入明细")] + public const string CM_NoDealTempDetail = "Exists some Detail need to deal."; #endregion } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentOneWayController.cs b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentOneWayController.cs index 07eecc29..0b9a4075 100644 --- a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentOneWayController.cs +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentOneWayController.cs @@ -139,4 +139,17 @@ public class CM_RentOneWayController : ApiController //return res; } + + /// + /// 单程 待租出 明细视图 + /// + /// + /// + [HttpPost] + [Route("CM_RentOneWay_NeedRent_View")] + public Task>> CM_RentOneWay_NeedRent_View([FromBody] PageRequest request) + { + var res = _invokeService.CM_RentOneWay_NeedRent_View(request); + return res; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOneWay_NeedRentRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOneWay_NeedRentRes.cs new file mode 100644 index 00000000..4b99812f --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOneWay_NeedRentRes.cs @@ -0,0 +1,130 @@ +using DS.Module.Core; +using DS.Module.Core.Enums; +using DS.WMS.Core.Op.Entity; +using FluentValidation; +using Masuit.Tools.Systems; +using SqlSugar; +using System.ComponentModel; + +namespace DS.WMS.ContainerManagement.Info.Dtos; + +/// +/// 箱管_单程 待单程租出箱明细 返回实体 +/// +public class VW_CM_RentOneWay_NeedRentRes +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// Desc:箱号 + /// + public string Cntrno { get; set; } + /// + /// 箱型代码 + /// + public string CtnCode { get; set; } + /// + /// Desc:箱型 + /// + public string Ctnall { get; set; } + + /// + /// Desc:箱主Id + /// + public long CtnOwnerId { get; set; } + /// + /// Desc:箱主 + /// + public string CtnOwner { get; set; } + + /// + /// Desc:是否上线id(是否管理中) + /// + public CM_IsOnlineEnum? IsOnlineId { get; set; } = 0; + /// + /// Desc:是否上线(是否管理中) + /// + public string IsOnline => IsOnlineId?.GetDescription(); + /// + /// Desc:箱来源Id: 自有箱/短租租入/长租租入/买箱 + /// + public CM_CtnSourceEnum? CtnSourceId { get; set; } + /// + /// Desc:箱来源: 自有箱/短租租入/长租租入/买箱 + /// + public string CtnSource => CtnSourceId?.GetDescription(); + + /// + /// Desc:箱业务状态id: 短租租出 长租租出 单程 卖箱 + /// + public CM_CtnBizStateEnum? CtnBizStateId { get; set; } + /// + /// Desc:箱业务状态: 短租租出 长租租出 单程 卖箱 + /// + public string CtnBizState => CtnBizStateId?.GetDescription(); + /// + /// + /// Desc:箱状态Id + /// + public CMCtnStateEnum? CtnStateId { get; set; } + /// + /// Desc:箱状态 + /// + public string CtnState => CtnStateId?.GetDescription(); + + /// + /// Desc:箱流转状态Id + /// + public CMCtnFlowStateEnum? CtnFlowStateId { get; set; } + /// + /// Desc:箱流转状态 + /// + public string CtnFlowState => CtnFlowStateId?.GetDescription(); + /// + /// Desc:当前港口代码 + /// + public long? Portid { get; set; } + + /// + /// Desc:当前港口五字码 + /// + public string PortCode { get; set; } + + /// + /// Desc:当前港口 + /// + public string Port { get; set; } + + /// + /// Desc:业务编号/提单号 + /// + public string Mblno { get; set; } + + /// + /// Desc:船名航次 + /// + public string VesselVoyno { get; set; } + + /// + /// 状态时间 + /// + public DateTime StateTime { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// Desc:关联放箱单号 + /// + public string? CtnReleaseNo { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } +} diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change_Temp.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change_Temp.cs index dbc89be9..4e512052 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change_Temp.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change_Temp.cs @@ -18,5 +18,12 @@ public class CM_State_Change_Temp : CM_State_Change /// [SugarColumn(ColumnDescription = "父节点号", IsNullable = false)] public long Pid { get; set; } + + /// + /// 处理结果备注 + /// + [SugarColumn(ColumnDescription = "处理结果备注", IsNullable = false)] + public string DealRemark { get; set; } + } diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/VW_CM_RentOneWay_NeedRent.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/VW_CM_RentOneWay_NeedRent.cs new file mode 100644 index 00000000..d292eeb4 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/VW_CM_RentOneWay_NeedRent.cs @@ -0,0 +1,133 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using DS.Module.Core.Enums; +using Masuit.Tools.Systems; +using SqlSugar; +using System.ComponentModel; + +namespace DS.WMS.ContainerManagement.Info.Entity; + +/// +/// 箱管_单程 待单程租出箱明细 +/// +[SqlSugar.SugarTable("VW_CM_RentOneWay_NeedRent", "箱管_单程 待单程租出箱明细")] +public class VW_CM_RentOneWay_NeedRent : BaseOrgModelV2 +{ + + /// + /// 箱当前状态id + /// + [SugarColumn(ColumnDescription = "箱当前状态id", IsNullable = false)] + public long Id { get; set; } + /// + /// Desc:箱号 + /// + [SugarColumn(ColumnDescription = "箱号", IsNullable = false, Length = 20)] + public string Cntrno { get; set; } + /// + /// 箱型代码 + /// + [SqlSugar.SugarColumn(ColumnDescription = "箱型代码", Length = 10, IsNullable = true)] + public string CtnCode { get; set; } + /// + /// Desc:箱型 + /// + [SugarColumn(ColumnDescription = "箱型", IsNullable = false, Length = 20)] + public string Ctnall { get; set; } + + /// + /// Desc:箱主Id + /// + [SqlSugar.SugarColumn(ColumnDescription = "箱主Id", IsNullable = false, DefaultValue = "0")] + public long CtnOwnerId { get; set; } + /// + /// Desc:箱主 + /// + [SugarColumn(ColumnDescription = "箱主", IsNullable = true, Length = 50)] + public string CtnOwner { get; set; } + + /// + /// Desc:是否上线id(是否管理中) + /// + [SugarColumn(ColumnDescription = "是否上线id", IsNullable = true, DefaultValue = "0")] + public CM_IsOnlineEnum? IsOnlineId { get; set; } = 0; + /// + /// Desc:箱来源Id: 自有箱/短租租入/长租租入/买箱 + /// + [SugarColumn(ColumnDescription = "箱来源Id", IsNullable = true, Length = 20)] + public CM_CtnSourceEnum? CtnSourceId { get; set; } + /// + /// Desc:箱业务状态id: 短租租出 长租租出 单程 卖箱 + /// + [SugarColumn(ColumnDescription = "箱业务状态Id", IsNullable = true)] + public CM_CtnBizStateEnum? CtnBizStateId { get; set; } + /// + /// + /// Desc:箱状态Id + /// + [SugarColumn(ColumnDescription = "箱状态Id", IsNullable = true)] + public CMCtnStateEnum? CtnStateId { get; set; } + + + /// + /// Desc:箱流转状态Id + /// + [SugarColumn(ColumnDescription = "箱流转状态Id", IsNullable = true)] + public CMCtnFlowStateEnum? CtnFlowStateId { get; set; } + + /// + /// Desc:当前港口代码 + /// + [SugarColumn(ColumnDescription = "当前港口代码", IsNullable = true)] + public long? Portid { get; set; } + + /// + /// Desc:当前港口五字码 + /// + [SugarColumn(ColumnDescription = "当前港口五字码", IsNullable = true, Length = 10)] + public string PortCode { get; set; } + + /// + /// Desc:当前港口 + /// + [SugarColumn(ColumnDescription = "当前港口", IsNullable = true, Length = 50)] + public string Port { get; set; } + + /// + /// Desc:业务编号/提单号 + /// + [SugarColumn(ColumnDescription = "业务编号/提单号", IsNullable = true, Length = 20)] + public string Mblno { get; set; } + + /// + /// Desc:船名航次 + /// + [SugarColumn(ColumnDescription = "船名航次", IsNullable = true, Length = 100)] + public string VesselVoyno { get; set; } + + /// + /// 状态时间 + /// + [Description("状态时间")] + public DateTime StateTime { get; set; } + + /// + /// 创建时间 + /// + [Description("创建时间")] + public DateTime CreateTime { get; set; } + + /// + /// 备注 + /// + [SqlSugar.SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 400)] + public string Remark { get; set; } + + + /// + /// Desc:关联放箱单号 + /// + [SugarColumn(ColumnDescription = "关联放箱单号", IsNullable = true, Length = 50)] + public string CtnReleaseNo { get; set; } +} + diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_BaseInfoService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_BaseInfoService.cs index e6d97c2f..bd9b5695 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_BaseInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_BaseInfoService.cs @@ -47,10 +47,9 @@ public interface ICM_BaseInfoService public Task CM_DealExcel(CM_DealExcelReq model); /// - /// 判断箱号的箱型与当前的该箱基础信息的箱型是否一致 + /// 判断箱号是否合规 /// /// /// - //DataResult CM_CheckCtnCtnall(CM_DealExcelReq model); - + public bool ValidateContainerNumber(string containerNumber, out string trueCntrno); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentOneWayService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentOneWayService.cs index 2ff01f01..ff760964 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentOneWayService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentOneWayService.cs @@ -59,4 +59,12 @@ public interface ICM_RentOneWayService /// 当前状态IDs /// Task CM_RentOneWay_AddCtn(long id, params long[] ids); + + + /// + /// 单程业务 待租出 明细_视图 + /// + /// + /// + Task>> CM_RentOneWay_NeedRent_View(PageRequest request); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_BaseInfoService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_BaseInfoService.cs index f2ee1fbe..ac957beb 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_BaseInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_BaseInfoService.cs @@ -149,7 +149,6 @@ public class CM_BaseInfoService : ICM_BaseInfoService public DataResult CM_CheckCntrno(CM_CheckCntrno req) { - var Cntrno = req.Cntrno; Cntrno = Cntrno.Replace(",", ","); @@ -211,7 +210,7 @@ public class CM_BaseInfoService : ICM_BaseInfoService return result; } - public static bool ValidateContainerNumber(string containerNumber,out string trueCntrno) + public bool ValidateContainerNumber(string containerNumber,out string trueCntrno) { // 集装箱号的校验规则 // - 由4位字母(ISO代码)+ 6位数字 + 1位校验码组成 diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWayService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWayService.cs index 610b5dde..f0904aaa 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWayService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWayService.cs @@ -504,4 +504,35 @@ public class CM_RentOneWayService : CMServiceBase, ICM_RentOneWayService //return result > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); } + + + /// + /// 单程 待租出 明细_视图 + /// + /// + /// + public async Task>> CM_RentOneWay_NeedRent_View(PageRequest request) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + //if (request.PageCondition.SortConditions == null || request.PageCondition.SortConditions.Count() == 0) + //{ + // request.PageCondition.SortConditions = new SortCondition[]{new SortCondition + // { + // SortField = nameof(VW_CM_RentOut_NeedRentRes.StateTime), + // ListSortDirection = System.ComponentModel.ListSortDirection.Descending + // } }; + //} + + request.SetDefaultOrderField("StateTime"); + + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + var data = tenantDb.Queryable() + .Where(whereList) + .Select() + .ToQueryPage(request.PageCondition); + return data; + } + } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWay_InService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWay_InService.cs index 532a5479..f1f25c7a 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWay_InService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWay_InService.cs @@ -251,10 +251,11 @@ public class CM_RentOneWay_InService : CMServiceBase, ICM_RentOneWay_InService //如果是提箱/还箱 分别产生变动 + //20241014 现在租入不处理还箱 foreach (var detail in body) { - if (detail.PickupPortid != null) + if (detail.PickupDate != null) { var changerec = new CM_State_ChangeReq(); @@ -312,63 +313,64 @@ public class CM_RentOneWay_InService : CMServiceBase, ICM_RentOneWay_InService await _Changeservice.AddCM_State_ChangeAsync(changerec); } - if (detail.DropoffDate != null) - { - var changerec = new CM_State_ChangeReq(); + //20241014 单程租入现在仅仅是租入 不处理还箱 + //if (detail.DropoffDate != null) + //{ + // var changerec = new CM_State_ChangeReq(); - changerec.Cntrno = detail.Cntrno; - changerec.CtnCode = detail.CtnCode; - changerec.Ctnall = detail.Ctnall; - changerec.UsedState = "USED"; - changerec.CtnOwnerId = data.OldContainerOwnerId; - changerec.CtnOwner = data.OldContainerOwner; + // changerec.Cntrno = detail.Cntrno; + // changerec.CtnCode = detail.CtnCode; + // changerec.Ctnall = detail.Ctnall; + // changerec.UsedState = "USED"; + // changerec.CtnOwnerId = data.OldContainerOwnerId; + // changerec.CtnOwner = data.OldContainerOwner; - //默认长租租入 - //changerec.CtnSourceId = detail.sour + // //默认长租租入 + // //changerec.CtnSourceId = detail.sour - changerec.CtnBizStateId = CM_CtnBizStateEnum.单程租入业务还箱; - changerec.ChangeSourceId = CMChangeSourceEnum.单程; - changerec.ChangeSourceDetailId = data.Id; - changerec.CtnFlowStateId = null; + // changerec.CtnBizStateId = CM_CtnBizStateEnum.单程租入业务还箱; + // changerec.ChangeSourceId = CMChangeSourceEnum.单程; + // changerec.ChangeSourceDetailId = data.Id; + // changerec.CtnFlowStateId = null; - changerec.CtnStateId = CMCtnStateEnum.AV; - changerec.CtnBreakStateId = CMCtnBreakStateEnum.AV; - changerec.IsHeavy = false; + // changerec.CtnStateId = CMCtnStateEnum.AV; + // changerec.CtnBreakStateId = CMCtnBreakStateEnum.AV; + // changerec.IsHeavy = false; - changerec.Billno = detail.Mblno; - //changerec.IsOnlineId = CM_IsOnlineEnum.待上线; + // changerec.Billno = detail.Mblno; + // //changerec.IsOnlineId = CM_IsOnlineEnum.待上线; - if (detail.DropoffPortid != null) - { - changerec.Portid = detail.DropoffPortid; - changerec.PortCode = detail.DropoffPortCode; - changerec.Port = detail.DropoffPort; - } + // if (detail.DropoffPortid != null) + // { + // changerec.Portid = detail.DropoffPortid; + // changerec.PortCode = detail.DropoffPortCode; + // changerec.Port = detail.DropoffPort; + // } - changerec.ChangeTime = data.Bsdate; - changerec.CtnFlowStateId = null; + // changerec.ChangeTime = data.Bsdate; + // changerec.CtnFlowStateId = null; - //如果没有填写提箱日期 则变动来源id设为租箱主单 变动日期设为业务日期 - //如果填写了提箱日期 则变动来源id设为租箱主单 变动日期设为提箱日期 + // //如果没有填写提箱日期 则变动来源id设为租箱主单 变动日期设为业务日期 + // //如果填写了提箱日期 则变动来源id设为租箱主单 变动日期设为提箱日期 - if (detail.PickupDate != null) - { - changerec.CtnStateId = CMCtnStateEnum.AV; - changerec.ChangeSourceDetailId = detail.Id;//还箱变动 来源是明细表 - changerec.CtnFlowStateId = CMCtnFlowStateEnum.已还箱; + // if (detail.PickupDate != null) + // { + // changerec.CtnStateId = CMCtnStateEnum.AV; + // changerec.ChangeSourceDetailId = detail.Id;//还箱变动 来源是明细表 + // changerec.CtnFlowStateId = CMCtnFlowStateEnum.已还箱; - changerec.ChangeTime = detail.DropoffDate; - changerec.IsOnlineId = CM_IsOnlineEnum.上线; - } + // changerec.ChangeTime = detail.DropoffDate; + // changerec.IsOnlineId = CM_IsOnlineEnum.上线; + // } - if (changerec.ChangeTime == null) changerec.ChangeTime = DateTime.Now; + // if (changerec.ChangeTime == null) changerec.ChangeTime = DateTime.Now; - //await TenantDb.Insertable(changerec).ExecuteReturnEntityAsync(); + // //await TenantDb.Insertable(changerec).ExecuteReturnEntityAsync(); - //await _Changeservice.UpdateCM_CurrentStateAsync(changerec); + // //await _Changeservice.UpdateCM_CurrentStateAsync(changerec); - await _Changeservice.AddCM_State_ChangeAsync(changerec); - } + // await _Changeservice.AddCM_State_ChangeAsync(changerec); + //} } diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs index cea1d2ec..0deaf542 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs @@ -69,6 +69,9 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha private readonly ICM_RentOneWayService _CM_RentOneWay; private readonly ICM_RentOneWay_InService _CM_RentOneWay_In; private readonly ICM_CtnScrapService _CM_CtnScrap; + private readonly ICM_BaseInfoService _CM_BaseInfo; + + /// /// /// @@ -93,6 +96,9 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha _CM_RentOneWay = _serviceProvider.GetRequiredService(); _CM_RentOneWay_In = _serviceProvider.GetRequiredService(); _CM_CtnScrap = _serviceProvider.GetRequiredService(); + _CM_BaseInfo = _serviceProvider.GetRequiredService(); + + } /// @@ -297,6 +303,11 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha insertrecords= tempList.Where(x => !DoneIdList.Contains(x.Id)).ToList(); } + if (insertrecords.Exists(x => x.IsOnlineId == CM_IsOnlineEnum.待上线)) + { + return await Task.FromResult(DataResult.Failed("添加失败!", MultiLanguageConst.CM_NoDealTempDetail)); + } + foreach (var item in insertrecords) { var saverec= item.Adapt(); @@ -304,6 +315,8 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha saverec.ChangeSourceId = CMChangeSourceEnum.手动批量变动; saverec.ChangeSourceDetailId = item.Id; + saverec.IsOnline = saverec.IsOnlineId?.GetDescription(); + var _addrec = saverec.Adapt(); await TenantDb.Insertable(saverec).ExecuteReturnEntityAsync(); @@ -963,7 +976,7 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha { newchange.VesselVoyno = Vessel +" : "+ Voyno; } - + newchange.IsOnlineId= CM_IsOnlineEnum.上线; changelist.Add(newchange); } @@ -972,6 +985,57 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha { await tenantDb.Deleteable(x => x.Pid == req.Id).ExecuteCommandAsync(); + //20241014 对于识别结果 做如下操作: + //1:判断箱号是否合规 不合规的记录错误(DealRemark=“箱号错误”) 是否上线记录成待上线, + //2:在箱当前状态表中查找,是否有此箱号,如果没有,或者有但是isonline不等于已上线, 是否上线记录成待上线 + + foreach (var ctn in changelist) + { + var trueCntrno = ""; + var istrue = _CM_BaseInfo.ValidateContainerNumber(ctn.Cntrno, out trueCntrno); + + if (istrue == true) + { + + } + else + { + ctn.IsOnlineId = CM_IsOnlineEnum.待上线; + ctn.DealRemark = $"箱号错误"; + + if (!string.IsNullOrWhiteSpace(trueCntrno)) + { + ctn.DealRemark += $",应为{trueCntrno}"; + } + } + } + + var _cntrnoList = changelist.Where(x => x.IsOnlineId == CM_IsOnlineEnum.上线).Select(s => s.Cntrno).ToList(); + var _currentStatusList = await tenantDb.Queryable().Where(x => _cntrnoList.Contains(x.Cntrno)).ToListAsync(); + foreach (var ctn in changelist.Where(x => x.IsOnlineId == CM_IsOnlineEnum.上线)) + { + if (_currentStatusList.Exists(x => x.Cntrno == ctn.Cntrno)) + { + var _rec = _currentStatusList.FirstOrDefault(x => x.Cntrno == ctn.Cntrno); + + if (_rec.IsOnlineId != CM_IsOnlineEnum.上线) + { + ctn.IsOnlineId = CM_IsOnlineEnum.待上线; + ctn.DealRemark = $"箱号目前非上线状态"; + } + } + else + { + ctn.IsOnlineId = CM_IsOnlineEnum.待上线; + ctn.DealRemark = $"未找到此箱号"; + } + } + + foreach (var ctn in changelist) + { + ctn.IsOnline= ctn.IsOnlineId?.GetDescription(); + } + var _r3 = await tenantDb.Insertable(changelist).ExecuteCommandAsync(); } diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs index 9d5f0c1d..bfdc3d4f 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs @@ -4,6 +4,8 @@ using DS.Module.ExcelModule.Model; using DS.WMS.Core.Code.Interface; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using NPOI.HPSF; +using System.Text; namespace DS.WMS.MainApi.Controllers { @@ -42,13 +44,13 @@ namespace DS.WMS.MainApi.Controllers /// [HttpPost] [Route("ExportExcelStreamByColumn")] - public IActionResult ExportExcelStreamByColumn([FromBody] ExportByColumnReq req) + public async Task ExportExcelStreamByColumn([FromBody] ExportByColumnReq req) { var result = _invokeService.ExportExcelStreamByColumn(req); HttpContext.Response.Headers.Add("Content-Length", result.Length.ToString()); HttpContext.Response.Headers.Add("Content-Type", "charset=UTF-8"); return File(result, "application/octet-stream;charset=UTF-8", Path.GetFileName(Path.GetRandomFileName() + ".xlsx")); - + //return new FileStreamResult(result, "application/octet-stream") { FileDownloadName = Guid.NewGuid().ToString() + ".xlsx" }; } } } diff --git a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs index 58ba1d2d..b8d1ca37 100644 --- a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs +++ b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs @@ -130,7 +130,7 @@ public class ContainerManagementTest //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_RentOneWay_In)); + //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_In)); //tenantDb.CodeFirst.InitTables(typeof(CM_BuyCtn)); //tenantDb.CodeFirst.InitTables(typeof(CM_BuyCtn_Detail)); @@ -147,7 +147,7 @@ public class ContainerManagementTest //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Templat)); //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_TemplatDetail)); //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_TemplatImport)); - //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Temp)); + tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Temp)); } Assert.True(true);