|
|
|
@ -7,11 +7,13 @@ using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.AspNetCore.StaticFiles.Infrastructure;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Application.ConfigOption;
|
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
using Myshipping.Core;
|
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
using NPOI.Util;
|
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
@ -503,29 +505,200 @@ 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).ToList();
|
|
|
|
|
.Where(a => a.NOM_ID == rollModel.PK_ID && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
var fromEntity = shipList.FirstOrDefault(a =>
|
|
|
|
|
a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
var fromEntity = shipList.Where(a =>
|
|
|
|
|
a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
if (fromEntity != null)
|
|
|
|
|
model.From = fromEntity.Adapt<TaskRollingNominationShipDto>();
|
|
|
|
|
if (fromEntity.Count > 0)
|
|
|
|
|
model.From = fromEntity.Select(p => p.Adapt<TaskRollingNominationShipDto>()).ToList();
|
|
|
|
|
|
|
|
|
|
var toEntity = shipList.FirstOrDefault(a =>
|
|
|
|
|
a.SHIP_TYPE.Equals("To", StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
var toEntity = shipList.Where(a => Regex.IsMatch(a.SHIP_TYPE, "To(\\s+[0-9]+)?"
|
|
|
|
|
, RegexOptions.IgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
if (toEntity != null)
|
|
|
|
|
model.To = toEntity.Adapt<TaskRollingNominationShipDto>();
|
|
|
|
|
if (toEntity.Count > 0)
|
|
|
|
|
model.To = toEntity.Select(p => p.Adapt<TaskRollingNominationShipDto>()).ToList();
|
|
|
|
|
|
|
|
|
|
List<TaskRollingNominationShipFromToDto> fromToList = new List<TaskRollingNominationShipFromToDto>();
|
|
|
|
|
|
|
|
|
|
//优先PORT关联FROM和TO,也有PORT为空的情况,这种就需要用Terminal来关联
|
|
|
|
|
if (model.From.Any(t => string.IsNullOrWhiteSpace(t.Port)))
|
|
|
|
|
{
|
|
|
|
|
//这里为了前端原船和换船做了根据Terminal对应
|
|
|
|
|
fromToList = model.From.GroupJoin(model.To, l => l.Terminal?.Trim(), r => r.Terminal?.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();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//这里为了前端原船和换船做了根据PORT对应
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
string rollontoRegex = "Roll\\s+onto\\s+\\w{3,}\\s+\\w+,\\s+[0-9]+\\s+days\\s+delay\\.";
|
|
|
|
|
|
|
|
|
|
bool isSelectRoll = false;
|
|
|
|
|
bool isRoll = false;
|
|
|
|
|
bool isRollOnto = false;
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
isSelectRoll = true;
|
|
|
|
|
}
|
|
|
|
|
else if (p.Status.Trim().Equals("roll", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
isRoll = true;
|
|
|
|
|
}
|
|
|
|
|
else if(Regex.IsMatch(p.Status, rollontoRegex, RegexOptions.IgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
vslCode = Regex.Match(p.Status, "(?<=Roll\\sonto\\s)\\w{3,}(?=\\s+\\w+,)").Value?.Trim();
|
|
|
|
|
|
|
|
|
|
isRollOnto = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < fromToList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(fromToList[i].FromShip.Port))
|
|
|
|
|
{
|
|
|
|
|
if (fromToList[i].FromShip.Port.Equals(p.PlaceOfReceipt, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
var fromInfo = fromToList[i].FromShip.Adapt<TaskRollingNominationShipDto>();
|
|
|
|
|
|
|
|
|
|
List<TaskRollingNominationShipDto> toShipList = new List<TaskRollingNominationShipDto>();
|
|
|
|
|
|
|
|
|
|
if (isSelectRoll)
|
|
|
|
|
{
|
|
|
|
|
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>());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (isRoll)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < fromToList[i].ToShipList.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
if (fromToList[i].ToShipList[j].Port.Equals(p.PlaceOfDelivery?.Trim(), StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
toShipList.Add(fromToList[i].ToShipList[j].Adapt<TaskRollingNominationShipDto>());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (toShipList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
if (fromToList[i].ToShipList.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
toShipList.Add(fromToList[i].ToShipList.FirstOrDefault().Adapt<TaskRollingNominationShipDto>());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.FromToList.Add(new TaskRollingNominationShipFromToDto
|
|
|
|
|
{
|
|
|
|
|
FromShip = fromInfo,
|
|
|
|
|
ToShipList = toShipList
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (fromToList[i].FromShip.Terminal.Contains(p.PlaceOfReceipt, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
var fromInfo = fromToList[i].FromShip.Adapt<TaskRollingNominationShipDto>();
|
|
|
|
|
|
|
|
|
|
List<TaskRollingNominationShipDto> toShipList = new List<TaskRollingNominationShipDto>();
|
|
|
|
|
|
|
|
|
|
if (isRollOnto)
|
|
|
|
|
{
|
|
|
|
|
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>());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.FromToList.Add(new TaskRollingNominationShipFromToDto
|
|
|
|
|
{
|
|
|
|
|
FromShip = fromInfo,
|
|
|
|
|
ToShipList = toShipList
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
@ -551,6 +724,7 @@ namespace Myshipping.Application.Service.TaskManagePlat
|
|
|
|
|
/*
|
|
|
|
|
1、验证shareKey是否有效。
|
|
|
|
|
2、查看分享记录找到对应的预甩调度详情。
|
|
|
|
|
3、用户已经提交过意见的不能再发起
|
|
|
|
|
3、更新用户反馈意见。
|
|
|
|
|
4、返回成功
|
|
|
|
|
*/
|
|
|
|
@ -568,9 +742,18 @@ namespace Myshipping.Application.Service.TaskManagePlat
|
|
|
|
|
if (shareEntity == null)
|
|
|
|
|
throw Oops.Oh($"链接分享不存在");
|
|
|
|
|
|
|
|
|
|
if(shareEntity.STATUS != TaskShareLinkStatusEnum.ACTIVE.ToString())
|
|
|
|
|
{
|
|
|
|
|
if(shareEntity.STATUS != TaskShareLinkStatusEnum.COMPLETE.ToString())
|
|
|
|
|
throw Oops.Oh($"预甩通知用户已反馈,不能重复提交");
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh($"分享链接已失效,请咨询操作重新获取");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shareEntity.USER_OPINION = model.userOpinion;
|
|
|
|
|
shareEntity.USER_OPINION_TXT = model.userOpinionTxt;
|
|
|
|
|
shareEntity.CONFIRM_DATE = DateTime.Now;
|
|
|
|
|
shareEntity.IS_MANUAL = model.isManual;
|
|
|
|
|
|
|
|
|
|
await _taskShareLinkInfoRepository.AsUpdateable(shareEntity)
|
|
|
|
|
.UpdateColumns(it => new
|
|
|
|
@ -578,8 +761,11 @@ namespace Myshipping.Application.Service.TaskManagePlat
|
|
|
|
|
it.USER_OPINION,
|
|
|
|
|
it.USER_OPINION_TXT,
|
|
|
|
|
it.CONFIRM_DATE,
|
|
|
|
|
it.IS_MANUAL,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
//需要回写预甩任务的
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "成功";
|
|
|
|
|
}
|
|
|
|
|