修改派车,新增台账查询

optimize
jianghaiqing 2 years ago
parent 812c17cc9b
commit 89d6d6d3d8

@ -206,5 +206,10 @@ namespace Myshipping.Application.Entity
/// </summary>
[Description("调度名称")]
public string DispatcherName { get; set; }
/// <summary>
/// 派车流水号
/// </summary>
[Description("派车流水号")]
public string TruckFlowNo { get; set; }
}
}

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 派车状态枚举
/// </summary>
public enum BookingTruckStatus
{
/// <summary>
/// 暂存
/// </summary>
[Description("暂存")]
TEMP,
/// <summary>
/// 已提交
/// </summary>
[Description("已提交")]
SUBMITED,
/// <summary>
/// 已撤销
/// </summary>
[Description("已撤销")]
CANCELED,
/// <summary>
/// 已发派车
/// </summary>
[Description("已撤销")]
SEND_DISPATCH,
/// <summary>
/// 已撤销派车
/// </summary>
[Description("已撤销")]
CANCEL_DISPATCH
}
}

@ -9,6 +9,7 @@ using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Application.Helper;
using Myshipping.Core;
using Myshipping.Core.Entity;
using Myshipping.Core.Service;
@ -17,6 +18,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Myshipping.Application
@ -193,6 +195,163 @@ namespace Myshipping.Application
return result;
}
/// <summary>
/// 派车台账查询
/// </summary>
/// <param name="QuerySearch">派车台账查询请求</param>
/// <returns>返回结果</returns>
[HttpPost("/BookingTruck/GetPage")]
public async Task<SqlSugarPagedList<BookingTruckPageDto>> GetPageAsync([FromBody] QueryBookingTruckDto QuerySearch)
{
List<string> contaList = new List<string>();
if (!string.IsNullOrWhiteSpace(QuerySearch.ContaNo))
{
if (Regex.IsMatch(QuerySearch.ContaNo, "(\\t|\\n\\r|\\n)"))
{
contaList = Regex.Replace(QuerySearch.ContaNo, "(\\t |\\n\\r |\\n)", "#").Split(new char[] { '#' }).Select(t => t?.Trim()).ToList();
}
else
{
contaList.Add(QuerySearch.ContaNo.Trim());
}
}
//制单日期
DateTime createBegin = DateTime.MinValue;
DateTime createEnd = DateTime.MinValue;
//派车日期
DateTime truckDateBegin = DateTime.MinValue;
DateTime truckDateEnd = DateTime.MinValue;
//截单日期
DateTime closeDateBegin = DateTime.MinValue;
DateTime closeDateEnd = DateTime.MinValue;
//提货日期
DateTime pickUpTimeBegin = DateTime.MinValue;
DateTime pickUpTimeEnd = DateTime.MinValue;
//返场时间
DateTime returnTimeBegin = DateTime.MinValue;
DateTime returnTimeEnd = DateTime.MinValue;
//要求到达时间
DateTime needArriveTimeBegin = DateTime.MinValue;
DateTime needArriveTimeEnd = DateTime.MinValue;
#region 查询条件
//制单日期
if (!string.IsNullOrWhiteSpace(QuerySearch.CreateBegin))
{
if (!DateTime.TryParse(QuerySearch.CreateBegin, out createBegin))
throw Oops.Oh($"创建起始日期格式错误,{QuerySearch.CreateBegin}");
}
if (!string.IsNullOrWhiteSpace(QuerySearch.CreateEnd))
{
if (!DateTime.TryParse(QuerySearch.CreateEnd, out createEnd))
throw Oops.Oh($"创建结束日期格式错误,{QuerySearch.CreateEnd}");
createEnd = createEnd.AddDays(1);
}
//派车日期
if (!string.IsNullOrWhiteSpace(QuerySearch.TruckTimeBegin))
{
if (!DateTime.TryParse(QuerySearch.TruckTimeBegin, out truckDateBegin))
throw Oops.Oh($"派车起始日期格式错误,{QuerySearch.TruckTimeBegin}");
}
if (!string.IsNullOrWhiteSpace(QuerySearch.TruckTimeEnd))
{
if (!DateTime.TryParse(QuerySearch.TruckTimeEnd, out truckDateEnd))
throw Oops.Oh($"派车结束日期格式错误,{QuerySearch.TruckTimeEnd}");
truckDateEnd = truckDateEnd.AddDays(1);
}
//截单日期
if (!string.IsNullOrWhiteSpace(QuerySearch.ClosingTimeBegin))
{
if (!DateTime.TryParse(QuerySearch.ClosingTimeBegin, out closeDateBegin))
throw Oops.Oh($"截单起始日期格式错误,{QuerySearch.ClosingTimeBegin}");
}
if (!string.IsNullOrWhiteSpace(QuerySearch.ClosingTimeEnd))
{
if (!DateTime.TryParse(QuerySearch.ClosingTimeEnd, out closeDateEnd))
throw Oops.Oh($"截单结束日期格式错误,{QuerySearch.ClosingTimeEnd}");
closeDateEnd = closeDateEnd.AddDays(1);
}
//提货日期
if (!string.IsNullOrWhiteSpace(QuerySearch.PickUpTimeBegin))
{
if (!DateTime.TryParse(QuerySearch.PickUpTimeBegin, out pickUpTimeBegin))
throw Oops.Oh($"提货起始日期格式错误,{QuerySearch.PickUpTimeBegin}");
}
if (!string.IsNullOrWhiteSpace(QuerySearch.PickUpTimeEnd))
{
if (!DateTime.TryParse(QuerySearch.ClosingTimeEnd, out pickUpTimeEnd))
throw Oops.Oh($"提货结束日期格式错误,{QuerySearch.PickUpTimeEnd}");
pickUpTimeEnd = pickUpTimeEnd.AddDays(1);
}
//返场时间
if (!string.IsNullOrWhiteSpace(QuerySearch.ReturnTimeBegin))
{
if (!DateTime.TryParse(QuerySearch.ReturnTimeBegin, out returnTimeBegin))
throw Oops.Oh($"返场起始日期格式错误,{QuerySearch.ReturnTimeBegin}");
}
if (!string.IsNullOrWhiteSpace(QuerySearch.ReturnTimeEnd))
{
if (!DateTime.TryParse(QuerySearch.ReturnTimeEnd, out returnTimeEnd))
throw Oops.Oh($"返场结束日期格式错误,{QuerySearch.ReturnTimeEnd}");
returnTimeEnd = returnTimeEnd.AddDays(1);
}
//要求到达时间
if (!string.IsNullOrWhiteSpace(QuerySearch.NeedArriveTimeBegin))
{
if (!DateTime.TryParse(QuerySearch.NeedArriveTimeBegin, out needArriveTimeBegin))
throw Oops.Oh($"返场起始日期格式错误,{QuerySearch.NeedArriveTimeBegin}");
}
if (!string.IsNullOrWhiteSpace(QuerySearch.NeedArriveTimeEnd))
{
if (!DateTime.TryParse(QuerySearch.NeedArriveTimeEnd, out needArriveTimeEnd))
throw Oops.Oh($"返场结束日期格式错误,{QuerySearch.NeedArriveTimeEnd}");
needArriveTimeEnd = needArriveTimeEnd.AddDays(1);
}
#endregion
string entityOrderCol = "CreatedTime";
//这里因为返回给前端的台账数据是DTO所以这里排序时候需要转换成Entity对应的字段
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
entityOrderCol = MapsterExtHelper.GetAdaptProperty<BookingTruckDto, BookingTruck>(QuerySearch.SortField);
var entities = await _bookingTruckRepository.AsQueryable()
.WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin)
.WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value < createEnd)
.WhereIF(truckDateBegin != DateTime.MinValue, t => t.TruckTime.HasValue && t.TruckTime.Value >= truckDateBegin)
.WhereIF(truckDateEnd != DateTime.MinValue, t => t.TruckTime.HasValue && t.TruckTime.Value < truckDateEnd)
.WhereIF(closeDateBegin != DateTime.MinValue, t => t.ClosingTime.HasValue && t.ClosingTime.Value >= closeDateBegin)
.WhereIF(closeDateEnd != DateTime.MinValue, t => t.ClosingTime.HasValue && t.ClosingTime.Value < closeDateEnd)
.WhereIF(pickUpTimeBegin != DateTime.MinValue, t => t.PickUpTime.HasValue && t.PickUpTime.Value >= pickUpTimeBegin)
.WhereIF(pickUpTimeEnd != DateTime.MinValue, t => t.PickUpTime.HasValue && t.PickUpTime.Value < pickUpTimeEnd)
.WhereIF(returnTimeBegin != DateTime.MinValue, t => t.ReturnTime.HasValue && t.ReturnTime.Value >= returnTimeBegin)
.WhereIF(returnTimeEnd != DateTime.MinValue, t => t.ReturnTime.HasValue && t.ReturnTime.Value < returnTimeEnd)
.WhereIF(needArriveTimeBegin != DateTime.MinValue, t => t.NeedArriveTime.HasValue && t.NeedArriveTime.Value >= needArriveTimeBegin)
.WhereIF(needArriveTimeEnd != DateTime.MinValue, t => t.NeedArriveTime.HasValue && t.NeedArriveTime.Value < needArriveTimeEnd)
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.Yard), t => t.YARDID.Contains(QuerySearch.Yard) || t.YARD.Contains(QuerySearch.Yard))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.InYard), t => t.InYardID.Contains(QuerySearch.Yard) || t.InYard.Contains(QuerySearch.Yard))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.Status), t => t.Status == QuerySearch.Status)
.OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc "))
.ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
return entities.Adapt<SqlSugarPagedList<BookingTruckPageDto>>();
}
private BookingTruckDto InnerCreateTruckFromBookingOrder(long bookingId)
{
BookingTruckDto model = null;

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
///
/// </summary>
public class BookingTruckPageDto: BookingTruckShowBaseDto
{
}
}

