8000元的工作!只需回答一个问题!
bolly 2001-07-25 03:11:36 请说明以下程序运行的结果.
{mfdtitle.i "c+ "} /*GH69*/
define variable comp like ps_comp no-undo.
define variable level as integer no-undo.
define variable maxlevel as integer format ">>>"
label "Levels" no-undo.
/*GH69* define variable eff_date like exd_eff_date no-undo. */
/*GH69*/ define variable eff_date as date no-undo label "As of Date".
define variable parent like ps_par no-undo.
define variable parent1 like ps_par no-undo.
define variable parent2 like ps_par no-undo.
define variable skpge like mfc_logical initial no
label "New Page Each Parent" no-undo.
define variable sort_ref like mfc_logical initial no
label "Sort by Reference" no-undo.
define buffer bommstr for bom_mstr.
define variable desc1 like pt_desc1 format "x(40)" no-undo.
define variable um like pt_um no-undo.
define variable phantom like mfc_logical format "yes"
label "Ph" no-undo.
define variable iss_pol like pt_iss_pol format "/no" no-undo.
define variable record as integer extent 100 no-undo.
define variable lvl as character format "x(10)"
label "Level" no-undo.
define variable new_parent like mfc_logical.
define variable dep like xcm_dept.
define variable lines as integer.
/*H100*/ define variable op like ro_op format ">>>>>>".
/*H100*/ define variable op1 like ro_op format ">>>>>>".
/*huo*/ define variable xpts_sub_part like pts_sub_part.
define variable xpts_qty_per like pts_qty_per.
define variable cate like xcm_cate.
define variable wt like pt_net_wt.
define variable pm like pt_pm_code.
define variable cdesc like xca_desc format "x(16)".
eff_date = today.
form
parent1 colon 22
/*H100 parent2 label {t001.i} colon 49 skip (1) */
/*H100*/ parent2 label {t001.i} colon 49 skip
/*H100*/ op colon 22
/*H100*/ op1 label {t001.i} colon 49 skip (1)
eff_date colon 22 skip
maxlevel colon 22 skip
skpge colon 22 skip
sort_ref colon 22 skip
with frame a width 80 side-labels attr-space.
repeat:
/* INPUT FORM */
if parent2 = hi_char then parent2 = "".
/*H100*/ if op1 = 999999 then op1 = 0.
update parent1 parent2
/*H100*/ op op1
eff_date maxlevel skpge sort_ref with frame a.
bcdparm = "".
{mfquoter.i parent1 }
{mfquoter.i parent2 }
/*H100*/ {mfquoter.i op }
/*H100*/ {mfquoter.i op1 }
{mfquoter.i eff_date }
{mfquoter.i maxlevel }
{mfquoter.i skpge }
{mfquoter.i sort_ref }
if parent2 = "" then parent2 = hi_char.
/*H100*/ if op1 = 0 then op1 = 999999.
/* SELECT PRINTER */
{mfselbpr.i "printer" 132}
{mfphead.i}
form header
skip(1) .
/* with frame a1 page-top.
view frame a1.
*/
for each bom_mstr no-lock
/*J12T*/ where bom_fsm_type = " " /* SKIP SERVICE BOM'S */
/*J12T*/ and bom_parent >= parent1 and bom_parent <= parent2:
/*J12T* where bom_parent >= parent1 and bom_parent <= parent2: */
/*J12T* REMOVED RELIANCE ON QAD_WKFL FOR SERVICE BOM DETERMINATION ***
./*G740*/ if can-find(qad_wkfl where qad_key1 = "bom_fsm"
./*G740*/ and qad_key2 = bom_parent)
./*G740*/ then
./*G740*/ next.
.*J12T*/
assign comp = bom_parent
maxlevel = min(maxlevel,99)
level = 1.
if sort_ref then
find first ps_mstr use-index ps_parref where ps_par = comp
/*H100*/ and (ps_op >= op and ps_op <= op1)
no-lock no-error.
else
find first ps_mstr use-index ps_parcomp where ps_par = comp
/*H100*/ and (ps_op >= op and ps_op <= op1)
no-lock no-error.
if not available ps_mstr then next.
find pt_mstr no-lock where pt_part = bom_parent no-error.
assign parent = ps_par
phantom = if available pt_mstr then pt_phantom else no
new_parent = yes
wt = pt_net_wt.
/* view frame phead. */
repeat with frame ddt2 down:
/*DETAIL FORM */
form
lvl
ps_comp
cate
cdesc
pm
desc1
ps_qty_per
um
wt
phantom
ps_ps_code
ps_start
ps_end
with frame ddt2 width 200 no-attr-space no-box.
if new_parent = yes then do:
if page-size - line-counter < 7 then page.
display "PARENT" @ lvl parent @ ps_comp
pt_desc1 when (available pt_mstr) @ desc1
bom_desc when (not available pt_mstr) @ desc1
pt_pm_code when ( available pt_mstr) @ pm
pt_um when (available pt_mstr) @ um
bom_batch_um when (not available pt_mstr) @ um
phantom @ phantom.
down 1.
if available pt_mstr and pt_desc2 > "" then do:
display pt_desc2 @ desc1.
down 1.
end.
/* if available pt_mstr and pt_rev <> "" then do:
display "Rev: " + pt_rev format "X(24)" @ desc1.
down 1.
end. */
new_parent = no.
end. /* if new_parent = yes */
if not available ps_mstr then do:
repeat:
level = level - 1.
if level < 1 then leave.
find ps_mstr
where recid(ps_mstr) = record[level] no-lock no-error.
comp = ps_par.
if sort_ref then
find next ps_mstr use-index ps_parref
where ps_par = comp
/*H100*/ and (ps_op >= op and ps_op <= op1)
no-lock no-error.
else
find next ps_mstr use-index ps_parcomp
where ps_par = comp
/*H100*/ and (ps_op >= op and ps_op <= op1)
no-lock no-error.
if available ps_mstr then leave.
end.
end. /* if not available ps_mstr */
if level < 1 then leave.
if eff_date = ? or (eff_date <> ? and
(ps_start = ? or ps_start <= eff_date)
and (ps_end = ? or eff_date <= ps_end)) then do:
assign um = ""
desc1 = "Item not in inventory"
iss_pol = no
phantom = no.
wt = 0.
find pt_mstr where pt_part = ps_comp no-lock no-error.
if available pt_mstr then do:
assign um = pt_um
pm = pt_pm_code
desc1 = pt_desc1
iss_pol = pt_iss_pol
wt = pt_net_wt
phantom = pt_phantom.
end.
else do:
find bommstr no-lock
where bommstr.bom_parent = ps_comp no-error.
if available bommstr then
assign um = bommstr.bom_batch_um
desc1 = bommstr.bom_desc.
end.
cate = "".
dep = "".
cdesc = "".
find xcm_mstr where xcm_part = ps_comp no-error.
if available xcm_mstr then do :
if xcm_cate <> " " then cate = xcm_cate.
else dep = xcm_dept.
end.
if cate <> "" then do:
find xca_mstr where xca_cate = cate no-error.
if available xca_mstr then cdesc = xca_desc.
end.
record[level] = recid(ps_mstr).
lvl = "........".
lvl = substring(lvl,1,min (level - 1,9)) + string(level).
if length(lvl) > 10
then lvl = substring(lvl,length (lvl) - 9,10).
lines = 1.
if ps_rmks > "" then lines = lines + 1.
if available pt_mstr and pt_desc2 > ""
then lines = lines + 1.
if available pt_mstr and pt_rev > ""
then lines = lines + 1.
if page-size - line-counter < lines then page.
if cate <> "" then do:
display lvl ps_comp cate cdesc pm desc1 ps_qty_per
um
wt
phantom
ps_ps_code ps_start ps_end
with frame ddt2.
end.
else do:
display lvl ps_comp dep @ cate cdesc pm desc1 ps_qty_per
um wt phantom ps_ps_code ps_start ps_end
with frame ddt2.
end.
/*huo*/ /* if ps_scrp_pct <> 0
then display ps_scrp_pct with frame det2.
*/
if available pt_mstr and pt_desc2 > "" then do:
down 1.
display pt_desc2 @ desc1.
end.
/* if available pt_mstr and pt_rev <> "" then do:
down 1.
display "Rev: " + pt_rev format "X(24)" @ desc1.
end.
if length(ps_rmks) <> 0 then do:
down 1.
/* put desc2 at 22. */
display ps_rmks @ desc1.
end. */
/*hslin990713*/ find pts_det no-lock use-index pts_par
where pts_par=comp
and pts_part=ps_comp no-error.
/*hslin990710*/ if available pts_det then do:
/* down 1.*/
find xcm_mstr where xcm_part = pts_sub_part no-error.
if available xcm_mstr then cate = xcm_cate.
find xca_mstr where xca_cate = cate no-error.
if available xca_mstr then cdesc = xca_desc.
down 1.
display "Alt.: " + pts_sub_part format "x(25)" @ ps_par
cate @ cate cdesc @ cdesc
pts_qty_per format "->>>,>>9.9<<<<<<".
end.
find pts_det no-lock where pts_part =ps_comp no-error.
if available pts_det then do:
if pts_par="" then do:
/*down 1.*/
find xcm_mstr where xcm_part = pts_sub_part no-error.
if available xcm_mstr then cate = xcm_cate.
find xca_mstr where xca_cate = cate no-error.
if available xca_mstr then cdesc = xca_desc.
down 1.
display "Alt.: " + pts_sub_part format "x(25)" @ ps_par
cate @ cate cdesc @ cdesc
pts_qty_per format "->>>,>>9.9<<<<<<".
end.
end.
if level < maxlevel or maxlevel = 0 then do:
comp = ps_comp.
level = level + 1.
if sort_ref
then find first ps_mstr use-index ps_parref
where ps_par = comp
/*H100 and (ps_op >= op and ps_op <= op1) */
no-lock no-error.
else
find first ps_mstr use-index ps_parcomp
where ps_par = comp
/*H100 and (ps_op >= op and ps_op <= op1) */
no-lock no-error.
end.
else do:
if sort_ref
then find next ps_mstr use-index ps_parref
where ps_par = comp
/*H100*/ and (ps_op >= op and ps_op <= op1)
no-lock no-error.
else
find next ps_mstr use-index ps_parcomp
where ps_par = comp
/*H100*/ and (ps_op >= op and ps_op <= op1)
no-lock no-error.
end.
end. /* if eff_date = ? or ... */
else do:
if sort_ref then
find next ps_mstr use-index ps_parref where ps_par = comp
/*H100*/ and (ps_op >= op and ps_op <= op1)
no-lock no-error.
else
find next ps_mstr use-index ps_parcomp
where ps_par = comp
/*H100*/ and (ps_op >= op and ps_op <= op1)
no-lock no-error.
end.
end. /* repeat with frame det2 */
if skpge then page.
else put skip(1).
{mfrpexit.i}
end. /* for each bom_mstr */
/* REPORT TRAILER */
{mfrtrail.i}
end. /* repeat */