|
@@ -1196,6 +1196,9 @@ namespace B20UVLog
|
|
|
|
|
|
private void IOLogTask()
|
|
|
{
|
|
|
+
|
|
|
+ List<IONewModel> ioNewModelList = new List<IONewModel>();
|
|
|
+ DateTime recordTime;
|
|
|
taskList.Add(Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
while (true)
|
|
@@ -1217,15 +1220,41 @@ namespace B20UVLog
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
+ recordTime = DateTime.Now;
|
|
|
+ ioNewModelList.Clear();
|
|
|
foreach (PlcItemModel plcItem in ioItemLst)
|
|
|
{
|
|
|
ParsePlcItemData(plcItem, ioRet.Content, 0);
|
|
|
+ //转化为
|
|
|
+ IONewModel ioNewModel = new IONewModel();
|
|
|
+ ioNewModel.IOName = plcItem.PlcItemCode;
|
|
|
+ if (plcItem.PlcItemCode.Contains("Stage"))
|
|
|
+ {
|
|
|
+ ioNewModel.IOType = "Stage";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (plcItem.PlcItemCode.Contains("IrradiatorInput"))
|
|
|
+ {
|
|
|
+ ioNewModel.IOType = "IrradiatorInput";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (plcItem.PlcItemCode.Contains("IrradiatorOutput"))
|
|
|
+ {
|
|
|
+ ioNewModel.IOType = "IrradiatorOutput";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ioNewModel.IOValue = Convert.ToInt32(plcItem.Value);
|
|
|
+ ioNewModel.RecordTime = recordTime;
|
|
|
+ ioNewModelList.Add(ioNewModel);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
//ToDo:把PLC数据插入到数据库中
|
|
|
- IOModel axisData = MapPlcItemToObjectProperty<IOModel>(ioItemLst);
|
|
|
- axisData.RecordTime = DateTime.Now;
|
|
|
- DbHelper.Db.Insertable(axisData).ExecuteCommand();
|
|
|
+
|
|
|
+ DbHelper.Db.Insertable(ioNewModelList).ExecuteCommand();
|
|
|
|
|
|
}
|
|
|
|