Ver Fonte

同步更新

JonYang há 3 dias atrás
pai
commit
3845bb12ad
46 ficheiros alterados com 1727 adições e 868 exclusões
  1. BIN
      Output/bin/x64/Control.dll
  2. BIN
      Output/bin/x64/Control.pdb
  3. BIN
      Output/bin/x64/JSMotion.dll
  4. BIN
      Output/bin/x64/Module.dll
  5. BIN
      Output/bin/x64/Module.pdb
  6. BIN
      Output/bin/x64/configurations.db
  7. BIN
      Output/config/db/AxisConfiguration.db
  8. BIN
      Output/config/db/Hardware.db
  9. BIN
      Output/config/db/IOConfiguration.db
  10. BIN
      Output/config/db/MachineCalibration.db
  11. BIN
      Output/config/db/MachineSetup.db
  12. BIN
      Output/config/db/ModuleConfig.db
  13. BIN
      Output/config/db/Product1/Product.db
  14. BIN
      Output/dll/x64/Control.dll
  15. BIN
      Output/dll/x64/JSMotion.dll
  16. BIN
      Output/dll/x64/Module.dll
  17. 11 2
      Output/inc/Control/CRunButton.h
  18. 3 0
      Output/inc/Module/CAxis.h
  19. 10 2
      Output/inc/Module/CBondHead.h
  20. 3 3
      Output/inc/Module/CBondMatrix.h
  21. 2 0
      Output/inc/Module/CCalib.h
  22. 8 8
      Output/inc/Module/CCalibrationConfig.h
  23. 1 1
      Output/inc/Module/CConfigBase.h
  24. 1 0
      Output/inc/Module/CHIKVisionCamera.h
  25. 22 22
      Output/inc/Module/CModuleConfig.h
  26. 12 8
      Output/inc/Module/CProduct.h
  27. 4 0
      Output/inc/Module/CRCalib.h
  28. 2 2
      Output/inc/Module/CUltraHead.h
  29. 3 1
      Output/inc/Module/CUltraHeadDiagnosis.h
  30. 2 2
      Output/inc/Module/JAxis.h
  31. 3 2
      Output/inc/Module/Machine.h
  32. BIN
      Output/lib/x64/Common.lib
  33. BIN
      Output/lib/x64/Control.lib
  34. BIN
      Output/lib/x64/Module.lib
  35. 1 0
      View/die-bonder-ui/SBTdie-bonder-ui.vcxproj
  36. 3 1
      View/die-bonder-ui/SBTdie-bonder-ui.vcxproj.filters
  37. 547 215
      View/die-bonder-ui/Src/BondMatrixProgramPage.cpp
  38. 33 2
      View/die-bonder-ui/Src/BondMatrixProgramPage.h
  39. 36 142
      View/die-bonder-ui/Src/BondMatrixProgramPage.ui
  40. 596 331
      View/die-bonder-ui/Src/WaferProgramPage.cpp
  41. 34 8
      View/die-bonder-ui/Src/WaferProgramPage.h
  42. 126 0
      View/die-bonder-ui/Src/WaferProgramPage.ui
  43. 233 108
      View/die-bonder-ui/Src/WaffleProgramPage.cpp
  44. 8 3
      View/die-bonder-ui/Src/WaffleProgramPage.h
  45. 23 4
      View/die-bonder-ui/Src/WaffleProgramPage.ui
  46. 0 1
      View/die-bonder-ui/main.cpp

BIN
Output/bin/x64/Control.dll


BIN
Output/bin/x64/Control.pdb


BIN
Output/bin/x64/JSMotion.dll


BIN
Output/bin/x64/Module.dll


BIN
Output/bin/x64/Module.pdb


BIN
Output/bin/x64/configurations.db


BIN
Output/config/db/AxisConfiguration.db


BIN
Output/config/db/Hardware.db


BIN
Output/config/db/IOConfiguration.db


BIN
Output/config/db/MachineCalibration.db


BIN
Output/config/db/MachineSetup.db


BIN
Output/config/db/ModuleConfig.db


BIN
Output/config/db/Product1/Product.db


BIN
Output/dll/x64/Control.dll


BIN
Output/dll/x64/JSMotion.dll


BIN
Output/dll/x64/Module.dll


+ 11 - 2
Output/inc/Control/CRunButton.h

@@ -94,7 +94,7 @@ namespace ns_module
 			REGISTER_FUNCTION(BondHead_AccuracyTest),
 			REGISTER_FUNCTION(SaveDB),
 			REGISTER_FUNCTION(BH_VacOn),
-			REGISTER_FUNCTION(BH_UltralOn),
+			REGISTER_FUNCTION(BH_UltralOnOffTest),
 			REGISTER_FUNCTION(BH_VacOff),
 			REGISTER_FUNCTION(BH_Pick),
 			REGISTER_FUNCTION(BH_Bond),
@@ -120,6 +120,8 @@ namespace ns_module
 			REGISTER_FUNCTION(WaferHead_Bond),
 			REGISTER_FUNCTION(WaferHead_OpenVac),
 			REGISTER_FUNCTION(WaferHead_CloseVac),
+			REGISTER_FUNCTION(BondTable_ToPreDie),
+			REGISTER_FUNCTION(BondTable_ToNextDie),
 			REGISTER_FUNCTION(Ejector_ToSafePos),
 			REGISTER_FUNCTION(Ejector_ToWorkPos),
 			REGISTER_FUNCTION(XYCalib_LookUpToPos),
@@ -147,6 +149,7 @@ namespace ns_module
 			REGISTER_FUNCTION(RCalib_HeadToPos),
 			REGISTER_FUNCTION(RCalib_WaferTableCalib),
 			REGISTER_FUNCTION(RCalib_WaferTableToPos),
+			REGISTER_FUNCTION(ModuleMove),
 		};
 
 
@@ -179,9 +182,10 @@ namespace ns_module
 		long Machine_Transfer2BondTable(ST_BUTTON_FUN stInfo);
 		long Machine_SingnedRun(ST_BUTTON_FUN stInfo);
 		long BondHead_AccuracyTest(ST_BUTTON_FUN stInfo);
+		long BondHead_PickAndBond_Diagnosis(ST_BUTTON_FUN stInfo);
 		long SaveDB(ST_BUTTON_FUN stInfo);
 		long BH_VacOn(ST_BUTTON_FUN stInfo);
-		long BH_UltralOn(ST_BUTTON_FUN stInfo);
+		long BH_UltralOnOffTest(ST_BUTTON_FUN stInfo);
 		long BH_VacOff(ST_BUTTON_FUN stInfo);
 		long BH_Pick(ST_BUTTON_FUN stInfo);
 		long BH_Bond(ST_BUTTON_FUN stInfo);
@@ -207,6 +211,9 @@ namespace ns_module
 		long WaferHead_Bond(ST_BUTTON_FUN stInfo);
 		long WaferHead_OpenVac(ST_BUTTON_FUN stInfo);
 		long WaferHead_CloseVac(ST_BUTTON_FUN stInfo);
+		long BondTable_ToPreDie(ST_BUTTON_FUN stInfo);
+		long BondTable_ToNextDie(ST_BUTTON_FUN stInfo);
+		
 		long Ejector_ToSafePos(ST_BUTTON_FUN stInfo);
 		long Ejector_ToWorkPos(ST_BUTTON_FUN stInfo);
 		long XYCalib_LookUpToPos(ST_BUTTON_FUN stInfo);
@@ -234,6 +241,8 @@ namespace ns_module
 		long RCalib_HeadToPos(ST_BUTTON_FUN stInfo);
 		long RCalib_WaferTableCalib(ST_BUTTON_FUN stInfo);
 		long RCalib_WaferTableToPos(ST_BUTTON_FUN stInfo);
+
+		long ModuleMove(ST_BUTTON_FUN stInfo);
 	};
 
 }

+ 3 - 0
Output/inc/Module/CAxis.h

@@ -48,6 +48,7 @@ private:
 	AXIS_TYPE m_eAxisType = AXIS_TYPE::X;
 	string m_strAxisType;
 	string m_strModuleType;
+	string m_strModuleName;
 	JAxis* m_pAxis = nullptr;
 	string m_strAxisName = "";
 	INT m_iUse = 0;
@@ -67,6 +68,7 @@ private:
 	std::vector <ns_db::MODULE_HOT_ZONE_STRUCT> m_vecHotZoneList;
 
 	static std::mutex m_MutexHotZone;
+	bool m_bHotZoneEnable = false;
 	static std::vector<HOT_ZONE_ID_STRUCT> m_vecHotZoneId;
 
 	//轴当前位置,模拟测试时才会使用
@@ -88,6 +90,7 @@ public:
 	LONG Init(JAxis* pAxis, ns_db::AXIS_LIST_STRUCT *pAxisStruct);
 	string GetAxisName() {return m_strAxisName;};
 	string GetModuleType() { return m_strModuleType; };
+	string GetModuleName() { return m_strModuleName; };
 	string GetStringAxisType() { return m_strAxisType; };
 	string GetStringModuleType() { return m_strModuleType; };
 	AXIS_TYPE GetAxisType() { return m_eAxisType; };

+ 10 - 2
Output/inc/Module/CBondHead.h

@@ -60,6 +60,9 @@ public:
 	LONG XYZMoveTo(double x, double y,double z);
 	LONG XYZRMoveTo(double x, double y, double z,double r);
 
+	LONG MoveToPreBondPoint();
+	LONG MoveToNextBondPoint();
+
 	virtual void SetPickHTestIndex(int index) = 0;
 	virtual void SetBondHTestIndex(int index) = 0;
 	virtual LONG PickHightTest();//调用之前先SetIndex
@@ -71,7 +74,7 @@ public:
 	virtual LONG StrongOn();		//强吹开
 	virtual LONG StrongOff();		//强吹关
 
-	virtual LONG UltraOn(int iUltraValue) { return OK; };			//超声开
+	virtual LONG UltraOn() { return OK; };			//超声开
 	virtual LONG UltraOff() { return OK; };	//超声关
 
 	virtual LONG ChangeNozzle(int nozzleIndex);
@@ -96,12 +99,15 @@ public:
 	//上视拍照
 	virtual LONG XYZToLookUpGrabPos();
 	virtual LONG LookUpGrab(int index,X_Y_ANGLE_STRUCT& result);//移动到上视拍照位,拍照结果放到结构体中
+	LONG MoveToLookUpAndGrab(int index, X_Y_ANGLE_STRUCT& result);
 
 	//吸嘴固晶
 	virtual LONG PlaceDie(int index, X_Y_ANGLE_STRUCT lookUpOffsetPixel) = 0;
+	virtual LONG HeadMoveToBondPos(int index, bool bGrab = true, X_Y_ANGLE_STRUCT lookUpOffsetPixel = {0,0,0});//移动到拾取位
+	virtual LONG CameraMoveToBondPos(int index, bool bGrab = true, X_Y_ANGLE_STRUCT lookUpOffsetPixel = { 0,0,0 });//移动到拾取位
 	virtual LONG MoveToBondGrabPos(int index);
 	virtual LONG BondGrab(int index, X_Y_ANGLE_STRUCT& result); //返回的拍照结果为物理单位
-	virtual LONG ToBondPos_AddOffset(int index, X_Y_ANGLE_STRUCT bondOffset, X_Y_ANGLE_STRUCT lookUpOffset, bool waitDone = true);//传入物理位置
+	virtual LONG ToBondPos_AddOffset(int index, X_Y_ANGLE_STRUCT bondOffset, X_Y_ANGLE_STRUCT lookUpOffset,bool bIsHard = true, bool waitDone = true);//传入物理位置
 	virtual LONG BondDieDown(int index) = 0;//传入物理位置
 	virtual LONG BondDieUp(bool waitDone = true);
 	virtual LONG FindForce(double force);		//寻压,寻找力控轴反馈位置
@@ -243,5 +249,7 @@ protected:
 	double m_dGivenForceZPos = 0;		//拾取放置芯片时力控轴的反馈位置
 
 	double m_dBondGrabPosZ = 0;			//bondGrabPosZ
+
+	bool m_bAngleOffsetEnabled = false;
 };
 

+ 3 - 3
Output/inc/Module/CBondMatrix.h

@@ -147,7 +147,7 @@ namespace ns_mat
 		bool bIsInitSuccess = false;
 
 		//当前点
-		//UINT m_iCurrentBondIndex = 0;
+		UINT m_iCurrentBondIndex = 0;
 		//矩阵总数
 		UINT m_iBondAmount = 0;
 		int m_iWaferDieNum = 0;
@@ -190,8 +190,8 @@ namespace ns_mat
 
 	public:
 		//返回0表示没找到
-		//UINT GetCurrentIndex();							//获取当前固晶点
-		//LONG SetCurrentIndex(UINT nIndex);				//设置当前固晶点
+		UINT GetCurrentIndex();							//获取当前固晶点
+		LONG SetCurrentIndex(UINT nIndex);				//设置当前固晶点
 
 		LONG GetAllBondMatrixInfo(std::vector <POINT_INFO_STRUCT>& stPointInfo);
 		//获取包括当前固晶点开始的下个固晶点

+ 2 - 0
Output/inc/Module/CCalib.h

@@ -116,6 +116,8 @@ public:
     virtual void Stop() { m_bStop = true; }
 
 protected:
+    LONG SearchTemp(int iTempID, CCameraBase* camera, bool isToCameraCenter, X_Y_ANGLE_STRUCT& outResult);
+
     LONG SearchTemp(int iTempID, CCameraBase* camera, bool isToCameraCenter, XY_DOUBLE_STRUCT& outResult);
 
 protected:

+ 8 - 8
Output/inc/Module/CCalibrationConfig.h

