299 lines
10 KiB
C#
Executable File
299 lines
10 KiB
C#
Executable File
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<BarcodeController>
|
|
{
|
|
private readonly IBarcodeService _barcodeService;
|
|
public BarcodeController(IMapper mapper, ILogger<BarcodeController> logger,IBarcodeService barcodeService)
|
|
: base(mapper, logger)
|
|
{
|
|
_barcodeService = barcodeService;
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="barcode"></param>
|
|
/// <param name="orgId"></param>
|
|
/// <param name="billType">哪个功能调用</param>
|
|
/// <returns></returns>
|
|
public async Task<BaseResponse<BarCodeMsg>> GetBarcodeMsg([FromQuery] string barcode, [FromQuery] string orgId,
|
|
[FromQuery] string billType)
|
|
{
|
|
return await TryProcess(async input =>
|
|
{
|
|
return await _barcodeService.GetBarCodeMsg(barcode, orgId,billType);
|
|
}, LoginInfo);
|
|
}
|
|
|
|
/// <summary>
|
|
/// MES扫描随工单二维码获取信息
|
|
/// </summary>
|
|
/// <param name="barcode">条码</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 盘点扫描条码获取信息
|
|
/// </summary>
|
|
/// <param name="barcode">条码</param>
|
|
/// <param name="billType">单据类型</param>
|
|
/// <param name="orgId">组织ID</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 盘点条码录入
|
|
/// </summary>
|
|
/// <param name="inputDto">参数实体</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 扫描条码获取信息
|
|
/// </summary>
|
|
/// <param name="barcode">条码</param>
|
|
/// <param name="billType">单据类型</param>
|
|
/// <param name="orgId">组织ID</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 扫描条码获取信息(追加装箱箱码扫描用)
|
|
/// </summary>
|
|
/// <param name="barcode">条码</param>
|
|
/// <param name="billType">单据类型</param>
|
|
/// <param name="orgId">组织ID</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<BaseResponse<RetMessage>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 条码拆分
|
|
/// </summary>
|
|
/// <param name="inputDto">参数实体</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 条码合并
|
|
/// </summary>
|
|
/// <param name="inputDto">参数实体</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 条码变更
|
|
/// </summary>
|
|
/// <param name="inputDto">参数实体</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 外部条码导入
|
|
/// </summary>
|
|
/// <param name="inputDto">参数实体</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 条码装箱
|
|
/// </summary>
|
|
/// <param name="inputDto">参数实体</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 条码拆箱
|
|
/// </summary>
|
|
/// <param name="inputDto">参数实体</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<BaseResponse<object>> 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);
|
|
}
|
|
}
|
|
}
|