水称下传 水秤添加 differ 和 stand

dep
我叫锄头 12 months ago
parent 333de46638
commit bcb198e65a

@ -78,7 +78,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
return; return;
} }
WaterDownload(TextE); WaterDownload(TextE,ComboE);
} }
#endregion #endregion

@ -44,6 +44,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.Entity
public MCCombobox DryM12 { get; set; } public MCCombobox DryM12 { get; set; }
public MCCombobox PasteChooseDry { get; set; } public MCCombobox PasteChooseDry { get; set; }
public MCCombobox PasteChooseWet { get; set; } public MCCombobox PasteChooseWet { get; set; }
public MCCombobox CALeftOrRight { get; set; } public MCCombobox CALeftOrRight { get; set; }
public MCCombobox HALeftOrRight { get; set; } public MCCombobox HALeftOrRight { get; set; }
public MCCombobox CBLeftOrRight { get; set; } public MCCombobox CBLeftOrRight { get; set; }
@ -137,6 +139,11 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.Entity
public MCTextBox HADeviation { get; set; } public MCTextBox HADeviation { get; set; }
public MCTextBox CBDeviation { get; set; } public MCTextBox CBDeviation { get; set; }
public MCTextBox HBDeviation { get; set; } public MCTextBox HBDeviation { get; set; }
} }
} }

@ -1,5 +1,7 @@
using DataBlockHelper.DBHelpers; using DataBlockHelper.DBHelpers;
using DevExpress.DataAccess.Wizard.Presenters; using DevExpress.DataAccess.Wizard.Presenters;
using DevExpress.XtraEditors.Filtering.Templates;
using Mesnac.Action.Base; using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.AutoControl.DB; using Mesnac.Action.ChemicalWeighing.AutoControl.DB;
using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; using Mesnac.Action.ChemicalWeighing.AutoControl.Entity;
@ -9,8 +11,10 @@ using Mesnac.Action.ChemicalWeighing.LjPlanning;
using Mesnac.Controls.Base; using Mesnac.Controls.Base;
using Mesnac.Controls.Default; using Mesnac.Controls.Default;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -39,6 +43,15 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
McControls = GetAllControls(); McControls = GetAllControls();
ControlsHelper.ControlImport<MCTextBox>(TextE, McControls); ControlsHelper.ControlImport<MCTextBox>(TextE, McControls);
// McControls.FirstOrDefault(x => x.Name == name)
//TextE.HALeftOrRight = McControls.FirstOrDefault(x => x.Name == "HALeftOrRight") as MCCombobox;
//TextE.HBLeftOrRight = McControls.FirstOrDefault(x => x.Name == "HBLeftOrRight") as MCCombobox;
//TextE.CALeftOrRight = McControls.FirstOrDefault(x => x.Name == "CALeftOrRight") as MCCombobox;
//TextE.CBLeftOrRight = McControls.FirstOrDefault(x => x.Name == "CBLeftOrRight") as MCCombobox;
ControlsHelper.ControlImport<MCCombobox>(ComboE, McControls); ControlsHelper.ControlImport<MCCombobox>(ComboE, McControls);
ControlsHelper.ControlImport<MCLabel>(LabelE, McControls); ControlsHelper.ControlImport<MCLabel>(LabelE, McControls);
ControlsHelper.ControlImport<MCRadioButton>(RadioE, McControls); ControlsHelper.ControlImport<MCRadioButton>(RadioE, McControls);
@ -228,6 +241,60 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
s1[i - 1] = "产线" + i; s1[i - 1] = "产线" + i;
} }
ComboE.PasteChooseDry.DataSource = s1; ComboE.PasteChooseDry.DataSource = s1;
DB2104Helper dB2104Helper=new DB2104Helper();
var data = GetTable();
ComboE.CALeftOrRight.DataSource = data.Copy();
ComboE.HALeftOrRight.DataSource = data.Copy();
ComboE.CBLeftOrRight.DataSource = data.Copy();
ComboE.HBLeftOrRight.DataSource = data.Copy();
var ha= dB2104Helper.GetAHotWater;
TextE.HADeviation.MCValue = ha.differ;
ComboE.HALeftOrRight.MCValue = ha.stand;
var hb = dB2104Helper.GetBHotWater;
TextE.HBDeviation.MCValue = hb.differ;
ComboE.HBLeftOrRight.MCValue = hb.stand;
var ca = dB2104Helper.GetAColWater;
TextE.CADeviation.MCValue = ca.differ;
ComboE.CALeftOrRight.MCValue = ca.stand;
var cb = dB2104Helper.GetBColWater;
TextE.CBDeviation.MCValue = cb.differ;
ComboE.CBLeftOrRight.MCValue = cb.stand;
}
private DataTable GetTable()
{
DataTable dataTable = new System.Data.DataTable();
dataTable.Columns.Add("CmbValue", typeof(string));
dataTable.Columns.Add("CmbDisplay", typeof(string));
DataRow dr=dataTable.NewRow();
dr[0] = "0";
dr[1] = "无";
dataTable.Rows.Add(dr);
dr = dataTable.NewRow();
dr[0] = "1";
dr[1] = "左";
dataTable.Rows.Add(dr);
dr = dataTable.NewRow();
dr[0] = "2";
dr[1] = "右";
dataTable.Rows.Add(dr);
return dataTable;
} }
#endregion #endregion

