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

129 lines
4.5 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 PainLab03Controller : BaseController
{
private readonly IPLBatchService plBatchService;
public PainLab03Controller(IPLBatchService plbatchservice)
{
this.plBatchService = plbatchservice;
}
/// <summary>
/// 获取批处理数据
/// </summary>
/// <param name="starttime"></param>
/// <param name="endTime"></param>
2024-06-20 11:52:05 +08:00
/// <param name="workorderid">颜色代码</param>
2024-06-11 16:51:44 +08:00
/// <param name="pageNum"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet("getbatchlist")]
2024-09-14 15:17:33 +08:00
public IActionResult GetBatchlist(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<PLBatch>, int) lst = plBatchService.GetPLBatchTable(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("addbatchlist")]
public IActionResult AddBatchlist(int num)
{
int ret = plBatchService.AddPLBatchRecords(1, 5);
return ToResponse(new ApiResult(200, "success", ret));
}
/// <summary>
/// 删除测试数据记录
/// </summary>
/// <param name="idGroup"></param>
/// <returns></returns>
[HttpGet("delbatchlist")]
public IActionResult DelBatchlist(string idGroup)
{
int ret = plBatchService.DelPLBatchRecords(idGroup);
return ToResponse(new ApiResult(200, "success", ret));
}
/// <summary>
/// 更新批处理数据记录
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
[HttpPost("updatebatchlist")]
[Log(Title = "更新批处理数据记录", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateTestlist([FromBody] List<PLBatchDto> list)
{
List<PLBatch> lstDest = new List<PLBatch>();
foreach (PLBatchDto dto in list)
{
lstDest.Add(ConvertDTO2PLBatch(dto));
}
int ret = plBatchService.UpdatePLBatchRecords(lstDest);
return ToResponse(new ApiResult(200, "success", ret));
}
public PLBatch ConvertDTO2PLBatch(PLBatchDto pLBatchDto)
{
PLBatch pLBatch = new PLBatch();
pLBatch.Id = pLBatchDto.Id;
pLBatch.IdGroup = pLBatchDto.plIdGroup;
2024-09-14 15:17:33 +08:00
pLBatch.Description = pLBatchDto.Description;
2024-06-11 16:51:44 +08:00
pLBatch.Code = pLBatchDto.plCode;
pLBatch.Dt = pLBatchDto.plDt;
pLBatch.Value01 = pLBatchDto.plValue01;
pLBatch.Value02 = pLBatchDto.plValue02;
pLBatch.Value03 = pLBatchDto.plValue03;
pLBatch.Value04 = pLBatchDto.plValue04;
pLBatch.Value05 = pLBatchDto.plValue05;
pLBatch.Value06 = pLBatchDto.plValue06;
pLBatch.Value07 = pLBatchDto.plValue07;
pLBatch.Value08 = pLBatchDto.plValue08;
pLBatch.Value09 = pLBatchDto.plValue09;
pLBatch.Value10 = pLBatchDto.plValue10;
pLBatch.Value11 = pLBatchDto.plValue11;
pLBatch.Value12 = pLBatchDto.plValue12;
pLBatch.Value13 = pLBatchDto.plValue13;
pLBatch.Value14 = pLBatchDto.plValue14;
pLBatch.Value15 = pLBatchDto.plValue15;
pLBatch.Value16 = pLBatchDto.plValue16;
pLBatch.Value17 = pLBatchDto.plValue17;
pLBatch.Value18 = pLBatchDto.plValue18;
pLBatch.Value19 = pLBatchDto.plValue19;
pLBatch.CreatedBy = pLBatchDto.plCreatedBy;
pLBatch.UpdatedBy = pLBatchDto.plUpdatedBy;
try
{
pLBatch.CreatedTime = Convert.ToDateTime(pLBatchDto.plCreatedTime);
pLBatch.UpdatedTime = Convert.ToDateTime(pLBatchDto.plUpdatedTime);
}
catch { }
return pLBatch;
}
}
}