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 Org.BouncyCastle.Ocsp; using SqlSugar; namespace DS.WMS.OpApi.Controllers { /// /// 舱位管理 /// public class BookingSlotServiceController : ApiController { private readonly IBookingSlotService _bookingSlotService; private readonly IBookingSlotStockService _bookingSlotStockService; /// /// /// /// public BookingSlotServiceController(IBookingSlotService bookingSlotService, IBookingSlotStockService bookingSlotStockService) { _bookingSlotService = bookingSlotService; _bookingSlotStockService = bookingSlotStockService; } #region 舱位接收保存、取消接口 /// /// 舱位接收保存、取消接口 /// /// 请求详情(JSON) /// BC附件 /// BC修改附件 /// [HttpPost] [Route("ApiReceive")] public async Task> ApiReceive(string jsonData, IFormFile file = null, IFormFile modifyFile = null) { return await _bookingSlotService.ApiReceive(jsonData, null, null); } #endregion #region 获取舱位详情 /// /// 获取舱位详情 /// /// 舱位ID /// 返回详情 [HttpGet] [Route("Detail")] public async Task> Detail([FromQuery] long id) { return await _bookingSlotService.Detail(id); } #endregion #region 查询可用的舱位及箱子列表 /// /// 分页查询可用的舱位及箱子列表 /// /// 可选:舱位查询条件 /// 可选:分页信息 /// 可用的舱位列表(含可用的箱子列表) [HttpGet] [Route("GetAvailableSlots")] public async Task>> GetAvailableSlots([FromQuery] BookingSlotBaseDto input, [FromQuery] PageWithTotal pageInfo) { return await _bookingSlotService.GetAvailableSlots(input, pageInfo); } #endregion #region 检查指定订舱记录,是否可以引入舱位列表 /// /// 检查指定订舱记录,是否可以引入舱位列表 /// /// 待引入的舱位列表 /// 返回回执 [HttpPost] [Route("CheckImportSlots")] public async Task CheckImportSlots([FromBody] List slots) { return null;//await _bookingSlotService.CheckImportSlots(slots, 0); } #endregion #region 为指定订舱记录引入舱位信息 /// /// 为指定订舱记录引入舱位信息 /// /// 引入舱位参数 /// (是否成功,提示消息) [HttpPost] [Route("ImportSlots")] public async Task> ImportSlots([FromBody] ImportSlotsDto model) { return await _bookingSlotService.ImportSlots(model); } #endregion #region 舱位库存台账 /// /// 舱位库存台账 /// /// 请求参数 /// 返回列表 [HttpPost] [Route("PageStock")] public async Task>> PageStock([FromBody] PageRequest querySearch) { return await _bookingSlotService.GetPageStockAsync(querySearch); } #endregion #region 舱位库存刷新 /// /// 舱位库存刷新 /// /// 请求参数 /// 返回列表 [HttpPost] [Route("RefreshStock")] public async Task> RefreshStock([FromBody] BookingSlotStockUpdateModel input) { return await _bookingSlotService.RefreshStock(input); } #endregion #region 保存舱位 /// /// 保存舱位 /// /// 舱位详情 /// 返回输出 [HttpPost] [Route("Save")] public async Task> Save([FromBody] BookingSlotBaseSaveInput input) { return await _bookingSlotService.Save(input); } #endregion #region 获取附件 /// /// 获取附件 /// /// 舱位主键 /// 返回附件列表 [HttpGet] [Route("GetFile")] public async Task>> GetFile([FromQuery] long id) { return await _bookingSlotService.GetFile(id); } #endregion #region 分页查询订舱舱位 /// /// 舱位台账查询 /// /// 查询条件 /// [HttpPost] [Route("GetPage")] public async Task>> GetPageAsync(PageRequest querySearch) { return await _bookingSlotService.GetPageAsync(querySearch); } #endregion #region 获取舱位变更比对结果 /// /// 获取舱位变更比对结果 /// /// 舱位主键 /// 批次号 /// 返回舱位变更比对结果 [HttpGet] [Route("GetSlotCompareResult")] public async Task>> GetSlotCompareResult([FromQuery] long id, [FromQuery] string batchNo) { return await _bookingSlotService.GetSlotCompareResult(id, batchNo); } #endregion #region 导入舱位 /// /// 导入舱位 /// /// 导入舱位文件 /// 返回回执 [HttpPost] [Route("ImportSlotFromFile")] public async Task>> ImportSlotFromFile(IFormFile file) { return await _bookingSlotService.ImportSlotFromFile(file); } #endregion #region 生成订舱订单 /// /// 生成订舱订单 /// /// 生成订舱订单请求 /// 返回回执 [HttpPost] [Route("CreateBookingOrder")] public async Task> CreateBookingOrder([FromBody] BookingGenerateDto model) { return await _bookingSlotService.CreateBookingOrder(model); } #endregion #region 检索舱位对应的订舱订单(BY 舱位主键) /// /// 检索舱位对应的订舱订单(BY 舱位主键) /// /// /// 返回回执 [HttpGet] [Route("SearchBookingSlotWithOrderById")] public async Task> SearchBookingSlotWithOrderById([FromQuery] long id) { return await _bookingSlotService.SearchBookingSlotWithOrderById(id); } #endregion #region 检索舱位对应的订舱订单(BY 订舱编号) /// /// 检索舱位对应的订舱订单(BY 订舱编号) /// /// 订舱编号 /// 租户ID /// 返回回执 [HttpGet] [Route("SearchBookingSlotWithOrderByNo")] public async Task> SearchBookingSlotWithOrderByNo([FromQuery] string slotBookingNo, [FromQuery] long tenantId) { return await _bookingSlotService.SearchBookingSlotWithOrderByNo(slotBookingNo, tenantId); } #endregion #region 请求BC比对 /// /// 请求BC比对 /// /// BC详情 /// 返回回执 [HttpPost] [Route("ExcuteCompare")] public async Task> ExcuteCompare([FromBody] ParserBCInfoDto bcSrcDto) { return null;// await _bookingSlotService.ExcuteCompare(bcSrcDto, null); } #endregion #region 推送BC变更比对 /// /// 推送BC变更比对 /// /// 原舱位详情 /// [HttpPost] [Route("PushCompareBCInfo")] public async Task> PushCompareBCInfo([FromBody] ParserBCInfoDto bcSrcDto) { return null;// _bookingSlotService.PushCompareBCInfo(bcSrcDto, null, 0, ""); } #endregion #region 估算差异重要提醒 /// /// 估算差异重要提醒 /// /// 原舱位详情 /// 新舱位详情 /// 舱位ID /// [HttpPost] [Route("MeasureDiffCautionTask")] public async Task MeasureDiffCautionTask([FromBody] ParserBCInfoDto bcSrcDto) { return await _bookingSlotService.MeasureDiffCautionTask(bcSrcDto, null, 0); } #endregion #region 订舱编号检索舱位信息 /// /// 订舱编号检索舱位信息 /// /// 订舱编号 /// 船公司ID /// [HttpGet("QueryBookingSlot")] [ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous] public async Task> QueryBookingSlot([FromQuery] string slotBookingNo, [FromQuery] string CarrierId) { return await _bookingSlotService.QueryBookingSlot(slotBookingNo, CarrierId); } #endregion #region 获取舱位详情列表 /// /// 获取舱位详情列表 /// /// 舱位ID组 /// 返回舱位详情 [HttpPost] [Route("GetSlotList")] public async Task>> GetSlotList([FromBody] long[] ids) { return await _bookingSlotService.GetSlotList(ids); } #endregion #region 获取合票详情(生成合票需要先调此方法) /// /// 获取合票详情(生成合票需要先调此方法) /// /// /// [HttpPost] [Route("GetMergeList")] public async Task> GetMergeList([FromBody] QueryMergeSlotDto model) { return await _bookingSlotService.GetMergeList(model); } #endregion #region 生成合票订舱订单 /// /// 生成合票订舱订单 /// /// 生成订舱订单请求 /// 返回回执 [HttpPost] [Route("MergeCreateBookingOrder")] public async Task> MergeCreateBookingOrder([FromBody] BookingGenerateDto model) { return await _bookingSlotService.MergeCreateBookingOrder(model); } #endregion #region 作废舱位(可以批量) /// /// 作废舱位(可以批量) /// /// 舱位主键数组 /// 返回回执 [HttpPost] [Route("Delete")] public async Task Delete([FromBody] long[] ids) { return await _bookingSlotService.Delete(ids); } #endregion #region 查询指定舱位可用的箱子列表 /// /// 查询指定舱位可用的箱子列表 /// /// 舱位主键 /// 可用的箱子列表 [HttpGet] [Route("GetAvailableCtnsBySlot")] public async Task>> GetAvailableCtnsBySlot(long slotId) { return await _bookingSlotService.GetAvailableCtnsBySlot(slotId); } #endregion #region 导出舱位为Excel /// /// 导出舱位为Excel /// /// 请求参数 /// 返回文件链接 [HttpPost] [Route("ExportOrder")] public async Task> ExportOrder([FromBody] PageRequest querySearch) { return await _bookingSlotService.ExportOrder(querySearch); } #endregion #region 获取现舱位查询 /// /// 获取现舱位查询 /// /// 查询条件 /// [HttpPost] [Route("GetAvailableBookingSlots")] public async Task>> GetAvailableBookingSlots([FromBody] PageRequest querySearch) { return await _bookingSlotService.GetAvailableBookingSlots(querySearch); } #endregion #region 引入现舱关联海运出口 /// /// 引入现舱关联海运出口 /// /// 请求参数 /// [HttpPost] [Route("BringInBookingSlotToOrder")] public async Task> BringInBookingSlotToOrder([FromBody] BringInBookingSlotReq model) { return await _bookingSlotService.BringInBookingSlotToOrder(model); } #endregion #region 获取舱位用途配置列表 /// /// 获取舱位用途配置列表 /// /// [HttpGet] [Route("GetSlotUseToConfig")] public async Task>> GetSlotUseToConfig() { return await _bookingSlotService.GetSlotUseToConfig(); } #endregion #region 重新计算某租户下面所有的库存 /// /// 重新计算某租户下面所有的库存 /// /// [HttpGet] [Route("RefreshAllStock")] public async Task RefreshAllStock() { await _bookingSlotStockService.RefreshAllStock(); } #endregion #region 重新计算单个统计库存 /// /// 重新计算单个统计库存 /// /// 计算范围 /// 返回回执 [HttpPost] [Route("CalcBookingSlotStock")] public async Task> CalcBookingSlotStock([FromBody] BookingSlotStockUpdateModel model) { return await _bookingSlotStockService.BookingSlotStock(model); } #endregion #region 保存舱位预甩或换舱 /// /// 保存舱位预甩或换舱 /// /// 请求详情 /// 返回回执 [HttpPost] [Route("SaveRolling")] public async Task SaveRolling([FromBody] BookingSlotRollingDto req) { return await _bookingSlotService.SaveRolling(req); } #endregion #region 获取舱位预甩或换舱列表 /// /// 获取舱位预甩或换舱列表 /// /// 舱位ID /// 返回列表 [HttpGet] [Route("GetRollingList")] public async Task>> GetRollingList([FromQuery] long slotId) { return await _bookingSlotService.GetRollingList(slotId); } #endregion } }