jianghaiqing 1 year ago
commit 6791c80de0

@ -129,7 +129,7 @@ namespace Myshipping.Application
private readonly IBookingGoodsStatusConfigService _GoodsConfig;
private readonly SqlSugarRepository<BookingLineOpMgrConfig> _repLineOpMgrConfig;
private readonly SqlSugarRepository<SysEmp> _repSysEmp;
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_RT";
@ -851,7 +851,8 @@ namespace Myshipping.Application
entity.YgtETD = vess.YgtETD;
}
else {
else
{
entity.StartETA = null;
entity.ATD = null;
entity.YgtETD = null;
@ -7600,16 +7601,24 @@ namespace Myshipping.Application
_logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入获取场站数据:{rtn.ToJsonString()}");
//场站数据的包装经常为空,因此取场站数据时,如果包装为空,从主信息或填写过的箱信息的包装中获取
var ctnKindPkg = ctns.FirstOrDefault(x => !string.IsNullOrEmpty(x.KINDPKGS));
var kindPkg = order.KINDPKGS;
if (string.IsNullOrEmpty(kindPkg) && ctnKindPkg != null)
{
kindPkg = ctnKindPkg.KINDPKGS;
}
foreach (var item in rtn)
{
var ctn = new BookingCtn();
ctn.BILLID = order.Id;
ctn.CTNCODE = item.CtnCode;
ctn.CTNALL = item.CTNALL;
ctn.CTNNUM = item.XiangLiang;
ctn.CTNNUM = 1;
ctn.CNTRNO = item.CNTRNO;
ctn.SEALNO = item.SEALNO;
ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? order.KINDPKGS : item.KINDPKGS;
ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? kindPkg : item.KINDPKGS;
ctn.PKGS = item.PKGS;
ctn.KGS = Convert.ToDecimal(item.KGS);
ctn.CBM = Convert.ToDecimal(item.CBM);
@ -8606,6 +8615,6 @@ namespace Myshipping.Application
await SendBookingOrder(orderlist.ToArray());
}
}
}

@ -115,7 +115,6 @@ namespace Myshipping.Application
[HttpGet("/BookingOrderSF/Page")]
public async Task<dynamic> Page([FromQuery] BookingOrderSFInput input)
{
var entities = await _rep.AsQueryable().Filter(null, true)
.Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false)
.WhereIF(!string.IsNullOrWhiteSpace(input.KDNO), u => u.KDNO.Contains(input.KDNO))
@ -134,9 +133,10 @@ namespace Myshipping.Application
.ToPagedListAsync(input.PageNo, input.PageSize);
var list = entities.Adapt<SqlSugarPagedList<BookingOrderSFDto>>();
foreach (var item in list.Items) {
foreach (var item in list.Items)
{
item.Business = await _business.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToListAsync();
item.detail= await _detail.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToListAsync();
item.detail = await _detail.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToListAsync();
}
return list;
}
@ -147,19 +147,66 @@ namespace Myshipping.Application
[HttpGet("/BookingOrderSF/Save")]
public async Task<dynamic> Save(BookingOrderSFDto input)
{
if (!string.IsNullOrEmpty(input.KDNO))
{
throw Oops.Bah("快递单号不能为空!");
}
if (!string.IsNullOrEmpty(input.SJPeople))
{
throw Oops.Bah("收件人不能为空!");
}
if (!string.IsNullOrEmpty(input.SJTel))
{
throw Oops.Bah("收件人电话不能为空!");
}
if (!string.IsNullOrEmpty(input.SJAddress))
{
throw Oops.Bah("收件人地址不能为空!");
}
if (!string.IsNullOrEmpty(input.FJPeople))
{
throw Oops.Bah("发件人不能为空!");
}
if (!string.IsNullOrEmpty(input.FJTel))
{
throw Oops.Bah("发件人电话不能为空!");
}
if (!string.IsNullOrEmpty(input.FJAddress))
{
throw Oops.Bah("发件人地址不能为空!");
}
if (input.Id == 0)
{
var entity = input.Adapt<BookingOrderSFExpressDelivery>();
await _rep.InsertAsync(entity);
if (input.Business != null && input.Business.Count > 0)
{
foreach (var item in input.Business)
{
var buentity = item.Adapt<BookingOrderSFExpressdeliveryBusiness>();
buentity.PId = entity.Id;
await _business.InsertAsync(buentity);
}
}
if (input.detail != null && input.detail.Count > 0)
{
foreach (var item in input.detail)
{
var dentity = item.Adapt<BookingOrderSFExpressdeliveryDetail>();
dentity.PId = entity.Id;
await _detail.InsertAsync(dentity);
}
}
}
else
{
}
else {
}
return null;
}