@ -442,7 +442,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
#region 水称下传 #region 水称下传
public static void WaterDownload(MCTextBoxEntity TextE) public static void WaterDownload(MCTextBoxEntity TextE, MCComboBoxEntity ComboE)
{ {
WaterEntity HotA = new WaterEntity(); WaterEntity HotA = new WaterEntity();
WaterEntity ColdA = new WaterEntity(); WaterEntity ColdA = new WaterEntity();
@ -451,6 +451,11 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
float hotASet, hotBSet, coldASet, coldBSet, hotATol, hotBTol, coldATol, coldBTol; float hotASet, hotBSet, coldASet, coldBSet, hotATol, hotBTol, coldATol, coldBTol;
float cADeviation; ushort cALeftOrRight;
float hADeviation; ushort hALeftOrRight;
float cBDeviation; ushort cBLeftOrRight;
float hBDeviation; ushort hBLeftOrRight;
if (float.TryParse(Convert.ToString(TextE.HotValueA.MCValue), out hotASet) && if (float.TryParse(Convert.ToString(TextE.HotValueA.MCValue), out hotASet) &&
float.TryParse(Convert.ToString(TextE.HotToleranceA.MCValue), out hotATol) && float.TryParse(Convert.ToString(TextE.HotToleranceA.MCValue), out hotATol) &&
float.TryParse(Convert.ToString(TextE.HotValueB.MCValue), out hotBSet) && float.TryParse(Convert.ToString(TextE.HotValueB.MCValue), out hotBSet) &&
@ -458,16 +463,39 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
float.TryParse(Convert.ToString(TextE.ColdValueA.MCValue), out coldASet) && float.TryParse(Convert.ToString(TextE.ColdValueA.MCValue), out coldASet) &&
float.TryParse(Convert.ToString(TextE.ColdToleranceA.MCValue), out coldATol) && float.TryParse(Convert.ToString(TextE.ColdToleranceA.MCValue), out coldATol) &&
float.TryParse(Convert.ToString(TextE.ColdValueB.MCValue), out coldBSet) && float.TryParse(Convert.ToString(TextE.ColdValueB.MCValue), out coldBSet) &&
float.TryParse(Convert.ToString(TextE.ColdToleranceB.MCValue), out coldBTol)) float.TryParse(Convert.ToString(TextE.ColdToleranceB.MCValue), out coldBTol)
&& float.TryParse(Convert.ToString(TextE.CADeviation.MCValue), out cADeviation)
&& float.TryParse(Convert.ToString(TextE.HADeviation.MCValue), out hADeviation)
&& float.TryParse(Convert.ToString(TextE.CBDeviation.MCValue), out cBDeviation)
&& float.TryParse(Convert.ToString(TextE.HBDeviation.MCValue), out hBDeviation)
)
{ {
HotA.Set = hotASet; HotA.Set = hotASet;
HotB.Set = hotBSet; HotB.Set = hotBSet;
ColdA.Set = coldASet; ColdA.Set = coldASet;
ColdB.Set = coldBSet; ColdB.Set = coldBSet;
HotA.Tolerance = hotATol; HotA.Tolerance = hotATol;
HotB.Tolerance = hotBTol; HotB.Tolerance = hotBTol;
ColdA.Tolerance = coldATol; ColdA.Tolerance = coldATol;
ColdB.Tolerance = coldBTol; ColdB.Tolerance = coldBTol;
HotA.differ = hADeviation;
HotB.differ = hBDeviation;
ColdA.differ = cADeviation;
ColdB.differ= cBDeviation;
HotA.stand = Convert.ToInt16(ComboE.HALeftOrRight.MCValue);
HotB.stand = Convert.ToInt16(ComboE.HBLeftOrRight.MCValue);
ColdA.stand = Convert.ToInt16(ComboE.CALeftOrRight.MCValue);
ColdB.stand = Convert.ToInt16(ComboE.CBLeftOrRight.MCValue);
Db2104WriteHelper.WriteAHostWater(HotA); Db2104WriteHelper.WriteAHostWater(HotA);
Db2104WriteHelper.WriteBHostWater(HotB); Db2104WriteHelper.WriteBHostWater(HotB);
Db2104WriteHelper.WriteAColWater(ColdA); Db2104WriteHelper.WriteAColWater(ColdA);

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections;
namespace DataBlockHelper.DBHelpers namespace DataBlockHelper.DBHelpers
{ {
@ -13,7 +14,7 @@ namespace DataBlockHelper.DBHelpers
public DB2104Helper() public DB2104Helper()
{ {
this.bytes = PlcConnect.Instance.Read("DB2104.0.0", 3618).Content; this.bytes = PlcConnect.Instance.Read("DB2104.0.0", 3802).Content;
} }
public RecipeCommEntity RecipeComm => RecipeCom(bytes); public RecipeCommEntity RecipeComm => RecipeCom(bytes);
@ -62,34 +63,38 @@ namespace DataBlockHelper.DBHelpers
/// 热水秤B /// 热水秤B
/// </summary> /// </summary>
public WaterEntity GetBHotWater => GetWater(3748); public WaterEntity GetBHotWater => GetWater(3754);
/// <summary> /// <summary>
/// 冷水秤A /// 冷水秤A
/// </summary> /// </summary>
public WaterEntity GetAColWater => GetWater(3758); public WaterEntity GetAColWater => GetWater(3770);
/// <summary> /// <summary>
/// 冷水秤B /// 冷水秤B
/// </summary> /// </summary>
public WaterEntity GetBColWater => GetWater(3768); public WaterEntity GetBColWater => GetWater(3786);
private WaterEntity GetWater(int start) private WaterEntity GetWater(int start)
{ {
var instanceByteTransform = PlcConnect.Instance.ByteTransform; var instanceByteTransform = PlcConnect.Instance.ByteTransform;
var ls = this.bytes = PlcConnect.Instance.Read($"DB2104.{start}.0", 10).Content; var ls = this.bytes = PlcConnect.Instance.Read($"DB2104.{start}.0", 16).Content;
WaterEntity entity = new WaterEntity WaterEntity entity = new WaterEntity
{ {
Bin = instanceByteTransform.TransInt16(ls, 0), Bin = instanceByteTransform.TransInt16(ls, 0),
Set = instanceByteTransform.TransSingle(ls, 2), Set = instanceByteTransform.TransSingle(ls, 2),
Tolerance = instanceByteTransform.TransSingle(ls, 6) Tolerance = instanceByteTransform.TransSingle(ls, 6),
differ = instanceByteTransform.TransSingle(ls, 10),
stand = instanceByteTransform.TransInt16(ls, 14),
}; };
return entity; return entity;
} }

@ -7,21 +7,7 @@ namespace DataBlockHelper.DBHelpers
{ {
private static readonly string DbName = "DB2104"; private static readonly string DbName = "DB2104";
/// <summary>
/// 写入水 写入集合顺序 A热水 B热水 冷水A 冷水B
/// </summary>
/// <param name="ls"></param>
public static bool Write(List<WaterEntity> ls)
{
int start = 3578;
for (int i = 0; i < ls.Count; i++)
{
int no = start + (i * 10);
Write(no, ls[i]);
}
return true;
}
/// <summary> /// <summary>
/// A热水 /// A热水
/// </summary> /// </summary>
@ -37,7 +23,7 @@ namespace DataBlockHelper.DBHelpers
/// <param name="entity"></param> /// <param name="entity"></param>
public static void WriteBHostWater(WaterEntity entity) public static void WriteBHostWater(WaterEntity entity)
{ {
Write(3748, entity); Write(3754, entity);
} }
/// <summary> /// <summary>
/// 冷水A /// 冷水A
@ -45,7 +31,7 @@ namespace DataBlockHelper.DBHelpers
/// <param name="entity"></param> /// <param name="entity"></param>
public static void WriteAColWater(WaterEntity entity) public static void WriteAColWater(WaterEntity entity)
{ {
Write(3758, entity); Write(3770, entity);
} }
/// <summary> /// <summary>
/// 冷水B /// 冷水B
@ -53,7 +39,7 @@ namespace DataBlockHelper.DBHelpers
/// <param name="entity"></param> /// <param name="entity"></param>
public static void WriteBColWater(WaterEntity entity) public static void WriteBColWater(WaterEntity entity)
{ {
Write(3768, entity); Write(3786, entity);
} }
@ -63,6 +49,8 @@ namespace DataBlockHelper.DBHelpers
siemensS7Net.Write($"{DbName}.{start}.0", entity.Bin); siemensS7Net.Write($"{DbName}.{start}.0", entity.Bin);
siemensS7Net.Write($"{DbName}.{start+2}.0", entity.Set); siemensS7Net.Write($"{DbName}.{start+2}.0", entity.Set);
siemensS7Net.Write($"{DbName}.{start+6}.0", entity.Tolerance); siemensS7Net.Write($"{DbName}.{start+6}.0", entity.Tolerance);
siemensS7Net.Write($"{DbName}.{start + 10}.0", entity.differ);
siemensS7Net.Write($"{DbName}.{start + 14}.0", entity.stand);
} }
} }
} }

@ -5,5 +5,9 @@
public short Bin { get; set; } public short Bin { get; set; }
public float Set { get; set; } public float Set { get; set; }
public float Tolerance { get; set; } public float Tolerance { get; set; }
public float differ { get; set; }
public short stand { get; set; }
} }
} }
Loading…
Cancel
Save