dep
wangsr 12 months ago
commit 122c196b5f

@ -2,6 +2,7 @@
using DataBlockHelper.DBHelpers;
using DataBlockHelper.Entity.DB2106Entity;
using DataBlockHelper.Entity.DB2107Entity;
using DataBlockHelper.Entity.DB2111Entity;
using DevExpress.Utils.Extensions;
using DevExpress.XtraPrinting;
@ -35,25 +36,107 @@ namespace Mesnac.Action.ChemicalWeighing.Report
/// </summary>
public static void ReadFeededDry()
{
DB2107Helper dB2107Helper = new DB2107Helper();
var nornalStatus = dB2107Helper.NormalStatus;
DB2111Helper dB2111Helper = new DB2111Helper();
//黑粉准备好信号
if (nornalStatus.spare1)
{
FeededDry(1, dB2111Helper.DryDosing_A);
}
if (nornalStatus.spare2)
{
FeededDry(2, dB2111Helper.DryDosing_B);
}
if (nornalStatus.spare3)
{
FeededDry(3, dB2111Helper.DryDosing_C);
}
if (nornalStatus.spare4)
{
FeededDry(4, dB2111Helper.DryDosing_D);
}
DB2105Helper dB2105Helper = new DB2105Helper();
List<bool> list = dB2105Helper.FeededDryList();
for (int i = 0; i < list.Count; i++)
//水
if (nornalStatus.RdyRpt_W1)
{
if (list[i])
FeededWaterHA(dB2111Helper.hwReport_A);
}
if (nornalStatus.RdyRpt_W2)
{
FeededWaterCA(dB2111Helper.cwReport_A);
}
//热水B
if (nornalStatus.RdyRpt_W3)
{
FeededWaterHB(dB2111Helper.hwReport_B);
}
if (nornalStatus.RdyRpt_W4)
{
var feedValue = new DB2107Helper().Weter[i].FeedValue.ToString("0.#");
LoggingService<ReportReadDb>.Debug($"{i + 1}:{feedValue}");
var deviceno = (i + 3) / 2;
// 螺旋1启动向湿混机1
string logName = $"螺旋{deviceno}向湿混机实际{i + 1}";
FeededWaterCB(dB2111Helper.cwReport_B);
}
}
//热水A
private static void FeededWaterHA(ReportDosEntity entity)
{
var actValue = Convert.ToInt32(entity.actValue);
string logName = $"热水秤A向 [{entity.eqNo}] 加水 {actValue}";
LoggingService<ReportReadDb>.Info(logName);
LjLogControl.ManualLogControl(logName, actValue, 2, entity.eqNo, 1);
DB2107WriteHelper.CleanWater(1);
}
private static void FeededWaterCA(ReportDosEntity entity)
{
var actValue = Convert.ToInt32(entity.actValue);
string logName = $"冷水秤A向 [{entity.eqNo}] 加水 {actValue}";
LoggingService<ReportReadDb>.Info(logName);
var value = Convert.ToInt32(Convert.ToDouble(feedValue));
LjLogControl.ManualLogControl(logName, value, 4, i + 1, 2);
DB2105WriteHelper.WriteFalseFeededDry(i + 1);
LjLogControl.ManualLogControl(logName, actValue, 2, entity.eqNo, 1);
DB2107WriteHelper.CleanWater(2);
}
private static void FeededWaterHB(ReportDosEntity entity)
{
var actValue = Convert.ToInt32(entity.actValue);
string logName = $"热水秤B向 [{entity.eqNo+4}] 加水 {actValue}";
LoggingService<ReportReadDb>.Info(logName);
LjLogControl.ManualLogControl(logName, actValue, 2, entity.eqNo+4, 1);
DB2107WriteHelper.CleanWater(3);
}
private static void FeededWaterCB(ReportDosEntity entity)
{
var actValue = Convert.ToInt32(entity.actValue);
string logName = $"冷水秤B向 [{entity.eqNo + 4}] 加水 {actValue}";
LoggingService<ReportReadDb>.Info(logName);
LjLogControl.ManualLogControl(logName, actValue, 2, entity.eqNo + 4, 1);
DB2107WriteHelper.CleanWater(4);
}
private static void FeededDry(int deviceno, ReportDosEntity entity)
{
int no = deviceno * 2;
if (entity.eqNo == 1)
{
no = deviceno-1;
}
var actValue = Convert.ToInt32(entity.actValue);
string logName = $"螺旋{deviceno}向湿混机 [{no}] 投料 {actValue}";
LoggingService<ReportReadDb>.Info(logName);
LjLogControl.ManualLogControl(logName, actValue, 4, no, 2);
DB2107WriteHelper.CleanSpare(deviceno);
}
public static void ReadReport()
@ -483,8 +566,12 @@ namespace Mesnac.Action.ChemicalWeighing.Report
break;
}
}
if(lde.Count > 0)
{
FreeSqlUnit.Instance.Insert(report).ExecuteAffrows();
FreeSqlUnit.Instance.Insert(lde).ExecuteAffrows();
}
}
}
}

