wet 2 years ago
commit 064b6ed67d

@ -216,5 +216,25 @@ namespace Myshipping.Application.Entity
/// </summary> /// </summary>
[Description("任务流水号")] [Description("任务流水号")]
public string TaskNo { get; set; } public string TaskNo { get; set; }
/// <summary>
/// 船名
/// </summary>
[Description("船名")]
public string Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
[Description("航次")]
public string VoyNo { get; set; }
/// <summary>
/// 提单号
/// </summary>
[Description("提单号")]
public string MBLNo { get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
[Description("箱型箱量")]
public string CntrTotal { get; set; }
} }
} }

@ -119,5 +119,11 @@ namespace Myshipping.Application
/// </summary> /// </summary>
[Description("比对下货纸")] [Description("比对下货纸")]
SHIPPING_ORDER_COMPARE, SHIPPING_ORDER_COMPARE,
/// <summary>
/// 派车
/// </summary>
[Description("派车")]
TRUCK_DISPATCH,
} }
} }

@ -2363,76 +2363,6 @@ namespace Myshipping.Application
#region 打印 #region 打印
/// <summary> /// <summary>
/// 打印准备作废使用PrintOrder代替
/// </summary>
/// <param name="bookingId">订舱Id</param>
/// <param name="typeCode">打印类型代码对应字典booking_template_type</param>
/// <param name="type">类型1pdf、2xlsx、3docx</param>
/// <returns></returns>
[HttpGet("/BookingOrder/Print")]
public async Task<string> Print(long bookingId, string typeCode, int type = 1)
{
var bs = await GetReportFile(bookingId, typeCode, type);
var fileType = "";
if (type == 1)
{
fileType = ".pdf";
}
else if (type == 2)
{
fileType = ".xlsx";
}
else if (type == 3)
{
fileType = ".docx";
}
else
{
throw Oops.Bah("类型参数不正确");
}
var typeObj = (await _cache.GetAllDictData()).First(x => x.TypeCode == "booking_template_type" && x.Code == typeCode);
var mblno = await _rep.AsQueryable().Where(x => x.Id == bookingId).Select(x => x.MBLNO).FirstAsync();
string fileName = string.Empty;
if (string.IsNullOrWhiteSpace(mblno))
{
fileName = $"{bookingId}_{typeObj.Value.ValidFileName()}_{DateTime.Now.Ticks}{fileType}";////名称
}
else
{
fileName = $"{mblno}_{typeObj.Value.ValidFileName()}_{DateTime.Now.Ticks}{fileType}";////名称
}
//var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName };
var opt = App.GetOptions<TempFileOptions>().Path;
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
if (!Directory.Exists(serverpath))
{
Directory.CreateDirectory(serverpath);
}
await File.WriteAllBytesAsync(Path.Combine(serverpath, fileName), bs);
//记录打印次数和时间,用于前端动态展示常用的打印类型
var usrCfg = _repUserConfig.AsQueryable().First(x => x.CreatedUserId == UserManager.UserId && x.Type == PrintRecentListTypeKey);
if (usrCfg == null)
{
usrCfg = new DjyUserConfig();
usrCfg.Type = PrintRecentListTypeKey;
usrCfg.ConfigJson = (new string[] { typeCode }).ToJson();
await _repUserConfig.InsertAsync(usrCfg);
}
else
{
var arr = JArray.Parse(usrCfg.ConfigJson).Select(x => x.ToString()).Where(x => x != typeCode).ToList();
arr.Insert(0, typeCode);
usrCfg.ConfigJson = arr.ToArray().ToJson();
await _repUserConfig.UpdateAsync(usrCfg);
}
return fileName;
}
/// <summary>
/// 下载打印文件 /// 下载打印文件
/// </summary> /// </summary>
/// <param name="fileName">文件名</param> /// <param name="fileName">文件名</param>
@ -2770,20 +2700,6 @@ namespace Myshipping.Application
return HttpUtility.UrlEncode(fileName, Encoding.GetEncoding("UTF-8")); return HttpUtility.UrlEncode(fileName, Encoding.GetEncoding("UTF-8"));
} }
//[HttpGet("/BookingOrder/TestExcel"), AllowAnonymous]
//public async Task TestExcel()
//{
// var excelwork = new HSSFWorkbook(new FileStream(@"E:\whm\proj_git\BookingHeChuan\Myshipping.Web.Entry\bin\Debug\net6.0\wwwroot\Upload\PrintTemplate\373472276209733.xls", FileMode.Open));
// var sheet = excelwork.GetSheetAt(0);
// sheet.GetRow(0).GetCell(0).SetCellValue(Guid.NewGuid().ToString());
// sheet.GetRow(0).GetCell(1).SetCellValue(DateTime.Now.Ticks);
// var filestream = new FileStream(Path.Combine(@"E:\whm\proj_git\BookingHeChuan\Myshipping.Web.Entry\bin\Debug\net6.0\wwwroot\Upload\PrintTemplate", "result.xls"), FileMode.Create);
// excelwork.Write(filestream);
// filestream.Close();
//}
/// <summary> /// <summary>
/// 预览模板生成的pdf文件 /// 预览模板生成的pdf文件
/// </summary> /// </summary>
@ -2814,58 +2730,6 @@ namespace Myshipping.Application
} }
} }
/// <summary>
/// 获取订舱打印模板列表带有当前用户打印历史排序准备作废使用PrintTemplateWithHistoryList代替
/// </summary>
/// <returns></returns>
[HttpGet("/BookingOrder/PrintTemplateList")]
public async Task<dynamic> PrintTemplateList()
{
//当前公司所有已配置的模板
var allList = await _repPrintTemplate.AsQueryable()
.Filter(null, true).InnerJoin<BookingPrinttemplateRight>((d, t) => d.Id == t.PrintTemplateId && t.SysUserId == UserManager.UserId)
.Where(d => d.TenantId == UserManager.TENANT_ID)
.Select(d => new
{
d.TypeCode,
d.TypeName,
d.IsMain,
d.IsSub
})
.ToListAsync();
var listReult = new List<dynamic>();
//当前用户打印历史数据
var usrCfg = await _repUserConfig.AsQueryable().FirstAsync(x => x.CreatedUserId == UserManager.UserId && x.Type == PrintRecentListTypeKey);
if (usrCfg != null)
{
var arr = JArray.Parse(usrCfg.ConfigJson).Select(x => x.ToString()).ToList();
//按顺序加入到结果
arr.ForEach(x =>
{
var find = allList.FirstOrDefault(y => y.TypeCode == x);
if (find != null)
{
listReult.Add(find);
}
});
var listOut = allList.Where(x => !arr.Contains(x.TypeCode)).ToList();
listReult.AddRange(listOut);
return listReult;
}
else
{
return allList;
}
}
/// <summary> /// <summary>
/// 获取订舱打印模板列表(带有当前用户打印历史排序) /// 获取订舱打印模板列表(带有当前用户打印历史排序)
/// </summary> /// </summary>

