using Admin.Core.IRepository ;
using Admin.Core.IService ;
using Admin.Core.Model ;
using Admin.Core.Model.Model_New ;
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Threading.Tasks ;
namespace Admin.Core.Service
{
/// <summary>
/// 质检记录
/// </summary>
public class ReportQualityInspectionServices : BaseServices < ReportQualityInsPection > , IReportQualityInspectionServices
{
private readonly IBaseRepository < ReportQualityInsPection > _dal ;
private readonly IReportQualityInspectionRepository _qualityInspectionRepository ;
private readonly ICodeBindingRecordRepository _codeBindingRecordRepository ;
public ReportQualityInspectionServices ( IBaseRepository < ReportQualityInsPection > dal , IReportQualityInspectionRepository reportQualityInspectionRepository , ICodeBindingRecordRepository codeBindingRepository )
{
_qualityInspectionRepository = reportQualityInspectionRepository ;
_codeBindingRecordRepository = codeBindingRepository ;
this . _dal = dal ;
base . BaseDal = dal ;
}
/// <summary>
/// 判断是否有不合格质检项,传入的是箱体码
/// </summary>
/// <returns></returns>
public ReportQualityInsPection JudgeIsQualified ( string BoxCode )
{
try
{
ReportQualityInsPection record = _qualityInspectionRepository . Db . Ado . SqlQuery < ReportQualityInsPection > ( $"select * from REPORT_QUALITY_INSPECTION where BAR_CODE = '{BoxCode}' AND STATION_CODE = 2010 AND TREATMENT_MEASURE = 3" ) . FirstOrDefault ( ) ;
return record ;
}
catch ( System . Exception ex )
{
Console . WriteLine ( ex . Message ) ;
}
return null ;
}
}
}