|
|
@ -1046,6 +1046,82 @@ namespace Myshipping.Application
|
|
|
|
await SendBookingOrder(new long[] { order.Id });
|
|
|
|
await SendBookingOrder(new long[] { order.Id });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 在订舱台账保存单证备注、操作备注等功能
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("/BookingOrder/SaveDataInList"), AllowAnonymous]
|
|
|
|
|
|
|
|
public async Task SaveDataInList(JObject obj)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!obj.ContainsKey("Id"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("参数有误,没有Id");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var id = obj.GetLongValue("Id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var order = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id);
|
|
|
|
|
|
|
|
if (order == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("订舱数据不存在");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断权限,返回null表示有全部权限
|
|
|
|
|
|
|
|
List<long> userlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder, true);
|
|
|
|
|
|
|
|
if (userlist != null && !userlist.Contains(UserManager.UserId))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("无权修改");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var orderCompare = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var propsOrder = typeof(BookingOrder).GetProperties();
|
|
|
|
|
|
|
|
foreach (var property in obj)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var propNameLower = property.Key.ToLower();
|
|
|
|
|
|
|
|
var propOrd = propsOrder.FirstOrDefault(p => p.Name.ToLower() == propNameLower);
|
|
|
|
|
|
|
|
if (propOrd != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (propOrd.PropertyType == typeof(string))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
propOrd.SetValue(order, obj.GetStringValue(property.Key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (propOrd.PropertyType == typeof(int) || propOrd.PropertyType == typeof(int?))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
propOrd.SetValue(order, obj.GetIntValue(property.Key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (propOrd.PropertyType == typeof(long) || propOrd.PropertyType == typeof(long?))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
propOrd.SetValue(order, obj.GetLongValue(property.Key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (propOrd.PropertyType == typeof(DateTime) || propOrd.PropertyType == typeof(DateTime?))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
propOrd.SetValue(order, obj.GetDateTimeValue(property.Key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (propOrd.PropertyType == typeof(bool) || propOrd.PropertyType == typeof(bool?))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
propOrd.SetValue(order, obj.GetBooleanValue(property.Key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (propOrd.PropertyType == typeof(decimal) || propOrd.PropertyType == typeof(decimal?))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
propOrd.SetValue(order, obj.GetDecimalValue(property.Key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JsonUtil.PropToUpper(order, "ORDNO", "BSSTATUS", "YARDID", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME", "DZRemark", "CZRemark");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
order.VERSION = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(order);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//记录修改日志
|
|
|
|
|
|
|
|
await SaveLog(order, orderCompare);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//推送东胜
|
|
|
|
|
|
|
|
await SendBookingOrder(new long[] { order.Id });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 删除订舱
|
|
|
|
/// 删除订舱
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -1987,37 +2063,41 @@ namespace Myshipping.Application
|
|
|
|
public async Task<dynamic> SendLetterYard(long bookingId)
|
|
|
|
public async Task<dynamic> SendLetterYard(long bookingId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var entity = _repLetterYard.AsQueryable().Filter(null, true).First(x => x.BookingId == bookingId);
|
|
|
|
var entity = _repLetterYard.AsQueryable().Filter(null, true).First(x => x.BookingId == bookingId);
|
|
|
|
var json = entity.ToJsonString();
|
|
|
|
if (entity != null)
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const string MqActionExchangeName = "djy.output.dingcang.ds6";
|
|
|
|
var json = entity.ToJsonString();
|
|
|
|
const string MqActionQueueName = "djy.output.dingcang.ds6_fangcang";
|
|
|
|
try
|
|
|
|
ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
{
|
|
|
|
factory.Uri = new Uri(_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault());
|
|
|
|
const string MqActionExchangeName = "djy.output.dingcang.ds6";
|
|
|
|
|
|
|
|
const string MqActionQueueName = "djy.output.dingcang.ds6_fangcang";
|
|
|
|
|
|
|
|
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())
|
|
|
|
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(json);
|
|
|
|
|
|
|
|
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()}】,数据内容:【{json}】");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IModel mqModel = conn.CreateModel();
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct);
|
|
|
|
_logger.LogError(ex.StackTrace);
|
|
|
|
var queueName = $"{MqActionQueueName}.{UserManager.TENANT_ID}";
|
|
|
|
|
|
|
|
mqModel.QueueDeclare(queueName, false, false, false, null);
|
|
|
|
|
|
|
|
mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
|
|
|
|
|
|
|
|
byte[] messageBodyBytes = Encoding.UTF8.GetBytes(json);
|
|
|
|
|
|
|
|
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()}】,数据内容:【{json}】");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
|
|
|
_logger.LogError(ex.StackTrace);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -7381,6 +7461,8 @@ namespace Myshipping.Application
|
|
|
|
var rtn = await GetYardDataAndMappingSystem(order, false);
|
|
|
|
var rtn = await GetYardDataAndMappingSystem(order, false);
|
|
|
|
await _repCtn.DeleteAsync(x => x.BILLID == bookId);
|
|
|
|
await _repCtn.DeleteAsync(x => x.BILLID == bookId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入获取场站数据:{rtn.ToJsonString()}");
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in rtn)
|
|
|
|
foreach (var item in rtn)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var ctn = new BookingCtn();
|
|
|
|
var ctn = new BookingCtn();
|
|
|
@ -7401,6 +7483,7 @@ namespace Myshipping.Application
|
|
|
|
await _repCtn.InsertAsync(ctn);
|
|
|
|
await _repCtn.InsertAsync(ctn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入完成");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -7752,10 +7835,10 @@ namespace Myshipping.Application
|
|
|
|
[NonAction]
|
|
|
|
[NonAction]
|
|
|
|
public async Task<dynamic> SendBookingOrder(long[] ids)
|
|
|
|
public async Task<dynamic> SendBookingOrder(long[] ids)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var itemcode = App.Configuration["ITEMCODE"];
|
|
|
|
var itemcode = App.Configuration["ITEMCODE"].ToString();
|
|
|
|
var BookingOrderMQUri= App.Configuration["SendBookingOrderMQUri"];
|
|
|
|
var BookingOrderMQUri = App.Configuration["SendBookingOrderMQUri"];
|
|
|
|
_logger.LogInformation("订舱数据回推地址:" + BookingOrderMQUri);
|
|
|
|
_logger.LogInformation("订舱数据回推地址:" + BookingOrderMQUri + itemcode);
|
|
|
|
if (!string.IsNullOrEmpty(itemcode) && itemcode == "true")
|
|
|
|
if (!string.IsNullOrEmpty(itemcode) && itemcode == "True")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ids.Count() == 0)
|
|
|
|
if (ids.Count() == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|