renmingwang
2026-03-30 2a21c41c5a700641eb2f0ac2437144eeac94ff1c
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
using Autofac.Core;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Common.Log;
using WIDESEA_Core;
using WIDESEA_Core.BaseController;
using WIDESEA_DTO.ToMes;
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
 
namespace WIDESEA_WMSServer.Controllers
{
 
    /// <summary>
    /// 上游接口
    /// </summary>
    [Route("v1/pallet/rmsPalletTask")]
    [ApiController]
    public class ToMes : ApiBaseController<ITaskService, Dt_Task>
    {
        public ToMes(ITaskService service) : base(service)
        {
        }
        /// <summary>
        /// MES下发出库任务
        /// </summary>
        /// <param name="taskNum"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("sendExTask"), AllowAnonymous]
        public ApiResponse<object> sendExTask([FromBody] InOutboundTaskReceived outbound)
        {
            ApiResponse<object> api = Service.sendExTask(outbound);
            if (api.Success == false)
            {
                WriteLog.Write_Log("MES下发任务", "MES下发出库任务", $"任务生成失败原因{api.Message}", outbound);
            }
            else
            {
                WriteLog.Write_Log("MES下发任务", "MES下发出库任务", $"任务生成成功", outbound);
            }
            return api;
        }
 
        /// <summary>
        /// MES下发入库任务
        /// </summary>
        /// <param name="taskNum"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("sendEnTask"), AllowAnonymous]
        public ApiResponse<object> sendEnTask([FromBody] InOutboundTaskReceived outbound)
        {
            ApiResponse<object> api = Service.sendEnTask(outbound);
            if (api.Success == false)
            {
                WriteLog.Write_Log("MES下发任务", "MES下发入库任务", $"任务生成失败原因{api.Message}", outbound);
 
            }
            else
            {
                WriteLog.Write_Log("MES下发任务", "MES下发入库任务", $"任务生成成功", outbound);
 
            }
            return api;
        }
 
 
        /// <summary>
        /// 新建货位
        /// </summary>
        [HttpPost, HttpGet, Route("createLocation"), AllowAnonymous]
        public ApiResponse<object> createLocation([FromBody] List<LocationInfoDto> locationInfo)
        {
            return Service.createLocation(locationInfo);
        }
 
        /// <summary>
        /// 修改货位
        /// </summary>
        [HttpPost, HttpGet, Route("updateLocation"), AllowAnonymous]
        public ApiResponse<object> updateLocation([FromBody] LocationInfoDto locationInfo)
        {
            return Service.updateLocation(locationInfo);
        }
 
        /// <summary>
        /// 删除货位
        /// </summary>
        [HttpPost, HttpGet, Route("deleteLocation"), AllowAnonymous]
        public ApiResponse<object> deleteLocation([FromBody] List<string> locationCode)
        {
            return Service.deleteLocation(locationCode);
        }
 
        /// <summary>
        /// MES下发库位调拨任务
        /// </summary>
        /// <param name="allocationTask">库位调拨任务信息</param>
        /// <returns></returns>
        [HttpPost, Route("onHandMove"), AllowAnonymous]
        public ApiResponse<object> sendAllocationTask([FromBody] AllocationTaskReceived allocationTask)
        {
            return Service.sendAllocationTask(allocationTask);
        }
 
 
 
 
 
 
 
        /// <summary>
        /// 托盘任务数据传输对象
        /// 用于内部业务数据传输
        /// </summary>
        public class PalletTaskDTO
        {
            /// <summary>
            /// 业务ID
            /// </summary>
            public string BusinessId { get; set; }
 
            /// <summary>
            /// 任务ID
            /// </summary>
            public string TaskId { get; set; }
 
            /// <summary>
            /// 托盘编码
            /// </summary>
            public string PalletCode { get; set; }
 
        }
 
 
        /// <summary>
        /// MES取消任务接口
        /// </summary>
        /// <param name="taskNum">任务号</param>
        /// <returns></returns>
        [HttpPost, Route("cancelTask"), AllowAnonymous]
        public ApiResponse<object> Cancelinventory([FromBody] PalletTaskDTO palletTaskDTO)
        {
            return Service.Cancelinventory(palletTaskDTO.PalletCode);
        }
 
        /// <summary>
        /// MES手动任务完成
        /// </summary>
        /// <param name="taskNum"></param>
        /// <returns></returns>
        [HttpPost, Route("mockComplete"), AllowAnonymous]
        public WebResponseContent ManualTaskCompleted([FromBody] PalletTaskDTO palletTaskDTO)
        {
            return Service.ManualTaskCompleted(palletTaskDTO.PalletCode);
        }
 
        /// <summary>
        /// MES任务结果反馈接口
        /// </summary>
        /// <param name="taskFeedback"></param>
        /// <returns></returns>
        [HttpPost, Route("resultReport"), AllowAnonymous]
        public ApiResponse<object> TaskFeedback([FromBody] TaskNotification taskFeedback)
        {
            return Service.TaskFeedback(taskFeedback);
        }
    }
}