Compare commits

...

4 Commits

@ -220,13 +220,14 @@ namespace Myshipping.Application
{
_logger.LogInformation($"PageData Stage 0 ");
}
//获取菜单列表权限
List<long> userlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder);
List<long?> pidlist = new List<long?>();
if (!string.IsNullOrWhiteSpace(input.SEALNO) || !string.IsNullOrWhiteSpace(input.CNTRNO))
{
pidlist = await _repCtn.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(input.SEALNO), x => x.SEALNO.StartsWith(input.SEALNO)).WhereIF(!string.IsNullOrWhiteSpace(input.CNTRNO), x => x.CNTRNO.StartsWith(input.CNTRNO)).Select(x => x.BILLID).ToListAsync();
}
//默认首次查询取开船日期范围
var ftoday = DateTime.Now.AddDays(-15);
var etoday = DateTime.Now.AddDays(30);
//List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
@ -514,14 +515,15 @@ namespace Myshipping.Application
ticks = DateTime.Now;
_logger.LogInformation($"PageData Stage 5 {et.TotalMilliseconds}");
}
//货运状态列表
//提箱返场
var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains((long)x.BookingId) && (x.Status == "提箱" || x.Status == "返场") && x.IsDeleted == false).ToList();
var statuslogId = statusloglist.Select(x => x.Id).ToList();
//运踪状态
//运踪状态详情
var statuslogdetaillist = _statuslogdetail.AsQueryable().Where(x => statuslogId.Contains(x.PId)).ToList();
//运踪状态
var BookingStatusList = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains((long)x.BookingId)).ToList();
//备注
var bookingremarkList = _bookingremark.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains(x.PId)).ToList();
@ -546,6 +548,7 @@ namespace Myshipping.Application
{
item.bookremark = st;
}
//变更日期类型
if (!string.IsNullOrWhiteSpace(item.ETD))
{
item.ETD = Convert.ToDateTime(item.ETD).ToString("yyyy-MM-dd");
@ -752,7 +755,7 @@ namespace Myshipping.Application
throw Oops.Bah(ms);
}
//转大写
JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YARDID", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME", "DZRemark", "CZRemark");
if (input.ctnInputs != null)
@ -760,7 +763,7 @@ namespace Myshipping.Application
var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}");
input.CNTRTOTAL = string.Join(" / ", groupList);
}
//条件限制 重复限制
if (!string.IsNullOrWhiteSpace(input.MBLNO) && input.ParentId == 0)
{
var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id).FirstAsync();
@ -916,7 +919,7 @@ namespace Myshipping.Application
var rightlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder, true);
_logger.LogInformation("保存权限范围:" + rightlist.ToJsonString());
//除现有配置权限外 操作和本人具有编辑权限
if (rightlist != null && !(
mlist.OPID == UserManager.UserId.ToString() || mlist.OP == UserManager.Name.ToString() ||
@ -1048,10 +1051,11 @@ namespace Myshipping.Application
}).ExecuteCommandAsync();
}
}
//记录日志
await SaveLog(entity, mlist);
if (!string.IsNullOrEmpty(entity.MBLNO) && !string.IsNullOrEmpty(entity.YARDID) && (entity.MBLNO != mlist.MBLNO || entity.YARDID != mlist.YARDID || entity.CARRIERID != mlist.CARRIERID))
{
//更改提单号
//更改提单号重新订阅运踪
await UpdateMblno(entity);
}
}
@ -1182,6 +1186,7 @@ namespace Myshipping.Application
{
ordOut.BookingEDIExt = ediExtEntity.Adapt<BookingEDIExtDto>();
}
//推送东胜
await SendBookingOrder(new long[] { main.ParentId == 0 ? Id : (long)main.ParentId });
//临时文件转正式
@ -1969,7 +1974,7 @@ namespace Myshipping.Application
var userid = _rep.Where(x => x.Id == bookingId).Select(x => x.CreatedUserId).First();
if (userid != null)
{
//获取当前用户已经录入的货物状态
var list = await _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
(goods, config) => config.Id == goods.ConfigId).Where((goods, config) => config.CreatedUserId == userid && goods.bookingId == bookingId).
OrderBy((goods, config) => config.Sort).
@ -1987,7 +1992,7 @@ namespace Myshipping.Application
Sort = config.Sort
}).ToListAsync();
//配置中所有的货物状态
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == userid).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
{
@ -2002,7 +2007,7 @@ namespace Myshipping.Application
Remark = null,
Sort = config.Sort
}).ToList();
//去掉两个list中重复的货物状态
foreach (var item in list)
{
config.RemoveAll(x => x.ConfigId == item.ConfigId);
@ -8125,8 +8130,10 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
//服务项目
var itemlist = await _serviceItem.AsQueryable().Where(x => x.BookingId == bookingId).ToListAsync();
allData.item = itemlist;
//备注
var remarklist = await _bookingremark.AsQueryable().Where(u => u.PId == bookingId).ToListAsync();
allData.remark = remarklist;
//附件
var filelist = await _bookingfile.AsQueryable().Filter(null, true).Where(u => u.BookingId == bookingId).ToListAsync();
allData.file = filelist;
@ -8136,9 +8143,10 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
ticks = DateTime.Now;
_logger.LogInformation($"GetAllData Stage 1 {et.TotalMilliseconds}");
}
//日志
var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == bookingId).OrderByDescending(x => x.OpTime).ToListAsync();
var dto = statuslog.Adapt<List<BookingStatusLogDto>>();
//状态日志
var statuslogdetail = await _statuslogdetail.AsQueryable().ToListAsync();
foreach (var item in dto)
{
@ -8180,6 +8188,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
var order = _rep.Where(x => x.Id == bookingId).First();
var userid = order.CreatedUserId;
var username = order.CreatedUserName;
//货物状态
if (userid != null)
{
_GoodsConfig.InitGoodsStatusConfig(Convert.ToInt64(userid), username);
@ -8301,6 +8310,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
x.lineRel.CarrierCode
}).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) &&
x.Type == "10" && x.CreatedUserId == UserManager.UserId).Take(10).ToList();
@ -8308,12 +8318,18 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
x.Type == "20" && x.CreatedUserId == UserManager.UserId).Take(10).ToList();
var TTemplate = _bookingTemplate.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && (TemplateIds.Contains(x.Id) || x.CreatedUserId == UserManager.UserId) &&
x.Type == "30" && x.CreatedUserId == UserManager.UserId).Take(10).ToList();
//委托单位
var WTDW = _djycustomer.Where(x => x.PropString.Contains("consignor") && x.TenantId == UserManager.TENANT_ID).Take(10).ToList();
//订舱代理
var DCDL = _djycustomer.Where(x => x.PropString.Contains("booking_agent") && x.TenantId == UserManager.TENANT_ID).Take(10).ToList();
//船代
var Forwarder = _cache.GetAllCodeForwarder().Result.Take(10).ToList();
//货物品名
var GoodsName = _paraGoodsInfoRepository.AsQueryable().OrderBy("GOODS_CODE asc").Take(50).ToList().Select(t => t.Adapt<ParaGoodsShowDto>()).ToList();
var YFXY = _paraContractNoInfoRepository.AsQueryable().OrderBy("CONTRACT_NO asc").Take(10).ToList().Select(t => t.Adapt<ParaContractNoShowDto>()).ToList(); ;
var User = await _repUser.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.Status == CommonStatus.ENABLE && x.IsDeleted == false).OrderBy(x => x.Name).ToListAsync();
//服务项目
var Service = _cache.GetAllCodeService().Result.Take(10).ToList();
dynamic obj = new
{
@ -8359,7 +8375,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
foreach (var item in order)
{
var dto = item.Adapt<SyncBookingOrderDto>();
//箱使
var CtnDayNumlist = await GetGoodsStatusList(item.Id);
if (CtnDayNumlist != null)
{
@ -8373,12 +8389,13 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync();
it.ctnDetailInputs = ctnDetailInputs.Adapt<List<BookingCtnDetailDto>>();
}
//EDI
var BookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && x.IsDeleted == false).FirstAsync();
if (BookingEDIExt != null)
{
dto.BookingEDIExt = BookingEDIExt.Adapt<BookingEDIExtDto>();
}
//货物状态
dto.GoodsStatus = await _goodsStatus.AsQueryable().Filter(null, true).Where(x => x.bookingId == item.Id).InnerJoin<BookingGoodsStatusConfig>((t, d) => t.ConfigId == d.Id).Select((t, d) => new BookingGoodsStatusDto
{
StatusName = d.StatusName,
@ -8541,7 +8558,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
order.ATD = sjlg_time;
flag = true;
}
//同步船期
if (flag)
{
await _rep.AsUpdateable(order).IgnoreColumns().ExecuteCommandAsync();
@ -8570,7 +8587,6 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
/// <param name="code"></param>
/// <param name="bookingId"></param>
/// <returns></returns>
public async Task SetGoodsStatus(string code, long bookingId)
{
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
@ -8634,6 +8650,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
}).ToListAsync();
if (list != null)
{
///回写主单状态
var StatusName = list.Where(x => x.FinishTime.HasValue).OrderByDescending(x => x.Sort).Select(x => x.StatusName).FirstOrDefault();
if (StatusName == null)
{
@ -8663,11 +8680,11 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
[NonAction]
public async Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder)
{
bool flag = true;
long bid = 0;
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(newOrder))
{
//基础字段不记录
string name = descriptor.Name;
if (name == "TenantId" || name == "CreatedTime" || name == "UpdatedTime" || name == "CreatedUserId" || name == "CreatedUserName")
{
@ -8675,7 +8692,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
}
object value = descriptor.GetValue(newOrder);
var oldvalue = oldOrder.GetType().GetProperty(name).GetValue(oldOrder, null);
//数值类型转换比较
if (name == "KGS" || name == "CBM")
{
if (Convert.ToDecimal(value) == Convert.ToDecimal(oldvalue))
@ -8728,7 +8745,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(newOrder))
{
string name = descriptor.Name;
if (name.ToUpper() == item.Code.ToUpper())
if (name.ToUpper() == item.Code.ToUpper())//转换大写 字典录入不在区分大小写
{
object value = descriptor.GetValue(newOrder);
var oldvalue = oldOrder.GetType().GetProperty(name).GetValue(oldOrder, null);
@ -8760,7 +8777,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(newOrder))
{
string name = descriptor.Name;
if (name.ToUpper() == item.Code.ToUpper())
if (name.ToUpper() == item.Code.ToUpper())//转换大写 字典录入不在区分大小写
{
object value = descriptor.GetValue(newOrder);
var oldvalue = oldOrder.GetType().GetProperty(name).GetValue(oldOrder, null);
@ -9043,7 +9060,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
#region 同步东胜
/// <summary>
/// /批量提单号同步东胜
/// 批量提单号同步东胜
/// </summary>
/// <param name="MBLNO"></param>
/// <returns></returns>

@ -72,7 +72,12 @@ namespace Myshipping.Application
/// <param name="bookingId"></param>
/// <returns></returns>
Task SetGoodsStatus(string code, long bookingId);
/// <summary>
/// 记录日志
/// </summary>
/// <param name="newOrder"></param>
/// <param name="oldOrder"></param>
/// <returns></returns>
Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder);

@ -403,6 +403,7 @@ namespace Myshipping.Application
if (jobj.GetStringValue("apiResultCode") == "A1000")
{
rt = jobj.GetStringValue("accessToken");
//设置token过期时间2小时
await _cache.SetTimeoutAsync($"SFToken{UserManager.TENANT_ID}", rt, TimeSpan.FromHours(2));
}
else

@ -146,8 +146,6 @@ namespace Myshipping.Application
[SqlSugarUnitOfWork]
public async Task ExecuteYard(string rtn)
{
JObject jobjRtn = JObject.Parse(rtn);
var code = jobjRtn.GetValue("code").ToString();
var msg = jobjRtn.GetValue("msg").ToString();
@ -217,7 +215,6 @@ namespace Myshipping.Application
}
await _bookingorderservice.AutoYardData(bookingId);
}
if (xl > 0 && fcnum > 0)
{
//新增数据

@ -324,7 +324,7 @@ namespace Myshipping.Application
var ship = shiplist.Where(x => x.Code == entity.CodeName).FirstOrDefault();
if (ship == null)
{
//船代
await _codeForwarder.InsertAsync(new CodeForwarder
{
GID = Guid.NewGuid().ToString(),
@ -368,7 +368,7 @@ namespace Myshipping.Application
}
if (entity.PropString.Contains("shipagency"))
{
//船代
var ship = shiplist.Where(x => x.Code == entity.CodeName).FirstOrDefault();
if (ship == null)
{
@ -1666,10 +1666,12 @@ 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 });
var order = orderlist.Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno).ToList();
bool issend = false;
//批量变更业务数据
if (order != null)
{
foreach (var it in order)
@ -1710,6 +1712,7 @@ namespace Myshipping.Application
var ids = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
if (ids.Count() > 0)
{
//同步东胜
await _bookingorderservice.SendBookingOrder(ids);
}
}
@ -1796,7 +1799,7 @@ namespace Myshipping.Application
{
var ids = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
if (ids.Count() > 0)
{
{ //同步东胜
await _bookingorderservice.SendBookingOrder(ids);
}
@ -2266,6 +2269,7 @@ namespace Myshipping.Application
#region ATD MDGETA MDGATA
if (item.Status == "ATD")
{
//变更ATD
var o = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == all[0].BookingId && x.IsDeleted == false).First();
var oldorder = o;
var oldatd = o == null ? null : o.ATD;
@ -2276,6 +2280,7 @@ namespace Myshipping.Application
flag = true;
await _bookingorderservice.SaveLog(o, oldorder);
}
//批量变更相同船期
if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO) && !string.IsNullOrEmpty(o.CARRIERID))
{
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.CARRIERID == o.CARRIERID && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();

Loading…
Cancel
Save