@ -13,6 +13,10 @@ using Myshipping.Application.Helper;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using MySqlX.XDevAPI.Common;
using NPOI.OpenXmlFormats.Wordprocessing;
using NPOI.SS.Formula.Functions;
using Org.BouncyCastle.Crypto;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -36,13 +40,14 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingTruckCtn> _bookingTruckContaRepository; private readonly SqlSugarRepository<BookingTruckCtn> _bookingTruckContaRepository;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository; private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository; private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository;
private readonly ITaskManageExternalService _taskManageExternalService;
public BookingTruckService(ISysCacheService cache, ILogger<BookingTruckService> logger, public BookingTruckService(ISysCacheService cache, ILogger<BookingTruckService> logger,
SqlSugarRepository<BookingTruck> bookingTruckRepository, SqlSugarRepository<BookingTruck> bookingTruckRepository,
SqlSugarRepository<BookingTruckCtn> bookingTruckContaRepository, SqlSugarRepository<BookingTruckCtn> bookingTruckContaRepository,
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BookingCtn> bookingCtnRepository) SqlSugarRepository<BookingCtn> bookingCtnRepository,
ITaskManageExternalService taskManageExternalService)
{ {
_cache = cache; _cache = cache;
_logger = logger; _logger = logger;
@ -51,6 +56,8 @@ namespace Myshipping.Application
_bookingTruckContaRepository = bookingTruckContaRepository; _bookingTruckContaRepository = bookingTruckContaRepository;
_bookingOrderRepository = bookingOrderRepository; _bookingOrderRepository = bookingOrderRepository;
_bookingCtnRepository = bookingCtnRepository; _bookingCtnRepository = bookingCtnRepository;
_taskManageExternalService = taskManageExternalService;
} }
/// <summary> /// <summary>
@ -65,7 +72,7 @@ namespace Myshipping.Application
try try
{ {
var id = InnerSave(info); var id = await InnerSave(info);
result.succ = true; result.succ = true;
result.msg = "保存成功"; result.msg = "保存成功";
@ -86,6 +93,7 @@ namespace Myshipping.Application
/// </summary> /// </summary>
/// <param name="info">派车信息</param> /// <param name="info">派车信息</param>
/// <returns>返回派车Id</returns> /// <returns>返回派车Id</returns>
[SqlSugarUnitOfWork]
private async Task<long> InnerSave(BookingTruckDto info) private async Task<long> InnerSave(BookingTruckDto info)
{ {
BookingTruck entity = info.Adapt<BookingTruck>(); BookingTruck entity = info.Adapt<BookingTruck>();
@ -97,6 +105,8 @@ namespace Myshipping.Application
if (entity.Id == 0) if (entity.Id == 0)
{ {
entity.Status = BookingTruckStatus.TEMP.ToString();
_bookingTruckRepository.Insert(entity); _bookingTruckRepository.Insert(entity);
if (entityCtnList != null && entityCtnList.Count > 0) if (entityCtnList != null && entityCtnList.Count > 0)
@ -111,6 +121,18 @@ namespace Myshipping.Application
} }
else else
{ {
var model = _bookingTruckRepository.AsQueryable().First(a => a.Id == entity.Id);
if(model == null)
throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废");
//校验
ValidateTruck(OperateTypeEnum.Save, new BookingTruck[] { model });
entity.UpdatedTime = DateTime.Now;
entity.UpdatedUserId = UserManager.UserId;
entity.UpdatedUserName = UserManager.Name;
await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new
{ {
it.TenantId, it.TenantId,
@ -122,22 +144,27 @@ namespace Myshipping.Application
it.TruckId, it.TruckId,
it.TruckName, it.TruckName,
it.TruckCode, it.TruckCode,
it.Status,
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
await _bookingTruckContaRepository.DeleteAsync(x => x.TruckId == model.Id);
if (entityCtnList != null && entityCtnList.Count > 0) if (entityCtnList != null && entityCtnList.Count > 0)
{ {
entityCtnList.ForEach(async ctn => entityCtnList.ForEach(async ctn =>
{ {
ctn.TruckId = entity.Id; ctn.TruckId = entity.Id;
await _bookingTruckContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new //await _bookingTruckContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new
{ //{
it.TenantId, // it.TenantId,
it.CreatedTime, // it.CreatedTime,
it.CreatedUserId, // it.CreatedUserId,
it.CreatedUserName, // it.CreatedUserName,
it.IsDeleted, // it.IsDeleted,
}).ExecuteCommandAsync(); //}).ExecuteCommandAsync();
await _bookingTruckContaRepository.InsertAsync(ctn);
}); });
} }
} }
@ -365,6 +392,21 @@ namespace Myshipping.Application
return entities.Adapt<SqlSugarPagedList<BookingTruckPageDto>>(); return entities.Adapt<SqlSugarPagedList<BookingTruckPageDto>>();
} }
/// <summary>
/// 订舱主键获取相关派车列表
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回派车列表</returns>
[HttpGet("/BookingTruck/GetTruckListByBooking")]
public async Task<List<BookingTruckShowDto>> GetTruckListByBookingAsync(long bookingId)
{
var list = _bookingTruckRepository.AsQueryable().Where(a => a.BookingId == bookingId).ToList();
return list.Adapt<List<BookingTruckShowDto>>();
}
private BookingTruckDto InnerCreateTruckFromBookingOrder(long bookingId) private BookingTruckDto InnerCreateTruckFromBookingOrder(long bookingId)
{ {
BookingTruckDto model = null; BookingTruckDto model = null;
@ -510,6 +552,33 @@ namespace Myshipping.Application
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
[HttpPost("/BookingTruck/Submit")] [HttpPost("/BookingTruck/Submit")]
public async Task<TaskManageOrderResultDto> Submit(BookingTruckDto info) public async Task<TaskManageOrderResultDto> Submit(BookingTruckDto info)
{
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no}获取提交派车请求规则 {id}", batchNo, info.Id);
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
result = await InnerSubmit(info, batchNo);
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"提交异常,原因:{ex.Message}";
}
return result;
}
/// <summary>
/// 提交内部方法
/// </summary>
/// <param name="info">派车信息</param>
/// <param name="batchNo">批次号</param>
/// <returns>返回回执</returns>
private async Task<TaskManageOrderResultDto> InnerSubmit(BookingTruckDto info,string batchNo)
{ {
TaskManageOrderResultDto result = new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -522,17 +591,56 @@ namespace Myshipping.Application
*/ */
try try
{ {
//先保存 //先保存
var id = InnerSave(info); var id = await InnerSave(info);
//更新派车订单为已提交 //校验
var model = _bookingTruckRepository.AsQueryable().First(a => a.Id == id);
if (model == null)
throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废");
//校验
ValidateTruck(OperateTypeEnum.Submit, new BookingTruck[] { model });
DateTime bDate = DateTime.Now;
//推送新增派车任务接口 //推送新增派车任务接口
var msgModel = model.Adapt<TaskManageOrderMessageInfo>();
var taskRlt = await _taskManageExternalService.SubmitTruckDispatchAsync(msgModel);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, JSON.Serialize(taskRlt));
if (!taskRlt.succ)
{
throw Oops.Oh($"请求派车调度失败,原因={taskRlt.msg}");
} }
catch (Exception ex)
//更新派车订单为已提交
model.Status = BookingTruckStatus.SUBMITED.ToString();
model.UpdatedTime = DateTime.Now;
model.UpdatedUserId = UserManager.UserId;
model.UpdatedUserName = UserManager.Name;
await _bookingTruckRepository.AsUpdateable(model).UpdateColumns(it => new
{ {
it.Status,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
result.succ = true;
result.msg = "提交成功";
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"提交异常,原因:{ex.Message}";
} }
return result; return result;
@ -665,6 +773,82 @@ namespace Myshipping.Application
return result; return result;
} }
/// <summary>
/// 删除派车
/// </summary>
/// <param name="id">派车主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> Delete(long id)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
//检索
var truckOrder = _bookingTruckRepository.AsQueryable().First(a => a.Id == id);
if(truckOrder == null)
throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废");
//先校验
ValidateTruck(OperateTypeEnum.Delete, new BookingTruck[] { truckOrder });
await _bookingTruckRepository.UpdateAsync(x => x.Id == id,
x => new BookingTruck { IsDeleted = true });
result.succ = true;
result.msg = "删除成功";
_logger.LogInformation("删除派车成功 id={id} user={usr}", id, UserManager.UserId);
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"删除派车异常,原因:{ex.Message}";
}
return result;
}
/// <summary>
/// 批量删除派车
/// </summary>
/// <param name="ids">派车主键组</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> DeleteBatch(long[] ids)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
//检索
var truckOrderList = _bookingTruckRepository.AsQueryable()
.Where(a => ids.Contains(a.Id)).ToList();
if (truckOrderList.Count != ids.Length)
throw Oops.Oh($"部分派车信息获取失败,派车信息不存在或已作废");
//先校验
ValidateTruck(OperateTypeEnum.Delete, truckOrderList.ToArray());
truckOrderList.ForEach(async tk => {
await _bookingTruckRepository.UpdateAsync(x => x.Id == tk.Id,
x => new BookingTruck { IsDeleted = true });
});
result.succ = true;
result.msg = "删除成功";
_logger.LogInformation("删除派车成功 ids={id} user={usr}", ids, UserManager.UserId);
}
catch (Exception ex)
{
}
return result;
}
/// <summary> /// <summary>
/// 打印派车 /// 打印派车
/// </summary> /// </summary>

