using CompressorXN_Log;
using CompressorXN_Model;
using CompressorXN_Model.ViewModel.Response;
using System;
using System.Collections.Generic;
namespace CompressorXN_Service
{
public class ParaPlcPointService : DbContext
{
///
/// 查询参数及参数点位
///
///
///
public List QueryParaPointByProductTypeName(string productTypeName)
{
try
{
return db.Queryable()
.InnerJoin((a, b) => a.ParaType == b.ParaType && b.ParaName == a.ParaName)
.Where((a, b) => a.ProductTypeName == productTypeName)
.Select((a, b) => new ParaPointVM
{
ProductTypeName = a.ProductTypeName,
ParaType = a.ParaType,
ParaName = a.ParaName,
TargetVal = a.TargetVal,
TargetAddress = b.TargetAddress,
MinVal = a.MinVal,
MinAddress = b.MinAddress,
MaxVal = a.MaxVal,
MaxAddress = b.MaxAddress,
IsCheck = a.IsCheck,
CheckAddress = b.CheckAddress
}).ToList();
}
catch (Exception ex)
{
LogHelper.Error(ex, "执行ParaPlcPointService下QueryParaPointByProductTypeName时异常");
return null;
}
}
}
}