main
liangzongpeng 2024-06-26 18:33:33 +08:00
parent 325a436ae3
commit 57f0699959
25 changed files with 922 additions and 111 deletions

View File

@ -40,19 +40,19 @@ public class CodePakageConfiguration : EntityTenant
/// <summary>
/// 条码前缀
/// </summary>
[SugarColumn(ColumnName = "CodePrefix", ColumnDescription = "条码前缀", Length = 32)]
[SugarColumn(ColumnName = "CodePrefix", ColumnDescription = "条码前缀", Length = 64)]
public string? CodePrefix { get; set; }
/// <summary>
/// 内码前缀
/// </summary>
[SugarColumn(ColumnName = "InternalCodePrefix", ColumnDescription = "内码前缀", Length = 32)]
[SugarColumn(ColumnName = "InternalCodePrefix", ColumnDescription = "内码前缀", Length = 64)]
public string? InternalCodePrefix { get; set; }
/// <summary>
/// 导出格式示例
/// </summary>
[SugarColumn(ColumnName = "ExportFormatExample", ColumnDescription = "导出格式示例", Length = 32)]
[SugarColumn(ColumnName = "ExportFormatExample", ColumnDescription = "导出格式示例", Length = 64)]
public string? ExportFormatExample { get; set; }
/// <summary>

View File

@ -0,0 +1,64 @@
using Admin.NET.Core;
namespace Admin.NET.Application.Entity;
/// <summary>
/// 打印记录
/// </summary>
[SugarTable("printrecords","打印记录")]
public class PrintRecords : EntityBase
{
/// <summary>
/// 物料ID
/// </summary>
[SugarColumn(ColumnName = "MaterialsId", ColumnDescription = "物料ID")]
public long? MaterialsId { get; set; }
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)]
public string? Name { get; set; }
/// <summary>
/// 批次
/// </summary>
[SugarColumn(ColumnName = "Batch", ColumnDescription = "批次", Length = 32)]
public string? Batch { get; set; }
/// <summary>
/// 完工数量
/// </summary>
[SugarColumn(ColumnName = "ProductCount", ColumnDescription = "完工数量")]
public int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
[SugarColumn(ColumnName = "BaseProductCount", ColumnDescription = "基本完工数量")]
public int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
[SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)]
public string? Unit { get; set; }
/// <summary>
/// 生产日期
/// </summary>
[SugarColumn(ColumnName = "ProductDate", ColumnDescription = "生产日期")]
public DateTime? ProductDate { get; set; }
/// <summary>
/// 失效日期
/// </summary>
[SugarColumn(ColumnName = "LoseDate", ColumnDescription = "失效日期")]
public DateTime? LoseDate { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
public string? Remarks { get; set; }
}

View File

@ -165,4 +165,9 @@ public class ReportDetailTable : EntityTenant
[SugarColumn(ColumnName = "MaterialsId", ColumnDescription = "物料ID")]
public long? MaterialsId { get; set; }
/// <summary>
/// 单位组ID
/// </summary>
[SugarColumn(ColumnName = "UnitGroupId", ColumnDescription = "单位组ID")]
public long? UnitGroupId { get; set; }
}

View File

@ -67,4 +67,34 @@ public class ReportTable : EntityTenant
[SugarColumn(ColumnName = "SourceId", ColumnDescription = "源单ID")]
public long? SourceId { get; set; }
/// <summary>
/// 完工数量
/// </summary>
[SugarColumn(ColumnName = "ProductCount", ColumnDescription = "完工数量")]
public int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
[SugarColumn(ColumnName = "BaseProductCount", ColumnDescription = "基本完工数量")]
public int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
[SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)]
public string? Unit { get; set; }
/// <summary>
/// 批次
/// </summary>
[SugarColumn(ColumnName = "Batch", ColumnDescription = "批次", Length = 32)]
public string? Batch { get; set; }
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)]
public string? Name { get; set; }
}

View File

