数据库DWG管理程序与界面
戻る
显示图纸号(mscshowdwg.pl)
sub mscshowdwg {
my $self = shift;
my(%t,$template,$n,@rec,@loop);
# Get CGI query object
$t{q} = $self->query();
# 访问数据库
$t{tname} = $t{q}->param("tname");
$t{id} = $t{q}->param("id");
$t{DB} = $t{q}->param("DB");
# 输出到界面HTML
$t{html} = $t{q}->param("tmpl");
$t{html} = $t{html} . '.htm';
$template = $self->load_tmpl("$t{html}") || die "error loading tmpl";
if ( $t{DB} == 1 ) { # 从数据库操作画面来
$template->param(DB1 => 1);
$template->param(ENQ1 => 0);
} else { # 从enq1输入操作画面来
$t{enq1_id} = $t{q}->param("enq1_id");
$template->param(DB1 => 0);
$template->param(ENQ1 => 1);
$template->param(enq1_id => $t{enq1_id});
}
# 读取主机的DWG
$t{DWG} = $self->dbh->selectrow_array("SELECT DWG FROM main_type1 WHERE id = $t{id}");
@loop = ();
if ( $t{DWG} ne 'NULL' ) {
@{ $t{DWGs} } = split(/=/,$t{DWG});
for $n ( 0 .. $#{ $t{DWGs} } ) {
$t{NO} = $n + 1;
my %row = (
DB => $t{DB},
tname => $t{tname},
enq1_id => $t{enq1_id}, # enq1的序号
tid => $t{id}, # 主机的序号
id => $t{NO},
content => $t{DWGs}[$n]
);
push(@loop, \%row);
}
}
$template->param(DB => $t{DB});
$template->param(tname => $t{tname});
$template->param(THIS_LOOP => \@loop);
return $template->output;
}
1;
图纸号管理
图纸号管理
图纸号管理
mode:mscdwg1
enq1_id=>
Equipment Type=>,DB=>
DWG图纸号修改(mscshowdwgone.pl)
sub mscshowdwgone {
my $self = shift;
my(%t,$n);
# Get CGI query object
$t{q} = $self->query();
$t{DB} = $t{q}->param("DB");
$t{html} = $t{q}->param("tmpl");
$t{html} = $t{html} . '.htm';
$t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
$t{tid} = $t{q}->param("tid");
$t{tname} = $t{q}->param("tname");
$t{id} = $t{q}->param("id");
# 读取主机的DWG
$t{DWG} = $self->dbh->selectrow_array("SELECT DWG FROM main_type1 WHERE id = $t{tid}");
@{ $t{DWGs} } = split(/=/,$t{DWG});
for $n ( 0 .. $#{ $t{DWGs} } ) {
$t{NO} = $n + 1;
if ( $t{NO} == $t{id} ) {
$t{content} = $t{DWGs}[$n];
last;
}
}
if ( $t{DB} == 0 ) {
$t{enq1_id} = $t{q}->param("enq1_id");
$t{template}->param(enq1_id => $t{enq1_id});
$t{template}->param(ENQ1 => 1);
}
$t{template}->param(id => $t{id});
$t{template}->param(content => $t{content});
$t{template}->param(DB => $t{DB});
$t{template}->param(tid => $t{tid});
$t{template}->param(tname => $t{tname});
return $t{template}->output;
}
1;
mscdwg2.htm
图纸号项目的修改
图纸号项目的修改
mode:mscdwg2
enq1_id=>
Equipment Type=>,DB=>
图纸号修改确认(mscdwgupdate.pl)
sub mscdwgupdate {
my $self = shift;
my(%t,$n);
# Get CGI query object
$t{q} = $self->query();
$t{DB} = $t{q}->param("DB");
$t{html} = $t{q}->param("tmpl");
$t{html} = $t{html} . '.htm';
$t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
$t{tid} = $t{q}->param("tid");
$t{tname} = $t{q}->param("tname");
$t{id} = $t{q}->param("id");
$t{content} = $t{q}->param("content");
# 读取主机的DWG
$t{DWG} = $self->dbh->selectrow_array("SELECT DWG FROM main_type1 WHERE id = $t{tid}");
@{ $t{DWGs} } = split(/=/,$t{DWG});
@{ $t{DWGnews} } = ();
for $n ( 0 .. $#{ $t{DWGs} } ) {
$t{NO} = $n + 1;
if ( $t{NO} == $t{id} ) {
push(@{ $t{DWGnews} },$t{content});
} else {
push(@{ $t{DWGnews} },$t{DWGs}[$n]);
}
}
$t{DWG} = join('=',@{ $t{DWGnews} });
$t{sql} = 'UPDATE main_type1 SET DWG ="';
$t{sql} .= $t{DWG} . '" ';
$t{sql} .= "WHERE id =" . $t{tid};
$t{update} = $self->dbh->do("$t{sql}");
for $n ( 0 .. $#arr ) {
$t{name} = $arr[$n];
$t{value} = $arr1[$n];
$t{template}->param($t{name} => $t{value});
}
$t{template}->param(DO => $t{update});
$t{template}->param(sql => $t{sql});
$t{template}->param(DB => $t{DB});
if ( $t{DB} == 0 ) {
$t{enq1_id} = $t{q}->param("enq1_id");
$t{template}->param(enq1_id => $t{enq1_id});
$t{template}->param(ENQ1 => 1);
}
$t{template}->param(id => $t{id});
$t{template}->param(content => $t{content});
$t{template}->param(tid => $t{tid});
$t{template}->param(tname => $t{tname});
return $t{template}->output;
}
1;
mscdwg3.htm
图纸号修改的确认
图纸号修改的确认
mode:mscdwg3
enq1_id=>,
Equipment Type=>,DB=>
DO==>
SQL==>
戻る