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.

42 lines
1.3 KiB
C#

using Admin.Core.IRepository;
using Admin.Core.Service;
using Admin.Core.IService;
using Admin.Core.Model;
using System.Linq;
using System.Collections.Generic;
using System;
using log4net.Repository.Hierarchy;
using Serilog;
namespace Admin.Core.Service
{
public class BinFeedingReportServices : BaseServices<BinFeedingReport>, IBinFeedingReportServices
{
private readonly IBaseRepository<BinFeedingReport> _dal;
public BinFeedingReportServices(IBaseRepository<BinFeedingReport> dal)
{
this._dal = dal;
base.BaseDal = dal;
}
/// <summary>
/// 获取批次号
/// </summary>
/// <param name="materialID"></param>
/// <param name="binID"></param>
/// <returns></returns>
public string GetBatchNumberByMaterialAndBinID(string materialID, int binID)
{
try
{
BinFeedingReport record = _dal.Query(x => x.MaterialID == materialID && x.BinID == binID).OrderBy(x => x.CreateTime).LastOrDefault();
return record != null ? record.Material_BatchNumber : string.Empty;
}
catch(Exception ex)
{
Log.Error($"获取批次号发生错误:{ex.Message}");
return string.Empty;
}
}
}
}