修改订单保存同步舱位

dev
jianghaiqing 1 month ago
parent a09fec84aa
commit ae6749ace1

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
/// <summary>
///
/// </summary>
public class BookingOrderToSlotDto
{
/// <summary>
/// 提单号
/// </summary>
public string SlotBookingNo { get; set; }
/// <summary>
/// 订单ID
/// </summary>
public long BookingId { get; set; }
/// <summary>
/// 委托客户ID
/// </summary>
public Nullable<long> CustomerId { get; set; }
/// <summary>
/// 委托客户名称
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 销售ID
/// </summary>
public Nullable<long> SaleId { get; set; }
/// <summary>
/// 销售名称
/// </summary>
public string SaleName { get; set; }
/// <summary>
/// 操作ID
/// </summary>
public Nullable<long> OpId { get; set; }
/// <summary>
/// 操作名称
/// </summary>
public string OpName { get; set; }
/// <summary>
/// 单证ID
/// </summary>
public Nullable<long> DocId { get; set; }
/// <summary>
/// 单证名称
/// </summary>
public string DocName { get; set; }
/// <summary>
/// 委托编号
/// </summary>
public string CustomerNo { get; set; }
}
}

@ -271,5 +271,11 @@ namespace DS.WMS.Core.Op.Interface
/// <returns>返回回执</returns>
Task<DataResult> BookingSlotOpenEdit(BookingSlotOpenEditReq req);
/// <summary>
/// 同步订单更新舱位
/// </summary>
/// <param name="req">同步订单更新舱位请求</param>
/// <returns>返回回执</returns>
Task<DataResult> SyncBookingOrderToSlot(BookingOrderToSlotDto req);
}
}

@ -63,6 +63,7 @@ using System.ComponentModel;
using Masuit.Tools.Systems;
using System.Threading;
using NPOI.OpenXmlFormats.Wordprocessing;
using DS.WMS.Core.Invoice.Dtos;
namespace DS.WMS.Core.Op.Method
{
@ -4864,7 +4865,81 @@ namespace DS.WMS.Core.Op.Method
}
#endregion
#region 同步
#region 同步订单更新舱位
/// <summary>
/// 同步订单更新舱位
/// </summary>
/// <param name="req">同步订单更新舱位请求</param>
/// <returns>返回回执</returns>
public async Task<DataResult> SyncBookingOrderToSlot(BookingOrderToSlotDto req)
{
try
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
/*
1
2
*/
var allocList = await tenantDb.Queryable<BookingSlotAllocation>().Where(a => a.BookingId == req.BookingId && a.Deleted == false).ToListAsync();
if (allocList.Count > 0)
{
foreach (var alloc in allocList)
{
alloc.CustomerId = req.CustomerId;
alloc.CustomerName = req.CustomerName;
if (req.SaleId.HasValue)
alloc.SaleId = req.SaleId.Value.ToString();
alloc.Sale = req.SaleName;
if (req.OpId.HasValue)
alloc.OpId = req.OpId.Value.ToString();
alloc.Op = req.OpName;
if (req.DocId.HasValue)
alloc.DocId = req.DocId.Value.ToString();
alloc.Doc = req.DocName;
await tenantDb.Updateable<BookingSlotAllocation>(alloc).UpdateColumns(x => new
{
x.CustomerId,
x.CustomerName,
x.SaleId,
x.Sale,
x.OpId,
x.Op,
x.DocId,
x.Doc
}).ExecuteCommandAsync();
var slot = await tenantDb.Queryable<BookingSlotBase>().FirstAsync(b => b.Id == alloc.BookingSlotId);
if (slot != null)
{
slot.CustomerNo = req.CustomerNo;
await tenantDb.Updateable<BookingSlotBase>(slot).UpdateColumns(x => new
{
x.CustomerNo,
}).ExecuteCommandAsync();
}
}
}
}
catch(Exception ex)
{
}
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
#endregion
}

@ -50,6 +50,7 @@ public partial class SeaExportService : ISeaExportService
private readonly ISysCacheService _sysCacheService;
private readonly IRabbitMQService _rabbitMQService;
private readonly IRedisService _redisBaseService;
private readonly IBookingSlotService _bookingSlotService;
private readonly Lazy<ITaskManageBaseService> _taskManageBaseService;
@ -87,6 +88,8 @@ public partial class SeaExportService : ISeaExportService
_configService = _serviceProvider.GetRequiredService<IConfigService>();
_rabbitMQService = _serviceProvider.GetRequiredService<IRabbitMQService>();
_redisBaseService = _serviceProvider.GetRequiredService<IRedisService>();
_bookingSlotService = _serviceProvider.GetRequiredService<IBookingSlotService>();
_taskManageBaseService = _serviceProvider.GetRequiredService<Lazy<ITaskManageBaseService>>();
}
@ -499,6 +502,21 @@ public partial class SeaExportService : ISeaExportService
//return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
await tenantDb.Ado.CommitTranAsync();
//保存会同步舱位
await _bookingSlotService.SyncBookingOrderToSlot(new BookingOrderToSlotDto {
BookingId = info.Id,
CustomerId = info.CustomerId,
CustomerName = info.CustomerName,
CustomerNo = info.CustomerNo,
DocId = info.Doc,
DocName = info.DocName,
SaleId = info.SaleId,
SaleName = info.Sale,
OpId = info.OperatorId,
OpName = info.OperatorName
});
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
catch (Exception ex)

Loading…
Cancel
Save