public async Task <AjaxResult <PB_Tray> > InManualTray(InAutoByTary data) { var StorId = _Op.Property.DefaultStorageId; var traySvc = this._provider.GetRequiredService <IPB_TrayBusiness>(); var tray = await traySvc.GetByTrayId(data.TrayCode); if (tray == null) { return new AjaxResult <PB_Tray>() { Success = false, Msg = "托盘号为空" } } ; var localSvc = this._provider.GetRequiredService <IPB_LocationBusiness>(); var local = await localSvc.GetByCode(StorId, data.LocalCode); if (local == null) { return new AjaxResult <PB_Tray>() { Success = false, Msg = "货位编号为空" } } ; var entity = new PB_Tray() { Code = tray.Code, PB_Location = local }; return(new AjaxResult <PB_Tray>() { Success = true, Msg = "空托盘手动入库成功", Data = entity }); } /// <summary> /// 空托盘查询 /// </summary> /// <returns></returns> //[HttpPost] //public async Task<AjaxResult<PB_Tray>> QueryTray(InAutoByTary data) //{ // var traySvc = this._provider.GetRequiredService<IPB_TrayBusiness>(); // var tray = await traySvc.GetByTrayId(data.TrayId); // if (tray == null) return new AjaxResult<PB_Tray>() { Success = false, Msg = "此托盘不存在" }; // return new AjaxResult<PB_Tray>() { Success = true, Msg = "托盘号查询成功", Data = tray }; //} #endregion } }
public async Task <AjaxResult <PB_Tray> > InAutoTray(InAutoByTary data) { var traySvc = this._provider.GetRequiredService <IPB_TrayBusiness>(); var tray = await traySvc.GetByTrayId(data.TrayCode); if (tray == null) { return new AjaxResult <PB_Tray>() { Success = false, Msg = "托盘号为空" } } ; var StorId = _Op.Property.DefaultStorageId; var local = await this._pB_TrayBus.InNullTray(StorId, data.TrayCode); if (local.IsNullOrEmpty()) { return new AjaxResult <PB_Tray>() { Success = false, Msg = "没有可以入库的货位" } } ; var entity = new PB_Tray() { Id = tray.Id, LocalId = local.Id, Code = tray.Code, Name = tray.Name, TrayTypeId = tray.TrayTypeId, StartTime = tray.StartTime, Status = tray.Status, Remarks = tray.Remarks, CreateTime = tray.CreateTime, CreatorId = tray.CreatorId, Deleted = tray.Deleted, PB_Location = local, }; if (!entity.Id.IsNullOrEmpty()) { await _pB_TrayBus.UpdateDataAsync(entity); } return(new AjaxResult <PB_Tray>() { Success = true, Msg = "空托盘自动入库成功", Data = entity }); //, }