巡检计划

This commit is contained in:
qianhao.xu 2024-05-28 17:23:55 +08:00
parent 3254646ae9
commit e1951a51e6
15 changed files with 159 additions and 27 deletions

View File

@ -31,12 +31,24 @@ namespace ZR.Admin.WebApi.Controllers
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:deviceaccount:list")]
[ActionPermissionFilter(Permission = "deviceManagement:deviceaccount:list")]
public IActionResult QueryDeviceAccount([FromQuery] DeviceAccountQueryDto parm)
{
var response = _DeviceAccountService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询绑定或者未绑定巡检任务的设备台账
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list_route_inspect")]
[AllowAnonymous]
public IActionResult QueryDeviceAccount_Route([FromQuery] DeviceAccountQueryDto2 parm)
{
var response = _DeviceAccountService.GetList_Route(parm);
return SUCCESS(response);
}
/// <summary>
@ -45,7 +57,7 @@ namespace ZR.Admin.WebApi.Controllers
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:deviceaccount:query")]
[ActionPermissionFilter(Permission = "deviceManagement:deviceaccount:query")]
public IActionResult GetDeviceAccount(int Id)
{
var response = _DeviceAccountService.GetInfo(Id);
@ -59,7 +71,7 @@ namespace ZR.Admin.WebApi.Controllers
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:deviceaccount:add")]
[ActionPermissionFilter(Permission = "deviceManagement:deviceaccount:add")]
[Log(Title = "设备台账", BusinessType = BusinessType.INSERT)]
public IActionResult AddDeviceAccount([FromBody] DeviceAccountDto parm)
{
@ -75,7 +87,7 @@ namespace ZR.Admin.WebApi.Controllers
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:deviceaccount:edit")]
[ActionPermissionFilter(Permission = "deviceManagement:deviceaccount:edit")]
[Log(Title = "设备台账", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDeviceAccount([FromBody] DeviceAccountDto parm)
{
@ -90,7 +102,7 @@ namespace ZR.Admin.WebApi.Controllers
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:deviceaccount:delete")]
[ActionPermissionFilter(Permission = "deviceManagement:deviceaccount:delete")]
[Log(Title = "设备台账", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDeviceAccount(string ids)
{

View File

@ -9,9 +9,13 @@
<NoWarn>1701;1702;1591,8603,8602,8604,8600,8618</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Remove="wwwroot\cloudUpload\**" />
<Compile Remove="wwwroot\device\**" />
<Content Remove="wwwroot\cloudUpload\**" />
<Content Remove="wwwroot\device\**" />
<EmbeddedResource Remove="wwwroot\cloudUpload\**" />
<EmbeddedResource Remove="wwwroot\device\**" />
<None Remove="wwwroot\cloudUpload\**" />
<None Remove="wwwroot\device\**" />
</ItemGroup>
@ -32,7 +36,6 @@
<ItemGroup>
<Folder Include="Properties\PublishProfiles\" />
<Folder Include="wwwroot\cloudUpload\" />
</ItemGroup>
<ItemGroup>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -16,6 +16,25 @@ namespace ZR.Model.MES.dev.Dto
public int? Status { get; set; }
}
/// <summary>
/// 适配设备巡检项
/// </summary>
public class DeviceAccountQueryDto2 : PagerInfo
{
/// <summary>
/// 设备类型
/// </summary>
public int FkDeviceType { get; set; }
public string DeviceName { get; set; }
public string DeviceSpecification { get; set; }
/// <summary>
/// 巡检id
/// </summary>
public string fkRouteInspectionPlanId { get; set; }
}
/// <summary>
/// 设备台账输入输出对象
/// </summary>

View File

@ -41,6 +41,28 @@ namespace ZR.Service.MES.dev
return response;
}
public PagedInfo<DeviceAccountDto> GetList_Route(DeviceAccountQueryDto2 parm)
{
var predicate = Expressionable.Create<DeviceAccount, DeviceRelRpAt>()
.AndIF(!string.IsNullOrEmpty(parm.DeviceName), (a, r) => a.DeviceName.Contains(parm.DeviceName))
.AndIF(!string.IsNullOrEmpty(parm.DeviceSpecification), (a, r) => a.DeviceSpecification.Contains(parm.DeviceSpecification))
.And((a, r) => a.Status == 1)
.AndIF(parm.FkDeviceType > 0, (a, r) => a.FkDeviceType == parm.FkDeviceType)
.AndIF(!string.IsNullOrEmpty(parm.fkRouteInspectionPlanId), (a, r) =>r.FkRouteInspectionPlanId== parm.fkRouteInspectionPlanId)
.AndIF(string.IsNullOrEmpty(parm.fkRouteInspectionPlanId), (a, r) =>r.FkRouteInspectionPlanId!= parm.fkRouteInspectionPlanId|| r.FkRouteInspectionPlanId==null)
;
var response = Context.Queryable<DeviceAccount>()
.LeftJoin<DeviceRelRpAt>((a, r) =>a.Id==r.FkDeviceAccountId)
.Where(predicate.ToExpression())
.Select((a,r)=>a)
.ToPage<DeviceAccount, DeviceAccountDto>(parm);
return response;
}
/// <summary>
/// 获取详情

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZR.Service.MES.dev
{
/// <summary>
/// 巡检计划与设备关联表
/// </summary>
[SugarTable("device_rel_rp_at")]
public class DeviceRelRpAt
{
/// <summary>
/// 巡检计划 id
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_route_inspection_plan_id")]
public string FkRouteInspectionPlanId { get; set; }
/// <summary>
/// 设备台账id
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_device_account_id")]
public int FkDeviceAccountId { get; set; }
/// <summary>
/// 巡检设备顺序
/// </summary>
public int? Sort { get; set; }
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "cREATED_BY")]
public string CreatedBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "cREATED_TIME")]
public DateTime? CreatedTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
[SugarColumn(ColumnName = "uPDATED_BY")]
public string UpdatedBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnName = "uPDATED_TIME")]
public DateTime? UpdatedTime { get; set; }
}
}

View File

@ -71,27 +71,42 @@ namespace ZR.Service.MES.dev
/// <returns></returns>
public int UpdateDeviceRouteInspectionPlan(DeviceRouteInspectionPlan model)
{
//var response = Update(w => w.Id == model.Id, it => new DeviceRouteInspectionPlan()
//{
// Name = model.Name,
// Status = model.Status,
// Type = model.Type,
// LifeCycleStart = model.LifeCycleStart,
// LifeCycleEnd = model.LifeCycleEnd,
// ExcuteCycleType = model.ExcuteCycleType,
// DayNum = model.DayNum,
// WeekList = model.WeekList,
// MonthDayList = model.MonthDayList,
// ExcuteDayStartTime = model.ExcuteDayStartTime,
// ExcuteDayEndTime = model.ExcuteDayEndTime,
// Remark = model.Remark,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
switch (model.ExcuteCycleType)
{
// 每日
case 1:
model.WeekList = "";
model.MonthDayList = "";
break;
//每周
case 2:
model.DayNum = null;
model.MonthDayList = "";
break;
//每月
case 3:
model.WeekList = "";
model.DayNum = null;
break;
}
var response = Update(w => w.Id == model.Id, it => new DeviceRouteInspectionPlan()
{
Name = model.Name,
Status = model.Status,
Type = model.Type,
LifeCycleStart = model.LifeCycleStart,
LifeCycleEnd = model.LifeCycleEnd,
ExcuteCycleType = model.ExcuteCycleType,
DayNum = model.DayNum,
WeekList = model.WeekList,
MonthDayList = model.MonthDayList,
Remark = model.Remark,
UpdatedBy = model.UpdatedBy,
UpdatedTime = model.UpdatedTime,
});
return response;
// return Update(model, true);
}
}

View File

@ -14,6 +14,10 @@ namespace ZR.Service.Business.IBusinessService
{
PagedInfo<DeviceAccountDto> GetList(DeviceAccountQueryDto parm);
PagedInfo<DeviceAccountDto> GetList_Route(DeviceAccountQueryDto2 parm);
DeviceAccount GetInfo(int Id);
DeviceAccount AddDeviceAccount(DeviceAccount parm);