| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816 |
- unit uPublic;
- interface
- uses
- LIBC, IniFiles, QForms, SysUtils, Classes, QGraphics,
- QMenus, QStdCtrls, QExtCtrls, QGrids, Variants,
- QDialogs, QPrinters;
- const
- key = 18900;
- text_size = 511;
- type
- msgbuff = record
- mtype: integer;
- mtext: array[0..511] of char;
- end;
- type
- //linux
- RTTCdata = record
- NozNO: INTEGER; //油枪号
- TTC: Integer; //流水号
- TTCtime: string; //上传时间
- MON: Double; //加油金额
- VOL: Double; //加油量
- rationV: Double; //预付金额
- code: string;
- FuelNO: string; //油品编号
- FuelName: string; //
- state: integer; //状态 0=空闲 1=申请 2= 通过 3=无此验证码 4=允许加油 5=加油未找零 6=验证码油品错误 7=验证码过期
- end;
- type
- Tzfz_posstat = record
- posid: integer;
- pos_stat: byte;
- cash_stat: byte;
- prt_stat: byte;
- money: integer;
- door_stat: byte;
- end;
- TzfzPosArr = array of Tzfz_posstat;
- EAdvListViewError = class(Exception); //输出错误提示
- TResultByteArray = array of byte;
- TFuellingPointDB = record
- FP_Name: string; //加油点的名称
- Nb_Tran_Buffer_Not_Paid: integer; //脱机记录编号 1-15
- Nb_Of_Historic_Trans: integer; //已经清除的交易记录编号 1-15
- Nb_Logical_Nozzle: integer; //逻辑枪号 1-8
- Loudspeaker_Switch: integer; //加油点喇叭的开关 0=off 1=on
- Default_Fuelling_Mode: integer; //默认的加油模式 FM,1-8
- Leak_Log_Noz_Mask: integer; //理解为测试用油 泄露测试
- Drive_Off_Light_Switch: integer; //设备灯 开关
- OPT_Light_Switch: integer; //OPT灯 开关
- FP_State: integer; //加油点状态
- Log_Noz_State: integer; //枪状态
- Assign_Contr_Id: string; //FP 当前登陆的 CD SUBNET+NODE 两字节
- Release_Mode: integer; // 开放模式 1=允许脱机加油 0=不允许
- ZeroTR_Mode: integer; // 0交易记录是否保存 ,0=不保存 1=保存
- Log_Noz_Mask: integer; //授权某一条枪或者多条抢 BIN8 每位代表一条枪 0=未授权 1=已授权
- Config_Lock: string; // 设置FP只与这个CD通讯 SUBNET+NODE 两字节
- Remote_Amount_Prepay: string; //定量金额
- Remote_Volume_Preset: string; //定量值
- Release_Token: INTEGER; //
- Fuelling_Mode: integer; //
- Transaction_Sequence_Nb: string; //交易流水号 1-9999 BCD
- Current_TR_Seq_Nb: string; //为当前正在加油的记录指定一个交易流水号。1-9999 BCD
- Release_Contr_Id: string; //大概是当前正在交易的记录是由哪个CD控制的
- Suspend_Contr_Id: string; //和上面的有关系,这两个都不知道什么意思
- Current_Amount: string; //加油金额
- Current_Volume: string; //加油量
- Current_Unit_Price: string; //单价
- Current_Log_Noz: integer; //正在加油的枪
- Current_Prod_Nb: integer; //商品号(油品)
- Current_TR_Error_Code: integer; //当前记录的错误状态,0=没错误
- Current_Average_Temp: string; //
- Current_Price_Set_Nb: string; //
- Multi_Nozzle_Type: integer; //
- Multi_Nozzle_State: integer; //
- Multi_Nozzle_Status_Message: integer; //
- Local_Vol_Preset: string; //
- Local_Amount_Prepay: string; //
- Running_Transaction_Message_Frequency: string; //
- Open_FP: integer; //启动加油点
- Close_FP: integer; //关闭加油点
- Release_FP: integer; //授权加油点
- Terminate_FP: integer; //停止加油
- Suspend_FP: integer; //暂停加油
- Resume_FP: integer; //恢复加油
- Clear_Display: integer; //清空显示版
- Leak_Command: integer;
- FP_Alarm: string; //警报
- FP_Status_Message: string;
- FP_Multi_Nozzle_Status_Message: integer;
- FP_Running_Transaction_Message: string;
- end;
- TPaymentState = record
- cardno: string;
- logicCardNO: string;
- LastlogicCardNO: string;
- PerSet: Double;
- PayState: integer;
- LastPayState: integer;
- ispaid: integer;
- Lastispaid: integer;
- paytype: integer;
- Fueled: integer;
- AcctID: string;
- end;
- procedure SplitColumns(const AData: string; AStrings: TStrings; const ADelim: string = ' ');
- procedure PRINTSTRINGGRID(StringGrid: TStringGrid; _titel: string; PAGETYPE: INTEGER = 0);
- function _IsInt(sStr: string): boolean;
- function _IsFloat(sStr: string): boolean;
- function _IsDate(sStr: string): boolean;
- function _IsTime(sStr: string): boolean;
- function _IsDateTime(sStr: string): boolean;
- function GetdateTimestrD1(dtstr: string; _INC: INTEGER): string;
- //function _GetDCB(DCBSTR:STRING):TDCB;
- // procedure _OpenFile(sFileName: string);
- function _SelectedFile(var sFileName: string; sExt: string = ''; sPath: string = ''): boolean;
- function _SaveTo(var sFileName: string; sExt: string; sPath: string = ''): boolean;
- procedure _Msg(sPrompt: string; sTitle: string = '');
- procedure _MsgError(sPrompt: string; sTitle: string = '');
- function _MsgYesNo(sPrompt: string; sTitle: string = ''): TMessageButton;
- // function _MsgOKCancel(sPrompt: string; sTitle: string = ''): integer;
- function _ErrorDate(sDate: string): string;
- function _ErrorTime(sTime: string): string;
- function _ErrorInt(sStr: string): string;
- function _ErrorFloat(sStr: string): string;
- procedure _test;
- function _GetAppPath: string;
- function _GetExcelPath: string;
- function _GetTrsDBPath: string;
- function _GetLogDBPath: string;
- function _GetRFCardPath: string;
- function _GetDBPath: string;
- procedure _LoadIPconfig; //取IP配置
- // procedure _ToExcel(sFileName: string;strGrid:TStringGrid);
- function _GetMK: string;
- // procedure _ToExcelDX(aDBGridEh: TdxDBGrid);
- function _LAddChar(sStr, sChar: string; iLength: integer): string;
- function _RAddChar(sStr, sChar: string; iLength: integer): string;
- function _NextNo(sNo: string): string;
- function _GetAccountNo(aDate: TDateTime): string;
- //系统 ID h:=GetHWndByPID(GetPID('hscd.exe'));
- // function GetPID(ExeFileName: string): integer;
- // function GetHWndByPID(const hPID: THandle): THandle;
- //控制LV到某一列并取值
- // function ListView_GetItemText_Ex(hwndLV: Integer; i, iSubItem: Integer;
- // pszText: PChar; cchTextMax: Integer): Integer;
- //不控制一列只取值
- // function ListView_GetItemText_NOT_SELECT(hwndLV:integer; i, iSubItem: Integer;
- // pszText: PChar; cchTextMax: Integer): Integer;
- //菜单操作和查找
- // FUNCTION ClickMenu(h:integer; MainIndex,SubIndex:integer) :integer;
- // function Find_SubMenuByCaption(h:integer;str:string;var MainIndex,SubIndex:integer):TStringList;
- //获取本地串口列表
- procedure _GetLocalCommList(var stList: TStringList);
- var
- _AppPath: string;
- _XlsPath: string;
- _TrsDBPath: string;
- _LogDBPath: string;
- _RFCardPath: string;
- _DBPath: string;
- _PsamIP: string;
- _PsamPort: integer;
- _ShiftID: string;
- _DayID: string;
- _MK: string;
- _User: string;
- _UserID: string;
- _E_isSup: integer;
- StateList: array of RTTCdata;
- StatePanelParentList: array of TPanel;
- posPlist: array of TPanel;
- _istest: integer;
- _isLOG: integer;
- _prtOrt: integer;
- _paymode: integer;
- _bPrint: integer;
- RTLDB: TRTLCriticalSection; //显示线程临界区
- CSMNT: TRTLCriticalSection; //显示线程临界区
- //InterlockedCritDisplay : TRTLCriticalSection; //显示线程临界区
- /// InterlockedRFCARD : TRTLCriticalSection; //RF卡支付线程临界区
- // InterlockedLocalFuel : TRTLCriticalSection; //RF卡支付线程临界区
- msgID: INTEGER; //PUBLIC
- ThreadMsgID1, ThreadMsgID2: INTEGER;
- implementation
- uses DESCrypt;
- const
- NumberArr: array[0..9] of Char = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
- LetterArr: array[0..25] of Char = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
- 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
- 'u', 'v', 'w', 'x', 'y', 'z');
- {
- function _GetDCB(DCBSTR:STRING):TDCB;
- BEGIN
- Result.BaudRate:=STRTOINT(COPY(DCBSTR,1,POS(',',DCBSTR)-1));
- DCBSTR:=COPY(DCBSTR,POS(',',DCBSTR)+1,LENGTH(DCBSTR));
- Result.ByteSize:=STRTOINT(COPY(DCBSTR,1,POS(',',DCBSTR)-1));
- DCBSTR:=COPY(DCBSTR,POS(',',DCBSTR)+1,LENGTH(DCBSTR));
- Result.Parity:=STRTOINT(COPY(DCBSTR,1,POS(',',DCBSTR)-1));
- DCBSTR:=COPY(DCBSTR,POS(',',DCBSTR)+1,LENGTH(DCBSTR));
- Result.StopBits:=STRTOINT(DCBSTR);
- END;
- }
- procedure PRINTSTRINGGRID(StringGrid: TStringGrid; _titel: string; PAGETYPE: INTEGER = 0);
- var
- i, ii, r: Integer;
- xdpi, ydpi, x, y: Integer;
- ye: integer;
- begin
- xdpi := 120;
- ydpi := 120;
- x := 0;
- Y := 150;
- Printer.Title := 'HS Printer';
- Printer.canvas.Font.Size := 12;
- if PAGETYPE = 0 then
- printer.Orientation := poPortrait
- else
- printer.Orientation := poLandscape;
- Printer.BeginDoc;
- with Printer.Canvas do
- begin
- ye := 1;
- i := 0;
- r := 1;
- while r < StringGrid.RowCount do
- // for i := 0 to StringGrid.RowCount do
- begin
- x := 0;
- if I = 0 then
- begin
- TextOut(x * 2, y - 100, _titel + ' ' + formatdatetime('yyyy-MM-dd HH:mm:SS', now) + ' 第 ' + inttostr(ye) + ' 页');
- for ii := 0 to StringGrid.colCount do
- begin
- MoveTo(x, ydpi + Y);
- LineTo(x, ydpi * i + Y);
- MoveTo(x, ydpi * i + Y);
- x := x + StringGrid.ColWidths[ii] * 5 + 100;
- LineTo(x, ydpi * i + Y);
- TextOut(x - (StringGrid.ColWidths[ii] * 5 + 90), ydpi * i + 2 + Y, StringGrid.Cells[ii, 0]);
- end;
- MoveTo(x, ydpi + Y);
- LineTo(x, ydpi * i + Y);
- end
- else
- begin
- for ii := 0 to StringGrid.colCount do
- begin
- MoveTo(x, ydpi + Y);
- LineTo(x, ydpi * i + Y);
- MoveTo(x, ydpi * i + Y);
- x := x + StringGrid.ColWidths[ii] * 5 + 100;
- LineTo(x, ydpi * i + Y);
- TextOut(x - (StringGrid.ColWidths[ii] * 5 + 90), ydpi * i + 2 + Y, StringGrid.Cells[ii, r]);
- end;
- MoveTo(x, ydpi + Y);
- LineTo(x, ydpi * i + Y);
- r := r + 1;
- end;
- if (i * ydpi) >= (printer.PageHeight - ydpi * 2 - 150) then
- begin
- i := i + 1;
- x := 0;
- for ii := 0 to StringGrid.colCount do
- begin
- MoveTo(x, ydpi + Y);
- LineTo(x, ydpi * i + Y);
- MoveTo(x, ydpi * i + Y);
- x := x + StringGrid.ColWidths[ii] * 5 + 100;
- LineTo(x, ydpi * i + Y);
- end;
- MoveTo(x, ydpi + Y);
- LineTo(x, ydpi * i + Y);
- ye := ye + 1;
- i := 0;
- printer.newpage;
- end
- else
- i := i + 1;
- end;
- end;
- Printer.EndDoc;
- end;
- function _GetMK: string;
- begin
- Result := EnCrypt_String('004150');
- end;
- function _GetAppPath: string;
- begin
- _AppPath := ExtractFilePath(Application.ExeName);
- Result := _AppPath;
- end;
- function _GetExcelPath: string;
- begin
- _XlsPath := ExtractFilePath(Application.ExeName) + 'xls/';
- Result := _XlsPath;
- end;
- function _GetTrsDBPath: string;
- begin
- _TrsDBPath := ExtractFilePath(Application.ExeName) + 'DB/TRSDB.T';
- Result := _TrsDBPath;
- end;
- function _GetLogDBPath: string;
- begin
- _LogDBPath := ExtractFilePath(Application.ExeName) + 'DB/LOGDB.L';
- Result := _LogDBPath;
- end;
- function _GetRFcardPath: string;
- begin
- _RFCardPath := ExtractFilePath(Application.ExeName) + 'RFcard/';
- Result := _RFCardPath;
- end;
- function _GetDBPath: string;
- begin
- _DBPath := ExtractFilePath(Application.ExeName) + 'db/';
- Result := _DBPath;
- end;
- //iStyle = 1, 下一个大写字母
- function NextChar(sChar: Char; iStyle: integer): Char;
- var
- i: integer;
- s: string;
- begin
- Result := sChar;
- s := LowerCase(sChar);
- for i := 0 to 25 do
- if s = LetterArr[i] then
- begin
- Result := LetterArr[(i + 1) mod 26];
- Break;
- end;
- if iStyle = 1 then
- Result := UpCase(Result);
- end;
- //下一个数字
- function NextNumber(sChar: Char): Char;
- var
- i: integer;
- begin
- Result := sChar;
- for i := 0 to 9 do
- if sChar = NumberArr[i] then
- begin
- Result := NumberArr[(i + 1) mod 10];
- Break;
- end;
- end;
- //左边增加字符串
- function _LAddChar(sStr, sChar: string; iLength: integer): string;
- var
- i: integer;
- begin
- Result := sStr;
- for i := Length(sStr) + 1 to iLength do
- Result := sChar + Result;
- end;
- //右边增加字符串
- function _RAddChar(sStr, sChar: string; iLength: integer): string;
- var
- i: integer;
- begin
- Result := sStr;
- for i := Length(sStr) + 1 to iLength do
- Result := Result + sChar;
- end;
- //是有效整型数
- function _IsInt(sStr: string): boolean;
- begin
- try
- StrToInt(sStr);
- Result := true;
- except
- Result := false;
- end;
- end;
- function GetdateTimestrD1(dtstr: string; _INC: INTEGER): string;
- var dt: Tdatetime;
- timestr, datestr: string;
- begin
- datestr := copy(dtstr, 1, pos(' ', dtstr) - 1);
- timestr := copy(dtstr, pos(' ', dtstr) + 1, 10);
- try
- dt := strtodate(datestr) - _INC + strtotime(timestr);
- except
- _msgerror('datetime error!');
- exit;
- end;
- result := formatdatetime('YYYY-MM-DD HH:mm:SS', DT);
- end;
- //是有效浮点数
- function _IsFloat(sStr: string): boolean;
- begin
- try
- StrToFloat(sStr);
- Result := true;
- except
- Result := false;
- end;
- end;
- //是有效日期
- function _IsDate(sStr: string): boolean;
- begin
- try
- StrToDate(sStr);
- Result := true;
- except
- Result := false;
- end;
- end;
- function _IsDateTime(sStr: string): boolean;
- begin
- try
- StrToDatetime(sStr);
- Result := true;
- except
- Result := false;
- end;
- end;
- //是有效时间
- function _IsTime(sStr: string): boolean;
- begin
- try
- StrToTime(sStr);
- Result := true;
- except
- Result := false;
- end;
- end;
- //获得下一编号
- function _NextNo(sNo: string): string;
- var
- iLen: integer;
- bStr: string;
- sChar: Char;
- begin
- Result := sNo;
- if Trim(sNo) = '' then Exit;
- iLen := Length(sNo);
- sChar := sNo[iLen];
- bStr := Copy(sNo, 1, iLen - 1);
- if sChar in ['0'..'9'] then
- begin
- sChar := NextNumber(sChar);
- if sChar = '0' then
- bStr := _NextNo(bStr);
- Result := bStr + sChar;
- end
- else if sChar in ['a'..'z'] then
- begin
- sChar := NextChar(sChar, 0);
- if sChar = 'a' then
- bStr := _NextNo(bStr);
- Result := bStr + sChar;
- end
- else if sChar in ['A'..'Z'] then
- begin
- sChar := NextChar(sChar, 1);
- if sChar = 'A' then
- bStr := _NextNo(bStr);
- Result := bStr + sChar;
- end
- else
- Result := _NextNo(bStr) + sChar;
- end;
- function _SelectedFile(var sFileName: string;
- sExt: string = '';
- sPath: string = ''): boolean;
- begin
- Result := False;
- with TOpenDialog.Create(nil) do
- try
- Options := Options + [ofFileMustExist];
- if Trim(sExt) = '' then
- sExt := '*';
- Filter := Format('文件类型 (*.%s)|*.%s', [sExt, sExt]);
- if Trim(sPath) = '' then
- InitialDir := _AppPath
- else
- InitialDir := sPath;
- if Execute then
- begin
- sFileName := FileName;
- Result := True;
- end;
- finally
- Free;
- end;
- end;
- function _SaveTo(var sFileName: string;
- sExt: string;
- sPath: string = ''): boolean;
- begin
- Result := False;
- with TSaveDialog.Create(nil) do
- try
- Options := Options + [ofOverwritePrompt];
- if Trim(sExt) <> '' then
- DefaultExt := sExt
- else
- sExt := '*';
- Filter := Format('文件类型 (*.%s)|*.%s', [sExt, sExt]);
- if sPath = '' then
- InitialDir := _AppPath
- else
- InitialDir := sPath;
- if Execute then
- begin
- sFileName := FileName;
- Result := True;
- end;
- finally
- Free;
- end;
- end;
- procedure _Msg(sPrompt: string; sTitle: string);
- begin
- //if sTitle <> '' then
- Application.MessageBox(Pchar(sPrompt),
- Pchar(sTitle))
- end;
- // MB_ICONINFORMATION
- procedure _MsgError(sPrompt: string; sTitle: string);
- begin
- //if sTitle <> '' then
- Application.MessageBox(Pchar(sPrompt),
- Pchar(sTitle),
- [smbOK], smsWarning)
- end;
- function _MsgYesNo(sPrompt: string; sTitle: string): TMessageButton;
- var bts: TMessageButtons;
- begin
- bts := [smbYes, smbNo, smbCancel];
- // if sTitle <> '' then
- result := Application.MessageBox(Pchar(sPrompt), Pchar(sTitle), bts); //,smsWarning,smsWarning,smbOK);
- end;
- function PosIdx(const ASubStr, AStr: AnsiString; AStartPos: Cardinal): Cardinal;
- var
- lpSubStr, lpS: PChar;
- LenSubStr, LenS: Integer;
- LChar: Char;
- begin
- LenSubStr := Length(ASubStr);
- LenS := Length(AStr);
- if (LenSubStr = 0) or (LenSubStr > LenS) then begin
- Result := 0; //not found
- EXIT;
- end; //if
- lpSubStr := Pointer(ASubStr);
- lpS := Pointer(AStr);
- if AStartPos > 0 then begin
- lpS := lpS + AStartPos - 1;
- LenS := LenS + 1 - Integer(AStartPos);
- end; //if
- LChar := lpSubStr[0]; //first char
- lpSubStr := lpSubStr + 1; //next char
- LenSubStr := LenSubStr - 1; //len w/o first char
- LenS := LenS - LenSubStr; //Length(S)-Length(SubStr) +1(!) MUST BE >0
- if LenS <= 0 then begin
- Result := 0;
- EXIT;
- end; //if
- while LenS > 0 do begin
- if lpS^ = LChar then begin
- inc(lpS);
- if CompareMem(lpS, lpSubStr, LenSubStr) then begin
- Result := lpS - Pointer(AStr); //+1 already here
- EXIT;
- end;
- end
- else begin
- inc(lpS);
- end;
- dec(LenS);
- end; //while
- Result := 0;
- end; //PosIdx
- procedure SplitColumns(const AData: string; AStrings: TStrings; const ADelim: string = ' '); {Do not Localize}
- var
- i: Integer;
- LData: string;
- LDelim: Integer; //delim len
- LLeft: string;
- LLastPos: Integer;
- LLeadingSpaceCnt: Integer;
- begin
- Assert(Assigned(AStrings));
- AStrings.Clear;
- LDelim := Length(ADelim);
- LLastPos := 1;
- LData := Trim(AData);
- LLeadingSpaceCnt := 0;
- if Length(LData) > 0 then begin //if Not WhiteStr
- while AData[LLeadingSpaceCnt + 1] <= ' ' do inc(LLeadingSpaceCnt);
- end
- else begin
- EXIT;
- end;
- i := Pos(ADelim, LData);
- while I > 0 do begin
- LLeft := Copy(LData, LLastPos, I - LLastPos); //'abc d' len:=i(=4)-1 {Do not Localize}
- if LLeft > '' then begin {Do not Localize}
- AStrings.AddObject(Trim(LLeft), Pointer(LLastPos + LLeadingSpaceCnt));
- end;
- LLastPos := I + LDelim; //first char after Delim
- i := PosIdx(ADelim, LData, LLastPos);
- end; //while found
- if LLastPos <= Length(LData) then begin
- AStrings.AddObject(Trim(Copy(LData, LLastPos, MaxInt)), Pointer(LLastPos + LLeadingSpaceCnt));
- end;
- end; //TIdFTPListItems.ParseColumns
- {
- function _MsgOKCancel(sPrompt: string; sTitle: string): integer;
- begin
- if sTitle <> '' then
- Result := Application.MessageBox(Pchar(sPrompt),Pchar(sTitle),
- MB_OKCANCEL + MB_ICONQUESTION + MB_DEFBUTTON2)
- else
- Result := Application.MessageBox(Pchar(sPrompt),Pchar(Application.Title),
- MB_OKCANCEL + MB_ICONQUESTION + MB_DEFBUTTON2);
- end; }
- {procedure _ToExcelDX(aDBGridEh: TdxDBGrid);
- var
- sFileName: string;
- begin
- if (not aDBGridEh.DataSource.DataSet.Active) or
- (aDBGridEh.DataSource.DataSet.IsEmpty) then
- begin
- _MsgError('对不起!没有数据可输出!');
- Exit;
- end;
- if _SaveTo(sFileName,'xls',_XlsPath) then
- begin
- aDBGridEh.SaveToXLS(sFileName,TRUE);
- { if _MsgBox('现在打开【' + sFileName + '】吗?') = IDOK then
- _OpenFile(sFileName);
- end;
- end; }
- function _GetAccountNo(aDate: TDateTime): string;
- var
- iY, iM, iD: Word;
- begin
- DecodeDate(aDate, iY, iM, iD);
- Result := IntToStr(iY) + '年' +
- _LAddChar(IntToStr(iM), '0', 2) + '月';
- end;
- function _ErrorDate(sDate: string): string;
- begin
- Result := Format('【%s】 - 无效的日期!', [sDate]);
- end;
- function _ErrorTime(sTime: string): string;
- begin
- Result := Format('【%s】 - 无效的时间!', [sTime]);
- end;
- function _ErrorInt(sStr: string): string;
- begin
- Result := Format('【%s】 - 无效的整数!', [sStr]);
- end;
- function _ErrorFloat(sStr: string): string;
- begin
- Result := Format('【%s】 - 无效的浮点数!', [sStr]);
- end;
- procedure _test;
- begin
- _Msg('test ok');
- end;
- procedure _loadIPconfig;
- var configini: TIniFile;
- begin
- _GetAppPath;
- configini := TIniFile.Create(_AppPath + 'config.ini');
- _PsamIP := configini.ReadString('PSAM CONFIG', 'ip', '');
- _PsamPort := configini.ReadInteger('PSAM CONFIG', 'port', 18900);
- configini.Free;
- end;
- procedure _GetLocalCommList(var stList: TStringList);
- begin
- ; ;
- end;
- end.
|