main
liangzongpeng 2024-06-24 18:21:52 +08:00
parent c358a67e4c
commit 325a436ae3
34 changed files with 1038 additions and 629 deletions

View File

@ -4,7 +4,7 @@ namespace Admin.NET.Application.Entity;
/// <summary> /// <summary>
/// 防伪扫码记录 /// 防伪扫码记录
/// </summary> /// </summary>
[SugarTable("AntiFakeRecords","防伪扫码记录")] [SugarTable("antifakerecords","防伪扫码记录")]
public class AntiFakeRecords : EntityBaseId public class AntiFakeRecords : EntityBaseId
{ {
/// <summary> /// <summary>
@ -55,4 +55,29 @@ public class AntiFakeRecords : EntityBaseId
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)] [SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
public string? Remarks { get; set; } public string? Remarks { get; set; }
/// <summary>
/// 内码
/// </summary>
[SugarColumn(ColumnName = "InternalCode", ColumnDescription = "内码", Length = 32)]
public string? InternalCode { get; set; }
/// <summary>
/// 商品编码
/// </summary>
[SugarColumn(ColumnName = "CodeNum", ColumnDescription = "商品编码", Length = 32)]
public string? CodeNum { get; set; }
/// <summary>
/// 验证通过
/// </summary>
[Required]
[SugarColumn(ColumnName = "IsPass", ColumnDescription = "验证通过")]
public bool IsPass { get; set; }
/// <summary>
/// 经纬度
/// </summary>
[SugarColumn(ColumnName = "LongitudeAndLatitude", ColumnDescription = "经纬度", Length = 32)]
public string? LongitudeAndLatitude { get; set; }
} }

View File

@ -4,7 +4,7 @@ namespace Admin.NET.Application.Entity;
/// <summary> /// <summary>
/// 码元素 /// 码元素
/// </summary> /// </summary>
[SugarTable("CodeElement","码元素")] [SugarTable("codeelement","码元素")]
public class CodeElement : EntityBase public class CodeElement : EntityBase
{ {
/// <summary> /// <summary>
@ -26,4 +26,10 @@ public class CodeElement : EntityBase
[SugarColumn(ColumnName = "ExportFormatExample", ColumnDescription = "导出格式示例", Length = 32)] [SugarColumn(ColumnName = "ExportFormatExample", ColumnDescription = "导出格式示例", Length = 32)]
public string? ExportFormatExample { get; set; } public string? ExportFormatExample { get; set; }
/// <summary>
/// 单位组
/// </summary>
[SugarColumn(ColumnName = "UnitGroupId", ColumnDescription = "单位组")]
public long? UnitGroupId { get; set; }
} }

View File

@ -4,7 +4,7 @@ namespace Admin.NET.Application.Entity;
/// <summary> /// <summary>
/// 码包配置 /// 码包配置
/// </summary> /// </summary>
[SugarTable("CodePakageConfiguration","码包配置")] [SugarTable("codepakageconfiguration","码包配置")]
public class CodePakageConfiguration : EntityTenant public class CodePakageConfiguration : EntityTenant
{ {
/// <summary> /// <summary>
@ -34,7 +34,7 @@ public class CodePakageConfiguration : EntityTenant
/// <summary> /// <summary>
/// 导出格式 /// 导出格式
/// </summary> /// </summary>
[SugarColumn(ColumnName = "ExportFormat", ColumnDescription = "导出格式")] [SugarColumn(ColumnName = "ExportFormat", ColumnDescription = "导出格式", Length = 255)]
public string? ExportFormat { get; set; } public string? ExportFormat { get; set; }
/// <summary> /// <summary>
@ -68,4 +68,10 @@ public class CodePakageConfiguration : EntityTenant
[SugarColumn(ColumnName = "SuffixType", ColumnDescription = "后缀类型", Length = 32)] [SugarColumn(ColumnName = "SuffixType", ColumnDescription = "后缀类型", Length = 32)]
public string? SuffixType { get; set; } public string? SuffixType { get; set; }
/// <summary>
/// 单位组
/// </summary>
[SugarColumn(ColumnName = "UnitGroupId", ColumnDescription = "单位组")]
public long? UnitGroupId { get; set; }
} }

View File

@ -128,6 +128,21 @@ public class AntiFakeRecordsService : IDynamicApiController, ITransient
return await _rep.AsQueryable().Select<AntiFakeRecordsOutput>().ToListAsync(); return await _rep.AsQueryable().Select<AntiFakeRecordsOutput>().ToListAsync();
} }
/// <summary>
/// 获取防伪扫码记录列表
/// </summary>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Test")]
public async Task Test()
{
var list = await _printCodeDetailService.List();
foreach (var item in list)
{
item.MaterialsId = 34150613270533;
await _printCodeDetailService.UpdateByEntity(item.Adapt<PrintCodeDetail>());
}
}
/// <summary> /// <summary>
/// 获取防伪扫码记录列表 /// 获取防伪扫码记录列表
@ -142,6 +157,25 @@ public class AntiFakeRecordsService : IDynamicApiController, ITransient
} }
/// <summary>
/// 获取防伪扫码记录列表
/// </summary>
/// <param name="productCode"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "CheckCode")]
[AllowAnonymous]
public async Task<bool> CheckCode(string productCode)
{
var code = await _printCodeDetailService.GetByProductCode(productCode);
if (code == null)
{
return false;
}
return true;
}
/// <summary> /// <summary>
/// 获取打印条码详情 /// 获取打印条码详情
/// </summary> /// </summary>
@ -149,30 +183,40 @@ public class AntiFakeRecordsService : IDynamicApiController, ITransient
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[ApiDescriptionSettings(Name = "AntiFakeCode")] [ApiDescriptionSettings(Name = "AntiFakeCode")]
[AllowAnonymous]
public async Task<AntiFakeInfoOutput> AntiFakeCode(AddAntiFakeRecordsInput input) public async Task<AntiFakeInfoOutput> AntiFakeCode(AddAntiFakeRecordsInput input)
{ {
var code = await _printCodeDetailService.GetByProductCode(input.Code); var code = await _printCodeDetailService.GetByProductCode(input.Code);
input.Date = DateTime.Now;
if (code == null) if (code == null)
{ {
input.IsPass = false;
await Add(input);
throw Oops.Oh(ErrorCodeEnum.xg1002); throw Oops.Oh(ErrorCodeEnum.xg1002);
} }
var material = await _materialsService.GetById(code.MaterialsId); var material = await _materialsService.GetById(code.MaterialsId);
if (material == null) if (material == null)
{ {
input.IsPass = false;
await Add(input);
throw Oops.Oh(ErrorCodeEnum.xg1002); throw Oops.Oh(ErrorCodeEnum.xg1002);
} }
input.IsPass = true;
var model = new AntiFakeInfoOutput() var model = new AntiFakeInfoOutput()
{ {
Addr = input.Addr, Addr = input.Addr,
Code = code.Code, Code = code.Code,
Name=material.Name,
Brand = material.Brand, Brand = material.Brand,
Specifications = material.Specifications, Specifications = material.Specifications,
}; };
var report = await _reportDetailTableService.Detail(new QueryByIdReportDetailTableInput() { Id = code.ReportTableId.Value }); var report = await _reportDetailTableService.Detail(new QueryByIdReportDetailTableInput() { Id = code.ReportTableId.Value });
if (report!=null) if (report!=null)
{ {
model.Batch= report.Batch; model.Batch= report.Batch;
model.ProductionLine = report.ProductionLine;
} }
await Add(input);
return model; return model;
} }

View File

@ -1,53 +1,74 @@
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary>
/// 防伪扫码记录输出参数
/// </summary>
public class AntiFakeRecordsDto
{
/// <summary> /// <summary>
/// 防伪扫码记录输出参数 /// 主键Id
/// </summary> /// </summary>
public class AntiFakeRecordsDto public long Id { get; set; }
{
/// <summary> /// <summary>
/// 主键Id /// 条码
/// </summary> /// </summary>
public long Id { get; set; } public string? Code { get; set; }
/// <summary> /// <summary>
/// 条码 /// IP地址
/// </summary> /// </summary>
public string? Code { get; set; } public string? Ip { get; set; }
/// <summary> /// <summary>
/// IP地址 /// 城市
/// </summary> /// </summary>
public string? Ip { get; set; } public string? City { get; set; }
/// <summary> /// <summary>
/// 城市 /// 地域信息
/// </summary> /// </summary>
public string? City { get; set; } public string? Addr { get; set; }
/// <summary> /// <summary>
/// 地域信息 /// 城市编码
/// </summary> /// </summary>
public string? Addr { get; set; } public string? CityCode { get; set; }
/// <summary> /// <summary>
/// 城市编码 /// 省份
/// </summary> /// </summary>
public string? CityCode { get; set; } public string? Pro { get; set; }
/// <summary> /// <summary>
/// 省份 /// 扫码时间
/// </summary> /// </summary>
public string? Pro { get; set; } public DateTime? Date { get; set; }
/// <summary> /// <summary>
/// 扫码时间 /// 备注
/// </summary> /// </summary>
public DateTime? Date { get; set; } public string? Remarks { get; set; }
/// <summary>
/// 备注 /// <summary>
/// </summary> /// 内码
public string? Remarks { get; set; } /// </summary>
public string? InternalCode { get; set; }
}
/// <summary>
/// 商品编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 验证通过
/// </summary>
public bool IsPass { get; set; }
/// <summary>
/// 经纬度
/// </summary>
public string? LongitudeAndLatitude { get; set; }
}

View File

