主机分组名/设计图名的输入程序
戻る
mscengine_data.pl,输入开始画面程序
sub mscengine_data {
    my $self = shift;
	my(%t,$template,$n,@arr,@arr1,@loop);
    # Get CGI query object
    $t{q} = $self->query();
	# データ転送
	$t{id} = $t{q}->param("id");
	$t{name} = $t{q}->param("name");
	$t{series} = $t{q}->param("series");
	# TABLEデータを取り出す
	($t{gname_id},$t{maker_id}) = $self->dbh->selectrow_array("SELECT gname_id, maker_id FROM main_type1 WHERE id = $t{id}");
	if ( $t{gname_id} ne 'NULL' ) {
		($t{gname},$t{gmemo}) = $self->dbh->selectrow_array("SELECT name, memo FROM main_name1 WHERE id = $t{gname_id}");
	}
	if ( $t{maker_id} ne 'NULL' ) {
		($t{maker},$t{makers}) = $self->dbh->selectrow_array("SELECT name, memo FROM main_maker1 WHERE id = $t{maker_id}");
	}
	# HTMLファイルに出力
	$t{html} = $t{q}->param("tmpl");
	$t{html} = $t{html} . '.htm';
    $template = $self->load_tmpl("$t{html}") || die "error loading tmpl";
	$template->param(id => $t{id});
	$template->param(gname_id => $t{gname_id});
	$template->param(maker_id => $t{maker_id});
	$template->param(gname => $t{gname});
	$template->param(gmemo => $t{gmemo});
	$template->param(maker => $t{maker});
	$template->param(makers => $t{makers});
	$template->param(name => $t{name});
	$template->param(series => $t{series});
	return $template->output;
}
1;
mscengine_data.htm,输入开始画面
主機データ入力
主機データ入力
mode:mscengine_data
id=>,主機タイプ=>,series=>
| ID | Main Ship Equipment | memo | 選択 | 
|  |  |  |  | 
| ID | Main Marine Manufacturer | memo | 選択 | 
|  |  |  |  | 
mscengine_gd_add.pl,GR/DWG管理开始画面程序
sub mscengine_gd_add {
    my $self = shift;
	my(%t,@loop,$n);
	
    # Get CGI query object
    $t{q} = $self->query();
	$t{html} = $t{q}->param("tmpl");
	$t{item} = $t{q}->param("item");
	$t{id} = $t{q}->param("id");
	$t{name} = $t{q}->param("name");
	$t{series} = $t{q}->param("series");
	# 零件表格名
	$t{ptable} = sprintf("%06d",$t{id});
	$t{ptable} = 'a' . $t{ptable};
	# 現在のGR/DWGを読む
	$t{GR} = $self->dbh->selectrow_array("SELECT $t{item} FROM main_type1 WHERE id = $t{id}");
	@{ $t{GRs} } = split(/==/,$t{GR});
	@loop = ();
	for $n ( 1 .. $#{ $t{GRs} } ) {
    	my %row = ( 
        	       id => $t{id},
        	       name => $t{name},
        	       series => $t{series},
            	   NO => $n,
            	   ptable => $t{ptable},
               	   content => $t{GRs}[$n]
              	);
    	push(@loop, \%row);
	}
	$t{html} = $t{html} . '.htm';
    $t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
	$t{template}->param(id => $t{id});
	$t{template}->param(name => $t{name});
	$t{template}->param(series => $t{series});
	$t{template}->param(GRLOOP => \@loop);
	return $t{template}->output;
}
1;
mscengine_gr.htm,GR管理画面
主機テーブルのGROUPの追加と修正
主機テーブルのGROUPの追加と修正
mode:mscengine_gr
id==>,name==>,series==>
mscengine_dwg.htm,DWG管理画面
主機テーブルのDWGの追加と修正
主機テーブルのDWGの追加と修正
mode:mscengine_dwg
id==>,name==>,series==>
mscengine_gd_add3.pl,GR/DWG追加程序
sub mscengine_gd_add3 {
    my $self = shift;
	my(%t,@loop,$n);
	
    # Get CGI query object
    $t{q} = $self->query();
    $t{id} = $t{q}->param("id");
    $t{group} = $t{q}->param("group");
	$t{html} = $t{q}->param("tmpl");
	$t{item} = $t{q}->param("item");
	$t{name} = $t{q}->param("name");
	$t{series} = $t{q}->param("series");
	if ( $t{item} eq 'GR' ) {
		$t{tmpl0} = 'mscengine_gr';
	} else {
		$t{tmpl0} = 'mscengine_dwg';
	}
	$t{html} = $t{html} . '.htm';
    $t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
	@{ $t{GRs} } = split(/\n/,$t{group});
	$t{GR} = '';
	for $n ( 0 .. $#{ $t{GRs} } ) {
		$t{GR} .= '==' . $t{GRs}[$n];
	}
	
	# 更新GR/DWG
	$t{sql} = 'UPDATE main_type1 set ' . $t{item} . ' = "';
	$t{sql} .= $t{GR} . '" where id = ' . $t{id};
	$t{DO} = $self->dbh->do($t{sql});
	$t{template}->param(id => $t{id});
	$t{template}->param(name => $t{name});
	$t{template}->param(series => $t{series});
	$t{template}->param(DO => $t{DO});
	$t{template}->param(sql => $t{sql});
	$t{template}->param(item => $t{item});
	$t{template}->param(tmpl0 => $t{tmpl0});
	return $t{template}->output;
}
1;
mscengine_gd_add3.htm,GR/DWG追加画面
主機テーブル項目追加
主機追加
mode:modeengine_gd_add3
id==>
name==>
series==>
DO==>
sql==>
item==>
tmpl0==>
mscengine_gd_add2.pl,GR/DWG修改开始程序
sub mscengine_gd_add2 {
    my $self = shift;
	my(%t,@loop,$n);
	
    # Get CGI query object
    $t{q} = $self->query();
	$t{html} = $t{q}->param("tmpl");
	$t{html} = $t{html} . '.htm';
    $t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
	$t{id} = $t{q}->param("id");
	$t{NO} = $t{q}->param("NO");
	$t{item} = $t{q}->param("item");
	$t{content} = $t{q}->param("content");
	$t{name} = $t{q}->param("name");
	$t{series} = $t{q}->param("series");
	if ( $t{item} eq 'GR' ) {
		$t{tmpl0} = 'mscengine_gr';
	} else {
		$t{tmpl0} = 'mscengine_dwg';
	}
	# 現在のGR/DWGを読む
#	$t{GR} = $self->dbh->selectrow_array("SELECT $t{item} FROM main_type1 WHERE id = $t{id}");
#	@{ $t{GRs} } = split(/==/,$t{GR});
#	@loop = ();
#	for $n ( 1 .. $#{ $t{GRs} } ) {
#		if ( $n == $t{NO} ) {
#            $t{GR1} = $t{GRs}[$n];
#		}
#	}
	$t{template}->param(id => $t{id});
	$t{template}->param(name => $t{name});
	$t{template}->param(series => $t{series});
	$t{template}->param(NO => $t{NO});
	$t{template}->param(item => $t{item});
	$t{template}->param(content => $t{content});
	$t{template}->param(tmpl0 => $t{tmpl0});
	return $t{template}->output;
}
1;
mscengine_gd_add2.htm,GR/DWG修改开始画面
主機修正
主機修正
mode:modeengine_gd_add2
id==>,name==>,series==>
mscengine_gd_add21.pl,GR/DWG修改实施程序
sub mscengine_gd_add21 {
    my $self = shift;
	my(%t,@loop,$n);
	
    # Get CGI query object
    $t{q} = $self->query();
	$t{html} = $t{q}->param("tmpl");
	$t{html} = $t{html} . '.htm';
    $t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
	$t{id} = $t{q}->param("id");
	$t{NO} = $t{q}->param("NO");
	$t{item} = $t{q}->param("item");
	$t{content} = $t{q}->param("content");
	$t{name} = $t{q}->param("name");
	$t{series} = $t{q}->param("series");
	if ( $t{item} eq 'GR' ) {
		$t{tmpl0} = 'mscengine_gr';
	} else {
		$t{tmpl0} = 'mscengine_dwg';
	}
	# 現在のGR/DWGを読む
	$t{GR} = $self->dbh->selectrow_array("SELECT $t{item} FROM main_type1 WHERE id = $t{id}");
	@{ $t{GRs} } = split(/==/,$t{GR});
	$t{GR} = '';
	for $n ( 1 .. $#{ $t{GRs} } ) {
		if ( $n == $t{NO} ) {
            $t{GR1} = $t{content};
		} else {
            $t{GR1} = $t{GRs}[$n];
		}
		$t{GR} .= '==' . $t{GR1};
	}
	# 更新GR
	$t{sql} = 'UPDATE main_type1 set ' . $t{item} . ' = "';
	$t{sql} .= $t{GR} . '" where id = ' . $t{id};
	$t{DO} = $self->dbh->do($t{sql});
	
	$t{template}->param(id => $t{id});
	$t{template}->param(name => $t{name});
	$t{template}->param(series => $t{series});
	$t{template}->param(DO => $t{DO});
	$t{template}->param(sql => $t{sql});
	$t{template}->param(item => $t{item});
	$t{template}->param(tmpl0 => $t{tmpl0});
	return $t{template}->output;
}
1;
mscengine_gd_add21.htm,GR/DWG修改实施完成画面
主機修正実施
主機修正実施
mode:modeengine_gd_add21
id==>,name==>,series==>
DO==>
sql==>
mscparts_gd.pl,GR/DWG的Parts选择开始画面程序
sub mscparts_gd {
    my $self = shift;
	my(%t,@loop,$n,@rec);
	
    # Get CGI query object
    $t{q} = $self->query();
	$t{html} = $t{q}->param("tmpl");
	$t{html} = $t{html} . '.htm';
    $t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
	$t{id} = $t{q}->param("id");
	$t{GNO} = $t{q}->param("NO");
	$t{table} = $t{q}->param("table");
	$t{item} = $t{q}->param("item");
	$t{content} = $t{q}->param("content");
	$t{name} = $t{q}->param("name");
	$t{series} = $t{q}->param("series");
	# パーツテーブルを読む
	$t{sth} = $self->dbh->prepare("SELECT id,name,code,group_id,dwg_id FROM $t{table}");
	$t{sth}->execute;
	while ( @rec = $t{sth}->fetchrow_array ) {
		$t{NO} = 'ss' . $rec[0];
    	my %row = ( 
    			 NO   => $t{NO},
				 id   => $rec[0],
				 name  => $rec[1],
				 code  => $rec[2],
				 group_id  => $rec[3],
				 dwg_id  => $rec[4]
		);
	    push(@loop, \%row);
	}
	$t{sth}->finish;
	
	if ( $t{item} eq 'GR' ) {
		$t{tmpl0} = 'mscengine_gr';
	} else {
		$t{tmpl0} = 'mscengine_dwg';
	}	
	$t{template}->param(LOOP => \@loop);
	$t{template}->param(id => $t{id});
	$t{template}->param(name => $t{name});
	$t{template}->param(series => $t{series});
	$t{template}->param(GNO => $t{GNO});
	$t{template}->param(table => $t{table});
	$t{template}->param(item => $t{item});
	$t{template}->param(tmpl0 => $t{tmpl0});
	$t{template}->param(content => $t{content});
	return $t{template}->output;
}
1;
mscparts_gd.htm,GR/DWG的Parts选择开始画面
Partsの選択
Partsの選択
mode:modeparts_gd
id=>,name=>,series=>
table=>
=>=
">
">
">
">
">
">
mscparts_gd1.pl,GR/DWG的Parts选择实施画面程序
sub mscparts_gd1 {
    my $self = shift;
	my(%t,@loop,$n,@rec);
	
    # Get CGI query object
    $t{q} = $self->query();
	$t{html} = $t{q}->param("tmpl");
	$t{item} = $t{q}->param("item");
	$t{name} = $t{q}->param("name");
	$t{series} = $t{q}->param("series");
	$t{GNO} = $t{q}->param("GNO");
	$t{html} = $t{html} . '.htm';
    $t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
	$t{id} = $t{q}->param("id");
	$t{table} = $t{q}->param("table");
	
	# パーツ数を取得
	$t{sth} = $self->dbh->prepare("SELECT id FROM $t{table}");
	$t{sth}->execute;
	$t{s} = '';
	while ( @rec = $t{sth}->fetchrow_array ) {
		$t{NO} = 'ss' . $rec[0];
		$t{s1} = $t{q}->param($t{NO});
		push(@{ $t{slist} },$t{s1});
	}
	$t{sth}->finish;
	
	if ( $t{item} eq 'GR' ) {
		$t{item1} = 'group_id';
	} else {
		$t{item1} = 'dwg_id';
	}
	# GR/DWGを書く
	for $n ( 0 .. $#{ $t{slist} } ) {
		$t{id1} = $n + 1;
		if ( $t{slist}[$n] eq 'on' ) {
			$t{sql} = 'UPDATE ' . $t{table} . ' set ' . $t{item1} . ' = "';
			$t{sql} .= $t{GNO} . '" where id = ' . $t{id1};
			$t{DO} = $self->dbh->do($t{sql});
		}
	}
	if ( $t{item} eq 'GR' ) {
		$t{tmpl0} = 'mscengine_gr';
	} else {
		$t{tmpl0} = 'mscengine_dwg';
	}	
	$t{template}->param(id => $t{id});
	$t{template}->param(item => $t{item});
	$t{template}->param(name => $t{name});
	$t{template}->param(series => $t{series});
	$t{template}->param(GNO => $t{GNO});
	$t{template}->param(DO => $t{DO});
	$t{template}->param(tmpl0 => $t{tmpl0});
	return $t{template}->output;
}
1;
mscparts_gd1.htm,GR/DWG的Parts选择实施完成画面
選択完了
選択完了
mode:modeparts_gd1
id==>,name==>,series==>
GNO==>
DO==>
戻る