@ -153,10 +153,6 @@ namespace Myshipping.Application
/// </summary> /// </summary>
public bool IsGuaJi { get; set; } public bool IsGuaJi { get; set; }
/// <summary> /// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 注意事项 /// 注意事项
/// </summary> /// </summary>
public string Attention { get; set; } public string Attention { get; set; }
@ -172,9 +168,12 @@ namespace Myshipping.Application
/// 调度名称 /// 调度名称
/// </summary> /// </summary>
public string DispatcherName { get; set; } public string DispatcherName { get; set; }
/// <summary> /// <summary>
/// 集装箱列表 /// 集装箱列表
/// </summary> /// </summary>
public List<BookingTruckCtnDto> ContaList { get; set; } public List<BookingTruckCtnDto> ContaList { get; set; }
} }
} }

@ -167,5 +167,22 @@ namespace Myshipping.Application
/// 调度名称 /// 调度名称
/// </summary> /// </summary>
public string DispatcherName { get; set; } public string DispatcherName { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string VoyNo { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string MBLNo { get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
public string CntrTotal { get; set; }
} }
} }

@ -48,6 +48,13 @@ namespace Myshipping.Application
/// <returns>返回结果</returns> /// <returns>返回结果</returns>
Task<SqlSugarPagedList<BookingTruckPageDto>> GetPageAsync(QueryBookingTruckDto QuerySearch); Task<SqlSugarPagedList<BookingTruckPageDto>> GetPageAsync(QueryBookingTruckDto QuerySearch);
/// <summary>
/// 订舱主键获取相关派车列表
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回派车列表</returns>
Task<List<BookingTruckShowDto>> GetTruckListByBookingAsync(long bookingId);
/// <summary> /// <summary>
/// 获取派车详情 /// 获取派车详情
/// </summary> /// </summary>
@ -83,6 +90,20 @@ namespace Myshipping.Application
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelBatch(long[] ids); Task<TaskManageOrderResultDto> CancelBatch(long[] ids);
/// <summary>
/// 删除派车
/// </summary>
/// <param name="id">派车主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> Delete(long id);
/// <summary>
/// 批量删除派车
/// </summary>
/// <param name="ids">派车主键组</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> DeleteBatch(long[] ids);
/// <summary> /// <summary>
/// 打印派车 /// 打印派车
/// </summary> /// </summary>

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 任务外部请求服务
/// </summary>
public interface ITaskManageExternalService
{
/// <summary>
/// 提交派车
/// </summary>
/// <param name="info">请求派车报文</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SubmitTruckDispatchAsync(TaskManageOrderMessageInfo info);
}
}

