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.

462 lines
16 KiB
C#

using Azure.Storage.Blobs.Models;
using DS.Module.Core;
using DS.Module.Core.Attributes;
using DS.Module.Core.Data;
using DS.Module.DjyServiceStatus;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Interface;
using Microsoft.AspNetCore.Authorization;
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;
3 months ago
private readonly IBookingSlotStockService _bookingSlotStockService;
/// <summary>
///
/// </summary>
/// <param name="bookingSlotService"></param>
3 months ago
public BookingSlotServiceController(IBookingSlotService bookingSlotService, IBookingSlotStockService bookingSlotStockService)
{
_bookingSlotService = bookingSlotService;
3 months ago
_bookingSlotStockService = bookingSlotStockService;
}
#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, null, null);
}
#endregion
#region 获取舱位详情
/// <summary>
/// 获取舱位详情
/// </summary>
/// <param name="id">舱位ID</param>
/// <returns>返回详情</returns>
[HttpGet]
[Route("Detail")]
public async Task<DataResult<BookingSlotBaseSaveOutput>> Detail([FromQuery] long id)
{
return await _bookingSlotService.Detail(id);
}
#endregion
#region 查询可用的舱位及箱子列表
/// <summary>
4 months ago
/// 分页查询可用的舱位及箱子列表
/// </summary>
4 months ago
/// <param name="input">可选:舱位查询条件</param>
/// <param name="pageInfo">可选:分页信息</param>
/// <returns>可用的舱位列表(含可用的箱子列表)</returns>
4 months ago
[HttpGet]
[Route("GetAvailableSlots")]
4 months ago
public async Task<DataResult<SqlSugarPagedList<BookingSlotBaseWithCtnDto>>> GetAvailableSlots([FromQuery] BookingSlotBaseDto input,
[FromQuery] PageWithTotal pageInfo)
{
4 months ago
return await _bookingSlotService.GetAvailableSlots(input, pageInfo);
}
#endregion
#region 检查指定订舱记录,是否可以引入舱位列表
/// <summary>
/// 检查指定订舱记录,是否可以引入舱位列表
/// </summary>
/// <param name="slots">待引入的舱位列表</param>
4 months ago
/// <returns>返回回执</returns>
[HttpPost]
[Route("CheckImportSlots")]
public async Task<DataResult> CheckImportSlots([FromBody] List<BookingSlotBaseWithCtnDto> slots)
{
return null;//await _bookingSlotService.CheckImportSlots(slots, 0);
}
#endregion
#region 为指定订舱记录引入舱位信息
/// <summary>
/// 为指定订舱记录引入舱位信息
/// </summary>
4 months ago
/// <param name="model">引入舱位参数</param>
/// <returns>(是否成功,提示消息)</returns>
[HttpPost]
[Route("ImportSlots")]
4 months ago
public async Task<DataResult<string>> ImportSlots([FromBody] ImportSlotsDto model)
{
4 months ago
return await _bookingSlotService.ImportSlots(model);
}
#endregion
#region 舱位库存台账
/// <summary>
/// 舱位库存台账
/// </summary>
/// <param name="input">请求参数</param>
/// <returns>返回列表</returns>
[HttpPost]
[Route("PageStock")]
public async Task<DataResult<List<BookingSlotStockDto>>> PageStock([FromBody] PageRequest querySearch)
{
return await _bookingSlotService.GetPageStockAsync(querySearch);
}
#endregion
#region 舱位库存刷新
/// <summary>
/// 舱位库存刷新
/// </summary>
/// <param name="input">请求参数</param>
/// <returns>返回列表</returns>
[HttpPost]
[Route("RefreshStock")]
public async Task<DataResult<string>> RefreshStock([FromBody] BookingSlotStockUpdateModel input)
{
return await _bookingSlotService.RefreshStock(input);
}
#endregion
#region 保存舱位
/// <summary>
/// 保存舱位
/// </summary>
/// <param name="input">舱位详情</param>
/// <returns>返回输出</returns>
[HttpPost]
4 months ago
[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([FromQuery] long id)
{
return await _bookingSlotService.GetFile(id);
}
#endregion
#region 分页查询订舱舱位
/// <summary>
4 months ago
/// 舱位台账查询
/// </summary>
4 months ago
/// <param name="querySearch">查询条件</param>
/// <returns></returns>
[HttpPost]
4 months ago
[Route("GetPage")]
public async Task<DataResult<List<BookingSlotBaseDto>>> GetPageAsync(PageRequest querySearch)
{
4 months ago
return await _bookingSlotService.GetPageAsync(querySearch);
}
#endregion
#region 获取舱位变更比对结果
/// <summary>
/// 获取舱位变更比对结果
/// </summary>
/// <param name="id">舱位主键</param>
/// <param name="batchNo">批次号</param>
/// <returns>返回舱位变更比对结果</returns>
[HttpGet]
[Route("GetSlotCompareResult")]
public async Task<DataResult<List<CompareResultDetailInfo>>> GetSlotCompareResult([FromQuery] long id, [FromQuery] string batchNo)
{
4 months ago
return await _bookingSlotService.GetSlotCompareResult(id, batchNo);
}
#endregion
#region 导入舱位
/// <summary>
/// 导入舱位
/// </summary>
/// <param name="file">导入舱位文件</param>
/// <returns>返回回执</returns>
[HttpPost]
[Route("ImportSlotFromFile")]
public async Task<DataResult<List<object>>> ImportSlotFromFile(IFormFile file)
{
return await _bookingSlotService.ImportSlotFromFile(file);
}
#endregion
#region 生成订舱订单
/// <summary>
/// 生成订舱订单
/// </summary>
/// <param name="model">生成订舱订单请求</param>
/// <returns>返回回执</returns>
[HttpPost]
5 months ago
[Route("CreateBookingOrder")]
4 months ago
public async Task<DataResult<long>> CreateBookingOrder([FromBody] BookingGenerateDto model)
{
4 months ago
return await _bookingSlotService.CreateBookingOrder(model);
}
#endregion
#region 检索舱位对应的订舱订单(BY 舱位主键)
/// <summary>
/// 检索舱位对应的订舱订单(BY 舱位主键)
/// </summary>
/// <param name="id"></param>
/// <returns>返回回执</returns>
[HttpGet]
[Route("SearchBookingSlotWithOrderById")]
public async Task<DataResult<BookingSlotWithOrderDto>> SearchBookingSlotWithOrderById([FromQuery] 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<DataResult<BookingSlotWithOrderDto>> SearchBookingSlotWithOrderByNo([FromQuery] string slotBookingNo, [FromQuery] long tenantId)
{
return await _bookingSlotService.SearchBookingSlotWithOrderByNo(slotBookingNo, tenantId);
}
#endregion
#region 请求BC比对
/// <summary>
/// 请求BC比对
/// </summary>
/// <param name="bcSrcDto">BC详情</param>
/// <returns>返回回执</returns>
[HttpPost]
[Route("ExcuteCompare")]
public async Task<DataResult<string>> ExcuteCompare([FromBody] ParserBCInfoDto bcSrcDto)
{
return null;// await _bookingSlotService.ExcuteCompare(bcSrcDto, null);
}
#endregion
#region 推送BC变更比对
/// <summary>
/// 推送BC变更比对
/// </summary>
/// <param name="bcSrcDto">原舱位详情</param>
/// <returns></returns>
[HttpPost]
[Route("PushCompareBCInfo")]
public async Task<DataResult<string>> PushCompareBCInfo([FromBody] ParserBCInfoDto bcSrcDto)
{
return null;// _bookingSlotService.PushCompareBCInfo(bcSrcDto, null, 0, "");
}
#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<DataResult> MeasureDiffCautionTask([FromBody] ParserBCInfoDto bcSrcDto)
{
return await _bookingSlotService.MeasureDiffCautionTask(bcSrcDto, null, 0);
}
#endregion
#region 订舱编号检索舱位信息
/// <summary>
/// 订舱编号检索舱位信息
/// </summary>
/// <param name="slotBookingNo">订舱编号</param>
/// <param name="CarrierId">船公司ID</param>
/// <returns></returns>
[HttpGet("QueryBookingSlot")]
[ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous]
public async Task<DataResult<long>> QueryBookingSlot([FromQuery] string slotBookingNo, [FromQuery] 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<DataResult<List<BookingSlotBaseSaveOutput>>> GetSlotList([FromBody] long[] ids)
{
return await _bookingSlotService.GetSlotList(ids);
}
#endregion
#region 获取合票详情(生成合票需要先调此方法)
/// <summary>
/// 获取合票详情(生成合票需要先调此方法)
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("GetMergeList")]
public async Task<DataResult<BookingSlotMergeResultDto>> GetMergeList([FromBody] QueryMergeSlotDto model)
{
return await _bookingSlotService.GetMergeList(model);
}
#endregion
#region 生成合票订舱订单
/// <summary>
/// 生成合票订舱订单
/// </summary>
/// <param name="model">生成订舱订单请求</param>
/// <returns>返回回执</returns>
[HttpPost]
[Route("MergeCreateBookingOrder")]
public async Task<DataResult<TaskManageOrderResultDto>> MergeCreateBookingOrder([FromBody] BookingGenerateDto model)
{
return await _bookingSlotService.MergeCreateBookingOrder(model);
}
#endregion
#region 作废舱位(可以批量)
/// <summary>
/// 作废舱位(可以批量)
/// </summary>
/// <param name="ids">舱位主键数组</param>
/// <returns>返回回执</returns>
[HttpPost]
[Route("Delete")]
public async Task<DataResult> Delete([FromBody] long[] ids)
{
return await _bookingSlotService.Delete(ids);
}
#endregion
4 months ago
#region 查询指定舱位可用的箱子列表
/// <summary>
/// 查询指定舱位可用的箱子列表
/// </summary>
/// <param name="slotId">舱位主键</param>
/// <returns>可用的箱子列表</returns>
[HttpGet]
[Route("GetAvailableCtnsBySlot")]
public async Task<DataResult<List<BookingSlotCtnDto>>> GetAvailableCtnsBySlot(long slotId)
{
return await _bookingSlotService.GetAvailableCtnsBySlot(slotId);
}
#endregion
#region 导出舱位为Excel
/// <summary>
/// 导出舱位为Excel
/// </summary>
/// <param name="querySearch">请求参数</param>
/// <returns>返回文件链接</returns>
[HttpPost]
[Route("ExportOrder")]
public async Task<DataResult<string>> ExportOrder([FromBody] PageRequest querySearch)
{
return await _bookingSlotService.ExportOrder(querySearch);
}
#endregion
#region 获取现舱位查询
/// <summary>
/// 获取现舱位查询
/// </summary>
/// <param name="querySearch">查询条件</param>
/// <returns></returns>
[HttpPost]
[Route("GetAvailableBookingSlots")]
public async Task<DataResult<List<BookingSlotBaseWithCtnDto>>> GetAvailableBookingSlots([FromBody] PageRequest querySearch)
{
return await _bookingSlotService.GetAvailableBookingSlots(querySearch);
}
#endregion
#region 引入现舱关联海运出口
/// <summary>
/// 引入现舱关联海运出口
/// </summary>
/// <param name="model">请求参数</param>
/// <returns></returns>
[HttpPost]
[Route("BringInBookingSlotToOrder")]
public async Task<DataResult<string>> BringInBookingSlotToOrder([FromBody] BringInBookingSlotReq model)
{
return await _bookingSlotService.BringInBookingSlotToOrder(model);
}
#endregion
#region 获取舱位用途配置列表
/// <summary>
/// 获取舱位用途配置列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetSlotUseToConfig")]
public async Task<DataResult<List<BookingSlotUseToConfigDto>>> GetSlotUseToConfig()
{
return await _bookingSlotService.GetSlotUseToConfig();
}
#endregion
3 months ago
#region 重新计算某租户下面所有的库存
/// <summary>
/// 重新计算某租户下面所有的库存
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("RefreshAllStock")]
public async Task RefreshAllStock()
{
await _bookingSlotStockService.RefreshAllStock();
}
#endregion
3 months ago
#region 重新计算单个统计库存
/// <summary>
/// 重新计算单个统计库存
/// </summary>
/// <param name="model">计算范围</param>
/// <returns>返回回执</returns>
[HttpPost]
[Route("CalcBookingSlotStock")]
public async Task<DataResult<string>> CalcBookingSlotStock([FromBody] BookingSlotStockUpdateModel model)
{
return await _bookingSlotStockService.BookingSlotStock(model);
}
#endregion
}
}