@@ -74,8 +74,8 @@ namespace ns_db
 	public:
 		LONG GetXYCalibParam(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetXYCalibParam() { return m_vecXYCalibParam; }
-		LONG SetXYCalibParam(vector<MODULE_CONFIG_STRUCT> vecconfig);
-		LONG SetXYCalibParam(vector<CONFIG_BASE_STRUCT> vecconfig);
+		LONG SetXYCalibParam(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetXYCalibParam(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
 
 #pragma endregion
 
@@ -85,8 +85,8 @@ namespace ns_db
 	public:
 		LONG GetCTDCalibParam(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetCTDCalibParam() { return m_vecCTDCalibParam; }
-		LONG SetCTDCalibParam(vector<MODULE_CONFIG_STRUCT> vecconfig);
-		LONG SetCTDCalibParam(vector<CONFIG_BASE_STRUCT> vecconfig);
+		LONG SetCTDCalibParam(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetCTDCalibParam(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region RCalib
@@ -95,8 +95,8 @@ namespace ns_db
 	public:
 		LONG GetRCalibParam(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetRCalibParam() { return m_vecRCalibParam; }
-		LONG SetRCalibParam(vector<MODULE_CONFIG_STRUCT> vecconfig);
-		LONG SetRCalibParam(vector<CONFIG_BASE_STRUCT> vecconfig);
+		LONG SetRCalibParam(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetRCalibParam(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region ForceCalib
@@ -105,8 +105,8 @@ namespace ns_db
 	public:
 		LONG GetForceCalibParam(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetForceCalibParam() { return m_vecForceCalib; }
-		LONG SetForceCalibParam(vector<MODULE_CONFIG_STRUCT> vecconfig);
-		LONG SetForceCalibParam(vector<CONFIG_BASE_STRUCT> vecconfig);
+		LONG SetForceCalibParam(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetForceCalibParam(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
 
 #pragma endregion 
 

+ 1 - 1
Output/inc/Module/CConfigBase.h

@@ -41,7 +41,7 @@ namespace ns_db
 		string strDefult = "";
 		string strLowerLimit = "-1000000";
 		string strUpperLimit = "1000000";
-		string strUnit = "um";
+		string strUnit = "";
 		string strAxisType = "";
 		string sIcon = "";
 		bool bEnable = true;

+ 1 - 0
Output/inc/Module/CHIKVisionCamera.h

@@ -45,6 +45,7 @@ private:
     bool                    m_bGrabImageDone;
     UCHAR* m_pSaveImageBuf = nullptr;                         //ͼÏñ»º´æ
     bool    m_bStartVedioBing = false;                     // ch:ÊÇ·ñ¿ªÊ¼×¥Í¼ | en:Whether to start grabbing
+    LONG    m_bTimeOutNum = 0;
 public:
     LONG SaveImageBuf(unsigned char* pData, MV_FRAME_OUT_INFO_EX* stImageInfo);
     long ImageToViewThreadProcess();

+ 22 - 22
Output/inc/Module/CModuleConfig.h

@@ -101,8 +101,8 @@ private:
 	public:
 		LONG GetConfigParam_BondHead(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_BondHead() { return m_vecConfig_BondHead; };
-		LONG SetConfigParam_BondHead(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_BondHead(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_BondHead(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_BondHead(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion	
 
 
@@ -112,8 +112,8 @@ private:
 	public:
 		LONG GetConfigParam_WaferHead(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_WaferHead() { return m_vecConfig_WaferHead; };
-		LONG SetConfigParam_WaferHead(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_WaferHead(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_WaferHead(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_WaferHead(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region WaffleHead
@@ -122,8 +122,8 @@ private:
 	public:
 		LONG GetConfigParam_WaffleHead(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_WaffleHead() { return m_vecConfig_WaffleHead; };
-		LONG SetConfigParam_WaffleHead(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_WaffleHead(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_WaffleHead(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_WaffleHead(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region Ejector
@@ -132,8 +132,8 @@ private:
 	public:
 		LONG GetConfigParam_Ejector(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_Ejector() { return m_vecConfig_Ejector; };
-		LONG SetConfigParam_Ejector(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_Ejector(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_Ejector(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_Ejector(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region WaferTable
@@ -142,8 +142,8 @@ private:
 	public:
 		LONG GetConfigParam_WaferTable(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_WaferTable() { return m_vecConfig_WaferTable; };
-		LONG SetConfigParam_WaferTable(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_WaferTable(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_WaferTable(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_WaferTable(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region MaterialBox
@@ -152,8 +152,8 @@ private:
 	public:
 		LONG GetConfigParam_MaterialBox(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_MaterialBox() { return m_vecConfig_MaterialBox; };
-		LONG SetConfigParam_MaterialBox(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_MaterialBox(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_MaterialBox(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_MaterialBox(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 		
 #pragma region CalibTable
@@ -166,10 +166,10 @@ private:
 		LONG GetConfigParam_WaffleCalibTable(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_WaferCalibTable() { return m_vecConfig_WaferCalibTable; };
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_WaffleCalibTable() { return m_vecConfig_WaffleCalibTable; };
-		LONG SetConfigParam_WaferCalibTable(vector<MODULE_CONFIG_STRUCT> vecconfig);
-		LONG SetConfigParam_WaffleCalibTable(vector<MODULE_CONFIG_STRUCT> vecconfig);
-		LONG SetConfigParam_WaferCalibTable(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_WaffleCalibTable(vector<CONFIG_BASE_STRUCT> vecconfig);
+		LONG SetConfigParam_WaferCalibTable(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_WaffleCalibTable(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_WaferCalibTable(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_WaffleCalibTable(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
 		//LONG SetConfigParam_CalibTable(int moduleType, vector<MODULE_CONFIG_STRUCT> vecconfig);
 #pragma endregion
 
@@ -179,8 +179,8 @@ private:
 	public:
 		LONG GetConfigParam_BondTable(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_BondTable() { return m_vecConfig_BondTable; };
-		LONG SetConfigParam_BondTable(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_BondTable(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_BondTable(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_BondTable(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region NozzleTable
@@ -189,8 +189,8 @@ private:
 	public:
 		LONG GetConfigParam_NozzleTable(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_NozzleTable() { return m_vecConfig_NozzleTable; };
-		LONG SetConfigParam_NozzleTable(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_NozzleTable(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_NozzleTable(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_NozzleTable(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region UltraHead
@@ -199,8 +199,8 @@ private:
 	public:
 		LONG GetConfigParam_UltraHead(vector<MODULE_CONFIG_STRUCT>* vecconfig);
 		vector<CONFIG_BASE_STRUCT> GetConfigParam_UltraHead() { return m_vecConfig_UltraHead; };
-		LONG SetConfigParam_UltraHead(vector<CONFIG_BASE_STRUCT> vecconfig);
-		LONG SetConfigParam_UltraHead(vector<MODULE_CONFIG_STRUCT> vecconfig);
+		LONG SetConfigParam_UltraHead(vector<CONFIG_BASE_STRUCT> vecconfig, bool isCallBack = true);
+		LONG SetConfigParam_UltraHead(vector<MODULE_CONFIG_STRUCT> vecconfig, bool isCallBack = true);
 #pragma endregion
 
 #pragma region UltraHead_Diagnosis

+ 12 - 8
Output/inc/Module/CProduct.h

@@ -31,6 +31,7 @@
 #define ALN_STRATEGY_TABLE_NAME                         "PR_Strategy"
 #define PR_TEMPLATE_TABLE_NAME							"PR_Template"
 
+#define NO_GRAB_TEMPLATE_ID			0
 
 namespace ns_db
 {
@@ -44,7 +45,7 @@ namespace ns_db
 
 	//模板类型枚举
 	enum MCM_TEMPLATE_TYPE {
-		COMMON_MIN = 0, COMMON_MAX = 50000,
+		COMMON_MIN = 1, COMMON_MAX = 50000,
 		BONDINSP_MIN = 50001, BONDINSP_MAX = 60000,
 		EXPOXY_MIN = 60001, EXPOXY_MAX = 70000,
 		ALN_MIN = 70001, ALN_MAX = 80000
@@ -79,8 +80,8 @@ namespace ns_db
 		bool bFindForce;						//是否寻压
 		double dPreLev;							//预备高度
 
-		double dForce;						//取(固)压力
-		double dPickOrBondLev;				//取(固)高度(寻压则无高度)
+		double dForce;							//取(固)压力
+		double dWorkLev;						//取(固)高度(寻压则无高度)
 
 		UINT iGrabDelay;						//拍图延时
 		UINT iPickOrBondDelay;					//取(固)延时
@@ -295,13 +296,15 @@ namespace ns_db
 	public:
 		LONG GetDieMatrix(UINT nModuleId, std::vector<PROGRAM_DIE_MATRIX_STRUCT>& vecDieMatrix);
 		LONG GetDieMatrix(UINT iMatrixId, PROGRAM_DIE_MATRIX_STRUCT& stDieMatrix);
+		LONG GetAllDieMatrix(std::vector<PROGRAM_DIE_MATRIX_STRUCT>& vecDieMatrix);
 		LONG SetDieMatrix(std::vector<PROGRAM_DIE_MATRIX_STRUCT> stDieMatrix, bool bAppend = false);
 		LONG SetAllDieMatrix(std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecDieMatrix);
-		LONG SetAllWaffleDieMatrix(std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecDieMatrix);
-		LONG SetAllWaferDieMatrix(std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecDieMatrix);
+		LONG SetAllWaffleDieMatrix(std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecDieMatrix, bool isCallBack = true);
+		LONG SetAllWaferDieMatrix(std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecDieMatrix, bool isCallBack = true);
 		LONG DeleteDieMatrix(int matrixId);
 
 
+
 #pragma endregion
 
 #pragma region Program_WaferMatrix 表
@@ -313,7 +316,7 @@ namespace ns_db
 	public:
 		std::vector<PROGRAM_WAFER_MATRIX_STRUCT> GetWaferMatrix() { return m_VecWaferMatrix; };
 		LONG SetWaferMatrix(UINT id, PROGRAM_WAFER_MATRIX_STRUCT matrix);
-		LONG SetAllWaferMatrix(std::vector<PROGRAM_WAFER_MATRIX_STRUCT> vecWaferMatrix);
+		LONG SetAllWaferMatrix(std::vector<PROGRAM_WAFER_MATRIX_STRUCT> vecWaferMatrix, bool isCallBack = true);
 		LONG AddWaferMatrix(PROGRAM_WAFER_MATRIX_STRUCT newMatrix, int& newId);
 		LONG DeleteWaferMatrix(int matrixID);
 
@@ -343,7 +346,7 @@ namespace ns_db
 	public:
 		std::vector<PROGRAM_BOND_MATRIX_STRUCT> GetBondMatrix() { return m_VecBondMatrix; };
 		void SetBondMatrix(int matrixID, PROGRAM_BOND_MATRIX_STRUCT matrix);
-		LONG SetAllBondMatrix(std::vector<PROGRAM_BOND_MATRIX_STRUCT> vecBondMatrix);
+		LONG SetAllBondMatrix(std::vector<PROGRAM_BOND_MATRIX_STRUCT> vecBondMatrix, bool isCallBack = true);
 		LONG AddBondMatrix(PROGRAM_BOND_MATRIX_STRUCT matrix, int& newId);
 		void DeleteBondMatrix(int matrixID);
 
@@ -357,9 +360,10 @@ namespace ns_db
 		LONG SavePointMatrix();
 	public:
 		LONG GetPointMatrix(UINT iMatrixId, PROGRAM_POINT_MATRIX_STRUCT& stPointMatrix);
+		LONG GetAllPointMatrix(std::vector<PROGRAM_POINT_MATRIX_STRUCT>& vecPointMatrix);
 		LONG AddPointMatrix(int bondMatrixID, PROGRAM_POINT_MATRIX_STRUCT subMatrix,int& newId);
 		LONG SetPointMatrix(int matrixID, PROGRAM_POINT_MATRIX_STRUCT dieMatrix);
-		LONG SetAllPointMatrix(std::vector<PROGRAM_POINT_MATRIX_STRUCT> vecPointMatrix);
+		LONG SetAllPointMatrix(std::vector<PROGRAM_POINT_MATRIX_STRUCT> vecPointMatrix, bool isCallBack = true);
 		LONG DeletePointMatrix(int bondMatrixId, int subMatrixID);
 
 #pragma endregion

+ 4 - 0
Output/inc/Module/CRCalib.h

@@ -112,6 +112,8 @@ public:
      * @return 操作结果,布尔类型,true 表示成功,false 表示失败
      */
     bool rotationPos(const XY_DOUBLE_STRUCT& point, const double& rotationRad, XY_DOUBLE_STRUCT& rotatedPoint);
+
+    LONG rotationPos(const XY_DOUBLE_STRUCT& point, const XY_DOUBLE_STRUCT& center, const double& rotationRad, XY_DOUBLE_STRUCT& rotatedPoint);
 	
     //设置旋转中心
     void SetCenter(XY_DOUBLE_STRUCT center) { 
@@ -158,4 +160,6 @@ private:
     //DOUBLE m_dAngleUpper = 90;                      // 标定时角度上限
     vector<Step_RCalib_Result> m_stVetCalib_R;      // R 轴标定结果,存储每次标定的结果
     CXYCalib* m_pXYCalib = nullptr;
+
+    int  m_nTestTempId = 0;
 };

+ 2 - 2
Output/inc/Module/CUltraHead.h

@@ -40,7 +40,7 @@ public:
     //virtual LONG VacuumOff();		//真空关
     //virtual LONG StrongOn();		//强吹开
     //virtual LONG StrongOff();		//强吹关
-    virtual LONG UltraOn(int iUltraValue);			//超声开
+    virtual LONG UltraOn();			//超声开
     virtual LONG UltraOff();		//超声关
   
 
@@ -51,7 +51,7 @@ public:
     LONG PlaceDie(int index, X_Y_ANGLE_STRUCT lookUpOffsetPixel);
     LONG MoveToBondGrabPos(int index);
     LONG BondGrab(int index, X_Y_ANGLE_STRUCT& result); //返回的拍照结果为物理单位
-    LONG ToBondPos_AddOffset(int index, X_Y_ANGLE_STRUCT bondOffset, X_Y_ANGLE_STRUCT lookUpOffset, bool waitDone = true);//传入物理位置
+    LONG ToBondPos_AddOffset(int index, X_Y_ANGLE_STRUCT bondOffset, X_Y_ANGLE_STRUCT lookUpOffset, bool bIsHard = true, bool waitDone = true);//传入物理位置
     LONG BondDieDown(int index);//传入物理位置
     LONG BondDieUp(bool waitDone = true);
 

+ 3 - 1
Output/inc/Module/CUltraHeadDiagnosis.h

@@ -15,6 +15,7 @@ public:
         bool bMoveX;
         bool bMoveY;
         bool bMoveZ;
+        long lCurrBondIndex;
     }XY_ACCURACY_TEST;
 private:
     CUltraHead *m_pCUltraHead;
@@ -27,6 +28,7 @@ private:
 public:
     CUltraHeadDiagnosis(CUltraHead* pUltraHeade);
 
-    LONG Diagnosis(string cmd);
+    LONG BondHead_AccuracyTest(string cmd);
+    LONG BondHead_PickAndBond_Diagnosis(string cmd);
 };
 

+ 2 - 2
Output/inc/Module/JAxis.h

@@ -479,10 +479,10 @@ public:
     virtual std::string ErrCodeTransfer(int nRtn){return "";};
 
 // protected:
-    //! 单位转换,用户单位(um)转换成轴单位(pulse),(无偏置适用速度相关转换)
+    //! 单位转换,用户单位(um)转换成轴单位,(无偏置适用速度相关转换)
     virtual long  User2Driver(double um,bool bWithHomeOffset = 0)=0;
 
-    //! 单位转换,轴单位(pulse)转换成用户单位(um),(无偏置适用速度相关转换)
+    //! 单位转换,轴单位转换成用户单位(um),(无偏置适用速度相关转换)
     virtual double Driver2User(double driverPulse,bool bWithHomeOffset = 0) = 0;
 
     //获取对应品牌的轴Index(不同品牌的逻辑不同,与m_stData中存储的轴Index不同)

+ 3 - 2
Output/inc/Module/Machine.h

@@ -56,6 +56,7 @@ public:
 	JMotion* GetMotion() {return m_pMotion;}
 
 	LONG ToHome();
+	LONG ToSafePosition();
 
 	void ShowMotionAdjustPage(std::string strAxisName = "");
 	vector<CAxis*> GetMachineAllAxis() {return m_vetAxis;};
@@ -108,7 +109,7 @@ public:
 	bool GetInitSuccess() { return m_bIsInitSuccess; }
 	HeadType GetHeadType() { return m_eHeadType; }
 	void SetHeadType(HeadType type) { m_eHeadType = type; }
-	LONG MoveToSafePosition() { return OK; };
+
 	LONG load();
 	LONG save();
 
@@ -164,7 +165,7 @@ private:
 
 	bool m_bIsInitSuccess = false;
 	bool    m_bMotionEnable = true;               //Ô˿ؿ¨½ûÖ¹/ÆôÓÃ
-	HeadType m_eHeadType = HeadType::EutecticHead;
+	HeadType m_eHeadType = HeadType::UltraHead;
 	CHardware* m_pCHardware = nullptr;
 
 	

BIN
Output/lib/x64/Common.lib


BIN
Output/lib/x64/Control.lib


BIN
Output/lib/x64/Module.lib


+ 1 - 0
View/die-bonder-ui/SBTdie-bonder-ui.vcxproj

@@ -396,6 +396,7 @@
     <QtUic Include="Src\SystemInfoPage\PageWnd\AddUserAccountWnd.ui" />
     <QtUic Include="Src\SystemInfoPage\PageWnd\LanguageSwitchWnd.ui" />
     <QtUic Include="Src\SystemInfoPage\SystemInfoPage.ui" />
+    <QtUic Include="Src\WaferProgramPage.ui" />
     <QtUic Include="Src\WaffleProgramPage.ui" />
   </ItemGroup>
   <ItemGroup>

+ 3 - 1
View/die-bonder-ui/SBTdie-bonder-ui.vcxproj.filters

@@ -522,6 +522,9 @@
     <QtUic Include="Src\WaffleProgramPage.ui">
       <Filter>Source Files\Src</Filter>
     </QtUic>
+    <QtUic Include="Src\WaferProgramPage.ui">
+      <Filter>Source Files\Src</Filter>
+    </QtUic>
   </ItemGroup>
   <ItemGroup>
     <None Include="images\Participation display\BlackDiamond.png">
@@ -825,7 +828,6 @@
       <Filter>Resource Files</Filter>
     </None>
     <None Include="dark.qss" />
-    <None Include="dark.qss" />
     <None Include="dark.qss">
       <Filter>Resource Files</Filter>
     </None>

Diff do ficheiro suprimidas por serem muito extensas
+ 547 - 215
View/die-bonder-ui/Src/BondMatrixProgramPage.cpp


+ 33 - 2
View/die-bonder-ui/Src/BondMatrixProgramPage.h

@@ -4,6 +4,15 @@
 #include "ui_BondMatrixProgramPage.h"
 #include "CViewInterface.h"
 
+#include "CModule.h"
+#include <QGroupBox>
+#include <QLineEdit>
+#include <QLabel>
+#include <QPushButton>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <algorithm>
+
 class BondMatrixProgramPage : public QWidget
 {
 	Q_OBJECT
@@ -16,10 +25,13 @@ private:
 
 
 	//新增矩阵界面
-	void AddMatrixPage(int bondMatrixVectorIndex, int vectorIndex, PROGRAM_POINT_MATRIX_STRUCT matrixData);
+	//void AddMatrixPage(int bondMatrixVectorIndex, int vectorIndex, PROGRAM_POINT_MATRIX_STRUCT matrixData);
 
-	void AddOutMatrixPage(int vectorIndex, PROGRAM_BOND_MATRIX_STRUCT matrixData);
+	void AddMatrixPage(int vectorIndex, int subVectorIndex, PROGRAM_POINT_MATRIX_STRUCT matrixData, QGridLayout* layout);
+	void AddOutMatrixPage(int vectorIndex, PROGRAM_BOND_MATRIX_STRUCT matrixData, std::vector<PROGRAM_POINT_MATRIX_STRUCT> vecSubMatrix);
+	//void AddOutMatrixPage(int vectorIndex, PROGRAM_BOND_MATRIX_STRUCT matrixData);
 
+	XY_DOUBLE_STRUCT BondGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos);
 	//往后端新增矩阵数据
 	void AddMatrixParam();
 
@@ -40,6 +52,13 @@ private:
 
 	void initPage();
 
+protected:
+	bool eventFilter(QObject* watched, QEvent* event) override;
+
+
+private slots:
+	void onNoBondPtsClicked(QLineEdit* lineEdit, int index, int parentIndex);
+
 private:
 	Ui::BondMatrixProgramPageClass ui;
 
@@ -60,6 +79,8 @@ private:
 
 	ns_mat::POINT_INFO_STRUCT m_curPointInfo;
 
+	ns_module::CViewInterface* m_pProgramCViewInterface = nullptr;
+
 	std::vector<ns_db::PICKBOND_PARAM_STRUCT> m_vecParam;
 
 	std::vector<ns_db::PROGRAM_BOND_MATRIX_STRUCT> m_vectBondMatrixs;
@@ -70,4 +91,14 @@ private:
 	QMap<int, QVector<QObject*>> m_mapSubMatrixControls;
 
 	int m_curPtIndex = 0;
+	// 新增字段: 用于管理大矩阵与子矩阵的关系
+	//QMap<int, std::vector<int>> m_mapBondMatrixToSubMatrices;  // 大矩阵ID和对应子矩阵ID的映射
+	QMap<int, std::vector<ns_db::PROGRAM_POINT_MATRIX_STRUCT>> m_mapBondMatrixToSubMatrices;  // 大矩阵ID和对应子矩阵ID的映射
+
+	// 用于标识当前矩阵类型(如大矩阵或子矩阵)
+	bool m_isSubMatrix = false;  // 标记是否为子矩阵
+
+	QMap<QWidget*, int> m_mapSubWidgetIndex;
+
+	QMap<QWidget*, int> m_mapOutWidgetIndex;
 };

+ 36 - 142
View/die-bonder-ui/Src/BondMatrixProgramPage.ui

@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>442</width>
+    <width>437</width>
     <height>943</height>
    </rect>
   </property>
@@ -16,9 +16,9 @@
   <widget class="QScrollArea" name="scrollArea_2">
    <property name="geometry">
     <rect>
-     <x>10</x>
-     <y>60</y>
-     <width>421</width>
+     <x>0</x>
+     <y>50</y>
+     <width>431</width>
      <height>231</height>
     </rect>
    </property>
@@ -36,132 +36,13 @@
      <rect>
       <x>0</x>
       <y>0</y>
-      <width>402</width>
-      <height>242</height>
+      <width>429</width>
+      <height>229</height>
      </rect>
     </property>
     <layout class="QVBoxLayout" name="verticalLayout_2">
      <item>
-      <layout class="QGridLayout" name="gridLayout">
-       <property name="spacing">
-        <number>10</number>
-       </property>
-       <item row="5" column="1">
-        <widget class="DoubleSpinBox" name="doubleSpinBoxRightTopX">
-         <property name="minimum">
-          <double>-1000000000.000000000000000</double>
-         </property>
-         <property name="maximum">
-          <double>1000000000.000000000000000</double>
-         </property>
-        </widget>
-       </item>
-       <item row="6" column="2">
-        <widget class="DoubleSpinBox" name="doubleSpinBoxRightButtomY">
-         <property name="minimum">
-          <double>-1000000000.000000000000000</double>
-         </property>
-         <property name="maximum">
-          <double>1000000000.000000000000000</double>
-         </property>
-        </widget>
-       </item>
-       <item row="5" column="0">
-        <widget class="QLabel" name="label_79">
-         <property name="text">
-          <string>右上角</string>
-         </property>
-        </widget>
-       </item>
-       <item row="5" column="2">
-        <widget class="DoubleSpinBox" name="doubleSpinBoxRightTopY">
-         <property name="minimum">
-          <double>-1000000000.000000000000000</double>
-         </property>
-         <property name="maximum">
-          <double>1000000000.000000000000000</double>
-         </property>
-        </widget>
-       </item>
-       <item row="4" column="1">
-        <widget class="DoubleSpinBox" name="doubleSpinBoxLeftTopX">
-         <property name="maximum">
-          <double>1000000000.000000000000000</double>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="label">
-         <property name="text">
-          <string>行数</string>
-         </property>
-        </widget>
-       </item>
-       <item row="6" column="0">
-        <widget class="QLabel" name="label_80">
-         <property name="text">
-          <string>右下角</string>
-         </property>
-        </widget>
-       </item>
-       <item row="6" column="1">
-        <widget class="DoubleSpinBox" name="doubleSpinBoxRightButtomX">
-         <property name="minimum">
-          <double>-1000000000.000000000000000</double>
-         </property>
-         <property name="maximum">
-          <double>1000000000.000000000000000</double>
-         </property>
-        </widget>
-       </item>
-       <item row="7" column="0">
-        <widget class="QLabel" name="label_81">
-         <property name="text">
-          <string>不固晶点</string>
-         </property>
-        </widget>
-       </item>
-       <item row="4" column="2">
-        <widget class="DoubleSpinBox" name="doubleSpinBoxLeftTopY">
-         <property name="minimum">
-          <double>-1000000000.000000000000000</double>
-         </property>
-         <property name="maximum">
-          <double>1000000000.000000000000000</double>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="1">
-        <widget class="SpinBox" name="spinBoxCol"/>
-       </item>
-       <item row="1" column="1">
-        <widget class="SpinBox" name="spinBoxRow"/>
-       </item>
-       <item row="4" column="0">
-        <widget class="QLabel" name="label_18">
-         <property name="text">
-          <string>左上角</string>
-         </property>
-        </widget>
-       </item>
-       <item row="7" column="1" colspan="2">
-        <widget class="QLineEdit" name="lineEditNoBondPts"/>
-       </item>
-       <item row="2" column="0">
-        <widget class="QLabel" name="label_2">
-         <property name="text">
-          <string>列数</string>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0" colspan="3">
-        <widget class="QLabel" name="label_82">
-         <property name="text">
-          <string>一维矩阵:</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
+      <layout class="QVBoxLayout" name="verticalLayout_3"/>
      </item>
     </layout>
    </widget>
@@ -169,8 +50,8 @@
   <widget class="QFrame" name="frame">
    <property name="geometry">
     <rect>
-     <x>10</x>
-     <y>290</y>
+     <x>0</x>
+     <y>280</y>
      <width>0</width>
      <height>0</height>
     </rect>
@@ -185,8 +66,8 @@
   <widget class="QFrame" name="frame_2">
    <property name="geometry">
     <rect>
-     <x>10</x>
-     <y>297</y>
+     <x>0</x>
+     <y>287</y>
      <width>0</width>
      <height>0</height>
     </rect>
@@ -201,10 +82,10 @@
   <widget class="QScrollArea" name="scrollArea_3">
    <property name="geometry">
     <rect>
-     <x>10</x>
-     <y>320</y>
-     <width>421</width>
-     <height>611</height>
+     <x>0</x>
+     <y>310</y>
+     <width>431</width>
+     <height>631</height>
     </rect>
    </property>
    <property name="sizePolicy">
@@ -221,7 +102,7 @@
      <rect>
       <x>0</x>
       <y>0</y>
-      <width>398</width>
+      <width>408</width>
       <height>1282</height>
      </rect>
     </property>
@@ -761,8 +642,8 @@
   <widget class="QFrame" name="frame_3">
    <property name="geometry">
     <rect>
-     <x>10</x>
-     <y>40</y>
+     <x>0</x>
+     <y>30</y>
      <width>431</width>
      <height>16</height>
     </rect>
@@ -777,9 +658,9 @@
   <widget class="QWidget" name="layoutWidget">
    <property name="geometry">
     <rect>
-     <x>10</x>
-     <y>10</y>
-     <width>421</width>
+     <x>0</x>
+     <y>0</y>
+     <width>431</width>
      <height>30</height>
     </rect>
    </property>
@@ -797,6 +678,19 @@
       </property>
      </spacer>
     </item>
+    <item>
+     <widget class="QPushButton" name="pushButtonAddOutMatrix">
+      <property name="minimumSize">
+       <size>
+        <width>150</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>Add</string>
+      </property>
+     </widget>
+    </item>
     <item>
      <widget class="QPushButton" name="pushButtonSave">
       <property name="minimumSize">
@@ -815,8 +709,8 @@
   <widget class="QFrame" name="frame_4">
    <property name="geometry">
     <rect>
-     <x>10</x>
-     <y>300</y>
+     <x>0</x>
+     <y>290</y>
      <width>431</width>
      <height>16</height>
     </rect>

+ 596 - 331
View/die-bonder-ui/Src/WaferProgramPage.cpp

@@ -5,372 +5,637 @@ std::unordered_map<int, bool> WaferProgramPage::m_IdIsUsedMap;
 WaferProgramPage::WaferProgramPage(QWidget* parent)
     : QWidget(parent)
 {
-    QVBoxLayout* mainLayout = new QVBoxLayout(this);
-
-    m_pCProduct = CManageDB::GetInstance()->GetCProduct();
-    // 从数据库中加载数据
-    m_pCProduct->LoadDataByDB();
-
-    // 创建表格
-    m_MergedTable = new QTableWidget(this);
-    m_MergedTable->setColumnCount(11); // 11 列,包含 Matrix 和 DieMatrix 的所有字段
-    m_MergedTable->setHorizontalHeaderLabels({
-        "MatrixID", "MatrixRow", "MatrixCol", "LeftTopPoint_Y", "LeftTopPoint_X",
-        "RightTopPoint_X", "RightTopPoint_Y", "RightBottomPoint_X", "RightBottomPoint_Y",
-        "DieMatrixId", "NoBondPt"
-        });
+    ui.setupUi(this);
 
-    m_MergedTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
-
-    // 创建按钮布局
-    QHBoxLayout* buttonLayout = new QHBoxLayout();
-    QPushButton* addRowButton = new QPushButton("Add", this);
-    QPushButton* deleteRowButton = new QPushButton("Delete", this);
-    QPushButton* updateButton = new QPushButton("Update", this);
-
-    buttonLayout->addWidget(addRowButton);
-    buttonLayout->addWidget(deleteRowButton);
-    buttonLayout->addWidget(updateButton);
-    QString buttonStyle = R"(
-    QPushButton {
-            background-color: #f0f0f0;
-            border: 1px solid #b0b0b0;
-            border-radius: 4px;
-            padding: 4px 12px;
-        }
-        QPushButton:hover {
-            background-color: #e0e0ff;
-        }
-        QPushButton:pressed {
-            background-color: #d0d0ff;
-        }
-    )";
-
-    addRowButton->setStyleSheet(buttonStyle);
-    deleteRowButton->setStyleSheet(buttonStyle);
-    updateButton->setStyleSheet(buttonStyle);
-    // 将控件添加到布局
-    mainLayout->addWidget(m_MergedTable);
-    mainLayout->addLayout(buttonLayout);
-    setLayout(mainLayout);
-
-    // 连接按钮和槽
-    connect(addRowButton, &QPushButton::clicked, this, &WaferProgramPage::addRow);
-    connect(deleteRowButton, &QPushButton::clicked, this, &WaferProgramPage::deleteRow);
-    connect(updateButton, &QPushButton::clicked, this, &WaferProgramPage::updateData);
-    connect(m_MergedTable, &QTableWidget::cellChanged, this, &WaferProgramPage::onCellChanged);
-    connect(m_MergedTable, &QTableWidget::cellDoubleClicked, this, [=](int row, int column) {
-        if (column == 9) {
-            QComboBox* comboBox = createDieMatrixIdComboBox(m_vecWaferMatrix[row].iDieMatrixId, row);
-            m_MergedTable->setCellWidget(row, column, comboBox);
-            comboBox->showPopup(); // 可选:自动展开下拉
-
-            // 记录初始值(以防没有变化)
-            int originalValue = comboBox->currentData().toInt();
-
-            // 1. 用户选择后立即还原
-            connect(comboBox, QOverload<int>::of(&QComboBox::activated), this, [=](int index) {
-                int selectedId = comboBox->itemData(index).toInt();
-                m_vecWaferMatrix[row].iDieMatrixId = selectedId;
-
-                m_MergedTable->removeCellWidget(row, column);
-                m_MergedTable->setItem(row, column, new QTableWidgetItem(QString::number(selectedId)));
-                });
-
-            // 2. 用户没有选中,仅点击其他地方,触发还原
-            connect(comboBox, &QComboBox::hidePopup, this, [=]() {
-                // 如果还在表格里,就还原(防止重复)
-                if (m_MergedTable->cellWidget(row, column) == comboBox) {
-                    int selectedId = comboBox->currentData().toInt();
-                    m_vecWaferMatrix[row].iDieMatrixId = selectedId;
-
-                    m_MergedTable->removeCellWidget(row, column);
-                    m_MergedTable->setItem(row, column, new QTableWidgetItem(QString::number(selectedId)));
-                }
-                });
-        }
+    ui.pushButtonSave->setProperty("type", "save");
+    ui.pushButtonAdd->setProperty("type", "add");
+
+    setStyleSheet(
+        "QWidget { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6); }"
+        "QDoubleSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
+        "QSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
+        "QLineEdit { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
+        "QCheckBox::indicator { width: 20px; height: 20px; }"
+        "QCheckBox::indicator:unchecked { background-color: #FFFFFF; border-radius: 2px; }"
+        "QComboBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
+        "QComboBox::drop-down { width: 20px; }"
+
+        "QPushButton { background: #D0D0E8; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"  // Button background color
+        "QPushButton:hover { background-color: #B0B0D8; }" // Lighter color on hover
+        "QPushButton:pressed { background-color: #A0A0C8; }" // Darker color on press
+
+    );
+
+    m_manageDB = CManageDB::GetInstance();
+    if (m_manageDB == nullptr) return;
+    m_pProduct = m_manageDB->GetCProduct();
+    if (m_pProduct == nullptr) return;
+    m_pProgramCViewInterface= ns_module::CViewInterface::GetInstance();
+
+
+    connect(ui.pushButtonSave, &QPushButton::clicked, this, [=]() {
+        m_pProduct->SetAllWaferMatrix(m_vecWaferMatrix);
+        CProduct* _Product = m_manageDB->GetCProduct();
         });
-    connect(m_MergedTable, &QTableWidget::cellDoubleClicked, this, [=](int row, int column) {
-        if (column == 10) { // NoBondPt 列
-            const auto& wafer = m_vecWaferMatrix[row];
-
-            NoBondPtEditDialog dlg(wafer.MatrixRow, wafer.MatrixCol, wafer.VecNoBondPt, this);
-            if (dlg.exec() == QDialog::Accepted) {
-                // 获取用户选择结果
-                QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
-
-                // 更新数据结构
-                m_vecWaferMatrix[row].VecNoBondPt.clear();
-                for (const auto& pt : selected) {
-                    m_vecWaferMatrix[row].VecNoBondPt.push_back(pt);
-                }
 
-                // 转换为字符串填入表格
-                QStringList ptList;
-                for (const auto& pt : selected) {
-                    ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
-                }
-                m_MergedTable->setItem(row, column, new QTableWidgetItem(ptList.join(" ")));
+    connect(ui.pushButtonAdd, &QPushButton::clicked, this, [=]() {
+        PROGRAM_WAFER_MATRIX_STRUCT newMatrix;
+        //排序
+        std::sort(m_vecWaferMatrix.begin(), m_vecWaferMatrix.end(),
+            [](const PROGRAM_WAFER_MATRIX_STRUCT& a, const PROGRAM_WAFER_MATRIX_STRUCT& b) {
+                return a.MatrixId < b.MatrixId;
+            });
+        //找Id
+        int newId = 1;
+        for (const auto& matrix : m_vecWaferMatrix)
+        {
+            if (matrix.MatrixId == newId)
+            {
+                newId++;
+            }
+            else if (matrix.MatrixId > newId)
+            {
+                break;
             }
         }
-        });
 
+        newMatrix.MatrixId = newId;
+        newMatrix.MatrixRow = 0;
+        newMatrix.MatrixCol = 0;
 
-    // 初始化表格数据
-    initMergedData();
-}
+        int newVectorIndex = m_vecWaferMatrix.size();
+        m_vecWaferMatrix.push_back(newMatrix);
+        AddMatrixPage(newVectorIndex, newMatrix);
 
-//QWidget* WaferProgramPage::CreateWaferProgramPage(const CONFIG_BASE_STRUCT& control) {
-//    return new WaferProgramPage();
-//}
+        });
+    initPage();
+}
 
-//创建下拉列表
-QComboBox* WaferProgramPage::createDieMatrixIdComboBox(int defaultId, int row) {
-    QComboBox* comboBox = new QComboBox(m_MergedTable);
-
-    // 设置样式,确保在暗色模式下也是白底黑字
-    comboBox->setStyleSheet(R"(
-        QComboBox {
-            background-color: white;
-            color: black;
-            border: 1px solid #BABBDC;
-            border-radius: 4px;
-            padding: 2px 5px;
-        }
-        QComboBox QAbstractItemView {
-            background-color: white;
-            color: black;
-            selection-background-color: #E5E5FF;
-            selection-color: black;
-        }
-    )");
-    for (const auto& dieMatrix : m_vecDieMatrixt) {
-        /*comboBox->addItem(
-            QString("%1 - %2").arg(dieMatrix.MatrixId).arg(QString::fromStdString(dieMatrix.strModuleName)),
-            QVariant(dieMatrix.MatrixId)
-        );*/
-        comboBox->addItem(QString::number(dieMatrix.MatrixId), QVariant(dieMatrix.MatrixId));
+void WaferProgramPage::initPage()
+{
+    m_vecWaferMatrix = m_pProduct->GetWaferMatrix();
+    for (int i = 0; i < m_vecWaferMatrix.size(); i++)
+    {
+        AddMatrixPage(i, m_vecWaferMatrix[i]);
     }
 
-    int index = comboBox->findData(defaultId);
-    if (index >= 0)
-        comboBox->setCurrentIndex(index);
 
-    return comboBox;
 }
 
+XY_DOUBLE_STRUCT WaferProgramPage::WaferGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos)
+{
+    /*CAxis* _Axis;
+    CAxis::AXIS_TYPE eAxisType = _Axis->GetAxisType();*/
+    if (m_pProgramCViewInterface == nullptr)
+    {
+        XY_DOUBLE_STRUCT errorPt = pos;  // 可以根据需要返回一个错误状态
+
+        // 弹出消息框显示位置
+        QString positionString = QString("Unable to retrieve axis position for module type: %1").arg(QString::fromStdString(ModuleType));
+        QMessageBox::information(this, "Axis Position Error", positionString);
 
-void WaferProgramPage::initMergedData() {
-    m_isInitializing = true;
-
-    SqlOperation& sqlOp = SqlOperation::GetInstance();
-    QList<QJsonObject> directories;
-    int userPrivilege = 0;//?
-    sqlOp.GetDirectories("Dir_Programme", userPrivilege, directories); // 使用相应的表名和权限加载目录
-    m_vecWaferMatrix = m_pCProduct->GetWaferMatrix();
-
-    for (const PROGRAM_WAFER_MATRIX_STRUCT& wafer : m_vecWaferMatrix) {
-        int row = m_MergedTable->rowCount();
-        m_MergedTable->insertRow(row);
-        PROGRAM_DIE_MATRIX_STRUCT stDieMatrix;
-        m_pCProduct->GetDieMatrix(wafer.MatrixId, stDieMatrix);
-        m_vecDieMatrixt.push_back(stDieMatrix);
-
-        // 填充表格数据
-        m_MergedTable->setItem(row, 0, new QTableWidgetItem(QString::number(wafer.MatrixId))); // MatrixID
-        m_MergedTable->setItem(row, 1, new QTableWidgetItem(QString::number(wafer.MatrixRow))); // MatrixRow
-        m_MergedTable->setItem(row, 2, new QTableWidgetItem(QString::number(wafer.MatrixCol))); // MatrixCol
-        m_MergedTable->setItem(row, 3, new QTableWidgetItem(QString::number(wafer.LeftTopPoint.y))); // LeftTopPoint_Y
-        m_MergedTable->setItem(row, 4, new QTableWidgetItem(QString::number(wafer.LeftTopPoint.x))); // LeftTopPoint_X
-        m_MergedTable->setItem(row, 5, new QTableWidgetItem(QString::number(wafer.RightTopPoint.x))); // RightTopPoint_X
-        m_MergedTable->setItem(row, 6, new QTableWidgetItem(QString::number(wafer.RightTopPoint.y))); // RightTopPoint_Y
-        m_MergedTable->setItem(row, 7, new QTableWidgetItem(QString::number(wafer.RightBottomPoint.x))); // RightBottomPoint_X
-        m_MergedTable->setItem(row, 8, new QTableWidgetItem(QString::number(wafer.RightBottomPoint.y))); // RightBottomPoint_Y
-        m_MergedTable->setItem(row, 9, new QTableWidgetItem(QString::number(wafer.iDieMatrixId))); // DieMatrixId
-
-        // 填充 NoBondPt 数据
-        QStringList noBondPts;
-        for (const XY_LONG_STRUCT& pt : wafer.VecNoBondPt) {
-            noBondPts.append(QString("(%1,%2)").arg(pt.x).arg(pt.y));
-        }
-        m_MergedTable->setItem(row, 10, new QTableWidgetItem(noBondPts.join(" "))); // NoBondPt
-    }
 
-    // 调整列宽和行高
-    m_MergedTable->resizeColumnsToContents();
-    m_MergedTable->resizeRowsToContents();
+        return errorPt;
+    }
+    m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "X", pos.x);
+    m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "Y", pos.y);
 
-    m_isInitializing = false;// 开启信号处理
+    return pos;
 }
 
+void WaferProgramPage::AddMatrixPage(int vectorIndex, _PROGRAM_WAFER_MATRIX_STRUCT matrixData) {
+    int matrixNum = m_vecWaferMatrix.size();
+    int newMatrixID = ++matrixNum;
+    QVector<QObject*> vecControls;
+
+    QGroupBox* groupBox = new QGroupBox();
+
+    QGridLayout* outMatrixGridLayout = new QGridLayout();
+    outMatrixGridLayout->setSpacing(6);
+    outMatrixGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
+    groupBox->setLayout(outMatrixGridLayout);
+
+    QGridLayout* subGridLayout = new QGridLayout();
+    subGridLayout->setSpacing(6);
+    subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
+
+    QLabel* labelTitle = new QLabel(this);
+    labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
+    labelTitle->setText(tr("Matrix ") + QString::number(vectorIndex));
+    subGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
+    vecControls.push_back(labelTitle);
+
+    // 删除按钮
+    QPushButton* pushButtonDelete = new QPushButton(this);
+    pushButtonDelete->setObjectName(QString::fromUtf8("buttonDelete"));
+    pushButtonDelete->setText(tr("Delete"));
+    pushButtonDelete->setFixedWidth(62);
+    subGridLayout->addWidget(pushButtonDelete, 0, 3, 1, 1);  // 添加到标题右侧的第四列
+    vecControls.push_back(pushButtonDelete);
+
+    // 删除按钮点击事件
+    connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
+        // 删除当前矩阵页面及控件
+        auto currentIt = m_mapWaferGroupBoxIndex.find(groupBox);
+        if (currentIt != m_mapWaferGroupBoxIndex.end()) {
+            int index = currentIt.value();
+            m_mapWaferGroupBoxIndex.erase(currentIt);
+
+            // 更新索引
+            for (auto it = m_mapWaferGroupBoxIndex.begin(); it != m_mapWaferGroupBoxIndex.end(); it++) {
+                if (it.value() > index) {
+                    int newIndex = it.value() - 1;
+                    m_mapWaferGroupBoxIndex.insert(it.key(), newIndex);
+                }
+            }
+
+            // 删除矩阵数据
+            m_vecWaferMatrix.erase(m_vecWaferMatrix.begin() + index);
 
-void WaferProgramPage::addRow() {
-    m_isInitializing = true;
-    m_IdIsUsedMap.clear();
-    for (const auto& wafer : m_vecWaferMatrix) {
-        m_IdIsUsedMap[wafer.MatrixId] = true;
-    }
-    int row = m_MergedTable->rowCount();
-    m_MergedTable->insertRow(row);
-
-    int newId = 1;
-    bool idUsed = true;
-
-    //// 检查当前 MatrixId 是否已存在
-    //while (idUsed) {
-    //    idUsed = false;  // 假设 ID 没有被使用
-
-    //    // 如果 ID 已存在于 map 中,则说明已被使用
-    //    if (m_IdIsUsedMap.find(newId) != m_IdIsUsedMap.end()) {
-    //        idUsed = true;
-    //    }
-
-    //    if (idUsed) {
-    //        ++newId; // 如果 ID 被使用,检查下一个 ID
-    //    }
-    //}
-    //找出最大的ID值
-    UINT maxId = 0;
-    for (PROGRAM_WAFER_MATRIX_STRUCT& bondMatrix : m_vecWaferMatrix)
-    {
-        if (bondMatrix.MatrixId > maxId)
-        {
-            maxId = bondMatrix.MatrixId;
+            // 删除矩阵控件
+            delete groupBox;
         }
-    }
-    newId = ++maxId;
-
-    // 为新行添加默认数据
-    m_MergedTable->setItem(row, 0, new QTableWidgetItem(QString::number(newId))); // MatrixID 默认值为 0
-    m_MergedTable->setItem(row, 1, new QTableWidgetItem("1")); // MatrixRow 默认值为 1
-    m_MergedTable->setItem(row, 2, new QTableWidgetItem("1")); // MatrixCol 默认值为 1
-    m_MergedTable->setItem(row, 3, new QTableWidgetItem("0")); // LeftTopPoint_Y 默认值为 0
-    m_MergedTable->setItem(row, 4, new QTableWidgetItem("0")); // LeftTopPoint_X 默认值为 0
-    m_MergedTable->setItem(row, 5, new QTableWidgetItem("0")); // RightTopPoint_X 默认值为 0
-    m_MergedTable->setItem(row, 6, new QTableWidgetItem("0")); // RightTopPoint_Y 默认值为 0
-    m_MergedTable->setItem(row, 7, new QTableWidgetItem("0")); // RightBottomPoint_X 默认值为 0
-    m_MergedTable->setItem(row, 8, new QTableWidgetItem("0")); // RightBottomPoint_Y 默认值为 0
-    m_MergedTable->setItem(row, 9, new QTableWidgetItem("0")); // DieMatrixId 默认值为 0
-    /*QComboBox* comboBox = createDieMatrixIdComboBox(0, row);
-    m_MergedTable->setCellWidget(row, 9, comboBox);*/
-
-    m_MergedTable->setItem(row, 10, new QTableWidgetItem("")); // NoBondPt 默认值为空
-
-    // 同时更新 PROGRAM_WAFER_MATRIX_STRUCT 数据
-    PROGRAM_WAFER_MATRIX_STRUCT newMatrix;
-    newMatrix.MatrixId = newId;
-    newMatrix.MatrixRow = 1;
-    newMatrix.MatrixCol = 1;
-    newMatrix.LeftTopPoint = { 0.0, 0.0 };
-    newMatrix.RightTopPoint = { 0.0, 0.0 };
-    newMatrix.RightBottomPoint = { 0.0, 0.0 };
-    newMatrix.iDieMatrixId = 0;
-    newMatrix.VecNoBondPt.clear();  // 默认值为空
-
-    m_vecWaferMatrix.push_back(newMatrix);
-    // 将新矩阵添加到数据结构中
-    //m_pCProduct->AddWaferMatrix(newMatrix, newId);
-    m_isInitializing = false;
-}
+        });
 
-void WaferProgramPage::deleteRow() {
-    int currentRow = m_MergedTable->currentRow();
+    QLabel* labelRow = new QLabel(this);
+    labelRow->setObjectName(QString::fromUtf8("labelRow"));
+    labelRow->setText(tr("Row & Cow "));
+    subGridLayout->addWidget(labelRow, 1, 0, 1, 1);
+    vecControls.push_back(labelRow);
+
+    SpinBox* spinBoxRow = new SpinBox(this);
+    spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
+    spinBoxRow->setValue(matrixData.MatrixRow);
+    subGridLayout->addWidget(spinBoxRow, 1, 1, 1, 1);
+    vecControls.push_back(spinBoxRow);
+
+    /*QLabel* labelCol = new QLabel(this);
+    labelCol->setObjectName(QString::fromUtf8("labelCol"));
+    labelCol->setText(tr("Cow "));
+    subGridLayout->addWidget(labelCol, 2, 0, 1, 1);
+    vecControls.push_back(labelCol);*/
+
+    SpinBox* spinBoxCol = new SpinBox(this);
+    spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
+    spinBoxCol->setValue(matrixData.MatrixCol);
+    subGridLayout->addWidget(spinBoxCol, 1, 2, 1, 1);
+    vecControls.push_back(spinBoxCol);
+
+    QLabel* labelLeftTop = new QLabel(this);
+    labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
+    labelLeftTop->setText(tr("Left Top Pos "));
+    subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
+    vecControls.push_back(labelLeftTop);
+
+    // Set all DoubleSpinBox width to 100
+    DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(this);
+    doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
+    doubleSpinBoxLeftTopX->setValue(matrixData.LeftTopPoint.x);
+    doubleSpinBoxLeftTopX->setFixedWidth(100);  // Set fixed width to 100
+    subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
+    vecControls.push_back(doubleSpinBoxLeftTopX);
+
+    DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(this);
+    doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
+    doubleSpinBoxLeftTopY->setValue(matrixData.LeftTopPoint.y);
+    doubleSpinBoxLeftTopY->setFixedWidth(100);  // Set fixed width to 100
+    subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
+    vecControls.push_back(doubleSpinBoxLeftTopY);
+
+    // Adding button to get LeftTop position
+    QPushButton* buttonLeftTop = new QPushButton("Get Pos", this);
+    buttonLeftTop->setFixedWidth(62);
+    subGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1);  // Position the button next to LeftTopPos
+    /*connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
+        QString position = QString("X: %1, Y: %2").arg(doubleSpinBoxLeftTopX->value()).arg(doubleSpinBoxLeftTopY->value());
+        QMessageBox::information(this, "Left Top Position", position);
+        });*/
+    connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
+        // 获取+更新位置
+        XY_DOUBLE_STRUCT position = WaferGetAxisPosition("WaferTable", m_vecWaferMatrix[vectorIndex].LeftTopPoint);
+
+        // 更新 DoubleSpinBox 的值
+        doubleSpinBoxLeftTopX->setValue(position.x);  // 更新 X 轴
+        doubleSpinBoxLeftTopY->setValue(position.y);  // 更新 Y 轴
+        });
 
-    if (currentRow >= 0 && currentRow < m_MergedTable->rowCount()) {
-        // 获取 MatrixID(假设第0列是 MatrixID)
-        QTableWidgetItem* idItem = m_MergedTable->item(currentRow, 0);
-        if (!idItem) return;
+    QLabel* labelRightTopPos = new QLabel(this);
+    labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
+    labelRightTopPos->setText(tr("Right Top Pos "));
+    subGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1);
+    vecControls.push_back(labelRightTopPos);
+
+    DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(this);
+    doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
+    doubleSpinBoxRightTopX->setValue(matrixData.RightTopPoint.x);
+    doubleSpinBoxRightTopX->setFixedWidth(100);  // Set fixed width to 100
+    subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
+    vecControls.push_back(doubleSpinBoxRightTopX);
+
+    DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(this);
+    doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
+    doubleSpinBoxRightTopY->setValue(matrixData.RightTopPoint.y);
+    doubleSpinBoxRightTopY->setFixedWidth(100);  // Set fixed width to 100
+    subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
+    vecControls.push_back(doubleSpinBoxRightTopY);
+
+    // Adding button to get RightTop position
+    QPushButton* buttonRightTop = new QPushButton("Get Pos", this);
+    buttonRightTop->setFixedWidth(62);
+    subGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1);  // Position the button next to RightTopPos
+
+    connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
+        // 获取+更新位置
+        XY_DOUBLE_STRUCT position = WaferGetAxisPosition("WaferTable", m_vecWaferMatrix[vectorIndex].LeftTopPoint);
+
+        // 更新 DoubleSpinBox 的值
+        doubleSpinBoxRightTopX->setValue(position.x);  // 更新 X 轴
+        doubleSpinBoxRightTopY->setValue(position.y);  // 更新 Y 轴
+        });
 
-        int matrixID = idItem->text().toInt();
+    QLabel* labelRightButtomPos = new QLabel(this);
+    labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
+    labelRightButtomPos->setText(tr("Right Buttom pos"));
+    subGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1);
+    vecControls.push_back(labelRightButtomPos);
+
+    DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(this);
+    doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
+    doubleSpinBoxRightButtomX->setValue(matrixData.RightBottomPoint.x);
+    doubleSpinBoxRightButtomX->setFixedWidth(100);  // Set fixed width to 100
+    subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
+    vecControls.push_back(doubleSpinBoxRightButtomX);
+
+    DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(this);
+    doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
+    doubleSpinBoxRightButtomY->setValue(matrixData.RightBottomPoint.y);
+    doubleSpinBoxRightButtomY->setFixedWidth(100);  // Set fixed width to 100
+    subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
+    vecControls.push_back(doubleSpinBoxRightButtomY);
+
+    // Adding button to get RightBottom position
+    QPushButton* buttonRightButtom = new QPushButton("Get Pos", this);
+    buttonRightButtom->setFixedWidth(62);
+    subGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1);  // Position the button next to RightBottomPos
+
+    connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
+        // 获取+更新位置
+        XY_DOUBLE_STRUCT position = WaferGetAxisPosition("WaferTable", m_vecWaferMatrix[vectorIndex].LeftTopPoint);
+
+        // 更新 DoubleSpinBox 的值
+        doubleSpinBoxRightButtomX->setValue(position.x);  // 更新 X 轴
+        doubleSpinBoxRightButtomY->setValue(position.y);  // 更新 Y 轴
+        });
 
-        // 从 m_MergedTable 删除行
-        m_MergedTable->removeRow(currentRow);
+    QLabel* labelNoBondPts = new QLabel(this);
+    labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
+    labelNoBondPts->setText(tr("No Bond Points"));
+    subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
+    vecControls.push_back(labelNoBondPts);
 
-        // 从 m_vecWaferMatrix 中移除对应项
-        auto it = std::remove_if(m_vecWaferMatrix.begin(), m_vecWaferMatrix.end(),
-            [matrixID](const PROGRAM_WAFER_MATRIX_STRUCT& wafer) {
-                return wafer.MatrixId == matrixID;
-            });
-        if (it != m_vecWaferMatrix.end()) {
-            m_vecWaferMatrix.erase(it, m_vecWaferMatrix.end());
-        }
+    QLineEdit* lineEditNoBondPts = new QLineEdit(this);
+    lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
+    lineEditNoBondPts->setReadOnly(true);
+    lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
+    lineEditNoBondPts->setProperty("vectorIndex", vectorIndex);  // Store the index
+    lineEditNoBondPts->installEventFilter(this);
+    subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
+    vecControls.push_back(lineEditNoBondPts);
 
-        // 同时通知数据管理类删除
-        //m_pCProduct->DeleteWaferMatrix(matrixID);
+    outMatrixGridLayout->addLayout(subGridLayout, 0, 0);
 
-    }
-    else {
-        //QMessageBox::warning(this, "No Row Selected", "Please select a row to delete.");
-        QMessageBox box(QMessageBox::Warning, "No Row Selected", "Please select a row to delete.");
-        box.setStyleSheet(R"(
-            QMessageBox {
-                background-color: #eeeeee;
-                color: black;
-            }
-            QPushButton {
-                background-color: #dddddd;
-                color: black;
-            }
-        )");
-        box.exec();
-    }
-    currentRow = -1;
-}
+    QFrame* line = new QFrame();
+    line->setFrameShape(QFrame::NoFrame);
+    line->setFixedHeight(2);
+    line->setStyleSheet("background-color: #C7CAEB;");
+    outMatrixGridLayout->addWidget(line);
 
-void WaferProgramPage::updateData() {
-    // 1. 清空原模型中的矩阵
-    auto originalData = m_pCProduct->GetWaferMatrix();
-    for (const auto& matrix : originalData) {
-        m_pCProduct->DeleteWaferMatrix(matrix.MatrixId);
-    }
+    ui.verticalLayout->addWidget(groupBox);
 
-    // 2. 添加当前表格中的数据
-    for (auto& matrix : m_vecWaferMatrix) {
-        int newId = matrix.MatrixId;
-        m_pCProduct->AddWaferMatrix(matrix, newId);
-        auto originalData1 = m_pCProduct->GetWaferMatrix();
-    }
+    m_mapWaferGroupBoxIndex.insert(groupBox, vectorIndex);
+
+    // 连接信号和槽
+    connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
+        m_vecWaferMatrix[vectorIndex].MatrixRow = spinBoxRow->value();
+        });
+
+    connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
+        m_vecWaferMatrix[vectorIndex].MatrixCol = spinBoxCol->value();
+        });
+
+    connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
+        m_vecWaferMatrix[vectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
+        });
+
+    connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
+        m_vecWaferMatrix[vectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
+        });
+
+    connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
+        m_vecWaferMatrix[vectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value();
+        });
+
+    connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
+        m_vecWaferMatrix[vectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value();
+        });
+
+    connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
+        m_vecWaferMatrix[vectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
+        });
+
+    connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
+        m_vecWaferMatrix[vectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
+        });
 
-    //qDebug() << "WaferMatrix 已同步到模型层,共同步:" << m_vecWaferMatrix.size() << "条记录。";
+    connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
+        // Handle NoBondPts logic here
+        });
 }
 
 
-void WaferProgramPage::onCellChanged(int row, int column)
-{
-    if (m_isInitializing) return; // 防止初始化时触发
-    if (row >= m_vecWaferMatrix.size()) return;
-
-    QTableWidgetItem* item = m_MergedTable->item(row, column);
-    if (!item) return;
-
-    QString value = item->text();
-    PROGRAM_WAFER_MATRIX_STRUCT& wafer = m_vecWaferMatrix[row];
-
-    switch (column) {
-    case 0: wafer.MatrixId = value.toInt(); break;
-    case 1: wafer.MatrixRow = value.toInt(); break;
-    case 2: wafer.MatrixCol = value.toInt(); break;
-    case 3: wafer.LeftTopPoint.y = value.toDouble(); break;
-    case 4: wafer.LeftTopPoint.x = value.toDouble(); break;
-    case 5: wafer.RightTopPoint.x = value.toDouble(); break;
-    case 6: wafer.RightTopPoint.y = value.toDouble(); break;
-    case 7: wafer.RightBottomPoint.x = value.toDouble(); break;
-    case 8: wafer.RightBottomPoint.y = value.toDouble(); break;
-        ////case 9: wafer.iDieMatrixId = value.toInt(); break;
-
-    case 10: {
-        wafer.VecNoBondPt.clear();
-        QRegularExpression regex(R"(\((\d+),(\d+)\))");
-        QRegularExpressionMatchIterator i = regex.globalMatch(value);
-        while (i.hasNext()) {
-            auto match = i.next();
-            XY_LONG_STRUCT pt;
-            pt.x = match.captured(1).toInt();
-            pt.y = match.captured(2).toInt();
-            wafer.VecNoBondPt.push_back(pt);
+bool WaferProgramPage::eventFilter(QObject* obj, QEvent* event) {
+    if (event->type() == QEvent::MouseButtonPress) {
+        auto* lineEdit = qobject_cast<QLineEdit*>(obj);
+        if (lineEdit) {
+            int index = lineEdit->property("vectorIndex").toInt();
+            if (lineEdit->property("vectorIndex").isValid()) {
+                // Handle WaffleMatrix
+                onNoBondPtsClickedWafer(lineEdit, index);
+            }
+            return true; // Intercept the event
         }
-        break;
     }
-    default: break;
+    return QWidget::eventFilter(obj, event);
+}
+
+void WaferProgramPage::onNoBondPtsClickedWafer(QLineEdit* lineEdit, int index) {
+    if (index < 0 || index >= m_vecWaferMatrix.size()) return;
+
+    const auto& wafer = m_vecWaferMatrix[index];
+    NoBondPtEditDialog dlg(wafer.MatrixRow, wafer.MatrixCol, wafer.VecNoBondPt, this);
+
+    if (dlg.exec() == QDialog::Accepted) {
+        QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
+        m_vecWaferMatrix[index].VecNoBondPt = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
+
+        QStringList ptList;
+        for (const auto& pt : selected)
+            ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
+        lineEdit->setText(ptList.join(" "));
     }
 }
+
+//QWidget* WaferProgramPage::CreateWaferProgramPage(const CONFIG_BASE_STRUCT& control) {
+//    return new WaferProgramPage();
+//}
+
+//创建下拉列表
+//QComboBox* WaferProgramPage::createDieMatrixIdComboBox(int defaultId, int row) {
+//    QComboBox* comboBox = new QComboBox(m_MergedTable);
+//
+//    // 设置样式,确保在暗色模式下也是白底黑字
+//    comboBox->setStyleSheet(R"(
+//        QComboBox {
+//            background-color: white;
+//            color: black;
+//            border: 1px solid #BABBDC;
+//            border-radius: 4px;
+//            padding: 2px 5px;
+//        }
+//        QComboBox QAbstractItemView {
+//            background-color: white;
+//            color: black;
+//            selection-background-color: #E5E5FF;
+//            selection-color: black;
+//        }
+//    )");
+//    for (const auto& dieMatrix : m_vecDieMatrixt) {
+//        /*comboBox->addItem(
+//            QString("%1 - %2").arg(dieMatrix.MatrixId).arg(QString::fromStdString(dieMatrix.strModuleName)),
+//            QVariant(dieMatrix.MatrixId)
+//        );*/
+//        comboBox->addItem(QString::number(dieMatrix.MatrixId), QVariant(dieMatrix.MatrixId));
+//    }
+//
+//    int index = comboBox->findData(defaultId);
+//    if (index >= 0)
+//        comboBox->setCurrentIndex(index);
+//
+//    return comboBox;
+//}
+
+//
+//void WaferProgramPage::initMergedData() {
+//    m_isInitializing = true;
+//
+//    SqlOperation& sqlOp = SqlOperation::GetInstance();
+//    QList<QJsonObject> directories;
+//    int userPrivilege = 0;//?
+//    sqlOp.GetDirectories("Dir_Programme", userPrivilege, directories); // 使用相应的表名和权限加载目录
+//    m_vecWaferMatrix = m_pProduct->GetWaferMatrix();
+//
+//    for (const PROGRAM_WAFER_MATRIX_STRUCT& wafer : m_vecWaferMatrix) {
+//        int row = m_MergedTable->rowCount();
+//        m_MergedTable->insertRow(row);
+//        PROGRAM_DIE_MATRIX_STRUCT stDieMatrix;
+//        m_pProduct->GetDieMatrix(wafer.MatrixId, stDieMatrix);
+//        m_vecDieMatrixt.push_back(stDieMatrix);
+//
+//        // 填充表格数据
+//        m_MergedTable->setItem(row, 0, new QTableWidgetItem(QString::number(wafer.MatrixId))); // MatrixID
+//        m_MergedTable->setItem(row, 1, new QTableWidgetItem(QString::number(wafer.MatrixRow))); // MatrixRow
+//        m_MergedTable->setItem(row, 2, new QTableWidgetItem(QString::number(wafer.MatrixCol))); // MatrixCol
+//        m_MergedTable->setItem(row, 3, new QTableWidgetItem(QString::number(wafer.LeftTopPoint.y))); // LeftTopPoint_Y
+//        m_MergedTable->setItem(row, 4, new QTableWidgetItem(QString::number(wafer.LeftTopPoint.x))); // LeftTopPoint_X
+//        m_MergedTable->setItem(row, 5, new QTableWidgetItem(QString::number(wafer.RightTopPoint.x))); // RightTopPoint_X
+//        m_MergedTable->setItem(row, 6, new QTableWidgetItem(QString::number(wafer.RightTopPoint.y))); // RightTopPoint_Y
+//        m_MergedTable->setItem(row, 7, new QTableWidgetItem(QString::number(wafer.RightBottomPoint.x))); // RightBottomPoint_X
+//        m_MergedTable->setItem(row, 8, new QTableWidgetItem(QString::number(wafer.RightBottomPoint.y))); // RightBottomPoint_Y
+//        m_MergedTable->setItem(row, 9, new QTableWidgetItem(QString::number(wafer.iDieMatrixId))); // DieMatrixId
+//
+//        // 填充 NoBondPt 数据
+//        QStringList noBondPts;
+//        for (const XY_LONG_STRUCT& pt : wafer.VecNoBondPt) {
+//            noBondPts.append(QString("(%1,%2)").arg(pt.x).arg(pt.y));
+//        }
+//        m_MergedTable->setItem(row, 10, new QTableWidgetItem(noBondPts.join(" "))); // NoBondPt
+//    }
+//
+//    // 调整列宽和行高
+//    m_MergedTable->resizeColumnsToContents();
+//    m_MergedTable->resizeRowsToContents();
+//
+//    m_isInitializing = false;// 开启信号处理
+//}
+
+//
+//void WaferProgramPage::addRow() {
+//    m_isInitializing = true;
+//    m_IdIsUsedMap.clear();
+//    for (const auto& wafer : m_vecWaferMatrix) {
+//        m_IdIsUsedMap[wafer.MatrixId] = true;
+//    }
+//    int row = m_MergedTable->rowCount();
+//    m_MergedTable->insertRow(row);
+//
+//    int newId = 1;
+//    bool idUsed = true;
+//
+//    //// 检查当前 MatrixId 是否已存在
+//    //while (idUsed) {
+//    //    idUsed = false;  // 假设 ID 没有被使用
+//
+//    //    // 如果 ID 已存在于 map 中,则说明已被使用
+//    //    if (m_IdIsUsedMap.find(newId) != m_IdIsUsedMap.end()) {
+//    //        idUsed = true;
+//    //    }
+//
+//    //    if (idUsed) {
+//    //        ++newId; // 如果 ID 被使用,检查下一个 ID
+//    //    }
+//    //}
+//    //找出最大的ID值
+//    UINT maxId = 0;
+//    for (PROGRAM_WAFER_MATRIX_STRUCT& bondMatrix : m_vecWaferMatrix)
+//    {
+//        if (bondMatrix.MatrixId > maxId)
+//        {
+//            maxId = bondMatrix.MatrixId;
+//        }
+//    }
+//    newId = ++maxId;
+//
+//    // 为新行添加默认数据
+//    m_MergedTable->setItem(row, 0, new QTableWidgetItem(QString::number(newId))); // MatrixID 默认值为 0
+//    m_MergedTable->setItem(row, 1, new QTableWidgetItem("1")); // MatrixRow 默认值为 1
+//    m_MergedTable->setItem(row, 2, new QTableWidgetItem("1")); // MatrixCol 默认值为 1
+//    m_MergedTable->setItem(row, 3, new QTableWidgetItem("0")); // LeftTopPoint_Y 默认值为 0
+//    m_MergedTable->setItem(row, 4, new QTableWidgetItem("0")); // LeftTopPoint_X 默认值为 0
+//    m_MergedTable->setItem(row, 5, new QTableWidgetItem("0")); // RightTopPoint_X 默认值为 0
+//    m_MergedTable->setItem(row, 6, new QTableWidgetItem("0")); // RightTopPoint_Y 默认值为 0
+//    m_MergedTable->setItem(row, 7, new QTableWidgetItem("0")); // RightBottomPoint_X 默认值为 0
+//    m_MergedTable->setItem(row, 8, new QTableWidgetItem("0")); // RightBottomPoint_Y 默认值为 0
+//    m_MergedTable->setItem(row, 9, new QTableWidgetItem("0")); // DieMatrixId 默认值为 0
+//    /*QComboBox* comboBox = createDieMatrixIdComboBox(0, row);
+//    m_MergedTable->setCellWidget(row, 9, comboBox);*/
+//
+//    m_MergedTable->setItem(row, 10, new QTableWidgetItem("")); // NoBondPt 默认值为空
+//
+//    // 同时更新 PROGRAM_WAFER_MATRIX_STRUCT 数据
+//    PROGRAM_WAFER_MATRIX_STRUCT newMatrix;
+//    newMatrix.MatrixId = newId;
+//    newMatrix.MatrixRow = 1;
+//    newMatrix.MatrixCol = 1;
+//    newMatrix.LeftTopPoint = { 0.0, 0.0 };
+//    newMatrix.RightTopPoint = { 0.0, 0.0 };
+//    newMatrix.RightBottomPoint = { 0.0, 0.0 };
+//    newMatrix.iDieMatrixId = 0;
+//    newMatrix.VecNoBondPt.clear();  // 默认值为空
+//
+//    m_vecWaferMatrix.push_back(newMatrix);
+//    // 将新矩阵添加到数据结构中
+//    //m_pProduct->AddWaferMatrix(newMatrix, newId);
+//    m_isInitializing = false;
+//}
+//
+//void WaferProgramPage::deleteRow() {
+//    int currentRow = m_MergedTable->currentRow();
+//
+//    if (currentRow >= 0 && currentRow < m_MergedTable->rowCount()) {
+//        // 获取 MatrixID(假设第0列是 MatrixID)
+//        QTableWidgetItem* idItem = m_MergedTable->item(currentRow, 0);
+//        if (!idItem) return;
+//
+//        int matrixID = idItem->text().toInt();
+//
+//        // 从 m_MergedTable 删除行
+//        m_MergedTable->removeRow(currentRow);
+//
+//        // 从 m_vecWaferMatrix 中移除对应项
+//        auto it = std::remove_if(m_vecWaferMatrix.begin(), m_vecWaferMatrix.end(),
+//            [matrixID](const PROGRAM_WAFER_MATRIX_STRUCT& wafer) {
+//                return wafer.MatrixId == matrixID;
+//            });
+//        if (it != m_vecWaferMatrix.end()) {
+//            m_vecWaferMatrix.erase(it, m_vecWaferMatrix.end());
+//        }
+//
+//        // 同时通知数据管理类删除
+//        //m_pProduct->DeleteWaferMatrix(matrixID);
+//
+//    }
+//    else {
+//        //QMessageBox::warning(this, "No Row Selected", "Please select a row to delete.");
+//        QMessageBox box(QMessageBox::Warning, "No Row Selected", "Please select a row to delete.");
+//        box.setStyleSheet(R"(
+//            QMessageBox {
+//                background-color: #eeeeee;
+//                color: black;
+//            }
+//            QPushButton {
+//                background-color: #dddddd;
+//                color: black;
+//            }
+//        )");
+//        box.exec();
+//    }
+//    currentRow = -1;
+//}
+//
+//void WaferProgramPage::updateData() {
+//    // 1. 清空原模型中的矩阵
+//    auto originalData = m_pProduct->GetWaferMatrix();
+//    for (const auto& matrix : originalData) {
+//        m_pProduct->DeleteWaferMatrix(matrix.MatrixId);
+//    }
+//
+//    // 2. 添加当前表格中的数据
+//    for (auto& matrix : m_vecWaferMatrix) {
+//        int newId = matrix.MatrixId;
+//        m_pProduct->AddWaferMatrix(matrix, newId);
+//        auto originalData1 = m_pProduct->GetWaferMatrix();
+//    }
+//
+//    //qDebug() << "WaferMatrix 已同步到模型层,共同步:" << m_vecWaferMatrix.size() << "条记录。";
+//}
+
+
+//void WaferProgramPage::onCellChanged(int row, int column)
+//{
+//    if (m_isInitializing) return; // 防止初始化时触发
+//    if (row >= m_vecWaferMatrix.size()) return;
+//
+//    QTableWidgetItem* item = m_MergedTable->item(row, column);
+//    if (!item) return;
+//
+//    QString value = item->text();
+//    PROGRAM_WAFER_MATRIX_STRUCT& wafer = m_vecWaferMatrix[row];
+//
+//    switch (column) {
+//    case 0: wafer.MatrixId = value.toInt(); break;
+//    case 1: wafer.MatrixRow = value.toInt(); break;
+//    case 2: wafer.MatrixCol = value.toInt(); break;
+//    case 3: wafer.LeftTopPoint.y = value.toDouble(); break;
+//    case 4: wafer.LeftTopPoint.x = value.toDouble(); break;
+//    case 5: wafer.RightTopPoint.x = value.toDouble(); break;
+//    case 6: wafer.RightTopPoint.y = value.toDouble(); break;
+//    case 7: wafer.RightBottomPoint.x = value.toDouble(); break;
+//    case 8: wafer.RightBottomPoint.y = value.toDouble(); break;
+//        ////case 9: wafer.iDieMatrixId = value.toInt(); break;
+//
+//    case 10: {
+//        wafer.VecNoBondPt.clear();
+//        QRegularExpression regex(R"(\((\d+),(\d+)\))");
+//        QRegularExpressionMatchIterator i = regex.globalMatch(value);
+//        while (i.hasNext()) {
+//            auto match = i.next();
+//            XY_LONG_STRUCT pt;
+//            pt.x = match.captured(1).toInt();
+//            pt.y = match.captured(2).toInt();
+//            wafer.VecNoBondPt.push_back(pt);
+//        }
+//        break;
+//    }
+//    default: break;
+//    }
+//}

+ 34 - 8
View/die-bonder-ui/Src/WaferProgramPage.h

@@ -2,7 +2,15 @@
 #define WAFER_PROGRAM_PAGE_H
 
 #include "Src/Sql/SqlOperation.h"
+#include "CViewInterface.h"
 #include <QWidget>
+#include <QGroupBox>
+#include <QLineEdit>
+#include "Src/RewriteControl/Controls/SpinBox.h"
+#include "Src/RewriteControl/Controls/DoubleSpinBox.h"
+#include "ui_WaferProgramPage.h"
+#include <QLabel>
+
 #include <QFileDialog>
 #include <QTextStream>
 #include <QHeaderView>
@@ -19,6 +27,8 @@
 
 #include <View/die-bonder-ui/Src/MatrixDialogs/NoBondPtEditDialog.h>
 
+#include "CModule.h"
+
 
 class WaferProgramPage : public QWidget {
     Q_OBJECT
@@ -26,30 +36,46 @@ class WaferProgramPage : public QWidget {
 public:
     explicit WaferProgramPage(QWidget* parent = nullptr);
 
-    QComboBox* createDieMatrixIdComboBox(int defaultId, int row);
+
+    void AddMatrixPage(int vectorIndex, _PROGRAM_WAFER_MATRIX_STRUCT matrixData);
+
+    //QComboBox* createDieMatrixIdComboBox(int defaultId, int row);
 
 private slots:
-    void addRow();
+    /*void addRow();
 
     void deleteRow();
 
-    void updateData();
+    void updateData();*/
 
-    void onCellChanged(int row, int column);
+    //void onCellChanged(int row, int column);
 
 private:
     // 初始化合并后的数据(多表)
-    void initMergedData();
+    //void initMergedData();
+
+    void initPage();
+    bool eventFilter(QObject* obj, QEvent* event);
+    XY_DOUBLE_STRUCT WaferGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos);
 
+private slots:
+    void onNoBondPtsClickedWafer(QLineEdit* lineEdit, int index);
 
 private:
-    QTableWidget* m_MergedTable = nullptr;
-    CProduct* m_pCProduct = nullptr;
+    Ui::WaferProgramPageClass ui;
+
+    CManageDB* m_manageDB = nullptr;
+    CProduct* m_pProduct = nullptr;
+
     std::vector<PROGRAM_WAFER_MATRIX_STRUCT> m_vecWaferMatrix;
-    std::vector<PROGRAM_DIE_MATRIX_STRUCT> m_vecDieMatrixt;
+    //std::vector<PROGRAM_DIE_MATRIX_STRUCT> m_vecDieMatrixt;
 
     static std::unordered_map<int, bool> m_IdIsUsedMap;
     bool m_isInitializing = false;
+
+    QMap<QGroupBox*, int> m_mapWaferGroupBoxIndex;
+
+    ns_module::CViewInterface* m_pProgramCViewInterface = nullptr;
 };
 
 #endif // WAFER_PROGRAM_PAGE_H

+ 126 - 0
View/die-bonder-ui/Src/WaferProgramPage.ui

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>WaferProgramPageClass</class>
+ <widget class="QWidget" name="WaferProgramPageClass">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1079</width>
+    <height>864</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>WaferProgramPage</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QScrollArea" name="scrollArea">
+     <property name="widgetResizable">
+      <bool>true</bool>
+     </property>
+     <widget class="QWidget" name="scrollAreaWidgetContents">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>1077</width>
+        <height>862</height>
+       </rect>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <property name="leftMargin">
+        <number>6</number>
+       </property>
+       <property name="topMargin">
+        <number>6</number>
+       </property>
+       <property name="rightMargin">
+        <number>6</number>
+       </property>
+       <property name="bottomMargin">
+        <number>6</number>
+       </property>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType">
+            <enum>QSizePolicy::Expanding</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonAdd">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>150</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>Add</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonSave">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>150</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>Save</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout"/>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>

+ 233 - 108
View/die-bonder-ui/Src/WaffleProgramPage.cpp

@@ -18,44 +18,97 @@ WaffleProgramPage::WaffleProgramPage(QWidget* parent)
 
 
 	ui.pushButtonSave->setProperty("type", "save");
-
-	setStyleSheet("QGroupBox { border: 2px solid #A9B4FF;border-radius: 10px;  }");
-
-	//setStyleSheet(
-	//	"QPushButton{background-color: #A9B4FF;border-radius: 5px;height: 30px;}"
-	//	"QDoubleSpinBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}"
-	//	"QSpinBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}"
-	//	"QLineEdit{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}"
-	//	"QCheckBox::indicator{width: 20px;height: 20px;}"
-	//	"QCheckBox::indicator:unchecked{background - color: #FFFFFF;border-radius: 2px;}"
-	//	"QComboBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}"
-	//	"QComboBox::drop - down{width: 20px;}"
-	//	"QGroupBox{ border: 2px solid red}"
-	//	//"QGroupBox::title { subcontrol-origin: margin; subcontrol-position: top center; padding: 0 3px; }"
-	//);
+	ui.pushButtonAddOutMatrix->setProperty("type", "addOutMatrix");
+	setStyleSheet(
+		"QWidget { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6); }"
+		"QDoubleSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
+		"QSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
+		"QLineEdit { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
+		"QCheckBox::indicator { width: 20px; height: 20px; }"
+		"QCheckBox::indicator:unchecked { background-color: #FFFFFF; border-radius: 2px; }"
+		"QComboBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
+		"QComboBox::drop-down { width: 20px; }"
+
+		"QPushButton { background: #D0D0E8; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"  // Button background color
+		"QPushButton:hover { background-color: #B0B0D8; }" // Lighter color on hover
+		"QPushButton:pressed { background-color: #A0A0C8; }" // Darker color on press
+
+	);
 
 	m_manageDB = CManageDB::GetInstance();
 	if (m_manageDB == nullptr) return;
 	m_pProduct = m_manageDB->GetCProduct();
 	if (m_pProduct == nullptr) return;
 
+	m_pProgramCViewInterface = ns_module::CViewInterface::GetInstance();
+
 	initPage();
 
     connect(ui.pushButtonSave, &QPushButton::clicked, this, [=]() {
         m_pProduct->SetAllWaffleMatrix(m_vecWaffleMatrix);
         m_pProduct->SetAllWaffleDieMatrix(m_vecSubWaffleMatrix);
 
+		CProduct* _Product = m_manageDB->GetCProduct();
         });
 
-}
+	connect(ui.pushButtonAddOutMatrix, &QPushButton::clicked, this, [=]() {
+		PROGRAM_WAFFLE_MATRIX_STRUCT newMatrix;
+		//排序
+		std::sort(m_vecWaffleMatrix.begin(), m_vecWaffleMatrix.end(),
+			[](const PROGRAM_WAFFLE_MATRIX_STRUCT& a, const PROGRAM_WAFFLE_MATRIX_STRUCT& b) {
+				return a.MatrixId < b.MatrixId;
+			});
+		//找Id
+		int newId = 1;
+		for (const auto& matrix : m_vecWaffleMatrix)
+		{
+			if (matrix.MatrixId == newId)
+			{
+				newId++;
+			}
+			else if (matrix.MatrixId > newId)
+			{
+				break;
+			}
+		}
 
+		newMatrix.MatrixId = newId;
+		newMatrix.PackRow = 0;
+		newMatrix.PackCol = 0;
+		int newVectorIndex = m_vecWaffleMatrix.size();
+		std::vector<PROGRAM_DIE_MATRIX_STRUCT> newVecSubMatrix;
+		m_vecWaffleMatrix.push_back(newMatrix);
+		AddMatrixPage(newVectorIndex, newMatrix, newVecSubMatrix);
 
+		});
+}
 
 WaffleProgramPage::~WaffleProgramPage()
 {
 
 }
 
+XY_DOUBLE_STRUCT WaffleProgramPage::WaffleGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos)
+{
+	/*CAxis* _Axis;
+	CAxis::AXIS_TYPE eAxisType = _Axis->GetAxisType();*/
+	if (m_pProgramCViewInterface == nullptr)
+	{
+		XY_DOUBLE_STRUCT errorPt = pos;  // 可以根据需要返回一个错误状态
+
+		// 弹出消息框显示位置
+		QString positionString = QString("Unable to retrieve axis position for module type: %1").arg(QString::fromStdString(ModuleType));
+		QMessageBox::information(this, "Axis Position Error", positionString);
+
+
+		return errorPt;
+	}
+	m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "X", pos.x);
+	m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "Y", pos.y);
+
+	return pos;
+}
+
 void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STRUCT matrixData, std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecSubMatrix)
 {
 	int matrixNum = m_mapSubMatrixControls.size();
@@ -65,8 +118,9 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 	QWidget* outWidget = new QWidget();
 
 	QGridLayout* outMatrixGridLayout = new QGridLayout();
-	outMatrixGridLayout->setSpacing(6);
+	outMatrixGridLayout->setSpacing(4);
 	outMatrixGridLayout->setObjectName(QString::fromUtf8("Out GridLayout"));
+	outMatrixGridLayout->setContentsMargins(0, 0, 0, 0);  // 设置布局的边距为0
 
 	QGridLayout* boxGridLayout = new QGridLayout();
 	boxGridLayout->setSpacing(6);
@@ -76,38 +130,12 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 	QSpacerItem* item = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
 	buttonLayout->addSpacerItem(item);
 
-	QPushButton* pushButtonAddOutMatrix = new QPushButton();
-	pushButtonAddOutMatrix->setObjectName(QString::fromUtf8("button Add"));
-	pushButtonAddOutMatrix->setText(tr("add out Matrix"));
-	buttonLayout->addWidget(pushButtonAddOutMatrix);
+	//QPushButton* pushButtonAddOutMatrix = new QPushButton();
+	//pushButtonAddOutMatrix->setObjectName(QString::fromUtf8("button Add"));
+	//pushButtonAddOutMatrix->setText(tr("add out Matrix"));
+	//buttonLayout->addWidget(pushButtonAddOutMatrix);
 
-	connect(pushButtonAddOutMatrix, &QPushButton::clicked, this, [=]() {
-		PROGRAM_WAFFLE_MATRIX_STRUCT newMatrix;
-		//排序
-		std::sort(m_vecWaffleMatrix.begin(), m_vecWaffleMatrix.end(),
-			[](const PROGRAM_WAFFLE_MATRIX_STRUCT& a, const PROGRAM_WAFFLE_MATRIX_STRUCT& b) {
-				return a.MatrixId < b.MatrixId;
-			});
-		//找Id
-		int newId = 1;
-		for (const auto& matrix : m_vecWaffleMatrix)
-		{
-			if (matrix.MatrixId == newId)
-			{
-				newId++;
-			} else if (matrix.MatrixId > newId)
-			{
-				break;
-			}
-		}
-
-		newMatrix.MatrixId = newId;
-		int newVectorIndex = m_vecWaffleMatrix.size();
-		std::vector<PROGRAM_DIE_MATRIX_STRUCT> newVecSubMatrix;
-		m_vecWaffleMatrix.push_back(newMatrix);
-		AddMatrixPage(newVectorIndex, newMatrix, newVecSubMatrix);
-
-		});
+	
 
 	//ui.verticalLayout->addLayout(buttonLayout);
 
@@ -122,14 +150,14 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 	labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
 	labelTitle->setText(tr("Matrix ") + QString::number(vectorIndex));
 	labelTitle->setStyleSheet("color: #6A78FF;height: 30px");
-	matrixGridLayout->addWidget(labelTitle, 0, 1, 1, 3);
+	matrixGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
 	vecControls.push_back(labelTitle);
 
 
 	QPushButton* pushButtonAdd = new QPushButton(outWidget);
 	pushButtonAdd->setObjectName(QString::fromUtf8("button Add"));
-	pushButtonAdd->setText(tr("add sub Matrix"));
-	matrixGridLayout->addWidget(pushButtonAdd, 1, 1, 1, 1);
+	pushButtonAdd->setText(tr("Add sub Matrix"));
+	matrixGridLayout->addWidget(pushButtonAdd, 0, 2, 1, 2);
 	pushButtonAdd->setProperty("type", "default");
 
 	connect(pushButtonAdd, &QPushButton::clicked, this, [=]() {
@@ -156,6 +184,8 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 		dieMatrix.MatrixId = newId;
 		dieMatrix.strModuleName = "WaffleHead";
 		dieMatrix.iModuleId = MODULE_LIST::WaffleHead;
+		dieMatrix.MatrixRow = 0;
+		dieMatrix.MatrixCol = 0;
 		m_vecSubWaffleMatrix.push_back(dieMatrix);
 
 		//找大矩阵ID/Index
@@ -163,14 +193,14 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 		int index = currentIt.value(); //迭代器 erase后currentIt被删除了
 		m_vecWaffleMatrix[index].VecDieMatrixId.push_back(newId);
 
-		AddSubMatrixPage(newIndex, dieMatrix, boxGridLayout);
+		AddSubMatrixPage(vectorIndex,newIndex, dieMatrix, boxGridLayout);
 		});
 
 
 	QPushButton* pushButtonDelete = new QPushButton(outWidget);
 	pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
-	pushButtonDelete->setText(tr("delete Matrix"));
-	matrixGridLayout->addWidget(pushButtonDelete, 1, 2, 1, 1);
+	pushButtonDelete->setText(tr("Delete"));
+	matrixGridLayout->addWidget(pushButtonDelete, 0, 1, 1, 1);
 
 
 
@@ -199,24 +229,26 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 
 	QLabel* labelRow = new QLabel(outWidget);
 	labelRow->setObjectName(QString::fromUtf8("labelRow"));
-	labelRow->setText(tr("Row "));
+	labelRow->setText(tr("Row & Cow"));
 	matrixGridLayout->addWidget(labelRow, 2, 0, 1, 1);
 	vecControls.push_back(labelRow);
 
 	SpinBox* spinBoxRow = new SpinBox(outWidget);
 	spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
+	spinBoxRow->setFixedWidth(100);  // Set fixed width to 100
 	matrixGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
 	vecControls.push_back(spinBoxRow);
 
-	QLabel* labelCol = new QLabel(outWidget);
+	/*QLabel* labelCol = new QLabel(outWidget);
 	labelCol->setObjectName(QString::fromUtf8("labelCol"));
 	labelCol->setText(tr("Cow "));
 	matrixGridLayout->addWidget(labelCol, 3, 0, 1, 1);
-	vecControls.push_back(labelCol);
+	vecControls.push_back(labelCol);*/
 
 	SpinBox* spinBoxCol = new SpinBox(outWidget);
 	spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
-	matrixGridLayout->addWidget(spinBoxCol, 3, 1, 1, 1);
+	spinBoxCol->setFixedWidth(100);  // Set fixed width to 100
+	matrixGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
 	vecControls.push_back(spinBoxCol);
 
 	QLabel* labelLeftTop = new QLabel(outWidget);
@@ -227,14 +259,25 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 
 	DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(outWidget);
 	doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
+	doubleSpinBoxLeftTopX->setFixedWidth(100);  // Set fixed width to 100
 	matrixGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
 	vecControls.push_back(doubleSpinBoxLeftTopX);
 
 	DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(outWidget);
 	doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
+	doubleSpinBoxLeftTopY->setFixedWidth(100);  // Set fixed width to 100
 	matrixGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
 	vecControls.push_back(doubleSpinBoxLeftTopY);
 
+	QPushButton* buttonLeftTop = new QPushButton("Get Pos", this);
+	buttonLeftTop->setFixedWidth(62);  // Set the same width for the button
+	matrixGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1);  // Position the button next to LeftTopPos
+	connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
+		XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[vectorIndex].LeftTopPoint);
+		doubleSpinBoxLeftTopX->setValue(position.x);  // Update X axis
+		doubleSpinBoxLeftTopY->setValue(position.y);  // Update Y axis
+		});
+
 	QLabel* labelRightTopPos = new QLabel(outWidget);
 	labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
 	labelRightTopPos->setText(tr("Right Top Pos "));
@@ -243,14 +286,25 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 
 	DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(outWidget);
 	doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
+	doubleSpinBoxRightTopX->setFixedWidth(100);  // Set fixed width to 100
 	matrixGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
 	vecControls.push_back(doubleSpinBoxRightTopX);
 
 	DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(outWidget);
 	doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
+	doubleSpinBoxRightTopY->setFixedWidth(100);  // Set fixed width to 100
 	matrixGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
 	vecControls.push_back(doubleSpinBoxRightTopY);
 
+	QPushButton* buttonRightTop = new QPushButton("Get Pos", this);
+	buttonRightTop->setFixedWidth(62);  // Set the same width for the button
+	matrixGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1);  // Position the button next to RightTopPos
+	connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
+		XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[vectorIndex].LeftTopPoint);
+		doubleSpinBoxRightTopX->setValue(position.x);  // Update X axis
+		doubleSpinBoxRightTopY->setValue(position.y);  // Update Y axis
+		});
+
 	QLabel* labelRightButtomPos = new QLabel(outWidget);
 	labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
 	labelRightButtomPos->setText(tr("Right Buttom pos"));
@@ -259,14 +313,25 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 
 	DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(outWidget);
 	doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
+	doubleSpinBoxRightButtomX->setFixedWidth(100);  // Set fixed width to 100
 	matrixGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
 	vecControls.push_back(doubleSpinBoxRightButtomX);
 
 	DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(outWidget);
 	doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
+	doubleSpinBoxRightButtomY->setFixedWidth(100);  // Set fixed width to 100
 	matrixGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
 	vecControls.push_back(doubleSpinBoxRightTopX);
 
+	QPushButton* buttonRightButtom = new QPushButton("Get Pos", this);
+	buttonRightButtom->setFixedWidth(62);  // Set the same width for the button
+	matrixGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1);  // Position the button next to RightBottomPos
+	connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
+		XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[vectorIndex].LeftTopPoint);
+		doubleSpinBoxRightButtomX->setValue(position.x);  // Update X axis
+		doubleSpinBoxRightButtomY->setValue(position.y);  // Update Y axis
+		});
+
 	QLabel* labelNoBondPts = new QLabel(outWidget);
 	labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
 	labelNoBondPts->setText(tr("No Bond Points"));
@@ -275,12 +340,13 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 
 	QLineEdit* lineEditNoBondPts = new QLineEdit(outWidget);
 	lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
-	matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 2);
+	matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
 	vecControls.push_back(lineEditNoBondPts);
 
 	lineEditNoBondPts->setReadOnly(true);
 	lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
-	lineEditNoBondPts->setProperty("subVectorIndex", vectorIndex);  // 存储索引
+	lineEditNoBondPts->setProperty("vectorIndex", vectorIndex);  // 存储索引
+	lineEditNoBondPts->setProperty("parentMatrixIndex", -1);  // 存储大矩阵的索引(即父矩阵)
 	lineEditNoBondPts->installEventFilter(this);
 
 	QFrame* line = new QFrame(outWidget);
@@ -307,7 +373,7 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 		{
 			if (matrixData.VecDieMatrixId[j] == m_vecSubWaffleMatrix[i].MatrixId)
 			{
-				AddSubMatrixPage(i, m_vecSubWaffleMatrix[i], boxGridLayout);
+				AddSubMatrixPage(j,i, m_vecSubWaffleMatrix[i], boxGridLayout);
 			}
 		}
 	}
@@ -368,30 +434,31 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
 
 }
 
-void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_STRUCT subMatrix, QGridLayout* layout)
+void WaffleProgramPage::AddSubMatrixPage(int vectorIndex, int subVectorIndex, PROGRAM_DIE_MATRIX_STRUCT subMatrix, QGridLayout* layout)
 {
 	QVector<QObject*> vecControls;
 
 	QWidget* subWidget = new QWidget();
 
 	QGridLayout* subGridLayout = new QGridLayout(subWidget);
-	subGridLayout->setSpacing(6);
+	subGridLayout->setSpacing(4);
 	subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
 	//groupBox->setLayout(subGridLayout);
-
+	subGridLayout->setContentsMargins(0, 0, 0, 0);  // 设置布局的边距为0
+	subGridLayout->setAlignment(Qt::AlignCenter);
 
 	QLabel* labelTitle = new QLabel(subWidget);
 	labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
 	labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex));
 	labelTitle->setStyleSheet("color: #808BFF;height: 30px");
-	subGridLayout->addWidget(labelTitle, 0, 1, 1, 3);
+	subGridLayout->addWidget(labelTitle, 0, 1, 1, 1);
 	vecControls.push_back(labelTitle);
 
 
 	QPushButton* pushButtonDelete = new QPushButton(subWidget);
 	pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
-	pushButtonDelete->setText(tr("delete Matrix"));
-	subGridLayout->addWidget(pushButtonDelete, 1, 2, 1, 1);
+	pushButtonDelete->setText(tr("Delete"));
+	subGridLayout->addWidget(pushButtonDelete, 0, 3, 1, 1);
 
 	connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
 
@@ -432,7 +499,7 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
 
 	QLabel* labelRow = new QLabel(subWidget);
 	labelRow->setObjectName(QString::fromUtf8("labelRow"));
-	labelRow->setText(tr("Row "));
+	labelRow->setText(tr("Row & Cow"));
 	subGridLayout->addWidget(labelRow, 2, 0, 1, 1);
 	vecControls.push_back(labelRow);
 
@@ -441,15 +508,15 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
 	subGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
 	vecControls.push_back(spinBoxRow);
 
-	QLabel* labelCol = new QLabel(subWidget);
+	/*QLabel* labelCol = new QLabel(subWidget);
 	labelCol->setObjectName(QString::fromUtf8("labelCol"));
 	labelCol->setText(tr("Cow "));
 	subGridLayout->addWidget(labelCol, 3, 0, 1, 1);
-	vecControls.push_back(labelCol);
+	vecControls.push_back(labelCol);*/
 
 	SpinBox* spinBoxCol = new SpinBox(subWidget);
 	spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
-	subGridLayout->addWidget(spinBoxCol, 3, 1, 1, 1);
+	subGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
 	vecControls.push_back(spinBoxCol);
 
 	QLabel* labelLeftTop = new QLabel(subWidget);
@@ -460,11 +527,15 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
 
 	DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(subWidget);
 	doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
+	doubleSpinBoxLeftTopX->setFixedWidth(100);  // Set fixed width to 100
+	doubleSpinBoxLeftTopX->setFixedWidth(100);  // Set fixed width to 100
 	subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
 	vecControls.push_back(doubleSpinBoxLeftTopX);
 
 	DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(subWidget);
 	doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
+	doubleSpinBoxLeftTopY->setFixedWidth(100);  // Set fixed width to 100
+	doubleSpinBoxLeftTopY->setFixedWidth(100);  // Set fixed width to 100
 	subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
 	vecControls.push_back(doubleSpinBoxLeftTopY);
 
@@ -476,11 +547,13 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
 
 	DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(subWidget);
 	doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
+	doubleSpinBoxRightTopX->setFixedWidth(100);  // Set fixed width to 100
 	subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
 	vecControls.push_back(doubleSpinBoxRightTopX);
 
 	DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(subWidget);
 	doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
+	doubleSpinBoxRightTopY->setFixedWidth(100);  // Set fixed width to 100
 	subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
 	vecControls.push_back(doubleSpinBoxRightTopY);
 
@@ -492,11 +565,13 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
 
 	DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(subWidget);
 	doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
+	doubleSpinBoxRightButtomX->setFixedWidth(100);  // Set fixed width to 100
 	subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
 	vecControls.push_back(doubleSpinBoxRightButtomX);
 
 	DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(subWidget);
 	doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
+	doubleSpinBoxRightButtomY->setFixedWidth(100);  // Set fixed width to 100
 	subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
 	vecControls.push_back(doubleSpinBoxRightTopX);
 
@@ -510,13 +585,48 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
 	lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
 
 	lineEditNoBondPts->setReadOnly(true);
-	lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
-	lineEditNoBondPts->setProperty("vectorIndex", subVectorIndex);  // 存储索引
+	lineEditNoBondPts->setCursor(Qt::PointingHandCursor); 
+	//lineEditNoBondPts->setProperty("matrixType", "SubMatrix");  // 设置为子矩阵
+	lineEditNoBondPts->setProperty("vectorIndex", subVectorIndex);  // 子矩阵索引
+	lineEditNoBondPts->setProperty("parentMatrixIndex", vectorIndex);  // 设置父矩阵的索引
+
 	lineEditNoBondPts->installEventFilter(this);
 
-	subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 2);
+	subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
 	vecControls.push_back(lineEditNoBondPts);
 
+	// Left Top Position X and Y
+	QPushButton* buttonLeftTop = new QPushButton("Get Pos", subWidget);
+	buttonLeftTop->setFixedWidth(62);  // 设置固定宽度
+	subGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1);  // 添加按钮到4行3列
+
+	connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
+		XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[subVectorIndex].LeftTopPoint);
+		doubleSpinBoxLeftTopX->setValue(position.x);  // 更新 X 轴
+		doubleSpinBoxLeftTopY->setValue(position.y);  // 更新 Y 轴
+		});
+
+	// Right Top Position X and Y
+	QPushButton* buttonRightTop = new QPushButton("Get Pos", subWidget);
+	buttonRightTop->setFixedWidth(62);  // 设置固定宽度
+	subGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1);  // 添加按钮到5行3列
+
+	connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
+		XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[subVectorIndex].RightTopPoint);
+		doubleSpinBoxRightTopX->setValue(position.x);  // 更新 X 轴
+		doubleSpinBoxRightTopY->setValue(position.y);  // 更新 Y 轴
+		});
+
+	// Right Bottom Position X and Y
+	QPushButton* buttonRightButtom = new QPushButton("Get Pos", subWidget);
+	buttonRightButtom->setFixedWidth(62);  // 设置固定宽度
+	subGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1);  // 添加按钮到6行3列
+
+	connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
+		XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[subVectorIndex].RightBottomPoint);
+		doubleSpinBoxRightButtomX->setValue(position.x);  // 更新 X 轴
+		doubleSpinBoxRightButtomY->setValue(position.y);  // 更新 Y 轴
+		});
 
 	//layout->addLayout(subGridLayout, 11, 0);
 
@@ -592,29 +702,59 @@ bool WaffleProgramPage::eventFilter(QObject* obj, QEvent* event) {
 		auto* lineEdit = qobject_cast<QLineEdit*>(obj);
 		if (lineEdit)
 		{
-			int index = lineEdit->property("vectorIndex").toInt();
-			onNoBondPtsClicked(lineEdit, index);
+			int index = lineEdit->property("vectorIndex").toInt();  // 当前矩阵索引
+			int parentIndex = lineEdit->property("parentMatrixIndex").toInt();  // 父矩阵索引
+
+			onNoBondPtsClicked(lineEdit, index, parentIndex);  // 传递父矩阵索引
 			return true; // 拦截事件
 		}
 	}
 	return QWidget::eventFilter(obj, event);
 }
 
-void WaffleProgramPage::onNoBondPtsClicked(QLineEdit* lineEdit, int index) {
-	if (index < 0 || index >= m_vecWaffleMatrix.size()) return;
 
-	const auto& waffle = m_vecWaffleMatrix[index];
-	NoBondPtEditDialog dlg(waffle.PackRow, waffle.PackCol, waffle.VecNoBondDie, this);
+void WaffleProgramPage::onNoBondPtsClicked(QLineEdit* lineEdit, int index, int parentIndex) {
+	if (parentIndex != -1)
+	{
+		// 处理子矩阵的操作
+		if (index < 0 || index >= m_vecSubWaffleMatrix.size()) return;
+
+		const auto& subMatrix = m_vecSubWaffleMatrix[index];
+		NoBondPtEditDialog dlg(subMatrix.MatrixRow, subMatrix.MatrixCol, subMatrix.VecNoBondPt, this);
+
+		if (dlg.exec() == QDialog::Accepted)
+		{
+			QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
+			m_vecSubWaffleMatrix[index].VecNoBondPt = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
 
-	if (dlg.exec() == QDialog::Accepted)
+			QStringList ptList;
+			for (const auto& pt : selected)
+				ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
+			lineEdit->setText(ptList.join(" "));
+		}
+
+		// 这里可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
+	}
+	else
 	{
-		QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
-		m_vecWaffleMatrix[index].VecNoBondDie = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
+		// 处理大矩阵的操作
+		if (index < 0 || index >= m_vecWaffleMatrix.size()) return;
+
+		const auto& waffleMatrix = m_vecWaffleMatrix[index];
+		NoBondPtEditDialog dlg(waffleMatrix.PackRow, waffleMatrix.PackCol, waffleMatrix.VecNoBondDie, this);
+
+		if (dlg.exec() == QDialog::Accepted)
+		{
+			QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
+			m_vecWaffleMatrix[index].VecNoBondDie = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
 
-		QStringList ptList;
-		for (const auto& pt : selected)
-			ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
-		lineEdit->setText(ptList.join(" "));
+			QStringList ptList;
+			for (const auto& pt : selected)
+				ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
+			lineEdit->setText(ptList.join(" "));
+		}
+
+		// 这里也可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
 	}
 }
 
@@ -646,31 +786,16 @@ void WaffleProgramPage::MatrixChangeEvent()
 void WaffleProgramPage::initPage()
 {
 	m_vecWaffleMatrix = m_pProduct->GetWaffleMatrix();
+	m_pProduct->GetAllDieMatrix(m_vecSubWaffleMatrix);
 	for (int i = 0; i < m_vecWaffleMatrix.size(); i++)
 	{
-		for (int j = 0; j < m_vecWaffleMatrix[i].VecDieMatrixId.size(); j++)
-		{
-			PROGRAM_DIE_MATRIX_STRUCT subMatrix;
-			m_pProduct->GetDieMatrix(m_vecWaffleMatrix[i].VecDieMatrixId[j], subMatrix);
-			m_vecSubWaffleMatrix.push_back(subMatrix);
-			//AddMatrixPage(i, j, subMatrix);
-		}
-		AddMatrixPage(i, m_vecWaffleMatrix[i], m_vecSubWaffleMatrix);
-
 		//for (int j = 0; j < m_vecWaffleMatrix[i].VecDieMatrixId.size(); j++)
 		//{
-		//	for (int k = 0; k < m_vecSubWaffleMatrix.size(); k++)
-		//	{
-		//		if (m_vecWaffleMatrix[i].VecDieMatrixId[j] == m_vecSubWaffleMatrix[k].MatrixId)
-		//		{
-		//			AddSubMatrixPage(i, m_vecSubWaffleMatrix[k],nullptr);
-		//		}
-		//	}
+		//	PROGRAM_DIE_MATRIX_STRUCT subMatrix;
+		//	m_pProduct->GetDieMatrix(m_vecWaffleMatrix[i].VecDieMatrixId[j], subMatrix);
+		//	m_vecSubWaffleMatrix.push_back(subMatrix);
+		//	//AddMatrixPage(i, j, subMatrix);
 		//}
+		AddMatrixPage(i, m_vecWaffleMatrix[i], m_vecSubWaffleMatrix);
 	}
-
-
-
-
-
 }

+ 8 - 3
View/die-bonder-ui/Src/WaffleProgramPage.h

@@ -5,6 +5,9 @@
 #include "CViewInterface.h"
 #include <QMap>
 
+#include <QMessageBox>
+#include "CModule.h"
+
 class WaffleProgramPage : public QWidget
 {
 	Q_OBJECT
@@ -19,7 +22,7 @@ private:
 
 	//void AddOutMatrixPage(int vectorIndex, PROGRAM_BOND_MATRIX_STRUCT matrixData);
 
-	void AddSubMatrixPage(int subVectorIndex,PROGRAM_DIE_MATRIX_STRUCT subMatrix, QGridLayout* layout);
+	void AddSubMatrixPage(int vectorIndex, int subVectorIndex,PROGRAM_DIE_MATRIX_STRUCT subMatrix, QGridLayout* layout);
 
 	//Íùºó¶ËÐÂÔö¾ØÕóÊý¾Ý
 	void AddMatrixParam();
@@ -33,6 +36,8 @@ private:
 	void MatrixChangeEvent();
 
 
+	XY_DOUBLE_STRUCT WaffleGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos);
+
 	void initPage();
 
 protected:
@@ -40,7 +45,7 @@ protected:
 
 
 private slots:
-	void onNoBondPtsClicked(QLineEdit* lineEdit, int waffleIndex);
+	void onNoBondPtsClicked(QLineEdit* lineEdit, int index, int parentIndex);
 
 private:
 	Ui::WaffleProgramPageClass ui;
@@ -64,5 +69,5 @@ private:
 
 	QMap<QWidget*, int> m_mapOutWidgetIndex;
 
-
+	ns_module::CViewInterface* m_pProgramCViewInterface = nullptr;
 };

+ 23 - 4
View/die-bonder-ui/Src/WaffleProgramPage.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1079</width>
-    <height>864</height>
+    <width>777</width>
+    <height>882</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -36,8 +36,8 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>1077</width>
-        <height>862</height>
+        <width>775</width>
+        <height>880</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_3">
@@ -71,6 +71,25 @@
            </property>
           </spacer>
          </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonAddOutMatrix">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>150</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>Add OutMatrix</string>
+           </property>
+          </widget>
+         </item>
          <item>
           <widget class="QPushButton" name="pushButtonSave">
            <property name="sizePolicy">

+ 0 - 1
View/die-bonder-ui/main.cpp

@@ -17,7 +17,6 @@ int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
 
-
     QSharedMemory sharedMem("SBTBonder");
     if (sharedMem.attach()) 
     {

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff