|
|
@ -2,6 +2,7 @@
|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
using Mapster;
|
|
|
|
using Mapster;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
@ -11,6 +12,8 @@ using Myshipping.Application.ConfigOption;
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
@ -34,9 +37,13 @@ namespace Myshipping.Application
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
private readonly SqlSugarRepository<BookingFile> _repFile;
|
|
|
|
private readonly SqlSugarRepository<BookingFile> _repFile;
|
|
|
|
private readonly SqlSugarRepository<BookingStatusLog> _repStatuslog;
|
|
|
|
private readonly SqlSugarRepository<BookingStatusLog> _repStatuslog;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingServiceItem> _repServiceItem;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _repOrder;
|
|
|
|
|
|
|
|
|
|
|
|
public BookingCustomerOrderService(SqlSugarRepository<BookingCustomerOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
|
|
|
|
public BookingCustomerOrderService(SqlSugarRepository<BookingCustomerOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
|
|
|
|
ILogger<BookingOrderService> logger, ISysCacheService cache, SqlSugarRepository<BookingFile> repFile, SqlSugarRepository<BookingStatusLog> statuslog)
|
|
|
|
ILogger<BookingOrderService> logger, ISysCacheService cache, SqlSugarRepository<BookingFile> repFile,
|
|
|
|
|
|
|
|
SqlSugarRepository<BookingStatusLog> statuslog, SqlSugarRepository<BookingServiceItem> repServiceItem,
|
|
|
|
|
|
|
|
SqlSugarRepository<BookingOrder> repOrder)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this._logger = logger;
|
|
|
|
this._logger = logger;
|
|
|
|
this._rep = rep;
|
|
|
|
this._rep = rep;
|
|
|
@ -44,23 +51,62 @@ namespace Myshipping.Application
|
|
|
|
this._cache = cache;
|
|
|
|
this._cache = cache;
|
|
|
|
this._repFile = repFile;
|
|
|
|
this._repFile = repFile;
|
|
|
|
this._repStatuslog = statuslog;
|
|
|
|
this._repStatuslog = statuslog;
|
|
|
|
|
|
|
|
this._repServiceItem = repServiceItem;
|
|
|
|
|
|
|
|
this._repOrder = repOrder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//查询台账
|
|
|
|
#region 订舱草稿及附件
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 订舱草稿台账
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("/BookingCustomerOrder/PageData")]
|
|
|
|
[HttpPost("/BookingCustomerOrder/PageData")]
|
|
|
|
public async Task<SqlSugarPagedList<BookingCustomerOrderListOutput>> PageData(BookingCustomerOrderQueryInput input)
|
|
|
|
public async Task<SqlSugarPagedList<BookingCustomerOrderListOutput>> PageData(BookingCustomerOrderQueryInput input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var query = _rep.AsQueryable();
|
|
|
|
var query = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID)
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.BOOKINGNO), x => x.BOOKINGNO.Contains(input.BOOKINGNO))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.VESSEL), x => x.VESSEL.Contains(input.VESSEL))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.VOYNO), x => x.VOYNO.Contains(input.VOYNO))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.YARDID), x => x.YARDID == input.YARDID)
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.YARD), x => x.YARD.Contains(input.YARD))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGEID), x => x.PORTDISCHARGEID == input.PORTDISCHARGEID)
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), x => x.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CARRIERID), x => x.CARRIERID == input.CARRIERID)
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CARRIER), x => x.CARRIER.Contains(input.CARRIER))
|
|
|
|
|
|
|
|
.WhereIF(input.ETDStart.HasValue, x => x.ETD >= input.ETDStart)
|
|
|
|
|
|
|
|
.WhereIF(input.ETDEnd.HasValue, x => x.ETD < input.ETDEnd.Value.Date.AddDays(1))
|
|
|
|
|
|
|
|
.WhereIF(input.CreatedTimeStart.HasValue, x => x.CreatedTime >= input.CreatedTimeStart)
|
|
|
|
|
|
|
|
.WhereIF(input.CreatedTimeEnd.HasValue, x => x.CreatedTime < input.CreatedTimeEnd.Value.Date.AddDays(1))
|
|
|
|
|
|
|
|
.WhereIF(input.BSStatusList != null && input.BSStatusList.Count > 0, x => input.BSStatusList.Contains(x.BSSTATUS))
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(input.SortField) || input.MultiSort == null || input.MultiSort.Count == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
query = query.OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.DescSort));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
query = query.OrderBy(PageInputOrder.MultiOrderBuilder(input.MultiSort));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var entities = await query.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
var entities = await query.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
var list = entities.Adapt<SqlSugarPagedList<BookingCustomerOrderListOutput>>();
|
|
|
|
var list = entities.Adapt<SqlSugarPagedList<BookingCustomerOrderListOutput>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//动态日志
|
|
|
|
|
|
|
|
var bkIdList = list.Items.Select(x => x.Id).ToList();
|
|
|
|
|
|
|
|
var staLogList = _repStatuslog.Where(x => bkIdList.Contains(x.BookingId.Value)).ToList();
|
|
|
|
|
|
|
|
foreach (var item in list.Items)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item.LogList = staLogList.Where(x => x.BookingId == item.Id).OrderBy(x => x.OpTime).Adapt<List<BookingCustomerLogDto>>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 保存数据
|
|
|
|
/// 保存草稿数据
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
@ -95,7 +141,7 @@ namespace Myshipping.Application
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entity = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == input.Id);
|
|
|
|
entity = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == input.Id);
|
|
|
|
if (entity.BSSTATUS != "已录入" || entity.BSSTATUS != "已驳回")
|
|
|
|
if (entity.BSSTATUS != "已录入" && entity.BSSTATUS != "已驳回")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw Oops.Bah("当前状态不允许修改");
|
|
|
|
throw Oops.Bah("当前状态不允许修改");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -123,6 +169,25 @@ namespace Myshipping.Application
|
|
|
|
await _repCtn.InsertAsync(ctnentity);
|
|
|
|
await _repCtn.InsertAsync(ctnentity);
|
|
|
|
ctnList.Add(ctnentity);
|
|
|
|
ctnList.Add(ctnentity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var groupList = input.CtnList.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}");
|
|
|
|
|
|
|
|
entity.CNTRTOTAL = string.Join(" / ", groupList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
entity.CNTRTOTAL = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(entity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//服务项目
|
|
|
|
|
|
|
|
_repServiceItem.Delete(x => x.BookingId == entity.Id);
|
|
|
|
|
|
|
|
foreach (var item in input.ServiceItemList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bsi = item.Adapt<BookingServiceItem>();
|
|
|
|
|
|
|
|
bsi.Id = YitIdHelper.NextId();
|
|
|
|
|
|
|
|
bsi.BookingId = entity.Id;
|
|
|
|
|
|
|
|
await _repServiceItem.InsertAsync(bsi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//文件
|
|
|
|
//文件
|
|
|
@ -141,6 +206,17 @@ namespace Myshipping.Application
|
|
|
|
if (!Directory.Exists(dirAbs))
|
|
|
|
if (!Directory.Exists(dirAbs))
|
|
|
|
Directory.CreateDirectory(dirAbs);
|
|
|
|
Directory.CreateDirectory(dirAbs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//清除前端已删除的文件
|
|
|
|
|
|
|
|
if (input.Files != null && input.Files.Count() > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var delIds = dbFiles.Where(x => !input.Files.Contains(x.Id)).Select(x => x.Id);
|
|
|
|
|
|
|
|
await _repFile.DeleteAsync(x => delIds.Contains(x.Id));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _repFile.DeleteAsync(x => x.BookingId == entity.Id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//临时文件转为正式文件
|
|
|
|
//临时文件转为正式文件
|
|
|
|
if (input.TempFileNames != null && input.TempFileNames.Count() > 0)
|
|
|
|
if (input.TempFileNames != null && input.TempFileNames.Count() > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -171,17 +247,6 @@ namespace Myshipping.Application
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//清除前端已删除的文件
|
|
|
|
|
|
|
|
if (input.Files != null && input.Files.Count() > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var delIds = dbFiles.Where(x => !input.Files.Contains(x.Id)).Select(x => x.Id);
|
|
|
|
|
|
|
|
await _repFile.DeleteAsync(x => delIds.Contains(x.Id));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _repFile.DeleteAsync(x => x.BookingId == entity.Id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//日志动态
|
|
|
|
//日志动态
|
|
|
|
var staLog = new BookingStatusLog();
|
|
|
|
var staLog = new BookingStatusLog();
|
|
|
@ -193,14 +258,15 @@ namespace Myshipping.Application
|
|
|
|
staLog.BookingId = entity.Id;
|
|
|
|
staLog.BookingId = entity.Id;
|
|
|
|
_repStatuslog.Insert(staLog);
|
|
|
|
_repStatuslog.Insert(staLog);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//返回给前端数据
|
|
|
|
var outModel = entity.Adapt<BookingCustomerOrderSaveOutput>();
|
|
|
|
var outModel = entity.Adapt<BookingCustomerOrderSaveOutput>();
|
|
|
|
outModel.CtnList = ctnList.Adapt<List<BookingCustomerCtnDto>>();
|
|
|
|
outModel.CtnList = ctnList.Adapt<List<BookingCustomerCtnDto>>();
|
|
|
|
|
|
|
|
|
|
|
|
var dicFile = new Dictionary<long, string>();
|
|
|
|
var dicFile = new Dictionary<long, string>();
|
|
|
|
_repFile.AsQueryable().Where(x => x.BookingId == entity.Id).ForEach(x => dicFile.Add(x.Id, x.FileName));
|
|
|
|
_repFile.AsQueryable().Where(x => x.BookingId == entity.Id).ForEach(x => dicFile.Add(x.Id, x.FileName));
|
|
|
|
outModel.Files = dicFile;
|
|
|
|
outModel.Files = dicFile;
|
|
|
|
|
|
|
|
|
|
|
|
outModel.LogList = _repStatuslog.AsQueryable().Where(x => x.BookingId == entity.Id).ToList().Adapt<List<BookingCustomerLogDto>>();
|
|
|
|
outModel.LogList = _repStatuslog.AsQueryable().Where(x => x.BookingId == entity.Id).ToList().Adapt<List<BookingCustomerLogDto>>();
|
|
|
|
|
|
|
|
outModel.ServiceItemList = _repServiceItem.AsQueryable().Where(x => x.BookingId == entity.Id).ToList().Adapt<List<BookingServiceItemCustomerDto>>();
|
|
|
|
|
|
|
|
|
|
|
|
return outModel;
|
|
|
|
return outModel;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -221,8 +287,8 @@ namespace Myshipping.Application
|
|
|
|
var dicFile = new Dictionary<long, string>();
|
|
|
|
var dicFile = new Dictionary<long, string>();
|
|
|
|
_repFile.AsQueryable().Where(x => x.BookingId == entity.Id).ForEach(x => dicFile.Add(x.Id, x.FileName));
|
|
|
|
_repFile.AsQueryable().Where(x => x.BookingId == entity.Id).ForEach(x => dicFile.Add(x.Id, x.FileName));
|
|
|
|
outModel.Files = dicFile;
|
|
|
|
outModel.Files = dicFile;
|
|
|
|
|
|
|
|
|
|
|
|
outModel.LogList = _repStatuslog.AsQueryable().Where(x => x.BookingId == entity.Id).ToList().Adapt<List<BookingCustomerLogDto>>();
|
|
|
|
outModel.LogList = _repStatuslog.AsQueryable().Where(x => x.BookingId == entity.Id).ToList().Adapt<List<BookingCustomerLogDto>>();
|
|
|
|
|
|
|
|
outModel.ServiceItemList = _repServiceItem.AsQueryable().Where(x => x.BookingId == entity.Id).ToList().Adapt<List<BookingServiceItemCustomerDto>>();
|
|
|
|
|
|
|
|
|
|
|
|
return outModel;
|
|
|
|
return outModel;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -283,19 +349,441 @@ namespace Myshipping.Application
|
|
|
|
throw Oops.Oh("文件不存在");
|
|
|
|
throw Oops.Oh("文件不存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var fileName = HttpUtility.UrlEncode(savedFile.FileName, Encoding.GetEncoding("UTF-8"));
|
|
|
|
//var fileName = HttpUtility.UrlEncode(savedFile.FileName, Encoding.GetEncoding("UTF-8"));
|
|
|
|
var result = new FileStreamResult(new FileStream(fileFullPath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
|
|
|
|
var result = new FileStreamResult(new FileStream(fileFullPath, FileMode.Open), "application/octet-stream") { FileDownloadName = savedFile.FileName };
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 客户订舱系统操作与接口
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 提交订舱
|
|
|
|
/// 提交订舱
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("/BookingCustomerOrder/Submit")]
|
|
|
|
[HttpPost("/BookingCustomerOrder/Submit")]
|
|
|
|
public async Task Submit()
|
|
|
|
public async Task<string> Submit(List<long> ids)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var recUrl = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingRequestReceiveUrl");
|
|
|
|
|
|
|
|
if (recUrl == null || string.IsNullOrEmpty(recUrl.Value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("大简云接收订舱URL地址未配置,请联系管理员");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var userId = _cache.GetAllTenantParam().Result.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == "DjyBookingReceiveUserId");
|
|
|
|
|
|
|
|
var userSecret = _cache.GetAllTenantParam().Result.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == "DjyBookingReceiveUserSecret");
|
|
|
|
|
|
|
|
if (userId == null || string.IsNullOrEmpty(userId.ItemCode) || userSecret == null || string.IsNullOrEmpty(userSecret.ItemCode))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("大简云接收订舱用户key和秘钥未配置,请联系管理员");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//构建数据并发送
|
|
|
|
|
|
|
|
var orderList = _rep.AsQueryable().Where(x => ids.Contains(x.Id)).ToList();
|
|
|
|
|
|
|
|
var ordIdList = orderList.Select(o => o.Id).ToList();
|
|
|
|
|
|
|
|
var ctnList = _repCtn.AsQueryable().Where(x => ordIdList.Contains(x.BILLID.Value)).ToList();
|
|
|
|
|
|
|
|
var fileList = _repFile.AsQueryable().Where(x => ordIdList.Contains(x.BookingId)).ToList();
|
|
|
|
|
|
|
|
var serviceItemList = _repServiceItem.AsQueryable().Where(x => ordIdList.Contains(x.BookingId.Value)).ToList();
|
|
|
|
|
|
|
|
var sendList = new List<BookingCustomerSubmitReceiveDto>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var opt = App.GetOptions<BookingAttachOptions>();
|
|
|
|
|
|
|
|
var dirAbs = opt.basePath;
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(dirAbs))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
dirAbs = App.WebHostEnvironment.WebRootPath;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var order in orderList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (order.BSSTATUS != "已录入" && order.BSSTATUS != "已驳回")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah($"{order.BOOKINGNO} 当前状态为{order.BSSTATUS},不能提交");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dto = order.Adapt<BookingCustomerSubmitReceiveDto>();
|
|
|
|
|
|
|
|
dto.BookingTenantId = UserManager.TENANT_ID;
|
|
|
|
|
|
|
|
dto.BookingTenantName = UserManager.TENANT_NAME;
|
|
|
|
|
|
|
|
dto.BookingCompanyId = UserManager.DjyCompanyId;
|
|
|
|
|
|
|
|
dto.BookingUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
dto.BookingUserName = UserManager.Name;
|
|
|
|
|
|
|
|
dto.BookingDjyUserId = UserManager.DjyUserId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dto.CtnList = ctnList.Where(x => x.BILLID == dto.Id).ToList().Adapt<List<BookingCustomerCtnDto>>();
|
|
|
|
|
|
|
|
dto.ServiceItemList = serviceItemList.Where(x => x.BookingId == dto.Id).ToList().Adapt<List<BookingServiceItemCustomerDto>>();
|
|
|
|
|
|
|
|
dto.Files = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
foreach (var file in fileList.Where(x => x.BookingId == dto.Id))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var fileAbsPath = Path.Combine(dirAbs, file.FilePath);
|
|
|
|
|
|
|
|
if (File.Exists(fileAbsPath))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dto.Files.Add(file.FileName, Convert.ToBase64String(File.ReadAllBytes(fileAbsPath)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sendList.Add(dto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"提交订舱数据({recUrl.Value},{userId.ItemCode},{userSecret.ItemCode}):{JsonConvert.SerializeObject(sendList)}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rtn = await recUrl.Value
|
|
|
|
|
|
|
|
.SetHeaders(new Dictionary<string, object> {
|
|
|
|
|
|
|
|
{ CommonConst.API_USER_HEADER_KEY, userId.ItemCode},
|
|
|
|
|
|
|
|
{ CommonConst.API_USER_HEADER_SECRET, userSecret.ItemCode}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.SetBody(sendList)
|
|
|
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"返回数据:{rtn}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var resultText = new StringBuilder();
|
|
|
|
|
|
|
|
var jobjRtn = JObject.Parse(rtn);
|
|
|
|
|
|
|
|
if (jobjRtn.GetIntValue("code") != 200)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah(jobjRtn.GetStringValue("message"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var arrData = jobjRtn.GetJArrayValue("data");
|
|
|
|
|
|
|
|
foreach (JObject item in arrData)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var id = item.GetLongValue("id");
|
|
|
|
|
|
|
|
var bookingno = item.GetStringValue("bookingno");
|
|
|
|
|
|
|
|
var message = item.GetStringValue("message");
|
|
|
|
|
|
|
|
var succ = item.GetBooleanValue("success");
|
|
|
|
|
|
|
|
if (succ)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var model = _rep.AsQueryable().First(x => x.Id == id);
|
|
|
|
|
|
|
|
model.BSSTATUS = "已提交";
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//日志动态
|
|
|
|
|
|
|
|
var staLog = new BookingStatusLog();
|
|
|
|
|
|
|
|
staLog.Status = "已提交";
|
|
|
|
|
|
|
|
staLog.CreatedUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
staLog.CreatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
staLog.CreatedTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.OpTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.BookingId = id;
|
|
|
|
|
|
|
|
_repStatuslog.Insert(staLog);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//日志动态
|
|
|
|
|
|
|
|
var staLog = new BookingStatusLog();
|
|
|
|
|
|
|
|
staLog.Status = $"提交失败:{item.GetBooleanValue("message")}";
|
|
|
|
|
|
|
|
staLog.CreatedUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
staLog.CreatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
staLog.CreatedTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.OpTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.BookingId = id;
|
|
|
|
|
|
|
|
_repStatuslog.Insert(staLog);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resultText.AppendLine($"{bookingno}:{message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultText.ToString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 接收反馈订舱审核回执
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("/BookingCustomerOrder/RecBookingAuditFeedback"), AllowAnonymous, ApiUser(ApiCode = "BookingRecAuditFeedback")]
|
|
|
|
|
|
|
|
public async Task<long> RecBookingAuditFeedback(BookingCustomerRecAduitFeedbackDto dto)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var id = Convert.ToInt64(dto.Id);
|
|
|
|
|
|
|
|
var model = _rep.AsQueryable().Filter(null, true).First(x => x.Id == id);
|
|
|
|
|
|
|
|
if (model == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("未找到数据");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.BSSTATUS != "已提交")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("当前状态不能接受审核回推");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dto.Accept)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
model.BSSTATUS = "已审核";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
model.BSSTATUS = "已驳回";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//日志动态
|
|
|
|
|
|
|
|
var staLog = new BookingStatusLog();
|
|
|
|
|
|
|
|
staLog.Status = $"{model.BSSTATUS},审核意见:{dto.Comment}";
|
|
|
|
|
|
|
|
staLog.CreatedUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
staLog.CreatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
staLog.CreatedTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.OpTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.BookingId = id;
|
|
|
|
|
|
|
|
_repStatuslog.Insert(staLog);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//进入客户订舱系统的订舱台账
|
|
|
|
|
|
|
|
if (dto.Accept)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bkOrder = model.Adapt<BookingOrder>();
|
|
|
|
|
|
|
|
bkOrder.Id = YitIdHelper.NextId();
|
|
|
|
|
|
|
|
bkOrder.BSSTATUS = "已录入";
|
|
|
|
|
|
|
|
await _repOrder.InsertAsync(bkOrder);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ctnList = await _repCtn.Where(x => x.BILLID == model.Id).ToListAsync();
|
|
|
|
|
|
|
|
foreach (var ctn in ctnList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ctn.Id = YitIdHelper.NextId();
|
|
|
|
|
|
|
|
ctn.BILLID = bkOrder.Id;
|
|
|
|
|
|
|
|
await _repCtn.InsertAsync(ctn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return bkOrder.Id;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 大简云订舱平台操作与接口
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 接收客户订舱系统提交的数据
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("/BookingCustomerOrder/ReceiveBooking"), AllowAnonymous, ApiUser(ApiCode = "DjyBookingReceiveApi")]
|
|
|
|
|
|
|
|
public async Task<List<BookingSubmitResultModel>> ReceiveBooking(List<BookingCustomerSubmitReceiveDto> list)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"收到提交的订舱数据:{JsonConvert.SerializeObject(list)}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rtnList = new List<BookingSubmitResultModel>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var strId = item.Id.ToString();
|
|
|
|
|
|
|
|
var order = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.TenantId == UserManager.TENANT_ID && !x.IsDeleted && x.BSNO == strId);
|
|
|
|
|
|
|
|
if (order == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
order = item.Adapt<BookingCustomerOrder>();
|
|
|
|
|
|
|
|
order.BSNO = order.Id.ToString(); //客户订舱系统中的id
|
|
|
|
|
|
|
|
order.Id = YitIdHelper.NextId();
|
|
|
|
|
|
|
|
order.BSSTATUS = "已接收";
|
|
|
|
|
|
|
|
await _rep.InsertAsync(order);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (order.BSSTATUS == "已审核")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
rtnList.Add(new BookingSubmitResultModel()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = item.Id,
|
|
|
|
|
|
|
|
Success = false,
|
|
|
|
|
|
|
|
BOOKINGNO = item.BOOKINGNO,
|
|
|
|
|
|
|
|
Message = $"数据已审核,不能重复提交"
|
|
|
|
|
|
|
|
}); ;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var idBackup = order.Id; //防止覆盖
|
|
|
|
|
|
|
|
var bsnoBackup = order.BSNO; //防止覆盖
|
|
|
|
|
|
|
|
order = order.Adapt(order);
|
|
|
|
|
|
|
|
order.Id = idBackup;
|
|
|
|
|
|
|
|
order.BSNO = bsnoBackup;
|
|
|
|
|
|
|
|
order.BSSTATUS = "已接收";
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(order);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//箱信息
|
|
|
|
|
|
|
|
await _repCtn.DeleteAsync(x => x.BILLID == order.Id);
|
|
|
|
|
|
|
|
foreach (var ctn in item.CtnList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bkCtn = ctn.Adapt<BookingCtn>();
|
|
|
|
|
|
|
|
bkCtn.Id = YitIdHelper.NextId();
|
|
|
|
|
|
|
|
bkCtn.BILLID = order.Id;
|
|
|
|
|
|
|
|
await _repCtn.InsertAsync(bkCtn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//服务项目
|
|
|
|
|
|
|
|
await _repServiceItem.DeleteAsync(x => x.BookingId == order.Id);
|
|
|
|
|
|
|
|
foreach (var serv in item.ServiceItemList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bkServ = serv.Adapt<BookingServiceItem>();
|
|
|
|
|
|
|
|
bkServ.Id = YitIdHelper.NextId();
|
|
|
|
|
|
|
|
bkServ.BookingId = order.Id;
|
|
|
|
|
|
|
|
await _repServiceItem.InsertAsync(bkServ);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//文件
|
|
|
|
|
|
|
|
await _repFile.DeleteAsync(x => x.BookingId == order.Id);
|
|
|
|
|
|
|
|
var opt = App.GetOptions<BookingAttachOptions>();
|
|
|
|
|
|
|
|
var dirAbs = string.Empty;
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(opt.basePath))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dirAbs = Path.Combine(App.WebHostEnvironment.WebRootPath, opt.relativePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dirAbs = Path.Combine(opt.basePath, opt.relativePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var file in item.Files)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var saveFileName = $"{DateTime.Now.Ticks}{Path.GetExtension(file.Key)}";
|
|
|
|
|
|
|
|
var fileRelaPath = Path.Combine(opt.relativePath, saveFileName).ToLower();
|
|
|
|
|
|
|
|
var fileAbsPath = Path.Combine(dirAbs, saveFileName).ToLower();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
File.WriteAllBytes(fileAbsPath, Convert.FromBase64String(file.Value));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bkFile = new BookingFile
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = YitIdHelper.NextId(),
|
|
|
|
|
|
|
|
FileName = Path.GetFileName(file.Key),
|
|
|
|
|
|
|
|
FilePath = fileRelaPath,
|
|
|
|
|
|
|
|
TypeCode = "tuodan",
|
|
|
|
|
|
|
|
TypeName = "托单文件",
|
|
|
|
|
|
|
|
BookingId = order.Id,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
await _repFile.InsertAsync(bkFile);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rtnList.Add(new BookingSubmitResultModel()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = item.Id,
|
|
|
|
|
|
|
|
Success = true,
|
|
|
|
|
|
|
|
BOOKINGNO = item.BOOKINGNO,
|
|
|
|
|
|
|
|
Message = $"提交成功"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//日志动态
|
|
|
|
|
|
|
|
var staLog = new BookingStatusLog();
|
|
|
|
|
|
|
|
staLog.Status = "已接收";
|
|
|
|
|
|
|
|
staLog.CreatedUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
staLog.CreatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
staLog.CreatedTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.OpTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.BookingId = order.Id;
|
|
|
|
|
|
|
|
_repStatuslog.Insert(staLog);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return rtnList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 审核订舱请求
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("/BookingCustomerOrder/AuditBooking")]
|
|
|
|
|
|
|
|
public async Task AuditBooking(long id, bool accept, string comment)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var model = _rep.FirstOrDefault(x => x.Id == id);
|
|
|
|
|
|
|
|
if (model == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("未找到业务信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.BSSTATUS != "已接收")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("当前状态不能审核");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (accept)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
model.BSSTATUS = "已审核";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
model.BSSTATUS = "已驳回";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//回推回执
|
|
|
|
|
|
|
|
var recFeedbackConfig = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingCustomerRecAuditFeedbackURL");
|
|
|
|
|
|
|
|
if (recFeedbackConfig == null || string.IsNullOrEmpty(recFeedbackConfig.Value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("回推订舱审核结果的URL地址未配置,请联系管理员");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var recFeedbackUserKey = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingCustomerRecAuditFeedbackUserKey");
|
|
|
|
|
|
|
|
if (recFeedbackUserKey == null || string.IsNullOrEmpty(recFeedbackUserKey.Value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("回推订舱审核结果的用户KEY未配置,请联系管理员");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var recFeedbackUserSecret = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingCustomerRecAuditFeedbackUserSecret");
|
|
|
|
|
|
|
|
if (recFeedbackUserSecret == null || string.IsNullOrEmpty(recFeedbackUserSecret.Value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("回推订舱审核结果的用户秘钥未配置,请联系管理员");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var sendObj = new BookingCustomerRecAduitFeedbackDto()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = model.BSNO,
|
|
|
|
|
|
|
|
Accept = accept,
|
|
|
|
|
|
|
|
Comment = comment
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"回推审核数据:{JsonConvert.SerializeObject(sendObj)}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rtn = await recFeedbackConfig.Value
|
|
|
|
|
|
|
|
.SetHeaders(new Dictionary<string, object> {
|
|
|
|
|
|
|
|
{ CommonConst.API_USER_HEADER_KEY, recFeedbackUserKey.Value},
|
|
|
|
|
|
|
|
{ CommonConst.API_USER_HEADER_SECRET, recFeedbackUserSecret.Value}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.SetBody(sendObj)
|
|
|
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"回推审核返回:{rtn}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var jobjRtn = JObject.Parse(rtn);
|
|
|
|
|
|
|
|
if (jobjRtn.GetIntValue("code") != 200)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah(jobjRtn.GetStringValue("message"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(model); //回推成功后,存库
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//日志动态
|
|
|
|
|
|
|
|
var staLog = new BookingStatusLog();
|
|
|
|
|
|
|
|
staLog.Status = $"{(accept ? "审核通过" : "审核驳回")},审核意见:{comment}";
|
|
|
|
|
|
|
|
staLog.CreatedUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
staLog.CreatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
staLog.CreatedTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.OpTime = DateTime.Now;
|
|
|
|
|
|
|
|
staLog.BookingId = id;
|
|
|
|
|
|
|
|
_repStatuslog.Insert(staLog);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//进入订舱台账
|
|
|
|
|
|
|
|
if (accept)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var custBookId = jobjRtn.GetStringValue("data"); //返回的客户订舱系统的订舱数据id
|
|
|
|
|
|
|
|
var bkOrder = model.Adapt<BookingOrder>();
|
|
|
|
|
|
|
|
bkOrder.Id = YitIdHelper.NextId();
|
|
|
|
|
|
|
|
bkOrder.BSNO = custBookId;
|
|
|
|
|
|
|
|
bkOrder.BSSTATUS = "已录入";
|
|
|
|
|
|
|
|
await _repOrder.InsertAsync(bkOrder);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ctnList = await _repCtn.Where(x => x.BILLID == model.Id).ToListAsync();
|
|
|
|
|
|
|
|
foreach (var ctn in ctnList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ctn.Id = YitIdHelper.NextId();
|
|
|
|
|
|
|
|
ctn.BILLID = bkOrder.Id;
|
|
|
|
|
|
|
|
await _repCtn.InsertAsync(ctn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|