| | |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure"); |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | //货架为空则扫描的认为是货架 |
| | | if (string.IsNullOrEmpty(CurScanShelf?.ShelfCode)) |
| | | //判断扫描的是否货架 |
| | | var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == input.SN || t.LOCATION_CODE.ToUpper() == input.SN) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); |
| | | //if (string.IsNullOrEmpty(CurScanShelf?.ShelfCode)) |
| | | if (!whUnit.IsNullOrEmpty()) |
| | | { |
| | | action = await ScanShelf(input.SN); |
| | | action = await ScanShelf(input.SN, whUnit); |
| | | } |
| | | //扫描物料并复核 |
| | | else//扫描物料并复核 |
| | | { |
| | | action = await ScanItem(input); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 扫描货架或者储位 |
| | | /// </summary> |
| | | public async Task<ApiAction<ScanOutput>> ScanShelf(string Code) |
| | | public async Task<ApiAction<ScanOutput>> ScanShelf(string Code, V_WH_UNIT whUnit) |
| | | { |
| | | var action = new ApiAction<ScanOutput>(new ScanOutput() { Command = Command }); |
| | | try |
| | |
| | | CurScanShelf = new ScanShelfInfo(); |
| | | |
| | | // 查询货架信息 |
| | | var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.SHELF_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); |
| | | whUnit = whUnit.IsNullOrEmpty(await Biz.Db.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == Code || t.LOCATION_CODE.ToUpper() == Code) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync()); |
| | | |
| | | // 扫描货架代码,且为智能货架 |
| | | if (whUnit != null && whUnit.SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.Smart.GetValue()) |
| | | if (!whUnit.IsNullOrEmpty() && whUnit.SHELF_CODE == Code) |
| | | { |
| | | CurScanShelf.Shelf = whUnit.Shelf; |
| | | CurScanShelf.WarehouseCode = whUnit.WH_CODE; |
| | |
| | | CurScanShelf.IsSmartRack = true; |
| | | } |
| | | // 扫描库位代码 |
| | | else |
| | | else if (!whUnit.IsNullOrEmpty() && whUnit.LOCATION_CODE == Code) |
| | | { |
| | | var nLocation = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); |
| | | if (nLocation == null) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("储位[{0}]不存在"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.LocationNotExist", Code); |
| | | return action; |
| | | } |
| | | if (nLocation.IS_ACTIVE == "N") |
| | | //var nLocation = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); |
| | | //if (nLocation == null) |
| | | //{ |
| | | // action.IsSuccessed = false; |
| | | // //action.LocaleMsg = Biz.L("储位[{0}]不存在"); |
| | | // action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.LocationNotExist", Code); |
| | | // return action; |
| | | //} |
| | | if (whUnit.IS_ACTIVE == "N") |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("扫描的储位[{0}]未启用"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfOrLocationDisabled", Code); |
| | | return action; |
| | | } |
| | | if (nLocation.Shelf.IsLightShelf || nLocation.Location.IS_SINGLE == "Y") |
| | | if (whUnit.Shelf.IsLightShelf || whUnit.Location.IS_SINGLE == "Y") |
| | | { |
| | | var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.LOCATION_ID && q.AUTH_ORG == OrgCode).First(); |
| | | var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == whUnit.LOCATION_ID && q.AUTH_ORG == OrgCode).First(); |
| | | if (!locationData.IsNullOrEmpty()) |
| | | { |
| | | action.IsSuccessed = false; |
| | |
| | | return action; |
| | | } |
| | | } |
| | | CurScanShelf.Shelf = nLocation.Shelf; |
| | | CurScanShelf.Location = nLocation.Location; |
| | | CurScanShelf.WarehouseCode = nLocation.WH_CODE; |
| | | CurScanShelf.RegionCode = nLocation.REGION_CODE; |
| | | CurScanShelf.ShelfCode = nLocation.SHELF_CODE; |
| | | CurScanShelf.LocationCode = nLocation.LOCATION_CODE; |
| | | CurScanShelf.Shelf = whUnit.Shelf; |
| | | CurScanShelf.Location = whUnit.Location; |
| | | CurScanShelf.WarehouseCode = whUnit.WH_CODE; |
| | | CurScanShelf.RegionCode = whUnit.REGION_CODE; |
| | | CurScanShelf.ShelfCode = whUnit .SHELF_CODE; |
| | | CurScanShelf.LocationCode = whUnit.LOCATION_CODE; |
| | | CurScanShelf.IsSmartRack = false; |
| | | } |
| | | else |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("请输入或扫描有效的货架/储位码"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty"); |
| | | return action; |
| | | } |
| | | |
| | | CurScanShelf.IsScanShelf = true; |
| | | //action.LocaleMsg = Biz.L("扫描货架/储位[{0}]成功"); |