MySQL操作程序四十八(mscs_engine.pl,主机项目检索)

返回


没有ptable,为什么要删除? # $t{sql} = 'DROP TABLE IF EXISTS ' . $t{ptable} . ';'; # $self->dbh->do($t{sql}); mysql> drop table a009291; Query OK, 0 rows affected (1.20 sec) ------------------------------------------------------- 编辑mscu_engine2.htm==>参照mscs_engine.htm copy mscenq1_parts22.htm mscu_engine2.htm 程序逻辑 1.type1id是一个的情况 a.等于'B' b.partsid不等于'C' 2.type1id是一个以上的情况 a.最后一个partsid不等于'C' ==>允许输入主机 生成不允许输入时返回用的"HTML"文件 $t{NG} = 1; # 读enq1_id ($t{type1id1},$t{partsid1}) = $self->dbh->selectrow_array("SELECT type1id, partsid FROM enq1 WHERE id = $t{enq1_id}"); @{ $t{type1ids} } = split(/==/,$t{type1id1}); @{ $t{partsids} } = split(/==/,$t{partsid1}); if ( $#{ $t{type1ids} } == 0 ) { if ( $t{type1ids}[0] eq 'B' ) { $t{NG} = 0; } else { if ( $t{partsids}[0] ne 'C' ) { $t{NG} = 0; } } } else { if ( $t{partsids}[$#{ $t{partsids} }] ne 'C' ) { $t{NG} = 0; } } if ( $t{NG} == 1 ) { $t{template} = $self->load_tmpl("mscu_engine2.htm") || die "error loading tmpl"; $t{template}->param(pro => "mscs_engine.pl"); $t{template}->param(mode => $t{mode}); # $t{template}->param(mode => $t{partsids}[$#{ $t{partsids} }]); $t{template}->param(enq1_id => $t{enq1_id}); return $t{template}->output; } 状态1,没有主机,没有零件 --------------------------------------------------------------- mysql> select * from enq1 where id = 12398\G *************************** 1. row *************************** id: 12398 time: 2012-01-16 ourref: C011601 owner: 1 ownerno: NULL hullnoid: 1 type1id: B partsid: C QTY: C memo: NULL LANGUAGEid: 1 makerid: 1 enq2s: 13948 seriesid: C tmp_pname: NULL tmp_pcode: NULL tmp_pqty: NULL 1 row in set (0.00 sec) 状态2,有一台主机,没有零件 --------------------------------------------------------------- mysql> select * from enq1 where id = 12398\G *************************** 1. row *************************** id: 12398 time: 2012-01-16 ourref: C011601 owner: 1 ownerno: NULL hullnoid: 1 type1id: 396 partsid: C QTY: C memo: NULL LANGUAGEid: 1 makerid: 1 enq2s: 13948 seriesid: 1 tmp_pname: NULL tmp_pcode: NULL tmp_pqty: NULL 1 row in set (0.00 sec) 状态3,有2台主机,没有零件 程序修改:在第一台主机的零件没有输入的情况下,不允许第二台主机的输入! --------------------------------------------------------------- mysql> select * from enq1 where id = 12398\G *************************** 1. row *************************** id: 12398 time: 2012-01-16 ourref: C011601 owner: 1 ownerno: NULL hullnoid: 1 type1id: 396==960 partsid: C==C QTY: C==C memo: NULL LANGUAGEid: 1 makerid: 1 enq2s: 13948 seriesid: 1==1 tmp_pname: NULL tmp_pcode: NULL tmp_pqty: NULL 1 row in set (0.00 sec)
返回