后台接口2

main
liangzongpeng 2024-03-20 14:11:00 +08:00
parent 0bd4eccca5
commit 8d2cfa59a6
15 changed files with 1886 additions and 0 deletions

View File

@ -0,0 +1,100 @@
using Admin.NET.Core;
namespace Admin.NET.Application.Entity;
/// <summary>
/// 发货通知单
/// </summary>
[SugarTable("Invoice","发货通知单")]
public class Invoice : EntityTenant
{
/// <summary>
/// 单号
/// </summary>
[SugarColumn(ColumnName = "CodeNum", ColumnDescription = "单号", Length = 32)]
public string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
[SugarColumn(ColumnName = "StartDate", ColumnDescription = "业务日期")]
public DateTime? StartDate { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)]
public string BusinessType { get; set; }
/// <summary>
/// 客户
/// </summary>
[SugarColumn(ColumnName = "Custom", ColumnDescription = "客户", Length = 32)]
public string Custom { get; set; }
/// <summary>
/// 仓库
/// </summary>
[SugarColumn(ColumnName = "Warehouse", ColumnDescription = "仓库", Length = 32)]
public string Warehouse { get; set; }
/// <summary>
/// 部门
/// </summary>
[SugarColumn(ColumnName = "Department", ColumnDescription = "部门", Length = 32)]
public string? Department { get; set; }
/// <summary>
/// 车牌号
/// </summary>
[SugarColumn(ColumnName = "CarNumber", ColumnDescription = "车牌号", Length = 32)]
public string? CarNumber { get; set; }
/// <summary>
/// 停车位
/// </summary>
[SugarColumn(ColumnName = "ParkingSpace", ColumnDescription = "停车位", Length = 32)]
public string? ParkingSpace { get; set; }
/// <summary>
/// 业务员
/// </summary>
[SugarColumn(ColumnName = "Salesman", ColumnDescription = "业务员", Length = 32)]
public string? Salesman { get; set; }
/// <summary>
/// 收货单位
/// </summary>
[SugarColumn(ColumnName = "Consignee", ColumnDescription = "收货单位", Length = 32)]
public string? Consignee { get; set; }
/// <summary>
/// 交货日期
/// </summary>
[SugarColumn(ColumnName = "DeliveryDate", ColumnDescription = "交货日期")]
public DateTime? DeliveryDate { get; set; }
/// <summary>
/// 交货地址
/// </summary>
[SugarColumn(ColumnName = "DeliveryAddress", ColumnDescription = "交货地址", Length = 128)]
public string? DeliveryAddress { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 128)]
public string? Remarks { get; set; }
/// <summary>
/// 方案客户拓展
/// </summary>
[SugarColumn(ColumnName = "CustomExpand", ColumnDescription = "方案客户拓展", Length = 32)]
public string? CustomExpand { get; set; }
/// <summary>
/// 发货拓展
/// </summary>
[SugarColumn(ColumnName = "SendOutExpand", ColumnDescription = "发货拓展", Length = 32)]
public string? SendOutExpand { get; set; }
}

View File

@ -0,0 +1,70 @@
using Admin.NET.Core;
namespace Admin.NET.Application.Entity;
/// <summary>
/// 出库单
/// </summary>
[SugarTable("Outbound","出库单")]
public class Outbound : EntityTenant
{
/// <summary>
/// 单号
/// </summary>
[SugarColumn(ColumnName = "CodeNum", ColumnDescription = "单号", Length = 32)]
public string? CodeNum { get; set; }
/// <summary>
/// 来源单号
/// </summary>
[SugarColumn(ColumnName = "SourceCodeNum", ColumnDescription = "来源单号", Length = 32)]
public string SourceCodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
[SugarColumn(ColumnName = "StartDate", ColumnDescription = "业务日期", Length = 32)]
public string? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnName = "State", ColumnDescription = "状态")]
public int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)]
public string? BusinessType { get; set; }
/// <summary>
/// 收货单位
/// </summary>
[SugarColumn(ColumnName = "Consignee", ColumnDescription = "收货单位", Length = 32)]
public string Consignee { get; set; }
/// <summary>
/// 仓库
/// </summary>
[SugarColumn(ColumnName = "Warehouse", ColumnDescription = "仓库")]
public string? Warehouse { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
[SugarColumn(ColumnName = "ExaminerId", ColumnDescription = "审核人ID")]
public long? ExaminerId { get; set; }
/// <summary>
/// 出库单整型拓展字段
/// </summary>
[SugarColumn(ColumnName = "OutboundExpandInt", ColumnDescription = "出库单整型拓展字段")]
public int? OutboundExpandInt { get; set; }
/// <summary>
/// 出库单字符串拓展字段
/// </summary>
[SugarColumn(ColumnName = "OutboundExpandString", ColumnDescription = "出库单字符串拓展字段", Length = 64)]
public string? OutboundExpandString { get; set; }
}

