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.

371 lines
14 KiB
C#

using Azure.Storage.Blobs.Models;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.DjyServiceStatus;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Interface;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Owin.Security.Provider;
using Org.BouncyCastle.Crypto;
using SqlSugar;
namespace DS.WMS.OpApi.Controllers
{
/// <summary>
/// 舱位管理
/// </summary>
public class BookingSlotServiceController : ApiController
{
private readonly IBookingSlotService _bookingSlotService;
public BookingSlotServiceController(IBookingSlotService bookingSlotService)
{
_bookingSlotService = bookingSlotService;
}
#region 舱位接收保存、取消接口
/// <summary>
/// 舱位接收保存、取消接口
/// </summary>
/// <param name="jsonData">请求详情(JSON)</param>
/// <param name="file">BC附件</param>
/// <param name="modifyFile">BC修改附件</param>
/// <returns></returns>
[HttpPost]
[Route("ApiReceive")]
public async Task<DataResult<long>> ApiReceive(string jsonData, IFormFile file = null, IFormFile modifyFile = null)
{
return await _bookingSlotService.ApiReceive(jsonData, file, modifyFile);
}
#endregion
#region 获取舱位详情
/// <summary>
/// 获取舱位详情
/// </summary>
/// <param name="id">舱位ID</param>
/// <returns>返回详情</returns>
[HttpGet]
[Route("Detail")]
public async Task<DataResult<BookingSlotBaseSaveOutput>> Detail(long id)
{
return await _bookingSlotService.Detail(id);
}
#endregion
#region 查询可用的舱位及箱子列表
/// <summary>
/// 查询可用的舱位及箱子列表
/// </summary>
/// <param name="slotInput">筛选条件1舱位信息、箱型</param>
/// <param name="slotIdListInput">筛选条件2舱位主键列表</param>
/// <param name="pageInfo">筛选条件3分页</param>
/// <returns>可用的舱位列表(含可用的箱子列表)</returns>
4 months ago
[HttpGet]
[Route("GetAvailableSlots")]
public async Task<DataResult<List<BookingSlotBaseWithCtnDto>>> GetAvailableSlots(BookingSlotBaseDto slotInput = null,
List<long> slotIdListInput = null,
PageWithTotal pageInfo = null)
{
return await _bookingSlotService.GetAvailableSlots(slotInput, slotIdListInput, pageInfo);
}
#endregion
#region 检查指定订舱记录,是否可以引入舱位列表
/// <summary>
/// 检查指定订舱记录,是否可以引入舱位列表
/// </summary>
/// <param name="slots">待引入的舱位列表</param>
/// <param name="bookingOrderId">待关联的订舱记录</param>
/// <returns>(指定订舱记录是否已经引入过舱位数据,现有舱位及箱子是否满足需求,提示信息)</returns>
[HttpPost]
[Route("CheckImportSlots")]
public async Task<(bool isExists, bool isEnough, string message)> CheckImportSlots(List<BookingSlotBaseWithCtnDto> slots, long bookingOrderId)
{
return await _bookingSlotService.CheckImportSlots(slots, bookingOrderId);
}
#endregion
#region 为指定订舱记录引入舱位信息
/// <summary>
/// 为指定订舱记录引入舱位信息
/// </summary>
/// <param name="slots">待引入的舱位列表</param>
/// <param name="bookingOrderId">待关联的订舱记录</param>
/// <param name="isCheck">是否进行剩余量检查</param>
/// <param name="generateModel">额外的用于生成管理记录的信息</param>
/// <returns>(是否成功,提示消息)</returns>
[HttpPost]
[Route("ImportSlots")]
public async Task<(bool isSuccess, string message)> ImportSlots(List<BookingSlotBaseWithCtnDto> slots, long bookingOrderId, bool isCheck, BookingGenerateDto generateModel = null)
{
return await _bookingSlotService.ImportSlots(slots, bookingOrderId, isCheck, generateModel);
}
#endregion
#region 舱位库存台账
/// <summary>
/// 舱位库存台账
/// </summary>
/// <param name="input">请求参数</param>
/// <returns>返回列表</returns>
[HttpPost]
[Route("PageStock")]
public async Task<dynamic> PageStock([FromBody] BookingSlotStockPageInput input)
{
return await _bookingSlotService.PageStock(input);
}
#endregion
#region 舱位库存刷新
/// <summary>
/// 舱位库存刷新
/// </summary>
/// <param name="input">请求参数</param>
/// <returns>返回列表</returns>
[HttpPost]
[Route("RefreshStock")]
public async Task RefreshStock([FromBody] BookingSlotStockUpdateModel input)
{
await _bookingSlotService.RefreshStock(input);
}
#endregion
#region 保存舱位
/// <summary>
/// 保存舱位
/// </summary>
/// <param name="input">舱位详情</param>
/// <returns>返回输出</returns>
[HttpPost]
[Route("Save")]
public async Task<DataResult<BookingSlotBaseSaveOutput>> Save([FromBody] BookingSlotBaseSaveInput input)
{
return await _bookingSlotService.Save(input);
}
#endregion
#region 获取附件
/// <summary>
/// 获取附件
/// </summary>
/// <param name="id">舱位主键</param>
/// <returns>返回附件列表</returns>
[HttpGet]
[Route("GetFile")]
public async Task<DataResult<List<OpFileRes>>> GetFile(long id)
{
return await _bookingSlotService.GetFile(id);
}
#endregion
#region 分页查询订舱舱位
/// <summary>
/// 分页查询订舱舱位
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("Page")]
public async Task<dynamic> Page([FromBody] BookingSlotBasePageInput input)
{
return await _bookingSlotService.Page(input);
}
#endregion
#region 舱位接收保存、取消接口
/// <summary>
/// 舱位接收保存、取消接口
/// </summary>
/// <param name="dto"></param>
/// <param name="file"></param>
/// <param name="modifyFile"></param>
/// <returns></returns>
[HttpPost]
[Route("InnerApiReceive")]
public async Task<long> InnerApiReceive(BookingSlotBaseApiDto dto, DynameFileInfo file = null, DynameFileInfo modifyFile = null)
{
return await _bookingSlotService.InnerApiReceive(dto, file, modifyFile);
}
#endregion
#region 获取舱位变更比对结果
/// <summary>
/// 获取舱位变更比对结果
/// </summary>
/// <param name="id">舱位主键</param>
/// <param name="batchNo">批次号</param>
/// <returns>返回舱位变更比对结果</returns>
[HttpGet]
[Route("GetSlotCompareResult")]
public async Task<List<CompareResultDetailInfo>> GetSlotCompareResult(long id, string batchNo)
{
return await _bookingSlotService.GetSlotCompareResult(id, batchNo);
}
#endregion
#region 导入舱位
/// <summary>
/// 导入舱位
/// </summary>
/// <param name="file">导入舱位文件</param>
/// <returns>返回回执</returns>
[HttpPost]
[Route("ImportSlotFromFile")]
public async Task<TaskManageOrderResultDto> ImportSlotFromFile(IFormFile file)
{
return await _bookingSlotService.ImportSlotFromFile(file);
}
#endregion
#region 生成订舱订单
/// <summary>
/// 生成订舱订单
/// </summary>
/// <param name="model">生成订舱订单请求</param>
/// <returns>返回回执</returns>
[HttpPost]
4 months ago
[Route("CreateBookingOrder")]
public async Task<TaskManageOrderResultDto> CreateBookingOrder([FromBody] BookingGenerateDto model)
{
return await _bookingSlotService.CreateBookingOrder(model);
}
#endregion
#region 检索舱位对应的订舱订单(BY 舱位主键)
/// <summary>
/// 检索舱位对应的订舱订单(BY 舱位主键)
/// </summary>
/// <param name="id"></param>
/// <returns>返回回执</returns>
[HttpGet]
[Route("SearchBookingSlotWithOrderById")]
public async Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderById(long id)
{
return await _bookingSlotService.SearchBookingSlotWithOrderById(id);
}
#endregion
#region 检索舱位对应的订舱订单(BY 订舱编号)
/// <summary>
/// 检索舱位对应的订舱订单(BY 订舱编号)
/// </summary>
/// <param name="slotBookingNo">订舱编号</param>
/// <param name="tenantId">租户ID</param>
/// <returns>返回回执</returns>
[HttpGet]
[Route("SearchBookingSlotWithOrderByNo")]
public async Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo, long tenantId)
{
return await _bookingSlotService.SearchBookingSlotWithOrderByNo(slotBookingNo, tenantId);
}
#endregion
#region 请求BC比对
/// <summary>
/// 请求BC比对
/// </summary>
/// <param name="bcSrcDto">BC详情</param>
/// <param name="bcTargetDto">BC变更后详情</param>
/// <returns>返回回执</returns>
[HttpPost]
[Route("ExcuteCompare")]
public async Task<string> ExcuteCompare(ParserBCInfoDto bcSrcDto, ParserBCInfoDto bcTargetDto)
{
return await _bookingSlotService.ExcuteCompare(bcSrcDto, bcTargetDto);
}
#endregion
#region 推送BC变更比对
/// <summary>
/// 推送BC变更比对
/// </summary>
/// <param name="bcSrcDto">原舱位详情</param>
/// <param name="bcTargetDto">变更后舱位详情</param>
/// <param name="slotId">舱位主键</param>
/// <param name="reqBatchNo">请求批次号用来区分对应的哪个批次任务</param>
/// <returns></returns>
[HttpPost]
[Route("PushCompareBCInfo")]
public async Task PushCompareBCInfo(ParserBCInfoDto bcSrcDto, ParserBCInfoDto bcTargetDto, long slotId, string reqBatchNo)
{
await _bookingSlotService.PushCompareBCInfo(bcSrcDto, bcTargetDto, slotId, reqBatchNo);
}
#endregion
#region 估算差异重要提醒
/// <summary>
/// 估算差异重要提醒
/// </summary>
/// <param name="bcSrcDto">原舱位详情</param>
/// <param name="bcTargetDto">新舱位详情</param>
/// <param name="slotId">舱位ID</param>
/// <returns></returns>
[HttpPost]
[Route("MeasureDiffCautionTask")]
public async Task MeasureDiffCautionTask(ParserBCInfoDto bcSrcDto, ParserBCInfoDto bcTargetDto, long slotId)
{
await _bookingSlotService.MeasureDiffCautionTask(bcSrcDto, bcTargetDto, slotId);
}
#endregion
#region 订舱编号检索舱位信息
/// <summary>
/// 订舱编号检索舱位信息
/// </summary>
/// <param name="slotBookingNo">订舱编号</param>
/// <param name="CarrierId">船公司ID</param>
/// <returns></returns>
[HttpGet]
[Route("QueryBookingSlot")]
public async Task<long> QueryBookingSlot(string slotBookingNo, string CarrierId)
{
return await _bookingSlotService.QueryBookingSlot(slotBookingNo, CarrierId);
}
#endregion
#region 获取舱位详情列表
/// <summary>
/// 获取舱位详情列表
/// </summary>
/// <param name="ids">舱位ID组</param>
/// <returns>返回舱位详情</returns>
[HttpPost]
[Route("GetSlotList")]
public async Task<List<BookingSlotBaseSaveOutput>> GetSlotList(long[] ids)
{
return await _bookingSlotService.GetSlotList(ids);
}
#endregion
#region 获取合票详情(生成合票需要先调此方法)
/// <summary>
/// 获取合票详情(生成合票需要先调此方法)
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("GetMergeList")]
public async Task<BookingSlotMergeResultDto> GetMergeList(QueryMergeSlotDto model)
{
return await _bookingSlotService.GetMergeList(model);
}
#endregion
#region 生成合票订舱订单
/// <summary>
/// 生成合票订舱订单
/// </summary>
/// <param name="model">生成订舱订单请求</param>
/// <returns>返回回执</returns>
[HttpPost]
[Route("MergeCreateBookingOrder")]
public async Task<TaskManageOrderResultDto> MergeCreateBookingOrder(BookingGenerateDto model)
{
return await _bookingSlotService.MergeCreateBookingOrder(model);
}
#endregion
}
}