DeviceMaterrial

wangsr
nodyang 1 year ago
parent b2476a6af4
commit 366640bdca

@ -1,7 +1,4 @@
using System.Collections.Generic; using FreeSql.DataAnnotations;
using System.Linq;
using FreeSql.DataAnnotations;
using Mesnac.Action.ChemicalWeighing.FreeDb;
namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
{ {
@ -28,33 +25,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
public int Type { get; set; } public int Type { get; set; }
} public int Code { get; set; }
public class DeviceMaterrialService
{
public static void Save(List<DeviceMaterrial> materrials)
{
var deviceMaterrial = materrials.First();
FreeSqlUnit.Instance.Delete<DeviceMaterrial>()
.Where(x => x.Type == deviceMaterrial.Type && x.DeviceId == deviceMaterrial.DeviceId)
.ExecuteDeleted();
FreeSqlUnit.Instance.Insert(materrials).ExecuteAffrows();
}
public static List<DeviceMaterrial> GetByTypeId(int type, int deviceId)
{
return FreeSqlUnit.Instance.Select<DeviceMaterrial>()
.Where(x => x.Type == type && x.DeviceId == deviceId)
.ToList();
}
} }
} }

@ -0,0 +1,38 @@
using System.Collections.Generic;
using System.Linq;
using Mesnac.Action.ChemicalWeighing.FreeDb;
namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
{
public class DeviceMaterrialService
{
public static void Save(List<DeviceMaterrial> materrials)
{
var deviceMaterrial = materrials.First();
FreeSqlUnit.Instance.Delete<DeviceMaterrial>()
.Where(x => x.Type == deviceMaterrial.Type && x.DeviceId == deviceMaterrial.DeviceId)
.ExecuteDeleted();
foreach (var materrial in materrials)
{
materrial.Code = StockMaterrialDbHelp.GetCodeById(materrial.MaterrialId);
}
FreeSqlUnit.Instance.Insert(materrials).ExecuteAffrows();
}
public static List<DeviceMaterrial> GetByTypeId(int type, int deviceId)
{
return FreeSqlUnit.Instance.Select<DeviceMaterrial>()
.Where(x => x.Type == type && x.DeviceId == deviceId)
.ToList();
}
}
}

@ -463,6 +463,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
public static DryerView GetGelatG7 => GetGelatView(1858); public static DryerView GetGelatG7 => GetGelatView(1858);
public static DryerView GetGelatG8 => GetGelatView(1998); public static DryerView GetGelatG8 => GetGelatView(1998);
public static List<MixStep> GetWeterM1 = GetWeterView(2138); public static List<MixStep> GetWeterM1 = GetWeterView(2138);
public static List<MixStep> GetWeterM2 = GetWeterView(2338); public static List<MixStep> GetWeterM2 = GetWeterView(2338);
public static List<MixStep> GetWeterM3 = GetWeterView(2538); public static List<MixStep> GetWeterM3 = GetWeterView(2538);

@ -223,6 +223,7 @@
<Compile Include="Alarm\PmtAlarm\ModifyAction.cs" /> <Compile Include="Alarm\PmtAlarm\ModifyAction.cs" />
<Compile Include="Alarm\PmtAlarm\SelectAction.cs" /> <Compile Include="Alarm\PmtAlarm\SelectAction.cs" />
<Compile Include="AutoControl\DB\DeviceMaterrial.cs" /> <Compile Include="AutoControl\DB\DeviceMaterrial.cs" />
<Compile Include="AutoControl\DB\DeviceMaterrialService.cs" />
<Compile Include="AutoControl\DB\StockMaterrialDBHelp.cs" /> <Compile Include="AutoControl\DB\StockMaterrialDBHelp.cs" />
<Compile Include="AutoControl\DryerWaterControl.cs" /> <Compile Include="AutoControl\DryerWaterControl.cs" />
<Compile Include="AutoControl\Entity\DryerWaterControlsEntity.cs" /> <Compile Include="AutoControl\Entity\DryerWaterControlsEntity.cs" />

Loading…
Cancel
Save