diff --git a/Admin.NET/Admin.NET.Application/Entity/AntiFakeRecords.cs b/Admin.NET/Admin.NET.Application/Entity/AntiFakeRecords.cs
index a278287..d08fd2b 100644
--- a/Admin.NET/Admin.NET.Application/Entity/AntiFakeRecords.cs
+++ b/Admin.NET/Admin.NET.Application/Entity/AntiFakeRecords.cs
@@ -4,7 +4,7 @@ namespace Admin.NET.Application.Entity;
///
/// 防伪扫码记录
///
-[SugarTable("AntiFakeRecords","防伪扫码记录")]
+[SugarTable("antifakerecords","防伪扫码记录")]
public class AntiFakeRecords : EntityBaseId
{
///
@@ -55,4 +55,29 @@ public class AntiFakeRecords : EntityBaseId
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
public string? Remarks { get; set; }
+ ///
+ /// 内码
+ ///
+ [SugarColumn(ColumnName = "InternalCode", ColumnDescription = "内码", Length = 32)]
+ public string? InternalCode { get; set; }
+
+ ///
+ /// 商品编码
+ ///
+ [SugarColumn(ColumnName = "CodeNum", ColumnDescription = "商品编码", Length = 32)]
+ public string? CodeNum { get; set; }
+
+ ///
+ /// 验证通过
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "IsPass", ColumnDescription = "验证通过")]
+ public bool IsPass { get; set; }
+
+ ///
+ /// 经纬度
+ ///
+ [SugarColumn(ColumnName = "LongitudeAndLatitude", ColumnDescription = "经纬度", Length = 32)]
+ public string? LongitudeAndLatitude { get; set; }
+
}
diff --git a/Admin.NET/Admin.NET.Application/Entity/CodeElement.cs b/Admin.NET/Admin.NET.Application/Entity/CodeElement.cs
index d2ea19b..5dc7bd7 100644
--- a/Admin.NET/Admin.NET.Application/Entity/CodeElement.cs
+++ b/Admin.NET/Admin.NET.Application/Entity/CodeElement.cs
@@ -4,7 +4,7 @@ namespace Admin.NET.Application.Entity;
///
/// 码元素
///
-[SugarTable("CodeElement","码元素")]
+[SugarTable("codeelement","码元素")]
public class CodeElement : EntityBase
{
///
@@ -26,4 +26,10 @@ public class CodeElement : EntityBase
[SugarColumn(ColumnName = "ExportFormatExample", ColumnDescription = "导出格式示例", Length = 32)]
public string? ExportFormatExample { get; set; }
+ ///
+ /// 单位组
+ ///
+ [SugarColumn(ColumnName = "UnitGroupId", ColumnDescription = "单位组")]
+ public long? UnitGroupId { get; set; }
+
}
diff --git a/Admin.NET/Admin.NET.Application/Entity/CodePakageConfiguration.cs b/Admin.NET/Admin.NET.Application/Entity/CodePakageConfiguration.cs
index c32651f..12da1c5 100644
--- a/Admin.NET/Admin.NET.Application/Entity/CodePakageConfiguration.cs
+++ b/Admin.NET/Admin.NET.Application/Entity/CodePakageConfiguration.cs
@@ -4,7 +4,7 @@ namespace Admin.NET.Application.Entity;
///
/// 码包配置
///
-[SugarTable("CodePakageConfiguration","码包配置")]
+[SugarTable("codepakageconfiguration","码包配置")]
public class CodePakageConfiguration : EntityTenant
{
///
@@ -34,7 +34,7 @@ public class CodePakageConfiguration : EntityTenant
///
/// 导出格式
///
- [SugarColumn(ColumnName = "ExportFormat", ColumnDescription = "导出格式")]
+ [SugarColumn(ColumnName = "ExportFormat", ColumnDescription = "导出格式", Length = 255)]
public string? ExportFormat { get; set; }
///
@@ -68,4 +68,10 @@ public class CodePakageConfiguration : EntityTenant
[SugarColumn(ColumnName = "SuffixType", ColumnDescription = "后缀类型", Length = 32)]
public string? SuffixType { get; set; }
+ ///
+ /// 单位组
+ ///
+ [SugarColumn(ColumnName = "UnitGroupId", ColumnDescription = "单位组")]
+ public long? UnitGroupId { get; set; }
+
}
diff --git a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/AntiFakeRecordsService.cs b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/AntiFakeRecordsService.cs
index d9f0cfd..4e61aa8 100644
--- a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/AntiFakeRecordsService.cs
+++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/AntiFakeRecordsService.cs
@@ -128,6 +128,21 @@ public class AntiFakeRecordsService : IDynamicApiController, ITransient
return await _rep.AsQueryable().Select().ToListAsync();
}
+ ///
+ /// 获取防伪扫码记录列表
+ ///
+ ///
+ [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());
+ }
+ }
///
/// 获取防伪扫码记录列表
@@ -142,6 +157,25 @@ public class AntiFakeRecordsService : IDynamicApiController, ITransient
}
+ ///
+ /// 获取防伪扫码记录列表
+ ///
+ ///
+ ///
+ [HttpGet]
+ [ApiDescriptionSettings(Name = "CheckCode")]
+ [AllowAnonymous]
+ public async Task CheckCode(string productCode)
+ {
+ var code = await _printCodeDetailService.GetByProductCode(productCode);
+ if (code == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+
///
/// 获取打印条码详情
///
@@ -149,30 +183,40 @@ public class AntiFakeRecordsService : IDynamicApiController, ITransient
///
[HttpPost]
[ApiDescriptionSettings(Name = "AntiFakeCode")]
+ [AllowAnonymous]
public async Task AntiFakeCode(AddAntiFakeRecordsInput input)
{
var code = await _printCodeDetailService.GetByProductCode(input.Code);
+ input.Date = DateTime.Now;
if (code == null)
{
+ input.IsPass = false;
+ await Add(input);
throw Oops.Oh(ErrorCodeEnum.xg1002);
}
var material = await _materialsService.GetById(code.MaterialsId);
if (material == null)
{
+ input.IsPass = false;
+ await Add(input);
throw Oops.Oh(ErrorCodeEnum.xg1002);
}
+ input.IsPass = true;
var model = new AntiFakeInfoOutput()
{
Addr = input.Addr,
Code = code.Code,
+ Name=material.Name,
Brand = material.Brand,
Specifications = material.Specifications,
};
var report = await _reportDetailTableService.Detail(new QueryByIdReportDetailTableInput() { Id = code.ReportTableId.Value });
if (report!=null)
{
- model.Batch= report.Batch;
+ model.Batch= report.Batch;
+ model.ProductionLine = report.ProductionLine;
}
+ await Add(input);
return model;
}
diff --git a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsDto.cs b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsDto.cs
index 5c41a25..fb43570 100644
--- a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsDto.cs
+++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsDto.cs
@@ -1,53 +1,74 @@
namespace Admin.NET.Application;
+///
+/// 防伪扫码记录输出参数
+///
+public class AntiFakeRecordsDto
+{
///
- /// 防伪扫码记录输出参数
+ /// 主键Id
///
- public class AntiFakeRecordsDto
- {
- ///
- /// 主键Id
- ///
- public long Id { get; set; }
-
- ///
- /// 条码
- ///
- public string? Code { get; set; }
-
- ///
- /// IP地址
- ///
- public string? Ip { get; set; }
-
- ///
- /// 城市
- ///
- public string? City { get; set; }
-
- ///
- /// 地域信息
- ///
- public string? Addr { get; set; }
-
- ///
- /// 城市编码
- ///
- public string? CityCode { get; set; }
-
- ///
- /// 省份
- ///
- public string? Pro { get; set; }
-
- ///
- /// 扫码时间
- ///
- public DateTime? Date { get; set; }
-
- ///
- /// 备注
- ///
- public string? Remarks { get; set; }
-
- }
+ public long Id { get; set; }
+
+ ///
+ /// 条码
+ ///
+ public string? Code { get; set; }
+
+ ///
+ /// IP地址
+ ///
+ public string? Ip { get; set; }
+
+ ///
+ /// 城市
+ ///
+ public string? City { get; set; }
+
+ ///
+ /// 地域信息
+ ///
+ public string? Addr { get; set; }
+
+ ///
+ /// 城市编码
+ ///
+ public string? CityCode { get; set; }
+
+ ///
+ /// 省份
+ ///
+ public string? Pro { get; set; }
+
+ ///
+ /// 扫码时间
+ ///
+ public DateTime? Date { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? Remarks { get; set; }
+
+
+ ///
+ /// 内码
+ ///
+ public string? InternalCode { get; set; }
+
+ ///
+ /// 商品编码
+ ///
+ public string? CodeNum { get; set; }
+
+ ///
+ /// 验证通过
+ ///
+ public bool IsPass { get; set; }
+
+ ///
+ /// 经纬度
+ ///
+ public string? LongitudeAndLatitude { get; set; }
+
+}
diff --git a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsInput.cs b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsInput.cs
index b673dc8..17bb85c 100644
--- a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsInput.cs
+++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsInput.cs
@@ -3,140 +3,179 @@ using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
+///
+/// 防伪扫码记录基础输入参数
+///
+public class AntiFakeRecordsBaseInput
+{
///
- /// 防伪扫码记录基础输入参数
+ /// 条码
///
- public class AntiFakeRecordsBaseInput
- {
- ///
- /// 条码
- ///
- public virtual string? Code { get; set; }
-
- ///
- /// IP地址
- ///
- public virtual string? Ip { get; set; }
-
- ///
- /// 城市
- ///
- public virtual string? City { get; set; }
-
- ///
- /// 地域信息
- ///
- public virtual string? Addr { get; set; }
-
- ///
- /// 城市编码
- ///
- public virtual string? CityCode { get; set; }
-
- ///
- /// 省份
- ///
- public virtual string? Pro { get; set; }
-
- ///
- /// 扫码时间
- ///
- public virtual DateTime? Date { get; set; }
-
- ///
- /// 备注
- ///
- public virtual string? Remarks { get; set; }
-
- }
+ public virtual string? Code { get; set; }
///
- /// 防伪扫码记录分页查询输入参数
+ /// IP地址
///
- public class AntiFakeRecordsInput : BasePageInput
- {
- ///
- /// 关键字查询
- ///
- public string? SearchKey { get; set; }
-
- ///
- /// 条码
- ///
- public string? Code { get; set; }
-
- ///
- /// IP地址
- ///
- public string? Ip { get; set; }
-
- ///
- /// 城市
- ///
- public string? City { get; set; }
-
- ///
- /// 地域信息
- ///
- public string? Addr { get; set; }
-
- ///
- /// 城市编码
- ///
- public string? CityCode { get; set; }
-
- ///
- /// 省份
- ///
- public string? Pro { get; set; }
-
- ///
- /// 扫码时间
- ///
- public DateTime? Date { get; set; }
-
- ///
- /// 扫码时间范围
- ///
- public List DateRange { get; set; }
- ///
- /// 备注
- ///
- public string? Remarks { get; set; }
-
- }
+ public virtual string? Ip { get; set; }
///
- /// 防伪扫码记录增加输入参数
+ /// 城市
///
- public class AddAntiFakeRecordsInput : AntiFakeRecordsBaseInput
- {
- }
+ public virtual string? City { get; set; }
///
- /// 防伪扫码记录删除输入参数
+ /// 地域信息
///
- public class DeleteAntiFakeRecordsInput : BaseIdInput
- {
- }
+ public virtual string? Addr { get; set; }
///
- /// 防伪扫码记录更新输入参数
+ /// 城市编码
///
- public class UpdateAntiFakeRecordsInput : AntiFakeRecordsBaseInput
- {
- ///
- /// 主键Id
- ///
- [Required(ErrorMessage = "主键Id不能为空")]
- public long Id { get; set; }
-
- }
+ public virtual string? CityCode { get; set; }
///
- /// 防伪扫码记录主键查询输入参数
+ /// 省份
///
- public class QueryByIdAntiFakeRecordsInput : DeleteAntiFakeRecordsInput
- {
+ public virtual string? Pro { get; set; }
- }
+ ///
+ /// 扫码时间
+ ///
+ public virtual DateTime? Date { get; set; }
+
+ ///
+ /// 内码
+ ///
+ public string? InternalCode { get; set; }
+
+ ///
+ /// 商品编码
+ ///
+ public string? CodeNum { get; set; }
+
+ ///
+ /// 验证通过
+ ///
+ public bool IsPass { get; set; }
+
+ ///
+ /// 经纬度
+ ///
+ public string? LongitudeAndLatitude { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public virtual string? Remarks { get; set; }
+
+}
+
+///
+/// 防伪扫码记录分页查询输入参数
+///
+public class AntiFakeRecordsInput : BasePageInput
+{
+ ///
+ /// 关键字查询
+ ///
+ public string? SearchKey { get; set; }
+
+ ///
+ /// 条码
+ ///
+ public string? Code { get; set; }
+
+ ///
+ /// IP地址
+ ///
+ public string? Ip { get; set; }
+
+ ///
+ /// 城市
+ ///
+ public string? City { get; set; }
+
+ ///
+ /// 地域信息
+ ///
+ public string? Addr { get; set; }
+
+ ///
+ /// 城市编码
+ ///
+ public string? CityCode { get; set; }
+
+ ///
+ /// 省份
+ ///
+ public string? Pro { get; set; }
+
+ ///
+ /// 扫码时间
+ ///
+ public DateTime? Date { get; set; }
+
+ ///
+ /// 内码
+ ///
+ public string? InternalCode { get; set; }
+
+ ///
+ /// 商品编码
+ ///
+ public string? CodeNum { get; set; }
+
+ ///
+ /// 验证通过
+ ///
+ public bool IsPass { get; set; }
+
+ ///
+ /// 经纬度
+ ///
+ public string? LongitudeAndLatitude { get; set; }
+ ///
+ /// 扫码时间范围
+ ///
+ public List DateRange { get; set; }
+ ///
+ /// 备注
+ ///
+ public string? Remarks { get; set; }
+
+}
+
+///
+/// 防伪扫码记录增加输入参数
+///
+public class AddAntiFakeRecordsInput : AntiFakeRecordsBaseInput
+{
+}
+
+///
+/// 防伪扫码记录删除输入参数
+///
+public class DeleteAntiFakeRecordsInput : BaseIdInput
+{
+}
+
+///
+/// 防伪扫码记录更新输入参数
+///
+public class UpdateAntiFakeRecordsInput : AntiFakeRecordsBaseInput
+{
+ ///
+ /// 主键Id
+ ///
+ [Required(ErrorMessage = "主键Id不能为空")]
+ public long Id { get; set; }
+
+}
+
+///
+/// 防伪扫码记录主键查询输入参数
+///
+public class QueryByIdAntiFakeRecordsInput : DeleteAntiFakeRecordsInput
+{
+
+}
diff --git a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsOutput.cs b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsOutput.cs
index 2848932..7a34106 100644
--- a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsOutput.cs
+++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsOutput.cs
@@ -45,6 +45,26 @@ public class AntiFakeRecordsOutput
///
public DateTime? Date { get; set; }
+ ///
+ /// 内码
+ ///
+ public string? InternalCode { get; set; }
+
+ ///
+ /// 商品编码
+ ///
+ public string? CodeNum { get; set; }
+
+ ///
+ /// 验证通过
+ ///
+ public bool IsPass { get; set; }
+
+ ///
+ /// 经纬度
+ ///
+ public string? LongitudeAndLatitude { get; set; }
+
///
/// 备注
///
diff --git a/Admin.NET/Admin.NET.Application/Service/CodeElement/CodeElementService.cs b/Admin.NET/Admin.NET.Application/Service/CodeElement/CodeElementService.cs
index 278c9bf..6a123fd 100644
--- a/Admin.NET/Admin.NET.Application/Service/CodeElement/CodeElementService.cs
+++ b/Admin.NET/Admin.NET.Application/Service/CodeElement/CodeElementService.cs
@@ -97,15 +97,14 @@ public class CodeElementService : IDynamicApiController, ITransient
///
[HttpGet]
[ApiDescriptionSettings(Name = "ElementByName")]
- public async Task GetElementByName([FromQuery] string input)
+ public async Task 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);
}
///
/// 获取码元素列表
///
- ///
///
[HttpGet]
[ApiDescriptionSettings(Name = "List")]
@@ -114,7 +113,17 @@ public class CodeElementService : IDynamicApiController, ITransient
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select().ToListAsync();
}
-
+ ///
+ /// 获取码包配置列表
+ ///
+ ///
+ [HttpGet]
+ [ApiDescriptionSettings(Name = "ListByGroupId")]
+ public async Task> ListByGroupId(long? unitGroupId)
+ {
+ var list = await _rep.AsQueryable().Where(a => a.UnitGroupId == unitGroupId && !a.IsDelete).Select().ToListAsync();
+ return list;
+ }
diff --git a/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementDto.cs b/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementDto.cs
index 951d91c..c13063b 100644
--- a/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementDto.cs
+++ b/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementDto.cs
@@ -1,63 +1,69 @@
namespace Admin.NET.Application;
+///
+/// 码元素输出参数
+///
+public class CodeElementDto
+{
///
- /// 码元素输出参数
+ /// 主键Id
///
- public class CodeElementDto
- {
- ///
- /// 主键Id
- ///
- public long Id { get; set; }
-
- ///
- /// 码长度
- ///
- public int CodeLength { get; set; }
-
- ///
- /// 码包名称
- ///
- public string? CodeName { get; set; }
-
- ///
- /// 导出格式示例
- ///
- public string? ExportFormatExample { get; set; }
-
- ///
- /// 创建时间
- ///
- public DateTime? CreateTime { get; set; }
-
- ///
- /// 更新时间
- ///
- public DateTime? UpdateTime { get; set; }
-
- ///
- /// 创建者Id
- ///
- public long? CreateUserId { get; set; }
-
- ///
- /// 创建者姓名
- ///
- public string? CreateUserName { get; set; }
-
- ///
- /// 修改者Id
- ///
- public long? UpdateUserId { get; set; }
-
- ///
- /// 修改者姓名
- ///
- public string? UpdateUserName { get; set; }
-
- ///
- /// 软删除
- ///
- public bool IsDelete { get; set; }
-
- }
+ public long Id { get; set; }
+
+ ///
+ /// 码长度
+ ///
+ public int CodeLength { get; set; }
+
+ ///
+ /// 码包名称
+ ///
+ public string? CodeName { get; set; }
+
+ ///
+ /// 导出格式示例
+ ///
+ public string? ExportFormatExample { get; set; }
+
+
+ ///
+ /// 单位组
+ ///
+ public long? UnitGroupId { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ public DateTime? UpdateTime { get; set; }
+
+ ///
+ /// 创建者Id
+ ///
+ public long? CreateUserId { get; set; }
+
+ ///
+ /// 创建者姓名
+ ///
+ public string? CreateUserName { get; set; }
+
+ ///
+ /// 修改者Id
+ ///
+ public long? UpdateUserId { get; set; }
+
+ ///
+ /// 修改者姓名
+ ///
+ public string? UpdateUserName { get; set; }
+
+ ///
+ /// 软删除
+ ///
+ public bool IsDelete { get; set; }
+
+}
diff --git a/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementInput.cs b/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementInput.cs
index 7a7818c..64d39a9 100644
--- a/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementInput.cs
+++ b/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementInput.cs
@@ -24,6 +24,11 @@ public class CodeElementBaseInput
///
public virtual string? ExportFormatExample { get; set; }
+ ///
+ /// 单位组
+ ///
+ public long? UnitGroupId { get; set; }
+
///
/// 创建时间
///
@@ -86,6 +91,10 @@ public class CodeElementInput : BasePageInput
///
public string? ExportFormatExample { get; set; }
+ ///
+ /// 单位组
+ ///
+ public long? UnitGroupId { get; set; }
}
///
diff --git a/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementOutput.cs b/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementOutput.cs
index 69b28ba..0840bf9 100644
--- a/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementOutput.cs
+++ b/Admin.NET/Admin.NET.Application/Service/CodeElement/Dto/CodeElementOutput.cs
@@ -9,57 +9,62 @@ public class CodeElementOutput
/// 主键Id
///
public long Id { get; set; }
-
+
///
/// 码长度
///
public int CodeLength { get; set; }
-
+
///
/// 码包名称
///
public string? CodeName { get; set; }
-
+
///
/// 导出格式示例
///
public string? ExportFormatExample { get; set; }
-
+
+ ///
+ /// 单位组
+ ///
+ public long? UnitGroupId { get; set; }
+
///
/// 创建时间
///
public DateTime? CreateTime { get; set; }
-
+
///
/// 更新时间
///
public DateTime? UpdateTime { get; set; }
-
+
///
/// 创建者Id
///
public long? CreateUserId { get; set; }
-
+
///
/// 创建者姓名
///
public string? CreateUserName { get; set; }
-
+
///
/// 修改者Id
///
public long? UpdateUserId { get; set; }
-
+
///
/// 修改者姓名
///
public string? UpdateUserName { get; set; }
-
+
///
/// 软删除
///
public bool IsDelete { get; set; }
-
- }
-
+
+}
+
diff --git a/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/CodePakageConfigurationService.cs b/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/CodePakageConfigurationService.cs
index 44d0b65..4e95e99 100644
--- a/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/CodePakageConfigurationService.cs
+++ b/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/CodePakageConfigurationService.cs
@@ -98,6 +98,29 @@ public class CodePakageConfigurationService : IDynamicApiController, ITransient
return list;
}
+ ///
+ /// 获取码包配置列表
+ ///
+ ///
+ [HttpGet]
+ [ApiDescriptionSettings(Name = "ListByGroupId")]
+ public async Task> ListByGroupId(long? unitGroupId)
+ {
+ var list = await _rep.AsQueryable().Where(a =>a.UnitGroupId == unitGroupId && !a.IsDelete).Select().ToListAsync();
+ return list;
+ }
+
+ ///
+ /// 获取码元素
+ ///
+ ///
+ ///
+ [HttpGet]
+ [ApiDescriptionSettings(Name = "GetConfigByName")]
+ public async Task GetConfigByName([FromQuery] string input, long? unitGroupId)
+ {
+ return await _rep.GetFirstAsync(u => u.UnitGroupId == unitGroupId && u.Name == input);
+ }
///
/// 获取码包示例
///
diff --git a/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationDto.cs b/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationDto.cs
index c3a1fe4..b53dfad 100644
--- a/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationDto.cs
+++ b/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationDto.cs
@@ -1,93 +1,98 @@
namespace Admin.NET.Application;
+///
+/// 码包配置输出参数
+///
+public class CodePakageConfigurationDto
+{
///
- /// 码包配置输出参数
+ /// 主键Id
///
- public class CodePakageConfigurationDto
- {
- ///
- /// 主键Id
- ///
- public long Id { get; set; }
-
- ///
- /// 序号
- ///
- public int? Index { get; set; }
-
- ///
- /// 码包配置名称
- ///
- public string? Name { get; set; }
-
- ///
- /// 条码类型
- ///
- public string? CodeType { get; set; }
-
- ///
- /// 条码类型ID
- ///
- public long? CodeTypeId { get; set; }
-
- ///
- /// 导出格式
- ///
- public string? ExportFormat { get; set; }
-
- ///
- /// 条码前缀
- ///
- public string? CodePrefix { get; set; }
-
- ///
- /// 内码前缀
- ///
- public string? InternalCodePrefix { get; set; }
-
- ///
- /// 导出格式示例
- ///
- public string? ExportFormatExample { get; set; }
-
- ///
- /// 租户Id
- ///
- public long? TenantId { get; set; }
-
- ///
- /// 创建时间
- ///
- public DateTime? CreateTime { get; set; }
-
- ///
- /// 更新时间
- ///
- public DateTime? UpdateTime { get; set; }
-
- ///
- /// 创建者Id
- ///
- public long? CreateUserId { get; set; }
-
- ///
- /// 创建者姓名
- ///
- public string? CreateUserName { get; set; }
-
- ///
- /// 修改者Id
- ///
- public long? UpdateUserId { get; set; }
-
- ///
- /// 修改者姓名
- ///
- public string? UpdateUserName { get; set; }
-
- ///
- /// 软删除
- ///
- public bool IsDelete { get; set; }
-
- }
+ public long Id { get; set; }
+
+ ///
+ /// 序号
+ ///
+ public int? Index { get; set; }
+
+ ///
+ /// 码包配置名称
+ ///
+ public string? Name { get; set; }
+
+ ///
+ /// 条码类型
+ ///
+ public string? CodeType { get; set; }
+
+ ///
+ /// 条码类型ID
+ ///
+ public long? CodeTypeId { get; set; }
+
+ ///
+ /// 导出格式
+ ///
+ public string? ExportFormat { get; set; }
+
+ ///
+ /// 条码前缀
+ ///
+ public string? CodePrefix { get; set; }
+
+ ///
+ /// 内码前缀
+ ///
+ public string? InternalCodePrefix { get; set; }
+
+ ///
+ /// 导出格式示例
+ ///
+ public string? ExportFormatExample { get; set; }
+
+ ///
+ /// 单位组
+ ///
+ public long? UnitGroupId { get; set; }
+
+ ///
+ /// 租户Id
+ ///
+ public long? TenantId { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ public DateTime? UpdateTime { get; set; }
+
+ ///
+ /// 创建者Id
+ ///
+ public long? CreateUserId { get; set; }
+
+ ///
+ /// 创建者姓名
+ ///
+ public string? CreateUserName { get; set; }
+
+ ///
+ /// 修改者Id
+ ///
+ public long? UpdateUserId { get; set; }
+
+ ///
+ /// 修改者姓名
+ ///
+ public string? UpdateUserName { get; set; }
+
+ ///
+ /// 软删除
+ ///
+ public bool IsDelete { get; set; }
+
+}
diff --git a/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationInput.cs b/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationInput.cs
index b736a50..eb83350 100644
--- a/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationInput.cs
+++ b/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationInput.cs
@@ -3,50 +3,55 @@ using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
+///
+/// 码包配置基础输入参数
+///
+public class CodePakageConfigurationBaseInput
+{
///
- /// 码包配置基础输入参数
+ /// 序号
///
- public class CodePakageConfigurationBaseInput
- {
- ///
- /// 序号
- ///
- public virtual int? Index { get; set; }
-
- ///
- /// 码包配置名称
- ///
- public virtual string? Name { get; set; }
-
- ///
- /// 条码类型
- ///
- public virtual string? CodeType { get; set; }
-
- ///
- /// 条码类型ID
- ///
- public virtual long? CodeTypeId { get; set; }
-
- ///
- /// 导出格式
- ///
- public virtual string? ExportFormat { get; set; }
-
- ///
- /// 条码前缀
- ///
- public virtual string? CodePrefix { get; set; }
-
- ///
- /// 内码前缀
- ///
- public virtual string? InternalCodePrefix { get; set; }
-
- ///
- /// 导出格式示例
- ///
- public virtual string? ExportFormatExample { get; set; }
+ public virtual int? Index { get; set; }
+
+ ///
+ /// 码包配置名称
+ ///
+ public virtual string? Name { get; set; }
+
+ ///
+ /// 条码类型
+ ///
+ public virtual string? CodeType { get; set; }
+
+ ///
+ /// 条码类型ID
+ ///
+ public virtual long? CodeTypeId { get; set; }
+
+ ///
+ /// 导出格式
+ ///
+ public virtual string? ExportFormat { get; set; }
+
+ ///
+ /// 条码前缀
+ ///
+ public virtual string? CodePrefix { get; set; }
+
+ ///
+ /// 内码前缀
+ ///
+ public virtual string? InternalCodePrefix { get; set; }
+
+ ///
+ /// 导出格式示例
+ ///
+ public virtual string? ExportFormatExample { get; set; }
+
+ ///
+ /// 单位组
+ ///
+ public long? UnitGroupId { get; set; }
///
/// 条码长度
@@ -62,93 +67,93 @@ namespace Admin.NET.Application;
/// 租户Id
///
public virtual long? TenantId { get; set; }
-
- ///
- /// 创建时间
- ///
- public virtual DateTime? CreateTime { get; set; }
-
- ///
- /// 更新时间
- ///
- public virtual DateTime? UpdateTime { get; set; }
-
- ///
- /// 创建者Id
- ///
- public virtual long? CreateUserId { get; set; }
-
- ///
- /// 创建者姓名
- ///
- public virtual string? CreateUserName { get; set; }
-
- ///
- /// 修改者Id
- ///
- public virtual long? UpdateUserId { get; set; }
-
- ///
- /// 修改者姓名
- ///
- public virtual string? UpdateUserName { get; set; }
-
- ///
- /// 软删除
- ///
- public virtual bool IsDelete { get; set; }
-
- }
///
- /// 码包配置分页查询输入参数
+ /// 创建时间
///
- public class CodePakageConfigurationInput : BasePageInput
- {
- ///
- /// 关键字查询
- ///
- public string? SearchKey { get; set; }
+ public virtual DateTime? CreateTime { get; set; }
- ///
- /// 序号
- ///
- public int? Index { get; set; }
-
- ///
- /// 码包配置名称
- ///
- public string? Name { get; set; }
-
- ///
- /// 条码类型
- ///
- public string? CodeType { get; set; }
-
- ///
- /// 条码类型ID
- ///
- public long? CodeTypeId { get; set; }
-
- ///
- /// 导出格式
- ///
- public string? ExportFormat { get; set; }
-
- ///
- /// 条码前缀
- ///
- public string? CodePrefix { get; set; }
-
- ///
- /// 内码前缀
- ///
- public string? InternalCodePrefix { get; set; }
-
- ///
- /// 导出格式示例
- ///
- public string? ExportFormatExample { get; set; }
+ ///
+ /// 更新时间
+ ///
+ public virtual DateTime? UpdateTime { get; set; }
+
+ ///
+ /// 创建者Id
+ ///
+ public virtual long? CreateUserId { get; set; }
+
+ ///
+ /// 创建者姓名
+ ///
+ public virtual string? CreateUserName { get; set; }
+
+ ///
+ /// 修改者Id
+ ///
+ public virtual long? UpdateUserId { get; set; }
+
+ ///
+ /// 修改者姓名
+ ///
+ public virtual string? UpdateUserName { get; set; }
+
+ ///
+ /// 软删除
+ ///
+ public virtual bool IsDelete { get; set; }
+
+}
+
+///
+/// 码包配置分页查询输入参数
+///
+public class CodePakageConfigurationInput : BasePageInput
+{
+ ///
+ /// 关键字查询
+ ///
+ public string? SearchKey { get; set; }
+
+ ///
+ /// 序号
+ ///
+ public int? Index { get; set; }
+
+ ///
+ /// 码包配置名称
+ ///
+ public string? Name { get; set; }
+
+ ///
+ /// 条码类型
+ ///
+ public string? CodeType { get; set; }
+
+ ///
+ /// 条码类型ID
+ ///
+ public long? CodeTypeId { get; set; }
+
+ ///
+ /// 导出格式
+ ///
+ public string? ExportFormat { get; set; }
+
+ ///
+ /// 条码前缀
+ ///
+ public string? CodePrefix { get; set; }
+
+ ///
+ /// 内码前缀
+ ///
+ public string? InternalCodePrefix { get; set; }
+
+ ///
+ /// 导出格式示例
+ ///
+ public string? ExportFormatExample { get; set; }
///
/// 条码长度
///
@@ -161,43 +166,43 @@ namespace Admin.NET.Application;
}
+///
+/// 码包配置增加输入参数
+///
+public class AddCodePakageConfigurationInput : CodePakageConfigurationBaseInput
+{
///
- /// 码包配置增加输入参数
+ /// 软删除
///
- public class AddCodePakageConfigurationInput : CodePakageConfigurationBaseInput
- {
- ///
- /// 软删除
- ///
- [Required(ErrorMessage = "软删除不能为空")]
- public override bool IsDelete { get; set; }
-
- }
+ [Required(ErrorMessage = "软删除不能为空")]
+ public override bool IsDelete { get; set; }
+}
+
+///
+/// 码包配置删除输入参数
+///
+public class DeleteCodePakageConfigurationInput : BaseIdInput
+{
+}
+
+///
+/// 码包配置更新输入参数
+///
+public class UpdateCodePakageConfigurationInput : CodePakageConfigurationBaseInput
+{
///
- /// 码包配置删除输入参数
+ /// 主键Id
///
- public class DeleteCodePakageConfigurationInput : BaseIdInput
- {
- }
+ [Required(ErrorMessage = "主键Id不能为空")]
+ public long Id { get; set; }
- ///
- /// 码包配置更新输入参数
- ///
- public class UpdateCodePakageConfigurationInput : CodePakageConfigurationBaseInput
- {
- ///
- /// 主键Id
- ///
- [Required(ErrorMessage = "主键Id不能为空")]
- public long Id { get; set; }
-
- }
+}
- ///
- /// 码包配置主键查询输入参数
- ///
- public class QueryByIdCodePakageConfigurationInput : DeleteCodePakageConfigurationInput
- {
+///
+/// 码包配置主键查询输入参数
+///
+public class QueryByIdCodePakageConfigurationInput : DeleteCodePakageConfigurationInput
+{
- }
+}
diff --git a/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationOutput.cs b/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationOutput.cs
index 8df32aa..16ee3c0 100644
--- a/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationOutput.cs
+++ b/Admin.NET/Admin.NET.Application/Service/CodePakageConfiguration/Dto/CodePakageConfigurationOutput.cs
@@ -60,6 +60,11 @@ public class CodePakageConfigurationOutput
///
public virtual string? SuffixType { get; set; }
+ ///
+ /// 单位组
+ ///
+ public long? UnitGroupId { get; set; }
+
///
/// 租户Id
///
diff --git a/Admin.NET/Admin.NET.Application/Service/PrintData/Dto/PrintDataMaterialsInput.cs b/Admin.NET/Admin.NET.Application/Service/PrintData/Dto/PrintDataMaterialsInput.cs
index 735d08b..6f49bd8 100644
--- a/Admin.NET/Admin.NET.Application/Service/PrintData/Dto/PrintDataMaterialsInput.cs
+++ b/Admin.NET/Admin.NET.Application/Service/PrintData/Dto/PrintDataMaterialsInput.cs
@@ -29,7 +29,11 @@ public class PrintDataMaterialsInput
/// 码类型
///
public string? CodeType { get; set; }
-
+
+ ///
+ /// 单位组
+ ///
+ public long? UnitGroupId { get; set; }
///
/// 备注
///
diff --git a/Admin.NET/Admin.NET.Application/Service/PrintData/PrintDataService.cs b/Admin.NET/Admin.NET.Application/Service/PrintData/PrintDataService.cs
index 3d8b5f4..d5ef7a9 100644
--- a/Admin.NET/Admin.NET.Application/Service/PrintData/PrintDataService.cs
+++ b/Admin.NET/Admin.NET.Application/Service/PrintData/PrintDataService.cs
@@ -14,13 +14,16 @@ public class PrintDataService : IDynamicApiController, ITransient
private readonly SqlSugarRepository _rep;
private readonly CodeElementService _codeElementService;
private readonly CodeElementPropService _codeElementPropService;
+ private readonly CodePakageConfigurationService _codePakageConfigurationService;
public PrintDataService(SqlSugarRepository rep,
CodeElementService codeElementService,
- CodeElementPropService codeElementPropService)
+ CodeElementPropService codeElementPropService,
+ CodePakageConfigurationService codePakageConfigurationService)
{
_rep = rep;
_codeElementService = codeElementService;
_codeElementPropService = codeElementPropService;
+ _codePakageConfigurationService = codePakageConfigurationService;
}
///
@@ -107,26 +110,30 @@ public class PrintDataService : IDynamicApiController, ITransient
[ApiDescriptionSettings(Name = "GetPrintDataList")]
public async Task> 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> GetPrintDatas(string codeName,string codeType,int count)
+ public async Task> GetPrintDatas(long? unitGroupId, string codeName,string codeType,int count)
{
var result = new List();
if (string.IsNullOrEmpty(codeName))
{
return result;
}
- var elem = await _codeElementService.GetElementByName(codeName);
+ var elem = await _codeElementService.GetElementByName(codeName, unitGroupId);
if (elem == null)
{ 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 });
if (elemProp.Count > 0)
{
+ var prefix = (string.IsNullOrEmpty(config.CodePrefix) || codeType == "条形码") ? "" : config.CodePrefix;
elemProp = elemProp.OrderBy(a => a.Index).ToList();
for (int i = 0; i < count; i++)
{
- var code = GetCodeNumByProp(elemProp, i + 1);
+ var code = prefix + GetCodeNumByProp(elemProp, i + 1);
if (codeType == "条形码")
{
result.Add(new PrintData() { BarCode = code });
diff --git a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/ReportDetailTableService.cs b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/ReportDetailTableService.cs
index b21c92b..6de682f 100644
--- a/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/ReportDetailTableService.cs
+++ b/Admin.NET/Admin.NET.Application/Service/ReportDetailTable/ReportDetailTableService.cs
@@ -2,6 +2,8 @@
using Admin.NET.Application.Const;
using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http;
+using Admin.NET.Application.Utils;
+
namespace Admin.NET.Application;
///
/// 汇报单详情服务
@@ -191,7 +193,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
Dictionary list = new Dictionary();
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 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);
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 detail2 = new AddPrintCodeDetailInput()
{
@@ -239,7 +241,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var childs3 = input.CodeDatas.FindAll(a => a.FatherCode == code2);
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 detail3 = new AddPrintCodeDetailInput()
{
@@ -264,7 +266,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var childs4 = input.CodeDatas.FindAll(a => a.FatherCode == code3);
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 detail4 = new AddPrintCodeDetailInput()
{
@@ -289,7 +291,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var childs5 = input.CodeDatas.FindAll(a => a.FatherCode == code4);
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 detail5 = new AddPrintCodeDetailInput()
{
diff --git a/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs b/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs
index 3a053f1..2c63c5f 100644
--- a/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs
+++ b/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Http;
using Admin.NET.Application.Service.ReportTable.Dto;
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types;
using Nest;
+using Admin.NET.Application.Utils;
namespace Admin.NET.Application;
///
@@ -266,7 +267,7 @@ public class ReportTableService : IDynamicApiController, ITransient
tempUnits.AddRange(others);
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 detail = new AddPrintCodeDetailInput()
{
@@ -291,10 +292,10 @@ public class ReportTableService : IDynamicApiController, ITransient
}
treeData1.Children = new List();
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)
{
- 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 detailId2 = await _codeDetailService.Add(detail2);
var treeData2 = detail2.Adapt();
@@ -302,10 +303,10 @@ public class ReportTableService : IDynamicApiController, ITransient
{
treeData2.Children = new List();
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)
{
- 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 detailId3 = await _codeDetailService.Add(detail3);
var treeData3 = detail3.Adapt();
@@ -313,10 +314,10 @@ public class ReportTableService : IDynamicApiController, ITransient
{
treeData3.Children = new List();
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)
{
- 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 treeData4 = detail4.Adapt();
treeData3.Children.Add(treeData4);
diff --git a/Admin.NET/Admin.NET.Application/Utils/CodeHelper.cs b/Admin.NET/Admin.NET.Application/Utils/CodeHelper.cs
index 3c115b3..17a9b75 100644
--- a/Admin.NET/Admin.NET.Application/Utils/CodeHelper.cs
+++ b/Admin.NET/Admin.NET.Application/Utils/CodeHelper.cs
@@ -56,6 +56,16 @@ internal class CodeHelper
}
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)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
diff --git a/Admin.NET/Admin.NET.Web.Core/Startup.cs b/Admin.NET/Admin.NET.Web.Core/Startup.cs
index ad3b1fe..29e9abf 100644
--- a/Admin.NET/Admin.NET.Web.Core/Startup.cs
+++ b/Admin.NET/Admin.NET.Web.Core/Startup.cs
@@ -91,6 +91,18 @@ public class Startup : AppStartup
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.AddSingleton();
@@ -192,6 +204,8 @@ public class Startup : AppStartup
ContentTypeProvider = contentTypeProvider
});
+ //app.UseCors("MyCorsPolicy");
+
//// 启用HTTPS
//app.UseHttpsRedirection();
diff --git a/Web/src/api/main/codeElement.ts b/Web/src/api/main/codeElement.ts
index 4c536f0..5d2cd43 100644
--- a/Web/src/api/main/codeElement.ts
+++ b/Web/src/api/main/codeElement.ts
@@ -3,9 +3,11 @@ enum Api {
AddCodeElement = '/api/codeElement/add',
DeleteCodeElement = '/api/codeElement/delete',
UpdateCodeElement = '/api/codeElement/update',
- PageCodeElement = '/api/codeElement/page',
+ PageCodeElement = '/api/codeElement/page',//ListByGroupId
DetailCodeElement = '/api/codeElement/detail',
GetCodeConfig = '/api/codePakageConfiguration/list',
+ ListByGroupId = '/api/codeElement/listByGroupId',
+ ConfigByGroupId = '/api/codePakageConfiguration/listByGroupId',
}
// 增加码元素
@@ -54,3 +56,20 @@ export const getCodeConfig = () =>
url: Api.GetCodeConfig,
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 },
+ });
\ No newline at end of file
diff --git a/Web/src/api/main/codePakageConfiguration.ts b/Web/src/api/main/codePakageConfiguration.ts
index b8226b1..3075245 100644
--- a/Web/src/api/main/codePakageConfiguration.ts
+++ b/Web/src/api/main/codePakageConfiguration.ts
@@ -7,6 +7,7 @@ enum Api {
UpdateCodePakageConfiguration = '/api/codePakageConfiguration/update',
PageCodePakageConfiguration = '/api/codePakageConfiguration/page',
DetailCodePakageConfiguration = '/api/codePakageConfiguration/detail',
+ ListByGroupId = '/api/codePakageConfiguration/listByGroupId',
}
// 增加码包配置
@@ -49,16 +50,6 @@ export const detailCodePakageConfiguration = (id: any) =>
data: { id },
});
-export const removeDuplicates=(persons: any[] | undefined) : any[]=> {
- const uniquePersons = new Map();
- 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=> {
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 },
+ });
\ No newline at end of file
diff --git a/Web/src/api/main/unit.ts b/Web/src/api/main/unit.ts
index 534f920..fd70ca5 100644
--- a/Web/src/api/main/unit.ts
+++ b/Web/src/api/main/unit.ts
@@ -7,6 +7,7 @@ enum Api {
DetailUnit = '/api/sysUnit/detail',
ListUnit = '/api/sysUnit/list',
ListUnitGroup = '/api/sysUnit/listByGroupId',
+ UnitGroupList = '/api/sysUnitGroup/list',
}
// 增加单位
@@ -64,3 +65,11 @@ export const listUnitGroup = (unitGroupId: any) =>
method: 'get',
data: { unitGroupId },
});
+
+// 单位组列表
+export const unitGroups = () =>
+ request({
+ url: Api.UnitGroupList,
+ method: 'get',
+ data: { },
+ });
\ No newline at end of file
diff --git a/Web/src/utils/formatTime.ts b/Web/src/utils/formatTime.ts
index 441e30c..d958b40 100644
--- a/Web/src/utils/formatTime.ts
+++ b/Web/src/utils/formatTime.ts
@@ -51,6 +51,18 @@ export function formatDate(date: Date, format: string): string {
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 当前传入的日期值
diff --git a/Web/src/views/basics-date/matter/component/editOpenAccess.vue b/Web/src/views/basics-date/matter/component/editOpenAccess.vue
index 05cbf10..c74297c 100644
--- a/Web/src/views/basics-date/matter/component/editOpenAccess.vue
+++ b/Web/src/views/basics-date/matter/component/editOpenAccess.vue
@@ -2,22 +2,22 @@
-
+
-
+
-
-
+
+
-
+
@@ -28,23 +28,23 @@
-
+
-
+
-
+
-
+
@@ -52,31 +52,35 @@
-
-
+
+
-
+
-
+
+
+
+
+
-
+
-
+
@@ -85,7 +89,7 @@
-
+
@@ -93,14 +97,14 @@
-
+
-
+
@@ -110,21 +114,21 @@
-
+
-
+
-
+
@@ -134,7 +138,7 @@
-
+
@@ -185,19 +189,21 @@
diff --git a/Web/src/views/labelPrinting/codeElement/component/editDialog.vue b/Web/src/views/labelPrinting/codeElement/component/editDialog.vue
index fbbf60f..050167e 100644
--- a/Web/src/views/labelPrinting/codeElement/component/editDialog.vue
+++ b/Web/src/views/labelPrinting/codeElement/component/editDialog.vue
@@ -16,6 +16,13 @@
+
+
+
+
+
+
+
@@ -56,7 +63,8 @@
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessage } 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({
@@ -74,6 +82,7 @@
const rules = ref({
});
const codeConfigData = ref([]);
+ const unitGroup = ref([]);
// 打开弹窗
const openDialog = async (row: any) => {
@@ -131,10 +140,26 @@
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 () => {
- handleCodeConfigQuery();
+ unitData();
+ //handleCodeConfigQuery();
});
//将属性或者函数暴露给父组件
diff --git a/Web/src/views/labelPrinting/codeElement/index.vue b/Web/src/views/labelPrinting/codeElement/index.vue
index cae624e..3b00113 100644
--- a/Web/src/views/labelPrinting/codeElement/index.vue
+++ b/Web/src/views/labelPrinting/codeElement/index.vue
@@ -36,6 +36,15 @@
+
+
+
+
+
+
+
+
+
({});
+ const unitGroup = ref([])
+
+ //获取单位组数据
+ const getUnitGroup = async () => {
+ unitGroup.value = (await unitGroups()).data.result;
+ }
+
// 改变高级查询的控件显示状态
const changeAdvanceQueryUI = () => {
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
@@ -180,7 +196,20 @@
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();