去除引用common.props
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using System.Dynamic;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.Message;
|
||||
using JNPF.Common.Enums;
|
||||
@@ -15,6 +9,7 @@ using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Message.Entitys.Entity;
|
||||
using JNPF.Message.Service;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
@@ -26,15 +21,14 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.BasicData.Entities;
|
||||
using MessageTemplateEntity = JNPF.Message.Entitys.Entity.MessageTemplateEntity;
|
||||
using JNPF.Message.Service;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -54,7 +48,7 @@ namespace Tnb.ProductionMgr
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly TimeTaskService _timeTaskService;
|
||||
private SendMessageService _sendMessageService;
|
||||
|
||||
|
||||
|
||||
private static Dictionary<string, object> _dicWorkStationAndShopRelacion = new Dictionary<string, object>();
|
||||
private static Dictionary<string, object> _dicWorkShop = new Dictionary<string, object>();
|
||||
@@ -218,14 +212,14 @@ namespace Tnb.ProductionMgr
|
||||
BasPushRuleD basPushRuleD = await _db.Queryable<BasPushRuleD>().FirstAsync(x => x.push_rule_id == PUSHRULEID && x.ordinal == 1);
|
||||
try
|
||||
{
|
||||
|
||||
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
|
||||
|
||||
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var moTaskList = await _prdMoTaskService.GetListByEqpId(input.eqp_id);
|
||||
if (moTaskList?.Count > 1) throw new AppFriendlyException($"设备{input.eqp_id},目前有两条进行中的生产任务", 500);
|
||||
if (moTaskList?.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
cancelCloseDown.id = SnowflakeIdHelper.NextId();
|
||||
cancelCloseDown.eqp_id = input.eqp_id;
|
||||
cancelCloseDown.create_id = _userManager.UserId;
|
||||
@@ -233,7 +227,7 @@ namespace Tnb.ProductionMgr
|
||||
cancelCloseDown.closedown_start_time = DateTime.Now;
|
||||
|
||||
await _db.Insertable(cancelCloseDown).ExecuteCommandAsync();
|
||||
|
||||
|
||||
var record = cancelCloseDown.Adapt<PrdCancelClosedownRecord>();
|
||||
record.eqp_code = eqp?.code;
|
||||
record.eqp_name = eqp?.name;
|
||||
@@ -281,12 +275,12 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
List<MessageSendModel> list = await _sendMessageService.SendTest(basPushRuleD.send_config_id);
|
||||
List<string> toUsers = JsonConvert.DeserializeObject<List<string>>(eqp.responsibler_id);
|
||||
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
foreach (var param in item.paramJson)
|
||||
{
|
||||
if (param.field=="equip_code")
|
||||
if (param.field == "equip_code")
|
||||
{
|
||||
param.value = eqp.code;
|
||||
}
|
||||
@@ -299,25 +293,25 @@ namespace Tnb.ProductionMgr
|
||||
await _sendMessageService.SendMessage(item, new Dictionary<string, object>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else throw Oops.Oh(ErrorCode.COM1001);
|
||||
});
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
BasPushRuleH basPushRuleH = await _db.Queryable<BasPushRuleH>().SingleAsync(x=>x.id==PUSHRULEID);
|
||||
BasPushRuleH basPushRuleH = await _db.Queryable<BasPushRuleH>().SingleAsync(x => x.id == PUSHRULEID);
|
||||
if (basPushRuleH?.enabled == 1)
|
||||
{
|
||||
string sendConfigId = basPushRuleD?.send_config_id ?? "";
|
||||
List<MessageSendModel> sendModels = await GetSendParamJson(sendConfigId);
|
||||
|
||||
|
||||
if (sendModels != null && sendModels.Count > 0)
|
||||
{
|
||||
DateTime executeTime = DateTime.Now.AddMinutes(basPushRuleD.interval);
|
||||
// string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ? {executeTime.Year}";
|
||||
string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ?";
|
||||
|
||||
|
||||
var comtentModel = new ContentModel();
|
||||
// comtentModel.cron = (2 * 60).ToString();
|
||||
comtentModel.cron = cron;
|
||||
@@ -331,7 +325,7 @@ namespace Tnb.ProductionMgr
|
||||
comtentModel.TenantDbName = _userManager?.TenantDbName;
|
||||
comtentModel.ConnectionConfig = _userManager?.ConnectionConfig;
|
||||
comtentModel.Token = _userManager?.ToKen;
|
||||
|
||||
|
||||
foreach (var item in sendModels)
|
||||
{
|
||||
foreach (var param in item.paramJson)
|
||||
@@ -342,7 +336,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput()
|
||||
{
|
||||
enCode = DateTime.Now.ToString("yyyyMMddHHmmss"),
|
||||
@@ -354,10 +348,10 @@ namespace Tnb.ProductionMgr
|
||||
enabledMark = 1,
|
||||
};
|
||||
|
||||
await _timeTaskService.Create(timeTaskCrInput,false);
|
||||
await _timeTaskService.Create(timeTaskCrInput, false);
|
||||
|
||||
TimeTaskEntity timeTaskEntity = await _db.Queryable<TimeTaskEntity>().Where(x => x.EnCode == timeTaskCrInput.enCode).FirstAsync();
|
||||
|
||||
|
||||
BasPushRuleLog basPushRuleLog = new BasPushRuleLog()
|
||||
{
|
||||
push_rule_id = PUSHRULEID,
|
||||
@@ -370,9 +364,9 @@ namespace Tnb.ProductionMgr
|
||||
await _db.Insertable<BasPushRuleLog>(basPushRuleLog).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -380,7 +374,7 @@ namespace Tnb.ProductionMgr
|
||||
// await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 停机结束
|
||||
@@ -420,7 +414,7 @@ namespace Tnb.ProductionMgr
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task<List<MessageSendModel>> GetSendParamJson(string id)
|
||||
{
|
||||
var list = await _db.Queryable<MessageSendTemplateEntity, MessageTemplateEntity>((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id))
|
||||
|
||||
Reference in New Issue
Block a user