修复bug

This commit is contained in:
18942506660
2024-04-08 14:28:26 +08:00
parent 4a8551ed84
commit f1f9dc4893

View File

@@ -287,23 +287,23 @@ namespace WMS.Web.Repositories
var materials = materials_result.Data.ToList();
var res = _context.SerialNumbers_Ops
//.GroupJoin(_context.BoxInventory.Include(x => x.Details), serial => serial.BoxId, boxInventory => boxInventory.BoxId, (serial, boxInventory) => new { serial, boxInventory })
//.SelectMany(x => x.boxInventory.DefaultIfEmpty(), (p, boxInventory) => new { p.serial, boxInventory })
//.GroupJoin(_context.Box, s => s.serial.BoxId, box => box.Id, (s, box) => new { s.serial, s.boxInventory, box })
//.SelectMany(x => x.box.DefaultIfEmpty(), (p, box) => new { p.serial, p.boxInventory, box })
.Where(w => serialNumber.Equals(w.SerialNumber));
if (IsIncludeDelete == false) res = res.Where(w => w.IsDelete != true);
.GroupJoin(_context.BoxInventory.Include(x => x.Details), serial => serial.BoxId, boxInventory => boxInventory.BoxId, (serial, boxInventory) => new { serial, boxInventory })
.SelectMany(x => x.boxInventory.DefaultIfEmpty(), (p, boxInventory) => new { p.serial, boxInventory })
.GroupJoin(_context.Box, s => s.serial.BoxId, box => box.Id, (s, box) => new { s.serial, s.boxInventory, box })
.SelectMany(x => x.box.DefaultIfEmpty(), (p, box) => new { p.serial, p.boxInventory, box })
.Where(w => serialNumber.Equals(w.serial.SerialNumber));
if (IsIncludeDelete == false) res = res.Where(w => w.serial.IsDelete != true);
var entity = await res.FirstOrDefaultAsync();
if (entity == null) return null;
response.IsOldOps = true;
response.IsBoxInventory = true;//如果是老ops序列号 默认有库存
response.BoxId = 0;
response.BoxBillNo = "";
response.SubStockCode = "";
response.SerialNumber = entity.SerialNumber;
response.MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, entity.MaterialNumber);
response.MaterialNumber = entity.MaterialNumber;
response.Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, entity.MaterialNumber);
response.BoxId = entity.serial.BoxId;
response.BoxBillNo = entity?.box?.BoxBillNo ?? "";
response.SubStockCode = entity?.boxInventory?.SubStockCode ?? "";
response.SerialNumber = entity.serial.SerialNumber;
response.MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, entity.serial.MaterialNumber);
response.MaterialNumber = entity.serial.MaterialNumber;
response.Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, entity.serial.MaterialNumber);
//if (entity.boxInventory != null)
// response.IsBoxInventory = entity.boxInventory.Details.SelectMany(s => s.SerialNumbers).Where(w => serialNumber.Equals(w)).Count() >= 1 ? true : false;