jianghaiqing 2 years ago
commit 9bc2d390d6

@ -905,40 +905,46 @@ namespace Myshipping.Application
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 });
List<long> list = new List<long>();
list.Add(Id);
await SendBookingOrder(list.ToArray());
_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());
//try
//{
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);
}
// SendBookingOrder(Id);
// 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
{
@ -5519,9 +5525,6 @@ namespace Myshipping.Application
}
#endregion

@ -260,12 +260,17 @@ namespace Myshipping.Application
mDATA.SENDREMARK = SENDREMARK;
var FORWARDER = mDATA.FORWARDER;
var YardCode = mDATA.YARDID;
mDATA.FORWARDER = _cache.GetAllMappingForwarder().Result.Where(x => x.Code == FORWARDER && x.Module == "cangdan").Select(x => x.MapCode).FirstOrDefault() == null ?
mDATA.FORWARDER =
_cache.GetAllMappingForwarder().Result.Where(x => x.Code == FORWARDER && x.Module == "cangdan").Select(x => x.MapCode).FirstOrDefault() == null ?
_cache.GetAllCodeForwarder().Result.Where(x => x.Name == FORWARDER).Select(x => x.Name).FirstOrDefault() :
_cache.GetAllMappingForwarder().Result.Where(x => x.Code == FORWARDER && x.Module == "cangdan").Select(x => x.MapCode).FirstOrDefault();
mDATA.YARDID = _cache.GetAllCodeYard().Result.Where(x => x.Code == YardCode).Select(x => x.ShowCode).FirstOrDefault();
CTNDATA = ctns.Adapt<List<CTNDATAItem>>();
foreach (var item in CTNDATA)
{
item.KINDPKGS = _cache.GetAllCodePackage().Result.Where(x => x.Name == item.KINDPKGS).Select(x => x.EdiCode).FirstOrDefault();
}
custEDIDtos.Add(
new CustEDIDto
{
@ -325,6 +330,10 @@ namespace Myshipping.Application
{
await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已直发", SENDREMARK = SENDREMARK });
}
if (type == "1")
{
await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已直发", SENDREMARK = SENDREMARK });
}
if (type == "2")
{
await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已删除", SENDREMARK = SENDREMARK });

@ -63,13 +63,16 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<CodePort> _codePortRep;
private readonly SqlSugarRepository<RelaPortCarrierLane> _relaPortLane;
private readonly ICommonDBService _commonDBService;
private readonly SqlSugarRepository<CodeForwarder> _codeForwarder;
public DataSyncService(ILogger<DataSyncService> logger, ISysCacheService cache, SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
SqlSugarRepository<SysUser> repUser, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<DjyCustomer> djycustomer,
SqlSugarRepository<DjyCustomerContact> djycustomercontact, SqlSugarRepository<DjyVesselInfo> vesselinfo, SqlSugarRepository<BookingCtnDetail> ctndetailrep
, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail,
SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig, SqlSugarRepository<DjyTenantLine> repline,
SqlSugarRepository<BookingRemark> bookingremark, SqlSugarRepository<MappingCarrier> mapcarrier,
SqlSugarRepository<BookingRemark> bookingremark, SqlSugarRepository<MappingCarrier> mapcarrier, SqlSugarRepository<CodeForwarder> codeForwarder,
SqlSugarRepository<CodePort> codePortRep, SqlSugarRepository<CodeLane> codeLaneRep, ICommonDBService commonDBService, SqlSugarRepository<RelaPortCarrierLane> relaPortLane)
{
this._logger = logger;
@ -94,6 +97,7 @@ namespace Myshipping.Application
this._codeLaneRep = codeLaneRep;
this._commonDBService = commonDBService;
this._relaPortLane = relaPortLane;
this._codeForwarder = codeForwarder;
}
@ -132,7 +136,7 @@ namespace Myshipping.Application
{
entity.CUSTSERVICEID = userlist.Where(x => x.Name == entity.CUSTSERVICE).Count() == 0 ? "" : userlist.Where(x => x.Name == entity.CUSTSERVICE).Select(x => x.Id).FirstOrDefault().ToString();
}
entity.PropString = entity.PropString.Replace("forwarder", "booking_agent");
entity.PropString = entity.PropString.Replace("forwarder", "booking_agent");
entity.TenantId = UserManager.TENANT_ID;
await _djycustomer.InsertAsync(entity);
foreach (var item in model.ContactList)
@ -142,6 +146,38 @@ namespace Myshipping.Application
contact.TenantId = UserManager.TENANT_ID;
await _djycustomercontact.InsertAsync(contact);
}
if (entity.PropString.Contains("shipagency"))
{
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
if (ship == null)
{
await _codeForwarder.InsertAsync(new CodeForwarder
{
GID = Guid.NewGuid().ToString(),
CreateTime = DateTime.Now,
CreateUser = UserManager.DjyUserId,
Code = entity.CodeName,
Name = entity.ShortName
});
}
else
{
ship.Code = entity.CodeName;
ship.Name = entity.ShortName;
ship.ModifyTime = DateTime.Now;
ship.ModifyUser = UserManager.DjyUserId;
await _codeForwarder.UpdateAsync(ship);
}
}
}
else
{
@ -171,6 +207,37 @@ namespace Myshipping.Application
it.TIDANINFO
}).ExecuteCommandAsync();
await _djycustomercontact.DeleteAsync(x => x.CustomerId == entity.Id);
if (entity.PropString.Contains("shipagency"))
{
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
if (ship == null)
{
await _codeForwarder.InsertAsync(new CodeForwarder
{
GID = Guid.NewGuid().ToString(),
CreateTime = DateTime.Now,
CreateUser = UserManager.DjyUserId,
Code = entity.CodeName,
Name = entity.ShortName
});
}
else
{
ship.Code = entity.CodeName;
ship.Name = entity.ShortName;
ship.ModifyTime = DateTime.Now;
ship.ModifyUser = UserManager.DjyUserId;
await _codeForwarder.UpdateAsync(ship);
}
}
foreach (var item in model.ContactList)
{
var contact = item.Adapt<DjyCustomerContact>();
@ -231,6 +298,37 @@ namespace Myshipping.Application
contact.CustomerId = entity.Id;
contact.TenantId = UserManager.TENANT_ID;
await _djycustomercontact.InsertAsync(contact);
}
if (entity.PropString.Contains("shipagency"))
{
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
if (ship == null)
{
await _codeForwarder.InsertAsync(new CodeForwarder
{
GID = Guid.NewGuid().ToString(),
CreateTime = DateTime.Now,
CreateUser = UserManager.DjyUserId,
Code = entity.CodeName,
Name = entity.ShortName
});
}
else
{
ship.Code = entity.CodeName;
ship.Name = entity.ShortName;
ship.ModifyTime = DateTime.Now;
ship.ModifyUser = UserManager.DjyUserId;
await _codeForwarder.UpdateAsync(ship);
}
}
}
else
@ -265,6 +363,37 @@ namespace Myshipping.Application
contact.CustomerId = entity.Id;
contact.TenantId = UserManager.TENANT_ID;
await _djycustomercontact.InsertAsync(contact);
}
if (entity.PropString.Contains("shipagency"))
{
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
if (ship == null)
{
await _codeForwarder.InsertAsync(new CodeForwarder
{
GID = Guid.NewGuid().ToString(),
CreateTime = DateTime.Now,
CreateUser = UserManager.DjyUserId,
Code = entity.CodeName,
Name = entity.ShortName
});
}
else
{
ship.Code = entity.CodeName;
ship.Name = entity.ShortName;
ship.ModifyTime = DateTime.Now;
ship.ModifyUser = UserManager.DjyUserId;
await _codeForwarder.UpdateAsync(ship);
}
}
}
}
@ -347,7 +476,8 @@ namespace Myshipping.Application
{
it.ATD = item.ATD;
}
if (it.YgtETD!=item.YgtETD) {
if (it.YgtETD != item.YgtETD)
{
it.YgtETD = item.YgtETD;
}
await _rep.AsUpdateable(it).IgnoreColumns(it => new

Loading…
Cancel
Save