kazelee
2025-05-23 e2ec31cc0062b3c1af621437554aa9a3505d2a56
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
using System.Web.Http;
 
using HH.WCS.Mobox3.DSZSH.models;
 
using Newtonsoft.Json;
 
using static HH.WCS.Mobox3.DSZSH.api.ApiModel;
using static HH.WCS.Mobox3.DSZSH.api.OtherModel;
 
namespace HH.WCS.Mobox3.DSZSH.api {
    /// <summary>
    /// Mobox3 调用,脚本中调用(包括 PDA 的接口)
    /// </summary>
    [RoutePrefix("api")]
    public class MoboxController : ApiController {
        /// <summary>
        /// 好运箱-满托下线入库(PDA)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("goodpack-offline")]
        public SimpleResult GoodpackOffline(GoodpackOfflineInfo model) {
            var apiName = "好运箱-满托下线入库(PDA)";
            LogHelper.InfoApi(apiName, model);
 
            return ApiHelper.GoodpackOffline(model);
        }
 
        ///// <summary>
        ///// 空托/空箱入库绑定(PDA)
        ///// </summary>
        ///// <param name="model"></param>
        ///// <returns></returns>
        //public SimpleResult EmptyBind(EmptyBindInfo model) {
        //    LogHelper.InfoApi("空托/空箱绑定", model);
 
        //    if (model.CntrType == "托盘") {
        //        //LogHelper.Info($"触发API:空托绑定 " + JsonConvert.SerializeObject(model), "API");
        //        return ApiHelper.EmptyBindPallet(model);
        //    }
        //    else if (model.CntrType == "好运箱") {
        //        //LogHelper.Info($"触发API:空箱绑定 " + JsonConvert.SerializeObject(model), "API");
        //        return ApiHelper.EmptyBindGoodpack(model);
        //    }
        //    else {
        //        return BuildSimpleResult(-1, $"不合法的容器类型:'{model.CntrType}'");
        //    }
        //}
 
        /// <summary>
        /// 空托/空箱入库(PDA)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("empty-inbound")]
        public SimpleResult EmptyInbound(EmptyInboundInfo model) {
            var apiName = "空托/空箱入库";
            LogHelper.InfoApi(apiName, model);
 
            if (model.CntrType == "托盘") {
                return ApiHelper.EmptyInboundPallet(model);
            }
            else if (model.CntrType == "好运箱") {
                return ApiHelper.EmptyInboundGoodpack(model);
            }
            else {
                return NewSimpleResult(-1, $"容器类型 '{model.CntrType}' 不合法:应为 '托盘' 或 '好运箱'");
            }
        }
 
        ///// <summary>
        ///// 空托/空箱上线(PDA)
        ///// </summary>
        ///// <returns>
        ///// 人工使用PDA扫码,根据物料类型判断上线空托/空箱
        ///// </returns>
        //public SimpleResult EmptyOnline(EmptyOnlineInfo model) {
        //    var db = DbHelper.GetDbClient();
        //    var locCntrRel = db.Queryable<TN_Loc_Container>()
        //        .LeftJoin<TN_CG_Detail>((lc, cd) => lc.S_CNTR_CODE == cd.S_CNTR_CODE)
        //        .Where((lc, cd) => cd.S_ITEM_CODE == model.ItemCode)
        //        .First();
 
        //    if (locCntrRel.S_CNTR_TYPE == "托盘") {
 
        //        return ApiHelper.EmptyOnlinePallet(new EmptyOnlinePalletInfo {
        //            CntId = locCntrRel.S_CNTR_CODE,
        //            EndLoc = model.EndLoc
        //        });
        //    }
        //    else if (locCntrRel.S_CNTR_TYPE == "好运箱") {
 
        //        return ApiHelper.EmptyOnlineGoodpack(new EmptyOnlineGoodpackInfo {
        //            CntId = locCntrRel.S_CNTR_CODE,
        //            EndLoc = model.EndLoc
        //        });
        //    }
        //    else {
        //        return BuildSimpleResult(-1, $"不合法的容器类型:'{locCntrRel.S_CNTR_CODE}'");
        //    }
        //}
 
        /// <summary>
        /// 托盘-空托上线(PDA)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("empty-online-pallet")]
        public SimpleResult EmptyOnlinePallet(EmptyOnlinePalletInfo model) {
            var apiName = "托盘-空托上线(PDA)";
            LogHelper.InfoApi(apiName, model);
            return ApiHelper.EmptyOnlinePallet(model);
        }
 
        /// <summary>
        /// 好运箱-空箱上线(PDA)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("empty-online-goodpack")]
        public SimpleResult EmptyOnlineGoodpack(EmptyOnlineGoodpackInfo model) {
            var apiName = "好运箱-空箱上线(PDA)";
            LogHelper.InfoApi(apiName, model);
            return ApiHelper.EmptyOnlineGoodpack(model);
        }
 
        ///// <summary>
        ///// 合格回库/不合格移库
        ///// </summary>
        ///// <param name="model"></param>
        ///// <returns></returns>
        //[HttpPost]
        //[Route("CheckShift")]
        //public SimpleResult CheckShift(CheckShiftInfo model) {
        //    LogHelper.InfoApi("合格回库/不合格移库", model);
 
        //    if (model.Qualified) {
        //        return ApiHelper.QualifiedBack(model);
        //    }
        //    else {
        //        return ApiHelper.UnqualifiedShift(model);
        //    }
        //}
 
        /// <summary>
        /// 合格回库(PDA)
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [Route("qualified-back")]
        public SimpleResult QualifiedBack(QualifiedBackInfo model) {
            var apiName = "合格回库(PDA)";
            LogHelper.InfoApi(apiName, model);
            return ApiHelper.QualifiedBack(model);
        }
 
        /// <summary>   
        /// 不合格移库(PDA)
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [Route("unqualified-shift")]
        public SimpleResult UnqualifiedShift(UnqualifiedShiftInfo model) {
            var apiName = "不合格移库(PDA)";
            LogHelper.InfoApi(apiName, model);
            return ApiHelper.UnqualifiedShift(model);
        }
 
        /// <summary>
        /// 余料尾箱回库(PDA)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("rest-back")]
        public SimpleResult RestBack(RestBackInfo model) {
            var apiName = "余料尾箱回库(PDA)";
            LogHelper.InfoApi(apiName, model);
            return ApiHelper.RestBack(model);
        }
 
        /// <summary>
        /// 成品胶出库(PDA)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("finished-outbound")]
        public SimpleResult FinishedOutbound(FinishedOutboundInfo model) {
            var apiName = "成品胶出库(PDA)";
            LogHelper.InfoApi(apiName, model);
 
            if (model.ForcedOut) {
                return ApiHelper.FinishedOutboundForce(model);
            }
            else {
                return ApiHelper.FinishedOutbound(model);
            }
        }
 
        ///// <summary>
        ///// 抽检-创建抽检单(WMS)
        ///// </summary>
        ///// <param name="model"></param>
        ///// <returns></returns>
        //[HttpPost]
        //[Route("create-check-order")]
        //public SimpleResult CreateCheckOrder(CreateCheckOrderInfo model) {
        //    return ApiHelper.CreateCheckOrder(model);
        //}
 
        ///// <summary>
        ///// 移库-创建移库任务(WMS)
        ///// </summary>
        ///// <param name="model"></param>
        ///// <returns></returns>
        //[HttpPost]
        //[Route("shift-storage")]
        //public SimpleResult CreateShiftOrder(CreateShiftOrderInfo model) {
        //    return ApiHelper.CreateShiftOrder(model);
        //}
    }
}