| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using Admin.NET.Plugin.AiDOP.Entity.S0.Manufacturing;
- using Admin.NET.Plugin.AiDOP.Entity.S0.Warehouse;
- namespace Admin.NET.Plugin.AiDOP.Service.S8;
- public class S8MasterDataAdapter : ITransient
- {
- private readonly SqlSugarRepository<AdoS0DepartmentMaster> _deptRep;
- private readonly SqlSugarRepository<AdoS0EmployeeMaster> _empRep;
- private readonly SqlSugarRepository<AdoS0LineMaster> _lineRep;
- public S8MasterDataAdapter(
- SqlSugarRepository<AdoS0DepartmentMaster> deptRep,
- SqlSugarRepository<AdoS0EmployeeMaster> empRep,
- SqlSugarRepository<AdoS0LineMaster> lineRep)
- {
- _deptRep = deptRep;
- _empRep = empRep;
- _lineRep = lineRep;
- }
- public async Task<object> GetDepartmentsAsync(long? factoryRefId) =>
- await _deptRep.AsQueryable()
- .WhereIF(factoryRefId.HasValue, x => x.FactoryRefId == factoryRefId!.Value)
- .Take(500)
- .Select(x => new { id = x.Id, code = x.Department, name = x.Descr ?? x.Department })
- .ToListAsync();
- public async Task<object> GetEmployeesAsync(long? factoryRefId) =>
- await _empRep.AsQueryable()
- .WhereIF(factoryRefId.HasValue, x => x.FactoryRefId == factoryRefId!.Value)
- .Take(500)
- .Select(x => new { id = x.Id, name = x.Name ?? x.Employee, empCode = x.Employee })
- .ToListAsync();
- public async Task<object> GetLinesAsync(long? factoryRefId) =>
- await _lineRep.AsQueryable()
- .WhereIF(factoryRefId.HasValue, x => x.FactoryRefId == factoryRefId!.Value)
- .Take(500)
- .Select(x => new { id = x.Id, code = x.Line, name = x.Describe ?? x.Line })
- .ToListAsync();
- }
|