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 { private ICallMaterialService _callMaterialService; public CallMaterialController(IMapper mapper, ILogger logger, ICallMaterialService callMaterialService) : base(mapper, logger) { _callMaterialService = callMaterialService; } [HttpPost] public async Task 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 CallMaterialSubmit([FromBody] List 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 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 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 SendTo([FromBody] List 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); } } }