@ -0,0 +1,33 @@
using Furion.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class TaskManageExternalService : ITaskManageExternalService, ITransient
{
/// <summary>
/// 提交派车
/// </summary>
/// <param name="info">请求派车报文</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SubmitTruckDispatchAsync(TaskManageOrderMessageInfo info)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
}
catch(Exception ex)
{
}
return result;
}
}
}

@ -117,5 +117,10 @@ namespace Myshipping.Application
/// 序列化报文详情 /// 序列化报文详情
/// </summary> /// </summary>
public TaskManageOrderExtMessageInfo SerialMsgInfo { get; set; } public TaskManageOrderExtMessageInfo SerialMsgInfo { get; set; }
/// <summary>
/// 派车信息
/// </summary>
public TaskManageOrderTruckContaInfo TruckInfo { get; set; }
} }
} }

@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 集装箱
/// </summary>
public class TaskManageOrderTruckContaInfo
{
/// <summary>
/// 箱型代码
/// </summary>
public string CTNCODE { get; set; }
/// <summary>
/// 箱型
/// </summary>
public string CTNALL { get; set; }
/// <summary>
/// 箱量
/// </summary>
public Nullable<int> CTNNUM { get; set; }
/// <summary>
/// TEU
/// </summary>
public Nullable<int> TEU { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string CNTRNO { get; set; }
/// <summary>
/// 封号
/// </summary>
public string SEALNO { get; set; }
/// <summary>
/// 件数
/// </summary>
public Nullable<int> PKGS { get; set; }
/// <summary>
/// 包装
/// </summary>
public string KINDPKGS { get; set; }
/// <summary>
/// 毛重
/// </summary>
public Nullable<decimal> KGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public Nullable<decimal> CBM { get; set; }
/// <summary>
/// 皮重
/// </summary>
public Nullable<decimal> TAREWEIGHT { get; set; }
/// <summary>
/// 箱状态
/// </summary>
public string CTNSTATUS { get; set; }
/// <summary>
/// 称重方式
/// </summary>
public string WEIGHTYPE { get; set; }
/// <summary>
/// 称重重量
/// </summary>
public Nullable<decimal> WEIGHKGS { get; set; }
/// <summary>
/// 称重联系人
/// </summary>
public string WEIGHATTN { get; set; }
/// <summary>
/// VGM联系公司
/// </summary>
public string VGMCONNCOM { get; set; }
/// <summary>
/// VGM联系电话
/// </summary>
public string WEIGHTEL { get; set; }
/// <summary>
/// 称重日期
/// </summary>
public string WEIGHDATE { get; set; }
/// <summary>
/// VGM地址
/// </summary>
public string VGMADDR { get; set; }
/// <summary>
/// VGM邮箱
/// </summary>
public string VGMEMAIL { get; set; }
/// <summary>
/// 备注
/// </summary>
public string REMARK { get; set; }
/// <summary>
/// 车牌号
/// </summary>
public string CarNumber { get; set; }
/// <summary>
/// 司机
/// </summary>
public string CarDriver { get; set; }
/// <summary>
/// 司机电话
/// </summary>
public string CarDriverTel { get; set; }
}
}

