=head NAME:ZWZ_output_drill_table DESCRIPTION: PARAMETER: [ ] VERSION_HISTORY: V1.01 2014-01-07 Sting 1.新版本 HELP:

功能简介

钻孔表输出


参数配置

● 无

注意事项

● 无


=cut use Data::Dump 'dump'; dump('+-+-+-+-+-+-+-+++-+------1'); $GEN->PAUSE('1'); use strict; use utf8; use Encode; use Number::Format 'round'; use File::Path 'make_path'; use File::Copy; use_module('TL_GenMath'); use_module('TL_OLE_Excel'); dump('+-+-+-+-+-+-+-+++-+------2'); try{ my $EX = TL::OLE::Excel->new(); $GEN->PAUSE('2'); unless ($GEN->{STATUS}){ show_loading("孔表资料制作完成....!",0,position=>'center'); sleep(1); } else{ $GUI->msgbox(-icon=>'error',-text=>join("\n",@{$GEN->{STATUS}})); addFlowNotes(-notes=>" Genesis Error:\n ".join("\n ",@{$GEN->{STATUS}})); return 'Error'; } } catch Error::Simple with { my $error = encode("utf8",shift); $GUI->msgbox(-icon=>'error',-text=>$error); return 'Error'; } finally{ }; =head 钻孔信息写入Excel template_file=>,file=>,data=>, A 刀具 C 产品孔径 D PTH E 公差(+) F 公差(-) G 钻咀直接 N PA孔数 P 类型 Q 备注 =cut sub output_excel { my %par = @_; if(defined$par{data}){ my $template_file = $par{template_file}; my %drl_layer; #多层钻孔时数据是合在一起的 foreach my $tmp (keys %{$par{data}}){ my ($tmp_data,) = split /\-/,$tmp; if(defined($drl_layer{$tmp_data})){ next; }else{ $drl_layer{$tmp_data} = 1; } } foreach my $tmp (keys %drl_layer){ my $cam = $IKM->get_jobinfo(-jobname=>$Job,-jobid=>$JOB_ID,-jobcategory=>'work',-jobinfo=>'cam_serial_number',-withspec=>1); my $folder = 'drill'; my $path = $PAR->{Outpath}."$cam/$folder"; my $excel_file = $path.'/'.$Job.'_'."$tmp.xls"; unlink $excel_file if (-e $excel_file); if (-e $excel_file) { $GUI->msgbox(-icon=>'error',-text=>"你正打开${excel_file},请关闭${excel_file}后再运行脚本!"); return 'Error'; } copy($template_file,$excel_file); my @data = grep($_ =~ /($tmp)/,sort{$par{data}->{$a}{sequence} <=> $par{data}->{$b}{sequence}} keys %{$par{data}}); foreach my $tmp (@data){ } # my $EX = TL::OLE::Excel->new(); # my $tol_row = 2;#从第2行开始 # $EX->open_file($excel_file); # $EX->select_ws('drill_table'); # $EX->set_range_value('A'.$tol_row => 'T01'); # $EX->save(); } } } __END__