diff --git a/Admin.NET/Admin.NET.Application/Entity/CodePakageConfiguration.cs b/Admin.NET/Admin.NET.Application/Entity/CodePakageConfiguration.cs index 12da1c5..8680b6a 100644 --- a/Admin.NET/Admin.NET.Application/Entity/CodePakageConfiguration.cs +++ b/Admin.NET/Admin.NET.Application/Entity/CodePakageConfiguration.cs @@ -40,19 +40,19 @@ public class CodePakageConfiguration : EntityTenant /// /// 条码前缀 /// - [SugarColumn(ColumnName = "CodePrefix", ColumnDescription = "条码前缀", Length = 32)] + [SugarColumn(ColumnName = "CodePrefix", ColumnDescription = "条码前缀", Length = 64)] public string? CodePrefix { get; set; } /// /// 内码前缀 /// - [SugarColumn(ColumnName = "InternalCodePrefix", ColumnDescription = "内码前缀", Length = 32)] + [SugarColumn(ColumnName = "InternalCodePrefix", ColumnDescription = "内码前缀", Length = 64)] public string? InternalCodePrefix { get; set; } /// /// 导出格式示例 /// - [SugarColumn(ColumnName = "ExportFormatExample", ColumnDescription = "导出格式示例", Length = 32)] + [SugarColumn(ColumnName = "ExportFormatExample", ColumnDescription = "导出格式示例", Length = 64)] public string? ExportFormatExample { get; set; } /// diff --git a/Admin.NET/Admin.NET.Application/Entity/PrintRecords.cs b/Admin.NET/Admin.NET.Application/Entity/PrintRecords.cs new file mode 100644 index 0000000..6eaab30 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Entity/PrintRecords.cs @@ -0,0 +1,64 @@ +using Admin.NET.Core; +namespace Admin.NET.Application.Entity; + +/// +/// 打印记录 +/// +[SugarTable("printrecords","打印记录")] +public class PrintRecords : EntityBase +{ + /// + /// 物料ID + /// + [SugarColumn(ColumnName = "MaterialsId", ColumnDescription = "物料ID")] + public long? MaterialsId { get; set; } + + /// + /// 名称 + /// + [SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)] + public string? Name { get; set; } + + /// + /// 批次 + /// + [SugarColumn(ColumnName = "Batch", ColumnDescription = "批次", Length = 32)] + public string? Batch { get; set; } + + /// + /// 完工数量 + /// + [SugarColumn(ColumnName = "ProductCount", ColumnDescription = "完工数量")] + public int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + [SugarColumn(ColumnName = "BaseProductCount", ColumnDescription = "基本完工数量")] + public int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + [SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)] + public string? Unit { get; set; } + + /// + /// 生产日期 + /// + [SugarColumn(ColumnName = "ProductDate", ColumnDescription = "生产日期")] + public DateTime? ProductDate { get; set; } + + /// + /// 失效日期 + /// + [SugarColumn(ColumnName = "LoseDate", ColumnDescription = "失效日期")] + public DateTime? LoseDate { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)] + public string? Remarks { get; set; } + +} diff --git a/Admin.NET/Admin.NET.Application/Entity/ReportDetailTable.cs b/Admin.NET/Admin.NET.Application/Entity/ReportDetailTable.cs index 67187ae..b1a4351 100644 --- a/Admin.NET/Admin.NET.Application/Entity/ReportDetailTable.cs +++ b/Admin.NET/Admin.NET.Application/Entity/ReportDetailTable.cs @@ -164,5 +164,10 @@ public class ReportDetailTable : EntityTenant /// [SugarColumn(ColumnName = "MaterialsId", ColumnDescription = "物料ID")] public long? MaterialsId { get; set; } - + + /// + /// 单位组ID + /// + [SugarColumn(ColumnName = "UnitGroupId", ColumnDescription = "单位组ID")] + public long? UnitGroupId { get; set; } } diff --git a/Admin.NET/Admin.NET.Application/Entity/ReportTable.cs b/Admin.NET/Admin.NET.Application/Entity/ReportTable.cs index 298b59d..330ca35 100644 --- a/Admin.NET/Admin.NET.Application/Entity/ReportTable.cs +++ b/Admin.NET/Admin.NET.Application/Entity/ReportTable.cs @@ -67,4 +67,34 @@ public class ReportTable : EntityTenant [SugarColumn(ColumnName = "SourceId", ColumnDescription = "源单ID")] public long? SourceId { get; set; } + /// + /// 完工数量 + /// + [SugarColumn(ColumnName = "ProductCount", ColumnDescription = "完工数量")] + public int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + [SugarColumn(ColumnName = "BaseProductCount", ColumnDescription = "基本完工数量")] + public int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + [SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)] + public string? Unit { get; set; } + + /// + /// 批次 + /// + [SugarColumn(ColumnName = "Batch", ColumnDescription = "批次", Length = 32)] + public string? Batch { get; set; } + + /// + /// 名称 + /// + [SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)] + public string? Name { get; set; } + } diff --git a/Admin.NET/Admin.NET.Application/Service/PrintRecords/Dto/PrintrecordsDto.cs b/Admin.NET/Admin.NET.Application/Service/PrintRecords/Dto/PrintrecordsDto.cs new file mode 100644 index 0000000..fd57929 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/PrintRecords/Dto/PrintrecordsDto.cs @@ -0,0 +1,93 @@ +namespace Admin.NET.Application; + + /// + /// 打印记录输出参数 + /// + public class PrintrecordsDto + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 物料ID + /// + public long? MaterialsId { get; set; } + + /// + /// 名称 + /// + public string? Name { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 生产日期 + /// + public DateTime? ProductDate { get; set; } + + /// + /// 失效日期 + /// + public DateTime? LoseDate { 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/PrintRecords/Dto/PrintrecordsInput.cs b/Admin.NET/Admin.NET.Application/Service/PrintRecords/Dto/PrintrecordsInput.cs new file mode 100644 index 0000000..f08817f --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/PrintRecords/Dto/PrintrecordsInput.cs @@ -0,0 +1,189 @@ +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace Admin.NET.Application; + +/// +/// 打印记录基础输入参数 +/// +public class PrintrecordsBaseInput +{ + /// + /// 物料ID + /// + public virtual long? MaterialsId { get; set; } + + /// + /// 名称 + /// + public virtual string? Name { get; set; } + + /// + /// 批次 + /// + public virtual string? Batch { get; set; } + + /// + /// 完工数量 + /// + public virtual int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + public virtual int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + public virtual string? Unit { get; set; } + + /// + /// 生产日期 + /// + public virtual DateTime? ProductDate { get; set; } + + /// + /// 失效日期 + /// + public virtual DateTime? LoseDate { 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 PrintRecordsInput : BasePageInput +{ + /// + /// 关键字查询 + /// + public string? SearchKey { get; set; } + + /// + /// 物料ID + /// + public long? MaterialsId { get; set; } + + /// + /// 名称 + /// + public string? Name { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 生产日期 + /// + public DateTime? ProductDate { get; set; } + + /// + /// 失效日期 + /// + public DateTime? LoseDate { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + +} + +/// +/// 打印记录增加输入参数 +/// +public class AddPrintRecordsInput : PrintrecordsBaseInput +{ + /// + /// 软删除 + /// + [Required(ErrorMessage = "软删除不能为空")] + public override bool IsDelete { get; set; } + +} + +/// +/// 打印记录删除输入参数 +/// +public class DeletePrintRecordsInput : BaseIdInput +{ +} + +/// +/// 打印记录更新输入参数 +/// +public class UpdatePrintRecordsInput : PrintrecordsBaseInput +{ + /// + /// 主键Id + /// + [Required(ErrorMessage = "主键Id不能为空")] + public long Id { get; set; } + +} + +/// +/// 打印记录主键查询输入参数 +/// +public class QueryByIdPrintRecordsInput : DeletePrintRecordsInput +{ + +} diff --git a/Admin.NET/Admin.NET.Application/Service/PrintRecords/Dto/PrintrecordsOutput.cs b/Admin.NET/Admin.NET.Application/Service/PrintRecords/Dto/PrintrecordsOutput.cs new file mode 100644 index 0000000..ab9942e --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/PrintRecords/Dto/PrintrecordsOutput.cs @@ -0,0 +1,95 @@ +namespace Admin.NET.Application; + +/// +/// 打印记录输出参数 +/// +public class PrintRecordsOutput +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 物料ID + /// + public long? MaterialsId { get; set; } + + /// + /// 名称 + /// + public string? Name { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 生产日期 + /// + public DateTime? ProductDate { get; set; } + + /// + /// 失效日期 + /// + public DateTime? LoseDate { 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/PrintRecords/PrintRecordsService.cs b/Admin.NET/Admin.NET.Application/Service/PrintRecords/PrintRecordsService.cs new file mode 100644 index 0000000..72763d2 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/PrintRecords/PrintRecordsService.cs @@ -0,0 +1,115 @@ +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 PrintRecordsService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository _rep; + public PrintRecordsService(SqlSugarRepository rep) + { + _rep = rep; + } + + /// + /// 分页查询打印记录 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + public async Task> Page(PrintRecordsInput input) + { + var query = _rep.AsQueryable().Where(a => !a.IsDelete) + .WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u => + u.Name.Contains(input.SearchKey.Trim()) + || u.Batch.Contains(input.SearchKey.Trim()) + || u.Unit.Contains(input.SearchKey.Trim()) + || u.Remarks.Contains(input.SearchKey.Trim()) + ) + .WhereIF(input.MaterialsId>0, u => u.MaterialsId == input.MaterialsId) + .WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Batch), u => u.Batch.Contains(input.Batch.Trim())) + .WhereIF(input.ProductCount>0, u => u.ProductCount == input.ProductCount) + .WhereIF(input.BaseProductCount>0, u => u.BaseProductCount == input.BaseProductCount) + .WhereIF(!string.IsNullOrWhiteSpace(input.Unit), u => u.Unit.Contains(input.Unit.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim())) + .Select(); + return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); + } + + /// + /// 增加打印记录 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + public async Task Add(AddPrintRecordsInput input) + { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + return entity.Id; + } + + /// + /// 删除打印记录 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Delete")] + public async Task Delete(DeletePrintRecordsInput 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(UpdatePrintRecordsInput input) + { + var entity = input.Adapt(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// + /// 获取打印记录 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + public async Task Detail([FromQuery] QueryByIdPrintRecordsInput input) + { + return await _rep.GetFirstAsync(u => u.Id == input.Id); + } + + /// + /// 获取打印记录列表 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + public async Task> List() + { + return await _rep.AsQueryable().Select().ToListAsync(); + } + + + + + +} + diff --git a/Admin.NET/Admin.NET.Application/Service/ProductRetrospect/ProductRetrospectService.cs b/Admin.NET/Admin.NET.Application/Service/ProductRetrospect/ProductRetrospectService.cs index 6c3eb85..0f4c3e9 100644 --- a/Admin.NET/Admin.NET.Application/Service/ProductRetrospect/ProductRetrospectService.cs +++ b/Admin.NET/Admin.NET.Application/Service/ProductRetrospect/ProductRetrospectService.cs @@ -2,6 +2,8 @@ using Admin.NET.Application.Const; using Admin.NET.Application.Entity; using Microsoft.AspNetCore.Http; +using static SKIT.FlurlHttpClient.Wechat.Api.Models.TCBGetPressureTestReportResponse.Types; + namespace Admin.NET.Application; /// /// 商品追溯服务 @@ -11,11 +13,14 @@ public class ProductRetrospectService : IDynamicApiController, ITransient { private readonly SqlSugarRepository _rep; private readonly PrintCodeDetailService _codeDetailService; + private readonly UserManager _userManager; public ProductRetrospectService(SqlSugarRepository rep, - PrintCodeDetailService codeDetailService) + PrintCodeDetailService codeDetailService, + UserManager userManager) { _rep = rep; _codeDetailService = codeDetailService; + _userManager = userManager; } /// @@ -30,6 +35,7 @@ public class ProductRetrospectService : IDynamicApiController, ITransient var query = _rep.AsQueryable().Where(a => !a.IsDelete) .WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u => u.OddNumber.Contains(input.SearchKey.Trim()) + || u.Code.Contains(input.SearchKey.Trim()) || u.CodeType.Contains(input.SearchKey.Trim()) || u.BusinessType.Contains(input.SearchKey.Trim()) || u.Destination.Contains(input.SearchKey.Trim()) @@ -42,6 +48,7 @@ public class ProductRetrospectService : IDynamicApiController, ITransient || u.Remarks.Contains(input.SearchKey.Trim()) ) .WhereIF(!string.IsNullOrWhiteSpace(input.OddNumber), u => u.OddNumber.Contains(input.OddNumber.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.CodeType), u => u.CodeType.Contains(input.CodeType.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.BusinessType), u => u.BusinessType.Contains(input.BusinessType.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Destination), u => u.Destination.Contains(input.Destination.Trim())) @@ -156,6 +163,38 @@ public class ProductRetrospectService : IDynamicApiController, ITransient return await _rep.AsQueryable().Where(u => !u.IsDelete && u.Code == productCode).Select().ToListAsync(); } + public async Task AddRetrospect(PrintCodeDetail item ,ReportTable report,string receipt, string location ,long? sourceId) + { + var userId = _userManager.UserId; + var userName = _userManager.RealName; + var retrospect1 = new AddProductRetrospectInput() + { + BaseCount = item.BaseCount, + BaseUnit = item.BaseUnit, + Batch = report.Batch, + BusinessType = report.ProductType, + CodeType = item.CodeName, + Location = location, + Department = report.ProductionLine, + //WarehouseID = input.WarehouseId, + WarehousingDate = DateTime.Now, + Count = 1, + CreateTime = DateTime.Now, + ScanCodeTime = DateTime.Now, + CreateUserId = userId, + CreateUserName = userName, + MaterialsId = report.MaterialsId, + OddNumber = report.OddNumber, + Receipt = receipt, + SourceId = sourceId, + Unit = item.Unit, + Name = item.CodeName, + Code = item.Code, + //Destination = invoice.Consignee + }; + await Add(retrospect1); + } + } diff --git a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableDto.cs b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableDto.cs index 45124d4..339557d 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableDto.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableDto.cs @@ -135,6 +135,10 @@ public class ReportDetailTableDto /// public long? MaterialsId { get; set; } + /// + /// 单位组ID + /// + public long? UnitGroupId { 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 index 9744507..0cc8082 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableInput.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableInput.cs @@ -133,6 +133,10 @@ public class ReportDetailTableBaseInput /// public virtual long? MaterialsId { get; set; } + /// + /// 单位组ID + /// + public long? UnitGroupId { get; set; } /// /// 备注 diff --git a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableOutput.cs b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableOutput.cs index e7d1648..a81603d 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableOutput.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/Dto/ReportDetailTableOutput.cs @@ -135,6 +135,10 @@ public class ReportDetailTableOutput /// public long? MaterialsId { get; set; } + /// + /// 单位组ID + /// + public long? UnitGroupId { get; set; } /// /// 备注 /// 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 cceaa2a..1efb573 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/AddReportContext.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/AddReportContext.cs @@ -17,10 +17,14 @@ public class AddReportContext /// public long UnitGroupId { get; set; } /// - /// 码包名称 + /// 名称 /// public string? Name { get; set; } /// + /// 码包名称 + /// + public string? Package { get; set; } + /// /// 生产日期 /// public DateTime? ProductDate { get; set; } diff --git a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableDto.cs b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableDto.cs index e81e18d..f9ec003 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableDto.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableDto.cs @@ -55,6 +55,30 @@ public class ReportTableDto /// public long? SourceId { get; set; } /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 名称 + /// + public string? Name { get; set; } + /// /// 备注 /// public string? Remarks { get; set; } diff --git a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableInput.cs b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableInput.cs index 97e07f3..639bf28 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableInput.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableInput.cs @@ -53,6 +53,30 @@ public class ReportTableBaseInput /// public long? MaterialsId { get; set; } + /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 名称 + /// + public string? Name { get; set; } /// /// 备注 /// diff --git a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableOutput.cs b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableOutput.cs index 982b313..08d2194 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableOutput.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportTable/Dto/ReportTableOutput.cs @@ -55,6 +55,31 @@ public class ReportTableOutput /// public long? MaterialsId { get; set; } + /// + /// 完工数量 + /// + public int? ProductCount { get; set; } + + /// + /// 基本完工数量 + /// + public int? BaseProductCount { get; set; } + + /// + /// 单位 + /// + public string? Unit { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 名称 + /// + public string? Name { 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 2c63c5f..f325740 100644 --- a/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs +++ b/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs @@ -21,14 +21,17 @@ public class ReportTableService : IDynamicApiController, ITransient //private readonly ReportDetailTableService _reportDetailTable; private readonly UserManager _userManager; private readonly PrintDataService _printDataService; - + private readonly PrintRecordsService _printRecordsService; + private readonly ProductRetrospectService _productRetrospectService; public ReportTableService(SqlSugarRepository rep, UserManager userManager, SysUnitService repUnit, SysUnitGroupService repUnitGroup, PrintCodeDetailService codeDetailService, //ReportDetailTableService reportDetailTable, - PrintDataService printDataService) + PrintDataService printDataService, + PrintRecordsService printRecordsService, + ProductRetrospectService productRetrospectService) { _rep = rep; _repUnit = repUnit; @@ -37,6 +40,8 @@ public class ReportTableService : IDynamicApiController, ITransient //_reportDetailTable = reportDetailTable; _userManager = userManager; _printDataService = printDataService; + _printRecordsService = printRecordsService; + _productRetrospectService = productRetrospectService; } /// @@ -92,7 +97,7 @@ public class ReportTableService : IDynamicApiController, ITransient { entity.SourceId = input.UpdateUserId; } - await _rep.InsertAsync(entity); + var reportId = await _rep.InsertAsync(entity); if (input.UpdateUserId > 0) { @@ -102,20 +107,25 @@ public class ReportTableService : IDynamicApiController, ITransient return 0; } var printDetails = details.FindAll(a => a.TempListId == input.UpdateUserId); - if (printDetails.Count > 0) + if (printDetails.Count < 1) { - for (int i = 0; i < printDetails.Count; i++) - { - var item = printDetails[i]; - item.ReportTableId = entity.Id; - await _codeDetailService.Update(item.Adapt()); - } + return 0; + } + for (int i = 0; i < printDetails.Count; i++) + { + var item = printDetails[i]; + item.ReportTableId = entity.Id; + var ent = item.Adapt(); + await _codeDetailService.UpdateByEntity(ent); + await _productRetrospectService.AddRetrospect(ent, entity, "汇报单", entity.ProductionLine, entity.Id); } } return entity.Id; } + + /// /// 删除汇报单 /// @@ -224,8 +234,8 @@ public class ReportTableService : IDynamicApiController, ITransient 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); + var others = units.FindAll(a => a.Rate < unit.Rate); var entity = input.Adapt(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); @@ -255,8 +265,9 @@ public class ReportTableService : IDynamicApiController, ITransient if (unit == null) throw new ArgumentNullException(nameof(unitGroup)); - var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0, MaterialsId = input.MaterialsId }; - var addReport = await Add(newReport); + var newReport = new AddPrintRecordsInput() { CreateTime = DateTime.Now, Unit = input.Package, Name = input.Name, IsDelete = false, Batch = input.Batch, ProductDate = input.ProductDate, LoseDate = input.LoseDate, ProductCount = input.PrintDatas?.Count, MaterialsId = input.MaterialsId }; + var addReport = await _printRecordsService.Add(newReport); + var others = units.FindAll(a => a.Rate < unit.Rate).OrderBy(a => a.Rate).ToList(); others.Reverse(); int toltalCount = unit.Rate.ToInt(); @@ -267,7 +278,7 @@ public class ReportTableService : IDynamicApiController, ITransient tempUnits.AddRange(others); foreach (var item in input.PrintDatas) { - var code = CodeHelper.GetCode(item.BarCode, item.BarCode); + var code = CodeHelper.GetCode(item.BarCode, item.QrCode); var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码"; var detail = new AddPrintCodeDetailInput() { diff --git a/Admin.NET/Admin.NET.Application/Utils/CodeHelper.cs b/Admin.NET/Admin.NET.Application/Utils/CodeHelper.cs index 17a9b75..1975c49 100644 --- a/Admin.NET/Admin.NET.Application/Utils/CodeHelper.cs +++ b/Admin.NET/Admin.NET.Application/Utils/CodeHelper.cs @@ -60,7 +60,7 @@ internal class CodeHelper public static string GetCode(string? barCode, string? qrCode) { var code = string.IsNullOrEmpty(barCode) ? qrCode : barCode; - if (code.Contains("?code=")) + if (!string.IsNullOrEmpty(code) && code.Contains("?code=")) { code = code.Split('=').LastOrDefault(); } diff --git a/Web/src/api/main/printRecords.ts b/Web/src/api/main/printRecords.ts new file mode 100644 index 0000000..5ed707c --- /dev/null +++ b/Web/src/api/main/printRecords.ts @@ -0,0 +1,58 @@ +import request from '/@/utils/request'; +enum Api { + AddPrintRecords = '/api/printRecords/add', + DeletePrintRecords = '/api/printRecords/delete', + UpdatePrintRecords = '/api/printRecords/update', + PagePrintRecords = '/api/printRecords/page', + DetailPrintRecords = '/api/printRecords/detail', + ListPrintRecords = '/api/printRecords/list', +} + +// 增加打印记录 +export const addPrintRecords = (params?: any) => + request({ + url: Api.AddPrintRecords, + method: 'post', + data: params, + }); + +// 删除打印记录 +export const deletePrintRecords = (params?: any) => + request({ + url: Api.DeletePrintRecords, + method: 'post', + data: params, + }); + +// 编辑打印记录 +export const updatePrintRecords = (params?: any) => + request({ + url: Api.UpdatePrintRecords, + method: 'post', + data: params, + }); + +// 分页查询打印记录 +export const pagePrintRecords = (params?: any) => + request({ + url: Api.PagePrintRecords, + method: 'post', + data: params, + }); + +// 详情打印记录 +export const detailPrintRecords = (id: any) => + request({ + url: Api.DetailPrintRecords, + method: 'get', + data: { id }, + }); + +// 列表打印记录 +export const listPrintRecords = () => + request({ + url: Api.ListPrintRecords, + method: 'get', + data: { }, + }); + diff --git a/Web/src/utils/formatTime.ts b/Web/src/utils/formatTime.ts index d958b40..122b850 100644 --- a/Web/src/utils/formatTime.ts +++ b/Web/src/utils/formatTime.ts @@ -59,7 +59,6 @@ export function formatDate(date: Date, format: string): string { const hours = now.getHours().toString().padStart(2, '0'); const minutes = now.getMinutes().toString().padStart(2, '0'); const seconds = now.getSeconds().toString().padStart(2, '0'); - return `${year}${month}${day}${hours}${minutes}${seconds}`; } diff --git a/Web/src/views/basics-date/matter/component/editOpenAccess.vue b/Web/src/views/basics-date/matter/component/editOpenAccess.vue index c74297c..11a3893 100644 --- a/Web/src/views/basics-date/matter/component/editOpenAccess.vue +++ b/Web/src/views/basics-date/matter/component/editOpenAccess.vue @@ -47,7 +47,7 @@ - + @@ -265,11 +265,6 @@ onMounted(() => { - -const onSubmit = () => { - console.log('submit!') -} - //获取品牌数据 let brandDate = ref([] as BrandOutput[]); @@ -312,14 +307,15 @@ const handleClick = (tab: TabsPaneContext, event: Event) => { //提交 const matterSubmit = async () => { let res; - //console.log(ruleForm); if (props.title=='添加物料'){ res = await addMaterials(ruleForm.value); } else { res = await updateMaterials(ruleForm.value); } - if (res.code === 200) { + //console.log(res) + + if (res.data.code == 200) { state.isShowDialog = false; ElMessage({ message: '成功', @@ -329,35 +325,34 @@ const matterSubmit = async () => { } else ElMessage.error(res.message!) - //MaterialsPage({}) closeDialog(); } -//获取包装关系 -let infoDate = reactive([] as PackageInfoOutput[]) -const getPackageInfoApi = async (id: number) => { - let res = await getAPI(PackageInfoApi).apiPackageInfoListMaterialsIdGet(id); - if (res.data.code === 200) { - infoDate = res.data.result!; - } -} +// //获取包装关系 + let infoDate = reactive([] as PackageInfoOutput[]) +// const getPackageInfoApi = async (id: number) => { +// let res = await getAPI(PackageInfoApi).apiPackageInfoListMaterialsIdGet(id); +// if (res.data.code === 200) { +// infoDate = res.data.result!; +// } +// } -//批量更新包装关系 -const UpdateInfoApi = async (paramsList: any[]) => { - const requests = paramsList.map(params => getAPI(PackageInfoApi).apiPackageInfoUpdatePost(params)); +// //批量更新包装关系 +// const UpdateInfoApi = async (paramsList: any[]) => { +// const requests = paramsList.map(params => getAPI(PackageInfoApi).apiPackageInfoUpdatePost(params)); - // 使用 Promise.all 等待所有请求完成 - Promise.all(requests) - .then(responses => { - // 所有请求都已完成,responses 是一个包含所有响应的数组 - console.log('所有请求完成:', responses); - }) - .catch(error => { - // 如果任何一个请求失败,则会进入这里 - console.error('请求失败:', error); - }); -} +// // 使用 Promise.all 等待所有请求完成 +// Promise.all(requests) +// .then(responses => { +// // 所有请求都已完成,responses 是一个包含所有响应的数组 +// console.log('所有请求完成:', responses); +// }) +// .catch(error => { +// // 如果任何一个请求失败,则会进入这里 +// console.error('请求失败:', error); +// }); +// } /** diff --git a/Web/src/views/labelPrinting/materialPrinting/component/editAccess.vue b/Web/src/views/labelPrinting/materialPrinting/component/editAccess.vue index 22f2033..69565d5 100644 --- a/Web/src/views/labelPrinting/materialPrinting/component/editAccess.vue +++ b/Web/src/views/labelPrinting/materialPrinting/component/editAccess.vue @@ -119,7 +119,7 @@ const printInfoFrom = reactive({ package: '', productDate: undefined, loseDate: undefined, - batch:1, + batch:'', }) const state = reactive({ @@ -188,7 +188,7 @@ const printSubmit = async () => { callback: async () => { state.waitShowPrinter = false; console.log('1111111'); - let contexts={unitGroupId:state.matterFrom.unitGroupId, materialsId:state.matterFrom.id, name:printInfoFrom.package, productDate:printInfoFrom.productDate, loseDate:printInfoFrom.loseDate, batch:printInfoFrom.batch, printDatas:printData.value}; + let contexts={unitGroupId:state.matterFrom.unitGroupId, materialsId:state.matterFrom.id, name:state.matterFrom.name, package:printInfoFrom.package, productDate:printInfoFrom.productDate, loseDate:printInfoFrom.loseDate, batch:printInfoFrom.batch, printDatas:printData.value}; let details = await addPrintDetail(contexts); //console.log(details.data.result); editDialogRef.value.openDialog(details.data.result); @@ -205,17 +205,6 @@ const printSubmit = async () => { }) -} - -//添加汇报单 -const addReport=async ()=>{ - let reportData = { - unitGroupId:state.matterFrom.unitGroupId, - name:printInfoFrom.package, - printData:printData.value - }; - - } // 查询操作 diff --git a/Web/src/views/labelPrinting/printDataDetail/index.vue b/Web/src/views/labelPrinting/printDataDetail/index.vue index ef2fe47..2d74bd4 100644 --- a/Web/src/views/labelPrinting/printDataDetail/index.vue +++ b/Web/src/views/labelPrinting/printDataDetail/index.vue @@ -83,13 +83,16 @@ @sort-change="sortChange" border=""> + - + - + + - + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + - - + - - - + + + + - + - - - + + - - - - - - - - - - - - - - - - + + + + - - @@ -91,6 +104,9 @@ import { ElMessage } from "element-plus"; import type { FormRules } from "element-plus"; import { addReportTable, updateReportTable, detailReportTable } from "/@/api/main/reportTable"; + import { listMaterials, detailMaterials } from '/@/api/main/materials'; + import { listProductionLine } from '/@/api/main/productionLine'; + import { getCurrentDate } from '/@/utils/formatTime'; //父级传递来的参数 var props = defineProps({ @@ -104,9 +120,11 @@ const ruleFormRef = ref(); const isShowDialog = ref(false); const ruleForm = ref({}); +const currentMaterial = ref({}); //自行添加其他规则 const rules = ref({ }); + const productionLines = ref([]); // 打开弹窗 const openDialog = async (row: any) => { @@ -117,6 +135,16 @@ ruleForm.value = (await detailReportTable(rowData.id)).data.result; else ruleForm.value = rowData; + + //console.log(rowData); + if(rowData.updateUserId){ + currentMaterial.value= (await detailMaterials(rowData.materialsId)).data.result; + ruleForm.value.name=currentMaterial.value.name; + ruleForm.value.productType='普通生产'; + ruleForm.value.startDate = ruleForm.value.productDate; + ruleForm.value.oddNumber = getCurrentDate(); + //console.log(currentMaterial.value); + } isShowDialog.value = true; }; @@ -159,6 +187,7 @@ // 页面加载时 onMounted(async () => { + productionLines.value = (await listProductionLine()).data.result; }); //将属性或者函数暴露给父组件 diff --git a/Web/src/views/productionCenter/reportTable/index.vue b/Web/src/views/productionCenter/reportTable/index.vue index 7cd1e5c..c36ab7f 100644 --- a/Web/src/views/productionCenter/reportTable/index.vue +++ b/Web/src/views/productionCenter/reportTable/index.vue @@ -79,13 +79,16 @@ @sort-change="sortChange" border=""> + + + - + - - + +