Files
GX.O3.WMS/APP.O3/WebApi/Controllers/WMS/PickInventoryController.cs
T

277 lines
9.0 KiB
C#
Executable File

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
{
/// <summary>
/// 销售拣货
/// </summary>
[Authorize]
public class PickInventoryController : BaseApiController<PickInventoryController>
{
private readonly IPickInventoryService _pickInventoryService;
private readonly IBarcodeService _barcodeService;
public PickInventoryController(
IMapper mapper, ILogger<PickInventoryController> logger,
IPickInventoryService pickInventoryService,
IBarcodeService barcodeService)
: base(mapper, logger)
{
_pickInventoryService = pickInventoryService;
_barcodeService = barcodeService;
}
#region 旧销售拣货接口
/// <summary>
/// 获取拣货信息
/// </summary>
/// <param name="para"></param>
/// <returns></returns>
[HttpPost]
public async Task<BaseResponse<object>> 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);
}
/// <summary>
/// 条码操作(扫码/删除)
/// </summary>
/// <param name="para"></param>
/// <returns></returns>
[HttpPost]
public async Task<BaseResponse<object>> 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);
}
/// <summary>
/// 条码拆分
/// </summary>
/// <param name="para"></param>
/// <returns></returns>
[HttpPost]
public async Task<BaseResponse<object>> 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 新拣货
/// <summary>
/// 获取拣货任务列表
/// </summary>
/// <param name="companyId">组织</param>
/// <param name="type">拣货类型</param>
/// <returns></returns>
[HttpGet]
public async Task<BaseResponse<object>> 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);
}
/// <summary>
/// 认领拣货任务
/// </summary>
/// <param name="companyId">组织</param>
/// <param name="billNo">单号</param>
/// <returns></returns>
[HttpGet]
public async Task<BaseResponse<object>> 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);
}
/// <summary>
/// 获取容器信息
/// </summary>
/// <param name="companyId">组织</param>
/// <param name="containerNo">容器号</param>
/// <returns></returns>
[HttpGet]
public async Task<BaseResponse<object>> 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);
}
/// <summary>
/// 获取库存信息
/// </summary>
/// <param name="taskSubRowDetailId">当前任务单明细行detailId</param>
/// <returns></returns>
[HttpGet]
public async Task<BaseResponse<object>> 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);
}
/// <summary>
/// 扫码获取条码信息
/// </summary>
/// <param name="companyId">组织</param>
/// <param name="barcode">条码</param>
/// <returns></returns>
[HttpGet]
public async Task<BaseResponse<object>> 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);
}
/// <summary>
/// 扫码回车
/// </summary>
/// <param name="para">参数</param>
/// <returns></returns>
[HttpPost]
public async Task<BaseResponse<object>> 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);
}
/// <summary>
/// 异常上报
/// </summary>
/// <param name="para">参数</param>
/// <returns></returns>
[HttpPost]
public async Task<BaseResponse<object>> 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
}
}