@ -0,0 +1,176 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
///
/// </summary>
public class TaskManageOrderTruckInfo
{
/// <summary>
/// 派车主键
/// </summary>
public long Id { get; set; }
/// <summary>
/// 订舱ID
/// </summary>
public Nullable<long> BookingId { get; set; }
/// <summary>
/// 车队ID
/// </summary>
public Nullable<long> TruckId { get; set; }
/// <summary>
/// 车队代码
/// </summary>
public string TruckCode { get; set; }
/// <summary>
/// 车队代码
/// </summary>
public string TruckName { get; set; }
/// <summary>
/// TO
/// </summary>
public string ToName { get; set; }
/// <summary>
/// ATTN
/// </summary>
public string Attn { get; set; }
/// <summary>
/// ATTN电话
/// </summary>
public string AttnTel { get; set; }
/// <summary>
/// ATTN邮箱
/// </summary>
public string AttnMail { get; set; }
/// <summary>
/// FROM
/// </summary>
public string FromName { get; set; }
/// <summary>
/// FROM电话
/// </summary>
public string FromTel { get; set; }
/// <summary>
/// FROM邮箱
/// </summary>
public string FromMail { get; set; }
/// <summary>
/// 吨数
/// </summary>
public Nullable<decimal> KGS { get; set; }
/// <summary>
/// 陆运费
/// </summary>
public Nullable<decimal> Fee { get; set; }
/// <summary>
/// 支付方式
/// </summary>
public string PayMethod { get; set; }
/// <summary>
/// 支付方式名称
/// </summary>
public string PayMethodName { get; set; }
/// <summary>
/// 派车日期
/// </summary>
public Nullable<DateTime> TruckTime { get; set; }
/// <summary>
/// 提箱场站ID
/// </summary>
public string YARDID { get; set; }
/// <summary>
/// 提箱场站
/// </summary>
public string YARD { get; set; }
/// <summary>
/// 场站联系人
/// </summary>
public string YARDCONTRACT { get; set; }
/// <summary>
/// 场站联系人电话
/// </summary>
public string YARDCONTRACTTEL { get; set; }
/// <summary>
/// 工厂ID
/// </summary>
public Nullable<long> FactoryId { get; set; }
/// <summary>
/// 工厂代码
/// </summary>
public string FactoryCode { get; set; }
/// <summary>
/// 工厂名称
/// </summary>
public string FactoryName { get; set; }
/// <summary>
/// 工厂联系人
/// </summary>
public string FactoryContact { get; set; }
/// <summary>
/// 工厂联系电话
/// </summary>
public string FactoryTel { get; set; }
/// <summary>
/// 返场时间
/// </summary>
public Nullable<DateTime> ReturnTime { get; set; }
/// <summary>
/// 入货场站ID
/// </summary>
public string InYardID { get; set; }
/// <summary>
/// 入货场站
/// </summary>
public string InYard { get; set; }
/// <summary>
/// 入货联系人
/// </summary>
public string InYardContact { get; set; }
/// <summary>
/// 入货联系人电话
/// </summary>
public string InYardContractTel { get; set; }
/// <summary>
/// 要求到达时间
/// </summary>
public Nullable<DateTime> NeedArriveTime { get; set; }
/// <summary>
/// 截港日期
/// </summary>
public Nullable<DateTime> ClosingTime { get; set; }
/// <summary>
/// 提货日期
/// </summary>
public Nullable<DateTime> PickUpTime { get; set; }
/// <summary>
/// 是否挂机
/// </summary>
public bool IsGuaJi { get; set; }
/// <summary>
/// 注意事项
/// </summary>
public string Attention { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 调度ID
/// </summary>
public Nullable<long> DispatcherId { get; set; }
/// <summary>
/// 调度名称
/// </summary>
public string DispatcherName { get; set; }
/// <summary>
/// 集装箱列表
/// </summary>
public List<TaskManageOrderTruckContaInfo> ContaList { get; set; }
}
}

