wanghaomei 9 months ago
commit bfd78ff389

@ -51,5 +51,15 @@ namespace Myshipping.Application.Entity
/// 接收时间 /// 接收时间
/// </summary> /// </summary>
public Nullable<DateTime> REC_TIME { get; set; } public Nullable<DateTime> REC_TIME { get; set; }
/// <summary>
/// 是否未提交VGM
/// </summary>
public bool IS_MISSING { get; set; }
/// <summary>
/// 最晚提交期限
/// </summary>
public Nullable<DateTime> SUBMISSION_DEADLINE { get; set; }
} }
} }

@ -72,5 +72,10 @@ namespace Myshipping.Application
/// 订舱ID /// 订舱ID
/// </summary> /// </summary>
public Nullable<long> BOOKING_ID { get; set; } public Nullable<long> BOOKING_ID { get; set; }
/// <summary>
/// VGM通知类型 VGM_MISSING-VGM未提交VGM_FEEDBACK-VGM回执
/// </summary>
public string TASK_TYPE { get; set; }
} }
} }

@ -139,9 +139,9 @@ namespace Myshipping.Application
MSC_PENDING, MSC_PENDING,
/// <summary> /// <summary>
/// VGM反馈详情 /// VGM回执
/// </summary> /// </summary>
[Description("VGM反馈详情")] [Description("VGM回执")]
VGM_FEEDBACK, VGM_FEEDBACK,
/// <summary> /// <summary>
/// 比对下货纸 /// 比对下货纸
@ -174,6 +174,11 @@ namespace Myshipping.Application
/// Transfer Nomination(预甩货通知) /// Transfer Nomination(预甩货通知)
/// </summary> /// </summary>
[Description("TransferNomination")] [Description("TransferNomination")]
TRANSFER_NOMINATION TRANSFER_NOMINATION,
/// <summary>
/// VGM未提交
/// </summary>
[Description("VGM未提交")]
VGM_MISSING,
} }
} }

