You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
200 lines
7.1 KiB
C#
200 lines
7.1 KiB
C#
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
|
|
}
|
|
}
|