jianghaiqing 5 months ago
commit 975f171678

@ -1705,6 +1705,7 @@ namespace Myshipping.Application
[NonAction]
public async Task<BookingOrder> CustomerToOrder(BookingCustomerOrder custOrd)
{
_logger.LogInformation($"准备根据客户订舱数据生成订舱台账:{custOrd.BOOKINGNO}");
var bkOrder = custOrd.Adapt<BookingOrder>();
bkOrder.Id = YitIdHelper.NextId();
bkOrder.BSSTATUS = "已录入";
@ -2364,59 +2365,21 @@ namespace Myshipping.Application
//日志动态
SaveAuditLog($"{(accept ? "" : "")}", id, remark: $"审核意见:{comment}");
//进入订舱台账
if (accept)
{
var custBookId = jobjRtn.GetStringValue("data"); //返回的客户订舱系统的订舱数据id
var bkOrder = model.Adapt<BookingOrder>();
bkOrder.Id = YitIdHelper.NextId();
bkOrder.BSNO = custBookId;
bkOrder.BSSTATUS = "已录入";
bkOrder.CUSTOMERNAME = model.BookingTenantName;
bkOrder.ParentId = 0;
bkOrder.LANENAME = bkOrder.LANECODE;
bkOrder.OPID = UserManager.UserId.ToString();
bkOrder.OP = UserManager.Name;
await _repOrder.InsertAsync(bkOrder);
_logger.LogInformation($"收到客户端返回的订舱台账id{custBookId}");
_logger.LogInformation($"审核通过进入订舱台账客户订舱ID{model.Id}订舱台账ID{bkOrder.Id},系统编号:{model.BOOKINGNO}");
var bkEdiExt = new BookingEDIExt();
bkEdiExt.Id = YitIdHelper.NextId();
bkEdiExt.BookingId = bkOrder.Id;
bkEdiExt.SalerCode = model.SaleCode;
await _repEdiExt.InsertAsync(bkEdiExt);
var bkOrder = await CustomerToOrder(model);
bkOrder.BSNO = custBookId;
await _repOrder.AsUpdateable(bkOrder).UpdateColumns(x => new { x.BSNO }).ExecuteCommandAsync();
model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联
await _rep.UpdateAsync(model);
var ctnList = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == model.Id).ToListAsync();
foreach (var ctn in ctnList)
{
ctn.Id = YitIdHelper.NextId();
ctn.BILLID = bkOrder.Id;
await _repCtn.InsertAsync(ctn);
}
//服务项目
var servList = await _repServiceItem.Where(x => x.BookingId == model.Id).ToListAsync();
foreach (var serv in servList)
{
serv.Id = YitIdHelper.NextId();
serv.BookingId = bkOrder.Id;
await _repServiceItem.InsertAsync(serv);
}
//附件
var files = await _repFile.AsQueryable().Filter(null, true).Where(x => x.BookingId == model.Id && x.IsDeleted == false).ToListAsync();
foreach (var file in files)
{
file.Id = YitIdHelper.NextId();
file.BookingId = bkOrder.Id;
_logger.LogInformation($"审核通过进入订舱台账客户订舱ID{model.Id}订舱台账ID{bkOrder.Id},系统编号:{model.BOOKINGNO}");
await _repFile.InsertAsync(file);
}
//订舱编号回写
JObject extObj = null;

Loading…
Cancel
Save