| | |
| | | /// <returns>库存信息</returns> |
| | | public async Task<Dt_StockInfo> GetStockInfoAsync(string palletCode, string locationCode) |
| | | { |
| | | return await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode && x.LocationCode == locationCode); |
| | | return await BaseDal.QueryDataNavFirstAsync(x => x.PalletCode == palletCode && x.LocationCode == locationCode); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | // 空托盘也有库存记录,只是不包含明细 |
| | | item.PalletCode = stockInfo.PalletCode; |
| | | item.StockStatus = stockInfo.StockStatus; // 直接使用后端库存状态 |
| | | |
| | | |
| | | // 只有当Details不为null且有数据时才处理库存明细 |
| | | if (stockInfo.Details != null && stockInfo.Details.Any()) |
| | | { |
| | | item.StockQuantity = stockInfo.Details.Sum(d => d.StockQuantity); |
| | | |
| | | item.OutboundDate = stockInfo.OutboundDate; |
| | | // 获取第一个明细的物料信息(如果存在) |
| | | var firstDetail = stockInfo.Details.FirstOrDefault(); |
| | | if (firstDetail != null) |
| | |
| | | Id = d.Id, |
| | | MaterielCode = d.MaterielCode, |
| | | MaterielName = d.MaterielName, |
| | | SerialNumber = d.SerialNumber, |
| | | BatchNo = d.BatchNo, |
| | | StockQuantity = d.StockQuantity, |
| | | Unit = d.Unit, |
| | |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error($"删除库存和明细时发生异常: {ex.Message}"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 更新MES上传状态 |
| | | /// </summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | var stockInfo = await BaseDal.QueryDataFirstAsync(x => x.PalletCode == palletCode); |
| | | var stockInfo = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode); |
| | | if (stockInfo == null) |
| | | return false; |
| | | |