MySQL操作程序十七(mscquo2.pl)

返回
[error] [client 127.0.0.1] Argument "" isn't numeric in numeric ne (!=) at ./pro/mscquo2.pl line 557 [error] [client 127.0.0.1] Argument "" isn't numeric in numeric ne (!=) at ./pro/mscquo2.pl line 591 [error] [client 127.0.0.1] Argument "" isn't numeric in numeric ne (!=) at ./pro/mscquo2.pl line 773 557:if ( $t{A1} != 0 ) { 591:if ( $t{pl1}[$n] != 0 ) { 773:if ( $t{pl1}[$n] != 0 ) { 分析: mysql> select partsid from enq1 where id = 12399; +----------+ | partsid | +----------+ | 179==3=4 | +----------+ 修改如下: 557:if ( $t{A1} ) { 591:if ( $t{pl1}[$n] ) { 773:if ( $t{pl1}[$n] ) { [error] [client 127.0.0.1] Argument "P0" isn't numeric in multiplication (*) at ./pro/mscquo2.pl line 108, <CONFIG> line 11. [error] [client 127.0.0.1] Use of uninitialized value in multiplication (*) at ./pro/mscquo2.pl line 869, <CONFIG> line 11., [error] [client 127.0.0.1] Use of uninitialized value in concatenation (.) or string at ./pro/mscquo2.pl line 882, 108: $t{ppp1} = int($t{prices}[$n]*$t{pe}[$n]/100); 869: $t{price2} = $t{pri}[$t{NO}-1]*$t{Q1}; 882: $t{line1} .= $t{pri}[$t{NO}-1] . '">' . '</td><td>'; ==>修改如下 if ( $t{price0} ne 'P0' ) { # 追加 if ( $t{pri}[$t{NO}-1] ) { $t{price2} = $t{pri}[$t{NO}-1]*$t{Q1}; } else { $t{price2} = 0; } if ($t{pri}[$t{NO}-1]) { $t{line1} .= $t{pri}[$t{NO}-1] . '">' . '</td><td>'; } else { $t{line1} .= '"0>' . '</td><td>'; }
# ORIGINid $t{ORIGIN1} = $t{q}->param("ORIGIN1"); $t{sql} = 'UPDATE quo2 set ORIGINid = "'; $t{sql} .= $t{ORIGIN1} . '" where id = '; $t{sql} .= $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql}); ==> # POKid $t{POK1} = $t{q}->param("POK1"); $t{sql} = 'UPDATE quo2 set pi_ok = "'; $t{sql} .= $t{POK1} . '" where id = '; $t{sql} .= $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql}); ==> mysql> update quo2 set pi_ok = 2 where id = 12395; Query OK, 1 row affected (0.08 sec) Rows matched: 1 Changed: 1 Warnings: 0 # ORIGIN输出 $t{sth} = $self->dbh->prepare("select id, ORIGIN from enq2_origin"); $t{sth}->execute; while (@rec = $t{sth}->fetchrow_array) { $row_ref = (); # 这个初始化非常重要! if ( $rec[0] == $t{ORIGINid} ) { $t{line1} = '<option value="' . $rec[0] . '" selected="selected">' . $rec[1] . '</option>'; } else { $t{line1} = '<option value="' . $rec[0] . '">' . $rec[1] . '</option>'; } $$row_ref{line1} = $t{line1}; push(@origin_loop, $row_ref); } $t{sth}->finish; ==> # POK输出 $t{sth} = $self->dbh->prepare("select id, PACKING1 from packing_ok"); $t{sth}->execute; while (@rec = $t{sth}->fetchrow_array) { $row_ref = (); # 这个初始化非常重要! if ( $rec[0] == $t{POKid} ) { $t{line1} = '<option value="' . $rec[0] . '" selected="selected">' . $rec[1] . '</option>'; } else { $t{line1} = '<option value="' . $rec[0] . '">' . $rec[1] . '</option>'; } $$row_ref{line1} = $t{line1}; push(@pok_loop, $row_ref); } $t{sth}->finish; $t{template}->param(ORIGIN_LOOP => \@origin_loop); ==> $t{template}->param(POK_LOOP => \@pok_loop); $t{ORIGINid} = $t{e}[2]; ==> $t{POKid} = $t{e}[18]; <select name="ORIGIN1"> <TMPL_LOOP NAME="ORIGIN_LOOP"> <TMPL_VAR NAME="line1"> </TMPL_LOOP> </select> <select name="POK1"> <TMPL_LOOP NAME="POK_LOOP"> <TMPL_VAR NAME="line1"> </TMPL_LOOP> </select> mysql> select * from packing_ok; +----+----------+ | id | PACKING1 | +----+----------+ | 1 | OK | | 2 | NG | +----+----------+ 2 rows in set (0.00 sec) c:\database\sql>mysql cookbook < packing_ok.sql -u cbuser -p Enter password: ****** packing_ok.sql DROP TABLE IF EXISTS packing_ok; CREATE TABLE packing_ok ( id INT AUTO_INCREMENT, PACKING1 varchar(20), PRIMARY KEY (id) ); INSERT INTO packing_ok (PACKING1) VALUES("OK"); INSERT INTO packing_ok (PACKING1) VALUES("NG"); mysql> ALTER TABLE quo2 ADD pi_ok INT DEFAULT 1; Query OK, 12395 rows affected (1.38 sec) Records: 12395 Duplicates: 0 Warnings: 0 mysql> show columns from quo2; +-----------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | money | int(11) | YES | | NULL | | | percent0 | int(11) | YES | | NULL | | | discount0 | int(11) | YES | | NULL | | | percent | text | YES | | NULL | | | discount | text | YES | | NULL | | | price | text | YES | | NULL | | | D_FEE | text | YES | | NULL | | | total | text | YES | | NULL | | | memo | text | YES | | NULL | | | disc0 | int(11) | YES | | NULL | | | disc | text | YES | | NULL | | | price0 | text | YES | | NULL | | | pi_ok | int(11) | YES | | 1 | | +-----------+---------+------+-----+---------+----------------+ 19 rows in set (0.05 sec) mysql> show columns from quo2; +-----------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | money | int(11) | YES | | NULL | | | percent0 | int(11) | YES | | NULL | | | discount0 | int(11) | YES | | NULL | | | percent | text | YES | | NULL | | | discount | text | YES | | NULL | | | price | text | YES | | NULL | | | D_FEE | text | YES | | NULL | | | total | text | YES | | NULL | | | memo | text | YES | | NULL | | | disc0 | int(11) | YES | | NULL | | | disc | text | YES | | NULL | | | price0 | text | YES | | NULL | | +-----------+---------+------+-----+---------+----------------+ 18 rows in set (0.14 sec)
台塑输入时,自动选择FCA==>已取消 mysql> select * from enq2_price; +----+------------------+ | id | PRICE | +----+------------------+ | 1 | EXW KOBE (OSAKA) | | 2 | EXW JAPAN | | 3 | FOB KOBE (OSAKA) | | 4 | FCA | | 5 | CFR KAOHSIUNG | | 6 | EXW CHINA | | 7 | EXW EUROPE | | 8 | EXW KOREA | +----+------------------+ 8 rows in set (0.00 sec)
[Sun Sep 12 12:12:46 2010] [error] [client 127.0.0.1] Argument "C" isn't numeric in numeric ne (!=) at ./pro/mscquo2.pl line 559, <CONFIG> line 11., referer: http://localhost/cgi-bin/msc_start.cgi [Sun Sep 12 12:12:46 2010] [error] [client 127.0.0.1] Argument "C" isn't numeric in numeric ne (!=) at ./pro/mscquo2.pl line 739, <CONFIG> line 11., 558:for $n ( 0 .. $#{ $t{pl1} } ) { 559: if ( $t{pl1}[$n] != 0 ) { $t{pl2}++; } } 738:for $n ( 0 .. $#{ $t{pl1} } ) { 739: if ( $t{pl1}[$n] != 0 ) { $t{pl2}++; } } 修改如下: $t{pl2} = 0; if ( $t{partsid} ne 'C' ) { @{ $t{pl1} } = split(/=/,$t{partsid}); for $n ( 0 .. $#{ $t{pl1} } ) { if ( $t{pl1}[$n] != 0 ) { $t{pl2}++; } } }
mscquo2.htm 新 <select name="ORIGIN1"> <TMPL_LOOP NAME="ORIGIN_LOOP"> <TMPL_VAR NAME="line1"> </TMPL_LOOP> </select> 旧 <input type="submit" value="选择"><p> <input type="hidden" name="id" value="<TMPL_VAR NAME="quo2_id">"> <input type="hidden" name="item" value="ORIGINid"> <input type="hidden" name="select" value="ORIGIN1"> <input type="hidden" name="pat" value="select1"> <input type="hidden" name="rm" value="modequo2"> </form> mscquo2.pl 增加 #---------读几个项目并更新 } elsif ( $t{pat} eq 'r_quo2' ) { # ORIGINid $t{ORIGIN1} = $t{q}->param("ORIGIN1"); #直接读即可!!! $t{sql} = 'UPDATE quo2 set ORIGINid = "'; $t{sql} .= $t{ORIGIN1} . '" where id = '; $t{sql} .= $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql}); # PRICEid $t{PRICE1} = $t{q}->param("PRICE1"); $t{sql} = 'UPDATE quo2 set PRICEid = "'; $t{sql} .= $t{PRICE1} . '" where id = '; $t{sql} .= $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql}); # PAYMENTid $t{PAYMENT1} = $t{q}->param("PAYMENT1"); $t{sql} = 'UPDATE quo2 set PAYMENTid = "'; $t{sql} .= $t{PAYMENT1} . '" where id = '; $t{sql} .= $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql}); # DELIVERY $t{content1} = $t{q}->param("content1"); $t{sql} = 'UPDATE quo2 set DELIVERY = "'; $t{sql} .= $t{content1} . '" where id = '; $t{sql} .= $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql}); # memo $t{content2} = $t{q}->param("content2"); $t{sql} = 'UPDATE quo2 set memo = "'; $t{sql} .= $t{content2} . '" where id = '; $t{sql} .= $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql}); 删除 #---------选择一个项目并更新 } elsif ( $t{pat} eq 'select1' ) { $t{select} = $t{q}->param("select"); $t{ORIGIN1} = $t{q}->param($t{select}); $t{item} = $t{q}->param("item"); $t{sql} = 'UPDATE quo2 set ' . $t{item} . ' = "'; $t{sql} .= $t{ORIGIN1} . '" where id = ' . $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql}); #---------读一个项目并更新 } elsif ( $t{pat} eq 'r_header' ) { $t{table} = $t{q}->param("table"); $t{item} = $t{q}->param("item"); $t{content} = $t{q}->param("content"); $t{sql} = 'UPDATE ' . $t{table} . ' set ' . $t{item} . ' = "'; $t{sql} .= $t{content} . '" where id = '; $t{sql} .= $t{quo2_id}; $t{DO} = $self->dbh->do($t{sql});
Argument "" isn't numeric in numeric ne (!=) at ./pro/mscquo2.pl line 505 # 取得enq1零件的长度 $$pref{A} = $t{enq1s}[7]; ($pref) = get_length($pref); sub get_length { my ($pref) = @_; my (%t,$n); @{ $t{As} } = split(/=/,$$pref{A}); $$pref{leng} = 0; if ( $t{As}[0] eq 'C' ) { return ($pref); } for $n ( 0 .. $#{ $t{As} } ) { $t{A1} = $t{As}[$n]; if ( $t{A1} != 0 ) { $$pref{leng}++; } } return ($pref); }
show_parts2:图号显示,注意图号集合从零开始(mscenq1.pl的show_parts也一样) $t{DWG1} = $t{DWGs}[$t{dwg1}-1]; if ($t{DWG1} eq 'XXXDWG') { $t{DWG1} = 'NO'; }
返回