Kaynağa Gözat

#IQRV #comment [Module] GUIConsole SafeDelete问题处理

gifur 5 yıl önce
ebeveyn
işleme
2678204110
1 değiştirilmiş dosya ile 16 ekleme ve 11 silme
  1. 16 11
      Module/mod_guiconsole/mod_guiconsole.cpp

+ 16 - 11
Module/mod_guiconsole/mod_guiconsole.cpp

@@ -393,19 +393,18 @@ ErrorCodeEnum CGUIConsoleEntity::ResetMaterialCounter(const char *pszMaterial, u
 		else
 		{
 			Dbg("连接CardIssuer失败");
+            pClient->SafeDelete();
 		}
-
-		pClient->SafeDelete();
-	}
+    }
 	else
 	{
-		rc = Error_Unexpect;
-		Dbg("未知物料: {%s}", (const char*)strMaterialCode);
+		rc = Error_NoTarget;
+		Dbg("Unknow material code: {%s}", (const char*)strMaterialCode);
 	}
 
 	if (rc != Error_Succeed)
 	{
-		LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("重置终端计数失败: %s", SpStrError(rc)));
+		LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("Reset teminal material counter failed: %s", SpStrError(rc)));
 		return rc;
 	}
 
@@ -414,24 +413,27 @@ ErrorCodeEnum CGUIConsoleEntity::ResetMaterialCounter(const char *pszMaterial, u
 	if (pCnn->ConnectFromCentralSetting() && pCnn->IsConnectionOK())
 	{
 		CSystemStaticInfo sysInfo;
-		auto rc = GetFunction()->GetSystemStaticInfo(sysInfo);
+		rc = GetFunction()->GetSystemStaticInfo(sysInfo);
 		assert(rc == Error_Succeed);
 
 		rc = pCnn->ResetMaterialCounter(strMaterialCode, sysInfo.strTerminalID, GetCurMaintainer(),
 			dwResetCapacity, dwUsedCounter, dwRemainCounter, pszComment);
 		pCnn->Close();
 	}
+	else {
+		rc = Error_NetBroken;
+	}
 
 	pCnn->DecRefCount();
 	pCnn = NULL;
 
 	if (rc == Error_Succeed)
 	{
-		Dbg("重置物料{%s}计数成功", (const char*)strMaterialCode);
+		Dbg("Reset teminal material counter succ: %s", (const char*)strMaterialCode);
 	}
 	else
 	{
-		LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("重置后端计数失败(0x%X)", rc));
+		LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("Reset teminal material counter from server failed:%s", SpStrError(rc)));
 	}
 
 	return rc;
@@ -458,6 +460,9 @@ ErrorCodeEnum CGUIConsoleEntity::RegistSwallowedCard(const char *pszCardNo, cons
 		rc = pCnn->RegistSwallowedCard(sysInfo.strMachineType, sysInfo.strTerminalID, pszCardNo, pszReasonCode, pszDate, pszTime, pszDeviceSciNo);
 		pCnn->Close();
 	}
+    else {
+        rc = Error_NetBroken;
+    }
 
 	pCnn->DecRefCount();
 	pCnn = NULL;
@@ -481,9 +486,9 @@ ErrorCodeEnum CGUIConsoleEntity::RegistSwallowedCard(const char *pszCardNo, cons
 
 
 	if (rc == Error_Succeed)
-		Dbg("吞卡登记成功,cardno: %s, reason: %s", tempCardNo, pszReasonCode);
+		Dbg("Register swallow card succ,cardno: %s, reason: %s", tempCardNo, pszReasonCode);
 	else
-		Dbg("吞卡登记失败(%s),cardno: %s, reason: %s", SpStrError(rc), tempCardNo, pszReasonCode);
+		Dbg("Register swallow card failed(%s),cardno: %s, reason: %s", SpStrError(rc), tempCardNo, pszReasonCode);
 	
 	return rc;
 }