@ -0,0 +1,171 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
///
/// </summary>
public class BookingTruckShowBaseDto
{
/// <summary>
/// 主键
/// </summary>
public long Id { 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 Status { 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; }
}
}

@ -9,164 +9,9 @@ namespace Myshipping.Application
/// <summary>
///
/// </summary>
public class BookingTruckShowDto
public class BookingTruckShowDto: BookingTruckShowBaseDto
{
/// <summary>
/// 主键
/// </summary>
public long Id { 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 Status { 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>

@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 派车台账查询
/// </summary>
public class QueryBookingTruckDto: QueryTaskManageBaseDto
{
/// <summary>
/// 派车单号
/// </summary>
public int TruckFlowNo { get; set; }
/// <summary>
/// 创建日期起始
/// </summary>
/// <example></example>
public string CreateBegin { get; set; }
/// <summary>
/// 创建日期结束
/// </summary>
/// <example></example>
public string CreateEnd { get; set; }
/// <summary>
/// 支付方式
/// </summary>
public string PayMethod { get; set; }
/// <summary>
/// 派车日期起始
/// </summary>
public string TruckTimeBegin { get; set; }
/// <summary>
/// 派车日期结束
/// </summary>
public string TruckTimeEnd { get; set; }
/// <summary>
/// 返场时间起始
/// </summary>
public string ReturnTimeBegin { get; set; }
/// <summary>
/// 返场时间结束
/// </summary>
public string ReturnTimeEnd { get; set; }
/// <summary>
/// 要求到达时间起始
/// </summary>
public string NeedArriveTimeBegin { get; set; }
/// <summary>
/// 要求到达时间结束
/// </summary>
public string NeedArriveTimeEnd { get; set; }
/// <summary>
/// 截港日期起始
/// </summary>
public string ClosingTimeBegin { get; set; }
/// <summary>
/// 截港日期结束
/// </summary>
public string ClosingTimeEnd { get; set; }
/// <summary>
/// 提货日期起始
/// </summary>
public string PickUpTimeBegin { get; set; }
/// <summary>
/// 提货日期结束
/// </summary>
public string PickUpTimeEnd { get; set; }
/// <summary>
/// 车队ID
/// </summary>
public Nullable<long> TruckId { get; set; }
/// <summary>
/// 集装箱号
/// </summary>
public string ContaNo { get; set; }
/// <summary>
/// 工厂ID
/// </summary>
public Nullable<long> FactoryId { get; set; }
/// <summary>
/// 提箱场站代码
/// </summary>
public string Yard { get; set; }
/// <summary>
/// 入货场站代码
/// </summary>
public string InYard { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
}
}

@ -1,4 +1,5 @@
using System;
using Myshipping.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -40,6 +41,13 @@ namespace Myshipping.Application
/// <returns>返回派车集装箱初始信息</returns>
Task<TaskManageOrderResultDto> PullInBookingOrderConta(long bookingId);
/// <summary>
/// 派车台账查询
/// </summary>
/// <param name="QuerySearch">派车台账查询请求</param>
/// <returns>返回结果</returns>
Task<SqlSugarPagedList<BookingTruckPageDto>> GetPageAsync(QueryBookingTruckDto QuerySearch);
/// <summary>
/// 获取派车详情
/// </summary>

Loading…
Cancel
Save