diff --git a/Admin.NET/Admin.NET.Application/Configuration/Database.json b/Admin.NET/Admin.NET.Application/Configuration/Database.json index de5b0d7..3993f4a 100644 --- a/Admin.NET/Admin.NET.Application/Configuration/Database.json +++ b/Admin.NET/Admin.NET.Application/Configuration/Database.json @@ -8,7 +8,8 @@ { //"ConfigId": "1300000000001", // 默认库标识-禁止修改 "DbType": "MySql", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom - "ConnectionString": "Server=gz-cdb-76wyaumn.sql.tencentcdb.com;Port=29867;Database=guanwei-;Uid=guanwei-dig;Pwd=hfc123456;SslMode=none;AllowPublicKeyRetrieval=True;", // 库连接字符串 + "ConnectionString": "Server=gz-cdb-blgil7uv.sql.tencentcdb.com;Port=27315;Database=sql-guanwei;Uid=sql-guanwei;Pwd=gw123456;SslMode=none;AllowPublicKeyRetrieval=True;", // 库连接字符串 + //"ConnectionString": "Server=gz-cdb-76wyaumn.sql.tencentcdb.com;Port=29867;Database=guanwei-;Uid=guanwei-dig;Pwd=hfc123456;SslMode=none;AllowPublicKeyRetrieval=True;", // 库连接字符串 //"ConnectionString": "Server=139.199.191.197;Port=3306;Database=b-guanwei;Uid=b-guanwei;Pwd=hfc123456;SslMode=none;AllowPublicKeyRetrieval=True;", // 库连接字符串 //"SlaveConnectionConfigs": [ // 读写分离/主从 // { diff --git a/Admin.NET/Admin.NET.Application/Entity/AntiFakeRecords.cs b/Admin.NET/Admin.NET.Application/Entity/AntiFakeRecords.cs new file mode 100644 index 0000000..a278287 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Entity/AntiFakeRecords.cs @@ -0,0 +1,58 @@ +using Admin.NET.Core; +namespace Admin.NET.Application.Entity; + +/// +/// 防伪扫码记录 +/// +[SugarTable("AntiFakeRecords","防伪扫码记录")] +public class AntiFakeRecords : EntityBaseId +{ + /// + /// 条码 + /// + [SugarColumn(ColumnName = "Code", ColumnDescription = "条码", Length = 32)] + public string? Code { get; set; } + + /// + /// IP地址 + /// + [SugarColumn(ColumnName = "Ip", ColumnDescription = "IP地址", Length = 32)] + public string? Ip { get; set; } + + /// + /// 城市 + /// + [SugarColumn(ColumnName = "City", ColumnDescription = "城市", Length = 32)] + public string? City { get; set; } + + /// + /// 地域信息 + /// + [SugarColumn(ColumnName = "Addr", ColumnDescription = "地域信息", Length = 32)] + public string? Addr { get; set; } + + /// + /// 城市编码 + /// + [SugarColumn(ColumnName = "CityCode", ColumnDescription = "城市编码", Length = 32)] + public string? CityCode { get; set; } + + /// + /// 省份 + /// + [SugarColumn(ColumnName = "Pro", ColumnDescription = "省份", Length = 32)] + public string? Pro { get; set; } + + /// + /// 扫码时间 + /// + [SugarColumn(ColumnName = "Date", ColumnDescription = "扫码时间")] + public DateTime? Date { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)] + public string? Remarks { get; set; } + +} diff --git a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/AntiFakeRecordsService.cs b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/AntiFakeRecordsService.cs new file mode 100644 index 0000000..d9f0cfd --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/AntiFakeRecordsService.cs @@ -0,0 +1,180 @@ +using Admin.NET.Core.Service; +using Admin.NET.Application.Const; +using Admin.NET.Application.Entity; +using Microsoft.AspNetCore.Http; +namespace Admin.NET.Application; +/// +/// 防伪扫码记录服务 +/// +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class AntiFakeRecordsService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository _rep; + private readonly PrintCodeDetailService _printCodeDetailService; + private readonly MaterialsService _materialsService; + private readonly ReportDetailTableService _reportDetailTableService; + public AntiFakeRecordsService(SqlSugarRepository rep, + PrintCodeDetailService printCodeDetailService, + MaterialsService materialsService, + ReportDetailTableService reportDetailTableService) + { + _rep = rep; + _printCodeDetailService = printCodeDetailService; + _materialsService = materialsService; + _reportDetailTableService = reportDetailTableService; + } + + /// + /// 分页查询防伪扫码记录 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + public async Task> Page(AntiFakeRecordsInput input) + { + var query = _rep.AsQueryable() + .WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u => + u.Code.Contains(input.SearchKey.Trim()) + || u.Ip.Contains(input.SearchKey.Trim()) + || u.City.Contains(input.SearchKey.Trim()) + || u.Addr.Contains(input.SearchKey.Trim()) + || u.CityCode.Contains(input.SearchKey.Trim()) + || u.Pro.Contains(input.SearchKey.Trim()) + || u.Remarks.Contains(input.SearchKey.Trim()) + ) + .WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Ip), u => u.Ip.Contains(input.Ip.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.City), u => u.City.Contains(input.City.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Addr), u => u.Addr.Contains(input.Addr.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.CityCode), u => u.CityCode.Contains(input.CityCode.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Pro), u => u.Pro.Contains(input.Pro.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim())) + .Select(); + if(input.DateRange != null && input.DateRange.Count >0) + { + DateTime? start= input.DateRange[0]; + query = query.WhereIF(start.HasValue, u => u.Date > start); + if (input.DateRange.Count >1 && input.DateRange[1].HasValue) + { + var end = input.DateRange[1].Value.AddDays(1); + query = query.Where(u => u.Date < end); + } + } + return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); + } + + /// + /// 增加防伪扫码记录 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + public async Task Add(AddAntiFakeRecordsInput input) + { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + return entity.Id; + } + + /// + /// 删除防伪扫码记录 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Delete")] + public async Task Delete(DeleteAntiFakeRecordsInput input) + { + var entity = await _rep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002); + //await _rep.FakeDeleteAsync(entity); //假删除 + await _rep.DeleteAsync(entity); //真删除 + } + + /// + /// 更新防伪扫码记录 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + public async Task Update(UpdateAntiFakeRecordsInput input) + { + var entity = input.Adapt(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// + /// 获取防伪扫码记录 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + public async Task Detail([FromQuery] QueryByIdAntiFakeRecordsInput input) + { + return await _rep.GetFirstAsync(u => u.Id == input.Id); + } + + /// + /// 获取防伪扫码记录列表 + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + public async Task> List() + { + return await _rep.AsQueryable().Select().ToListAsync(); + } + + + /// + /// 获取防伪扫码记录列表 + /// + /// + /// + [HttpGet] + [ApiDescriptionSettings(Name = "GetRecords")] + public async Task> GetRecords(string ?productCode) + { + return await _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(productCode), u => u.Code == productCode).Select().ToListAsync(); + } + + + /// + /// 获取打印条码详情 + /// + /// + /// + [HttpPost] + [ApiDescriptionSettings(Name = "AntiFakeCode")] + public async Task AntiFakeCode(AddAntiFakeRecordsInput input) + { + var code = await _printCodeDetailService.GetByProductCode(input.Code); + if (code == null) + { + throw Oops.Oh(ErrorCodeEnum.xg1002); + } + var material = await _materialsService.GetById(code.MaterialsId); + if (material == null) + { + throw Oops.Oh(ErrorCodeEnum.xg1002); + } + var model = new AntiFakeInfoOutput() + { + Addr = input.Addr, + Code = code.Code, + Brand = material.Brand, + Specifications = material.Specifications, + }; + var report = await _reportDetailTableService.Detail(new QueryByIdReportDetailTableInput() { Id = code.ReportTableId.Value }); + if (report!=null) + { + model.Batch= report.Batch; + } + return model; + } + +} + diff --git a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeInfoOutput.cs b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeInfoOutput.cs new file mode 100644 index 0000000..8192853 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeInfoOutput.cs @@ -0,0 +1,59 @@ +namespace Admin.NET.Application; + +/// +/// 防伪扫码输出参数 +/// +public class AntiFakeInfoOutput +{ + + /// + /// 条码 + /// + public string? Code { get; set; } + + /// + /// 地域信息 + /// + public string? Addr { get; set; } + + /// + /// 备注 + /// + public string? Remarks { get; set; } + /// + /// 名称 + /// + public string? Name { get; set; } + + /// + /// 单号 + /// + public string? OddNumber { get; set; } + + /// + /// 规格型号 + /// + public string? Specifications { get; set; } + + /// + /// 批次 + /// + public string? Batch { get; set; } + + /// + /// 品牌 + /// + public string? Brand { get; set; } + + /// + /// 生产线 + /// + public string? ProductionLine { get; set; } + + /// + /// 经销商 + /// + public string? Dealer { get; set; } +} + + diff --git a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsDto.cs b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsDto.cs new file mode 100644 index 0000000..5c41a25 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsDto.cs @@ -0,0 +1,53 @@ +namespace Admin.NET.Application; + + /// + /// 防伪扫码记录输出参数 + /// + 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; } + + } diff --git a/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsInput.cs b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsInput.cs new file mode 100644 index 0000000..b673dc8 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsInput.cs @@ -0,0 +1,142 @@ +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace Admin.NET.Application; + + /// + /// 防伪扫码记录基础输入参数 + /// + 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 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 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 new file mode 100644 index 0000000..2848932 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Service/AntiFakeRecords/Dto/AntiFakeRecordsOutput.cs @@ -0,0 +1,55 @@ +namespace Admin.NET.Application; + +/// +/// 防伪扫码记录输出参数 +/// +public class AntiFakeRecordsOutput +{ + /// + /// 主键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; } + +} + + diff --git a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailDto.cs b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailDto.cs index d26cc0d..8b7e13e 100644 --- a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailDto.cs +++ b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailDto.cs @@ -70,6 +70,10 @@ public class PrintCodeDetailDto /// public long? FatherId { get; set; } + /// + /// 物料ID + /// + public long? MaterialsId { get; set; } /// /// 打码时间 /// diff --git a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailInput.cs b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailInput.cs index 5d44862..deef220 100644 --- a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailInput.cs +++ b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/Dto/PrintCodeDetailInput.cs @@ -63,6 +63,11 @@ public class PrintCodeDetailBaseInput /// public virtual long? FatherId { get; set; } + /// + /// 物料ID + /// + public long? MaterialsId { get; set; } + /// /// 仓库ID /// @@ -184,6 +189,12 @@ public class PrintCodeDetailInput : BasePageInput /// 父节点ID /// public long? FatherId { get; set; } + + /// + /// 物料ID + /// + public long? MaterialsId { get; set; } + /// /// 打码时间 /// diff --git a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/PrintCodeDetailService.cs b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/PrintCodeDetailService.cs index 32e2f8d..50682d9 100644 --- a/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/PrintCodeDetailService.cs +++ b/Admin.NET/Admin.NET.Application/Service/PrintCodeDetail/PrintCodeDetailService.cs @@ -163,6 +163,5 @@ public class PrintCodeDetailService : IDynamicApiController, ITransient { return await _rep.GetFirstAsync(a => a.Code == productCode); } - } diff --git a/Web/.env.production b/Web/.env.production index d22f363..eabf086 100644 --- a/Web/.env.production +++ b/Web/.env.production @@ -2,4 +2,4 @@ ENV = production # 线上环境接口地址 -VITE_API_URL = http://139.199.191.197:9005 \ No newline at end of file +VITE_API_URL = http://49.234.181.176:9005 \ No newline at end of file diff --git a/Web/index.html b/Web/index.html index b533dc5..ed6f9be 100644 --- a/Web/index.html +++ b/Web/index.html @@ -14,7 +14,7 @@ /> - 广东海方程 + 冠威云
diff --git a/Web/src/api/main/antiFakeRecords.ts b/Web/src/api/main/antiFakeRecords.ts new file mode 100644 index 0000000..d0632c3 --- /dev/null +++ b/Web/src/api/main/antiFakeRecords.ts @@ -0,0 +1,59 @@ +import request from '/@/utils/request'; +enum Api { + AddAntiFakeRecords = '/api/antiFakeRecords/add', + DeleteAntiFakeRecords = '/api/antiFakeRecords/delete', + UpdateAntiFakeRecords = '/api/antiFakeRecords/update', + PageAntiFakeRecords = '/api/antiFakeRecords/page', + DetailAntiFakeRecords = '/api/antiFakeRecords/detail', + ListAntiFakeRecords = '/api/antiFakeRecords/list', +} + +// 增加防伪扫码记录 +export const addAntiFakeRecords = (params?: any) => + request({ + url: Api.AddAntiFakeRecords, + method: 'post', + data: params, + }); + +// 删除防伪扫码记录 +export const deleteAntiFakeRecords = (params?: any) => + request({ + url: Api.DeleteAntiFakeRecords, + method: 'post', + data: params, + }); + +// 编辑防伪扫码记录 +export const updateAntiFakeRecords = (params?: any) => + request({ + url: Api.UpdateAntiFakeRecords, + method: 'post', + data: params, + }); + +// 分页查询防伪扫码记录 +export const pageAntiFakeRecords = (params?: any) => + request({ + url: Api.PageAntiFakeRecords, + method: 'post', + data: params, + }); + +// 列表防伪扫码记录 +export const listAntiFakeRecords = () => + request({ + url: Api.ListAntiFakeRecords, + method: 'get', + data: { }, + }); + +// 详情防伪扫码记录 +export const detailAntiFakeRecords = (id: any) => + request({ + url: Api.DetailAntiFakeRecords, + method: 'get', + data: { id }, + }); + + diff --git a/Web/src/views/main/antiFakeRecords/component/editDialog.vue b/Web/src/views/main/antiFakeRecords/component/editDialog.vue new file mode 100644 index 0000000..3b57e8a --- /dev/null +++ b/Web/src/views/main/antiFakeRecords/component/editDialog.vue @@ -0,0 +1,170 @@ + + + + + + + diff --git a/Web/src/views/main/antiFakeRecords/index.vue b/Web/src/views/main/antiFakeRecords/index.vue new file mode 100644 index 0000000..dfb4e63 --- /dev/null +++ b/Web/src/views/main/antiFakeRecords/index.vue @@ -0,0 +1,228 @@ + + + + +