更换通讯库版本
This commit is contained in:
+10
-10
@@ -150,7 +150,7 @@ namespace JY.Inspection
|
||||
public CancellationTokenSource mCOMState = new CancellationTokenSource();
|
||||
private ManualResetEvent resetEventRecv = new ManualResetEvent(true);
|
||||
|
||||
private ByteTransformBase TransformBase = new ByteTransformBase();
|
||||
//private ByteTransformBase TransformBase = new ByteTransformBase();
|
||||
|
||||
/// <summary>
|
||||
/// 用于电芯出站时向FMS上报出站及生产数据
|
||||
@@ -2024,8 +2024,8 @@ namespace JY.Inspection
|
||||
byte[] bytes = resByte.Content.ByteReverse();
|
||||
//前面有\03\00 标识 占2个字节
|
||||
int offset = 0;
|
||||
listBar[0] = TransformBase.TransString(bytes, 0+ offset, 20*2, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();//1# 条码
|
||||
listBar[1] = TransformBase.TransString(bytes, 40+ offset, 20*2, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();//2# 条码
|
||||
listBar[0] = omronPLCCom.lstMcUI[0].omronCipNet.ByteTransform.TransString(bytes, 0+ offset, 20*2, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();//1# 条码
|
||||
listBar[1] = omronPLCCom.lstMcUI[0].omronCipNet.ByteTransform.TransString(bytes, 40+ offset, 20*2, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();//2# 条码
|
||||
// listBar[2] = TransformBase.TransString(bytes, 80+ offset, 20 * 2, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();//3# 条码
|
||||
//新增 左右通道
|
||||
var dtGroup = 0;
|
||||
@@ -2300,7 +2300,7 @@ namespace JY.Inspection
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
// 出站条码: 偏移0, 每通道40字节(20字符)
|
||||
containers.ListBarOut[i] = TransformBase.TransString(
|
||||
containers.ListBarOut[i] = omronPLCCom.lstMcUI[0].omronCipNet.ByteTransform.TransString(
|
||||
bytes, 0 + (i * 40 * 2), 20 * 2, System.Text.Encoding.ASCII)
|
||||
.Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
|
||||
@@ -2310,25 +2310,25 @@ namespace JY.Inspection
|
||||
for (int j = 0; j < ConstValue.CCD_SDict.Count; j++)
|
||||
{
|
||||
int index = (i * 50 * 2) + j * 2;
|
||||
lstBarResult[j] = (short)TransformBase.TransInt16(sByteArr, index);
|
||||
lstBarResult[j] = (short)omronPLCCom.lstMcUI[0].omronCipNet.ByteTransform.TransInt16(sByteArr, index);
|
||||
}
|
||||
|
||||
// 浮点型结果: 3500起/3550
|
||||
for (int k = 0; k < ConstValue.CCD_FDict.Count; k++)
|
||||
{
|
||||
int index = (i * 50 * 2) + k * 2 * 2;
|
||||
containers.ListCCDFResult[i][k] = TransformBase.TransSingle(fByteArr, index);
|
||||
containers.ListCCDFResult[i][k] = omronPLCCom.lstMcUI[0].omronCipNet.ByteTransform.TransSingle(fByteArr, index);
|
||||
}
|
||||
|
||||
// 整型结果: 3600起/3650
|
||||
for (int k = 0; k < ConstValue.CCD_IDict.Count; k++)
|
||||
{
|
||||
int index = (i * 50 * 2) + k * 2;
|
||||
containers.ListCCDIResult[i][k] = TransformBase.TransInt16(iByteArr, index);
|
||||
containers.ListCCDIResult[i][k] = omronPLCCom.lstMcUI[0].omronCipNet.ByteTransform.TransInt16(iByteArr, index);
|
||||
}
|
||||
|
||||
// 进站条码: 偏移280(140*2), 每通道40字节
|
||||
containers.ListBarIn[i] = TransformBase.TransString(
|
||||
containers.ListBarIn[i] = omronPLCCom.lstMcUI[0].omronCipNet.ByteTransform.TransString(
|
||||
bytes, 140 * 2 + (i * 20 * 2), 20 * 2, System.Text.Encoding.ASCII)
|
||||
.Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
}
|
||||
@@ -3156,7 +3156,7 @@ namespace JY.Inspection
|
||||
}
|
||||
|
||||
//AddLog(0, "读取报警耗时:" + sw.ElapsedMilliseconds + "ms");
|
||||
if (listAlamByte == null) { return; }
|
||||
if (listAlamByte == null || listAlamByte.Count == 0) { return; }
|
||||
|
||||
//string strFileName = Environment.CurrentDirectory + "\\欧姆龙报警寄存器对应表.csv";
|
||||
//listAlarmForm = CSVHelper<AlarmForm>.ReadCSV(strFileName);
|
||||
@@ -3402,7 +3402,7 @@ namespace JY.Inspection
|
||||
try
|
||||
{
|
||||
sw.Restart();
|
||||
string code = Convert.ToString(TransformBase.TransInt16(resByte.Content, 0));//读取工位编码,W7010
|
||||
string code = Convert.ToString(omronPLCCom.lstMcUI[0].omronCipNet.ByteTransform.TransInt16(resByte.Content, 0));//读取工位编码,W7010
|
||||
omronPLCCom.lstMcUI[0].WriteDReg(omronPLCCom.lstMcUI[0].lstTrgUI[3].TrgParams.ResultAddr, 1);//结果返回PLC,W7100
|
||||
omronPLCCom.lstMcUI[0].ClearReg(omronPLCCom.lstMcUI[0].lstTrgUI[3].TrgParams.TriggerAddr, VarType.Short);//复位PLC信号,W7000
|
||||
sw.Stop();
|
||||
|
||||
Reference in New Issue
Block a user