fix:焊接任务单打印材料匹配率显示问题修改

This commit is contained in:
李鹏飞 2026-04-02 15:47:47 +08:00
parent 7715352579
commit 2e16ebb9d3
1 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@

using Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
@ -125,9 +126,7 @@ namespace BLL
{
var twPipeMatMatchOutputs = new List<Tw_PipeMatMatchOutput>();
var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId);
string warehouseCode = PipelineService
.GetPipeArea().FirstOrDefault(x => x.Value == pipelineModel.PipeArea.ToString())
?.Text;
string warehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(pipelineModel.PipelineId).WarehouseId).WarehouseName;
// 获取所需材料列表
var requiredMaterials = (from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
@ -152,7 +151,9 @@ namespace BLL
).ToList();
twPipeMatMatchOutputs = GetMatMatchOutput(requiredMaterials, warehouseCode, pipelineModel.ProjectId);
var result = twPipeMatMatchOutputs.Count == 0 ? 0 : twPipeMatMatchOutputs.Sum(x => x.MatchRate) / twPipeMatMatchOutputs.Count;
var result = twPipeMatMatchOutputs.Any()
? twPipeMatMatchOutputs.Average(x => x.MatchRate)
: 0;
return result;
}
}