wet 2 years ago
commit 08c804cb46

@ -858,19 +858,22 @@ namespace Myshipping.Application.Entity
public string LineManageID { get; set; }
/// <summary>
/// 最后下货纸比对状态 NO_DIFF-无异常;DIFF-有;NO_YARD-无场站数据;EXPT-异常
/// 最后下货纸比对状态 NO_DIFF-无异常;DIFF-有异;NO_YARD-无场站数据;EXPT-异常
/// </summary>
public string LstShipOrderCompareRlt { get; set; }
/// <summary>
/// 最后下货纸比对时间
/// </summary>
public string LstShipOrderCompareDate { get; set; }
public Nullable<DateTime> LstShipOrderCompareDate { get; set; }
/// <summary>
/// 最后下货纸比对批次号
/// </summary>
public string LstShipOrderCompareId { get; set; }
/// <summary>
/// 最后下货纸比对状态 NO_DIFF-无异常;DIFF-有差异;NO_YARD-无场站数据;EXPT-异常
/// </summary>
public string LstShipOrderCompareRltName { get; set; }
}
}

@ -115,7 +115,7 @@ namespace Myshipping.Application.Entity
/// 工厂ID
/// </summary>
[Description("工厂ID")]
public string FactoryId { get; set; }
public Nullable<long> FactoryId { get; set; }
/// <summary>
/// 工厂代码
/// </summary>
@ -200,7 +200,7 @@ namespace Myshipping.Application.Entity
/// 调度ID
/// </summary>
[Description("调度ID")]
public string DispatcherId { get; set; }
public Nullable<long> DispatcherId { get; set; }
/// <summary>
/// 调度名称
/// </summary>

