|
@@ -188,12 +188,12 @@ namespace B20UVLog
|
|
|
YMeasureDataLogTask();
|
|
|
EQPStatusLogTask();
|
|
|
RecipeBodyLogTask();
|
|
|
- // AnalogDataLogTask();
|
|
|
- // LampDataLogTask();
|
|
|
+ AnalogDataLogTask();
|
|
|
+ LampDataLogTask();
|
|
|
AlarmLogTask();
|
|
|
WarnLogTask();
|
|
|
IOLogTask();
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -957,32 +957,34 @@ namespace B20UVLog
|
|
|
}
|
|
|
|
|
|
{
|
|
|
- OperateResult<short[]> analogDataRet = melsec_net.ReadInt16(AnalogDataPLC.PlcItemAddressType + AnalogDataPLC.PlcItemStartAddress, (ushort)AnalogDataPLC.PlcItemAddressLength);
|
|
|
+
|
|
|
List<PlcItemModel> analogPlcItemLst = DbHelper.Db.Queryable<PlcItemModel>().Where(x => x.PlcItemType == AnalogDataPLC.PlcItemType).ToList();
|
|
|
- if (!analogDataRet.IsSuccess || analogDataRet.Content.Length <= 0 || analogPlcItemLst is null || analogPlcItemLst.Count <= 0)
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
- foreach (PlcItemModel plcItem in analogPlcItemLst)
|
|
|
+ foreach(var item in analogPlcItemLst)
|
|
|
{
|
|
|
- ParsePlcItemData(plcItem, analogDataRet.Content, 0);
|
|
|
+ item.Value= melsec_net.ReadInt16(item.PlcAddr).Content;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ //foreach (PlcItemModel plcItem in analogPlcItemLst)
|
|
|
+ //{
|
|
|
+ // ParsePlcItemData(plcItem, analogDataRet.Content, 0);
|
|
|
+ //}
|
|
|
|
|
|
//ToDo:把PLC数据插入到数据库中
|
|
|
AnalogDataModel analogData = MapPlcItemToObjectProperty<AnalogDataModel>(analogPlcItemLst);
|
|
|
//几个字段特殊读取
|
|
|
- OperateResult<short> stageMain = melsec_net.ReadInt16("D16640");
|
|
|
- analogData.StageMainCDA= stageMain.Content;
|
|
|
- OperateResult<short> irradiator = melsec_net.ReadInt16("D16642");
|
|
|
- analogData.IrradiatorMainCDA = irradiator.Content;
|
|
|
- OperateResult<short> z1Current = melsec_net.ReadInt16("D16650");
|
|
|
- analogData.Z1Current = z1Current.Content;
|
|
|
- OperateResult<short> z2Current = melsec_net.ReadInt16("D16652");
|
|
|
- analogData.Z2Current = z2Current.Content;
|
|
|
- OperateResult<short> z3Current = melsec_net.ReadInt16("D16654");
|
|
|
- analogData.Z3Current = z3Current.Content;
|
|
|
- OperateResult<short> z4Current = melsec_net.ReadInt16("D16656");
|
|
|
- analogData.Z4Current = z4Current.Content;
|
|
|
+ //OperateResult<short> stageMain = melsec_net.ReadInt16("D16640");
|
|
|
+ //analogData.StageMainCDA= stageMain.Content;
|
|
|
+ //OperateResult<short> irradiator = melsec_net.ReadInt16("D16642");
|
|
|
+ //analogData.IrradiatorMainCDA = irradiator.Content;
|
|
|
+ //OperateResult<short> z1Current = melsec_net.ReadInt16("D16650");
|
|
|
+ //analogData.Z1Current = z1Current.Content;
|
|
|
+ //OperateResult<short> z2Current = melsec_net.ReadInt16("D16652");
|
|
|
+ //analogData.Z2Current = z2Current.Content;
|
|
|
+ //OperateResult<short> z3Current = melsec_net.ReadInt16("D16654");
|
|
|
+ //analogData.Z3Current = z3Current.Content;
|
|
|
+ //OperateResult<short> z4Current = melsec_net.ReadInt16("D16656");
|
|
|
+ //analogData.Z4Current = z4Current.Content;
|
|
|
|
|
|
analogData.RecordTime = DateTime.Now;
|
|
|
DbHelper.Db.Insertable(analogData).ExecuteCommand();
|
|
@@ -1015,24 +1017,21 @@ namespace B20UVLog
|
|
|
}
|
|
|
|
|
|
{
|
|
|
- OperateResult<short[]> lampDataRet = melsec_net.ReadInt16(LampDataPLC.PlcItemAddressType + LampDataPLC.PlcItemStartAddress, (ushort)AnalogDataPLC.PlcItemAddressLength);
|
|
|
+ //OperateResult<short[]> lampDataRet = melsec_net.ReadInt16(LampDataPLC.PlcItemAddressType + LampDataPLC.PlcItemStartAddress, (ushort)AnalogDataPLC.PlcItemAddressLength);
|
|
|
List<PlcItemModel> lampDataItemLst = DbHelper.Db.Queryable<PlcItemModel>().Where(x => x.PlcItemType == LampDataPLC.PlcItemType).ToList();
|
|
|
- if (!lampDataRet.IsSuccess || lampDataRet.Content.Length <= 0 || lampDataItemLst is null || lampDataItemLst.Count <= 0)
|
|
|
+ foreach (var item in lampDataItemLst)
|
|
|
{
|
|
|
- continue;
|
|
|
- }
|
|
|
- foreach (PlcItemModel plcItem in lampDataItemLst)
|
|
|
- {
|
|
|
- ParsePlcItemData(plcItem, lampDataRet.Content, 0);
|
|
|
+ item.Value = melsec_net.ReadInt16(item.PlcAddr).Content;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//ToDo:把PLC数据插入到数据库中
|
|
|
- LampDataModel axisData = MapPlcItemToObjectProperty<LampDataModel>(lampDataItemLst);
|
|
|
+ LampDataModel lampData = MapPlcItemToObjectProperty<LampDataModel>(lampDataItemLst);
|
|
|
//几个字段特殊读取
|
|
|
|
|
|
-
|
|
|
- axisData.RecordTime = DateTime.Now;
|
|
|
- DbHelper.Db.Insertable(axisData).ExecuteCommand();
|
|
|
+
|
|
|
+ lampData.RecordTime = DateTime.Now;
|
|
|
+ DbHelper.Db.Insertable(lampData).ExecuteCommand();
|
|
|
|
|
|
}
|
|
|
|