/// <summary> /// 添加静态拉伸数据 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <Guid> AddManufactory(StaticTensionDataDetailDto input) { var staticTensionDataDetail = new StaticTensionDataDetail { MaterialTrialDataId = input.MaterialTrialDataId, Standard = input.Standard, SerialNumber = input.SerialNumber, SampleCode = input.SampleCode, Length = input.Length, Width = input.Width, Thickness = input.Thickness, Diameter = input.Diameter, GaugeDistance = input.GaugeDistance, Remark = input.Remark, NonProportionalExtendRatio = input.NonProportionalExtendRatio, YieldStrength = input.YieldStrength, TensileStrength = input.TensileStrength, StrainHardening = input.StrainHardening, Elongation = input.Elongation, PlasticStrainRatio = input.PlasticStrainRatio, ModulusOfElasticity = input.ModulusOfElasticity, PoissonRatio = input.PoissonRatio, MaximumForce = input.MaximumForce, }; await _staticTensionDataDetailRepository.InsertAsync(staticTensionDataDetail); return(staticTensionDataDetail.Id); }
public List <StaticTensionDataDetailDto> GetStaticTensionDataDetailsNum(List <Guid> ids) { try { //存放查询一个id返回得到的数据数组 List <StaticTensionDataDetailDto> project1 = new List <StaticTensionDataDetailDto>(); //对查询返回得到的数据数组处理 StaticTensionDataDetailDto project2 = new StaticTensionDataDetailDto(); //处理后存放的位置,最后一起返回所有id对应的数据数组 List <StaticTensionDataDetailDto> project3 = new List <StaticTensionDataDetailDto>(); foreach (var item in ids) { //查询一个materiaid返回的是一个数组,如果数组为空则在project3add一个空对象数组 project1 = _materialTrialAppService.GetStaticTensionDataDetails2(item); if (project1.Count != 0) { project2 = project1[0]; //返回两位数的小数 project2.YieldStrength = Math.Round(project1.Average(t => t.YieldStrength).GetValueOrDefault(), 2); project2.TensileStrength = Math.Round(project1.Average(t => t.TensileStrength).GetValueOrDefault(), 2); project2.StrainHardening = Math.Round(project1.Average(t => t.StrainHardening).GetValueOrDefault(), 2); project2.Elongation = Math.Round(project1.Average(t => t.Elongation).GetValueOrDefault(), 2); project2.PlasticStrainRatio = Math.Round(project1.Average(t => t.PlasticStrainRatio).GetValueOrDefault(), 2); project2.ModulusOfElasticity = Math.Round(project1.Average(t => t.ModulusOfElasticity).GetValueOrDefault(), 2); project2.PoissonRatio = Math.Round(project1.Average(t => t.PoissonRatio).GetValueOrDefault(), 2); project2.MaximumForce = Math.Round(project1.Average(t => t.MaximumForce).GetValueOrDefault(), 2); project2.BHValue = Math.Round(project1.Average(t => t.BHValue).GetValueOrDefault(), 2); project2.IndenterDiameter = Math.Round(project1.Average(t => t.IndenterDiameter).GetValueOrDefault(), 2); project2.VImpactTemperature = Math.Round(project1.Average(t => t.VImpactTemperature).GetValueOrDefault(), 2); project2.VImpactEnergy = Math.Round(project1.Average(t => t.VImpactEnergy).GetValueOrDefault(), 2); } else { //需要对project2重新操作一次让它为空 project2 = new StaticTensionDataDetailDto(); } project3.Add(project2); } return(project3); } catch (Exception) { return(null); } }
/// <summary> /// 添加静态拉伸数据 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <Guid> AddstaticTensionDataDetail(StaticTensionDataDetailDto input) { var staticTensionDataDetail = new StaticTensionDataDetail { MaterialTrialDataId = input.MaterialTrialDataId, Standard = input.Standard, SampleCode = input.SampleCode, Thickness = input.Thickness, GaugeDistance = input.GaugeDistance, Remark = input.Remark, NonProportionalExtendRatio = input.NonProportionalExtendRatio, YieldStrength = input.YieldStrength, TensileStrength = input.TensileStrength, StrainHardening = input.StrainHardening, Elongation = input.Elongation, PlasticStrainRatio = input.PlasticStrainRatio, ModulusOfElasticity = input.ModulusOfElasticity, PoissonRatio = input.PoissonRatio, MaximumForce = input.MaximumForce, #region 新增 Equipment = input.Equipment, FileString = input.FileString, Direction = input.Direction, BHValue = input.BHValue, IndenterDiameter = input.IndenterDiameter, VImpactTemperature = input.VImpactTemperature, VImpactEnergy = input.VImpactEnergy, TestOrganization = input.TestOrganization, TestMethod = input.TestMethod #endregion }; await _staticTensionDataDetailRepository.InsertAsync(staticTensionDataDetail); return(staticTensionDataDetail.Id); }