v3.4.6
This commit is contained in:
@@ -47,4 +47,19 @@ public class DocumentListOutput
|
||||
/// 父级Id.
|
||||
/// </summary>
|
||||
public string? parentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文档下载地址.
|
||||
/// </summary>
|
||||
public string? uploaderUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件路径.
|
||||
/// </summary>
|
||||
public string? filePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持预览.
|
||||
/// </summary>
|
||||
public string? isPreview { get; set; }
|
||||
}
|
||||
|
||||
@@ -87,17 +87,17 @@ public class ProductCrInput
|
||||
/// <summary>
|
||||
/// 让利金额.
|
||||
/// </summary>
|
||||
public decimal partPrice { get; set; }
|
||||
public decimal? partPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 优惠金额.
|
||||
/// </summary>
|
||||
public decimal reducedPrice { get; set; }
|
||||
public decimal? reducedPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 折后金额.
|
||||
/// </summary>
|
||||
public decimal discountPrice { get; set; }
|
||||
public decimal? discountPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注.
|
||||
|
||||
@@ -92,17 +92,17 @@ public class ProductInfoOutput
|
||||
/// <summary>
|
||||
/// 让利金额.
|
||||
/// </summary>
|
||||
public decimal partPrice { get; set; }
|
||||
public decimal? partPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 优惠金额.
|
||||
/// </summary>
|
||||
public decimal reducedPrice { get; set; }
|
||||
public decimal? reducedPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 折后金额.
|
||||
/// </summary>
|
||||
public decimal discountPrice { get; set; }
|
||||
public decimal? discountPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注.
|
||||
|
||||
@@ -67,4 +67,9 @@ public class ProductListOutput
|
||||
/// 联系人.
|
||||
/// </summary>
|
||||
public string contactName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表数据.
|
||||
/// </summary>
|
||||
public List<ProductEntryEntity> productEntryList { get; set; }
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace JNPF.Extend.Entitys.Dto.Customer;
|
||||
/// 客户信息.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class CustomerListOutput
|
||||
public class ProductCustomerListOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键.
|
||||
@@ -1,4 +1,5 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Extras.DatabaseAccessor.SqlSugar.Models;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.Extend.Entitys;
|
||||
|
||||
@@ -78,4 +78,10 @@ public class DocumentEntity : CLDEntityBase
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_SORTCODE")]
|
||||
public long? SortCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下载地址.
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_UPLOADERURL")]
|
||||
public string? UploaderUrl { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace JNPF.Extend.Entitys.Entity;
|
||||
/// 客户信息.
|
||||
/// </summary>
|
||||
[SugarTable("ext_customer", TableDescription = "客户信息")]
|
||||
public class CustomerEntity : CLEntityBase
|
||||
public class ProductCustomerEntity : CLEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 编码.
|
||||
@@ -159,19 +159,19 @@ public class ProductEntity : EntityBase<string>
|
||||
/// 让利金额.
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_PartPrice")]
|
||||
public decimal PartPrice { get; set; }
|
||||
public decimal? PartPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 优惠金额.
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_ReducedPrice")]
|
||||
public decimal ReducedPrice { get; set; }
|
||||
public decimal? ReducedPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 折后金额.
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_DiscountPrice")]
|
||||
public decimal DiscountPrice { get; set; }
|
||||
public decimal? DiscountPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注.
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace JNPF.Extend.Entitys;
|
||||
/// </summary>
|
||||
[SugarTable("ext_productgoods")]
|
||||
[Tenant(ClaimConst.TENANTID)]
|
||||
public class ProductgoodsEntity
|
||||
public class ProductGoodsEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键.
|
||||
|
||||
@@ -84,6 +84,12 @@ public class DocumentService : IDynamicApiController, ITransient
|
||||
.WhereIF(input.keyword.IsNotEmptyOrNull(), t => t.FullName.Contains(input.keyword))
|
||||
.OrderBy(x => x.SortCode).OrderBy(x => x.CreatorTime, OrderByType.Desc)
|
||||
.OrderByIF(!string.IsNullOrEmpty(input.keyword), t => t.LastModifyTime, OrderByType.Desc).ToListAsync()).Adapt<List<DocumentListOutput>>();
|
||||
string[]? typeList = new string[] { "doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf", "jpg", "jpeg", "gif", "png", "bmp" };
|
||||
foreach (var item in data)
|
||||
{
|
||||
string? type = item.fullName.Split('.').LastOrDefault();
|
||||
item.isPreview = typeList.Contains(type) ? "1" : null;
|
||||
}
|
||||
return new { list = data };
|
||||
}
|
||||
|
||||
@@ -248,6 +254,7 @@ public class DocumentService : IDynamicApiController, ITransient
|
||||
entity.FilePath = Path.Combine(_filePath, input.file.FileName);
|
||||
entity.FileSize = input.file.Length.ToString();
|
||||
entity.DeleteMark = 0;
|
||||
entity.UploaderUrl = string.Format("/api/file/Image/document/{0}", entity.FilePath);
|
||||
var isOk = await _repository.AsSugarClient().Insertable(entity).CallEntityMethod(m => m.Creator()).ExecuteCommandAsync();
|
||||
if (isOk < 1)
|
||||
throw Oops.Oh(ErrorCode.D8001);
|
||||
@@ -261,11 +268,12 @@ public class DocumentService : IDynamicApiController, ITransient
|
||||
[HttpPost("merge")]
|
||||
public async Task<dynamic> merge([FromForm] ChunkModel input)
|
||||
{
|
||||
if (await _repository.IsAnyAsync(x => x.FullName == input.fileName && x.Type == 1 && x.DeleteMark != 1))
|
||||
if (await _repository.IsAnyAsync(x =>x.CreatorUserId==_userManager.UserId && x.FullName == input.fileName && x.Type == 1 && x.DeleteMark != 1))
|
||||
{
|
||||
string directoryPath = Path.Combine(App.GetConfig<AppOptions>("JNPF_App", true).SystemPath, "TemporaryFile", input.identifier);
|
||||
FileHelper.DeleteDirectory(directoryPath);
|
||||
throw Oops.Oh(ErrorCode.D8002);
|
||||
//string directoryPath = Path.Combine(App.GetConfig<AppOptions>("JNPF_App", true).SystemPath, "TemporaryFile", input.identifier);
|
||||
//FileHelper.DeleteDirectory(directoryPath);
|
||||
//throw Oops.Oh(ErrorCode.D8002);
|
||||
input.fileName = string.Format("{0}-{1}", DateTime.Now.ParseToUnixTime(), input.fileName);
|
||||
}
|
||||
input.isUpdateName = false;
|
||||
input.type = "document";
|
||||
@@ -276,10 +284,11 @@ public class DocumentService : IDynamicApiController, ITransient
|
||||
entity.Type = 1;
|
||||
entity.FullName = input.fileName;
|
||||
entity.ParentId = input.parentId;
|
||||
entity.FileExtension = Path.GetExtension(input.fileName).Replace(".", string.Empty);
|
||||
entity.FileExtension = input.extension;
|
||||
entity.FilePath = output.name;
|
||||
entity.FileSize = input.fileSize;
|
||||
entity.DeleteMark = 0;
|
||||
entity.UploaderUrl = string.Format("/api/file/Image/document/{0}", entity.FilePath);
|
||||
var isOk = await _repository.AsSugarClient().Insertable(entity).CallEntityMethod(m => m.Creator()).ExecuteCommandAsync();
|
||||
if (isOk < 1)
|
||||
throw Oops.Oh(ErrorCode.D8001);
|
||||
@@ -299,8 +308,7 @@ public class DocumentService : IDynamicApiController, ITransient
|
||||
throw Oops.Oh(ErrorCode.D8000);
|
||||
var fileName = _userManager.UserId + "|" + entity.FilePath + "|document";
|
||||
_cacheManager.Set(entity.FilePath, string.Empty);
|
||||
return new
|
||||
{
|
||||
return new {
|
||||
name = entity.FullName,
|
||||
url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "JNPF")
|
||||
};
|
||||
|
||||
@@ -233,7 +233,7 @@ public class EmailService : IDynamicApiController, ITransient
|
||||
var mailAccount = mailConfig.Adapt<MailParameterInfo>();
|
||||
if (MailUtil.CheckConnected(mailAccount))
|
||||
{
|
||||
new List<EmailReceiveEntity>();
|
||||
new List<EmailReceiveEntity>();
|
||||
var startTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00");
|
||||
var endTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59");
|
||||
var receiveCount = await _repository.AsSugarClient().Queryable<EmailReceiveEntity>().CountAsync(x => x.MAccount == mailConfig.Account && SqlFunc.Between(x.CreatorTime, startTime, endTime));
|
||||
@@ -331,7 +331,7 @@ public class EmailService : IDynamicApiController, ITransient
|
||||
var mailFilePath = FileVariable.EmailFilePath;
|
||||
foreach (MailFileParameterInfo mailFile in attachmentList)
|
||||
{
|
||||
FileHelper.MoveFile(Path.Combine(temporaryFile , mailFile.fileId), Path.Combine(mailFilePath , mailFile.fileId));
|
||||
FileHelper.MoveFile(Path.Combine(temporaryFile, mailFile.fileId), Path.Combine(mailFilePath, mailFile.fileId));
|
||||
mailFile.fileName = mailFile.name;
|
||||
}
|
||||
//发送邮件
|
||||
@@ -342,7 +342,7 @@ public class EmailService : IDynamicApiController, ITransient
|
||||
mailModel.Subject = entity.Subject;
|
||||
mailModel.BodyText = HttpUtility.HtmlDecode(entity.BodyText);
|
||||
mailModel.Attachment = attachmentList;
|
||||
MailUtil.Send(new MailParameterInfo { AccountName = mailConfig.SenderName, Account = mailConfig.Account, Password = mailConfig.Password, SMTPHost = mailConfig.SMTPHost, SMTPPort = mailConfig.SMTPPort.ParseToInt() }, mailModel);
|
||||
MailUtil.Send(new MailParameterInfo { AccountName = mailConfig.SenderName, Account = mailConfig.Account, Password = mailConfig.Password, SMTPHost = mailConfig.SMTPHost, SMTPPort = mailConfig.SMTPPort.ParseToInt(), Ssl = mailConfig.Ssl == 1 }, mailModel);
|
||||
if (isOk < 1)
|
||||
throw Oops.Oh(ErrorCode.COM1008);
|
||||
}
|
||||
@@ -396,10 +396,10 @@ public class EmailService : IDynamicApiController, ITransient
|
||||
[HttpPost("Download")]
|
||||
public async Task Download(AnnexModel fileModel)
|
||||
{
|
||||
var filePath = Path.Combine(FileVariable.EmailFilePath , fileModel.FileId);
|
||||
var filePath = Path.Combine(FileVariable.EmailFilePath, fileModel.FileId);
|
||||
if (await _fileManager.ExistsFile(filePath))
|
||||
{
|
||||
_fileManager.DownloadFileByType(filePath, fileModel.FileName);
|
||||
_fileManager.DownloadFileByType(filePath, fileModel.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Helper;
|
||||
using JNPF.Common.Manager;
|
||||
using JNPF.Common.Models.NPOI;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DataEncryption;
|
||||
@@ -34,12 +35,14 @@ public class EmployeeService : IDynamicApiController, ITransient
|
||||
private readonly ISqlSugarRepository<EmployeeEntity> _repository;
|
||||
private readonly IFileManager _fileManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
|
||||
public EmployeeService(ISqlSugarRepository<EmployeeEntity> repository, IFileManager fileManager, IUserManager userManager)
|
||||
public EmployeeService(ISqlSugarRepository<EmployeeEntity> repository, IFileManager fileManager, IUserManager userManager,ICacheManager cacheManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_fileManager = fileManager;
|
||||
_userManager = userManager;
|
||||
_cacheManager = cacheManager;
|
||||
}
|
||||
|
||||
#region GET
|
||||
@@ -114,6 +117,7 @@ public class EmployeeService : IDynamicApiController, ITransient
|
||||
//得到数据
|
||||
var sr = await _fileManager.GetFileStream(savePath);
|
||||
var excelData = ExcelImportHelper.ToDataTable(savePath, sr);
|
||||
excelData.Rows.RemoveAt(0);
|
||||
foreach (var item in excelData.Columns)
|
||||
{
|
||||
excelData.Columns[item.ToString()].ColumnName = GetFiledEncode(item.ToString());
|
||||
@@ -200,6 +204,7 @@ public class EmployeeService : IDynamicApiController, ITransient
|
||||
var addPath = Path.Combine(FileVariable.TemporaryFilePath, excelconfig.FileName);
|
||||
var stream = ExcelExportHelper<EmployeeEntity>.ExportMemoryStream(dataList, excelconfig);
|
||||
await _fileManager.UploadFileByType(stream, FileVariable.TemporaryFilePath, excelconfig.FileName);
|
||||
_cacheManager.Set(excelconfig.FileName, string.Empty);
|
||||
return new { name = excelconfig.FileName, url = "/api/file/Download?encryption=" + DESCEncryption.Encrypt(_userManager.UserId + "|" + excelconfig.FileName + "|" + addPath, "JNPF") };
|
||||
}
|
||||
|
||||
@@ -214,6 +219,7 @@ public class EmployeeService : IDynamicApiController, ITransient
|
||||
var _fileName = DateTime.Now.ToString("yyyyMMdd") + "_" + SnowflakeIdHelper.NextId() + Path.GetExtension(file.FileName);
|
||||
var stream = file.OpenReadStream();
|
||||
await _fileManager.UploadFileByType(stream, _filePath, _fileName);
|
||||
_cacheManager.Set(_fileName, string.Empty);
|
||||
return new { name = _fileName, url = string.Format("/api/File/Image/{0}/{1}", string.Empty, _fileName) };
|
||||
}
|
||||
|
||||
@@ -267,6 +273,7 @@ public class EmployeeService : IDynamicApiController, ITransient
|
||||
{
|
||||
var stream = await _fileManager.GetFileStream(filePath);
|
||||
await _fileManager.UploadFileByType(stream, FileVariable.TemporaryFilePath, "职员信息.xlsx");
|
||||
_cacheManager.Set("职员信息.xlsx", string.Empty);
|
||||
}
|
||||
return new { name = "职员信息.xlsx", url = "/api/file/Download?encryption=" + DESCEncryption.Encrypt(_userManager.UserId + "|职员信息.xlsx", "JNPF") };
|
||||
}
|
||||
|
||||
@@ -44,14 +44,12 @@ public class OrderService : IDynamicApiController, ITransient
|
||||
ISqlSugarRepository<OrderEntity> repository,
|
||||
IUserManager userManager,
|
||||
IUsersService usersService,
|
||||
ICacheManager cacheManager,
|
||||
IFileManager fileManager)
|
||||
ICacheManager cacheManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_usersService = usersService;
|
||||
_cacheManager = cacheManager;
|
||||
_fileManager = fileManager;
|
||||
}
|
||||
|
||||
#region GET
|
||||
@@ -141,6 +139,7 @@ public class OrderService : IDynamicApiController, ITransient
|
||||
[HttpGet("{id}")]
|
||||
public async Task<dynamic> GetInfo(string id)
|
||||
{
|
||||
if ("0".Equals(id)) return null;
|
||||
var data = (await _repository.GetFirstAsync(x => x.Id == id && x.DeleteMark == null)).Adapt<OrderInfoOutput>();
|
||||
if (data.IsNullOrEmpty()) return null;
|
||||
data.collectionPlanList = (await _repository.AsSugarClient().Queryable<OrderReceivableEntity>().Where(x => x.OrderId == id).ToListAsync()).Adapt<List<CollectionPlanModel>>();
|
||||
|
||||
@@ -30,10 +30,10 @@ public class ProductClassifyService : IDynamicApiController, ITransient
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public ProductClassifyService(
|
||||
ISqlSugarRepository<ProductClassifyEntity> extProductRepository,
|
||||
ISqlSugarRepository<ProductClassifyEntity> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = extProductRepository;
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
|
||||
65
extend/Tnb.Extend/ProductCustomerService.cs
Normal file
65
extend/Tnb.Extend/ProductCustomerService.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Filter;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Extend.Entitys.Entity;
|
||||
using JNPF.Extend.Entitys.Dto.Customer;
|
||||
|
||||
namespace JNPF.Extend;
|
||||
|
||||
/// <summary>
|
||||
/// 客户信息.
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "Extend", Name = "Customer", Order = 600)]
|
||||
[Route("api/extend/saleOrder/[controller]")]
|
||||
public class ProductCustomerService : IDynamicApiController, ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务基础仓储.
|
||||
/// </summary>
|
||||
private readonly ISqlSugarRepository<ProductCustomerEntity> _repository;
|
||||
|
||||
/// <summary>
|
||||
/// 用户管理.
|
||||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public ProductCustomerService(
|
||||
ISqlSugarRepository<ProductCustomerEntity> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
#region GET
|
||||
|
||||
/// <summary>
|
||||
/// 客户列表.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("")]
|
||||
public async Task<dynamic> GetList([FromQuery] PageInputBase input)
|
||||
{
|
||||
var data = await _repository.AsQueryable()
|
||||
.Where(it => it.Deletemark == null)
|
||||
.WhereIF(input.keyword.IsNotEmptyOrNull(), x => x.Name.Contains(input.keyword))
|
||||
.Select(x => new ProductCustomerListOutput
|
||||
{
|
||||
id = x.Id,
|
||||
code = x.Code,
|
||||
name = x.Name,
|
||||
customerName = x.Customername,
|
||||
address = x.Address,
|
||||
contactTel = x.ContactTel
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return new { list = data };
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
87
extend/Tnb.Extend/ProductGoodsService.cs
Normal file
87
extend/Tnb.Extend/ProductGoodsService.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extend.Entitys;
|
||||
using JNPF.Extend.Entitys.Dto.ProductGoods;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.Extend;
|
||||
|
||||
/// <summary>
|
||||
/// 选择产品.
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "Extend", Name = "Goods", Order = 600)]
|
||||
[Route("api/extend/saleOrder/[controller]")]
|
||||
public class ProductGoodsService : IDynamicApiController, ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务基础仓储.
|
||||
/// </summary>
|
||||
private readonly ISqlSugarRepository<ProductGoodsEntity> _repository;
|
||||
|
||||
/// <summary>
|
||||
/// 用户管理.
|
||||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public ProductGoodsService(
|
||||
ISqlSugarRepository<ProductGoodsEntity> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
#region GET
|
||||
|
||||
/// <summary>
|
||||
/// 产品列表.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("")]
|
||||
public async Task<dynamic> GetList([FromQuery] ProductGoodsListQueryInput input)
|
||||
{
|
||||
var data = await _repository.AsQueryable()
|
||||
.Where(it => it.DeleteMark == null)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.classifyId), it => it.ClassifyId.Equals(input.classifyId))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.code), it => it.Code.Contains(input.code))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.fullName), it => it.FullName.Contains(input.fullName))
|
||||
.Select(it => new ProductGoodsListOutput
|
||||
{
|
||||
id = it.Id,
|
||||
code = it.Code,
|
||||
fullName = it.FullName,
|
||||
qty = it.Qty,
|
||||
}).MergeTable().OrderByIF(string.IsNullOrEmpty(input.sidx), it => it.id).OrderByIF(!string.IsNullOrEmpty(input.sidx), input.sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<ProductGoodsListOutput>.SqlSugarPageResult(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商品编码.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Selector")]
|
||||
public async Task<dynamic> GetSelectorList([FromQuery] PageInputBase input)
|
||||
{
|
||||
var data = await _repository.AsQueryable()
|
||||
.Where(it => it.DeleteMark == null)
|
||||
.WhereIF(input.keyword.IsNotEmptyOrNull(), x => x.Code.Contains(input.keyword))
|
||||
.Select(it => new ProductGoodsListOutput
|
||||
{
|
||||
id = it.Id,
|
||||
classifyId = it.ClassifyId,
|
||||
code = it.Code,
|
||||
fullName = it.FullName,
|
||||
qty = it.Qty,
|
||||
type = it.Type,
|
||||
amount = it.Amount,
|
||||
money = it.Money,
|
||||
}).ToListAsync();
|
||||
return new { list = data };
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user