|
|
|
@ -1374,54 +1374,92 @@ namespace Myshipping.Application
|
|
|
|
|
var arr = Ids.Split(",");
|
|
|
|
|
if (arr.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
|
|
|
|
|
var url = "http://123.235.27.122:8966/CommMng/PublicInterface/DJYDELBILL";// _cache.GetAllDictData().Result.Where(x => x.Code == "bookingorder_delete").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
if (string.IsNullOrEmpty(url))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未获取到相关url,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
foreach (var ar in arr)
|
|
|
|
|
{
|
|
|
|
|
long Id = Convert.ToInt64(ar);
|
|
|
|
|
|
|
|
|
|
var mblno = order.Where(x => x.Id == Id).Select(x => x.MBLNO).FirstOrDefault();
|
|
|
|
|
BookingOrderDelete bookingOrderDelete = new BookingOrderDelete();
|
|
|
|
|
List<BookingOrderDeleteDetail> deletelist = new List<BookingOrderDeleteDetail>();
|
|
|
|
|
deletelist.Add(new BookingOrderDeleteDetail
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
|
|
|
|
MBLNO = mblno
|
|
|
|
|
});
|
|
|
|
|
bookingOrderDelete.Delete = deletelist;
|
|
|
|
|
|
|
|
|
|
var stn = await url.SetBody(bookingOrderDelete).PostAsStringAsync();
|
|
|
|
|
var jobj = stn.ToJObject();
|
|
|
|
|
if (jobj.GetIntValue("Code") == 200)
|
|
|
|
|
{
|
|
|
|
|
JObject data = jobj.GetValue("Data") as JObject;
|
|
|
|
|
JArray NoDeleted = data.GetValue("NoDeleted") as JArray;
|
|
|
|
|
if (NoDeleted == null || NoDeleted.Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
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 = 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 + "删除成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
|
|
|
|
|
if (!string.IsNullOrEmpty(itemcode))
|
|
|
|
|
{
|
|
|
|
|
if (itemcode == "true")
|
|
|
|
|
|
|
|
|
|
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())
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
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}】");
|
|
|
|
|
var re = NoDeleted[0] as JObject;
|
|
|
|
|
string result = re.GetStringValue("Result");
|
|
|
|
|
throw Oops.Bah(result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
_logger.LogError(ex.StackTrace);
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("接口调用异常");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#region 消息队列推送删除信息
|
|
|
|
|
//var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
|
|
|
|
|
//if (!string.IsNullOrEmpty(itemcode))
|
|
|
|
|
//{
|
|
|
|
|
// if (itemcode == "true")
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -8153,7 +8191,7 @@ namespace Myshipping.Application
|
|
|
|
|
}).Take(10).ToList();
|
|
|
|
|
});
|
|
|
|
|
var TemplateIds = _repPrintTemplateShare.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.ShareToId == UserManager.UserId).Select(x => x.TemplateId).ToList();
|
|
|
|
|
var STemplate = _bookingTemplate.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && (TemplateIds.Contains(x.Id) || x.CreatedUserId == UserManager.UserId)&&
|
|
|
|
|
var STemplate = _bookingTemplate.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && (TemplateIds.Contains(x.Id) || x.CreatedUserId == UserManager.UserId) &&
|
|
|
|
|
x.Type == "10" && x.CreatedUserId == UserManager.UserId).Take(10).ToList();
|
|
|
|
|
var FTemplate = _bookingTemplate.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && (TemplateIds.Contains(x.Id) || x.CreatedUserId == UserManager.UserId) &&
|
|
|
|
|
x.Type == "20" && x.CreatedUserId == UserManager.UserId).Take(10).ToList();
|
|
|
|
|