@ -0,0 +1,93 @@
namespace Admin.NET.Application;
/// <summary>
/// 打印记录输出参数
/// </summary>
public class PrintrecordsDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public DateTime? ProductDate { get; set; }
/// <summary>
/// 失效日期
/// </summary>
public DateTime? LoseDate { 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,189 @@
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 打印记录基础输入参数
/// </summary>
public class PrintrecordsBaseInput
{
/// <summary>
/// 物料ID
/// </summary>
public virtual long? MaterialsId { get; set; }
/// <summary>
/// 名称
/// </summary>
public virtual string? Name { get; set; }
/// <summary>
/// 批次
/// </summary>
public virtual string? Batch { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public virtual int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public virtual int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
public virtual string? Unit { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public virtual DateTime? ProductDate { get; set; }
/// <summary>
/// 失效日期
/// </summary>
public virtual DateTime? LoseDate { 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 PrintRecordsInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public DateTime? ProductDate { get; set; }
/// <summary>
/// 失效日期
/// </summary>
public DateTime? LoseDate { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
/// <summary>
/// 打印记录增加输入参数
/// </summary>
public class AddPrintRecordsInput : PrintrecordsBaseInput
{
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
}
/// <summary>
/// 打印记录删除输入参数
/// </summary>
public class DeletePrintRecordsInput : BaseIdInput
{
}
/// <summary>
/// 打印记录更新输入参数
/// </summary>
public class UpdatePrintRecordsInput : PrintrecordsBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 打印记录主键查询输入参数
/// </summary>
public class QueryByIdPrintRecordsInput : DeletePrintRecordsInput
{
}

View File

@ -0,0 +1,95 @@
namespace Admin.NET.Application;
/// <summary>
/// 打印记录输出参数
/// </summary>
public class PrintRecordsOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public DateTime? ProductDate { get; set; }
/// <summary>
/// 失效日期
/// </summary>
public DateTime? LoseDate { 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,115 @@
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 PrintRecordsService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<PrintRecords> _rep;
public PrintRecordsService(SqlSugarRepository<PrintRecords> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询打印记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<PrintRecordsOutput>> 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<PrintRecordsOutput>();
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(AddPrintRecordsInput input)
{
var entity = input.Adapt<PrintRecords>();
await _rep.InsertAsync(entity);
return entity.Id;
}
/// <summary>
/// 删除打印记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[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); //真删除
}
/// <summary>
/// 更新打印记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Update")]
public async Task Update(UpdatePrintRecordsInput input)
{
var entity = input.Adapt<PrintRecords>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取打印记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<PrintRecords> Detail([FromQuery] QueryByIdPrintRecordsInput 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<PrintRecordsOutput>> List()
{
return await _rep.AsQueryable().Select<PrintRecordsOutput>().ToListAsync();
}
}

View File

@ -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;
/// <summary>
/// 商品追溯服务
@ -11,11 +13,14 @@ public class ProductRetrospectService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<ProductRetrospect> _rep;
private readonly PrintCodeDetailService _codeDetailService;
private readonly UserManager _userManager;
public ProductRetrospectService(SqlSugarRepository<ProductRetrospect> rep,
PrintCodeDetailService codeDetailService)
PrintCodeDetailService codeDetailService,
UserManager userManager)
{
_rep = rep;
_codeDetailService = codeDetailService;
_userManager = userManager;
}
/// <summary>
@ -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<ProductRetrospectOutput>().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);
}
}

View File

@ -135,6 +135,10 @@ public class ReportDetailTableDto
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 单位组ID
/// </summary>
public long? UnitGroupId { get; set; }
/// <summary>
/// 备注
/// </summary>

View File

@ -133,6 +133,10 @@ public class ReportDetailTableBaseInput
/// </summary>
public virtual long? MaterialsId { get; set; }
/// <summary>
/// 单位组ID
/// </summary>
public long? UnitGroupId { get; set; }
/// <summary>
/// 备注

View File

@ -135,6 +135,10 @@ public class ReportDetailTableOutput
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 单位组ID
/// </summary>
public long? UnitGroupId { get; set; }
/// <summary>
/// 备注
/// </summary>

View File

@ -17,10 +17,14 @@ public class AddReportContext
/// </summary>
public long UnitGroupId { get; set; }
/// <summary>
/// 码包名称
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 码包名称
/// </summary>
public string? Package { get; set; }
/// <summary>
/// 生产日期
/// </summary>
public DateTime? ProductDate { get; set; }

View File

@ -55,6 +55,30 @@ public class ReportTableDto
/// </summary>
public long? SourceId { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }

View File

@ -53,6 +53,30 @@ public class ReportTableBaseInput
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 备注
/// </summary>

View File

@ -55,6 +55,31 @@ public class ReportTableOutput
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 完工数量
/// </summary>
public int? ProductCount { get; set; }
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? Batch { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 备注
/// </summary>

View File

@ -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<ReportTable> 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;
}
/// <summary>
@ -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)
{
return 0;
}
for (int i = 0; i < printDetails.Count; i++)
{
var item = printDetails[i];
item.ReportTableId = entity.Id;
await _codeDetailService.Update(item.Adapt<UpdatePrintCodeDetailInput>());
}
var ent = item.Adapt<PrintCodeDetail>();
await _codeDetailService.UpdateByEntity(ent);
await _productRetrospectService.AddRetrospect(ent, entity, "汇报单", entity.ProductionLine, entity.Id);
}
}
return entity.Id;
}
/// <summary>
/// 删除汇报单
/// </summary>
@ -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<ReportTable>();
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()
{

View File

@ -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();
}