@ -48,7 +48,7 @@ namespace Myshipping.Application.Helper
}
var yardMappings = await cacheService.GetAllMappingYard();
var ym = yardMappings.FirstOrDefault(x => x.Code == yardid && x.Module == "BillTrace");
var ym = yardMappings.FirstOrDefault(x => x.Code.ToLower() == yardid.ToLower() && x.Module == "BillTrace");
if (ym == null)
{
return new KeyValuePair<bool, string>(false, $"场站代号配置未找到:{yardid}");

@ -32,16 +32,23 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingTruck> _bookingTruckRepository;
private readonly SqlSugarRepository<BookingTruckCtn> _bookingTruckContaRepository;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository;
public BookingTruckService(ISysCacheService cache, ILogger<BookingTruckService> logger,
SqlSugarRepository<BookingTruck> bookingTruckRepository,
SqlSugarRepository<BookingTruckCtn> bookingTruckContaRepository)
SqlSugarRepository<BookingTruckCtn> bookingTruckContaRepository,
SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BookingCtn> bookingCtnRepository)
{
_cache = cache;
_logger = logger;
_bookingTruckRepository = bookingTruckRepository;
_bookingTruckContaRepository = bookingTruckContaRepository;
_bookingOrderRepository = bookingOrderRepository;
_bookingCtnRepository = bookingCtnRepository;
}
/// <summary>
@ -49,15 +56,266 @@ namespace Myshipping.Application
/// </summary>
/// <param name="info">派车信息</param>
/// <returns>返回回执</returns>
[HttpPost("/BookingTruck/Save")]
public async Task<TaskManageOrderResultDto> Save(BookingTruckDto info)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
BookingTruck entity = info.Adapt<BookingTruck>();
if(entity == null)
throw Oops.Oh($"派车信息不能为空");
List<BookingTruckCtn> entityCtnList = info.ContaList.Adapt<List<BookingTruckCtn>>();
if (entity.Id == 0)
{
_bookingTruckRepository.Insert(entity);
if (entityCtnList.Count > 0)
{
entityCtnList.ForEach(async ctn =>
{
ctn.TruckId = entity.Id;
await _bookingTruckContaRepository.InsertAsync(ctn);
});
}
}
else
{
await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new
{
it.TenantId,
it.CreatedTime,
it.CreatedUserId,
it.CreatedUserName,
it.IsDeleted,
it.BookingId,
it.TruckId,
it.TruckName,
it.TruckCode,
}).ExecuteCommandAsync();
if (entityCtnList.Count > 0)
{
entityCtnList.ForEach(async ctn =>
{
ctn.TruckId = entity.Id;
await _bookingTruckContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new
{
it.TenantId,
it.CreatedTime,
it.CreatedUserId,
it.CreatedUserName,
it.IsDeleted,
}).ExecuteCommandAsync();
});
}
}
result.succ = true;
result.msg = "保存成功";
result.ext = entity.Id;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"保存派车异常,原因:{ex.Message}";
}
return result;
}
/// <summary>
/// 获取派车详情
/// </summary>
/// <param name="id">派车主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingTruck/GetInfo")]
public async Task<TaskManageOrderResultDto> GetInfo(long id)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var truckOrder = _bookingTruckRepository.AsQueryable().First(a => a.Id == id);
if (truckOrder == null)
throw Oops.Oh($"派车主键{id}无法获取业务信息");
var truckCtnList = _bookingTruckContaRepository.AsQueryable().Where(a => a.TruckId == id).ToList();
BookingTruckShowDto model = truckOrder.Adapt<BookingTruckShowDto>();
if (truckCtnList.Count > 0)
model.ContaList = truckCtnList.Adapt<List<BookingTruckCtnDto>>();
result.succ = true;
result.ext = model;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"获取派车详情异常,原因:{ex.Message}";
}
catch(Exception ex)
return result;
}
/// <summary>
/// 订舱生成派车初始信息
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回派车初始信息</returns>
[HttpGet("/BookingTruck/InitFromBookingOrder")]
public async Task<TaskManageOrderResultDto> InitFromBookingOrder(long bookingId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var model = InnerCreateTruckFromBookingOrder(bookingId);
result.succ = true;
result.ext = model;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"订舱生成派车初始信息异常,原因:{ex.Message}";
}
return result;
}
private BookingTruckDto InnerCreateTruckFromBookingOrder(long bookingId)
{
BookingTruckDto model = null;
//取订舱主信息
var orderInfo = _bookingOrderRepository.AsQueryable()
.First(a => a.Id == bookingId);
if (orderInfo == null)
throw Oops.Oh($"订舱主键{bookingId}无法获取业务信息");
model = new BookingTruckDto();
model.YARDID = orderInfo.YARDID;
model.YARD = orderInfo.YARD;
model.ClosingTime = orderInfo.CLOSINGDATE;
model.InYardID = orderInfo.YARDID;
model.InYard = orderInfo.YARD;
model.FromName = UserManager.Name;
model.FromTel = UserManager.TEl;
model.FromMail = UserManager.Email;
if (orderInfo.KGS.HasValue)
{
//计算总吨数
model.KGS = Math.Round(orderInfo.KGS.Value / 1000m, 3);
}
//取订舱箱列表
var ctnList = _bookingCtnRepository.AsQueryable()
.Where(a => a.BILLID == bookingId).ToList();
if (ctnList.Count > 0)
{
model.ContaList = new List<BookingTruckCtnDto>();
ctnList.ForEach(b =>
{
if (b.CTNNUM == 1)
{
model.ContaList.Add(new BookingTruckCtnDto
{
CTNCODE = b.CTNCODE,
CTNALL = b.CTNALL,
KGS = b.KGS,
PKGS = b.PKGS,
CBM = b.CBM,
TAREWEIGHT = b.TAREWEIGHT,
CNTRNO = b.CNTRNO,
KINDPKGS = b.KINDPKGS,
SEALNO = b.SEALNO,
TEU = b.TEU,
CTNNUM = b.CTNNUM,
});
}
else
{
for (int i = 0; i < b.CTNNUM; i++)
{
model.ContaList.Add(new BookingTruckCtnDto
{
CTNCODE = b.CTNCODE,
CTNALL = b.CTNALL,
KGS = b.KGS,
PKGS = b.PKGS,
CBM = b.CBM,
TAREWEIGHT = b.TAREWEIGHT,
CNTRNO = b.CNTRNO,
KINDPKGS = b.KINDPKGS,
SEALNO = b.SEALNO,
TEU = b.TEU,
CTNNUM = b.CTNNUM,
});
}
}
});
}
return model;
}
/// <summary>
/// 引入订舱详情生成派车信息
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回派车初始信息</returns>
[HttpGet("/BookingTruck/PullInBookingOrder")]
public async Task<TaskManageOrderResultDto> PullInBookingOrder(long bookingId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var model = InnerCreateTruckFromBookingOrder(bookingId);
result.succ = true;
result.ext = model;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"引入订舱详情生成派车信息异常,原因:{ex.Message}";
}
return result;
}
/// <summary>
/// 引入订舱集装箱详情生成派车信息
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回派车集装箱初始信息</returns>
[HttpGet("/BookingTruck/PullInBookingOrderConta")]
public async Task<TaskManageOrderResultDto> PullInBookingOrderConta(long bookingId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
}
catch (Exception ex)
{
}
@ -70,6 +328,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="info">派车信息</param>
/// <returns>返回回执</returns>
[HttpPost("/BookingTruck/Submit")]
public async Task<TaskManageOrderResultDto> Submit(BookingTruckDto info)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -91,7 +350,8 @@ namespace Myshipping.Application
/// </summary>
/// <param name="ids">派车主键组</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SubmitBatch(long[] ids)
[HttpPost("/BookingTruck/SubmitBatch")]
public async Task<TaskManageOrderResultDto> SubmitBatch([FromBody] long[] ids)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -112,6 +372,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="id">派车主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingTruck/Cancel")]
public async Task<TaskManageOrderResultDto> Cancel(long id)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -133,7 +394,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="ids">派车主键组</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelBatch(long[] ids)
public async Task<TaskManageOrderResultDto> CancelBatch([FromBody] long[] ids)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -154,6 +415,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="id">派车主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingTruck/Print")]
public async Task<TaskManageOrderResultDto> Print(long id)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -175,7 +437,8 @@ namespace Myshipping.Application
/// </summary>
/// <param name="ids">派车主键组</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SendDispatchBatch(long[] ids)
[HttpPost("/BookingTruck/SendDispatchBatch")]
public async Task<TaskManageOrderResultDto> SendDispatchBatch([FromBody] long[] ids)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -196,6 +459,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="id">派车主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingTruck/CancelDispatch")]
public async Task<TaskManageOrderResultDto> CancelDispatch(long id)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -217,7 +481,8 @@ namespace Myshipping.Application
/// </summary>
/// <param name="ids">派车主键组</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelDispatchBatch(long[] ids)
[HttpPost("/BookingTruck/CancelDispatchBatch")]
public async Task<TaskManageOrderResultDto> CancelDispatchBatch([FromBody] long[] ids)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -233,20 +498,8 @@ namespace Myshipping.Application
return result;
}
public async Task<TaskManageOrderResultDto> GetInfo(long id)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
}
catch (Exception ex)
{
}
return result;
}
}
}

