|
|
|
@ -12758,5 +12758,68 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 批量更新订舱的详情
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 批量更新订舱的详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dto">请求参数</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingOrder/BatchUpdateOrder")]
|
|
|
|
|
public async Task BatchUpdateOrder(BatchUpdate dto)
|
|
|
|
|
{
|
|
|
|
|
if (dto == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请求参数不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(dto.Id.Count == 0)
|
|
|
|
|
throw Oops.Bah("未选中需要更新的订舱数据,请重新选择");
|
|
|
|
|
|
|
|
|
|
string version = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
// 记录日志
|
|
|
|
|
var oldOrderList = await _rep.AsQueryable().Filter(null, true).Where(x => dto.Id.Contains(x.Id) && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
|
|
|
|
|
if(dto.Id.Count != oldOrderList.Count)
|
|
|
|
|
throw Oops.Bah("订舱数据获取失败,部分订舱数据未获取到,订舱数据为空或已作废");
|
|
|
|
|
|
|
|
|
|
//oldOrderList.ForEach()
|
|
|
|
|
|
|
|
|
|
foreach (var oldOrder in oldOrderList)
|
|
|
|
|
{
|
|
|
|
|
var newOrder = oldOrder.Adapt<BookingOrder>();
|
|
|
|
|
|
|
|
|
|
newOrder.VERSION = version;
|
|
|
|
|
newOrder.VESSEL = dto.VESSEL;
|
|
|
|
|
newOrder.VOYNOINNER = dto.VOYNOINNER;
|
|
|
|
|
newOrder.ETD = dto.ETD;
|
|
|
|
|
newOrder.VOYNO = dto.VOYNO;
|
|
|
|
|
newOrder.PORTDISCHARGEID = dto.PORTDISCHARGEID;
|
|
|
|
|
newOrder.PORTDISCHARGE = dto.PORTDISCHARGE;
|
|
|
|
|
newOrder.DESTINATIONID = dto.DESTINATIONID;
|
|
|
|
|
newOrder.DESTINATION = dto.DESTINATION;
|
|
|
|
|
newOrder.CLOSINGDATE = dto.CLOSINGDATE;
|
|
|
|
|
newOrder.CLOSEDOCDATE = dto.CLOSEDOCDATE;
|
|
|
|
|
|
|
|
|
|
await SaveLog(newOrder, oldOrder, "批量编辑台账");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(x => dto.Id.Contains(x.Id), x => new BookingOrder
|
|
|
|
|
{
|
|
|
|
|
VERSION = version,
|
|
|
|
|
VESSEL = dto.VESSEL,
|
|
|
|
|
VOYNOINNER = dto.VOYNOINNER,
|
|
|
|
|
ETD = dto.ETD,
|
|
|
|
|
VOYNO = dto.VOYNO,
|
|
|
|
|
PORTDISCHARGEID = dto.PORTDISCHARGEID,
|
|
|
|
|
PORTDISCHARGE = dto.PORTDISCHARGE,
|
|
|
|
|
DESTINATIONID = dto.DESTINATIONID,
|
|
|
|
|
DESTINATION = dto.DESTINATION,
|
|
|
|
|
CLOSINGDATE = dto.CLOSINGDATE,
|
|
|
|
|
CLOSEDOCDATE = dto.CLOSEDOCDATE
|
|
|
|
|
});
|
|
|
|
|
await SendBookingOrder(dto.Id.ToArray());
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|