服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-05-31 d4c326deaa51e7d4897a84afc339684012b8cfbe
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
using Rhea.Common;
using Microsoft.AspNetCore.Http;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Tiger.Model;
using Tiger.IBusiness;
using Tiger.Model.Sharetronic.Shelf;
using Tiger.Business.WMS.Sharetronic.Shelf;
 
namespace Tiger.Business.WMS.Transaction
{
    /// <summary>
    /// 客供料入库清点事务
    /// </summary>
    public class CustomerSupplyInNew : WMSTransactionBase, ICustomerSupplyInNew
    {
        /// <summary>
        /// 事务初始化函数
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userCode"></param>
        /// <param name="apiHost"></param>
        /// <param name="orgCode"></param>
        /// <returns></returns>
        public ICustomerSupplyInNew Init(string id, string userCode, string apiHost, string orgCode)
        {
            TransID = id;
            UserCode = userCode;
            ApiHost = apiHost;
            OrgCode = orgCode;
            Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]");
            return this;
        }
 
        #region Propertys & Variables
        public string UserCode { get; set; }
        public long UserId { get; set; }
        public string RackCode { get; set; }
        public string WarehouseCode { get; set; }
        public string WarehouseName { get; set; }
        public string OrgCode { get; set; }
        public WMS_SHELF Shelf { get; set; }
 
        public Model.Minsun.CustomerSupplyPuton CustomerSupplyPuton { get; set; }
        #endregion
 
        #region Functions
 
        public async Task<ApiAction> OtherInToT100(string billCode) 
        {
            var action = new ApiAction();
            try
            {
                string UserCode = "";
                string CurOrg = "";
                List<Detail4> detail2s = new List<Detail4>();
                var billHeader = Biz.Db.Queryable<BIZ_ERP_OTH_IN>().Where(t => t.BILLCODE.ToUpper() == billCode).First();
                var Details = await Biz.Db.Queryable<BIZ_ERP_OTH_IN_DTL>().Where(t => t.BILLCODE == billCode).ToListAsync();
                foreach (var item in Details)
                {
                    UserCode = item.UPDATE_USER;
                    CurOrg = item.AUTH_ORG;
                    detail2s.Add(new Detail4
                    {
                        pmdtseq = "1",
                        pmdt027 = billHeader.ERP_BILL_CODE,
                        pmdt028 = item.BILLLINE.ToString(),
                        pmdt006 = item.ITEM_CODE,
                        pmdt020 = item.QTY.ToString(),
                        pmdtud011 = "0",
                        pmdt016 = item.WAREHOUSECODE,
                        pmdt017 = "",
                        pmdt018 = billHeader.REMARK
                    });
                }
                var ret = ErpT100.GenerateOtherIn(new OtherInputParameter<Detail4>
                {
                    parameter = new InParameter<Detail4>
                    {
                        pmdstype = "6",
                        pmdsdocno = "3538",                //--单别
                        pmdsdocdt = DateTime.Now.ToString("yyyy-MM-dd"), //"2022/3/24",   
                        pmds002 = UserCode == "admin" ? "00000" : UserCode, //"00000",           
                        pmds003 = "",
                        pmds006 = billHeader.ERP_BILL_CODE,
                        pmds007 = "C0006",
                        detail = detail2s
                    },
                    datakey = new Datakey
                    {
                        EntId = "88",
                        CompanyId = CurOrg
                    }
                });
                if (ret.payload.std_data.execution.code != "0")
                {
                    action.IsSuccessed = false;
                    action.Message = $"其他入库单[{billCode}],收货单[{billHeader.ERP_BILL_CODE}],错误信息:[{ret.payload.std_data.execution.description}]";
                    return action;
                }
                else
                {
                    action.Message += $"其他入库单[{billCode}],收货单[{billHeader.ERP_BILL_CODE}]入库完成,扣账成功返回T100入库单据[{ret.payload.std_data.parameter.docno}]";
                }
            }
            catch (Exception ex)
            {
                action.CatchExceptionWithLog(ex, $"其他入库单[{billCode}]过账异常");
            }
            return action;
        }
 