@ -965,6 +965,61 @@ namespace Myshipping.Application
return bkOrder.Id; return bkOrder.Id;
} }
// 接收到订舱需求审核后推送东胜
_ = Task.Run(() =>
{
try
{
var body = new
{
Type = recModel.Accept ? "CustOrderStatusAccept" : "CustOrderStatusReject",
Data = new
{
model.BSNO,
BSSTATUS = recModel.Accept ? "已审核" : "已驳回",
BookingOrderId = recModel.Accept ? (long?)model.BookingId : null,
COMMENT = recModel.Accept ? null: recModel.Comment
}
};
var json = body.ToJsonString();
var mqUrl = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "AuditBookingMqUrl")?.Value ?? throw new Exception("需配置接收订舱需求审核后推送东胜MQ连接串[AuditBookingMqUrl]");
const string MqActionExchangeName = "amq.direct";
const string MqActionQueueName = "auditbooking.output.ds";
ConnectionFactory factory = new ConnectionFactory();
factory.Uri = new Uri(mqUrl);
using (IConnection conn = factory.CreateConnection())
using (IModel mqModel = conn.CreateModel())
{
mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct, true);
var queueName = $"{MqActionQueueName}.{model.TenantId}";
mqModel.QueueDeclare(queueName, false, false, false, null);
mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
IBasicProperties props = mqModel.CreateBasicProperties();
props.DeliveryMode = 2;
byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json));
mqModel.BasicPublish(MqActionExchangeName, queueName, props, messageBodyBytes);
conn.Close();
_logger.LogInformation($"接收到订舱需求审核后推送东胜,已发送数据到消息队列【{mqUrl}】,数据内容:【{json}】");
}
}
catch (Exception ex)
{
_logger.LogError(ex, "接收到订舱需求审核后推送东胜时发生异常");
}
});
return 0; return 0;
} }
#endregion #endregion
@ -1448,60 +1503,6 @@ namespace Myshipping.Application
SaveAuditLog($"{(accept ? "" : "")},审核意见:{comment}", id); SaveAuditLog($"{(accept ? "" : "")},审核意见:{comment}", id);
// 订舱需求审核后推送东胜
_ = Task.Run(() =>
{
try
{
var body = new
{
Type = accept ? "CustOrderStatusAccept" : "CustOrderStatusReject",
Data = new
{
model.BSNO,
BSSTATUS = accept ? "已审核" : "已驳回",
BookingOrderId = accept ? jobjRtn.GetLongValue("data") as long? : null
}
};
var json = body.ToJsonString();
var mqUrl = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "AuditBookingMqUrl")?.Value ?? throw new Exception("需配置订舱需求审核后推送东胜MQ连接串[AuditBookingMqUrl]");
const string MqActionExchangeName = "amq.direct";
const string MqActionQueueName = "auditbooking.output.ds";
ConnectionFactory factory = new ConnectionFactory();
factory.Uri = new Uri(mqUrl);
using (IConnection conn = factory.CreateConnection())
using (IModel mqModel = conn.CreateModel())
{
mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct, true);
var queueName = $"{MqActionQueueName}.{model.BookingCompanyId}";
mqModel.QueueDeclare(queueName, false, false, false, null);
mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
IBasicProperties props = mqModel.CreateBasicProperties();
props.DeliveryMode = 2;
byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json));
mqModel.BasicPublish(MqActionExchangeName, queueName, props, messageBodyBytes);
conn.Close();
_logger.LogInformation($"订舱需求审核后推送东胜,已发送数据到消息队列【{mqUrl}】,数据内容:【{json}】");
}
}
catch (Exception ex)
{
_logger.LogError(ex, "订舱需求审核后推送东胜时发生异常");
}
});
//进入订舱台账 //进入订舱台账
if (accept) if (accept)
{ {

@ -2567,12 +2567,13 @@ namespace Myshipping.Application
} }
#endregion #endregion
#region 获取订舱对应的集装箱VGM回执详情
/// <summary> /// <summary>
/// 获取订舱对应的集装箱VGM回执详情 /// 获取订舱对应的集装箱VGM回执详情
/// </summary> /// </summary>
/// <param name="id">订舱ID</param> /// <param name="id">订舱ID</param>
/// <returns>返回VGM明细</returns> /// <returns>返回VGM明细</returns>
[HttpGet("/BookingValueAdded/GetBookingVGMResult")]
public async Task<List<BookingCtnVGMDto>> GetBookingVGMResult(long id) public async Task<List<BookingCtnVGMDto>> GetBookingVGMResult(long id)
{ {
List<BookingCtnVGMDto> list = new List<BookingCtnVGMDto>(); List<BookingCtnVGMDto> list = new List<BookingCtnVGMDto>();
@ -2594,6 +2595,7 @@ namespace Myshipping.Application
return list; return list;
} }
#endregion
} }
public class DateTimeJsonConverter : System.Text.Json.Serialization.JsonConverter<Nullable<DateTime>> public class DateTimeJsonConverter : System.Text.Json.Serialization.JsonConverter<Nullable<DateTime>>

@ -938,6 +938,37 @@ namespace Myshipping.Application
.Map(dest => dest.CtnAll, src => src.CTNALL) .Map(dest => dest.CtnAll, src => src.CTNALL)
.Map(dest => dest.CtnNum, src => src.CTNNUM) .Map(dest => dest.CtnNum, src => src.CTNNUM)
.Map(dest => dest.PKId, src => src.PK_ID); .Map(dest => dest.PKId, src => src.PK_ID);
config.ForType<TaskVGMInfo, TaskVGMDto>()
.Map(dest => dest.PKId, src => src.PK_ID)
.Map(dest => dest.TaskId, src => src.TASK_ID)
.Map(dest => dest.MBlNo, src => src.MBL_NO)
.Map(dest => dest.Carrier, src => src.CARRIER)
.Map(dest => dest.Vessel, src => src.VESSEL)
.Map(dest => dest.Voyno, src => src.VOYNO)
.Map(dest => dest.PortLoad, src => src.PORTLOAD)
.Map(dest => dest.VGMSubmissionDeadLine, src => src.VGM_SUBMISSION_DEADLINE)
.Map(dest => dest.BookedByReference, src => src.BOOKED_BY_REFERENCE)
.Map(dest => dest.CtnStat, src => src.CTN_STAT)
.Map(dest => dest.NoticeDate, src => src.NOTICE_DATE)
.Map(dest => dest.BookingId, src => src.BOOKING_ID)
.Map(dest => dest.TaskType, src => src.TASK_TYPE);
config.ForType<TaskVGMInfo, TaskVGMShowDto>()
.Map(dest => dest.PKId, src => src.PK_ID)
.Map(dest => dest.TaskId, src => src.TASK_ID)
.Map(dest => dest.MBlNo, src => src.MBL_NO)
.Map(dest => dest.Carrier, src => src.CARRIER)
.Map(dest => dest.Vessel, src => src.VESSEL)
.Map(dest => dest.Voyno, src => src.VOYNO)
.Map(dest => dest.PortLoad, src => src.PORTLOAD)
.Map(dest => dest.VGMSubmissionDeadLine, src => src.VGM_SUBMISSION_DEADLINE)
.Map(dest => dest.BookedByReference, src => src.BOOKED_BY_REFERENCE)
.Map(dest => dest.CtnStat, src => src.CTN_STAT)
.Map(dest => dest.NoticeDate, src => src.NOTICE_DATE)
.Map(dest => dest.BookingId, src => src.BOOKING_ID)
.Map(dest => dest.TaskType, src => src.TASK_TYPE);
} }
} }