@ -12531,6 +12531,18 @@
职位名称 职位名称
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.EmpPosOutput.SysEmpName">
<summary>
员工名称
</summary>
</member>
<member name="M:Myshipping.Core.Service.ISysEmpPosService.GetAllEmpByPos(System.Collections.Generic.List{System.String})">
<summary>
通过职位代码列表获取人员ID信息
</summary>
<param name="posCodeList">职位代码列表</param>
<returns>返回人员ID列表</returns>
</member>
<member name="T:Myshipping.Core.Service.SysEmpExtOrgPosService"> <member name="T:Myshipping.Core.Service.SysEmpExtOrgPosService">
<summary> <summary>
员工附属机构和职位服务 员工附属机构和职位服务
@ -12603,6 +12615,13 @@
<param name="empId"></param> <param name="empId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.SysEmpPosService.GetAllEmpByPos(System.Collections.Generic.List{System.String})">
<summary>
通过职位代码列表获取人员ID信息
</summary>
<param name="posCodeList">职位代码列表</param>
<returns>返回人员ID列表</returns>
</member>
<member name="T:Myshipping.Core.Service.SysEmpService"> <member name="T:Myshipping.Core.Service.SysEmpService">
<summary> <summary>
员工服务 员工服务
@ -15535,6 +15554,14 @@
<param name="TenantId">默认0 获取当前用户,可不传 传租户id获取当前租户</param> <param name="TenantId">默认0 获取当前用户,可不传 传租户id获取当前租户</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.SysUserService.QueryUserByPos(System.String,System.String)">
<summary>
通过职位获取用户信息
</summary>
<param name="name"></param>
<param name="pos">职位代码 PCDD-调度</param>
<returns>返回用户详情</returns>
</member>
<member name="T:Myshipping.Core.DjyEdiSettingDto"> <member name="T:Myshipping.Core.DjyEdiSettingDto">
<summary> <summary>
EDI参数设置输出参数 EDI参数设置输出参数

