数据库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;

图纸号管理

<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE>图纸号管理</TITLE> </HEAD> <BODY bgcolor="#FFFFFF"> <center> <h2>图纸号管理</h2></center> mode:mscdwg1 <TMPL_IF NAME="DB1"> <form action="" method="post"> <input type="submit" value="Equipment Types管理へ戻る"><p> <input type="hidden" name="tmpl" value="msc261"> <input type="hidden" name="table" value="main_type1"> <input type="hidden" name="DB" value="<TMPL_VAR NAME="DB">"> <input type="hidden" name="items" value="id,name,gname_id,maker_id"> <input type="hidden" name="rm" value="modeshowall"> </form> </TMPL_IF> <TMPL_IF NAME="ENQ1"> <form action="" method="post"> <input type="submit" value="パーツ入力へ戻る"><p> <input type="hidden" name="id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="rm" value="modeenq1_parts"> </form> enq1_id=><TMPL_VAR NAME="enq1_id"> </TMPL_IF> Equipment Type=><TMPL_VAR NAME="tname">,DB=><TMPL_VAR NAME="DB"><br> <hr color="#003366"> <center> <table width=80% align="center" border=1 cellpadding=5> <tr bgcolor="#3399FF" align="center"> <th>NO</th> <th>DWG</th> <th>修正釦</th> </tr> <TMPL_LOOP NAME="this_loop"> <tr bgcolor="lightcyan" align="left"> <td><TMPL_VAR NAME="id"></td> <td><TMPL_VAR NAME="content"></td> <td> <form action="" method="post"> <input type="submit" value="修正"> <input type="hidden" name="tmpl" value="mscdwg2"> <input type="hidden" name="tname" value="<TMPL_VAR NAME="tname">"> <input type="hidden" name="id" value="<TMPL_VAR NAME="id">"> <input type="hidden" name="tid" value="<TMPL_VAR NAME="tid">"> <input type="hidden" name="DB" value="<TMPL_VAR NAME="DB">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="rm" value="modeshowdwgone"> </form> </td> </tr> </TMPL_LOOP> </table> </center> <hr color="#003366"> </BODY> </HTML>

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

<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE>图纸号项目的修改</TITLE> </HEAD> <BODY bgcolor="#FFFFFF"> <center> <h2>图纸号项目的修改</h2></center> mode:mscdwg2 <form action="" method="post"> <input type="submit" value="返回图纸号管理"><p> <input type="hidden" name="tmpl" value="mscdwg1"> <input type="hidden" name="DB" value="<TMPL_VAR NAME="DB">"> <input type="hidden" name="id" value="<TMPL_VAR NAME="tid">"> <input type="hidden" name="tname" value="<TMPL_VAR NAME="tname">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="rm" value="modeshowdwg"> </form> <TMPL_IF NAME="ENQ1"> enq1_id=><TMPL_VAR NAME="enq1_id"> </TMPL_IF> <hr color="#003366"> Equipment Type=><TMPL_VAR NAME="tname">,DB=><TMPL_VAR NAME="DB"><br> <form action="" method="post"> <table> <tr><td>NO</td><td><TMPL_VAR NAME="id"></td></tr> <input type="hidden" name="id" value="<TMPL_VAR NAME="id">"> <tr><td>name</td><td><input type=text size=100 name=content value="<TMPL_VAR NAME="content">"></td></tr> <input type="hidden" name="content" value="<TMPL_VAR NAME="content">"> </table> <input type="submit" value="入力"><p> <input type="hidden" name="tmpl" value="mscdwg3"> <input type="hidden" name="tid" value="<TMPL_VAR NAME="tid">"> <input type="hidden" name="tname" value="<TMPL_VAR NAME="tname">"> <input type="hidden" name="DB" value="<TMPL_VAR NAME="DB">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="rm" value="modedwgupdate"> </form> </BODY> </HTML>

图纸号修改确认(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

<HTML> <HEAD> <TITLE>图纸号修改的确认</TITLE> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> </HEAD> <BODY bgcolor="#FFFFFF"> <center> <h2>图纸号修改的确认</h2></center> <hr color="#003366"> mode:mscdwg3<br> <TMPL_IF NAME="ENQ1"> enq1_id=><TMPL_VAR NAME="enq1_id">, </TMPL_IF> Equipment Type=><TMPL_VAR NAME="tname">,DB=><TMPL_VAR NAME="DB"><br> <center> <table width=80% align="center" border=1 cellpadding=5> <tr bgcolor="#3399FF" align="center"> <th>NO</th> <th>Name</th> <th>終了釦</th> </tr> <tr bgcolor="lightcyan" align="left"> <td><TMPL_VAR NAME="id"></td> <td><TMPL_VAR NAME="content"></td> <td><form action="" method="post"> <input type="submit" value="終了"><p> <input type="hidden" name="tmpl" value="mscdwg1"> <input type="hidden" name="id" value="<TMPL_VAR NAME="tid">"> <input type="hidden" name="DB" value="<TMPL_VAR NAME="DB">"> <input type="hidden" name="tname" value="<TMPL_VAR NAME="tname">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="rm" value="modeshowdwg"> </form> </td> </tr> </table> </center> DO==><TMPL_VAR NAME="DO"><br> SQL==><TMPL_VAR NAME="sql"><br> <hr color="#003366"> </BODY> </HTML>
戻る