        /// <summary>
        /// 扫描物料并复核,如果物料已经完成移库则货架上亮灯提醒储位
        /// </summary>
        public async Task<ApiAction> ScanItem(CustSupplyInInput input)
        {
            var action = new ApiAction();
            var multiRet = new Model.Minsun.MultiInvInStorageOutput();
            try
            {
                if (string.IsNullOrEmpty(input.SN))
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.SnEmptyFailure"); // $"条码不能为空!";
                    return action;
                }
                //货架为空则扫描的认为是货架
                if (string.IsNullOrEmpty(RackCode))
                {
                    //action.IsSuccessed = false;
                    //action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.ShelfEmptyFailure"); 
                    var _action = await ScanShelf(input.SN);
                    action.LocaleMsg = _action.LocaleMsg;
                    action.IsSuccessed = _action.IsSuccessed;
                    action.Data = _action.Data;
                    return action;
                }
                var nLocation = new WMS_LOCATION();
                input.AuthOption.OrgCode.IsNullOrEmpty(input.AuthOption.CurOrg);
                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.GetK(input.SN, input.AuthOption, true);
                if (!result.IsSuccessed)
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = result.LocaleMsg;
                    return action;
                }
                var inv = result.Data;
 
                //判断是否一维码
                if (!inv.IsQRCode)
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", inv.Barcode.MetaSn);
                    return action;
                }
                //验证条码是否正确
                if (!inv.isNormalStatus || inv.Status != WMS_ITEM.STATUSs.WaitIn)
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',',inv.StatusList.Select(x => x.GetDesc())));
                    return action;
                }
 
                // 根据物料Barcode 检索清点扫描表
                var barcodeScanned = Biz.Db.Queryable<BIZ_ERP_OTH_IN_SN>().Where(t => t.SN.ToUpper() == inv.SN.ToUpper()).First();
                if (barcodeScanned == null)
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotCounted", inv.SN); // $"此物料条码未做清点,不能入库";
                    return action;
                } 
                //物料验证
                if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N")
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode));
                    return action;
                }
                else
                {
                    if (inv.Status != WMS_ITEM.STATUSs.WaitIn || barcodeScanned.BUSINESSCODE.IsNullOrEmpty())
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotGenerateBill", inv.SN); //$"此物料条码未生成库存单据,不能入库";
                        return action;
                    }
 
                    if (barcodeScanned.WAREHOUSECODE.ToUpper() != WarehouseCode.ToUpper())
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L("此物料条码清点仓库与库位仓库不同,不能入库", inv.SN); //$"此物料条码清点仓库与库位仓库不同,不能入库";
                        return action;
                    }
 
                    if (barcodeScanned.QTY != inv.Barcode.Qty.ToDecimal())
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.DiffQty", inv.SN); //$"此物料条码入库数量与清点数量不同,不能入库";
                        return action;
                    }
                }
 
                // 判断是否智能货架
                if (CustomerSupplyPuton.IsSmartRack)
                {
                    ShelfApiResult shelfApiResult = await Share.Shelf.PutOn(TransID, Shelf, inv.Items[0]);
                    if (!shelfApiResult.IsSuccess)
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L(shelfApiResult.GetData<string>());
                        return action;
                    }
                    var reaultShelf = shelfApiResult.GetData<ShelfChangeModel>();
                    //Logger.Default.Info($"智能货架返回信息:${JsonConvert.SerializeObject(reaultShelf.)}");
 
                    nLocation = reaultShelf.GetLocation();
                    if (nLocation == null)
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L($"系统不存在储位,请先维护货架信息");
                        return action;
                    }
                    var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.ID && q.AUTH_ORG == OrgCode).First();
                    if (!locationData.IsNullOrEmpty())
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L($"系统当前库位存在料盘,请检查系统库存信息");
                        return action;
                    }
                    CustomerSupplyPuton.LocationCode = nLocation.LOCATION_CODE;
                }
                else
                {
 
                    if (CustomerSupplyPuton.LocationCode.IsNullOrEmpty() || CustomerSupplyPuton.WarehouseCode.IsNullOrEmpty())
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.LocationEmptyFailure"); //$"请先扫描库位码";
                        return action;
                    }
 
 
                    //验证库位盘数 和 剩余可放数量
                    //var nStorageLotInfos = await Biz.Db.Queryable<WMS_STORAGELOTINFO>().Where(t => t.LOCATIONCODE == CustomerSupplyPuton.LocationCode.ToUpper()).ToListAsync();
                    //if (nStorageLotInfos.Count >= CustomerSupplyPuton.LotCount)
                    //{
                    //    action.IsSuccessed = false;
                    //    action.Message = $"库位盘数已满,该库位只能存放[{CustomerSupplyPuton.LotCount}]盘";
                    //    return action;
                    //}
 
                    //var nUsedCapacity = nStorageLotInfos.Any() ? nStorageLotInfos.Sum(x => x.QTY) : 0;
                    //if (CustomerSupplyPuton.MaxSize <= (nUsedCapacity + nDisassembleBarcode.LotQty))
                    //{
                    //    action.IsSuccessed = false;
                    //    action.Message = $"该库位的剩余容量[{Math.Round(CustomerSupplyPuton.MaxSize - nUsedCapacity, 2)}]无法放入当前条码,请确认";
                    //    return action;
                    //}
 
                    nLocation = await Biz.Db.Queryable<WMS_LOCATION>().Where(t => t.LOCATION_CODE == CustomerSupplyPuton.LocationCode).FirstAsync();
                }
 
                string billCode = barcodeScanned.BUSINESSCODE;
                string billLine = barcodeScanned.BUSINESSLINE;
 
                foreach (var item in inv.Items)
                {
                    item.TRANS_CODE = nameof(BIZ_ERP_OTH_IN);
                    item.TRANS_NO = billCode;
                    item.TRANS_LINE = billLine.ToString();
                }
 
                //执行入库
                Result<PutOnInfo> onResult = WMS_ITEM_Biz.WmsItem.PutOn(inv, input.AuthOption, nLocation.LOCATION_CODE);
                if (!onResult.IsSuccessed) {
                    action.IsSuccessed = false;
                    action.LocaleMsg = onResult.LocaleMsg;
                    return action;
                }
                PutOnInfo putOnInfo = onResult.Data;
 
                #region 更新单据信息
                barcodeScanned.STATUS = WMS_ITEM.STATUSs.InStore.GetValue();
                //其他出入库单
                //新单据行状态
                var billDetail = Biz.Db.Queryable<BIZ_ERP_OTH_IN_DTL>().Where(t => t.BILLCODE.ToUpper() == billCode.ToUpper() && t.BILLLINE == billLine).First();
                var total = Biz.Db.Queryable<BIZ_ERP_OTH_IN_SN>().Where(t => t.BUSINESSCODE.ToUpper() == billCode.ToUpper() && t.BUSINESSLINE == billLine)
                    .Where(x=>x.STATUS == WMS_ITEM.STATUSs.InStore.GetValue() || x.SN == inv.SN).Sum(x => x.QTY);
                billDetail.DELIVERYDATE = DateTime.Now.Date;
                billDetail.QTY = total; //inv.Barcode.Qty.ToDecimal();
                var isCompleted = false;
                // 更新单据HEADER状态
                var billHeader = Biz.Db.Queryable<BIZ_ERP_OTH_IN>().Where(t => t.BILLCODE.ToUpper() == billCode).First();
                if (billDetail.QTY == billDetail.PRQTY)
                {
                    billDetail.LINESTATUS = BIZ_ERP_OTH_IN.STATUSs.COMPLETE.GetValue();
                    
                    if (!Biz.Db.Queryable<BIZ_ERP_OTH_IN_DTL>().Where(t => t.BILLCODE.ToUpper() == billCode.ToUpper() && t.BILLLINE != billLine && t.LINESTATUS != BIZ_ERP_OTH_IN.STATUSs.COMPLETE.GetValue()).Any())
                    {
                        billHeader.STATUS = BIZ_ERP_OTH_IN.STATUSs.COMPLETE.GetValue();
                        isCompleted = true;
                    }
                }
                else
                {
                    billDetail.LINESTATUS = BIZ_ERP_OTH_IN.STATUSs.WORKING.GetValue();
                }
                Logger.Default.Info($"更新单据明细信息[BIZ_ERP_OTH_IN_DTL]:单号[{billCode}],项次[{billLine}],数量[{billDetail.QTY}],状态[{billDetail.LINESTATUS}]");
                action.LocaleMsg = Biz.L($"更新单据明细信息[BIZ_ERP_OTH_IN_DTL]:单号[{billCode}],项次[{billLine}],数量[{billDetail.QTY}],状态[{billDetail.LINESTATUS}]");
                #endregion
 
 
                //保存到数据库
                var db = Business.Biz.Db;
                var dbTran = db.UseTran(() =>
                {
                    //入库
                    db.Updateable(putOnInfo.Items, UserCode).ExecuteCommand();
                    var x = db.Storageable(putOnInfo.ItemsExt,UserCode).ToStorage();
                    x.AsInsertable.ExecuteCommand();//不存在插入
                    x.AsUpdateable.ExecuteCommand();//存在更新
                    //db.Updateable(putOnInfo.ItemsExt, UserCode).ExecuteCommand();
                    db.Insertable(putOnInfo.History, UserCode).ExecuteCommand();
                    db.Updateable(putOnInfo.Packages, UserCode).ExecuteCommand();
 
                    db.Updateable(barcodeScanned, UserCode).ExecuteCommand();
                    db.Updateable(billDetail,UserCode).ExecuteCommand();
                    db.Updateable(billHeader, UserCode).ExecuteCommand();
 
                });
                if (!dbTran.IsSuccess)
                {
                    Logger.Default.Fatal(dbTran.ErrorException, "Database transaction save exception");
                    this.Close(!dbTran.IsSuccess);
                    throw dbTran.ErrorException;
                }
 
                //生成其他入库单
                if (isCompleted)
                {
                    List<Detail4> detail2s = new List<Detail4>();
                    var Details = await Biz.Db.Queryable<BIZ_ERP_OTH_IN_DTL>().Where(t => t.BILLCODE.ToUpper() == billCode.ToUpper()).ToListAsync();
                    foreach (var item in Details)
                    {
                        detail2s.Add(new Detail4
                        {
                            pmdtseq = "1",
                            pmdt027 = billHeader.ERP_BILL_CODE,
                            pmdt028 = item.BILLLINE.ToString(),
                            pmdt006 = item.ITEM_CODE,
                            pmdt020 = item.QTY.ToString(),
                            pmdtud011 = "0",
                            pmdt016 = item.WAREHOUSECODE,
                            pmdt017 = "",
                            pmdt018 = billHeader.REMARK
                        });
                    }
                    var ret = ErpT100.GenerateOtherIn(new OtherInputParameter<Detail4>
                    {
                        parameter = new InParameter<Detail4>
                        {
                            pmdstype = "6",
                            pmdsdocno = "3538",                //--单别
                            pmdsdocdt = DateTime.Now.ToString("yyyy-MM-dd"), //"2022/3/24",   
                            pmds002 = UserCode == "admin" ? "00000" : UserCode, //"00000",           
                            pmds003 = "",
                            pmds006 = billHeader.ERP_BILL_CODE,
                            pmds007 = "C0006",
                            detail = detail2s
                        },
                        datakey = new Datakey
                        {
                            EntId = "88",
                            CompanyId = input.AuthOption.CurOrg
                        }
                    });
                    if (ret.payload.std_data.execution.code != "0")
                    {
                        action.IsSuccessed = false;
                        action.Message = $"其他入库单[{billCode}],收货单[{billHeader.ERP_BILL_CODE}],错误信息:[{ret.payload.std_data.execution.description}]";
                        return action;
                    }
                    else
                    {
 
                        action.Message += $"其他入库单[{billCode}],收货单[{billHeader.ERP_BILL_CODE}]入库完成,扣账成功返回T100入库单据[{ret.payload.std_data.parameter.docno}]";
                    }
                }
                // 返回其他入库对象
                action.Data = new Model.Minsun.OtherInstockBarcodeOutput
                {
                    Barcode = inv.SN,
                    MaterialCode = inv.ItemInfo.ITEM_CODE,
                    MaterialName = inv.ItemInfo.ITEM_NAME,
                    MaterialStandard = inv.ItemInfo.SPEC,
                    InitialQty = inv.Barcode.Qty??0,
                    CurrentQty = inv.Barcode.Qty ?? 0,
                    Unit = inv.ItemInfo.UNIT,
                    DateCode = inv.Barcode.ProdDate??DateTime.MinValue,
                    //Period = inv.PeriodDays.HasValue ? inv.LotDate.AddDays(inv.PeriodDays.Value) : (DateTime?)null,
                    LotNo = inv.SN,  //批次号默认为外包装条码
                    SourceBillCode = billCode,
                    SourceBillLine = Convert.ToInt32(billLine),
                    //StateFlag = inv.StateFlag,
                    LocationCode = nLocation.LOCATION_CODE,
                    ReceiptCode = barcodeScanned?.BUSINESSCODE,
                    IncompleteTips = iWMS.GetERP_OTH_INTips(barcodeScanned?.BUSINESSCODE, barcodeScanned?.ITEM_CODE),//isCompleted ? "数量:0 (0盘)" : 
                    IsScanShelf = false
                };
            }
            catch (Exception ex)
            {
                //取消当前操作
 
                action.CatchExceptionWithLog(ex, $"扫描物料[{input.SN}]复核异常");
            }
            return action;
        }
 
        /// <summary>
        /// 扫描货架或者储位
        /// </summary>
        public async Task<ApiAction<Model.Minsun.CustomerSupplyPuton>> ScanShelf(string Code)
        {
            var action = new ApiAction<Model.Minsun.CustomerSupplyPuton>();
            try
            {
                if (Code.IsNullOrEmpty())
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.ShelfCanNotEmpty");
                    return action;
                }
 
                CustomerSupplyPuton = new Model.Minsun.CustomerSupplyPuton();
 
                // 查询货架信息
                var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.SHELF_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync();
 
                // 扫描货架代码,且为智能货架
                if (whUnit != null && whUnit.SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.Smart.GetValue())
                {
                    CustomerSupplyPuton.WarehouseCode = whUnit.WH_CODE;
                    CustomerSupplyPuton.RackCode = whUnit.SHELF_CODE;
                    CustomerSupplyPuton.ShelfType = whUnit.SHELF_TYPE;
                    CustomerSupplyPuton.IsSmartRack = true;
                    Shelf = whUnit.Shelf;
                    
                }
                // 扫描库位代码
                else
                {
                    var nLocation = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).FirstAsync();
                    if (nLocation == null)
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotExist", Code);
                        return action;
                    }
 
                    if (nLocation.IS_ACTIVE == "N")
                    {
                        action.IsSuccessed = false;
                        action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.ShelfOrLocationDisabled");
                        return action;
                    }
                    if (nLocation.SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.Smart.GetValue() || nLocation.SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.QRCode.GetValue())
                    {
                        var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.LOCATION_ID && q.AUTH_ORG == OrgCode).First();
                        if (!locationData.IsNullOrEmpty())
                        {
                            action.IsSuccessed = false;
                            action.LocaleMsg = Biz.L($"系统当前库位存在料盘,请检查系统库存信息");
                            return action;
 
                        }
                    }
                    //var nStorageLotInfos = await Biz.Db.Queryable<WMS_STORAGELOTINFO>().Where(x => x.LOCATIONCODE.ToUpper() == nLocation.LOCATIONCODE.ToUpper()).ToListAsync();
                    //if (nStorageLotInfos.Count >= nLocation.LOTCOUNT)
                    //{
                    //    action.IsSuccessed = false;
                    //    action.Message = $"库位盘数已满,该库位只能存放[{nLocation.LOTCOUNT}]盘";
                    //    return action;
                    //}
 
                    // 计算库位剩余容量
                    //var nUsedCapacity = nStorageLotInfos.Any() ? nStorageLotInfos.Sum(x => x.QTY) : 0;
                    //if (nLocation.MAXSIZE <= nUsedCapacity)
                    //{
                    //    action.IsSuccessed = false;
                    //    action.Message = $"该库位已经放满";
                    //    return action;
                    //}
 
                    CustomerSupplyPuton.LocationCode = nLocation.LOCATION_CODE;
                    CustomerSupplyPuton.WarehouseCode = nLocation.WH_CODE;
                    //CustomerSupplyPuton.Capacity = nLocation.MAXSIZE - nUsedCapacity;
                    //CustomerSupplyPuton.LotCount = nLocation.LOTCOUNT;
                    //CustomerSupplyPuton.MaxSize = nLocation.MAXSIZE;
                    CustomerSupplyPuton.IsSmartRack = false;
                    CustomerSupplyPuton.RackCode = nLocation.SHELF_CODE;
                }
                WarehouseCode = CustomerSupplyPuton.WarehouseCode;
                RackCode = CustomerSupplyPuton.RackCode;
                CustomerSupplyPuton.IsScanShelf = true;
                action.Data = CustomerSupplyPuton;
            }
            catch (Exception ex)
            {
                //取消当前操作
 
                action.CatchExceptionWithLog(ex, $"扫描货架或者储位[{Code}]异常");
            }
            return action;
        }
 
        #endregion
 
        public override bool Close(bool needSaveHistoryLog = false)
        {
            //保存操作日志
 
            this.IsFinished = true;
            return IsFinished ? base.Close(needSaveHistoryLog) : IsFinished;
        }
 
    }//endClass
}