/// <summary> /// 根据点位自动生成遥控字符串 /// </summary> public void AutoCreateYK(List <MyObject> m_ObjectList) { try { DBOPs db = new DBOPs(); int commandid = 0; List <PLCEqu> insertEqu = new List <PLCEqu>(); for (int i = 0; i < m_ObjectList.Count; i++) { if (m_ObjectList[i] is PLCEqu) { //生成遥信字符串 var plcEqu = m_ObjectList[i] as PLCEqu; if (plcEqu.plc_pro.ykList.Count > 0) { continue; } #region switch (plcEqu.equtype) { case MyObject.ObjectType.P: break; case MyObject.ObjectType.P_AF: break; case MyObject.ObjectType.P_CL: break; case MyObject.ObjectType.P_CO: break; case MyObject.ObjectType.P_GJ: break; case MyObject.ObjectType.P_HL: commandid = 47; AddYKStr(PlcString.strYKhl, plcEqu, commandid); break; case MyObject.ObjectType.P_HL2: commandid = 51; AddYKStr(PlcString.strYKhl2, plcEqu, commandid); break; case MyObject.ObjectType.P_JF: commandid = 40; AddYKStr(PlcString.strYKjf, plcEqu, commandid); break; case MyObject.ObjectType.P_L: commandid = 34; AddYKStr(PlcString.stryk2byte, plcEqu, commandid); break; case MyObject.ObjectType.P_LJQ: commandid = 36; AddYKStr(PlcString.stryk2byte, plcEqu, commandid); break; case MyObject.ObjectType.P_LLDI: break; case MyObject.ObjectType.P_LYJ: commandid = 38; AddYKStr(PlcString.stryk2byte, plcEqu, commandid); break; case MyObject.ObjectType.P_P: break; case MyObject.ObjectType.P_TD: commandid = 58; AddYKStr(PlcString.strYKTD, plcEqu, commandid); break; case MyObject.ObjectType.P_TL2_Close: commandid = 114; AddYKStr(PlcString.stryk2byte, plcEqu, commandid); break; case MyObject.ObjectType.P_TL2_Down: commandid = 67; AddYKStr(PlcString.stryk2byte, plcEqu, commandid); break; case MyObject.ObjectType.P_TL2_Left: break; case MyObject.ObjectType.P_TL2_Right: break; case MyObject.ObjectType.P_TL2_UP: commandid = 71; AddYKStr(PlcString.stryk2byte, plcEqu, commandid); break; case MyObject.ObjectType.P_TL3_Down: break; case MyObject.ObjectType.P_TL3_Left: break; case MyObject.ObjectType.P_TL3_Right: break; case MyObject.ObjectType.P_TL3_UP: break; case MyObject.ObjectType.P_TL4_Down: break; case MyObject.ObjectType.P_TL4_Left: break; case MyObject.ObjectType.P_TL4_Right: break; case MyObject.ObjectType.P_TL4_UP: break; case MyObject.ObjectType.P_TL5_Down: break; case MyObject.ObjectType.P_TL5_Left: commandid = 105; AddYKStr(PlcString.strYKtl1, plcEqu, commandid); break; case MyObject.ObjectType.P_TL5_Right: commandid = 109; AddYKStr(PlcString.strYKtl1, plcEqu, commandid); break; case MyObject.ObjectType.P_TL5_UP: commandid = 97; AddYKStr(PlcString.strYKtl, plcEqu, commandid); break; case MyObject.ObjectType.P_TL_Down: commandid = 85; AddYKStr(PlcString.strYKtl, plcEqu, commandid); break; case MyObject.ObjectType.P_TL_Left: break; case MyObject.ObjectType.P_TL_Right: break; case MyObject.ObjectType.P_TL_UP: break; case MyObject.ObjectType.P_TW: break; case MyObject.ObjectType.P_VI: break; default: break; } #endregion insertEqu.Add(plcEqu); } } if (insertEqu.Count > 0) { db.InsertYK(insertEqu); gMain.log.WriteLog("自动生成遥控字符串成功!"); } } catch (Exception e) { gMain.log.WriteLog("AutoCreateYK:" + e); } }