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 MesCutterLedgerController : ControllerBase { private readonly MesCutterLedgerManager m = new(); /// /// 刀具查询(支持编号或名称模糊查询)MesCutterLedger /// /// 查询关键字请求体 /// 刀具列表 [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); } } /// /// 上下刀操作(上刀type=0,下刀type=1) /// [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 }); } }