|
|
|
@ -31,6 +31,7 @@ using System.ComponentModel;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
@ -56,6 +57,8 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<BookingExcelTemplate> _bookingExcelTemplateRepository;
|
|
|
|
|
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
|
|
|
|
|
private readonly ITaskManageExternalService _taskManageExternalService;
|
|
|
|
|
private readonly ISysUserService _sysUserService;
|
|
|
|
|
private readonly IDjyCustomerService _djyCustomerService;
|
|
|
|
|
|
|
|
|
|
const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list";
|
|
|
|
|
const string PRINT_DATASOURCE_KEY = "booking_order";
|
|
|
|
@ -69,6 +72,7 @@ namespace Myshipping.Application
|
|
|
|
|
SqlSugarRepository<DjyUserConfig> djyUserConfigConfig,
|
|
|
|
|
SqlSugarRepository<BookingExcelTemplate> bookingExcelTemplateRepository,
|
|
|
|
|
SqlSugarRepository<SysUser> sysUserRepository,
|
|
|
|
|
ISysUserService sysUserService, IDjyCustomerService djyCustomerService,
|
|
|
|
|
ITaskManageExternalService taskManageExternalService)
|
|
|
|
|
{
|
|
|
|
|
_cache = cache;
|
|
|
|
@ -84,6 +88,8 @@ namespace Myshipping.Application
|
|
|
|
|
_djyUserConfigConfig = djyUserConfigConfig;
|
|
|
|
|
_bookingExcelTemplateRepository = bookingExcelTemplateRepository;
|
|
|
|
|
_sysUserRepository = sysUserRepository;
|
|
|
|
|
_sysUserService = sysUserService;
|
|
|
|
|
_djyCustomerService = djyCustomerService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -259,7 +265,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var model = InnerCreateTruckFromBookingOrder(bookingId);
|
|
|
|
|
var model = await InnerCreateTruckFromBookingOrder(bookingId);
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.ext = model;
|
|
|
|
@ -445,7 +451,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BookingTruckShowDto InnerCreateTruckFromBookingOrder(long bookingId)
|
|
|
|
|
private async Task<BookingTruckShowDto> InnerCreateTruckFromBookingOrder(long bookingId)
|
|
|
|
|
{
|
|
|
|
|
BookingTruckShowDto model = null;
|
|
|
|
|
|
|
|
|
@ -466,11 +472,54 @@ namespace Myshipping.Application
|
|
|
|
|
model.MBLNo = orderInfo.MBLNO;
|
|
|
|
|
model.Vessel = orderInfo.VESSEL;
|
|
|
|
|
model.VoyNo = orderInfo.VOYNO;
|
|
|
|
|
model.YARDCONTRACT = orderInfo.YARDCONTRACT;
|
|
|
|
|
model.YARDCONTRACTTEL = orderInfo.YARDCONTRACTTEL;
|
|
|
|
|
model.TruckTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
model.FromName = UserManager.Name;
|
|
|
|
|
model.FromTel = UserManager.TEl;
|
|
|
|
|
model.FromMail = UserManager.Email;
|
|
|
|
|
|
|
|
|
|
//这里岗位是调度的信息,如果默认只有一条记录,取第一条,其他情况不返回默认值
|
|
|
|
|
var userPosInfo = await _sysUserService.QueryUserByPos("", "PCDD");
|
|
|
|
|
|
|
|
|
|
if(userPosInfo.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
model.DispatcherId = userPosInfo.FirstOrDefault().SysEmpId;
|
|
|
|
|
model.DispatcherName = userPosInfo.FirstOrDefault().SysEmpName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var yardList = await _djyCustomerService.QuerytDjyCustomerInfo("", new string[] { "yard" }, 999);
|
|
|
|
|
|
|
|
|
|
if(yardList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if((string.IsNullOrWhiteSpace(model.YARDCONTRACT) || string.IsNullOrWhiteSpace(model.YARDCONTRACTTEL))
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(model.YARD))
|
|
|
|
|
{
|
|
|
|
|
var yardInfo = yardList.Select(a =>
|
|
|
|
|
{
|
|
|
|
|
return new { KNum = a.ShortName.IndexOf(model.YARD),
|
|
|
|
|
Equls = a.ShortName.Equals(model.YARD, StringComparison.OrdinalIgnoreCase) ? 1 : 0,
|
|
|
|
|
Obj = a };
|
|
|
|
|
}).Where(a=>a.KNum >= 0)
|
|
|
|
|
.OrderByDescending(a => a.Equls)
|
|
|
|
|
.ThenBy(a=>a.KNum)
|
|
|
|
|
.FirstOrDefault().Obj;
|
|
|
|
|
|
|
|
|
|
if(yardInfo != null)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.YARDCONTRACT))
|
|
|
|
|
model.YARDCONTRACT = yardInfo.Chief?.Trim();
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.YARDCONTRACTTEL))
|
|
|
|
|
model.YARDCONTRACTTEL = yardInfo.Tel?.Trim();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.InYardContact = orderInfo.YARDCONTRACT;
|
|
|
|
|
model.InYardContractTel = orderInfo.YARDCONTRACTTEL;
|
|
|
|
|
|
|
|
|
|
if (orderInfo.KGS.HasValue)
|
|
|
|
|
{
|
|
|
|
|
//计算总吨数
|
|
|
|
@ -542,7 +591,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var model = InnerCreateTruckFromBookingOrder(bookingId);
|
|
|
|
|
var model = await InnerCreateTruckFromBookingOrder(bookingId);
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.ext = model;
|
|
|
|
@ -568,7 +617,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var model = InnerCreateTruckFromBookingOrder(bookingId);
|
|
|
|
|
var model = await InnerCreateTruckFromBookingOrder(bookingId);
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
|
|
|
|
|