using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Opsoft.Data; 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; using System.Threading.Tasks; namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS { [Authorize] public class BarcodeController : BaseApiController { private readonly IBarcodeService _barcodeService; public BarcodeController(IMapper mapper, ILogger logger,IBarcodeService barcodeService) : base(mapper, logger) { _barcodeService = barcodeService; } /// /// /// /// /// /// 哪个功能调用 /// public async Task> GetBarcodeMsg([FromQuery] string barcode, [FromQuery] string orgId, [FromQuery] string billType) { return await TryProcess(async input => { return await _barcodeService.GetBarCodeMsg(barcode, orgId,billType); }, LoginInfo); } /// /// MES扫描随工单二维码获取信息 /// /// 条码 /// [HttpGet] public async Task> GetMESWorkOrderInfo([FromQuery] string barcode) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.GetMESWorkOrderInfo(barcode); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 盘点扫描条码获取信息 /// /// 条码 /// 单据类型 /// 组织ID /// [HttpGet] public async Task> GetStockTakingBarcodeInfo([FromQuery] string barcode, [FromQuery] string orgId) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.GetStockTakingBarcodeInfo(barcode, orgId); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 盘点条码录入 /// /// 参数实体 /// [HttpPost] public async Task> ImportStockTakingBarCode([FromBody] ImportBarcodeDto inputDto) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.ImportStockTakingBarCode(inputDto); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 扫描条码获取信息 /// /// 条码 /// 单据类型 /// 组织ID /// [HttpGet] public async Task> GetBarcodeInfo([FromQuery] string barcode, [FromQuery] int billType, [FromQuery] string orgId, [FromQuery] bool isMix=false) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.GetBarcodeInfo(barcode, billType, orgId, isMix); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 扫描条码获取信息(追加装箱箱码扫描用) /// /// 条码 /// 单据类型 /// 组织ID /// [HttpGet] public async Task> GetBarcodeInfoIsAdd([FromQuery] string barcode,[FromQuery] string orgId, [FromQuery] bool isMix = false) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.GetBarcodeInfoIsAdd(barcode,orgId, isMix); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg; } }, LoginInfo); } /// /// 条码拆分 /// /// 参数实体 /// [HttpPost] public async Task> SplitBarcode([FromBody] SplitInputDto inputDto) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.SplitBarcode(inputDto); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { if(inputDto.TranType.ToStringEx().ToUpperEx()== "STK_BARCODESPLIT") { return retMsg.Data["datainfo"]; } else { return retMsg.Data["data"]; } } }, LoginInfo); } /// /// 条码合并 /// /// 参数实体 /// [HttpPost] public async Task> MergeBarcode([FromBody] MergeInputDto inputDto) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.MergeBarcode(inputDto); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 条码变更 /// /// 参数实体 /// [HttpPost] public async Task> UpBarcodeInfo([FromBody] UpBarCodeInfoDto inputDto) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.UpBarcodeInfo(inputDto); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 外部条码导入 /// /// 参数实体 /// [HttpPost] public async Task> ImportBarCode([FromBody] ImportBarcodeDto inputDto) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.ImportBarCode(inputDto); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 条码装箱 /// /// 参数实体 /// [HttpPost] public async Task> InBox([FromBody] InBoxInputDto inputDto) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.InBox(inputDto); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } /// /// 条码拆箱 /// /// 参数实体 /// [HttpPost] public async Task> OutBox([FromBody] OutBoxInputDto inputDto) { return await TryProcess(async input => { RetMessage retMsg = await _barcodeService.OutBox(inputDto); if (retMsg == null || retMsg.Status == 0) { throw new O3AppException(retMsg.Message); } else { return retMsg.Data["data"]; } }, LoginInfo); } } }