|
|
using Admin.Core.Common;
|
|
|
using Admin.Core.Common.Helper;
|
|
|
using Admin.Core.IService;
|
|
|
using Admin.Core.Model;
|
|
|
using Aucma.Core.HwPLc;
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
using NetTaste;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using NPOI.Util;
|
|
|
using SqlSugar;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.DirectoryServices.Protocols;
|
|
|
using System.Linq;
|
|
|
using System.Security.RightsManagement;
|
|
|
using System.Text;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows.Documents;
|
|
|
|
|
|
namespace Aucma.Core.DoorFoam.Business
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 采集发泡线数据
|
|
|
/// </summary>
|
|
|
public class DoorCollection
|
|
|
{
|
|
|
private static System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
|
|
|
|
|
|
private IDoorFoamMachineServices _doorFoamMachineServices;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 刷新门体发泡数据
|
|
|
/// </summary>
|
|
|
/// <param name="message"></param>
|
|
|
public delegate void RefreshDoorFoamMachine(List<DoorFoamMachine> doorFoams);
|
|
|
public event RefreshDoorFoamMachine RefreshDoorFoamMachineEvent;
|
|
|
|
|
|
public DoorCollection()
|
|
|
{
|
|
|
|
|
|
_doorFoamMachineServices = App.ServiceProvider.GetService<IDoorFoamMachineServices>();
|
|
|
}
|
|
|
|
|
|
public void startCollect()
|
|
|
{
|
|
|
while (true)
|
|
|
{
|
|
|
//semaphore.WaitOne();
|
|
|
try
|
|
|
{
|
|
|
Thread.Sleep(5000);
|
|
|
|
|
|
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("DoorPlc"));
|
|
|
|
|
|
if (obj != null)
|
|
|
{
|
|
|
//读取所有模具状态
|
|
|
List<DoorFoamMachine> moldStatusList = ReadModeStatus(obj);
|
|
|
//读取所有模具型号
|
|
|
List<DoorFoamMachine> moldTypeList = ReadModeType(obj);
|
|
|
//读取所有模具产量
|
|
|
List<DoorFoamMachine> moldOutPutList = ReadModeProduct(obj);
|
|
|
|
|
|
|
|
|
#region 读取设备状态(1运行 2停机 3故障)、生产节拍、节拍、设备报警
|
|
|
byte[] info = obj.plc.Read("DB4.2086", 10);
|
|
|
int deviceStatus = 0;
|
|
|
float productTakt = 0;
|
|
|
float taktNum = 0;
|
|
|
if (info != null)
|
|
|
{
|
|
|
//设备状态1运行 2停机 3故障
|
|
|
deviceStatus = judgeStatus(ByteArrayToBinary(info.Skip(0).Take(1).ToArray()));
|
|
|
// 生产节拍
|
|
|
productTakt = byteToFloat(info.Skip(2).Take(4).ToArray());
|
|
|
//节拍
|
|
|
taktNum = byteToFloat(info.Skip(6).Take(4).ToArray());
|
|
|
}
|
|
|
|
|
|
int deviceAlarm = obj.plc.ReadInt32("DB4.2136");
|
|
|
#endregion
|
|
|
|
|
|
List<DoorFoamMachine> result = new List<DoorFoamMachine>();
|
|
|
|
|
|
var mergedCollection = from moldStatus in moldStatusList
|
|
|
join moldType in moldTypeList on new { moldStatus.StationTrolleyNumber, moldStatus.GunNumber } equals new { moldType.StationTrolleyNumber, moldType.GunNumber }
|
|
|
join moldOutPut in moldOutPutList on new { moldStatus.StationTrolleyNumber, moldStatus.GunNumber } equals new { moldOutPut.StationTrolleyNumber, moldOutPut.GunNumber }
|
|
|
select new DoorFoamMachine
|
|
|
{
|
|
|
StationTrolleyNumber = moldStatus.StationTrolleyNumber,
|
|
|
GunNumber = moldStatus.GunNumber,
|
|
|
MoldType_A = moldType.MoldType_A,
|
|
|
MoldType_B = moldType.MoldType_B,
|
|
|
MoldProdutionA = moldOutPut.MoldProdutionA,
|
|
|
MoldProdutionB = moldOutPut.MoldProdutionB,
|
|
|
DeviceStatus = deviceStatus,
|
|
|
DeviceAlarm = deviceAlarm,
|
|
|
ProductTakt = productTakt,
|
|
|
Takt = taktNum,
|
|
|
CreateTime = DateTime.Now
|
|
|
};
|
|
|
result = mergedCollection.ToList();
|
|
|
if(result != null)
|
|
|
{
|
|
|
RefreshDoorFoamMachineEvent?.Invoke(result);
|
|
|
|
|
|
var addFlag = _doorFoamMachineServices.AddAsync(result).Result;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
Console.WriteLine($"门体发泡数据采集异常:{ex.Message}");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 读取模位状态
|
|
|
/// </summary>
|
|
|
static List<DoorFoamMachine> ReadModeStatus(HwPLc.PlcModel obj)
|
|
|
{
|
|
|
if (obj == null) return null;
|
|
|
else
|
|
|
{
|
|
|
List<DoorFoamMachine> doorFoams = new List<DoorFoamMachine>();
|
|
|
if (obj.plc.IsConnected)
|
|
|
{
|
|
|
|
|
|
byte[] info = obj.plc.Read("DB4.0", 142);
|
|
|
if(info != null)
|
|
|
{
|
|
|
///出模工位台车号,上料工位台车号,注料工位台车号
|
|
|
short tempNo1 = short.Parse(StringChange.bytesToHexStr(info.Skip(0).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
|
short tempNo2 = short.Parse(StringChange.bytesToHexStr(info.Skip(2).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
|
short tempNo3 = short.Parse(StringChange.bytesToHexStr(info.Skip(4).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
|
//模位状态,台车1#枪模式:0,不工作;1,A门工作;2,B门工作;3,AB门工作
|
|
|
#region 读取模具状态
|
|
|
short temp1 = short.Parse(StringChange.bytesToHexStr(info.Skip(6).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =1,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp1.ToString(),
|
|
|
});
|
|
|
|
|
|
short temp2 = short.Parse(StringChange.bytesToHexStr(info.Skip(8).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =1,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp2.ToString(),
|
|
|
});
|
|
|
short temp3 = short.Parse(StringChange.bytesToHexStr(info.Skip(10).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =2,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp3.ToString(),
|
|
|
});
|
|
|
short temp4 = short.Parse(StringChange.bytesToHexStr(info.Skip(12).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =2,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp4.ToString(),
|
|
|
});
|
|
|
short temp5 = short.Parse(StringChange.bytesToHexStr(info.Skip(14).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =3,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp5.ToString(),
|
|
|
});
|
|
|
short temp6 = short.Parse(StringChange.bytesToHexStr(info.Skip(16).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =3,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp6.ToString(),
|
|
|
});
|
|
|
short temp7 = short.Parse(StringChange.bytesToHexStr(info.Skip(18).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =4,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp7.ToString(),
|
|
|
});
|
|
|
short temp8 = short.Parse(StringChange.bytesToHexStr(info.Skip(20).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =4,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp8.ToString(),
|
|
|
});
|
|
|
short temp9 = short.Parse(StringChange.bytesToHexStr(info.Skip(22).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =5,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp9.ToString(),
|
|
|
});
|
|
|
short temp10 = short.Parse(StringChange.bytesToHexStr(info.Skip(24).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =5,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp10.ToString(),
|
|
|
});
|
|
|
short temp11 = short.Parse(StringChange.bytesToHexStr(info.Skip(26).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =6,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp11.ToString(),
|
|
|
});
|
|
|
short temp12 = short.Parse(StringChange.bytesToHexStr(info.Skip(28).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =6,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp12.ToString(),
|
|
|
});
|
|
|
short temp13 = short.Parse(StringChange.bytesToHexStr(info.Skip(30).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =7,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp13.ToString(),
|
|
|
});
|
|
|
short temp14 = short.Parse(StringChange.bytesToHexStr(info.Skip(32).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =7,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp14.ToString(),
|
|
|
});
|
|
|
short temp15 = short.Parse(StringChange.bytesToHexStr(info.Skip(34).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =8,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp15.ToString(),
|
|
|
});
|
|
|
short temp16 = short.Parse(StringChange.bytesToHexStr(info.Skip(36).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =8,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp16.ToString(),
|
|
|
});
|
|
|
short temp17 = short.Parse(StringChange.bytesToHexStr(info.Skip(38).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =9,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp17.ToString(),
|
|
|
});
|
|
|
short temp18 = short.Parse(StringChange.bytesToHexStr(info.Skip(40).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =9,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp18.ToString(),
|
|
|
});
|
|
|
short temp19 = short.Parse(StringChange.bytesToHexStr(info.Skip(42).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =10,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp19.ToString(),
|
|
|
});
|
|
|
short temp20 = short.Parse(StringChange.bytesToHexStr(info.Skip(44).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =10,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp20.ToString(),
|
|
|
});
|
|
|
short temp21 = short.Parse(StringChange.bytesToHexStr(info.Skip(46).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =11,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp21.ToString(),
|
|
|
});
|
|
|
short temp22 = short.Parse(StringChange.bytesToHexStr(info.Skip(48).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =11,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp22.ToString(),
|
|
|
});
|
|
|
short temp23 = short.Parse(StringChange.bytesToHexStr(info.Skip(50).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =12,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp23.ToString(),
|
|
|
});
|
|
|
short temp24 = short.Parse(StringChange.bytesToHexStr(info.Skip(52).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =12,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp24.ToString(),
|
|
|
});
|
|
|
short temp25 = short.Parse(StringChange.bytesToHexStr(info.Skip(54).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =13,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp25.ToString(),
|
|
|
});
|
|
|
short temp26 = short.Parse(StringChange.bytesToHexStr(info.Skip(56).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =13,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp26.ToString(),
|
|
|
});
|
|
|
short temp27 = short.Parse(StringChange.bytesToHexStr(info.Skip(58).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =14,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp27.ToString(),
|
|
|
});
|
|
|
short temp28 = short.Parse(StringChange.bytesToHexStr(info.Skip(60).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =14,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp28.ToString(),
|
|
|
});
|
|
|
short temp29 = short.Parse(StringChange.bytesToHexStr(info.Skip(62).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =15,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp29.ToString(),
|
|
|
});
|
|
|
short temp30 = short.Parse(StringChange.bytesToHexStr(info.Skip(64).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =15,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp30.ToString(),
|
|
|
});
|
|
|
short temp31 = short.Parse(StringChange.bytesToHexStr(info.Skip(66).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =16,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp31.ToString(),
|
|
|
});
|
|
|
short temp32 = short.Parse(StringChange.bytesToHexStr(info.Skip(68).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =16,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp32.ToString(),
|
|
|
});
|
|
|
short temp33 = short.Parse(StringChange.bytesToHexStr(info.Skip(70).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =17,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp33.ToString(),
|
|
|
});
|
|
|
short temp34 = short.Parse(StringChange.bytesToHexStr(info.Skip(72).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =17,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp34.ToString(),
|
|
|
});
|
|
|
short temp35 = short.Parse(StringChange.bytesToHexStr(info.Skip(74).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =18,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp35.ToString(),
|
|
|
});
|
|
|
short temp36 = short.Parse(StringChange.bytesToHexStr(info.Skip(76).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =18,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp36.ToString(),
|
|
|
});
|
|
|
short temp37 = short.Parse(StringChange.bytesToHexStr(info.Skip(78).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =19,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp37.ToString(),
|
|
|
});
|
|
|
short temp38 = short.Parse(StringChange.bytesToHexStr(info.Skip(80).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =19,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp38.ToString(),
|
|
|
});
|
|
|
short temp39 = short.Parse(StringChange.bytesToHexStr(info.Skip(82).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =20,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp39.ToString(),
|
|
|
});
|
|
|
short temp40 = short.Parse(StringChange.bytesToHexStr(info.Skip(84).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =20,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp40.ToString(),
|
|
|
});
|
|
|
short temp41 = short.Parse(StringChange.bytesToHexStr(info.Skip(86).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =21,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp41.ToString(),
|
|
|
});
|
|
|
short temp42 = short.Parse(StringChange.bytesToHexStr(info.Skip(88).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =21,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp42.ToString(),
|
|
|
});
|
|
|
short temp43 = short.Parse(StringChange.bytesToHexStr(info.Skip(90).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =22,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp43.ToString(),
|
|
|
});
|
|
|
short temp44 = short.Parse(StringChange.bytesToHexStr(info.Skip(92).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =22,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp44.ToString(),
|
|
|
});
|
|
|
short temp45 = short.Parse(StringChange.bytesToHexStr(info.Skip(94).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =23,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp45.ToString(),
|
|
|
});
|
|
|
short temp46 = short.Parse(StringChange.bytesToHexStr(info.Skip(96).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =23,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp46.ToString(),
|
|
|
});
|
|
|
short temp47 = short.Parse(StringChange.bytesToHexStr(info.Skip(98).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =24,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp47.ToString(),
|
|
|
});
|
|
|
short temp48 = short.Parse(StringChange.bytesToHexStr(info.Skip(100).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =24,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp48.ToString(),
|
|
|
});
|
|
|
short temp49 = short.Parse(StringChange.bytesToHexStr(info.Skip(102).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =25,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp49.ToString(),
|
|
|
});
|
|
|
short temp50 = short.Parse(StringChange.bytesToHexStr(info.Skip(104).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =25,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp50.ToString(),
|
|
|
});
|
|
|
short temp51 = short.Parse(StringChange.bytesToHexStr(info.Skip(106).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =26,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp51.ToString(),
|
|
|
});
|
|
|
short temp52 = short.Parse(StringChange.bytesToHexStr(info.Skip(108).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =26,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp52.ToString(),
|
|
|
});
|
|
|
short temp53 = short.Parse(StringChange.bytesToHexStr(info.Skip(110).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =27,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp53.ToString(),
|
|
|
});
|
|
|
short temp54 = short.Parse(StringChange.bytesToHexStr(info.Skip(112).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =27,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp54.ToString(),
|
|
|
});
|
|
|
short temp55 = short.Parse(StringChange.bytesToHexStr(info.Skip(114).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =28,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp55.ToString(),
|
|
|
});
|
|
|
short temp56 = short.Parse(StringChange.bytesToHexStr(info.Skip(116).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =28,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp56.ToString(),
|
|
|
});
|
|
|
short temp57 = short.Parse(StringChange.bytesToHexStr(info.Skip(118).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =29,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp57.ToString(),
|
|
|
});
|
|
|
short temp58 = short.Parse(StringChange.bytesToHexStr(info.Skip(120).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =29,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp58.ToString(),
|
|
|
});
|
|
|
short temp59 = short.Parse(StringChange.bytesToHexStr(info.Skip(122).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =30,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp59.ToString(),
|
|
|
});
|
|
|
short temp60 = short.Parse(StringChange.bytesToHexStr(info.Skip(124).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =30,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp60.ToString(),
|
|
|
});
|
|
|
short temp61 = short.Parse(StringChange.bytesToHexStr(info.Skip(126).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =31,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp61.ToString(),
|
|
|
});
|
|
|
short temp62 = short.Parse(StringChange.bytesToHexStr(info.Skip(128).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =31,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp62.ToString(),
|
|
|
});
|
|
|
short temp63 = short.Parse(StringChange.bytesToHexStr(info.Skip(130).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =32,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp63.ToString(),
|
|
|
});
|
|
|
short temp64 = short.Parse(StringChange.bytesToHexStr(info.Skip(132).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =32,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp64.ToString(),
|
|
|
});
|
|
|
short temp65 = short.Parse(StringChange.bytesToHexStr(info.Skip(134).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =33,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp65.ToString(),
|
|
|
});
|
|
|
short temp66 = short.Parse(StringChange.bytesToHexStr(info.Skip(136).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =33,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp66.ToString(),
|
|
|
});
|
|
|
short temp67 = short.Parse(StringChange.bytesToHexStr(info.Skip(138).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =34,
|
|
|
GunNumber =1,
|
|
|
MoldStatus = temp67.ToString(),
|
|
|
});
|
|
|
short temp68 = short.Parse(StringChange.bytesToHexStr(info.Skip(140).Take(2).ToArray(), 2), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =34,
|
|
|
GunNumber =2,
|
|
|
MoldStatus = temp68.ToString(),
|
|
|
});
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return doorFoams;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 读取模位型号,读5台,1-5,6-10...
|
|
|
/// </summary>
|
|
|
static List<DoorFoamMachine> ReadModeType(HwPLc.PlcModel obj)
|
|
|
{
|
|
|
if (obj == null) return null;
|
|
|
else
|
|
|
{
|
|
|
List<DoorFoamMachine> doorFoams = new List<DoorFoamMachine>();
|
|
|
if (obj.plc.IsConnected)
|
|
|
{
|
|
|
byte[] info1 = obj.plc.Read("DB4.142", 200);
|
|
|
//1#台车1#枪A门,1#台车1#枪B门,1#台车2#枪A门,1#台车2#枪B门
|
|
|
|
|
|
#region 1-5台车
|
|
|
if (info1 != null)
|
|
|
{
|
|
|
string trolley_1_1_A = asciiEncoding.GetString(info1.Skip(0).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_1_1_B = asciiEncoding.GetString(info1.Skip(10).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =1,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_1_1_A,
|
|
|
MoldType_B = trolley_1_1_B
|
|
|
});
|
|
|
|
|
|
string trolley_1_2_A = asciiEncoding.GetString(info1.Skip(20).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_1_2_B = asciiEncoding.GetString(info1.Skip(30).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =1,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_1_2_A,
|
|
|
MoldType_B = trolley_1_2_B
|
|
|
});
|
|
|
string trolley_2_1_A = asciiEncoding.GetString(info1.Skip(40).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_2_1_B = asciiEncoding.GetString(info1.Skip(50).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =2,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_2_1_A,
|
|
|
MoldType_B = trolley_2_1_B
|
|
|
});
|
|
|
string trolley_2_2_A = asciiEncoding.GetString(info1.Skip(60).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_2_2_B = asciiEncoding.GetString(info1.Skip(70).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =2,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_2_2_A,
|
|
|
MoldType_B = trolley_2_2_B
|
|
|
});
|
|
|
|
|
|
string trolley_3_1_A = asciiEncoding.GetString(info1.Skip(80).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_3_1_B = asciiEncoding.GetString(info1.Skip(90).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =3,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_3_1_A,
|
|
|
MoldType_B = trolley_3_1_B
|
|
|
});
|
|
|
string trolley_3_2_A = asciiEncoding.GetString(info1.Skip(100).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_3_2_B = asciiEncoding.GetString(info1.Skip(110).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =3,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_3_2_A,
|
|
|
MoldType_B = trolley_3_2_B
|
|
|
});
|
|
|
string trolley_4_1_A = asciiEncoding.GetString(info1.Skip(120).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_4_1_B = asciiEncoding.GetString(info1.Skip(130).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =4,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_4_1_A,
|
|
|
MoldType_B = trolley_4_1_B
|
|
|
});
|
|
|
string trolley_4_2_A = asciiEncoding.GetString(info1.Skip(140).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_4_2_B = asciiEncoding.GetString(info1.Skip(150).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =4,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_4_2_A,
|
|
|
MoldType_B = trolley_4_2_B
|
|
|
});
|
|
|
string trolley_5_1_A = asciiEncoding.GetString(info1.Skip(160).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_5_1_B = asciiEncoding.GetString(info1.Skip(170).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =5,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_5_1_A,
|
|
|
MoldType_B = trolley_5_1_B
|
|
|
});
|
|
|
string trolley_5_2_A = asciiEncoding.GetString(info1.Skip(180).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_5_2_B = asciiEncoding.GetString(info1.Skip(190).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =5,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_5_2_A,
|
|
|
MoldType_B = trolley_5_2_B
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info2 = obj.plc.Read("DB4.342", 200);
|
|
|
|
|
|
#region 6-10台车
|
|
|
if(info2 != null)
|
|
|
{
|
|
|
string trolley_6_1_A = asciiEncoding.GetString(info2.Skip(0).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_6_1_B = asciiEncoding.GetString(info2.Skip(10).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =6,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_6_1_A,
|
|
|
MoldType_B = trolley_6_1_B
|
|
|
});
|
|
|
|
|
|
string trolley_6_2_A = asciiEncoding.GetString(info2.Skip(20).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_6_2_B = asciiEncoding.GetString(info2.Skip(30).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =6,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_6_2_A,
|
|
|
MoldType_B = trolley_6_2_B
|
|
|
});
|
|
|
string trolley_7_1_A = asciiEncoding.GetString(info2.Skip(40).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_7_1_B = asciiEncoding.GetString(info2.Skip(50).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =7,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_7_1_A,
|
|
|
MoldType_B = trolley_7_1_B
|
|
|
});
|
|
|
string trolley_7_2_A = asciiEncoding.GetString(info2.Skip(60).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_7_2_B = asciiEncoding.GetString(info2.Skip(70).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =7,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_7_2_A,
|
|
|
MoldType_B = trolley_7_2_B
|
|
|
});
|
|
|
|
|
|
string trolley_8_1_A = asciiEncoding.GetString(info2.Skip(80).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_8_1_B = asciiEncoding.GetString(info2.Skip(90).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =8,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_8_1_A,
|
|
|
MoldType_B = trolley_8_1_B
|
|
|
});
|
|
|
string trolley_8_2_A = asciiEncoding.GetString(info2.Skip(100).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_8_2_B = asciiEncoding.GetString(info2.Skip(110).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =8,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_8_2_A,
|
|
|
MoldType_B = trolley_8_2_B
|
|
|
});
|
|
|
string trolley_9_1_A = asciiEncoding.GetString(info2.Skip(120).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_9_1_B = asciiEncoding.GetString(info2.Skip(130).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =9,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_9_1_A,
|
|
|
MoldType_B = trolley_9_1_B
|
|
|
});
|
|
|
string trolley_9_2_A = asciiEncoding.GetString(info2.Skip(140).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_9_2_B = asciiEncoding.GetString(info2.Skip(150).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =9,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_9_2_A,
|
|
|
MoldType_B = trolley_9_2_B
|
|
|
});
|
|
|
string trolley_10_1_A = asciiEncoding.GetString(info2.Skip(160).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_10_1_B = asciiEncoding.GetString(info2.Skip(170).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =10,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_10_1_A,
|
|
|
MoldType_B = trolley_10_1_B
|
|
|
});
|
|
|
string trolley_10_2_A = asciiEncoding.GetString(info2.Skip(180).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_10_2_B = asciiEncoding.GetString(info2.Skip(190).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =10,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_10_2_A,
|
|
|
MoldType_B = trolley_10_2_B
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info3 = obj.plc.Read("DB4.542", 200);
|
|
|
|
|
|
#region 11-15台车
|
|
|
if(info3 != null)
|
|
|
{
|
|
|
string trolley_11_1_A = asciiEncoding.GetString(info3.Skip(0).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_11_1_B = asciiEncoding.GetString(info3.Skip(10).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =11,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_11_1_A,
|
|
|
MoldType_B = trolley_11_1_B
|
|
|
});
|
|
|
|
|
|
string trolley_11_2_A = asciiEncoding.GetString(info3.Skip(20).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_11_2_B = asciiEncoding.GetString(info3.Skip(30).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =11,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_11_2_A,
|
|
|
MoldType_B = trolley_11_2_B
|
|
|
});
|
|
|
string trolley_12_1_A = asciiEncoding.GetString(info3.Skip(40).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_12_1_B = asciiEncoding.GetString(info3.Skip(50).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =12,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_12_1_A,
|
|
|
MoldType_B = trolley_12_1_B
|
|
|
});
|
|
|
string trolley_12_2_A = asciiEncoding.GetString(info3.Skip(60).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_12_2_B = asciiEncoding.GetString(info3.Skip(70).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =12,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_12_2_A,
|
|
|
MoldType_B = trolley_12_2_B
|
|
|
});
|
|
|
|
|
|
string trolley_13_1_A = asciiEncoding.GetString(info3.Skip(80).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_13_1_B = asciiEncoding.GetString(info3.Skip(90).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =13,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_13_1_A,
|
|
|
MoldType_B = trolley_13_1_B
|
|
|
});
|
|
|
string trolley_13_2_A = asciiEncoding.GetString(info3.Skip(100).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_13_2_B = asciiEncoding.GetString(info3.Skip(110).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =13,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_13_2_A,
|
|
|
MoldType_B = trolley_13_2_B
|
|
|
});
|
|
|
string trolley_14_1_A = asciiEncoding.GetString(info3.Skip(120).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_14_1_B = asciiEncoding.GetString(info3.Skip(130).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =14,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_14_1_A,
|
|
|
MoldType_B = trolley_14_1_B
|
|
|
});
|
|
|
string trolley_14_2_A = asciiEncoding.GetString(info3.Skip(140).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_14_2_B = asciiEncoding.GetString(info3.Skip(150).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =14,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_14_2_A,
|
|
|
MoldType_B = trolley_14_2_B
|
|
|
});
|
|
|
string trolley_15_1_A = asciiEncoding.GetString(info3.Skip(160).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_15_1_B = asciiEncoding.GetString(info3.Skip(170).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =15,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_15_1_A,
|
|
|
MoldType_B = trolley_15_1_B
|
|
|
});
|
|
|
string trolley_15_2_A = asciiEncoding.GetString(info3.Skip(180).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_15_2_B = asciiEncoding.GetString(info3.Skip(190).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =15,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_15_2_A,
|
|
|
MoldType_B = trolley_15_2_B
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info4 = obj.plc.Read("DB4.742", 200);
|
|
|
|
|
|
#region 16-20台车
|
|
|
if(info4 != null)
|
|
|
{
|
|
|
string trolley_16_1_A = asciiEncoding.GetString(info4.Skip(0).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_16_1_B = asciiEncoding.GetString(info4.Skip(10).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =16,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_16_1_A,
|
|
|
MoldType_B = trolley_16_1_B
|
|
|
});
|
|
|
|
|
|
string trolley_16_2_A = asciiEncoding.GetString(info4.Skip(20).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_16_2_B = asciiEncoding.GetString(info4.Skip(30).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =16,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_16_2_A,
|
|
|
MoldType_B = trolley_16_2_B
|
|
|
});
|
|
|
string trolley_17_1_A = asciiEncoding.GetString(info4.Skip(40).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_17_1_B = asciiEncoding.GetString(info4.Skip(50).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =17,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_17_1_A,
|
|
|
MoldType_B = trolley_17_1_B
|
|
|
});
|
|
|
string trolley_17_2_A = asciiEncoding.GetString(info4.Skip(60).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_17_2_B = asciiEncoding.GetString(info4.Skip(70).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =17,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_17_2_A,
|
|
|
MoldType_B = trolley_17_2_B
|
|
|
});
|
|
|
|
|
|
string trolley_18_1_A = asciiEncoding.GetString(info4.Skip(80).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_18_1_B = asciiEncoding.GetString(info4.Skip(90).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =18,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_18_1_A,
|
|
|
MoldType_B = trolley_18_1_B
|
|
|
});
|
|
|
string trolley_18_2_A = asciiEncoding.GetString(info4.Skip(100).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_18_2_B = asciiEncoding.GetString(info4.Skip(110).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =18,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_18_2_A,
|
|
|
MoldType_B = trolley_18_2_B
|
|
|
});
|
|
|
string trolley_19_1_A = asciiEncoding.GetString(info4.Skip(120).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_19_1_B = asciiEncoding.GetString(info4.Skip(130).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =19,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_19_1_A,
|
|
|
MoldType_B = trolley_19_1_B
|
|
|
});
|
|
|
string trolley_19_2_A = asciiEncoding.GetString(info4.Skip(140).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_19_2_B = asciiEncoding.GetString(info4.Skip(150).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =19,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_19_2_A,
|
|
|
MoldType_B = trolley_19_2_B
|
|
|
});
|
|
|
string trolley_20_1_A = asciiEncoding.GetString(info4.Skip(160).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_20_1_B = asciiEncoding.GetString(info4.Skip(170).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =20,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_20_1_A,
|
|
|
MoldType_B = trolley_20_1_B
|
|
|
});
|
|
|
string trolley_20_2_A = asciiEncoding.GetString(info4.Skip(180).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_20_2_B = asciiEncoding.GetString(info4.Skip(190).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =20,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_20_2_A,
|
|
|
MoldType_B = trolley_20_2_B
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info5 = obj.plc.Read("DB4.942", 200);
|
|
|
|
|
|
#region 21-25台车
|
|
|
if(info5 != null)
|
|
|
{
|
|
|
string trolley_21_1_A = asciiEncoding.GetString(info5.Skip(0).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_21_1_B = asciiEncoding.GetString(info5.Skip(10).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =21,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_21_1_A,
|
|
|
MoldType_B = trolley_21_1_B
|
|
|
});
|
|
|
|
|
|
string trolley_21_2_A = asciiEncoding.GetString(info5.Skip(20).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_21_2_B = asciiEncoding.GetString(info5.Skip(30).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =21,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_21_2_A,
|
|
|
MoldType_B = trolley_21_2_B
|
|
|
});
|
|
|
string trolley_22_1_A = asciiEncoding.GetString(info5.Skip(40).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_22_1_B = asciiEncoding.GetString(info5.Skip(50).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =22,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_22_1_A,
|
|
|
MoldType_B = trolley_22_1_B
|
|
|
});
|
|
|
string trolley_22_2_A = asciiEncoding.GetString(info5.Skip(60).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_22_2_B = asciiEncoding.GetString(info5.Skip(70).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =22,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_22_2_A,
|
|
|
MoldType_B = trolley_22_2_B
|
|
|
});
|
|
|
|
|
|
string trolley_23_1_A = asciiEncoding.GetString(info5.Skip(80).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_23_1_B = asciiEncoding.GetString(info5.Skip(90).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =23,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_23_1_A,
|
|
|
MoldType_B = trolley_23_1_B
|
|
|
});
|
|
|
string trolley_23_2_A = asciiEncoding.GetString(info5.Skip(100).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_23_2_B = asciiEncoding.GetString(info5.Skip(110).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =23,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_23_2_A,
|
|
|
MoldType_B = trolley_23_2_B
|
|
|
});
|
|
|
string trolley_24_1_A = asciiEncoding.GetString(info5.Skip(120).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_24_1_B = asciiEncoding.GetString(info5.Skip(130).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =24,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_24_1_A,
|
|
|
MoldType_B = trolley_24_1_B
|
|
|
});
|
|
|
string trolley_24_2_A = asciiEncoding.GetString(info5.Skip(140).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_24_2_B = asciiEncoding.GetString(info5.Skip(150).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =24,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_24_2_A,
|
|
|
MoldType_B = trolley_24_2_B
|
|
|
});
|
|
|
string trolley_25_1_A = asciiEncoding.GetString(info5.Skip(160).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_25_1_B = asciiEncoding.GetString(info5.Skip(170).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =25,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_25_1_A,
|
|
|
MoldType_B = trolley_25_1_B
|
|
|
});
|
|
|
string trolley_25_2_A = asciiEncoding.GetString(info5.Skip(180).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_25_2_B = asciiEncoding.GetString(info5.Skip(190).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =25,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_25_2_A,
|
|
|
MoldType_B = trolley_25_2_B
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info6 = obj.plc.Read("DB4.1142", 200);
|
|
|
|
|
|
#region 26-30 台车
|
|
|
if(info6 != null)
|
|
|
{
|
|
|
string trolley_26_1_A = asciiEncoding.GetString(info6.Skip(0).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_26_1_B = asciiEncoding.GetString(info6.Skip(10).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =26,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_26_1_A,
|
|
|
MoldType_B = trolley_26_1_B
|
|
|
});
|
|
|
|
|
|
string trolley_26_2_A = asciiEncoding.GetString(info6.Skip(20).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_26_2_B = asciiEncoding.GetString(info6.Skip(30).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =26,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_26_2_A,
|
|
|
MoldType_B = trolley_26_2_B
|
|
|
});
|
|
|
string trolley_27_1_A = asciiEncoding.GetString(info6.Skip(40).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_27_1_B = asciiEncoding.GetString(info6.Skip(50).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =27,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_27_1_A,
|
|
|
MoldType_B = trolley_27_1_B
|
|
|
});
|
|
|
string trolley_27_2_A = asciiEncoding.GetString(info6.Skip(60).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_27_2_B = asciiEncoding.GetString(info6.Skip(70).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =27,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_27_2_A,
|
|
|
MoldType_B = trolley_27_2_B
|
|
|
});
|
|
|
|
|
|
string trolley_28_1_A = asciiEncoding.GetString(info6.Skip(80).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_28_1_B = asciiEncoding.GetString(info6.Skip(90).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =28,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_28_1_A,
|
|
|
MoldType_B = trolley_28_1_B
|
|
|
});
|
|
|
string trolley_28_2_A = asciiEncoding.GetString(info6.Skip(100).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_28_2_B = asciiEncoding.GetString(info6.Skip(110).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =28,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_28_2_A,
|
|
|
MoldType_B = trolley_28_2_B
|
|
|
});
|
|
|
string trolley_29_1_A = asciiEncoding.GetString(info6.Skip(120).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_29_1_B = asciiEncoding.GetString(info6.Skip(130).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =29,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_29_1_A,
|
|
|
MoldType_B = trolley_29_1_B
|
|
|
});
|
|
|
string trolley_29_2_A = asciiEncoding.GetString(info6.Skip(140).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_29_2_B = asciiEncoding.GetString(info6.Skip(150).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =29,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_29_2_A,
|
|
|
MoldType_B = trolley_29_2_B
|
|
|
});
|
|
|
string trolley_30_1_A = asciiEncoding.GetString(info6.Skip(160).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_30_1_B = asciiEncoding.GetString(info6.Skip(170).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =30,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_30_1_A,
|
|
|
MoldType_B = trolley_30_1_B
|
|
|
});
|
|
|
string trolley_30_2_A = asciiEncoding.GetString(info6.Skip(180).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_30_2_B = asciiEncoding.GetString(info6.Skip(190).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =30,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_30_2_A,
|
|
|
MoldType_B = trolley_30_2_B
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info7 = obj.plc.Read("DB4.1342", 200);
|
|
|
|
|
|
#region 31-34 台车
|
|
|
if (info7 != null)
|
|
|
{
|
|
|
string trolley_31_1_A = asciiEncoding.GetString(info7.Skip(0).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_31_1_B = asciiEncoding.GetString(info7.Skip(10).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =31,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_31_1_A,
|
|
|
MoldType_B = trolley_31_1_B
|
|
|
});
|
|
|
|
|
|
string trolley_31_2_A = asciiEncoding.GetString(info7.Skip(20).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_31_2_B = asciiEncoding.GetString(info7.Skip(30).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =31,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_31_2_A,
|
|
|
MoldType_B = trolley_31_2_B
|
|
|
});
|
|
|
string trolley_32_1_A = asciiEncoding.GetString(info7.Skip(40).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_32_1_B = asciiEncoding.GetString(info7.Skip(50).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =32,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_32_1_A,
|
|
|
MoldType_B = trolley_32_1_B
|
|
|
});
|
|
|
string trolley_32_2_A = asciiEncoding.GetString(info7.Skip(60).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_32_2_B = asciiEncoding.GetString(info7.Skip(70).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =32,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_32_2_A,
|
|
|
MoldType_B = trolley_32_2_B
|
|
|
});
|
|
|
|
|
|
string trolley_33_1_A = asciiEncoding.GetString(info7.Skip(80).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_33_1_B = asciiEncoding.GetString(info7.Skip(90).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =33,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_33_1_A,
|
|
|
MoldType_B = trolley_33_1_B
|
|
|
});
|
|
|
string trolley_33_2_A = asciiEncoding.GetString(info7.Skip(100).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_33_2_B = asciiEncoding.GetString(info7.Skip(110).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =33,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_33_2_A,
|
|
|
MoldType_B = trolley_33_2_B
|
|
|
});
|
|
|
string trolley_34_1_A = asciiEncoding.GetString(info7.Skip(120).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_34_1_B = asciiEncoding.GetString(info7.Skip(130).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =34,
|
|
|
GunNumber =1,
|
|
|
MoldType_A = trolley_34_1_A,
|
|
|
MoldType_B = trolley_34_1_B
|
|
|
});
|
|
|
string trolley_34_2_A = asciiEncoding.GetString(info7.Skip(140).Take(10).ToArray()).Trim('\n');
|
|
|
string trolley_34_2_B = asciiEncoding.GetString(info7.Skip(150).Take(10).ToArray()).Trim('\n');
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =34,
|
|
|
GunNumber =2,
|
|
|
MoldType_A = trolley_34_2_A,
|
|
|
MoldType_B = trolley_34_2_B
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
return doorFoams;
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 读取模位型号,读4台,31-34
|
|
|
/// </summary>
|
|
|
static void ReadModeTypeLast(HwPLc.PlcModel obj, string startStr, List<string> boxTypeList)
|
|
|
{
|
|
|
if (obj == null) return;
|
|
|
else
|
|
|
{
|
|
|
if (obj.plc.IsConnected)
|
|
|
{
|
|
|
byte[] info = obj.plc.Read(startStr, 160);
|
|
|
if (info == null) return;
|
|
|
//1#台车1#枪A门,1#台车1#枪B门,1#台车2#枪A门,1#台车2#枪B门
|
|
|
|
|
|
string temp1 = asciiEncoding.GetString(info.Skip(0).Take(10).ToArray()).Trim('\n');
|
|
|
string temp2 = asciiEncoding.GetString(info.Skip(10).Take(10).ToArray()).Trim('\n');
|
|
|
string temp3 = asciiEncoding.GetString(info.Skip(20).Take(10).ToArray()).Trim('\n');
|
|
|
string temp4 = asciiEncoding.GetString(info.Skip(30).Take(10).ToArray()).Trim('\n');
|
|
|
string temp5 = asciiEncoding.GetString(info.Skip(40).Take(10).ToArray()).Trim('\n');
|
|
|
string temp6 = asciiEncoding.GetString(info.Skip(50).Take(10).ToArray()).Trim('\n');
|
|
|
string temp7 = asciiEncoding.GetString(info.Skip(60).Take(10).ToArray()).Trim('\n');
|
|
|
string temp8 = asciiEncoding.GetString(info.Skip(70).Take(10).ToArray()).Trim('\n');
|
|
|
string temp9 = asciiEncoding.GetString(info.Skip(80).Take(10).ToArray()).Trim('\n');
|
|
|
string temp10 = asciiEncoding.GetString(info.Skip(90).Take(10).ToArray()).Trim('\n');
|
|
|
string temp11 = asciiEncoding.GetString(info.Skip(100).Take(10).ToArray()).Trim('\n');
|
|
|
string temp12 = asciiEncoding.GetString(info.Skip(110).Take(10).ToArray()).Trim('\n');
|
|
|
string temp13 = asciiEncoding.GetString(info.Skip(120).Take(10).ToArray()).Trim('\n');
|
|
|
string temp14 = asciiEncoding.GetString(info.Skip(130).Take(10).ToArray()).Trim('\n');
|
|
|
string temp15 = asciiEncoding.GetString(info.Skip(140).Take(10).ToArray()).Trim('\n');
|
|
|
string temp16 = asciiEncoding.GetString(info.Skip(150).Take(10).ToArray()).Trim('\n');
|
|
|
|
|
|
Console.WriteLine(temp16);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 读取模位产量1-10 ,10-20,20-30
|
|
|
/// </summary>
|
|
|
static List<DoorFoamMachine> ReadModeProduct(HwPLc.PlcModel obj)
|
|
|
{
|
|
|
if (obj == null) return null;
|
|
|
else
|
|
|
{
|
|
|
List<DoorFoamMachine> doorFoams = new List<DoorFoamMachine>();
|
|
|
if (obj.plc.IsConnected)
|
|
|
{
|
|
|
byte[] info = obj.plc.Read("DB4.1542", 160);
|
|
|
#region 1-10台车产量
|
|
|
if (info != null)
|
|
|
{
|
|
|
//1#台车1#枪A门,1#台车1#枪B门,1#台车2#枪A门,1#台车2#枪B门
|
|
|
int temp1 = int.Parse(StringChange.bytesToHexStr(info.Skip(0).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp2 = int.Parse(StringChange.bytesToHexStr(info.Skip(4).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =1,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp1.ToString(),
|
|
|
MoldProdutionB = temp2.ToString()
|
|
|
});
|
|
|
int temp3 = int.Parse(StringChange.bytesToHexStr(info.Skip(8).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp4 = int.Parse(StringChange.bytesToHexStr(info.Skip(12).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =1,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp3.ToString(),
|
|
|
MoldProdutionB = temp4.ToString()
|
|
|
});
|
|
|
int temp5 = int.Parse(StringChange.bytesToHexStr(info.Skip(16).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp6 = int.Parse(StringChange.bytesToHexStr(info.Skip(20).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =2,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp5.ToString(),
|
|
|
MoldProdutionB = temp6.ToString()
|
|
|
});
|
|
|
int temp7 = int.Parse(StringChange.bytesToHexStr(info.Skip(24).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp8 = int.Parse(StringChange.bytesToHexStr(info.Skip(28).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =2,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp7.ToString(),
|
|
|
MoldProdutionB = temp8.ToString()
|
|
|
});
|
|
|
int temp9 = int.Parse(StringChange.bytesToHexStr(info.Skip(32).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp10 = int.Parse(StringChange.bytesToHexStr(info.Skip(36).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =3,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp9.ToString(),
|
|
|
MoldProdutionB = temp10.ToString()
|
|
|
});
|
|
|
int temp11 = int.Parse(StringChange.bytesToHexStr(info.Skip(40).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp12 = int.Parse(StringChange.bytesToHexStr(info.Skip(44).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =3,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp11.ToString(),
|
|
|
MoldProdutionB = temp12.ToString()
|
|
|
});
|
|
|
int temp13 = int.Parse(StringChange.bytesToHexStr(info.Skip(48).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp14 = int.Parse(StringChange.bytesToHexStr(info.Skip(52).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =4,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp13.ToString(),
|
|
|
MoldProdutionB = temp14.ToString()
|
|
|
});
|
|
|
int temp15 = int.Parse(StringChange.bytesToHexStr(info.Skip(56).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp16 = int.Parse(StringChange.bytesToHexStr(info.Skip(60).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =4,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp15.ToString(),
|
|
|
MoldProdutionB = temp16.ToString()
|
|
|
});
|
|
|
int temp17 = int.Parse(StringChange.bytesToHexStr(info.Skip(64).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp18 = int.Parse(StringChange.bytesToHexStr(info.Skip(68).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =5,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp17.ToString(),
|
|
|
MoldProdutionB = temp18.ToString()
|
|
|
});
|
|
|
int temp19 = int.Parse(StringChange.bytesToHexStr(info.Skip(72).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp20 = int.Parse(StringChange.bytesToHexStr(info.Skip(76).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =5,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp19.ToString(),
|
|
|
MoldProdutionB = temp20.ToString()
|
|
|
});
|
|
|
int temp21 = int.Parse(StringChange.bytesToHexStr(info.Skip(80).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp22 = int.Parse(StringChange.bytesToHexStr(info.Skip(84).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =6,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp21.ToString(),
|
|
|
MoldProdutionB = temp22.ToString()
|
|
|
});
|
|
|
int temp23 = int.Parse(StringChange.bytesToHexStr(info.Skip(88).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp24 = int.Parse(StringChange.bytesToHexStr(info.Skip(92).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =6,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp23.ToString(),
|
|
|
MoldProdutionB = temp24.ToString()
|
|
|
});
|
|
|
int temp25 = int.Parse(StringChange.bytesToHexStr(info.Skip(96).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp26 = int.Parse(StringChange.bytesToHexStr(info.Skip(100).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =7,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp25.ToString(),
|
|
|
MoldProdutionB = temp26.ToString()
|
|
|
});
|
|
|
int temp27 = int.Parse(StringChange.bytesToHexStr(info.Skip(104).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp28 = int.Parse(StringChange.bytesToHexStr(info.Skip(108).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =7,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp27.ToString(),
|
|
|
MoldProdutionB = temp28.ToString()
|
|
|
});
|
|
|
int temp29 = int.Parse(StringChange.bytesToHexStr(info.Skip(112).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp30 = int.Parse(StringChange.bytesToHexStr(info.Skip(116).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =8,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp29.ToString(),
|
|
|
MoldProdutionB = temp30.ToString()
|
|
|
});
|
|
|
int temp31 = int.Parse(StringChange.bytesToHexStr(info.Skip(120).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp32 = int.Parse(StringChange.bytesToHexStr(info.Skip(124).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =8,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp31.ToString(),
|
|
|
MoldProdutionB = temp32.ToString()
|
|
|
});
|
|
|
int temp33 = int.Parse(StringChange.bytesToHexStr(info.Skip(128).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp34 = int.Parse(StringChange.bytesToHexStr(info.Skip(132).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =9,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp33.ToString(),
|
|
|
MoldProdutionB = temp34.ToString()
|
|
|
});
|
|
|
int temp35 = int.Parse(StringChange.bytesToHexStr(info.Skip(136).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp36 = int.Parse(StringChange.bytesToHexStr(info.Skip(140).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =9,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp35.ToString(),
|
|
|
MoldProdutionB = temp36.ToString()
|
|
|
});
|
|
|
int temp37 = int.Parse(StringChange.bytesToHexStr(info.Skip(144).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp38 = int.Parse(StringChange.bytesToHexStr(info.Skip(148).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =10,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp37.ToString(),
|
|
|
MoldProdutionB = temp38.ToString()
|
|
|
});
|
|
|
int temp39 = int.Parse(StringChange.bytesToHexStr(info.Skip(152).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp40 = int.Parse(StringChange.bytesToHexStr(info.Skip(156).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =10,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp39.ToString(),
|
|
|
MoldProdutionB = temp40.ToString()
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info2 = obj.plc.Read("DB4.1702", 160);
|
|
|
#region 11-20台车产量
|
|
|
if (info2 != null)
|
|
|
{
|
|
|
int temp1 = int.Parse(StringChange.bytesToHexStr(info2.Skip(0).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp2 = int.Parse(StringChange.bytesToHexStr(info2.Skip(4).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =11,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp1.ToString(),
|
|
|
MoldProdutionB = temp2.ToString()
|
|
|
});
|
|
|
int temp3 = int.Parse(StringChange.bytesToHexStr(info2.Skip(8).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp4 = int.Parse(StringChange.bytesToHexStr(info2.Skip(12).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =11,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp3.ToString(),
|
|
|
MoldProdutionB = temp4.ToString()
|
|
|
});
|
|
|
int temp5 = int.Parse(StringChange.bytesToHexStr(info2.Skip(16).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp6 = int.Parse(StringChange.bytesToHexStr(info2.Skip(20).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =12,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp5.ToString(),
|
|
|
MoldProdutionB = temp6.ToString()
|
|
|
});
|
|
|
int temp7 = int.Parse(StringChange.bytesToHexStr(info2.Skip(24).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp8 = int.Parse(StringChange.bytesToHexStr(info2.Skip(28).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =12,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp7.ToString(),
|
|
|
MoldProdutionB = temp8.ToString()
|
|
|
});
|
|
|
int temp9 = int.Parse(StringChange.bytesToHexStr(info2.Skip(32).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp10 = int.Parse(StringChange.bytesToHexStr(info2.Skip(36).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =13,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp9.ToString(),
|
|
|
MoldProdutionB = temp10.ToString()
|
|
|
});
|
|
|
int temp11 = int.Parse(StringChange.bytesToHexStr(info2.Skip(40).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp12 = int.Parse(StringChange.bytesToHexStr(info2.Skip(44).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =13,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp11.ToString(),
|
|
|
MoldProdutionB = temp12.ToString()
|
|
|
});
|
|
|
int temp13 = int.Parse(StringChange.bytesToHexStr(info2.Skip(48).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp14 = int.Parse(StringChange.bytesToHexStr(info2.Skip(52).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =14,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp13.ToString(),
|
|
|
MoldProdutionB = temp14.ToString()
|
|
|
});
|
|
|
int temp15 = int.Parse(StringChange.bytesToHexStr(info2.Skip(56).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp16 = int.Parse(StringChange.bytesToHexStr(info2.Skip(60).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =14,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp15.ToString(),
|
|
|
MoldProdutionB = temp16.ToString()
|
|
|
});
|
|
|
int temp17 = int.Parse(StringChange.bytesToHexStr(info2.Skip(64).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp18 = int.Parse(StringChange.bytesToHexStr(info2.Skip(68).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =15,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp17.ToString(),
|
|
|
MoldProdutionB = temp18.ToString()
|
|
|
});
|
|
|
int temp19 = int.Parse(StringChange.bytesToHexStr(info2.Skip(72).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp20 = int.Parse(StringChange.bytesToHexStr(info2.Skip(76).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =15,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp19.ToString(),
|
|
|
MoldProdutionB = temp20.ToString()
|
|
|
});
|
|
|
int temp21 = int.Parse(StringChange.bytesToHexStr(info2.Skip(80).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp22 = int.Parse(StringChange.bytesToHexStr(info2.Skip(84).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =16,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp21.ToString(),
|
|
|
MoldProdutionB = temp22.ToString()
|
|
|
});
|
|
|
int temp23 = int.Parse(StringChange.bytesToHexStr(info2.Skip(88).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp24 = int.Parse(StringChange.bytesToHexStr(info2.Skip(92).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =16,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp23.ToString(),
|
|
|
MoldProdutionB = temp24.ToString()
|
|
|
});
|
|
|
int temp25 = int.Parse(StringChange.bytesToHexStr(info2.Skip(96).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp26 = int.Parse(StringChange.bytesToHexStr(info2.Skip(100).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =17,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp25.ToString(),
|
|
|
MoldProdutionB = temp26.ToString()
|
|
|
});
|
|
|
int temp27 = int.Parse(StringChange.bytesToHexStr(info2.Skip(104).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp28 = int.Parse(StringChange.bytesToHexStr(info2.Skip(108).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =17,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp27.ToString(),
|
|
|
MoldProdutionB = temp28.ToString()
|
|
|
});
|
|
|
int temp29 = int.Parse(StringChange.bytesToHexStr(info2.Skip(112).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp30 = int.Parse(StringChange.bytesToHexStr(info2.Skip(116).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =18,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp29.ToString(),
|
|
|
MoldProdutionB = temp30.ToString()
|
|
|
});
|
|
|
int temp31 = int.Parse(StringChange.bytesToHexStr(info2.Skip(120).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp32 = int.Parse(StringChange.bytesToHexStr(info2.Skip(124).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =18,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp31.ToString(),
|
|
|
MoldProdutionB = temp32.ToString()
|
|
|
});
|
|
|
int temp33 = int.Parse(StringChange.bytesToHexStr(info2.Skip(128).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp34 = int.Parse(StringChange.bytesToHexStr(info2.Skip(132).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =19,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp33.ToString(),
|
|
|
MoldProdutionB = temp34.ToString()
|
|
|
});
|
|
|
int temp35 = int.Parse(StringChange.bytesToHexStr(info2.Skip(136).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp36 = int.Parse(StringChange.bytesToHexStr(info2.Skip(140).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =19,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp35.ToString(),
|
|
|
MoldProdutionB = temp36.ToString()
|
|
|
});
|
|
|
int temp37 = int.Parse(StringChange.bytesToHexStr(info2.Skip(144).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp38 = int.Parse(StringChange.bytesToHexStr(info2.Skip(148).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =20,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp37.ToString(),
|
|
|
MoldProdutionB = temp38.ToString()
|
|
|
});
|
|
|
int temp39 = int.Parse(StringChange.bytesToHexStr(info2.Skip(152).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp40 = int.Parse(StringChange.bytesToHexStr(info2.Skip(156).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =20,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp39.ToString(),
|
|
|
MoldProdutionB = temp40.ToString()
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info3 = obj.plc.Read("DB4.1862", 160);
|
|
|
#region 21-30台车产量
|
|
|
if (info3 != null)
|
|
|
{
|
|
|
int temp1 = int.Parse(StringChange.bytesToHexStr(info3.Skip(0).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp2 = int.Parse(StringChange.bytesToHexStr(info3.Skip(4).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =21,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp1.ToString(),
|
|
|
MoldProdutionB = temp2.ToString()
|
|
|
});
|
|
|
int temp3 = int.Parse(StringChange.bytesToHexStr(info3.Skip(8).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp4 = int.Parse(StringChange.bytesToHexStr(info3.Skip(12).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =21,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp3.ToString(),
|
|
|
MoldProdutionB = temp4.ToString()
|
|
|
});
|
|
|
int temp5 = int.Parse(StringChange.bytesToHexStr(info3.Skip(16).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp6 = int.Parse(StringChange.bytesToHexStr(info3.Skip(20).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =22,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp5.ToString(),
|
|
|
MoldProdutionB = temp6.ToString()
|
|
|
});
|
|
|
int temp7 = int.Parse(StringChange.bytesToHexStr(info3.Skip(24).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp8 = int.Parse(StringChange.bytesToHexStr(info3.Skip(28).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =22,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp7.ToString(),
|
|
|
MoldProdutionB = temp8.ToString()
|
|
|
});
|
|
|
int temp9 = int.Parse(StringChange.bytesToHexStr(info3.Skip(32).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp10 = int.Parse(StringChange.bytesToHexStr(info3.Skip(36).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =23,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp9.ToString(),
|
|
|
MoldProdutionB = temp10.ToString()
|
|
|
});
|
|
|
int temp11 = int.Parse(StringChange.bytesToHexStr(info3.Skip(40).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp12 = int.Parse(StringChange.bytesToHexStr(info3.Skip(44).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =23,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp11.ToString(),
|
|
|
MoldProdutionB = temp12.ToString()
|
|
|
});
|
|
|
int temp13 = int.Parse(StringChange.bytesToHexStr(info3.Skip(48).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp14 = int.Parse(StringChange.bytesToHexStr(info3.Skip(52).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =24,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp13.ToString(),
|
|
|
MoldProdutionB = temp14.ToString()
|
|
|
});
|
|
|
int temp15 = int.Parse(StringChange.bytesToHexStr(info3.Skip(56).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp16 = int.Parse(StringChange.bytesToHexStr(info3.Skip(60).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =24,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp15.ToString(),
|
|
|
MoldProdutionB = temp16.ToString()
|
|
|
});
|
|
|
int temp17 = int.Parse(StringChange.bytesToHexStr(info3.Skip(64).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp18 = int.Parse(StringChange.bytesToHexStr(info3.Skip(68).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =25,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp17.ToString(),
|
|
|
MoldProdutionB = temp18.ToString()
|
|
|
});
|
|
|
int temp19 = int.Parse(StringChange.bytesToHexStr(info3.Skip(72).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp20 = int.Parse(StringChange.bytesToHexStr(info3.Skip(76).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =25,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp19.ToString(),
|
|
|
MoldProdutionB = temp20.ToString()
|
|
|
});
|
|
|
int temp21 = int.Parse(StringChange.bytesToHexStr(info3.Skip(80).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp22 = int.Parse(StringChange.bytesToHexStr(info3.Skip(84).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =26,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp21.ToString(),
|
|
|
MoldProdutionB = temp22.ToString()
|
|
|
});
|
|
|
int temp23 = int.Parse(StringChange.bytesToHexStr(info3.Skip(88).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp24 = int.Parse(StringChange.bytesToHexStr(info3.Skip(92).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =26,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp23.ToString(),
|
|
|
MoldProdutionB = temp24.ToString()
|
|
|
});
|
|
|
int temp25 = int.Parse(StringChange.bytesToHexStr(info3.Skip(96).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp26 = int.Parse(StringChange.bytesToHexStr(info3.Skip(100).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =27,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp25.ToString(),
|
|
|
MoldProdutionB = temp26.ToString()
|
|
|
});
|
|
|
int temp27 = int.Parse(StringChange.bytesToHexStr(info3.Skip(104).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp28 = int.Parse(StringChange.bytesToHexStr(info3.Skip(108).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =27,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp27.ToString(),
|
|
|
MoldProdutionB = temp28.ToString()
|
|
|
});
|
|
|
int temp29 = int.Parse(StringChange.bytesToHexStr(info3.Skip(112).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp30 = int.Parse(StringChange.bytesToHexStr(info3.Skip(116).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =28,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp29.ToString(),
|
|
|
MoldProdutionB = temp30.ToString()
|
|
|
});
|
|
|
int temp31 = int.Parse(StringChange.bytesToHexStr(info3.Skip(120).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp32 = int.Parse(StringChange.bytesToHexStr(info3.Skip(124).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =28,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp31.ToString(),
|
|
|
MoldProdutionB = temp32.ToString()
|
|
|
});
|
|
|
int temp33 = int.Parse(StringChange.bytesToHexStr(info3.Skip(128).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp34 = int.Parse(StringChange.bytesToHexStr(info3.Skip(132).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =29,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp33.ToString(),
|
|
|
MoldProdutionB = temp34.ToString()
|
|
|
});
|
|
|
int temp35 = int.Parse(StringChange.bytesToHexStr(info3.Skip(136).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp36 = int.Parse(StringChange.bytesToHexStr(info3.Skip(140).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =29,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp35.ToString(),
|
|
|
MoldProdutionB = temp36.ToString()
|
|
|
});
|
|
|
int temp37 = int.Parse(StringChange.bytesToHexStr(info3.Skip(144).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp38 = int.Parse(StringChange.bytesToHexStr(info3.Skip(148).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =30,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp37.ToString(),
|
|
|
MoldProdutionB = temp38.ToString()
|
|
|
});
|
|
|
int temp39 = int.Parse(StringChange.bytesToHexStr(info3.Skip(152).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp40 = int.Parse(StringChange.bytesToHexStr(info3.Skip(156).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =30,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp39.ToString(),
|
|
|
MoldProdutionB = temp40.ToString()
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
byte[] info4 = obj.plc.Read("DB4.2022", 160);
|
|
|
#region 31-34台车产量
|
|
|
if (info4 != null)
|
|
|
{
|
|
|
int temp1 = int.Parse(StringChange.bytesToHexStr(info4.Skip(0).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp2 = int.Parse(StringChange.bytesToHexStr(info4.Skip(4).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =31,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp1.ToString(),
|
|
|
MoldProdutionB = temp2.ToString()
|
|
|
});
|
|
|
int temp3 = int.Parse(StringChange.bytesToHexStr(info4.Skip(8).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp4 = int.Parse(StringChange.bytesToHexStr(info4.Skip(12).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =31,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp3.ToString(),
|
|
|
MoldProdutionB = temp4.ToString()
|
|
|
});
|
|
|
int temp5 = int.Parse(StringChange.bytesToHexStr(info4.Skip(16).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp6 = int.Parse(StringChange.bytesToHexStr(info4.Skip(20).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =32,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp5.ToString(),
|
|
|
MoldProdutionB = temp6.ToString()
|
|
|
});
|
|
|
int temp7 = int.Parse(StringChange.bytesToHexStr(info4.Skip(24).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp8 = int.Parse(StringChange.bytesToHexStr(info4.Skip(28).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =32,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp7.ToString(),
|
|
|
MoldProdutionB = temp8.ToString()
|
|
|
});
|
|
|
int temp9 = int.Parse(StringChange.bytesToHexStr(info4.Skip(32).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp10 = int.Parse(StringChange.bytesToHexStr(info4.Skip(36).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =33,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp9.ToString(),
|
|
|
MoldProdutionB = temp10.ToString()
|
|
|
});
|
|
|
int temp11 = int.Parse(StringChange.bytesToHexStr(info4.Skip(40).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp12 = int.Parse(StringChange.bytesToHexStr(info4.Skip(44).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =33,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp11.ToString(),
|
|
|
MoldProdutionB = temp12.ToString()
|
|
|
});
|
|
|
int temp13 = int.Parse(StringChange.bytesToHexStr(info4.Skip(48).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp14 = int.Parse(StringChange.bytesToHexStr(info4.Skip(52).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =34,
|
|
|
GunNumber =1,
|
|
|
MoldProdutionA = temp13.ToString(),
|
|
|
MoldProdutionB = temp14.ToString()
|
|
|
});
|
|
|
int temp15 = int.Parse(StringChange.bytesToHexStr(info4.Skip(56).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp16 = int.Parse(StringChange.bytesToHexStr(info4.Skip(60).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
doorFoams.Add(new DoorFoamMachine()
|
|
|
{
|
|
|
StationTrolleyNumber =34,
|
|
|
GunNumber =2,
|
|
|
MoldProdutionA = temp15.ToString(),
|
|
|
MoldProdutionB = temp16.ToString()
|
|
|
});
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
return doorFoams;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 读取模位产量1-10 ,10-20,20-30
|
|
|
/// </summary>
|
|
|
static void ReadModeProductLast(HwPLc.PlcModel obj, string startStr, List<string> boxTypeList)
|
|
|
{
|
|
|
if (obj == null) return;
|
|
|
else
|
|
|
{
|
|
|
if (obj.plc.IsConnected)
|
|
|
{
|
|
|
byte[] info = obj.plc.Read(startStr, 64);
|
|
|
if (info == null) return;
|
|
|
//1#台车1#枪A门,1#台车1#枪B门,1#台车2#枪A门,1#台车2#枪B门
|
|
|
int temp1 = int.Parse(StringChange.bytesToHexStr(info.Skip(0).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp2 = int.Parse(StringChange.bytesToHexStr(info.Skip(4).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp3 = int.Parse(StringChange.bytesToHexStr(info.Skip(8).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp4 = int.Parse(StringChange.bytesToHexStr(info.Skip(12).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp5 = int.Parse(StringChange.bytesToHexStr(info.Skip(16).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp6 = int.Parse(StringChange.bytesToHexStr(info.Skip(20).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp7 = int.Parse(StringChange.bytesToHexStr(info.Skip(24).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp8 = int.Parse(StringChange.bytesToHexStr(info.Skip(28).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp9 = int.Parse(StringChange.bytesToHexStr(info.Skip(32).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp10 = int.Parse(StringChange.bytesToHexStr(info.Skip(36).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp11 = int.Parse(StringChange.bytesToHexStr(info.Skip(40).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp12 = int.Parse(StringChange.bytesToHexStr(info.Skip(44).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp13 = int.Parse(StringChange.bytesToHexStr(info.Skip(48).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp14 = int.Parse(StringChange.bytesToHexStr(info.Skip(52).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp15 = int.Parse(StringChange.bytesToHexStr(info.Skip(56).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
int temp16 = int.Parse(StringChange.bytesToHexStr(info.Skip(60).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
|
Console.WriteLine(temp16);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 读取设备状态及生产节拍
|
|
|
/// </summary>
|
|
|
static void ReadEquipStatusAndCycle(HwPLc.PlcModel obj, List<string> boxTypeList)
|
|
|
{
|
|
|
if (obj == null) return;
|
|
|
else
|
|
|
{
|
|
|
if (obj.plc.IsConnected)
|
|
|
{
|
|
|
byte[] info = obj.plc.Read("DB4.2086", 10);
|
|
|
if (info == null) return;
|
|
|
//设备状态1运行 2停机 3故障
|
|
|
int temp1 = judgeStatus(ByteArrayToBinary(info.Skip(0).Take(1).ToArray()));
|
|
|
// 生产节拍
|
|
|
float temp2 = byteToFloat(info.Skip(2).Take(4).ToArray());
|
|
|
//节拍
|
|
|
float temp3 = byteToFloat(info.Skip(6).Take(4).ToArray());
|
|
|
Console.WriteLine(temp1);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 读取设备报警信息
|
|
|
/// </summary>
|
|
|
static void ReadWarnInfo(HwPLc.PlcModel obj, List<string> boxTypeList)
|
|
|
{
|
|
|
if (obj == null) return;
|
|
|
else
|
|
|
{
|
|
|
if (obj.plc.IsConnected)
|
|
|
{
|
|
|
byte[] info = obj.plc.Read("DB4.2136", 4);
|
|
|
if (info == null) return;
|
|
|
//1-主驱动报警 2-枪1X轴伺服异常 3-枪2X轴伺服异常 4-换模位门打开 5-枪1急停被激活 6-枪2急停被激活 7-枪1发泡机报警 8-枪2发泡机报警
|
|
|
int temp1 = judgeStatus(ByteArrayToBinary(info.Skip(0).Take(1).ToArray()));
|
|
|
|
|
|
|
|
|
Console.WriteLine(temp1);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region 字符工具转换方法
|
|
|
/// <summary>
|
|
|
/// byte数组转换为float
|
|
|
/// </summary>
|
|
|
static float byteToFloat(byte[] list)
|
|
|
{
|
|
|
float result = 0.00f;
|
|
|
Array.Reverse(list);
|
|
|
result = BitConverter.ToSingle(list, 0);
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// byte[]转二进制,读两字节,截取1字节 00000000 (00100000)
|
|
|
/// </summary>
|
|
|
/// <param name="bytes"></param>
|
|
|
static string ByteArrayToBinary(byte[] bytes)
|
|
|
{
|
|
|
StringBuilder binaryString = new StringBuilder();
|
|
|
|
|
|
foreach (byte b in bytes)
|
|
|
{
|
|
|
binaryString.Append(Convert.ToString(b, 2).PadLeft(8, '0'));
|
|
|
}
|
|
|
|
|
|
// Console.WriteLine(binaryString);
|
|
|
|
|
|
string reversedStr = new string(binaryString.ToString().Reverse().ToArray());
|
|
|
// Console.WriteLine(reversedStr);
|
|
|
|
|
|
return reversedStr;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据二进制字符串确定夹具状态 1正常生产 2暂停生产
|
|
|
/// </summary>
|
|
|
static int judgeStatus(string str1)
|
|
|
{
|
|
|
int item1 = 0;
|
|
|
if (str1.Substring(0, 1) == "1")
|
|
|
{
|
|
|
item1 = 1; //
|
|
|
}
|
|
|
else if (str1.Substring(1, 1) =="1")
|
|
|
{
|
|
|
item1 = 2; //
|
|
|
}
|
|
|
else if (str1.Substring(2, 1) =="1")
|
|
|
{
|
|
|
item1 = 3; //
|
|
|
}
|
|
|
else if (str1.Substring(3, 1) =="1")
|
|
|
{
|
|
|
item1 = 4; //
|
|
|
}
|
|
|
else if (str1.Substring(4, 1) =="1")
|
|
|
{
|
|
|
item1 = 5; //
|
|
|
}
|
|
|
else if (str1.Substring(5, 1) =="1")
|
|
|
{
|
|
|
item1 = 6; //
|
|
|
}
|
|
|
else if (str1.Substring(6, 1) =="1")
|
|
|
{
|
|
|
item1 = 7; //
|
|
|
}
|
|
|
else if (str1.Substring(7, 1) =="1")
|
|
|
{
|
|
|
item1 = 8; //
|
|
|
}
|
|
|
return item1;
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
|
|
|
|