@ -3,140 +3,179 @@ using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary>
/// 防伪扫码记录基础输入参数
/// </summary>
public class AntiFakeRecordsBaseInput
{
/// <summary> /// <summary>
/// 防伪扫码记录基础输入参数 /// 条码
/// </summary> /// </summary>
public class AntiFakeRecordsBaseInput public virtual string? Code { get; set; }
{
/// <summary>
/// 条码
/// </summary>
public virtual string? Code { get; set; }
/// <summary>
/// IP地址
/// </summary>
public virtual string? Ip { get; set; }
/// <summary>
/// 城市
/// </summary>
public virtual string? City { get; set; }
/// <summary>
/// 地域信息
/// </summary>
public virtual string? Addr { get; set; }
/// <summary>
/// 城市编码
/// </summary>
public virtual string? CityCode { get; set; }
/// <summary>
/// 省份
/// </summary>
public virtual string? Pro { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public virtual DateTime? Date { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
}
/// <summary> /// <summary>
/// 防伪扫码记录分页查询输入参数 /// IP地址
/// </summary> /// </summary>
public class AntiFakeRecordsInput : BasePageInput public virtual string? Ip { get; set; }
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 条码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// IP地址
/// </summary>
public string? Ip { get; set; }
/// <summary>
/// 城市
/// </summary>
public string? City { get; set; }
/// <summary>
/// 地域信息
/// </summary>
public string? Addr { get; set; }
/// <summary>
/// 城市编码
/// </summary>
public string? CityCode { get; set; }
/// <summary>
/// 省份
/// </summary>
public string? Pro { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public DateTime? Date { get; set; }
/// <summary>
/// 扫码时间范围
/// </summary>
public List<DateTime?> DateRange { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
/// <summary> /// <summary>
/// 防伪扫码记录增加输入参数 /// 城市
/// </summary> /// </summary>
public class AddAntiFakeRecordsInput : AntiFakeRecordsBaseInput public virtual string? City { get; set; }
{
}
/// <summary> /// <summary>
/// 防伪扫码记录删除输入参数 /// 地域信息
/// </summary> /// </summary>
public class DeleteAntiFakeRecordsInput : BaseIdInput public virtual string? Addr { get; set; }
{
}
/// <summary> /// <summary>
/// 防伪扫码记录更新输入参数 /// 城市编码
/// </summary> /// </summary>
public class UpdateAntiFakeRecordsInput : AntiFakeRecordsBaseInput public virtual string? CityCode { get; set; }
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary> /// <summary>
/// 防伪扫码记录主键查询输入参数 /// 省份
/// </summary> /// </summary>
public class QueryByIdAntiFakeRecordsInput : DeleteAntiFakeRecordsInput public virtual string? Pro { get; set; }
{
} /// <summary>
/// 扫码时间
/// </summary>
public virtual DateTime? Date { get; set; }
/// <summary>
/// 内码
/// </summary>
public string? InternalCode { get; set; }
/// <summary>
/// 商品编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 验证通过
/// </summary>
public bool IsPass { get; set; }
/// <summary>
/// 经纬度
/// </summary>
public string? LongitudeAndLatitude { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
}
/// <summary>
/// 防伪扫码记录分页查询输入参数
/// </summary>
public class AntiFakeRecordsInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 条码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// IP地址
/// </summary>
public string? Ip { get; set; }
/// <summary>
/// 城市
/// </summary>
public string? City { get; set; }
/// <summary>
/// 地域信息
/// </summary>
public string? Addr { get; set; }
/// <summary>
/// 城市编码
/// </summary>
public string? CityCode { get; set; }
/// <summary>
/// 省份
/// </summary>
public string? Pro { get; set; }
/// <summary>
/// 扫码时间
/// </summary>
public DateTime? Date { get; set; }
/// <summary>
/// 内码
/// </summary>
public string? InternalCode { get; set; }
/// <summary>
/// 商品编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 验证通过
/// </summary>
public bool IsPass { get; set; }
/// <summary>
/// 经纬度
/// </summary>
public string? LongitudeAndLatitude { get; set; }
/// <summary>
/// 扫码时间范围
/// </summary>
public List<DateTime?> DateRange { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
/// <summary>
/// 防伪扫码记录增加输入参数
/// </summary>
public class AddAntiFakeRecordsInput : AntiFakeRecordsBaseInput
{
}
/// <summary>
/// 防伪扫码记录删除输入参数
/// </summary>
public class DeleteAntiFakeRecordsInput : BaseIdInput
{
}
/// <summary>
/// 防伪扫码记录更新输入参数
/// </summary>
public class UpdateAntiFakeRecordsInput : AntiFakeRecordsBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 防伪扫码记录主键查询输入参数
/// </summary>
public class QueryByIdAntiFakeRecordsInput : DeleteAntiFakeRecordsInput
{
}

View File

@ -45,6 +45,26 @@ public class AntiFakeRecordsOutput
/// </summary> /// </summary>
public DateTime? Date { get; set; } public DateTime? Date { get; set; }
/// <summary>
/// 内码
/// </summary>
public string? InternalCode { get; set; }
/// <summary>
/// 商品编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 验证通过
/// </summary>
public bool IsPass { get; set; }
/// <summary>
/// 经纬度
/// </summary>
public string? LongitudeAndLatitude { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>

View File

@ -97,15 +97,14 @@ public class CodeElementService : IDynamicApiController, ITransient
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[ApiDescriptionSettings(Name = "ElementByName")] [ApiDescriptionSettings(Name = "ElementByName")]
public async Task<CodeElement> GetElementByName([FromQuery] string input) public async Task<CodeElement> GetElementByName([FromQuery] string input,long? unitGroupId)
{ {
return await _rep.GetFirstAsync(u => u.CodeName == input); return await _rep.GetFirstAsync(u => u.UnitGroupId == unitGroupId && u.CodeName == input);
} }
/// <summary> /// <summary>
/// 获取码元素列表 /// 获取码元素列表
/// </summary> /// </summary>
/// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[ApiDescriptionSettings(Name = "List")] [ApiDescriptionSettings(Name = "List")]
@ -114,7 +113,17 @@ public class CodeElementService : IDynamicApiController, ITransient
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<CodeElementOutput>().ToListAsync(); return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<CodeElementOutput>().ToListAsync();
} }
/// <summary>
/// 获取码包配置列表
/// </summary>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "ListByGroupId")]
public async Task<List<CodeElementOutput>> ListByGroupId(long? unitGroupId)
{
var list = await _rep.AsQueryable().Where(a => a.UnitGroupId == unitGroupId && !a.IsDelete).Select<CodeElementOutput>().ToListAsync();
return list;
}

View File

@ -1,63 +1,69 @@
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary>
/// 码元素输出参数
/// </summary>
public class CodeElementDto
{
/// <summary> /// <summary>
/// 码元素输出参数 /// 主键Id
/// </summary> /// </summary>
public class CodeElementDto public long Id { get; set; }
{
/// <summary> /// <summary>
/// 主键Id /// 码长度
/// </summary> /// </summary>
public long Id { get; set; } public int CodeLength { get; set; }
/// <summary> /// <summary>
/// 码长度 /// 码包名称
/// </summary> /// </summary>
public int CodeLength { get; set; } public string? CodeName { get; set; }
/// <summary> /// <summary>
/// 码包名称 /// 导出格式示例
/// </summary> /// </summary>
public string? CodeName { get; set; } public string? ExportFormatExample { get; set; }
/// <summary>
/// 导出格式示例 /// <summary>
/// </summary> /// 单位组
public string? ExportFormatExample { get; set; } /// </summary>
public long? UnitGroupId { get; set; }
/// <summary>
/// 创建时间 /// <summary>
/// </summary> /// 创建时间
public DateTime? CreateTime { get; set; } /// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间 /// <summary>
/// </summary> /// 更新时间
public DateTime? UpdateTime { get; set; } /// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id /// <summary>
/// </summary> /// 创建者Id
public long? CreateUserId { get; set; } /// </summary>
public long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名 /// <summary>
/// </summary> /// 创建者姓名
public string? CreateUserName { get; set; } /// </summary>
public string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id /// <summary>
/// </summary> /// 修改者Id
public long? UpdateUserId { get; set; } /// </summary>
public long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名 /// <summary>
/// </summary> /// 修改者姓名
public string? UpdateUserName { get; set; } /// </summary>
public string? UpdateUserName { get; set; }
/// <summary>
/// 软删除 /// <summary>
/// </summary> /// 软删除
public bool IsDelete { get; set; } /// </summary>
public bool IsDelete { get; set; }
}
}

View File

@ -24,6 +24,11 @@ public class CodeElementBaseInput
/// </summary> /// </summary>
public virtual string? ExportFormatExample { get; set; } public virtual string? ExportFormatExample { get; set; }
/// <summary>
/// 单位组
/// </summary>
public long? UnitGroupId { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>
@ -86,6 +91,10 @@ public class CodeElementInput : BasePageInput
/// </summary> /// </summary>
public string? ExportFormatExample { get; set; } public string? ExportFormatExample { get; set; }
/// <summary>
/// 单位组
/// </summary>
public long? UnitGroupId { get; set; }
} }
/// <summary> /// <summary>

View File

@ -9,57 +9,62 @@ public class CodeElementOutput
/// 主键Id /// 主键Id
/// </summary> /// </summary>
public long Id { get; set; } public long Id { get; set; }
/// <summary> /// <summary>
/// 码长度 /// 码长度
/// </summary> /// </summary>
public int CodeLength { get; set; } public int CodeLength { get; set; }
/// <summary> /// <summary>
/// 码包名称 /// 码包名称
/// </summary> /// </summary>
public string? CodeName { get; set; } public string? CodeName { get; set; }
/// <summary> /// <summary>
/// 导出格式示例 /// 导出格式示例
/// </summary> /// </summary>
public string? ExportFormatExample { get; set; } public string? ExportFormatExample { get; set; }
/// <summary>
/// 单位组
/// </summary>
public long? UnitGroupId { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
/// <summary> /// <summary>
/// 更新时间 /// 更新时间
/// </summary> /// </summary>
public DateTime? UpdateTime { get; set; } public DateTime? UpdateTime { get; set; }
/// <summary> /// <summary>
/// 创建者Id /// 创建者Id
/// </summary> /// </summary>
public long? CreateUserId { get; set; } public long? CreateUserId { get; set; }
/// <summary> /// <summary>
/// 创建者姓名 /// 创建者姓名
/// </summary> /// </summary>
public string? CreateUserName { get; set; } public string? CreateUserName { get; set; }
/// <summary> /// <summary>
/// 修改者Id /// 修改者Id
/// </summary> /// </summary>
public long? UpdateUserId { get; set; } public long? UpdateUserId { get; set; }
/// <summary> /// <summary>
/// 修改者姓名 /// 修改者姓名
/// </summary> /// </summary>
public string? UpdateUserName { get; set; } public string? UpdateUserName { get; set; }
/// <summary> /// <summary>
/// 软删除 /// 软删除
/// </summary> /// </summary>
public bool IsDelete { get; set; } public bool IsDelete { get; set; }
} }

View File

@ -98,6 +98,29 @@ public class CodePakageConfigurationService : IDynamicApiController, ITransient
return list; return list;
} }
/// <summary>
/// 获取码包配置列表
/// </summary>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "ListByGroupId")]
public async Task<List<CodePakageConfigurationOutput>> ListByGroupId(long? unitGroupId)
{
var list = await _rep.AsQueryable().Where(a =>a.UnitGroupId == unitGroupId && !a.IsDelete).Select<CodePakageConfigurationOutput>().ToListAsync();
return list;
}
/// <summary>
/// 获取码元素
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "GetConfigByName")]
public async Task<CodePakageConfiguration> GetConfigByName([FromQuery] string input, long? unitGroupId)
{
return await _rep.GetFirstAsync(u => u.UnitGroupId == unitGroupId && u.Name == input);
}
/// <summary> /// <summary>
/// 获取码包示例 /// 获取码包示例
/// </summary> /// </summary>

