添加485串口线路指令

This commit is contained in:
sc authored and sc committed 2025-10-10 00:56:14 +08:00
commit 927c38853d
3 files changed
+168 -41

No files matched your search

+68 -32
View File
@@ -1114,37 +1114,55 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}
else
{//串口
int index = Convert.ToInt16(MachinesRow["ID"]);
string dat_ = "SC827[" + MachinesRow["Station"] + "]";
if (MachinesRow["Serial"].ToString() == "PORT1")
{
stringQueueSerial_1.Enqueue(new QueueSerial
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat_);
if (!exists)
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC827[" + MachinesRow["Station"] + "]"
});
stringQueueSerial_1.Enqueue(new QueueSerial
{
ID = index,
DAT = dat_
});
}
}
else if (MachinesRow["Serial"].ToString() == "PORT2")
{
stringQueueSerial_2.Enqueue(new QueueSerial
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat_);
if (!exists)
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC827[" + MachinesRow["Station"] + "]"
});
stringQueueSerial_2.Enqueue(new QueueSerial
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC827[" + MachinesRow["Station"] + "]"
});
}
}
else if (MachinesRow["Serial"].ToString() == "PORT3")
{
stringQueueSerial_3.Enqueue(new QueueSerial
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat_);
if (!exists)
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC827[" + MachinesRow["Station"] + "]"
});
stringQueueSerial_3.Enqueue(new QueueSerial
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC827[" + MachinesRow["Station"] + "]"
});
}
}
else if (MachinesRow["Serial"].ToString() == "PORT4")
{
stringQueueSerial_4.Enqueue(new QueueSerial
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat_);
if (!exists)
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC827[" + MachinesRow["Station"] + "]"
});
stringQueueSerial_4.Enqueue(new QueueSerial
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC827[" + MachinesRow["Station"] + "]"
});
}
}
}
}
@@ -1175,37 +1193,55 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}
else
{//串口
int index = Convert.ToInt16(MachinesRow["ID"]);
string dat_ = "SC828[" + MachinesRow["Station"] + "]" + Product_.ToJsonString();
if (MachinesRow["Serial"].ToString() == "PORT1")
{
stringQueueSerial_1.Enqueue(new QueueSerial
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat_);
if (!exists)
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC828[" + MachinesRow["Station"] + "]" + Product_.ToJsonString()
});
stringQueueSerial_1.Enqueue(new QueueSerial
{
ID = index,
DAT = dat_
});
}
}
else if (MachinesRow["Serial"].ToString() == "PORT2")
{
stringQueueSerial_2.Enqueue(new QueueSerial
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat_);
if (!exists)
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC828[" + MachinesRow["Station"] + "]" + Product_.ToJsonString()
});
stringQueueSerial_2.Enqueue(new QueueSerial
{
ID = index,
DAT = dat_
});
}
}
else if (MachinesRow["Serial"].ToString() == "PORT3")
{
stringQueueSerial_3.Enqueue(new QueueSerial
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat_);
if (!exists)
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC828[" + MachinesRow["Station"] + "]" + Product_.ToJsonString()
});
stringQueueSerial_3.Enqueue(new QueueSerial
{
ID = index,
DAT = dat_
});
}
}
else if (MachinesRow["Serial"].ToString() == "PORT4")
{
stringQueueSerial_4.Enqueue(new QueueSerial
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat_);
if (!exists)
{
ID = Convert.ToInt16(MachinesRow["ID"]),
DAT = "SC828[" + MachinesRow["Station"] + "]" + Product_.ToJsonString()
});
stringQueueSerial_4.Enqueue(new QueueSerial
{
ID = index,
DAT = dat_
});
}
}
}