127 lines
4.3 KiB
C#
127 lines
4.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
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>
|
||
/// <param name="workorderid">颜色代码</param>
|
||
/// <param name="description">产品描述</param>
|
||
/// <param name="pageNum"></param>
|
||
/// <param name="pageSize"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("gettestlist")]
|
||
public IActionResult GetTestlist(DateTime starttime, DateTime endTime, string workorderid, string description, int pageNum, int pageSize, int dateType)
|
||
{
|
||
//starttime = starttime.AddHours(8);
|
||
//endTime = endTime.AddHours(8);
|
||
|
||
// 时间要增加,8个小时
|
||
(List<PLTest>, int) lst = plTestService.GetPLTestTable(starttime, endTime, workorderid, description, pageNum, pageSize, dateType);
|
||
|
||
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;
|
||
pLTest.Description = pLTestDto.Description;
|
||
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;
|
||
}
|
||
}
|
||
}
|