MySQL操作程序四十七(mscenq1.pl,u_engine,更新主机项目)

返回

增加seriesid项目的更新 #---------更新主机项目 } elsif ( $t{pat} eq 'u_engine' ) { $t{id1} = $t{q}->param("id2"); ($t{old1},$t{new1p},$t{new1q},$t{new1s}) = $self->dbh->selectrow_array("SELECT type1id,partsid,QTY,seriesid FROM enq1 WHERE id = $t{enq1_id}"); if ( $t{old1} eq 'B' ) { $t{new1} = $t{id1}; $t{new1p} = 'C'; $t{new1q} = 'C'; $t{new1s} = '1'; } else { @{ $t{olds} } = split(/==/,$t{old1}); $t{NG} = 0; for $n ( 0 .. $#{ $t{olds} } ) { $t{id1_test} = $t{olds}[$n]; if ( $t{id1_test} == $t{id1} ) { $t{NG} = 1; } } if ( $t{NG} == 1 ) { $t{template} = $self->load_tmpl("mscs_engine1.htm") || die "error loading tmpl"; $t{template}->param(id1 => $t{id1}); $t{template}->param(enq1_id => $t{enq1_id}); return $t{template}->output; } $t{new1} = $t{old1} . '==' . $t{id1}; # $t{new1p} .= '==1'; #取消这儿的加1 # $t{new1q} .= '==1'; $t{new1p} .= '==C'; $t{new1q} .= '==C'; $t{new1s} .= '==1'; } if ( $t{id1} != 0 ) { $t{sql} = 'UPDATE enq1 set type1id = "'; $t{sql} .= $t{new1} . '" where id = '; $t{sql} .= $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{sql} = 'UPDATE enq1 set partsid = "'; $t{sql} .= $t{new1p} . '" where id = '; $t{sql} .= $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{sql} = 'UPDATE enq1 set QTY = "'; $t{sql} .= $t{new1q} . '" where id = '; $t{sql} .= $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{sql} = 'UPDATE enq1 set seriesid = "'; $t{sql} .= $t{new1s} . '" where id = '; $t{sql} .= $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); } ------------------------------------------------------------------ #---------更新主机项目 } elsif ( $t{pat} eq 'u_engine' ) { $t{id1} = $t{q}->param("id2"); ($t{old1},$t{new1p},$t{new1q}) = $self->dbh->selectrow_array("SELECT type1id,partsid,QTY FROM enq1 WHERE id = $t{enq1_id}"); if ( $t{old1} eq 'B' ) { $t{new1} = $t{id1}; $t{new1p} = 'C'; $t{new1q} = 'C'; } else { @{ $t{olds} } = split(/==/,$t{old1}); $t{NG} = 0; for $n ( 0 .. $#{ $t{olds} } ) { $t{id1_test} = $t{olds}[$n]; if ( $t{id1_test} == $t{id1} ) { $t{NG} = 1; } } if ( $t{NG} == 1 ) { $t{template} = $self->load_tmpl("mscs_engine1.htm") || die "error loading tmpl"; $t{template}->param(id1 => $t{id1}); $t{template}->param(enq1_id => $t{enq1_id}); return $t{template}->output; } $t{new1} = $t{old1} . '==' . $t{id1}; # $t{new1p} .= '==1'; #取消这儿的加1 # $t{new1q} .= '==1'; $t{new1p} .= '==C'; $t{new1q} .= '==C'; } if ( $t{id1} != 0 ) { $t{sql} = 'UPDATE enq1 set type1id = "'; $t{sql} .= $t{new1} . '" where id = '; $t{sql} .= $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{sql} = 'UPDATE enq1 set partsid = "'; $t{sql} .= $t{new1p} . '" where id = '; $t{sql} .= $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); $t{sql} = 'UPDATE enq1 set QTY = "'; $t{sql} .= $t{new1q} . '" where id = '; $t{sql} .= $t{enq1_id}; $t{DO} = $self->dbh->do($t{sql}); }
返回