|
|
|
@ -505,11 +505,7 @@ namespace Myshipping.Application.Service.TaskManagePlat
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var shipList = _taskRollingNominationShipInfoRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 1 && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
if (shipList.Count == 0)
|
|
|
|
|
shipList = _taskRollingNominationShipInfoRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 0 && a.IsDeleted == false).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();
|
|
|
|
@ -517,28 +513,93 @@ namespace Myshipping.Application.Service.TaskManagePlat
|
|
|
|
|
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对应
|
|
|
|
|
var fromToList = model.From.GroupJoin(model.To, l => l.Port?.Trim(), r => r.Port?.Trim(), (l, r) =>
|
|
|
|
|
{
|
|
|
|
|
TaskRollingNominationShipFromToDto dto = new TaskRollingNominationShipFromToDto();
|
|
|
|
|
|
|
|
|
|
dto.FromShip = l;
|
|
|
|
|
|
|
|
|
|
var currArg = r.ToList();
|
|
|
|
|
|
|
|
|
|
if (currArg.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
dto.ToShipList = currArg.Select((p, idx) =>
|
|
|
|
|
{
|
|
|
|
|
if (Regex.IsMatch(p.ShipType, "[0-9]+"))
|
|
|
|
|
return new { SortNo = int.Parse(Regex.Match(p.ShipType, "[0-9]+").Value), Obj = p };
|
|
|
|
|
|
|
|
|
|
return new { SortNo = idx + 1, Obj = p };
|
|
|
|
|
}).OrderBy(p => p.SortNo).Select(p => p.Obj).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dto;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
List<Tuple<string, int>> tuples = new List<Tuple<string, int>>();
|
|
|
|
|
|
|
|
|
|
model.LoadDetailList = list.Select(a => a.Detail.Adapt<TaskRollingNominationShipDetailShowDto>()).ToList();
|
|
|
|
|
|
|
|
|
|
model.FromToList = new List<TaskRollingNominationShipFromToDto>();
|
|
|
|
|
|
|
|
|
|
if (model.LoadDetailList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
model.TotalLoadCtnStat = string.Join(",", model.LoadDetailList.GroupBy(x => x.CtnAll)
|
|
|
|
|
.Select(x =>
|
|
|
|
|
$"{x.Key}*{x.Sum(t => t.CtnNum)}").ToArray());
|
|
|
|
|
|
|
|
|
|
var portList = model.LoadDetailList.Where(p => !string.IsNullOrWhiteSpace(p.PlaceOfReceipt))
|
|
|
|
|
.Select(p => p.PlaceOfReceipt?.Trim()).Distinct().ToList();
|
|
|
|
|
string rollRegex = "Roll\\s+to\\s+\\w+\\s+\\w{3,}\\/\\w+,\\s?if\\s+cannot\\s+catch\\s?,\\s+roll\\s+to\\s+\\w{3,}\\s+next\\s+sailing";
|
|
|
|
|
|
|
|
|
|
model.LoadDetailList.ForEach(p =>
|
|
|
|
|
{
|
|
|
|
|
string vslCode = string.Empty;
|
|
|
|
|
string voyNo = string.Empty;
|
|
|
|
|
string strCode = string.Empty;
|
|
|
|
|
string strCode2 = string.Empty;
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(p.Status, rollRegex,RegexOptions.IgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
string currS = Regex.Match(p.Status, "(?<=Roll\\sto\\s\\w+\\s)\\w{3,}\\/\\w+(?=,)").Value;
|
|
|
|
|
vslCode = Regex.Split(currS,"\\/")[0]?.Trim();
|
|
|
|
|
voyNo = Regex.Split(currS, "\\/")[1]?.Trim();
|
|
|
|
|
|
|
|
|
|
strCode = Regex.Match(p.Status, "(?<=if\\scannot\\scatch\\s?,\\sroll\\sto\\s)\\w{3,}(?=\\s+next\\s+sailing)").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < fromToList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (fromToList[i].FromShip.Port.Equals(p.PlaceOfReceipt, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
var fromInfo = fromToList[i].FromShip.Adapt<TaskRollingNominationShipDto>();
|
|
|
|
|
|
|
|
|
|
model.From = model.From.Where(p => portList.Any(p2 => p2.Equals(p.Port?.Trim()))).ToList();
|
|
|
|
|
List<TaskRollingNominationShipDto> toShipList = new List<TaskRollingNominationShipDto>();
|
|
|
|
|
|
|
|
|
|
model.To = model.To.Where(p => portList.Any(p2 => p2.Equals(p.Port?.Trim()))).ToList();
|
|
|
|
|
for (int j = 0; j < fromToList[i].ToShipList.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
if (fromToList[i].ToShipList[j].VslCode.Equals(vslCode, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
toShipList.Add(fromToList[i].ToShipList[j].Adapt<TaskRollingNominationShipDto>());
|
|
|
|
|
}
|
|
|
|
|
else if (fromToList[i].ToShipList[j].ShipString.Equals(strCode, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
toShipList.Add(fromToList[i].ToShipList[j].Adapt<TaskRollingNominationShipDto>());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.FromToList.Add(new TaskRollingNominationShipFromToDto
|
|
|
|
|
{
|
|
|
|
|
FromShip = fromInfo,
|
|
|
|
|
ToShipList = toShipList
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|