| | |
| | | private readonly IRepository<EquipmentBaseInfo, MasterDbContextLocator> _equipmentBaseInfoRep; |
| | | private readonly IRepository<SysDictType, MasterDbContextLocator> _sysDictTypeRep; |
| | | private readonly IRepository<SysDictData, MasterDbContextLocator> _sysDictDataRep; |
| | | private readonly IRepository<WorkPieceLog, MasterDbContextLocator> _workPieceLogRep; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="sysDictTypeRep"></param> |
| | | /// <param name="sysDictDataRep"></param> |
| | | public WorkPieceProcessService( |
| | | IRepository<WorkPieceLog, MasterDbContextLocator> workPieceLogRep, |
| | | IRepository<WorkPieceProcess, MasterDbContextLocator> workPieceProcessRep, |
| | | IRepository<WorkPieceInfo, MasterDbContextLocator> workPieceInfoRep, |
| | | IRepository<EquipmentBaseInfo, MasterDbContextLocator> equipmentBaseInfoRep, |
| | |
| | | IRepository<SysDictData, MasterDbContextLocator> sysDictDataRep |
| | | ) |
| | | { |
| | | _workPieceLogRep = workPieceLogRep; |
| | | _workPieceInfoRep = workPieceInfoRep; |
| | | _workPieceProcessRep = workPieceProcessRep; |
| | | _equipmentBaseInfoRep = equipmentBaseInfoRep; |
| | |
| | | && process.StartTime <= (input.StartTimeEndTime.HasValue ? input.StartTimeEndTime : DateTime.MaxValue) |
| | | select new WorkPieceProcessOutput |
| | | { |
| | | |
| | | UpdatedUserName = process.UpdatedUserName, |
| | | DataCapturePointCname = process.DataCapturePointCname, |
| | | UpdateDataCapturePointCname = process.UpdateDataCapturePointCname, |
| | | QualityNoOk = process.QualityNoOk, |
| | | QualityNoOkReason = process.QualityNoOkReason, |
| | | Id = process.Id, |
| | | WorkPieceID = process.WorkPieceID, |
| | | EquipmentID = process.EquipmentID, |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 采集日志查询 [Editby shaocx,2024-06-08] |
| | | |
| | | /// <summary> |
| | | /// 采集日志查询 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpGet("queryWorkPieceLogYield")] |
| | | public async Task<PageResult<QueryWorkPieceLogYieldOutput>> QueryWorkPieceLogYield([FromQuery] WorkPieceLogYieldInput input) |
| | | { |
| | | |
| | | var resutlt = await _workPieceLogRep.DetachedEntities |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.WorkPieceID.Contains(input.WorkPieceID)) |
| | | .Where(!string.IsNullOrEmpty(input.workingProcedure), u => u.WorkingProcedure.Contains(input.workingProcedure)) |
| | | .Where(!string.IsNullOrEmpty(input.createdUserName), u => u.CreatedUserName.Contains(input.createdUserName)) |
| | | .Where(!string.IsNullOrEmpty(input.StartTimeBeginTime.ToString()), u => u.CreatedTime >= input.StartTimeBeginTime) |
| | | .Where(!string.IsNullOrEmpty(input.StartTimeEndTime.ToString()), u => u.CreatedTime <= input.StartTimeEndTime) |
| | | |
| | | |
| | | .OrderBy(PageInputOrder.OrderBuilder<WorkPieceLogYieldInput>(input)) |
| | | .ProjectToType<QueryWorkPieceLogYieldOutput>() |
| | | .ToADPagedListAsync(input.PageNo, input.PageSize); |
| | | return resutlt; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导出采集日志查询 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns>导出的Excel文件</returns> |
| | | [HttpGet("exportWorkPieceLogYield")] |
| | | public async Task<IActionResult> ExportWorkPieceLogYield([FromQuery] WorkPieceLogYieldInput input) |
| | | { |
| | | input.PageNo = 1; |
| | | input.PageSize = 1000000; |
| | | var workPieceMachiningInfos2 = QueryWorkPieceLogYield(input); |
| | | var workPieceMachiningInfos = workPieceMachiningInfos2.Result.Rows.ToList(); |
| | | var daList = workPieceMachiningInfos.Adapt<List<ExportYQueryWorkPieceLogYieldOutput>>(); |
| | | |
| | | MemoryStream ms = new(); |
| | | DataConvertUtil.ToExcelData(daList, _sysDictTypeRep, _sysDictDataRep, out List<string> headers, |
| | | out List<List<object>> data, out string sheetName); |
| | | |
| | | ExcelUtil.ToExcel(headers, data, sheetName, ms); |
| | | ms.Position = 0; |
| | | var fileName = HttpUtility.UrlEncode($"{sheetName}[{DateTimeOffset.Now:yyyy-MM-dd}].xlsx", Encoding.GetEncoding("UTF-8")); |
| | | return new FileStreamResult(ms, "application/octet-stream") { FileDownloadName = fileName }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 分页查询工件加工(工件信息表) |
| | | /// </summary> |
| | |
| | | .Where(o => o.f.e.a.QualityState == (input.QualityState.HasValue ? input.QualityState.Value : o.f.e.a.QualityState)) |
| | | .Select(s => new WorkPieceInfoMachiningPageOutput |
| | | { |
| | | QualityNoOk = s.f.e.a.QualityNoOk, |
| | | QualityNoOkReason = s.f.e.a.QualityNoOkReason, |
| | | Id = s.f.e.a.Id, |
| | | |
| | | WorkPieceID = s.f.e.a.WorkPieceID, |
| | | WorkPieceState = s.f.e.a.WorkPieceState, |
| | | WorkPieceStateName = s.f.f.Value, |