From ffa34eef2edf85bb9971747b0a58a14ee413f2f9 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 6 Nov 2024 12:41:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E5=8D=95=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Op/Dtos/Enum/BLIssueActionEnum.cs | 2 +- .../DS.WMS.Core/Op/Entity/SeaExport.cs | 7 + .../Op/Entity/SeaExportBillManage.cs | 14 + .../BLIssueManage/BLIssueManageService.cs | 445 ++++++++++++++---- 4 files changed, 365 insertions(+), 103 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/Enum/BLIssueActionEnum.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/Enum/BLIssueActionEnum.cs index 1f381ae5..d6526939 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/Enum/BLIssueActionEnum.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/Enum/BLIssueActionEnum.cs @@ -35,7 +35,7 @@ namespace DS.WMS.Core.Op.Dtos /// /// 船证签入 /// - [Description("签入")] + [Description("船证签入")] ShipCertCheckIn, /// /// 船证签出 diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs index 29b39cda..f9e5bd82 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs @@ -1499,6 +1499,13 @@ public class SeaExport : BaseOrgModel [SugarColumn(ColumnDescription = "提单签发状态", IsNullable = true, DefaultValue = "0")] public int BLIssueStatus { get; set; } + /// + /// Desc:提单签发状态名称 + /// + [Description("提单签发状态名称")] + [SugarColumn(ColumnDescription = "提单签发状态名称", IsNullable = true, Length = 30)] + public string BLIssueStatusName { get; set; } + /// /// Desc:整票提交状态 /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs index bfbb0856..41a15da2 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs @@ -536,4 +536,18 @@ public class SeaExportBillManage : BaseOrgModel [Description("集装箱")] [SugarColumn(ColumnDescription = "集装箱", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] public string CntrTotal { get; set; } + + /// + /// 提单签发状态 + /// + [Description("提单签发状态")] + [SugarColumn(ColumnDescription = "提单签发状态", IsNullable = true, DefaultValue = "0")] + public int BLIssueStatus { get; set; } + + /// + /// 提单签发状态名称 + /// + [Description("提单签发状态名称")] + [SugarColumn(ColumnDescription = "提单签发状态名称", IsNullable = true, Length = 30)] + public string BLIssueStatusName { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BLIssueManage/BLIssueManageService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BLIssueManage/BLIssueManageService.cs index 53b61c43..54771fff 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BLIssueManage/BLIssueManageService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BLIssueManage/BLIssueManageService.cs @@ -586,6 +586,8 @@ namespace DS.WMS.Core.Op.Method if (model.bookids.Count == 0) return DataResult.Failed("请求参数错误,请选择提单记录"); + DateTime nowDate = DateTime.Now; + if (model.bookids.Any(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase))) { var checkIds = model.bookids.Where(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray(); @@ -596,13 +598,6 @@ namespace DS.WMS.Core.Op.Method .Select((l, r) => new { order = l, bl = r }) .ToList(); - //if (orderList.Count != model.bookids.Length) - //{ - // return DataResult.Failed("部分订单查询失败,请重新查询台账"); - //} - - DateTime nowDate = DateTime.Now; - foreach (var data in orderList) { var blModel = data.bl; @@ -654,6 +649,22 @@ namespace DS.WMS.Core.Op.Method }; await tenantDb.Insertable(log).ExecuteCommandAsync(); + + data.order.BLIssueStatus = (int)BLIssueStatusEnum.CheckIn; + data.order.BLIssueStatusName = BLIssueStatusEnum.CheckIn.GetDescription(); + + data.order.UpdateBy = long.Parse(user.UserId); + data.order.UpdateUserName = user.UserName; + data.order.UpdateTime = nowDate; + + await tenantDb.Updateable(data.order).UpdateColumns(x => new + { + x.BLIssueStatus, + x.BLIssueStatusName, + x.UpdateBy, + x.UpdateUserName, + x.UpdateTime, + }).ExecuteCommandAsync(); } } #endregion @@ -662,9 +673,8 @@ namespace DS.WMS.Core.Op.Method if (model.bookids.Any(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase))) { var checkIds = model.bookids.Where(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray(); - #region 主单处理 - - + + #region 分单处理 var orderList = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .InnerJoin((l, r) => l.BusinessId == r.Id) .LeftJoin((l, r, t) => l.Id == t.BookingId) @@ -672,12 +682,6 @@ namespace DS.WMS.Core.Op.Method .Select((l, r, t) => new { order = r, sub = l,bl = t }) .ToList(); - //if (orderList.Count != model.bookids.Length) - //{ - // return DataResult.Failed("部分订单查询失败,请重新查询台账"); - //} - - DateTime nowDate = DateTime.Now; foreach (var data in orderList) { @@ -730,6 +734,22 @@ namespace DS.WMS.Core.Op.Method }; await tenantDb.Insertable(log).ExecuteCommandAsync(); + + data.sub.BLIssueStatus = (int)BLIssueStatusEnum.CheckIn; + data.sub.BLIssueStatusName = BLIssueStatusEnum.CheckIn.GetDescription(); + + data.sub.UpdateBy = long.Parse(user.UserId); + data.sub.UpdateUserName = user.UserName; + data.sub.UpdateTime = nowDate; + + await tenantDb.Updateable(data.sub).UpdateColumns(x => new + { + x.BLIssueStatus, + x.BLIssueStatusName, + x.UpdateBy, + x.UpdateUserName, + x.UpdateTime, + }).ExecuteCommandAsync(); } } #endregion @@ -790,65 +810,157 @@ namespace DS.WMS.Core.Op.Method if (model.bookids.Count == 0) return DataResult.Failed("请求参数错误,请选择提单记录"); - var checkIds = model.bookids.Select(a => a.bookid).ToArray(); + DateTime nowDate = DateTime.Now; - var orderList = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) + if (model.bookids.Any(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase))) + { + var checkIds = model.bookids.Where(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray(); + #region 主单处理 + var orderList = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .LeftJoin((l, r) => l.Id == r.BookingId) .Where((l, r) => checkIds.Contains(l.Id) && l.Deleted == false) .Select((l, r) => new { order = l, bl = r }) .ToList(); - if (orderList.Count != model.bookids.Count) - { - return DataResult.Failed("部分订单查询失败,请重新查询台账"); - } + foreach (var data in orderList) + { + var blModel = data.bl; - DateTime nowDate = DateTime.Now; + if (blModel != null && blModel.Id > 0) + { + if (blModel.IsCheckIn) + { + blModel.IsCheckIn = false; + blModel.CheckInBy = 0; + blModel.CheckInUserName = null; + blModel.CheckInDate = null; + blModel.CheckInNote = null; + blModel.Status = null; + blModel.StatusName = null; + + await tenantDb.Updateable(blModel) + .UpdateColumns(x => new + { + x.IsCheckIn, + x.CheckInBy, + x.CheckInUserName, + x.CheckInDate, + x.CheckInNote, + x.Status, + x.StatusName + }).ExecuteCommandAsync(); + + + var log = new BLIssueManageLog + { + Pid = blModel.Id, + ActionCode = BLIssueActionEnum.CheckInCancel.ToString(), + ActionName = BLIssueActionEnum.CheckInCancel.GetDescription(), + Note = model.Notes, + Result = "成功", + CreateBy = long.Parse(user.UserId), + CreateUserName = user.UserName, + CreateTime = nowDate, + }; + + await tenantDb.Insertable(log).ExecuteCommandAsync(); + + data.order.BLIssueStatus = 0; + data.order.BLIssueStatusName = null; + + data.order.UpdateBy = long.Parse(user.UserId); + data.order.UpdateUserName = user.UserName; + data.order.UpdateTime = nowDate; + + await tenantDb.Updateable(data.order).UpdateColumns(x => new + { + x.BLIssueStatus, + x.BLIssueStatusName, + x.UpdateBy, + x.UpdateUserName, + x.UpdateTime, + }).ExecuteCommandAsync(); + } + } + } + #endregion + } - foreach (var data in orderList) + if (model.bookids.Any(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase))) { - var blModel = data.bl; + var checkIds = model.bookids.Where(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray(); - if (blModel != null && blModel.Id > 0) + #region 分单处理 + var orderList = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) + .InnerJoin((l, r) => l.BusinessId == r.Id) + .LeftJoin((l, r, t) => l.Id == t.BookingId) + .Where((l, r, t) => checkIds.Contains(l.Id) && l.Deleted == false) + .Select((l, r, t) => new { order = r, sub = l, bl = t }) + .ToList(); + + foreach (var data in orderList) { - if (blModel.IsCheckIn) - { - blModel.IsCheckIn = false; - blModel.CheckInBy = 0; - blModel.CheckInUserName = null; - blModel.CheckInDate = null; - blModel.CheckInNote = null; - blModel.Status = null; - blModel.StatusName = null; + var blModel = data.bl; - await tenantDb.Updateable(blModel) - .UpdateColumns(x => new + if (blModel != null && blModel.Id > 0) + { + if (blModel.IsCheckIn) + { + blModel.IsCheckIn = false; + blModel.CheckInBy = 0; + blModel.CheckInUserName = null; + blModel.CheckInDate = null; + blModel.CheckInNote = null; + blModel.Status = null; + blModel.StatusName = null; + + await tenantDb.Updateable(blModel) + .UpdateColumns(x => new + { + x.IsCheckIn, + x.CheckInBy, + x.CheckInUserName, + x.CheckInDate, + x.CheckInNote, + x.Status, + x.StatusName + }).ExecuteCommandAsync(); + + + var log = new BLIssueManageLog { - x.IsCheckIn, - x.CheckInBy, - x.CheckInUserName, - x.CheckInDate, - x.CheckInNote, - x.Status, - x.StatusName + Pid = blModel.Id, + ActionCode = BLIssueActionEnum.CheckInCancel.ToString(), + ActionName = BLIssueActionEnum.CheckInCancel.GetDescription(), + Note = model.Notes, + Result = "成功", + CreateBy = long.Parse(user.UserId), + CreateUserName = user.UserName, + CreateTime = nowDate, + }; + + await tenantDb.Insertable(log).ExecuteCommandAsync(); + + data.sub.BLIssueStatus = 0; + data.sub.BLIssueStatusName = null; + + data.sub.UpdateBy = long.Parse(user.UserId); + data.sub.UpdateUserName = user.UserName; + data.sub.UpdateTime = nowDate; + + await tenantDb.Updateable(data.order).UpdateColumns(x => new + { + x.BLIssueStatus, + x.BLIssueStatusName, + x.UpdateBy, + x.UpdateUserName, + x.UpdateTime, }).ExecuteCommandAsync(); - - - var log = new BLIssueManageLog - { - Pid = blModel.Id, - ActionCode = BLIssueActionEnum.CheckInCancel.ToString(), - ActionName = BLIssueActionEnum.CheckInCancel.GetDescription(), - Note = model.Notes, - Result = "成功", - CreateBy = long.Parse(user.UserId), - CreateUserName = user.UserName, - CreateTime = nowDate, - }; - - await tenantDb.Insertable(log).ExecuteCommandAsync(); + } } } + + #endregion } return DataResult.Successed("成功"); @@ -933,6 +1045,22 @@ namespace DS.WMS.Core.Op.Method }; await tenantDb.Insertable(log).ExecuteCommandAsync(); + + data.order.BLIssueStatus = (int)BLIssueStatusEnum.CheckOut; + data.order.BLIssueStatusName = BLIssueStatusEnum.CheckOut.GetDescription(); + + data.order.UpdateBy = long.Parse(user.UserId); + data.order.UpdateUserName = user.UserName; + data.order.UpdateTime = nowDate; + + await tenantDb.Updateable(data.order).UpdateColumns(x => new + { + x.BLIssueStatus, + x.BLIssueStatusName, + x.UpdateBy, + x.UpdateUserName, + x.UpdateTime, + }).ExecuteCommandAsync(); } } } @@ -941,7 +1069,7 @@ namespace DS.WMS.Core.Op.Method { var checkIds = model.bookids.Where(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray(); - #region 主单处理 + #region 分单处理 var orderList = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .InnerJoin((l, r) => l.BusinessId == r.Id) .LeftJoin((l, r, t) => l.Id == t.BookingId) @@ -998,6 +1126,22 @@ namespace DS.WMS.Core.Op.Method }; await tenantDb.Insertable(log).ExecuteCommandAsync(); + + data.sub.BLIssueStatus = (int)BLIssueStatusEnum.CheckOut; + data.sub.BLIssueStatusName = BLIssueStatusEnum.CheckOut.GetDescription(); + + data.sub.UpdateBy = long.Parse(user.UserId); + data.sub.UpdateUserName = user.UserName; + data.sub.UpdateTime = nowDate; + + await tenantDb.Updateable(data.sub).UpdateColumns(x => new + { + x.BLIssueStatus, + x.BLIssueStatusName, + x.UpdateBy, + x.UpdateUserName, + x.UpdateTime, + }).ExecuteCommandAsync(); } } #endregion @@ -1020,65 +1164,162 @@ namespace DS.WMS.Core.Op.Method if (model.bookids.Count == 0) return DataResult.Failed("请求参数错误,请选择提单记录"); - var checkIds = model.bookids.Select(a => a.bookid).ToArray(); + DateTime nowDate = DateTime.Now; - var orderList = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) + if (model.bookids.Any(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase))) + { + var checkIds = model.bookids.Where(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray(); + + var orderList = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) .LeftJoin((l, r) => l.Id == r.BookingId) .Where((l, r) => checkIds.Contains(l.Id) && l.Deleted == false) .Select((l, r) => new { order = l, bl = r }) .ToList(); - if (orderList.Count != model.bookids.Count) - { - return DataResult.Failed("部分订单查询失败,请重新查询台账"); - } - - DateTime nowDate = DateTime.Now; + if (orderList.Count != model.bookids.Count) + { + return DataResult.Failed("部分订单查询失败,请重新查询台账"); + } - foreach (var data in orderList) - { - var blModel = data.bl; + - if (blModel != null && blModel.Id > 0) + foreach (var data in orderList) { - if (blModel.IsCheckOut) - { - blModel.IsCheckOut = false; - blModel.CheckOutBy = 0; - blModel.CheckOutUserName = null; - blModel.CheckOutDate = null; - blModel.CheckOutNote = null; - blModel.Status = null; - blModel.StatusName = null; + var blModel = data.bl; - await tenantDb.Updateable(blModel) - .UpdateColumns(x => new + if (blModel != null && blModel.Id > 0) + { + if (blModel.IsCheckOut) + { + blModel.IsCheckOut = false; + blModel.CheckOutBy = 0; + blModel.CheckOutUserName = null; + blModel.CheckOutDate = null; + blModel.CheckOutNote = null; + blModel.Status = null; + blModel.StatusName = null; + + await tenantDb.Updateable(blModel) + .UpdateColumns(x => new + { + x.IsCheckOut, + x.CheckOutBy, + x.CheckOutUserName, + x.CheckOutDate, + x.CheckOutNote, + x.Status, + x.StatusName + }).ExecuteCommandAsync(); + + + var log = new BLIssueManageLog { - x.IsCheckOut, - x.CheckOutBy, - x.CheckOutUserName, - x.CheckOutDate, - x.CheckOutNote, - x.Status, - x.StatusName + Pid = blModel.Id, + ActionCode = BLIssueActionEnum.CheckOutCancel.ToString(), + ActionName = BLIssueActionEnum.CheckOutCancel.GetDescription(), + Note = model.Notes, + Result = "成功", + CreateBy = long.Parse(user.UserId), + CreateUserName = user.UserName, + CreateTime = nowDate, + }; + + await tenantDb.Insertable(log).ExecuteCommandAsync(); + + data.order.BLIssueStatus = 0; + data.order.BLIssueStatusName = null; + + data.order.UpdateBy = long.Parse(user.UserId); + data.order.UpdateUserName = user.UserName; + data.order.UpdateTime = nowDate; + + await tenantDb.Updateable(data.order).UpdateColumns(x => new + { + x.BLIssueStatus, + x.BLIssueStatusName, + x.UpdateBy, + x.UpdateUserName, + x.UpdateTime, }).ExecuteCommandAsync(); + } + } + } + } + if (model.bookids.Any(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase))) + { + var checkIds = model.bookids.Where(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray(); - var log = new BLIssueManageLog - { - Pid = blModel.Id, - ActionCode = BLIssueActionEnum.CheckOutCancel.ToString(), - ActionName = BLIssueActionEnum.CheckOutCancel.GetDescription(), - Note = model.Notes, - Result = "成功", - CreateBy = long.Parse(user.UserId), - CreateUserName = user.UserName, - CreateTime = nowDate, - }; + #region 分单处理 + var orderList = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) + .InnerJoin((l, r) => l.BusinessId == r.Id) + .LeftJoin((l, r, t) => l.Id == t.BookingId) + .Where((l, r, t) => checkIds.Contains(l.Id) && l.Deleted == false) + .Select((l, r, t) => new { order = r, sub = l, bl = t }) + .ToList(); - await tenantDb.Insertable(log).ExecuteCommandAsync(); + foreach (var data in orderList) + { + var blModel = data.bl; + + if (blModel != null && blModel.Id > 0) + { + if (blModel.IsCheckOut) + { + blModel.IsCheckOut = false; + blModel.CheckOutBy = 0; + blModel.CheckOutUserName = null; + blModel.CheckOutDate = null; + blModel.CheckOutNote = null; + blModel.Status = null; + blModel.StatusName = null; + + await tenantDb.Updateable(blModel) + .UpdateColumns(x => new + { + x.IsCheckOut, + x.CheckOutBy, + x.CheckOutUserName, + x.CheckOutDate, + x.CheckOutNote, + x.Status, + x.StatusName + }).ExecuteCommandAsync(); + + + var log = new BLIssueManageLog + { + Pid = blModel.Id, + ActionCode = BLIssueActionEnum.CheckOutCancel.ToString(), + ActionName = BLIssueActionEnum.CheckOutCancel.GetDescription(), + Note = model.Notes, + Result = "成功", + CreateBy = long.Parse(user.UserId), + CreateUserName = user.UserName, + CreateTime = nowDate, + }; + + await tenantDb.Insertable(log).ExecuteCommandAsync(); + + data.sub.BLIssueStatus = 0; + data.sub.BLIssueStatusName = null; + + data.sub.UpdateBy = long.Parse(user.UserId); + data.sub.UpdateUserName = user.UserName; + data.sub.UpdateTime = nowDate; + + await tenantDb.Updateable(data.sub).UpdateColumns(x => new + { + x.BLIssueStatus, + x.BLIssueStatusName, + x.UpdateBy, + x.UpdateUserName, + x.UpdateTime, + }).ExecuteCommandAsync(); + } } } + #endregion } return DataResult.Successed("成功");