shgx_tz_mom/ZR.Admin.WebApi/Controllers/mes/ql/PainLab02Controller.cs

127 lines
4.3 KiB
C#
Raw Normal View History

using Microsoft.AspNetCore.Mvc;
2024-06-11 16:51:44 +08:00
using ZR.Model.MES.ql;
using ZR.Model.MES.ql.DTO;
using ZR.Service.mes.ql.IService;
namespace ZR.Admin.WebApi.Controllers.mes.ql
{
[Route("mes/ql/PaintLab")]
public class PainLab02Controller : BaseController
{
private readonly IPLTestService plTestService;
public PainLab02Controller(IPLTestService pltestservice)
{
this.plTestService = pltestservice;
}
/// <summary>
/// 获取测试数据
/// </summary>
/// <param name="starttime"></param>
/// <param name="endTime"></param>
2024-06-20 11:52:05 +08:00
/// <param name="workorderid">颜色代码</param>
2024-09-14 15:17:33 +08:00
/// <param name="description">产品描述</param>
2024-06-11 16:51:44 +08:00
/// <param name="pageNum"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet("gettestlist")]
2024-09-14 15:17:33 +08:00
public IActionResult GetTestlist(DateTime starttime, DateTime endTime, string workorderid, string description, int pageNum, int pageSize)
2024-06-11 16:51:44 +08:00
{
2024-06-11 17:27:02 +08:00
//starttime = starttime.AddHours(8);
//endTime = endTime.AddHours(8);
2024-06-11 16:51:44 +08:00
// 时间要增加8个小时
2024-09-14 15:17:33 +08:00
(List<PLTest>, int) lst = plTestService.GetPLTestTable(starttime, endTime, workorderid, description, pageNum, pageSize);
2024-06-11 16:51:44 +08:00
return ToResponse(new ApiResult(200, "success", lst));
}
/// <summary>
/// 增加测试数据记录
/// </summary>
/// <param name="num"></param>
/// <returns></returns>
[HttpGet("addtestlist")]
public IActionResult AddTestlist(int num)
{
int ret = plTestService.AddPLTestRecords(1, 5);
return ToResponse(new ApiResult(200, "success", ret));
}
/// <summary>
/// 删除测试数据记录
/// </summary>
/// <param name="idGroup"></param>
/// <returns></returns>
[HttpGet("deltestlist")]
public IActionResult DelTestlist(string idGroup)
{
int ret = plTestService.DelPLTestRecords(idGroup);
return ToResponse(new ApiResult(200, "success", ret));
}
/// <summary>
/// 更新测试数据记录
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
[HttpPost("updatetestlist")]
[Log(Title = "更新测试数据记录", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateTestlist([FromBody] List<PLTestDto> list)
{
List<PLTest> lstDest = new List<PLTest>();
foreach (PLTestDto dto in list)
{
lstDest.Add(ConvertDTO2PLTest(dto));
}
int ret = plTestService.UpdatePLTestRecords(lstDest);
return ToResponse(new ApiResult(200, "success", ret));
}
public PLTest ConvertDTO2PLTest(PLTestDto pLTestDto)
{
PLTest pLTest = new PLTest();
pLTest.Id = pLTestDto.Id;
pLTest.IdGroup = pLTestDto.plIdGroup;
2024-09-14 15:17:33 +08:00
pLTest.Description = pLTestDto.Description;
2024-06-11 16:51:44 +08:00
pLTest.Code = pLTestDto.plCode;
pLTest.Dt = pLTestDto.plDt;
pLTest.Value01 = pLTestDto.plValue01;
pLTest.Value02 = pLTestDto.plValue02;
pLTest.Value03 = pLTestDto.plValue03;
pLTest.Value04 = pLTestDto.plValue04;
pLTest.Value05 = pLTestDto.plValue05;
pLTest.Value06 = pLTestDto.plValue06;
pLTest.Value07 = pLTestDto.plValue07;
pLTest.Value08 = pLTestDto.plValue08;
pLTest.Value09 = pLTestDto.plValue09;
pLTest.Value10 = pLTestDto.plValue10;
pLTest.Value11 = pLTestDto.plValue11;
pLTest.Value12 = pLTestDto.plValue12;
pLTest.Value13 = pLTestDto.plValue13;
pLTest.Value14 = pLTestDto.plValue14;
pLTest.Value15 = pLTestDto.plValue15;
pLTest.Value16 = pLTestDto.plValue16;
pLTest.CreatedBy = pLTestDto.plCreatedBy;
pLTest.UpdatedBy = pLTestDto.plUpdatedBy;
try
{
pLTest.CreatedTime = Convert.ToDateTime(pLTestDto.plCreatedTime);
pLTest.UpdatedTime = Convert.ToDateTime(pLTestDto.plUpdatedTime);
}
catch { }
return pLTest;
}
}
}