|
|
|
@ -223,11 +223,11 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpPost("/BookingOrder/PageData")]
|
|
|
|
|
public async Task<dynamic> PageData(BookingOrderInput input)
|
|
|
|
|
{
|
|
|
|
|
var traceTime = false;
|
|
|
|
|
var reqId = Guid.NewGuid().ToString(); //请求id,跟踪请求耗时
|
|
|
|
|
var ticks = DateTime.Now;
|
|
|
|
|
if (traceTime)
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"PageData Stage 0 ");
|
|
|
|
|
_logger.LogWarning($"PageData {reqId} Stage 0 ");
|
|
|
|
|
}
|
|
|
|
|
//获取菜单列表权限
|
|
|
|
|
List<long> userlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder);
|
|
|
|
@ -242,11 +242,11 @@ namespace Myshipping.Application
|
|
|
|
|
var etoday = DateTime.Now.AddDays(30);
|
|
|
|
|
//List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
|
|
|
|
|
|
|
|
|
|
if (traceTime)
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogInformation($"PageData Stage 1 {et.TotalMilliseconds}");
|
|
|
|
|
_logger.LogWarning($"PageData {reqId} Stage 1 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//按部门查询
|
|
|
|
@ -264,11 +264,11 @@ namespace Myshipping.Application
|
|
|
|
|
opUserList = tmpList.Select(x => x.ToString()).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (traceTime)
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogInformation($"PageData Stage 2 {et.TotalMilliseconds}");
|
|
|
|
|
_logger.LogWarning($"PageData {reqId} Stage 2 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
@ -458,20 +458,20 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
var entities = await query.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
//var sql = query.ToSqlString();
|
|
|
|
|
if (traceTime)
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogInformation($"PageData Stage 3 {et.TotalMilliseconds}");
|
|
|
|
|
_logger.LogWarning($"PageData {reqId} Stage 3 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = entities.Adapt<SqlSugarPagedList<PageBookingOrder>>();
|
|
|
|
|
|
|
|
|
|
if (traceTime)
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogInformation($"PageData Stage 4 {et.TotalMilliseconds}");
|
|
|
|
|
_logger.LogWarning($"PageData {reqId} Stage 4 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bookingidlist = list.Items.Select(x => x.Id).ToList();
|
|
|
|
@ -552,11 +552,11 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (traceTime)
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogInformation($"PageData Stage 5 {et.TotalMilliseconds}");
|
|
|
|
|
_logger.LogWarning($"PageData {reqId} 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();
|
|
|
|
@ -570,11 +570,11 @@ namespace Myshipping.Application
|
|
|
|
|
var bookingremarkList = _bookingremark.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains(x.PId)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (traceTime)
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogInformation($"PageData Stage 6 {et.TotalMilliseconds}");
|
|
|
|
|
_logger.LogWarning($"PageData {reqId} Stage 6 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in list.Items)
|
|
|
|
@ -795,11 +795,637 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (traceTime)
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogWarning($"PageData {reqId} Stage 7 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页查询订舱主表(新)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingOrder/PageDataNew")]
|
|
|
|
|
public async Task<dynamic> PageDataNew(BookingOrderInputNew input)
|
|
|
|
|
{
|
|
|
|
|
var reqId = Guid.NewGuid().ToString(); //请求id,跟踪请求耗时
|
|
|
|
|
var ticks = DateTime.Now;
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogWarning($"PageDataNew {reqId} Stage 0 ");
|
|
|
|
|
}
|
|
|
|
|
//获取菜单列表权限
|
|
|
|
|
List<long> userlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder);
|
|
|
|
|
List<string> userlistString = userlist?.Select(u => u.ToString())?.ToList();
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogWarning($"PageDataNew {reqId} Stage 1 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//按部门查询
|
|
|
|
|
List<string> saleUserList = null;
|
|
|
|
|
List<string> opUserList = null;
|
|
|
|
|
if (input.OrgSale.HasValue)
|
|
|
|
|
{
|
|
|
|
|
var tmpList = await _orgService.GetUserIdListInOrg(input.OrgSale.Value);
|
|
|
|
|
saleUserList = tmpList.Select(x => x.ToString()).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (input.OrgOp.HasValue)
|
|
|
|
|
{
|
|
|
|
|
var tmpList = await _orgService.GetUserIdListInOrg(input.OrgOp.Value);
|
|
|
|
|
opUserList = tmpList.Select(x => x.ToString()).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogWarning($"PageDataNew {reqId} Stage 2 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
var query = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID)
|
|
|
|
|
.WhereIF(!input.ISDel, x => x.IsDeleted == false)
|
|
|
|
|
.WhereIF(input.ISDel, x => x.IsDeleted == true)
|
|
|
|
|
.WhereIF(input.firstFlag, x => (x.ETD <= etoday && x.ETD >= ftoday || x.ETD == null) && (x.CreatedUserId == UserManager.UserId || x.OPID == UserManager.UserId.ToString() || x.DOCID == UserManager.UserId.ToString() || x.ROUTEID == UserManager.UserId.ToString() || x.LineManageID == UserManager.UserId.ToString() || x.CUSTSERVICEID == UserManager.UserId.ToString() || x.SALEID == UserManager.UserId.ToString())) //首次加载数据:ETD前后15天,且创建人、操作是当前人
|
|
|
|
|
.Where(x => x.ParentId == 0 || x.ParentId == null) //台账只查询主单!!
|
|
|
|
|
.WhereIF(input.Id != 0, x => x.Id == input.Id)
|
|
|
|
|
.WhereIF(pidlist != null && pidlist.Count > 0, x => pidlist.Contains(x.Id))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
|
|
|
|
|
.WhereIF(input.BBSDATE != null, u => u.BSDATE >= input.BBSDATE)
|
|
|
|
|
.WhereIF(input.EBSDATE != null, u => u.BSDATE <= input.EBSDATE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO) && !input.MBLNO.Contains(','), u => u.MBLNO.Contains(input.MBLNO.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TMBLNO) && !input.TMBLNO.Contains(','), u => u.TMBLNO.Contains(input.TMBLNO.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO) && !input.HBLNO.Contains(','), u => u.HBLNO.Contains(input.HBLNO.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO) && input.MBLNO.Contains(','), u => input.MBLNO.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Contains(u.MBLNO.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO) && input.HBLNO.Contains(','), u => input.HBLNO.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Contains(u.HBLNO.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BOOKINGNO), u => u.BOOKINGNO.Contains(input.BOOKINGNO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONTRACTNO), u => u.CONTRACTNO.Contains(input.CONTRACTNO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVICECONTRACTNO), u => u.SERVICECONTRACTNO.Contains(input.SERVICECONTRACTNO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPER), u => u.SHIPPER.Contains(input.SHIPPER))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEE), u => u.CONSIGNEE.Contains(input.CONSIGNEE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY), u => u.NOTIFYPARTY.Contains(input.NOTIFYPARTY))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY2), u => u.NOTIFYPARTY2.Contains(input.NOTIFYPARTY2))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDID), u => u.YARDID == input.YARDID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSELID), u => u.VESSELID.Contains(input.VESSELID))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSEL), u => u.VESSEL.ToLower().Contains(input.VESSEL.ToLower()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.Contains(input.VOYNOINNER))
|
|
|
|
|
.WhereIF(input.BETD != null, u => u.ETD >= input.BETD)
|
|
|
|
|
.WhereIF(input.EETD != null, u => u.ETD < input.EETD.Value.AddDays(1))
|
|
|
|
|
.WhereIF(input.BATD != null, u => u.ATD >= input.BATD)
|
|
|
|
|
.WhereIF(input.EATD != null, u => u.ATD < input.EATD.Value.AddDays(1))
|
|
|
|
|
.WhereIF(input.BCLOSINGDATE != null, u => u.CLOSINGDATE >= input.BCLOSINGDATE)
|
|
|
|
|
.WhereIF(input.ECLOSINGDATE != null, u => u.CLOSINGDATE <= input.ECLOSINGDATE)
|
|
|
|
|
.WhereIF(input.BCLOSEDOCDATE != null, u => u.CLOSEDOCDATE >= input.BCLOSEDOCDATE)
|
|
|
|
|
.WhereIF(input.ECLOSEDOCDATE != null, u => u.CLOSEDOCDATE <= input.ECLOSEDOCDATE)
|
|
|
|
|
.WhereIF(input.BCLOSEVGMDATE != null, u => u.CLOSEVGMDATE >= input.BCLOSEVGMDATE)
|
|
|
|
|
.WhereIF(input.ECLOSEVGMDATE != null, u => u.CLOSEVGMDATE <= input.ECLOSEVGMDATE)
|
|
|
|
|
.WhereIF(input.BETA != null, u => u.ETA >= input.BETA)
|
|
|
|
|
.WhereIF(input.EETA != null, u => u.ETA < input.EETA.Value.AddDays(1))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGEID), u => u.PORTDISCHARGEID == input.PORTDISCHARGEID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERY), u => u.PLACEDELIVERY.Contains(input.PLACEDELIVERY))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERYID), u => u.PLACEDELIVERYID == input.PLACEDELIVERYID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DESTINATION), u => u.DESTINATION.Contains(input.DESTINATION))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DESTINATIONID), u => u.DESTINATIONID == input.DESTINATIONID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOBILL), u => u.NOBILL == input.NOBILL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.COPYNOBILLL), u => u.COPYNOBILL == input.COPYNOBILLL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUETYPE), u => u.ISSUETYPE == input.ISSUETYPE)
|
|
|
|
|
.WhereIF(input.BISSUEDATE != null, u => u.ISSUEDATE >= input.BISSUEDATE)
|
|
|
|
|
.WhereIF(input.EISSUEDATE != null, u => u.ISSUEDATE < input.EISSUEDATE.Value.AddDays(1))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACE), u => u.ISSUEPLACE.Contains(input.ISSUEPLACE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACEID), u => u.ISSUEPLACEID == input.ISSUEPLACEID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BLFRT), u => u.BLFRT == input.BLFRT)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PREPARDATID), u => u.PREPARDATID == input.PREPARDATID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PREPARDAT), u => u.PREPARDAT == input.PREPARDAT)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEAT), u => u.PAYABLEAT.Contains(input.PAYABLEAT))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEATID), u => u.PAYABLEATID == input.PAYABLEATID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVICE), u => u.SERVICE.Contains(input.SERVICE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.MARKS), u => u.MARKS.Contains(input.MARKS))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE.Contains(input.HSCODE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DESCRIPTION), u => u.DESCRIPTION.Contains(input.DESCRIPTION))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CNTRTOTAL), u => u.CNTRTOTAL.StartsWith(input.CNTRTOTAL))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CARRIERID), u => u.CARRIERID == input.CARRIERID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CARRIER), u => u.CARRIER.Contains(input.CARRIER))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CARGOID), u => u.CARGOID == input.CARGOID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DCLASS), u => u.DCLASS == input.DCLASS)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DUNNO), u => u.DUNNO == input.DUNNO)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DPAGE), u => u.DPAGE == input.DPAGE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DLABEL), u => u.DLABEL == input.DLABEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.LINKMAN), u => u.LINKMAN == input.LINKMAN)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TEMPID), u => u.TEMPID == input.TEMPID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TEMPSET), u => u.TEMPSET == input.TEMPSET)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.REEFERF), u => u.REEFERF == input.REEFERF)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.HUMIDITY), u => u.HUMIDITY == input.HUMIDITY)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TEMPMIN), u => u.TEMPMIN == input.TEMPMIN)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TEMPMAX), u => u.TEMPMAX == input.TEMPMAX)
|
|
|
|
|
.WhereIF(input.ISCONTAINERSOC != null, u => u.ISCONTAINERSOC == input.ISCONTAINERSOC)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SOREMARK), u => u.SOREMARK.Contains(input.SOREMARK))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SIREMARK), u => u.SIREMARK.Contains(input.SIREMARK))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDREMARK), u => u.YARDREMARK.Contains(input.YARDREMARK))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.COMPID), u => u.COMPID == input.COMPID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.COMPNAME), u => u.COMPNAME.Contains(input.COMPNAME))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERNAME), u => u.SHIPPERNAME.Contains(input.SHIPPERNAME))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCITY), u => u.SHIPPERCITY.Contains(input.SHIPPERCITY))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPROVINCE), u => u.SHIPPERPROVINCE == input.SHIPPERPROVINCE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPOSTCODE), u => u.SHIPPERPOSTCODE == input.SHIPPERPOSTCODE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCOUNTRY), u => u.SHIPPERCOUNTRY == input.SHIPPERCOUNTRY)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERATTN), u => u.SHIPPERATTN.Contains(input.SHIPPERATTN))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERTEL), u => u.SHIPPERTEL == input.SHIPPERTEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEENAME), u => u.CONSIGNEENAME.Contains(input.CONSIGNEENAME))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEECITY), u => u.CONSIGNEECITY.Contains(input.CONSIGNEECITY))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEPROVINCE), u => u.CONSIGNEEPROVINCE == input.CONSIGNEEPROVINCE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEPOSTCODE), u => u.CONSIGNEEPOSTCODE == input.CONSIGNEEPOSTCODE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEERCOUNTRY), u => u.CONSIGNEERCOUNTRY == input.CONSIGNEERCOUNTRY)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEATTN), u => u.CONSIGNEEATTN.Contains(input.CONSIGNEEATTN))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEETEL), u => u.CONSIGNEETEL == input.CONSIGNEETEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYNAME), u => u.NOTIFYPARTYNAME.Contains(input.NOTIFYPARTYNAME))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCITY), u => u.NOTIFYPARTYCITY.Contains(input.NOTIFYPARTYCITY))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYPROVINCE), u => u.NOTIFYPARTYPROVINCE == input.NOTIFYPARTYPROVINCE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYPOSTCODE), u => u.NOTIFYPARTYPOSTCODE == input.NOTIFYPARTYPOSTCODE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCOUNTRY), u => u.NOTIFYPARTYCOUNTRY == input.NOTIFYPARTYCOUNTRY)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYATTN), u => u.NOTIFYPARTYATTN.Contains(input.NOTIFYPARTYATTN))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYTEL), u => u.NOTIFYPARTYTEL == input.NOTIFYPARTYTEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PONO), u => u.PONO.Contains(input.PONO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.OPID), u => u.OPID == input.OPID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DOCID), u => u.DOCID == input.DOCID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.OP), u => u.OP == input.OP)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DOC), u => u.DOC == input.DOC)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SALEID), u => u.SALEID == input.SALEID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SALE), u => u.SALE.Contains(input.SALE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICEID), u => u.CUSTSERVICEID == input.CUSTSERVICEID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE.Contains(input.CUSTSERVICE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME.Contains(input.CUSTOMERNAME))
|
|
|
|
|
.WhereIF(input.CUSTOMERID != null && input.CUSTOMERID != 0, u => u.CUSTOMERID == input.CUSTOMERID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER.Contains(input.FORWARDER))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.AGENTID), u => u.AGENTID == input.AGENTID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDERID), u => u.FORWARDERID == input.FORWARDERID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCY), u => u.SHIPAGENCY.Contains(input.SHIPAGENCY))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCYID), u => u.SHIPAGENCYID == input.SHIPAGENCYID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSER), u => u.CUSTOMSER.Contains(input.CUSTOMSER))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSERID), u => u.CUSTOMSERID == input.CUSTOMSERID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKER), u => u.TRUCKER.Contains(input.TRUCKER))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKERID), u => u.TRUCKERID == input.TRUCKERID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.AGENTNAME), u => u.AGENTNAME.Contains(input.AGENTNAME))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.WEITUO), u => u.WEITUO.Contains(input.WEITUO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SCACCODE), u => u.SCACCODE == input.SCACCODE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ITNCODE), u => u.ITNCODE == input.ITNCODE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTNO), u => u.CUSTNO.Contains(input.CUSTNO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TRANSPORTID), u => u.TRANSPORTID == input.TRANSPORTID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TRANSPORT), u => u.TRANSPORT.Contains(input.TRANSPORT))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTTEL), u => u.YARDCONTRACTTEL == input.YARDCONTRACTTEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTEMAIL), u => u.YARDCONTRACTEMAIL == input.YARDCONTRACTEMAIL)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.LANECODE), u => u.LANECODE == input.LANECODE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ROUTEID), u => u.ROUTEID == input.ROUTEID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ROUTE), u => u.ROUTE.Contains(input.ROUTE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.LineManageID), u => u.LineManageID == input.LineManageID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.LineManage), u => u.LineManage.Contains(input.LineManage))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ShippingMethod), u => u.ShippingMethod.Contains(input.ShippingMethod))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DZRemark), u => u.DZRemark.Contains(input.DZRemark))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CZRemark), u => u.CZRemark.Contains(input.CZRemark))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ZhanCangFlag), u => u.ZhanCangFlag == input.ZhanCangFlag)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUSNAME), u => u.BSSTATUSNAME == input.BSSTATUSNAME)
|
|
|
|
|
.WhereIF(input.BDELETETIME != null, u => u.DeleteTime >= input.BDELETETIME)
|
|
|
|
|
.WhereIF(input.EDELETETIME != null, u => u.DeleteTime < input.EDELETETIME.Value.AddDays(1))
|
|
|
|
|
.WhereIF(saleUserList != null && saleUserList.Count > 0, o => saleUserList.Contains(o.SALEID))
|
|
|
|
|
.WhereIF(opUserList != null && opUserList.Count > 0, o => opUserList.Contains(o.OPID))
|
|
|
|
|
.WhereIF(userlist != null && userlist.Count() > 0, u => userlist.Contains((long)u.CreatedUserId) ||
|
|
|
|
|
UserManager.UserId.ToString() == u.ROUTEID || UserManager.Name.ToString() == u.ROUTE ||
|
|
|
|
|
UserManager.UserId.ToString() == u.LineManageID || UserManager.Name.ToString() == u.LineManage ||
|
|
|
|
|
UserManager.UserId.ToString() == u.SALEID || UserManager.Name.ToString() == u.SALE ||
|
|
|
|
|
userlistString.Contains(u.OPID) || UserManager.Name.ToString() == u.OP ||
|
|
|
|
|
userlistString.Contains(u.DOCID) || UserManager.Name.ToString() == u.DOC ||
|
|
|
|
|
UserManager.UserId.ToString() == u.CUSTSERVICEID || UserManager.Name.ToString() == u.CUSTSERVICE);
|
|
|
|
|
|
|
|
|
|
var selector = new List<SelectModel>()
|
|
|
|
|
{
|
|
|
|
|
new SelectModel() { FiledName = "Id" },
|
|
|
|
|
new SelectModel() { FiledName = "TenantId" }
|
|
|
|
|
};
|
|
|
|
|
var ordProps = typeof(BookingOrder).GetProperties();
|
|
|
|
|
foreach (var sc in input.ShowColumns)
|
|
|
|
|
{
|
|
|
|
|
var prop = ordProps.FirstOrDefault(x => x.Name.ToLower() == sc.ToLower());
|
|
|
|
|
if (prop != null)
|
|
|
|
|
{
|
|
|
|
|
selector.Add(new SelectModel() { FiledName = prop.Name });
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_logger.LogWarning($"找不到对象上的列:{sc}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query = query.Select(selector);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(input.SortField) || input.MultiSort == null || input.MultiSort.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
query = query.OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.DescSort));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
query = query.OrderBy(PageInputOrder.MultiOrderBuilder(input.MultiSort));
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entities = await query.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
//var sql = query.ToSqlString();
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogWarning($"PageDataNew {reqId} Stage 3 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = entities.Adapt<SqlSugarPagedList<PageBookingOrder>>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogWarning($"PageDataNew {reqId} Stage 4 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bookingidlist = list.Items.Select(x => x.Id).ToList();
|
|
|
|
|
|
|
|
|
|
var itgoodsStatus = new List<ITGoodsStatusDto>();
|
|
|
|
|
var itconfigs = new List<ITConfigsDto>();
|
|
|
|
|
|
|
|
|
|
var pageColsCfg = _djyUserConfigService.Multi(new string[] { "booking_list_column" })
|
|
|
|
|
.GetAwaiter().GetResult().FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
bool isUseGoodsStatus = true;
|
|
|
|
|
|
|
|
|
|
//这里因为个人配置的不是标准的格式化数据,所以这里只做了正则匹配
|
|
|
|
|
if (pageColsCfg != null && !string.IsNullOrWhiteSpace(pageColsCfg.ConfigJson))
|
|
|
|
|
{
|
|
|
|
|
isUseGoodsStatus = Regex.IsMatch(pageColsCfg.ConfigJson, "\\\"field\\\"\\s?\\:\\s?\\\"goodsStatusList\\\"");
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("取到个人配置里是否展示 goodsStatusList(货物状态)={rlt}", (isUseGoodsStatus ? "展示" : "隐藏"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ServiceProjectStatusDto> statusList = new List<ServiceProjectStatusDto>();
|
|
|
|
|
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
|
|
|
|
|
{
|
|
|
|
|
if (isUseGoodsStatus)
|
|
|
|
|
{
|
|
|
|
|
QueryServiceProjectWithStatusBatch batchQuery = new QueryServiceProjectWithStatusBatch
|
|
|
|
|
{
|
|
|
|
|
BookingIds = bookingidlist.ToArray(),
|
|
|
|
|
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_ALL,
|
|
|
|
|
TenantId = list.Items.FirstOrDefault().TenantId.Value
|
|
|
|
|
};
|
|
|
|
|
var queryRlt = _serviceWorkFlowManageService.GetEnableStatusListByBusinessBatch(batchQuery)
|
|
|
|
|
.GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
if (queryRlt.succ)
|
|
|
|
|
{
|
|
|
|
|
statusList = JSON.Deserialize<List<ServiceProjectStatusDto>>(JSON.Serialize(queryRlt.ext));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//货物状态
|
|
|
|
|
itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
|
|
|
|
|
(goods, config) => config.Id == goods.ConfigId && bookingidlist.Contains((long)goods.bookingId)).
|
|
|
|
|
OrderBy((goods, config) => config.Sort).
|
|
|
|
|
Select((goods, config) => new ITGoodsStatusDto
|
|
|
|
|
{
|
|
|
|
|
bookingid = goods.bookingId,
|
|
|
|
|
ConfigId = goods.ConfigId,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = goods.FinishTime,
|
|
|
|
|
ExtData = goods.ExtData,
|
|
|
|
|
Remark = goods.Remark,
|
|
|
|
|
CreatedUserId = config.CreatedUserId,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var configID = itgoodsStatus.Select(x => x.ConfigId)
|
|
|
|
|
.Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
itconfigs = _goodsStatusConfig.AsQueryable()
|
|
|
|
|
.Where(x => configID.Contains(x.Id)).Select(config => new ITConfigsDto
|
|
|
|
|
{
|
|
|
|
|
bookingid = "",
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = "",
|
|
|
|
|
ExtData = "",
|
|
|
|
|
Remark = "",
|
|
|
|
|
CreatedUserId = config.CreatedUserId,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogWarning($"PageDataNew {reqId} Stage 5 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<BookingStatusLog> statusloglist = null;
|
|
|
|
|
List<BookingStatusLogDetail> statuslogdetaillist = null;
|
|
|
|
|
if (input.ShowColumns.Contains("statuslogs"))
|
|
|
|
|
{
|
|
|
|
|
//提箱返场
|
|
|
|
|
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();
|
|
|
|
|
//运踪状态详情
|
|
|
|
|
statuslogdetaillist = _statuslogdetail.AsQueryable().Where(x => statuslogId.Contains(x.PId)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//运踪状态
|
|
|
|
|
List<BookingStatus> BookingStatusList = null;
|
|
|
|
|
if (input.ShowColumns.Contains("bookstatus"))
|
|
|
|
|
{
|
|
|
|
|
BookingStatusList = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains((long)x.BookingId)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//备注
|
|
|
|
|
List<BookingRemark> bookingremarkList = null;
|
|
|
|
|
if (input.ShowColumns.Contains("bookremark"))
|
|
|
|
|
{
|
|
|
|
|
bookingremarkList = _bookingremark.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains(x.PId)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogWarning($"PageDataNew {reqId} Stage 6 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (input.ShowColumns.Contains("isVGM")
|
|
|
|
|
|| input.ShowColumns.Contains("isCanDan")
|
|
|
|
|
|| input.ShowColumns.Contains("isZZFX")
|
|
|
|
|
|| input.ShowColumns.Contains("goodsStatusList")
|
|
|
|
|
|| input.ShowColumns.Contains("statuslogs")
|
|
|
|
|
|| input.ShowColumns.Contains("txxp"))
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in list.Items)
|
|
|
|
|
{
|
|
|
|
|
#region 查询条件
|
|
|
|
|
//运踪
|
|
|
|
|
if (input.ShowColumns.Contains("bookstatus"))
|
|
|
|
|
{
|
|
|
|
|
var sta = BookingStatusList.Where(x => x.BookingId == item.Id).ToList();
|
|
|
|
|
if (sta != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
item.bookstatus = sta;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//备注
|
|
|
|
|
if (input.ShowColumns.Contains("bookremark"))
|
|
|
|
|
{
|
|
|
|
|
var st = bookingremarkList.Where(x => x.PId == item.Id).ToList();
|
|
|
|
|
if (st != null)
|
|
|
|
|
{
|
|
|
|
|
item.bookremark = st;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//变更日期类型
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.ETD))
|
|
|
|
|
{
|
|
|
|
|
item.ETD = Convert.ToDateTime(item.ETD).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.ETA))
|
|
|
|
|
{
|
|
|
|
|
item.ETA = Convert.ToDateTime(item.ETA).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.YgtETD))
|
|
|
|
|
{
|
|
|
|
|
item.YgtETD = Convert.ToDateTime(item.YgtETD).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.ATD))
|
|
|
|
|
{
|
|
|
|
|
item.ATD = Convert.ToDateTime(item.ATD).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.StartETA))
|
|
|
|
|
{
|
|
|
|
|
item.StartETA = Convert.ToDateTime(item.StartETA).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.StartATA))
|
|
|
|
|
{
|
|
|
|
|
item.StartATA = Convert.ToDateTime(item.StartATA).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.MiddleETA))
|
|
|
|
|
{
|
|
|
|
|
item.MiddleETA = Convert.ToDateTime(item.MiddleETA).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.MiddleETD))
|
|
|
|
|
{
|
|
|
|
|
item.MiddleETD = Convert.ToDateTime(item.MiddleETD).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.MiddleATA))
|
|
|
|
|
{
|
|
|
|
|
item.MiddleATA = Convert.ToDateTime(item.MiddleATA).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.MiddleATD))
|
|
|
|
|
{
|
|
|
|
|
item.MiddleATD = Convert.ToDateTime(item.MiddleATD).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.ATA))
|
|
|
|
|
{
|
|
|
|
|
item.ATA = Convert.ToDateTime(item.ATA).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
|
|
|
|
|
{
|
|
|
|
|
if (isUseGoodsStatus)
|
|
|
|
|
{
|
|
|
|
|
var currStatusList = statusList.Where(a => long.Parse(a.BusiId) == item.Id).ToList();
|
|
|
|
|
|
|
|
|
|
if (currStatusList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (currStatusList.Any(a => a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield))
|
|
|
|
|
{
|
|
|
|
|
var currStus = currStatusList.FirstOrDefault(a =>
|
|
|
|
|
a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield);
|
|
|
|
|
|
|
|
|
|
if (currStus != null)
|
|
|
|
|
item.IsVGM = currStus?.ActDate.Value;
|
|
|
|
|
}
|
|
|
|
|
if (currStatusList.Any(a => a.StatusSKUCode.Equals("YFCD", StringComparison.OrdinalIgnoreCase) && a.IsYield))
|
|
|
|
|
{
|
|
|
|
|
var currStus = currStatusList.FirstOrDefault(a =>
|
|
|
|
|
a.StatusSKUCode.Equals("YFCD", StringComparison.OrdinalIgnoreCase) && a.IsYield);
|
|
|
|
|
|
|
|
|
|
if (currStus != null)
|
|
|
|
|
item.IsCanDan = currStus?.ActDate.Value;
|
|
|
|
|
}
|
|
|
|
|
if (currStatusList.Any(a => a.StatusSKUCode.Equals("ZZFX", StringComparison.OrdinalIgnoreCase) && a.IsYield))
|
|
|
|
|
{
|
|
|
|
|
var currStus = currStatusList.FirstOrDefault(a =>
|
|
|
|
|
a.StatusSKUCode.Equals("ZZFX", StringComparison.OrdinalIgnoreCase) && a.IsYield);
|
|
|
|
|
|
|
|
|
|
if (currStus != null)
|
|
|
|
|
item.IsZZFX = currStus?.ActDate.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//货物状态列
|
|
|
|
|
if (input.ShowColumns.Contains("goodsStatusList"))
|
|
|
|
|
{
|
|
|
|
|
item.GoodsStatusList = currStatusList.OrderBy(a => a.CalcSortNo)
|
|
|
|
|
.Select(a => new GoodsStatusList
|
|
|
|
|
{
|
|
|
|
|
FinishTime = a.ActDate,
|
|
|
|
|
IsLast = a.IsEnd,
|
|
|
|
|
Sort = a.ActSortNo,
|
|
|
|
|
StatusName = a.ShowName,
|
|
|
|
|
SystemCode = a.StatusSKUCode,
|
|
|
|
|
ExtData = !string.IsNullOrWhiteSpace(a.ActVal) ? a.ActVal : string.Empty,
|
|
|
|
|
Remark = !string.IsNullOrWhiteSpace(a.ActRemark) ? a.ActRemark : string.Empty
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var itgoods = itgoodsStatus.Where(x => x.CreatedUserId == item.CreatedUserId && x.bookingid == item.Id).OrderBy(x => x.Sort).
|
|
|
|
|
Select(x => new GoodsStatusList
|
|
|
|
|
{
|
|
|
|
|
ConfigId = x.ConfigId,
|
|
|
|
|
StatusName = x.StatusName,
|
|
|
|
|
SystemCode = x.SystemCode,
|
|
|
|
|
FinishTime = x.FinishTime,
|
|
|
|
|
ExtData = x.ExtData,
|
|
|
|
|
Remark = x.Remark,
|
|
|
|
|
Sort = x.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort).
|
|
|
|
|
Select(x => new GoodsStatusList
|
|
|
|
|
{
|
|
|
|
|
ConfigId = x.ConfigId,
|
|
|
|
|
StatusName = x.StatusName,
|
|
|
|
|
SystemCode = x.SystemCode,
|
|
|
|
|
FinishTime = null,
|
|
|
|
|
ExtData = x.ExtData,
|
|
|
|
|
Remark = x.Remark,
|
|
|
|
|
Sort = x.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var ii in itgoods)
|
|
|
|
|
{
|
|
|
|
|
itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId);
|
|
|
|
|
}
|
|
|
|
|
item.IsVGM = itgoods.Where(x => x.SystemCode == "YFVGM").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFVGM").Select(x => x.FinishTime).FirstOrDefault();
|
|
|
|
|
item.IsCanDan = itgoods.Where(x => x.SystemCode == "YFCD").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFCD").Select(x => x.FinishTime).FirstOrDefault();
|
|
|
|
|
item.IsZZFX = itgoods.Where(x => x.SystemCode == "ZZFX").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "ZZFX").Select(x => x.FinishTime).FirstOrDefault();
|
|
|
|
|
item.GoodsStatusList = itgoods.Union<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取提箱返场状态
|
|
|
|
|
if (input.ShowColumns.Contains("statuslogs"))
|
|
|
|
|
{
|
|
|
|
|
var statusids = statusloglist.Where(x => x.BookingId == item.Id).Select(x => x.Id).ToList();
|
|
|
|
|
var dto = statuslogdetaillist.Where(x => statusids.Contains(x.PId)).ToList();
|
|
|
|
|
List<CNTRNODto> CNTRNODtolist = new List<CNTRNODto>();
|
|
|
|
|
foreach (var d in dto)
|
|
|
|
|
{
|
|
|
|
|
var ctn = CNTRNODtolist.Where(x => x.CNTRNO == d.CNTRNO).FirstOrDefault();
|
|
|
|
|
if (ctn == null)
|
|
|
|
|
{
|
|
|
|
|
if (d.Status == "提箱")
|
|
|
|
|
{
|
|
|
|
|
CNTRNODtolist.Add(new CNTRNODto
|
|
|
|
|
{
|
|
|
|
|
BookingId = item.Id,
|
|
|
|
|
CNTRNO = d.CNTRNO,
|
|
|
|
|
TXOPTime = d.OPTime,
|
|
|
|
|
FCOPTime = null
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (d.Status == "返场")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
CNTRNODtolist.Add(new CNTRNODto
|
|
|
|
|
{
|
|
|
|
|
BookingId = item.Id,
|
|
|
|
|
CNTRNO = d.CNTRNO,
|
|
|
|
|
FCOPTime = d.OPTime,
|
|
|
|
|
TXOPTime = null
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (d.Status == "提箱")
|
|
|
|
|
{
|
|
|
|
|
ctn.TXOPTime = d.OPTime;
|
|
|
|
|
}
|
|
|
|
|
if (d.Status == "返场")
|
|
|
|
|
{
|
|
|
|
|
ctn.FCOPTime = d.OPTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
item.statuslogs1 = CNTRNODtolist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//扩展表(小票相关)
|
|
|
|
|
if (input.ShowColumns.Contains("txxp"))
|
|
|
|
|
{
|
|
|
|
|
var extendstate = await _repextendstate.FirstOrDefaultAsync(x => x.bookingId == item.Id);
|
|
|
|
|
if (extendstate != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
item.ExtendState = extendstate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
|
{
|
|
|
|
|
var et = DateTime.Now - ticks;
|
|
|
|
|
ticks = DateTime.Now;
|
|
|
|
|
_logger.LogInformation($"PageData Stage 7 {et.TotalMilliseconds}");
|
|
|
|
|
_logger.LogWarning($"PageDataNew {reqId} Stage 7 {et.TotalMilliseconds}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|