117 lines
3.8 KiB
C#
Executable File
117 lines
3.8 KiB
C#
Executable File
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
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
|
|
{
|
|
public class CallMaterialController : BaseApiController<CallMaterialController>
|
|
{
|
|
private ICallMaterialService _callMaterialService;
|
|
public CallMaterialController(IMapper mapper, ILogger<CallMaterialController> logger, ICallMaterialService callMaterialService) : base(mapper, logger)
|
|
{
|
|
_callMaterialService = callMaterialService;
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<BaseResponse> GetCallBillInfo([FromBody] GetCallMaterialBillInfoPara para)
|
|
{
|
|
return await TryProcess(async input =>
|
|
{
|
|
RetMessage retMsg =
|
|
await _callMaterialService.GetCallBillInfo(para);
|
|
|
|
if (retMsg == null || retMsg.Status == 0)
|
|
{
|
|
throw new O3AppException(retMsg.Message);
|
|
}
|
|
else
|
|
{
|
|
return retMsg.Data["data"];
|
|
}
|
|
}, LoginInfo);
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<BaseResponse> CallMaterialSubmit([FromBody] List<CallMaterialSubmitHead> callBills)
|
|
{
|
|
return await TryProcess(async input =>
|
|
{
|
|
RetMessage retMsg =
|
|
await _callMaterialService.CallMaterialSubmit(callBills);
|
|
|
|
if (retMsg == null || retMsg.Status == 0)
|
|
{
|
|
throw new O3AppException(retMsg.Message);
|
|
}
|
|
else
|
|
{
|
|
return retMsg.Data["data"];
|
|
}
|
|
}, LoginInfo);
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<BaseResponse> CallMaterialQueryBarcode([FromQuery] string barcode)
|
|
{
|
|
return await TryProcess(async input =>
|
|
{
|
|
RetMessage retMsg =
|
|
await _callMaterialService.CallMaterialQueryBarcode(barcode);
|
|
|
|
if (retMsg == null || retMsg.Status == 0)
|
|
{
|
|
throw new O3AppException(retMsg.Message);
|
|
}
|
|
else
|
|
{
|
|
return retMsg.Data["data"];
|
|
}
|
|
}, LoginInfo);
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<BaseResponse> StartSend([FromQuery] string billNo)
|
|
{
|
|
return await TryProcess(async input =>
|
|
{
|
|
RetMessage retMsg =
|
|
await _callMaterialService.StartSend(billNo);
|
|
|
|
if (retMsg == null || retMsg.Status == 0)
|
|
{
|
|
throw new O3AppException(retMsg.Message);
|
|
}
|
|
else
|
|
{
|
|
return retMsg.Data["data"];
|
|
}
|
|
}, LoginInfo);
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<BaseResponse> SendTo([FromBody] List<string> billNo)
|
|
{
|
|
return await TryProcess(async input =>
|
|
{
|
|
RetMessage retMsg =
|
|
await _callMaterialService.SendTo(billNo);
|
|
|
|
if (retMsg == null || retMsg.Status == 0)
|
|
{
|
|
throw new O3AppException(retMsg.Message);
|
|
}
|
|
else
|
|
{
|
|
return retMsg.Data["data"];
|
|
}
|
|
}, LoginInfo);
|
|
}
|
|
|
|
}
|
|
}
|