@ -23,4 +23,9 @@ public class EmpPosOutput
/// 职位名称 /// 职位名称
/// </summary> /// </summary>
public string PosName { get; set; } public string PosName { get; set; }
/// <summary>
/// 员工名称
/// </summary>
public string SysEmpName { get; set; }
} }

@ -10,4 +10,12 @@ public interface ISysEmpPosService
Task<List<EmpPosOutput>> GetEmpPosList(long empId); Task<List<EmpPosOutput>> GetEmpPosList(long empId);
Task<List<EmpPosOutput>> GetEmpPosList(List<long> empIds); Task<List<EmpPosOutput>> GetEmpPosList(List<long> empIds);
Task<bool> HasPosEmp(long posId); Task<bool> HasPosEmp(long posId);
/// <summary>
/// 通过职位代码列表获取人员ID信息
/// </summary>
/// <param name="posCodeList">职位代码列表</param>
/// <returns>返回人员ID列表</returns>
Task<List<EmpPosOutput>> GetAllEmpByPos(List<string> posCodeList);
} }

@ -15,10 +15,12 @@ namespace Myshipping.Core.Service;
public class SysEmpPosService : ISysEmpPosService, ITransient public class SysEmpPosService : ISysEmpPosService, ITransient
{ {
private readonly SqlSugarRepository<SysEmpPos> _sysEmpPosRep; // 员工职位表仓储 private readonly SqlSugarRepository<SysEmpPos> _sysEmpPosRep; // 员工职位表仓储
private readonly SqlSugarRepository<SysPos> _sysPosRep;
public SysEmpPosService(SqlSugarRepository<SysEmpPos> sysEmpPosRep) public SysEmpPosService(SqlSugarRepository<SysEmpPos> sysEmpPosRep, SqlSugarRepository<SysPos> sysPosRep)
{ {
_sysEmpPosRep = sysEmpPosRep; _sysEmpPosRep = sysEmpPosRep;
_sysPosRep = sysPosRep;
} }
/// <summary> /// <summary>
@ -105,4 +107,27 @@ public class SysEmpPosService : ISysEmpPosService, ITransient
{ {
await _sysEmpPosRep.DeleteAsync(u => u.SysEmpId == empId); await _sysEmpPosRep.DeleteAsync(u => u.SysEmpId == empId);
} }
/// <summary>
/// 通过职位代码列表获取人员ID信息
/// </summary>
/// <param name="posCodeList">职位代码列表</param>
/// <returns>返回人员ID列表</returns>
public async Task<List<EmpPosOutput>> GetAllEmpByPos(List<string> posCodeList)
{
var query = _sysPosRep.AsQueryable().Where(a => posCodeList.Contains(a.Code));
var list = await query.InnerJoin<SysEmpPos>((l,r)=>l.Id == r.SysPosId)
.InnerJoin<SysUser>((l,r,x)=> r.SysEmpId == x.Id)
.Select((l, r,x) => new EmpPosOutput
{
PosId = l.Id,
PosCode = l.Code,
PosName = l.Name,
SysEmpId = x.Id,
SysEmpName = x.Name
}).ToListAsync();
return list;
}
} }

