This commit is contained in:
2023-05-31 10:19:05 +08:00
parent 1b65a7a9e5
commit 9c621c75cd
238 changed files with 9905 additions and 4034 deletions

View File

@@ -43,11 +43,11 @@ public class ProductService : IDynamicApiController, ITransient
/// 初始化一个<see cref="ProductService"/>类型的新实例.
/// </summary>
public ProductService(
ISqlSugarRepository<ProductEntity> extProductRepository,
ISqlSugarRepository<ProductEntity> repository,
IBillRullService billRullService,
IUserManager userManager)
{
_repository = extProductRepository;
_repository = repository;
_billRullService = billRullService;
_userManager = userManager;
}
@@ -74,7 +74,8 @@ public class ProductService : IDynamicApiController, ITransient
Price = it.Price,
Amount = it.Amount,
Description = it.Description
}).ToList()).Where(a => a.Id.Equals(id) && a.DeleteMark == null)
}).ToList())
.Where(it => it.Id.Equals(id) && it.DeleteMark == null)
.ToListAsync(it => new ProductInfoOutput
{
id = it.Id,
@@ -100,6 +101,52 @@ public class ProductService : IDynamicApiController, ITransient
}))?.FirstOrDefault();
}
/// <summary>
/// 获取全订单示例.
/// </summary>
/// <param name="input">请求参数.</param>
/// <returns></returns>
[HttpGet("Goods")]
public async Task<dynamic> GetAllProductEntryList([FromQuery] ProductListQueryInput input)
{
var data = await _repository.AsQueryable()
.Includes(x => x.productEntryList.Where(it => it.DeleteMark == null).Select(it => new ProductEntryEntity
{
ProductCode = it.ProductCode,
ProductName = it.ProductName,
ProductSpecification = it.ProductSpecification,
Qty = it.Qty,
Type = it.Type,
Money = it.Money,
Price = it.Price,
Amount = it.Amount,
Description = it.Description,
Activity = it.Activity
}).ToList())
.Where(it => it.DeleteMark == null)
.WhereIF(!string.IsNullOrEmpty(input.code), it => it.Code.Contains(input.code))
.WhereIF(!string.IsNullOrEmpty(input.customerName), it => it.CustomerName.Contains(input.customerName))
.OrderByIF(string.IsNullOrEmpty(input.sidx), it => it.Id)
.OrderByIF(!string.IsNullOrEmpty(input.sidx), input.sidx + " " + input.sort)
.ToPagedListAsync(input.currentPage, input.pageSize, it => new ProductListOutput
{
id = it.Id,
code = it.Code,
customerName = it.CustomerName,
business = it.Business,
address = it.Address,
contactTel = it.ContactTel,
salesmanName = it.SalesmanName,
auditState = it.AuditState,
goodsState = it.GoodsState,
closeState = it.CloseState,
closeDate = it.CloseDate,
contactName = it.ContactName,
productEntryList = it.productEntryList.Adapt<List<ProductEntryEntity>>()
});
return PageResult<ProductListOutput>.SqlSugarPageResult(data);
}
/// <summary>
/// 获取订单示例列表.
/// </summary>
@@ -119,6 +166,7 @@ public class ProductService : IDynamicApiController, ITransient
.WhereIF(!string.IsNullOrEmpty(input.contactTel), it => it.ContactTel.Contains(input.contactTel))
.WhereIF(!string.IsNullOrEmpty(input.auditState), it => it.AuditState.Equals(input.auditState))
.WhereIF(!string.IsNullOrEmpty(input.closeState), it => it.CloseState.Equals(input.closeState))
.OrderByIF(string.IsNullOrEmpty(input.sidx), it => it.Id).OrderByIF(!string.IsNullOrEmpty(input.sidx), input.sidx + " " + input.sort)
.Select(it => new ProductListOutput
{
id = it.Id,
@@ -133,7 +181,7 @@ public class ProductService : IDynamicApiController, ITransient
closeState = it.CloseState,
closeDate = it.CloseDate,
contactName = it.ContactName
}).MergeTable().OrderByIF(string.IsNullOrEmpty(input.sidx), it => it.id).OrderByIF(!string.IsNullOrEmpty(input.sidx), input.sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize);
}).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<ProductListOutput>.SqlSugarPageResult(data);
}