@ -73,5 +73,11 @@ namespace Myshipping.Application
/// </summary> /// </summary>
public Nullable<long> BookingId { get; set; } public Nullable<long> BookingId { get; set; }
/// <summary>
/// VGM通知类型
/// </summary>
public string TaskType { get; set; }
} }
} }

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class TaskVGMShowDto: TaskVGMDto
{
/// <summary>
/// 箱号
/// </summary>
public string CntrNo { get; set; }
/// <summary>
/// VGM重量
/// </summary>
public Nullable<decimal> VGMWeight { get; set; }
/// <summary>
/// VGM重量单位
/// </summary>
public string VGMWeightUnit { get; set; }
/// <summary>
/// VGM称重方式
/// </summary>
public string VGMWeightMethod { get; set; }
}
}

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.TaskManagePlat.Interface
{
/// <summary>
/// VGM任务
/// </summary>
public interface ITaskManageVGMService
{
/// <summary>
/// 获取VGM成功回执详情
/// </summary>
/// <param name="pkId">BC主键</param>
/// <returns>返回回执</returns>
Task<List<TaskVGMShowDto>> GetVGMSubmissionInfo(string pkId);
/// <summary>
/// 通过任务主键获取VGM成功回执详情
/// </summary>
/// <param name="taskPkId">VGM任务主键</param>
/// <returns>返回回执</returns>
Task<List<TaskVGMShowDto>> GetVGMSubmissionInfoByTaskId(string taskPkId);
/// <summary>
/// 获取VGM未提交详情
/// </summary>
/// <param name="pkId">BC主键</param>
/// <returns>返回回执</returns>
Task<List<TaskVGMShowDto>> GetVGMMissingInfo(string pkId);
/// <summary>
/// 通过任务主键获取VGM未提交详情
/// </summary>
/// <param name="taskPkId">VGM任务主键</param>
/// <returns>返回回执</returns>
Task<List<TaskVGMShowDto>> GetVGMMissingInfoByTaskId(string taskPkId);
}
}

