| | |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway); |
| | | int lastStatus = location.LocationStatus; |
| | | location.LocationStatus = (int)LocationEnum.Free; |
| | | if (location != null) |
| | | { |
| | | int lastStatus = location.LocationStatus; |
| | | location.LocationStatus = (int)LocationEnum.Free; |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | } |
| | | task.TaskState = (int)TaskOutStatusEnum.OutFinish; |
| | | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | // 事务处理 |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | |
| | | await AddStockInfoHtyAsync(stockInfo_Hty); |
| | | } |
| | | |
| | | await UpdateLocationAsync(location); |
| | | if (location != null) |
| | | { |
| | | await UpdateLocationAsync(location); |
| | | } |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | |
| | | .Where(x => x.DeviceCode.Contains("CWSC")) // 过滤条件 |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | |
| | | var outBoundMateriel = _dt_ChangeoversRepository.QueryData(x => x.Status == "1").ToList(); |
| | | List<string>? materielCodes = outBoundMateriel.Count != 0 |
| | | ? outBoundMateriel.Where(x => x.ProductionLine == station.productLine && x.ProcessCode == "CWSC3") |
| | | .Select(x => x.MaterielCode) |
| | | .ToList() |
| | | : null; |
| | | |
| | | // 修改后的查询代码 |
| | | var stockInfo = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) |
| | |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock) |
| | | // 增加对 LocationInfo 的空值检查 |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) |
| | | .FirstAsync(); |
| | | |