这个要怎么实现??
万分感谢~~~
根據你制定的編碼原則,
例:table: cur_no 是按照不同的類別存放流水號
SELECT COUNT(*),"cur_no"."cur_number"
INTO :Li_count , :LS_CURNUM
FROM "cur_no"
WHERE "cur_no"."cur_mark" = :ls_finmark
group by "cur_no"."cur_number";
ii_count = INTEGER(LS_CURNUM)
if Li_count = 0 then
ii_count = 1
INSERT INTO "cur_no"
VALUES ( :ls_finmark,'001' ) ;
if sqlca.sqlnrows > 0 then
commit;
else
messagebox('錯誤~','累計流水號無法記錄, 無法存檔!',stopsign!)
return
end if
else
if ii_count > 999 then
messagebox('錯誤~','的累計流水號已經超過最大限制, 無法再累計 !',stopsign!)
return
end if
if ii_count < 0 then
ii_count = 1
INSERT INTO "cur_no"
VALUES ( :ls_finmark,'001' ) ;
if sqlca.sqlnrows > 0 then
commit;
else
messagebox('錯誤~','累計流水號無法記錄, 無法存檔!',stopsign!)
return
end if
else
ii_count = ii_count + 1
ls_cur = string(ii_count,'000')
messagebox('ls_cur',ls_cur)
UPDATE "cur_no"
SET "cur_number" = :ls_cur
WHERE "cur_no"."cur_mark" = :ls_finmark ;
commit;
end if
end if
messagebox('ii_count',ii_count)
//產生一個訂單號:由類別+日期+流水號
ls_fin = ls_finmark+ls_findate+string(ii_count,'000')
dw_1.SetItem (dw_1.getrow(),"fin_no",ls_fin)
這只是一種方法,你可以按照自已的思路去寫。