@ -43,7 +43,8 @@ namespace Mesnac.Action.ChemicalWeighing.Test
public void theout(object source, EventArgs e)
{
LoggingService<TestAction>.InfoFormatted("定时器开始运行");
ReportReadDb.ReadReport();
}
public void Run(RuntimeParameter runtime)
@ -69,7 +70,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test
mCButton.Click += MCButton_Click;
System.Timers.Timer t = new System.Timers.Timer(5000);//实例化Timer类设置间隔时间为10000毫秒
System.Timers.Timer t = new System.Timers.Timer(1000*20);//实例化Timer类设置间隔时间为10000毫秒
t.Elapsed += new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;
t.AutoReset = true;//设置是执行一次false还是一直执行(true)
t.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件
@ -78,7 +79,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test
private void MCButton_Click(object sender, EventArgs e)
{
// ReportReadDb.ReadFeededDry();
ReportReadDb.ReadFeededDry();
var list= DB2105WriteHelper.GetWaterStatus();
}

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBlockHelper.DBHelpers
{
public class DB2107WriteHelper
{
static string DbName = "DB2107";
public static void CleanSpare(int no)
{
int dian = no + 1;
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.8.{dian}", false);
}
public static void CleanWater(int no)
{
int dian = no + 1;
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.5.{dian}", false);
}
}
}

@ -19,6 +19,7 @@ namespace DataBlockHelper.DBHelpers
public ReportDosEntity hwReport_B => new ReportDosEntity(bytes, 1528);
public ReportDosEntity cwReport_A => new ReportDosEntity(bytes, 1550);
public ReportDosEntity cwReport_B => new ReportDosEntity(bytes, 1572);
public ReportDosEntity DryDosing_A => new ReportDosEntity(bytes, 1594);
public ReportDosEntity DryDosing_B => new ReportDosEntity(bytes, 1616);
public ReportDosEntity DryDosing_C => new ReportDosEntity(bytes, 1638);

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBlockHelper.DBHelpers
{
public class DB2111Writer
{
}
}

@ -56,7 +56,9 @@
<Compile Include="DBHelpers\DB2105Helper.cs" />
<Compile Include="DBHelpers\DB2105WriteHelper.cs" />
<Compile Include="DBHelpers\DB2106Helper.cs" />
<Compile Include="DBHelpers\DB2107WriteHelper.cs" />
<Compile Include="DBHelpers\DB2111Helper.cs" />
<Compile Include="DBHelpers\DB2111Writer.cs" />
<Compile Include="DBHelpers\DB2119Helper.cs" />
<Compile Include="DBHelpers\DB2119WriteHelper.cs" />
<Compile Include="DBHelpers\Db3000Helper.cs" />

@ -61,6 +61,12 @@ namespace DataBlockHelper.Entity.DB2107Entity
RdyRpt_M7 = byt.GetBit(0);
RdyRpt_M8 = byt.GetBit(1);
spare1= byt.GetBit(2);
spare2 = byt.GetBit(3);
spare3 = byt.GetBit(4);
spare4 = byt.GetBit(5);
}
public int WatchDog { get; private set; }
@ -98,5 +104,11 @@ namespace DataBlockHelper.Entity.DB2107Entity
public bool RdyRpt_M6 { get; private set; }
public bool RdyRpt_M7 { get; private set; }
public bool RdyRpt_M8 { get; private set; }
public bool spare1 { get; private set; }
public bool spare2 { get; private set; }
public bool spare3 { get; private set; }
public bool spare4 { get; private set; }
}
}

@ -1,3 +1,3 @@
<DataSources>
<DataSourceItem Name="DataSource1" Driver="MS SQL Server" Server="127.0.0.1" UserName="sa" Password="123456" DataBase="CWSSHG" ConnectionTimeout="5" DriverAssembly="ICSharpCode.Data.SQLServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DriverClass="ICSharpCode.Data.Core.DatabaseDrivers.SQLServer.SQLServerDatabaseDriver" DataSourceClass="ICSharpCode.Data.Core.DatabaseObjects.Database" />
<DataSourceItem Name="DataSource1" Driver="MS SQL Server" Server="192.168.0.100" UserName="sa" Password="123456" DataBase="CWSSHG" ConnectionTimeout="5" DriverAssembly="ICSharpCode.Data.SQLServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DriverClass="ICSharpCode.Data.Core.DatabaseDrivers.SQLServer.SQLServerDatabaseDriver" DataSourceClass="ICSharpCode.Data.Core.DatabaseObjects.Database" />
</DataSources>
Loading…
Cancel
Save