我试试吧,不过我对对COM+、MIDAS、WEBSERVICE没有什么经验,Delphi到是用勒2年勒.
项目经验:
1 : Category_Analyzer数据分析系统,现应用于可口可乐,保洁,广州实力媒体有限公司,客户反映良好.同时在台湾,泰国也有客户在试运行中.
工具: Delphi,Access,Sql.
2 : 文王贡物流管理系统,现应用于安徽文王贡酿酒有限公司.主要业务包括:人员管理,生产管理,库存管理,销售管理,系统管理等.
工具: Delphi,Sql,PowerDesigner.
3 : 电力营销管理软件,现应用于福建省德化县电力公司.
工具: Delphi,Sql,PowerDesigner.
4 : 华新物流管理管理系统,现应用于安徽华新物流有限公司.
工具: Delphi,Sql,PowerDesigner.
这段时间正在搞导数据,贴段代码:
function TfmReach.CreateCommFormatText(SourceFileName: string;
ResultTxtFileNames: TStringList): Boolean;
var InputTextstringlist,inputTextRowstringlist : Tstringlist;
I,IText,IRow : integer;
TextName,BrandName,CategoryName,MarketName,IndexName,ProductName : string;
SignRow : integer;
OutPutTextStringlist : Tstringlist;
TitleArray,DataArray : TstringArray;
TitleString,DataString : String;
Indexstringlist : Tstringlist;
DirectoryName : string;
R1,R2,R3,R4,R5,R6,R7,R8,R9,R10 : string;
Year,DateCell,date,month : string;
CheckStringList : Tstringlist;
begin
Result := False;
if Source = 1 then
begin
InputTextstringlist := Tstringlist.Create;
InputTextRowstringlist := Tstringlist.Create;
OutPutTextStringlist := Tstringlist.Create;
Indexstringlist := Tstringlist.Create;
try
TextName := ExtractFileName(SourceFileName);
DirectoryName := Copy(TextName,1,Length(TextName)-4);
TextName := Copy(TextName,1,length(TextName)-4);
BrandName := Copy(TextName,1,Pos('_',TextName)-1);
TextName := Copy(TextName,Pos('_',TextName)+1,Length(TextName)-Length(BrandName)-1);
CategoryName := Copy(TextName,1,Pos('_',TextName)-1);
InputTextstringlist.LoadFromFile(SourceFileName);
Getstringlist(Indexstringlist,InputTextstringlist.Strings[1],#9);
+#9+ 'MarketName' +#9+ 'CategoryName'+#9+ 'DataValue');
//-->ÕÒ³ö²»Í¬µÄÈÕÆÚ,Ìí¼Ó
TitleString := 'IndexName' +#9+ 'MarketLevel' +#9+ 'MarketName' +#9+ 'CategoryName'
+#9+ 'BrandName' +#9+ 'ProductName';
for IText := 0 to InputTextstringlist.Count - 1do
begin
InputTextRowstringlist.Clear;
GetStringlist(InputTextRowstringlist,InputTextstringlist.Strings[IText],#9);
if InputTextRowstringlist.Count = 1 then
begin
//market
end else
if InputTextRowstringlist.Count = 0 then
begin
//¿ÕÐÐ
end else
if IText = SignRow + 4 then
begin
//Êý¾ÝÁÐ
if TrimRight(TrimLeft(InputTextRowstringlist.Strings[0])) <> '' then
begin
if GetIndex(@TitleArray,InputTextRowstringlist.Strings[0]) < 0 then
begin
AddArray(@TitleArray,InputTextRowstringlist.Strings[0]);
end;
end;
end;
end;
for I := low(TitleArray) to high(TitleArray)do
begin
TitleString := TitleString +#9+ TitleArray;
end;
OutPutTextStringlist.Add(TitleString);
//<--&Otilde;&Ograve;&sup3;&ouml;&sup2;&raquo;&Iacute;&not;&micro;&Auml;&Egrave;&Otilde;&AElig;&Uacute;,&Igrave;í&frac14;&Oacute;
//-->&Otilde;&Ograve;&sup3;&ouml;&Ecirc;&yacute;&frac34;&Yacute;&ETH;&ETH;,&Igrave;í&frac14;&Oacute;
for IText := 0 to InputTextstringlist.Count - 1do
begin
InputTextRowstringlist.Clear;
GetStringlist(InputTextRowstringlist,InputTextstringlist.Strings[IText],#9);
if InputTextRowstringlist.Count = 1 then
begin
//market
MarketName := Copy(InputTextRowstringlist.Strings[0],Pos('|',InputTextRowstringlist.Strings[0])+1,Length(InputTextRowstringlist.Strings[0])-Pos('|',InputTextRowstringlist.Strings[0])-1);
SignRow := IText;//±ê&Ouml;&frac34;&Aacute;&ETH;
if Marketname <> '' then
begin
R1 := '1+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R2 := '2+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R3 := '3+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R4 := '4+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R5 := '5+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R6 := '6+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R7 := '7+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R8 := '8+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R9 := '9+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
R10 := '10+' +#9+ '' +#9+ MarketName +#9+ CategoryName
+#9+ BrandName +#9+ 'ProductName';
end;
end else
if InputTextRowstringlist.Count = 0 then
begin
//&iquest;&Otilde;&ETH;&ETH;
MarketName := '';
SignRow := 0;
end else
if (IText >= SignRow + 4) and (MarketName <> '') then
begin
//&Ecirc;&yacute;&frac34;&Yacute;&Aacute;&ETH;
if InputTextRowstringlist.Count >= 5 then
begin
for IRow := 5 to InputTextRowstringlist.Count - 1do
begin
IndexName := Indexstringlist.Strings[IRow];
if IndexName = '1+ (%)' then
begin
//1+
if InputTextRowstringlist.Count - 1 >= IRow then
R1 := R1 +#9+ InputTextRowstringlist.Strings[IRow]
else
R1 := R1 +#9+ '';
Continue;
end;
if IndexName = '2+ (%)' then
begin
//2+
if InputTextRowstringlist.Count - 1 >= IRow then
R2 := R2 +#9+ InputTextRowstringlist.Strings[IRow]
else
R2 := R2 +#9+ '';
Continue;
end;
if IndexName = '3+ (%)' then
begin
//3+
if InputTextRowstringlist.Count - 1 >= IRow then
R3 := R3 +#9+ InputTextRowstringlist.Strings[IRow]
else
R3 := R3 +#9+ '';
Continue;
end;
if IndexName = '4+ (%)' then
begin
//4+
if InputTextRowstringlist.Count - 1 >= IRow then
R4 := R4 +#9+ InputTextRowstringlist.Strings[IRow]
else
R4 := R4 +#9+ '';
Continue;
end;
if IndexName = '5+ (%)' then
begin
//5+
if InputTextRowstringlist.Count - 1 >= IRow then
R5 := R5 +#9+ InputTextRowstringlist.Strings[IRow]
else
R5 := R5 +#9+ '';
Continue;
end;
if IndexName = '6+ (%)' then
begin
//6+
if InputTextRowstringlist.Count - 1 >= IRow then
R6 := R6 +#9+ InputTextRowstringlist.Strings[IRow]
else
R6 := R6 +#9+ '';
Continue;
end;
if IndexName = '7+ (%)' then
begin
//7+
if InputTextRowstringlist.Count - 1 >= IRow then
R7 := R7 +#9+ InputTextRowstringlist.Strings[IRow]
else
R7 := R7 +#9+ '';
Continue;
end;
if IndexName = '8+ (%)' then
begin
//8+
if InputTextRowstringlist.Count - 1 >= IRow then
R8 := R8 +#9+ InputTextRowstringlist.Strings[IRow]
else
R8 := R8 +#9+ '';
Continue;
end;
if IndexName = '9+ (%)' then
begin
//9+
if InputTextRowstringlist.Count - 1 >= IRow then
R9 := R9 +#9+ InputTextRowstringlist.Strings[IRow]
else
R9 := R9 +#9+ '';
Continue;
end;
if IndexName = '10+ (%)' then
begin
//10+
if InputTextRowstringlist.Count - 1 >= IRow then
R10 := R10 +#9+ InputTextRowstringlist.Strings[IRow]
else
R10 := R10 +#9+ '';
Continue;
end;
end;
OutPutTextStringlist.Add(R1);
OutPutTextStringlist.Add(R2);
OutPutTextStringlist.Add(R3);
OutPutTextStringlist.Add(R4);
OutPutTextStringlist.Add(R5);
OutPutTextStringlist.Add(R6);
OutPutTextStringlist.Add(R7);
OutPutTextStringlist.Add(R8);
OutPutTextStringlist.Add(R9);
OutPutTextStringlist.Add(R10);
end;
end;
end;
//<--&Otilde;&Ograve;&sup3;&ouml;&Ecirc;&yacute;&frac34;&Yacute;&ETH;&ETH;,&Igrave;í&frac14;&Oacute;
if not DirectoryExists(GetAppPath + 'Temp/') then
CreateDir(GetAppPath + 'Temp/');
if FileExists(GetAppPath + 'Temp/'+ DirectoryName + '.txt')
then
DeleteFile(GetAppPath + 'Temp/'+ DirectoryName + '.txt');
OutPutTextStringlist.SaveToFile(GetAppPath + 'Temp/'+ DirectoryName + '.txt');
ResultTxtFileNames.Add(GetAppPath + 'Temp/'+ DirectoryName + '.txt');
Result := True;
finally
InputTextstringlist.Free;
inputTextRowstringlist.Free;
OutPutTextStringlist.Free;
Indexstringlist.Free;
end;
end else
if Source = 2 then
begin
TextName := ExtractFileName(SourceFileName);
DirectoryName := Copy(TextName,1,Length(TextName)-4);
InputTextstringlist := Tstringlist.Create;
InputTextRowstringlist := Tstringlist.Create;
OutPutTextStringlist := Tstringlist.Create;
Indexstringlist := Tstringlist.Create;
CheckStringList := Tstringlist.Create;
try
//-->Title
TitleString := 'IndexName' +#9+ 'MarketLevel' +#9+ 'MarketName' +#9+ 'CategoryName'
+#9+ 'BrandName' +#9+ 'ProductName';
InputTextstringlist.LoadFromFile(SourceFileName);
year := Copy(InputTextstringlist.Strings[3],Length(InputTextstringlist.Strings[3])-5,4);
inputTextRowstringlist.Clear;
GetStringList(inputTextRowstringlist,InputTextstringlist[15],#9);
SetLength(DataArray,0);
for I := 1 to inputTextRowstringlist.Count - 1do
begin
//2001/10/1 - 2001/20/31 31-10
DateCell := TrimLeft(TrimRight(inputTextRowstringlist.Strings));
Month := Copy(DateCell,Pos('-',DateCell)+1,(Length(DateCell)-Pos('-',DateCell)));
date := Copy(DateCell,1,Pos('-',DateCell)-1);
AddArray(@DataArray,(year+'/'+Month+'/1-'+year+'/'+Month+'/'+date));
end;
for I := Low(DataArray) to High(DataArray)do
begin
TitleString := TitleString +#9+ DataArray;
end;
OutPutTextStringlist.Add(TitleString);
//<--Title
//-->Data
SetLength(DataArray,0);
for IText := 0 to InputTextstringlist.Count - 1do
begin
GetStringList(inputTextRowstringlist,InputTextstringlist[IText],#9);
if (inputTextRowstringlist.Count = 1) then
begin
if Pos('Market',inputTextRowstringlist.Strings[0]) = 1 then
MarketName := Copy(inputTextRowstringlist.Strings[0],23,length(inputTextRowstringlist.Strings[0])-21)
else
if Pos('Product',inputTextRowstringlist.Strings[0]) = 1 then
ProductName := Copy(inputTextRowstringlist.Strings[0],23,length(inputTextRowstringlist.Strings[0])-21);
+#9+''+#9+MarketName+#9+''+#9+''+#9+ProductName;
end else
if (inputTextRowstringlist.Count = 0) then
begin
if (IText < inputTextRowstringlist.Count -2) then
begin
CheckStringlist.Clear;
GetStringlist(CheckStringlist,InputTextstringlist[IText+2],#9);
if CheckStringlist.Count <= 2 then
begin
MarketName := '';
ProductName := '';
SetLength(DataArray,0);
end;
end;
end else
if (inputTextRowstringlist.Count > 1)
and ((Pos('+',inputTextRowstringlist.Strings[0]) = 2)
or (Pos('+',inputTextRowstringlist.Strings[0]) = 3)) then
begin
SetLength(DataArray,0);
DataString := inputTextRowstringlist.Strings[0]+#9+''+#9+MarketName+#9+''+#9+''+#9+ProductName;
for IRow := 1 to inputTextRowstringlist.Count - 1do
begin
AddArray(@DataArray,inputTextRowstringlist.Strings[IRow]);
end;
for I := Low(DataArray) to high(DataArray)do
begin
DataString := DataString +#9+ DataArray;
end;
OutPutTextStringlist.Add(DataString);
end;
end;
//<--Data
if not DirectoryExists(GetAppPath + 'Temp/') then
CreateDir(GetAppPath + 'Temp/');
if FileExists(GetAppPath + 'Temp/'+ DirectoryName + '.txt')
then
DeleteFile(GetAppPath + 'Temp/'+ DirectoryName + '.txt');
OutPutTextStringlist.SaveToFile(GetAppPath + 'Temp/'+ DirectoryName + '.txt');
ResultTxtFileNames.Add(GetAppPath + 'Temp/'+ DirectoryName + '.txt');
Result := True;
finally
InputTextstringlist.Free;
InputTextRowstringlist.Free;
OutPutTextStringlist.Free;
Indexstringlist.Free;
CheckStringList.Free;
end;
end;
end;