main
liangzongpeng 2024-06-06 18:22:07 +08:00
parent 1c3b1a6501
commit 94fbe26728
20 changed files with 1786 additions and 33 deletions

View File

@ -19,6 +19,16 @@ public class PrintData : EntityBaseId
[SugarColumn(ColumnName = "QrCode", ColumnDescription = "二维码数据", Length = 128)] [SugarColumn(ColumnName = "QrCode", ColumnDescription = "二维码数据", Length = 128)]
public string? QrCode { get; set; } public string? QrCode { get; set; }
/// <summary>
/// 包装名称
/// </summary>
public string PackageName { get; set; }
/// <summary>
/// 父条码
/// </summary>
public string FatherCode { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>

View File

@ -0,0 +1,131 @@
using Admin.NET.Core;
namespace Admin.NET.Application.Entity;
/// <summary>
/// 商品追溯
/// </summary>
[SugarTable("productretrospect","商品追溯")]
public class ProductRetrospect : EntityBase
{
/// <summary>
/// 单号
/// </summary>
[SugarColumn(ColumnName = "OddNumber", ColumnDescription = "单号", Length = 32)]
public string? OddNumber { get; set; }
/// <summary>
/// 条码类型
/// </summary>
[SugarColumn(ColumnName = "CodeType", ColumnDescription = "条码类型", Length = 32)]
public string? CodeType { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
[SugarColumn(ColumnName = "ScanCodeTime", ColumnDescription = "扫码时间")]
public DateTime? ScanCodeTime { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)]
public string? BusinessType { get; set; }
/// <summary>
/// 收货/供货单位
/// </summary>
[SugarColumn(ColumnName = "Destination", ColumnDescription = "收货/供货单位", Length = 32)]
public string? Destination { get; set; }
/// <summary>
/// 所在地区
/// </summary>
[SugarColumn(ColumnName = "Location", ColumnDescription = "所在地区", Length = 32)]
public string? Location { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
[SugarColumn(ColumnName = "WarehouseID", ColumnDescription = "仓库ID")]
public long? WarehouseID { get; set; }
/// <summary>
/// 单据类型
/// </summary>
[SugarColumn(ColumnName = "Receipt", ColumnDescription = "单据类型", Length = 32)]
public string? Receipt { get; set; }
/// <summary>
/// 部门
/// </summary>
[SugarColumn(ColumnName = "Department", ColumnDescription = "部门", Length = 32)]
public string? Department { get; set; }
/// <summary>
/// 批次
/// </summary>
[SugarColumn(ColumnName = "Batch", ColumnDescription = "批次", Length = 32)]
public string? Batch { get; set; }
/// <summary>
/// 数量
/// </summary>
[SugarColumn(ColumnName = "Count", ColumnDescription = "数量")]
public int? Count { get; set; }
/// <summary>
/// 单位
/// </summary>
[SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)]
public string? Unit { get; set; }
/// <summary>
/// 基本数量
/// </summary>
[SugarColumn(ColumnName = "BaseCount", ColumnDescription = "基本数量")]
public int? BaseCount { get; set; }
/// <summary>
/// 基本单位
/// </summary>
[SugarColumn(ColumnName = "BaseUnit", ColumnDescription = "基本单位", Length = 32)]
public string? BaseUnit { get; set; }
/// <summary>
/// 业务日期
/// </summary>
[SugarColumn(ColumnName = "WarehousingDate", ColumnDescription = "业务日期")]
public DateTime? WarehousingDate { get; set; }
/// <summary>
/// 物料ID
/// </summary>
[SugarColumn(ColumnName = "MaterialsId", ColumnDescription = "物料ID")]
public long? MaterialsId { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
public string? Remarks { get; set; }
/// <summary>
/// 源ID
/// </summary>
[SugarColumn(ColumnName = "SourceId", ColumnDescription = "源ID")]
public long? SourceId { get; set; }
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)]
public string? Name { get; set; }
/// <summary>
/// 条码
/// </summary>
[Required]
[SugarColumn(ColumnName = "Code", ColumnDescription = "条码", Length = 32)]
public string Code { get; set; }
}

View File

