payne
2024-04-25 873f69e7f1e681cbd1dacd7a39f9140885756fcc
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsMaterial/WmsMaterialService.cs
@@ -191,16 +191,26 @@
                                              .ProjectToType<WmsControlRuleDetailOutput>()
                                              .ToListAsync();
            //物料客户关联
            var wmsMaterialCustomerList = await _wmsMaterialCustomerRep.DetachedEntities
                                              .Where(u => u.MaterialId == wmsMaterialInfo.Id)
                                              .Where(u => u.IsDeleted == false)
                                              .OrderBy(o => o.CreatedTime)
                                              .ProjectToType<WmsMaterialCustomerOutput>()
                                              .ToListAsync();
            List<long> custIds = wmsMaterialCustomerList.Select(s => s.CustId).ToList();
            //根据物料客户关联表获取往来信息
            var baseCustomers = await _baseCustomerRep.DetachedEntities.Join(_wmsMaterialCustomerRep.DetachedEntities, bc => bc.Id, mc => mc.CustId, (bc, mc) => new { bc, mc })
                                      .Where(p =>p.mc.MaterialId== wmsMaterialInfo.Id)
                                      .OrderBy(o => o.mc.CreatedTime)
            var baseCustomers = await _baseCustomerRep.DetachedEntities
                                      .Where(p => custIds.Contains(p.Id))
                                      .OrderBy(o => o.CreatedTime)
                                      .ProjectToType<BaseCustomerOutput>()
                                      .ToListAsync();
            resultInfo.MaterialInfo = wmsMaterialInfo;
            resultInfo.SubstituteGoodList = wmsSubstituteGoods;
            resultInfo.ControlRuleDetailList = wmsControlRuleDetails;
            resultInfo.BaseCustomerList = baseCustomers;
            return resultInfo;
        }