using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Opsoft.NetCore.O3App.Domain; using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices; using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model; using Opsoft.NetCore.O3App.Shared; using Opsoft.NetCore.O3App.WebApi.Models; namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS { /// /// 销售拣货 /// [Authorize] public class PickInventoryController : BaseApiController { private readonly IPickInventoryService _pickInventoryService; private readonly IBarcodeService _barcodeService; public PickInventoryController( IMapper mapper, ILogger logger, IPickInventoryService pickInventoryService, IBarcodeService barcodeService) : base(mapper, logger) { _pickInventoryService = pickInventoryService; _barcodeService = barcodeService; } #region 旧销售拣货接口 /// /// 获取拣货信息 /// /// /// [HttpPost] public async Task> GetPickInventoryDetail([FromBody] PickInventoryParameter para) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.GetPickInventoryDetail(para); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 条码操作(扫码/删除) /// /// /// [HttpPost] public async Task> BarcodeOperate([FromBody] PickInventoryBarcodeParameter para) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.ScanOrRemoveBarcode(para); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 条码拆分 /// /// /// [HttpPost] public async Task> SplitBarcode([FromBody] SplitInputDto para) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.SplitBarcode(para); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } #endregion #region 新拣货 /// /// 获取拣货任务列表 /// /// 组织 /// 拣货类型 /// [HttpGet] public async Task> GetPickTaskList(string companyId, int type) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.GetPickTaskList(companyId, type); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 认领拣货任务 /// /// 组织 /// 单号 /// [HttpGet] public async Task> TakePickTask(string companyId, string billNo) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.TakePickTask(companyId, billNo); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 获取容器信息 /// /// 组织 /// 容器号 /// [HttpGet] public async Task> GetContainerInfo(string companyId, string containerNo) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.GetContainerInfo(companyId, containerNo); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 获取库存信息 /// /// 当前任务单明细行detailId /// [HttpGet] public async Task> PickTaskGetInventoryInfo(string taskSubRowDetailId) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.GetInventoryInfo(taskSubRowDetailId); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 扫码获取条码信息 /// /// 组织 /// 条码 /// [HttpGet] public async Task> PickTaskQueryBarcode(string companyId, string barcode) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.QueryBarcode(companyId, barcode); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 扫码回车 /// /// 参数 /// [HttpPost] public async Task> PickTaskScanBarcode([FromBody] PickTaskScanBarcodePara para) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.ScanBarcode(para); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 异常上报 /// /// 参数 /// [HttpPost] public async Task> PickTaskErrorReport([FromBody] PickTaskErrorReportPara para) { return await TryProcess(async input => { RetMessage retMsg = await _pickInventoryService.ErrorReport(para); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } #endregion } }