@@ -29,7 +29,6 @@ | |||
<Folder Include="Services\MaterialService\" /> | |||
<Folder Include="Services\RecipesService\" /> | |||
<Folder Include="Services\CustomCodeService\" /> | |||
<Folder Include="Services\SystemService\" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -37,6 +37,10 @@ | |||
/// </summary> | |||
public const string CLAINM_ISAUTH = "0"; | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public const string CLAINM_ROLEID = ""; | |||
/// <summary> | |||
/// 微信session_key | |||
/// </summary> | |||
public const string SESSION_KEY = "session_key"; | |||
@@ -60,6 +64,10 @@ | |||
/// 是否是管理员 | |||
/// </summary> | |||
public const bool ISADMIN = false; | |||
/// <summary> | |||
/// 所有缓存关键字集合 | |||
/// </summary> | |||
public const string CACHE_KEY_ALL = "allkey"; | |||
} | |||
public class MQTTConfig | |||
@@ -24,6 +24,11 @@ | |||
/// <summary> | |||
/// 原料分组 | |||
/// </summary> | |||
public string Gourp { get; set; } | |||
public string Type { get; set; } | |||
/// <summary> | |||
/// 每升重量 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string WeightPerLiter { get; set; } | |||
} | |||
} |
@@ -23,12 +23,17 @@ | |||
/// </summary> | |||
public string FinalId { get; set; } | |||
/// <summary> | |||
/// 指定设备Id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string DeviceId { get; set; } | |||
/// <summary> | |||
/// 产量 | |||
/// </summary> | |||
public string Number { get;set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
public string CreateTime { get; set; } | |||
public DateTime CreateTime { get; set; } | |||
} | |||
} |
@@ -21,5 +21,9 @@ | |||
/// 创建时间 | |||
/// </summary> | |||
public DateTime CreateTime { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
} | |||
} |
@@ -1,23 +0,0 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 :设备 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 :2023/3/2 13:51:45 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("devices_info")] | |||
public class DevicesInfoEntity: DEntityBase | |||
{ | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
[Required(ErrorMessage = "名称不能为空")] | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 编码 | |||
/// </summary> | |||
[Required(ErrorMessage = "编码不能为空")] | |||
public string Code { get; set; } | |||
} | |||
} |
@@ -21,5 +21,9 @@ | |||
/// 账号 | |||
/// </summary> | |||
public string Account { get; set; } | |||
/// <summary> | |||
/// 消息发布路由 4.0和5.0不一样 | |||
/// </summary> | |||
public string MsgPublishRoute { get; set; } | |||
} | |||
} |
@@ -1,31 +0,0 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 :物料 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 :2023/3/2 13:52:00 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("materials_info")] | |||
public class MaterialsInfoEntity: DEntityBase | |||
{ | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
[Required(ErrorMessage = "名称不能为空")] | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 编码 | |||
/// </summary> | |||
[Required(ErrorMessage = "编码不能为空")] | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 单位 | |||
/// </summary> | |||
public string Unit { get; set; } | |||
/// <summary> | |||
/// 每秒出水量(g) | |||
/// </summary> | |||
public string Wos { get; set; } | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
/// 创建时间 : 2023/8/21 10:17:57 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("alarm_log")] | |||
[SugarTable("alarm")] | |||
public class AlarmLogEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
@@ -14,23 +14,41 @@ | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 报警值 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Value { get; set; } | |||
/// <summary> | |||
/// 报警等级 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Grade { get; set; } | |||
/// <summary> | |||
/// 设备名称 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string DeviceName { get; set; } | |||
/// <summary> | |||
/// 日期 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Date { get; set; } | |||
/// <summary> | |||
/// 时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Time { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public DateTime CreateDate { get; set; } | |||
/// <summary> | |||
/// 类型 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string LogType { get; set; } | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
/// 创建时间 : 2023/8/21 10:18:13 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("program_log")] | |||
[SugarTable("programlog")] | |||
public class ProgramLogEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
@@ -20,5 +20,21 @@ | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 日期 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Date { get; set; } | |||
/// <summary> | |||
/// 时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Time { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public DateTime CreateDate { get; set; } | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
/// 创建时间 : 2023/8/21 10:18:34 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("run_log")] | |||
[SugarTable("runlog")] | |||
public class RunLogEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
@@ -14,11 +14,25 @@ | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string LogType { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 日期 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Date { get; set; } | |||
/// <summary> | |||
/// 时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Time { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public DateTime CreateDate { get; set; } | |||
} | |||
} |
@@ -26,5 +26,11 @@ | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 日志时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public DateTime CreateDate { get; set; } | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 授权模板表 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:31:11 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("sys_authorizetemplate")] | |||
public class AuthorizeTemplateEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
public DateTime? CreateAt { get; set; } | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public bool IsDeleted { get; set; } | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 : 授权模板子项表 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:31:27 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("sys_authorizetemplate_item")] | |||
public class AuthorizeTemplateItemEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 模板编号 | |||
/// </summary> | |||
public string TB_TemplateId { get; set; } | |||
/// <summary> | |||
/// 模块编号 | |||
/// </summary> | |||
public string TB_ModuleId { get; set; } | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public bool IsDeleted { get; set; } | |||
} | |||
} |
@@ -1,30 +0,0 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 :授权对象表 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:31:39 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("sys_authorizetemplatemap")] | |||
public class AuthorizeTemplateMapEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 授权模板编号 | |||
/// </summary> | |||
public string TemplateId { get; set; } | |||
/// <summary> | |||
/// 授权对象编号(用户编号,角色编号) | |||
/// </summary> | |||
public string ObjectId { get; set; } | |||
/// <summary> | |||
/// 授权类型 1:用户,2:角色 | |||
/// </summary> | |||
public int AuthorizeType { get; set; } | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public bool IsDeleted { get; set; } | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 :角色权限表 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/8/31 15:56:02 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("sys_role_module")] | |||
public class RoleModuleEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
/// <summary> | |||
/// 模块Id | |||
/// </summary> | |||
public string ModuleId { get; set; } | |||
/// <summary> | |||
/// 父级模块 | |||
/// </summary> | |||
[SugarColumn(IsNullable =true)] | |||
public string ParentId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
using BPA.MES.Base.Application.Services; | |||
using BPA.MES.Base.Application.Services.AGVService.Dtos; | |||
using Furion.JsonSerialization; | |||
using Microsoft.AspNetCore.Mvc.Filters; | |||
using System.Diagnostics; | |||
namespace BPA.MES.Base.Application | |||
{ | |||
public class AGVAttribute : ActionFilterAttribute | |||
{ | |||
/// <summary> | |||
/// 执行操作前后 | |||
/// </summary> | |||
/// <param name="context"></param> | |||
/// <param name="next"></param> | |||
/// <returns></returns> | |||
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) | |||
{ | |||
// 获取 HttpContext 和 HttpRequest 对象 | |||
var httpContext = context.HttpContext; | |||
var httpRequest = httpContext.Request; | |||
var sw = new Stopwatch(); | |||
sw.Start(); | |||
var actionContext = await next(); | |||
sw.Stop(); | |||
var server = App.GetService<IAGVThirdPartyService>(); | |||
var contentstring = JSON.Serialize(context.ActionArguments["input"]); | |||
AGVLoadAndUnloadRequest input = JSON.Deserialize<AGVLoadAndUnloadRequest>(contentstring); | |||
Roller_JobRequest roller_Job = new() | |||
{ | |||
AgvCode = input.Body.Event.agvCode, | |||
Complete = true, | |||
JobId = input.Body.Event.jobId, | |||
MsgId = input.Body.Event.msgId | |||
}; | |||
await server.RollerJobExecute(roller_Job); | |||
} | |||
} | |||
} |
@@ -11,12 +11,14 @@ namespace BPA.MES.Base.Application | |||
/// 创建时间 : 2022/11/18 15:38:40 | |||
/// 描 述 : | |||
/// </summary> | |||
public class MQTTService : IMQTTService, ITransient | |||
public class MQTTService : IMQTTService, ITransient, IDynamicApiController | |||
{ | |||
private readonly ISqlSugarClient _dbContext; | |||
public MQTTService(ISqlSugarClient db) | |||
ISysCacheService _sysCacheService; | |||
public MQTTService(ISqlSugarClient db, ISysCacheService sysCacheService) | |||
{ | |||
_dbContext = db; | |||
_sysCacheService = sysCacheService; | |||
} | |||
public async Task GetMQTTConfig() | |||
{ | |||
@@ -26,49 +28,90 @@ namespace BPA.MES.Base.Application | |||
MQTTConfig.Address = entity.Address; | |||
MQTTConfig.Account = entity.Account; | |||
MQTTConfig.Pwd = entity.Pwd; | |||
await _sysCacheService.SetAsync("mqtt", entity); | |||
} | |||
} | |||
/// <summary> | |||
/// Mqtt通用服务 | |||
/// </summary> | |||
public async Task<bool> MqttPublish(IMessage payload, string topic,int messageId) | |||
public async Task<bool> MqttPublish(MqttPublishDto input) | |||
{ | |||
bool result = false; | |||
MQTTInfoEntity mqttentity = new(); | |||
mqttentity = await _sysCacheService.GetAsync<MQTTInfoEntity>("mqtt"); | |||
if (mqttentity==null) | |||
{ | |||
mqttentity = await _dbContext.Queryable<MQTTInfoEntity>().FirstAsync(); | |||
await _sysCacheService.SetAsync("mqtt", mqttentity); | |||
} | |||
try | |||
{ | |||
input.Payload.MessageId = input.MessageId; | |||
input.Payload.MsgVersion = new Version(1, 0, 0, 0); | |||
MsgPackage mp = new() | |||
{ | |||
Message = input.Payload, | |||
MessageLen = JSON.Serialize(input.Payload).Length | |||
}; | |||
//组装MQTT消息 | |||
var tem = await $"http://{mqttentity.Address}{mqttentity.MsgPublishRoute}".SetHeaders(new | |||
{ | |||
Authorization = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes($"{mqttentity.Account}:{mqttentity.Pwd}")) | |||
}).SetBody(new | |||
{ | |||
input.Topic, | |||
payload = JsonConvert.SerializeObject(mp), | |||
qos = 2, | |||
retain = false, | |||
clientid = "pztj_service" | |||
}).PostAsStringAsync(); | |||
var res = JSON.Deserialize<MqttResult>(tem); | |||
if (res.Code == 0 || res.Reason_code<100 || !string.IsNullOrEmpty(res.Id)) | |||
{ | |||
result = true; | |||
} | |||
Console.WriteLine($"_____________________MQTT发消息:{JsonConvert.SerializeObject(mp)}"); | |||
} | |||
catch | |||
{ | |||
} | |||
return result; | |||
} | |||
[AllowAnonymous] | |||
public async Task<bool> MqttTestPublish(string topic, string msg) | |||
{ | |||
bool result = false; | |||
var mqttentity = await _dbContext.Queryable<MQTTInfoEntity>().FirstAsync(); | |||
string mqttAddress = mqttentity.Address; | |||
try | |||
{ | |||
payload.MessageId = messageId; | |||
payload.MsgVersion = new Version(1, 0, 0, 0); | |||
MsgPackage mp = new MsgPackage(); | |||
mp.Message = payload; | |||
mp.MessageLen = JSON.Serialize(payload).Length; | |||
//组装MQTT消息 | |||
var tem = await $"http://{mqttAddress}/api/v4/mqtt/publish".SetHeaders(new | |||
var tem = await $"http://{mqttAddress}/api/v5/publish".SetHeaders(new | |||
{ | |||
Authorization = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes($"{mqttentity.Account}:{mqttentity.Pwd}")) | |||
}).SetBody(new | |||
{ | |||
topic, | |||
payload = JsonConvert.SerializeObject(mp), | |||
payload = msg, | |||
qos = 2, | |||
retain = false, | |||
clientid = "pztj_service" | |||
}).PostAsStringAsync(); | |||
var res = JSON.Deserialize<MqttResult>(tem); | |||
if (res.Code == 0) | |||
if (res.Code == 0 || res.Reason_code < 100 || !string.IsNullOrEmpty(res.Id)) | |||
{ | |||
result = true; | |||
} | |||
} | |||
catch | |||
{ | |||
} | |||
return result; | |||
} | |||
} | |||
public class MqttResult | |||
@@ -77,11 +120,25 @@ namespace BPA.MES.Base.Application | |||
/// code | |||
/// </summary> | |||
public int Code { get; set; } | |||
/// <summary> | |||
/// reason_code | |||
/// </summary> | |||
public int Reason_code { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public string Id { get; set; } | |||
} | |||
public class MqttPublishDto | |||
{ | |||
public IMessage Payload { get; set; } | |||
public string Topic { get; set; } | |||
public int MessageId { get; set; } | |||
} | |||
public interface IMQTTService | |||
{ | |||
Task<bool> MqttPublish(IMessage payload, string topic, int messageId); | |||
Task<bool> MqttPublish(MqttPublishDto input); | |||
Task GetMQTTConfig(); | |||
} | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.AGV; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -7,10 +8,37 @@ using System.Threading.Tasks; | |||
namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||
{ | |||
public class Roller_JobRequest | |||
{ | |||
public string Url { get; set; } | |||
[Required(ErrorMessage = "[{0}]不能为空")] | |||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||
public string AgvCode { get; set; } | |||
[Required(ErrorMessage = "[{0}]不能为空")] | |||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||
public string JobId { get; set; } | |||
[Required(ErrorMessage = "[{0}]不能为空")] | |||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||
public string MsgId { get; set; } | |||
public bool? Complete { get; set; } | |||
} | |||
public class AGVExecuteReplyRequest | |||
{ | |||
public AgvHeader Header { get; set; } | |||
public AgvReplyBody Body { get; set; } | |||
} | |||
public class AgvReplyBody | |||
{ | |||
public AGVExecuteReplyDto Event { get; set; } | |||
} | |||
public class AGVExecuteReplyMQTT: IMessage | |||
{ | |||
public AGVExecuteReplyDto Event { get; set; } | |||
@@ -19,6 +47,12 @@ namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||
} | |||
public class AGVLoadAndUnloadRequest | |||
{ | |||
public AgvHeader Header { get; set; } | |||
public AGVLoadAndUnloadBody Body { get; set; } | |||
} | |||
public class AGVLoadAndUnloadBody | |||
{ | |||
public AGVLoadAndUnloadDto Event { get; set; } | |||
} | |||
@@ -30,6 +64,28 @@ namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||
public Version MsgVersion { get; set; } | |||
} | |||
public class AgvBody | |||
{ | |||
public AgvHeader Header { get; set; } | |||
public AgvRetrun Body { get; set; } | |||
} | |||
public class AgvHeader | |||
{ | |||
public string RequestId { get; set; } | |||
public string Timestamp { get; set; } | |||
public string Version { get; set; } | |||
} | |||
public class AgvRetrun | |||
{ | |||
public string Code { get; set; } | |||
public bool Success { get; set; } | |||
public string Message { get; set; } | |||
public object? Data { get; set; } | |||
} | |||
/// <summary> | |||
/// 任务完成回报Dto | |||
/// </summary> | |||
@@ -51,7 +107,7 @@ namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||
public string jobId { get; set; } | |||
/// <summary> | |||
/// | |||
/// 任务状态 | |||
/// </summary> | |||
public string state { get; set; } | |||
@@ -275,4 +331,143 @@ namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||
POINT_ROLLER_MOVE=2 | |||
} | |||
public class KC_Response | |||
{ | |||
public KC_Response() | |||
{ | |||
Data = new(); | |||
} | |||
/// <summary> | |||
/// 是否成功 | |||
/// </summary> | |||
public bool Success { get; set; } | |||
/// <summary> | |||
/// 状态码 | |||
/// </summary> | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 消息 | |||
/// </summary> | |||
public string Message { get; set; } | |||
/// <summary> | |||
/// 返回数据数组 | |||
/// </summary> | |||
public List<KC_Response_Data> Data { get; set; } | |||
} | |||
public class KC_Response_Data | |||
{ | |||
/// <summary> | |||
/// 状态码 | |||
/// </summary> | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 消息体 | |||
/// </summary> | |||
public string Message { get; set; } | |||
/// <summary> | |||
/// 任务编号 | |||
/// </summary> | |||
public string RobotJobId { get; set; } | |||
} | |||
/// <summary> | |||
/// AGV请求 | |||
/// </summary> | |||
public class KC_ExecuteRequest | |||
{ | |||
/// <summary> | |||
/// 快仓api地址 | |||
/// </summary> | |||
public string Url { get; set; } | |||
/// <summary> | |||
/// 任务编码 | |||
/// </summary> | |||
public string RobotJobId { get; set; } | |||
/// <summary> | |||
/// 仓库编码 默认值1 | |||
/// </summary> | |||
public long WarehouseId { get; set; } = 1; | |||
public string RobotJobGroupId { get; set; } | |||
public int? Sequence { get; set; } | |||
public string RobotJobGroupNum { get; set; } | |||
/// <summary> | |||
/// 优先级 0-99 越高越先执行 | |||
/// </summary> | |||
public int? JobPriority { get; set; } | |||
public int? JobPriorityType { get; set; } | |||
public string Deadline { get; set; } | |||
public string AgvType { get; set; } | |||
public string AgvEndPoint { get; set; } | |||
public bool NeedOperation { get; set; } | |||
public string AgvCode { get; set; } | |||
public int? TaskCountDown { get; set; } = 0; | |||
public string BusinessType { get; set; } | |||
[Required(ErrorMessage = "[{0}]不能为空")] | |||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||
//任务类型 用来滚筒点对点 POINT_ROLLER_MOVE n8H7jX | |||
public string JobType { get; set; } = "POINT_ROLLER_MOVE"; | |||
[Required(ErrorMessage = "[{0}]不能为空")] | |||
public KC_JobDataRequest? JobData { get; set; } | |||
} | |||
/// <summary> | |||
/// 任务下发起止点信息 | |||
/// </summary> | |||
public class KC_JobDataRequest | |||
{ | |||
/// <summary> | |||
/// 用户自定义信息编号 | |||
/// </summary> | |||
public string ContainerCode { get; set; } | |||
/// <summary> | |||
/// 起点点位 | |||
/// </summary> | |||
[Required(ErrorMessage = "[{0}]不能为空")] | |||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||
public string StartPoint { get; set; } | |||
/// <summary> | |||
/// 终点点位 | |||
/// </summary> | |||
[Required(ErrorMessage = "[{0}]不能为空")] | |||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||
public string EndPoint { get; set; } | |||
/// <summary> | |||
/// 上料方式 自动/人工 | |||
/// </summary> | |||
public bool? AutoLoad { get; set; } | |||
/// <summary> | |||
/// 上料交互方式 //接口对接 false | |||
/// </summary> | |||
public bool? EnableIOLoad { get; set; } = false; | |||
/// <summary> | |||
/// 下料方式 true自动/false人工 | |||
/// </summary> | |||
public bool? AutoUnload { get; set; } | |||
/// <summary> | |||
/// 接口对接 false | |||
/// </summary> | |||
public bool? EnableIOUnload { get; set; } = false; | |||
/// <summary> | |||
/// 起点设备ID | |||
/// </summary> | |||
public long LoadEquipmentId { get; set; } | |||
/// <summary> | |||
/// 目标设备ID | |||
/// </summary> | |||
public long UnloadEquipmentId { get; set; } | |||
public long LoadInteractive { get; set; } | |||
public long LoadHeight { get; set; } | |||
public long UnloadHeight { get; set; } | |||
} | |||
} |
@@ -1,24 +1,21 @@ | |||
using BPA.AGV; | |||
using BPA.MES.Base.Application.Services.AGVService.Dtos; | |||
using MQTTnet.Client; | |||
using MQTTnet.Client.Publishing; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Furion.EventBus; | |||
using Furion.JsonSerialization; | |||
using Furion.RemoteRequest.Extensions; | |||
namespace BPA.MES.Base.Application.Services.AGVService.Services | |||
namespace BPA.MES.Base.Application.Services | |||
{ | |||
/// <summary> | |||
/// AGV第三方api | |||
/// </summary> | |||
[AllowAnonymous, NonUnify] | |||
[ApiDescriptionSettings("AGV管理", Name = "AgvThirdParty", Tag = "AGV第三方api", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||
public class AGVThirdPartyService:IAGVThirdPartyService, ITransient, IDynamicApiController | |||
public class AGVThirdPartyService : IAGVThirdPartyService, ITransient, IDynamicApiController | |||
{ | |||
private readonly AGVHandler _aGVHandler; | |||
private readonly IMQTTService _MQTTService; | |||
public AGVThirdPartyService(AGVHandler aGVHandler, IMQTTService MQTTService) | |||
public AGVThirdPartyService(AGVHandler aGVHandler, IMQTTService MQTTService) | |||
{ | |||
_aGVHandler = aGVHandler; | |||
_MQTTService = MQTTService; | |||
@@ -27,98 +24,147 @@ namespace BPA.MES.Base.Application.Services.AGVService.Services | |||
/// <summary> | |||
/// 下发任务 | |||
/// </summary> | |||
/// <param name="cExecuteRequest"></param> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<KCResponse> ExecuteAsync(KCExecuteRequest cExecuteRequest) | |||
public async Task<KC_Response> Execute(KC_ExecuteRequest input) | |||
{ | |||
if (cExecuteRequest.JobData != null) | |||
cExecuteRequest = new KCExecuteRequest | |||
List<KC_ExecuteRequest> cExecuteRequests = new(); | |||
if (string.IsNullOrEmpty(input.RobotJobId)) | |||
{ | |||
throw Oops.Bah("任务编号不能为空"); | |||
} | |||
if (input.JobData != null) | |||
input = new KC_ExecuteRequest | |||
{ | |||
Url = cExecuteRequest.Url,//http://[IP:Port]/api/quicktron/wcs/standardized.robot.job.submit | |||
RobotJobId = Guid.NewGuid().ToString(), | |||
WarehouseId = cExecuteRequest.WarehouseId, | |||
JobPriority = cExecuteRequest.JobPriority, | |||
JobPriorityType = cExecuteRequest.JobPriorityType, | |||
JobData = new KCJobDataRequest | |||
Url = string.IsNullOrEmpty(input.Url) ? App.GetConfig<string>("AGVUrl")+"/api/quicktron/wcs/standardized.robot.job.submit": input.Url + "/api/quicktron/wcs/standardized.robot.job.submit", | |||
RobotJobId = input.RobotJobId,//任务号 | |||
WarehouseId = input.WarehouseId,//仓库编码 默认值1 | |||
JobPriority = input.JobPriority, //优先级 0-99 越高越先执行 | |||
JobPriorityType = input.JobPriorityType, //优先级类型 0 普通和1 强制. | |||
JobType = input.JobType,//任务类型 用来滚筒点对点 POINT_ROLLER_MOVE n8H7jX | |||
JobData = new KC_JobDataRequest | |||
{ | |||
StartPoint = cExecuteRequest.JobData.StartPoint, | |||
EndPoint = cExecuteRequest.JobData.EndPoint, | |||
StartPoint = input.JobData.StartPoint, //起点 | |||
EndPoint = input.JobData.EndPoint,//终点 | |||
ContainerCode = input.JobData.ContainerCode,//桶号 | |||
AutoLoad = input.JobData.AutoLoad,//上料方式 自动/人工 | |||
EnableIOLoad = input.JobData.EnableIOLoad,//上料交互方式 //接口对接 false | |||
AutoUnload = input.JobData.AutoUnload,//下料方式 true自动/false人工 | |||
EnableIOUnload = input.JobData.EnableIOUnload,//接口对接 false | |||
LoadEquipmentId = input.JobData.LoadEquipmentId,//起点设备ID | |||
UnloadEquipmentId = input.JobData.UnloadEquipmentId,//目标设备ID | |||
} | |||
}; | |||
return await _aGVHandler.ExecuteAsync(cExecuteRequest); | |||
cExecuteRequests.Add(input); | |||
try | |||
{ | |||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:{input.RobotJobId}接收到下发任务!"); | |||
var res = await input.Url.SetBody(cExecuteRequests).PostAsStringAsync(); | |||
return JSON.Deserialize<KC_Response>(res); | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw Oops.Bah(ex.Message); | |||
} | |||
} | |||
/// <summary> | |||
/// 取消任务 | |||
/// </summary> | |||
/// <param name="kCCancelRequest"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<KCResponse> CancelAsync(KCCancelRequest kCCancelRequest) | |||
public async Task<KCResponse> Cancel(KCCancelRequest kCCancelRequest) | |||
{ | |||
//http://[IP:Port]/api/quicktron/wcs/standardized.robot.job.cancel | |||
kCCancelRequest.Url = string.IsNullOrEmpty(kCCancelRequest.Url) ? App.GetConfig<string>("AGVUrl") + "/api/quicktron/wcs/standardized.robot.job.cancel" : kCCancelRequest.Url + "/api/quicktron/wcs/standardized.robot.job.cancel"; | |||
return await _aGVHandler.CancelAsync(kCCancelRequest); | |||
} | |||
/// <summary> | |||
/// | |||
/// 上下料反馈给AGV接口 | |||
/// </summary> | |||
/// <param name="rollerJobRequest"></param> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
public async Task<RollerJobResponse> RollerJobExecuteAsync(RollerJobRequest rollerJobRequest) | |||
public async Task<RollerJobResponse> RollerJobExecute(Roller_JobRequest input) | |||
{ | |||
//http://[IP:Port]/api/quicktron/wcs/standardized.roller.job.upstream.response | |||
return await _aGVHandler.RollerJobExecuteAsync(rollerJobRequest); | |||
input.Url = string.IsNullOrEmpty(input.Url) ? App.GetConfig<string>("AGVUrl") + "/api/quicktron/wcs/standardized.roller.job.upstream.response": input.Url+ "/api/quicktron/wcs/standardized.roller.job.upstream.response"; | |||
try | |||
{ | |||
var res = await input.Url.SetBody(input).PostAsStringAsync(); | |||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:{input.JobId}上下料反馈给AGV接口!{res}"); | |||
return JSON.Deserialize<RollerJobResponse>(res); | |||
} | |||
catch (Exception ex) | |||
{ | |||
return new RollerJobResponse() { Success = false }; | |||
} | |||
} | |||
/// <summary> | |||
/// 任务回调 | |||
/// 任务反馈(暴露给AGV厂商) | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<bool> ExecuteReplyAsync(AGVExecuteReplyRequest input) | |||
public async Task<AgvBody> ExecuteReply(AGVExecuteReplyRequest input) | |||
{ | |||
try | |||
{ | |||
var data = new AGVExecuteReplyMQTT() | |||
{ | |||
Event = input.Event, | |||
Event = input.Body.Event, | |||
}; | |||
return await _MQTTService.MqttPublish(data, Topics.ExecuteReplyTopic, MessageID.TaskState); | |||
bool res = await _MQTTService.MqttPublish(new MqttPublishDto(){ Payload= data, Topic = Topics.ExecuteReplyTopic, MessageId = MessageID.TaskState }); | |||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:接收到AGV反馈请求!", res.ToString()); | |||
AgvBody agvBody = new() | |||
{ | |||
Header = input.Header, | |||
Body = new AgvRetrun { Code = "SUCCESS", Success = res, Message = "SUCCESS", Data = null } | |||
}; | |||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:AGV反馈消息!{JSON.Serialize(agvBody)}"); | |||
return agvBody; | |||
} | |||
catch (Exception e) | |||
catch (Exception ex) | |||
{ | |||
return false; | |||
AgvBody agvBody = new() | |||
{ | |||
Header = input.Header, | |||
Body = new AgvRetrun { Code = "SUCCESS", Success = false, Message = ex.Message, Data = null } | |||
}; | |||
return agvBody; | |||
} | |||
} | |||
/// <summary> | |||
/// AGV上下料交互请求 | |||
/// AGV上下料交互请求 (暴露给AGV厂商) | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<bool> LoadAndUnloadAsync(AGVLoadAndUnloadRequest input) | |||
[HttpPost, AGV] | |||
public async Task<AgvBody> LoadAndUnload(AGVLoadAndUnloadRequest input) | |||
{ | |||
try | |||
{ | |||
var data = new AGVLoadAndUnloadMQTT() | |||
{ | |||
Event = input.Event, | |||
Event = input.Body.Event, | |||
}; | |||
bool res = await _MQTTService.MqttPublish(new MqttPublishDto() { Payload= data, Topic = Topics.LoadAndUnloadTopic, MessageId = MessageID.LoadAndUnload }); | |||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:接收到AGV上下料交互请求!{res.ToString()}"); | |||
AgvBody agvBody = new() | |||
{ | |||
Header = input.Header, | |||
Body = new AgvRetrun { Code = "SUCCESS", Success = res, Message = "SUCCESS", Data = null } | |||
}; | |||
return await _MQTTService.MqttPublish(data, Topics.LoadAndUnloadTopic, MessageID.LoadAndUnload); | |||
return agvBody; | |||
} | |||
catch (Exception e) | |||
catch (Exception ex) | |||
{ | |||
return false; | |||
AgvBody agvBody = new() | |||
{ | |||
Header = input.Header, | |||
Body = new AgvRetrun { Code = "SUCCESS", Success = false, Message = ex.Message, Data = null } | |||
}; | |||
return agvBody; | |||
} | |||
} | |||
} | |||
} |
@@ -1,12 +1,7 @@ | |||
using BPA.AGV; | |||
using BPA.MES.Base.Application.Services.AGVService.Dtos; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.MES.Base.Application.Services.AGVService.Services | |||
namespace BPA.MES.Base.Application.Services | |||
{ | |||
public interface IAGVThirdPartyService | |||
{ | |||
@@ -14,31 +9,32 @@ namespace BPA.MES.Base.Application.Services.AGVService.Services | |||
/// <summary> | |||
/// 下发任务 | |||
/// </summary> | |||
/// <param name="cExecuteRequest"></param> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<KCResponse> ExecuteAsync(KCExecuteRequest cExecuteRequest); | |||
Task<KC_Response> Execute(KC_ExecuteRequest input); | |||
/// <summary> | |||
/// 取消任务 | |||
/// </summary> | |||
/// <param name="kCCancelRequest"></param> | |||
/// <returns></returns> | |||
Task<KCResponse> CancelAsync(KCCancelRequest kCCancelRequest); | |||
Task<KCResponse> Cancel(KCCancelRequest kCCancelRequest); | |||
/// <summary> | |||
/// 任务回调 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<bool> ExecuteReplyAsync(AGVExecuteReplyRequest input); | |||
Task<AgvBody> ExecuteReply(AGVExecuteReplyRequest input); | |||
/// <summary> | |||
/// AGV上下料交互请求 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<bool> LoadAndUnloadAsync(AGVLoadAndUnloadRequest input); | |||
Task<AgvBody> LoadAndUnload(AGVLoadAndUnloadRequest input); | |||
/// <summary> | |||
/// 上下料反馈给AGV接口 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<RollerJobResponse> RollerJobExecute(Roller_JobRequest input); | |||
} | |||
} |
@@ -39,8 +39,20 @@ | |||
[HttpPost] | |||
public async Task<bool> Del(CraftsInfoDelInput input) | |||
{ | |||
var res = await _dbContext.Deleteable<Pztj_CraftsInfoEntity>().Where(x=>x.Id==input.Id).ExecuteCommandHasChangeAsync(); | |||
return res; | |||
//事务,删除所有子表 | |||
try | |||
{ | |||
_dbContext.Ado.BeginTran(); | |||
await _dbContext.Deleteable<Pztj_CraftsInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandAsync(); | |||
await _dbContext.Deleteable<Pztj_CraftStepsEntity>().Where(x => x.CraftId == input.Id).ExecuteCommandAsync(); | |||
_dbContext.Ado.CommitTran(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
_dbContext.Ado.RollbackTran(); | |||
throw Oops.Bah("删除失败!"); | |||
} | |||
return true; | |||
} | |||
/// <summary> | |||
/// 详情 | |||
@@ -22,7 +22,7 @@ | |||
[HttpPost] | |||
public async Task<bool> Add(DeviceProductFunctionAddInput input) | |||
{ | |||
var r_entity = await _dbContext.Queryable<DeviceProductFunctionEntity>().FirstAsync(x => x.Name == input.Name); | |||
var r_entity = await _dbContext.Queryable<DeviceProductFunctionEntity>().Where(x=>x.DeviceProductId==input.DeviceProductId && x.Name == input.Name).FirstAsync(); | |||
if (r_entity != null) | |||
{ | |||
throw Oops.Bah("名称已存在!"); | |||
@@ -111,8 +111,16 @@ | |||
[HttpPost] | |||
public async Task<bool> Update(DeviceProductFunctionUpdateInput input) | |||
{ | |||
var isEntity = await _dbContext.Queryable<DeviceProductFunctionEntity>() | |||
.Where(x =>x.Id != input.Id && x.DeviceProductId == input.DeviceProductId && x.Name == input.Name).FirstAsync(); | |||
if (isEntity != null) | |||
{ | |||
throw Oops.Bah("名称已存在!"); | |||
} | |||
var entity = await _dbContext.Queryable<DeviceProductFunctionEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||
entity = input.Adapt<DeviceProductFunctionEntity>(); | |||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||
return res; | |||
} | |||
@@ -39,8 +39,20 @@ | |||
[HttpPost] | |||
public async Task<bool> Del(DeviceProductDelInput input) | |||
{ | |||
var res = await _dbContext.Deleteable<DeviceProductEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||
return res; | |||
//事务,删除所有子表 | |||
try | |||
{ | |||
_dbContext.Ado.BeginTran(); | |||
await _dbContext.Deleteable<DeviceProductEntity>().Where(x => x.Id == input.Id).ExecuteCommandAsync(); | |||
await _dbContext.Deleteable<DeviceProductFunctionEntity>().Where(x => x.DeviceProductId == input.Id).ExecuteCommandAsync(); | |||
_dbContext.Ado.CommitTran(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
_dbContext.Ado.RollbackTran(); | |||
throw Oops.Bah("删除失败!"); | |||
} | |||
return true; | |||
} | |||
/// <summary> | |||
/// 详情 | |||
@@ -10,6 +10,5 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services | |||
public interface IKepDataService | |||
{ | |||
Task<Dictionary<string, object>> GetList(); | |||
Task<string> GetA1(); | |||
} | |||
} |
@@ -29,19 +29,30 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services | |||
[HttpPost] | |||
public async Task<Dictionary<string, object>> GetList() | |||
{ | |||
var data =await KepDb.Queryable<ch1_device1>().Where(x=> SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Take(1000).ToListAsync(); | |||
var dicdatass = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x => x._NAME).ToArray(); | |||
//to_days(now()) - to_days(o._TIMESTAMP) = 1 | |||
// to_days(o._TIMESTAMP) = to_days(now()) | |||
var list = KepDb.Queryable<object>().AS("ch01_device1", "o").Where(" to_days(o._TIMESTAMP) = to_days(now())").ToList(); | |||
//var data =await KepDb.Queryable<ch1_device1>().Where(x=> SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Take(1000).ToListAsync(); | |||
//var dicdatass = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x => x._NAME).ToArray(); | |||
//var dicdata = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x=>x._NAME).ToDictionary(); | |||
Dictionary<string, object> dic = new Dictionary<string, object>(); | |||
DataTable table = new DataTable(); | |||
foreach (var item in dicdatass) | |||
{ | |||
var key = item.ToString(); | |||
var values = data.Where(x => x._NAME == key).Select(x=>x._VALUE).ToList(); | |||
dic.Add(key, values); | |||
} | |||
var JsonString = JsonConvert.SerializeObject(dic); | |||
return dic; | |||
//DataTable table = new DataTable(); | |||
//foreach (var item in dicdatass) | |||
//{ | |||
// var key = item.ToString(); | |||
// var values = data.Where(x => x._NAME == key).Select(x=>x._VALUE).ToList(); | |||
// dic.Add(key, values); | |||
//} | |||
//var JsonString = JsonConvert.SerializeObject(dic); | |||
return list; | |||
} | |||
[HttpGet] | |||
[AllowAnonymous] | |||
public async Task<bool> DeleteKep() | |||
{ | |||
var sql = "delete from ch01_device1 where 1=1 order by id limit 1000;"; | |||
var list = KepDb.Ado.ExecuteCommand(sql); | |||
return true; | |||
} | |||
public async Task<string> GetA1() | |||
@@ -12,21 +12,35 @@ | |||
/// 报警信息 | |||
/// </summary> | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 报警值 | |||
/// </summary> | |||
public string Value { get; set; } | |||
/// <summary> | |||
/// 报警等级 | |||
/// </summary> | |||
public string Grade { get; set; } | |||
/// <summary> | |||
/// 类型 | |||
/// </summary> | |||
public string LogType { get; set; } | |||
/// <summary> | |||
/// 设备名称 | |||
/// </summary> | |||
public string DeviceName { get; set; } | |||
/// <summary> | |||
/// 日期 | |||
/// </summary> | |||
public string Date { get; set; } | |||
/// <summary> | |||
/// 时间 | |||
/// </summary> | |||
public string Time { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
public DateTime CreateDate { get; set; } | |||
} | |||
/// <summary> | |||
/// 增加 | |||
@@ -86,6 +100,14 @@ | |||
/// 设备名称 | |||
/// </summary> | |||
public string DeviceName { get; set; } | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
public DateTime? StartTime { get; set; } | |||
/// <summary> | |||
/// 结束时间 | |||
/// </summary> | |||
public DateTime? EndTime { get; set; } | |||
} | |||
/// <summary> | |||
/// 输出 | |||
@@ -17,6 +17,18 @@ | |||
/// 日志消息 | |||
/// </summary> | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 日期 | |||
/// </summary> | |||
public string Date { get; set; } | |||
/// <summary> | |||
/// 时间 | |||
/// </summary> | |||
public string Time { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
public DateTime CreateDate { get; set; } | |||
} | |||
/// <summary> | |||
/// 增加 | |||
@@ -66,6 +78,14 @@ | |||
/// 日志消息 | |||
/// </summary> | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
public DateTime? StartTime { get; set; } | |||
/// <summary> | |||
/// 结束时间 | |||
/// </summary> | |||
public DateTime? EndTime { get; set; } | |||
} | |||
/// <summary> | |||
/// 输出 | |||
@@ -12,11 +12,22 @@ | |||
/// 日志类别 | |||
/// </summary> | |||
public string LogType { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 日期 | |||
/// </summary> | |||
public string Date { get; set; } | |||
/// <summary> | |||
/// 时间 | |||
/// </summary> | |||
public string Time { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
public DateTime CreateDate { get; set; } | |||
} | |||
/// <summary> | |||
/// 增加 | |||
@@ -61,11 +72,18 @@ | |||
/// 日志类别 | |||
/// </summary> | |||
public string LogType { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
public DateTime? StartTime { get; set; } | |||
/// <summary> | |||
/// 结束时间 | |||
/// </summary> | |||
public DateTime? EndTime { get; set; } | |||
} | |||
/// <summary> | |||
/// 输出 | |||
@@ -22,6 +22,10 @@ | |||
/// 日志消息 | |||
/// </summary> | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 日志时间 | |||
/// </summary> | |||
public DateTime CreateDate { get; set; } | |||
} | |||
/// <summary> | |||
/// 增加 | |||
@@ -75,6 +75,9 @@ | |||
.WhereIF(!string.IsNullOrEmpty(input.Grade), x => x.Grade.Contains(input.Grade)) | |||
.WhereIF(!string.IsNullOrEmpty(input.MsgInfo), x => x.MsgInfo.Contains(input.MsgInfo)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Value), x => x.Value.Contains(input.Value)) | |||
.WhereIF(input.StartTime.HasVal(), x => x.CreateDate >= input.StartTime.Value) | |||
.WhereIF(input.EndTime.HasVal(), x => x.CreateDate <= input.EndTime.Value) | |||
.OrderByDescending(x=>x.CreateDate) | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
SqlSugarPagedList<AlarmLogOutput> output = entity.Adapt<SqlSugarPagedList<AlarmLogOutput>>(); | |||
return output; | |||
@@ -73,6 +73,9 @@ | |||
var entity = await _dbContext.Queryable<ProgramLogEntity>() | |||
.WhereIF(input.LogType != null, x => x.LogType == input.LogType) | |||
.WhereIF(!string.IsNullOrEmpty(input.MsgInfo), x => x.MsgInfo.Contains(input.MsgInfo)) | |||
.WhereIF(input.StartTime.HasVal(), x => x.CreateDate >= input.StartTime.Value) | |||
.WhereIF(input.EndTime.HasVal(), x => x.CreateDate <= input.EndTime.Value) | |||
.OrderByDescending(x => x.CreateDate) | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
SqlSugarPagedList<ProgramLogOutput> output = entity.Adapt<SqlSugarPagedList<ProgramLogOutput>>(); | |||
return output; | |||
@@ -73,6 +73,9 @@ | |||
var entity = await _dbContext.Queryable<RunLogEntity>() | |||
.WhereIF(!string.IsNullOrEmpty(input.LogType), x => x.LogType.Contains(input.LogType)) | |||
.WhereIF(!string.IsNullOrEmpty(input.MsgInfo), x => x.MsgInfo.Contains(input.MsgInfo)) | |||
.WhereIF(input.StartTime.HasVal(), x => x.CreateDate >= input.StartTime.Value) | |||
.WhereIF(input.EndTime.HasVal(), x => x.CreateDate <= input.EndTime.Value) | |||
.OrderByDescending(x => x.CreateDate) | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
SqlSugarPagedList<RunLogOutput> output = entity.Adapt<SqlSugarPagedList<RunLogOutput>>(); | |||
return output; | |||
@@ -27,7 +27,12 @@ | |||
/// 原料分组 | |||
/// </summary> | |||
/// <example></example> | |||
public string Gourp { get; set; } | |||
public string Type { get; set; } | |||
/// <summary> | |||
/// 每升重量 | |||
/// </summary> | |||
public string WeightPerLiter { get; set; } | |||
} | |||
/// <summary> | |||
/// 增加 | |||
@@ -84,5 +89,9 @@ | |||
/// </summary> | |||
/// <example></example> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 类型名称 | |||
/// </summary> | |||
public string TypeName { get; set; } | |||
} | |||
} |
@@ -51,8 +51,15 @@ | |||
[HttpGet] | |||
public async Task<MaterialsInfoOutput> Detail(string Id) | |||
{ | |||
var entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>().FirstAsync(x => x.Id == Id); | |||
MaterialsInfoOutput output = entity.Adapt<MaterialsInfoOutput>(); | |||
var output = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>() | |||
.LeftJoin<DictDataEntity>((a,b)=>a.Type==b.Id) | |||
.Where((a,b)=> a.Id == Id) | |||
.Select((a,b)=>new MaterialsInfoOutput | |||
{ | |||
Id=a.Id.SelectAll(), | |||
TypeName = b.Value | |||
}) | |||
.FirstAsync(); | |||
return output; | |||
} | |||
/// <summary> | |||
@@ -63,8 +70,14 @@ | |||
[HttpGet] | |||
public async Task<List<MaterialsInfoOutput>> List() | |||
{ | |||
var entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>().ToListAsync(); | |||
List<MaterialsInfoOutput> output = entity.Adapt<List<MaterialsInfoOutput>>(); | |||
var output = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>() | |||
.LeftJoin<DictDataEntity>((a, b) => a.Type == b.Id) | |||
.Select((a, b) => new MaterialsInfoOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
TypeName = b.Value | |||
}) | |||
.ToListAsync(); | |||
return output; | |||
} | |||
/// <summary> | |||
@@ -75,11 +88,16 @@ | |||
[HttpPost] | |||
public async Task<SqlSugarPagedList<MaterialsInfoOutput>> PagedList(MaterialsInfoQueryPageInput input) | |||
{ | |||
var entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>() | |||
.WhereIF(!string.IsNullOrEmpty(input.Name),x=>x.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code)) | |||
var output = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>() | |||
.LeftJoin<DictDataEntity>((a, b) => a.Type == b.Id) | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b) => a.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Code), (a, b) => a.Code.Contains(input.Code)) | |||
.Select((a, b) => new MaterialsInfoOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
TypeName = b.Value | |||
}) | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
SqlSugarPagedList<MaterialsInfoOutput> output = entity.Adapt<SqlSugarPagedList<MaterialsInfoOutput>>(); | |||
return output; | |||
} | |||
/// <summary> | |||
@@ -58,7 +58,7 @@ namespace BPA.MES.Base.Application.Services.OrderService.Service | |||
ProductionLineId=a.LineId, | |||
ProductionLineName=c.Name, | |||
Id = a.Id, | |||
CreateTime=a.CreateTime, | |||
CreateTime=a.CreateTime.ToString(), | |||
Status = d.Status == null ? WorkOrderStatusEnum.Draft : d.Status | |||
}).ToListAsync(); | |||
@@ -230,7 +230,7 @@ namespace BPA.MES.Base.Application.Services.OrderService.Service | |||
{ | |||
Pztj_WorkInfoEntity entity = new Pztj_WorkInfoEntity() | |||
{ | |||
CreateTime = DateTime.Now.ToString(), | |||
CreateTime = DateTime.Now, | |||
FinalId = item.FinalslId, | |||
LineId = item.ProductionLineId, | |||
Name = "", | |||
@@ -20,6 +20,20 @@ | |||
public class ProductLineDeviceAddInput: ProductLineDeviceDto { | |||
} | |||
/// <summary> | |||
/// 产线设备不分页 | |||
/// </summary> | |||
public class ProductLineDeviceQueryInput | |||
{ | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 产线Id | |||
/// </summary> | |||
public string LineId { get; set; } | |||
} | |||
/// <summary> | |||
/// 产线设备分页 | |||
@@ -21,6 +21,24 @@ | |||
{ | |||
} | |||
/// <summary> | |||
/// 产线设备不分页 | |||
/// </summary> | |||
public class ProductLineStockQueryInput | |||
{ | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 产线Id | |||
/// </summary> | |||
public string LineId { get; set; } | |||
/// <summary> | |||
/// 物料Id | |||
/// </summary> | |||
public string MaterialId { get; set; } | |||
} | |||
/// <summary> | |||
/// 产线设备分页 | |||
@@ -56,6 +74,10 @@ | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 产线名称 | |||
/// </summary> | |||
public string LineName { get; set; } | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
/// <example>设备名称</example> | |||
@@ -64,6 +86,14 @@ | |||
/// 编码 | |||
/// </summary> | |||
public string StockCode { get; set; } | |||
/// <summary> | |||
/// 物料信息 | |||
/// </summary> | |||
public string MaterialId { get; set; } | |||
/// <summary> | |||
/// 物料名称 | |||
/// </summary> | |||
public string MateriaName { get; set; } | |||
} | |||
} | |||
@@ -63,7 +63,7 @@ | |||
/// 产线设备不分页 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<ProductLineDeviceOutput>> DeviceList(); | |||
Task<List<ProductLineDeviceOutput>> DeviceList(ProductLineDeviceQueryInput input); | |||
/// <summary> | |||
/// 产线设备分页 | |||
/// </summary> | |||
@@ -90,7 +90,7 @@ | |||
/// 产线料仓不分页 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<ProductLineStockOutput>> StockList(); | |||
Task<List<ProductLineStockOutput>> StockList(ProductLineStockQueryInput input); | |||
/// <summary> | |||
/// 产线料仓分页 | |||
/// </summary> | |||
@@ -145,11 +145,24 @@ | |||
/// 产线设备不分页 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public async Task<List<ProductLineDeviceOutput>> DeviceList() | |||
[HttpPost] | |||
public async Task<List<ProductLineDeviceOutput>> DeviceList(ProductLineDeviceQueryInput input) | |||
{ | |||
var entity = await _dbContext.Queryable<Pztj_LineDevicesEntity>().ToListAsync(); | |||
List<ProductLineDeviceOutput> output = entity.Adapt<List<ProductLineDeviceOutput>>(); | |||
var output = await _dbContext.Queryable<Pztj_LineDevicesEntity>() | |||
.LeftJoin<Pztj_DevicesInfoEntity>((a, b) => a.DeviceId == b.Id) | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b) => b.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.LineId), (a, b) => a.LineId == input.LineId) | |||
.Select((a, b) => new ProductLineDeviceOutput | |||
{ | |||
DeviceId = a.DeviceId, | |||
DeviceCode = b.Code, | |||
DeviceName = b.Name, | |||
Describe = b.Describe, | |||
DeviceType = b.DeviceType, | |||
Id = a.Id, | |||
LineId = a.LineId | |||
}). | |||
ToListAsync(); | |||
return output; | |||
} | |||
/// <summary> | |||
@@ -162,7 +175,7 @@ | |||
var entity = await _dbContext.Queryable<Pztj_LineDevicesEntity>() | |||
.LeftJoin<Pztj_DevicesInfoEntity>((a,b)=>a.DeviceId==b.Id) | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b) => b.Name.Contains(input.Name)) | |||
.Where((a, b) => a.LineId == input.LineId) | |||
.WhereIF(!string.IsNullOrEmpty(input.LineId), (a, b) => a.LineId == input.LineId) | |||
.Select((a,b)=>new ProductLineDeviceOutput | |||
{ | |||
DeviceId = a.DeviceId, | |||
@@ -207,12 +220,26 @@ | |||
/// 产线料仓不分页 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public async Task<List<ProductLineStockOutput>> StockList() | |||
[HttpPost] | |||
public async Task<List<ProductLineStockOutput>> StockList(ProductLineStockQueryInput input) | |||
{ | |||
var entity = await _dbContext.Queryable<Pztj_LineStocksEntity>().ToListAsync(); | |||
List<ProductLineStockOutput> output = entity.Adapt<List<ProductLineStockOutput>>(); | |||
return output; | |||
var entity = await _dbContext.Queryable<Pztj_LineStocksEntity>() | |||
.LeftJoin<Pztj_StockInfoEntity>((a, b) => a.StockId == b.Id) | |||
.LeftJoin<Pztj_MaterialsInfoEntity>((a, b,c) => b.MaterialId == c.Id) | |||
.WhereIF(!string.IsNullOrEmpty(input.MaterialId), (a, b) => b.MaterialId == input.MaterialId) | |||
.WhereIF(!string.IsNullOrEmpty(input.LineId), (a, b) => a.LineId == input.LineId) | |||
.Select((a, b,c) => new ProductLineStockOutput | |||
{ | |||
Id = a.Id, | |||
LineId = a.LineId, | |||
StockCode = b.Code, | |||
StockId = b.Id, | |||
StockName = b.Name, | |||
MaterialId = b.MaterialId, | |||
MateriaName = c.Name | |||
}) | |||
.ToListAsync(); | |||
return entity; | |||
} | |||
/// <summary> | |||
/// 产线料仓分页 | |||
@@ -224,7 +251,7 @@ | |||
var entity = await _dbContext.Queryable<Pztj_LineStocksEntity>() | |||
.LeftJoin<Pztj_StockInfoEntity>((a, b) => a.StockId == b.Id) | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b) => b.Name.Contains(input.Name)) | |||
.Where((a, b) => a.LineId == input.LineId) | |||
.WhereIF(!string.IsNullOrEmpty(input.LineId), (a, b) => a.LineId == input.LineId) | |||
.Select((a, b) => new ProductLineStockOutput | |||
{ | |||
StockId = a.StockId, | |||
@@ -0,0 +1,15 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
public interface ISysCacheService | |||
{ | |||
Task AddCacheKey(string cacheKey); | |||
Task DelCacheKey(string cacheKey); | |||
bool Exists(string cacheKey); | |||
Task<List<string>> GetAllCacheKeys(); | |||
Task<T> GetAsync<T>(string cacheKey); | |||
Task<string> GetStringAsync(string cacheKey); | |||
Task RemoveAsync(string key); | |||
Task SetAsync(string cacheKey, object value); | |||
Task SetStringAsync(string cacheKey, string value); | |||
} | |||
} |
@@ -0,0 +1,163 @@ | |||
using Furion.JsonSerialization; | |||
using Microsoft.Extensions.Caching.Distributed; | |||
using System.Text; | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 系统缓存服务 | |||
/// </summary> | |||
[ApiDescriptionSettings(Name = "Cache", Order = 100)] | |||
public class SysCacheService : ISysCacheService, IDynamicApiController, ISingleton | |||
{ | |||
private readonly IDistributedCache _cache; | |||
public SysCacheService(IDistributedCache cache) | |||
{ | |||
_cache = cache; | |||
} | |||
/// <summary> | |||
/// 获取所有缓存关键字 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("sysCache/keyList")] | |||
public async Task<List<string>> GetAllCacheKeys() | |||
{ | |||
var res = await _cache.GetStringAsync(ClaimConst.CACHE_KEY_ALL); | |||
return string.IsNullOrWhiteSpace(res) ? null : JSON.Deserialize<List<string>>(res); | |||
} | |||
/// <summary> | |||
/// 删除指定关键字缓存 | |||
/// </summary> | |||
/// <param name="key"></param> | |||
/// <returns></returns> | |||
[HttpGet("sysCache/remove")] | |||
public async Task RemoveAsync(string key) | |||
{ | |||
await _cache.RemoveAsync(key); | |||
await DelCacheKey(key); | |||
} | |||
/// <summary> | |||
/// 删除某特征关键字缓存 | |||
/// </summary> | |||
/// <param name="key"></param> | |||
/// <returns></returns> | |||
[NonAction] | |||
public async Task DelByPatternAsync(string key) | |||
{ | |||
var allkeys = await GetAllCacheKeys(); | |||
var delAllkeys = allkeys.Where(u => u.Contains(key)).ToList(); | |||
// 删除相应的缓存 | |||
delAllkeys.ForEach(u => | |||
{ | |||
_cache.Remove(u); | |||
}); | |||
// 更新所有缓存键 | |||
allkeys = allkeys.Where(u => !u.Contains(key)).ToList(); | |||
await _cache.SetStringAsync(ClaimConst.CACHE_KEY_ALL, JSON.Serialize(allkeys)); | |||
} | |||
/// <summary> | |||
/// 设置缓存 | |||
/// </summary> | |||
/// <param name="cacheKey"></param> | |||
/// <param name="value"></param> | |||
/// <returns></returns> | |||
[NonAction] | |||
public async Task SetAsync(string cacheKey, object value) | |||
{ | |||
await _cache.SetAsync(cacheKey, Encoding.UTF8.GetBytes(JSON.Serialize(value))); | |||
await AddCacheKey(cacheKey); | |||
} | |||
/// <summary> | |||
/// 设置缓存 | |||
/// </summary> | |||
/// <param name="cacheKey"></param> | |||
/// <param name="value"></param> | |||
/// <returns></returns> | |||
[NonAction] | |||
public async Task SetStringAsync(string cacheKey, string value) | |||
{ | |||
await _cache.SetStringAsync(cacheKey, value); | |||
await AddCacheKey(cacheKey); | |||
} | |||
/// <summary> | |||
/// 获取缓存 | |||
/// </summary> | |||
/// <param name="cacheKey"></param> | |||
/// <returns></returns> | |||
[HttpGet("sysCache/detail")] | |||
public async Task<string> GetStringAsync(string cacheKey) | |||
{ | |||
return await _cache.GetStringAsync(cacheKey); | |||
} | |||
/// <summary> | |||
/// 获取缓存 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="cacheKey"></param> | |||
/// <returns></returns> | |||
[NonAction] | |||
public async Task<T> GetAsync<T>(string cacheKey) | |||
{ | |||
var res = await _cache.GetAsync(cacheKey); | |||
return res == null ? default : JSON.Deserialize<T>(Encoding.UTF8.GetString(res)); | |||
} | |||
/// <summary> | |||
/// 检查给定 key 是否存在 | |||
/// </summary> | |||
/// <param name="cacheKey">键</param> | |||
/// <returns></returns> | |||
[NonAction] | |||
public bool Exists(string cacheKey) | |||
{ | |||
return _cache.Equals(cacheKey); | |||
} | |||
/// <summary> | |||
/// 增加缓存Key | |||
/// </summary> | |||
/// <param name="cacheKey"></param> | |||
/// <returns></returns> | |||
[NonAction] | |||
public async Task AddCacheKey(string cacheKey) | |||
{ | |||
var res = await _cache.GetStringAsync(ClaimConst.CACHE_KEY_ALL); | |||
var allkeys = string.IsNullOrWhiteSpace(res) ? new List<string>() : JSON.Deserialize<List<string>>(res); | |||
if (!allkeys.Any(m => m == cacheKey)) | |||
{ | |||
allkeys.Add(cacheKey); | |||
await _cache.SetStringAsync(ClaimConst.CACHE_KEY_ALL, JSON.Serialize(allkeys)); | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="cacheKey"></param> | |||
/// <returns></returns> | |||
[NonAction] | |||
public async Task DelCacheKey(string cacheKey) | |||
{ | |||
var res = await _cache.GetStringAsync(ClaimConst.CACHE_KEY_ALL); | |||
var allkeys = string.IsNullOrWhiteSpace(res) ? new List<string>() : JSON.Deserialize<List<string>>(res); | |||
if (allkeys.Any(m => m == cacheKey)) | |||
{ | |||
allkeys.Remove(cacheKey); | |||
await _cache.SetStringAsync(ClaimConst.CACHE_KEY_ALL, JSON.Serialize(allkeys)); | |||
} | |||
} | |||
} | |||
} |
@@ -50,8 +50,12 @@ namespace BPA.MES.Base.Application | |||
/// <summary> | |||
/// [账号信息]修改密码 | |||
/// </summary> | |||
public class AccountUpdatePwdInput: AccountInput | |||
public class AccountUpdatePwdInput | |||
{ | |||
/// <summary> | |||
/// 旧密码 | |||
/// </summary> | |||
public string OldPwd { get; set; } | |||
/// <summary> | |||
/// 新密码 | |||
/// </summary> | |||
@@ -1,134 +0,0 @@ | |||
///<summary> | |||
/// 名 称 :[授权模块]实体基础 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/3 10:21:42 | |||
/// 描 述 | |||
/// </summary> | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// [授权模块]入参基础 | |||
/// </summary> | |||
public class AuthorModuleInput | |||
{ | |||
/// <summary> | |||
/// 子级列表 | |||
/// </summary> | |||
public List<AuthorModuleInput>? Childrens { get; set; } | |||
/// <summary> | |||
/// 拥有权限 | |||
/// </summary> | |||
public bool HasPermission { get; set; } | |||
/// <summary> | |||
/// 模块编号 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 类别 1:菜单,2:视图,3:功能 | |||
/// </summary> | |||
public int Category { get; set; } | |||
/// <summary> | |||
/// 菜单打开方式 0:框架内嵌,1:新开页面 | |||
/// </summary> | |||
public int OpenType { get; set; } | |||
/// <summary> | |||
/// 父级编号 | |||
/// </summary> | |||
public string ParentId { get; set; } | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { set; get; } | |||
/// <summary> | |||
/// 图标 | |||
/// </summary> | |||
public string Icon { set; get; } | |||
/// <summary> | |||
/// 地址 | |||
/// </summary> | |||
public string Url { set; get; } | |||
/// <summary> | |||
/// 排序码 | |||
/// </summary> | |||
public int Sort { set; get; } | |||
/// <summary> | |||
/// 启用禁用 | |||
/// </summary> | |||
public bool IsDisabled { get; set; } | |||
/// <summary> | |||
/// 子集 | |||
/// </summary> | |||
public List<ModuleTreeInput>? Children { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]添加入参 | |||
/// </summary> | |||
public class AuthorModuleAddInput : AuthorModuleInput | |||
{ | |||
} | |||
/// <summary> | |||
/// [授权模块]批量授权信息 | |||
/// </summary> | |||
public class AuthorModulesAddInput | |||
{ | |||
/// <summary> | |||
/// 模板名称 | |||
/// </summary> | |||
public string TemplateName { set; get; } | |||
/// <summary> | |||
/// 授权模块 | |||
/// </summary> | |||
public List<string> ModuleIds { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]修改入参 | |||
/// </summary> | |||
public class AuthorModuleUpdateInput : AuthorModuleInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]删除入参 | |||
/// </summary> | |||
public class AuthorModuleDelInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]普通查询入参 | |||
/// </summary> | |||
public class AuthorModuleQueryInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]分页查询入参 | |||
/// </summary> | |||
public class AuthorModuleQueryPageInput : RequestPage | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
} |
@@ -1,70 +0,0 @@ | |||
///<summary> | |||
/// 名 称 :[账号信息]实体基础 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/3 10:21:42 | |||
/// 描 述 | |||
/// </summary> | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// [账号信息]入参基础 | |||
/// </summary> | |||
public class AuthorModuleItemInput | |||
{ | |||
/// <summary> | |||
/// 模板Id | |||
/// </summary> | |||
public string TB_TemplateId { get; set; } | |||
/// <summary> | |||
/// 模块Id | |||
/// </summary> | |||
public List<string> TB_ModuleIds { get; set; } | |||
} | |||
/// <summary> | |||
/// [账号信息]添加入参 | |||
/// </summary> | |||
public class AuthorModuleItemAddInput : AuthorModuleItemInput | |||
{ | |||
} | |||
/// <summary> | |||
/// [账号信息]修改入参 | |||
/// </summary> | |||
public class AuthorModuleItemUpdateInput : AuthorModuleItemInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [账号信息]删除入参 | |||
/// </summary> | |||
public class AuthorModuleItemDelInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [账号信息]普通查询入参 | |||
/// </summary> | |||
public class AuthorModuleItemQueryInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [账号信息]分页查询入参 | |||
/// </summary> | |||
public class AuthorModuleItemQueryPageInput : RequestPage | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
} |
@@ -1,17 +0,0 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 名 称 : | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:20:51 | |||
/// 描 述 : | |||
/// </summary> | |||
public class AuthorModuleItemOutput | |||
{ | |||
/// <summary> | |||
/// 模块编号 | |||
/// </summary> | |||
public string Id { get; set; } | |||
} | |||
} |
@@ -1,68 +0,0 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 名 称 :授权模块输出 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:18:24 | |||
/// 描 述 : | |||
/// </summary> | |||
public class AuthorModuleOutput | |||
{ | |||
/// <summary> | |||
/// 子级列表 | |||
/// </summary> | |||
public List<AuthorModuleOutput>? Childrens { get; set; } | |||
/// <summary> | |||
/// 拥有权限 | |||
/// </summary> | |||
public bool HasPermission { get; set; } | |||
/// <summary> | |||
/// 模块编号 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 类别 1:菜单,2:视图,3:功能 | |||
/// </summary> | |||
public int Category { get; set; } | |||
/// <summary> | |||
/// 菜单打开方式 0:框架内嵌,1:新开页面 | |||
/// </summary> | |||
public int OpenType { get; set; } | |||
/// <summary> | |||
/// 父级编号 | |||
/// </summary> | |||
public string ParentId { get; set; } | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { set; get; } | |||
/// <summary> | |||
/// 图标 | |||
/// </summary> | |||
public string Icon { set; get; } | |||
/// <summary> | |||
/// 地址 | |||
/// </summary> | |||
public string Url { set; get; } | |||
/// <summary> | |||
/// 排序码 | |||
/// </summary> | |||
public int Sort { set; get; } | |||
/// <summary> | |||
/// 启用禁用 | |||
/// </summary> | |||
public bool IsDisabled { get; set; } | |||
/// <summary> | |||
/// 子集 | |||
/// </summary> | |||
public List<ModuleTreeInput>? Children { get; set; } | |||
} | |||
} |
@@ -1,74 +0,0 @@ | |||
///<summary> | |||
/// 名 称 :[授权模块]实体基础 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/3 10:21:42 | |||
/// 描 述 | |||
/// </summary> | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// [授权模块]入参基础 | |||
/// </summary> | |||
public class AuthorizeTemplateInput | |||
{ | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]添加入参 | |||
/// </summary> | |||
public class AuthorizeTemplateAddInput : AuthorizeTemplateInput | |||
{ | |||
} | |||
/// <summary> | |||
/// [授权模块]修改入参 | |||
/// </summary> | |||
public class AuthorizeTemplateUpdateInput : AuthorizeTemplateInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]删除入参 | |||
/// </summary> | |||
public class AuthorizeTemplateDelInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]普通查询入参 | |||
/// </summary> | |||
public class AuthorizeTemplateQueryInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]分页查询入参 | |||
/// </summary> | |||
public class AuthorizeTemplateQueryPageInput : RequestPage | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
/// <summary> | |||
/// 关键字 | |||
/// </summary> | |||
public string Keyword { get; set; } | |||
} | |||
} |
@@ -1,24 +0,0 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 名 称 :授权模块输出 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 9:48:24 | |||
/// 描 述 : | |||
/// </summary> | |||
public class AuthorizeTemplateOutput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 名 称 : | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/8/31 15:58:31 | |||
/// 描 述 : | |||
/// </summary> | |||
public class RoleModuleDto | |||
{ | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
/// <summary> | |||
/// 模块Id | |||
/// </summary> | |||
public string ModuleId { get; set; } | |||
/// <summary> | |||
/// 父级Id | |||
/// </summary> | |||
public string ParentId { get; set; } | |||
} | |||
public class RoleModuleAddInput | |||
{ | |||
public List<RoleModuleDto> ModuleIds { get; set; } | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
} | |||
public class RoleModuleOutput | |||
{ | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
/// <summary> | |||
/// 模块Id | |||
/// </summary> | |||
public string ModuleId { get; set; } | |||
} | |||
public class RoleModuleQuery | |||
{ | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
} | |||
} |
@@ -49,8 +49,10 @@ | |||
{ | |||
{ClaimConst.CLAINM_USERID, User.Id}, | |||
{ClaimConst.CLAINM_NAME,User.Name}, | |||
{ClaimConst.CLAINM_ACCOUNT,Info.Account }, | |||
{ClaimConst.CLAINM_ISAUTH,User.IsAdmin}, | |||
},200); | |||
{ClaimConst.CLAINM_ROLEID,User.RoleId } | |||
}, 43200); | |||
// 设置Swagger自动登录 | |||
_httpContextAccessor.HttpContext.SigninToSwagger(accessToken); | |||
// 生成刷新Token令牌 | |||
@@ -104,71 +106,24 @@ | |||
async Task<UserRoleCacheDto> GetJurisdictionItemsAsync() | |||
{ | |||
string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
string roleId = App.User?.FindFirst(ClaimConst.CLAINM_ROLEID)?.Value; | |||
var result = new UserRoleCacheDto(); | |||
result.AuthorizationCodes = (await GetAuthorityModuleIdsAsync(userId)) ?? new List<string>(); | |||
//根据角色获取权限Id | |||
var rolemodules = await db.Queryable<RoleModuleEntity>().Where(x => x.RoleId == roleId).ToListAsync(); | |||
result.AuthorizationCodes = rolemodules.Select(t => t.ModuleId).ToList(); | |||
if (result.AuthorizationCodes.HasVal()) | |||
{ | |||
var temp = await db.Queryable<ModuleEntity>().Where(t => t.Category == 1 || t.Category == 2 || t.Category == 3) | |||
.Where(t => result.AuthorizationCodes.Contains(t.Id) && !t.IsDisabled).OrderBy(t => t.ParentId) | |||
var temp = await db.Queryable<ModuleEntity>().Where(t => result.AuthorizationCodes.Contains(t.Id) && !t.IsDisabled).OrderBy(t => t.ParentId) | |||
.ToListAsync(); | |||
result.Menus = temp.Adapt<List<UserMenu>>().BuildTree(); | |||
} | |||
result.Menus = result.Menus ?? new List<UserMenu>(); | |||
result.Menus ??= new List<UserMenu>(); | |||
return result; | |||
} | |||
/// <summary> | |||
/// 获取权限模块编号 | |||
/// </summary> | |||
/// <param name="userId"></param> | |||
/// <returns></returns> | |||
/// <exception cref="NotImplementedException"></exception> | |||
[HttpGet] | |||
async Task<List<string>> GetAuthorityModuleIdsAsync(string userId) | |||
{ | |||
List<string> moduleIds = null; | |||
var user = await db.Queryable<EmployeeEntity>().Where(m => m.Id == userId).FirstAsync(); | |||
if (user == null) | |||
{ | |||
return moduleIds; | |||
} | |||
//超管用户 | |||
if (user.IsAdmin) | |||
{ | |||
moduleIds = await db.Queryable<ModuleEntity>() | |||
.OrderBy(m => m.ParentId).OrderBy(m => m.Name) | |||
.ToListAsync(m => m.Id); | |||
} | |||
else | |||
{ | |||
moduleIds = await GetAuthorityModuleIdsAsync((category) => | |||
{ | |||
if (category == 1) | |||
{ | |||
return user.Id; | |||
} | |||
if (category == 2) | |||
{ | |||
return user.RoleId; | |||
} | |||
else | |||
{ | |||
throw new NotImplementedException("无效授权类别"); | |||
} | |||
}); | |||
} | |||
return moduleIds; | |||
} | |||
/// <summary> | |||
/// 获取账户信息 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
@@ -211,33 +166,7 @@ | |||
var entity = input.Adapt<AccountEntity>(); | |||
return await _dbContext.Deleteable(entity).Where(x=>x.Id==input.Id).ExecuteCommandHasChangeAsync(); | |||
} | |||
/// <summary> | |||
/// 获取授权模块编号 | |||
/// </summary> | |||
/// <param name="getObjectId"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
async Task<List<string>> GetAuthorityModuleIdsAsync(Func<int, string> getObjectId) | |||
{ | |||
for (int index = 1; index <= 2; index++) | |||
{ | |||
var objectId = getObjectId(index); | |||
var templateIds = await db.Queryable<AuthorizeTemplateMapEntity>().LeftJoin<AuthorizeTemplateEntity>((t, x) => t.TemplateId == x.Id) | |||
.Where((t, x) => t.AuthorizeType == index && t.ObjectId == objectId).ToListAsync(t => t.TemplateId); | |||
if (!templateIds.HasVal() || templateIds.Count == 0) | |||
{ | |||
continue; | |||
} | |||
return await db.Queryable<AuthorizeTemplateItemEntity>().LeftJoin<ModuleEntity>((t, x) => t.TB_ModuleId == x.Id) | |||
.Where((t, x) => templateIds.Contains(t.TB_TemplateId)) | |||
.GroupBy((t, x) => t.TB_ModuleId).ToListAsync(t => t.TB_ModuleId); | |||
} | |||
return null; | |||
} | |||
#endregion | |||
#region 角色 | |||
[HttpPost] | |||
public async Task<bool> AddRole(RoleAddInput input) | |||
@@ -349,174 +278,8 @@ | |||
} | |||
#endregion | |||
#region 授权模板 | |||
[HttpPost] | |||
public async Task<bool> AddAuthorTemp(AuthorizeTemplateAddInput input) | |||
{ | |||
if (await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Name == input.Name && it.IsDeleted == false).AnyAsync()) | |||
throw Oops.Bah("模板名称已经存在"); | |||
var data = await db.Insertable(input.Adapt<AuthorizeTemplateEntity>()).ExecuteCommandAsync(); | |||
return data > 0; | |||
} | |||
[HttpPost] | |||
public async Task<bool> EditAuthorTemp(AuthorizeTemplateUpdateInput input) | |||
{ | |||
if (!await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Id == input.Id && it.IsDeleted == false).AnyAsync()) | |||
throw Oops.Bah("模板不存在或已被删除"); | |||
if (await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Id != input.Id && it.Name == input.Name && it.IsDeleted == false).AnyAsync()) | |||
throw Oops.Bah("模板名称已经存在"); | |||
return await db.Updateable<AuthorizeTemplateEntity>(input).Where(a => a.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||
} | |||
[HttpGet] | |||
public async Task<bool> RemoveAuthorTemp(string input) | |||
{ | |||
var f1 = await db.Updateable<AuthorizeTemplateEntity>().SetColumns(t => t.IsDeleted == true).Where(t => t.Id == input).ExecuteCommandHasChangeAsync(); | |||
var f2 = await db.Updateable<AuthorizeTemplateItemEntity>().SetColumns(T => T.IsDeleted == true).Where(t => t.TB_TemplateId == input).ExecuteCommandHasChangeAsync(); | |||
return f1 && f2; | |||
} | |||
[HttpPost] | |||
public async Task<SqlSugarPagedList<AuthorizeTemplateOutput>> QueryAuthorTemp(AuthorizeTemplateQueryPageInput input) | |||
{ | |||
RefAsync<int> Total = 0; | |||
var data = await db.Queryable<AuthorizeTemplateEntity>().Where(t => !t.IsDeleted) | |||
.WhereIF(!string.IsNullOrEmpty(input.Keyword), t => t.Name.Contains(input.Keyword)) | |||
.OrderByDescending(t => t.CreateAt) | |||
.Select<AuthorizeTemplateOutput>() | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
return data; | |||
} | |||
public async Task<AuthorizeTemplateOutput> GetAuthorTemp(string input) | |||
{ | |||
var data = await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Id == input && it.IsDeleted == false).FirstAsync(); | |||
return data.Adapt<AuthorizeTemplateOutput>(); | |||
} | |||
#endregion | |||
#region 授权模板详情 | |||
[HttpGet] | |||
public async Task<List<AuthorizeTemplateItemEntity>> GetModuleByTemplateId(string input) | |||
{ | |||
var entity =await db.Queryable<AuthorizeTemplateItemEntity>().Where(m => m.TB_TemplateId == input).ToListAsync(); | |||
return entity; | |||
} | |||
[HttpPost] | |||
public async Task<bool> EditTemplateItem(AuthorModuleItemUpdateInput input) | |||
{ | |||
var temp = await db.Queryable<AuthorizeTemplateEntity>().FirstAsync(t => t.Id == input.TB_TemplateId && t.IsDeleted == false); | |||
try | |||
{ | |||
db.Ado.BeginTran(); | |||
await db.Deleteable<AuthorizeTemplateItemEntity>() | |||
.Where(t => t.TB_TemplateId == input.TB_TemplateId).ExecuteCommandAsync(); | |||
var entity = input.TB_ModuleIds.Distinct().ToList().ConvertAll(t => new AuthorizeTemplateItemEntity | |||
{ | |||
TB_ModuleId = t, | |||
TB_TemplateId = input.TB_TemplateId | |||
}); | |||
await db.Insertable(entity).ExecuteCommandAsync(); | |||
db.Ado.CommitTran(); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw Oops.Bah(ex.Message); | |||
} | |||
} | |||
[HttpPost] | |||
public async Task<List<AuthorizeOutput>> GetAuthorizeObjects(AuthorizeInput input) | |||
{ | |||
List<AuthorizeOutput> result; | |||
if (input.Type == 2) | |||
{ | |||
var temp = await db.Queryable<RoleEntity>() | |||
.Where(t => t.RoleType != 1) | |||
.Where(t => t.IsDeleted == false) | |||
.WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), t => t.Name.Contains(input.Keyword)) | |||
.OrderBy(t => t.RoleType) | |||
.OrderBy(t => t.Name) | |||
.ToListAsync(); | |||
result = temp.Adapt<List<AuthorizeOutput>>(); | |||
db.ThenMapper(result, item => | |||
{ | |||
item.IsAuthorized = db.Queryable<AuthorizeTemplateMapEntity>() | |||
.Where(m => m.TemplateId == input.TemplateId && m.AuthorizeType == input.Type && m.ObjectId == item.Id).Any(); | |||
}); | |||
} | |||
else | |||
{ | |||
var temp = await db.Queryable<EmployeeEntity>() | |||
.Where(t => t.IsAdmin == false) | |||
.WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), t => t.Name.Contains(input.Keyword)) | |||
.OrderBy(t => t.Name) | |||
.ToListAsync(); | |||
result = temp.Adapt<List<AuthorizeOutput>>(); | |||
db.ThenMapper(result, item => | |||
{ | |||
item.IsAuthorized = db.Queryable<AuthorizeTemplateMapEntity>().Where(t => t.IsDeleted == false) | |||
.Where(m => m.TemplateId == input.TemplateId && m.AuthorizeType == input.Type && m.ObjectId == item.Id).Any(); | |||
}); | |||
} | |||
if (result.HasVal()) | |||
{ | |||
result = result.OrderByDescending(m => m.IsAuthorized).ThenBy(m => m.Name).ToList(); | |||
} | |||
return result; | |||
} | |||
[HttpPost] | |||
public async Task<bool> RemoveAuthorize(AuthorizeInput input) | |||
{ | |||
var objectIds = input.ObjectIds.Distinct().ToArray(); | |||
return await db.Updateable<AuthorizeTemplateMapEntity>().SetColumns(t => t.IsDeleted == true) | |||
.Where(it => it.TemplateId == input.TemplateId && it.AuthorizeType == input.Type && objectIds.Contains(it.ObjectId)) | |||
.ExecuteCommandHasChangeAsync(); | |||
} | |||
[HttpPost] | |||
public async Task AddAuthorize(AuthorMapAddInput input) | |||
{ | |||
foreach (var item in input.TemplateIds.Distinct()) | |||
{ | |||
if (!await _dbContext.Queryable<AuthorizeTemplateMapEntity>().AnyAsync(m => m.TemplateId == item && m.AuthorizeType == input.AuthorizeType && m.IsDeleted == false && m.ObjectId == input.ObjectId)) | |||
{ | |||
await _dbContext.Insertable(new AuthorizeTemplateMapEntity() | |||
{ | |||
TemplateId = item, | |||
ObjectId = input.ObjectId, | |||
AuthorizeType = input.AuthorizeType | |||
}).ExecuteCommandAsync(); | |||
} | |||
} | |||
} | |||
[HttpPost] | |||
public async Task<bool> SaveAuthorize(AuthorModulesAddInput input) | |||
{ | |||
if (await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Name == input.TemplateName && it.IsDeleted == false).AnyAsync()) | |||
{ | |||
throw Oops.Bah("模板名称已经存在"); | |||
} | |||
AuthorizeTemplateEntity Model = new AuthorizeTemplateEntity(); | |||
Model.Name = input.TemplateName; | |||
List<AuthorizeTemplateItemEntity> templateItems = input.ModuleIds.ConvertAll(m => new AuthorizeTemplateItemEntity | |||
{ | |||
TB_TemplateId = Model.Id, | |||
TB_ModuleId = m | |||
}); | |||
try | |||
{ | |||
db.Ado.BeginTran(); | |||
var f1 = (await db.Insertable(Model).ExecuteCommandAsync()) > 0; | |||
var f2 = (await _dbContext.Insertable(templateItems).ExecuteCommandAsync()) > 0; | |||
db.Ado.CommitTran(); | |||
return f1 && f2; | |||
} | |||
catch (Exception) | |||
{ | |||
db.Ado.RollbackTran(); | |||
return false; | |||
} | |||
} | |||
[HttpGet] | |||
public async Task<bool> RestoreAccountByUser(string input) | |||
{ | |||
var Demo = "123456".ToMD5Encrypt(); | |||
@@ -545,7 +308,8 @@ | |||
[HttpPost] | |||
public async Task<bool> EditAccountPwd(AccountUpdatePwdInput input) | |||
{ | |||
var model = db.Queryable<AccountEntity>().First(t => t.Account == input.Account && t.Pwd == input.Pwd); | |||
var Account = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value; | |||
var model = db.Queryable<AccountEntity>().First(t => t.Account == Account && t.Pwd == input.OldPwd); | |||
if (model == null) throw Oops.Bah("原密码不正确"); | |||
model.Pwd = input.NewPwd; | |||
return await db.Updateable(model).ExecuteCommandAsync() > 0; | |||
@@ -629,6 +393,60 @@ | |||
var data = await db.Queryable<EmployeeEntity>().Where(t => t.IsAdmin == false).ToListAsync(); | |||
return data.Adapt<List<EmployeeOutput>>(); | |||
} | |||
/// <summary> | |||
/// 分配角色权限 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<bool> AddRoleModule(RoleModuleAddInput input) | |||
{ | |||
List<RoleModuleEntity> entitys = new(); | |||
var moduleList =await _dbContext.Queryable<ModuleEntity>().ToListAsync(); | |||
var parentId = input.ModuleIds.Where(x=>x.ParentId!="").GroupBy(x => x.ParentId).ToList(); | |||
foreach (var item in parentId) | |||
{ | |||
if (input.ModuleIds.FirstOrDefault(x=>x.ModuleId==item.Key && x.ParentId=="")==null) | |||
{ | |||
input.ModuleIds.Add(new RoleModuleDto { ModuleId = item.Key, ParentId = "", RoleId = input.RoleId }); | |||
} | |||
} | |||
foreach (var item in input.ModuleIds) | |||
{ | |||
RoleModuleEntity entity = new() | |||
{ | |||
ModuleId = item.ModuleId, | |||
ParentId = item.ParentId, | |||
RoleId = input.RoleId | |||
}; | |||
entitys.Add(entity); | |||
} | |||
try | |||
{ | |||
_dbContext.Ado.BeginTran(); | |||
await _dbContext.Deleteable<RoleModuleEntity>().Where(x => x.RoleId == input.RoleId).ExecuteCommandAsync(); | |||
await _dbContext.Insertable(entitys).ExecuteCommandAsync(); | |||
_dbContext.Ado.CommitTran(); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw Oops.Bah(ex.Message); | |||
} | |||
} | |||
/// <summary> | |||
/// 根据角色获取权限模块 | |||
/// </summary> | |||
/// <param name="RoleId"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public async Task<List<RoleModuleOutput>> RoleModuleList(string RoleId) | |||
{ | |||
var entitys = await _dbContext.Queryable<RoleModuleEntity>().Where(x => x.RoleId == RoleId&&x.ParentId!="").ToListAsync(); | |||
var output = entitys.Adapt<List<RoleModuleOutput>>(); | |||
return output; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -35,6 +35,8 @@ public interface IAuthorizeService | |||
Task<RoleOutput> GetRole(string input); | |||
Task<List<RoleOutput>> GetRoleList(); | |||
Task<SqlSugarPagedList<RoleOutput>> QueryRole(RoleQueryPageInput input); | |||
Task<bool> AddRoleModule(RoleModuleAddInput input); | |||
#endregion | |||
#region 模块 | |||
@@ -44,20 +46,5 @@ public interface IAuthorizeService | |||
Task<List<ModuleTreeOutput>> GetTreeGrid(ModuleTreeQueryInput input); | |||
#endregion | |||
#region 授权模板 | |||
Task<bool> AddAuthorTemp(AuthorizeTemplateAddInput input); | |||
Task<bool> EditAuthorTemp(AuthorizeTemplateUpdateInput input); | |||
Task<bool> RemoveAuthorTemp(string input); | |||
Task<SqlSugarPagedList<AuthorizeTemplateOutput>> QueryAuthorTemp(AuthorizeTemplateQueryPageInput input); | |||
Task<AuthorizeTemplateOutput> GetAuthorTemp(string input); | |||
#endregion | |||
#region 授权模板详情 | |||
Task<List<AuthorizeTemplateItemEntity>> GetModuleByTemplateId(string input); | |||
Task<bool> EditTemplateItem(AuthorModuleItemUpdateInput input); | |||
Task<List<AuthorizeOutput>> GetAuthorizeObjects(AuthorizeInput input); | |||
Task<bool> RemoveAuthorize(AuthorizeInput input); | |||
Task<bool> SaveAuthorize(AuthorModulesAddInput input); | |||
Task AddAuthorize(AuthorMapAddInput input); | |||
#endregion | |||
} |
@@ -25,6 +25,10 @@ | |||
/// </summary> | |||
public string Number { get; set; } | |||
/// <summary> | |||
/// 设备id | |||
/// </summary> | |||
public string DeviceId { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
public string CreateTime { get; set; } | |||
@@ -137,6 +141,14 @@ | |||
/// </summary> | |||
public string LineName { get; set; } | |||
/// <summary> | |||
/// 设备编码 | |||
/// </summary> | |||
public string DeviceCode { get; set; } | |||
/// <summary> | |||
/// 设备名称 | |||
/// </summary> | |||
public string DeviceName { get; set; } | |||
/// <summary> | |||
/// 工单状态 | |||
/// </summary> | |||
public WorkOrderStatusEnum? Status { get; set; } | |||
@@ -170,6 +182,9 @@ | |||
/// <summary> | |||
/// 物料信息 | |||
/// </summary> | |||
public List<WorkInfoMaterialsRecordEntity> MaterialList { get; set; } | |||
public List<WorkInfoMaterialsRecordOutput> MaterialList { get; set; } | |||
} | |||
} |
@@ -8,6 +8,42 @@ | |||
/// </summary> | |||
public class WorkInfoMaterialsRecordDto | |||
{ | |||
/// <summary> | |||
/// 物料名称 | |||
/// </summary> | |||
public string MaterialName { get; set; } | |||
/// <summary> | |||
/// 物料id | |||
/// </summary> | |||
public string MaterialId { get; set; } | |||
/// <summary> | |||
/// 工单id | |||
/// </summary> | |||
public string WorkId { get; set; } | |||
/// <summary> | |||
/// 重量 | |||
/// </summary> | |||
public string Weight { get; set; } | |||
/// <summary> | |||
/// 第几锅 | |||
/// </summary> | |||
public string PotNum { get; set; } | |||
/// <summary> | |||
/// 配方Id | |||
/// </summary> | |||
public string RecipeId { get; set; } | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipeName { get; set; } | |||
/// <summary> | |||
/// 物料状态 | |||
/// </summary> | |||
public EBatchingStatus MaterialStatus { get; set; } | |||
/// <summary> | |||
/// 更新时间 | |||
/// </summary> | |||
public DateTime? UpdateTime { get; set; } | |||
} | |||
/// <summary> | |||
/// 增加 | |||
@@ -56,5 +92,17 @@ | |||
/// 主键 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 物料类型 | |||
/// </summary> | |||
public string MaterialType { get; set; } | |||
/// <summary> | |||
/// 物料类型名称 | |||
/// </summary> | |||
public string MaterialTypeName { get; set; } | |||
/// <summary> | |||
/// 每升重量 | |||
/// </summary> | |||
public string WeightPerLiter { get; set; } | |||
} | |||
} |
@@ -15,11 +15,16 @@ | |||
/// <summary> | |||
/// 工单状态 | |||
/// </summary> | |||
public string Status { get; set; } | |||
public WorkOrderStatusEnum Status { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
public DateTime CreateTime { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
} | |||
/// <summary> | |||
/// 增加 | |||
@@ -41,6 +46,11 @@ | |||
/// 状态 | |||
/// </summary> | |||
public WorkOrderStatusEnum Status { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
} | |||
/// <summary> | |||
/// 删除 | |||
@@ -58,6 +68,20 @@ | |||
public class WorkInfoStatusQueryPageInput : RequestPage | |||
{ | |||
} | |||
/// <summary> | |||
/// 下发 | |||
/// </summary> | |||
public class PublishInput | |||
{ | |||
/// <summary> | |||
/// 工单ID | |||
/// </summary> | |||
public string WorkId { get; set; } | |||
/// <summary> | |||
/// 设备ID | |||
/// </summary> | |||
public string? DeviceId { get; set; } | |||
} | |||
/// <summary> | |||
/// 输出 | |||
@@ -68,5 +92,30 @@ | |||
/// 主键 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 状态名称 | |||
/// </summary> | |||
public string StatusName { get { | |||
switch (Status) | |||
{ | |||
case WorkOrderStatusEnum.Unkown: | |||
return "未知"; | |||
case WorkOrderStatusEnum.Draft: | |||
return "草稿"; | |||
case WorkOrderStatusEnum.Issued: | |||
return "已下发"; | |||
case WorkOrderStatusEnum.Receive: | |||
return "已接受"; | |||
case WorkOrderStatusEnum.Started: | |||
return "已启动"; | |||
case WorkOrderStatusEnum.Completed: | |||
return "已完成"; | |||
case WorkOrderStatusEnum.Obsolete: | |||
return "废弃"; | |||
default: | |||
return "错误"; | |||
} | |||
} } | |||
} | |||
} |
@@ -53,9 +53,9 @@ | |||
/// <summary> | |||
/// 工单下发 | |||
/// </summary> | |||
/// <param name="workId">工单Id</param> | |||
/// <param name="input">工单Id</param> | |||
/// <returns></returns> | |||
Task<bool> Publish(string workId); | |||
Task<bool> Publish(PublishInput input); | |||
/// <summary> | |||
/// 强制结束 | |||
/// </summary> | |||
@@ -74,34 +74,51 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
.LeftJoin<Pztj_FinalsInfoEntity>((a, b) => a.FinalId == b.Id) | |||
.LeftJoin<ProductLineEntity>((a, b, c) => a.LineId == c.Id) | |||
.LeftJoin<Pztj_WorkInfoStatusEntity>((a, b, c, d) => d.Id == SqlFunc.Subqueryable<Pztj_WorkInfoStatusEntity>().Where(s => s.WorkId == a.Id).OrderByDesc(s => s.CreateTime).Select(s => s.Id)) | |||
.LeftJoin<Pztj_DevicesInfoEntity>((a,b,c,d,e)=>a.DeviceId==e.Id) | |||
.Where((a, b, c, d) => a.Id == Id) | |||
.Select((a, b, c, d) => new WorkInfoDetailOutput | |||
.Select((a, b, c, d, e) => new WorkInfoDetailOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
DeviceCode = e.Code, | |||
DeviceName=e.Name, | |||
DeviceId = e.Id, | |||
FinalName = b.Name, | |||
LineName = c.Name, | |||
Status = d.Status == null ? WorkOrderStatusEnum.Draft : d.Status | |||
}).FirstAsync(); | |||
if (entity==null) | |||
if (entity == null) | |||
{ | |||
throw Oops.Bah("没有找到工单信息!"); | |||
} | |||
//获取成品信息 | |||
var finainfo = await _dbContext.Queryable<Pztj_FinalsInfoEntity>().FirstAsync(x => x.Id == entity.FinalId); | |||
if (finainfo==null) | |||
if (finainfo == null) | |||
{ | |||
throw Oops.Bah("没有找到成品信息!"); | |||
} | |||
//获取工艺步骤 | |||
var craftlist = await _dbContext.Queryable<WorkInfoCraftstepRecordEntity>().Where(x => x.WorkId == Id).ToListAsync(); | |||
//获取物料信息 | |||
var materiallist = await _dbContext.Queryable<WorkInfoMaterialsRecordEntity>().Where(x => x.WorkId == Id).ToListAsync(); | |||
var materiallist = await _dbContext.Queryable<WorkInfoMaterialsRecordEntity>() | |||
.LeftJoin<Pztj_MaterialsInfoEntity>((a,b)=>a.MaterialId==b.Id) | |||
.LeftJoin<DictDataEntity>((a,b,c) => b.Type == c.Id) | |||
.Where((a, b) => a.WorkId == Id) | |||
.Select((a, b,c) => | |||
new WorkInfoMaterialsRecordOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
MaterialType = c.Id, | |||
MaterialTypeName = c.Value, | |||
WeightPerLiter = b.WeightPerLiter | |||
}) | |||
.ToListAsync(); | |||
entity.CraftList = craftlist; | |||
entity.MaterialList = materiallist; | |||
if(craftlist.Max(x=>x.Status) == RecipeStatus.执行完成 && craftlist.Max(x => x.Status) == craftlist.Min(x => x.Status)) | |||
if (craftlist.Max(x => x.Status) == RecipeStatus.执行完成 && craftlist.Max(x => x.Status) == craftlist.Min(x => x.Status)) | |||
{ | |||
entity.CraftStatus = RecipeStatus.执行完成; | |||
}else | |||
} | |||
else | |||
if (craftlist.Max(x => x.Status) == RecipeStatus.等待执行 && craftlist.Max(x => x.Status) == craftlist.Min(x => x.Status)) | |||
{ | |||
entity.CraftStatus = RecipeStatus.等待执行; | |||
@@ -141,8 +158,8 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b, c, d) => b.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Id), (a, b, c, d) => a.Id.Contains(input.Id)) | |||
.WhereIF(input.Status != null, (a, b, c, d) => input.Status.Contains(d.Status)) | |||
.WhereIF(input.StartTime!=null,(a, b, c, d) => input.StartTime<= Convert.ToDateTime(a.CreateTime)) | |||
.WhereIF(input.EndTime != null, (a, b, c, d) => input.EndTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59) >= Convert.ToDateTime(a.CreateTime)) | |||
.WhereIF(input.StartTime != null, (a, b, c, d) => input.StartTime <= a.CreateTime) | |||
.WhereIF(input.EndTime != null, (a, b, c, d) => input.EndTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59) >= a.CreateTime) | |||
.Select((a, b, c, d) => new WorkInfoOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
@@ -169,6 +186,7 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
.WhereIF(input.Status != null, (a, b, c, d) => input.Status.Contains(d.Status)) | |||
.WhereIF(input.StartTime != null, (a, b, c, d) => input.StartTime <= Convert.ToDateTime(a.CreateTime)) | |||
.WhereIF(input.EndTime != null, (a, b, c, d) => input.EndTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59) >= Convert.ToDateTime(a.CreateTime)) | |||
.OrderByDescending((a, b, c, d) => a.CreateTime) | |||
.Select((a, b, c, d) => new WorkInfoOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
@@ -182,56 +200,71 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
/// <summary> | |||
/// 工单下发 | |||
/// </summary> | |||
/// <param name="workId">工单id</param> | |||
/// <param name="input">工单id</param> | |||
/// <returns></returns> | |||
/// <exception cref="NotImplementedException"></exception> | |||
[HttpPost] | |||
public async Task<bool> Publish(string workId) | |||
public async Task<bool> Publish(PublishInput input) | |||
{ | |||
string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
string userName = App.User?.FindFirst(ClaimConst.CLAINM_NAME)?.Value; | |||
if (!string.IsNullOrEmpty(input.DeviceId)) | |||
{ | |||
await _dbContext.Updateable<Pztj_WorkInfoEntity>().SetColumns(x => x.DeviceId == input.DeviceId).Where(x => x.Id == input.WorkId).ExecuteCommandAsync(); | |||
} | |||
var res = await UpdateStatus( | |||
new WorkInfoStatusUpdateInput | |||
{ | |||
WorkId = workId, | |||
Status = WorkOrderStatusEnum.Issued | |||
WorkId = input.WorkId, | |||
Status = WorkOrderStatusEnum.Issued, | |||
Remark = $"[{userId}]{userName}" | |||
}); | |||
var entity = await _dbContext.Queryable<Pztj_WorkInfoEntity>().FirstAsync(x => x.Id == workId); | |||
WorkInfoOutput workInfo = entity.Adapt<WorkInfoOutput>(); | |||
var workentity = await _dbContext.Queryable<Pztj_WorkInfoEntity>() | |||
.LeftJoin<Pztj_DevicesInfoEntity>((a,b)=>a.DeviceId==b.Id) | |||
.Where((a, b) => a.Id == input.WorkId) | |||
.Select((a,b)=>new WorkInfoOutput | |||
{ | |||
Id=a.Id.SelectAll(), | |||
DeviceCode = b.Code, | |||
DeviceName = b.Name | |||
}) | |||
.FirstAsync(); | |||
if (res) | |||
{ | |||
WorkInfoMaterialsRecordEntity workInfoMaterialsRecordEntity = new() | |||
WorkInfoMaterialsRecordEntity workInfoMaterialsRecordEntity = new() | |||
{ | |||
MaterialId = workId, | |||
MaterialId = input.WorkId, | |||
}; | |||
//获取成品信息 | |||
var finainfo = await _dbContext.Queryable<Pztj_FinalsInfoEntity>().FirstAsync(x => x.Id == entity.FinalId); | |||
var finainfo = await _dbContext.Queryable<Pztj_FinalsInfoEntity>().FirstAsync(x => x.Id == workentity.FinalId); | |||
if (finainfo == null) | |||
{ | |||
throw Oops.Bah("没有找到成品信息!"); | |||
} | |||
var materiallist = await _dbContext.Queryable<RecipeMaterialEntity>() | |||
.LeftJoin<Pztj_MaterialsInfoEntity>((a,b)=>a.MaterialId==b.Id) | |||
.Where((a, b) => a.RecipesId == finainfo.RecipeId) | |||
.Select((a, b) => new WorkInfoMaterialsRecordEntity | |||
.LeftJoin<Pztj_MaterialsInfoEntity>((a, b) => a.MaterialId == b.Id) | |||
.LeftJoin<RecipesInfoEntity>((a,b,c)=>a.RecipesId==c.Id) | |||
.Where((a, b, c) => a.RecipesId == finainfo.RecipeId) | |||
.Select((a, b, c) => new WorkInfoMaterialsRecordEntity | |||
{ | |||
MaterialId = a.MaterialId, | |||
MaterialName = b.Name, | |||
MaterialStatus = EBatchingStatus.等待配料, | |||
WorkId = workId, | |||
WorkId = input.WorkId, | |||
Weight = a.Weight, | |||
RecipeId = a.RecipesId, | |||
RecipeName = b.Name | |||
RecipeName = c.Name | |||
}) | |||
.ToListAsync(); | |||
//获取物料信息 | |||
var craftsteplist = await _dbContext.Queryable<Pztj_CraftStepsEntity>() | |||
.LeftJoin<Pztj_CraftsInfoEntity>((a,b)=>a.CraftId==b.Id) | |||
.LeftJoin<DeviceProductFunctionEntity>((a,b,c)=>a.DeviceProductFunctionId==c.Id) | |||
.Where((a,b)=>a.CraftId== finainfo.CraftId) | |||
.Select((a,b,c)=>new WorkInfoCraftstepRecordEntity | |||
.LeftJoin<Pztj_CraftsInfoEntity>((a, b) => a.CraftId == b.Id) | |||
.LeftJoin<DeviceProductFunctionEntity>((a, b, c) => a.DeviceProductFunctionId == c.Id) | |||
.Where((a, b) => a.CraftId == finainfo.CraftId) | |||
.Select((a, b, c) => new WorkInfoCraftstepRecordEntity | |||
{ | |||
CraftId = a.CraftId, | |||
CraftName = b.Name, | |||
@@ -241,12 +274,12 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
CraftstepParms = a.Params, | |||
Status = RecipeStatus.等待执行, | |||
Step = a.Step, | |||
WorkId = workId | |||
WorkId = input.WorkId | |||
}) | |||
.ToListAsync(); | |||
List<WorkInfoMaterialsRecordEntity> newmateriallist = new(); | |||
List<WorkInfoCraftstepRecordEntity> newcraftslist = new(); | |||
for (int i = 1; i <= Convert.ToInt32(entity.Number); i++) | |||
for (int i = 1; i <= Convert.ToInt32(workentity.Number); i++) | |||
{ | |||
foreach (var item in materiallist) | |||
{ | |||
@@ -276,7 +309,7 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
Status = item.Status, | |||
Step = item.Step, | |||
WorkId = item.WorkId, | |||
PotNum=i.ToString(), | |||
PotNum = i.ToString(), | |||
}; | |||
newcraftslist.Add(itementity); | |||
} | |||
@@ -284,8 +317,9 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
try | |||
{ | |||
_dbContext.Ado.BeginTran(); | |||
await _dbContext.Deleteable<WorkInfoCraftstepRecordEntity>().Where(x => x.WorkId == workId).ExecuteCommandAsync(); | |||
await _dbContext.Deleteable<WorkInfoMaterialsRecordEntity>().Where(x => x.WorkId == workId).ExecuteCommandAsync(); | |||
await _dbContext.Deleteable<WorkInfoCraftstepRecordEntity>().Where(x => x.WorkId == input.WorkId).ExecuteCommandAsync(); | |||
await _dbContext.Deleteable<WorkInfoMaterialsRecordEntity>().Where(x => x.WorkId == input.WorkId).ExecuteCommandAsync(); | |||
await _dbContext.Insertable(newcraftslist).ExecuteCommandAsync(); | |||
await _dbContext.Insertable(newmateriallist).ExecuteCommandAsync(); | |||
_dbContext.Ado.CommitTran(); | |||
@@ -295,7 +329,7 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
_dbContext.Ado.RollbackTran(); | |||
throw Oops.Oh("下发失败!"); | |||
} | |||
await _MQTTService.MqttPublish(workInfo, Topics.WorkOrderPush, MessageID.WorkOrderIssued); | |||
await _MQTTService.MqttPublish(new MqttPublishDto() { Payload = workentity, Topic = Topics.WorkOrderPush, MessageId = MessageID.WorkOrderIssued }); | |||
} | |||
return true; | |||
} | |||
@@ -367,12 +401,16 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
{ | |||
var entityFrist = await _dbContext.Queryable<WorkInfoCraftstepRecordEntity>().Where(x => x.Id == input.WorkCraftstepId).FirstAsync(); | |||
var entityFrist = await _dbContext.Queryable<WorkInfoCraftstepRecordEntity>().Where(x => x.Id == input.WorkCraftstepId).FirstAsync(); | |||
if (entityFrist==null) | |||
{ | |||
throw Oops.Bah("未查询到工单信息!"); | |||
} | |||
if (!string.IsNullOrEmpty(input.WorkId)) | |||
{ | |||
bool res = await _dbContext.Updateable<WorkInfoCraftstepRecordEntity>() | |||
.SetColumns(x=>x.Status==input.Status) | |||
.SetColumns(x=>x.UpdateTime==DateTime.Now).IgnoreColumns(true).Where(x=>x.WorkId==input.WorkId && x.PotNum==input.PotNum).ExecuteCommandHasChangeAsync(); | |||
.SetColumns(x => x.Status == input.Status) | |||
.SetColumns(x => x.UpdateTime == DateTime.Now).IgnoreColumns(true).Where(x => x.WorkId == input.WorkId && x.PotNum == input.PotNum).ExecuteCommandHasChangeAsync(); | |||
return res; | |||
} | |||
else | |||
@@ -397,10 +435,13 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
[HttpPost] | |||
public async Task<bool> ForcedEnd(string workId) | |||
{ | |||
string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
string userName = App.User?.FindFirst(ClaimConst.CLAINM_NAME)?.Value; | |||
Pztj_WorkInfoStatusEntity entity = new() | |||
{ | |||
WorkId = workId, | |||
Status = WorkOrderStatusEnum.Completed | |||
Status = WorkOrderStatusEnum.Completed, | |||
Remark = $"{userName}[{userId}]点击你强制结束" | |||
}; | |||
var res = await _dbContext.Insertable(entity).IgnoreColumns(true).ExecuteCommandIdentityIntoEntityAsync(); | |||
return res; | |||
@@ -413,8 +454,9 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
[HttpGet] | |||
public async Task<List<WorkInfoStatusOutput>> StatusList(string workId) | |||
{ | |||
var entitys = await _dbContext.Queryable<Pztj_WorkInfoStatusEntity>().Where(x => x.WorkId == workId).ToListAsync(); | |||
var entitys = await _dbContext.Queryable<Pztj_WorkInfoStatusEntity>().Where(x => x.WorkId == workId).OrderByDescending(x=>x.CreateTime).ToListAsync(); | |||
List<WorkInfoStatusOutput> list = entitys.Adapt<List<WorkInfoStatusOutput>>(); | |||
return list; | |||
} | |||
} | |||
@@ -39,6 +39,10 @@ namespace BPA.MES.Base.Core | |||
{ | |||
entityInfo.SetValue(DateTime.Now); | |||
}; | |||
if (entityInfo.PropertyName == "CreateDate" && entityInfo.OperationType == DataFilterType.InsertByObject) | |||
{ | |||
entityInfo.SetValue(DateTime.Now); | |||
}; | |||
}; | |||
} | |||
); | |||
@@ -30,7 +30,7 @@ public class JwtHandler : AppAuthorizeHandler | |||
else | |||
{ | |||
// 自动刷新 token | |||
if (JWTEncryption.AutoRefreshToken(context, context.GetCurrentHttpContext(), expiredTime: 20, refreshTokenExpiredTime: 25)) | |||
if (JWTEncryption.AutoRefreshToken(context, context.GetCurrentHttpContext(), expiredTime: 43200, refreshTokenExpiredTime: 43225)) | |||
{ | |||
await AuthorizeHandleAsync(context); | |||
} | |||
@@ -56,35 +56,6 @@ public class Startup : AppStartup | |||
op.Sign = "123456"; | |||
}); | |||
//services.AddMqttClientHostedService(op => | |||
//{ | |||
// op.Port = 1883; | |||
// op.Server = "10.2.1.21"; | |||
// op.UserName = "emqx_u_block"; | |||
// op.Password = "emqx_p_admin8765490789"; | |||
// op.mqttClientConnectedHandlerDelegate = new MqttClientConnectedHandlerDelegate(async e => | |||
// { | |||
// Console.WriteLine("MQTT连接成功"); | |||
// }); | |||
// op.mqttClientDisconnectedHandlerDelegate = new MqttClientDisconnectedHandlerDelegate(async e => | |||
// { | |||
// Console.WriteLine("MQTT断开连接"); | |||
// await Task.Delay(TimeSpan.FromSeconds(5)); | |||
// try | |||
// { | |||
// //var options = builder.Build().Services.GetService<IMqttClientOptions>(); | |||
// //await builder.Build().Services.GetService<IMqttClient>().ConnectAsync(options); | |||
// } | |||
// catch (global::System.Exception) | |||
// { | |||
// } | |||
// }); | |||
// op.MqttApplicationMessageReceivedHandler = new MQTTnet.Client.Receiving.MqttApplicationMessageReceivedHandlerDelegate(async e => | |||
// { | |||
// }); | |||
//}); | |||
services.AddControllers() | |||
.AddInjectWithUnifyResult(); | |||
@@ -0,0 +1,5 @@ | |||
{ | |||
"version": 1, | |||
"isRoot": true, | |||
"tools": {} | |||
} |
@@ -5,6 +5,10 @@ | |||
</PropertyGroup> | |||
<PropertyGroup> | |||
<ActiveDebugProfile>BPA.MES.Base.Web.Entry</ActiveDebugProfile> | |||
<<<<<<< HEAD | |||
<NameOfLastUsedPublishProfile>D:\Work\WFZ.MES\backend\BPA.MES.Base.Web.Entry\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> | |||
======= | |||
<NameOfLastUsedPublishProfile>D:\胖子天骄\PZTJ.MES\backend\BPA.MES.Base.Web.Entry\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> | |||
>>>>>>> 6f4b2f1df49c81e7fad80144116bbcedd9567b2e | |||
</PropertyGroup> | |||
</Project> |
@@ -4,7 +4,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||
--> | |||
<Project> | |||
<PropertyGroup> | |||
<<<<<<< HEAD | |||
<DeleteExistingFiles>false</DeleteExistingFiles> | |||
======= | |||
<DeleteExistingFiles>true</DeleteExistingFiles> | |||
>>>>>>> 6f4b2f1df49c81e7fad80144116bbcedd9567b2e | |||
<ExcludeApp_Data>false</ExcludeApp_Data> | |||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish> | |||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> | |||
@@ -12,6 +16,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||
<PublishProvider>FileSystem</PublishProvider> | |||
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl> | |||
<WebPublishMethod>FileSystem</WebPublishMethod> | |||
<<<<<<< HEAD | |||
<_TargetId>Folder</_TargetId> | |||
======= | |||
<SiteUrlToLaunchAfterPublish /> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | |||
<ProjectGuid>c8d99f52-edc7-411f-8300-6db14bf59e8c</ProjectGuid> | |||
<SelfContained>true</SelfContained> | |||
>>>>>>> 6f4b2f1df49c81e7fad80144116bbcedd9567b2e | |||
</PropertyGroup> | |||
</Project> |
@@ -4,8 +4,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||
--> | |||
<Project> | |||
<PropertyGroup> | |||
<<<<<<< HEAD | |||
<_PublishTargetUrl>D:\Work\WFZ.MES\backend\BPA.MES.Base.Web.Entry\bin\Release\net6.0\publish\</_PublishTargetUrl> | |||
<History>True|2023-11-21T18:21:39.5146403Z;False|2023-11-22T02:20:54.9725149+08:00;True|2023-11-22T02:03:13.7452019+08:00;</History> | |||
<LastFailureDetails /> | |||
======= | |||
<_PublishTargetUrl>D:\胖子天骄\PZTJ.MES\backend\BPA.MES.Base.Web.Entry\bin\Release\net6.0\publish\</_PublishTargetUrl> | |||
<History>True|2023-11-17T01:40:44.6883835Z;True|2023-11-03T09:49:49.8809253+08:00;True|2023-10-19T18:26:28.9736059+08:00;True|2023-10-19T12:20:00.3256982+08:00;True|2023-10-18T11:41:41.7977602+08:00;True|2023-10-17T18:56:25.1421613+08:00;True|2023-10-16T15:43:05.7944751+08:00;True|2023-10-15T17:28:41.6387899+08:00;True|2023-10-14T18:02:29.7904729+08:00;True|2023-10-14T10:58:09.1850768+08:00;False|2023-10-14T10:57:38.1803146+08:00;True|2023-10-10T15:43:25.4511019+08:00;False|2023-10-10T15:34:09.4564943+08:00;False|2023-10-09T14:10:16.8583415+08:00;True|2023-10-09T14:07:07.0884367+08:00;True|2023-10-09T13:50:15.6186644+08:00;True|2023-10-09T12:23:40.9180586+08:00;</History> | |||
>>>>>>> 6f4b2f1df49c81e7fad80144116bbcedd9567b2e | |||
</PropertyGroup> | |||
</Project> |
@@ -26,7 +26,11 @@ | |||
"environmentVariables": { | |||
"ASPNETCORE_ENVIRONMENT": "Development" | |||
}, | |||
<<<<<<< HEAD | |||
"applicationUrl": "http://localhost:5001", | |||
======= | |||
"applicationUrl": "http://172.16.12.102:5002", | |||
>>>>>>> 6f4b2f1df49c81e7fad80144116bbcedd9567b2e | |||
"dotnetRunMessages": true | |||
}, | |||
"Docker": { | |||
@@ -10,9 +10,15 @@ | |||
"AllowedHosts": "*", | |||
"ConnectionConfigs": [ | |||
{ | |||
<<<<<<< HEAD | |||
"ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_wfz;Uid=root;Pwd=BapAdmin123456.;", | |||
======= | |||
"ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=BapAdmin123456.;", | |||
//"ConnectionString": "server=192.168.1.231;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=pztj8127;", | |||
>>>>>>> 6f4b2f1df49c81e7fad80144116bbcedd9567b2e | |||
"DbType": "MySql", | |||
"IsAutoCloseConnection": true | |||
} | |||
] | |||
], | |||
"AGVUrl": "http://172.16.12.206:10080" | |||
} |
@@ -13,12 +13,12 @@ export default defineConfig({ | |||
* @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。 | |||
* @doc https://umijs.org/docs/api/config#hash | |||
*/ | |||
history:{type:'hash'}, | |||
history: { type: 'hash' }, | |||
// 更改为history模式 | |||
// history:{type:'browser'} | |||
hash: true, | |||
esbuildMinifyIIFE: true, | |||
/** | |||
* @name 兼容性设置 | |||
* @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖 | |||
@@ -105,7 +105,7 @@ export default defineConfig({ | |||
* @description 将项目中的 moment 替换为 dayjs | |||
* @doc https://umijs.org/docs/max/moment2dayjs | |||
*/ | |||
moment2dayjs: { | |||
moment2dayjs: { | |||
preset: 'antd', | |||
plugins: ['duration'], | |||
}, | |||
@@ -124,7 +124,7 @@ export default defineConfig({ | |||
//================ pro 插件配置 ================= | |||
presets: ['umi-presets-pro'], | |||
keepalive: [/./], | |||
tabsLayout: {hasFixedHeader:false}, | |||
tabsLayout: { hasFixedHeader: false }, | |||
mfsu: { | |||
strategy: 'normal', | |||
}, | |||
@@ -1,5 +1,6 @@ | |||
export default [ | |||
{ path: '/user', layout: false, routes: [{ path: '/user/login', component: './user/login' }] }, | |||
<<<<<<< HEAD | |||
// { path: '/', icon: 'SmileOutlined', component: './welcome', name: '数据看板' }, | |||
// { | |||
// icon: 'SettingOutlined', | |||
@@ -86,6 +87,91 @@ | |||
// { path: '/report/material', name: '原料统计', component: './report/material' }, | |||
// ] | |||
// }, | |||
======= | |||
{ path: '/', icon: 'SmileOutlined', component: './welcome', name: '数据看板' }, | |||
{ | |||
icon: 'SettingOutlined', | |||
path: '/system', | |||
name: '系统管理', | |||
routes: [ | |||
// { path: '/system/account', name: '账号管理', component: './system/account' }, | |||
{ path: '/system/user', name: '人员管理', component: './system/user' }, | |||
{ path: '/system/role', name: '角色管理', component: './system/role' }, | |||
{ path: '/system/module', name: '模块管理', component: './system/module' }, | |||
// { path: '/system/authTemplate', name: '权限管理', component: './system/authTemplate' }, | |||
], | |||
}, | |||
{ | |||
path: '/wmx', icon: 'SettingOutlined', name: '设备模型管理', | |||
routes: [{ | |||
name: '设备建模', | |||
path: '/wmx/deviceProduct', | |||
component: './deviceProductInfo/index', | |||
}, | |||
] | |||
}, | |||
{ | |||
path: '/kep', icon: 'SettingOutlined', name: '大屏数据', | |||
routes: [{ | |||
name: '数据看板', | |||
path: '/kep', | |||
component: './kep', | |||
}, | |||
] | |||
}, | |||
{ | |||
path: '/base', icon: 'SettingOutlined', name: '基础数据管理', | |||
routes: [{ path: '/base/deviceinfo', name: '设备管理', component: './deviceInfo/index' }, | |||
{ path: '/base/stock', name: '料仓管理', component: './stock/index' }, | |||
{ 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' }, | |||
{ path: '/base/manufacturing', name: '产线设备管理', component: './manufacturing/index' }, | |||
] | |||
}, | |||
{ | |||
path: '/line', icon: 'SettingOutlined', name: '产线管理', | |||
routes: [ | |||
{ path: '/line/manufacturing', name: '产线设备管理', component: './manufacturing/index' }, | |||
] | |||
}, | |||
{ | |||
path: '/recipeCraft', icon: 'SettingOutlined', name: '配方工艺管理', | |||
routes: [ | |||
{ path: '/recipeCraft/recipe', name: '配方管理', component: './recipe/index' }, | |||
{ path: '/recipeCraft/pot', name: '设备工艺', component: './craftInfo/pot' } | |||
] | |||
}, | |||
{ path: '/work', icon: 'SettingOutlined', name: '工单管理', component: './workInfo/index' }, | |||
{ | |||
path: '/data', icon: 'SettingOutlined', name: '数据服务', | |||
routes: [ | |||
{ path: '/data/userlog', name: '操作日志', component: './logs/userlog' }, | |||
{ path: '/data/runlog', name: '运行日志', component: './logs/runlog' }, | |||
{ path: '/data/alarmlog', name: '报警日志', component: './logs/alarmlog' }, | |||
{ path: '/data/programlog', name: '系统日志', component: './logs/programlog' } | |||
] | |||
}, | |||
{ | |||
path: '/agv', icon: 'SettingOutlined', name: 'agv管理', | |||
routes: [ | |||
{ path: '/agv/agvbasic', name: 'agv基础数据', component: './agvbasic/index' }, | |||
{ path: '/agv/agvline', name: 'agv线路管理', component: './agvline/index' } | |||
] | |||
}, | |||
{ path: '/order', icon: 'SettingOutlined', name: '订单管理', component: './order/index' }, | |||
{ | |||
path: '/report', icon: 'SettingOutlined', name: '统计报表', | |||
routes: [ | |||
{ path: '/report/product', name: '成品统计', component: './report/product' }, | |||
{ path: '/report/material', name: '原料统计', component: './report/material' }, | |||
] | |||
}, | |||
>>>>>>> 6f4b2f1df49c81e7fad80144116bbcedd9567b2e | |||
{ path: '*', layout: false, component: './404' }, | |||
]; |
@@ -6,6 +6,10 @@ | |||
</head> | |||
<body> | |||
<div id="root"></div> | |||
<<<<<<< HEAD | |||
<script src="/umi.21356be0.js"></script> | |||
======= | |||
<script src="/umi.eeba41ac.js"></script> | |||
>>>>>>> 6f4b2f1df49c81e7fad80144116bbcedd9567b2e | |||
</body></html> |
@@ -1 +1 @@ | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[571],{9826:function(D,n,u){u.r(n);var E=u(12578),_=u(45821),a=u(71577),P=u(67294),t=u(85893),s=function(){return(0,t.jsx)(_.ZP,{status:"404",title:"404",subTitle:"\u6B64\u9875\u9762\u4E0D\u5B58\u5728\uFF01\u8BF7\u8FD4\u56DE\u9996\u9875\uFF01",extra:(0,t.jsx)(a.ZP,{type:"primary",onClick:function(){return E.history.push("/")},children:"\u56DE\u5230\u9996\u9875"})})};n.default=s}}]); | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[571],{9826:function(D,n,u){u.r(n);var E=u(12578),_=u(45821),a=u(15867),P=u(67294),t=u(85893),s=function(){return(0,t.jsx)(_.ZP,{status:"404",title:"404",subTitle:"\u6B64\u9875\u9762\u4E0D\u5B58\u5728\uFF01\u8BF7\u8FD4\u56DE\u9996\u9875\uFF01",extra:(0,t.jsx)(a.ZP,{type:"primary",onClick:function(){return E.history.push("/")},children:"\u56DE\u5230\u9996\u9875"})})};n.default=s}}]); |
@@ -0,0 +1 @@ | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[614],{19127:function(S,D,e){var M=e(97857),s=e.n(M),m=e(12578);D.Z={Add:function(o){return(0,m.request)("/api/agvpoint/add",{method:"POST",data:s()({},o)})},Del:function(o){return(0,m.request)("/api/agvpoint/del",{method:"POST",data:s()({},o)})},Update:function(o){return(0,m.request)("/api/agvpoint/update",{method:"POST",data:s()({},o)})},List:function(){return(0,m.request)("/api/agvpoint/list",{method:"POST"})},PagedList:function(o){return(0,m.request)("/api/agvpoint/pagedlist",{method:"POST",data:s()({},o)})},selectlist:function(){return(0,m.request)("/api/agvpoint/selectlist",{method:"GET"})}}},66871:function(S,D,e){e.r(D);var M=e(15009),s=e.n(M),m=e(99289),i=e.n(m),o=e(5574),T=e.n(o),A=e(74254),p=e(40741),P=e(15867),B=e(86738),E=e(45360),I=e(5914),R=e(66309),g=e(12096),v=e(67294),O=e(19127),t=e(85893),F=function(){var L=(0,v.useState)(!1),C=T()(L,2),y=C[0],f=C[1],U=p.Z.useForm(),K=T()(U,1),b=K[0],W=(0,v.useState)(),j=T()(W,2),x=j[0],Z=j[1],h=(0,v.useRef)(),J=[{title:"id",dataIndex:"id",tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",hideInSearch:!0,hideInTable:!0},{title:"\u70B9\u4F4D\u540D\u79F0",dataIndex:"name",ellipsis:!0,align:"center"},{title:"\u70B9\u4F4D\u7F16\u7801",dataIndex:"code",hideInSearch:!0,ellipsis:!0,align:"center"},{title:"\u64CD\u4F5C",valueType:"option",key:"option",align:"center",render:function(l,u){return[(0,t.jsx)(P.ZP,{type:"primary",ghost:!0,onClick:i()(s()().mark(function a(){var r;return s()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:f(!0),Z("\u7F16\u8F91\u70B9\u4F4D"),r=JSON.parse(JSON.stringify(u)),b.setFieldsValue(r);case 4:case"end":return n.stop()}},a)})),children:"\u7F16\u8F91"},"edit"),(0,t.jsx)(B.Z,{title:"\u786E\u5B9A\u8981\u5220\u9664\u6B64\u6761\u6570\u636E\u5417\uFF1F",onConfirm:function(){var r={id:u.id,name:"",code:""};O.Z.Del(r).then(function(_){if(_.statusCode===200){var n;E.ZP.success(_.statusCode===200?"\u5220\u9664\u6210\u529F":_.message),(n=h.current)===null||n===void 0||n.reload()}})},onCancel:function(){E.ZP.info("\u5DF2\u53D6\u6D88\u5220\u9664")},okText:"\u786E\u8BA4",cancelText:"\u5173\u95ED",children:(0,t.jsx)(P.ZP,{type:"primary",danger:!0,ghost:!0,children:"\u5220\u9664"})},"del")]}}];(0,v.useEffect)(function(){},[]);var $=function(){var c=i()(s()().mark(function l(u){var a,r,_,n;return s()().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!u.id){d.next=7;break}return d.next=3,O.Z.Update(u);case 3:a=d.sent,a.statusCode===200?(E.ZP.success("\u4FEE\u6539\u6210\u529F"),(r=h.current)===null||r===void 0||r.reload(),f(!1)):E.ZP.error(JSON.stringify(a.errors)||"\u4FEE\u6539\u5931\u8D25"),d.next=12;break;case 7:return d.next=9,O.Z.Add(u);case 9:_=d.sent,console.log("response",_),_.statusCode===200?(E.ZP.success("\u6DFB\u52A0\u6210\u529F"),(n=h.current)===null||n===void 0||n.reload(),f(!1)):E.ZP.error(JSON.stringify(_.errors)||"\u6DFB\u52A0\u5931\u8D25");case 12:case"end":return d.stop()}},l)}));return function(u){return c.apply(this,arguments)}}();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z,{actionRef:h,cardBordered:!0,request:i()(s()().mark(function c(){var l,u,a,r=arguments;return s()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return l=r.length>0&&r[0]!==void 0?r[0]:{},u={pageIndex:l.current||1,pageSize:l.pageSize||10,name:l.name||""},n.next=4,O.Z.PagedList(u);case 4:if(a=n.sent,a.statusCode!==200){n.next=9;break}return n.abrupt("return",{data:a.data.items,success:!0,total:a.data.total});case 9:return n.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return n.stop()}},c)})),rowKey:"id",pagination:{pageSize:10},dateFormatter:"string",headerTitle:"\u70B9\u4F4D\u5217\u8868",columns:J,toolBarRender:function(){return[(0,t.jsx)(P.ZP,{type:"primary",onClick:function(){b.resetFields(),f(!0),Z("\u65B0\u589E\u70B9\u4F4D")},children:"\u65B0\u589E\u70B9\u4F4D"},"button")]}},"myTable"),(0,t.jsx)(I.Z,{maskClosable:!1,width:800,title:(0,t.jsx)(R.Z,{color:"#cd201f",children:x}),open:y,onCancel:function(){f(!1)},footer:[(0,t.jsx)(P.ZP,{onClick:function(){f(!1)},children:"\u8FD4\u56DE"},"back"),(0,t.jsx)(P.ZP,{form:"agvbasicForm",type:"primary",htmlType:"submit",children:"\u63D0\u4EA4"},"submit")],children:(0,t.jsxs)(p.Z,{form:b,name:"basic",id:"agvbasicForm",labelAlign:"right",wrapperCol:{span:12},onFinish:$,autoComplete:"off",children:[(0,t.jsx)(p.Z.Item,{label:"id",name:"id",hidden:!0,children:(0,t.jsx)(g.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"\u70B9\u4F4D\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879!"}],children:(0,t.jsx)(g.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"\u70B9\u4F4D\u7F16\u7801",name:"code",rules:[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879!"}],children:(0,t.jsx)(g.Z,{})})]})},"01")]})};D.default=F}}]); |
@@ -0,0 +1 @@ | |||
#data-view{width:100%;height:100%;background-color:#030409;color:#fff}#data-view #dv-full-screen-container{background-image:url(./static/bg.9a80c9d4.png);background-size:100% 100%;box-shadow:0 0 3px #00f;display:flex;flex-direction:column}#data-view #dv-full-screen-container #chart_title{padding:10;color:"#04b2f7";font-size:"18px";font-weight:"bold"}#data-view .head_title{text-align:center;position:relative}#data-view .head_title_txt{position:absolute;top:15px;font-size:24px;right:46%}#data-view .g2-tooltip-title{color:#fff}#data-view .g2-html-annotation{font-size:14px} |
@@ -0,0 +1 @@ | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[522],{90503:function(A,i,n){n.d(i,{DH:function(){return p},Xk:function(){return c},n5:function(){return D},xu:function(){return E}});var P=n(97857),d=n.n(P),t=n(12578),c={Add:function(e){return(0,t.request)("/api/alarmlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/alarmlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/alarmlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/alarmlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/alarmlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/alarmlog/pagedlist",{method:"POST",data:d()({},e)})}},p={Add:function(e){return(0,t.request)("/api/programlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/programlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/programlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/programlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/programlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/programlog/pagedlist",{method:"POST",data:d()({},e)})}},D={Add:function(e){return(0,t.request)("/api/userlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/userlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/userlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/userlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/userlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/userlog/pagedlist",{method:"POST",data:d()({},e)})}},E={Add:function(e){return(0,t.request)("/api/runlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/runlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/runlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/runlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/runlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/runlog/pagedlist",{method:"POST",data:d()({},e)})}}},48350:function(A,i,n){n.r(i);var P=n(15009),d=n.n(P),t=n(99289),c=n.n(t),p=n(13769),D=n.n(p),E=n(5574),r=n.n(E),e=n(85322),b=n(74254),j=n(27484),g=n.n(j),I=n(41594),U=n(15867),m=n(45360),T=n(67294),O=n(90503),u=n(85893),C=["type","defaultRender"],B=I.default.RangePicker;i.default=function(){var W=(0,T.useState)("table"),S=r()(W,2),h=S[0],M=S[1],v=(0,T.useRef)(),L=(0,T.useRef)(),R=function(){var a,_;(a=v.current)===null||a===void 0||a.resetFields(),(_=L.current)===null||_===void 0||_.reload()},K=[{title:"\u4E3B\u952E",dataIndex:"id",hideInForm:!0,search:!1},{title:"\u8BBE\u5907\u540D\u79F0",dataIndex:"deviceName"},{title:"\u65F6\u95F4",dataIndex:"createDate",renderFormItem:function(a,_,l){var f=_.type,Z=_.defaultRender,o=D()(_,C);return(0,u.jsx)(B,{showTime:!0})},render:function(a,_){return(0,u.jsx)(u.Fragment,{children:_.createDate?g()(_.createDate).format("YYYY-MM-DD HH:mm:ss"):""})}},{title:"\u62A5\u8B66\u7B49\u7EA7",dataIndex:"grade"},{title:"\u62A5\u8B66\u7C7B\u578B",dataIndex:"logType"},{title:"\u62A5\u8B66\u503C",dataIndex:"value",search:!1},{title:"\u62A5\u8B66\u4FE1\u606F",dataIndex:"msgInfo",search:!1}];return(0,u.jsx)(u.Fragment,{children:(0,u.jsxs)(e.Z,{children:[h==="form"?(0,u.jsx)(U.ZP,{type:"link",onClick:function(){var a;(a=v.current)===null||a===void 0||a.resetFields(),M("table")},children:"\u2B05\u8FD4\u56DE"}):"",(0,u.jsx)(b.Z,{columns:K,type:h,formRef:v,actionRef:L,onSubmit:function(a){console.log(a),h==="form"&&(a.id?O.Xk.Update(a).then(function(_){_.statusCode===200?(m.ZP.info("\u66F4\u65B0\u6210\u529F!"),M("table"),R()):m.ZP.error(_.errors)}):O.Xk.Add(a).then(function(_){_.statusCode===200?(m.ZP.info("\u65B0\u589E\u6210\u529F!"),M("table"),R()):m.ZP.error(_.errors)}))},request:c()(d()().mark(function s(){var a,_,l,f=arguments;return d()().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return a=f.length>0&&f[0]!==void 0?f[0]:{},_={pageIndex:a.current||1,pageSize:a.pageSize||10,msgInfo:a.msgInfo,value:a.value,grade:a.grade,deviceName:a.deviceName,startTime:a.createDate?g()(a.createDate[0]):null,endTime:a.createDate?g()(a.createDate[1]):null},o.next=4,O.Xk.PagedList(_);case 4:if(l=o.sent,l.statusCode!==200){o.next=9;break}return o.abrupt("return",{data:l.data.items,success:!0,total:l.data.total});case 9:return o.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return o.stop()}},s)})),pagination:{pageSize:5},rowKey:"id",dateFormatter:"string",headerTitle:"\u5217\u8868",toolBarRender:!1})]})})}}}]); |
@@ -0,0 +1 @@ | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[309],{90503:function(A,i,r){r.d(i,{DH:function(){return D},Xk:function(){return p},n5:function(){return c},xu:function(){return E}});var P=r(97857),d=r.n(P),t=r(12578),p={Add:function(e){return(0,t.request)("/api/alarmlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/alarmlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/alarmlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/alarmlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/alarmlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/alarmlog/pagedlist",{method:"POST",data:d()({},e)})}},D={Add:function(e){return(0,t.request)("/api/programlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/programlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/programlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/programlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/programlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/programlog/pagedlist",{method:"POST",data:d()({},e)})}},c={Add:function(e){return(0,t.request)("/api/userlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/userlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/userlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/userlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/userlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/userlog/pagedlist",{method:"POST",data:d()({},e)})}},E={Add:function(e){return(0,t.request)("/api/runlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/runlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/runlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/runlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/runlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/runlog/pagedlist",{method:"POST",data:d()({},e)})}}},95690:function(A,i,r){r.r(i);var P=r(15009),d=r.n(P),t=r(99289),p=r.n(t),D=r(13769),c=r.n(D),E=r(5574),a=r.n(E),e=r(85322),b=r(74254),j=r(27484),g=r.n(j),I=r(41594),U=r(15867),m=r(45360),T=r(67294),O=r(90503),u=r(85893),C=["type","defaultRender"],B=I.default.RangePicker;i.default=function(){var W=(0,T.useState)("table"),S=a()(W,2),M=S[0],h=S[1],v=(0,T.useRef)(),L=(0,T.useRef)(),R=function(){var n,_;(n=v.current)===null||n===void 0||n.resetFields(),(_=L.current)===null||_===void 0||_.reload()},K=[{title:"\u4E3B\u952E",dataIndex:"id",search:!1},{title:"\u65E5\u5FD7\u7C7B\u522B",dataIndex:"logType",width:160},{title:"\u65E5\u5FD7\u6D88\u606F",dataIndex:"msgInfo"},{title:"\u65F6\u95F4",dataIndex:"createDate",renderFormItem:function(n,_,l){var f=_.type,y=_.defaultRender,o=c()(_,C);return(0,u.jsx)(B,{showTime:!0})},render:function(n,_){return(0,u.jsx)(u.Fragment,{children:_.createDate?g()(_.createDate).format("YYYY-MM-DD HH:mm:ss"):""})},width:160}];return(0,u.jsx)(u.Fragment,{children:(0,u.jsxs)(e.Z,{children:[M==="form"?(0,u.jsx)(U.ZP,{type:"link",onClick:function(){var n;(n=v.current)===null||n===void 0||n.resetFields(),h("table")},children:"\u2B05\u8FD4\u56DE"}):"",(0,u.jsx)(b.Z,{columns:K,type:M,formRef:v,actionRef:L,onSubmit:function(n){console.log(n),M==="form"&&(n.id?O.DH.Update(n).then(function(_){_.statusCode===200?(m.ZP.info("\u66F4\u65B0\u6210\u529F!"),h("table"),R()):m.ZP.error(_.errors)}):O.DH.Add(n).then(function(_){_.statusCode===200?(m.ZP.info("\u65B0\u589E\u6210\u529F!"),h("table"),R()):m.ZP.error(_.errors)}))},request:p()(d()().mark(function s(){var n,_,l,f=arguments;return d()().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return n=f.length>0&&f[0]!==void 0?f[0]:{},_={pageIndex:n.current||1,pageSize:n.pageSize||10,logType:n.logType,msgInfo:n.msgInfo,startTime:n.createDate?g()(n.createDate[0]):null,endTime:n.createDate?g()(n.createDate[1]):null},o.next=4,O.DH.PagedList(_);case 4:if(l=o.sent,l.statusCode!==200){o.next=9;break}return o.abrupt("return",{data:l.data.items,success:!0,total:l.data.total});case 9:return o.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return o.stop()}},s)})),pagination:{pageSize:5},rowKey:"id",dateFormatter:"string",headerTitle:"\u5217\u8868",toolBarRender:!1})]})})}}}]); |
@@ -0,0 +1 @@ | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[675],{90503:function(A,i,r){r.d(i,{DH:function(){return D},Xk:function(){return p},n5:function(){return c},xu:function(){return E}});var P=r(97857),d=r.n(P),t=r(12578),p={Add:function(e){return(0,t.request)("/api/alarmlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/alarmlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/alarmlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/alarmlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/alarmlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/alarmlog/pagedlist",{method:"POST",data:d()({},e)})}},D={Add:function(e){return(0,t.request)("/api/programlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/programlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/programlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/programlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/programlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/programlog/pagedlist",{method:"POST",data:d()({},e)})}},c={Add:function(e){return(0,t.request)("/api/userlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/userlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/userlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/userlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/userlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/userlog/pagedlist",{method:"POST",data:d()({},e)})}},E={Add:function(e){return(0,t.request)("/api/runlog/add",{method:"POST",data:d()({},e)})},Del:function(e){return(0,t.request)("/api/runlog/del",{method:"POST",data:d()({},e)})},Update:function(e){return(0,t.request)("/api/runlog/update",{method:"POST",data:d()({},e)})},Detail:function(e){return(0,t.request)("/api/runlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/runlog/list",{method:"POST",data:d()({},e)})},PagedList:function(e){return(0,t.request)("/api/runlog/pagedlist",{method:"POST",data:d()({},e)})}}},48098:function(A,i,r){r.r(i);var P=r(15009),d=r.n(P),t=r(99289),p=r.n(t),D=r(13769),c=r.n(D),E=r(5574),a=r.n(E),e=r(85322),b=r(74254),j=r(27484),g=r.n(j),I=r(41594),U=r(15867),m=r(45360),T=r(67294),O=r(90503),u=r(85893),C=["type","defaultRender"],B=I.default.RangePicker;i.default=function(){var W=(0,T.useState)("table"),S=a()(W,2),h=S[0],M=S[1],v=(0,T.useRef)(),L=(0,T.useRef)(),R=function(){var n,o;(n=v.current)===null||n===void 0||n.resetFields(),(o=L.current)===null||o===void 0||o.reload()},K=[{title:"\u4E3B\u952E",dataIndex:"id",search:!1},{title:"\u65E5\u5FD7\u7C7B\u522B",dataIndex:"logType",width:160},{title:"\u65E5\u5FD7\u6D88\u606F",dataIndex:"msgInfo"},{title:"\u65F6\u95F4",dataIndex:"createDate",renderFormItem:function(n,o,l){var f=o.type,y=o.defaultRender,_=c()(o,C);return(0,u.jsx)(B,{showTime:!0})},render:function(n,o){return(0,u.jsx)(u.Fragment,{children:o.createDate?g()(o.createDate).format("YYYY-MM-DD HH:mm:ss"):""})}}];return(0,u.jsx)(u.Fragment,{children:(0,u.jsxs)(e.Z,{children:[h==="form"?(0,u.jsx)(U.ZP,{type:"link",onClick:function(){var n;(n=v.current)===null||n===void 0||n.resetFields(),M("table")},children:"\u2B05\u8FD4\u56DE"}):"",(0,u.jsx)(b.Z,{columns:K,type:h,formRef:v,actionRef:L,onSubmit:function(n){console.log(n),h==="form"&&(n.id?O.xu.Update(n).then(function(o){o.statusCode===200?(m.ZP.info("\u66F4\u65B0\u6210\u529F!"),M("table"),R()):m.ZP.error(o.errors)}):O.xu.Add(n).then(function(o){o.statusCode===200?(m.ZP.info("\u65B0\u589E\u6210\u529F!"),M("table"),R()):m.ZP.error(o.errors)}))},request:p()(d()().mark(function s(){var n,o,l,f=arguments;return d()().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return n=f.length>0&&f[0]!==void 0?f[0]:{},o={pageIndex:n.current||1,pageSize:n.pageSize||10,logType:n.logType,msgInfo:n.msgInfo,startTime:n.createDate?g()(n.createDate[0]).add(8,"h").toDate():null,endTime:n.createDate?g()(n.createDate[1]).add(8,"h").toDate():null},_.next=4,O.xu.PagedList(o);case 4:if(l=_.sent,l.statusCode!==200){_.next=9;break}return _.abrupt("return",{data:l.data.items,success:!0,total:l.data.total});case 9:return _.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return _.stop()}},s)})),pagination:{pageSize:5},rowKey:"id",dateFormatter:"string",headerTitle:"\u5217\u8868",toolBarRender:!1})]})})}}}]); |
@@ -0,0 +1 @@ | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[464],{90503:function(A,i,n){n.d(i,{DH:function(){return p},Xk:function(){return P},n5:function(){return c},xu:function(){return g}});var f=n(97857),r=n.n(f),t=n(12578),P={Add:function(e){return(0,t.request)("/api/alarmlog/add",{method:"POST",data:r()({},e)})},Del:function(e){return(0,t.request)("/api/alarmlog/del",{method:"POST",data:r()({},e)})},Update:function(e){return(0,t.request)("/api/alarmlog/update",{method:"POST",data:r()({},e)})},Detail:function(e){return(0,t.request)("/api/alarmlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/alarmlog/list",{method:"POST",data:r()({},e)})},PagedList:function(e){return(0,t.request)("/api/alarmlog/pagedlist",{method:"POST",data:r()({},e)})}},p={Add:function(e){return(0,t.request)("/api/programlog/add",{method:"POST",data:r()({},e)})},Del:function(e){return(0,t.request)("/api/programlog/del",{method:"POST",data:r()({},e)})},Update:function(e){return(0,t.request)("/api/programlog/update",{method:"POST",data:r()({},e)})},Detail:function(e){return(0,t.request)("/api/programlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/programlog/list",{method:"POST",data:r()({},e)})},PagedList:function(e){return(0,t.request)("/api/programlog/pagedlist",{method:"POST",data:r()({},e)})}},c={Add:function(e){return(0,t.request)("/api/userlog/add",{method:"POST",data:r()({},e)})},Del:function(e){return(0,t.request)("/api/userlog/del",{method:"POST",data:r()({},e)})},Update:function(e){return(0,t.request)("/api/userlog/update",{method:"POST",data:r()({},e)})},Detail:function(e){return(0,t.request)("/api/userlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/userlog/list",{method:"POST",data:r()({},e)})},PagedList:function(e){return(0,t.request)("/api/userlog/pagedlist",{method:"POST",data:r()({},e)})}},g={Add:function(e){return(0,t.request)("/api/runlog/add",{method:"POST",data:r()({},e)})},Del:function(e){return(0,t.request)("/api/runlog/del",{method:"POST",data:r()({},e)})},Update:function(e){return(0,t.request)("/api/runlog/update",{method:"POST",data:r()({},e)})},Detail:function(e){return(0,t.request)("/api/runlog/detail?id=".concat(e),{method:"GET"})},List:function(e){return(0,t.request)("/api/runlog/list",{method:"POST",data:r()({},e)})},PagedList:function(e){return(0,t.request)("/api/runlog/pagedlist",{method:"POST",data:r()({},e)})}}},46730:function(A,i,n){n.r(i);var f=n(15009),r=n.n(f),t=n(99289),P=n.n(t),p=n(5574),c=n.n(p),g=n(85322),a=n(74254),e=n(27484),R=n.n(e),b=n(15867),l=n(45360),D=n(67294),E=n(90503),_=n(85893);i.default=function(){var j=(0,D.useState)("table"),v=c()(j,2),T=v[0],O=v[1],h=(0,D.useRef)(),S=(0,D.useRef)(),L=function(){var d,o;(d=h.current)===null||d===void 0||d.resetFields(),(o=S.current)===null||o===void 0||o.reload()},I=[{title:"\u4E3B\u952E",dataIndex:"id",hideInForm:!0,search:!1},{title:"\u6743\u9650",dataIndex:"permission",ellipsis:!0,search:!1},{title:"\u7528\u6237\u540D",dataIndex:"userName"},{title:"\u65E5\u5FD7\u6D88\u606F",dataIndex:"msgInfo",width:120},{title:"\u65F6\u95F4",dataIndex:"createDate",render:function(d,o){return(0,_.jsx)(_.Fragment,{children:o.createDate?R()(o.createDate).format("YYYY-MM-DD HH:mm:ss"):""})}}];return(0,_.jsx)(_.Fragment,{children:(0,_.jsxs)(g.Z,{children:[T==="form"?(0,_.jsx)(b.ZP,{type:"link",onClick:function(){var d;(d=h.current)===null||d===void 0||d.resetFields(),O("table")},children:"\u2B05\u8FD4\u56DE"}):"",(0,_.jsx)(a.Z,{columns:I,type:T,formRef:h,actionRef:S,onSubmit:function(d){console.log(d),T==="form"&&(d.id?E.n5.Update(d).then(function(o){o.statusCode===200?(l.ZP.info("\u66F4\u65B0\u6210\u529F!"),O("table"),L()):l.ZP.error(o.errors)}):E.n5.Add(d).then(function(o){o.statusCode===200?(l.ZP.info("\u65B0\u589E\u6210\u529F!"),O("table"),L()):l.ZP.error(o.errors)}))},request:P()(r()().mark(function s(){var d,o,m,M=arguments;return r()().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return d=M.length>0&&M[0]!==void 0?M[0]:{},o={pageIndex:d.current||1,pageSize:d.pageSize||10,userName:d.userName,msgInfo:d.msgInfo},u.next=4,E.n5.PagedList(o);case 4:if(m=u.sent,m.statusCode!==200){u.next=9;break}return u.abrupt("return",{data:m.data.items,success:!0,total:m.data.total});case 9:return u.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return u.stop()}},s)})),pagination:{pageSize:5},rowKey:"id",dateFormatter:"string",headerTitle:"\u5217\u8868",toolBarRender:!1})]})})}}}]); |
@@ -0,0 +1 @@ | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[496],{76704:function(P,r,e){var u=e(97857),a=e.n(u),d=e(12578);r.Z={PagedList:function(n){return(0,d.request)("/api/report/getproductreport",{method:"POST",data:a()({},n)})},PagedMaterialList:function(n){return(0,d.request)("/api/report/getmaterialsreport",{method:"POST",data:a()({},n)})}}},7780:function(P,r,e){e.r(r);var u=e(15009),a=e.n(u),d=e(99289),s=e.n(d),n=e(67294),c=e(15867),p=e(74254),T=e(76704),l=e(85893);r.default=function(){var D=(0,n.useRef)(),M=[{title:"materialId",dataIndex:"materialId",hideInSearch:!0,hideInTable:!0,align:"center"},{title:"\u6210\u54C1\u540D\u79F0",dataIndex:"materialName",align:"center"},{title:"\u751F\u4EA7\u6570\u91CF",dataIndex:"count",hideInSearch:!0,align:"center"},{title:"\u751F\u4EA7\u65F6\u95F4",dataIndex:"dateTime",valueType:"dateRange",hideInTable:!0,align:"center"}];return(0,l.jsx)(p.Z,{columns:M,actionRef:D,cardBordered:!0,request:s()(a()().mark(function m(){var t,E,o,i=arguments;return a()().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return t=i.length>0&&i[0]!==void 0?i[0]:{},E={endTime:t.dateTime?t.dateTime[1]:void 0,startTime:t.dateTime?t.dateTime[0]:void 0,productName:t.productName||""},_.next=4,T.Z.PagedMaterialList(E);case 4:if(o=_.sent,o.statusCode!==200){_.next=9;break}return _.abrupt("return",{data:o.data,success:!0,total:1});case 9:return _.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return _.stop()}},m)})),rowKey:"productId",pagination:{pageSize:10},dateFormatter:"string",headerTitle:"\u5DE5\u5355\u5217\u8868",toolBarRender:function(){return[(0,l.jsx)(c.ZP,{type:"primary",onClick:function(){},children:"\u65B0\u5EFA\u5DE5\u5355"},"button")]}},"myTable")}}}]); |
@@ -0,0 +1 @@ | |||
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[926],{76704:function(P,r,e){var u=e(97857),a=e.n(u),d=e(12578);r.Z={PagedList:function(n){return(0,d.request)("/api/report/getproductreport",{method:"POST",data:a()({},n)})},PagedMaterialList:function(n){return(0,d.request)("/api/report/getmaterialsreport",{method:"POST",data:a()({},n)})}}},47667:function(P,r,e){e.r(r);var u=e(15009),a=e.n(u),d=e(99289),s=e.n(d),n=e(67294),c=e(15867),p=e(74254),T=e(76704),l=e(85893);r.default=function(){var D=(0,n.useRef)(),M=[{title:"productId",dataIndex:"productId",hideInSearch:!0,hideInTable:!0,align:"center"},{title:"\u6210\u54C1\u540D\u79F0",dataIndex:"productName",align:"center"},{title:"\u751F\u4EA7\u6570\u91CF",dataIndex:"count",hideInSearch:!0,align:"center"},{title:"\u751F\u4EA7\u65F6\u95F4",dataIndex:"dateTime",valueType:"dateRange",hideInTable:!0,align:"center"}];return(0,l.jsx)(p.Z,{columns:M,actionRef:D,cardBordered:!0,request:s()(a()().mark(function m(){var t,E,o,i=arguments;return a()().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return t=i.length>0&&i[0]!==void 0?i[0]:{},E={endTime:t.dateTime?t.dateTime[1]:void 0,startTime:t.dateTime?t.dateTime[0]:void 0,productName:t.productName||""},_.next=4,T.Z.PagedList(E);case 4:if(o=_.sent,o.statusCode!==200){_.next=9;break}return _.abrupt("return",{data:o.data,success:!0,total:1});case 9:return _.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return _.stop()}},m)})),rowKey:"productId",pagination:{pageSize:10},dateFormatter:"string",headerTitle:"\u5DE5\u5355\u5217\u8868",toolBarRender:function(){return[(0,l.jsx)(c.ZP,{type:"primary",onClick:function(){},children:"\u65B0\u5EFA\u5DE5\u5355"},"button")]}},"myTable")}}}]); |