在创建一个共公单元时,自定义两个函数时,在编译提示出错(50)

  • 主题发起人 主题发起人 骷髅头
  • 开始时间 开始时间

骷髅头

Unregistered / Unconfirmed
GUEST, unregistred user!
在创建一个共公单元时pBaseMethod,自定义两个函数时getPY,Make_Orders_Code,在编译时提示错误unit pBaseMethod;interfaceuses Variants;type TpBaseMethod=class(TObject);public function getPY(hzChar: string): char
Function Make_Orders_Code: string;//合同编号生成函数var strUser: string
intPower: integer;end;implementation {procedure FlashMe;var FWinfo: TFlashWInfo;begin FWinfo.cbSize := SizeOf(FWinfo)
FWinfo.hwnd := Application.Handle
FWinfo.dwflags := FLASHW_ALL or FLASHW_TIMERNOFG
FWinfo.ucount := 0
FWinfo.dwtimeout := 0
FlashWindowEx(FWinfo);end
}function getPY(hzchar:string):char;begin case word(hzchar[1])shl 8+word(hzchar[2]) of $B0a1..$B0c4:result:='A'
$B0C5..$B2C0:result:='B'
$B2C1..$B4ED:result:='C'
$B4EE..$B6E9:result:='D'
$B6EA..$B7A1:result:='E'
$B7A2..$B8C0:result:='F'
$B8C1..$B9FD:result:='G'
$B9FE..$BBF6:result:='H'
$BBF7..$BFA5:result:='J'
$BFA6..$C0AB:result:='K'
$C0AC..$C2E7:result:='L'
$C2E8..$C4C2:result:='M'
$C4C3..$C5B5:result:='N'
$C5B6..$C5BD:result:='O'
$C5BE..$C6D9:result:='P'
$C6DA..$C8BA:result:='Q'
$C8BB..$C8F5:result:='R'
$C8F6..$CBF9:result:='S'
$CBFA..$CDD9:result:='T'
$CDDA..$CEF3:result:='W'
$CEF4..$D188:result:='X'
$D189..$D4D0:result:='Y'
$D4D1..$D7F9:result:='Z'
ELSE RESULT:=char(32)
end
Function Make_Orders_Code: string;//合同编号生成函数 begin { strTMPOrders:=FormatDateTime('yyyymmdd',now)
//当前日期组成字符串 with query1 do begin Close
SQL.Clear
SQL.Add('select max(ProductID) from dbRecLabel')
SQL.Add('where ProductID like '+ Quotedstr(strTMPOrders+'%'))
Open
if not IsEmpty then strOrders_Code:=fields[0].AsString //取得最大合同编号 else strOrders_Code:=strTMPOrders
close
end
if copy(strOrders_Code,12,4)<>'' then IntLastOrders:=strtoint(copy(strOrders_Code,12,4))//合同序号 else IntLastOrders:=0
IntLastOrders :=IntLastOrders+1;//序号加1,得到当前单号序号 //生成最新单号 if (IntLastOrders>=1) and (IntLastOrders<10) then strOrders_Code:=strTMPOrders+'000'+inttostr(IntLastOrders)
if (IntLastOrders>=10) and (IntLastOrders<100) then strOrders_Code:=strTMPOrders+'00'+inttostr(IntLastOrders)
if (IntLastOrders>=100) and (IntLastOrders<1000) then strOrders_Code:=strTMPOrders+inttostr(IntLastOrders);//showmessage(listno)
//最新单号 result:=strOrders_Code
} end;end.
 
哪里报错???报什么错误???
 
function getPY(hzChar: string): char ;这里报错,错误提示是'=' expected but 'FUNCTION' found
 
改成function TpBaseMethod.getPY(hzChar: string): char 就好了 ,太粗心了吧。
 
这个我之前加了,也不行,才发帖的,
 
是编译器出了问题,呵呵 ,
 
多人接受答案了。
 
后退
顶部