@ -99,7 +99,7 @@ namespace Myshipping.Application
/// <summary>
/// 工厂ID
/// </summary>
public string FactoryId { get; set; }
public Nullable<long> FactoryId { get; set; }
/// <summary>
/// 工厂代码
/// </summary>
@ -167,7 +167,7 @@ namespace Myshipping.Application
/// <summary>
/// 调度ID
/// </summary>
public string DispatcherId { get; set; }
public Nullable<long> DispatcherId { get; set; }
/// <summary>
/// 调度名称
/// </summary>

@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
///
/// </summary>
public class BookingTruckShowDto
{
/// <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>
public List<BookingTruckCtnDto> ContaList { get; set; }
}
}

@ -18,6 +18,28 @@ namespace Myshipping.Application
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> Save(BookingTruckDto info);
/// <summary>
/// 订舱生成派车初始信息
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回派车初始信息</returns>
Task<TaskManageOrderResultDto> InitFromBookingOrder(long bookingId);
/// <summary>
/// 引入订舱详情生成派车信息
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回派车初始信息</returns>
Task<TaskManageOrderResultDto> PullInBookingOrder(long bookingId);
/// <summary>
/// 引入订舱集装箱详情生成派车信息
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回派车集装箱初始信息</returns>
Task<TaskManageOrderResultDto> PullInBookingOrderConta(long bookingId);
/// <summary>
/// 获取派车详情
/// </summary>

@ -54,6 +54,11 @@ namespace Myshipping.Application
/// </summary>
public string OrigPKId { get; set; }
/// <summary>
/// 比对ID
/// </summary>
public string TaskCompareId { get; set; }
/// <summary>
/// 原数据主单号
/// </summary>

@ -130,6 +130,43 @@ namespace Myshipping.Application
if (compareResult == null)
throw Oops.Oh($"订舱主键{bookingId}请求下货纸比对失败,返回为空");
var orderInfo = _bookingOrderRepository.AsQueryable().First(x => x.Id == long.Parse(bookingId));
if(orderInfo != null)
{
if(compareResult.succ)
{
if (compareResult.extra.IsExistsDiff)
{
orderInfo.LstShipOrderCompareRlt = "DIFF";
orderInfo.LstShipOrderCompareRltName = "有差异";
}
else
{
orderInfo.LstShipOrderCompareRlt = "NO_DIFF";
orderInfo.LstShipOrderCompareRltName = "正常";
}
orderInfo.LstShipOrderCompareDate = bDate;
}
else
{
orderInfo.LstShipOrderCompareRlt = "NO_YARD";
orderInfo.LstShipOrderCompareRltName = "无动态";
}
orderInfo.LstShipOrderCompareId = compareResult.extra.TaskCompareId;
//更新
await _bookingOrderRepository.AsUpdateable(orderInfo).UpdateColumns(it => new
{
it.LstShipOrderCompareId,
it.LstShipOrderCompareDate,
it.LstShipOrderCompareRlt,
}).ExecuteCommandAsync();
}
result.succ = compareResult.succ;
result.msg = compareResult.msg;
result.extra = compareResult.extra;

Loading…
Cancel
Save