From 2e18e44f7618abf056df751f8ab87c5a4c34473b Mon Sep 17 00:00:00 2001 From: "747575620@qq.com" <747575620@qq.com> Date: Wed, 9 Aug 2023 17:59:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BPA.MES.Base.Application.xml | 528 ++++++++++++++++-- .../Entitys/App/Pztj_CraftStepsEntity.cs | 15 +- .../Entitys/Base/DictDataEntity.cs | 33 ++ .../Entitys/Base/DictTypeEntity.cs | 26 + .../BPA.MES.Base.Application/MQTT/IMessage.cs | 4 +- .../MQTT/MQTTService.cs | 20 +- .../MQTT/MsgPackage.cs | 20 +- .../CraftsInfoService/Dtos/CraftsStepsDto.cs | 29 +- .../Services/CraftsStepsService.cs | 43 +- .../Dtos/DeviceProductFunctionDto.cs | 12 + .../Services/DeviceProductFunctionService.cs | 6 +- .../Services/DictService/Dtos/DictDataDto.cs | 98 ++++ .../Services/DictService/Dtos/DictTypeDto.cs | 90 +++ .../DictService/Services/DictDataService.cs | 111 ++++ .../DictService/Services/DictTypeService.cs | 109 ++++ .../DictService/Services/IDictDataService.cs | 43 ++ .../DictService/Services/IDictTypeService.cs | 44 ++ .../WorkInfoService/Dtos/WorkInfoDto.cs | 8 +- .../Services/WorkInfoService.cs | 7 +- frontend/config/config.ts | 5 +- frontend/config/routes.ts | 3 +- frontend/package.json | 3 +- frontend/src/api/craftsinfo.ts | 20 + .../api/deviceInfo/dtos/deviceProduct.d.ts | 3 + .../dtos/deviceProductFunction.d.ts | 2 + frontend/src/api/dictType/dto.d.ts | 139 +++++ frontend/src/api/dictType/service.ts | 164 ++++++ frontend/src/pages/agvline/index.tsx | 14 +- frontend/src/pages/craftInfo/pot.tsx | 518 +++++++++-------- .../src/pages/deviceProductInfo/index.less | 3 + .../src/pages/deviceProductInfo/index.tsx | 81 ++- frontend/src/pages/dict/index.tsx | 169 ++++++ frontend/src/types/Crafts.d.ts | 16 +- 33 files changed, 2030 insertions(+), 356 deletions(-) create mode 100644 backend/BPA.MES.Base.Application/Entitys/Base/DictDataEntity.cs create mode 100644 backend/BPA.MES.Base.Application/Entitys/Base/DictTypeEntity.cs create mode 100644 backend/BPA.MES.Base.Application/Services/DictService/Dtos/DictDataDto.cs create mode 100644 backend/BPA.MES.Base.Application/Services/DictService/Dtos/DictTypeDto.cs create mode 100644 backend/BPA.MES.Base.Application/Services/DictService/Services/DictDataService.cs create mode 100644 backend/BPA.MES.Base.Application/Services/DictService/Services/DictTypeService.cs create mode 100644 backend/BPA.MES.Base.Application/Services/DictService/Services/IDictDataService.cs create mode 100644 backend/BPA.MES.Base.Application/Services/DictService/Services/IDictTypeService.cs create mode 100644 frontend/src/api/dictType/dto.d.ts create mode 100644 frontend/src/api/dictType/service.ts create mode 100644 frontend/src/pages/deviceProductInfo/index.less create mode 100644 frontend/src/pages/dict/index.tsx diff --git a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml index ca433b8..665ea93 100644 --- a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml +++ b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml @@ -286,14 +286,19 @@ 步骤 - + - 名称 + 功能描述 - + - 功能描述 + 设备产品功能Id + + + + + 功能参数 @@ -653,6 +658,62 @@ 编码 + + + 名 称 :码表数据 + 创 建 人 :yangxiao + 创建时间 : 2023/8/9 9:47:53 + 描 述 : + + + + + 类型id + + + + + 值 + + + + + 编码 + + + + + 排序 + + + + + 添加时间 + + + + + 名 称 :数据码表 + 创 建 人 :yangxiao + 创建时间 : 2023/8/9 9:48:05 + 描 述 : + + + + + 名称 + + + + + 编码 + + + + + 排序 + + 名 称 :分组信息 @@ -1151,7 +1212,7 @@ 描 述 : - + Mqtt通用服务 @@ -1161,26 +1222,16 @@ code - - - 消息ID - - - + 消息内容 - + 消息长度 - - - 消息版本 - - 名 称 : @@ -2058,7 +2109,7 @@ - 步骤Id + 工艺Id @@ -2066,31 +2117,21 @@ 步骤 - + - 名称 + 功能描述 - + - 单位 + 设备产品功能Id - + 功能参数 - - - 功能值 物料信息 - - - - - 功能描述 - - 增加 @@ -2146,6 +2187,16 @@ 主键 + + + 设备产品功能名称 + + + + + 设备产品Id + + 名 称 :工艺信息 @@ -2532,6 +2583,21 @@ 主键 + + + 设备产品Id + + + + + 设备产品名称 + + + + + 设备产品编号 + + 分页查询条件 @@ -3381,6 +3447,402 @@ + + + 名 称 :码表数据 + 创 建 人 :yangxiao + 创建时间 : 2023/8/9 9:56:11 + 描 述 : + + + + + 类型id + + + + + 值 + + + + + 编码 + + + + + 排序 + + + + + 增加 + + + + + 修改 + + + + + 主键 + + + + + 刪除 + + + + + 主键 + + + + + 普通查询条件 + + + + + 码表类型Id + + + + + 主键 + + + + + 分页查询条件 + + + + + 名称 + + + + + 编码 + + + + + 码表类型Id + + + + + 输出 + + + + + 主键 + + + + + 名 称 :码表类型 + 创 建 人 :yangxiao + 创建时间 : 2023/8/9 9:56:00 + 描 述 : + + + + + 名称 + + + + + 编码 + + + + + 排序 + + + + + 增加 + + + + + 修改 + + + + + 主键 + + + + + 刪除 + + + + + 主键 + + + + + 普通查询条件 + + + + + 主键 + + + + + 分页查询条件 + + + + + 类型Id + + + + + 名称 + + + + + 编码 + + + + + 输出 + + + + + 主键 + + + + + 名 称 :码表管理 + 创 建 人 :yangxiao + 创建时间 : 2023/8/9 10:01:19 + 描 述 : + + + + + 增加 + + + + + + + 删除 + + + + + + + + 详情 + + + + + + + + 列表 + + + + + + + 分页 + + + + + + + 下拉 + + + + + + + 更新 + + + + + + + + 名 称 :码表类型管理 + 创 建 人 :yangxiao + 创建时间 : 2023/8/9 10:01:35 + 描 述 : + + + + + 增加 + + + + + + + 删除 + + + + + + + + 详情 + + + + + + + + 列表 + + + + + + + 分页 + + + + + + + 下拉 + + + + + + + 更新 + + + + + + + + 名 称 :码表数据 + 创 建 人 :yangxiao + 创建时间 : 2023/8/9 10:00:06 + 描 述 : + + + + + 增加 + + + + + + 移除 + + + + + + 更新 + + + + + + 不分页列表 + + + + + + 分页列表 + + + + + + 查询单条 + + + + + + + 名 称 : + 创 建 人 :yangxiao + 创建时间 : 2023/8/9 10:00:23 + 描 述 : + + + + + 增加 + + + + + + 移除 + + + + + + 更新 + + + + + + 不分页列表 + + + + + + 分页列表 + + + + + + 查询单条 + + + + 名 称 :成品管理 diff --git a/backend/BPA.MES.Base.Application/Entitys/App/Pztj_CraftStepsEntity.cs b/backend/BPA.MES.Base.Application/Entitys/App/Pztj_CraftStepsEntity.cs index 0f9e7b3..33672d9 100644 --- a/backend/BPA.MES.Base.Application/Entitys/App/Pztj_CraftStepsEntity.cs +++ b/backend/BPA.MES.Base.Application/Entitys/App/Pztj_CraftStepsEntity.cs @@ -18,12 +18,19 @@ /// public int Step { get; set; } /// - /// 名称 + /// 功能描述 /// - public string Name { get; set; } + [SugarColumn(IsNullable = true)] + public string Description { get; set; } /// - /// 功能描述 + /// 设备产品功能Id + /// + [SugarColumn(IsNullable = true)] + public string DeviceProductFunctionId { get; set; } + /// + /// 功能参数 /// - public string Describe { get; set; } + [SugarColumn(IsNullable = true)] + public string Params { get; set; } } } diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/DictDataEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/DictDataEntity.cs new file mode 100644 index 0000000..0c2a890 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/DictDataEntity.cs @@ -0,0 +1,33 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :码表数据 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/8/9 9:47:53 + /// 描 述 : + /// + [SugarTable("dict_data")] + public class DictDataEntity : DEntityBase + { + /// + /// 类型id + /// + public string TypeId { get; set; } + /// + /// 值 + /// + public string Value { get; set; } + /// + /// 编码 + /// + public string Code { get; set; } + /// + /// 排序 + /// + public int Sort { get; set; } + /// + /// 添加时间 + /// + public DateTime CreateTime { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/DictTypeEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/DictTypeEntity.cs new file mode 100644 index 0000000..7feed45 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/DictTypeEntity.cs @@ -0,0 +1,26 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :数据码表 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/8/9 9:48:05 + /// 描 述 : + /// + [SugarTable("dict_type")] + public class DictTypeEntity : DEntityBase + { + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 编码 + /// + public string Code { get; set; } + /// + /// 排序 + /// + public int Sort { get; set; } + + } +} diff --git a/backend/BPA.MES.Base.Application/MQTT/IMessage.cs b/backend/BPA.MES.Base.Application/MQTT/IMessage.cs index 20e08c0..f8f5d28 100644 --- a/backend/BPA.MES.Base.Application/MQTT/IMessage.cs +++ b/backend/BPA.MES.Base.Application/MQTT/IMessage.cs @@ -6,7 +6,7 @@ /// 创建时间 : 2023/7/21 10:24:24 /// 描 述 : /// - public class IMessage + public interface IMessage { /// /// 消息ID @@ -16,6 +16,6 @@ /// /// 消息版本 /// - public Version MsgVersion { get; set; } = new Version("1.0"); + public Version MsgVersion { get; set; } } } diff --git a/backend/BPA.MES.Base.Application/MQTT/MQTTService.cs b/backend/BPA.MES.Base.Application/MQTT/MQTTService.cs index 6362a2c..d3bebf0 100644 --- a/backend/BPA.MES.Base.Application/MQTT/MQTTService.cs +++ b/backend/BPA.MES.Base.Application/MQTT/MQTTService.cs @@ -1,5 +1,6 @@ using Furion.JsonSerialization; using Furion.RemoteRequest.Extensions; +using Newtonsoft.Json; using System.Text; namespace BPA.MES.Base.Application @@ -30,27 +31,28 @@ namespace BPA.MES.Base.Application /// /// Mqtt通用服务 /// - public async Task MqttPublish(T payload, string topic,int messageId) + public async Task MqttPublish(IMessage payload, string topic,int messageId) { bool result = false; var mqttentity = await _dbContext.Queryable().FirstAsync(); string mqttAddress = mqttentity.Address; try { + payload.MessageId = messageId; + payload.MessageId = MessageID.WorkOrderIssued; + payload.MsgVersion = new Version(1, 0, 0, 0); + MsgPackage mp = new MsgPackage(); + mp.Message = payload; + mp.MessageLen = JSON.Serialize(payload).Length; //组装MQTT消息 - var entity = new MsgPackage() - { - MessageId = messageId, - Message = payload, - MessageLen = JSON.Serialize(payload).Length - }; + string ss = JsonConvert.SerializeObject(mp); var tem = await $"http://{mqttAddress}/api/v4/mqtt/publish".SetHeaders(new { Authorization = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes($"{mqttentity.Account}:{mqttentity.Pwd}")) }).SetBody(new { topic, - payload = JSON.Serialize(entity), + payload = JSON.Serialize(mp), qos = 2, retain = false, clientid = "pztj_service" @@ -79,7 +81,7 @@ namespace BPA.MES.Base.Application public interface IMQTTService { - Task MqttPublish(T payload, string topic, int messageId); + Task MqttPublish(IMessage payload, string topic, int messageId); Task GetMQTTConfig(); } diff --git a/backend/BPA.MES.Base.Application/MQTT/MsgPackage.cs b/backend/BPA.MES.Base.Application/MQTT/MsgPackage.cs index 6fe6642..ed8e173 100644 --- a/backend/BPA.MES.Base.Application/MQTT/MsgPackage.cs +++ b/backend/BPA.MES.Base.Application/MQTT/MsgPackage.cs @@ -1,24 +1,18 @@ -namespace BPA.MES.Base.Application +using Newtonsoft.Json; + +namespace BPA.MES.Base.Application { - public class MsgPackage + public class MsgPackage { - /// - /// 消息ID - /// - public int MessageId { get; set; } - /// /// 消息内容 /// - //[JsonProperty(TypeNameHandling = TypeNameHandling.Auto)] - public T Message { get; set; } + [JsonProperty(TypeNameHandling = TypeNameHandling.Auto)] + public IMessage Message { get; set; } /// /// 消息长度 /// public int MessageLen { get; set; } - /// - /// 消息版本 - /// - public Version MsgVersion { get; set; } = new Version(1, 0, 0, 0); + } } diff --git a/backend/BPA.MES.Base.Application/Services/CraftsInfoService/Dtos/CraftsStepsDto.cs b/backend/BPA.MES.Base.Application/Services/CraftsInfoService/Dtos/CraftsStepsDto.cs index a167259..d413cf5 100644 --- a/backend/BPA.MES.Base.Application/Services/CraftsInfoService/Dtos/CraftsStepsDto.cs +++ b/backend/BPA.MES.Base.Application/Services/CraftsInfoService/Dtos/CraftsStepsDto.cs @@ -9,7 +9,7 @@ public class CraftsStepsDto { /// - /// 步骤Id + /// 工艺Id /// public string CraftId { get; set; } /// @@ -17,25 +17,18 @@ /// public int Step { get; set; } /// - /// 名称 + /// 功能描述 /// - public string Name { get; set; } + public string Description { get; set; } /// - /// 单位 + /// 设备产品功能Id /// - public string Unit { get; set; } + public string DeviceProductFunctionId { get; set; } + /// /// 功能参数 /// - public string Value { get; set; } - /// - /// 功能值 物料信息 - /// - public string Materials { get; set; } - /// - /// 功能描述 - /// - public string Describe { get; set; } + public string Params { get; set; } } /// /// 增加 @@ -91,5 +84,13 @@ /// 主键 /// public string Id { get; set; } + /// + /// 设备产品功能名称 + /// + public string DeviceProductFunctionName { get; set; } + /// + /// 设备产品Id + /// + public string DeviceProductId { get; set; } } } diff --git a/backend/BPA.MES.Base.Application/Services/CraftsInfoService/Services/CraftsStepsService.cs b/backend/BPA.MES.Base.Application/Services/CraftsInfoService/Services/CraftsStepsService.cs index d22ad83..a3d908b 100644 --- a/backend/BPA.MES.Base.Application/Services/CraftsInfoService/Services/CraftsStepsService.cs +++ b/backend/BPA.MES.Base.Application/Services/CraftsInfoService/Services/CraftsStepsService.cs @@ -22,11 +22,7 @@ [HttpPost] public async Task Add(CraftsStepsAddInput input) { - var r_entity = await _dbContext.Queryable().FirstAsync(x => x.Name == input.Name); - if (r_entity != null) - { - throw Oops.Bah("名称已存在!"); - } + var step = await _dbContext.Queryable().Where(x=>x.CraftId==input.CraftId).MaxAsync(x => x.Step); Pztj_CraftStepsEntity entity = input.Adapt(); entity.Step = step+1; @@ -41,7 +37,19 @@ [HttpPost] public async Task Del(CraftsStepsDelInput input) { + var stepItem = await _dbContext.Queryable().Where(x => x.Id == input.Id).FirstAsync(); + string craftsId = stepItem.CraftId; + int step = stepItem.Step; var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); + if (res) + { + var stepList = await _dbContext.Queryable().Where(x => x.CraftId == craftsId).OrderBy(x=>x.Step).ToListAsync(); + for (int i = 0; i < stepList.Count; i++) + { + stepList[i].Step = i + 1; + } + await _dbContext.Updateable(stepList).ExecuteCommandAsync(); + } return res; } /// @@ -77,12 +85,18 @@ [HttpPost] public async Task> PagedList(CraftsStepsQueryPageInput input) { - var entity = await _dbContext.Queryable() - .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name)) - .WhereIF(!string.IsNullOrEmpty(input.CraftId), x => x.CraftId == input.CraftId) - .OrderBy(x=>x.Step) + var output = await _dbContext.Queryable() + .LeftJoin((a,b)=>a.DeviceProductFunctionId==b.Id) + .WhereIF(!string.IsNullOrEmpty(input.CraftId), (a, b) => a.CraftId == input.CraftId) + .OrderBy((a, b) => a.Step) + .Select((a,b)=>new CraftsStepsOutput + { + Id = a.Id.SelectAll(), + DeviceProductFunctionName = b.Name, + DeviceProductFunctionId = a.DeviceProductFunctionId, + DeviceProductId = b.DeviceProductId + }) .ToPagedListAsync(input.PageIndex, input.PageSize); - SqlSugarPagedList output = entity.Adapt>(); return output; } /// @@ -96,7 +110,7 @@ var entity = await _dbContext.Queryable().Select(x => new { key = x.Id, - value = x.Name + value = x.Description }).ToListAsync(); return entity; } @@ -109,13 +123,8 @@ [HttpPost] public async Task Update(CraftsStepsUpdateInput input) { - var isExit =await _dbContext.Queryable().Where(x => x.Id != input.Id && x.Name == input.Name).FirstAsync(); - if (isExit != null) - { - throw Oops.Bah("名称或编码已存在!"); - } Pztj_CraftStepsEntity entity = input.Adapt(); - var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); + var res = await _dbContext.Updateable(entity).IgnoreColumns(it => it.Step).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); return res; } /// diff --git a/backend/BPA.MES.Base.Application/Services/DeviceProduct/Dtos/DeviceProductFunctionDto.cs b/backend/BPA.MES.Base.Application/Services/DeviceProduct/Dtos/DeviceProductFunctionDto.cs index 3802412..ecd4b0c 100644 --- a/backend/BPA.MES.Base.Application/Services/DeviceProduct/Dtos/DeviceProductFunctionDto.cs +++ b/backend/BPA.MES.Base.Application/Services/DeviceProduct/Dtos/DeviceProductFunctionDto.cs @@ -65,6 +65,18 @@ /// 主键 /// public string Id { get; set; } + /// + /// 设备产品Id + /// + public string DeviceProductId { get; set; } + /// + /// 设备产品名称 + /// + public string Name { get; set; } + /// + /// 设备产品编号 + /// + public string Code { get; set; } } /// /// 分页查询条件 diff --git a/backend/BPA.MES.Base.Application/Services/DeviceProduct/Services/DeviceProductFunctionService.cs b/backend/BPA.MES.Base.Application/Services/DeviceProduct/Services/DeviceProductFunctionService.cs index f58d393..daab822 100644 --- a/backend/BPA.MES.Base.Application/Services/DeviceProduct/Services/DeviceProductFunctionService.cs +++ b/backend/BPA.MES.Base.Application/Services/DeviceProduct/Services/DeviceProductFunctionService.cs @@ -63,7 +63,11 @@ [HttpPost] public async Task> List(DeviceProductFunctionQueryInput input) { - var entity = await _dbContext.Queryable().ToListAsync(); + var entity = await _dbContext.Queryable() + .WhereIF(!string.IsNullOrEmpty(input.DeviceProductId), x => x.DeviceProductId==input.DeviceProductId) + .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name)) + .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code)) + .ToListAsync(); List output = entity.Adapt>(); return output; } diff --git a/backend/BPA.MES.Base.Application/Services/DictService/Dtos/DictDataDto.cs b/backend/BPA.MES.Base.Application/Services/DictService/Dtos/DictDataDto.cs new file mode 100644 index 0000000..7f89a63 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DictService/Dtos/DictDataDto.cs @@ -0,0 +1,98 @@ +namespace BPA.MES.Base.Application.Services +{ + /// + /// 名 称 :码表数据 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/8/9 9:56:11 + /// 描 述 : + /// + public class DictDataDto + { + /// + /// 类型id + /// + public string TypeId { get; set; } + /// + /// 值 + /// + public string Value { get; set; } + /// + /// 编码 + /// + public string Code { get; set; } + /// + /// 排序 + /// + public int Sort { get; set; } + } + /// + /// 增加 + /// + public class DictDataAddInput : DictDataDto + { + + } + /// + /// 修改 + /// + public class DictDataUpdateInput : DictDataDto + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 刪除 + /// + public class DictDataDelInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 普通查询条件 + /// + public class DictDataQueryInput + { + /// + /// 码表类型Id + /// + public string TypeId { get; set; } + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 分页查询条件 + /// + public class DictDataQueryPageInput : RequestPage + { + /// + /// 名称 + /// + public string Value { get; set; } + /// + /// 编码 + /// + public string Code { get; set; } + /// + /// 码表类型Id + /// + public string TypeId { get; set; } + } + /// + /// 输出 + /// + public class DictDataOutput : DictDataDto + { + /// + /// 主键 + /// + public string Id { get; set; } + //下面增加多的数据 + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DictService/Dtos/DictTypeDto.cs b/backend/BPA.MES.Base.Application/Services/DictService/Dtos/DictTypeDto.cs new file mode 100644 index 0000000..cfa5d25 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DictService/Dtos/DictTypeDto.cs @@ -0,0 +1,90 @@ +namespace BPA.MES.Base.Application.Services +{ + /// + /// 名 称 :码表类型 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/8/9 9:56:00 + /// 描 述 : + /// + public class DictTypeDto + { + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 编码 + /// + public string Code { get; set; } + /// + /// 排序 + /// + public int Sort { get; set; } + } + /// + /// 增加 + /// + public class DictTypeAddInput : DictTypeDto + { + + } + /// + /// 修改 + /// + public class DictTypeUpdateInput : DictTypeDto + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 刪除 + /// + public class DictTypeDelInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 普通查询条件 + /// + public class DictTypeQueryInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 分页查询条件 + /// + public class DictTypeQueryPageInput : RequestPage + { + /// + /// 类型Id + /// + public string TypeId { get; set; } + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 编码 + /// + public string Code { get; set; } + } + /// + /// 输出 + /// + public class DictTypeOutput : DictTypeDto + { + /// + /// 主键 + /// + public string Id { get; set; } + //下面增加多的数据 + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DictService/Services/DictDataService.cs b/backend/BPA.MES.Base.Application/Services/DictService/Services/DictDataService.cs new file mode 100644 index 0000000..b04044c --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DictService/Services/DictDataService.cs @@ -0,0 +1,111 @@ +namespace BPA.MES.Base.Application.Services +{ + /// + /// 名 称 :码表管理 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/8/9 10:01:19 + /// 描 述 : + /// + [ApiDescriptionSettings("码表管理", Name = "DictData", Tag = "码表数据", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class DictDataService: IDictDataService, ITransient, IDynamicApiController + { + private readonly ISqlSugarClient _dbContext; + public DictDataService(ISqlSugarClient db) + { + _dbContext = db; + } + /// + /// 增加 + /// + /// + /// + [HttpPost] + public async Task Add(DictDataAddInput input) + { + DictDataEntity entity = input.Adapt(); + return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 删除 + /// + /// + /// + /// + [HttpPost] + public async Task Del(DictDataDelInput input) + { + var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); + return res; + } + /// + /// 详情 + /// + /// + /// + /// + [HttpGet] + public async Task Detail(string Id) + { + var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == Id); + DictDataOutput output = entity.Adapt(); + return output; + } + /// + /// 列表 + /// + /// + /// + [HttpPost] + public async Task> List(DictDataQueryInput input) + { + var entity = await _dbContext.Queryable().WhereIF(!string.IsNullOrEmpty(input.TypeId), x => x.TypeId == input.TypeId).ToListAsync(); + List output = entity.Adapt>(); + return output; + } + /// + /// 分页 + /// + /// + /// + [HttpPost] + public async Task> PagedList(DictDataQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .WhereIF(!string.IsNullOrEmpty(input.Value), x => x.Value.Contains(input.Value)) + .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code)) + .WhereIF(!string.IsNullOrEmpty(input.TypeId),x=>x.TypeId==input.TypeId) + .ToPagedListAsync(input.PageIndex, input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + /// + /// 下拉 + /// + /// + /// + [HttpGet] + public async Task SelectList() + { + var entity = await _dbContext.Queryable().Select(x => new + { + key = x.Id, + value = x.Value + }).ToListAsync(); + return entity; + } + /// + /// 更新 + /// + /// + /// + /// + [HttpPost] + public async Task Update(DictDataUpdateInput input) + { + var entity = await _dbContext.Queryable().Where(x => x.Id == input.Id).FirstAsync(); + entity = input.Adapt(); + var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); + return res; + } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DictService/Services/DictTypeService.cs b/backend/BPA.MES.Base.Application/Services/DictService/Services/DictTypeService.cs new file mode 100644 index 0000000..a0749ac --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DictService/Services/DictTypeService.cs @@ -0,0 +1,109 @@ +namespace BPA.MES.Base.Application.Services +{ + /// + /// 名 称 :码表类型管理 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/8/9 10:01:35 + /// 描 述 : + /// + [ApiDescriptionSettings("码表类型管理", Name = "DictType", Tag = "码表数据", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class DictTypeService : IDictTypeService, ITransient, IDynamicApiController + { + private readonly ISqlSugarClient _dbContext; + public DictTypeService(ISqlSugarClient db) + { + _dbContext = db; + } + /// + /// 增加 + /// + /// + /// + [HttpPost] + public async Task Add(DictTypeAddInput input) + { + DictTypeEntity entity = input.Adapt(); + return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 删除 + /// + /// + /// + /// + [HttpPost] + public async Task Del(DictTypeDelInput input) + { + var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); + return res; + } + /// + /// 详情 + /// + /// + /// + /// + [HttpGet] + public async Task Detail(string Id) + { + var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == Id); + DictTypeOutput output = entity.Adapt(); + return output; + } + /// + /// 列表 + /// + /// + /// + [HttpPost] + public async Task> List(DictTypeQueryInput input) + { + var entity = await _dbContext.Queryable().ToListAsync(); + List output = entity.Adapt>(); + return output; + } + /// + /// 分页 + /// + /// + /// + [HttpPost] + public async Task> PagedList(DictTypeQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code)) + .ToPagedListAsync(input.PageIndex, input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + /// + /// 下拉 + /// + /// + /// + [HttpGet] + public async Task SelectList() + { + var entity = await _dbContext.Queryable().Select(x => new + { + key = x.Id, + value = x.Name + }).ToListAsync(); + return entity; + } + /// + /// 更新 + /// + /// + /// + /// + [HttpPost] + public async Task Update(DictTypeUpdateInput input) + { + var entity = await _dbContext.Queryable().Where(x => x.Id == input.Id).FirstAsync(); + entity = input.Adapt(); + var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); + return res; + } + } + } \ No newline at end of file diff --git a/backend/BPA.MES.Base.Application/Services/DictService/Services/IDictDataService.cs b/backend/BPA.MES.Base.Application/Services/DictService/Services/IDictDataService.cs new file mode 100644 index 0000000..fc989fd --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DictService/Services/IDictDataService.cs @@ -0,0 +1,43 @@ +namespace BPA.MES.Base.Application.Services +{ + /// + /// 名 称 :码表数据 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/8/9 10:00:06 + /// 描 述 : + /// + public interface IDictDataService + { + /// + /// 增加 + /// + /// + Task Add(DictDataAddInput input); + /// + /// 移除 + /// + /// + Task Del(DictDataDelInput input); + /// + /// 更新 + /// + /// + Task Update(DictDataUpdateInput input); + /// + /// 不分页列表 + /// + /// + Task> List(DictDataQueryInput input); + /// + /// 分页列表 + /// + /// + Task> PagedList(DictDataQueryPageInput input); + /// + /// 查询单条 + /// + /// + /// + Task Detail(string Id); + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DictService/Services/IDictTypeService.cs b/backend/BPA.MES.Base.Application/Services/DictService/Services/IDictTypeService.cs new file mode 100644 index 0000000..be8b79d --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DictService/Services/IDictTypeService.cs @@ -0,0 +1,44 @@ +namespace BPA.MES.Base.Application.Services +{ + /// + /// 名 称 : + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/8/9 10:00:23 + /// 描 述 : + /// + public interface IDictTypeService + { + /// + /// 增加 + /// + /// + Task Add(DictTypeAddInput input); + /// + /// 移除 + /// + /// + Task Del(DictTypeDelInput input); + /// + /// 更新 + /// + /// + Task Update(DictTypeUpdateInput input); + /// + /// 不分页列表 + /// + /// + Task> List(DictTypeQueryInput input); + /// + /// 分页列表 + /// + /// + Task> PagedList(DictTypeQueryPageInput input); + /// + /// 查询单条 + /// + /// + /// + Task Detail(string Id); + } +} + diff --git a/backend/BPA.MES.Base.Application/Services/WorkInfoService/Dtos/WorkInfoDto.cs b/backend/BPA.MES.Base.Application/Services/WorkInfoService/Dtos/WorkInfoDto.cs index 771f5a1..970b96a 100644 --- a/backend/BPA.MES.Base.Application/Services/WorkInfoService/Dtos/WorkInfoDto.cs +++ b/backend/BPA.MES.Base.Application/Services/WorkInfoService/Dtos/WorkInfoDto.cs @@ -28,6 +28,9 @@ /// 创建时间 /// public string CreateTime { get; set; } + public int MessageId { get; set; } + + public Version MsgVersion { get; set; } } /// /// 增加 @@ -113,8 +116,9 @@ /// 工单状态 /// public WorkOrderStatusEnum? Status { get; set; } - - + + + } /// /// 详情输出 diff --git a/backend/BPA.MES.Base.Application/Services/WorkInfoService/Services/WorkInfoService.cs b/backend/BPA.MES.Base.Application/Services/WorkInfoService/Services/WorkInfoService.cs index 608a700..8f21412 100644 --- a/backend/BPA.MES.Base.Application/Services/WorkInfoService/Services/WorkInfoService.cs +++ b/backend/BPA.MES.Base.Application/Services/WorkInfoService/Services/WorkInfoService.cs @@ -104,7 +104,7 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services /// /// /// - [HttpGet] + [HttpPost] public async Task> List(WorkInfoQueryInput input) { var entity = await _dbContext.Queryable() @@ -163,11 +163,10 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services Status = WorkOrderStatusEnum.Issued }); var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == workId); - - + WorkInfoOutput workInfo = entity.Adapt(); if (res) { - await _MQTTService.MqttPublish(entity, Topics.WorkOrderPush, MessageID.WorkOrderIssued); + await _MQTTService.MqttPublish(workInfo, Topics.WorkOrderPush, MessageID.WorkOrderIssued); } return true; } diff --git a/frontend/config/config.ts b/frontend/config/config.ts index 2d76b40..9e84d70 100644 --- a/frontend/config/config.ts +++ b/frontend/config/config.ts @@ -96,7 +96,10 @@ export default defineConfig({ * @description 内置了 babel import 插件 * @doc https://umijs.org/docs/max/antd#antd */ - antd: {}, + antd: { + configProvider: {}, + appConfig: {}, + }, /** * @name moment2dayjs 插件 * @description 将项目中的 moment 替换为 dayjs diff --git a/frontend/config/routes.ts b/frontend/config/routes.ts index d650e25..22f572d 100644 --- a/frontend/config/routes.ts +++ b/frontend/config/routes.ts @@ -31,6 +31,7 @@ { path: '/base/materials', name: '原料管理', component: './materials/index' }, { path: '/base/bucket', name: '桶管理', component: './bucket/index' }, { path: '/base/final', name: '成品管理', component: './final/index' }, + { path: '/base/dict',name:'数据字典',component:'./dict/index'} ] }, { @@ -59,7 +60,7 @@ ] }, { - path:'/agv',icon:'SettingOutlined',name:'agv点位', + path:'/agv',icon:'SettingOutlined',name:'agv管理', routes:[ {path:'/agv/agvbasic',name:'agv基础数据',component:'./agvbasic/index'}, {path:'/agv/agvline',name:'agv线路管理',component:'./agvline/index'} diff --git a/frontend/package.json b/frontend/package.json index e57cd81..1ba6edf 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -66,7 +66,8 @@ "react": "^18.2.0", "react-dev-inspector": "^1.8.3", "react-dom": "^18.2.0", - "react-helmet-async": "^1.3.0" + "react-helmet-async": "^1.3.0", + "uuid": "^9.0.0" }, "devDependencies": { "@ant-design/pro-cli": "^2.1.5", diff --git a/frontend/src/api/craftsinfo.ts b/frontend/src/api/craftsinfo.ts index ed4a3c9..c365305 100644 --- a/frontend/src/api/craftsinfo.ts +++ b/frontend/src/api/craftsinfo.ts @@ -128,6 +128,26 @@ export default { data: parms }) }, + //更新步骤 + UpdateStep(parms:CraftsTypes.craftsInfoUpdateInput){ + return request('/api/craftssteps/update',{ + method: 'POST', + data: parms + }) + }, + /** + * 删除 + * @param parms + * @returns + */ + DelStep(parms: CraftsTypes.craftsInfoDelInput) { + return request(`/api/craftssteps/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, //增加步骤 StepAdd(parms : CraftsTypes.Pztj_CraftStepsAddInput){ return request('/api/craftssteps/add',{ diff --git a/frontend/src/api/deviceInfo/dtos/deviceProduct.d.ts b/frontend/src/api/deviceInfo/dtos/deviceProduct.d.ts index 92a6aac..fcdf087 100644 --- a/frontend/src/api/deviceInfo/dtos/deviceProduct.d.ts +++ b/frontend/src/api/deviceInfo/dtos/deviceProduct.d.ts @@ -48,6 +48,9 @@ declare namespace deviceProduct { * 名称 */ name?: null | string; + deviceProductId? : null | string; + code? : null | string; + } /** * 查询分页输入参数 diff --git a/frontend/src/api/deviceInfo/dtos/deviceProductFunction.d.ts b/frontend/src/api/deviceInfo/dtos/deviceProductFunction.d.ts index 3c25a97..29798bf 100644 --- a/frontend/src/api/deviceInfo/dtos/deviceProductFunction.d.ts +++ b/frontend/src/api/deviceInfo/dtos/deviceProductFunction.d.ts @@ -20,6 +20,7 @@ declare namespace deviceProductFunction { * 名称 */ name: string; + params:string; } /** * 增加输入参数 @@ -51,6 +52,7 @@ declare namespace deviceProductFunction { * 名称 */ name?: null | string; + deviceProductId?: null | string; } /** * 查询分页输入参数 diff --git a/frontend/src/api/dictType/dto.d.ts b/frontend/src/api/dictType/dto.d.ts new file mode 100644 index 0000000..96a02bf --- /dev/null +++ b/frontend/src/api/dictType/dto.d.ts @@ -0,0 +1,139 @@ +declare namespace dictType { + /** + * 基类 + */ + type base_dto = { + /** + * 编码 + */ + code?: null | string; + /** + * 描述 + */ + sort?: null | string; + /** + * 名称 + */ + name?: null | string; + } + /** + * 增加输入参数 + */ + type addInput = base_dto + /** + * 更新输入参数 + */ + interface updateInput extends base_dto { + /** + * 主键 + */ + id: string + } + /** + * 删除输入参数 + */ + interface delInput { + /** + * 主键 + */ + id: string + } + /** + * 查询输入参数 + */ + interface queryParms { + /** + * 名称 + */ + name?: null | string; + } + /** + * 查询分页输入参数 + */ + interface queryPage { + pageIndex: number, + pageSize: number, + name:string + } + /** + * 查询输出参数 + */ + interface output extends base_dto { + /** + * 主键 + */ + id: string + } +} +declare namespace dictData { + /** + * 基类 + */ + type base_dto = { + /** + * 编码 + */ + code?: null | string; + /** + * 描述 + */ + sort?: null | string; + /** + * 名称 + */ + value?: null | string; + /** + * 类型id + */ + typeId:string; + + } + /** + * 增加输入参数 + */ + type addInput = base_dto + /** + * 更新输入参数 + */ + interface updateInput extends base_dto { + /** + * 主键 + */ + id: string + } + /** + * 删除输入参数 + */ + interface delInput { + /** + * 主键 + */ + id: string + } + /** + * 查询输入参数 + */ + interface queryParms { + /** + * 名称 + */ + name?: null | string; + } + /** + * 查询分页输入参数 + */ + interface queryPage { + pageIndex: number, + pageSize: number, + name:string + } + /** + * 查询输出参数 + */ + interface output extends base_dto { + /** + * 主键 + */ + id: string + } +} \ No newline at end of file diff --git a/frontend/src/api/dictType/service.ts b/frontend/src/api/dictType/service.ts new file mode 100644 index 0000000..c598468 --- /dev/null +++ b/frontend/src/api/dictType/service.ts @@ -0,0 +1,164 @@ + +import { request } from '@umijs/max'; + + +const dictTypeApi= { + /** + * 新增 + * @param parms + * @returns + */ + Add(parms: dictType.addInput) { + return request('/api/dictType/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 删除 + * @param parms + * @returns + */ + Del(parms: dictType.delInput) { + return request(`/api/dictType/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 修改 + * @param parms + * @returns + */ + Update(parms: dictType.updateInput) { + return request('/api/dictType/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 详情 + * @param parms + * @returns + */ + Detail(id: string) { + return request(`/api/dictType/detail?id=${id}`, { + method: 'GET' + }); + }, + /** + * 获取列表 + * @param parms + * @returns + */ + List(parms: dictType.queryParms) { + return request('/api/dictType/list', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 分页查询 + * @param parms + * @returns + */ + PagedList(parms: dictType.queryPage) { + return request('/api/dictType/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + +} + +const dictDataApi= { + /** + * 新增 + * @param parms + * @returns + */ + Add(parms: dictData.addInput) { + return request('/api/dictData/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 删除 + * @param parms + * @returns + */ + Del(parms: dictData.delInput) { + return request(`/api/dictData/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 修改 + * @param parms + * @returns + */ + Update(parms: dictData.updateInput) { + return request('/api/dictData/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 详情 + * @param parms + * @returns + */ + Detail(id: string) { + return request(`/api/dictData/detail?id=${id}`, { + method: 'GET' + }); + }, + /** + * 获取列表 + * @param parms + * @returns + */ + List(parms: dictData.queryParms) { + return request('/api/dictData/list', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 分页查询 + * @param parms + * @returns + */ + PagedList(parms: dictData.queryPage) { + return request('/api/dictData/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + +} + +export {dictTypeApi,dictDataApi} + diff --git a/frontend/src/pages/agvline/index.tsx b/frontend/src/pages/agvline/index.tsx index 329b2cb..36dc94e 100644 --- a/frontend/src/pages/agvline/index.tsx +++ b/frontend/src/pages/agvline/index.tsx @@ -43,7 +43,12 @@ const Agvline = () => { ellipsis: true, align: 'center' }, - + { + title: '线路编码', + dataIndex: 'code', + ellipsis: true, + align: 'center' + }, { title: '起始点位', dataIndex: 'startPointId', @@ -279,6 +284,13 @@ const Agvline = () => { > + + + + ); + }, + colProps: { + xs: 24, + md: 12, + }, + } + c.push(element) + }) + setDeviceParm(c); + } + if (dongtaiformRef) { + const element =JSON.parse(record.params!) + console.log('element',element); + + dongtaiformRef.setFieldsValue(element) + } + }, 1000); + // const element =JSON.parse(record.params!) + // setDeviceParm(element); }} > 配置设备参数 { const delData: CraftsTypes.Info = { id: record.id, - name: '', + step: 0, + craftId: '', + deviceProductId: '' }; - CraftsInfoAPI.Del(delData).then((r) => { + CraftsInfoAPI.DelStep(delData).then((r) => { if (r.statusCode === 200) { message.success(r.statusCode === 200 ? '删除成功' : r.message); - actionRef.current?.reload(); + action?.reload(); } }); }} @@ -393,8 +383,15 @@ const Index = () => { rowKey="step" search={false} pagination={false} - params ={stepparams} + params={stepparams} request={async (params = {}) => { + if (!params.craftId) { + return { + data: [], + success: false, + total: 0, + }; + } const jsonData: CraftsTypes.Pztj_CraftStepsPageInput = { pageIndex: params.current || 1, pageSize: params.pageSize || 10, @@ -417,21 +414,21 @@ const Index = () => { }} dragSortKey="step" onDragSortEnd={(newDataSource: any[]) => { - + // 模拟将排序后数据发送到服务器的场景 // remoteData = newDataSource; // 请求成功之后刷新列表 - newDataSource.map((item,index)=>{ - item.step = index+1; + newDataSource.map((item, index) => { + item.step = index + 1; }) console.log('排序后的数据', newDataSource); - CraftsInfoAPI.BatchUpdateStep(newDataSource).then((res:MyResponse.Content)=>{ + CraftsInfoAPI.BatchUpdateStep(newDataSource).then((res: MyResponse.Content) => { if (res.data) { sortActionRef.current?.reload(); message.success('修改列表排序成功'); } }); - + }} /> @@ -441,10 +438,10 @@ const Index = () => { * 新增工艺信息 */} 新增信息} + + title={工艺信息} open={isModalOpen} onCancel={() => { setIsModalOpen(false); @@ -452,48 +449,79 @@ const Index = () => { footer={false} > - - onFinish={async (values) => { - console.log(values); - }} - form={typeForm} - columns={columns} - /> - + + onFinish={async (values) => { + if (selectRowItem?.id) { + values.id = selectRowItem.id + CraftsInfoAPI.Update(values).then((res: MyResponse.Content) => { + if (res.data) { + message.success("修改成功!"); + setIsModalOpen(false) + actionRef.current?.reload(); + } else { + message.success(res.errors); + } + }); + } else { + CraftsInfoAPI.Add(values).then((res: MyResponse.Content) => { + if (res.data) { + message.success("添加成功!"); + setIsModalOpen(false) + actionRef.current?.reload(); + } else { + message.success(res.errors); + } + }); + } + }} + form={typeForm} + columns={columns} + /> + { - setIsSetpModalOpen(false); - }} - footer={false} + destroyOnClose + width={800} + open={isSetpModalOpen} + onCancel={() => { + setIsSetpModalOpen(false); + }} + footer={false} title={ 添加步骤 } > - { + { value.craftId = stepparams.craftId; console.log(value); - CraftsInfoAPI.StepAdd(value).then((res: MyResponse.Content)=>{ + if (value.id) { + CraftsInfoAPI.UpdateStep(value).then((res: MyResponse.Content) => { if (res.data) { message.success('提交成功'); setIsSetpModalOpen(false); sortActionRef.current?.reload() - }else{ + } else { message.success(res.errors); } - }) - - }}> - @@ -504,69 +532,75 @@ const Index = () => { * 配置设备参数弹框 */} 配置设备参数信息} open={isSchemaModalOpen} onCancel={() => { setIsSchemaModalOpen(false); + dongtaiformRef.resetFields() + setDeviceParm([]); }} footer={false} >
- { + + const out = deviceFun.find(x => x.id === value); + if (out?.params) { + const b = JSON.parse(out?.params); + console.log(b); + const c: any[] = []; + b.map((paramsItem: paramsType) => { + const element = { + title: paramsItem.paramName, + dataIndex: paramsItem.paramCode, + width: 'md', + renderFormItem: (dom, rowData, index) => { + return ( + + ); + }, + colProps: { + xs: 24, + md: 12, + }, + } + c.push(element) + }) + setDeviceParm(c); + } else { + setDeviceParm([]); } - - setDeviceParm(b); - - }} placeholder="下拉选择设备"> + }} placeholder="下拉选择功能"> { - devices.map((item: MySelectType.Select) => { - return - {item.value} + deviceFun.map((item: deviceProductFunction.output) => { + return + {item.name} }) } - -
trigger={点击我} - - rowProps={{ gutter: [16, 16], }} @@ -575,9 +609,31 @@ const Index = () => { }} grid={true} onFinish={async (values) => { - console.log(values); + console.log(formRef.getFieldsValue()); + + const froms: CraftsTypes.craftsInfoOutput = formRef.getFieldsValue() + if (!froms.deviceProductFunctionId) { + message.error("请选择设备产品功能"); + return; + } + console.log(froms.deviceProductFunctionId); + + const jsonData: CraftsTypes.craftsInfoUpdateInput = { + id: froms.id, + deviceProductFunctionId: froms.deviceProductFunctionId, + params: JSON.stringify(values), + deviceProductId: '' + } + CraftsInfoAPI.UpdateStep(jsonData).then((res: MyResponse.Content) => { + if (res.data) { + sortActionRef.current?.reload(); + message.success("成功!"); + setIsSchemaModalOpen(false) + } + }); }} columns={deviceParm} + form = {dongtaiformRef} />
diff --git a/frontend/src/pages/deviceProductInfo/index.less b/frontend/src/pages/deviceProductInfo/index.less new file mode 100644 index 0000000..4f67539 --- /dev/null +++ b/frontend/src/pages/deviceProductInfo/index.less @@ -0,0 +1,3 @@ +.sss{ + color: red; +} \ No newline at end of file diff --git a/frontend/src/pages/deviceProductInfo/index.tsx b/frontend/src/pages/deviceProductInfo/index.tsx index a5d102e..058e012 100644 --- a/frontend/src/pages/deviceProductInfo/index.tsx +++ b/frontend/src/pages/deviceProductInfo/index.tsx @@ -1,25 +1,44 @@ import { ArrowLeftOutlined, LeftCircleOutlined, LeftSquareTwoTone, PlusOutlined } from '@ant-design/icons'; -import type { +import { ActionType, ProColumns, + ProForm, ProFormInstance, } from '@ant-design/pro-components'; import { ProCard, ProTable, } from '@ant-design/pro-components'; -import { Button, Card, Col, Divider, Form, FormInstance, Input, message, Modal, Popconfirm, Row, Space } from 'antd'; +import {v4 as uuid} from 'uuid' +import { Button, Card, Col, Divider, Form, FormInstance, Input, message, Modal, Popconfirm, Row, Select, Space } from 'antd'; import { useState, useRef, useEffect } from 'react'; import { history } from '@umijs/max'; //引入接口 import deviceProductApi from '@/api/deviceInfo/services/deviceProduct' import deviceProducFunctiontApi from '@/api/deviceInfo/services/deviceProductFunction' +import { uniqueId, values } from 'lodash'; +import './index.less' interface ParmForm { paramName: string, - paramUnit: string + paramCode: string, + paramType:number, + paramUnit: string, + id:string, } + +const ParmsTypeList = [{ + + label:'数据', + value:0 +}, +{ + label:'数组', + value:1 +} +] + export default () => { const [fromType, setFromType] = useState('table') const ref = useRef(); @@ -34,7 +53,7 @@ export default () => { // useEffect(()=>{ // console.log("funcParams"); - + const[isParamsUnit,setIsParamsUnit] = useState(); // },[funcParams]) const [paramsModelOpen, setParamsModelOpen] = useState(false); @@ -89,6 +108,7 @@ export default () => { { setIsfunc(true) setSelectRow(row) + setFuncParams([]) }}> 设置功能 @@ -228,7 +248,7 @@ export default () => { search={false} columns={[ { - title: '功能Id', + title: '功能主键', dataIndex: 'id', search: false, readonly: true, @@ -258,13 +278,13 @@ export default () => { }>
参数名称:{res.paramName}
-
参数单位:{res.paramUnit}
+
参数代码:{res.paramCode}
+ }}>设置 - { + setParamsModelOpen(false)} open={paramsModelOpen}> + { + console.log(values); const b = paramsForm.getFieldsValue(); - funcParams.push(b); + if (b.id) { + funcParams.forEach((res) => { + if (res.id===b.id) { + res.paramCode = b.paramCode; + res.paramName = b.paramName; + res.paramType = b.paramType; + res.paramUnit = b.paramUnit; + } + }) + setFuncParams(funcParams); + }else{ + b.id = uuid() + funcParams.push(b); + } setFuncParams(funcParams); console.log(b); setParamsModelOpen(false) - }} onCancel={() => { setParamsModelOpen(false) }} open={paramsModelOpen}> -
- + }}> + + - + + + + + + + - +
) @@ -361,6 +413,7 @@ export default () => { onSubmit={(params: any) => { console.log(params, funcParams); params.params = JSON.stringify(funcParams); + params.deviceProductId = selectRow?.id if (funcfromType === 'form') { if (params.id) { deviceProducFunctiontApi.Update(params).then((res: MyResponse.Content) => { diff --git a/frontend/src/pages/dict/index.tsx b/frontend/src/pages/dict/index.tsx new file mode 100644 index 0000000..123bb67 --- /dev/null +++ b/frontend/src/pages/dict/index.tsx @@ -0,0 +1,169 @@ +import { PlusOutlined } from '@ant-design/icons'; +import type { + ActionType, + ProColumns, + ProFormInstance, +} from '@ant-design/pro-components'; +import { + ProCard, + ProTable, +} from '@ant-design/pro-components'; +import { Button, message, Popconfirm, Space } from 'antd'; +import { useState, useRef } from 'react'; +//引入接口 +import {dictTypeApi,dictDataApi} from '@/api/dictType/service' + +export default () => { + const [fromType, setFromType] = useState('table') + const ref = useRef(); + const actionRef = useRef(); + + const Reolod = () =>{ + ref.current?.resetFields() + actionRef.current?.reload() + } + const columns: ProColumns[] = [ + { + title: '主键', + dataIndex: 'id', + hideInTable:true, + hideInForm: true, + search: false, + }, + { + title: '名称', + dataIndex: 'name', + copyable: true, + ellipsis: true, + }, + { + title: '编码', + hideInTable: true, + hideInDescriptions: true, + dataIndex: 'code', + + }, + { + title: '描述', + dataIndex: 'des', + width: 120, + search: false, + }, + { + title: '操作', + valueType: 'option', + dataIndex: 'id', + render: (text, row) => [ + +
{ + setFromType('form') + ref.current?.setFieldsValue(row) + }} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> + 编辑 + + { + + dictTypeApi.Del(row).then((res: MyResponse.Content) => { + if (res.statusCode === 200) { + message.info("删除成功!"); + Reolod() + } else { + message.error(res.errors); + } + }) + }} + onCancel={() => { + message.info('已取消删除'); + }} + okText="确认" + cancelText="关闭" + > + + 删除 + + + + ], + }, + ]; + + return ( + <> + + {fromType === 'form' ? : ""} + + columns={columns} + type={fromType as 'table'} + formRef={ref} + actionRef={actionRef} + onSubmit={(params: any) => { + console.log(params); + if (fromType === 'form') { + if (params.id) { + dictTypeApi.Update(params).then((res: MyResponse.Content) => { + if (res.statusCode === 200) { + message.info("更新成功!"); + setFromType('table') + Reolod() + } else { + message.error(res.errors); + } + }) + } else { + dictTypeApi.Add(params).then((res: MyResponse.Content) => { + if (res.statusCode === 200) { + message.info("新增成功!"); + setFromType('table') + Reolod() + } else { + message.error(res.errors); + } + }) + } + } + }} + request={async (params = {}) => { + const jsonData: dictType.queryPage = { + pageIndex: params.current || 1, + pageSize: params.pageSize || 10, + name: params.name || '', + }; + const response = await dictTypeApi.PagedList(jsonData); + if (response.statusCode === 200) { + return { + data: response.data.items, + success: true, + total: response.data.total, + }; + } else { + return { + data: [], + success: false, + total: 0, + }; + } + }} + pagination={{ + pageSize: 5, + }} + rowKey="id" + dateFormatter="string" + headerTitle="列表" + toolBarRender={() => [ + , + ]} + /> + + + ); +}; \ No newline at end of file diff --git a/frontend/src/types/Crafts.d.ts b/frontend/src/types/Crafts.d.ts index 42103d0..2771d1a 100644 --- a/frontend/src/types/Crafts.d.ts +++ b/frontend/src/types/Crafts.d.ts @@ -20,14 +20,13 @@ declare enum CraftsDeviceType{ } declare namespace CraftsTypes { interface Info{ - id: any; - name: string, - step: number, - craftId:string, - deviceType:number - // craftsType:string, - // describe:string, - // repairDate: any + id:string, + step?:null | number, + craftId?: null |string, + deviceProductId:string, + description?:null | string, + deviceProductFunctionId?:null | string, + params?:null | string } interface Page { @@ -147,6 +146,7 @@ declare namespace CraftsTypes { id?: string | null; } export interface Pztj_CraftStepsAddInput{ + id?:null|string, craftId:string, step:string, name:string,