修改数据

dep
我叫锄头 12 months ago
parent 13e1c20a05
commit d424bf4891

@ -743,57 +743,57 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
case 1: case 1:
PowderDownSignel(MinAnPlc.Heir1, 1); PowderDownSignel(MinAnPlc.Heir1, 1);
DB2105WriteHelper.WriteSetValueH1(value); DB2105WriteHelper.WriteSetValueL1(value);
DB2105WriteHelper.WriteH(1, "L", true); DB2105WriteHelper.WriteHNo(1, "L", true);
// DB2105WriteHelper.WriteManScrewH1(); // DB2105WriteHelper.WriteManScrewH1();
break; break;
case 2: case 2:
PowderDownSignel(MinAnPlc.Heir1, 1); PowderDownSignel(MinAnPlc.Heir1, 1);
DB2105WriteHelper.WriteSetValueH1(value); DB2105WriteHelper.WriteSetValueR1(value);
DB2105WriteHelper.WriteH(1, "R", true); DB2105WriteHelper.WriteHNo(1, "R", true);
// DB2105WriteHelper.WriteManScrewH2(); // DB2105WriteHelper.WriteManScrewH2();
break; break;
case 3: case 3:
PowderDownSignel(MinAnPlc.Heir2, 2); PowderDownSignel(MinAnPlc.Heir2, 2);
DB2105WriteHelper.WriteSetValueH2(value); DB2105WriteHelper.WriteSetValueL2(value);
DB2105WriteHelper.WriteH(2, "L", true); DB2105WriteHelper.WriteHNo(2, "L", true);
// DB2105WriteHelper.WriteManScrewH3(); // DB2105WriteHelper.WriteManScrewH3();
break; break;
case 4: case 4:
PowderDownSignel(MinAnPlc.Heir2, 2); PowderDownSignel(MinAnPlc.Heir2, 2);
DB2105WriteHelper.WriteSetValueH2(value); DB2105WriteHelper.WriteSetValueR2(value);
DB2105WriteHelper.WriteH(2, "R", true); DB2105WriteHelper.WriteHNo(2, "R", true);
// DB2105WriteHelper.WriteManScrewH4(); // DB2105WriteHelper.WriteManScrewH4();
break; break;
case 5: case 5:
PowderDownSignel(MinAnPlc.Heir3, 3); PowderDownSignel(MinAnPlc.Heir3, 3);
DB2105WriteHelper.WriteSetValueH3(value); DB2105WriteHelper.WriteSetValueL3(value);
DB2105WriteHelper.WriteH(3, "L", true); DB2105WriteHelper.WriteHNo(3, "L", true);
//DB2105WriteHelper.WriteManScrewH5(); //DB2105WriteHelper.WriteManScrewH5();
break; break;
case 6: case 6:
PowderDownSignel(MinAnPlc.Heir3, 3); PowderDownSignel(MinAnPlc.Heir3, 3);
DB2105WriteHelper.WriteSetValueH3(value); DB2105WriteHelper.WriteSetValueR3(value);
DB2105WriteHelper.WriteH(3, "R", true); DB2105WriteHelper.WriteHNo(3, "R", true);
// DB2105WriteHelper.WriteManScrewH6(); // DB2105WriteHelper.WriteManScrewH6();
break; break;
case 7: case 7:
PowderDownSignel(MinAnPlc.Heir4, 4); PowderDownSignel(MinAnPlc.Heir4, 4);
DB2105WriteHelper.WriteSetValueH4(value); DB2105WriteHelper.WriteSetValueL4(value);
DB2105WriteHelper.WriteH(4, "L", true); DB2105WriteHelper.WriteHNo(4, "L", true);
// DB2105WriteHelper.WriteManScrewH7(); // DB2105WriteHelper.WriteManScrewH7();
break; break;
case 8: case 8:
PowderDownSignel(MinAnPlc.Heir4, 4); PowderDownSignel(MinAnPlc.Heir4, 4);
DB2105WriteHelper.WriteSetValueH4(value); DB2105WriteHelper.WriteSetValueR4(value);
DB2105WriteHelper.WriteH(4, "R", true); DB2105WriteHelper.WriteHNo(4, "R", true);
//DB2105WriteHelper.WriteManScrewH8(); //DB2105WriteHelper.WriteManScrewH8();
break; break;
@ -820,36 +820,66 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
public static bool WetSetWeight(SetValue value, MCRadioButtonEntity RadioE) public static bool WetSetWeight(SetValue value, MCRadioButtonEntity RadioE)
{ {
var singE = ControlsHelper.SingleSelect(RadioE); var singE = ControlsHelper.SingleSelect(RadioE);
switch (singE) switch (singE)
{ {
case 1: case 1:
DB2105WriteHelper.WriteSetValueL1(value);
// DB2105WriteHelper.WriteManScrewH1();
break;
case 2: case 2:
DB2105WriteHelper.WriteSetValueH1(value);
DB2105WriteHelper.WriteSetValueR1(value);
// DB2105WriteHelper.WriteManScrewH2();
break; break;
case 3: case 3:
case 4:
DB2105WriteHelper.WriteSetValueH2(value); DB2105WriteHelper.WriteSetValueL2(value);
// DB2105WriteHelper.WriteManScrewH3();
break; break;
case 4:
DB2105WriteHelper.WriteSetValueR2(value);
// DB2105WriteHelper.WriteManScrewH4();
break;
case 5: case 5:
case 6:
DB2105WriteHelper.WriteSetValueH3(value); DB2105WriteHelper.WriteSetValueL3(value);
//DB2105WriteHelper.WriteManScrewH5();
break; break;
case 6:
DB2105WriteHelper.WriteSetValueR3(value);
// DB2105WriteHelper.WriteManScrewH6();
break;
case 7: case 7:
case 8:
DB2105WriteHelper.WriteSetValueH4(value); DB2105WriteHelper.WriteSetValueL4(value);
// DB2105WriteHelper.WriteManScrewH7();
break; break;
case 8:
DB2105WriteHelper.WriteSetValueR4(value);
//DB2105WriteHelper.WriteManScrewH8();
break;
default: default:
MessageBox.Show("当前未选择产线!"); MessageBox.Show("当前未选择产线!");
return false; return false;
@ -872,7 +902,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
{ {
var singE = ControlsHelper.SingleSelect(RadioE); var singE = ControlsHelper.SingleSelect(RadioE);
int no = (singE + 1) / 2; int no = (singE + 1) / 2;
DB2105WriteHelper.WriteH(no, "S", true); DB2105WriteHelper.WriteHNo(no, "S", true);
} }

@ -83,6 +83,8 @@ namespace DataBlockHelper.DBHelpers
{ {
var instanceByteTransform = PlcConnect.Instance.ByteTransform; var instanceByteTransform = PlcConnect.Instance.ByteTransform;
var ls = this.bytes = PlcConnect.Instance.Read($"DB2104.{start}.0", 16).Content; var ls = this.bytes = PlcConnect.Instance.Read($"DB2104.{start}.0", 16).Content;
if (ls != null)
{
WaterEntity entity = new WaterEntity WaterEntity entity = new WaterEntity
{ {
Bin = instanceByteTransform.TransInt16(ls, 0), Bin = instanceByteTransform.TransInt16(ls, 0),
@ -93,6 +95,8 @@ namespace DataBlockHelper.DBHelpers
}; };
return entity; return entity;
}
return new WaterEntity();
} }

@ -12,7 +12,7 @@ namespace DataBlockHelper.DBHelpers
{ {
public DB2105Helper() public DB2105Helper()
{ {
this.bytes = PlcConnect.Instance.Read("DB2105.0.0", 206).Content; this.bytes = PlcConnect.Instance.Read("DB2105.0.0", 222).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();
@ -151,18 +151,19 @@ namespace DataBlockHelper.DBHelpers
public bool FeededDry => ReadReady(110, 4); public bool FeededDry => ReadReady(110, 4);
//
public ManualH H1 => ReadH(134); public ManualH H1 => ReadH(134);
public ManualH H2 => ReadH(144); public ManualH H2 => ReadH(148);
public ManualH H3 => ReadH(154); public ManualH H3 => ReadH(162);
public ManualH H4 => ReadH(164); public ManualH H4 => ReadH(176);
public ForceWaterEntity Force_HA => new ForceWaterEntity(bytes, 174); public ForceWaterEntity Force_HA => new ForceWaterEntity(bytes, 190);
public ForceWaterEntity Force_HB => new ForceWaterEntity(bytes, 182); public ForceWaterEntity Force_HB => new ForceWaterEntity(bytes, 198);
public ForceWaterEntity Force_CA => new ForceWaterEntity(bytes, 190); public ForceWaterEntity Force_CA => new ForceWaterEntity(bytes, 206);
public ForceWaterEntity Force_CB => new ForceWaterEntity(bytes, 198); public ForceWaterEntity Force_CB => new ForceWaterEntity(bytes, 214);
/// <summary> /// <summary>
/// 获取所有的 feededDry 是不是读取好了 /// 获取所有的 feededDry 是不是读取好了
@ -220,16 +221,17 @@ namespace DataBlockHelper.DBHelpers
{ {
ManualH manual = new ManualH(); ManualH manual = new ManualH();
var content = bytes.Skip(start).Take(10).ToArray(); var content = bytes.Skip(start).Take(14).ToArray();
var first = bytes.Skip(start).Take(1).First(); var first = bytes.Skip(start).Take(1).First();
manual.FeedStartL = first.GetBit(0); manual.FeedStartL = first.GetBit(0);
manual.FeedStartR = first.GetBit(1); manual.FeedStartR = first.GetBit(1);
manual.FeedStop = first.GetBit(2); manual.FeedStop = first.GetBit(2);
manual.RunStatus = first.GetBit(3); manual.RunStatus = first.GetBit(3);
manual.SetValue = PlcConnect.Instance.ByteTransform.TransSingle(content, 2);
manual.Toterance = PlcConnect.Instance.ByteTransform.TransSingle(content, 6);
manual.SetValueL = PlcConnect.Instance.ByteTransform.TransSingle(content, 2);
manual.SetValueR = PlcConnect.Instance.ByteTransform.TransSingle(content, 6);
manual.Toterance = PlcConnect.Instance.ByteTransform.TransSingle(content, 10);
return manual; return manual;
} }
@ -259,7 +261,9 @@ namespace DataBlockHelper.DBHelpers
public bool FeedStartR { get; set; } public bool FeedStartR { get; set; }
public bool FeedStop { get; set; } public bool FeedStop { get; set; }
public bool RunStatus { get; set; } public bool RunStatus { get; set; }
public float SetValue { get; set; } public float SetValueL { get; set; }
public float SetValueR { get; set; }
public float Toterance { get; set; } public float Toterance { get; set; }
} }

@ -159,28 +159,49 @@ namespace DataBlockHelper.DBHelpers
/// 换一个数据区 134 /// 换一个数据区 134
/// </summary> /// </summary>
/// <param name="setValue"></param> /// <param name="setValue"></param>
public static void WriteSetValueH1(SetValue setValue) public static void WriteSetValueL1(SetValue setValue)
{ {
WriteH(1, setValue.Value,setValue.Toterance); WriteL(1, setValue.Value,setValue.Toterance);
} }
public static void WriteSetValueH2(SetValue setValue) public static void WriteSetValueR1(SetValue setValue)
{ {
WriteH(2, setValue.Value, setValue.Toterance); WriteR(1, setValue.Value, setValue.Toterance);
} }
public static void WriteSetValueH3(SetValue setValue) public static void WriteSetValueL2(SetValue setValue)
{ {
WriteH(3, setValue.Value, setValue.Toterance); WriteL(2, setValue.Value, setValue.Toterance);
} }
public static void WriteSetValueH4(SetValue setValue) public static void WriteSetValueR2(SetValue setValue)
{ {
WriteH(4, setValue.Value, setValue.Toterance); WriteR(2, setValue.Value, setValue.Toterance);
} }
public static void WriteSetValueL3(SetValue setValue)
{
WriteL(3, setValue.Value, setValue.Toterance);
}
public static void WriteSetValueR3(SetValue setValue)
{
WriteR(3, setValue.Value, setValue.Toterance);
}
public static void WriteSetValueL4(SetValue setValue)
{
WriteL(4, setValue.Value, setValue.Toterance);
}
public static void WriteSetValueR4(SetValue setValue)
{
WriteR(4, setValue.Value, setValue.Toterance);
}
private static void WriteSetValue(int start,SetValue setValue) private static void WriteSetValue(int start,SetValue setValue)
{ {
@ -413,11 +434,11 @@ namespace DataBlockHelper.DBHelpers
public static bool WriteH(int no,string t, bool b) public static bool WriteHNo(int no,string t, bool b)
{ {
var siemensS7Net = PlcConnect.Instance; var siemensS7Net = PlcConnect.Instance;
int start = 134; int start = 134;
int db=start+((no - 1)*10); int db=start+((no - 1)*14);
int dian = 0; int dian = 0;
if (t == "L") if (t == "L")
{ {
@ -443,21 +464,36 @@ namespace DataBlockHelper.DBHelpers
} }
public static bool WriteH(int no,float value,float tolerance) public static bool WriteL(int no, float value, float tolerance)
{
var siemensS7Net = PlcConnect.Instance;
int start = 134;
int db = start + ((no - 1) * 14);
var operate = siemensS7Net.Write($"{DbName}.{db + 2}.0", value);
operate = siemensS7Net.Write($"{DbName}.{db + 10}.0", tolerance);
return operate.IsSuccess;
}
public static bool WriteR(int no, float value, float tolerance)
{ {
var siemensS7Net = PlcConnect.Instance; var siemensS7Net = PlcConnect.Instance;
int start = 134; int start = 134;
int db = start + ((no - 1) * 10); int db = start + ((no - 1) * 14);
var operate = siemensS7Net.Write($"{DbName}.{db+2}.0", value); var operate = siemensS7Net.Write($"{DbName}.{db + 6}.0", value);
operate = siemensS7Net.Write($"{DbName}.{db+6}.0", tolerance); operate = siemensS7Net.Write($"{DbName}.{db + 10}.0", tolerance);
return operate.IsSuccess; return operate.IsSuccess;
} }
private static readonly int HaNo = 174;
public static readonly int HbNo = 182;
private static readonly int CaNo = 190;
private static readonly int CbNo = 198; private static readonly int HaNo = 190;
public static readonly int HbNo = 198;
private static readonly int CaNo = 206;
private static readonly int CbNo = 214;
#region 添加方法Ha #region 添加方法Ha

Loading…
Cancel
Save