Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -4,6 +4,8 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public string? id { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
|
||||
public string? fhattachment { get; set; }
|
||||
public string? create_time { get; set; }
|
||||
public string? equip_id { get; set; }
|
||||
public string? equip_id_id { get; set; }
|
||||
|
||||
24
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartRecord.cs
Normal file
24
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartRecord.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
public class EquipSparePartRecordInput
|
||||
{
|
||||
public string? equip_id { get; set; }
|
||||
}
|
||||
public class EquipSparePartRecordOut
|
||||
{
|
||||
public string? id { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? type { get; set; }
|
||||
public string? execuser { get; set; }
|
||||
public string? execdatetime { get; set; }
|
||||
public int? num { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
public string? code { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? specification { get; set; }
|
||||
public int? num { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public string? id { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
|
||||
public string? fhattachment { get; set; }
|
||||
public string? create_time { get; set; }
|
||||
public string? equip_id { get; set; }
|
||||
public string? repeat_remark { get; set; }
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
public string repeat_result { get; set; } = string.Empty;
|
||||
|
||||
public string? repeat_remark { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
|
||||
public List<Dictionary<string, string>>? details { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,5 +7,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
public string? repeat_result { get; set; }
|
||||
|
||||
public string? repeat_remark { get; set; }
|
||||
|
||||
public string? attachment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -164,4 +164,10 @@ public partial class EqpMaintainRecordH : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 复核附件
|
||||
/// </summary>
|
||||
public string? fhattachment { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -134,4 +134,7 @@ public partial class EqpMaintainTemEquipH : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
public string? duty_user_id { get; set; }
|
||||
public string? repeat_user_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -129,4 +129,7 @@ public partial class EqpMaintainTemH : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
public string? duty_user_id { get; set; }
|
||||
public string? repeat_user_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -159,4 +159,10 @@ public partial class EqpSpotInsRecordH : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? repeat_result { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 复核附件
|
||||
/// </summary>
|
||||
public string? fhattachment { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -128,5 +128,7 @@ public partial class EqpSpotInsTemEquipH : BaseEntity<string>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
public string? duty_user_id { get; set; }
|
||||
public string? repeat_user_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -124,4 +124,7 @@ public partial class EqpSpotInsTemH : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
public string? duty_user_id { get; set; }
|
||||
public string? repeat_user_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using System.CodeDom.Compiler;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
@@ -68,6 +71,9 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var eqpSpareParts = await db.Queryable<EqpSpareParts>().ToListAsync();
|
||||
var InstockDs= await db.Queryable<EqpSparePartsInstockD>().ToListAsync();
|
||||
var RequisitionDs = await db.Queryable<EqpSparePartsRequisitionD>().ToListAsync();
|
||||
SqlSugarPagedList<EquipSparePartsQueryOutput> result = await db.Queryable<EqpEquipSpareParts>()
|
||||
.LeftJoin<EqpSpareParts>((a, b) => a.spare_parts_id == b.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => c.EnCode == Tnb.BasicData.DictConst.SparePartsType && c.DeleteMark == null)
|
||||
@@ -82,10 +88,68 @@ namespace Tnb.EquipMgr
|
||||
type_name = d.FullName,
|
||||
code = b.code,
|
||||
name = b.name,
|
||||
specification = b.specification
|
||||
specification = b.specification,
|
||||
num = 0
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
foreach (var item in result.list)
|
||||
{
|
||||
try
|
||||
{
|
||||
var part = eqpSpareParts.Where(p => p.code == item.code).First();
|
||||
var Instocknum = InstockDs.Where(p => p.spare_parts_id == part.id).Sum(p => p.quantity);
|
||||
var Requisitionum = RequisitionDs.Where(p => p.spare_parts_id == part.id).Sum(p => p.quantity);
|
||||
item.num = Instocknum > Requisitionum ? Instocknum - Requisitionum : 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
return PageResult<EquipSparePartsQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
//获取备品备件历史
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetEquipSparePartRecord(EquipSparePartRecordInput input)
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
var partsids = await db.Queryable<EqpEquipSpareParts>().Where(p => p.equip_id == input.equip_id).Select(p => p.spare_parts_id).ToListAsync();
|
||||
var Instocks = await db.Queryable<EqpSparePartsInstockD>()
|
||||
.LeftJoin<EqpSparePartsInstockH>((a, b) => a.instock_id == b.id)
|
||||
.LeftJoin<EqpSpareParts>((a, b, c) => a.spare_parts_id == c.id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d) => b.instock_id == d.Id)
|
||||
.Where((a, b, c, d) => partsids.Contains(a.spare_parts_id!))
|
||||
.Select((a, b, c, d) => new EquipSparePartRecordOut()
|
||||
{
|
||||
id = a.id,
|
||||
code = c.code,
|
||||
name = c.name,
|
||||
type = "入库",
|
||||
execuser = d.RealName,
|
||||
execdatetime = b.create_time != null ? b.create_time.ToString() : "",
|
||||
num = a.quantity
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var Requisitions = await db.Queryable<EqpSparePartsRequisitionD>()
|
||||
.LeftJoin<EqpSparePartsRequisitionH>((a, b) => a.spare_parts_requisition_id == b.id)
|
||||
.LeftJoin<EqpSpareParts>((a, b, c) => a.spare_parts_id == c.id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d) => b.recipient_id == d.Id)
|
||||
.Where((a, b, c, d) => partsids.Contains(a.spare_parts_id!))
|
||||
.Select((a, b, c, d) => new EquipSparePartRecordOut()
|
||||
{
|
||||
id = a.id,
|
||||
code = c.code,
|
||||
name = c.name,
|
||||
type = "领用",
|
||||
execuser = d.RealName,
|
||||
execdatetime = b.create_time != null ? b.create_time.ToString()!.Substring(0,19) : "",
|
||||
num = a.quantity
|
||||
})
|
||||
.ToListAsync();
|
||||
Instocks.AddRange(Requisitions);
|
||||
var result = Instocks.OrderByDescending(p => DateTime.Parse(p.execdatetime!));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,8 @@ namespace Tnb.EquipMgr
|
||||
org_id = eqpMaintainTemH.org_id,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
duty_user_id= eqpMaintainTemH.duty_user_id,
|
||||
repeat_user_id= eqpMaintainTemH.repeat_user_id
|
||||
};
|
||||
insertEqpMaintainTemEquipHs.Add(eqpMaintainTemEquipH);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
@@ -98,22 +99,22 @@ namespace Tnb.EquipMgr
|
||||
input.data["code"] = await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE);
|
||||
}
|
||||
|
||||
EqpRepairApply eqpRepairApply = new()
|
||||
{
|
||||
code = (string)input.data["code"],
|
||||
name = (string)input.data["name"],
|
||||
equip_id = (string)input.data["equip_id"],
|
||||
expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null,
|
||||
is_ugent = (int?)(long)input.data["is_ugent"],
|
||||
attachment = input.data.ContainsKey("attachment") ? (string)input.data["attachment"] : null,
|
||||
apply_user_id = (string)input.data["apply_user_id"],
|
||||
create_id = (string)input.data["create_id"],
|
||||
create_time = DateTime.Now,
|
||||
org_id = (string)input.data["org_id"],
|
||||
remark = (string)input.data["remark"],
|
||||
description = (string)input.data["description"],
|
||||
status = RepairApplyStatus.TOBEEXECUTED
|
||||
};
|
||||
EqpRepairApply eqpRepairApply = new();
|
||||
|
||||
eqpRepairApply.code = (string)input.data["code"];
|
||||
eqpRepairApply.name = (string)input.data["name"];
|
||||
eqpRepairApply.equip_id = (string)input.data["equip_id"];
|
||||
eqpRepairApply.expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? DateTimeOffset.FromUnixTimeSeconds(((long)input.data["expect_complete_time"]) / 1000).ToLocalTime().DateTime : null;
|
||||
eqpRepairApply.is_ugent = (int?)(long)input.data["is_ugent"];
|
||||
eqpRepairApply.attachment = input.data.ContainsKey("attachment") ? JsonConvert.SerializeObject(input.data["attachment"]) : null;
|
||||
eqpRepairApply.apply_user_id = (string)input.data["apply_user_id"];
|
||||
eqpRepairApply.create_id = (string)input.data["create_id"];
|
||||
eqpRepairApply.create_time = DateTime.Now;
|
||||
eqpRepairApply.org_id = (string)input.data["org_id"];
|
||||
eqpRepairApply.remark = input.data.ContainsKey("remark") ? (string)input.data["remark"] : "";
|
||||
eqpRepairApply.description = input.data.ContainsKey("description") ? (string)input.data["description"] : "";
|
||||
eqpRepairApply.status = RepairApplyStatus.TOBEEXECUTED;
|
||||
|
||||
_ = await _repository.InsertAsync(eqpRepairApply);
|
||||
|
||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Security;
|
||||
@@ -117,7 +118,14 @@ namespace Tnb.EquipMgr
|
||||
|
||||
if (eqpSparePartsList.Count > 0)
|
||||
{
|
||||
_ = await db.Insertable<EqpEquipSpareParts>(eqpSparePartsList).ExecuteCommandAsync();
|
||||
var datas= await db.Queryable<EqpEquipSpareParts>().ToListAsync();
|
||||
foreach (var item in eqpSparePartsList)
|
||||
{
|
||||
if (!datas.Where(p => p.equip_id == item.equip_id && p.spare_parts_id == item.spare_parts_id).Any())
|
||||
_ = await db.Insertable<EqpEquipSpareParts>(eqpSparePartsList).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ namespace Tnb.EquipMgr
|
||||
org_id = eqpSpotInsTemH.org_id,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
duty_user_id= eqpSpotInsTemH.duty_user_id,
|
||||
repeat_user_id= eqpSpotInsTemH.repeat_user_id
|
||||
};
|
||||
insertEqpSpotInsTemEquipHs.Add(eqpSpotInsTemEquipH);
|
||||
|
||||
|
||||
@@ -214,6 +214,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
_ = await _repository.UpdateAsync(x => new EqpMaintainRecordH()
|
||||
{
|
||||
fhattachment=input.attachment,
|
||||
repeat_result = input.repeat_result,
|
||||
repeat_remark = input.repeat_remark,
|
||||
repeat_user_id = _userManager.UserId,
|
||||
@@ -244,6 +245,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
fhattachment= a.fhattachment,
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
equip_id = b.code,
|
||||
equip_id_id = a.equip_id,
|
||||
|
||||
@@ -183,6 +183,7 @@ namespace Tnb.EquipMgr
|
||||
repeat_result = input.repeat_result,
|
||||
repeat_remark = input.repeat_remark,
|
||||
repeat_user_id = _userManager.UserId,
|
||||
fhattachment=input.attachment,
|
||||
repeat_time = DateTime.Now,
|
||||
status = SpotInsRecordExecutionStatus.COMPLETED
|
||||
}, x => x.id == input.id);
|
||||
@@ -204,6 +205,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
fhattachment=a.fhattachment,
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
equip_id = a.equip_id,
|
||||
repeat_remark = a.repeat_remark,
|
||||
|
||||
@@ -31,5 +31,13 @@
|
||||
public string? material_name { get; set; }
|
||||
|
||||
public string? material_id { get; set; }
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string? material_specification { get; set; }
|
||||
/// <summary>
|
||||
/// 箱号
|
||||
/// </summary>
|
||||
public string? container_no { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Message;
|
||||
using JNPF.Message.Interfaces.Message;
|
||||
using JNPF.Message.Service;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
|
||||
@@ -15,7 +18,7 @@ namespace JNPF.TaskScheduler.Listener
|
||||
// {
|
||||
// _repository = repository;
|
||||
// }
|
||||
|
||||
private IMessageService _sendMessageService => App.GetService<IMessageService>();
|
||||
[SpareTime("0 0 0 * * ?", "生成设备保养计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
||||
public async void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||
{
|
||||
@@ -105,7 +108,11 @@ namespace JNPF.TaskScheduler.Listener
|
||||
is_repeat = item.is_repeat,
|
||||
repeat_post_info_user_id = item.repeat_post_info_user_id,
|
||||
is_send = item.is_send,
|
||||
repeat_user_id = item.repeat_user_id,
|
||||
execute_user_id = item.duty_user_id,
|
||||
create_time = DateTime.Now,
|
||||
|
||||
|
||||
status = Tnb.EquipMgr.SpotInsRecordExecutionStatus.TOBEEXECUTED
|
||||
});
|
||||
}
|
||||
@@ -167,6 +174,24 @@ namespace JNPF.TaskScheduler.Listener
|
||||
Console.WriteLine(dbResult.ErrorMessage);
|
||||
Log.Error(dbResult.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<EqpEquipment> equipments = await db.Queryable<EqpEquipment>().Where(x => x.life == Tnb.EquipMgr.EquipmentLife.ENABLE).ToListAsync();
|
||||
foreach (var item in tobeCreateList)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
|
||||
continue;
|
||||
var users = new List<string>() { item.execute_user_id };
|
||||
var title = equipments.FirstOrDefault(x => x.id == item.equip_id).code + "设备保养提醒";
|
||||
await _sendMessageService.SentMessage(users, title, title);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Message.Interfaces.Message;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
|
||||
@@ -15,7 +16,7 @@ namespace JNPF.TaskScheduler.Listener
|
||||
// {
|
||||
// _repository = repository;
|
||||
// }
|
||||
|
||||
private IMessageService _sendMessageService => App.GetService<IMessageService>();
|
||||
[SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
||||
public async void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||
{
|
||||
@@ -104,6 +105,8 @@ namespace JNPF.TaskScheduler.Listener
|
||||
repeat_post_info_user_id = item.repeat_post_info_user_id,
|
||||
is_send = item.is_send,
|
||||
create_time = DateTime.Now,
|
||||
repeat_user_id= item.repeat_user_id,
|
||||
spot_record_user_id=item.duty_user_id,
|
||||
status = Tnb.EquipMgr.SpotInsRecordExecutionStatus.TOBEEXECUTED
|
||||
});
|
||||
}
|
||||
@@ -170,6 +173,24 @@ namespace JNPF.TaskScheduler.Listener
|
||||
Console.WriteLine(dbResult.ErrorMessage);
|
||||
Log.Error(dbResult.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<EqpEquipment> equipments = await db.Queryable<EqpEquipment>().Where(x => x.life == Tnb.EquipMgr.EquipmentLife.ENABLE).ToListAsync();
|
||||
foreach (var item in tobeCreateList)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
|
||||
continue;
|
||||
var users = new List<string>() { item.spot_record_user_id };
|
||||
var title = equipments.FirstOrDefault(x => x.id == item.equip_id).code + "设备点巡检提醒";
|
||||
await _sendMessageService.SentMessage(users, title, title);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user