|
|
|
@ -193,7 +193,9 @@ namespace Myshipping.Application
|
|
|
|
|
//List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
|
var entities = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID)
|
|
|
|
|
.WhereIF(!input.ISDel, x => x.IsDeleted == false)
|
|
|
|
|
.WhereIF(input.ISDel, x => x.IsDeleted == true)
|
|
|
|
|
.WhereIF(input.firstFlag, x => x.ETD <= etoday && x.ETD >= ftoday || x.ETD == null)
|
|
|
|
|
.WhereIF(string.IsNullOrWhiteSpace(input.HBLNO), x => x.ParentId == 0 || x.ParentId == null)
|
|
|
|
|
.WhereIF(pidlist != null && pidlist.Count > 0, x => pidlist.Contains(x.Id))
|
|
|
|
@ -463,7 +465,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.MBLNO))
|
|
|
|
|
{
|
|
|
|
|
var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.HBLNO == input.HBLNO && x.ParentId == input.ParentId && x.Id != input.Id).FirstAsync();
|
|
|
|
|
var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.HBLNO == input.HBLNO && x.ParentId == input.ParentId && x.Id != input.Id).FirstAsync();
|
|
|
|
|
if (et != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -475,7 +477,6 @@ namespace Myshipping.Application
|
|
|
|
|
if (input.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
entity.BOOKINGNO = Yitter.IdGenerator.YitIdHelper.NextId().ToString();
|
|
|
|
|
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
if (input.ctnInputs != null)
|
|
|
|
|
{
|
|
|
|
@ -537,7 +538,7 @@ namespace Myshipping.Application
|
|
|
|
|
it.LstShipOrderCompareRlt,
|
|
|
|
|
it.LstShipOrderCompareRltName,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == input.Id).Select(x => x.Id).ToListAsync();
|
|
|
|
|
var ctnlist = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == input.Id && x.IsDeleted == false).Select(x => x.Id).ToListAsync();
|
|
|
|
|
await _repCtn.DeleteAsync(x => x.BILLID == input.Id);
|
|
|
|
|
await _ctndetailrep.DeleteAsync(x => ctnlist.Contains((long)x.CTNID));
|
|
|
|
|
if (input.ctnInputs != null)
|
|
|
|
@ -836,9 +837,107 @@ namespace Myshipping.Application
|
|
|
|
|
await _repCtn.UpdateAsync(x => x.BILLID == Id, x => new BookingCtn { IsDeleted = true });
|
|
|
|
|
await _ctndetailrep.UpdateAsync(x => ctnlist.Contains((long)x.CTNID), x => new BookingCtnDetail { IsDeleted = true });
|
|
|
|
|
await _rep.UpdateAsync(x => x.Id == Id, x => new BookingOrder { IsDeleted = true });
|
|
|
|
|
await _bookingEDIExt.UpdateAsync(x => x.BookingId == Id, x => new BookingEDIExt { IsDeleted = true });
|
|
|
|
|
_logger.LogInformation(Id + "删除成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
const string MqActionExchangeName = "djy.output.dingcang.ds6";
|
|
|
|
|
const string MqActionQueueName = "djy.output.dingcang.ds6_delete";
|
|
|
|
|
ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
|
factory.Uri = new Uri(_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault());
|
|
|
|
|
|
|
|
|
|
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(Ids);
|
|
|
|
|
IBasicProperties props = mqModel.CreateBasicProperties();
|
|
|
|
|
props.DeliveryMode = 2;
|
|
|
|
|
mqModel.BasicPublish(MqActionExchangeName,
|
|
|
|
|
queueName, props,
|
|
|
|
|
messageBodyBytes);
|
|
|
|
|
conn.Close();
|
|
|
|
|
_logger.LogInformation($"订舱数据删除回推,已发送数据到消息队列【{_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()}】,数据内容:【{Ids}】");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
_logger.LogError(ex.StackTrace);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("请上传正确参数");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 恢复删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Ids"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
[HttpPost("/BookingOrder/RecoverDelete")]
|
|
|
|
|
public async Task RecoverDelete(string Ids)
|
|
|
|
|
{
|
|
|
|
|
var arr = Ids.Split(",");
|
|
|
|
|
if (arr.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var ar in arr)
|
|
|
|
|
{
|
|
|
|
|
long Id = Convert.ToInt64(ar);
|
|
|
|
|
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).Select(x => x.Id).ToListAsync();
|
|
|
|
|
await _repCtn.UpdateAsync(x => x.BILLID == Id, x => new BookingCtn { IsDeleted = false });
|
|
|
|
|
await _ctndetailrep.UpdateAsync(x => ctnlist.Contains((long)x.CTNID), x => new BookingCtnDetail { IsDeleted = false });
|
|
|
|
|
await _rep.UpdateAsync(x => x.Id == Id, x => new BookingOrder { IsDeleted = false });
|
|
|
|
|
await _bookingEDIExt.UpdateAsync(x => x.BookingId == Id, x => new BookingEDIExt { IsDeleted = false });
|
|
|
|
|
_logger.LogInformation(Id + "恢复删除成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
const string MqActionExchangeName = "djy.output.dingcang.ds6";
|
|
|
|
|
const string MqActionQueueName = "djy.output.dingcang.ds6_recoverdelete";
|
|
|
|
|
ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
|
factory.Uri = new Uri(_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault());
|
|
|
|
|
|
|
|
|
|
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(Ids);
|
|
|
|
|
IBasicProperties props = mqModel.CreateBasicProperties();
|
|
|
|
|
props.DeliveryMode = 2;
|
|
|
|
|
mqModel.BasicPublish(MqActionExchangeName,
|
|
|
|
|
queueName, props,
|
|
|
|
|
messageBodyBytes);
|
|
|
|
|
conn.Close();
|
|
|
|
|
_logger.LogInformation($"订舱数据删除恢复回推,已发送数据到消息队列【{_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()}】,数据内容:【{Ids}】");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
_logger.LogError(ex.StackTrace);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -5302,7 +5401,11 @@ namespace Myshipping.Application
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 推送东胜
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<dynamic> SendBookingOrder(long[] ids)
|
|
|
|
|
{
|
|
|
|
@ -5403,7 +5506,7 @@ namespace Myshipping.Application
|
|
|
|
|
queueName, props,
|
|
|
|
|
messageBodyBytes);
|
|
|
|
|
conn.Close();
|
|
|
|
|
_logger.LogInformation($"订舱数据回推,已发送数据到消息队列【{ConfigurationManager.AppSettings["BookingFeedbackMQUri"]}】,数据内容:【{json}】");
|
|
|
|
|
_logger.LogInformation($"订舱数据回推,已发送数据到消息队列【{_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()}】,数据内容:【{json}】");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
@ -5415,6 +5518,11 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|