tjx
2025-11-05 30ecd82c14c5b62bf5444f29edcbb7a044653b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System.Dynamic;
using Microsoft.AspNetCore.Mvc;
using PadApplication.Entites.DbModels;
using PadApplication.Entites.Dto;
using PadApplication.Services;
using PadApplication.util;
 
namespace PadApplication.Controllers;
 
[ApiController]
[Route("api/[controller]")]
public class EquipmentInspectionController : ControllerBase
{
    private readonly EquipmentInspectionManager _manager = new();
 
    /// <summary>
    /// 查询设备点检记录
    /// </summary>
    /// <param name="query">查询参数:machineNo和date</param>
    /// <returns>点检记录数据</returns>
    [HttpPost("Query")]
    public ResponseResult Query(EquipmentInspectionQueryDto query)
    {
        try
        {
            var result = _manager.QueryInspectionRecord(query);
            return new ResponseResult
            {
                status = 0,
                message = "查询成功",
                data = result
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
 
    /// <summary>
    /// 保存设备点检记录
    /// </summary>
    /// <param name="saveDto">保存参数:machineNo、date、dailyChecks、monthlyChecks</param>
    /// <returns>保存结果</returns>
    [HttpPost("Save")]
    public ResponseResult Save(EquipmentInspectionSaveDto saveDto)
    {
        try
        {
            var result = _manager.SaveInspectionRecord(saveDto);
            return new ResponseResult
            {
                status = 0,
                message = "保存成功",
                data = result
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
}