chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
This commit is contained in:
1 parent
2b0c2055ff
commit
164968b62e
6171 files changed
+191244
-191243
No files matched your search
@@ -1,4 +1,4 @@
|
||||
#include "StdAfx.h"
|
||||
#include "StdAfx.h"
|
||||
#include "initools.h"
|
||||
#include "EquipManaOperator.h"
|
||||
#include "UserDataDlg.h"
|
||||
@@ -79,7 +79,7 @@ void CEquipManaOperator::SetEquipTree(CTreeCtrl* pTree)
|
||||
m_pEquipTree = pTree;
|
||||
}
|
||||
|
||||
//目录分类操作
|
||||
//目录分类操作
|
||||
void CEquipManaOperator::NewFolder(CMapStringToString& mapItem2Folder)
|
||||
{
|
||||
CStringList lstFolders;
|
||||
@@ -91,11 +91,11 @@ void CEquipManaOperator::NewFolder(CMapStringToString& mapItem2Folder)
|
||||
while(TRUE)
|
||||
{
|
||||
CString sName(_T(""));
|
||||
if (CoreTools::getNameByDialog(_T("请输入名称"), _T("名称:"), sName))
|
||||
if (CoreTools::getNameByDialog(_T("请输入名称"), _T("名称:"), sName))
|
||||
{
|
||||
if (lstFolders.Find(sName) != NULL)
|
||||
{
|
||||
AfxMessageBox(_T("输入的目录名已经存在!请重新输入!"));
|
||||
AfxMessageBox(_T("输入的目录名已经存在!请重新输入!"));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void CEquipManaOperator::NewFolder(CMapStringToString& mapItem2Folder)
|
||||
sSQL.Format(_T("insert into %s (folder) values ('%s')"), getTableName(m_sPrefix, eFolder), sName);
|
||||
m_pDb->ExecuteSQL(sSQL);
|
||||
|
||||
//插入
|
||||
//插入
|
||||
HTREEITEM hItem = m_pEquipTree->InsertItem(sName,IMG_FOLDER,IMG_FOLDER);
|
||||
|
||||
//sSQL.Format(_T("select id from aec_folder where folder='%s'"),nameDlg.m_sName);
|
||||
@@ -140,11 +140,11 @@ void CEquipManaOperator::OnNewclass(HTREEITEM hItem,CMapStringToString& mapItem2
|
||||
while(TRUE)
|
||||
{
|
||||
CString sName(_T(""));
|
||||
if (CoreTools::getNameByDialog(_T("请输入名称"), _T("名称:"), sName))
|
||||
if (CoreTools::getNameByDialog(_T("请输入名称"), _T("名称:"), sName))
|
||||
{
|
||||
if (lstClass.Find(sName) != NULL)
|
||||
{
|
||||
AfxMessageBox(_T("输入的分类名已经存在!请重新输入!"));
|
||||
AfxMessageBox(_T("输入的分类名已经存在!请重新输入!"));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void CEquipManaOperator::OnRename(HTREEITEM hItem,CString& sID)
|
||||
CString sName = m_pEquipTree->GetItemText(hItem);
|
||||
CString sSQL;
|
||||
|
||||
if (CoreTools::getNameByDialog(_T("请输入名称"), _T("名称:"), sName))
|
||||
if (CoreTools::getNameByDialog(_T("请输入名称"), _T("名称:"), sName))
|
||||
{
|
||||
if (nImage == IMG_FOLDER )
|
||||
{
|
||||
@@ -191,7 +191,7 @@ void CEquipManaOperator::OnRename(HTREEITEM hItem,CString& sID)
|
||||
|
||||
if (lstFolders.Find(sName) != NULL)
|
||||
{
|
||||
AfxMessageBox(_T("目录名已经存在,不能重名!"));
|
||||
AfxMessageBox(_T("目录名已经存在,不能重名!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ void CEquipManaOperator::OnRename(HTREEITEM hItem,CString& sID)
|
||||
|
||||
if (lstClass.Find(sName) != NULL)
|
||||
{
|
||||
AfxMessageBox(_T("分类名已经存在,不能重名!"));
|
||||
AfxMessageBox(_T("分类名已经存在,不能重名!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -234,19 +234,19 @@ void CEquipManaOperator::OnDelete(HTREEITEM hItem,CString& sID)
|
||||
CString sText,sSQL;
|
||||
if (nImage == IMG_FOLDER )
|
||||
{
|
||||
//判断目录下没有分类
|
||||
//判断目录下没有分类
|
||||
sText = m_pEquipTree->GetItemText(hItem);
|
||||
|
||||
//sSQL.Format(_T("select id from aec_class where idfolder='%s'"),sID);
|
||||
sSQL.Format(_T("select id from %s where idfolder='%s'"), getTableName(m_sPrefix, eClass),sID);
|
||||
if ( !m_pDb->IsSelEmpty(sSQL) )
|
||||
{
|
||||
AfxMessageBox(_T("选择的目录下含有分类名,不能删除!请先删除其下分类再删除目录!"));
|
||||
AfxMessageBox(_T("选择的目录下含有分类名,不能删除!请先删除其下分类再删除目录!"));
|
||||
return;
|
||||
}
|
||||
|
||||
CString sTip;
|
||||
sTip.Format(_T("删除为永久性删除!确实要删除目录 [%s]吗?"),sText);
|
||||
sTip.Format(_T("删除为永久性删除!确实要删除目录 [%s]吗?"),sText);
|
||||
|
||||
if ( IDYES == AfxMessageBox(sTip,MB_YESNO) )
|
||||
{
|
||||
@@ -259,19 +259,19 @@ void CEquipManaOperator::OnDelete(HTREEITEM hItem,CString& sID)
|
||||
|
||||
if ( nImage == IMG_CLASS)
|
||||
{
|
||||
//判断分类下没有设备元件
|
||||
//判断分类下没有设备元件
|
||||
sText = m_pEquipTree->GetItemText(hItem);
|
||||
|
||||
//sSQL.Format(_T("select id from aec_package where idclass='%s'"),sID);
|
||||
sSQL.Format(_T("select id from %s where idclass='%s'"), getTableName(m_sPrefix, ePackage),sID);
|
||||
if ( !m_pDb->IsSelEmpty(sSQL) )
|
||||
{
|
||||
AfxMessageBox(_T("选择的分类下含有设备元件,不能删除!请先删除其下设备元件再删除分类!"));
|
||||
AfxMessageBox(_T("选择的分类下含有设备元件,不能删除!请先删除其下设备元件再删除分类!"));
|
||||
return;
|
||||
}
|
||||
|
||||
CString sTip;
|
||||
sTip.Format(_T("删除为永久性删除!确实要删除分类 [%s]吗?"),sText);
|
||||
sTip.Format(_T("删除为永久性删除!确实要删除分类 [%s]吗?"),sText);
|
||||
|
||||
if ( IDYES == AfxMessageBox(sTip,MB_YESNO) )
|
||||
{
|
||||
@@ -283,30 +283,30 @@ void CEquipManaOperator::OnDelete(HTREEITEM hItem,CString& sID)
|
||||
}
|
||||
}
|
||||
|
||||
//设备元件操作
|
||||
//设备元件操作
|
||||
void CEquipManaOperator::OnAddequ(HTREEITEM hItem)
|
||||
{
|
||||
//目录,分类
|
||||
//目录,分类
|
||||
CString sFolder,sCLass;
|
||||
sCLass = m_pEquipTree->GetItemText(hItem);
|
||||
|
||||
HTREEITEM hFolder = m_pEquipTree->GetParentItem(hItem);
|
||||
sFolder = m_pEquipTree->GetItemText(hFolder);
|
||||
|
||||
//选择equ文件
|
||||
//选择equ文件
|
||||
CString sEquFile;
|
||||
CFileDialog dlg( TRUE, NULL,NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT,
|
||||
_T("通用设备元件设计文件(*.equ)|*.equ|All Files (*.*)|*.*||"));
|
||||
_T("通用设备元件设计文件(*.equ)|*.equ|All Files (*.*)|*.*||"));
|
||||
|
||||
int nRes = dlg.DoModal();
|
||||
if (nRes != IDOK) return;
|
||||
|
||||
int inputType = AfxMessageBox(_T("是否通过配置文件来进行BIM数据导入?"), MB_YESNO);
|
||||
int inputType = AfxMessageBox(_T("是否通过配置文件来进行BIM数据导入?"), MB_YESNO);
|
||||
|
||||
CString bimFile(_T(""));
|
||||
if (inputType == IDYES)
|
||||
{
|
||||
CFileDialog dg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("bim配置文件(*.ini)|*.ini||"));
|
||||
CFileDialog dg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("bim配置文件(*.ini)|*.ini||"));
|
||||
if (dg.DoModal() == IDOK)
|
||||
bimFile = dg.GetPathName();
|
||||
else
|
||||
@@ -319,7 +319,7 @@ void CEquipManaOperator::OnAddequ(HTREEITEM hItem)
|
||||
{
|
||||
sEquFile = dlg.GetNextPathName(pos);
|
||||
iAll++;
|
||||
//提取名称
|
||||
//提取名称
|
||||
AecDbEwEquipment* pEqu = new AecDbEwEquipment;
|
||||
if (pEqu->ReadFromFile(sEquFile))
|
||||
{
|
||||
@@ -329,11 +329,11 @@ void CEquipManaOperator::OnAddequ(HTREEITEM hItem)
|
||||
|
||||
SH_BIM_BLOCK bims;
|
||||
|
||||
if (inputType == IDYES) // 读配置文件
|
||||
if (inputType == IDYES) // 读配置文件
|
||||
{
|
||||
IniTools::getSectionContent(bimFile, sEquFile, bims);
|
||||
}
|
||||
else // 读equ文件内的xdata数据
|
||||
else // 读equ文件内的xdata数据
|
||||
{
|
||||
AecDbObjXDataMap *pXData = pEqu->GetSpecialtyData(AcDb::kForRead);
|
||||
if (pXData)
|
||||
@@ -342,7 +342,7 @@ void CEquipManaOperator::OnAddequ(HTREEITEM hItem)
|
||||
}
|
||||
}
|
||||
|
||||
// 文件内的bim数据,插入时再删除
|
||||
// 文件内的bim数据,插入时再删除
|
||||
|
||||
if (PutPackageToDb(sFolder
|
||||
, sCLass
|
||||
@@ -356,23 +356,23 @@ void CEquipManaOperator::OnAddequ(HTREEITEM hItem)
|
||||
|
||||
}
|
||||
else
|
||||
AfxMessageBox(sEquFile + _T("入库失败。"));
|
||||
AfxMessageBox(sEquFile + _T("入库失败。"));
|
||||
|
||||
DELETE_PTR(pEqu);
|
||||
}
|
||||
else
|
||||
AfxMessageBox(sEquFile + _T("入库失败。"));
|
||||
AfxMessageBox(sEquFile + _T("入库失败。"));
|
||||
}
|
||||
|
||||
CString s(_T(""));
|
||||
s.Format(_T("共选择%d个文件,成功入库%d个。"), iAll, iSuc);
|
||||
s.Format(_T("共选择%d个文件,成功入库%d个。"), iAll, iSuc);
|
||||
AfxMessageBox(s);
|
||||
}
|
||||
|
||||
void CEquipManaOperator::OnDelequ(LPCTSTR pszID,LPCTSTR pszName)
|
||||
{
|
||||
CString sTip;
|
||||
sTip.Format(_T("删除为永久性删除!确实要删除设备元件 [%s]吗?"),pszName);
|
||||
sTip.Format(_T("删除为永久性删除!确实要删除设备元件 [%s]吗?"),pszName);
|
||||
if (IDYES != AfxMessageBox(sTip, MB_YESNO)) return;
|
||||
|
||||
int equid(_ttoi(pszID));
|
||||
@@ -389,11 +389,11 @@ void CEquipManaOperator::OnProperty(AecDbEwEquipment* pEquSel)
|
||||
{
|
||||
AecDbObjXDataMap* pXDataMap = pEquSel->GetSpecialtyData();
|
||||
|
||||
//用户数据USER0~999
|
||||
//用户数据USER0~999
|
||||
SH_BIM_BLOCK bims;
|
||||
CoreTools::getBimDatas(*pXDataMap, bims);
|
||||
|
||||
//仅仅只读?
|
||||
//仅仅只读?
|
||||
CUserDataDlg userDlg(1);
|
||||
userDlg.SetUserData(bims);
|
||||
//userDlg.SetReadOnly(TRUE);
|
||||
@@ -409,7 +409,7 @@ void CEquipManaOperator::OnProperty(AecDbEwEquipment* pEquSel)
|
||||
sTmplFile += _T("\\eq_.tmp");
|
||||
if (!SaveEquFile(pEquSel,(LPCTSTR)sTmplFile) )
|
||||
{
|
||||
AfxMessageBox(_T("意外保存中间临时文件失败!请重新执行命令!"));
|
||||
AfxMessageBox(_T("意外保存中间临时文件失败!请重新执行命令!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ void CEquipManaOperator::OnProperty(AecDbEwEquipment* pEquSel)
|
||||
sSQL.Format(_T("update %s set package=? where id=%d"), getTableName(m_sPrefix, ePackage),_ttoi(sID));
|
||||
if (m_pDb->UpdateBlob(sSQL, sTmplFile))
|
||||
{
|
||||
AfxMessageBox(_T("更新数据库成功!请选择设备元件查看属性验证!"));
|
||||
AfxMessageBox(_T("更新数据库成功!请选择设备元件查看属性验证!"));
|
||||
}
|
||||
|
||||
// CUIIPackageDbOper packageDb;
|
||||
@@ -432,7 +432,7 @@ void CEquipManaOperator::OnProperty(AecDbEwEquipment* pEquSel)
|
||||
// sPackageField = _T("Package");
|
||||
// if ( packageDb.UpdatePackage(sSQL,sPackageField,sTmpFile) )
|
||||
// {
|
||||
// AfxMessageBox(_T("更新数据库成功!请选择设备元件查看属性验证!"));
|
||||
// AfxMessageBox(_T("更新数据库成功!请选择设备元件查看属性验证!"));
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -449,22 +449,22 @@ void CEquipManaOperator::OnCloneEqu(LPCTSTR pszID, LPCTSTR pszName)
|
||||
, pszID);
|
||||
if (!m_pDb->ExecuteSQL(sSQL)) return;
|
||||
|
||||
// 得到clone出的设备的ID
|
||||
// 得到clone出的设备的ID
|
||||
CString s;
|
||||
sSQL.Format(_T("SELECT id FROM %s ORDER BY id DESC LIMIT 1"), sTable);
|
||||
if (!m_pDb->GetSelData(sSQL, s)) return;
|
||||
|
||||
// 为新设备改名
|
||||
// 为新设备改名
|
||||
sSQL.Format(_T("UPDATE %s SET [name]='%s' WHERE [id]='%s'"), sTable, pszName, s);
|
||||
if (!m_pDb->ExecuteSQL(sSQL)) return;
|
||||
|
||||
// clone aec_bims表内数据
|
||||
// clone aec_bims表内数据
|
||||
sTable = getTableName(m_sPrefix, eBims);
|
||||
sSQL.Format(_T("INSERT INTO %s ([name],[value],[readonly]) SELECT [name],[value],[readonly] FROM %s WHERE [equid]='%s'")
|
||||
, sTable, sTable, pszID);
|
||||
if (!m_pDb->ExecuteSQL(sSQL)) return;
|
||||
|
||||
// 将新bim数据的equid指向新设备的ID
|
||||
// 将新bim数据的equid指向新设备的ID
|
||||
sSQL.Format(_T("UPDATE %s SET [equid]='%s' WHERE [equid]='-1'"), sTable, s);
|
||||
if (!m_pDb->ExecuteSQL(sSQL)) return;
|
||||
}
|
||||
@@ -512,13 +512,13 @@ BOOL CEquipManaOperator::SaveEquFile(AecDbEwEquipment* pWEqu,LPCTSTR pszFile)
|
||||
{
|
||||
AecDbObjXDataMap* pXDataMap = pWEqu->GetSpecialtyData();
|
||||
|
||||
//0.写入文件标识
|
||||
//0.写入文件标识
|
||||
std::string str1,str2;
|
||||
str1.append(EQU_COMPANY);
|
||||
str2 = Base64::Encode(str1);
|
||||
file.Write(str2.c_str(),sizeof(char)* ( str2.length() ) );
|
||||
|
||||
//1.写入名称
|
||||
//1.写入名称
|
||||
char szName[MAX_PATH];
|
||||
memset(szName,0,sizeof(szName));
|
||||
|
||||
@@ -529,15 +529,15 @@ BOOL CEquipManaOperator::SaveEquFile(AecDbEwEquipment* pWEqu,LPCTSTR pszFile)
|
||||
strcpy(szName,(const char*)bst);
|
||||
file.Write(szName,MAX_PATH);
|
||||
|
||||
//2.版本
|
||||
//2.版本
|
||||
int nVer = 1;
|
||||
file.Write(&nVer,sizeof(int));
|
||||
|
||||
//4.写入定义数据
|
||||
//4.写入定义数据
|
||||
AcGeMatrix3d xform;
|
||||
int nCount = pWEqu->GetSubPrimObjCount();
|
||||
|
||||
//4.写入数量
|
||||
//4.写入数量
|
||||
file.Write(&nCount,sizeof(int));
|
||||
|
||||
int nLen = 0;
|
||||
@@ -546,7 +546,7 @@ BOOL CEquipManaOperator::SaveEquFile(AecDbEwEquipment* pWEqu,LPCTSTR pszFile)
|
||||
AecEqui::XPrimData* pData = pWEqu->GetSubPrimObj(i);
|
||||
if (pData != NULL)
|
||||
{
|
||||
//通用数据
|
||||
//通用数据
|
||||
file.Write(&pData->m_eType,sizeof(short));
|
||||
file.Write(&pData->m_nActiveInf,sizeof(short));
|
||||
file.Write(&pData->m_nID,sizeof(long));
|
||||
@@ -559,7 +559,7 @@ BOOL CEquipManaOperator::SaveEquFile(AecDbEwEquipment* pWEqu,LPCTSTR pszFile)
|
||||
file.Write(&pData->m_ptRotation.y,sizeof(double));
|
||||
file.Write(&pData->m_ptRotation.z,sizeof(double));
|
||||
|
||||
//矩阵
|
||||
//矩阵
|
||||
nLen = pData->m_arMatrix.length();
|
||||
file.Write(&nLen,sizeof(int));
|
||||
|
||||
@@ -586,8 +586,8 @@ BOOL CEquipManaOperator::SaveEquFile(AecDbEwEquipment* pWEqu,LPCTSTR pszFile)
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
|
||||
//5.写入用户数据
|
||||
pXDataMap->Write(&file,TRUE); //写出用户数据USER0~999
|
||||
//5.写入用户数据
|
||||
pXDataMap->Write(&file,TRUE); //写出用户数据USER0~999
|
||||
}
|
||||
file.Close();
|
||||
}
|
||||
@@ -652,9 +652,9 @@ BOOL CEquipManaOperator::PutPackageToDb(const CString& sFolder
|
||||
, SH_BIM_BLOCK *pBims)
|
||||
{
|
||||
CString sSQL;
|
||||
//检查 Folder 是否数据库中有
|
||||
//检查 Folder 是否数据库中有
|
||||
sSQL.Format(_T("SELECT [id] FROM %s WHERE [folder]='%s'"), getTableName(m_sPrefix, eFolder),sFolder);
|
||||
if ( m_pDb->IsSelEmpty(sSQL) ) //数据库中没有
|
||||
if ( m_pDb->IsSelEmpty(sSQL) ) //数据库中没有
|
||||
{
|
||||
sSQL.Format(_T("INSERT INTO %s ([folder]) VALUES ('%s')"), getTableName(m_sPrefix, eFolder),sFolder);
|
||||
m_pDb->ExecuteSQL(sSQL);
|
||||
@@ -664,7 +664,7 @@ BOOL CEquipManaOperator::PutPackageToDb(const CString& sFolder
|
||||
sSQL.Format(_T("SELECT [id] FROM %s WHERE [folder]='%s'"), getTableName(m_sPrefix, eFolder),sFolder);
|
||||
m_pDb->GetSelData(sSQL,sID);
|
||||
|
||||
//检查 Class
|
||||
//检查 Class
|
||||
sSQL.Format(_T("SELECT [class] FROM %s WHERE [idfolder]='%s' AND [class]='%s'"), getTableName(m_sPrefix, eClass),sID,sClass);
|
||||
if (m_pDb->IsSelEmpty(sSQL))
|
||||
{
|
||||
@@ -676,7 +676,7 @@ BOOL CEquipManaOperator::PutPackageToDb(const CString& sFolder
|
||||
CString sClassID;
|
||||
m_pDb->GetSelData(sSQL,sClassID);
|
||||
|
||||
// 在入库前,检查一下有没有同样的设备存在,如果有,则删除
|
||||
// 在入库前,检查一下有没有同样的设备存在,如果有,则删除
|
||||
if (m_sPrefix.CompareNoCase(_T("aec_")) == 0)
|
||||
sSQL.Format(_T("SELECT aec_package.[id]")
|
||||
_T(" FROM aec_package")
|
||||
@@ -703,7 +703,7 @@ BOOL CEquipManaOperator::PutPackageToDb(const CString& sFolder
|
||||
}
|
||||
}
|
||||
|
||||
//压包入库
|
||||
//压包入库
|
||||
sSQL.Format(_T("INSERT INTO %s ([name], [rem], [idclass], [package]) VALUES ('%s', '%s', '%s', ?)")
|
||||
, getTableName(m_sPrefix, ePackage)
|
||||
, sName
|
||||
@@ -713,7 +713,7 @@ BOOL CEquipManaOperator::PutPackageToDb(const CString& sFolder
|
||||
BOOL bSuccess = m_pDb->InsertBlob(sSQL, sEquTmplFile);
|
||||
if (!bSuccess)
|
||||
{
|
||||
AfxMessageBox(_T("设备元件入库失败!"));
|
||||
AfxMessageBox(_T("设备元件入库失败!"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -722,7 +722,7 @@ BOOL CEquipManaOperator::PutPackageToDb(const CString& sFolder
|
||||
m_pDb->GetSelData(sSQL, equid);
|
||||
if (pIDPackage) *pIDPackage = equid;
|
||||
|
||||
// 设备
|
||||
// 设备
|
||||
if (m_sPrefix.CompareNoCase(_T("Aec_")) == 0 && pBims && !pBims->empty())
|
||||
{
|
||||
std::vector<std::pair<CString, CString>>::const_iterator it(pBims->begin());
|
||||
|
||||
Reference in new issue
Block a user