@ -422,6 +422,7 @@ namespace Myshipping.Application
{
throw Oops.Bah("BSNO未录入");
}
//根据东胜bsno获取当前数据查询不到则为新增
var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault();
var entity = item.Adapt<DjyVesselInfo>();
entity.Vessel = item.Vessel.ToUpper().Trim();
@ -431,20 +432,16 @@ namespace Myshipping.Application
if (string.IsNullOrEmpty(entity.CARRIERID))
{
entity.CARRIERID = mapcarrier.Where(x => x.MapName == item.CARRIER).Select(x => x.Code).FirstOrDefault();
}
if (string.IsNullOrEmpty(entity.CARRIERID))
{
throw Oops.Bah($"未找到{item.CARRIER}对应code,请联系管理员!");
}
}
if (!string.IsNullOrEmpty(item.CreatedUserName))
{
entity.CreatedUserId = CreatedUserId;
}
if (string.IsNullOrEmpty(item.Voyno))
@ -453,31 +450,34 @@ namespace Myshipping.Application
}
if (m == null)
{
//查询是否存在相同船名航次数据
var e = mlist.Where(x => x.CARRIERID == entity.CARRIERID && x.Vessel == entity.Vessel && x.Voyno == entity.Voyno && x.VoynoInside == entity.VoynoInside).FirstOrDefault();
//2023年7月27日王书岚航次为V.开头的不查询船期
if (!string.IsNullOrEmpty(entity.VoynoInside) && entity.VoynoInside.StartsWith("V."))
{
entity.Sign = true;
}
if (e == null)
{
//2023年7月27日王书岚航次为V.开头的不查询船期
if (!string.IsNullOrEmpty(entity.VoynoInside) && entity.VoynoInside.StartsWith("V."))
{
entity.Sign = true;
}
await _vesselinfo.InsertAsync(entity);
}
else
{
entity.Id = e.Id;
if (e.ETA != null)
{
entity.ETA = e.ETA;
}
await _vesselinfo.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
}
else
{
//2023年7月27日王书岚航次为V.开头的不查询船期
if (!string.IsNullOrEmpty(entity.VoynoInside) && entity.VoynoInside.StartsWith("V."))
{
entity.Sign = true;
}
entity.Id = m.Id;
if (m.ETA != null)
{
@ -1664,8 +1664,8 @@ namespace Myshipping.Application
// model.UpdatedTime = DateTime.Now;
// await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync();
//}
await _vesselinfo.UpdateAsync(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false&&
x.Vessel == item.Vessel && x.Voyno == item.Voyno , x => new DjyVesselInfo { ETA = item.ETA, YgtETD= item.ETD , ATD = item.ATD , UpdatedTime = DateTime.Now });
await _vesselinfo.UpdateAsync(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false &&
x.Vessel == item.Vessel && x.Voyno == item.Voyno, x => new DjyVesselInfo { ETA = item.ETA, YgtETD = item.ETD, ATD = item.ATD, UpdatedTime = DateTime.Now });
var order = orderlist.Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno).ToList();
bool issend = false;
if (order != null)
@ -2103,7 +2103,7 @@ namespace Myshipping.Application
bookingStatusLog.MBLNO = item.MBLNO;
await _repStatuslog.InsertAsync(bookingStatusLog);
if (item.detail != null && item.detail.Count > 0)
{
foreach (var dt in item.detail)
@ -2115,7 +2115,7 @@ namespace Myshipping.Application
BookingStatusLogDetail.OPTime = dt.OPTime;
await _statuslogdetail.InsertAsync(BookingStatusLogDetail);
}
}
@ -2358,9 +2358,9 @@ namespace Myshipping.Application
}
}
}
#endregion
#endregion
}
if (flag)
{

@ -48,10 +48,19 @@ public class LogEventSubscriber : IEventSubscriber
using var scope = Services.CreateScope();
var _repository = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<SysUser>>();
var log = (SysUser)context.Source.Payload;
await _repository.UpdateAsync(a => a.Id == log.Id, a => new SysUser
{
LastLoginTime = log.LastLoginTime,
LastLoginIp = log.LastLoginIp
});
}
await _repository.UpdateAsync(a => a.Id == log.Id, a => new SysUser
{
LastLoginTime = log.LastLoginTime,
LastLoginIp = log.LastLoginIp
});
}
[EventSubscribe("Delete:OpLog")]
public async Task DeleteOpLog(EventHandlerExecutingContext context)
{
using var scope = Services.CreateScope();
var _repository = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<SysLogOp>>();
var dayRemain = (int)context.Source.Payload;
await _repository.DeleteAsync(x => x.OpTime < DateTime.Now.AddDays(dayRemain * -1));
}
}

Loading…
Cancel
Save