Admin
2025-12-02 9e42f0dafa019f5ecf6b0ff425ecb966b002171e
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
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
using WIDESEA_WCS;
using WIDESEA_Services.Services;
using System.Collections.Generic;
using WIDESEA_Common;
using WIDESEA_WCS.WCSClient;
using System.Linq;
using System;
using WIDESEA_Common.CutomerModel;
using WIDESEA_Services.Repositories;
using WIDESEA_Services;
 
namespace WIDESEA_WCSServer.Controllers.ToWMS
{
 
    [Route("api/ToWMS")]
    [ApiController]
    public class ToWMSController : ControllerBase
    {
 
        /// <summary>
        /// 接收WMS下发的任务
        /// </summary>
        /// <param name="taskinfo"></param>
        /// <returns></returns>
        [HttpPost, Route("ReceiveTaskFromWMS"), AllowAnonymous]
        public WebResponseContent ReceiveTaskFromWMS([FromBody] List<WmsTaskInfo> taskinfo)
        {
            Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
            Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
 
            return taskWCSinfoService.AddTaskByWms(taskinfo);
 
        }
 
 
 
        /// <summary>
        /// 取消一条未开始执行的任务
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        [HttpPost, Route("CancelATask"), AllowAnonymous]
        public WebResponseContent CancelATask([FromBody] SaveModel saveModel)
        {
            Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
            Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
 
            return taskWCSinfoService.CancelATask(saveModel);
        }
 
 
        /// <summary>
        /// WMS下发更改任务状态,给测量设备测量完毕后,更新WCS任务状态
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        [HttpPost, Route("UpdateWcsTaskState"), AllowAnonymous]
        public WebResponseContent UpdateWcsTaskState([FromBody] SaveModel saveModel)
        {
            Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
            Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
 
            return taskWCSinfoService.UpdateWcsTaskState(saveModel);
        }
 
 
        /// <summary>
        /// WMS下发更改任务信息,当入库任务与出库测量任务冲突时,WMS调用此接口来更换目的货位
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        [HttpPost, Route("UpdateWcsTaskInformation"), AllowAnonymous]
        public WebResponseContent UpdateWcsTaskInformation([FromBody] SaveModel saveModel)
        {
            Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
            Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
 
            return taskWCSinfoService.UpdateWcsTaskInformation(saveModel);
        }
 
 
        /// <summary>
        /// 切换入库线体区的模式,正常模式和应急模式
        /// </summary>
        [HttpPost, Route("ChangeInboundLineModel"), AllowAnonymous]
        public WebResponseContent ChangeInboundLineModel([FromBody] SaveModel saveModel)
        {
            return WCSService.ChangeInboundLineModel(saveModel);
        }
 
 
        /// <summary>
        /// 获取入库线体当前模式状态
        /// </summary>
        [HttpPost, Route("GetInboundLineCurrentModel"), AllowAnonymous]
        public WebResponseContent GetInboundLineCurrentModel([FromBody] SaveModel saveModel)
        {
            return WCSService.GetInboundLineCurrentModel(saveModel);
        }
 
 
        /// <summary>
        /// 当校验托盘码不一致时,人工触发继续任务
        /// </summary>
        [HttpPost, Route("CheckBarcodeSameOk"), AllowAnonymous]
        public WebResponseContent CheckBarcodeSameOk([FromBody] SaveModel saveModel)
        {
            return WCSService.CheckBarcodeSameOk(saveModel);
        }
 
        /// <summary>
        /// 称重后,由人工继续任务
        /// </summary>
        [HttpPost, Route("WeightCheckOk"), AllowAnonymous]
        public WebResponseContent WeightCheckOk([FromBody] SaveModel saveModel)
        {
            return WCSService.WeightCheckOk(saveModel);
        }
 
 
        /// <summary>
        ///  取消测量,直接回库
        /// </summary>
        [HttpPost, Route("CancelAMeasureTask"), AllowAnonymous]
        public WebResponseContent CancelAMeasureTask([FromBody] SaveModel saveModel)
        {
            Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
            Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
 
            return taskWCSinfoService.CancelAMeasureTask(saveModel);
        }
 
    }
}