| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Newtonsoft.Json; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Attributes; |
| | | using WIDESEA_Core.BaseController; |
| | |
| | | using WIDESEA_DTO.Outbound; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_WMSServer.Controllers.Inbound; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Outbound |
| | | { |
| | |
| | | [ApiController] |
| | | public class OutboundOrderController : ApiBaseController<IOutboundOrderService, Dt_OutboundOrder> |
| | | { |
| | | public OutboundOrderController(IOutboundOrderService service) : base(service) |
| | | private readonly ILogger<OutboundOrderController> _logger; |
| | | public OutboundOrderController(IOutboundOrderService service, ILogger<OutboundOrderController> logger) : base(service) |
| | | { |
| | | |
| | | _logger = logger; |
| | | } |
| | | /// <summary> |
| | | /// æ¥æ¶MESåºåºåä¿¡æ¯ |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ReceiveOutBoundOrder"), AllowAnonymous, MethodParamsValidate] |
| | | public WebResponseContent ReceiveOutBoundOrder([FromBody] OutboundRequestModel model) |
| | | public async Task<WebResponseContent> ReceiveOutBoundOrder([FromBody] OutboundRequestModel model) |
| | | { |
| | | _logger.LogInformation("OutboundOrderController ReceiveOutBoundOrder: " + JsonConvert.SerializeObject(model)); |
| | | Dt_OutboundOrder dt_OutboundOrder = new Dt_OutboundOrder() { Details = new List<Dt_OutboundOrderDetail>() }; |
| | | foreach (var detailitem in model.details) |
| | | { |
| | |
| | | Unit = detailitem.unit, |
| | | WarehouseCode = detailitem.warehouseCode, |
| | | MoveQty = detailitem.moveQty, |
| | | BarcodeMoveQty=detailitem.moveQty, |
| | | BarcodeQty=detailitem.qty, |
| | | BarcodeUnit=detailitem.unit, |
| | | OrderQuantity = detailitem.qty |
| | | }; |
| | | dt_OutboundOrder.Details.Add(inboundOrderDetail); |
| | |
| | | dt_OutboundOrder.IsBatch = model.isBatch; |
| | | dt_OutboundOrder.FactoryArea = model.factoryArea; |
| | | |
| | | var content = Service.ReceiveOutboundOrder(dt_OutboundOrder, model.operationType); |
| | | var content =await Service.ReceiveOutboundOrder(dt_OutboundOrder, model.operationType); |
| | | |
| | | if (content.Status) return WebResponseContent.Instance.OK(200); |
| | | else return WebResponseContent.Instance.Error(content.Message); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®IDè·ååºåºå |
| | | /// </summary>ss |
| | | [HttpGet, Route("GetById"), AllowAnonymous, MethodParamsValidate] |
| | | public async Task<WebResponseContent> GetById(int id) |
| | | { |
| | | var order = await Service.GetById(id); |
| | | if (order == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°åºåºåä¿¡æ¯"); |
| | | } |
| | | return WebResponseContent.Instance.OK(null, order); |
| | | } |
| | | } |
| | | } |