修改预甩的任务

master
jianghaiqing 7 months ago
parent 91f8ed1410
commit 9e810935be

@ -1565,7 +1565,7 @@ namespace Myshipping.Application
{
BookingSlotWithOrderDto dto = null;
var slotInfo = await _repBase.AsQueryable().Filter(null,true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId);
var slotInfo = await _repBase.AsQueryable().Filter(null,true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId && a.IsDeleted == false);
if (slotInfo == null)
{
@ -1574,7 +1574,7 @@ namespace Myshipping.Application
return dto;
}
var list = _repAllocation.AsQueryable().Filter(null, true).Where(a => a.BOOKING_SLOT_ID == slotInfo.Id && a.TenantId == tenantId).ToList();
var list = _repAllocation.AsQueryable().Filter(null, true).Where(a => a.BOOKING_SLOT_ID == slotInfo.Id && a.TenantId == tenantId && a.IsDeleted == false).ToList();
dto = new BookingSlotWithOrderDto
{

@ -58,6 +58,11 @@ namespace Myshipping.Application
/// </summary>
public List<TaskRollingNominationShipDto> To { get; set; }
/// <summary>
/// 预甩的FROM TO对应列表
/// </summary>
public List<TaskRollingNominationShipFromToDto> FromToList { get; set; }
/// <summary>
/// 单票汇总列表
/// </summary>
@ -328,4 +333,20 @@ namespace Myshipping.Application
/// </summary>
public string PKId { get; set; }
}
/// <summary>
/// 预甩的FROM TO对应列表
/// </summary>
public class TaskRollingNominationShipFromToDto
{
/// <summary>
/// 原船记录
/// </summary>
public TaskRollingNominationShipDto FromShip { get; set; }
/// <summary>
/// 换船记录列表
/// </summary>
public List<TaskRollingNominationShipDto> ToShipList { get; set; }
}
}

@ -17,6 +17,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Myshipping.Application
@ -168,11 +169,7 @@ namespace Myshipping.Application
};
var shipList = _taskRollingNominationShipInfoRepository.AsQueryable()
.Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 1 && !a.IsDeleted).ToList();
if(shipList.Count == 0)
shipList = _taskRollingNominationShipInfoRepository.AsQueryable()
.Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 0 && !a.IsDeleted).ToList();
.Where(a => a.NOM_ID == rollModel.PK_ID && a.IsDeleted == false).ToList();
var fromEntity = shipList.Where(a =>
a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase)).ToList();
@ -180,32 +177,40 @@ namespace Myshipping.Application
if (fromEntity.Count > 0)
model.From = fromEntity.Select(p=>p.Adapt<TaskRollingNominationShipDto>()).ToList();
var toEntity = shipList.Where(a =>
a.SHIP_TYPE.Equals("To", StringComparison.OrdinalIgnoreCase)).ToList();
var toEntity = shipList.Where(a => Regex.IsMatch(a.SHIP_TYPE,"To(\\s+[0-9]+)?"
, RegexOptions.IgnoreCase)).ToList();
if (toEntity.Count > 0)
model.To = toEntity.Select(p => p.Adapt<TaskRollingNominationShipDto>()).ToList();
//这里为了前端原船和换船做了根据PORT对应
model.FromToList = model.From.GroupJoin(model.To, l => l.Port?.Trim(), r => r.Port?.Trim(), (l, r) =>
{
TaskRollingNominationShipFromToDto dto = new TaskRollingNominationShipFromToDto();
var withDispatchList = _taskRollingNominationDetailInfoRepository.AsQueryable().Filter(null, true)
.LeftJoin<TaskRollingNominationDispatchInfo>((detail, dispatch) => detail.PK_ID == dispatch.DETAIL_ID)
.Where((detail, dispatch) => detail.NOM_ID == rollModel.PK_ID && detail.IsDeleted == false
&& (string.IsNullOrWhiteSpace(dispatch.PK_ID) || (!string.IsNullOrWhiteSpace(dispatch.PK_ID) && dispatch.IsDeleted == false)))
.Select((detail, dispatch) => new { Detail = detail, Dispatch = dispatch }).ToList();
dto.FromShip = l;
if (withDispatchList.Any(p => p.Detail != null))
var currArg = r.ToList();
if (currArg.Count > 0)
{
dto.ToShipList = currArg.Select((p, idx) =>
{
var detailList =
withDispatchList.Where(p => p.Detail != null)
.Select(p => p.Detail).ToList();
if (Regex.IsMatch(p.ShipType, "[0-9]+"))
return new { SortNo = int.Parse(Regex.Match(p.ShipType, "[0-9]+").Value), Obj = p };
var portList = detailList.Where(p => !string.IsNullOrWhiteSpace(p.PLACEOF_RECEIPT))
.Select(p => p.PLACEOF_RECEIPT?.Trim()).Distinct().ToList();
return new { SortNo = idx + 1, Obj = p };
}).OrderBy(p => p.SortNo).Select(p => p.Obj).ToList();
}
model.From = model.From.Where(p=> portList.Any(p2=>p2.Equals(p.Port?.Trim()))).ToList();
return dto;
}).ToList();
model.To = model.To.Where(p => portList.Any(p2 => p2.Equals(p.Port?.Trim()))).ToList();
}
var withDispatchList = _taskRollingNominationDetailInfoRepository.AsQueryable().Filter(null, true)
.LeftJoin<TaskRollingNominationDispatchInfo>((detail, dispatch) => detail.PK_ID == dispatch.DETAIL_ID)
.Where((detail, dispatch) => detail.NOM_ID == rollModel.PK_ID && detail.IsDeleted == false
&& (string.IsNullOrWhiteSpace(dispatch.PK_ID) || (!string.IsNullOrWhiteSpace(dispatch.PK_ID) && dispatch.IsDeleted == false)))
.Select((detail, dispatch) => new { Detail = detail, Dispatch = dispatch }).ToList();
List<Tuple<string,int>> tuples = new List<Tuple<string,int>>();

Loading…
Cancel
Save