From 8d2cfa59a6d90ea7a35f17ab7938ecb7712759b4 Mon Sep 17 00:00:00 2001 From: liangzongpeng <532365025@qq.com> Date: Wed, 20 Mar 2024 14:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=8E=A5=E5=8F=A32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin.NET.Application/Entity/Invoice.cs | 100 +++++++ .../Admin.NET.Application/Entity/Outbound.cs | 70 +++++ .../Entity/Warehousing.cs | 52 ++++ .../Service/Invoice/Dto/InvoiceDto.cs | 128 +++++++++ .../Service/Invoice/Dto/InvoiceInput.cs | 265 ++++++++++++++++++ .../Service/Invoice/Dto/InvoiceOutput.cs | 130 +++++++++ .../Service/Invoice/InvoiceService.cs | 144 ++++++++++ .../Service/Outbound/Dto/OutboundDto.cs | 103 +++++++ .../Service/Outbound/Dto/OutboundInput.cs | 200 +++++++++++++ .../Service/Outbound/Dto/OutboundOutput.cs | 105 +++++++ .../Service/Outbound/OutboundService.cs | 116 ++++++++ .../Service/Warehousing/Dto/WarehousingDto.cs | 88 ++++++ .../Warehousing/Dto/WarehousingInput.cs | 173 ++++++++++++ .../Warehousing/Dto/WarehousingOutput.cs | 90 ++++++ .../Service/Warehousing/WarehousingService.cs | 122 ++++++++ 15 files changed, 1886 insertions(+) create mode 100644 Admin.NET/Admin.NET.Application/Entity/Invoice.cs create mode 100644 Admin.NET/Admin.NET.Application/Entity/Outbound.cs create mode 100644 Admin.NET/Admin.NET.Application/Entity/Warehousing.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceDto.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceInput.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceOutput.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Invoice/InvoiceService.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundDto.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundInput.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundOutput.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Outbound/OutboundService.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingDto.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingInput.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingOutput.cs create mode 100644 Admin.NET/Admin.NET.Application/Service/Warehousing/WarehousingService.cs diff --git a/Admin.NET/Admin.NET.Application/Entity/Invoice.cs b/Admin.NET/Admin.NET.Application/Entity/Invoice.cs new file mode 100644 index 0000000..f50918f --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Entity/Invoice.cs @@ -0,0 +1,100 @@ +using Admin.NET.Core; +namespace Admin.NET.Application.Entity; + +/// +/// 发货通知单 +/// +[SugarTable("Invoice","发货通知单")] +public class Invoice : EntityTenant +{ + /// + /// 单号 + /// + [SugarColumn(ColumnName = "CodeNum", ColumnDescription = "单号", Length = 32)] + public string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + [SugarColumn(ColumnName = "StartDate", ColumnDescription = "业务日期")] + public DateTime? StartDate { get; set; } + + /// + /// 业务类型 + /// + [SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)] + public string BusinessType { get; set; } + + /// + /// 客户 + /// + [SugarColumn(ColumnName = "Custom", ColumnDescription = "客户", Length = 32)] + public string Custom { get; set; } + + /// + /// 仓库 + /// + [SugarColumn(ColumnName = "Warehouse", ColumnDescription = "仓库", Length = 32)] + public string Warehouse { get; set; } + + /// + /// 部门 + /// + [SugarColumn(ColumnName = "Department", ColumnDescription = "部门", Length = 32)] + public string? Department { get; set; } + + /// + /// 车牌号 + /// + [SugarColumn(ColumnName = "CarNumber", ColumnDescription = "车牌号", Length = 32)] + public string? CarNumber { get; set; } + + /// + /// 停车位 + /// + [SugarColumn(ColumnName = "ParkingSpace", ColumnDescription = "停车位", Length = 32)] + public string? ParkingSpace { get; set; } + + /// + /// 业务员 + /// + [SugarColumn(ColumnName = "Salesman", ColumnDescription = "业务员", Length = 32)] + public string? Salesman { get; set; } + + /// + /// 收货单位 + /// + [SugarColumn(ColumnName = "Consignee", ColumnDescription = "收货单位", Length = 32)] + public string? Consignee { get; set; } + + /// + /// 交货日期 + /// + [SugarColumn(ColumnName = "DeliveryDate", ColumnDescription = "交货日期")] + public DateTime? DeliveryDate { get; set; } + + /// + /// 交货地址 + /// + [SugarColumn(ColumnName = "DeliveryAddress", ColumnDescription = "交货地址", Length = 128)] + public string? DeliveryAddress { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 128)] + public string? Remarks { get; set; } + + /// + /// 方案客户拓展 + /// + [SugarColumn(ColumnName = "CustomExpand", ColumnDescription = "方案客户拓展", Length = 32)] + public string? CustomExpand { get; set; } + + /// + /// 发货拓展 + /// + [SugarColumn(ColumnName = "SendOutExpand", ColumnDescription = "发货拓展", Length = 32)] + public string? SendOutExpand { get; set; } + +} diff --git a/Admin.NET/Admin.NET.Application/Entity/Outbound.cs b/Admin.NET/Admin.NET.Application/Entity/Outbound.cs new file mode 100644 index 0000000..40c07d2 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Entity/Outbound.cs @@ -0,0 +1,70 @@ +using Admin.NET.Core; +namespace Admin.NET.Application.Entity; + +/// +/// 出库单 +/// +[SugarTable("Outbound","出库单")] +public class Outbound : EntityTenant +{ + /// + /// 单号 + /// + [SugarColumn(ColumnName = "CodeNum", ColumnDescription = "单号", Length = 32)] + public string? CodeNum { get; set; } + + /// + /// 来源单号 + /// + [SugarColumn(ColumnName = "SourceCodeNum", ColumnDescription = "来源单号", Length = 32)] + public string SourceCodeNum { get; set; } + + /// + /// 业务日期 + /// + [SugarColumn(ColumnName = "StartDate", ColumnDescription = "业务日期", Length = 32)] + public string? StartDate { get; set; } + + /// + /// 状态 + /// + [SugarColumn(ColumnName = "State", ColumnDescription = "状态")] + public int? State { get; set; } + + /// + /// 业务类型 + /// + [SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)] + public string? BusinessType { get; set; } + + /// + /// 收货单位 + /// + [SugarColumn(ColumnName = "Consignee", ColumnDescription = "收货单位", Length = 32)] + public string Consignee { get; set; } + + /// + /// 仓库 + /// + [SugarColumn(ColumnName = "Warehouse", ColumnDescription = "仓库")] + public string? Warehouse { get; set; } + + /// + /// 审核人ID + /// + [SugarColumn(ColumnName = "ExaminerId", ColumnDescription = "审核人ID")] + public long? ExaminerId { get; set; } + + /// + /// 出库单整型拓展字段 + /// + [SugarColumn(ColumnName = "OutboundExpandInt", ColumnDescription = "出库单整型拓展字段")] + public int? OutboundExpandInt { get; set; } + + /// + /// 出库单字符串拓展字段 + /// + [SugarColumn(ColumnName = "OutboundExpandString", ColumnDescription = "出库单字符串拓展字段", Length = 64)] + public string? OutboundExpandString { get; set; } + +} diff --git a/Admin.NET/Admin.NET.Application/Entity/Warehousing.cs b/Admin.NET/Admin.NET.Application/Entity/Warehousing.cs new file mode 100644 index 0000000..ecfc4c1 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Entity/Warehousing.cs @@ -0,0 +1,52 @@ +using Admin.NET.Core; +namespace Admin.NET.Application.Entity; + +/// +/// 入库单 +/// +[SugarTable("Warehousing","入库单")] +public class Warehousing : EntityTenant +{ + /// + /// 单号 + /// + [SugarColumn(ColumnName = "CodeNum", ColumnDescription = "单号", Length = 32)] + public string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + [SugarColumn(ColumnName = "StartDate", ColumnDescription = "业务日期")] + public DateTime? StartDate { get; set; } + + /// + /// 状态 + /// + [SugarColumn(ColumnName = "State", ColumnDescription = "状态")] + public int? State { get; set; } + + /// + /// 业务类型 + /// + [SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)] + public string? BusinessType { get; set; } + + /// + /// 供货单位 + /// + [SugarColumn(ColumnName = "Supplier", ColumnDescription = "供货单位", Length = 32)] + public string? Supplier { get; set; } + + /// + /// 审核人ID + /// + [SugarColumn(ColumnName = "ExaminerId", ColumnDescription = "审核人ID")] + public long? ExaminerId { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)] + public string? Remarks { get; set; } + +} diff --git a/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceDto.cs b/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceDto.cs new file mode 100644 index 0000000..ac5ed65 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceDto.cs @@ -0,0 +1,128 @@ +namespace Admin.NET.Application; + + /// + /// 发货通知单输出参数 + /// + public class InvoiceDto + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + public DateTime? StartDate { get; set; } + + /// + /// 业务类型 + /// + public string BusinessType { get; set; } + + /// + /// 客户 + /// + public string Custom { get; set; } + + /// + /// 仓库 + /// + public string Warehouse { get; set; } + + /// + /// 部门 + /// + public string? Department { get; set; } + + /// + /// 车牌号 + /// + public string? CarNumber { get; set; } + + /// + /// 停车位 + /// + public string? ParkingSpace { get; set; } + + /// + /// 业务员 + /// + public string? Salesman { get; set; } + + /// + /// 收货单位 + /// + public string? Consignee { get; set; } + + /// + /// 交货日期 + /// + public DateTime? DeliveryDate { get; set; } + + /// + /// 交货地址 + /// + public string? DeliveryAddress { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + /// + /// 方案客户拓展 + /// + public string? CustomExpand { get; set; } + + /// + /// 发货拓展 + /// + public string? SendOutExpand { get; set; } + + /// + /// 租户Id + /// + public long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + } diff --git a/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceInput.cs b/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceInput.cs new file mode 100644 index 0000000..e2e26f4 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceInput.cs @@ -0,0 +1,265 @@ +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace Admin.NET.Application; + + /// + /// 发货通知单基础输入参数 + /// + public class InvoiceBaseInput + { + /// + /// 单号 + /// + public virtual string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + public virtual DateTime? StartDate { get; set; } + + /// + /// 业务类型 + /// + public virtual string BusinessType { get; set; } + + /// + /// 客户 + /// + public virtual string Custom { get; set; } + + /// + /// 仓库 + /// + public virtual string Warehouse { get; set; } + + /// + /// 部门 + /// + public virtual string? Department { get; set; } + + /// + /// 车牌号 + /// + public virtual string? CarNumber { get; set; } + + /// + /// 停车位 + /// + public virtual string? ParkingSpace { get; set; } + + /// + /// 业务员 + /// + public virtual string? Salesman { get; set; } + + /// + /// 收货单位 + /// + public virtual string? Consignee { get; set; } + + /// + /// 交货日期 + /// + public virtual DateTime? DeliveryDate { get; set; } + + /// + /// 交货地址 + /// + public virtual string? DeliveryAddress { get; set; } + + /// + /// 备注 + /// + public virtual string? Remarks { get; set; } + + /// + /// 方案客户拓展 + /// + public virtual string? CustomExpand { get; set; } + + /// + /// 发货拓展 + /// + public virtual string? SendOutExpand { get; set; } + + /// + /// 租户Id + /// + public virtual long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public virtual DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public virtual DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public virtual long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public virtual string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public virtual long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public virtual string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public virtual bool IsDelete { get; set; } + + } + + /// + /// 发货通知单分页查询输入参数 + /// + public class InvoiceInput : BasePageInput + { + /// + /// 关键字查询 + /// + public string? SearchKey { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + public DateTime? StartDate { get; set; } + + /// + /// 业务日期范围 + /// + public List StartDateRange { get; set; } + /// + /// 业务类型 + /// + public string? BusinessType { get; set; } + + /// + /// 客户 + /// + public string? Custom { get; set; } + + /// + /// 仓库 + /// + public string? Warehouse { get; set; } + + /// + /// 部门 + /// + public string? Department { get; set; } + + /// + /// 车牌号 + /// + public string? CarNumber { get; set; } + + /// + /// 停车位 + /// + public string? ParkingSpace { get; set; } + + /// + /// 业务员 + /// + public string? Salesman { get; set; } + + /// + /// 收货单位 + /// + public string? Consignee { get; set; } + + /// + /// 交货日期 + /// + public DateTime? DeliveryDate { get; set; } + + /// + /// 交货日期范围 + /// + public List DeliveryDateRange { get; set; } + /// + /// 交货地址 + /// + public string? DeliveryAddress { get; set; } + + } + + /// + /// 发货通知单增加输入参数 + /// + public class AddInvoiceInput : InvoiceBaseInput + { + /// + /// 业务类型 + /// + [Required(ErrorMessage = "业务类型不能为空")] + public override string BusinessType { get; set; } + + /// + /// 客户 + /// + [Required(ErrorMessage = "客户不能为空")] + public override string Custom { get; set; } + + /// + /// 仓库 + /// + [Required(ErrorMessage = "仓库不能为空")] + public override string Warehouse { get; set; } + + /// + /// 软删除 + /// + [Required(ErrorMessage = "软删除不能为空")] + public override bool IsDelete { get; set; } + + } + + /// + /// 发货通知单删除输入参数 + /// + public class DeleteInvoiceInput : BaseIdInput + { + } + + /// + /// 发货通知单更新输入参数 + /// + public class UpdateInvoiceInput : InvoiceBaseInput + { + /// + /// 主键Id + /// + [Required(ErrorMessage = "主键Id不能为空")] + public long Id { get; set; } + + } + + /// + /// 发货通知单主键查询输入参数 + /// + public class QueryByIdInvoiceInput : DeleteInvoiceInput + { + + } diff --git a/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceOutput.cs b/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceOutput.cs new file mode 100644 index 0000000..04d9b41 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Invoice/Dto/InvoiceOutput.cs @@ -0,0 +1,130 @@ +namespace Admin.NET.Application; + +/// +/// 发货通知单输出参数 +/// +public class InvoiceOutput +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + public DateTime? StartDate { get; set; } + + /// + /// 业务类型 + /// + public string BusinessType { get; set; } + + /// + /// 客户 + /// + public string Custom { get; set; } + + /// + /// 仓库 + /// + public string Warehouse { get; set; } + + /// + /// 部门 + /// + public string? Department { get; set; } + + /// + /// 车牌号 + /// + public string? CarNumber { get; set; } + + /// + /// 停车位 + /// + public string? ParkingSpace { get; set; } + + /// + /// 业务员 + /// + public string? Salesman { get; set; } + + /// + /// 收货单位 + /// + public string? Consignee { get; set; } + + /// + /// 交货日期 + /// + public DateTime? DeliveryDate { get; set; } + + /// + /// 交货地址 + /// + public string? DeliveryAddress { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + /// + /// 方案客户拓展 + /// + public string? CustomExpand { get; set; } + + /// + /// 发货拓展 + /// + public string? SendOutExpand { get; set; } + + /// + /// 租户Id + /// + public long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + } + + diff --git a/Admin.NET/Admin.NET.Application/Service/Invoice/InvoiceService.cs b/Admin.NET/Admin.NET.Application/Service/Invoice/InvoiceService.cs new file mode 100644 index 0000000..2214655 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Invoice/InvoiceService.cs @@ -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; +/// +/// 发货通知单服务 +/// +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class InvoiceService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository _rep; + public InvoiceService(SqlSugarRepository rep) + { + _rep = rep; + } + + /// + /// 分页查询发货通知单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + public async Task> 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(); + 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); + } + + /// + /// 增加发货通知单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + public async Task Add(AddInvoiceInput input) + { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + return entity.Id; + } + + /// + /// 删除发货通知单 + /// + /// + /// + [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); //真删除 + } + + /// + /// 更新发货通知单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + public async Task Update(UpdateInvoiceInput input) + { + var entity = input.Adapt(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// + /// 获取发货通知单 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + public async Task Detail([FromQuery] QueryByIdInvoiceInput input) + { + return await _rep.GetFirstAsync(u => u.Id == input.Id); + } + + /// + /// 获取发货通知单列表 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + public async Task> List() + { + return await _rep.AsQueryable().Select().ToListAsync(); + } + + + + + +} + diff --git a/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundDto.cs b/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundDto.cs new file mode 100644 index 0000000..d9a5378 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundDto.cs @@ -0,0 +1,103 @@ +namespace Admin.NET.Application; + + /// + /// 出库单输出参数 + /// + public class OutboundDto + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 来源单号 + /// + public string SourceCodeNum { get; set; } + + /// + /// 业务日期 + /// + public string? StartDate { get; set; } + + /// + /// 状态 + /// + public int? State { get; set; } + + /// + /// 业务类型 + /// + public string? BusinessType { get; set; } + + /// + /// 收货单位 + /// + public string Consignee { get; set; } + + /// + /// 审核人ID + /// + public long? ExaminerId { get; set; } + + /// + /// 出库单整型拓展字段 + /// + public int? OutboundExpandInt { get; set; } + + /// + /// 出库单字符串拓展字段 + /// + public string? OutboundExpandString { get; set; } + + /// + /// 租户Id + /// + public long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + /// + /// 仓库 + /// + public string? Warehouse { get; set; } + + } diff --git a/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundInput.cs b/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundInput.cs new file mode 100644 index 0000000..2b2930d --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundInput.cs @@ -0,0 +1,200 @@ +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace Admin.NET.Application; + + /// + /// 出库单基础输入参数 + /// + public class OutboundBaseInput + { + /// + /// 单号 + /// + public virtual string? CodeNum { get; set; } + + /// + /// 来源单号 + /// + public virtual string SourceCodeNum { get; set; } + + /// + /// 业务日期 + /// + public virtual string? StartDate { get; set; } + + /// + /// 状态 + /// + public virtual int? State { get; set; } + + /// + /// 业务类型 + /// + public virtual string? BusinessType { get; set; } + + /// + /// 收货单位 + /// + public virtual string Consignee { get; set; } + + /// + /// 审核人ID + /// + public virtual long? ExaminerId { get; set; } + + /// + /// 出库单整型拓展字段 + /// + public virtual int? OutboundExpandInt { get; set; } + + /// + /// 出库单字符串拓展字段 + /// + public virtual string? OutboundExpandString { get; set; } + + /// + /// 租户Id + /// + public virtual long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public virtual DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public virtual DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public virtual long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public virtual string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public virtual long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public virtual string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public virtual bool IsDelete { get; set; } + + /// + /// 仓库 + /// + public virtual string? Warehouse { get; set; } + + } + + /// + /// 出库单分页查询输入参数 + /// + public class OutboundInput : BasePageInput + { + /// + /// 关键字查询 + /// + public string? SearchKey { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 来源单号 + /// + public string? SourceCodeNum { get; set; } + + /// + /// 业务日期 + /// + public string? StartDate { get; set; } + + /// + /// 状态 + /// + public int? State { get; set; } + + /// + /// 业务类型 + /// + public string? BusinessType { get; set; } + + /// + /// 收货单位 + /// + public string? Consignee { get; set; } + + /// + /// 审核人ID + /// + public long? ExaminerId { get; set; } + } + + /// + /// 出库单增加输入参数 + /// + public class AddOutboundInput : OutboundBaseInput + { + /// + /// 来源单号 + /// + [Required(ErrorMessage = "来源单号不能为空")] + public override string SourceCodeNum { get; set; } + + /// + /// 收货单位 + /// + [Required(ErrorMessage = "收货单位不能为空")] + public override string Consignee { get; set; } + + /// + /// 软删除 + /// + [Required(ErrorMessage = "软删除不能为空")] + public override bool IsDelete { get; set; } + + } + + /// + /// 出库单删除输入参数 + /// + public class DeleteOutboundInput : BaseIdInput + { + } + + /// + /// 出库单更新输入参数 + /// + public class UpdateOutboundInput : OutboundBaseInput + { + /// + /// 主键Id + /// + [Required(ErrorMessage = "主键Id不能为空")] + public long Id { get; set; } + + } + + /// + /// 出库单主键查询输入参数 + /// + public class QueryByIdOutboundInput : DeleteOutboundInput + { + + } diff --git a/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundOutput.cs b/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundOutput.cs new file mode 100644 index 0000000..7458f22 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Outbound/Dto/OutboundOutput.cs @@ -0,0 +1,105 @@ +namespace Admin.NET.Application; + +/// +/// 出库单输出参数 +/// +public class OutboundOutput +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 来源单号 + /// + public string SourceCodeNum { get; set; } + + /// + /// 业务日期 + /// + public string? StartDate { get; set; } + + /// + /// 状态 + /// + public int? State { get; set; } + + /// + /// 业务类型 + /// + public string? BusinessType { get; set; } + + /// + /// 收货单位 + /// + public string Consignee { get; set; } + + /// + /// 审核人ID + /// + public long? ExaminerId { get; set; } + + /// + /// 出库单整型拓展字段 + /// + public int? OutboundExpandInt { get; set; } + + /// + /// 出库单字符串拓展字段 + /// + public string? OutboundExpandString { get; set; } + + /// + /// 租户Id + /// + public long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + /// + /// 仓库 + /// + public string? Warehouse { get; set; } + + } + + diff --git a/Admin.NET/Admin.NET.Application/Service/Outbound/OutboundService.cs b/Admin.NET/Admin.NET.Application/Service/Outbound/OutboundService.cs new file mode 100644 index 0000000..97ec12d --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Outbound/OutboundService.cs @@ -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; +/// +/// 出库单服务 +/// +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class OutboundService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository _rep; + public OutboundService(SqlSugarRepository rep) + { + _rep = rep; + } + + /// + /// 分页查询出库单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + public async Task> 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(); + return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); + } + + /// + /// 增加出库单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + public async Task Add(AddOutboundInput input) + { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + return entity.Id; + } + + /// + /// 删除出库单 + /// + /// + /// + [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); //真删除 + } + + /// + /// 更新出库单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + public async Task Update(UpdateOutboundInput input) + { + var entity = input.Adapt(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// + /// 获取出库单 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + public async Task Detail([FromQuery] QueryByIdOutboundInput input) + { + return await _rep.GetFirstAsync(u => u.Id == input.Id); + } + + /// + /// 获取出库单列表 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + public async Task> List() + { + return await _rep.AsQueryable().Select().ToListAsync(); + } + + + + + +} + diff --git a/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingDto.cs b/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingDto.cs new file mode 100644 index 0000000..a31e41d --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingDto.cs @@ -0,0 +1,88 @@ +namespace Admin.NET.Application; + + /// + /// 入库单输出参数 + /// + public class WarehousingDto + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + public DateTime? StartDate { get; set; } + + /// + /// 状态 + /// + public int? State { get; set; } + + /// + /// 业务类型 + /// + public string? BusinessType { get; set; } + + /// + /// 供货单位 + /// + public string? Supplier { get; set; } + + /// + /// 审核人ID + /// + public long? ExaminerId { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + /// + /// 租户Id + /// + public long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + } diff --git a/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingInput.cs b/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingInput.cs new file mode 100644 index 0000000..7498731 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingInput.cs @@ -0,0 +1,173 @@ +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace Admin.NET.Application; + + /// + /// 入库单基础输入参数 + /// + public class WarehousingBaseInput + { + /// + /// 单号 + /// + public virtual string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + public virtual DateTime? StartDate { get; set; } + + /// + /// 状态 + /// + public virtual int? State { get; set; } + + /// + /// 业务类型 + /// + public virtual string? BusinessType { get; set; } + + /// + /// 供货单位 + /// + public virtual string? Supplier { get; set; } + + /// + /// 审核人ID + /// + public virtual long? ExaminerId { get; set; } + + /// + /// 备注 + /// + public virtual string? Remarks { get; set; } + + /// + /// 租户Id + /// + public virtual long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public virtual DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public virtual DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public virtual long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public virtual string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public virtual long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public virtual string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public virtual bool IsDelete { get; set; } + + } + + /// + /// 入库单分页查询输入参数 + /// + public class WarehousingInput : BasePageInput + { + /// + /// 关键字查询 + /// + public string? SearchKey { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + public DateTime? StartDate { get; set; } + + /// + /// 业务日期范围 + /// + public List StartDateRange { get; set; } + /// + /// 状态 + /// + public int? State { get; set; } + + /// + /// 业务类型 + /// + public string? BusinessType { get; set; } + + /// + /// 供货单位 + /// + public string? Supplier { get; set; } + + /// + /// 审核人ID + /// + public long? ExaminerId { get; set; } + + } + + /// + /// 入库单增加输入参数 + /// + public class AddWarehousingInput : WarehousingBaseInput + { + /// + /// 软删除 + /// + [Required(ErrorMessage = "软删除不能为空")] + public override bool IsDelete { get; set; } + + } + + /// + /// 入库单删除输入参数 + /// + public class DeleteWarehousingInput : BaseIdInput + { + } + + /// + /// 入库单更新输入参数 + /// + public class UpdateWarehousingInput : WarehousingBaseInput + { + /// + /// 主键Id + /// + [Required(ErrorMessage = "主键Id不能为空")] + public long Id { get; set; } + + } + + /// + /// 入库单主键查询输入参数 + /// + public class QueryByIdWarehousingInput : DeleteWarehousingInput + { + + } diff --git a/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingOutput.cs b/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingOutput.cs new file mode 100644 index 0000000..3cf288d --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Warehousing/Dto/WarehousingOutput.cs @@ -0,0 +1,90 @@ +namespace Admin.NET.Application; + +/// +/// 入库单输出参数 +/// +public class WarehousingOutput +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 单号 + /// + public string? CodeNum { get; set; } + + /// + /// 业务日期 + /// + public DateTime? StartDate { get; set; } + + /// + /// 状态 + /// + public int? State { get; set; } + + /// + /// 业务类型 + /// + public string? BusinessType { get; set; } + + /// + /// 供货单位 + /// + public string? Supplier { get; set; } + + /// + /// 审核人ID + /// + public long? ExaminerId { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + /// + /// 租户Id + /// + public long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + } + + diff --git a/Admin.NET/Admin.NET.Application/Service/Warehousing/WarehousingService.cs b/Admin.NET/Admin.NET.Application/Service/Warehousing/WarehousingService.cs new file mode 100644 index 0000000..d4cf668 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/Warehousing/WarehousingService.cs @@ -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; +/// +/// 入库单服务 +/// +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class WarehousingService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository _rep; + public WarehousingService(SqlSugarRepository rep) + { + _rep = rep; + } + + /// + /// 分页查询入库单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + public async Task> 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(); + 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); + } + + /// + /// 增加入库单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + public async Task Add(AddWarehousingInput input) + { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + return entity.Id; + } + + /// + /// 删除入库单 + /// + /// + /// + [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); //真删除 + } + + /// + /// 更新入库单 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + public async Task Update(UpdateWarehousingInput input) + { + var entity = input.Adapt(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// + /// 获取入库单 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + public async Task Detail([FromQuery] QueryByIdWarehousingInput input) + { + return await _rep.GetFirstAsync(u => u.Id == input.Id); + } + + /// + /// 获取入库单列表 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + public async Task> List() + { + return await _rep.AsQueryable().Select().ToListAsync(); + } + + + + + +} +