You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AUCMA_SCADA/Admin.Core.Service/Service_New/ReportQualityInspectionServ...

54 lines
1.9 KiB
C#

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 _baseSpaceInfoRepository;
private readonly ICodeBindingRecordRepository _codeBindingRecordRepository;
public ReportQualityInspectionServices(IBaseRepository<ReportQualityInsPection> dal, IReportQualityInspectionRepository reportQualityInspectionRepository, ICodeBindingRecordRepository codeBindingRepository)
{
_baseSpaceInfoRepository = reportQualityInspectionRepository;
_codeBindingRecordRepository = codeBindingRepository;
this._dal = dal;
base.BaseDal = dal;
}
/// <summary>
/// 判断是否有不合格质检项,传入的是SN码
/// </summary>
/// <returns></returns>
public List<ReportQualityInsPection> JudgeIsQualified(string SnCode)
{
try
{
List<CodeBindingRecord> 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;
}
}
}