杨前锦
2025-07-07 c8f338feee0b6003d8f069b1d37fd9b90dd1b7f4
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
using HH.WCS.Mobox3.SXJK.dispatch;
using HH.WCS.Mobox3.SXJK.models;
using HH.WCS.Mobox3.SXJK.process;
using HH.WCS.Mobox3.SXJK.wms;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Web.Http;
using static HH.WCS.Mobox3.SXJK.api.ApiHelper;
using static HH.WCS.Mobox3.SXJK.api.ApiModel;
using static HH.WCS.Mobox3.SXJK.api.OtherModel;
using HH.WCS.Mobox3.SXJK.device;
using HH.WCS.Mobox3.SXJK.util;
using System.Linq;
 
 
namespace HH.WCS.Mobox3.SXJK.api {
    /// <summary>
    /// mobox3调用,脚本中调用
    /// </summary>
    public class MoboxController : System.Web.Http.ApiController {
 
        /// <summary>
        /// 入库单重置
        /// </summary>
        /// <returns></returns>
        public SimpleResult inventoryReceiptReset(InventoryReceiptResetModel model)
        {
            LogHelper.Info("[入库单重置]inventoryReceiptReset 入参:" + JsonConvert.SerializeObject(model), "Mobox");
            SimpleResult simpleResult = new SimpleResult();
            ApiHelper.inventoryReceiptReset(model);
            LogHelper.Info("[入库单重置]inventoryReceiptReset 出参:" + JsonConvert.SerializeObject(simpleResult), "Mobox");
            return simpleResult;
        }
 
        public class InventoryReceiptResetModel 
        {
            public string asnNo { get; set; }  // 入库单号
        }
 
        /// <summary>
        /// 远程启动输送线
        /// </summary>
        /// <returns></returns>
        public SimpleResult remoteBootMachine(remoteBootMachineModel model) 
        {
            LogHelper.Info("[远程启动输送线]remoteBootMachine 入参:" + JsonConvert.SerializeObject(model), "Mobox");
            SimpleResult simpleResult = new SimpleResult();
            bool bo = false;
            var lineDeviceInfo = Settings.lineDeviceInfos.Where(a => a.deviceNo == model.deviceNo && a.type == 3) .First();
            if (lineDeviceInfo != null) 
            {
                bo = S7Helper.WriteInt(lineDeviceInfo.deviceNo, 101, lineDeviceInfo.writeAddr + 18, model.signal);
            }
            simpleResult.resultCode = bo ? 0 : 1;
            LogHelper.Info("[远程启动输送线]remoteBootMachine 出参:" + JsonConvert.SerializeObject(simpleResult), "Mobox");
            return simpleResult;
        }
 
        public class remoteBootMachineModel 
        {
            public string deviceNo { get; set; }
            public short signal { get; set; }
        }
 
        /// <summary>
        /// 更新抽检信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public SimpleResult updateSpotCheckInfo(SpotCheckListModel model)
        {
            LogHelper.Info("updateSpotCheckInfo Request:" + JsonConvert.SerializeObject(model), "Mobox");
            return ApiHelper.updateSpotCheckInfo(model);
        }
 
        /// <summary>
        /// 任务取消(目前支持ndc)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public SimpleResult CancelTask(MoboxTaskBase model) {
            var result = new SimpleResult();
            var task = WCSHelper.GetTask(model.TaskNo);
            if (task != null) {
                if (task.S_B_STATE.Trim() == "等待") {
                    //等待直接修改状态为取消
                    WCSHelper.UpdateStatus(model.TaskNo, "取消");
                    result.resultMsg = "任务等待,直接取消";
                }
                else if (task.S_B_STATE.Trim() != "取消" && task.S_B_STATE.Trim() != "完成") {
                    //已推送但是没有完成或者取消,通知hosttoagv
                    NDCHelper.Cancel(task.S_CODE.Trim());
                    result.resultMsg = "任务取消已经发送给小车";
                }
                else {
                    result.resultCode = 1;
                    result.resultMsg = "任务已结束";
                }
            }
            else {
                result.resultCode = 1;
                result.resultMsg = "任务不存在";
            }
            return result;
        }
        /// <summary>
        /// 任务强制完成(目前支持ndc)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public SimpleResult CompleteTask(MoboxTaskBase model) {
            var result = new SimpleResult();
            return result;
        }
 
 
        /// <summary>
        /// 码盘校验
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public SimpleResult PalletSorting(PalletSorting model) {
            return ApiHelper.PalletSorting(model);
        }
        /// <summary>
        /// 码盘校验不带上架(入库)单号
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public SimpleResult PalletSorting1(PalletSorting1 model) {
            return ApiHelper.PalletSorting1(model);
        }
        /// <summary>
        /// pda入库申请
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public SimpleResult Instock(InstockInfo model) {
            return ApiHelper.Instock(model);
 
        }
 
        /// <summary>
        /// 发货单执行
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public SimpleResult ShippingOrderExecute(ShippingOrderCheck model) {
            return ApiHelper.ShippingOrderExecute(model);
 
        }
        /// <summary>
        /// 分拣单执行
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public SimpleResult SortingOrderExecute(SortingOrderCheck model) {
            return ApiHelper.SortingOrderExecute(model);
 
        }
        /// <summary>
        /// 分拣结果确认(前端拦截数量不可以超过分拣明细中 F_QTY-F_ACC_SR_QTY的数量)
        /// </summary>
        /// <returns></returns>
        public SimpleResult SortingResultCheck(List<SortingResultCheck> models) {
            return ApiHelper.SortingResultCheck(models);
 
        }
        /// <summary>
        /// 判断是否是整托分拣
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public SimpleResult CheckSortingWholeCntr(CheckSortingWholeCntr model) {
            return ApiHelper.CheckSortingWholeCntr(model);
 
        }
    }
}