dev
liuwf 1 year ago
parent f808c8f1f0
commit 64f95f2115

@ -1,5 +1,6 @@
using Admin.Core.Common.Helper;
using Aucma.Core.HwPLc;
using Aucma.Core.OldBoxFoam.Models;
using System;
using System.Collections.Generic;
using System.Linq;
@ -16,6 +17,15 @@ namespace Aucma.Core.OldBoxFoam.Business
public HwPLc.PlcModel plc2 = null;
public HwPLc.PlcModel plc3 = null;
public HwPLc.PlcModel plc4 = null;
public List<FixtureStatus> listFixtureStatus = new List<FixtureStatus>();
public List<int> BoxTypeList = new List<int>();
public List<int> HolderStatusList = new List<int>();
public List<int> HolderOutPutList = new List<int>();
public List<int> SolidifyTimeList = new List<int>();
public List<int> StoreTypeList = new List<int>();
public List<int> StoreAmountList = new List<int>();
public Collection() {
startCollect();
@ -31,25 +41,32 @@ namespace Aucma.Core.OldBoxFoam.Business
plc4 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc4"));
while (true)
{
ReadBoxType(plc1);
ReadBoxType(plc2);
ReadBoxType(plc3);
ReadBoxType(plc4);
ReadHolderStatus(plc1);
ReadHolderStatus(plc2);
ReadHolderStatus(plc3);
ReadHolderStatus(plc4);
ReadHolderOutPut(plc1);
ReadHolderOutPut(plc2);
ReadHolderOutPut(plc3);
ReadHolderOutPut(plc4);
ReadSolidifyTime(plc1);
ReadSolidifyTime(plc2);
ReadSolidifyTime(plc3);
ReadSolidifyTime(plc4);
BoxTypeList.Clear();
HolderStatusList.Clear();
HolderOutPutList.Clear();
SolidifyTimeList.Clear();
//夹具箱型
ReadBoxType(plc1, BoxTypeList);
ReadBoxType(plc2, BoxTypeList);
ReadBoxType(plc3, BoxTypeList);
ReadBoxType(plc4, BoxTypeList);
ReadHolderStatus(plc1, HolderStatusList);
ReadHolderStatus(plc2, HolderStatusList);
ReadHolderStatus(plc3, HolderStatusList);
ReadHolderStatus(plc4, HolderStatusList);
ReadHolderOutPut(plc1,HolderOutPutList);
ReadHolderOutPut(plc2,HolderOutPutList);
ReadHolderOutPut(plc3,HolderOutPutList);
ReadHolderOutPut(plc4,HolderOutPutList);
ReadSolidifyTime(plc1,SolidifyTimeList);
ReadSolidifyTime(plc2,SolidifyTimeList);
ReadSolidifyTime(plc3,SolidifyTimeList);
ReadSolidifyTime(plc4,SolidifyTimeList);
ReadStoreType(plc1);
ReadStoreType(plc2);
@ -60,7 +77,15 @@ namespace Aucma.Core.OldBoxFoam.Business
ReadStoreAmount(plc2);
ReadStoreAmount(plc3);
ReadStoreAmount(plc4);
for(int i = 0; i < 24; i++)
{
FixtureStatus model = new FixtureStatus();
model.FixtureBoxType = BoxTypeList[i];
model.Status = HolderStatusList[i];
model.Yield = HolderOutPutList[i];
model.PlanCuringTime = SolidifyTimeList[i];
listFixtureStatus.Add(model);
}
Thread.Sleep(100000);
}
});
@ -68,9 +93,9 @@ namespace Aucma.Core.OldBoxFoam.Business
/// <summary>
/// 读取夹具箱型
/// </summary>
static void ReadBoxType(HwPLc.PlcModel obj)
static void ReadBoxType(HwPLc.PlcModel obj, List<int> BoxTypeList)
{
//夹具箱型
byte[] result = obj.plc.Read("D3140", 48);
byte[] info = result;
int temp1 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(0).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
@ -79,14 +104,19 @@ namespace Aucma.Core.OldBoxFoam.Business
int temp4 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(12).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
int temp5 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(16).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
int temp6 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(18).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
Console.WriteLine($"读取夹具箱型,1#:{temp1};2#{temp2};3#:{temp3};4#:{temp4};5#:{temp5};6#:{temp6}");
BoxTypeList.Add(temp1);
BoxTypeList.Add(temp2);
BoxTypeList.Add(temp3);
BoxTypeList.Add(temp4);
BoxTypeList.Add(temp5);
BoxTypeList.Add(temp6);
Console.WriteLine($"读取夹具箱型,1#:{temp1};2#{temp2};3#:{temp3};4#:{temp4};5#:{temp5};6#:{temp6}");
}
/// <summary>
/// 读取夹具状态
/// </summary>
static void ReadHolderStatus(PlcModel obj1)
static void ReadHolderStatus(PlcModel obj1, List<int> HolderStatusList)
{
byte[] result = obj1.plc.Read("YF0", 1);
//输出二进制字符串,1#-3#手动、自动数据
@ -180,14 +210,19 @@ namespace Aucma.Core.OldBoxFoam.Business
{
item6 = 3;
}
HolderStatusList.Add(item1);
HolderStatusList.Add(item2);
HolderStatusList.Add(item3);
HolderStatusList.Add(item4);
HolderStatusList.Add(item5);
HolderStatusList.Add(item6);
Console.WriteLine($"读取夹具状态,1#:{item1};2#:{item2};3#:{item3};4#:{item4};5#:{item5};6#:{item6}");
}
/// <summary>
/// 读取夹具产量
/// </summary>
static void ReadHolderOutPut(PlcModel obj)
static void ReadHolderOutPut(PlcModel obj,List<int> HolderOutPutList)
{
byte[] result = obj.plc.Read("D182", 24);
byte[] info = result;
@ -197,6 +232,12 @@ namespace Aucma.Core.OldBoxFoam.Business
int temp4 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(6).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
int temp5 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(8).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
int temp6 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(10).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
HolderOutPutList.Add(temp1);
HolderOutPutList.Add(temp2);
HolderOutPutList.Add(temp3);
HolderOutPutList.Add(temp4);
HolderOutPutList.Add(temp5);
HolderOutPutList.Add(temp6);
Console.WriteLine($"读取夹具产量,1#:{temp1};2#{temp2};3#:{temp3};4#:{temp4};5#:{temp5};6#:{temp6}");
}
@ -204,7 +245,7 @@ namespace Aucma.Core.OldBoxFoam.Business
/// <summary>
/// 读取固化时间
/// </summary>
static void ReadSolidifyTime(PlcModel obj)
static void ReadSolidifyTime(PlcModel obj,List<int> SolidifyTimeList)
{
byte[] result = obj.plc.Read("D910", 24);
byte[] info = result;
@ -214,7 +255,12 @@ namespace Aucma.Core.OldBoxFoam.Business
int temp4 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(6).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
int temp5 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(8).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
int temp6 = short.Parse(StringChange.bytesToHexStr(array(info.Skip(10).Take(2).ToArray()), 2), System.Globalization.NumberStyles.HexNumber);
SolidifyTimeList.Add(temp1);
SolidifyTimeList.Add(temp2);
SolidifyTimeList.Add(temp3);
SolidifyTimeList.Add(temp4);
SolidifyTimeList.Add(temp5);
SolidifyTimeList.Add(temp6);
Console.WriteLine($"读取固化时间,1#:{temp1};2#{temp2};3#:{temp3};4#:{temp4};5#:{temp5};6#:{temp6}");
}

@ -15,39 +15,39 @@ namespace Aucma.Core.OldBoxFoam.Models
/// <summary>
/// 夹具箱型
/// </summary>
public string FixtureBoxType { get; set; }
public int FixtureBoxType { get; set; }
/// <summary>
/// 夹具状态
/// </summary>
public string Status { get; set; }
public int Status { get; set; }
/// <summary>
/// 夹具产量
/// </summary>
public string Yield { get; set; }
public int Yield { get; set; }
/// <summary>
/// 固化时间设定值
/// </summary>
public string PlanCuringTime { get; set; }
public int PlanCuringTime { get; set; }
/// <summary>
/// 固化时间实际值
/// </summary>
public string RealCuringTime { get; set; }
public int RealCuringTime { get; set; }
///// <summary>
///// 生产节拍
///// </summary>
public string ProductionCycle { get; set; }
public int ProductionCycle { get; set; }
/// <summary>
/// 泡前库箱型
/// </summary>
public string BeforeBoxType { get; set; }
public int BeforeBoxType { get; set; }
/// <summary>
/// 泡前库库存数
/// </summary>
public string Inventory { get; set; }
public int Inventory { get; set; }
}

Loading…
Cancel
Save