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

153 lines
5.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 PainLab03Controller : BaseController
{
private readonly IPLBatchService plBatchService;
public PainLab03Controller(IPLBatchService plbatchservice)
{
this.plBatchService = plbatchservice;
}
/// <summary>
/// 获取批处理数据
/// </summary>
/// <param name="starttime"></param>
/// <param name="endTime"></param>
/// <param name="workorderid">颜色代码</param>
/// <param name="pageNum"></param>
/// <param name="pageSize"></param>
/// <param name="dateType"></param>
/// <returns></returns>
[HttpGet("getbatchlist")]
public IActionResult GetBatchlist(DateTime starttime, DateTime endTime, string workorderid, string description, int pageNum, int pageSize, int dateType, string workOrder)
{
//starttime = starttime.AddHours(8);
//endTime = endTime.AddHours(8);
// 时间要增加8个小时
(List<PLBatch>, int) lst = plBatchService.GetPLBatchTable(starttime, endTime, workorderid, description, pageNum, pageSize, dateType, workOrder);
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="actionDate">执行时间</param>
/// <returns></returns>
[HttpGet("AddBatchListByWorkOrder")]
public IActionResult AddBatchListByWorkOrder(DateTime actionDate)
{
try
{
int ret = plBatchService.CreatePLBatchRecordsByWorkOrder(actionDate);
return ToResponse(new ApiResult(200, "success", ret));
}
catch (Exception e)
{
return ToResponse(new ApiResult(500, "error", e.Message));
throw;
}
}
/// <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;
pLBatch.Workorder = pLBatchDto.Workorder;
pLBatch.Description = pLBatchDto.Description;
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;
}
}
}