数据导入支持汉字名字
This commit is contained in:
parent
d0c4bbc89f
commit
3818e80601
|
|
@ -23,6 +23,7 @@
|
||||||
#include "LogIO.h"
|
#include "LogIO.h"
|
||||||
|
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
|
#pragma execution_character_set("utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1675,7 +1675,7 @@ QString CDataImport::ConvertorWellLogFiles(ConvertorManager &pManager,QString we
|
||||||
//v->Transfer(logfilename,outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow);
|
//v->Transfer(logfilename,outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow);
|
||||||
//whp change 2019.12.10 for写入井名
|
//whp change 2019.12.10 for写入井名
|
||||||
// QString strCh(logfilename); // 汉字路径转换
|
// QString strCh(logfilename); // 汉字路径转换
|
||||||
if(v->Transfer(/*strCh.toLocal8Bit().data()*/UTF8ToGBK(logfilename).data(),outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow))
|
if(v->Transfer(/*strCh.toLocal8Bit().data()*//*UTF8ToGBK(logfilename).data()*/logfilename,outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow))
|
||||||
{
|
{
|
||||||
CLogIO * logio=new CLogIO();
|
CLogIO * logio=new CLogIO();
|
||||||
logio->Open(outfile/*UTF8ToGBK(outfile).data()*/,CSlfIO::modeReadWrite);
|
logio->Open(outfile/*UTF8ToGBK(outfile).data()*/,CSlfIO::modeReadWrite);
|
||||||
|
|
|
||||||
|
|
@ -767,7 +767,7 @@ bool ImportDataDialog::SelectAndDeleteWellLog(int iRow,InterfaceWidget *pCurren
|
||||||
|
|
||||||
// QString strCh(logfilename); // 汉字路径转换
|
// QString strCh(logfilename); // 汉字路径转换
|
||||||
// // QString strChOut(outfile); // 汉字路径转换
|
// // QString strChOut(outfile); // 汉字路径转换
|
||||||
if(((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->Transfer(/*strCh.toLocal8Bit().data()*/UTF8ToGBK(logfilename).data(),outfile/*strChOut.toLocal8Bit().data()*/,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow))
|
if(((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->Transfer(/*strCh.toLocal8Bit().data()*//*UTF8ToGBK(logfilename).data()*/logfilename,outfile/*strChOut.toLocal8Bit().data()*/,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow))
|
||||||
{
|
{
|
||||||
MyWelllogRound *wellRound=pCurrentInterfaceWidget->m_pConvertor->GetWellLogRoundInfo();
|
MyWelllogRound *wellRound=pCurrentInterfaceWidget->m_pConvertor->GetWellLogRoundInfo();
|
||||||
if(wellRound) {
|
if(wellRound) {
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ bool InterIConvertor::IsSupport( const QString &filename )
|
||||||
string tempStr=filename.toStdString();
|
string tempStr=filename.toStdString();
|
||||||
char *filePath=const_cast<char*>(tempStr.c_str());
|
char *filePath=const_cast<char*>(tempStr.c_str());
|
||||||
// QString strCh(filePath); // 汉字路径转换
|
// QString strCh(filePath); // 汉字路径转换
|
||||||
int Value= ScanLogFile(UTF8ToGBK(filePath).data()/*strCh.toLocal8Bit().data()*/,m_fileMessage,&m_vCurverName[0],&m_vCurverUnit[0]);
|
int Value= ScanLogFile(filePath/*UTF8ToGBK(filePath).data()*//*strCh.toLocal8Bit().data()*/,m_fileMessage,&m_vCurverName[0],&m_vCurverUnit[0]);
|
||||||
m_CurveData.Curve_Num=Value;
|
m_CurveData.Curve_Num=Value;
|
||||||
if(Value<=0) return 0;//ww
|
if(Value<=0) return 0;//ww
|
||||||
return Value;
|
return Value;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "CStringType.h"
|
#include "CStringType.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#pragma execution_character_set("utf-8")
|
||||||
char *m_temp=NULL;
|
char *m_temp=NULL;
|
||||||
CString::CString(const char *str)
|
CString::CString(const char *str)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ void CloseView(HANDLE hMapObject,LPVOID lpvMem)
|
||||||
if(lpvMem)UnmapViewOfFile(lpvMem);
|
if(lpvMem)UnmapViewOfFile(lpvMem);
|
||||||
if(hMapObject)CloseHandle(hMapObject);
|
if(hMapObject)CloseHandle(hMapObject);
|
||||||
#else
|
#else
|
||||||
if(lpvMem)munmap(lpvMem,0);
|
if(lpvMem)munmap(lpvMem,4096*512);
|
||||||
if(hMapObject)close(hMapObject);
|
if(hMapObject)close(hMapObject);
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "ParameterItem.h"
|
#include "ParameterItem.h"
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#pragma execution_character_set("utf-8")
|
||||||
#define UINT unsigned int
|
#define UINT unsigned int
|
||||||
struct DllMessage{
|
struct DllMessage{
|
||||||
char strDLL[500];
|
char strDLL[500];
|
||||||
|
|
@ -35,7 +36,6 @@ public:
|
||||||
virtual bool validate(CModuleCheckResult& moduleCheckResult);
|
virtual bool validate(CModuleCheckResult& moduleCheckResult);
|
||||||
virtual bool validate();
|
virtual bool validate();
|
||||||
virtual CModule* Clone();
|
virtual CModule* Clone();
|
||||||
bool ToUnicode(char* szStr);
|
|
||||||
static QStringList GetNames(std::string names,char split=',',bool removeblank=true);
|
static QStringList GetNames(std::string names,char split=',',bool removeblank=true);
|
||||||
QString strDLLFun;
|
QString strDLLFun;
|
||||||
QString paramCardNameInSlf;
|
QString paramCardNameInSlf;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "CStringType.h"
|
#include "CStringType.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#pragma execution_character_set("utf-8")
|
||||||
char *m_temp=NULL;
|
char *m_temp=NULL;
|
||||||
CString::CString(const char *str)
|
CString::CString(const char *str)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -65,14 +65,6 @@ PELibraryModule::~PELibraryModule(void)
|
||||||
}
|
}
|
||||||
Methodlib.unload();
|
Methodlib.unload();
|
||||||
}
|
}
|
||||||
bool PELibraryModule::ToUnicode(char* szStr)
|
|
||||||
{
|
|
||||||
QString qstr;;
|
|
||||||
qstr = qstr.fromLocal8Bit(szStr);
|
|
||||||
std::string stdStr = qstr.toStdString();
|
|
||||||
strcpy(szStr,stdStr.c_str());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
QStringList PELibraryModule::GetNames(std::string names,char split,bool removeblank)
|
QStringList PELibraryModule::GetNames(std::string names,char split,bool removeblank)
|
||||||
{
|
{
|
||||||
QString incname;
|
QString incname;
|
||||||
|
|
@ -1341,30 +1333,6 @@ bool PELibraryModule::InitModule(QWidget*pWidget)
|
||||||
Conc = (struct CONC_STRU *)Methodlib.resolve("CONC");
|
Conc = (struct CONC_STRU *)Methodlib.resolve("CONC");
|
||||||
Con = (struct CON_STRU *)Methodlib.resolve("CON");
|
Con = (struct CON_STRU *)Methodlib.resolve("CON");
|
||||||
|
|
||||||
// 显示乱码进行字符串转码
|
|
||||||
if (strlen(Inc->Script)==0&&strlen(Inc->Name)>0)// m_pMemRdWt->ChangeName函数会用Inc->Name生成Inc->Scrip,防止重复转换字符串格式,暂时先这样判断是否转换过格式
|
|
||||||
{
|
|
||||||
if (Inc)
|
|
||||||
{
|
|
||||||
ToUnicode(Inc->Name);
|
|
||||||
ToUnicode(Inc->Script);
|
|
||||||
ToUnicode(Inc->Unit);
|
|
||||||
}
|
|
||||||
if (Conc)
|
|
||||||
{
|
|
||||||
ToUnicode(Conc->Name);
|
|
||||||
ToUnicode(Conc->Script);
|
|
||||||
ToUnicode(Conc->Unit);
|
|
||||||
ToUnicode(Conc->Options);
|
|
||||||
ToUnicode(Conc->ValType);
|
|
||||||
}
|
|
||||||
if (Outc)
|
|
||||||
{
|
|
||||||
ToUnicode(Outc->Name);
|
|
||||||
ToUnicode(Outc->Script);
|
|
||||||
ToUnicode(Outc->Unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(paramCardNameInSlf.isEmpty()) {
|
if(paramCardNameInSlf.isEmpty()) {
|
||||||
if(Hd){
|
if(Hd){
|
||||||
paramCardNameInSlf=Hd->Param;
|
paramCardNameInSlf=Hd->Param;
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ int CLisConvertor::ScanLogFile(char *FileName,char *Message,char **CurveName,ch
|
||||||
strcpy(szTemp, "[LIS]");
|
strcpy(szTemp, "[LIS]");
|
||||||
int pos1=GetBeginPosit(FileName,szTemp);
|
int pos1=GetBeginPosit(FileName,szTemp);
|
||||||
mWellDynamicInfo=&WellDynamicInfo;
|
mWellDynamicInfo=&WellDynamicInfo;
|
||||||
if((fp=fopen(FileName,"rb"))==NULL) {
|
if((fp=fopen(/*FileName*/UTF8ToGBK(FileName),"rb"))==NULL) {
|
||||||
QMessageBox::information(NULL,FileName,"Open Not File:",QMessageBox::Ok);
|
QMessageBox::information(NULL,FileName,"Open Not File:",QMessageBox::Ok);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -736,7 +736,7 @@ bool CLisConvertor::Transfer(char *FileName,char *outfile,int *OutCurveNo,char *
|
||||||
// format spcification number
|
// format spcification number
|
||||||
int nfmsp=0 ,nfrmob;
|
int nfmsp=0 ,nfrmob;
|
||||||
|
|
||||||
if((fp=fopen(FileName,"rb")) == NULL) {
|
if((fp=fopen(UTF8ToGBK(FileName),"rb")) == NULL) {
|
||||||
QMessageBox::information(NULL,FileName,"Open Not File:",QMessageBox::Ok);
|
QMessageBox::information(NULL,FileName,"Open Not File:",QMessageBox::Ok);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,12 @@ int CSLFAsciiConvertor::ScanLogFile(char *FileName,char *Message,char **CurveNa
|
||||||
dates.clear();
|
dates.clear();
|
||||||
depths.clear();
|
depths.clear();
|
||||||
CString sss;
|
CString sss;
|
||||||
/* open SLFAscii file */
|
|
||||||
|
/* open SLFAscii file */
|
||||||
char name[curve_name_len+1],temps[15];
|
char name[curve_name_len+1],temps[15];
|
||||||
int i,j,num;
|
int i,j,num;
|
||||||
// CString cs,csOutName;
|
// CString cs,csOutName;
|
||||||
QFile InFile(GBKToUTF8(FileName));
|
QFile InFile(/*GBKToUTF8*/(FileName));
|
||||||
if( !InFile.open(QIODevice::ReadOnly ) )return 0;
|
if( !InFile.open(QIODevice::ReadOnly ) )return 0;
|
||||||
QTextStream textstream( &InFile );
|
QTextStream textstream( &InFile );
|
||||||
QString str = textstream.readLine();
|
QString str = textstream.readLine();
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ bool Tran(char *FileName,char *outfile,int *OutCurveNo,char **OutCurve,char **st
|
||||||
MyDepthProgress.SetDepth(20);
|
MyDepthProgress.SetDepth(20);
|
||||||
#pragma region 统计数据行数
|
#pragma region 统计数据行数
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
if((fp=fopen(FileName,"rb"))==NULL)return 0;
|
if((fp=fopen(UTF8ToGBK(FileName),"rb"))==NULL)return 0;
|
||||||
DataLineNum=0;
|
DataLineNum=0;
|
||||||
int LineLen=(ScanInf.LineDataPoint+1)*15;//预算行长
|
int LineLen=(ScanInf.LineDataPoint+1)*15;//预算行长
|
||||||
if(ScanInf.LineDataPoint+1<100)LineLen*=2;//数据量小时适当开大点,保证LineLen>行长
|
if(ScanInf.LineDataPoint+1<100)LineLen*=2;//数据量小时适当开大点,保证LineLen>行长
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user