View File

@ -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: { },
});

View File

@ -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}`;
}

View File

@ -47,7 +47,7 @@
<el-switch v-model="ruleForm.isEnable" inline-prompt active-text="" inactive-text="" />
</el-form-item>
</el-col>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" :key="key">
<el-tabs v-model="activeName" class="demo-tabs" :key="key">
<el-tab-pane label="基本信息" name="基本信息">
<el-row>
<el-col :span="8">
@ -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);
// });
// }
/**

View File

@ -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
};
}
//

View File

@ -83,13 +83,16 @@
@sort-change="sortChange"
border="">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="name" label="名称" width="140" show-overflow-tooltip="" />
<el-table-column prop="oddNumber" label="单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="startDate" label="业务日期" width="140" show-overflow-tooltip="" />
<el-table-column prop="productDate" 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="productionLine" label="生产线" width="140" show-overflow-tooltip="" />
<el-table-column prop="startDate" 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="sourceNumber" label="源单号" width="140" show-overflow-tooltip="" /> -->
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
<el-table-column label="操作" width="240" align="center" fixed="right" show-overflow-tooltip="" >
<template #default="scope">
@ -129,9 +132,9 @@
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { formatDate } from '/@/utils/formatTime';
import addReportDialog from '/@/views/productionCenter/reportDetailTable/component/editDialog.vue'
import addReportDialog from '/@/views/productionCenter/reportTable/component/editDialog.vue'
import editDialog from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue'
import { pageReportTable, deleteReportTable } from '/@/api/main/reportTable';
import { pagePrintRecords, deletePrintRecords } from '/@/api/main/printRecords';
const showAdvanceQueryUI = ref(false);
@ -158,7 +161,7 @@
//
const handleQuery = async () => {
loading.value = true;
var res = await pageReportTable(Object.assign(queryParams.value, tableParams.value));
var res = await pagePrintRecords(Object.assign(queryParams.value, tableParams.value));
tableData.value = res.data.result?.items ?? [];
tableParams.value.total = res.data.result?.total;
loading.value = false;
@ -180,7 +183,12 @@
//
const addReportTable = (row: any) => {
addReportTitle.value = '添加汇报单';
addReportDialogRef.value.openDialog({updateUserId:row.id});
let report = Object.assign({updateUserId:row.id},row);
report.updateUserId = row.id;
report.sourceId=row.id;
report.id = undefined;
//console.log(report);
addReportDialogRef.value.openDialog(report);
};
//
@ -197,7 +205,7 @@
type: "warning",
})
.then(async () => {
await deleteReportTable(row);
await deletePrintRecords(row);
handleQuery();
ElMessage.success("删除成功");
})

View File

@ -9,64 +9,77 @@
</template>
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
<el-row :gutter="35">
<el-form-item v-show="false">
<!-- <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="name">
<el-input v-model="ruleForm.name" 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="productCount">
<el-input-number v-model="ruleForm.productCount" 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="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="productType">
<el-select v-model="ruleForm.productType" placeholder="请选择" clearable>
<el-option label="普通生产" value= '普通生产' />
<el-option label="返工生产" value= '返工生产' />
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="业务日期" prop="startDate">
<el-date-picker v-model="ruleForm.startDate" 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="state">
<el-input-number v-model="ruleForm.state" placeholder="请输入状态" clearable />
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="生产线" prop="productionLine" >
<el-select v-model="ruleForm.productionLine" placeholder="请选择" clearable >
<el-option :label="item.name" :value="item.name" v-for="item, index in productionLines"
:key="index" />
</el-select>
</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-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="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-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>
<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="64" show-word-limit clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
@ -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<any>({});
const currentMaterial = ref<any>({});
//
const rules = ref<FormRules>({
});
const productionLines = ref<any>([]);
//
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;
});
//

View File

@ -79,13 +79,16 @@
@sort-change="sortChange"
border="">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="name" label="名称" width="140" show-overflow-tooltip="" />
<el-table-column prop="unit" label="单位" width="100" show-overflow-tooltip="" />
<el-table-column prop="batch" label="批次" width="140" show-overflow-tooltip="" />
<el-table-column prop="oddNumber" label="单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="startDate" label="业务日期" width="200" show-overflow-tooltip="" />
<el-table-column prop="state" label="状态" width="80" show-overflow-tooltip="" />
<!-- <el-table-column prop="state" label="状态" width="80" 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="productCount" label="生产数量" width="100" show-overflow-tooltip="" />
<!-- <el-table-column prop="sourceNumber" label="源单号" width="140" show-overflow-tooltip="" /> -->
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
<el-table-column label="操作" width="200" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('reportTable:update') || auth('reportTable:delete')">
<template #default="scope">