供參考
vb is t.a2,t.a12,t.a13 from . t;
b2 (100);
b12 (100);
b13 (100);
b2c ;
i ;
j ;
n ;
t1 bom.ents.%type;
t2 %type;
t3 bom.ents.%type;
t4 inv..%type;
t5 inv..%type;
t6 ;
;
;
inv..%type;
inv..%type;
;
-- ;
-- ;
type arr is (css );
TYPE IS TABLE OF arr INDEX BY ;
t ;
item ;
;
(80);
uw ;
uu (80);
c is ,
bic.,
,
bic.,
msi.,
msi.,
bic.,
msi.,
msi.
from bom.s bbom,
bom.ents bic,
inv. msi
where = (b12)
and bic. is null
and bbom. = bic.
and = msi.
and =
and bbom. =
order by bic.,bic.;
begin
from .;
;
/*
table
(
(300),
(300),
(300),
(300),
(300),
(300),
(300),
(300),
(300),
A10 (300),
A11 (300),
A12 (300),
A13 (300),
A14 (300),
A15 (300),
A16 (300)
)
*/
--當天生成的BOM物料插入臨時表
into .(a1,a2,a3,a12,a13)
'0' a, w. cp,w. sm, '24' 組織代碼, 'XXX' 組織名稱
from...
where ...;
;
;
loop
fetch vb into b2,b12,b13; -- item, orgid
exit when vb%;
b2c := 0;
count(a.)
into b2c
from inv. a
where = (b12)
and a. = b2;
if b2c = 0 then
. t
set t.a3 = 'ERP中無此物料編碼'
where t.a2 = b2;
else
a.,a., a.
into , ,
from inv. a
where = (b12)
and a. = b2;
:= ;
for i in 0..9 loop
t(i).css := 0;
item(i).css := 0;
end loop;
i := 1;
item(1).css := ;
t6 := 0;
:= 0;
n := 1;
while t(0).css=0 loop
open c;
for j in 0..t(i).css loop
fetch c into ,t1,t2,t3,t4,t5,t6,uwvb使用友bom錄入更簡單,uu;
if c% then
:= 0;
else
item(i+1).css := ;
end if;
end loop;
if =0 then
t(i).css := 0;
i := i -1;
t(i).css := t(i).css + 1;
:= item(i).css;
else
--輸出部裝工序
/* if t61 and then
b.,
b.n
into ,
from bom.ings a,
bom.ces b
where = (b12)
and a. =
and b. = t6
and a. = b.;
--.('工序號: '||chr(9)||||chr(9)||'工序名稱: '||chr(9)||);
:= t6;
end if;*/
--.(n||chr(9)||i||chr(9)||t4||chr(9)||t5||chr(9)||t1||chr(9)||t2||chr(9)||t3);
into .(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a12vb使用友bom錄入更簡單,a13) (
n,,i,t4,t5,t1,t2,t3,uw,uu,b12,b13);
i := i + 1;
n := n + 1;
end if;
close c;
end loop;
end if;
end loop;
close vb;
;
when then
null;
;
.('Error at: '||b2||','||());
end;
/* t.*from . t
order by 2,(t.a1)*/