@ -37,13 +37,15 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
private readonly ISysEmpService _sysEmpService; private readonly ISysEmpService _sysEmpService;
private readonly ISysUserDataScopeService _sysUserDataScopeService; private readonly ISysUserDataScopeService _sysUserDataScopeService;
private readonly ISysUserRoleService _sysUserRoleService; private readonly ISysUserRoleService _sysUserRoleService;
private readonly ISysEmpPosService _sysEmpPosService;
public SysUserService(SqlSugarRepository<SysUser> sysUserRep, public SysUserService(SqlSugarRepository<SysUser> sysUserRep,
ISysCacheService sysCacheService, ISysCacheService sysCacheService,
ISysEmpService sysEmpService, ISysEmpService sysEmpService,
ISysUserDataScopeService sysUserDataScopeService, ISysUserDataScopeService sysUserDataScopeService,
ISysUserRoleService sysUserRoleService, ISysUserRoleService sysUserRoleService,
ISysConfigService sysConfigService) ISysConfigService sysConfigService,
ISysEmpPosService sysEmpPosService)
{ {
_sysUserRep = sysUserRep; _sysUserRep = sysUserRep;
_sysCacheService = sysCacheService; _sysCacheService = sysCacheService;
@ -51,6 +53,7 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
_sysUserDataScopeService = sysUserDataScopeService; _sysUserDataScopeService = sysUserDataScopeService;
_sysUserRoleService = sysUserRoleService; _sysUserRoleService = sysUserRoleService;
_sysConfigService = sysConfigService; _sysConfigService = sysConfigService;
_sysEmpPosService = sysEmpPosService;
} }
/// <summary> /// <summary>
@ -597,4 +600,26 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
throw Oops.Bah("没有权限"); throw Oops.Bah("没有权限");
} }
/// <summary>
/// 通过职位获取用户信息
/// </summary>
/// <param name="name"></param>
/// <param name="pos">职位代码 PCDD-调度</param>
/// <returns>返回用户详情</returns>
[HttpGet("/sysUser/QueryUserByPos")]
public async Task<List<EmpPosOutput>> QueryUserByPos([FromQuery] string name, [FromQuery] string pos)
{
if (string.IsNullOrWhiteSpace(pos))
Oops.Oh("没有权限");
var allList = await _sysEmpPosService.GetAllEmpByPos(new List<string> { pos });
if (allList.Count > 0 && !string.IsNullOrWhiteSpace(name))
{
allList = allList.Where(a => a.SysEmpName.Contains(name.Trim())).ToList();
}
return allList;
}
} }

Loading…
Cancel
Save