@ -769,6 +769,7 @@ namespace Myshipping.Application
vgmInfo.CreatedUserName = taskInfo.CreatedUserName; vgmInfo.CreatedUserName = taskInfo.CreatedUserName;
vgmInfo.TenantId = taskInfo.TenantId; vgmInfo.TenantId = taskInfo.TenantId;
vgmInfo.TenantName = taskInfo.TenantName; vgmInfo.TenantName = taskInfo.TenantName;
vgmInfo.TASK_TYPE = info.Main.TaskType.ToString();
_taskVGMInfoRepository.InsertAsync(vgmInfo); _taskVGMInfoRepository.InsertAsync(vgmInfo);
@ -813,19 +814,8 @@ namespace Myshipping.Application
var bookingInfo = bookingList.FirstOrDefault(a => var bookingInfo = bookingList.FirstOrDefault(a =>
a.MBLNO.Equals(vgmInfo.MBL_NO, StringComparison.OrdinalIgnoreCase)); a.MBLNO.Equals(vgmInfo.MBL_NO, StringComparison.OrdinalIgnoreCase));
//推送状态 if (bookingInfo != null)
var pushModel = new ModifyServiceProjectStatusDto
{ {
BookingId = bookingInfo.Id,
SourceType = TrackingSourceTypeEnum.AUTO,
StatusCodes = new List<ModifyServiceProjectStatusDetailDto> {
new ModifyServiceProjectStatusDetailDto { StatusCode = "VGMCG" } }
};
var saveStatusRlt = _bookingValueAddedService.SaveServiceStatus(pushModel).GetAwaiter().GetResult();
_logger.LogInformation("请求JSON={json} 异步推送服务状态完成,结果={rlt}", JSON.Serialize(pushModel), JSON.Serialize(saveStatusRlt));
var vgmEntity = _taskVGMInfoRepository.AsQueryable().Filter(null, true) var vgmEntity = _taskVGMInfoRepository.AsQueryable().Filter(null, true)
.First(x => x.PK_ID == vgmInfo.PK_ID && x.IsDeleted == false && x.TenantId == taskInfo.TenantId); .First(x => x.PK_ID == vgmInfo.PK_ID && x.IsDeleted == false && x.TenantId == taskInfo.TenantId);
@ -842,6 +832,21 @@ namespace Myshipping.Application
var ctnList = info.Main.VGMFeedBack var ctnList = info.Main.VGMFeedBack
.FirstOrDefault(x => x.MBlNo.Equals(vgmInfo.MBL_NO, StringComparison.OrdinalIgnoreCase)).CtnList; .FirstOrDefault(x => x.MBlNo.Equals(vgmInfo.MBL_NO, StringComparison.OrdinalIgnoreCase)).CtnList;
if (info.Main.TaskType == TaskBaseTypeEnum.VGM_FEEDBACK)
{
//推送状态
var pushModel = new ModifyServiceProjectStatusDto
{
BookingId = bookingInfo.Id,
SourceType = TrackingSourceTypeEnum.AUTO,
StatusCodes = new List<ModifyServiceProjectStatusDetailDto> {
new ModifyServiceProjectStatusDetailDto { StatusCode = "VGMCG" } }
};
var saveStatusRlt = _bookingValueAddedService.SaveServiceStatus(pushModel).GetAwaiter().GetResult();
_logger.LogInformation("请求JSON={json} 异步推送服务状态完成,结果={rlt}", JSON.Serialize(pushModel), JSON.Serialize(saveStatusRlt));
foreach (var ctn in ctnList) foreach (var ctn in ctnList)
{ {
var bookCtnVGM = ctnVGMList.FirstOrDefault(t => t.CNTRNO.Equals(ctn.CntrNo, StringComparison.OrdinalIgnoreCase)); var bookCtnVGM = ctnVGMList.FirstOrDefault(t => t.CNTRNO.Equals(ctn.CntrNo, StringComparison.OrdinalIgnoreCase));
@ -853,6 +858,8 @@ namespace Myshipping.Application
bookCtnVGM.UpdatedTime = taskInfo.CreatedTime; bookCtnVGM.UpdatedTime = taskInfo.CreatedTime;
bookCtnVGM.UpdatedUserId = taskInfo.CreatedUserId; bookCtnVGM.UpdatedUserId = taskInfo.CreatedUserId;
bookCtnVGM.UpdatedUserName = taskInfo.CreatedUserName; bookCtnVGM.UpdatedUserName = taskInfo.CreatedUserName;
bookCtnVGM.IS_MISSING = false;
bookCtnVGM.SUBMISSION_DEADLINE = null;
_bookingCtnVGMRepository.AsUpdateable(bookCtnVGM).UpdateColumns(x => new _bookingCtnVGMRepository.AsUpdateable(bookCtnVGM).UpdateColumns(x => new
{ {
@ -881,11 +888,50 @@ namespace Myshipping.Application
CreatedUserId = taskInfo.CreatedUserId, CreatedUserId = taskInfo.CreatedUserId,
CreatedUserName = taskInfo.CreatedUserName, CreatedUserName = taskInfo.CreatedUserName,
TenantId = taskInfo.TenantId, TenantId = taskInfo.TenantId,
REC_TIME = vgmInfo.NOTICE_DATE
};
_bookingCtnVGMRepository.Insert(bookingCtnVGM);
}
}
}
else
{
if (ctnList.Count > 0)
{
foreach (var ctn in ctnList)
{
var bookCtnVGM = ctnVGMList.FirstOrDefault(t => t.CNTRNO.Equals(ctn.CntrNo, StringComparison.OrdinalIgnoreCase));
var bookCtn = bookCtnList.FirstOrDefault(t => t.CNTRNO.Equals(ctn.CntrNo, StringComparison.OrdinalIgnoreCase));
if (bookCtnVGM == null)
{
//写入
var bookingCtnVGM = new BookingCtnVGM
{
CNTRNO = ctn.CntrNo,
BILLID = bookingInfo.Id,
VGM_WEIGHT = ctn.VGMWeight,
VGM_WEIGHT_UNIT = ctn.VGMWeightUnit,
VGM_METHOD = ctn.VGMWeightMethod,
IS_MATCH = bookCtn != null,
CreatedTime = taskInfo.CreatedTime,
UpdatedTime = taskInfo.CreatedTime,
CreatedUserId = taskInfo.CreatedUserId,
CreatedUserName = taskInfo.CreatedUserName,
TenantId = taskInfo.TenantId,
REC_TIME = vgmInfo.NOTICE_DATE,
IS_MISSING = true,
SUBMISSION_DEADLINE = vgmInfo.VGM_SUBMISSION_DEADLINE
}; };
_bookingCtnVGMRepository.Insert(bookingCtnVGM); _bookingCtnVGMRepository.Insert(bookingCtnVGM);
} }
} }
}
}
}
}); });
} }