@ -131,7 +131,7 @@ public class MaterialsService : IDynamicApiController, ITransient
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[ApiDescriptionSettings(Name = "GetById")] [ApiDescriptionSettings(Name = "GetById")]
public async Task<Materials> GetById(long materialsId) public async Task<Materials> GetById(long? materialsId)
{ {
var model = await _rep.GetFirstAsync(u => u.Id == materialsId); var model = await _rep.GetFirstAsync(u => u.Id == materialsId);
if (model!=null) if (model!=null)
@ -148,7 +148,7 @@ public class MaterialsService : IDynamicApiController, ITransient
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[ApiDescriptionSettings(Name = "PackageList")] [ApiDescriptionSettings(Name = "PackageList")]
public async Task<List<PackageInfoOutput>> GetPackageList(long materialsId) public async Task<List<PackageInfoOutput>> GetPackageList(long? materialsId)
{ {
return await _repPackage.List(materialsId); return await _repPackage.List(materialsId);
} }

View File

@ -11,7 +11,7 @@ namespace Admin.NET.Application;
/// <summary> /// <summary>
/// 物料Id /// 物料Id
/// </summary> /// </summary>
public virtual long MaterialsId { get; set; } public virtual long? MaterialsId { get; set; }
/// <summary> /// <summary>
/// 是否启用 /// 是否启用
@ -151,7 +151,7 @@ namespace Admin.NET.Application;
/// 物料Id /// 物料Id
/// </summary> /// </summary>
[Required(ErrorMessage = "物料Id不能为空")] [Required(ErrorMessage = "物料Id不能为空")]
public override long MaterialsId { get; set; } public override long? MaterialsId { get; set; }
/// <summary> /// <summary>
/// 是否启用 /// 是否启用

View File

@ -116,7 +116,7 @@ public class PackageInfoService : IDynamicApiController, ITransient
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[ApiDescriptionSettings(Name = "List")] [ApiDescriptionSettings(Name = "List")]
public async Task<List<PackageInfoOutput>> List(long materialsId) public async Task<List<PackageInfoOutput>> List(long? materialsId)
{ {
var list = await _rep.AsQueryable().Where(u =>!u.IsDelete && u.MaterialsId == materialsId)?.Select<PackageInfoOutput>().ToListAsync(); var list = await _rep.AsQueryable().Where(u =>!u.IsDelete && u.MaterialsId == materialsId)?.Select<PackageInfoOutput>().ToListAsync();
if (list != null && list.Count > 5) if (list != null && list.Count > 5)

View File

@ -170,7 +170,6 @@ public class PrintCodeDetailInput : BasePageInput
/// </summary> /// </summary>
public int? ChildCount { get; set; } public int? ChildCount { get; set; }
/// <summary> /// <summary>
/// 打印单ID /// 打印单ID
/// </summary> /// </summary>

View File

@ -135,6 +135,17 @@ public class PrintCodeDetailService : IDynamicApiController, ITransient
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<PrintCodeDetailOutput>().ToListAsync(); return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<PrintCodeDetailOutput>().ToListAsync();
} }
/// <summary>
/// 获取打印条码详情
/// </summary>
/// <param name="productCode"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "GetByProductCode")]
public async Task<PrintCodeDetail> GetByProductCode(string? productCode)
{
return await _rep.GetFirstAsync(a => a.Code == productCode);
}
} }

View File

