快乐的昕的电脑
2025-10-10 fa68fdbf65998473284c250189382dcfd0d0244f
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
64
65
66
67
using System.Dynamic;
using Microsoft.AspNetCore.Mvc;
using PadApplication.Entites.DbModels;
using PadApplication.Entites.Dto;
using PadApplication.Services;
using PadApplication.util;
 
namespace PadApplication.Controllers;
 
/// <summary>
/// 刀具台账控制器,提供刀具相关的接口
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class MesCutterLedgerController : ControllerBase
{
    private readonly MesCutterLedgerManager m = new();
 
 
    /// <summary>
    /// 刀具查询(支持编号或名称模糊查询)MesCutterLedger
    /// </summary>
    /// <param name="req">查询关键字请求体</param>
    /// <returns>刀具列表</returns>
    [HttpPost("QueryTools")]
    public ResponseResult QueryTools([FromBody] MesCutterLedger req)
    {
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var queryResult = m.QueryTools(req.searchKey, req.pageIndex, req.pageSize);
            resultInfos.tbBillList = queryResult.tbBillList;
            resultInfos.total = queryResult.total;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
 
    /// <summary>
    /// 上下刀操作(上刀type=0,下刀type=1)
    /// </summary>
    [HttpPost("SubmitToolAction")]
    public IActionResult SubmitToolAction([FromBody] dynamic data)
    {
        string workOrderNo = data.workOrderNo;
        string machineNo = data.machineNo;
        string toolNo = data.toolNo;
        string type = data.type;
        int? useLimit = data.useLimit;
 
        var result = m.SubmitToolAction(workOrderNo, machineNo, toolNo, type, useLimit);
        return Ok(new ResponseResult
        {
            status = 0,
            message = "OK",
            data = result
        });
    }
}