View File

@ -1,93 +1,98 @@
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary>
/// 码包配置输出参数
/// </summary>
public class CodePakageConfigurationDto
{
/// <summary> /// <summary>
/// 码包配置输出参数 /// 主键Id
/// </summary> /// </summary>
public class CodePakageConfigurationDto public long Id { get; set; }
{
/// <summary> /// <summary>
/// 主键Id /// 序号
/// </summary> /// </summary>
public long Id { get; set; } public int? Index { get; set; }
/// <summary> /// <summary>
/// 序号 /// 码包配置名称
/// </summary> /// </summary>
public int? Index { get; set; } public string? Name { get; set; }
/// <summary> /// <summary>
/// 码包配置名称 /// 条码类型
/// </summary> /// </summary>
public string? Name { get; set; } public string? CodeType { get; set; }
/// <summary> /// <summary>
/// 条码类型 /// 条码类型ID
/// </summary> /// </summary>
public string? CodeType { get; set; } public long? CodeTypeId { get; set; }
/// <summary> /// <summary>
/// 条码类型ID /// 导出格式
/// </summary> /// </summary>
public long? CodeTypeId { get; set; } public string? ExportFormat { get; set; }
/// <summary> /// <summary>
/// 导出格式 /// 条码前缀
/// </summary> /// </summary>
public string? ExportFormat { get; set; } public string? CodePrefix { get; set; }
/// <summary> /// <summary>
/// 条码前缀 /// 内码前缀
/// </summary> /// </summary>
public string? CodePrefix { get; set; } public string? InternalCodePrefix { get; set; }
/// <summary> /// <summary>
/// 内码前缀 /// 导出格式示例
/// </summary> /// </summary>
public string? InternalCodePrefix { get; set; } public string? ExportFormatExample { get; set; }
/// <summary> /// <summary>
/// 导出格式示例 /// 单位组
/// </summary> /// </summary>
public string? ExportFormatExample { get; set; } public long? UnitGroupId { get; set; }
/// <summary> /// <summary>
/// 租户Id /// 租户Id
/// </summary> /// </summary>
public long? TenantId { get; set; } public long? TenantId { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
/// <summary> /// <summary>
/// 更新时间 /// 更新时间
/// </summary> /// </summary>
public DateTime? UpdateTime { get; set; } public DateTime? UpdateTime { get; set; }
/// <summary> /// <summary>
/// 创建者Id /// 创建者Id
/// </summary> /// </summary>
public long? CreateUserId { get; set; } public long? CreateUserId { get; set; }
/// <summary> /// <summary>
/// 创建者姓名 /// 创建者姓名
/// </summary> /// </summary>
public string? CreateUserName { get; set; } public string? CreateUserName { get; set; }
/// <summary> /// <summary>
/// 修改者Id /// 修改者Id
/// </summary> /// </summary>
public long? UpdateUserId { get; set; } public long? UpdateUserId { get; set; }
/// <summary> /// <summary>
/// 修改者姓名 /// 修改者姓名
/// </summary> /// </summary>
public string? UpdateUserName { get; set; } public string? UpdateUserName { get; set; }
/// <summary> /// <summary>
/// 软删除 /// 软删除
/// </summary> /// </summary>
public bool IsDelete { get; set; } public bool IsDelete { get; set; }
} }

View File

@ -3,50 +3,55 @@ using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary>
/// 码包配置基础输入参数
/// </summary>
public class CodePakageConfigurationBaseInput
{
/// <summary> /// <summary>
/// 码包配置基础输入参数 /// 序号
/// </summary> /// </summary>
public class CodePakageConfigurationBaseInput public virtual int? Index { get; set; }
{
/// <summary> /// <summary>
/// 序号 /// 码包配置名称
/// </summary> /// </summary>
public virtual int? Index { get; set; } public virtual string? Name { get; set; }
/// <summary> /// <summary>
/// 码包配置名称 /// 条码类型
/// </summary> /// </summary>
public virtual string? Name { get; set; } public virtual string? CodeType { get; set; }
/// <summary> /// <summary>
/// 条码类型 /// 条码类型ID
/// </summary> /// </summary>
public virtual string? CodeType { get; set; } public virtual long? CodeTypeId { get; set; }
/// <summary> /// <summary>
/// 条码类型ID /// 导出格式
/// </summary> /// </summary>
public virtual long? CodeTypeId { get; set; } public virtual string? ExportFormat { get; set; }
/// <summary> /// <summary>
/// 导出格式 /// 条码前缀
/// </summary> /// </summary>
public virtual string? ExportFormat { get; set; } public virtual string? CodePrefix { get; set; }
/// <summary> /// <summary>
/// 条码前缀 /// 内码前缀
/// </summary> /// </summary>
public virtual string? CodePrefix { get; set; } public virtual string? InternalCodePrefix { get; set; }
/// <summary> /// <summary>
/// 内码前缀 /// 导出格式示例
/// </summary> /// </summary>
public virtual string? InternalCodePrefix { get; set; } public virtual string? ExportFormatExample { get; set; }
/// <summary> /// <summary>
/// 导出格式示例 /// 单位组
/// </summary> /// </summary>
public virtual string? ExportFormatExample { get; set; } public long? UnitGroupId { get; set; }
/// <summary> /// <summary>
/// 条码长度 /// 条码长度
@ -62,93 +67,93 @@ namespace Admin.NET.Application;
/// 租户Id /// 租户Id
/// </summary> /// </summary>
public virtual long? TenantId { get; set; } public virtual long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public virtual DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public virtual long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public virtual string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public virtual long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public virtual string? UpdateUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public virtual bool IsDelete { get; set; }
}
/// <summary> /// <summary>
/// 码包配置分页查询输入参数 /// 创建时间
/// </summary> /// </summary>
public class CodePakageConfigurationInput : BasePageInput public virtual DateTime? CreateTime { get; set; }
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary> /// <summary>
/// 序号 /// 更新时间
/// </summary> /// </summary>
public int? Index { get; set; } public virtual DateTime? UpdateTime { get; set; }
/// <summary> /// <summary>
/// 码包配置名称 /// 创建者Id
/// </summary> /// </summary>
public string? Name { get; set; } public virtual long? CreateUserId { get; set; }
/// <summary> /// <summary>
/// 条码类型 /// 创建者姓名
/// </summary> /// </summary>
public string? CodeType { get; set; } public virtual string? CreateUserName { get; set; }
/// <summary> /// <summary>
/// 条码类型ID /// 修改者Id
/// </summary> /// </summary>
public long? CodeTypeId { get; set; } public virtual long? UpdateUserId { get; set; }
/// <summary> /// <summary>
/// 导出格式 /// 修改者姓名
/// </summary> /// </summary>
public string? ExportFormat { get; set; } public virtual string? UpdateUserName { get; set; }
/// <summary> /// <summary>
/// 条码前缀 /// 软删除
/// </summary> /// </summary>
public string? CodePrefix { get; set; } public virtual bool IsDelete { get; set; }
/// <summary> }
/// 内码前缀
/// </summary> /// <summary>
public string? InternalCodePrefix { get; set; } /// 码包配置分页查询输入参数
/// </summary>
/// <summary> public class CodePakageConfigurationInput : BasePageInput
/// 导出格式示例 {
/// </summary> /// <summary>
public string? ExportFormatExample { get; set; } /// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 序号
/// </summary>
public int? Index { get; set; }
/// <summary>
/// 码包配置名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public string? CodeType { get; set; }
/// <summary>
/// 条码类型ID
/// </summary>
public long? CodeTypeId { get; set; }
/// <summary>
/// 导出格式
/// </summary>
public string? ExportFormat { get; set; }
/// <summary>
/// 条码前缀
/// </summary>
public string? CodePrefix { get; set; }
/// <summary>
/// 内码前缀
/// </summary>
public string? InternalCodePrefix { get; set; }
/// <summary>
/// 导出格式示例
/// </summary>
public string? ExportFormatExample { get; set; }
/// <summary> /// <summary>
/// 条码长度 /// 条码长度
/// </summary> /// </summary>
@ -161,43 +166,43 @@ namespace Admin.NET.Application;
} }
/// <summary>
/// 码包配置增加输入参数
/// </summary>
public class AddCodePakageConfigurationInput : CodePakageConfigurationBaseInput
{
/// <summary> /// <summary>
/// 码包配置增加输入参数 /// 软删除
/// </summary> /// </summary>
public class AddCodePakageConfigurationInput : CodePakageConfigurationBaseInput [Required(ErrorMessage = "软删除不能为空")]
{ public override bool IsDelete { get; set; }
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
}
}
/// <summary>
/// 码包配置删除输入参数
/// </summary>
public class DeleteCodePakageConfigurationInput : BaseIdInput
{
}
/// <summary>
/// 码包配置更新输入参数
/// </summary>
public class UpdateCodePakageConfigurationInput : CodePakageConfigurationBaseInput
{
/// <summary> /// <summary>
/// 码包配置删除输入参数 /// 主键Id
/// </summary> /// </summary>
public class DeleteCodePakageConfigurationInput : BaseIdInput [Required(ErrorMessage = "主键Id不能为空")]
{ public long Id { get; set; }
}
/// <summary> }
/// 码包配置更新输入参数
/// </summary>
public class UpdateCodePakageConfigurationInput : CodePakageConfigurationBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary> /// <summary>
/// 码包配置主键查询输入参数 /// 码包配置主键查询输入参数
/// </summary> /// </summary>
public class QueryByIdCodePakageConfigurationInput : DeleteCodePakageConfigurationInput public class QueryByIdCodePakageConfigurationInput : DeleteCodePakageConfigurationInput
{ {
} }

View File

@ -60,6 +60,11 @@ public class CodePakageConfigurationOutput
/// </summary> /// </summary>
public virtual string? SuffixType { get; set; } public virtual string? SuffixType { get; set; }
/// <summary>
/// 单位组
/// </summary>
public long? UnitGroupId { get; set; }
/// <summary> /// <summary>
/// 租户Id /// 租户Id
/// </summary> /// </summary>

View File

@ -29,7 +29,11 @@ public class PrintDataMaterialsInput
/// 码类型 /// 码类型
/// </summary> /// </summary>
public string? CodeType { get; set; } public string? CodeType { get; set; }
/// <summary>
/// 单位组
/// </summary>
public long? UnitGroupId { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>

View File

@ -14,13 +14,16 @@ public class PrintDataService : IDynamicApiController, ITransient
private readonly SqlSugarRepository<PrintData> _rep; private readonly SqlSugarRepository<PrintData> _rep;
private readonly CodeElementService _codeElementService; private readonly CodeElementService _codeElementService;
private readonly CodeElementPropService _codeElementPropService; private readonly CodeElementPropService _codeElementPropService;
private readonly CodePakageConfigurationService _codePakageConfigurationService;
public PrintDataService(SqlSugarRepository<PrintData> rep, public PrintDataService(SqlSugarRepository<PrintData> rep,
CodeElementService codeElementService, CodeElementService codeElementService,
CodeElementPropService codeElementPropService) CodeElementPropService codeElementPropService,
CodePakageConfigurationService codePakageConfigurationService)
{ {
_rep = rep; _rep = rep;
_codeElementService = codeElementService; _codeElementService = codeElementService;
_codeElementPropService = codeElementPropService; _codeElementPropService = codeElementPropService;
_codePakageConfigurationService = codePakageConfigurationService;
} }
/// <summary> /// <summary>
@ -107,26 +110,30 @@ public class PrintDataService : IDynamicApiController, ITransient
[ApiDescriptionSettings(Name = "GetPrintDataList")] [ApiDescriptionSettings(Name = "GetPrintDataList")]
public async Task<List<PrintData>> GetPrintDataList(PrintDataMaterialsInput input) public async Task<List<PrintData>> GetPrintDataList(PrintDataMaterialsInput input)
{ {
return await GetPrintDatas(input.CodeHead, input.CodeType, input.Count); return await GetPrintDatas(input.UnitGroupId, input.CodeHead, input.CodeType, input.Count);
} }
public async Task<List<PrintData>> GetPrintDatas(string codeName,string codeType,int count) public async Task<List<PrintData>> GetPrintDatas(long? unitGroupId, string codeName,string codeType,int count)
{ {
var result = new List<PrintData>(); var result = new List<PrintData>();
if (string.IsNullOrEmpty(codeName)) if (string.IsNullOrEmpty(codeName))
{ {
return result; return result;
} }
var elem = await _codeElementService.GetElementByName(codeName); var elem = await _codeElementService.GetElementByName(codeName, unitGroupId);
if (elem == null) if (elem == null)
{ return result; } { return result; }
var config = await _codePakageConfigurationService.GetConfigByName(codeName, unitGroupId);
if (config == null)
{ return result; }
var elemProp = await _codeElementPropService.CodePropByElement(new CodeElementOutput() { Id = elem.Id, CodeLength = elem.CodeLength }); var elemProp = await _codeElementPropService.CodePropByElement(new CodeElementOutput() { Id = elem.Id, CodeLength = elem.CodeLength });
if (elemProp.Count > 0) if (elemProp.Count > 0)
{ {
var prefix = (string.IsNullOrEmpty(config.CodePrefix) || codeType == "条形码") ? "" : config.CodePrefix;
elemProp = elemProp.OrderBy(a => a.Index).ToList(); elemProp = elemProp.OrderBy(a => a.Index).ToList();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
var code = GetCodeNumByProp(elemProp, i + 1); var code = prefix + GetCodeNumByProp(elemProp, i + 1);
if (codeType == "条形码") if (codeType == "条形码")
{ {
result.Add(new PrintData() { BarCode = code }); result.Add(new PrintData() { BarCode = code });

View File

@ -2,6 +2,8 @@
using Admin.NET.Application.Const; using Admin.NET.Application.Const;
using Admin.NET.Application.Entity; using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Admin.NET.Application.Utils;
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary> /// <summary>
/// 汇报单详情服务 /// 汇报单详情服务
@ -191,7 +193,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
Dictionary<AddPrintCodeDetailInput, long> list = new Dictionary<AddPrintCodeDetailInput, long>(); Dictionary<AddPrintCodeDetailInput, long> list = new Dictionary<AddPrintCodeDetailInput, long>();
foreach (var item in topDatas) foreach (var item in topDatas)
{ {
var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode; var code = CodeHelper.GetCode(item.BarCode, item.QrCode);
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码"; var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
var unit = units.Find(a => a.Name == item.PackageName); var unit = units.Find(a => a.Name == item.PackageName);
@ -215,7 +217,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var childs = input.CodeDatas.FindAll(a => a.FatherCode == code); var childs = input.CodeDatas.FindAll(a => a.FatherCode == code);
foreach (var child in childs) foreach (var child in childs)
{ {
var code2 = string.IsNullOrEmpty(child.BarCode) ? child.QrCode : child.BarCode; var code2 = CodeHelper.GetCode(child.BarCode, child.QrCode);
var unit2 = units.Find(a => a.Name == child.PackageName); var unit2 = units.Find(a => a.Name == child.PackageName);
var detail2 = new AddPrintCodeDetailInput() var detail2 = new AddPrintCodeDetailInput()
{ {
@ -239,7 +241,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var childs3 = input.CodeDatas.FindAll(a => a.FatherCode == code2); var childs3 = input.CodeDatas.FindAll(a => a.FatherCode == code2);
foreach (var child3 in childs3) foreach (var child3 in childs3)
{ {
var code3 = string.IsNullOrEmpty(child3.BarCode) ? child3.QrCode : child3.BarCode; var code3 = CodeHelper.GetCode(child3.BarCode, child3.QrCode);
var unit3 = units.Find(a => a.Name == child3.PackageName); var unit3 = units.Find(a => a.Name == child3.PackageName);
var detail3 = new AddPrintCodeDetailInput() var detail3 = new AddPrintCodeDetailInput()
{ {
@ -264,7 +266,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var childs4 = input.CodeDatas.FindAll(a => a.FatherCode == code3); var childs4 = input.CodeDatas.FindAll(a => a.FatherCode == code3);
foreach (var child4 in childs4) foreach (var child4 in childs4)
{ {
var code4 = string.IsNullOrEmpty(child4.BarCode) ? child4.QrCode : child4.BarCode; var code4 = CodeHelper.GetCode(child4.BarCode, child4.QrCode);
var unit4 = units.Find(a => a.Name == child4.PackageName); var unit4 = units.Find(a => a.Name == child4.PackageName);
var detail4 = new AddPrintCodeDetailInput() var detail4 = new AddPrintCodeDetailInput()
{ {
@ -289,7 +291,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var childs5 = input.CodeDatas.FindAll(a => a.FatherCode == code4); var childs5 = input.CodeDatas.FindAll(a => a.FatherCode == code4);
foreach (var child5 in childs5) foreach (var child5 in childs5)
{ {
var code5 = string.IsNullOrEmpty(child5.BarCode) ? child5.QrCode : child5.BarCode; var code5 = CodeHelper.GetCode(child5.BarCode, child5.QrCode);
var unit5 = units.Find(a => a.Name == child5.PackageName); var unit5 = units.Find(a => a.Name == child5.PackageName);
var detail5 = new AddPrintCodeDetailInput() var detail5 = new AddPrintCodeDetailInput()
{ {

View File

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Http;
using Admin.NET.Application.Service.ReportTable.Dto; using Admin.NET.Application.Service.ReportTable.Dto;
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types; using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types;
using Nest; using Nest;
using Admin.NET.Application.Utils;
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary> /// <summary>
@ -266,7 +267,7 @@ public class ReportTableService : IDynamicApiController, ITransient
tempUnits.AddRange(others); tempUnits.AddRange(others);
foreach (var item in input.PrintDatas) foreach (var item in input.PrintDatas)
{ {
var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode; var code = CodeHelper.GetCode(item.BarCode, item.BarCode);
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码"; var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
var detail = new AddPrintCodeDetailInput() var detail = new AddPrintCodeDetailInput()
{ {
@ -291,10 +292,10 @@ public class ReportTableService : IDynamicApiController, ITransient
} }
treeData1.Children = new List<PrintCodeTreeData>(); treeData1.Children = new List<PrintCodeTreeData>();
var currUnit = tempUnits.FirstOrDefault(); var currUnit = tempUnits.FirstOrDefault();
var printDatas = await _printDataService.GetPrintDatas(currUnit.Name, codeType, unit.ChildUnitCount); var printDatas = await _printDataService.GetPrintDatas(input.UnitGroupId, currUnit.Name, codeType, unit.ChildUnitCount);
foreach (var dt in printDatas) foreach (var dt in printDatas)
{ {
var code2 = string.IsNullOrEmpty(dt.BarCode) ? dt.QrCode : dt.BarCode; var code2 = CodeHelper.GetCode(dt.BarCode, dt.QrCode);
var detail2 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code, FatherId = detailId, Code = code2, ChildCount = currUnit.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit.Name, BaseCount = currUnit.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName }; var detail2 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code, FatherId = detailId, Code = code2, ChildCount = currUnit.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit.Name, BaseCount = currUnit.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
var detailId2 = await _codeDetailService.Add(detail2); var detailId2 = await _codeDetailService.Add(detail2);
var treeData2 = detail2.Adapt<PrintCodeTreeData>(); var treeData2 = detail2.Adapt<PrintCodeTreeData>();
@ -302,10 +303,10 @@ public class ReportTableService : IDynamicApiController, ITransient
{ {
treeData2.Children = new List<PrintCodeTreeData>(); treeData2.Children = new List<PrintCodeTreeData>();
var currUnit3 = tempUnits[1]; var currUnit3 = tempUnits[1];
var printDatas3 = await _printDataService.GetPrintDatas(currUnit3.Name, codeType, currUnit.ChildUnitCount); var printDatas3 = await _printDataService.GetPrintDatas(input.UnitGroupId, currUnit3.Name, codeType, currUnit.ChildUnitCount);
foreach (var dt3 in printDatas3) foreach (var dt3 in printDatas3)
{ {
var code3 = string.IsNullOrEmpty(dt3.BarCode) ? dt3.QrCode : dt3.BarCode; var code3 = CodeHelper.GetCode(dt3.BarCode, dt3.QrCode);
var detail3 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code2, FatherId = detailId2, Code = code3, ChildCount = currUnit3.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit3.Name, BaseCount = currUnit3.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName }; var detail3 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code2, FatherId = detailId2, Code = code3, ChildCount = currUnit3.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit3.Name, BaseCount = currUnit3.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
var detailId3 = await _codeDetailService.Add(detail3); var detailId3 = await _codeDetailService.Add(detail3);
var treeData3 = detail3.Adapt<PrintCodeTreeData>(); var treeData3 = detail3.Adapt<PrintCodeTreeData>();
@ -313,10 +314,10 @@ public class ReportTableService : IDynamicApiController, ITransient
{ {
treeData3.Children = new List<PrintCodeTreeData>(); treeData3.Children = new List<PrintCodeTreeData>();
var currUnit4 = tempUnits[2]; var currUnit4 = tempUnits[2];
var printDatas4 = await _printDataService.GetPrintDatas(currUnit4.Name, codeType, currUnit3.ChildUnitCount); var printDatas4 = await _printDataService.GetPrintDatas(input.UnitGroupId, currUnit4.Name, codeType, currUnit3.ChildUnitCount);
foreach (var dt4 in printDatas4) foreach (var dt4 in printDatas4)
{ {
var code4 = string.IsNullOrEmpty(dt4.BarCode) ? dt4.QrCode : dt4.BarCode; var code4 = CodeHelper.GetCode(dt4.BarCode, dt4.QrCode);
var detail4 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code3, FatherId = detailId3, Code = code4, ChildCount = currUnit4.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit4.Name, BaseCount = currUnit4.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName }; var detail4 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code3, FatherId = detailId3, Code = code4, ChildCount = currUnit4.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit4.Name, BaseCount = currUnit4.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
var treeData4 = detail4.Adapt<PrintCodeTreeData>(); var treeData4 = detail4.Adapt<PrintCodeTreeData>();
treeData3.Children.Add(treeData4); treeData3.Children.Add(treeData4);

View File

@ -56,6 +56,16 @@ internal class CodeHelper
} }
return stringBuilder.ToString(); return stringBuilder.ToString();
} }
public static string GetCode(string? barCode, string? qrCode)
{
var code = string.IsNullOrEmpty(barCode) ? qrCode : barCode;
if (code.Contains("?code="))
{
code = code.Split('=').LastOrDefault();
}
return code;
}
public static string GetCodeUpLetter(int codeLen) public static string GetCodeUpLetter(int codeLen)
{ {
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

View File

@ -91,6 +91,18 @@ public class Startup : AppStartup
options.KnownProxies.Clear(); options.KnownProxies.Clear();
}); });
//跨域问题6.21
//services.AddCors(options =>
//{
// options.AddPolicy("MyCorsPolicy",
// builder =>
// {
// builder.WithOrigins("https://whois.pconline.com.cn/ipJson.jsp?ip=&json=true") // 允许的域
// .AllowAnyHeader()
// .AllowAnyMethod();
// });
//});
// 限流服务 // 限流服务
services.AddInMemoryRateLimiting(); services.AddInMemoryRateLimiting();
services.AddSingleton<IRateLimitConfiguration, RateLimitConfiguration>(); services.AddSingleton<IRateLimitConfiguration, RateLimitConfiguration>();
@ -192,6 +204,8 @@ public class Startup : AppStartup
ContentTypeProvider = contentTypeProvider ContentTypeProvider = contentTypeProvider
}); });
//app.UseCors("MyCorsPolicy");
//// 启用HTTPS //// 启用HTTPS
//app.UseHttpsRedirection(); //app.UseHttpsRedirection();

View File

@ -3,9 +3,11 @@ enum Api {
AddCodeElement = '/api/codeElement/add', AddCodeElement = '/api/codeElement/add',
DeleteCodeElement = '/api/codeElement/delete', DeleteCodeElement = '/api/codeElement/delete',
UpdateCodeElement = '/api/codeElement/update', UpdateCodeElement = '/api/codeElement/update',
PageCodeElement = '/api/codeElement/page', PageCodeElement = '/api/codeElement/page',//ListByGroupId
DetailCodeElement = '/api/codeElement/detail', DetailCodeElement = '/api/codeElement/detail',
GetCodeConfig = '/api/codePakageConfiguration/list', GetCodeConfig = '/api/codePakageConfiguration/list',
ListByGroupId = '/api/codeElement/listByGroupId',
ConfigByGroupId = '/api/codePakageConfiguration/listByGroupId',
} }
// 增加码元素 // 增加码元素
@ -54,3 +56,20 @@ export const getCodeConfig = () =>
url: Api.GetCodeConfig, url: Api.GetCodeConfig,
method: 'get', method: 'get',
}); });
// 详情码包配置
export const listByGroupId = (unitGroupId: any) =>
request({
url: Api.ListByGroupId,
method: 'get',
data: { unitGroupId },
});
// 详情码包配置
export const configByGroupId = (unitGroupId: any) =>
request({
url: Api.ConfigByGroupId,
method: 'get',
data: { unitGroupId },
});

View File

@ -7,6 +7,7 @@ enum Api {
UpdateCodePakageConfiguration = '/api/codePakageConfiguration/update', UpdateCodePakageConfiguration = '/api/codePakageConfiguration/update',
PageCodePakageConfiguration = '/api/codePakageConfiguration/page', PageCodePakageConfiguration = '/api/codePakageConfiguration/page',
DetailCodePakageConfiguration = '/api/codePakageConfiguration/detail', DetailCodePakageConfiguration = '/api/codePakageConfiguration/detail',
ListByGroupId = '/api/codePakageConfiguration/listByGroupId',
} }
// 增加码包配置 // 增加码包配置
@ -49,16 +50,6 @@ export const detailCodePakageConfiguration = (id: any) =>
data: { id }, data: { id },
}); });
export const removeDuplicates=(persons: any[] | undefined) : any[]=> {
const uniquePersons = new Map<string, any>();
for (const person of persons) {
if (!uniquePersons.has(person.name)) {
uniquePersons.set(person.name, person);
}
}
return Array.from(uniquePersons.values());
}
export const padNumberToLength=(num: number, length: number) : string=> { export const padNumberToLength=(num: number, length: number) : string=> {
let numStr = num.toString(); let numStr = num.toString();
@ -69,3 +60,10 @@ export const padNumberToLength=(num: number, length: number) : string=> {
} }
// 详情码包配置
export const listByGroupId = (unitGroupId: any) =>
request({
url: Api.ListByGroupId,
method: 'get',
data: { unitGroupId },
});

View File

@ -7,6 +7,7 @@ enum Api {
DetailUnit = '/api/sysUnit/detail', DetailUnit = '/api/sysUnit/detail',
ListUnit = '/api/sysUnit/list', ListUnit = '/api/sysUnit/list',
ListUnitGroup = '/api/sysUnit/listByGroupId', ListUnitGroup = '/api/sysUnit/listByGroupId',
UnitGroupList = '/api/sysUnitGroup/list',
} }
// 增加单位 // 增加单位
@ -64,3 +65,11 @@ export const listUnitGroup = (unitGroupId: any) =>
method: 'get', method: 'get',
data: { unitGroupId }, data: { unitGroupId },
}); });
// 单位组列表
export const unitGroups = () =>
request({
url: Api.UnitGroupList,
method: 'get',
data: { },
});

View File

@ -51,6 +51,18 @@ export function formatDate(date: Date, format: string): string {
return format; return format;
} }
export function getCurrentDate(): string {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
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}`;
}
/** /**
* *
* @param dateTime * @param dateTime

View File

@ -2,22 +2,22 @@
<template> <template>
<div class="sys-open-access-container"> <div class="sys-open-access-container">
<el-dialog v-model="state.isShowDialog" :title="props.title" width="1000"> <el-dialog v-model="state.isShowDialog" :title="props.title" width="1000">
<el-form :inline="true" :model="state.matterFrom" class="demo-form-inline" label-width="90px"> <el-form :inline="true" :model="ruleForm" class="demo-form-inline" label-width="90px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="名称" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]"> <el-form-item label="名称" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
<el-input v-model="state.matterFrom.name" placeholder="请输入名称" clearable /> <el-input v-model="ruleForm.name" placeholder="请输入名称" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="编码" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]"> <el-form-item label="编码" >
<el-input v-model="state.matterFrom.codeNum" placeholder="请输入编码" clearable /> <el-input v-model="ruleForm.codeNum" placeholder="请输入编码" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="分类" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]"> <el-form-item label="分类" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.classify" placeholder="请选择" clearable> <el-select v-model="ruleForm.classify" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in fyListData" <el-option :label="item.name" :value="item.id" v-for="item, index in fyListData"
:key="index" /> :key="index" />
</el-select> </el-select>
@ -28,23 +28,23 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="规格型号"> <el-form-item label="规格型号">
<el-input v-model="state.matterFrom.specifications" placeholder="请输入" clearable /> <el-input v-model="ruleForm.specifications" placeholder="请输入" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="助记码"> <el-form-item label="助记码">
<el-input v-model="state.matterFrom.simpleNumber" placeholder="请输入" clearable /> <el-input v-model="ruleForm.simpleNumber" placeholder="请输入" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model="state.matterFrom.remarks" placeholder="请输入" clearable /> <el-input v-model="ruleForm.remarks" placeholder="请输入" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="可用状态"> <el-form-item label="可用状态">
<el-switch v-model="state.matterFrom.isEnable" inline-prompt active-text="" inactive-text="" /> <el-switch v-model="ruleForm.isEnable" inline-prompt active-text="" inactive-text="" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" :key="key"> <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" :key="key">
@ -52,31 +52,35 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="品牌"> <el-form-item label="品牌">
<el-select v-model="state.matterFrom.brand" placeholder="请选择" clearable> <el-select v-model="ruleForm.brand" placeholder="请选择" clearable>
<el-option v-for="item in brandDate" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in brandDate" :key="item.id" :label="item.name" :value="item.name" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="保质期"> <el-form-item label="保质期">
<el-input v-model="state.matterFrom.shelfLife" placeholder="请输入保质期" clearable /> <el-input v-model="ruleForm.shelfLife" placeholder="请输入保质期" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="保质期单位"> <el-form-item label="保质期单位">
<el-input v-model="state.matterFrom.shelfLifeUnit" placeholder="请输入保质期单位" clearable /> <el-select v-model="ruleForm.shelfLifeUnit" placeholder="请选择保质期单位" clearable>
<el-option label="年" value= '年' />
<el-option label="月" value= '月' />
<el-option label="日" value= '日' />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="商品条形码"> <el-form-item label="商品条形码">
<el-input v-model="state.matterFrom.barCode" placeholder="请输入商品条形码" clearable /> <el-input v-model="ruleForm.barCode" placeholder="请输入商品条形码" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="统一零售价"> <el-form-item label="统一零售价">
<el-input v-model="state.matterFrom.price" placeholder="请输入统一零售价" clearable /> <el-input v-model="ruleForm.price" placeholder="请输入统一零售价" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -85,7 +89,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="单位组" prop="unitGroupId" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]"> <el-form-item label="单位组" prop="unitGroupId" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange"> <el-select v-model="ruleForm.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange">
<el-option v-for="item in state.unitGroupData" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in state.unitGroupData" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -93,14 +97,14 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="基本单位" prop="unit" :rules="[{ required: true, message: '基本单位不能为空', trigger: 'blur' }]"> <el-form-item label="基本单位" prop="unit" :rules="[{ required: true, message: '基本单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.unit" placeholder="基本单位" filterable default-first-option style="width: 100%"> <el-select v-model="ruleForm.unit" placeholder="基本单位" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="生产单位" prop="productUnit" :rules="[{ required: true, message: '生产单位不能为空', trigger: 'blur' }]"> <el-form-item label="生产单位" prop="productUnit" :rules="[{ required: true, message: '生产单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.productUnit" placeholder="生产单位" filterable default-first-option style="width: 100%"> <el-select v-model="ruleForm.productUnit" placeholder="生产单位" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -110,21 +114,21 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="采购单位" prop="procureUnit" :rules="[{ required: true, message: '采购单位不能为空', trigger: 'blur' }]"> <el-form-item label="采购单位" prop="procureUnit" :rules="[{ required: true, message: '采购单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.procureUnit" placeholder="采购单位" filterable default-first-option style="width: 100%"> <el-select v-model="ruleForm.procureUnit" placeholder="采购单位" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="库存单位" prop="inventoryUnit" :rules="[{ required: true, message: '库存单位不能为空', trigger: 'blur' }]"> <el-form-item label="库存单位" prop="inventoryUnit" :rules="[{ required: true, message: '库存单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.inventoryUnit" placeholder="库存单位" filterable default-first-option style="width: 100%"> <el-select v-model="ruleForm.inventoryUnit" placeholder="库存单位" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="销售单位" prop="saleUnit" :rules="[{ required: true, message: '销售单位不能为空', trigger: 'blur' }]"> <el-form-item label="销售单位" prop="saleUnit" :rules="[{ required: true, message: '销售单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.saleUnit" placeholder="销售单位" filterable default-first-option style="width: 100%"> <el-select v-model="ruleForm.saleUnit" placeholder="销售单位" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -134,7 +138,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="分销单位" prop="retailStoreUnit" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]"> <el-form-item label="分销单位" prop="retailStoreUnit" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.retailStoreUnit" placeholder="分销单位" filterable default-first-option style="width: 100%"> <el-select v-model="ruleForm.retailStoreUnit" placeholder="分销单位" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -185,19 +189,21 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive, ref, watch } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import { getAPI } from '/@/utils/axios-utils'; import { getAPI } from '/@/utils/axios-utils';
import { BrandApi, MaterialClassifyApi, MaterialsApi, PackageInfoApi, SysUnitGroupApi,SysUnitApi } from '/@/api-services/api'; import { BrandApi, MaterialClassifyApi, PackageInfoApi, SysUnitGroupApi,SysUnitApi } from '/@/api-services/api';
import { AddMaterialsInput, BrandOutput, UpdateMaterialsInput, MaterialsOutput, PackageInfoOutput, SysUnitGroupOutput, SysUnitOutput} from '/@/api-services/models'; import { AddMaterialsInput, BrandOutput, MaterialsOutput, PackageInfoOutput, SysUnitGroupOutput, SysUnitOutput} from '/@/api-services/models';
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus'; import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
import { addMaterials, updateMaterials,detailMaterials } from '/@/api/main/materials';
import { listUnitGroup } from '/@/api/main/unit';
const props = defineProps({ const props = defineProps({
title: String, title: String,
orgData: Array<MaterialsOutput>, orgData: Array<MaterialsOutput>,
}); });
const emits = defineEmits(['handleQuery']); //
const emit = defineEmits(["reloadTable"]);
const ruleFormRef = ref();
// //
let fyListData = ref(); let fyListData = ref();
@ -208,13 +214,15 @@ const fyListGet = async () => {
} }
} }
const ruleForm = ref<any>({});
const state = reactive({ const state = reactive({
loading: false, loading: false,
isShowDialog:false, isShowDialog:false,
editOpenAccessTitle:'新增', editOpenAccessTitle:'新增',
tableData: [] as Array<MaterialsOutput>, tableData: [] ,//as Array<MaterialsOutput>
orgTreeData: [] as Array<MaterialsOutput>, orgTreeData: [] ,//as Array<MaterialsOutput>
matterFrom: {} as AddMaterialsInput, //matterFrom: {} ,//as AddMaterialsInput
queryParams: { queryParams: {
name: undefined, name: undefined,
}, },
@ -230,25 +238,24 @@ const state = reactive({
// //
const openDialog = async (row: any) => { const openDialog = async (row: any) => {
ruleFormRef.value?.resetFields(); //ruleFormRef.value?.resetFields();
//state.selectedTabName = '0'; // tab //state.selectedTabName = '0'; // tab
//let rowData = JSON.parse(JSON.stringify(row)); let rowData = JSON.parse(JSON.stringify(row));
if (row.id != undefined) { if (rowData.id)
state.matterFrom=row; ruleForm.value = (await detailMaterials(rowData.id)).data.result;
//var resRole = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id); else{
//state.ruleForm.roleIdList = resRole.data.result; ruleForm.value = rowData;
}else{ ruleForm.value.isEnable=true;
state.matterFrom.isEnable=true; ruleForm.value.codeNum = 'WL'+ getCurrentDate();
} }
state.isShowDialog = true; state.isShowDialog = true;
}; };
//
// const closeDialog = () => {
const closeDialog = () => { emit("reloadTable");
emits('handleQuery'); state.isShowDialog = false;
state.isShowDialog = false; };
};
onMounted(() => { onMounted(() => {
fyListGet(); fyListGet();
@ -261,7 +268,6 @@ onMounted(() => {
const onSubmit = () => { const onSubmit = () => {
console.log('submit!') console.log('submit!')
} }
// //
@ -302,42 +308,27 @@ const handleClick = (tab: TabsPaneContext, event: Event) => {
// }; // };
let key = ref(0) let key = ref(0)
// watch(state.isShowDialog, (newValue, oldValue) => {
// if (!newValue) {
// clearFormValues(state.matterFrom)
// infoDate = [];
// activeName.value = '';
// }else{
// key.value = Math.random();
// }
// })
// //
const matterSubmit = async () => { const matterSubmit = async () => {
let res; let res;
//console.log(state.matterFrom); //console.log(ruleForm);
if (props.title=='新增'){ if (props.title=='添加物料'){
res = await getAPI(MaterialsApi).apiMaterialsAddPost(state.matterFrom); res = await addMaterials(ruleForm.value);
} }
else { else {
let update = {} as UpdateMaterialsInput res = await updateMaterials(ruleForm.value);
Object.assign(update,state.matterFrom)
res = await getAPI(MaterialsApi).apiMaterialsUpdatePost(update);
//await UpdateInfoApi(infoDate)
} }
// console.log('res'); if (res.code === 200) {
// console.log(res);
if (res.data.code === 200) {
state.isShowDialog = false; state.isShowDialog = false;
ElMessage({ ElMessage({
message: '成功', message: '成功',
type: 'success', type: 'success',
}) })
//state.tableData.handleList(); //state.tableData.handleList();
} else }
ElMessage.error(res.data.message!) else
ElMessage.error(res.message!)
//MaterialsPage({}) //MaterialsPage({})
closeDialog(); closeDialog();
} }
@ -374,13 +365,26 @@ const UpdateInfoApi = async (paramsList: any[]) => {
* @param clearBindUserId 是否清空 * @param clearBindUserId 是否清空
*/ */
const unitGroupChange = async (clearBindUserId: boolean = true) => { const unitGroupChange = async (clearBindUserId: boolean = true) => {
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(state.matterFrom.unitGroupId ?? 0); var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(ruleForm.value.unitGroupId ?? 0);
state.unitData = res.data.result ?? []; state.unitData = res.data.result ?? [];
if (clearBindUserId) { if (clearBindUserId) {
//state.matterFrom.id = undefined!; //ruleForm.id = undefined!;
} }
}; };
function getCurrentDate(): string {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
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}`;
}
// //
defineExpose({ openDialog }); defineExpose({ openDialog });
</script> </script>

View File

@ -16,6 +16,13 @@
<el-input v-model="ruleForm.codeLength" /> <el-input v-model="ruleForm.codeLength" />
</el-form-item> </el-form-item>
<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="unitGroupId" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange">
<el-option v-for="item in unitGroup" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item prop="codeName" label="码包名称" :rules="[{ required: true, message: '码包名称不能为空', trigger: 'blur' }]"> <el-form-item prop="codeName" label="码包名称" :rules="[{ required: true, message: '码包名称不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.codeName" @change="formOnActivated" placeholder="请选择" clearable> <el-select v-model="ruleForm.codeName" @change="formOnActivated" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.name" v-for="item, index in codeConfigData" :key="index" /> <el-option :label="item.name" :value="item.name" v-for="item, index in codeConfigData" :key="index" />
@ -56,7 +63,8 @@
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import type { FormRules } from "element-plus"; import type { FormRules } from "element-plus";
import { addCodeElement, updateCodeElement, detailCodeElement ,getCodeConfig} from "/@/api/main/codeElement"; import { addCodeElement, updateCodeElement, detailCodeElement ,getCodeConfig,listByGroupId, configByGroupId} from "/@/api/main/codeElement";
import { unitGroups } from '/@/api/main/unit';
// //
var props = defineProps({ var props = defineProps({
@ -74,6 +82,7 @@
const rules = ref<FormRules>({ const rules = ref<FormRules>({
}); });
const codeConfigData = ref<any>([]); const codeConfigData = ref<any>([]);
const unitGroup = ref<any>([]);
// //
const openDialog = async (row: any) => { const openDialog = async (row: any) => {
@ -131,10 +140,26 @@
ruleForm.value.codeLength=codeConfigData.value.find(a=>a.name==value).codeLength; ruleForm.value.codeLength=codeConfigData.value.find(a=>a.name==value).codeLength;
} }
/**
* 单位组值变更
* @param clearBindUserId 是否清空
*/
const unitGroupChange = async (clearBindUserId: boolean = true) => {
var res = await configByGroupId(ruleForm.value.unitGroupId ?? 0);
codeConfigData.value = res.data.result ?? [];
if (clearBindUserId) {
//ruleForm.id = undefined!;
}
};
//
const unitData = async () => {
unitGroup.value = (await unitGroups()).data.result;
}
// //
onMounted(async () => { onMounted(async () => {
handleCodeConfigQuery(); unitData();
//handleCodeConfigQuery();
}); });
// //

View File

@ -36,6 +36,15 @@
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item label="单位组" prop="unitGroupId" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange">
<el-option v-for="item in unitGroup" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px"> <el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table <el-table
:data="tableData" :data="tableData"
@ -87,13 +96,12 @@
import { ElMessageBox, ElMessage } from "element-plus"; import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction'; import { auth } from '/@/utils/authFunction';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { formatDate } from '/@/utils/formatTime';
///@/views/labelPrinting/codeElement/component/editDialog.vue ///@/views/labelPrinting/codeElement/component/editDialog.vue
import editDialog from '/@/views/labelPrinting/codeElement/component/editDialog.vue' import editDialog from '/@/views/labelPrinting/codeElement/component/editDialog.vue'
import editElementDialog from '/@/views/labelPrinting/codeElement/component/editElementDialog.vue' import editElementDialog from '/@/views/labelPrinting/codeElement/component/editElementDialog.vue'
import { pageCodeElement, deleteCodeElement} from '/@/api/main/codeElement'; import { pageCodeElement, deleteCodeElement, listByGroupId} from '/@/api/main/codeElement';
import { unitGroups } from '/@/api/main/unit';
const showAdvanceQueryUI = ref(false); const showAdvanceQueryUI = ref(false);
const editDialogRef = ref(); const editDialogRef = ref();
@ -110,6 +118,14 @@
const editCodeElementTitle = ref(""); const editCodeElementTitle = ref("");
const editElementTitle = ref(""); const editElementTitle = ref("");
const ruleForm = ref<any>({});
const unitGroup = ref<any>([])
//
const getUnitGroup = async () => {
unitGroup.value = (await unitGroups()).data.result;
}
// //
const changeAdvanceQueryUI = () => { const changeAdvanceQueryUI = () => {
showAdvanceQueryUI.value = !showAdvanceQueryUI.value; showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
@ -180,7 +196,20 @@
handleQuery(); handleQuery();
}; };
/**
* 单位组值变更
* @param clearBindUserId 是否清空
*/
const unitGroupChange = async (clearBindUserId: boolean = true) => {
console.log('object');
var res = await listByGroupId(ruleForm.value.unitGroupId ?? 0);
tableData.value = res.data.result ?? [];
tableParams.value.total = res.data.result?.count ?? 0;
};
onMounted(() => {
getUnitGroup();
})
handleQuery(); handleQuery();
</script> </script>
<style scoped> <style scoped>

View File

@ -12,6 +12,13 @@
<el-form-item v-show="false"> <el-form-item v-show="false">
<el-input v-model="ruleForm.id" /> <el-input v-model="ruleForm.id" />
</el-form-item> </el-form-item>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="单位组" prop="unitGroupId" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange">
<el-option v-for="item in unitGroup" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</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="码包名称" :rules="[{ required: true, message: '码包名称不能为空', trigger: 'blur' }]"> <el-form-item label="码包名称" :rules="[{ required: true, message: '码包名称不能为空', trigger: 'blur' }]">
@ -95,8 +102,8 @@
import { getAPI } from '/@/utils/axios-utils'; import { getAPI } from '/@/utils/axios-utils';
import {SysUnitOutput} from '/@/api-services/models'; import {SysUnitOutput} from '/@/api-services/models';
import { SysUnitApi } from '/@/api-services/api'; import { SysUnitApi } from '/@/api-services/api';
import { addCodePakageConfiguration, updateCodePakageConfiguration, detailCodePakageConfiguration , removeDuplicates,padNumberToLength} from "/@/api/main/codePakageConfiguration"; import { addCodePakageConfiguration, updateCodePakageConfiguration, detailCodePakageConfiguration , padNumberToLength} from "/@/api/main/codePakageConfiguration";
import { unitGroups } from '/@/api/main/unit';
// //
var props = defineProps({ var props = defineProps({
title: { title: {
@ -118,12 +125,12 @@
unit: [] as SysUnitOutput[],// unit: [] as SysUnitOutput[],//
}); });
const unitGroup = ref<any>([])
// //
const unitData = async () => { const unitData = async () => {
console.log('unit'); unitGroup.value = (await unitGroups()).data.result;
let res = await getAPI(SysUnitApi).apiSysUnitListGet();
data.unit = removeDuplicates(res.data.result) || [];
//data.unitname
} }
// //
@ -136,7 +143,6 @@
else{ else{
ruleForm.value = rowData; ruleForm.value = rowData;
ruleForm.value.exportFormat='条码' ruleForm.value.exportFormat='条码'
} }
isShowDialog.value = true; isShowDialog.value = true;
}; };
@ -179,7 +185,17 @@
ruleForm.value.exportFormatExample = padNumberToLength(5,ruleForm.value.codeLength); ruleForm.value.exportFormatExample = padNumberToLength(5,ruleForm.value.codeLength);
}; };
/**
* 单位组值变更
* @param clearBindUserId 是否清空
*/
const unitGroupChange = async (clearBindUserId: boolean = true) => {
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(ruleForm.value.unitGroupId ?? 0);
data.unit = res.data.result ?? [];
if (clearBindUserId) {
//ruleForm.id = undefined!;
}
};
// //

View File

@ -73,6 +73,15 @@
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item label="单位组" prop="unitGroupId" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange">
<el-option v-for="item in unitGroup" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px"> <el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table <el-table
:data="tableData" :data="tableData"
@ -129,7 +138,8 @@
import {SysUnitOutput,SysUnitInput} from '/@/api-services/models'; import {SysUnitOutput,SysUnitInput} from '/@/api-services/models';
import { SysUnitApi } from '/@/api-services/api'; import { SysUnitApi } from '/@/api-services/api';
import editDialog from '/@/views/labelPrinting/codePakageConfiguration/component/editDialog.vue' import editDialog from '/@/views/labelPrinting/codePakageConfiguration/component/editDialog.vue'
import { pageCodePakageConfiguration, deleteCodePakageConfiguration, removeDuplicates } from '/@/api/main/codePakageConfiguration'; import { pageCodePakageConfiguration, deleteCodePakageConfiguration,listByGroupId } from '/@/api/main/codePakageConfiguration';
import { unitGroups } from '/@/api/main/unit';
const showAdvanceQueryUI = ref(false); const showAdvanceQueryUI = ref(false);
@ -147,16 +157,16 @@
unit: [] as SysUnitOutput[],// unit: [] as SysUnitOutput[],//
}); });
const ruleForm = ref<any>({});
const unitGroup = ref<any>([])
// //
const unitData = async () => { const getUnitGroup = async () => {
console.log('unit'); unitGroup.value = (await unitGroups()).data.result;
let res = await getAPI(SysUnitApi).apiSysUnitListGet();
data.unit = removeDuplicates(res.data.result) || [];
//data.unitname
//console.log(data.unit);
} }
const editCodePakageConfigurationTitle = ref(""); const editCodePakageConfigurationTitle = ref("");
// //
@ -221,9 +231,23 @@
handleQuery(); handleQuery();
}; };
/**
* 单位组值变更
* @param clearBindUserId 是否清空
*/
const unitGroupChange = async (clearBindUserId: boolean = true) => {
console.log('object');
var res = await listByGroupId(ruleForm.value.unitGroupId ?? 0);
tableData.value = res.data.result ?? [];
tableParams.value.total = res.data.result?.count ?? 0;
};
handleQuery(); handleQuery();
onMounted(() => { onMounted(() => {
getUnitGroup();
//unitData() //unitData()
}) })

View File

@ -92,12 +92,10 @@ import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css'; import 'vue-json-pretty/lib/styles.css';
import {getCodeConfig} from "/@/api/main/codeElement"; import {getCodeConfig} from "/@/api/main/codeElement";
import { addReportTable, addPrintDetail} from "/@/api/main/reportTable"; import { addReportTable, addPrintDetail} from "/@/api/main/reportTable";
import { getCurrentDate } from '/@/utils/formatTime';
import { hiprint } from 'vue-plugin-hiprint'; import { hiprint } from 'vue-plugin-hiprint';
import providers from '../../print/component/hiprint/providers'; import providers from '../../print/component/hiprint/providers';
import PrintPreview from '../../print/component/hiprint/preview.vue'; import PrintPreview from '../../print/component/hiprint/preview.vue';
import { PrintDataApiFp } from '../../../../api-services/apis/print-data-api';
import { async } from '../../../../router/backEnd';
import detailForm from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue' import detailForm from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue'
const props = defineProps({ const props = defineProps({
@ -177,9 +175,10 @@ const printSubmit = async () => {
} }
hiprintTemplate.value.clear(); hiprintTemplate.value.clear();
hiprintTemplate.value?.update(JSON.parse(printInfoFrom.printDataTem)); hiprintTemplate.value?.update(JSON.parse(printInfoFrom.printDataTem));
//let { width } = hiprintTemplate.value.printPanels[0].width; // let { width } = hiprintTemplate.value.printPanels[0].width;
//let tempPrintData =[{qrCode: '6544898545156',barCode:'456789'},{qrCode: 'https://cli.im/deqr/other',barCode:'https://www.baidu.com/'}] // let tempPrintData =[{qrCode: '6544898545156',barCode:'456789'},{qrCode: 'http://49.234.181.176:5555/?code=1102500006',barCode:''}]
//preViewRef.value.showDialog(hiprintTemplate.value, tempPrintData, width); // preViewRef.value.showDialog(hiprintTemplate.value, tempPrintData, width);
getPrintData().then(()=>{ getPrintData().then(()=>{
state.waitShowPrinter = true; state.waitShowPrinter = true;
hiprintTemplate.value.print( hiprintTemplate.value.print(
@ -188,13 +187,22 @@ const printSubmit = async () => {
{ {
callback: async () => { callback: async () => {
state.waitShowPrinter = false; 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:printInfoFrom.package, productDate:printInfoFrom.productDate, loseDate:printInfoFrom.loseDate, batch:printInfoFrom.batch, printDatas:printData.value};
let details = await addPrintDetail(contexts); let details = await addPrintDetail(contexts);
//console.log(details.data.result);
editDialogRef.value.openDialog(details.data.result); editDialogRef.value.openDialog(details.data.result);
}, },
} error: () => {
); console.log('2222222');
}); },
print: () => {
console.log('33333');
},
},
)
})
} }
@ -216,6 +224,7 @@ const getPrintData = async () => {
//PrintDataMaterialsInput //PrintDataMaterialsInput
let printInput = { let printInput = {
codeHead:printInfoFrom.package, codeHead:printInfoFrom.package,
unitGroupId:state.matterFrom.unitGroupId,
codeLength:5, codeLength:5,
count:printInfoFrom.printCount, count:printInfoFrom.printCount,
codeType:codeType codeType:codeType
@ -239,6 +248,7 @@ const openDialog = async (row: any) => {
} }
state.isShowDialog = true; state.isShowDialog = true;
changeMode(); changeMode();
printInfoFrom.batch=getCurrentDate();
}; };

View File

@ -32,8 +32,6 @@ const showDialog = (hiprintTemplate: any, printData: {}, width = 210) => {
previewContentRef.value.removeChild(previewContentRef.value.firstChild); previewContentRef.value.removeChild(previewContentRef.value.firstChild);
} }
const newHtml = hiprintTemplate.getHtml(printData); const newHtml = hiprintTemplate.getHtml(printData);
// console.log('newHtml')
// console.log(newHtml[0])
previewContentRef.value.appendChild(newHtml[0]); previewContentRef.value.appendChild(newHtml[0]);
}); });
}; };

View File

@ -40,7 +40,7 @@
</el-col> </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="productType"> <el-form-item label="生产类型" prop="productType">
<el-select v-model="ruleForm.productType" placeholder="请选择" clearable> <el-select v-model="ruleForm.productType" placeholder="请选择" clearable>
<el-option label="普通生产" value= '普通生产' /> <el-option label="普通生产" value= '普通生产' />
<el-option label="返工生产" value= '返工生产' /> <el-option label="返工生产" value= '返工生产' />
</el-select> </el-select>

View File

@ -91,7 +91,6 @@
<template #default="scope"> <template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditReportTable(scope.row)" v-auth="'reportTable:update'"> </el-button> <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditReportTable(scope.row)" v-auth="'reportTable:update'"> </el-button>
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="readReportDetailTable(scope.row)" v-auth="'reportDetailTable:update'"> </el-button> <el-button icon="ele-Edit" size="small" text="" type="primary" @click="readReportDetailTable(scope.row)" v-auth="'reportDetailTable:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delReportTable(scope.row)" v-auth="'reportTable:delete'"> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>