首次提交:添加src文件夹代码
This commit is contained in:
73
Cowain.Bake.BLL/StoveSctualPatrolService.cs
Normal file
73
Cowain.Bake.BLL/StoveSctualPatrolService.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.BLL
|
||||
{
|
||||
public class StoveSctualPatrolService : ServiceBase
|
||||
{
|
||||
public StoveSctualPatrolService(IUnityContainer unityContainer) : base(unityContainer)
|
||||
{
|
||||
}
|
||||
|
||||
//批量插入数据太慢了
|
||||
public int Insert(int palletVirtualId, int cavityId, string palletCode, float vacuum, string temperature)
|
||||
{
|
||||
TStoveSctualPatrol model = new TStoveSctualPatrol()
|
||||
{
|
||||
PalletVirtualId = palletVirtualId,
|
||||
CavityId = cavityId,
|
||||
PalletCode = palletCode,
|
||||
Vacuum = vacuum,
|
||||
Temperature = temperature
|
||||
};
|
||||
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
Context.Set<TStoveSctualPatrol>().Add(model);
|
||||
return Context.SaveChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int Insert(List<TStoveSctualPatrol> tempDatas)
|
||||
{
|
||||
if (0 == tempDatas.Count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
Context.Set<TStoveSctualPatrol>().AddRange(tempDatas);
|
||||
return Context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//如果耗时不行,就用视图
|
||||
public float GetStoveMaxTemp(int palletVirtualId)
|
||||
{
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
try
|
||||
{
|
||||
return Context.Database.SqlQuery<float>($"call GetStoveMaxTemp({palletVirtualId})").FirstOrDefault(); //20250408 有时会崩
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
LogHelper.Instance.Fatal($"GetStoveMaxTemp:{ex.Message},{palletVirtualId}");
|
||||
}
|
||||
|
||||
return 90.6f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user