@ -0,0 +1,148 @@
namespace Admin.NET.Application;
/// <summary>
/// 商品追溯输出参数
/// </summary>
public class ProductRetrospectDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? OddNumber { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public string? CodeType { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public DateTime? ScanCodeTime { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 收货/供货单位
/// </summary>
public string? Destination { get; set; }
/// <summary>
/// 所在地区
/// </summary>
public string? Location { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
public long? WarehouseID { get; set; }
/// <summary>
/// 单据类型
/// </summary>
public string? Receipt { get; set; }
/// <summary>
/// 部门
/// </summary>
public string? Department { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 数量
/// </summary>
public int? Count { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 基本数量
/// </summary>
public int? BaseCount { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public string? BaseUnit { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? WarehousingDate { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 源ID
/// </summary>
public long? SourceId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 条码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { 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,305 @@
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 商品追溯基础输入参数
/// </summary>
public class ProductRetrospectBaseInput
{
/// <summary>
/// 单号
/// </summary>
public virtual string? OddNumber { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public virtual string? CodeType { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public virtual DateTime? ScanCodeTime { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public virtual string? BusinessType { get; set; }
/// <summary>
/// 收货/供货单位
/// </summary>
public virtual string? Destination { get; set; }
/// <summary>
/// 所在地区
/// </summary>
public virtual string? Location { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
public virtual long? WarehouseID { get; set; }
/// <summary>
/// 单据类型
/// </summary>
public virtual string? Receipt { get; set; }
/// <summary>
/// 部门
/// </summary>
public virtual string? Department { get; set; }
/// <summary>
/// 批次
/// </summary>
public virtual string? Batch { get; set; }
/// <summary>
/// 数量
/// </summary>
public virtual int? Count { get; set; }
/// <summary>
/// 单位
/// </summary>
public virtual string? Unit { get; set; }
/// <summary>
/// 基本数量
/// </summary>
public virtual int? BaseCount { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public virtual string? BaseUnit { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public virtual DateTime? WarehousingDate { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public virtual long? MaterialsId { get; set; }
/// <summary>
/// 源ID
/// </summary>
public virtual long? SourceId { get; set; }
/// <summary>
/// 名称
/// </summary>
public virtual string? Name { get; set; }
/// <summary>
/// 条码
/// </summary>
public virtual string Code { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { 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 ProductRetrospectInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? OddNumber { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public string? CodeType { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public DateTime? ScanCodeTime { get; set; }
/// <summary>
/// 扫码时间范围
/// </summary>
public List<DateTime?> ScanCodeTimeRange { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 收货/供货单位
/// </summary>
public string? Destination { get; set; }
/// <summary>
/// 所在地区
/// </summary>
public string? Location { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
public long? WarehouseID { get; set; }
/// <summary>
/// 单据类型
/// </summary>
public string? Receipt { get; set; }
/// <summary>
/// 部门
/// </summary>
public string? Department { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 数量
/// </summary>
public int? Count { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 基本数量
/// </summary>
public int? BaseCount { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public string? BaseUnit { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? WarehousingDate { get; set; }
/// <summary>
/// 业务日期范围
/// </summary>
public List<DateTime?> WarehousingDateRange { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 名称
/// </summary>
public virtual string? Name { get; set; }
/// <summary>
/// 条码
/// </summary>
public virtual string Code { get; set; }
/// <summary>
/// 源ID
/// </summary>
public long? SourceId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
/// <summary>
/// 商品追溯增加输入参数
/// </summary>
public class AddProductRetrospectInput : ProductRetrospectBaseInput
{
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
}
/// <summary>
/// 商品追溯删除输入参数
/// </summary>
public class DeleteProductRetrospectInput : BaseIdInput
{
}
/// <summary>
/// 商品追溯更新输入参数
/// </summary>
public class UpdateProductRetrospectInput : ProductRetrospectBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 商品追溯主键查询输入参数
/// </summary>
public class QueryByIdProductRetrospectInput : DeleteProductRetrospectInput
{
}

View File

@ -0,0 +1,149 @@
namespace Admin.NET.Application;
/// <summary>
/// 商品追溯输出参数
/// </summary>
public class ProductRetrospectOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? OddNumber { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public string? CodeType { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public DateTime? ScanCodeTime { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public string? BusinessType { get; set; }
/// <summary>
/// 收货/供货单位
/// </summary>
public string? Destination { get; set; }
/// <summary>
/// 所在地区
/// </summary>
public string? Location { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
public long? WarehouseID { get; set; }
/// <summary>
/// 单据类型
/// </summary>
public string? Receipt { get; set; }
/// <summary>
/// 部门
/// </summary>
public string? Department { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 数量
/// </summary>
public int? Count { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 基本数量
/// </summary>
public int? BaseCount { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public string? BaseUnit { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime? WarehousingDate { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 名称
/// </summary>
public virtual string? Name { get; set; }
/// <summary>
/// 条码
/// </summary>
public virtual string Code { get; set; }
/// <summary>
/// 源ID
/// </summary>
public long? SourceId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { 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,161 @@
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 ProductRetrospectService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<ProductRetrospect> _rep;
private readonly PrintCodeDetailService _codeDetailService;
public ProductRetrospectService(SqlSugarRepository<ProductRetrospect> rep,
PrintCodeDetailService codeDetailService)
{
_rep = rep;
_codeDetailService = codeDetailService;
}
/// <summary>
/// 分页查询商品追溯
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<ProductRetrospectOutput>> Page(ProductRetrospectInput input)
{
var query = _rep.AsQueryable().Where(a => !a.IsDelete)
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
u.OddNumber.Contains(input.SearchKey.Trim())
|| u.CodeType.Contains(input.SearchKey.Trim())
|| u.BusinessType.Contains(input.SearchKey.Trim())
|| u.Destination.Contains(input.SearchKey.Trim())
|| u.Location.Contains(input.SearchKey.Trim())
|| u.Receipt.Contains(input.SearchKey.Trim())
|| u.Department.Contains(input.SearchKey.Trim())
|| u.Batch.Contains(input.SearchKey.Trim())
|| u.Unit.Contains(input.SearchKey.Trim())
|| u.BaseUnit.Contains(input.SearchKey.Trim())
|| u.Remarks.Contains(input.SearchKey.Trim())
)
.WhereIF(!string.IsNullOrWhiteSpace(input.OddNumber), u => u.OddNumber.Contains(input.OddNumber.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeType), u => u.CodeType.Contains(input.CodeType.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.BusinessType), u => u.BusinessType.Contains(input.BusinessType.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Destination), u => u.Destination.Contains(input.Destination.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Location), u => u.Location.Contains(input.Location.Trim()))
.WhereIF(input.WarehouseID>0, u => u.WarehouseID == input.WarehouseID)
.WhereIF(!string.IsNullOrWhiteSpace(input.Receipt), u => u.Receipt.Contains(input.Receipt.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Department), u => u.Department.Contains(input.Department.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Batch), u => u.Batch.Contains(input.Batch.Trim()))
.WhereIF(input.Count>0, u => u.Count == input.Count)
.WhereIF(!string.IsNullOrWhiteSpace(input.Unit), u => u.Unit.Contains(input.Unit.Trim()))
.WhereIF(input.BaseCount>0, u => u.BaseCount == input.BaseCount)
.WhereIF(!string.IsNullOrWhiteSpace(input.BaseUnit), u => u.BaseUnit.Contains(input.BaseUnit.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim()))
.Select<ProductRetrospectOutput>();
if(input.ScanCodeTimeRange != null && input.ScanCodeTimeRange.Count >0)
{
DateTime? start= input.ScanCodeTimeRange[0];
query = query.WhereIF(start.HasValue, u => u.ScanCodeTime > start);
if (input.ScanCodeTimeRange.Count >1 && input.ScanCodeTimeRange[1].HasValue)
{
var end = input.ScanCodeTimeRange[1].Value.AddDays(1);
query = query.Where(u => u.ScanCodeTime < end);
}
}
if(input.WarehousingDateRange != null && input.WarehousingDateRange.Count >0)
{
DateTime? start= input.WarehousingDateRange[0];
query = query.WhereIF(start.HasValue, u => u.WarehousingDate > start);
if (input.WarehousingDateRange.Count >1 && input.WarehousingDateRange[1].HasValue)
{
var end = input.WarehousingDateRange[1].Value.AddDays(1);
query = query.Where(u => u.WarehousingDate < 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(AddProductRetrospectInput input)
{
var entity = input.Adapt<ProductRetrospect>();
await _rep.InsertAsync(entity);
return entity.Id;
}
/// <summary>
/// 删除商品追溯
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeleteProductRetrospectInput 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(UpdateProductRetrospectInput input)
{
var entity = input.Adapt<ProductRetrospect>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取商品追溯
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<ProductRetrospect> Detail([FromQuery] QueryByIdProductRetrospectInput 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<ProductRetrospectOutput>> List()
{
return await _rep.AsQueryable().Select<ProductRetrospectOutput>().Where(a => !a.IsDelete).ToListAsync();
}
/// <summary>
/// 获取商品追溯列表
/// </summary>
/// <param name="productCode"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "RetrospectByProductCode")]
public async Task<List<ProductRetrospectOutput>> RetrospectByProductCode(string? productCode)
{
return await _rep.AsQueryable().Where(u => !u.IsDelete && u.Code == productCode).Select<ProductRetrospectOutput>().ToListAsync();
}
}

View File

@ -0,0 +1,24 @@
using Admin.NET.Application.Entity;
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 产品入库输入参数
/// </summary>
public class AddProductCodeInput
{
/// <summary>
/// 入库单ID
/// </summary>
public long? WarehousingTableId { get; set; }
/// <summary>
/// 条码数据
/// </summary>
public List<PrintData> CodeDatas { get; set; }
}

View File

@ -2,6 +2,10 @@
using Admin.NET.Application.Const; using Admin.NET.Application.Const;
using Admin.NET.Application.Entity; using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types;
using RazorEngine.Compilation.ImpromptuInterface.InvokeExt;
using AngleSharp.Dom;
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary> /// <summary>
/// 产品入库服务 /// 产品入库服务
@ -15,17 +19,26 @@ public class ProductWarehousingService : IDynamicApiController, ITransient
private readonly SysUnitService _sysUnitService; private readonly SysUnitService _sysUnitService;
private readonly MaterialClassifyService _materialClassifyService; private readonly MaterialClassifyService _materialClassifyService;
private readonly WarehousingStatisticsService _warehousingStatisticsService; private readonly WarehousingStatisticsService _warehousingStatisticsService;
private readonly PrintCodeDetailService _codeDetailService;
private readonly ProductRetrospectService _productRetrospect;
private readonly UserManager _userManager;
public ProductWarehousingService(SqlSugarRepository<ProductWarehousing> rep, public ProductWarehousingService(SqlSugarRepository<ProductWarehousing> rep,
UserManager userManager,
WarehouseDetailsService warehouseDetails, WarehouseDetailsService warehouseDetails,
MaterialsService materialsService, MaterialsService materialsService,
SysUnitService sysUnitService, SysUnitService sysUnitService,
PrintCodeDetailService codeDetailService,
ProductRetrospectService productRetrospect,
MaterialClassifyService materialClassifyService, MaterialClassifyService materialClassifyService,
WarehousingStatisticsService warehousingStatisticsService) WarehousingStatisticsService warehousingStatisticsService)
{ {
_rep = rep; _rep = rep;
_userManager = userManager;
_warehouseDetails = warehouseDetails; _warehouseDetails = warehouseDetails;
_materialsService = materialsService; _materialsService = materialsService;
_sysUnitService = sysUnitService; _sysUnitService = sysUnitService;
_codeDetailService = codeDetailService;
_productRetrospect = productRetrospect;
_materialClassifyService = materialClassifyService; _materialClassifyService = materialClassifyService;
_warehousingStatisticsService = warehousingStatisticsService; _warehousingStatisticsService = warehousingStatisticsService;
} }
@ -123,6 +136,226 @@ public class ProductWarehousingService : IDynamicApiController, ITransient
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
} }
/// <summary>
/// 产品入库
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "ProductWarehousing")]
public async Task ProductWarehousing(AddProductCodeInput input)
{
if (input == null || input.WarehousingTableId == null || input.CodeDatas == null || input.CodeDatas.Count == 0)
{
throw Oops.Oh(ErrorCodeEnum.xg1002);
}
var warehousing = await Detail(new QueryByIdProductWarehousingInput() { Id = input.WarehousingTableId.Value });
if (warehousing == null)
{
throw Oops.Oh(ErrorCodeEnum.xg1002);
}
var materials = await _materialsService.GetById(warehousing.MaterialsId);
if (materials == null)
{
throw Oops.Oh(ErrorCodeEnum.xg1002);
}
var units = await _sysUnitService.ListByGroupId(materials.UnitGroupId);
var baseUnit = units.LastOrDefault().Name;
var userId = _userManager.UserId;
var userName = _userManager.RealName;
var topDatas = input.CodeDatas.FindAll(a => string.IsNullOrEmpty(a.FatherCode));
Dictionary<AddPrintCodeDetailInput,long> list = new Dictionary<AddPrintCodeDetailInput, long>();
foreach (var item in topDatas)
{
var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode;
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
var unit = units.Find(a => a.Name == item.PackageName);
var detail = new AddPrintCodeDetailInput()
{
ReportTableId = input.WarehousingTableId,
Code = code,
CodeName = codeType,
ChildCount = unit.ChildUnitCount,
Count = 1,
Unit = item.PackageName,
BaseCount = unit.Rate,
BaseUnit = baseUnit,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName
};
var detailId = await _codeDetailService.Add(detail);
list.Add(detail, detailId);
var childs = input.CodeDatas.FindAll(a => a.FatherCode == code);
foreach (var child in childs)
{
var code2 = string.IsNullOrEmpty(child.BarCode) ? child.QrCode : child.BarCode;
var unit2 = units.Find(a => a.Name == child.PackageName);
var detail2 = new AddPrintCodeDetailInput()
{
ReportTableId = input.WarehousingTableId,
Code = code2,
CodeName = codeType,
ChildCount = unit2.ChildUnitCount,
Count = 1,
Unit = child.PackageName,
BaseCount = unit2.Rate,
BaseUnit = baseUnit,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
FatherCode = code,
FatherId = detailId
};
var detailId2 = await _codeDetailService.Add(detail2);
list.Add(detail2, detailId2);
var childs3 = input.CodeDatas.FindAll(a => a.FatherCode == code2);
foreach (var child3 in childs)
{
var code3 = string.IsNullOrEmpty(child3.BarCode) ? child3.QrCode : child3.BarCode;
var unit3 = units.Find(a => a.Name == child3.PackageName);
var detail3 = new AddPrintCodeDetailInput()
{
ReportTableId = input.WarehousingTableId,
Code = code3,
CodeName = codeType,
ChildCount = unit3.ChildUnitCount,
Count = 1,
Unit = child3.PackageName,
BaseCount = unit3.Rate,
BaseUnit = baseUnit,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
FatherCode = code2,
FatherId = detailId2
};
var detailId3 = await _codeDetailService.Add(detail3);
list.Add(detail3, detailId3);
if (input.CodeDatas.Any(a => a.FatherCode == code3))
{
var childs4 = input.CodeDatas.FindAll(a => a.FatherCode == code3);
foreach (var child4 in childs)
{
var code4 = string.IsNullOrEmpty(child4.BarCode) ? child4.QrCode : child4.BarCode;
var unit4 = units.Find(a => a.Name == child4.PackageName);
var detail4 = new AddPrintCodeDetailInput()
{
ReportTableId = input.WarehousingTableId,
Code = code4,
CodeName = codeType,
ChildCount = unit4.ChildUnitCount,
Count = 1,
Unit = child4.PackageName,
BaseCount = unit4.Rate,
BaseUnit = baseUnit,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
FatherCode = code3,
FatherId = detailId3
};
var detailId4 = await _codeDetailService.Add(detail4);
list.Add(detail4, detailId4);
if (input.CodeDatas.Any(a => a.FatherCode == code4))
{
var childs5 = input.CodeDatas.FindAll(a => a.FatherCode == code4);
foreach (var child5 in childs)
{
var code5 = string.IsNullOrEmpty(child5.BarCode) ? child5.QrCode : child5.BarCode;
var unit5 = units.Find(a => a.Name == child5.PackageName);
var detail5 = new AddPrintCodeDetailInput()
{
ReportTableId = input.WarehousingTableId,
Code = code5,
CodeName = codeType,
ChildCount = unit5.ChildUnitCount,
Count = 1,
Unit = child5.PackageName,
BaseCount = unit5.Rate,
BaseUnit = baseUnit,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
FatherCode = code4,
FatherId = detailId4
};
var detailId5 = await _codeDetailService.Add(detail5);
list.Add(detail5, detailId5);
}
}
}
}
}
}
}
foreach (var dic in list)
{
var item = dic.Key;
var retrospect1 = new AddProductRetrospectInput()
{
BaseCount = item.BaseCount,
BaseUnit = baseUnit,
Batch = warehousing.Batch,
BusinessType = "扫码入库",
CodeType = item.CodeName,
Department = warehousing.ProductionLine,
Destination = warehousing.Supplier,
WarehouseID = warehousing.WarehouseId,
WarehousingDate = DateTime.Now,
Count = 1,
CreateTime = DateTime.Now,
ScanCodeTime = DateTime.Now,
Location = warehousing.WarehouseLocation,
CreateUserId = userId,
CreateUserName = userName,
MaterialsId = dic.Value,
OddNumber = warehousing.OddNumber,
Receipt = "入库单",
SourceId = warehousing.Id,
Unit = item.Unit,
Name = materials.Name,
Code = item.Code
};
await _productRetrospect.Add(retrospect1);
}
var details = await _warehouseDetails.List();
if (details != null && details.Any(a => a.MaterialsId == warehousing.MaterialsId && a.Unit == warehousing.Unit))
{
var unit = units.Find(a => a.Name == warehousing.Unit);
var detail = details.Find(a => a.MaterialsId == warehousing.MaterialsId && a.Unit == warehousing.Unit);
detail.Count += warehousing.Count;
if (unit != null)
{
detail.BaseCount = detail.Count * unit.Rate;
}
await _warehouseDetails.UpdateByEntity(detail.Adapt<WarehouseDetails>());
}
else
{
var newEnt = warehousing.Adapt<AddWarehouseDetailsInput>();
newEnt.SourceId = warehousing.Id;
var addId = await _warehouseDetails.Add(newEnt);
}
var newDetail = warehousing.Adapt<AddWarehousingStatisticsInput>();
newDetail.SourceId = warehousing.Id;
await _warehousingStatisticsService.Add(newDetail);
}
/// <summary> /// <summary>
/// 增加产品入库 /// 增加产品入库
/// </summary> /// </summary>
@ -169,33 +402,12 @@ public class ProductWarehousingService : IDynamicApiController, ITransient
} }
input.CreateUserId = _userManager.UserId;
input.CreateUserName = _userManager.RealName;
var entity = input.Adapt<ProductWarehousing>(); var entity = input.Adapt<ProductWarehousing>();
await _rep.InsertAsync(entity); await _rep.InsertAsync(entity);
var details = await _warehouseDetails.List();
if (details != null && details.Any(a => a.MaterialsId == input.MaterialsId && a.Unit == input.Unit))
{
var detail = details.Find(a => a.MaterialsId == input.MaterialsId && a.Unit == input.Unit);
detail.Count += input.Count;
if (unit != null)
{
detail.BaseCount = detail.Count * unit.Rate;
}
await _warehouseDetails.UpdateByEntity(detail.Adapt<WarehouseDetails>());
}
else
{
var newEnt = input.Adapt<AddWarehouseDetailsInput>();
newEnt.SourceId = entity.Id;
var addId = await _warehouseDetails.Add(newEnt);
}
var newDetail = input.Adapt<AddWarehousingStatisticsInput>();
newDetail.SourceId = entity.Id;
await _warehousingStatisticsService.Add(newDetail);
return entity.Id; return entity.Id;
} }

View File

@ -125,6 +125,8 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
return entity.Id; return entity.Id;
} }
/// <summary> /// <summary>
/// 删除汇报单详情 /// 删除汇报单详情
/// </summary> /// </summary>

View File

@ -230,7 +230,20 @@ public class ReportTableService : IDynamicApiController, ITransient
{ {
var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode; var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode;
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码"; var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
var detail = new AddPrintCodeDetailInput() { TempListId = addReport, Code = code, CodeName = codeType, ChildCount = unit.ChildUnitCount, Count = 1, Unit = unit.Name, BaseCount = toltalCount, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName }; var detail = new AddPrintCodeDetailInput()
{
TempListId = addReport,
Code = code,
CodeName = codeType,
ChildCount = unit.ChildUnitCount,
Count = 1,
Unit = unit.Name,
BaseCount = toltalCount,
BaseUnit = baseUnit,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName
};
var detailId = await _codeDetailService.Add(detail); var detailId = await _codeDetailService.Add(detail);
var treeData1 = detail.Adapt<PrintCodeTreeData>(); var treeData1 = detail.Adapt<PrintCodeTreeData>();
if (others.Count < 1) if (others.Count < 1)

View File

@ -0,0 +1,59 @@
import request from '/@/utils/request';
enum Api {
AddProductRetrospect = '/api/productRetrospect/add',
DeleteProductRetrospect = '/api/productRetrospect/delete',
UpdateProductRetrospect = '/api/productRetrospect/update',
PageProductRetrospect = '/api/productRetrospect/page',
DetailProductRetrospect = '/api/productRetrospect/detail',
ListProductRetrospect = '/api/productRetrospect/list',
}
// 增加商品追溯
export const addProductRetrospect = (params?: any) =>
request({
url: Api.AddProductRetrospect,
method: 'post',
data: params,
});
// 删除商品追溯
export const deleteProductRetrospect = (params?: any) =>
request({
url: Api.DeleteProductRetrospect,
method: 'post',
data: params,
});
// 编辑商品追溯
export const updateProductRetrospect = (params?: any) =>
request({
url: Api.UpdateProductRetrospect,
method: 'post',
data: params,
});
// 分页查询商品追溯
export const pageProductRetrospect = (params?: any) =>
request({
url: Api.PageProductRetrospect,
method: 'post',
data: params,
});
// 列表商品追溯
export const listProductRetrospect = () =>
request({
url: Api.ListProductRetrospect,
method: 'get',
data: { },
});
// 详情商品追溯
export const detailProductRetrospect = (id: any) =>
request({
url: Api.DetailProductRetrospect,
method: 'get',
data: { id },
});

View File

@ -0,0 +1,233 @@
<template>
<div class="productRetrospect-container">
<el-dialog v-model="isShowDialog" :width="800" draggable="">
<template #header>
<div style="color: #fff">
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
<span>{{ props.title }}</span>
</div>
</template>
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
<el-row :gutter="35">
<el-form-item v-show="false">
<el-input v-model="ruleForm.id" />
</el-form-item>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="单号" prop="oddNumber">
<el-input v-model="ruleForm.oddNumber" placeholder="请输入单号" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="条码类型" prop="codeType">
<el-input v-model="ruleForm.codeType" placeholder="请输入条码类型" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="扫码时间" prop="scanCodeTime">
<el-date-picker v-model="ruleForm.scanCodeTime" type="date" placeholder="扫码时间" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="业务类型" prop="businessType">
<el-input v-model="ruleForm.businessType" placeholder="请输入业务类型" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="收货/供货单位" prop="destination">
<el-input v-model="ruleForm.destination" placeholder="请输入收货/供货单位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="所在地区" prop="location">
<el-input v-model="ruleForm.location" placeholder="请输入所在地区" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="仓库ID" prop="warehouseID">
<el-input v-model="ruleForm.warehouseID" placeholder="请输入仓库ID" maxlength="20" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="单据类型" prop="receipt">
<el-input v-model="ruleForm.receipt" placeholder="请输入单据类型" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="部门" prop="department">
<el-input v-model="ruleForm.department" placeholder="请输入部门" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="批次" prop="batch">
<el-input v-model="ruleForm.batch" placeholder="请输入批次" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="数量" prop="count">
<el-input-number v-model="ruleForm.count" placeholder="请输入数量" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="单位" prop="unit">
<el-input v-model="ruleForm.unit" placeholder="请输入单位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="基本数量" prop="baseCount">
<el-input-number v-model="ruleForm.baseCount" placeholder="请输入基本数量" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="基本单位" prop="baseUnit">
<el-input v-model="ruleForm.baseUnit" placeholder="请输入基本单位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="业务日期" prop="warehousingDate">
<el-date-picker v-model="ruleForm.warehousingDate" type="date" placeholder="业务日期" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="物料ID" prop="materialsId">
<el-input v-model="ruleForm.materialsId" placeholder="请输入物料ID" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="备注" prop="remarks">
<el-input v-model="ruleForm.remarks" placeholder="请输入备注" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<style scoped>
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
</style>
<script lang="ts" setup>
import { ref,onMounted } from "vue";
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessage } from "element-plus";
import type { FormRules } from "element-plus";
import { addProductRetrospect, updateProductRetrospect, detailProductRetrospect } from "/@/api/main/productRetrospect";
//
var props = defineProps({
title: {
type: String,
default: "",
},
});
//
const emit = defineEmits(["reloadTable"]);
const ruleFormRef = ref();
const isShowDialog = ref(false);
const ruleForm = ref<any>({});
//
const rules = ref<FormRules>({
});
//
const openDialog = async (row: any) => {
// ruleForm.value = JSON.parse(JSON.stringify(row));
// detail
let rowData = JSON.parse(JSON.stringify(row));
if (rowData.id)
ruleForm.value = (await detailProductRetrospect(rowData.id)).data.result;
else
ruleForm.value = rowData;
isShowDialog.value = true;
};
//
const closeDialog = () => {
emit("reloadTable");
isShowDialog.value = false;
};
//
const cancel = () => {
isShowDialog.value = false;
};
//
const submit = async () => {
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
if (isValid) {
let values = ruleForm.value;
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
await addProductRetrospect(values);
} else {
await updateProductRetrospect(values);
}
closeDialog();
} else {
ElMessage({
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
type: "error",
});
}
});
};
//
onMounted(async () => {
});
//
defineExpose({ openDialog });
</script>

View File

@ -0,0 +1,284 @@
<template>
<div class="productRetrospect-container">
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :model="queryParams" ref="queryForm" labelWidth="90">
<el-row>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item label="关键字">
<el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="单号">
<el-input v-model="queryParams.oddNumber" clearable="" placeholder="请输入单号"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="条码类型">
<el-input v-model="queryParams.codeType" clearable="" placeholder="请输入条码类型"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="扫码时间">
<el-date-picker placeholder="请选择扫码时间" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.scanCodeTimeRange" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="业务类型">
<el-input v-model="queryParams.businessType" clearable="" placeholder="请输入业务类型"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="收货/供货单位">
<el-input v-model="queryParams.destination" clearable="" placeholder="请输入收货/供货单位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="所在地区">
<el-input v-model="queryParams.location" clearable="" placeholder="请输入所在地区"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="仓库ID">
<el-input v-model="queryParams.warehouseID" clearable="" placeholder="请输入仓库ID"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="单据类型">
<el-input v-model="queryParams.receipt" clearable="" placeholder="请输入单据类型"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="部门">
<el-input v-model="queryParams.department" clearable="" placeholder="请输入部门"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="批次">
<el-input v-model="queryParams.batch" clearable="" placeholder="请输入批次"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="数量">
<el-input-number v-model="queryParams.count" clearable="" placeholder="请输入数量"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="单位">
<el-input v-model="queryParams.unit" clearable="" placeholder="请输入单位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本数量">
<el-input-number v-model="queryParams.baseCount" clearable="" placeholder="请输入基本数量"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本单位">
<el-input v-model="queryParams.baseUnit" clearable="" placeholder="请输入基本单位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="业务日期">
<el-date-picker placeholder="请选择业务日期" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.warehousingDateRange" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="物料ID">
<el-input v-model="queryParams.materialsId" clearable="" placeholder="请输入物料ID"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="备注">
<el-input v-model="queryParams.remarks" clearable="" placeholder="请输入备注"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10">
<el-form-item>
<el-button-group style="display: flex; align-items: center;">
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'productRetrospect:page'"> </el-button>
<el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
<el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
</el-button-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table
:data="tableData"
style="width: 100%"
v-loading="loading"
tooltip-effect="light"
row-key="id"
@sort-change="sortChange"
border="">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="oddNumber" label="单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="codeType" label="条码类型" width="140" show-overflow-tooltip="" />
<el-table-column prop="scanCodeTime" label="扫码时间" width="140" show-overflow-tooltip="" />
<el-table-column prop="businessType" label="业务类型" width="140" show-overflow-tooltip="" />
<el-table-column prop="destination" label="收货/供货单位" width="105" show-overflow-tooltip="" />
<el-table-column prop="location" label="所在地区" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehouseID" label="仓库ID" width="140" show-overflow-tooltip="" />
<el-table-column prop="receipt" label="单据类型" width="140" show-overflow-tooltip="" />
<el-table-column prop="department" label="部门" width="140" show-overflow-tooltip="" />
<el-table-column prop="batch" label="批次" width="140" show-overflow-tooltip="" />
<el-table-column prop="count" label="数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="unit" label="单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseCount" label="基本数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseUnit" label="基本单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehousingDate" label="业务日期" width="140" show-overflow-tooltip="" />
<el-table-column prop="materialsId" label="物料ID" width="140" show-overflow-tooltip="" />
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('productRetrospect:update') || auth('productRetrospect:delete')">
<template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditProductRetrospect(scope.row)" v-auth="'productRetrospect:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delProductRetrospect(scope.row)" v-auth="'productRetrospect:delete'"> </el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="tableParams.page"
v-model:page-size="tableParams.pageSize"
:total="tableParams.total"
:page-sizes="[10, 20, 50, 100, 200, 500]"
small=""
background=""
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
<printDialog
ref="printDialogRef"
:title="printProductRetrospectTitle"
@reloadTable="handleQuery" />
<editDialog
ref="editDialogRef"
:title="editProductRetrospectTitle"
@reloadTable="handleQuery"
/>
</el-card>
</div>
</template>
<script lang="ts" setup="" name="productRetrospect">
import { ref } from "vue";
import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { formatDate } from '/@/utils/formatTime';
import printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue'
import editDialog from '/@/views/main/productRetrospect/component/editDialog.vue'
import { pageProductRetrospect, deleteProductRetrospect } from '/@/api/main/productRetrospect';
const showAdvanceQueryUI = ref(false);
const printDialogRef = ref();
const editDialogRef = ref();
const loading = ref(false);
const tableData = ref<any>([]);
const queryParams = ref<any>({});
const tableParams = ref({
page: 1,
pageSize: 10,
total: 0,
});
const printProductRetrospectTitle = ref("");
const editProductRetrospectTitle = ref("");
//
const changeAdvanceQueryUI = () => {
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
}
//
const handleQuery = async () => {
loading.value = true;
var res = await pageProductRetrospect(Object.assign(queryParams.value, tableParams.value));
tableData.value = res.data.result?.items ?? [];
tableParams.value.total = res.data.result?.total;
loading.value = false;
};
//
const sortChange = async (column: any) => {
queryParams.value.field = column.prop;
queryParams.value.order = column.order;
await handleQuery();
};
//
// const openPrintProductRetrospect = async (row: any) => {
// printProductRetrospectTitle.value = '';
// }
//
const openEditProductRetrospect = (row: any) => {
editProductRetrospectTitle.value = '编辑商品追溯';
editDialogRef.value.openDialog(row);
};
//
const delProductRetrospect = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
await deleteProductRetrospect(row);
handleQuery();
ElMessage.success("删除成功");
})
.catch(() => {});
};
//
const handleSizeChange = (val: number) => {
tableParams.value.pageSize = val;
handleQuery();
};
//
const handleCurrentChange = (val: number) => {
tableParams.value.page = val;
handleQuery();
};
//handleQuery();
</script>
<style scoped>
:deep(.el-ipnut),
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
</style>

View File

@ -307,8 +307,8 @@
// //
const readReportDetailTable = (row: any) => { const readReportDetailTable = (row: any) => {
printDetailTableTitle.value = '打印详情'; printDetailTableTitle.value = '条码详情';
console.log(row); //console.log(row);
printDetailDialogRef.value.openDialog(row); printDetailDialogRef.value.openDialog(row);
}; };

View File

@ -150,6 +150,7 @@
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('warehousingStatistics:update') || auth('warehousingStatistics:delete')"> <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('warehousingStatistics:update') || auth('warehousingStatistics:delete')">
<template #default="scope"> <template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:update'"> </el-button> <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:update'"> </el-button>
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="readReportDetailTable(scope.row.id)" v-auth="'reportDetailTable:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:delete'"> </el-button> <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:delete'"> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -187,11 +188,13 @@
import printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue' import printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue'
import printDetailDialog from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue'
import editDialog from '/@/views/warehouseManagement/warehousingStatistics/component/editDialog.vue' import editDialog from '/@/views/warehouseManagement/warehousingStatistics/component/editDialog.vue'
import { pageWarehousingStatistics, deleteWarehousingStatistics } from '/@/api/main/warehousingStatistics'; import { pageWarehousingStatistics, deleteWarehousingStatistics } from '/@/api/main/warehousingStatistics';
const showAdvanceQueryUI = ref(false); const showAdvanceQueryUI = ref(false);
const printDetailDialogRef = ref();
const printDialogRef = ref(); const printDialogRef = ref();
const editDialogRef = ref(); const editDialogRef = ref();
const loading = ref(false); const loading = ref(false);
@ -205,6 +208,7 @@
const printWarehousingStatisticsTitle = ref(""); const printWarehousingStatisticsTitle = ref("");
const editWarehousingStatisticsTitle = ref(""); const editWarehousingStatisticsTitle = ref("");
const printDetailTableTitle = ref("");
// //
const changeAdvanceQueryUI = () => { const changeAdvanceQueryUI = () => {
@ -245,6 +249,14 @@
editDialogRef.value.openDialog(row); editDialogRef.value.openDialog(row);
}; };
//
const readReportDetailTable = (row: any) => {
printDetailTableTitle.value = '条码详情';
//console.log(row);
printDetailDialogRef.value.openDialog(row);
};
// //
const delWarehousingStatistics = (row: any) => { const delWarehousingStatistics = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", { ElMessageBox.confirm(`确定要删除吗?`, "提示", {