零件选择和排序的4个程序

戻る

mscenq1_parts.pl,零件输入管理程序(旧)

sub mscenq1_parts { my $self = shift; my(%t,$n,@loop1,@engine_loop,@parts_loop,%tablelist); # Get CGI query object $t{q} = $self->query(); $t{enq1_id} = $t{q}->param("id"); # HTMLファイル $t{template} = $self->load_tmpl('mscenq1_parts.htm') || die "error loading tmpl"; # time $t{time1} = $self->dbh->selectrow_array("SELECT time FROM enq1 WHERE id = $t{enq1_id}"); # ourref $t{ourref1} = $self->dbh->selectrow_array("SELECT ourref FROM enq1 WHERE id = $t{enq1_id}"); # 主機タイプ(main_type1) $t{name1id} = $self->dbh->selectrow_array("SELECT type1id FROM enq1 WHERE id = $t{enq1_id}"); @engine_loop = (); $t{NO} = 0; if ( $t{name1id} ne 'NULL' ) { @{ $t{name1id_list} } = split(/==/,$t{name1id}); for $n ( 0 .. $#{ $t{name1id_list} } ) { $t{name1id1} = $t{name1id_list}[$n]; ($t{id1},$t{name1}) = $self->dbh->selectrow_array("select id, name from main_type1 where id = $t{name1id1}"); $t{NO}++; my %row = ( enq1_id => $t{enq1_id}, NO1 => $t{NO}, name1 => $t{name1}, main_type1id => $t{id1} ); push(@engine_loop, \%row); } } # パーツテーブルを生成 if ( $t{name1id} ne 'NULL' ) { for $n ( 0 .. $#{ $t{name1id_list} } ) { $t{name1id1} = $t{name1id_list}[$n]; ($t{id1},$t{name1}) = $self->dbh->selectrow_array("select id, name from main_type1 where id = $t{name1id1}"); $t{ptable1} = sprintf("%06d",$t{id1}); $t{ptable1} = 'a' . $t{ptable1}; $tablelist{$t{name1id1}} = $t{ptable1}; my %row = ( ptable1 => $t{ptable1} ); push(@parts_loop, \%row); } } # パーツデータ処理 ($t{partsid},$t{QTY}) = $self->dbh->selectrow_array("SELECT partsid,QTY FROM enq1 WHERE id = $t{enq1_id}"); if ( $t{partsid} ) { @loop1 = (); @{ $t{partsid_list0} } = split(/==/,$t{partsid}); @{ $t{QTY_list0} } = split(/==/,$t{QTY}); $t{NO2} = 0; for $n (0 .. $#{ $t{partsid_list0} } ) { $t{name1id1} = $t{name1id_list}[$n]; $t{p_list1} = $t{partsid_list0}[$n]; $t{Q_list1} = $t{QTY_list0}[$n]; @{ $t{partsid_list} } = split(/=/,$t{p_list1}); @{ $t{QTY_list} } = split(/=/,$t{Q_list1}); $t{NO} = $n + 1; for $n1 ( 0 .. $#{ $t{partsid_list} } ) { $t{partsid1} = $t{partsid_list}[$n1]; $t{QTY1} = $t{QTY_list}[$n1]; @{ $t{parts} } = $self->dbh->selectrow_array("select name, code from $tablelist{$t{name1id1}} where id = $t{partsid1}"); $t{NO2}++; my %row = ( enq1_id => $t{enq1_id}, # 主機タイプID NO1 => $t{NO}, # 順番 NO2 => $t{NO2}, # パーツ順番 partsid => $t{partsid1}, # パーツID QTY1 => $t{QTY1}, # パーツ数量 parts_name => $t{parts}[0], # パーツ名 parts_code => $t{parts}[1] # パーツコート ); # put this row into the loop by reference push(@loop1, \%row); } } } $t{template}->param(pro => "mscenq1_parts.pl"); $t{template}->param(enq1_id => $t{enq1_id}); $t{template}->param(time1 => $t{time1}); $t{template}->param(ourref1 => $t{ourref1}); $t{template}->param(engine_loop => \@engine_loop); $t{template}->param(parts_loop => \@parts_loop); $t{template}->param(LOOP1 => \@loop1); return $t{template}->output; } 1;

mscenq1_parts.htm,零件输入管理界面(旧)

<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE>mscenq1_parts</TITLE> <style type="text/css"> body { background: white; color:black; margin-left:2em;margin-right:2em;} </style> </HEAD> <BODY bgcolor="#FFFFFF"> <center><h2>mscenq1_parts</h2></center> 目的:enq1のパーツデータ入力<br> mode:mscenq1_parts;table:enq1;Perl:<TMPL_VAR NAME="pro"> <hr color="#003366"> <!-- 主機名(main_name1) --> enq1_id==><TMPL_VAR NAME="enq1_id"><br> time1==><TMPL_VAR NAME="time1"><br> ourref1==><TMPL_VAR NAME="ourref1"><br> <TMPL_LOOP NAME="parts_loop"> ptable1==><TMPL_VAR NAME="ptable1"><br> </TMPL_LOOP> <center> <table width=80% align="center" border=1 cellpadding=5> <tr bgcolor="#3399FF" align="center"> <th width=20%>主機タイプ</th> <th width=10%>順番</th> <th width=25%>名前</th> <th width=25%>コート</th> <th width=10%>QTY</th> <th width=10%>削除釦</th> </tr> <TMPL_LOOP NAME="LOOP1"> <tr bgcolor="lightcyan" align="center"> <td><TMPL_VAR NAME="NO1"></td> <td><TMPL_VAR NAME="NO2"></td> <td><TMPL_VAR NAME="parts_name"></td> <td><TMPL_VAR NAME="parts_code"></td> <td><TMPL_VAR NAME="QTY1"></td> <td> <form action="" method="post"> <input type="submit" value="削除"><p> <input type="hidden" name="NO1" value="<TMPL_VAR NAME="NO1">"> <input type="hidden" name="partsid" value="<TMPL_VAR NAME="partsid">"> <input type="hidden" name="QTY1" value="<TMPL_VAR NAME="QTY1">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="rm" value="moded_parts"> </form> </td> </tr> </TMPL_LOOP> </table> </center> <table> <tr bgcolor="#3399FF"> <th>NO</th> <th>Engine NO</th> <th>Engine Name</th> <th>パーツ選択</th> </tr> <TMPL_LOOP NAME="ENGINE_LOOP"> <tr bgcolor="lightcyan"> <td><TMPL_VAR NAME="NO1"></td> <td><TMPL_VAR NAME="main_type1id"></td> <td><TMPL_VAR NAME="name1"></td> <td> <form action="" method="post"> <input type="submit" value="enq1_parts1"> <input type="hidden" name="NE1" value="<TMPL_VAR NAME="NO1">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="main_type1id" value="<TMPL_VAR NAME="main_type1id">"> <input type="hidden" name="name1" value="<TMPL_VAR NAME="name1">"> <input type="hidden" name="rm" value="modeenq1_parts1"> </form> </td> </tr> </TMPL_LOOP> </table> <hr color="#003366"> <form action="" method="post"> <input type="submit" value="enq1(From 船主)作成開始へ戻る"><p> <input type="hidden" name="rm" value="modeenq1_start"> </form> <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_engine"> </form> <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"> </form> </BODY> </HTML>

mscenq1_parts1.pl,零件选择开始程序(之一)

sub mscenq1_parts1 { my $self = shift; my(%t,@rec,@loop,$n); # Get CGI query object $t{q} = $self->query(); $t{NE1} = $t{q}->param("NE1"); $t{enq1_id} = $t{q}->param("enq1_id"); $t{main_type1id} = $t{q}->param("main_type1id"); $t{name1} = $t{q}->param("name1"); $t{template} = $self->load_tmpl('mscenq1_parts1.htm') || die "error loading tmpl"; # Parts table $t{ptable} = sprintf("%06d",$t{main_type1id}); $t{ptable} = 'a' . $t{ptable}; # Parts namecodeo $t{sth} = $self->dbh->prepare("SELECT id, name, code FROM $t{ptable}"); $t{sth}->execute; while ( @rec = $t{sth}->fetchrow_array ) { $t{NO} = 'ss' . $rec[0]; $t{list_NO}{$rec[2]} = $t{NO}; $t{list_id}{$rec[2]} = $rec[0]; $t{list_name}{$rec[2]} = $rec[1]; $t{list_code}{$rec[2]} = $rec[2]; } $t{sth}->finish; @loop = (); # R[g̏ for $n ( sort keys %{ $t{list_code} } ) { $t{NO} = $t{list_NO}{$n}; $t{id} = $t{list_id}{$n}; $t{name} = $t{list_name}{$n}; $t{code} = $t{list_code}{$n}; my %row = ( NO => $t{NO}, id => $t{id}, name => $t{name}, code => $n ); push(@loop, \%row); } $t{template}->param(LOOP => \@loop); $t{template}->param(NE1 => $t{NE1}); $t{template}->param(enq1_id => $t{enq1_id}); $t{template}->param(ptable => $t{ptable}); $t{template}->param(main_type1id => $t{main_type1id}); $t{template}->param(name1 => $t{name1}); $t{template}->param(pro => "mscenq1_parts1.pl"); return $t{template}->output; } 1;

mscenq1_parts1.htm,零件选择画面

<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE>enq1_parts1</TITLE> <style type="text/css"> body { background: lightcyan; color:black; margin-left:2em;margin-right:2em;} </style> </HEAD> <BODY> <center> <h2>enq1_parts1</h2></center> mode:modeenq1_parts1 <form action="" method="post"> <input type="submit" value="mscenq1_partsへ戻る"><p> <input type="hidden" name="id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="rm" value="modeenq1_parts"> </form> <hr color="#003366"> 列出属于该主机的全部Parts供挑选。<br> ptable=<TMPL_VAR NAME="ptable">;主机名=<TMPL_VAR NAME="name1"><br> enq1_id=><TMPL_VAR NAME="enq1_id"><br> pro=><TMPL_VAR NAME="pro"> <hr color="#003366"> <form action="" method="post"> <table> <tr bgcolor=white> <th>id</th> <th>name</th> <th>code</th> <th>选择</th> </tr> <TMPL_LOOP NAME="LOOP"> <tr bgcolor=cyan> <td><TMPL_VAR NAME="id"></td> <td><TMPL_VAR NAME="name"></td> <td><TMPL_VAR NAME="code"></td> <td><INPUT TYPE="checkbox" NAME="<TMPL_VAR NAME="NO">"></td> </tr> </TMPL_LOOP> </table> 注意:至少选一个!一个没有的话按上面的"mscenq1_partsへ戻る"<br> <input type="submit" value="enq1_parts2へ進む"> <input type="hidden" name="NE1" value="<TMPL_VAR NAME="NE1">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="main_type1id" value="<TMPL_VAR NAME="main_type1id">"> <input type="hidden" name="name1" value="<TMPL_VAR NAME="name1">"> <input type="hidden" name="rm" value="modeenq1_parts2"> </form> </BODY> </HTML>

mscenq1_parts2.pl,零件选择完成程序(之二)

sub mscenq1_parts2 { my $self = shift; my(%t,$n); # Get CGI query object $t{q} = $self->query(); $t{NE1} = $t{q}->param("NE1"); # 選択された主機の順番 $t{enq1_id} = $t{q}->param("enq1_id"); $t{main_type1id} = $t{q}->param("main_type1id"); $t{name1} = $t{q}->param("name1"); # Parts table名 $t{ptable} = sprintf("%06d",$t{main_type1id}); $t{ptable} = 'a' . $t{ptable}; # 選択したParts のnameとcodeを取り出す $t{sth} = $self->dbh->prepare("SELECT id, name, code FROM $t{ptable}"); $t{sth}->execute; $t{list} = ''; $t{listq} = ''; while ( @rec = $t{sth}->fetchrow_array ) { $t{NO} = 'ss' . $rec[0]; $t{s1} = $t{q}->param($t{NO}); if ( $t{s1} ) { $t{list} .= '=' . $rec[0]; $t{listq} .= '=1'; $t{list_NO}{$rec[2]} = $t{NO}; $t{list_id}{$rec[2]} = $rec[0]; $t{list_name}{$rec[2]} = $rec[1]; $t{list_code}{$rec[2]} = $rec[2]; } } $t{sth}->finish; @loop = (); # コートの順番 $t{NO1} = 0; for $n ( sort keys %{ $t{list_code} } ) { $t{NO1}++; $t{NO} = $t{list_NO}{$n}; $t{id} = $t{list_id}{$n}; $t{name} = $t{list_name}{$n}; $t{code} = $t{list_code}{$n}; my %row = ( NO => $t{NO}, NO1 => $t{NO1}, id => $t{id}, name => $t{name}, code => $n ); push(@loop, \%row); } ($t{old1},$t{old1q}) = $self->dbh->selectrow_array("SELECT partsid,QTY FROM enq1 WHERE id = $t{enq1_id}"); @{ $t{olds} } = split(/==/,$t{old1}); @{ $t{oldsq} } = split(/==/,$t{old1q}); @{ $t{news} } = (); @{ $t{newsq} } = (); $t{N1} = $t{NE1} - 1; for $n ( 0 .. $#{ $t{olds} } ) { if ( $n == $t{N1} ) { substr($t{list},0,1)=''; substr($t{listq},0,1)=''; push(@{ $t{news} },$t{list}); push(@{ $t{newsq} },$t{listq}); } else { push(@{ $t{news} },$t{olds}[$n]); push(@{ $t{newsq} },$t{oldsq}[$n]); } } $t{new1} = join('==',@{ $t{news} }); $t{new1q} = join('==',@{ $t{newsq} }); $t{sql} = 'UPDATE enq1 set partsid = "'; $t{sql} .= $t{new1} . '" where id = ' . $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{sql} = 'UPDATE enq1 set QTY = "'; $t{sql} .= $t{new1q} . '" where id = ' . $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{template} = $self->load_tmpl('mscenq1_parts2.htm') || die "error loading tmpl"; $t{template}->param(NE1 => $t{NE1}); $t{template}->param(LOOP => \@loop); $t{template}->param(sql => $t{sql}); $t{template}->param(DO => $t{DO}); $t{template}->param(list => $t{new1}); $t{template}->param(enq1_id => $t{enq1_id}); $t{template}->param(main_type1id => $t{main_type1id}); $t{template}->param(name1 => $t{name1}); $t{template}->param(pro => "mscenq1_parts2.pl"); return $t{template}->output; } 1;

mscenq1_parts2.htm,零件排序画面

<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE>enq1_parts2</TITLE> <style type="text/css"> body { background: lightcyan; color:black; margin-left:2em;margin-right:2em;} </style> </HEAD> <BODY> <center> <h2>enq1_parts2</h2></center> mode:modeenq1_parts2 <form action="" method="post"> <input type="submit" value="mscenq1_parts1へ戻る"><p> <input type="hidden" name="NE1" value="<TMPL_VAR NAME="NE1">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="main_type1id" value="<TMPL_VAR NAME="main_type1id">"> <input type="hidden" name="name1" value="<TMPL_VAR NAME="name1">"> <input type="hidden" name="rm" value="modeenq1_parts1"> </form> NE1==><TMPL_VAR NAME="NE1"><br> sql==><TMPL_VAR NAME="sql"><br> DO==><TMPL_VAR NAME="DO"><br> list==><TMPL_VAR NAME="list"><br> <hr color="#003366"> 挑选后的Parts写入DB,并列表排序。<br> 主机NO=<TMPL_VAR NAME="main_type1id">;主机名=<TMPL_VAR NAME="name1"><br> enq1_id=><TMPL_VAR NAME="enq1_id"><br> pro=><TMPL_VAR NAME="pro"> <hr color="#003366"> <table> <tr bgcolor=white> <th>id</th> <th>name</th> <th>code</th> <th>排序</th> </tr> <form action="" method="post"> <TMPL_LOOP NAME="LOOP"> <tr bgcolor=cyan> <td><TMPL_VAR NAME="id"></td> <td><TMPL_VAR NAME="name"></td> <td><TMPL_VAR NAME="code"></td> <td><input type="text" name="<TMPL_VAR NAME="NO">" value="<TMPL_VAR NAME="NO1">"></td> </tr> <input type="hidden" name="<TMPL_VAR NAME="NO">" value="<TMPL_VAR NAME="NO1">"> </TMPL_LOOP> </table> <input type="submit" value="enq1_parts3へ進む"> <input type="hidden" name="NE1" value="<TMPL_VAR NAME="NE1">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="main_type1id" value="<TMPL_VAR NAME="main_type1id">"> <input type="hidden" name="name1" value="<TMPL_VAR NAME="name1">"> <input type="hidden" name="rm" value="modeenq1_parts3"> </form> </BODY> </HTML>

mscenq1_parts3.pl(之三)

sub mscenq1_parts3 { my $self = shift; my(%t,$n,$n1,@loop0,@loop,$ref); # Get CGI query object $t{q} = $self->query(); $t{NE1} = $t{q}->param("NE1"); $t{enq1_id} = $t{q}->param("enq1_id"); $t{main_type1id} = $t{q}->param("main_type1id"); $t{name1} = $t{q}->param("name1"); # パーツデータを読む @loop0 = (); ($t{ps},$t{Qs}) = $self->dbh->selectrow_array("SELECT partsid,QTY FROM enq1 WHERE id = $t{enq1_id}"); @{ $t{pss} } = split(/==/,$t{ps}); @{ $t{Qss} } = split(/==/,$t{Qs}); $t{N1} = $t{NE1} - 1; for $n ( 0 .. $#{ $t{pss} } ) { if ( $n == $t{N1} ) { $t{partsid} = $t{pss}[$n]; $t{QTY1s} = $t{Qss}[$n]; $t{NEn} = $n; } } @{ $t{parts} } = split(/=/,$t{partsid}); @{ $t{QTY2} } = split(/=/,$t{QTY1s}); for $n ( 0 .. $#{ $t{parts} } ) { $t{NO} = 'ss' . $t{parts}[$n]; $t{list1} = $t{q}->param($t{NO}); $t{list}{$t{parts}[$n]} = $t{list1}; $t{Qlist}{$t{parts}[$n]} = $t{QTY2}[$n]; # データを転送する my %row = ( NO => $t{NO} ); push(@loop0, \%row); } # Parts table名 $t{ptable} = sprintf("%06d",$t{main_type1id}); $t{ptable} = 'a' . $t{ptable}; $t{NO} = 0; @loop = (); $t{list1} = ''; for $n ( sort { $t{list}{$a}<=>$t{list}{$b} } keys %{ $t{list} } ) { ($t{id},$t{name},$t{code}) = $self->dbh->selectrow_array("SELECT id, name, code FROM $t{ptable} WHERE id = $n"); $t{NO}++; $t{QTY} = 'QTY' . $t{id}; $t{list1} .= '=' . $t{id}; $t{QTY1} = $t{Qlist}{$t{id}}; my %row = ( QTY => $t{QTY}, QTY1 => $t{QTY1}, NO => $t{NO}, id => $t{id}, name => $t{name}, code => $t{code} ); push(@loop, \%row); } substr($t{list1},0,1) = ''; $t{pss}[$t{NEn}] = $t{list1}; $t{new1} = join("==",@{ $t{pss} }); $t{sql} = 'UPDATE enq1 set partsid = "'; $t{sql} .= $t{new1} . '" where id = ' . $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{template} = $self->load_tmpl('mscenq1_parts3.htm') || die "error loading tmpl"; $t{template}->param(LOOP0 => \@loop0); $t{template}->param(LOOP => \@loop); $t{template}->param(NE1 => $t{NE1}); $t{template}->param(sql => $t{sql}); $t{template}->param(DO => $t{DO}); $t{template}->param(partsid => $t{new1}); $t{template}->param(enq1_id => $t{enq1_id}); $t{template}->param(main_type1id => $t{main_type1id}); $t{template}->param(name1 => $t{name1}); $t{template}->param(pro => "mscenq1_parts3.pl"); return $t{template}->output; } 1;

mscenq1_part3.htm

<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE>enq1_parts3</TITLE> <style type="text/css"> body { background: lightcyan; color:black; margin-left:2em;margin-right:2em;} </style> </HEAD> <BODY> <center> <h2>enq1_parts3</h2></center> mode:modeenq1_parts3 <form action="" method="post"> <input type="submit" value="mscenq1_parts2へ戻る"><p> <!-- 这个传送很巧妙,把排序前的顺序保存下来了 --> <TMPL_LOOP NAME="LOOP0"> <input type="hidden" name="<TMPL_VAR NAME="NO">" value="1"> </TMPL_LOOP> <input type="hidden" name="NE1" value="<TMPL_VAR NAME="NE1">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="main_type1id" value="<TMPL_VAR NAME="main_type1id">"> <input type="hidden" name="name1" value="<TMPL_VAR NAME="name1">"> <input type="hidden" name="rm" value="modeenq1_parts2"> </form> <hr color="#003366"> 排序后的Parts写入DB,并输入数量。<br> 主机NO=<TMPL_VAR NAME="main_type1id">;主机名=<TMPL_VAR NAME="name1"><br> enq1_id=><TMPL_VAR NAME="enq1_id"><br> pro=><TMPL_VAR NAME="pro"><br> partsid=><TMPL_VAR NAME="partsid"><br> DO=><TMPL_VAR NAME="DO"><br> sql=><TMPL_VAR NAME="sql"><br> <hr color="#003366"> <form action="" method="post"> <table> <tr bgcolor=white> <th>顺序</th> <th>id</th> <th>name</th> <th>code</th> <th>QTY</th> </tr> <TMPL_LOOP NAME="LOOP"> <tr bgcolor=cyan> <td><TMPL_VAR NAME="NO"></td> <td><TMPL_VAR NAME="id"></td> <td><TMPL_VAR NAME="name"></td> <td><TMPL_VAR NAME="code"></td> <td><input type="text" name="<TMPL_VAR NAME="QTY">" value="<TMPL_VAR NAME="QTY1">"></td> </tr> </TMPL_LOOP> </table> <input type="submit" value="enq1_parts4へ進む"> <input type="hidden" name="NE1" value="<TMPL_VAR NAME="NE1">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="main_type1id" value="<TMPL_VAR NAME="main_type1id">"> <input type="hidden" name="name1" value="<TMPL_VAR NAME="name1">"> <input type="hidden" name="rm" value="modeenq1_parts4"> </form> </BODY> </HTML>

mscenq1_parts4.pl(之四)

sub mscenq1_parts4 { my $self = shift; my(%t,$n,@loop); # Get CGI query object $t{q} = $self->query(); $t{NE1} = $t{q}->param("NE1"); $t{enq1_id} = $t{q}->param("enq1_id"); $t{main_type1id} = $t{q}->param("main_type1id"); $t{name1} = $t{q}->param("name1"); # パーツデータを読む @loop = (); $t{list1} = ''; ($t{ps},$t{Qs}) = $self->dbh->selectrow_array("SELECT partsid,QTY FROM enq1 WHERE id = $t{enq1_id}"); @{ $t{pss} } = split(/==/,$t{ps}); @{ $t{Qss} } = split(/==/,$t{Qs}); $t{N1} = $t{NE1} - 1; for $n ( 0 .. $#{ $t{pss} } ) { if ( $n == $t{N1} ) { $t{partsid} = $t{pss}[$n]; $t{QTY1s} = $t{Qss}[$n]; $t{NEn} = $n; } } @{ $t{parts} } = split(/=/,$t{partsid}); for $n ( 0 .. $#{ $t{parts} } ) { $t{QTY} = 'QTY' . $t{parts}[$n]; $t{QTY1} = $t{q}->param($t{QTY}); # データを転送する $t{list1} .= '=' . $t{QTY1}; my %row = ( QTY => $t{QTY1} ); push(@loop, \%row); } # パーツ数量のUPDATE substr($t{list1},0,1) = ''; $t{Qss}[$t{NEn}] = $t{list1}; $t{new1} = join("==",@{ $t{Qss} }); $t{sql} = 'UPDATE enq1 set QTY = "'; $t{sql} .= $t{new1} . '" where id = ' . $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{template} = $self->load_tmpl('mscenq1_parts4.htm') || die "error loading tmpl"; $t{template}->param(sql => $t{sql}); $t{template}->param(DO => $t{DO}); $t{template}->param(LOOP => \@loop); $t{template}->param(NE1 => $t{NE1}); $t{template}->param(enq1_id => $t{enq1_id}); $t{template}->param(main_type1id => $t{main_type1id}); $t{template}->param(name1 => $t{name1}); $t{template}->param(pro => "mscenq1_parts4.pl"); return $t{template}->output; } 1;

mscenq1_parts4.htm

<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE>enq1_parts4</TITLE> <style type="text/css"> body { background: lightcyan; color:black; margin-left:2em;margin-right:2em;} </style> </HEAD> <BODY> <center> <h2>enq1_parts4</h2></center> mode:modeenq1_parts4 <form action="" method="post"> <input type="submit" value="enq1_parts3へ戻る"> <input type="hidden" name="NE1" value="<TMPL_VAR NAME="NE1">"> <input type="hidden" name="enq1_id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="main_type1id" value="<TMPL_VAR NAME="main_type1id">"> <input type="hidden" name="name1" value="<TMPL_VAR NAME="name1">"> <input type="hidden" name="rm" value="modeenq1_parts3"> </form> <hr color="#003366"> 输入数量完成。<br> 主机NO=<TMPL_VAR NAME="main_type1id">;主机名=<TMPL_VAR NAME="name1"><br> enq1_id=><TMPL_VAR NAME="enq1_id"><br> pro=><TMPL_VAR NAME="pro"> <hr color="#003366"> <TMPL_LOOP NAME="LOOP"> QTY==><TMPL_VAR NAME="QTY"><br> </TMPL_LOOP> sql==><TMPL_VAR NAME="sql"><br> DO==><TMPL_VAR NAME="DO"><br> <hr color="#003366"> <form action="" method="post"> <input type="submit" value="mscenq1_partsへ戻る"><p> <input type="hidden" name="id" value="<TMPL_VAR NAME="enq1_id">"> <input type="hidden" name="rm" value="modeenq1_parts"> </form> </BODY> </HTML>
戻る