huangxiaoqiang
2025-12-17 bdf29324be453a64ac4baab479c3bb2b26a1bd5c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Core;
using WIDESEA_DTO.CalcOut;
 
namespace WIDESEA_WMSServer.Controllers.Outbound
{
    [Route("api/[controller]")]
    [ApiController]
    public class OutboundController : ControllerBase
    {
        private readonly WIDESEA_IOutboundService.IOutboundService _outboundService;
        public OutboundController(WIDESEA_IOutboundService.IOutboundService outboundService)
        {
            _outboundService = outboundService;
        }
 
        /// <summary>
        /// 分拣出库操作
        /// </summary>
        /// <param name="request">分拣出库请求</param>
        /// <returns>分拣出库响应</returns>
        [HttpPost, Route("ProcessPickingOutbound"), AllowAnonymous]
        public WebResponseContent ProcessPickingOutbound([FromBody] PickingOutboundRequestDTO request)
        {
            try
            {
                if (!ModelState.IsValid)
                    return WebResponseContent.Instance.Error(string.Join("; ", ModelState.Values
                        .SelectMany(v => v.Errors)
                        .Select(e => e.ErrorMessage)));
 
                return _outboundService.ProcessPickingOutbound(request);
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error($"分拣出库操作失败: {ex.Message}");
            }
        }
 
        [HttpPost, Route("CompleteOutboundWithBarcode"), AllowAnonymous]
        public WebResponseContent CompleteOutboundWithBarcode([FromBody] OutboundCompleteRequestDTO request)
        {
            try
            {
                if (!ModelState.IsValid)
                    return WebResponseContent.Instance.Error(string.Join("; ", ModelState.Values
                        .SelectMany(v => v.Errors)
                        .Select(e => e.ErrorMessage)));
 
                return _outboundService.CompleteOutboundWithBarcode(request);
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error($"出库扫描操作失败: {ex.Message}");
            }
        }
 
        [HttpPost, Route("QueryPickingTasks"), AllowAnonymous]
        public WebResponseContent QueryPickingTasks(string palletCode, string orderNo)
        {
            return _outboundService.QueryPickingTasks(palletCode, orderNo);
        }
 
        [HttpPost, Route("QueryPickedList"), AllowAnonymous]
        public WebResponseContent QueryPickedList(string orderNo, string palletCode)
        {
            return _outboundService.QueryPickedList(orderNo, palletCode);
        }
    }
}