From bc7f1c4e028e69be51079b59dae4ae5c4d43f5bb Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 31 一月 2026 21:54:56 +0800
Subject: [PATCH] 1.状态指示图,目前灰色表示掉线,绿色表示在线。增加Slot的小点表示有没有料,及加工状态 。 2.增加图示
---
SourceCode/Bond/Servo/SECSRuntimeManager.h | 252 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 245 insertions(+), 7 deletions(-)
diff --git a/SourceCode/Bond/Servo/SECSRuntimeManager.h b/SourceCode/Bond/Servo/SECSRuntimeManager.h
index 8c11a96..a3bc39d 100644
--- a/SourceCode/Bond/Servo/SECSRuntimeManager.h
+++ b/SourceCode/Bond/Servo/SECSRuntimeManager.h
@@ -31,6 +31,34 @@
*/
void termRuntimeSetting();
+ /**
+ * 鍒濆鍖栨寚瀹氱殑 SystemV 琛�
+ * @param tableName: 瑕佸垵濮嬪寲鐨勮〃鍚嶏紙濡� "SystemSV" 鎴� "SystemDV"锛夈��
+ *
+ * 姝ゅ嚱鏁扮敤浜庡垵濮嬪寲鎸囧畾鍚嶇О鐨� SystemV 琛ㄣ�傚鏋滆〃涓嶅瓨鍦紝灏嗕細鍒涘缓璇ヨ〃銆�
+ * - 琛ㄧ粨鏋勫寘鎷細ID銆丯ame銆丏ataType銆丩ength銆乁nit銆丷emark銆丼ystemID銆�
+ * - 濡傛灉琛ㄥ凡缁忓瓨鍦紝鍒欎笉杩涜浠讳綍鎿嶄綔銆�
+ */
+ void initSystemVTable(const std::string& tableName);
+
+ int addSystemVData(const std::string& tableName, int nID, const std::string& sName, const std::string& sDataType, int nLength, const std::string& sUnit, const std::string& sRemark, int nSystemID);
+
+ std::vector<std::vector<std::string>> getSystemVByID(const std::string& tableName, int nID);
+
+ std::vector<std::vector<std::string>> getAllSystemV(const std::string& tableName);
+
+ int updateIDSystemV(const std::string& tableName, int nID, int sNewID);
+
+ int updateAllSystemV(const std::string& tableName, int nID, int sNewID, const std::string& sName, const std::string& sDataType, int nLength, const std::string& sUnit, const std::string& sRemark, int nSystemID);
+
+ void initEqpVTable(const std::string& tableName);
+
+ int addEqpVData(const std::string& tableName, int nID, const std::string& sName, const std::string& sDataType, int nLength, const std::string& sUnit, const std::string& sRemark, int nSeqNo);
+
+ std::vector<std::vector<std::string>> getEqpVDataByID(const std::string& tableName, int nID);
+
+ int updateEqpV(const std::string& tableName, int nID, int nNewID, const std::string& sName, const std::string& sDataType, int nLength, const std::string& sUnit, const std::string& sRemark, int nSeqNo);
+
/**
* 鍒濆鍖朣ystemSV琛�
*/
@@ -190,14 +218,8 @@
/**
* 鑾峰彇鎵�鏈� EqpSV 鏁版嵁
- * @return std::vector<std::vector<std::string>>: 杩斿洖涓�涓簩缁村瓧绗︿覆鍚戦噺锛岃〃绀烘煡璇㈢粨鏋溿�傛瘡琛屼唬琛ㄤ竴鏉¤褰曪紝姣忓垪浠h〃璇ヨ褰曠殑涓�涓瓧娈靛�笺��
- * 濡傛灉琛ㄤ腑鏈夋暟鎹紝鍒欒繑鍥炴墍鏈夎褰曪紱濡傛灉琛ㄤ负绌猴紝鍒欒繑鍥炵┖鐨勪簩缁村悜閲忋��
- *
- * 姝ゅ嚱鏁扮敤浜庝粠 EqpSV 琛ㄤ腑鑾峰彇鎵�鏈夌殑鏁版嵁銆傞�氳繃鏋勯�� SQL 鏌ヨ璇彞鏉ラ�夋嫨鎵�鏈夎褰曪紝骞舵墽琛屾煡璇㈡搷浣溿��
- * 杩斿洖鐨勭粨鏋滄槸涓�涓簩缁村瓧绗︿覆鍚戦噺锛岃〃绀鸿〃涓殑鎵�鏈夎褰曘�傛瘡琛屾暟鎹槸涓�涓瓧绗︿覆鍚戦噺锛屽叾涓寘鍚璁板綍鐨勫悇涓瓧娈点��
- * 濡傛灉琛ㄤ腑娌℃湁鏁版嵁锛屽嚱鏁板皢杩斿洖涓�涓┖鐨勪簩缁村悜閲忋��
*/
- std::vector<std::vector<std::string>> SECSRuntimeManager::getAllEqpSV();
+ bool getAllEqpSV(std::vector<std::vector<std::string>>& outEqpSV);
/**
* 鏇存柊鎸囧畾 ID 鐨� EqpSV 鏁版嵁
@@ -258,30 +280,104 @@
*/
void initSystemDVTable();
+ int addSystemDV(int nID, const std::string& sName, const std::string& sDataType, int nLength, const std::string& sUnit, const std::string& sRemark, int nSystemID);
+
+ std::vector<std::vector<std::string>> getSystemDVByID(int nID);
+
+ std::vector<std::vector<std::string>> getAllSystemDV();
+
+ int updateIDSystemDV(int nID, int sNewID);
+
+ int updateAllSystemDV(int nID, int sNewID, const std::string& sName, const std::string& sDataType, int nLength, const std::string& sUnit, const std::string& sRemark, int nSystemID);
+
+ int deleteSystemDVByID(int nID);
+
+ int deleteAllSystemDV();
+
/**
* 鍒濆鍖� EqpDV 琛�
*/
void initEqpDVTable();
+
+ int addEqpDV(int nID, const std::string& sName, const std::string& sDataType, int nLength, const std::string& sUnit, const std::string& sRemark, int nSeqNo);
+
+ std::vector<std::vector<std::string>> getEqpDVByID(int nID);
+
+ bool getAllEqpDV(std::vector<std::vector<std::string>>& outEqpDV);
+
+ int updateEqpDV(int nID, int nNewID, const std::string& sName, const std::string& sDataType, int nLength, const std::string& sUnit, const std::string& sRemark, int nSeqNo);
+
+ int deleteEqpDVByID(int nID);
+
+ int deleteAllEqpDV();
/**
* 鍒濆鍖� SystemEC 琛�
*/
void initSystemECTable();
+ int addSystemEC(int nID, const std::string& sName, const std::string& sDataType, int nMinValue, int nMaxValue, int nDefaultVal, const std::string& sUnit, const std::string& sRemark, int nSystemID);
+
+ std::vector<std::vector<std::string>> getSystemECByID(int nID);
+
+ std::vector<std::vector<std::string>> getAllSystemEC();
+
+ int updateSystemEC(int nID, int nNewID, const std::string& sName, const std::string& sDataType, int nMinValue, int nMaxValue, int nDefaultVal, const std::string& sUnit, const std::string& sRemark, int nSystemID);
+
+ int deleteSystemECByID(int nID);
+
+ int deleteAllSystemEC();
+
/**
* 鍒濆鍖� EqpEC 琛�
*/
void initEqpECTable();
+
+ int addEqpEC(int nID, const std::string& sName, const std::string& sDataType, int nMinValue, int nMaxValue, int nDefaultValue, const std::string& sUnit, const std::string& sRemark, int nSeqNo, int nLength, int bCanUpdateByHost);
+
+ std::vector<std::vector<std::string>> getEqpECByID(int nID);
+
+ std::vector<std::vector<std::string>> getAllEqpEC();
+
+ int updateEqpEC(int nID, int nNewID, const std::string& sName, const std::string& sDataType, int nMinValue, int nMaxValue, int nDefaultValue, const std::string& sUnit, const std::string& sRemark, int nSeqNo, int nLength, int bCanUpdateByHost);
+
+ int deleteEqpECByID(int nID);
+
+ int deleteAllEqpEC();
/**
* 鍒濆鍖� SystemEvent 琛�
*/
void initSystemEventTable();
+ int addSystemEvent(int nCEID, const std::string& sName, const std::string& sRemark, int nSystemID);
+
+ std::vector<std::vector<std::string>> getSystemEventByID(int nCEID);
+
+ std::vector<std::vector<std::string>> getAllSystemEvents();
+
+ int updateSystemEvent(int nCEID, int nNewCEID, const std::string& sName, const std::string& sRemark, int nSystemID);
+
+ int deleteSystemEventByID(int nCEID);
+
+ int deleteAllSystemEvents();
+
/**
* 鍒濆鍖� EqpEvent 琛�
*/
void initEqpEventTable();
+
+ int addEqpEvent(const std::string& sName, const std::string& sRemark, int nBitNo);
+
+ std::vector<std::vector<std::string>> getEqpEventByID(int nCEID);
+
+ std::vector<std::vector<std::string>> getAllEqpEvents();
+
+ int updateEqpEvent(int nCEID, const std::string& sName, const std::string& sRemark, int nBitNo);
+
+ int deleteEqpEventByID(int nCEID);
+
+ int deleteAllEqpEvents();
/**
* 鍒濆鍖� EventLink 琛�
@@ -293,10 +389,143 @@
*/
void initPPIDTable();
+ std::vector<std::string> getAllPPID();
+
+ void setAllPPID(const std::vector<std::string>& vecPPIDList);
+
+ bool updatePPIDForRecipe(int nRecipeNo, const std::string& strPPID);
+
+ std::string getPPIDForRecipe(int nRecipeNo);
+
+ int getRecipeForPPID(std::string strPPID);
+
+ bool deletePPIDForRecipe(int nRecipeNo);
+
+ bool deletePPIDForAllRecipes();
+
/**
* 鍒濆鍖� RPTID 琛�
*/
void initRPTIDTable();
+
+ /**
+ * 娣诲姞 RPTID 鍜� VID 鐨勫叧绯�
+ * @param nRPTID: 闇�瑕佸叧鑱旂殑 RPTID銆�
+ * @param nVID: 闇�瑕佸叧鑱旂殑 VID锛屽彲浠ユ槸 SystemSV 鎴� EqpSV 鐨� ID銆�
+ * @return 1: 鏁版嵁搴撴湭杩炴帴銆�
+ * @return 2: RPTID 鍜� VID 鐨勫叧绯诲凡瀛樺湪锛屾棤娉曟彃鍏ャ��
+ * @return 3: Report 琛ㄦ彃鍏ユ暟鎹け璐ャ��
+ * @return 4: ReportVIDs 琛ㄦ彃鍏ユ暟鎹け璐ャ��
+ * @return 0: 鎻掑叆鎴愬姛锛屾暟鎹凡娣诲姞鍒� ReportVIDs 琛ㄤ腑銆�
+ *
+ * 姝ゅ嚱鏁扮敤浜庢坊鍔犱竴涓柊鐨� RPTID 鍜� VID 鐨勫叧鑱斿叧绯汇�傚鏋滆 RPTID 鍜� VID 鐨勭粍鍚堝凡瀛樺湪浜庢暟鎹簱涓紝
+ * 鍒欒繑鍥為敊璇唬鐮� 2銆傚惁鍒欙紝鍑芥暟浼氭彃鍏ユ柊鐨勫叧绯伙紝骞惰繑鍥� 0 琛ㄧず鎻掑叆鎴愬姛銆�
+ */
+ int addRPTIDVID(int nRPTID, int nVID);
+
+ /**
+ * 娣诲姞澶氫釜 VID 涓庝竴涓� RPTID 鐨勫叧绯�
+ * @param nRPTID: 闇�瑕佸叧鑱旂殑 RPTID銆�
+ * @param vecVID: 闇�瑕佸叧鑱旂殑澶氫釜 VID锛屽彲浠ユ槸 SystemSV 鎴� EqpSV 鐨� ID 鐨勯泦鍚堛��
+ * @return 1: 鏁版嵁搴撴湭杩炴帴銆�
+ * @return 2: Report 琛ㄦ彃鍏ユ暟鎹け璐ャ��
+ * @return 3: ReportVIDs 琛ㄦ彃鍏ユ暟鎹け璐ャ��
+ * @return 0: 鎻掑叆鎴愬姛锛屾暟鎹凡娣诲姞鍒� ReportVIDs 琛ㄤ腑銆�
+ *
+ * 姝ゅ嚱鏁扮敤浜庡皢澶氫釜 VID 涓� RPTID 鍏宠仈銆傞鍏堟鏌� `RPTID` 鏄惁宸茬粡瀛樺湪浜� `Report` 琛ㄤ腑锛�
+ * 濡傛灉涓嶅瓨鍦紝鍒欏厛鎻掑叆璇� `RPTID`銆傜劧鍚庯紝鎵归噺鎻掑叆 `RPTID` 鍜� `VID` 鐨勫叧绯伙紝纭繚鍚屼竴涓� `RPTID`
+ * 涓嬬殑 `VID` 涓嶉噸澶嶃��
+ */
+ int addRPTIDVIDs(int nRPTID, const std::vector<int>& vecVID);
+
+ /**
+ * 鍒犻櫎鎸囧畾 RPTID 鍜� VID 鐨勫叧绯�
+ * @param nRPTID: 闇�瑕佸垹闄ょ殑 RPTID銆�
+ * @param nVID: 闇�瑕佸垹闄ょ殑 VID銆�
+ * @return 1: 鏁版嵁搴撴湭杩炴帴銆�
+ * @return 2: RPTID 鍜� VID 鐨勫叧绯讳笉瀛樺湪锛屾棤娉曞垹闄ゃ��
+ * @return 3: 鍒犻櫎鎿嶄綔澶辫触銆�
+ * @return 0: 鍒犻櫎鎴愬姛銆�
+ *
+ * 姝ゅ嚱鏁扮敤浜庡垹闄ゆ寚瀹氱殑 RPTID 鍜� VID 鐨勫叧鑱斿叧绯汇�傚鏋滆鍏崇郴涓嶅瓨鍦紝鍒欒繑鍥為敊璇唬鐮� 2銆�
+ * 濡傛灉鍒犻櫎鎿嶄綔澶辫触锛屽垯杩斿洖閿欒浠g爜 3銆傚垹闄ゆ垚鍔熷悗锛岃繑鍥� 0 琛ㄧず鍒犻櫎鎴愬姛銆�
+ */
+ int deleteRPTIDVID(int nRPTID, int nVID);
+
+ /**
+ * 鍒犻櫎鎸囧畾 RPTID 鍏宠仈鐨勬墍鏈夎褰�
+ * @param nRPTID: 闇�瑕佸垹闄ょ殑 RPTID銆�
+ *
+ * @return 1: 鏁版嵁搴撴湭杩炴帴銆�
+ * @return 2: 鍒犻櫎 ReportVIDs 琛ㄤ腑鐨勮褰曞け璐ャ��
+ * @return 3: 鍒犻櫎 Report 琛ㄤ腑鐨� RPTID 澶辫触銆�
+ * @return 0: 鍒犻櫎鎴愬姛锛屾墍鏈変笌璇� RPTID 鍏宠仈鐨勮褰曞凡琚垹闄ゃ��
+ *
+ * 姝ゅ嚱鏁扮敤浜庡垹闄� ReportVIDs 琛ㄤ腑鎵�鏈変笌鎸囧畾 RPTID 鍏宠仈鐨勮褰曪紝骞舵牴鎹渶瑕佸垹闄� Report 琛ㄤ腑鐨� RPTID銆�
+ * - 棣栧厛锛屽垹闄� ReportVIDs 琛ㄤ腑鎵�鏈変笌璇� RPTID 鍏宠仈鐨勮褰曘��
+ * - 鐒跺悗锛屽彲浠ラ�夋嫨鏄惁鍒犻櫎 Report 琛ㄤ腑瀵瑰簲鐨� RPTID銆�
+ *
+ * 鑻ュ垹闄ゅけ璐ワ紝鍒欒繑鍥炵浉搴旂殑閿欒浠g爜銆傚鏋滄垚鍔熷垹闄ゆ墍鏈夎褰曪紝鍒欒繑鍥� 0銆�
+ */
+ int deleteRPTID(int nRPTID);
+
+ /**
+ * 鏇存柊鎸囧畾 RPTID 鐨� VID 鍏宠仈璁板綍
+ * @param nRPTID: 闇�瑕佹洿鏂扮殑 RPTID銆�
+ * @param nOldVID: 闇�瑕佹洿鏂扮殑鏃� VID銆�
+ * @param nNewVID: 鏂扮殑 VID锛屾浛浠f棫鐨� VID銆�
+ *
+ * @return 1: 鏁版嵁搴撴湭杩炴帴銆�
+ * @return 2: 鎵句笉鍒版寚瀹氱殑 RPTID 鍜屾棫 VID 缁勫悎銆�
+ * @return 3: 鏂扮殑 VID 宸茬粡瀛樺湪浜庤 RPTID 涓嬨��
+ * @return 4: 鏇存柊鎿嶄綔澶辫触銆�
+ * @return 0: 鏇存柊鎴愬姛锛孷ID 宸茶鏇挎崲涓烘柊鐨� VID銆�
+ *
+ * 姝ゅ嚱鏁扮敤浜庢洿鏂� `ReportVIDs` 琛ㄤ腑鎸囧畾 `RPTID` 鐨勬棫 `VID` 涓烘柊鐨� `VID`銆�
+ * - 棣栧厛锛屾鏌ユ槸鍚﹀瓨鍦ㄦ寚瀹氱殑 `RPTID` 鍜� `OldVID` 缁勫悎銆�
+ * - 鐒跺悗妫�鏌ユ柊鐨� `VID` 鏄惁宸茬粡瀛樺湪浜庣浉鍚岀殑 `RPTID` 涓嬶紝闃叉閲嶅銆�
+ * - 濡傛灉妫�鏌ラ�氳繃锛屽垯鎵ц鏇存柊鎿嶄綔銆�
+ */
+ int updateRPTIDVID(int nRPTID, int nOldVID, int nNewVID);
+
+ /**
+ * 鍒犻櫎骞堕噸鏂版坊鍔犳寚瀹� RPTID 涓嬬殑澶氫釜 VID 鍏宠仈璁板綍
+ * @param nRPTID: 闇�瑕佹洿鏂拌褰曠殑 RPTID銆�
+ * @param vecVID: 闇�瑕侀噸鏂版坊鍔犵殑 VID 鍒楄〃銆�
+ *
+ * @return 1: 鏁版嵁搴撴湭杩炴帴銆�
+ * @return 2: 鍒犻櫎鎿嶄綔澶辫触锛屽彲鑳芥槸鏌愪簺 VID 涓嶅瓨鍦ㄦ垨鏁版嵁搴撴搷浣滃け璐ャ��
+ * @return 3: 鎻掑叆鎿嶄綔澶辫触锛屽彲鑳芥槸鏌愪簺 VID 宸茬粡瀛樺湪銆�
+ * @return 0: 鍒犻櫎骞堕噸鏂版坊鍔犳垚鍔燂紝鎵�鏈� VID 璁板綍宸叉洿鏂般��
+ *
+ * 姝ゅ嚱鏁扮敤浜庡垹闄ゆ寚瀹� `RPTID` 涓嬬殑鎵�鏈夋棫 VID 璁板綍锛岀劧鍚庨噸鏂版坊鍔犳柊鐨� VID 璁板綍銆�
+ * - 棣栧厛锛屽垹闄ゆ寚瀹� `RPTID` 涓嬬殑鎵�鏈� VID 鍏宠仈璁板綍銆�
+ * - 鐒跺悗锛屾鏌ユ柊 `VID` 鏄惁瀛樺湪锛岃嫢涓嶅瓨鍦ㄥ垯鎻掑叆鏂拌褰曘��
+ *
+ * 濡傛灉鎿嶄綔鎴愬姛锛岃繑鍥� 0锛涘鏋滃垹闄ゆ垨鎻掑叆杩囩▼涓亣鍒伴棶棰橈紝杩斿洖鐩稿簲鐨勯敊璇唬鐮併��
+ */
+ int updateRPTIDVIDs(int nRPTID, const std::vector<int>& vecVID);
+
+ /**
+ * 鏌ヨ鎸囧畾 RPTID 涓嬬殑鎵�鏈� VID
+ * @param nRPTID: 闇�瑕佹煡璇㈢殑 RPTID銆�
+ * @return std::vector<int>: 瀛樺偍鎵�鏈変笌 RPTID 鍏宠仈鐨� VID銆�
+ *
+ * 姝ゅ嚱鏁扮敤浜庢牴鎹寚瀹氱殑 `RPTID` 鏌ヨ鎵�鏈変笌涔嬪叧鑱旂殑 `VID`銆�
+ * - 鏌ヨ `ReportVIDs` 琛紝鏍规嵁 `RPTID` 鑾峰彇鎵�鏈夌浉鍏崇殑 `VID`銆�
+ * - 杩斿洖鐨勭粨鏋滄槸涓�涓� `std::vector<int>`锛屽寘鍚墍鏈夊搴旂殑 `VID`銆�
+ */
+ std::vector<int> getVIDsByRPTID(int nRPTID);
+
+ /**
+ * 鏌ヨ鎵�鏈� Report 琛ㄤ腑鐨� RPTID
+ * @return std::vector<int>: 瀛樺偍鎵�鏈夌殑 RPTID銆�
+ *
+ * 姝ゅ嚱鏁扮敤浜庢煡璇� `Report` 琛ㄤ腑鐨勬墍鏈� `RPTID`銆�
+ * - 鏌ヨ `Report` 琛ㄤ腑鐨勬墍鏈� `RPTID`銆�
+ * - 杩斿洖鐨勭粨鏋滄槸涓�涓� `std::vector<int>`锛屽寘鍚墍鏈夌殑 `RPTID`銆�
+ */
+ std::vector<int> getAllRPTIDs();
private:
SECSRuntimeManager();
@@ -315,6 +544,15 @@
// 鍒ゆ柇鍚嶇О鏄惁閲嶅
bool isNameDuplicate(const std::string& sName);
+ // 鍒犻櫎鎸囧畾琛ㄤ腑鐨勬墍鏈夋暟鎹�
+ int deleteAllDataFromTable(const std::string& tableName);
+
+ // 鏌ヨ鎸囧畾琛ㄦ墍鏈夋暟鎹紙閫氱敤鍑芥暟锛�
+ bool getAllDataFromTable(const std::string& tableName, std::vector<std::vector<std::string>>& outData);
+
+ // 鍒犻櫎鎸囧畾琛ㄤ腑鎸囧畾 ID 鐨勬暟鎹�
+ int deleteDataByID(const std::string& tableName, int nID);
+
BL::Database* m_pDB;
static std::mutex m_mutex;
};
--
Gitblit v1.9.3