wangsr
wangsr 1 year ago
commit 9b31b74429

@ -35,7 +35,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
{ {
public void Save(List<DeviceMaterrial> materrials) public static void Save(List<DeviceMaterrial> materrials)
{ {
var deviceMaterrial = materrials.First(); var deviceMaterrial = materrials.First();
@ -47,7 +47,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
} }
public List<DeviceMaterrial> GetByTypeId(int type, int deviceId) public static List<DeviceMaterrial> GetByTypeId(int type, int deviceId)
{ {
return FreeSqlUnit.Instance.Select<DeviceMaterrial>() return FreeSqlUnit.Instance.Select<DeviceMaterrial>()
.Where(x => x.Type == type && x.DeviceId == deviceId) .Where(x => x.Type == type && x.DeviceId == deviceId)

@ -15,7 +15,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
/// 获取干混机物料 /// 获取干混机物料
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<MyNameValue> GetDryerMaterrial() public static List<MyNameValue> GetDryerMaterrial()
{ {
var list = GetStockMaterrial(1); var list = GetStockMaterrial(1);
list.RemoveAll(x => x.Id == 5); list.RemoveAll(x => x.Id == 5);
@ -27,7 +27,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
/// 获取糊化机物料 /// 获取糊化机物料
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<MyNameValue> GetSiloMaterrial() public static List<MyNameValue> GetSiloMaterrial()
{ {
var list1 = GetStockMaterrial(1); var list1 = GetStockMaterrial(1);
list1 = list1.Where(x => x.Id == 5 || x.Id == 6).ToList(); list1 = list1.Where(x => x.Id == 5 || x.Id == 6).ToList();
@ -40,7 +40,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
public int GetCodeById(int id) public static int GetCodeById(int id)
{ {
string sql = $"select Code from lj_stock_material where Id={id}"; string sql = $"select Code from lj_stock_material where Id={id}";
var dataTable = DBHelp.GetTable(sql); var dataTable = DBHelp.GetTable(sql);
@ -50,7 +50,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
private List<MyNameValue> GetStockMaterrial(int mtypId) private static List<MyNameValue> GetStockMaterrial(int mtypId)
{ {
string sql = "select Id, Code, StockName, MTypeId, MTypeName, MId, MName, Remark from lj_stock_material"; string sql = "select Id, Code, StockName, MTypeId, MTypeName, MId, MName, Remark from lj_stock_material";

@ -176,6 +176,9 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PlugInPlatform\Mesnac.PlugIn.dll</HintPath> <HintPath>..\..\..\PlugInPlatform\Mesnac.PlugIn.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Office.Interop.Excel">
<HintPath>..\..\Microsoft.Office.Interop.Excel.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

@ -54,7 +54,7 @@ namespace DataBlockHelper.DBHelpers
List<NoVal> ls = new List<NoVal>(); List<NoVal> ls = new List<NoVal>();
var b = bytes.Skip(53).Take(1).First(); var b = bytes.Skip(53).Take(1).First();
for (int i = 0; i <4; i++) for (int i = 0; i <8; i++)
{ {
int no = i + 1; int no = i + 1;
ls.Add(new NoVal() ls.Add(new NoVal()
@ -88,7 +88,7 @@ namespace DataBlockHelper.DBHelpers
int start = 54; int start = 54;
List<SetValue> ls = new List<SetValue>(); List<SetValue> ls = new List<SetValue>();
for (int i = 0; i < 8; i++) for (int i = 0; i < 4; i++)
{ {
int no = i + 1; int no = i + 1;
var b = bytes.Skip(start).Take(8).ToArray(); var b = bytes.Skip(start).Take(8).ToArray();

@ -7,48 +7,173 @@ namespace DataBlockHelper.DBHelpers
private static readonly string DbName = "DB2105"; private static readonly string DbName = "DB2105";
public static void WriteSetValueH1(SetValue setValue) public static void WriteStartJob1()
{ {
WriteSetValue(54, setValue); var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.0",true);
}
public static void WriteStopJob1()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.0",false);
} }
public static void WriteSetValueH2(SetValue setValue) public static void WriteStartJob2()
{ {
WriteSetValue(62, setValue); var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.1",true);
} }
public static void WriteSetValueH3(SetValue setValue) public static void WriteStopJob2()
{ {
WriteSetValue(70, setValue); var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.1",false);
} }
public static void WriteSetValueH4(SetValue setValue) public static void WriteStartJob3()
{ {
WriteSetValue(78, setValue); var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.2",true);
}
public static void WriteStopJob3()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.2",false);
}
public static void WriteStartJob4()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.3",true);
}
public static void WriteStopJob4()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.3",false);
}
public static void WriteStartJob5()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.4",true);
}
public static void WriteStopJob5()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.4",false);
}
public static void WriteStartJob6()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.5",true);
}
public static void WriteStopJob6()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.5",false);
}
public static void WriteStartJob7()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.6",true);
}
public static void WriteStopJob7()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.6",false);
}
public static void WriteStartJob8()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.7",true);
}
public static void WriteStopJob8()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:52.7",false);
}
public static void WriteManScrewH1()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:53.0",true);
} }
public static void WriteSetValueH5(SetValue setValue) public static void WriteManScrewH2()
{ {
WriteSetValue(86, setValue); var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:53.1",true);
} }
public static void WriteSetValueH6(SetValue setValue) public static void WriteManScrewH3()
{ {
WriteSetValue(86, setValue); var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:53.2",true);
} }
public static void WriteSetValueH7(SetValue setValue) public static void WriteManScrewH4()
{ {
WriteSetValue(94, setValue); var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:53.3",true);
} }
public static void WriteSetValueH8(SetValue setValue) public static void WriteManScrewH5()
{ {
WriteSetValue(102, setValue); var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:53.4",true);
}
public static void WriteManScrewH6()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:53.5",true);
}
public static void WriteManScrewH7()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:53.6",true);
}
public static void WriteManScrewH8()
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}:53.7",true);
} }
public static void WriteSetValueH1(SetValue setValue)
{
WriteSetValue(54, setValue);
}
public static void WriteSetValueH2(SetValue setValue)
{
WriteSetValue(62, setValue);
}
public static void WriteSetValueH3(SetValue setValue)
{
WriteSetValue(70, setValue);
}
public static void WriteSetValueH4(SetValue setValue)
{
WriteSetValue(78, setValue);
}
private static void WriteSetValue(int start,SetValue setValue) private static void WriteSetValue(int start,SetValue setValue)
{ {

Loading…
Cancel
Save