View File

@ -0,0 +1,52 @@
using Admin.NET.Core;
namespace Admin.NET.Application.Entity;
/// <summary>
/// 入库单
/// </summary>
[SugarTable("Warehousing","入库单")]
public class Warehousing : EntityTenant
{
/// <summary>
/// 单号
/// </summary>
[SugarColumn(ColumnName = "CodeNum", ColumnDescription = "单号", Length = 32)]
public string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
[SugarColumn(ColumnName = "StartDate", ColumnDescription = "业务日期")]
public DateTime? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnName = "State", ColumnDescription = "状态")]
public int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)]
public string? BusinessType { get; set; }
/// <summary>
/// 供货单位
/// </summary>
[SugarColumn(ColumnName = "Supplier", ColumnDescription = "供货单位", Length = 32)]
public string? Supplier { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
[SugarColumn(ColumnName = "ExaminerId", ColumnDescription = "审核人ID")]
public long? ExaminerId { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
public string? Remarks { get; set; }
}

View File

@ -0,0 +1,128 @@
namespace Admin.NET.Application;
/// <summary>
/// 发货通知单输出参数
/// </summary>
public class InvoiceDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? StartDate { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string BusinessType { get; set; }
/// <summary>
/// 客户
/// </summary>
public string Custom { get; set; }
/// <summary>
/// 仓库
/// </summary>
public string Warehouse { get; set; }
/// <summary>
/// 部门
/// </summary>
public string? Department { get; set; }
/// <summary>
/// 车牌号
/// </summary>
public string? CarNumber { get; set; }
/// <summary>
/// 停车位
/// </summary>
public string? ParkingSpace { get; set; }
/// <summary>
/// 业务员
/// </summary>
public string? Salesman { get; set; }
/// <summary>
/// 收货单位
/// </summary>
public string? Consignee { get; set; }
/// <summary>
/// 交货日期
/// </summary>
public DateTime? DeliveryDate { get; set; }
/// <summary>
/// 交货地址
/// </summary>
public string? DeliveryAddress { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
/// <summary>
/// 方案客户拓展
/// </summary>
public string? CustomExpand { get; set; }
/// <summary>
/// 发货拓展
/// </summary>
public string? SendOutExpand { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
}

View File

@ -0,0 +1,265 @@
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 发货通知单基础输入参数
/// </summary>
public class InvoiceBaseInput
{
/// <summary>
/// 单号
/// </summary>
public virtual string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public virtual DateTime? StartDate { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public virtual string BusinessType { get; set; }
/// <summary>
/// 客户
/// </summary>
public virtual string Custom { get; set; }
/// <summary>
/// 仓库
/// </summary>
public virtual string Warehouse { get; set; }
/// <summary>
/// 部门
/// </summary>
public virtual string? Department { get; set; }
/// <summary>
/// 车牌号
/// </summary>
public virtual string? CarNumber { get; set; }
/// <summary>
/// 停车位
/// </summary>
public virtual string? ParkingSpace { get; set; }
/// <summary>
/// 业务员
/// </summary>
public virtual string? Salesman { get; set; }
/// <summary>
/// 收货单位
/// </summary>
public virtual string? Consignee { get; set; }
/// <summary>
/// 交货日期
/// </summary>
public virtual DateTime? DeliveryDate { get; set; }
/// <summary>
/// 交货地址
/// </summary>
public virtual string? DeliveryAddress { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
/// <summary>
/// 方案客户拓展
/// </summary>
public virtual string? CustomExpand { get; set; }
/// <summary>
/// 发货拓展
/// </summary>
public virtual string? SendOutExpand { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public virtual long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public virtual DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public virtual long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public virtual string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public virtual long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public virtual string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public virtual bool IsDelete { get; set; }
}
/// <summary>
/// 发货通知单分页查询输入参数
/// </summary>
public class InvoiceInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? StartDate { get; set; }
/// <summary>
/// 业务日期范围
/// </summary>
public List<DateTime?> StartDateRange { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 客户
/// </summary>
public string? Custom { get; set; }
/// <summary>
/// 仓库
/// </summary>
public string? Warehouse { get; set; }
/// <summary>
/// 部门
/// </summary>
public string? Department { get; set; }
/// <summary>
/// 车牌号
/// </summary>
public string? CarNumber { get; set; }
/// <summary>
/// 停车位
/// </summary>
public string? ParkingSpace { get; set; }
/// <summary>
/// 业务员
/// </summary>
public string? Salesman { get; set; }
/// <summary>
/// 收货单位
/// </summary>
public string? Consignee { get; set; }
/// <summary>
/// 交货日期
/// </summary>
public DateTime? DeliveryDate { get; set; }
/// <summary>
/// 交货日期范围
/// </summary>
public List<DateTime?> DeliveryDateRange { get; set; }
/// <summary>
/// 交货地址
/// </summary>
public string? DeliveryAddress { get; set; }
}
/// <summary>
/// 发货通知单增加输入参数
/// </summary>
public class AddInvoiceInput : InvoiceBaseInput
{
/// <summary>
/// 业务类型
/// </summary>
[Required(ErrorMessage = "业务类型不能为空")]
public override string BusinessType { get; set; }
/// <summary>
/// 客户
/// </summary>
[Required(ErrorMessage = "客户不能为空")]
public override string Custom { get; set; }
/// <summary>
/// 仓库
/// </summary>
[Required(ErrorMessage = "仓库不能为空")]
public override string Warehouse { get; set; }
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
}
/// <summary>
/// 发货通知单删除输入参数
/// </summary>
public class DeleteInvoiceInput : BaseIdInput
{
}
/// <summary>
/// 发货通知单更新输入参数
/// </summary>
public class UpdateInvoiceInput : InvoiceBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 发货通知单主键查询输入参数
/// </summary>
public class QueryByIdInvoiceInput : DeleteInvoiceInput
{
}

View File

@ -0,0 +1,130 @@
namespace Admin.NET.Application;
/// <summary>
/// 发货通知单输出参数
/// </summary>
public class InvoiceOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? StartDate { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string BusinessType { get; set; }
/// <summary>
/// 客户
/// </summary>
public string Custom { get; set; }
/// <summary>
/// 仓库
/// </summary>
public string Warehouse { get; set; }
/// <summary>
/// 部门
/// </summary>
public string? Department { get; set; }
/// <summary>
/// 车牌号
/// </summary>
public string? CarNumber { get; set; }
/// <summary>
/// 停车位
/// </summary>
public string? ParkingSpace { get; set; }
/// <summary>
/// 业务员
/// </summary>
public string? Salesman { get; set; }
/// <summary>
/// 收货单位
/// </summary>
public string? Consignee { get; set; }
/// <summary>
/// 交货日期
/// </summary>
public DateTime? DeliveryDate { get; set; }
/// <summary>
/// 交货地址
/// </summary>
public string? DeliveryAddress { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
/// <summary>
/// 方案客户拓展
/// </summary>
public string? CustomExpand { get; set; }
/// <summary>
/// 发货拓展
/// </summary>
public string? SendOutExpand { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
}

View File

@ -0,0 +1,144 @@
using Admin.NET.Core.Service;
using Admin.NET.Application.Const;
using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http;
namespace Admin.NET.Application;
/// <summary>
/// 发货通知单服务
/// </summary>
[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)]
public class InvoiceService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<Invoice> _rep;
public InvoiceService(SqlSugarRepository<Invoice> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询发货通知单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<InvoiceOutput>> Page(InvoiceInput input)
{
var query = _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
u.CodeNum.Contains(input.SearchKey.Trim())
|| u.BusinessType.Contains(input.SearchKey.Trim())
|| u.Custom.Contains(input.SearchKey.Trim())
|| u.Warehouse.Contains(input.SearchKey.Trim())
|| u.Department.Contains(input.SearchKey.Trim())
|| u.CarNumber.Contains(input.SearchKey.Trim())
|| u.ParkingSpace.Contains(input.SearchKey.Trim())
|| u.Salesman.Contains(input.SearchKey.Trim())
|| u.Consignee.Contains(input.SearchKey.Trim())
|| u.DeliveryAddress.Contains(input.SearchKey.Trim())
)
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeNum), u => u.CodeNum.Contains(input.CodeNum.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.BusinessType), u => u.BusinessType.Contains(input.BusinessType.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Custom), u => u.Custom.Contains(input.Custom.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Warehouse), u => u.Warehouse.Contains(input.Warehouse.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Department), u => u.Department.Contains(input.Department.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.CarNumber), u => u.CarNumber.Contains(input.CarNumber.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ParkingSpace), u => u.ParkingSpace.Contains(input.ParkingSpace.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Salesman), u => u.Salesman.Contains(input.Salesman.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Consignee), u => u.Consignee.Contains(input.Consignee.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.DeliveryAddress), u => u.DeliveryAddress.Contains(input.DeliveryAddress.Trim()))
.Select<InvoiceOutput>();
if(input.StartDateRange != null && input.StartDateRange.Count >0)
{
DateTime? start= input.StartDateRange[0];
query = query.WhereIF(start.HasValue, u => u.StartDate > start);
if (input.StartDateRange.Count >1 && input.StartDateRange[1].HasValue)
{
var end = input.StartDateRange[1].Value.AddDays(1);
query = query.Where(u => u.StartDate < end);
}
}
if(input.DeliveryDateRange != null && input.DeliveryDateRange.Count >0)
{
DateTime? start= input.DeliveryDateRange[0];
query = query.WhereIF(start.HasValue, u => u.DeliveryDate > start);
if (input.DeliveryDateRange.Count >1 && input.DeliveryDateRange[1].HasValue)
{
var end = input.DeliveryDateRange[1].Value.AddDays(1);
query = query.Where(u => u.DeliveryDate < end);
}
}
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
/// 增加发货通知单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Add")]
public async Task<long> Add(AddInvoiceInput input)
{
var entity = input.Adapt<Invoice>();
await _rep.InsertAsync(entity);
return entity.Id;
}
/// <summary>
/// 删除发货通知单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeleteInvoiceInput input)
{
var entity = await _rep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
await _rep.FakeDeleteAsync(entity); //假删除
//await _rep.DeleteAsync(entity); //真删除
}
/// <summary>
/// 更新发货通知单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Update")]
public async Task Update(UpdateInvoiceInput input)
{
var entity = input.Adapt<Invoice>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取发货通知单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<Invoice> Detail([FromQuery] QueryByIdInvoiceInput input)
{
return await _rep.GetFirstAsync(u => u.Id == input.Id);
}
/// <summary>
/// 获取发货通知单列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "List")]
public async Task<List<InvoiceOutput>> List()
{
return await _rep.AsQueryable().Select<InvoiceOutput>().ToListAsync();
}
}

View File

@ -0,0 +1,103 @@
namespace Admin.NET.Application;
/// <summary>
/// 出库单输出参数
/// </summary>
public class OutboundDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 来源单号
/// </summary>
public string SourceCodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public string? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
public int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 收货单位
/// </summary>
public string Consignee { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
public long? ExaminerId { get; set; }
/// <summary>
/// 出库单整型拓展字段
/// </summary>
public int? OutboundExpandInt { get; set; }
/// <summary>
/// 出库单字符串拓展字段
/// </summary>
public string? OutboundExpandString { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
/// <summary>
/// 仓库
/// </summary>
public string? Warehouse { get; set; }
}

View File

@ -0,0 +1,200 @@
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 出库单基础输入参数
/// </summary>
public class OutboundBaseInput
{
/// <summary>
/// 单号
/// </summary>
public virtual string? CodeNum { get; set; }
/// <summary>
/// 来源单号
/// </summary>
public virtual string SourceCodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public virtual string? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
public virtual int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public virtual string? BusinessType { get; set; }
/// <summary>
/// 收货单位
/// </summary>
public virtual string Consignee { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
public virtual long? ExaminerId { get; set; }
/// <summary>
/// 出库单整型拓展字段
/// </summary>
public virtual int? OutboundExpandInt { get; set; }
/// <summary>
/// 出库单字符串拓展字段
/// </summary>
public virtual string? OutboundExpandString { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public virtual long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public virtual DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public virtual long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public virtual string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public virtual long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public virtual string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public virtual bool IsDelete { get; set; }
/// <summary>
/// 仓库
/// </summary>
public virtual string? Warehouse { get; set; }
}
/// <summary>
/// 出库单分页查询输入参数
/// </summary>
public class OutboundInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 来源单号
/// </summary>
public string? SourceCodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public string? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
public int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 收货单位
/// </summary>
public string? Consignee { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
public long? ExaminerId { get; set; }
}
/// <summary>
/// 出库单增加输入参数
/// </summary>
public class AddOutboundInput : OutboundBaseInput
{
/// <summary>
/// 来源单号
/// </summary>
[Required(ErrorMessage = "来源单号不能为空")]
public override string SourceCodeNum { get; set; }
/// <summary>
/// 收货单位
/// </summary>
[Required(ErrorMessage = "收货单位不能为空")]
public override string Consignee { get; set; }
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
}
/// <summary>
/// 出库单删除输入参数
/// </summary>
public class DeleteOutboundInput : BaseIdInput
{
}
/// <summary>
/// 出库单更新输入参数
/// </summary>
public class UpdateOutboundInput : OutboundBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 出库单主键查询输入参数
/// </summary>
public class QueryByIdOutboundInput : DeleteOutboundInput
{
}

View File

@ -0,0 +1,105 @@
namespace Admin.NET.Application;
/// <summary>
/// 出库单输出参数
/// </summary>
public class OutboundOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 来源单号
/// </summary>
public string SourceCodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public string? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
public int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 收货单位
/// </summary>
public string Consignee { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
public long? ExaminerId { get; set; }
/// <summary>
/// 出库单整型拓展字段
/// </summary>
public int? OutboundExpandInt { get; set; }
/// <summary>
/// 出库单字符串拓展字段
/// </summary>
public string? OutboundExpandString { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
/// <summary>
/// 仓库
/// </summary>
public string? Warehouse { get; set; }
}

View File

@ -0,0 +1,116 @@
using Admin.NET.Core.Service;
using Admin.NET.Application.Const;
using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http;
namespace Admin.NET.Application;
/// <summary>
/// 出库单服务
/// </summary>
[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)]
public class OutboundService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<Outbound> _rep;
public OutboundService(SqlSugarRepository<Outbound> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询出库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<OutboundOutput>> Page(OutboundInput input)
{
var query = _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
u.CodeNum.Contains(input.SearchKey.Trim())
|| u.SourceCodeNum.Contains(input.SearchKey.Trim())
|| u.StartDate.Contains(input.SearchKey.Trim())
|| u.BusinessType.Contains(input.SearchKey.Trim())
|| u.Consignee.Contains(input.SearchKey.Trim())
)
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeNum), u => u.CodeNum.Contains(input.CodeNum.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.SourceCodeNum), u => u.SourceCodeNum.Contains(input.SourceCodeNum.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.StartDate), u => u.StartDate.Contains(input.StartDate.Trim()))
.WhereIF(input.State>0, u => u.State == input.State)
.WhereIF(!string.IsNullOrWhiteSpace(input.BusinessType), u => u.BusinessType.Contains(input.BusinessType.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Consignee), u => u.Consignee.Contains(input.Consignee.Trim()))
.WhereIF(input.ExaminerId>0, u => u.ExaminerId == input.ExaminerId)
.Select<OutboundOutput>();
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
/// 增加出库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Add")]
public async Task<long> Add(AddOutboundInput input)
{
var entity = input.Adapt<Outbound>();
await _rep.InsertAsync(entity);
return entity.Id;
}
/// <summary>
/// 删除出库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeleteOutboundInput input)
{
var entity = await _rep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
await _rep.FakeDeleteAsync(entity); //假删除
//await _rep.DeleteAsync(entity); //真删除
}
/// <summary>
/// 更新出库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Update")]
public async Task Update(UpdateOutboundInput input)
{
var entity = input.Adapt<Outbound>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取出库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<Outbound> Detail([FromQuery] QueryByIdOutboundInput input)
{
return await _rep.GetFirstAsync(u => u.Id == input.Id);
}
/// <summary>
/// 获取出库单列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "List")]
public async Task<List<OutboundOutput>> List()
{
return await _rep.AsQueryable().Select<OutboundOutput>().ToListAsync();
}
}

View File

@ -0,0 +1,88 @@
namespace Admin.NET.Application;
/// <summary>
/// 入库单输出参数
/// </summary>
public class WarehousingDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
public int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 供货单位
/// </summary>
public string? Supplier { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
public long? ExaminerId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
}

View File

@ -0,0 +1,173 @@
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 入库单基础输入参数
/// </summary>
public class WarehousingBaseInput
{
/// <summary>
/// 单号
/// </summary>
public virtual string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public virtual DateTime? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
public virtual int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public virtual string? BusinessType { get; set; }
/// <summary>
/// 供货单位
/// </summary>
public virtual string? Supplier { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
public virtual long? ExaminerId { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public virtual long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public virtual DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public virtual long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public virtual string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public virtual long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public virtual string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public virtual bool IsDelete { get; set; }
}
/// <summary>
/// 入库单分页查询输入参数
/// </summary>
public class WarehousingInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? StartDate { get; set; }
/// <summary>
/// 业务日期范围
/// </summary>
public List<DateTime?> StartDateRange { get; set; }
/// <summary>
/// 状态
/// </summary>
public int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 供货单位
/// </summary>
public string? Supplier { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
public long? ExaminerId { get; set; }
}
/// <summary>
/// 入库单增加输入参数
/// </summary>
public class AddWarehousingInput : WarehousingBaseInput
{
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
}
/// <summary>
/// 入库单删除输入参数
/// </summary>
public class DeleteWarehousingInput : BaseIdInput
{
}
/// <summary>
/// 入库单更新输入参数
/// </summary>
public class UpdateWarehousingInput : WarehousingBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 入库单主键查询输入参数
/// </summary>
public class QueryByIdWarehousingInput : DeleteWarehousingInput
{
}

View File

@ -0,0 +1,90 @@
namespace Admin.NET.Application;
/// <summary>
/// 入库单输出参数
/// </summary>
public class WarehousingOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? StartDate { get; set; }
/// <summary>
/// 状态
/// </summary>
public int? State { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 供货单位
/// </summary>
public string? Supplier { get; set; }
/// <summary>
/// 审核人ID
/// </summary>
public long? ExaminerId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
}

View File

@ -0,0 +1,122 @@
using Admin.NET.Core.Service;
using Admin.NET.Application.Const;
using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http;
namespace Admin.NET.Application;
/// <summary>
/// 入库单服务
/// </summary>
[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)]
public class WarehousingService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<Warehousing> _rep;
public WarehousingService(SqlSugarRepository<Warehousing> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询入库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<WarehousingOutput>> Page(WarehousingInput input)
{
var query = _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
u.CodeNum.Contains(input.SearchKey.Trim())
|| u.BusinessType.Contains(input.SearchKey.Trim())
|| u.Supplier.Contains(input.SearchKey.Trim())
)
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeNum), u => u.CodeNum.Contains(input.CodeNum.Trim()))
.WhereIF(input.State>0, u => u.State == input.State)
.WhereIF(!string.IsNullOrWhiteSpace(input.BusinessType), u => u.BusinessType.Contains(input.BusinessType.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Supplier), u => u.Supplier.Contains(input.Supplier.Trim()))
.WhereIF(input.ExaminerId>0, u => u.ExaminerId == input.ExaminerId)
.Select<WarehousingOutput>();
if(input.StartDateRange != null && input.StartDateRange.Count >0)
{
DateTime? start= input.StartDateRange[0];
query = query.WhereIF(start.HasValue, u => u.StartDate > start);
if (input.StartDateRange.Count >1 && input.StartDateRange[1].HasValue)
{
var end = input.StartDateRange[1].Value.AddDays(1);
query = query.Where(u => u.StartDate < end);
}
}
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
/// 增加入库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Add")]
public async Task<long> Add(AddWarehousingInput input)
{
var entity = input.Adapt<Warehousing>();
await _rep.InsertAsync(entity);
return entity.Id;
}
/// <summary>
/// 删除入库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeleteWarehousingInput input)
{
var entity = await _rep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
await _rep.FakeDeleteAsync(entity); //假删除
//await _rep.DeleteAsync(entity); //真删除
}
/// <summary>
/// 更新入库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Update")]
public async Task Update(UpdateWarehousingInput input)
{
var entity = input.Adapt<Warehousing>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取入库单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<Warehousing> Detail([FromQuery] QueryByIdWarehousingInput input)
{
return await _rep.GetFirstAsync(u => u.Id == input.Id);
}
/// <summary>
/// 获取入库单列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "List")]
public async Task<List<WarehousingOutput>> List()
{
return await _rep.AsQueryable().Select<WarehousingOutput>().ToListAsync();
}
}