@ -0,0 +1,199 @@
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Myshipping.Application.Entity;
using Myshipping.Application.Service.TaskManagePlat.Interface;
using Myshipping.Core;
using MySqlX.XDevAPI.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// VGM任务
/// </summary>
[ApiDescriptionSettings("Application", Name = "TaskManageVGM", Order = 10)]
public class TaskManageVGMService: ITaskManageVGMService, IDynamicApiController
{
private readonly SqlSugarRepository<TaskVGMInfo> _taskVGMInfoRepository;
private readonly SqlSugarRepository<TaskVGMCtnInfo> _taskVGMCtnInfoRepository;
private readonly SqlSugarRepository<TaskBaseInfo> _taskBaseRepository;
public TaskManageVGMService(SqlSugarRepository<TaskVGMInfo> taskVGMInfoRepository,
SqlSugarRepository<TaskVGMCtnInfo> taskVGMCtnInfoRepository,
SqlSugarRepository<TaskBaseInfo> taskBaseRepository)
{
_taskVGMInfoRepository = taskVGMInfoRepository;
_taskVGMCtnInfoRepository = taskVGMCtnInfoRepository;
_taskBaseRepository = taskBaseRepository;
}
#region 获取VGM成功回执详情
/// <summary>
/// 获取VGM成功回执详情
/// </summary>
/// <param name="pkId">BC主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingMSKAPI/GetVGMSubmissionInfo")]
public async Task<List<TaskVGMShowDto>> GetVGMSubmissionInfo(string pkId)
{
List<TaskVGMShowDto> list = new List<TaskVGMShowDto>();
var vgmOrder = _taskVGMInfoRepository.AsQueryable().First(a => a.PK_ID == pkId);
if (vgmOrder == null)
throw Oops.Oh($"VGM主键{pkId}无法获取业务信息");
var CtnList = _taskVGMCtnInfoRepository.AsQueryable()
.Where(a => a.P_ID == pkId).ToList();
if (CtnList.Count > 0)
{
list = CtnList.OrderBy(p => p.P_ID).ThenBy(p => p.CNTRNO).Select(p =>
{
TaskVGMShowDto model = vgmOrder.Adapt<TaskVGMShowDto>();
model.CntrNo = p.CNTRNO;
model.VGMWeight = p.VGM_WEIGHT;
model.VGMWeightMethod = p.VGM_METHOD;
model.VGMWeightUnit = p.VGM_WEIGHT_UNIT;
return model;
}).ToList();
}
return list;
}
#endregion
#region 通过任务主键获取VGM成功回执详情
/// <summary>
/// 通过任务主键获取VGM成功回执详情
/// </summary>
/// <param name="taskPkId">VGM任务主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingMSKAPI/GetVGMSubmissionInfoByTaskId")]
public async Task<List<TaskVGMShowDto>> GetVGMSubmissionInfoByTaskId(string taskPkId)
{
List<TaskVGMShowDto> list = new List<TaskVGMShowDto>();
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId);
if (taskBase == null)
throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息");
var vgmOrder = _taskVGMInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID);
if (vgmOrder == null)
throw Oops.Oh($"任务主键{taskPkId}无法获取VGM信息");
var CtnList = _taskVGMCtnInfoRepository.AsQueryable()
.Where(a => a.P_ID == vgmOrder.PK_ID).ToList();
if (CtnList.Count > 0)
{
list = CtnList.OrderBy(p => p.P_ID).ThenBy(p => p.CNTRNO).Select(p =>
{
TaskVGMShowDto model = vgmOrder.Adapt<TaskVGMShowDto>();
model.CntrNo = p.CNTRNO;
model.VGMWeight = p.VGM_WEIGHT;
model.VGMWeightMethod = p.VGM_METHOD;
model.VGMWeightUnit = p.VGM_WEIGHT_UNIT;
return model;
}).ToList();
}
return list;
}
#endregion
#region 获取VGM未提交详情
/// <summary>
/// 获取VGM未提交详情
/// </summary>
/// <param name="pkId">BC主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingMSKAPI/GetVGMMissingInfo")]
public async Task<List<TaskVGMShowDto>> GetVGMMissingInfo(string pkId)
{
List<TaskVGMShowDto> list = new List<TaskVGMShowDto>();
var vgmOrder = _taskVGMInfoRepository.AsQueryable().First(a => a.PK_ID == pkId);
if (vgmOrder == null)
throw Oops.Oh($"VGM主键{pkId}无法获取业务信息");
var CtnList = _taskVGMCtnInfoRepository.AsQueryable()
.Where(a => a.P_ID == pkId).ToList();
if (CtnList.Count > 0)
{
list = CtnList.OrderBy(p => p.P_ID).ThenBy(p => p.CNTRNO).Select(p =>
{
TaskVGMShowDto model = vgmOrder.Adapt<TaskVGMShowDto>();
model.CntrNo = p.CNTRNO;
model.VGMWeight = p.VGM_WEIGHT;
model.VGMWeightMethod = p.VGM_METHOD;
model.VGMWeightUnit = p.VGM_WEIGHT_UNIT;
return model;
}).ToList();
}
return list;
}
#endregion
#region 通过任务主键获取VGM未提交详情
/// <summary>
/// 通过任务主键获取VGM未提交详情
/// </summary>
/// <param name="taskPkId">VGM任务主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingMSKAPI/GetVGMMissingInfoByTaskId")]
public async Task<List<TaskVGMShowDto>> GetVGMMissingInfoByTaskId(string taskPkId)
{
List<TaskVGMShowDto> list = new List<TaskVGMShowDto>();
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId);
if (taskBase == null)
throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息");
var vgmOrder = _taskVGMInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID);
if (vgmOrder == null)
throw Oops.Oh($"任务主键{taskPkId}无法获取VGM信息");
var CtnList = _taskVGMCtnInfoRepository.AsQueryable()
.Where(a => a.P_ID == vgmOrder.PK_ID).ToList();
if (CtnList.Count > 0)
{
list = CtnList.OrderBy(p => p.P_ID).ThenBy(p => p.CNTRNO).Select(p =>
{
TaskVGMShowDto model = vgmOrder.Adapt<TaskVGMShowDto>();
model.CntrNo = p.CNTRNO;
model.VGMWeight = p.VGM_WEIGHT;
model.VGMWeightMethod = p.VGM_METHOD;
model.VGMWeightUnit = p.VGM_WEIGHT_UNIT;
return model;
}).ToList();
}
return list;
}
#endregion
}
}
Loading…
Cancel
Save