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
{
///
/// 质检记录
///
public class ReportQualityInspectionServices : BaseServices, IReportQualityInspectionServices
{
private readonly IBaseRepository _dal;
private readonly IReportQualityInspectionRepository _baseSpaceInfoRepository;
private readonly ICodeBindingRecordRepository _codeBindingRecordRepository;
public ReportQualityInspectionServices(IBaseRepository dal, IReportQualityInspectionRepository reportQualityInspectionRepository, ICodeBindingRecordRepository codeBindingRepository)
{
_baseSpaceInfoRepository = reportQualityInspectionRepository;
_codeBindingRecordRepository = codeBindingRepository;
this._dal = dal;
base.BaseDal = dal;
}
///
/// 判断是否有不合格质检项,传入的是SN码
///
///
public List JudgeIsQualified(string SnCode)
{
try
{
List list = _codeBindingRecordRepository.Query(s => s.ProductCode == SnCode);
if(list!=null && list.Count > 0)
{
string boxCode = list.FirstOrDefault().BoxCode;
var list1 = _baseSpaceInfoRepository.Query(x => x.BarCode.Equals(boxCode) && x.IsFlag != 1);
return list1;
}
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
return null;
}
}
}