|
|
|
@ -130,6 +130,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<BookingLineOpMgrConfig> _repLineOpMgrConfig;
|
|
|
|
|
private readonly SqlSugarRepository<SysEmp> _repSysEmp;
|
|
|
|
|
private readonly SqlSugarRepository<BookingAutoYardImport> _repAutoYard;
|
|
|
|
|
private readonly SqlSugarRepository<BookingGoodsStatusSubscribe> _repBookingStatusSubscribe;
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingExtendState> _repextendstate;
|
|
|
|
|
|
|
|
|
@ -157,7 +158,7 @@ namespace Myshipping.Application
|
|
|
|
|
SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingServiceItem> serviceItem,
|
|
|
|
|
SqlSugarRepository<ParaContractNoInfo> paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository,
|
|
|
|
|
ISysOrgService orgService, SqlSugarRepository<BookingLineOpMgrConfig> repLineOpMgrConfig, SqlSugarRepository<SysEmp> repSysEmp, SqlSugarRepository<BookingAutoYardImport> repAutoYard,
|
|
|
|
|
IServiceWorkFlowManageService serviceWorkFlowManageService)
|
|
|
|
|
IServiceWorkFlowManageService serviceWorkFlowManageService, SqlSugarRepository<BookingGoodsStatusSubscribe> repBookingStatusSubscribe)
|
|
|
|
|
{
|
|
|
|
|
this._logger = logger;
|
|
|
|
|
this._rep = rep;
|
|
|
|
@ -203,6 +204,7 @@ namespace Myshipping.Application
|
|
|
|
|
this._repAutoYard = repAutoYard;
|
|
|
|
|
this._repextendstate = repextendstate;
|
|
|
|
|
_serviceWorkFlowManageService = serviceWorkFlowManageService;
|
|
|
|
|
this._repBookingStatusSubscribe = repBookingStatusSubscribe;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 主表和箱信息
|
|
|
|
@ -1896,156 +1898,80 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 货物状态
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加货物状态
|
|
|
|
|
/// 设置货物状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
[HttpPost("/BookingOrder/SaveGoodsStatus")]
|
|
|
|
|
public async Task<dynamic> SaveGoodsStatus(GoodsStatusDtoList input)
|
|
|
|
|
[HttpPost("/BookingOrder/SetGoodsStatus")]
|
|
|
|
|
public async Task<List<GoodsStatusDto>> SetGoodsStatus(GoodsStatusSetDto input)
|
|
|
|
|
{
|
|
|
|
|
if (input.BookingId == null || input.BookingId == 0)
|
|
|
|
|
var order = await _rep.FirstOrDefaultAsync(x => x.Id == input.BookingId);
|
|
|
|
|
if (order == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未传入业务id");
|
|
|
|
|
throw Oops.Bah("订舱数据未找到");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _goodsStatus.DeleteAsync(x => x.bookingId == input.BookingId);
|
|
|
|
|
foreach (var item in input.item)
|
|
|
|
|
var gsCfg = await _goodsStatusConfig.FirstOrDefaultAsync(x => x.Id == input.GoodsStatusConfigId);
|
|
|
|
|
if (gsCfg == null)
|
|
|
|
|
{
|
|
|
|
|
var entity = item.Adapt<BookingGoodsStatus>();
|
|
|
|
|
entity.bookingId = input.BookingId;
|
|
|
|
|
if (item.FinishTime.HasValue) //2023年5月25日,王书岚:可以只填写申请箱使天数,但是没有完成申请箱使
|
|
|
|
|
{
|
|
|
|
|
entity.FinishUser = UserManager.Name;
|
|
|
|
|
entity.FinishTime = item.FinishTime;
|
|
|
|
|
entity.FinishUserId = UserManager.UserId;
|
|
|
|
|
}
|
|
|
|
|
await _goodsStatus.InsertAsync(entity);
|
|
|
|
|
throw Oops.Bah("货物状态配置未找到");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新货物状态
|
|
|
|
|
await SetBookingOrderGoodsStatus((long)input.BookingId);
|
|
|
|
|
_logger.LogInformation("货物状态直推东胜:");
|
|
|
|
|
//推送东胜
|
|
|
|
|
await SendBookingOrder(new long[] { Convert.ToInt64(input.BookingId) });
|
|
|
|
|
var order = _rep.Where(x => x.Id == input.BookingId).First();
|
|
|
|
|
var userid = order.CreatedUserId;
|
|
|
|
|
if (userid != null)
|
|
|
|
|
if (input.IsCancel)
|
|
|
|
|
{
|
|
|
|
|
//获取当前用户已经录入的货物状态
|
|
|
|
|
var list = await _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
|
|
|
|
|
(goods, config) => config.Id == goods.ConfigId).Where((goods, config) => config.CreatedUserId == userid && goods.bookingId == input.BookingId).
|
|
|
|
|
OrderBy((goods, config) => config.Sort).
|
|
|
|
|
Select((goods, config) => new GoodsStatusQuery
|
|
|
|
|
{
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = goods.FinishTime,
|
|
|
|
|
FinishUser = goods.FinishUser,
|
|
|
|
|
FinishUserId = goods.FinishUserId,
|
|
|
|
|
IsPublic = goods.IsPublic,
|
|
|
|
|
ExtData = goods.ExtData,
|
|
|
|
|
Remark = goods.Remark,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
await _goodsStatus.DeleteAsync(x => x.ConfigId == gsCfg.Id
|
|
|
|
|
&& x.bookingId == order.Id);
|
|
|
|
|
|
|
|
|
|
//配置中所有的货物状态
|
|
|
|
|
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == userid).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
|
|
|
|
|
CustomerBookingSyncHelper.SyncBookingGoodsStatus(new GoodsStatusSyncDto() { Id = input.BookingId.Value, Code = gsCfg.SystemCode, IsCancel = true });
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var gs = await _goodsStatus.FirstOrDefaultAsync(x => x.bookingId == input.BookingId && x.ConfigId == input.GoodsStatusConfigId);
|
|
|
|
|
if (gs == null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = null,
|
|
|
|
|
FinishUser = null,
|
|
|
|
|
FinishUserId = null,
|
|
|
|
|
IsPublic = false,
|
|
|
|
|
ExtData = null,
|
|
|
|
|
Remark = null,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
//去掉两个list中重复的货物状态
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
gs = new BookingGoodsStatus();
|
|
|
|
|
gs.Id = YitIdHelper.NextId();
|
|
|
|
|
gs.bookingId = order.Id;
|
|
|
|
|
gs.ConfigId = gsCfg.Id;
|
|
|
|
|
gs.FinishUserId = UserManager.UserId;
|
|
|
|
|
gs.FinishUser = UserManager.Name;
|
|
|
|
|
gs.FinishTime = input.FinishTime.HasValue ? input.FinishTime.Value : DateTime.Now;
|
|
|
|
|
gs.Remark = input.Remark;
|
|
|
|
|
await _goodsStatus.InsertAsync(gs);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
config.RemoveAll(x => x.ConfigId == item.ConfigId);
|
|
|
|
|
gs.FinishUserId = UserManager.UserId;
|
|
|
|
|
gs.FinishUser = UserManager.Name;
|
|
|
|
|
gs.FinishTime = input.FinishTime.HasValue ? input.FinishTime.Value : DateTime.Now;
|
|
|
|
|
gs.Remark = input.Remark;
|
|
|
|
|
await _goodsStatus.UpdateAsync(gs);
|
|
|
|
|
}
|
|
|
|
|
var t = list.Union<GoodsStatusQuery>(config).OrderBy(x => x.Sort).DistinctBy(x => x.StatusName).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
|
CustomerBookingSyncHelper.SyncBookingGoodsStatus(new GoodsStatusSyncDto() { Id = input.BookingId.Value, Code = gsCfg.SystemCode, FinishTime = gs.FinishTime, IsCancel = false });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
return await GetGoodsStatus(order.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取货物状态
|
|
|
|
|
/// 设置货物状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookingId"></param>
|
|
|
|
|
/// <param name="bookId">订舱id</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/BookingOrder/GetGoodsStatusList")]
|
|
|
|
|
public async Task<List<GoodsStatusQuery>> GetGoodsStatusList(long bookingId)
|
|
|
|
|
[HttpPost("/BookingOrder/GetGoodsStatus")]
|
|
|
|
|
public async Task<List<GoodsStatusDto>> GetGoodsStatus(long bookId)
|
|
|
|
|
{
|
|
|
|
|
var userid = _rep.Where(x => x.Id == bookingId).Select(x => x.CreatedUserId).First();
|
|
|
|
|
if (userid != null)
|
|
|
|
|
{
|
|
|
|
|
//获取当前用户已经录入的货物状态
|
|
|
|
|
var list = await _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
|
|
|
|
|
(goods, config) => config.Id == goods.ConfigId).Where((goods, config) => config.CreatedUserId == userid && goods.bookingId == bookingId).
|
|
|
|
|
OrderBy((goods, config) => config.Sort).
|
|
|
|
|
Select((goods, config) => new GoodsStatusQuery
|
|
|
|
|
{
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = goods.FinishTime,
|
|
|
|
|
FinishUser = goods.FinishUser,
|
|
|
|
|
FinishUserId = goods.FinishUserId,
|
|
|
|
|
IsPublic = goods.IsPublic,
|
|
|
|
|
ExtData = goods.ExtData,
|
|
|
|
|
Remark = goods.Remark,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
//配置中所有的货物状态
|
|
|
|
|
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == userid).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = null,
|
|
|
|
|
FinishUser = null,
|
|
|
|
|
FinishUserId = null,
|
|
|
|
|
IsPublic = false,
|
|
|
|
|
ExtData = null,
|
|
|
|
|
Remark = null,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
//去掉两个list中重复的货物状态
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
config.RemoveAll(x => x.ConfigId == item.ConfigId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list.Union<GoodsStatusQuery>(config).OrderBy(x => x.Sort).DistinctBy(x => x.StatusName).ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lst = await _goodsStatus.Where(x => x.bookingId == bookId).ToListAsync();
|
|
|
|
|
return lst.Adapt<List<GoodsStatusDto>>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 运踪
|
|
|
|
@ -8384,104 +8310,104 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<dynamic> SendBookingOrder(long[] ids)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("开始同步订舱数据");
|
|
|
|
|
var itemcode = App.Configuration["ITEMCODE"].ToString();
|
|
|
|
|
var BookingOrderMQUri = App.Configuration["SendBookingOrderMQUri"];
|
|
|
|
|
_logger.LogInformation("订舱数据回推地址:" + BookingOrderMQUri + itemcode);
|
|
|
|
|
if (!string.IsNullOrEmpty(itemcode) && itemcode == "True")
|
|
|
|
|
{
|
|
|
|
|
if (ids.Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请上传正确数据");
|
|
|
|
|
}
|
|
|
|
|
var order = await _rep.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id) && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
foreach (var item in order)
|
|
|
|
|
{
|
|
|
|
|
var dto = item.Adapt<SyncBookingOrderDto>();
|
|
|
|
|
//箱使
|
|
|
|
|
var CtnDayNumlist = await GetGoodsStatusList(item.Id);
|
|
|
|
|
if (CtnDayNumlist != null)
|
|
|
|
|
{
|
|
|
|
|
dto.CtnDayNum = CtnDayNumlist.Where(x => x.StatusName == "申请箱使").Select(x => x.ExtData).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
dto.ctnInputs = ctn.Adapt<List<BookingCtnDto>>();
|
|
|
|
|
foreach (var it in dto.ctnInputs)
|
|
|
|
|
{
|
|
|
|
|
var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
it.ctnDetailInputs = ctnDetailInputs.Adapt<List<BookingCtnDetailDto>>();
|
|
|
|
|
}
|
|
|
|
|
//EDI
|
|
|
|
|
var BookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && x.IsDeleted == false).FirstAsync();
|
|
|
|
|
if (BookingEDIExt != null)
|
|
|
|
|
{
|
|
|
|
|
dto.BookingEDIExt = BookingEDIExt.Adapt<BookingEDIExtDto>();
|
|
|
|
|
}
|
|
|
|
|
//货物状态
|
|
|
|
|
dto.GoodsStatus = await _goodsStatus.AsQueryable().Filter(null, true).Where(x => x.bookingId == item.Id).InnerJoin<BookingGoodsStatusConfig>((t, d) => t.ConfigId == d.Id).Select((t, d) => new BookingGoodsStatusDto
|
|
|
|
|
{
|
|
|
|
|
StatusName = d.StatusName,
|
|
|
|
|
FinishTime = t.FinishTime,
|
|
|
|
|
Remark = t.Remark,
|
|
|
|
|
ExtData = t.ExtData
|
|
|
|
|
}).Distinct().ToListAsync();
|
|
|
|
|
|
|
|
|
|
var childrens = await _rep.AsQueryable().Filter(null, true).Where(x => x.ParentId == item.Id && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
dto.childrens = childrens.Adapt<List<Children>>();
|
|
|
|
|
|
|
|
|
|
foreach (var childitem in dto.childrens)
|
|
|
|
|
{
|
|
|
|
|
var ctnInputs = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == childitem.Id && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
childitem.ctnInputs = ctnInputs.Adapt<List<BookingCtnDto>>();
|
|
|
|
|
|
|
|
|
|
foreach (var it in childitem.ctnInputs)
|
|
|
|
|
{
|
|
|
|
|
var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
it.ctnDetailInputs = ctnDetailInputs.Adapt<List<BookingCtnDetailDto>>();
|
|
|
|
|
}
|
|
|
|
|
var childBookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == childitem.Id && x.IsDeleted == false).FirstAsync();
|
|
|
|
|
if (childBookingEDIExt != null)
|
|
|
|
|
{
|
|
|
|
|
childitem.BookingEDIExt = childBookingEDIExt.Adapt<BookingEDIExtDto>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var json = dto.ToJsonString();
|
|
|
|
|
json = $"[{json}]";
|
|
|
|
|
_logger.LogInformation("订舱数据回推:" + json);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
const string MqActionExchangeName = "djy.output.dingcang.ds6";
|
|
|
|
|
const string MqActionQueueName = "djy.output.dingcang.ds6";
|
|
|
|
|
ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
|
factory.Uri = new Uri(BookingOrderMQUri);
|
|
|
|
|
|
|
|
|
|
using (IConnection conn = factory.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
IModel mqModel = conn.CreateModel();
|
|
|
|
|
mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct);
|
|
|
|
|
var queueName = $"{MqActionQueueName}.{UserManager.TENANT_ID}";
|
|
|
|
|
mqModel.QueueDeclare(queueName, false, false, false, null);
|
|
|
|
|
mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
|
|
|
|
|
byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json));
|
|
|
|
|
IBasicProperties props = mqModel.CreateBasicProperties();
|
|
|
|
|
props.DeliveryMode = 2;
|
|
|
|
|
mqModel.BasicPublish(MqActionExchangeName, queueName, props, messageBodyBytes);
|
|
|
|
|
conn.Close();
|
|
|
|
|
_logger.LogInformation($"订舱数据回推,已发送数据到消息队列【{BookingOrderMQUri}】,数据内容:【{json}】");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
_logger.LogError(ex.StackTrace);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
await SendLetterYard(item.Id);
|
|
|
|
|
}
|
|
|
|
|
return order;
|
|
|
|
|
}
|
|
|
|
|
//_logger.LogInformation("开始同步订舱数据");
|
|
|
|
|
//var itemcode = App.Configuration["ITEMCODE"].ToString();
|
|
|
|
|
//var BookingOrderMQUri = App.Configuration["SendBookingOrderMQUri"];
|
|
|
|
|
//_logger.LogInformation("订舱数据回推地址:" + BookingOrderMQUri + itemcode);
|
|
|
|
|
//if (!string.IsNullOrEmpty(itemcode) && itemcode == "True")
|
|
|
|
|
//{
|
|
|
|
|
// if (ids.Count() == 0)
|
|
|
|
|
// {
|
|
|
|
|
// throw Oops.Bah("请上传正确数据");
|
|
|
|
|
// }
|
|
|
|
|
// var order = await _rep.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id) && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
// foreach (var item in order)
|
|
|
|
|
// {
|
|
|
|
|
// var dto = item.Adapt<SyncBookingOrderDto>();
|
|
|
|
|
// //箱使
|
|
|
|
|
// var CtnDayNumlist = await GetGoodsStatusList(item.Id);
|
|
|
|
|
// if (CtnDayNumlist != null)
|
|
|
|
|
// {
|
|
|
|
|
// dto.CtnDayNum = CtnDayNumlist.Where(x => x.StatusName == "申请箱使").Select(x => x.ExtData).FirstOrDefault();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
// dto.ctnInputs = ctn.Adapt<List<BookingCtnDto>>();
|
|
|
|
|
// foreach (var it in dto.ctnInputs)
|
|
|
|
|
// {
|
|
|
|
|
// var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
// it.ctnDetailInputs = ctnDetailInputs.Adapt<List<BookingCtnDetailDto>>();
|
|
|
|
|
// }
|
|
|
|
|
// //EDI
|
|
|
|
|
// var BookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && x.IsDeleted == false).FirstAsync();
|
|
|
|
|
// if (BookingEDIExt != null)
|
|
|
|
|
// {
|
|
|
|
|
// dto.BookingEDIExt = BookingEDIExt.Adapt<BookingEDIExtDto>();
|
|
|
|
|
// }
|
|
|
|
|
// //货物状态
|
|
|
|
|
// dto.GoodsStatus = await _goodsStatus.AsQueryable().Filter(null, true).Where(x => x.bookingId == item.Id).InnerJoin<BookingGoodsStatusConfig>((t, d) => t.ConfigId == d.Id).Select((t, d) => new BookingGoodsStatusDto
|
|
|
|
|
// {
|
|
|
|
|
// StatusName = d.StatusName,
|
|
|
|
|
// FinishTime = t.FinishTime,
|
|
|
|
|
// Remark = t.Remark,
|
|
|
|
|
// ExtData = t.ExtData
|
|
|
|
|
// }).Distinct().ToListAsync();
|
|
|
|
|
|
|
|
|
|
// var childrens = await _rep.AsQueryable().Filter(null, true).Where(x => x.ParentId == item.Id && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
// dto.childrens = childrens.Adapt<List<Children>>();
|
|
|
|
|
|
|
|
|
|
// foreach (var childitem in dto.childrens)
|
|
|
|
|
// {
|
|
|
|
|
// var ctnInputs = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == childitem.Id && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
// childitem.ctnInputs = ctnInputs.Adapt<List<BookingCtnDto>>();
|
|
|
|
|
|
|
|
|
|
// foreach (var it in childitem.ctnInputs)
|
|
|
|
|
// {
|
|
|
|
|
// var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
// it.ctnDetailInputs = ctnDetailInputs.Adapt<List<BookingCtnDetailDto>>();
|
|
|
|
|
// }
|
|
|
|
|
// var childBookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == childitem.Id && x.IsDeleted == false).FirstAsync();
|
|
|
|
|
// if (childBookingEDIExt != null)
|
|
|
|
|
// {
|
|
|
|
|
// childitem.BookingEDIExt = childBookingEDIExt.Adapt<BookingEDIExtDto>();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// var json = dto.ToJsonString();
|
|
|
|
|
// json = $"[{json}]";
|
|
|
|
|
// _logger.LogInformation("订舱数据回推:" + json);
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// const string MqActionExchangeName = "djy.output.dingcang.ds6";
|
|
|
|
|
// const string MqActionQueueName = "djy.output.dingcang.ds6";
|
|
|
|
|
// ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
|
// factory.Uri = new Uri(BookingOrderMQUri);
|
|
|
|
|
|
|
|
|
|
// using (IConnection conn = factory.CreateConnection())
|
|
|
|
|
// {
|
|
|
|
|
// IModel mqModel = conn.CreateModel();
|
|
|
|
|
// mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct);
|
|
|
|
|
// var queueName = $"{MqActionQueueName}.{UserManager.TENANT_ID}";
|
|
|
|
|
// mqModel.QueueDeclare(queueName, false, false, false, null);
|
|
|
|
|
// mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
|
|
|
|
|
// byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json));
|
|
|
|
|
// IBasicProperties props = mqModel.CreateBasicProperties();
|
|
|
|
|
// props.DeliveryMode = 2;
|
|
|
|
|
// mqModel.BasicPublish(MqActionExchangeName, queueName, props, messageBodyBytes);
|
|
|
|
|
// conn.Close();
|
|
|
|
|
// _logger.LogInformation($"订舱数据回推,已发送数据到消息队列【{BookingOrderMQUri}】,数据内容:【{json}】");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// _logger.LogError(ex.Message);
|
|
|
|
|
// _logger.LogError(ex.StackTrace);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// await SendLetterYard(item.Id);
|
|
|
|
|
// }
|
|
|
|
|
// return order;
|
|
|
|
|
//}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -9407,5 +9333,31 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 订阅货物状态
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订阅货物状态(不同用户都可订阅同一票货)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingOrder/GoodsStatusSubscribe")]
|
|
|
|
|
public async Task GoodsStatusSubscribe(BookingStatusSubscribeDto dto)
|
|
|
|
|
{
|
|
|
|
|
await _repBookingStatusSubscribe.DeleteAsync(x => x.BookingId == dto.BookingId && x.CreatedUserId == UserManager.UserId);
|
|
|
|
|
var model = dto.Adapt<BookingGoodsStatusSubscribe>();
|
|
|
|
|
model.Id = YitIdHelper.NextId();
|
|
|
|
|
await _repBookingStatusSubscribe.InsertAsync(model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取订阅货物状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingOrder/GetGoodsStatusSubscribe")]
|
|
|
|
|
public async Task<BookingStatusSubscribeDto> GetGoodsStatusSubscribe(long bookId)
|
|
|
|
|
{
|
|
|
|
|
var model = await _repBookingStatusSubscribe.FirstOrDefaultAsync(x => x.BookingId == bookId && x.CreatedUserId == UserManager.UserId);
|
|
|
|
|
return model.Adapt<BookingStatusSubscribeDto>();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|