main
liangzongpeng 2024-05-25 18:46:26 +08:00
parent d3cb68aec8
commit afc41d099e
18 changed files with 2578 additions and 8 deletions

View File

@ -0,0 +1,94 @@
using Admin.NET.Core;
namespace Admin.NET.Application.Entity;
/// <summary>
/// 打印条码详情
/// </summary>
[SugarTable("PrintCodeDetail","打印条码详情")]
public class PrintCodeDetail : EntityBase
{
/// <summary>
/// 条码
/// </summary>
[SugarColumn(ColumnName = "Code", ColumnDescription = "条码", Length = 32)]
public string? Code { get; set; }
/// <summary>
/// 上级码
/// </summary>
[SugarColumn(ColumnName = "FatherCode", ColumnDescription = "上级码", Length = 32)]
public string? FatherCode { get; set; }
/// <summary>
/// 条码类型
/// </summary>
[SugarColumn(ColumnName = "CodeName", ColumnDescription = "条码类型", Length = 32)]
public string? CodeName { 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 = "ChildCount", ColumnDescription = "子码数")]
public int? ChildCount { get; set; }
/// <summary>
/// 打码时间
/// </summary>
[SugarColumn(ColumnName = "PrintCodeTime", ColumnDescription = "打码时间")]
public DateTime? PrintCodeTime { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
[SugarColumn(ColumnName = "ScanCodeTime", ColumnDescription = "扫码时间")]
public DateTime? ScanCodeTime { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
public string? Remarks { get; set; }
/// <summary>
/// 打印单ID
/// </summary>
[SugarColumn(ColumnName = "TempListId", ColumnDescription = "打印单ID")]
public long? TempListId { get; set; }
/// <summary>
/// 汇报单ID
/// </summary>
[SugarColumn(ColumnName = "ReportTableId", ColumnDescription = "汇报单ID")]
public long? ReportTableId { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
[SugarColumn(ColumnName = "WarehouseID", ColumnDescription = "仓库ID")]
public long? WarehouseID { get; set; }
}

View File

@ -0,0 +1,162 @@
using Admin.NET.Core;
namespace Admin.NET.Application.Entity;
/// <summary>
/// 汇报单详情
/// </summary>
[SugarTable("ReportDetailTable","汇报单详情")]
public class ReportDetailTable : EntityTenant
{
/// <summary>
/// 产品名称
/// </summary>
[Required]
[SugarColumn(ColumnName = "ProductName", ColumnDescription = "产品名称", Length = 32)]
public string ProductName { get; set; }
/// <summary>
/// 产品编码
/// </summary>
[SugarColumn(ColumnName = "ProductCodeNum", ColumnDescription = "产品编码", Length = 32)]
public string? ProductCodeNum { get; set; }
/// <summary>
/// 单号
/// </summary>
[SugarColumn(ColumnName = "OddNumber", ColumnDescription = "单号", Length = 32)]
public string? OddNumber { get; set; }
/// <summary>
/// 状态
/// </summary>
[Required]
[SugarColumn(ColumnName = "State", ColumnDescription = "状态", Length = 32)]
public string State { get; set; }
/// <summary>
/// 生产类型
/// </summary>
[SugarColumn(ColumnName = "ProductType", ColumnDescription = "生产类型", Length = 32)]
public string? ProductType { get; set; }
/// <summary>
/// 生产线
/// </summary>
[SugarColumn(ColumnName = "ProductionLine", ColumnDescription = "生产线", Length = 32)]
public string? ProductionLine { get; set; }
/// <summary>
/// 生产线编码
/// </summary>
[SugarColumn(ColumnName = "CodeNum", ColumnDescription = "生产线编码", Length = 32)]
public string? CodeNum { get; set; }
/// <summary>
/// 源单号
/// </summary>
[SugarColumn(ColumnName = "SourceNumber", ColumnDescription = "源单号", Length = 32)]
public string? SourceNumber { get; set; }
/// <summary>
/// 规格型号
/// </summary>
[SugarColumn(ColumnName = "Specifications", ColumnDescription = "规格型号", Length = 32)]
public string? Specifications { get; set; }
/// <summary>
/// 完工数量
/// </summary>
[SugarColumn(ColumnName = "ProductCount", ColumnDescription = "完工数量")]
public int? ProductCount { get; set; }
/// <summary>
/// 入库数量
/// </summary>
[SugarColumn(ColumnName = "PutWarehouse", ColumnDescription = "入库数量")]
public int? PutWarehouse { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
[SugarColumn(ColumnName = "BaseProductCount", ColumnDescription = "基本完工数量")]
public int? BaseProductCount { get; set; }
/// <summary>
/// 基本入库数量
/// </summary>
[SugarColumn(ColumnName = "BasePutWarehouse", ColumnDescription = "基本入库数量")]
public int? BasePutWarehouse { get; set; }
/// <summary>
/// 单位
/// </summary>
[SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)]
public string? Unit { get; set; }
/// <summary>
/// 基本单位
/// </summary>
[SugarColumn(ColumnName = "BaseUnit", ColumnDescription = "基本单位", Length = 32)]
public string? BaseUnit { get; set; }
/// <summary>
/// 批次
/// </summary>
[SugarColumn(ColumnName = "Batch", ColumnDescription = "批次", Length = 32)]
public string? Batch { get; set; }
/// <summary>
/// 包装规格
/// </summary>
[SugarColumn(ColumnName = "Package", ColumnDescription = "包装规格", Length = 32)]
public string? Package { get; set; }
/// <summary>
/// 包装数量
/// </summary>
[SugarColumn(ColumnName = "PackageCount", ColumnDescription = "包装数量")]
public int? PackageCount { get; set; }
/// <summary>
/// 采集失败数量
/// </summary>
[SugarColumn(ColumnName = "GatherFalseCount", ColumnDescription = "采集失败数量")]
public int? GatherFalseCount { get; set; }
/// <summary>
/// 生产日期
/// </summary>
[SugarColumn(ColumnName = "ProductDate", ColumnDescription = "生产日期")]
public DateTime? ProductDate { get; set; }
/// <summary>
/// 班组
/// </summary>
[SugarColumn(ColumnName = "TeamGroup", ColumnDescription = "班组", Length = 32)]
public string? TeamGroup { get; set; }
/// <summary>
/// 操作工人
/// </summary>
[SugarColumn(ColumnName = "Operator", ColumnDescription = "操作工人", Length = 32)]
public string? Operator { get; set; }
/// <summary>
/// 完工时间
/// </summary>
[SugarColumn(ColumnName = "EndDate", ColumnDescription = "完工时间")]
public DateTime? EndDate { get; set; }
/// <summary>
/// 源单号
/// </summary>
[SugarColumn(ColumnName = "SourceOddNumber", ColumnDescription = "源单号", Length = 32)]
public string? SourceOddNumber { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
public string? Remarks { get; set; }
}

View File

@ -0,0 +1,27 @@
using Admin.NET.Core;
using Admin.NET.Application.Entity;
namespace Admin.NET.Application.SeedData;
/// <summary>
/// 打印条码详情 表种子数据
/// </summary>
public class PrintCodeDetailSeedData: ISqlSugarEntitySeedData<PrintCodeDetail>
{
/// <summary>
/// 种子数据
/// </summary>
/// <returns></returns>
public IEnumerable<PrintCodeDetail> HasData()
{
string recordsJSON = @"
[]
";
List<PrintCodeDetail> records = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PrintCodeDetail>>(recordsJSON);
// 后处理数据的特殊字段
//for (int i = 0; i < records.Count; i++) { }
return records;
}
}

View File

@ -0,0 +1,118 @@
namespace Admin.NET.Application;
/// <summary>
/// 打印条码详情输出参数
/// </summary>
public class PrintCodeDetailDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 条码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// 上级码
/// </summary>
public string? FatherCode { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public string? CodeName { 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 int? ChildCount { get; set; }
/// <summary>
/// 打印单ID
/// </summary>
public long? TempListId { get; set; }
/// <summary>
/// 汇报单ID
/// </summary>
public long? ReportTableId { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
public long? WarehouseID { get; set; }
/// <summary>
/// 打码时间
/// </summary>
public DateTime? PrintCodeTime { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public DateTime? ScanCodeTime { 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,233 @@
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 打印条码详情基础输入参数
/// </summary>
public class PrintCodeDetailBaseInput
{
/// <summary>
/// 条码
/// </summary>
public virtual string? Code { get; set; }
/// <summary>
/// 上级码
/// </summary>
public virtual string? FatherCode { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public virtual string? CodeName { 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 int? ChildCount { get; set; }
/// <summary>
/// 打印单ID
/// </summary>
public long? TempListId { get; set; }
/// <summary>
/// 汇报单ID
/// </summary>
public long? ReportTableId { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
public long? WarehouseID { get; set; }
/// <summary>
/// 打码时间
/// </summary>
public virtual DateTime? PrintCodeTime { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public virtual DateTime? ScanCodeTime { 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 PrintCodeDetailInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 条码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// 上级码
/// </summary>
public string? FatherCode { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public string? CodeName { 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 int? ChildCount { get; set; }
/// <summary>
/// 打码时间
/// </summary>
public DateTime? PrintCodeTime { get; set; }
/// <summary>
/// 打码时间范围
/// </summary>
public List<DateTime?> PrintCodeTimeRange { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public DateTime? ScanCodeTime { get; set; }
/// <summary>
/// 扫码时间范围
/// </summary>
public List<DateTime?> ScanCodeTimeRange { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
/// <summary>
/// 打印条码详情增加输入参数
/// </summary>
public class AddPrintCodeDetailInput : PrintCodeDetailBaseInput
{
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
}
/// <summary>
/// 打印条码详情删除输入参数
/// </summary>
public class DeletePrintCodeDetailInput : BaseIdInput
{
}
/// <summary>
/// 打印条码详情更新输入参数
/// </summary>
public class UpdatePrintCodeDetailInput : PrintCodeDetailBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 打印条码详情主键查询输入参数
/// </summary>
public class QueryByIdPrintCodeDetailInput : DeletePrintCodeDetailInput
{
}

View File

@ -0,0 +1,120 @@
namespace Admin.NET.Application;
/// <summary>
/// 打印条码详情输出参数
/// </summary>
public class PrintCodeDetailOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 条码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// 上级码
/// </summary>
public string? FatherCode { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public string? CodeName { 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 int? ChildCount { get; set; }
/// <summary>
/// 打印单ID
/// </summary>
public long? TempListId { get; set; }
/// <summary>
/// 汇报单ID
/// </summary>
public long? ReportTableId { get; set; }
/// <summary>
/// 仓库ID
/// </summary>
public long? WarehouseID { get; set; }
/// <summary>
/// 打码时间
/// </summary>
public DateTime? PrintCodeTime { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public DateTime? ScanCodeTime { 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,135 @@
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 PrintCodeDetailService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<PrintCodeDetail> _rep;
public PrintCodeDetailService(SqlSugarRepository<PrintCodeDetail> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询打印条码详情
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<PrintCodeDetailOutput>> Page(PrintCodeDetailInput input)
{
var query = _rep.AsQueryable().Where(a => !a.IsDelete)
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
u.Code.Contains(input.SearchKey.Trim())
|| u.FatherCode.Contains(input.SearchKey.Trim())
|| u.CodeName.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.Code), u => u.Code.Contains(input.Code.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.FatherCode), u => u.FatherCode.Contains(input.FatherCode.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeName), u => u.CodeName.Contains(input.CodeName.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(input.ChildCount>0, u => u.ChildCount == input.ChildCount)
.WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim()))
.Select<PrintCodeDetailOutput>();
if(input.PrintCodeTimeRange != null && input.PrintCodeTimeRange.Count >0)
{
DateTime? start= input.PrintCodeTimeRange[0];
query = query.WhereIF(start.HasValue, u => u.PrintCodeTime > start);
if (input.PrintCodeTimeRange.Count >1 && input.PrintCodeTimeRange[1].HasValue)
{
var end = input.PrintCodeTimeRange[1].Value.AddDays(1);
query = query.Where(u => u.PrintCodeTime < end);
}
}
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);
}
}
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(AddPrintCodeDetailInput input)
{
var entity = input.Adapt<PrintCodeDetail>();
await _rep.InsertAsync(entity);
return entity.Id;
}
/// <summary>
/// 删除打印条码详情
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeletePrintCodeDetailInput 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(UpdatePrintCodeDetailInput input)
{
var entity = input.Adapt<PrintCodeDetail>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取打印条码详情
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<PrintCodeDetail> Detail([FromQuery] QueryByIdPrintCodeDetailInput input)
{
return await _rep.GetFirstAsync(u => u.Id == input.Id);
}
/// <summary>
/// 获取打印条码详情列表
/// </summary>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "List")]
public async Task<List<PrintCodeDetailOutput>> List()
{
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<PrintCodeDetailOutput>().ToListAsync();
}
}

View File

@ -106,23 +106,28 @@ public class PrintDataService : IDynamicApiController, ITransient
[HttpPost] [HttpPost]
[ApiDescriptionSettings(Name = "GetPrintDataList")] [ApiDescriptionSettings(Name = "GetPrintDataList")]
public async Task<List<PrintData>> GetPrintDataList(PrintDataMaterialsInput input) public async Task<List<PrintData>> GetPrintDataList(PrintDataMaterialsInput input)
{
return await GetPrintDatas(input.CodeHead, input.CodeType, input.Count);
}
private async Task<List<PrintData>> GetPrintDatas(string codeName,string codeType,int count)
{ {
var result = new List<PrintData>(); var result = new List<PrintData>();
if (string.IsNullOrEmpty(input.CodeHead)) if (string.IsNullOrEmpty(codeName))
{ {
return result; return result;
} }
var elem = await _codeElementService.GetElementByName(input.CodeHead); var elem = await _codeElementService.GetElementByName(codeName);
if (elem == null) if (elem == null)
{ return result; } { return result; }
var elemProp = await _codeElementPropService.CodePropByElement(new CodeElementOutput() { Id = elem.Id, CodeLength = elem.CodeLength }); var elemProp = await _codeElementPropService.CodePropByElement(new CodeElementOutput() { Id = elem.Id, CodeLength = elem.CodeLength });
if (elemProp.Count>0) if (elemProp.Count > 0)
{ {
elemProp = elemProp.OrderBy(a => a.Index).ToList(); elemProp = elemProp.OrderBy(a => a.Index).ToList();
for (int i = 0; i < input.Count; i++) for (int i = 0; i < count; i++)
{ {
var code = GetCodeNumByProp(elemProp, i + 1); var code = GetCodeNumByProp(elemProp, i + 1);
if (input.CodeType == "条形码") if (codeType == "条形码")
{ {
result.Add(new PrintData() { BarCode = code }); result.Add(new PrintData() { BarCode = code });
} }
@ -132,7 +137,7 @@ public class PrintDataService : IDynamicApiController, ITransient
} }
} }
} }
return result; return result;
} }
private string GetCodeNumByProp(List<CodeElementPropOutput> lists,int index) private string GetCodeNumByProp(List<CodeElementPropOutput> lists,int index)

View File

@ -0,0 +1,178 @@
namespace Admin.NET.Application;
/// <summary>
/// 汇报单详情输出参数
/// </summary>
public class ReportDetailTableDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string ProductName { get; set; }
/// <summary>
/// 产品编码
/// </summary>
public string? ProductCodeNum { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? OddNumber { get; set; }
/// <summary>
/// 状态
/// </summary>
public string State { get; set; }
/// <summary>
/// 生产类型
/// </summary>
public string? ProductType { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string? ProductionLine { get; set; }
/// <summary>
/// 生产线编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 源单号
/// </summary>
public string? SourceNumber { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string? Specifications { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 入库数量
/// </summary>
public int? PutWarehouse { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 基本入库数量
/// </summary>
public int? BasePutWarehouse { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public string? BaseUnit { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 包装规格
/// </summary>
public string? Package { get; set; }
/// <summary>
/// 包装数量
/// </summary>
public int? PackageCount { get; set; }
/// <summary>
/// 采集失败数量
/// </summary>
public int? GatherFalseCount { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public DateTime? ProductDate { get; set; }
/// <summary>
/// 班组
/// </summary>
public string? TeamGroup { get; set; }
/// <summary>
/// 操作工人
/// </summary>
public string? Operator { get; set; }
/// <summary>
/// 完工时间
/// </summary>
public DateTime? EndDate { get; set; }
/// <summary>
/// 源单号
/// </summary>
public string? SourceOddNumber { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
}

View File

@ -0,0 +1,374 @@
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 汇报单详情基础输入参数
/// </summary>
public class ReportDetailTableBaseInput
{
/// <summary>
/// 产品名称
/// </summary>
public virtual string ProductName { get; set; }
/// <summary>
/// 产品编码
/// </summary>
public virtual string? ProductCodeNum { get; set; }
/// <summary>
/// 单号
/// </summary>
public virtual string? OddNumber { get; set; }
/// <summary>
/// 状态
/// </summary>
public virtual string State { get; set; }
/// <summary>
/// 生产类型
/// </summary>
public virtual string? ProductType { get; set; }
/// <summary>
/// 生产线
/// </summary>
public virtual string? ProductionLine { get; set; }
/// <summary>
/// 生产线编码
/// </summary>
public virtual string? CodeNum { get; set; }
/// <summary>
/// 源单号
/// </summary>
public virtual string? SourceNumber { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public virtual string? Specifications { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public virtual int? ProductCount { get; set; }
/// <summary>
/// 入库数量
/// </summary>
public virtual int? PutWarehouse { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public virtual int? BaseProductCount { get; set; }
/// <summary>
/// 基本入库数量
/// </summary>
public virtual int? BasePutWarehouse { get; set; }
/// <summary>
/// 单位
/// </summary>
public virtual string? Unit { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public virtual string? BaseUnit { get; set; }
/// <summary>
/// 批次
/// </summary>
public virtual string? Batch { get; set; }
/// <summary>
/// 包装规格
/// </summary>
public virtual string? Package { get; set; }
/// <summary>
/// 包装数量
/// </summary>
public virtual int? PackageCount { get; set; }
/// <summary>
/// 采集失败数量
/// </summary>
public virtual int? GatherFalseCount { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public virtual DateTime? ProductDate { get; set; }
/// <summary>
/// 班组
/// </summary>
public virtual string? TeamGroup { get; set; }
/// <summary>
/// 操作工人
/// </summary>
public virtual string? Operator { get; set; }
/// <summary>
/// 完工时间
/// </summary>
public virtual DateTime? EndDate { get; set; }
/// <summary>
/// 源单号
/// </summary>
public virtual string? SourceOddNumber { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public virtual long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public virtual DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public virtual long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public virtual string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public virtual long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public virtual string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public virtual bool IsDelete { get; set; }
}
/// <summary>
/// 汇报单详情分页查询输入参数
/// </summary>
public class ReportDetailTableInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string? ProductName { get; set; }
/// <summary>
/// 产品编码
/// </summary>
public string? ProductCodeNum { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? OddNumber { get; set; }
/// <summary>
/// 状态
/// </summary>
public string? State { get; set; }
/// <summary>
/// 生产类型
/// </summary>
public string? ProductType { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string? ProductionLine { get; set; }
/// <summary>
/// 生产线编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 源单号
/// </summary>
public string? SourceNumber { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string? Specifications { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 入库数量
/// </summary>
public int? PutWarehouse { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 基本入库数量
/// </summary>
public int? BasePutWarehouse { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public string? BaseUnit { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 包装规格
/// </summary>
public string? Package { get; set; }
/// <summary>
/// 包装数量
/// </summary>
public int? PackageCount { get; set; }
/// <summary>
/// 采集失败数量
/// </summary>
public int? GatherFalseCount { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public DateTime? ProductDate { get; set; }
/// <summary>
/// 生产日期范围
/// </summary>
public List<DateTime?> ProductDateRange { get; set; }
/// <summary>
/// 班组
/// </summary>
public string? TeamGroup { get; set; }
/// <summary>
/// 操作工人
/// </summary>
public string? Operator { get; set; }
/// <summary>
/// 完工时间
/// </summary>
public DateTime? EndDate { get; set; }
/// <summary>
/// 完工时间范围
/// </summary>
public List<DateTime?> EndDateRange { get; set; }
/// <summary>
/// 源单号
/// </summary>
public string? SourceOddNumber { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
/// <summary>
/// 汇报单详情增加输入参数
/// </summary>
public class AddReportDetailTableInput : ReportDetailTableBaseInput
{
/// <summary>
/// 产品名称
/// </summary>
[Required(ErrorMessage = "产品名称不能为空")]
public override string ProductName { get; set; }
/// <summary>
/// 状态
/// </summary>
[Required(ErrorMessage = "状态不能为空")]
public override string State { get; set; }
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
}
/// <summary>
/// 汇报单详情删除输入参数
/// </summary>
public class DeleteReportDetailTableInput : BaseIdInput
{
}
/// <summary>
/// 汇报单详情更新输入参数
/// </summary>
public class UpdateReportDetailTableInput : ReportDetailTableBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 汇报单详情主键查询输入参数
/// </summary>
public class QueryByIdReportDetailTableInput : DeleteReportDetailTableInput
{
}

View File

@ -0,0 +1,180 @@
namespace Admin.NET.Application;
/// <summary>
/// 汇报单详情输出参数
/// </summary>
public class ReportDetailTableOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string ProductName { get; set; }
/// <summary>
/// 产品编码
/// </summary>
public string? ProductCodeNum { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? OddNumber { get; set; }
/// <summary>
/// 状态
/// </summary>
public string State { get; set; }
/// <summary>
/// 生产类型
/// </summary>
public string? ProductType { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string? ProductionLine { get; set; }
/// <summary>
/// 生产线编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 源单号
/// </summary>
public string? SourceNumber { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string? Specifications { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 入库数量
/// </summary>
public int? PutWarehouse { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 基本入库数量
/// </summary>
public int? BasePutWarehouse { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public string? BaseUnit { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 包装规格
/// </summary>
public string? Package { get; set; }
/// <summary>
/// 包装数量
/// </summary>
public int? PackageCount { get; set; }
/// <summary>
/// 采集失败数量
/// </summary>
public int? GatherFalseCount { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public DateTime? ProductDate { get; set; }
/// <summary>
/// 班组
/// </summary>
public string? TeamGroup { get; set; }
/// <summary>
/// 操作工人
/// </summary>
public string? Operator { get; set; }
/// <summary>
/// 完工时间
/// </summary>
public DateTime? EndDate { get; set; }
/// <summary>
/// 源单号
/// </summary>
public string? SourceOddNumber { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
}

View File

@ -0,0 +1,162 @@
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 ReportDetailTableService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<ReportDetailTable> _rep;
public ReportDetailTableService(SqlSugarRepository<ReportDetailTable> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询汇报单详情
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<ReportDetailTableOutput>> Page(ReportDetailTableInput input)
{
var query = _rep.AsQueryable().Where(a => !a.IsDelete)
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
u.ProductName.Contains(input.SearchKey.Trim())
|| u.ProductCodeNum.Contains(input.SearchKey.Trim())
|| u.OddNumber.Contains(input.SearchKey.Trim())
|| u.State.Contains(input.SearchKey.Trim())
|| u.ProductType.Contains(input.SearchKey.Trim())
|| u.ProductionLine.Contains(input.SearchKey.Trim())
|| u.CodeNum.Contains(input.SearchKey.Trim())
|| u.SourceNumber.Contains(input.SearchKey.Trim())
|| u.Specifications.Contains(input.SearchKey.Trim())
|| u.Unit.Contains(input.SearchKey.Trim())
|| u.BaseUnit.Contains(input.SearchKey.Trim())
|| u.Batch.Contains(input.SearchKey.Trim())
|| u.Package.Contains(input.SearchKey.Trim())
|| u.TeamGroup.Contains(input.SearchKey.Trim())
|| u.Operator.Contains(input.SearchKey.Trim())
|| u.SourceOddNumber.Contains(input.SearchKey.Trim())
|| u.Remarks.Contains(input.SearchKey.Trim())
)
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductName), u => u.ProductName.Contains(input.ProductName.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductCodeNum), u => u.ProductCodeNum.Contains(input.ProductCodeNum.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.OddNumber), u => u.OddNumber.Contains(input.OddNumber.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.State), u => u.State.Contains(input.State.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductType), u => u.ProductType.Contains(input.ProductType.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductionLine), u => u.ProductionLine.Contains(input.ProductionLine.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeNum), u => u.CodeNum.Contains(input.CodeNum.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.SourceNumber), u => u.SourceNumber.Contains(input.SourceNumber.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Specifications), u => u.Specifications.Contains(input.Specifications.Trim()))
.WhereIF(input.ProductCount>0, u => u.ProductCount == input.ProductCount)
.WhereIF(input.PutWarehouse>0, u => u.PutWarehouse == input.PutWarehouse)
.WhereIF(input.BaseProductCount>0, u => u.BaseProductCount == input.BaseProductCount)
.WhereIF(input.BasePutWarehouse>0, u => u.BasePutWarehouse == input.BasePutWarehouse)
.WhereIF(!string.IsNullOrWhiteSpace(input.Unit), u => u.Unit.Contains(input.Unit.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.BaseUnit), u => u.BaseUnit.Contains(input.BaseUnit.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Batch), u => u.Batch.Contains(input.Batch.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Package), u => u.Package.Contains(input.Package.Trim()))
.WhereIF(input.PackageCount>0, u => u.PackageCount == input.PackageCount)
.WhereIF(input.GatherFalseCount>0, u => u.GatherFalseCount == input.GatherFalseCount)
.WhereIF(!string.IsNullOrWhiteSpace(input.TeamGroup), u => u.TeamGroup.Contains(input.TeamGroup.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Operator), u => u.Operator.Contains(input.Operator.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.SourceOddNumber), u => u.SourceOddNumber.Contains(input.SourceOddNumber.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim()))
.Select<ReportDetailTableOutput>();
if(input.ProductDateRange != null && input.ProductDateRange.Count >0)
{
DateTime? start= input.ProductDateRange[0];
query = query.WhereIF(start.HasValue, u => u.ProductDate > start);
if (input.ProductDateRange.Count >1 && input.ProductDateRange[1].HasValue)
{
var end = input.ProductDateRange[1].Value.AddDays(1);
query = query.Where(u => u.ProductDate < end);
}
}
if(input.EndDateRange != null && input.EndDateRange.Count >0)
{
DateTime? start= input.EndDateRange[0];
query = query.WhereIF(start.HasValue, u => u.EndDate > start);
if (input.EndDateRange.Count >1 && input.EndDateRange[1].HasValue)
{
var end = input.EndDateRange[1].Value.AddDays(1);
query = query.Where(u => u.EndDate < 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(AddReportDetailTableInput input)
{
var entity = input.Adapt<ReportDetailTable>();
await _rep.InsertAsync(entity);
return entity.Id;
}
/// <summary>
/// 删除汇报单详情
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeleteReportDetailTableInput 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(UpdateReportDetailTableInput input)
{
var entity = input.Adapt<ReportDetailTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取汇报单详情
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<ReportDetailTable> Detail([FromQuery] QueryByIdReportDetailTableInput 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<ReportDetailTableOutput>> List()
{
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<ReportDetailTableOutput>().ToListAsync();
}
}

View File

@ -21,6 +21,18 @@ public class AddReportContext
/// </summary> /// </summary>
public string? Name { get; set; } public string? Name { get; set; }
/// <summary> /// <summary>
/// 生产日期
/// </summary>
public DateTime? ProductDate { get; set; }
/// <summary>
/// 失效日期
/// </summary>
public DateTime? LoseDate { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 打印数据 /// 打印数据
/// </summary> /// </summary>
public List<PrintData> PrintDatas { get; set; } public List<PrintData> PrintDatas { get; set; }

View File

@ -14,13 +14,23 @@ public class ReportTableService : IDynamicApiController, ITransient
private readonly SqlSugarRepository<ReportTable> _rep; private readonly SqlSugarRepository<ReportTable> _rep;
private readonly SysUnitService _repUnit; private readonly SysUnitService _repUnit;
private readonly SysUnitGroupService _repUnitGroup; private readonly SysUnitGroupService _repUnitGroup;
private readonly PrintCodeDetailService _codeDetailService;
private readonly ReportDetailTableService _reportDetailTable;
private readonly UserManager _userManager;
public ReportTableService(SqlSugarRepository<ReportTable> rep, public ReportTableService(SqlSugarRepository<ReportTable> rep,
UserManager userManager,
SysUnitService repUnit, SysUnitService repUnit,
SysUnitGroupService repUnitGroup) SysUnitGroupService repUnitGroup,
PrintCodeDetailService codeDetailService,
ReportDetailTableService reportDetailTable)
{ {
_rep = rep; _rep = rep;
_repUnit = repUnit; _repUnit = repUnit;
_repUnitGroup = repUnitGroup; _repUnitGroup = repUnitGroup;
_codeDetailService = codeDetailService;
_reportDetailTable = reportDetailTable;
_userManager = userManager;
} }
/// <summary> /// <summary>
@ -160,6 +170,71 @@ public class ReportTableService : IDynamicApiController, ITransient
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
} }
/// <summary>
/// 新增汇报单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "AddReport")]
public async Task AddPrintList(AddReportContext input)
{
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
if (unitGroup == null)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var units = await _repUnit.ListByGroupId(unitGroup.Id);
if (units == null || units.Count < 1)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var unit = units.Find(a => a.Name == input.Name);
if (unit == null)
throw new ArgumentNullException(nameof(unitGroup));
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 1 };
var addReport = await Add(newReport);
var others = units.FindAll(a => a.Rate < unit.Rate).OrderBy(a => a.Rate).ToList();
int toltalCount = 1;
foreach (var other in others)
{
toltalCount *= other.Rate.ToInt();
}
foreach (var item in input.PrintDatas)
{
var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode;
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
var detail = new AddPrintCodeDetailInput() { TempListId = addReport, Code = code, CodeName = codeType, Count = 1, Unit = unit.Name, BaseCount = toltalCount, BaseUnit = others.FirstOrDefault()?.Name, PrintCodeTime = DateTime.Now, CreateUserId = _userManager.UserId, CreateUserName = _userManager.RealName };
if (others.Count>0)
{
detail.ChildCount = others.LastOrDefault().Rate;
}
var detailId = await _codeDetailService.Add(detail);
for (int i = 0; i < others.Count; i++)
{
var current = others[i];
int count = current.Rate.ToInt();
if (i < others.Count - 1)
{
var ends = others.Skip(i + 1).ToList();
if (ends.Count>0)
{
foreach (var ss in ends)
{
count /= ss.Rate.ToInt();
}
}
}
}
}
var entity = input.Adapt<ReportTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
} }

View File

@ -3,6 +3,13 @@
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证 // 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
Console.WriteLine(DateTime.Now.ToString("yyyyMMddhhmmss")); Console.WriteLine(DateTime.Now.ToString("yyyyMMddhhmmss"));
List<int> numbers = new List<int> { 7, 8, 9, 10 };
for (int i = 0; i < numbers.Count; i++)
{
var current = numbers[i];
var ewrw = numbers.Skip(i + 1).ToList();
}
// 使用LINQ获取索引大于3的剩余集合
IEnumerable<int> result = numbers.Skip(4);
Console.WriteLine("Hello, World!"); Console.WriteLine("Hello, World!");
Console.ReadKey(); Console.ReadKey();

View File

@ -0,0 +1,50 @@
import request from '/@/utils/request';
enum Api {
AddReportDetailTable = '/api/reportDetailTable/add',
DeleteReportDetailTable = '/api/reportDetailTable/delete',
UpdateReportDetailTable = '/api/reportDetailTable/update',
PageReportDetailTable = '/api/reportDetailTable/page',
DetailReportDetailTable = '/api/reportDetailTable/detail',
}
// 增加汇报单详情
export const addReportDetailTable = (params?: any) =>
request({
url: Api.AddReportDetailTable,
method: 'post',
data: params,
});
// 删除汇报单详情
export const deleteReportDetailTable = (params?: any) =>
request({
url: Api.DeleteReportDetailTable,
method: 'post',
data: params,
});
// 编辑汇报单详情
export const updateReportDetailTable = (params?: any) =>
request({
url: Api.UpdateReportDetailTable,
method: 'post',
data: params,
});
// 分页查询汇报单详情
export const pageReportDetailTable = (params?: any) =>
request({
url: Api.PageReportDetailTable,
method: 'post',
data: params,
});
// 详情汇报单详情
export const detailReportDetailTable = (id: any) =>
request({
url: Api.DetailReportDetailTable,
method: 'get',
data: { id },
});

View File

@ -0,0 +1,291 @@
<template>
<div class="reportDetailTable-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="productName">
<el-input v-model="ruleForm.productName" 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="productCodeNum">
<el-input v-model="ruleForm.productCodeNum" 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="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="state">
<el-input v-model="ruleForm.state" 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="productType">
<el-input v-model="ruleForm.productType" 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="productionLine">
<el-input v-model="ruleForm.productionLine" 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="codeNum">
<el-input v-model="ruleForm.codeNum" 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="sourceNumber">
<el-input v-model="ruleForm.sourceNumber" 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="specifications">
<el-input v-model="ruleForm.specifications" 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="productCount">
<el-input-number v-model="ruleForm.productCount" 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="putWarehouse">
<el-input-number v-model="ruleForm.putWarehouse" 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="baseProductCount">
<el-input-number v-model="ruleForm.baseProductCount" 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="basePutWarehouse">
<el-input-number v-model="ruleForm.basePutWarehouse" 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="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="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="package">
<el-input v-model="ruleForm.package" 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="packageCount">
<el-input-number v-model="ruleForm.packageCount" 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="gatherFalseCount">
<el-input-number v-model="ruleForm.gatherFalseCount" 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="productDate">
<el-date-picker v-model="ruleForm.productDate" 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="teamGroup">
<el-input v-model="ruleForm.teamGroup" 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="operator">
<el-input v-model="ruleForm.operator" 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="endDate">
<el-date-picker v-model="ruleForm.endDate" 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="sourceOddNumber">
<el-input v-model="ruleForm.sourceOddNumber" 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="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 { addReportDetailTable, updateReportDetailTable, detailReportDetailTable } from "/@/api/main/reportDetailTable";
//
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>({
productName: [{required: true, message: '请输入产品名称!', trigger: 'blur',},],
state: [{required: true, message: '请输入状态!', trigger: 'blur',},],
});
//
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 detailReportDetailTable(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 addReportDetailTable(values);
} else {
await updateReportDetailTable(values);
}
closeDialog();
} else {
ElMessage({
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
type: "error",
});
}
});
};
//
onMounted(async () => {
});
//
defineExpose({ openDialog });
</script>

View File

@ -0,0 +1,347 @@
<template>
<div class="reportDetailTable-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.productName" 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.productCodeNum" 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.state" 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.productType" 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.productionLine" 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.codeNum" 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.sourceNumber" 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.specifications" 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.productCount" 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.putWarehouse" 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.baseProductCount" 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.basePutWarehouse" 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 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-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 v-model="queryParams.package" 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.packageCount" 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.gatherFalseCount" 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.productDateRange" />
</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.teamGroup" 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.operator" 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.endDateRange" />
</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.sourceOddNumber" 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.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="'reportDetailTable: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 type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddReportDetailTable" v-auth="'reportDetailTable:add'"> </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="productName" label="产品名称" width="140" show-overflow-tooltip="" />
<el-table-column prop="productCodeNum" label="产品编码" width="140" show-overflow-tooltip="" />
<el-table-column prop="oddNumber" label="单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="state" label="状态" width="140" show-overflow-tooltip="" />
<el-table-column prop="productType" label="生产类型" width="140" show-overflow-tooltip="" />
<el-table-column prop="productionLine" label="生产线" width="140" show-overflow-tooltip="" />
<el-table-column prop="codeNum" label="生产线编码" width="140" show-overflow-tooltip="" />
<el-table-column prop="sourceNumber" label="源单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="specifications" label="规格型号" width="140" show-overflow-tooltip="" />
<el-table-column prop="productCount" label="完工数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="putWarehouse" label="入库数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseProductCount" label="基本完工数量" width="90" show-overflow-tooltip="" />
<el-table-column prop="basePutWarehouse" label="基本入库数量" width="90" show-overflow-tooltip="" />
<el-table-column prop="unit" label="单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseUnit" label="基本单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="batch" label="批次" width="140" show-overflow-tooltip="" />
<el-table-column prop="package" label="包装规格" width="140" show-overflow-tooltip="" />
<el-table-column prop="packageCount" label="包装数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="gatherFalseCount" label="采集失败数量" width="90" show-overflow-tooltip="" />
<el-table-column prop="productDate" label="生产日期" width="140" show-overflow-tooltip="" />
<el-table-column prop="teamGroup" label="班组" width="140" show-overflow-tooltip="" />
<el-table-column prop="operator" label="操作工人" width="140" show-overflow-tooltip="" />
<el-table-column prop="endDate" label="完工时间" width="140" show-overflow-tooltip="" />
<el-table-column prop="sourceOddNumber" label="源单号" 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('reportDetailTable:update') || auth('reportDetailTable:delete')">
<template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditReportDetailTable(scope.row)" v-auth="'reportDetailTable:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delReportDetailTable(scope.row)" v-auth="'reportDetailTable: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="printReportDetailTableTitle"
@reloadTable="handleQuery" />
<editDialog
ref="editDialogRef"
:title="editReportDetailTableTitle"
@reloadTable="handleQuery"
/>
</el-card>
</div>
</template>
<script lang="ts" setup="" name="reportDetailTable">
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/reportDetailTable/component/editDialog.vue'
import { pageReportDetailTable, deleteReportDetailTable } from '/@/api/main/reportDetailTable';
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 printReportDetailTableTitle = ref("");
const editReportDetailTableTitle = ref("");
//
const changeAdvanceQueryUI = () => {
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
}
//
const handleQuery = async () => {
loading.value = true;
var res = await pageReportDetailTable(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 openAddReportDetailTable = () => {
editReportDetailTableTitle.value = '添加汇报单详情';
editDialogRef.value.openDialog({});
};
//
const openPrintReportDetailTable = async (row: any) => {
printReportDetailTableTitle.value = '打印汇报单详情';
}
//
const openEditReportDetailTable = (row: any) => {
editReportDetailTableTitle.value = '编辑汇报单详情';
editDialogRef.value.openDialog(row);
};
//
const delReportDetailTable = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
await deleteReportDetailTable(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>