| | |
| | | public string OrgCode { get; set; } |
| | | public Inventory CurInvItem { get; set; } |
| | | public ScanShelfInfo CurScanShelf { get; set; } |
| | | public string Command { get; set; } = "Normal"; |
| | | #endregion |
| | | |
| | | #region Functions |
| | | /// <summary> |
| | | /// 扫描物料并复核,如果是智能货架则亮灯提醒储位 |
| | | /// 扫描入口 |
| | | /// </summary> |
| | | public async Task<ApiAction<DefaultScanItemOutput>> ScanItem(BaseInput input) |
| | | public async Task<ApiAction<ScanOutput>> Scan(BaseInput input) |
| | | { |
| | | var action = new ApiAction<DefaultScanItemOutput>(); |
| | | var action = new ApiAction<ScanOutput>(); |
| | | try |
| | | { |
| | | if (input.SN.IsNullOrEmpty()) |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("条码不能为空"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure"); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | //扫描物料并复核 |
| | | { |
| | | action = await ScanItem(input); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //取消当前操作 |
| | | ResetInfo(); |
| | | //action.CatchExceptionWithLog(ex, $"扫描[{input.SN}]异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN)); |
| | | } |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 扫描物料并复核,如果是智能货架则亮灯提醒储位 |
| | | /// </summary> |
| | | public async Task<ApiAction<ScanOutput>> ScanItem(BaseInput input) |
| | | { |
| | | var action = new ApiAction<ScanOutput>(new ScanOutput() { Command = Command }); |
| | | try |
| | | { |
| | | //解析条码 |
| | | Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true); |
| | | if (!result.IsSuccessed) |
| | |
| | | throw dbTran.ErrorException; |
| | | } |
| | | |
| | | action.Data = new DefaultScanItemOutput() |
| | | action.Data.Data = new DefaultScanItemOutput() |
| | | { |
| | | SN = CurInvItem.SN, |
| | | ItemCode = CurInvItem.ItemInfo.ITEM_CODE, |
| | |
| | | ScanAfCut = CurInvItem.Warehouse.SCAN_AF_CUT |
| | | }; |
| | | //action.LocaleMsg = Biz.L($"扫描条码[{0}]从储位[{1}]下架成功"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.TakeDownSucceeded", action.Data.SN, action.Data.locationCode); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.TakeDownSucceeded", CurInvItem.SN, CurInvItem.Location?.LOCATION_CODE); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ResetInfo(); |
| | | //action.CatchExceptionWithLog(ex, $"扫描条码[{input.SN}]复核异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", action.Data.SN)); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); |
| | | } |
| | | return action; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 扫描货架或者储位(供亮灯货架使用) |
| | | /// </summary> |
| | | public async Task<ApiAction<ScanShelfInfo>> ScanShelf(string Code) |
| | | public async Task<ApiAction<ScanOutput>> ScanShelf(string Code) |
| | | { |
| | | var action = new ApiAction<ScanShelfInfo>(); |
| | | var action = new ApiAction<ScanOutput>(new ScanOutput() { Command = Command }); |
| | | try |
| | | { |
| | | if (Code.IsNullOrEmpty()) |
| | |
| | | CurScanShelf.WarehouseCode = whUnit.WH_CODE; |
| | | CurScanShelf.RegionCode = whUnit.REGION_CODE; |
| | | CurScanShelf.ShelfCode = whUnit.SHELF_CODE; |
| | | CurScanShelf.LocationCode = whUnit.LOCATION_CODE; |
| | | CurScanShelf.ShelfType = whUnit.SHELF_TYPE; |
| | | CurScanShelf.IsSmartRack = true; |
| | | } |
| | | // 扫描储位代码 |
| | | // 扫描库位代码 |
| | | else |
| | | { |
| | | var nLocation = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).FirstAsync(); |
| | | 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; |
| | |
| | | // return action; |
| | | // } |
| | | //} |
| | | |
| | | CurScanShelf.Shelf = nLocation.Shelf; |
| | | CurScanShelf.Location = nLocation.Location; |
| | | CurScanShelf.WarehouseCode = nLocation.WH_CODE; |
| | | CurScanShelf.RegionCode = nLocation.REGION_CODE; |
| | |
| | | CurScanShelf.IsScanShelf = true; |
| | | //action.LocaleMsg = Biz.L("扫描货架/储位[{0}]成功"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ScanSucceeded", Code); |
| | | action.Data = CurScanShelf; |
| | | action.Data.Data = CurScanShelf; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | public override void ResetInfo() |
| | | { |
| | | base.ResetInfo(); |
| | | Command = null; |
| | | CurInvItem = null; |
| | | CurScanShelf = null; |
| | | } |