MDM更新
This commit is contained in:
parent
c61d050947
commit
df44f145a9
117
MDM/Controllers/Plant/PlantPlcIoPointController.cs
Normal file
117
MDM/Controllers/Plant/PlantPlcIoPointController.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Controllers;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using MDM.Model.Plant;
|
||||
using MDM.Model.Plant.Dto;
|
||||
using MDM.Services.IPlantService;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RIZO.Admin.WebApi.Filters;
|
||||
using RIZO.Common;
|
||||
using RIZO.ServiceCore.Middleware;
|
||||
|
||||
//创建时间:2025-11-15
|
||||
namespace MDM.Controllers.Plant
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC点位
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("MasterDataManagement/Plant/PlantPlcIoPoint")]
|
||||
public class PlantPlcIoPointController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC点位接口
|
||||
/// </summary>
|
||||
private readonly IPlantPlcIoPointService _PlantPlcIoPointService;
|
||||
|
||||
public PlantPlcIoPointController(IPlantPlcIoPointService PlantPlcIoPointService)
|
||||
{
|
||||
_PlantPlcIoPointService = PlantPlcIoPointService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询PLC点位列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "business:plantplciopoint:list")]
|
||||
public IActionResult QueryPlantPlcIoPoint([FromQuery] PlantPlcIoPointQueryDto parm)
|
||||
{
|
||||
var response = _PlantPlcIoPointService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询PLC点位详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:plantplciopoint:query")]
|
||||
public IActionResult GetPlantPlcIoPoint(int Id)
|
||||
{
|
||||
var response = _PlantPlcIoPointService.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<PlantPlcIoPoint>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加PLC点位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "business:plantplciopoint:add")]
|
||||
[Log(Title = "PLC点位", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddPlantPlcIoPoint([FromBody] PlantPlcIoPointDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<PlantPlcIoPoint>().ToCreate(HttpContext);
|
||||
|
||||
var response = _PlantPlcIoPointService.AddPlantPlcIoPoint(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新PLC点位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "business:plantplciopoint:edit")]
|
||||
[Log(Title = "PLC点位", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdatePlantPlcIoPoint([FromBody] PlantPlcIoPointDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<PlantPlcIoPoint>().ToUpdate(HttpContext);
|
||||
var response = _PlantPlcIoPointService.UpdatePlantPlcIoPoint(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除PLC点位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:plantplciopoint:delete")]
|
||||
[Log(Title = "PLC点位", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeletePlantPlcIoPoint(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _PlantPlcIoPointService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using RIZO.Admin.WebApi.Filters;
|
||||
using Infrastructure.Controllers;
|
||||
using RIZO.ServiceCore.Middleware;
|
||||
using Mapster;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using RIZO.Common;
|
||||
using Infrastructure.Model;
|
||||
using MDM.Services.IProcessService;
|
||||
using MDM.Model.Process.Dto;
|
||||
using MDM.Model.Process;
|
||||
using MDM.Services.Process;
|
||||
|
||||
//创建时间:2025-11-22
|
||||
namespace MDM.Controllers.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// 工序工站映射
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("MasterDataManagement/Process/ProcessOperationWorkstationMapping")]
|
||||
public class ProcessOperationWorkstationMappingController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 接口
|
||||
/// </summary>
|
||||
private readonly IProcessOperationWorkstationMappingService _ProcessOperationWorkstationMappingService;
|
||||
|
||||
public ProcessOperationWorkstationMappingController(IProcessOperationWorkstationMappingService ProcessOperationWorkstationMappingService)
|
||||
{
|
||||
_ProcessOperationWorkstationMappingService = ProcessOperationWorkstationMappingService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "business:processoperationworkstationmapping:list")]
|
||||
public IActionResult QueryProcessOperationWorkstationMapping([FromQuery] ProcessOperationWorkstationMappingQueryDto parm)
|
||||
{
|
||||
var response = _ProcessOperationWorkstationMappingService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:processoperationworkstationmapping:query")]
|
||||
public IActionResult GetProcessOperationWorkstationMapping(int Id)
|
||||
{
|
||||
var response = _ProcessOperationWorkstationMappingService.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<ProcessOperationWorkstationMapping>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "business:processoperationworkstationmapping:add")]
|
||||
[Log(Title = "", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddProcessOperationWorkstationMapping([FromBody] ProcessOperationWorkstationMappingDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<ProcessOperationWorkstationMapping>().ToCreate(HttpContext);
|
||||
|
||||
var response = _ProcessOperationWorkstationMappingService.AddProcessOperationWorkstationMapping(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "business:processoperationworkstationmapping:edit")]
|
||||
[Log(Title = "", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateProcessOperationWorkstationMapping([FromBody] ProcessOperationWorkstationMappingDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<ProcessOperationWorkstationMapping>().ToUpdate(HttpContext);
|
||||
var response = _ProcessOperationWorkstationMappingService.UpdateProcessOperationWorkstationMapping(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:processoperationworkstationmapping:delete")]
|
||||
[Log(Title = "", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteProcessOperationWorkstationMapping(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _ProcessOperationWorkstationMappingService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
117
MDM/Controllers/Process/ProcessParameterController.cs
Normal file
117
MDM/Controllers/Process/ProcessParameterController.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using RIZO.Admin.WebApi.Filters;
|
||||
using Infrastructure.Controllers;
|
||||
using RIZO.ServiceCore.Middleware;
|
||||
using Mapster;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using RIZO.Common;
|
||||
using Infrastructure.Model;
|
||||
using MDM.Services.IProcessService;
|
||||
using MDM.Model.Process.Dto;
|
||||
using MDM.Model.Process;
|
||||
|
||||
//创建时间:2025-11-15
|
||||
namespace MDM.Controllers.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("MasterDataManagement/Process/ProcessParameter")]
|
||||
public class ProcessParameterController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)接口
|
||||
/// </summary>
|
||||
private readonly IProcessParameterService _ProcessParameterService;
|
||||
|
||||
public ProcessParameterController(IProcessParameterService ProcessParameterService)
|
||||
{
|
||||
_ProcessParameterService = ProcessParameterService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询工艺参数表(如温度、压力、时间等,关联工艺路线与工序)列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "business:processparameter:list")]
|
||||
public IActionResult QueryProcessParameter([FromQuery] ProcessParameterQueryDto parm)
|
||||
{
|
||||
var response = _ProcessParameterService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询工艺参数表(如温度、压力、时间等,关联工艺路线与工序)详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:processparameter:query")]
|
||||
public IActionResult GetProcessParameter(int Id)
|
||||
{
|
||||
var response = _ProcessParameterService.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<ProcessParameter>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "business:processparameter:add")]
|
||||
[Log(Title = "工艺参数表(如温度、压力、时间等,关联工艺路线与工序)", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddProcessParameter([FromBody] ProcessParameterDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<ProcessParameter>().ToCreate(HttpContext);
|
||||
|
||||
var response = _ProcessParameterService.AddProcessParameter(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "business:processparameter:edit")]
|
||||
[Log(Title = "工艺参数表(如温度、压力、时间等,关联工艺路线与工序)", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateProcessParameter([FromBody] ProcessParameterDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<ProcessParameter>().ToUpdate(HttpContext);
|
||||
var response = _ProcessParameterService.UpdateProcessParameter(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:processparameter:delete")]
|
||||
[Log(Title = "工艺参数表(如温度、压力、时间等,关联工艺路线与工序)", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteProcessParameter(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _ProcessParameterService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
56
MDM/Host/StartupTaskService.cs
Normal file
56
MDM/Host/StartupTaskService.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using MDM.Model.Plant;
|
||||
using MDM.Services.Plant;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SqlSugar.IOC;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
namespace MDM.Host
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序启动时执行的任务服务
|
||||
/// </summary>
|
||||
public class StartupTaskService : IHostedService
|
||||
{
|
||||
private readonly ILogger<StartupTaskService> _logger;
|
||||
private readonly PlcIoPointCacheService _cacheService;
|
||||
|
||||
public StartupTaskService(ILogger<StartupTaskService> logger, PlcIoPointCacheService cacheService)
|
||||
{
|
||||
_logger = logger;
|
||||
_cacheService = cacheService;
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation("应用程序启动,正在执行初始化逻辑...");
|
||||
|
||||
// 在这里写你想要启动时立刻执行的逻辑
|
||||
ExecuteStartupLogic();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation("StartupTaskService 已停止");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void ExecuteStartupLogic()
|
||||
{
|
||||
// 查询所有启用的点位数据(IsActive == 1)
|
||||
var activePoints = DbScoped.SugarScope.CopyNew().Queryable<PlantPlcIoPoint>()
|
||||
.Where(p => p.IsActive == 1)
|
||||
.ToList();
|
||||
|
||||
_logger.LogInformation($"✅ 从数据库加载到 {activePoints.Count} 条有效的 PlantPlcIoPoint 数据");
|
||||
|
||||
// 将数据存入缓存服务
|
||||
_cacheService.InitializeCache(activePoints);
|
||||
|
||||
_logger.LogInformation("📦 PlantPlcIoPoint 数据已成功加载到内存缓存。");
|
||||
}
|
||||
}
|
||||
}
|
||||
50
MDM/Models/Plant/Dto/PlantPlcIoPointDto.cs
Normal file
50
MDM/Models/Plant/Dto/PlantPlcIoPointDto.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MDM.Model.Plant.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC点位查询对象
|
||||
/// </summary>
|
||||
public class PlantPlcIoPointQueryDto : PagerInfo
|
||||
{
|
||||
public string FkWorkstationCode { get; set; }
|
||||
|
||||
public string FkProcessParamCode { get; set; }
|
||||
|
||||
public string FkDeviceCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PLC点位输入输出对象
|
||||
/// </summary>
|
||||
public class PlantPlcIoPointDto
|
||||
{
|
||||
[Required(ErrorMessage = "Id不能为空")]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string FkWorkstationCode { get; set; }
|
||||
|
||||
public string FkProcessParamCode { get; set; }
|
||||
|
||||
public string FkDeviceCode { get; set; }
|
||||
|
||||
public string PointType { get; set; }
|
||||
|
||||
public string Address { get; set; }
|
||||
|
||||
public int? IsActive { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
80
MDM/Models/Plant/PlantPlcIoPoint.cs
Normal file
80
MDM/Models/Plant/PlantPlcIoPoint.cs
Normal file
@ -0,0 +1,80 @@
|
||||
namespace MDM.Model.Plant
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC点位
|
||||
/// </summary>
|
||||
[SugarTable("plant_plc_io_point")]
|
||||
public class PlantPlcIoPoint
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工站code
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_workstation_code")]
|
||||
public string FkWorkstationCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工艺参数code
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_process_param_code")]
|
||||
public string FkProcessParamCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_device_code")]
|
||||
public string FkDeviceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 点位类型,如 AI(模拟输入)、DI等
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "point_type")]
|
||||
public string PointType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 点位地址,如 %IW64、DB1.DBW0
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否激活(1启用,0停用)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_active")]
|
||||
public int? IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string Description { 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; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MDM.Model.Process.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询对象
|
||||
/// </summary>
|
||||
public class ProcessOperationWorkstationMappingQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public string? FkRoutingCode { get; set; }
|
||||
|
||||
|
||||
public string? FkOperationCode { get; set; }
|
||||
|
||||
public string? FkWorkstationCode { get; set; }
|
||||
public string FkProductlinebodyCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 输入输出对象
|
||||
/// </summary>
|
||||
public class ProcessOperationWorkstationMappingDto
|
||||
{
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "工艺路线不能为空")]
|
||||
public string FkRoutingCode { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "线体不能为空")]
|
||||
public string FkProductlinebodyCode { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "工序code不能为空")]
|
||||
public string FkOperationCode { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "工位ID不能为空")]
|
||||
public string FkWorkstationCode { get; set; }
|
||||
|
||||
public string IsActive { get; set; }
|
||||
|
||||
public int? Priority { get; set; }
|
||||
|
||||
public decimal StandardTime { get; set; }
|
||||
|
||||
public decimal SetupTime { get; set; }
|
||||
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
77
MDM/Models/Process/Dto/ProcessParameterDto.cs
Normal file
77
MDM/Models/Process/Dto/ProcessParameterDto.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MDM.Model.Process.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)查询对象
|
||||
/// </summary>
|
||||
public class ProcessParameterQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public string FkRoutingCode { get; set; }
|
||||
|
||||
|
||||
public string FkOperationCode { get; set; }
|
||||
|
||||
|
||||
public string ParameterCode { get; set; }
|
||||
|
||||
public string ParameterName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)输入输出对象
|
||||
/// </summary>
|
||||
public class ProcessParameterDto
|
||||
{
|
||||
[Required(ErrorMessage = "工艺参数ID,主键不能为空")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "所属工艺路线code不能为空")]
|
||||
public string FkRoutingCode { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "所属工序code不能为空")]
|
||||
public string FkOperationCode { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "参数名称,如:温度、压力、时间不能为空")]
|
||||
public string ParameterCode { get; set; }
|
||||
|
||||
public string ParameterName { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "数据类型:FLOAT, INT, STRING, BOOL, AI(模拟量输入)等不能为空")]
|
||||
public string DataType { get; set; }
|
||||
|
||||
public string Unit { get; set; }
|
||||
|
||||
public decimal StandardValue { get; set; }
|
||||
|
||||
public decimal MinValue { get; set; }
|
||||
|
||||
public decimal MaxValue { get; set; }
|
||||
|
||||
public string IsControlled { get; set; }
|
||||
|
||||
public string IsMonitored { get; set; }
|
||||
|
||||
public string ControlType { get; set; }
|
||||
|
||||
public decimal DefaultValue { get; set; }
|
||||
|
||||
public string IsRequired { get; set; }
|
||||
|
||||
public int? Sequence { get; set; }
|
||||
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
96
MDM/Models/Process/ProcessOperationWorkstationMapping.cs
Normal file
96
MDM/Models/Process/ProcessOperationWorkstationMapping.cs
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MDM.Model.Process
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarTable("process_operation_workstation_mapping")]
|
||||
public class ProcessOperationWorkstationMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工序路线code
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_routing_code")]
|
||||
public string FkRoutingCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工序code
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_operation_code")]
|
||||
public string FkOperationCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生产线体/工作中心code
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_productlinebody_code")]
|
||||
public string FkProductlinebodyCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工位ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_workstation_code")]
|
||||
public string FkWorkstationCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有效:1=有效,0=无效
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_active")]
|
||||
public string IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 优先级(可选):如果某工位可执行多个工序,用来排序优先级
|
||||
/// </summary>
|
||||
public int? Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准加工时间(分钟/小时,可选)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "standard_time")]
|
||||
public decimal StandardTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 准备时间(如换模等,可选)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "setup_time")]
|
||||
public decimal SetupTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CreatedTime
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "created_time")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "created_by")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注信息
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// UpdatedTime
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "updated_time")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "updated_by")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -7,17 +7,7 @@ namespace MDM.Model.Process
|
||||
[SugarTable("process_opreration_transition_dict")]
|
||||
public class ProcessOprerationTransitionDict
|
||||
{
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// id
|
||||
@ -54,5 +44,17 @@ namespace MDM.Model.Process
|
||||
[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; }
|
||||
|
||||
}
|
||||
}
|
||||
134
MDM/Models/Process/ProcessParameter.cs
Normal file
134
MDM/Models/Process/ProcessParameter.cs
Normal file
@ -0,0 +1,134 @@
|
||||
|
||||
namespace MDM.Model.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
||||
/// </summary>
|
||||
[SugarTable("process_parameter")]
|
||||
public class ProcessParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// 工艺参数ID,主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属工艺路线code
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_routing_code")]
|
||||
public string FkRoutingCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属工序code
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_operation_code")]
|
||||
public string FkOperationCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数名称,如:温度、压力、时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "parameter_code")]
|
||||
public string ParameterCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示名称(用于UI展示,可和name一样)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "parameter_name")]
|
||||
public string ParameterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数描述,如:模具温度,用于热压工序
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型:FLOAT, INT, STRING, BOOL, AI(模拟量输入)等
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "data_type")]
|
||||
public string DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位,如:℃、MPa、秒、mm
|
||||
/// </summary>
|
||||
public string Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准/目标值(如目标温度 200.0 ℃)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "standard_value")]
|
||||
public decimal StandardValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小允许值(用于报警/校验)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "min_value")]
|
||||
public decimal MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大允许值(用于报警/校验)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "max_value")]
|
||||
public decimal MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为控制参数:1=是(如PID控制),0=否(仅采集)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_controlled")]
|
||||
public string IsControlled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为监控参数(是否采集/显示):1=是,0=否
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_monitored")]
|
||||
public string IsMonitored { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控制类型(如PID、ON/OFF、手动设定等,可选)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "control_type")]
|
||||
public string ControlType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认值(如未采集时使用)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "default_value")]
|
||||
public decimal DefaultValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填/必采:1=是,0=否
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_required")]
|
||||
public string IsRequired { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数排序(用于UI展示顺序)
|
||||
/// </summary>
|
||||
public int? Sequence { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "created_time")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "created_by")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "updated_time")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "updated_by")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
24
MDM/Services/Plant/IService/IPlantPlcIoPointService.cs
Normal file
24
MDM/Services/Plant/IService/IPlantPlcIoPointService.cs
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
using MDM.Model;
|
||||
using MDM.Model.Plant;
|
||||
using MDM.Model.Plant.Dto;
|
||||
using MDM.Service;
|
||||
|
||||
namespace MDM.Services.IPlantService
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC点位service接口
|
||||
/// </summary>
|
||||
public interface IPlantPlcIoPointService : IBaseService<PlantPlcIoPoint>
|
||||
{
|
||||
PagedInfo<PlantPlcIoPointDto> GetList(PlantPlcIoPointQueryDto parm);
|
||||
|
||||
PlantPlcIoPoint GetInfo(int Id);
|
||||
|
||||
PlantPlcIoPoint AddPlantPlcIoPoint(PlantPlcIoPoint parm);
|
||||
|
||||
int UpdatePlantPlcIoPoint(PlantPlcIoPoint parm);
|
||||
|
||||
}
|
||||
}
|
||||
116
MDM/Services/Plant/PlantPlcIoPointService.cs
Normal file
116
MDM/Services/Plant/PlantPlcIoPointService.cs
Normal file
@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
|
||||
using MDM.Services.IPlantService;
|
||||
|
||||
using MDM.Service;
|
||||
using MDM.Model;
|
||||
using MDM.Model.Plant;
|
||||
using MDM.Model.Plant.Dto;
|
||||
using MDM.Repository;
|
||||
using SqlSugar.IOC;
|
||||
|
||||
namespace MDM.Services.Plant
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC点位Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IPlantPlcIoPointService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class PlantPlcIoPointService : BaseService<PlantPlcIoPoint>, IPlantPlcIoPointService
|
||||
{
|
||||
private readonly PlcIoPointCacheService _cacheService;
|
||||
|
||||
public PlantPlcIoPointService(PlcIoPointCacheService cacheService)
|
||||
{
|
||||
_cacheService = cacheService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询PLC点位列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<PlantPlcIoPointDto> GetList(PlantPlcIoPointQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<PlantPlcIoPoint>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkWorkstationCode), it => it.FkWorkstationCode.Contains(parm.FkWorkstationCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkProcessParamCode), it => it.FkProcessParamCode.Contains(parm.FkProcessParamCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkDeviceCode), it => it.FkDeviceCode.Contains(parm.FkDeviceCode))
|
||||
;
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<PlantPlcIoPoint, PlantPlcIoPointDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public PlantPlcIoPoint GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加PLC点位
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public PlantPlcIoPoint AddPlantPlcIoPoint(PlantPlcIoPoint model)
|
||||
{
|
||||
PlantPlcIoPoint result = Context.Insertable(model).ExecuteReturnEntity();
|
||||
if (result != null)
|
||||
{
|
||||
var activePoints = Context.Queryable<PlantPlcIoPoint>()
|
||||
.Where(p => p.IsActive == 1)
|
||||
.ToList();
|
||||
_cacheService.InitializeCache(activePoints);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改PLC点位
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdatePlantPlcIoPoint(PlantPlcIoPoint model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new PlantPlcIoPoint()
|
||||
//{
|
||||
// FkWorkstationCode = model.FkWorkstationCode,
|
||||
// FkProcessParamCode = model.FkProcessParamCode,
|
||||
// FkDeviceCode = model.FkDeviceCode,
|
||||
// PointType = model.PointType,
|
||||
// Address = model.Address,
|
||||
// IsActive = model.IsActive,
|
||||
// Description = model.Description,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
int result= Update(model, true);
|
||||
if (result != null)
|
||||
{
|
||||
var activePoints = Context.Queryable<PlantPlcIoPoint>()
|
||||
.Where(p => p.IsActive == 1)
|
||||
.ToList();
|
||||
_cacheService.InitializeCache(activePoints);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
65
MDM/Services/PlcIoPointCacheService.cs
Normal file
65
MDM/Services/PlcIoPointCacheService.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using Infrastructure.Attribute;
|
||||
using MDM.Model.Plant;
|
||||
using MDM.Services.IPlantService;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MDM.Services.Plant
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用于缓存 PlantPlcIoPoint 数据的服务
|
||||
/// </summary>
|
||||
|
||||
[AppService(ServiceType = typeof(PlcIoPointCacheService), ServiceLifetime = LifeTime.Singleton)]
|
||||
public class PlcIoPointCacheService
|
||||
{
|
||||
// 使用线程安全的字典缓存所有点位,Key 是点位 ID
|
||||
private readonly ConcurrentDictionary<int, PlantPlcIoPoint> _pointsById = new();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化缓存(由 IHostedService 调用)
|
||||
/// </summary>
|
||||
/// <param name="points">从数据库加载的点位集合</param>
|
||||
public void InitializeCache(IEnumerable<PlantPlcIoPoint> points)
|
||||
{
|
||||
if (points == null) return;
|
||||
|
||||
// 清空旧数据
|
||||
_pointsById.Clear();
|
||||
|
||||
// 只缓存有效的点位(IsActive == 1)
|
||||
foreach (var point in points.Where(p => p.IsActive == 1))
|
||||
{
|
||||
if (point.Id > 0)
|
||||
{
|
||||
_pointsById[point.Id] = point;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据 ID 获取点位
|
||||
/// </summary>
|
||||
/// <param name="id">点位 ID</param>
|
||||
/// <returns>点位对象,如果不存在返回 null</returns>
|
||||
public PlantPlcIoPoint? GetPointById(int id)
|
||||
{
|
||||
_pointsById.TryGetValue(id, out var point);
|
||||
return point;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有已缓存的点位
|
||||
/// </summary>
|
||||
public IEnumerable<PlantPlcIoPoint> GetAllCachedPoints()
|
||||
{
|
||||
return _pointsById.Values;
|
||||
}
|
||||
|
||||
// 可根据需要添加更多方法,如:
|
||||
// - 按 工站 + 设备 分组查询
|
||||
// - 按 点位类型、工艺参数等过滤
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
|
||||
using MDM.Model;
|
||||
using MDM.Model.Process;
|
||||
using MDM.Model.Process.Dto;
|
||||
using MDM.Service;
|
||||
|
||||
namespace MDM.Services.IProcessService
|
||||
{
|
||||
/// <summary>
|
||||
/// service接口
|
||||
/// </summary>
|
||||
public interface IProcessOperationWorkstationMappingService : IBaseService<ProcessOperationWorkstationMapping>
|
||||
{
|
||||
PagedInfo<ProcessOperationWorkstationMappingDto> GetList(ProcessOperationWorkstationMappingQueryDto parm);
|
||||
|
||||
ProcessOperationWorkstationMapping GetInfo(int Id);
|
||||
|
||||
ProcessOperationWorkstationMapping AddProcessOperationWorkstationMapping(ProcessOperationWorkstationMapping parm);
|
||||
|
||||
int UpdateProcessOperationWorkstationMapping(ProcessOperationWorkstationMapping parm);
|
||||
|
||||
}
|
||||
}
|
||||
24
MDM/Services/Process/IService/IProcessParameterService.cs
Normal file
24
MDM/Services/Process/IService/IProcessParameterService.cs
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
using MDM.Model;
|
||||
using MDM.Model.Process;
|
||||
using MDM.Model.Process.Dto;
|
||||
using MDM.Service;
|
||||
|
||||
namespace MDM.Services.IProcessService
|
||||
{
|
||||
/// <summary>
|
||||
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)service接口
|
||||
/// </summary>
|
||||
public interface IProcessParameterService : IBaseService<ProcessParameter>
|
||||
{
|
||||
PagedInfo<ProcessParameterDto> GetList(ProcessParameterQueryDto parm);
|
||||
|
||||
ProcessParameter GetInfo(int Id);
|
||||
|
||||
ProcessParameter AddProcessParameter(ProcessParameter parm);
|
||||
|
||||
int UpdateProcessParameter(ProcessParameter parm);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
|
||||
using Infrastructure.Attribute;
|
||||
using MDM.Model;
|
||||
using MDM.Model.Process;
|
||||
using MDM.Model.Process.Dto;
|
||||
using MDM.Repository;
|
||||
using MDM.Service;
|
||||
using MDM.Services.IProcessService;
|
||||
namespace MDM.Services.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IProcessOperationWorkstationMappingService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ProcessOperationWorkstationMappingService : BaseService<ProcessOperationWorkstationMapping>, IProcessOperationWorkstationMappingService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProcessOperationWorkstationMappingDto> GetList(ProcessOperationWorkstationMappingQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<ProcessOperationWorkstationMapping>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkRoutingCode), m => m.FkRoutingCode.Contains(parm.FkRoutingCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkOperationCode), m => m.FkOperationCode.Contains(parm.FkOperationCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkWorkstationCode), m => m.FkWorkstationCode.Contains(parm.FkWorkstationCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkProductlinebodyCode), m => m.FkProductlinebodyCode.Contains(parm.FkProductlinebodyCode))
|
||||
|
||||
|
||||
;
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<ProcessOperationWorkstationMapping, ProcessOperationWorkstationMappingDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public ProcessOperationWorkstationMapping GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public ProcessOperationWorkstationMapping AddProcessOperationWorkstationMapping(ProcessOperationWorkstationMapping model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateProcessOperationWorkstationMapping(ProcessOperationWorkstationMapping model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new ProcessOperationWorkstationMapping()
|
||||
//{
|
||||
// FkOperationCode = model.FkOperationCode,
|
||||
// FkWorkstationCode = model.FkWorkstationCode,
|
||||
// IsActive = model.IsActive,
|
||||
// Priority = model.Priority,
|
||||
// StandardTime = model.StandardTime,
|
||||
// SetupTime = model.SetupTime,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// Remark = model.Remark,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
100
MDM/Services/Process/ProcessParameterService.cs
Normal file
100
MDM/Services/Process/ProcessParameterService.cs
Normal file
@ -0,0 +1,100 @@
|
||||
|
||||
using Infrastructure.Attribute;
|
||||
using MDM.Model;
|
||||
using MDM.Model.Process;
|
||||
using MDM.Model.Process.Dto;
|
||||
using MDM.Repository;
|
||||
using MDM.Service;
|
||||
using MDM.Services.IProcessService;
|
||||
namespace MDM.Services.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IProcessParameterService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ProcessParameterService : BaseService<ProcessParameter>, IProcessParameterService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询工艺参数表(如温度、压力、时间等,关联工艺路线与工序)列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProcessParameterDto> GetList(ProcessParameterQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<ProcessParameter>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkRoutingCode), it => it.FkRoutingCode.Contains(parm.FkRoutingCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkOperationCode), it => it.FkOperationCode.Contains(parm.FkOperationCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.ParameterCode), it => it.ParameterCode.Contains(parm.ParameterCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.ParameterName), it => it.ParameterName.Contains(parm.ParameterName))
|
||||
|
||||
|
||||
;
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<ProcessParameter, ProcessParameterDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public ProcessParameter GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public ProcessParameter AddProcessParameter(ProcessParameter model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateProcessParameter(ProcessParameter model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new ProcessParameter()
|
||||
//{
|
||||
// FkRoutingCode = model.FkRoutingCode,
|
||||
// FkOperationCode = model.FkOperationCode,
|
||||
// ParameterCode = model.ParameterCode,
|
||||
// ParameterName = model.ParameterName,
|
||||
// Description = model.Description,
|
||||
// DataType = model.DataType,
|
||||
// Unit = model.Unit,
|
||||
// StandardValue = model.StandardValue,
|
||||
// MinValue = model.MinValue,
|
||||
// MaxValue = model.MaxValue,
|
||||
// IsControlled = model.IsControlled,
|
||||
// IsMonitored = model.IsMonitored,
|
||||
// ControlType = model.ControlType,
|
||||
// DefaultValue = model.DefaultValue,
|
||||
// IsRequired = model.IsRequired,
|
||||
// Sequence = model.Sequence,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"dbConfigs": [
|
||||
{
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog=ay2509055-guiyang-fluorescence-lmes;Port=3308;",
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=RIZOtech123;Initial Catalog=ay2509055-guiyang-fluorescence-lmes;Port=3308;",
|
||||
"Conn": "Data Source=192.168.1.48;User ID=root;Password=123456;Initial Catalog=ay2509055-guiyang-fluorescence-lmes;Port=3306;",
|
||||
"DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
|
||||
"ConfigId": "0", //多租户唯一标识
|
||||
@ -12,7 +12,7 @@
|
||||
//代码生成数据库配置
|
||||
"CodeGenDbConfig": {
|
||||
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog={dbName};Port=3308;",
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=RIZOtech123;Initial Catalog={dbName};Port=3308;",
|
||||
"Conn": "Data Source=192.168.1.48;User ID=root;Password=123456;Initial Catalog={dbName};Port=3306;",
|
||||
"DbType": 0,
|
||||
"IsAutoCloseConnection": true,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"dbConfigs": [
|
||||
{
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog=ay2509055-guiyang-fluoresence-lmes;Port=3306;SslMode=Required",
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=RIZOtech123;Initial Catalog=ay2509055-guiyang-fluoresence-lmes;Port=3306;SslMode=Required",
|
||||
"Conn": "Data Source=192.168.1.48;User ID=root;Password=123456;Initial Catalog=ay2509055-guiyang-fluoresence-lmes;Port=3306;SslMode=Required",
|
||||
"DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
|
||||
"ConfigId": "0", //多租户唯一标识
|
||||
@ -12,7 +12,7 @@
|
||||
//代码生成数据库配置
|
||||
"CodeGenDbConfig": {
|
||||
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog={dbName};",
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=RIZOtech123;Initial Catalog={dbName};",
|
||||
"Conn": "Data Source=192.168.1.48;User ID=root;Password=123456;Initial Catalog={dbName};",
|
||||
"DbType": 1,
|
||||
"IsAutoCloseConnection": true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user