diff --git a/Admin.NET/Admin.NET.Application/Entity/PrintCodeDetail.cs b/Admin.NET/Admin.NET.Application/Entity/PrintCodeDetail.cs new file mode 100644 index 0000000..f10d66b --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Entity/PrintCodeDetail.cs @@ -0,0 +1,94 @@ +using Admin.NET.Core; +namespace Admin.NET.Application.Entity; + +/// +/// 打印条码详情 +/// +[SugarTable("PrintCodeDetail","打印条码详情")] +public class PrintCodeDetail : EntityBase +{ + /// + /// 条码 + /// + [SugarColumn(ColumnName = "Code", ColumnDescription = "条码", Length = 32)] + public string? Code { get; set; } + + /// + /// 上级码 + /// + [SugarColumn(ColumnName = "FatherCode", ColumnDescription = "上级码", Length = 32)] + public string? FatherCode { get; set; } + + /// + /// 条码类型 + /// + [SugarColumn(ColumnName = "CodeName", ColumnDescription = "条码类型", Length = 32)] + public string? CodeName { get; set; } + + /// + /// 数量 + /// + [SugarColumn(ColumnName = "Count", ColumnDescription = "数量")] + public int? Count { get; set; } + + /// + /// 单位 + /// + [SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)] + public string? Unit { get; set; } + + /// + /// 基本数量 + /// + [SugarColumn(ColumnName = "BaseCount", ColumnDescription = "基本数量")] + public int? BaseCount { get; set; } + + /// + /// 基本单位 + /// + [SugarColumn(ColumnName = "BaseUnit", ColumnDescription = "基本单位", Length = 32)] + public string? BaseUnit { get; set; } + + /// + /// 子码数 + /// + [SugarColumn(ColumnName = "ChildCount", ColumnDescription = "子码数")] + public int? ChildCount { get; set; } + + /// + /// 打码时间 + /// + [SugarColumn(ColumnName = "PrintCodeTime", ColumnDescription = "打码时间")] + public DateTime? PrintCodeTime { get; set; } + + /// + /// 扫码时间 + /// + [SugarColumn(ColumnName = "ScanCodeTime", ColumnDescription = "扫码时间")] + public DateTime? ScanCodeTime { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)] + public string? Remarks { get; set; } + + /// + /// 打印单ID + /// + [SugarColumn(ColumnName = "TempListId", ColumnDescription = "打印单ID")] + public long? TempListId { get; set; } + + /// + /// 汇报单ID + /// + [SugarColumn(ColumnName = "ReportTableId", ColumnDescription = "汇报单ID")] + public long? ReportTableId { get; set; } + + /// + /// 仓库ID + /// + [SugarColumn(ColumnName = "WarehouseID", ColumnDescription = "仓库ID")] + public long? WarehouseID { get; set; } + +} diff --git a/Admin.NET/Admin.NET.Application/Entity/ReportDetailTable.cs b/Admin.NET/Admin.NET.Application/Entity/ReportDetailTable.cs new file mode 100644 index 0000000..e992fcc --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Entity/ReportDetailTable.cs @@ -0,0 +1,162 @@ +using Admin.NET.Core; +namespace Admin.NET.Application.Entity; + +/// +/// 汇报单详情 +/// +[SugarTable("ReportDetailTable","汇报单详情")] +public class ReportDetailTable : EntityTenant +{ + /// + /// 产品名称 + /// + [Required] + [SugarColumn(ColumnName = "ProductName", ColumnDescription = "产品名称", Length = 32)] + public string ProductName { get; set; } + + /// + /// 产品编码 + /// + [SugarColumn(ColumnName = "ProductCodeNum", ColumnDescription = "产品编码", Length = 32)] + public string? ProductCodeNum { get; set; } + + /// + /// 单号 + /// + [SugarColumn(ColumnName = "OddNumber", ColumnDescription = "单号", Length = 32)] + public string? OddNumber { get; set; } + + /// + /// 状态 + /// + [Required] + [SugarColumn(ColumnName = "State", ColumnDescription = "状态", Length = 32)] + public string State { get; set; } + + /// + /// 生产类型 + /// + [SugarColumn(ColumnName = "ProductType", ColumnDescription = "生产类型", Length = 32)] + public string? ProductType { get; set; } + + /// + /// 生产线 + /// + [SugarColumn(ColumnName = "ProductionLine", ColumnDescription = "生产线", Length = 32)] + public string? ProductionLine { get; set; } + + /// + /// 生产线编码 + /// + [SugarColumn(ColumnName = "CodeNum", ColumnDescription = "生产线编码", Length = 32)] + public string? CodeNum { get; set; } + + /// + /// 源单号 + /// + [SugarColumn(ColumnName = "SourceNumber", ColumnDescription = "源单号", Length = 32)] + public string? SourceNumber { get; set; } + + /// + /// 规格型号 + /// + [SugarColumn(ColumnName = "Specifications", ColumnDescription = "规格型号", Length = 32)] + public string? Specifications { get; set; } + + /// + /// 完工数量 + /// + [SugarColumn(ColumnName = "ProductCount", ColumnDescription = "完工数量")] + public int? ProductCount { get; set; } + + /// + /// 入库数量 + /// + [SugarColumn(ColumnName = "PutWarehouse", ColumnDescription = "入库数量")] + public int? PutWarehouse { get; set; } + + /// + /// 基本完工数量 + /// + [SugarColumn(ColumnName = "BaseProductCount", ColumnDescription = "基本完工数量")] + public int? BaseProductCount { get; set; } + + /// + /// 基本入库数量 + /// + [SugarColumn(ColumnName = "BasePutWarehouse", ColumnDescription = "基本入库数量")] + public int? BasePutWarehouse { get; set; } + + /// + /// 单位 + /// + [SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)] + public string? Unit { get; set; } + + /// + /// 基本单位 + /// + [SugarColumn(ColumnName = "BaseUnit", ColumnDescription = "基本单位", Length = 32)] + public string? BaseUnit { get; set; } + + /// + /// 批次 + /// + [SugarColumn(ColumnName = "Batch", ColumnDescription = "批次", Length = 32)] + public string? Batch { get; set; } + + /// + /// 包装规格 + /// + [SugarColumn(ColumnName = "Package", ColumnDescription = "包装规格", Length = 32)] + public string? Package { get; set; } + + /// + /// 包装数量 + /// + [SugarColumn(ColumnName = "PackageCount", ColumnDescription = "包装数量")] + public int? PackageCount { get; set; } + + /// + /// 采集失败数量 + /// + [SugarColumn(ColumnName = "GatherFalseCount", ColumnDescription = "采集失败数量")] + public int? GatherFalseCount { get; set; } + + /// + /// 生产日期 + /// + [SugarColumn(ColumnName = "ProductDate", ColumnDescription = "生产日期")] + public DateTime? ProductDate { get; set; } + + /// + /// 班组 + /// + [SugarColumn(ColumnName = "TeamGroup", ColumnDescription = "班组", Length = 32)] + public string? TeamGroup { get; set; } + + /// + /// 操作工人 + /// + [SugarColumn(ColumnName = "Operator", ColumnDescription = "操作工人", Length = 32)] + public string? Operator { get; set; } + + /// + /// 完工时间 + /// + [SugarColumn(ColumnName = "EndDate", ColumnDescription = "完工时间")] + public DateTime? EndDate { get; set; } + + /// + /// 源单号 + /// + [SugarColumn(ColumnName = "SourceOddNumber", ColumnDescription = "源单号", Length = 32)] + public string? SourceOddNumber { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)] + public string? Remarks { get; set; } + +} diff --git a/Admin.NET/Admin.NET.Application/SeedData/PrintCodeDetailSeedData.cs b/Admin.NET/Admin.NET.Application/SeedData/PrintCodeDetailSeedData.cs new file mode 100644 index 0000000..78ef0b5 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/SeedData/PrintCodeDetailSeedData.cs @@ -0,0 +1,27 @@ +using Admin.NET.Core; +using Admin.NET.Application.Entity; + +namespace Admin.NET.Application.SeedData; + +/// +/// 打印条码详情 表种子数据 +/// +public class PrintCodeDetailSeedData: ISqlSugarEntitySeedData +{ + /// + /// 种子数据 + /// + /// + public IEnumerable HasData() + { + string recordsJSON = @" + [] + "; + List records = Newtonsoft.Json.JsonConvert.DeserializeObject>(recordsJSON); + + // 后处理数据的特殊字段 + //for (int i = 0; i < records.Count; i++) { } + + return records; + } +} \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailDto.cs b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailDto.cs new file mode 100644 index 0000000..282d7b1 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailDto.cs @@ -0,0 +1,118 @@ +namespace Admin.NET.Application; + +/// +/// 打印条码详情输出参数 +/// +public class PrintCodeDetailDto +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 条码 + /// + public string? Code { get; set; } + + /// + /// 上级码 + /// + public string? FatherCode { get; set; } + + /// + /// 条码类型 + /// + public string? CodeName { get; set; } + + /// + /// 数量 + /// + public int? Count { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 基本数量 + /// + public int? BaseCount { get; set; } + + /// + /// 基本单位 + /// + public string? BaseUnit { get; set; } + + /// + /// 子码数 + /// + public int? ChildCount { get; set; } + + /// + /// 打印单ID + /// + public long? TempListId { get; set; } + + /// + /// 汇报单ID + /// + public long? ReportTableId { get; set; } + + /// + /// 仓库ID + /// + public long? WarehouseID { get; set; } + + /// + /// 打码时间 + /// + public DateTime? PrintCodeTime { get; set; } + + /// + /// 扫码时间 + /// + public DateTime? ScanCodeTime { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + +} diff --git a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailInput.cs b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailInput.cs new file mode 100644 index 0000000..2cf811a --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailInput.cs @@ -0,0 +1,233 @@ +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace Admin.NET.Application; + +/// +/// 打印条码详情基础输入参数 +/// +public class PrintCodeDetailBaseInput +{ + /// + /// 条码 + /// + public virtual string? Code { get; set; } + + /// + /// 上级码 + /// + public virtual string? FatherCode { get; set; } + + /// + /// 条码类型 + /// + public virtual string? CodeName { get; set; } + + /// + /// 数量 + /// + public virtual int? Count { get; set; } + + /// + /// 单位 + /// + public virtual string? Unit { get; set; } + + /// + /// 基本数量 + /// + public virtual int? BaseCount { get; set; } + + /// + /// 基本单位 + /// + public virtual string? BaseUnit { get; set; } + + /// + /// 子码数 + /// + public virtual int? ChildCount { get; set; } + + + /// + /// 打印单ID + /// + public long? TempListId { get; set; } + + /// + /// 汇报单ID + /// + public long? ReportTableId { get; set; } + + /// + /// 仓库ID + /// + public long? WarehouseID { get; set; } + + /// + /// 打码时间 + /// + public virtual DateTime? PrintCodeTime { get; set; } + + /// + /// 扫码时间 + /// + public virtual DateTime? ScanCodeTime { get; set; } + + /// + /// 备注 + /// + public virtual string? Remarks { get; set; } + + /// + /// 创建时间 + /// + public virtual DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public virtual DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public virtual long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public virtual string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public virtual long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public virtual string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public virtual bool IsDelete { get; set; } + +} + +/// +/// 打印条码详情分页查询输入参数 +/// +public class PrintCodeDetailInput : BasePageInput +{ + /// + /// 关键字查询 + /// + public string? SearchKey { get; set; } + + /// + /// 条码 + /// + public string? Code { get; set; } + + /// + /// 上级码 + /// + public string? FatherCode { get; set; } + + /// + /// 条码类型 + /// + public string? CodeName { get; set; } + + /// + /// 数量 + /// + public int? Count { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 基本数量 + /// + public int? BaseCount { get; set; } + + /// + /// 基本单位 + /// + public string? BaseUnit { get; set; } + + /// + /// 子码数 + /// + public int? ChildCount { get; set; } + + /// + /// 打码时间 + /// + public DateTime? PrintCodeTime { get; set; } + + /// + /// 打码时间范围 + /// + public List PrintCodeTimeRange { get; set; } + /// + /// 扫码时间 + /// + public DateTime? ScanCodeTime { get; set; } + + /// + /// 扫码时间范围 + /// + public List ScanCodeTimeRange { get; set; } + /// + /// 备注 + /// + public string? Remarks { get; set; } + +} + +/// +/// 打印条码详情增加输入参数 +/// +public class AddPrintCodeDetailInput : PrintCodeDetailBaseInput +{ + /// + /// 软删除 + /// + [Required(ErrorMessage = "软删除不能为空")] + public override bool IsDelete { get; set; } + +} + +/// +/// 打印条码详情删除输入参数 +/// +public class DeletePrintCodeDetailInput : BaseIdInput +{ +} + +/// +/// 打印条码详情更新输入参数 +/// +public class UpdatePrintCodeDetailInput : PrintCodeDetailBaseInput +{ + /// + /// 主键Id + /// + [Required(ErrorMessage = "主键Id不能为空")] + public long Id { get; set; } + +} + +/// +/// 打印条码详情主键查询输入参数 +/// +public class QueryByIdPrintCodeDetailInput : DeletePrintCodeDetailInput +{ + +} diff --git a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailOutput.cs b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailOutput.cs new file mode 100644 index 0000000..a9c7e05 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailOutput.cs @@ -0,0 +1,120 @@ +namespace Admin.NET.Application; + +/// +/// 打印条码详情输出参数 +/// +public class PrintCodeDetailOutput +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 条码 + /// + public string? Code { get; set; } + + /// + /// 上级码 + /// + public string? FatherCode { get; set; } + + /// + /// 条码类型 + /// + public string? CodeName { get; set; } + + /// + /// 数量 + /// + public int? Count { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 基本数量 + /// + public int? BaseCount { get; set; } + + /// + /// 基本单位 + /// + public string? BaseUnit { get; set; } + + /// + /// 子码数 + /// + public int? ChildCount { get; set; } + + /// + /// 打印单ID + /// + public long? TempListId { get; set; } + + /// + /// 汇报单ID + /// + public long? ReportTableId { get; set; } + + /// + /// 仓库ID + /// + public long? WarehouseID { get; set; } + + /// + /// 打码时间 + /// + public DateTime? PrintCodeTime { get; set; } + + /// + /// 扫码时间 + /// + public DateTime? ScanCodeTime { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + } + + diff --git a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/PrintCodeDetailService.cs b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/PrintCodeDetailService.cs new file mode 100644 index 0000000..404458f --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/PrintCodeDetailService.cs @@ -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; +/// +/// 打印条码详情服务 +/// +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class PrintCodeDetailService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository _rep; + public PrintCodeDetailService(SqlSugarRepository rep) + { + _rep = rep; + } + + /// + /// 分页查询打印条码详情 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + public async Task> 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(); + 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); + } + + /// + /// 增加打印条码详情 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + public async Task Add(AddPrintCodeDetailInput input) + { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + return entity.Id; + } + + /// + /// 删除打印条码详情 + /// + /// + /// + [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); //真删除 + } + + /// + /// 更新打印条码详情 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + public async Task Update(UpdatePrintCodeDetailInput input) + { + var entity = input.Adapt(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// + /// 获取打印条码详情 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + public async Task Detail([FromQuery] QueryByIdPrintCodeDetailInput input) + { + return await _rep.GetFirstAsync(u => u.Id == input.Id); + } + + /// + /// 获取打印条码详情列表 + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + public async Task> List() + { + return await _rep.AsQueryable().Where(a => !a.IsDelete).Select().ToListAsync(); + } + + +} + diff --git a/Admin.NET/Admin.NET.Application/Service/PrintData/PrintDataService.cs b/Admin.NET/Admin.NET.Application/Service/PrintData/PrintDataService.cs index 2617981..616e576 100644 --- a/Admin.NET/Admin.NET.Application/Service/PrintData/PrintDataService.cs +++ b/Admin.NET/Admin.NET.Application/Service/PrintData/PrintDataService.cs @@ -106,23 +106,28 @@ public class PrintDataService : IDynamicApiController, ITransient [HttpPost] [ApiDescriptionSettings(Name = "GetPrintDataList")] public async Task> GetPrintDataList(PrintDataMaterialsInput input) + { + return await GetPrintDatas(input.CodeHead, input.CodeType, input.Count); + } + + private async Task> GetPrintDatas(string codeName,string codeType,int count) { var result = new List(); - if (string.IsNullOrEmpty(input.CodeHead)) + if (string.IsNullOrEmpty(codeName)) { return result; } - var elem = await _codeElementService.GetElementByName(input.CodeHead); + var elem = await _codeElementService.GetElementByName(codeName); if (elem == null) { return result; } 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(); - for (int i = 0; i < input.Count; i++) + for (int i = 0; i < count; i++) { var code = GetCodeNumByProp(elemProp, i + 1); - if (input.CodeType == "条形码") + if (codeType == "条形码") { result.Add(new PrintData() { BarCode = code }); } @@ -132,7 +137,7 @@ public class PrintDataService : IDynamicApiController, ITransient } } } - return result; + return result; } private string GetCodeNumByProp(List lists,int index) diff --git a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableDto.cs b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableDto.cs new file mode 100644 index 0000000..e27a81c --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableDto.cs @@ -0,0 +1,178 @@ +namespace Admin.NET.Application; + + /// + /// 汇报单详情输出参数 + /// + public class ReportDetailTableDto + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 产品名称 + /// + public string ProductName { get; set; } + + /// + /// 产品编码 + /// + public string? ProductCodeNum { get; set; } + + /// + /// 单号 + /// + public string? OddNumber { get; set; } + + /// + /// 状态 + /// + public string State { get; set; } + + /// + /// 生产类型 + /// + public string? ProductType { get; set; } + + /// + /// 生产线 + /// + public string? ProductionLine { get; set; } + + /// + /// 生产线编码 + /// + public string? CodeNum { get; set; } + + /// + /// 源单号 + /// + public string? SourceNumber { get; set; } + + /// + /// 规格型号 + /// + public string? Specifications { get; set; } + + /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 入库数量 + /// + public int? PutWarehouse { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 基本入库数量 + /// + public int? BasePutWarehouse { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 基本单位 + /// + public string? BaseUnit { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 包装规格 + /// + public string? Package { get; set; } + + /// + /// 包装数量 + /// + public int? PackageCount { get; set; } + + /// + /// 采集失败数量 + /// + public int? GatherFalseCount { get; set; } + + /// + /// 生产日期 + /// + public DateTime? ProductDate { get; set; } + + /// + /// 班组 + /// + public string? TeamGroup { get; set; } + + /// + /// 操作工人 + /// + public string? Operator { get; set; } + + /// + /// 完工时间 + /// + public DateTime? EndDate { get; set; } + + /// + /// 源单号 + /// + public string? SourceOddNumber { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + /// + /// 租户Id + /// + public long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + } diff --git a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableInput.cs b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableInput.cs new file mode 100644 index 0000000..e494eb1 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableInput.cs @@ -0,0 +1,374 @@ +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace Admin.NET.Application; + + /// + /// 汇报单详情基础输入参数 + /// + public class ReportDetailTableBaseInput + { + /// + /// 产品名称 + /// + public virtual string ProductName { get; set; } + + /// + /// 产品编码 + /// + public virtual string? ProductCodeNum { get; set; } + + /// + /// 单号 + /// + public virtual string? OddNumber { get; set; } + + /// + /// 状态 + /// + public virtual string State { get; set; } + + /// + /// 生产类型 + /// + public virtual string? ProductType { get; set; } + + /// + /// 生产线 + /// + public virtual string? ProductionLine { get; set; } + + /// + /// 生产线编码 + /// + public virtual string? CodeNum { get; set; } + + /// + /// 源单号 + /// + public virtual string? SourceNumber { get; set; } + + /// + /// 规格型号 + /// + public virtual string? Specifications { get; set; } + + /// + /// 完工数量 + /// + public virtual int? ProductCount { get; set; } + + /// + /// 入库数量 + /// + public virtual int? PutWarehouse { get; set; } + + /// + /// 基本完工数量 + /// + public virtual int? BaseProductCount { get; set; } + + /// + /// 基本入库数量 + /// + public virtual int? BasePutWarehouse { get; set; } + + /// + /// 单位 + /// + public virtual string? Unit { get; set; } + + /// + /// 基本单位 + /// + public virtual string? BaseUnit { get; set; } + + /// + /// 批次 + /// + public virtual string? Batch { get; set; } + + /// + /// 包装规格 + /// + public virtual string? Package { get; set; } + + /// + /// 包装数量 + /// + public virtual int? PackageCount { get; set; } + + /// + /// 采集失败数量 + /// + public virtual int? GatherFalseCount { get; set; } + + /// + /// 生产日期 + /// + public virtual DateTime? ProductDate { get; set; } + + /// + /// 班组 + /// + public virtual string? TeamGroup { get; set; } + + /// + /// 操作工人 + /// + public virtual string? Operator { get; set; } + + /// + /// 完工时间 + /// + public virtual DateTime? EndDate { get; set; } + + /// + /// 源单号 + /// + public virtual string? SourceOddNumber { get; set; } + + /// + /// 备注 + /// + public virtual string? Remarks { get; set; } + + /// + /// 租户Id + /// + public virtual long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public virtual DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public virtual DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public virtual long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public virtual string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public virtual long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public virtual string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public virtual bool IsDelete { get; set; } + + } + + /// + /// 汇报单详情分页查询输入参数 + /// + public class ReportDetailTableInput : BasePageInput + { + /// + /// 关键字查询 + /// + public string? SearchKey { get; set; } + + /// + /// 产品名称 + /// + public string? ProductName { get; set; } + + /// + /// 产品编码 + /// + public string? ProductCodeNum { get; set; } + + /// + /// 单号 + /// + public string? OddNumber { get; set; } + + /// + /// 状态 + /// + public string? State { get; set; } + + /// + /// 生产类型 + /// + public string? ProductType { get; set; } + + /// + /// 生产线 + /// + public string? ProductionLine { get; set; } + + /// + /// 生产线编码 + /// + public string? CodeNum { get; set; } + + /// + /// 源单号 + /// + public string? SourceNumber { get; set; } + + /// + /// 规格型号 + /// + public string? Specifications { get; set; } + + /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 入库数量 + /// + public int? PutWarehouse { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 基本入库数量 + /// + public int? BasePutWarehouse { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 基本单位 + /// + public string? BaseUnit { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 包装规格 + /// + public string? Package { get; set; } + + /// + /// 包装数量 + /// + public int? PackageCount { get; set; } + + /// + /// 采集失败数量 + /// + public int? GatherFalseCount { get; set; } + + /// + /// 生产日期 + /// + public DateTime? ProductDate { get; set; } + + /// + /// 生产日期范围 + /// + public List ProductDateRange { get; set; } + /// + /// 班组 + /// + public string? TeamGroup { get; set; } + + /// + /// 操作工人 + /// + public string? Operator { get; set; } + + /// + /// 完工时间 + /// + public DateTime? EndDate { get; set; } + + /// + /// 完工时间范围 + /// + public List EndDateRange { get; set; } + /// + /// 源单号 + /// + public string? SourceOddNumber { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + } + + /// + /// 汇报单详情增加输入参数 + /// + public class AddReportDetailTableInput : ReportDetailTableBaseInput + { + /// + /// 产品名称 + /// + [Required(ErrorMessage = "产品名称不能为空")] + public override string ProductName { get; set; } + + /// + /// 状态 + /// + [Required(ErrorMessage = "状态不能为空")] + public override string State { get; set; } + + /// + /// 软删除 + /// + [Required(ErrorMessage = "软删除不能为空")] + public override bool IsDelete { get; set; } + + } + + /// + /// 汇报单详情删除输入参数 + /// + public class DeleteReportDetailTableInput : BaseIdInput + { + } + + /// + /// 汇报单详情更新输入参数 + /// + public class UpdateReportDetailTableInput : ReportDetailTableBaseInput + { + /// + /// 主键Id + /// + [Required(ErrorMessage = "主键Id不能为空")] + public long Id { get; set; } + + } + + /// + /// 汇报单详情主键查询输入参数 + /// + public class QueryByIdReportDetailTableInput : DeleteReportDetailTableInput + { + + } diff --git a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableOutput.cs b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableOutput.cs new file mode 100644 index 0000000..a61efb5 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableOutput.cs @@ -0,0 +1,180 @@ +namespace Admin.NET.Application; + +/// +/// 汇报单详情输出参数 +/// +public class ReportDetailTableOutput +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 产品名称 + /// + public string ProductName { get; set; } + + /// + /// 产品编码 + /// + public string? ProductCodeNum { get; set; } + + /// + /// 单号 + /// + public string? OddNumber { get; set; } + + /// + /// 状态 + /// + public string State { get; set; } + + /// + /// 生产类型 + /// + public string? ProductType { get; set; } + + /// + /// 生产线 + /// + public string? ProductionLine { get; set; } + + /// + /// 生产线编码 + /// + public string? CodeNum { get; set; } + + /// + /// 源单号 + /// + public string? SourceNumber { get; set; } + + /// + /// 规格型号 + /// + public string? Specifications { get; set; } + + /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 入库数量 + /// + public int? PutWarehouse { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 基本入库数量 + /// + public int? BasePutWarehouse { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 基本单位 + /// + public string? BaseUnit { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 包装规格 + /// + public string? Package { get; set; } + + /// + /// 包装数量 + /// + public int? PackageCount { get; set; } + + /// + /// 采集失败数量 + /// + public int? GatherFalseCount { get; set; } + + /// + /// 生产日期 + /// + public DateTime? ProductDate { get; set; } + + /// + /// 班组 + /// + public string? TeamGroup { get; set; } + + /// + /// 操作工人 + /// + public string? Operator { get; set; } + + /// + /// 完工时间 + /// + public DateTime? EndDate { get; set; } + + /// + /// 源单号 + /// + public string? SourceOddNumber { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + + /// + /// 租户Id + /// + public long? TenantId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 创建者Id + /// + public long? CreateUserId { get; set; } + + /// + /// 创建者姓名 + /// + public string? CreateUserName { get; set; } + + /// + /// 修改者Id + /// + public long? UpdateUserId { get; set; } + + /// + /// 修改者姓名 + /// + public string? UpdateUserName { get; set; } + + /// + /// 软删除 + /// + public bool IsDelete { get; set; } + + } + + diff --git a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/ReportDetailTableService.cs b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/ReportDetailTableService.cs new file mode 100644 index 0000000..6aca1b8 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/ReportDetailTableService.cs @@ -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; +/// +/// 汇报单详情服务 +/// +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class ReportDetailTableService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository _rep; + public ReportDetailTableService(SqlSugarRepository rep) + { + _rep = rep; + } + + /// + /// 分页查询汇报单详情 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + public async Task> 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(); + 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); + } + + /// + /// 增加汇报单详情 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + public async Task Add(AddReportDetailTableInput input) + { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + return entity.Id; + } + + /// + /// 删除汇报单详情 + /// + /// + /// + [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); //真删除 + } + + /// + /// 更新汇报单详情 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + public async Task Update(UpdateReportDetailTableInput input) + { + var entity = input.Adapt(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// + /// 获取汇报单详情 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + public async Task Detail([FromQuery] QueryByIdReportDetailTableInput input) + { + return await _rep.GetFirstAsync(u => u.Id == input.Id); + } + + /// + /// 获取汇报单详情列表 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + public async Task> List() + { + return await _rep.AsQueryable().Where(a => !a.IsDelete).Select().ToListAsync(); + } + + + +} + diff --git a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/AddReportContext.cs b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/AddReportContext.cs index a52b2ed..fc89c74 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/AddReportContext.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/AddReportContext.cs @@ -21,6 +21,18 @@ public class AddReportContext /// public string? Name { get; set; } /// + /// 生产日期 + /// + public DateTime? ProductDate { get; set; } + /// + /// 失效日期 + /// + public DateTime? LoseDate { get; set; } + /// + /// 批次 + /// + public string? Batch { get; set; } + /// /// 打印数据 /// public List PrintDatas { get; set; } diff --git a/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs b/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs index 71659c9..5cd8870 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs @@ -14,13 +14,23 @@ public class ReportTableService : IDynamicApiController, ITransient private readonly SqlSugarRepository _rep; private readonly SysUnitService _repUnit; private readonly SysUnitGroupService _repUnitGroup; + private readonly PrintCodeDetailService _codeDetailService; + private readonly ReportDetailTableService _reportDetailTable; + private readonly UserManager _userManager; + public ReportTableService(SqlSugarRepository rep, + UserManager userManager, SysUnitService repUnit, - SysUnitGroupService repUnitGroup) + SysUnitGroupService repUnitGroup, + PrintCodeDetailService codeDetailService, + ReportDetailTableService reportDetailTable) { _rep = rep; _repUnit = repUnit; _repUnitGroup = repUnitGroup; + _codeDetailService = codeDetailService; + _reportDetailTable = reportDetailTable; + _userManager = userManager; } /// @@ -160,6 +170,71 @@ public class ReportTableService : IDynamicApiController, ITransient await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } + /// + /// 新增汇报单 + /// + /// + /// + [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(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } } diff --git a/Admin.NET/Test/Program.cs b/Admin.NET/Test/Program.cs index d06c7ca..0e09ea8 100644 --- a/Admin.NET/Test/Program.cs +++ b/Admin.NET/Test/Program.cs @@ -3,6 +3,13 @@ // 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证 Console.WriteLine(DateTime.Now.ToString("yyyyMMddhhmmss")); - +List numbers = new List { 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 result = numbers.Skip(4); Console.WriteLine("Hello, World!"); Console.ReadKey(); \ No newline at end of file diff --git a/Web/src/api/main/reportDetailTable.ts b/Web/src/api/main/reportDetailTable.ts new file mode 100644 index 0000000..0f01e7f --- /dev/null +++ b/Web/src/api/main/reportDetailTable.ts @@ -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 }, + }); + + diff --git a/Web/src/views/main/reportDetailTable/component/editDialog.vue b/Web/src/views/main/reportDetailTable/component/editDialog.vue new file mode 100644 index 0000000..c58ba3a --- /dev/null +++ b/Web/src/views/main/reportDetailTable/component/editDialog.vue @@ -0,0 +1,291 @@ + + + + + + + diff --git a/Web/src/views/main/reportDetailTable/index.vue b/Web/src/views/main/reportDetailTable/index.vue new file mode 100644 index 0000000..14eb01d --- /dev/null +++ b/Web/src/views/main/reportDetailTable/index.vue @@ -0,0 +1,347 @@ + + + + +