wet 2 years ago
commit 96f33fde84

@ -31,6 +31,7 @@ using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -56,6 +57,8 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingExcelTemplate> _bookingExcelTemplateRepository; private readonly SqlSugarRepository<BookingExcelTemplate> _bookingExcelTemplateRepository;
private readonly SqlSugarRepository<SysUser> _sysUserRepository; private readonly SqlSugarRepository<SysUser> _sysUserRepository;
private readonly ITaskManageExternalService _taskManageExternalService; 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_LIST_TYPE_KEY = "booking_truck_print_list";
const string PRINT_DATASOURCE_KEY = "booking_order"; const string PRINT_DATASOURCE_KEY = "booking_order";
@ -69,6 +72,7 @@ namespace Myshipping.Application
SqlSugarRepository<DjyUserConfig> djyUserConfigConfig, SqlSugarRepository<DjyUserConfig> djyUserConfigConfig,
SqlSugarRepository<BookingExcelTemplate> bookingExcelTemplateRepository, SqlSugarRepository<BookingExcelTemplate> bookingExcelTemplateRepository,
SqlSugarRepository<SysUser> sysUserRepository, SqlSugarRepository<SysUser> sysUserRepository,
ISysUserService sysUserService, IDjyCustomerService djyCustomerService,
ITaskManageExternalService taskManageExternalService) ITaskManageExternalService taskManageExternalService)
{ {
_cache = cache; _cache = cache;
@ -84,6 +88,8 @@ namespace Myshipping.Application
_djyUserConfigConfig = djyUserConfigConfig; _djyUserConfigConfig = djyUserConfigConfig;
_bookingExcelTemplateRepository = bookingExcelTemplateRepository; _bookingExcelTemplateRepository = bookingExcelTemplateRepository;
_sysUserRepository = sysUserRepository; _sysUserRepository = sysUserRepository;
_sysUserService = sysUserService;
_djyCustomerService = djyCustomerService;
} }
/// <summary> /// <summary>
@ -259,7 +265,7 @@ namespace Myshipping.Application
try try
{ {
var model = InnerCreateTruckFromBookingOrder(bookingId); var model = await InnerCreateTruckFromBookingOrder(bookingId);
result.succ = true; result.succ = true;
result.ext = model; 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; BookingTruckShowDto model = null;
@ -466,11 +472,54 @@ namespace Myshipping.Application
model.MBLNo = orderInfo.MBLNO; model.MBLNo = orderInfo.MBLNO;
model.Vessel = orderInfo.VESSEL; model.Vessel = orderInfo.VESSEL;
model.VoyNo = orderInfo.VOYNO; model.VoyNo = orderInfo.VOYNO;
model.YARDCONTRACT = orderInfo.YARDCONTRACT;
model.YARDCONTRACTTEL = orderInfo.YARDCONTRACTTEL;
model.TruckTime = DateTime.Now;
model.FromName = UserManager.Name; model.FromName = UserManager.Name;
model.FromTel = UserManager.TEl; model.FromTel = UserManager.TEl;
model.FromMail = UserManager.Email; 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) if (orderInfo.KGS.HasValue)
{ {
//计算总吨数 //计算总吨数
@ -542,7 +591,7 @@ namespace Myshipping.Application
try try
{ {
var model = InnerCreateTruckFromBookingOrder(bookingId); var model = await InnerCreateTruckFromBookingOrder(bookingId);
result.succ = true; result.succ = true;
result.ext = model; result.ext = model;
@ -568,7 +617,7 @@ namespace Myshipping.Application
try try
{ {
var model = InnerCreateTruckFromBookingOrder(bookingId); var model = await InnerCreateTruckFromBookingOrder(bookingId);
result.succ = true; result.succ = true;

@ -15294,6 +15294,14 @@
所属租户 所属租户
</summary> </summary>
</member> </member>
<member name="M:Myshipping.Core.Service.ISysUserService.QueryUserByPos(System.String,System.String)">
<summary>
通过职位获取用户信息
</summary>
<param name="name"></param>
<param name="pos">职位代码 PCDD-调度</param>
<returns>返回用户详情</returns>
</member>
<member name="T:Myshipping.Core.Service.SysDataUserMenuService"> <member name="T:Myshipping.Core.Service.SysDataUserMenuService">
<summary> <summary>
用户数据范围 用户数据范围

@ -32,4 +32,11 @@ public interface ISysUserService
void CheckDataScopeByUserId(long userId); void CheckDataScopeByUserId(long userId);
void CheckDataScope(long orgId); void CheckDataScope(long orgId);
Task<List<SysUser>> GetTenantUser(string name,long? tenantId); Task<List<SysUser>> GetTenantUser(string name,long? tenantId);
/// <summary>
/// 通过职位获取用户信息
/// </summary>
/// <param name="name"></param>
/// <param name="pos">职位代码 PCDD-调度</param>
/// <returns>返回用户详情</returns>
Task<List<EmpPosOutput>> QueryUserByPos(string name, string pos);
} }

Loading…
Cancel
Save