干混机称量准备好

dep
我叫锄头 1 year ago
parent aaa4338292
commit 6748c7fe4c

@ -4,12 +4,19 @@ using DataBlockHelper.Entity.DB2106Entity;
using DataBlockHelper.Entity.DB2107Entity; using DataBlockHelper.Entity.DB2107Entity;
using DevExpress.Utils.Extensions; using DevExpress.Utils.Extensions;
using DevExpress.XtraPrinting;
using HslCommunication.Enthernet;
using ICSharpCode.Core; using ICSharpCode.Core;
using Mesnac.Action.ChemicalWeighing.Alarm.PmtAlarm;
using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Action.ChemicalWeighing.FreeDb; using Mesnac.Action.ChemicalWeighing.FreeDb;
using Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity; using Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity;
using Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity.Report; using Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity.Report;
using Mesnac.Action.ChemicalWeighing.ManualControl;
using Mesnac.Basic;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -22,6 +29,67 @@ namespace Mesnac.Action.ChemicalWeighing.Report
{ {
public class ReportReadDb public class ReportReadDb
{ {
/// <summary>
/// 干混料插入日志
/// </summary>
public static void ReadFeededDry()
{
LoggingService<ReportReadDb>.Debug("读取加料信息"+DateTime.Now.ToString());
DB2105Helper dB2105Helper = new DB2105Helper();
List<bool> list=dB2105Helper.FeededDryList();
for (int i = 0; i < list.Count; i++)
{
if (list[i])
{
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}";
LoggingService<ReportReadDb>.Info(logName);
var value = Convert.ToInt32(Convert.ToDouble(feedValue));
ManualLogControl(logName, value, 5, i + 1);
DB2105WriteHelper.WriteFalseFeededDry(i + 1);
}
}
}
/// <summary>
/// 日志插入
/// </summary>
/// <param name="logName">日志内容</param>
/// <param name="value">值</param>
/// <param name="valuekind">值类型 0无 1水称设定值 2水称称量值 3螺旋设定值 4螺旋称量值</param>
/// <param name="deviceno">设备编号</param>
/// <param name="devicekind">设备类型 0无 1水称 2螺旋</param>
private static void ManualLogControl(string logName, int value, int valuekind, int deviceno)
{
var Log = new ManualLogEntity()
{
logtext = logName,
logtime = DateTime.Now,
userid = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
value = value,
deviceno = deviceno,
devicekind = 2,
valuekind = valuekind,
createdate = DateTime.Now.ToString("yyyyMMdd")
};
FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity();
}
public static void Read() public static void Read()
{ {
LoggingService<ReportReadDb>.InfoFormatted("开始读取报表"); LoggingService<ReportReadDb>.InfoFormatted("开始读取报表");

@ -43,7 +43,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test
public void theout(object source, EventArgs e) public void theout(object source, EventArgs e)
{ {
// ReportReadDb.Read();
} }
public void Run(RuntimeParameter runtime) public void Run(RuntimeParameter runtime)
@ -60,14 +60,11 @@ namespace Mesnac.Action.ChemicalWeighing.Test
this.hslMove.ForeColor = Color.Yellow; this.hslMove.ForeColor = Color.Yellow;
this.hslMove.Margin = new Padding(5, 6, 5, 6); this.hslMove.Margin = new Padding(5, 6, 5, 6);
this.hslMove.MoveSpeed = 20f; this.hslMove.MoveSpeed = 2f;
this.hslMove.Size = new Size(726, 49); this.hslMove.Size = new Size(726, 49);
this.hslMove.TabIndex = 8; this.hslMove.TabIndex = 8;
this.hslMove.Text = @"公告这是一条测试的公告信息11111111111111111111111111111111111111111111111111111111111" + this.hslMove.Text = @"公告:这是一条测试的公告信息";
"1111111111111112312321" +
"3213213213213" +
"3213333333333333333311111。";
mCButton.Click += MCButton_Click; mCButton.Click += MCButton_Click;
@ -81,7 +78,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test
private void MCButton_Click(object sender, EventArgs e) private void MCButton_Click(object sender, EventArgs e)
{ {
new HttpResponse().GetLGInfo(); ReportReadDb.ReadFeededDry();
} }
} }
} }

@ -12,7 +12,7 @@ namespace DataBlockHelper.DBHelpers
{ {
public DB2105Helper() public DB2105Helper()
{ {
this.bytes = PlcConnect.Instance.Read("DB2105.0.0", 126).Content; this.bytes = PlcConnect.Instance.Read("DB2105.0.0", 134).Content;
} }
public List<PlanEntity> Plan => new PlanArrayManager(4, 0, 12, bytes).GetList(); public List<PlanEntity> Plan => new PlanArrayManager(4, 0, 12, bytes).GetList();
public bool[] Status => new FourBoolArrayManager(48, bytes).GetList(); public bool[] Status => new FourBoolArrayManager(48, bytes).GetList();
@ -144,6 +144,28 @@ namespace DataBlockHelper.DBHelpers
public bool ReadReadyM8 => ReadReadyM(124); public bool ReadReadyM8 => ReadReadyM(124);
/// <summary>
/// M1
/// </summary>
public bool FeededDry => ReadReady(110, 4);
/// <summary>
/// 获取所有的 feededDry 是不是读取好了
/// </summary>
/// <returns></returns>
public List<bool> FeededDryList()
{
List<bool> ls = new List<bool>(8);
for (int i = 110; i <=124; i=i+2)
{
ls.Add(ReadReady(i, 4));
}
return ls;
}
//94 //94
public List<bool> ReadReady(int start) public List<bool> ReadReady(int start)
{ {
@ -165,6 +187,14 @@ namespace DataBlockHelper.DBHelpers
var first = bytes.Skip(start).Take(1).First(); var first = bytes.Skip(start).Take(1).First();
return first.GetBit(1); return first.GetBit(1);
} }
public bool ReadReady(int start,int bit)
{
var first = bytes.Skip(start).Take(1).First();
return first.GetBit(bit);
}
} }
@ -185,4 +215,8 @@ namespace DataBlockHelper.DBHelpers
} }

@ -388,6 +388,22 @@ namespace DataBlockHelper.DBHelpers
var operate= siemensS7Net.Write($"{DbName}.{start}.0", true); var operate= siemensS7Net.Write($"{DbName}.{start}.0", true);
return operate.IsSuccess; return operate.IsSuccess;
} }
/// <summary>
/// 传入机台1~8 自动清零
/// </summary>
/// <param name="no"></param>
/// <returns></returns>
public static bool WriteFalseFeededDry(int no)
{
int start = 110;
int n = start+((no - 1)*2);
var siemensS7Net = PlcConnect.Instance;
var operate = siemensS7Net.Write($"{DbName}.{n}.4", false);
return operate.IsSuccess;
}

Loading…
Cancel
Save