using Infrastructure.Extensions; using JinianNet.JNTemplate; using Microsoft.AspNetCore.Mvc; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Text.Json; using ZR.Admin.WebApi.Extensions; using ZR.Model.mes.pro; using ZR.Model.MES.qc.DTO; using ZR.Model.MES.ql; using ZR.Model.MES.ql.DTO; using ZR.Service.mes.pro; using ZR.Service.mes.pro.IService; using ZR.Service.mes.ql; using ZR.Service.mes.ql.IService; using ZR.Service.mes.qu.IService; using static System.Runtime.InteropServices.JavaScript.JSType; 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; } /// /// 获取批处理数据 /// /// /// /// /// /// [HttpGet("getbatchlist")] public IActionResult GetBatchlist(DateTime starttime, DateTime endTime, int pageNum, int pageSize) { starttime = starttime.AddHours(8); endTime = endTime.AddHours(8); // 时间要增加,8个小时 (List, int) lst = plBatchService.GetPLBatchTable(starttime, endTime, pageNum, pageSize); return ToResponse(new ApiResult(200, "success", lst)); } /// /// 增加批处理数据记录 /// /// /// [HttpGet("addbatchlist")] public IActionResult AddBatchlist(int num) { int ret = plBatchService.AddPLBatchRecords(1, 5); return ToResponse(new ApiResult(200, "success", ret)); } /// /// 删除测试数据记录 /// /// /// [HttpGet("delbatchlist")] public IActionResult DelBatchlist(string idGroup) { int ret = plBatchService.DelPLBatchRecords(idGroup); return ToResponse(new ApiResult(200, "success", ret)); } /// /// 更新批处理数据记录 /// /// /// [HttpPost("updatebatchlist")] [Log(Title = "更新批处理数据记录", BusinessType = BusinessType.UPDATE)] public IActionResult UpdateTestlist([FromBody] List list) { List lstDest = new List(); 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.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; } } }