⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unityarnlslook.~pas

📁 纺织类 纤维强力测试中蠕变性能测试源码
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
unit UnitYarnlslook;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, TeEngine, Series, TeeProcs,
  Chart, ComCtrls, StdCtrls, DB, ADODB, DbChart, QRTEE, QuickRpt, ActnList,
  Buttons;

type
  TFormyarnLSlook = class(TForm)
    StatusBar1: TStatusBar;
    Panel1: TPanel;
    DBNavigator1: TDBNavigator;
    DBGrid2: TDBGrid;
    DBGrid3: TDBGrid;
    Panel2: TPanel;
    Chart1: TChart;
    dgls: TFastLineSeries;
    DBNavigator2: TDBNavigator;
    Splitter1: TSplitter;
    Button1: TButton;
    Button2: TButton;
    DataSource2: TDataSource;
    DataSource3: TDataSource;
    ADOTable3: TADOTable;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    ADOQuery1: TADOQuery;
    ADOQuery2: TADOQuery;
    ActionList1: TActionList;
    Action1: TAction;
    Action2: TAction;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Chart2: TChart;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    Chart4: TChart;
    Chart5: TChart;
    bar1: TBarSeries;
    bar2: TBarSeries;
    Chart3: TChart;
    testP: TPointSeries;
    BitBtn1: TBitBtn;
    ComboBox1: TComboBox;
    Label1: TLabel;
    RadioGroup1: TRadioGroup;
    Label2: TLabel;
    Label3: TLabel;
    Label5: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure DataSourceFLRECDataChange(Sender: TObject; Field: TField);
    procedure DataSourceFLTOPDataChange(Sender: TObject; Field: TField);
    procedure Action1Execute(Sender: TObject);
    procedure Action2Execute(Sender: TObject);
    procedure DataSource2DataChange(Sender: TObject; Field: TField);
    procedure FormShow(Sender: TObject);
    procedure ADOQuery1AfterScroll(DataSet: TDataSet);
    procedure BitBtn1Click(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure Chart2DblClick(Sender: TObject);
    procedure Chart3DblClick(Sender: TObject);
    procedure Chart4DblClick(Sender: TObject);
    procedure Chart5DblClick(Sender: TObject);
    procedure Chart1DblClick(Sender: TObject);
    procedure Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure CopySeries(DestChart: TChart; SourceChart:TChart;
                                  AOwner:TComponent);
  end;

  type
  dd=record
   x:real;
   y:real;
   end;

var
  FormyarnLSlook: TFormyarnLSlook;
  Series: TFastLineSeries;

implementation

uses ComObj, UnityarnRP, DataYarn, UnitPrint, UnitLarge;

{$R *.dfm}

procedure TFormyarnLSlook.Button1Click(Sender: TObject);
var
 excelApp:variant;
 ss:string;
 t:integer;
begin

 excelapp:=CreateOleObject( 'Excel.Application' );
 ExcelApp.Visible := True;
 ExcelApp.Caption := '多功能强力仪数据';
 ExcelApp.WorkBooks.Add;
// ExcelApp.WorkSheets[1].Activate;
 ExcelApp.Cells[1,5].Value := '纱线蠕变试验报告';
 ExcelApp.Cells[2,1].Value := '使用仪器: 纺织用多功能能强力仪';
 //ADOquery1.Open;
// ss:='测试日期:  '+datetostr(ADOquery1['TestDate']);
 ss:=ss+ '测试时间:'+ADOquery1['Testtime'];
 ExcelApp.Cells[2,6].Value :=ss;
 ss:='纱线品种: ' +ADOquery1['SampleName'];
 ExcelApp.Cells[3,1].Value :=ss;
 ss:='试验次数: ' +inttostr(ADOquery1['Tnum']);
 ExcelApp.Cells[3,4].Value :=ss;
  ss:='试样长度(mm): ' +floattostr(ADOquery1['Gauge']);
 ExcelApp.Cells[4,1].Value :=ss;
   ss:='拉伸速度(mm/min): ' +floattostr(ADOquery1['Espeed']);
 ExcelApp.Cells[4,3].Value :=ss;
   ss:='纱线细度: ' +floattostr(ADOquery1['Tex']);

 ExcelApp.Cells[5,1].Value :=ss;
   ss:='预加张力(N): ' +floattostr(ADOquery1['Preforce']);
 ExcelApp.Cells[5,3].Value :=ss;
   ss:='温度(℃): ' +inttostr(ADOquery1['Tp']);
 ExcelApp.Cells[6,1].Value :=ss;
   ss:='相对湿度: ' +inttostr(ADOquery1['Rh']);
 ExcelApp.Cells[6,3].Value :=ss;
   ss:='检测者: ' +ADOquery1['Optioner'];
 ExcelApp.Cells[6,5].Value :=ss;

 ExcelApp.Cells[8,2].Value :='断裂强力';
 ExcelApp.Cells[8,3].Value :='断裂伸长';
 ExcelApp.Cells[8,4].Value :='断裂伸长率';
 ExcelApp.Cells[8,5].Value :='断裂强度';
 ExcelApp.Cells[8,6].Value :='屈服点应力';
 ExcelApp.Cells[8,7].Value :='屈服点应变';
 ExcelApp.Cells[8,8].Value :='断裂功';
 ExcelApp.Cells[8,9].Value :='断脱强力';
 ExcelApp.Cells[8,10].Value :='断脱伸长';
 ExcelApp.Cells[8,11].Value :='断脱伸长率';
 ExcelApp.Cells[8,12].Value :='断脱强度';
 ExcelApp.Cells[8,13].Value :='断脱功';
 ExcelApp.Cells[9,1].Value :='项目';
 ExcelApp.Cells[9,2].Value :='F(N)';
 ExcelApp.Cells[9,3].Value :='L(mm)';
 ExcelApp.Cells[9,4].Value :='E(%)';
 ExcelApp.Cells[9,5].Value :='P(cN/tex)';
 ExcelApp.Cells[9,6].Value :='Pf(cN/tex)';
 ExcelApp.Cells[9,7].Value :='Pe(%)';
 ExcelApp.Cells[9,8].Value :='W(mJ)';
 ExcelApp.Cells[9,9].Value :='BF(N)';
 ExcelApp.Cells[9,10].Value :='BL(mm)';
 ExcelApp.Cells[9,11].Value :='BE(%)';
 ExcelApp.Cells[9,12].Value :='Bp(cN/tex)';
 ExcelApp.Cells[9,13].Value :='BW(mJ)';
 ExcelApp.Cells[10,1].Value :='统计值';
 ExcelApp.Cells[11,1].Value :='平均值';
 ExcelApp.Cells[12,1].Value :='最大值';
 ExcelApp.Cells[13,1].Value :='最小值';
 ExcelApp.Cells[14,1].Value :='均方差';
 ExcelApp.Cells[15,1].Value :='变异系数%';
 if ADOquery1['Fmean']<>null then
 ss:=floattostr(ADOquery1['Fmean']);
 ExcelApp.Cells[11,2].Value :=ss;
  if ADOquery1['Fmax']<>null then
 ss:=floattostr(ADOquery1['Fmax']);
 ExcelApp.Cells[12,2].Value :=ss;
  if ADOquery1['Fmin']<>null then
 ss:=floattostr(ADOquery1['Fmin']);
 ExcelApp.Cells[13,2].Value :=ss;
  if ADOquery1['Fdc']<>null then
 ss:=floattostr(ADOquery1['Fdc']);
 ExcelApp.Cells[14,2].Value :=ss;
  if ADOquery1['Fcv']<>null then
 ss:=floattostr(ADOquery1['Fcv']);
 ExcelApp.Cells[15,2].Value :=ss;

 ss:=floattostr(ADOquery1['Lmean']);
 ExcelApp.Cells[11,3].Value :=ss;
 ss:=floattostr(ADOquery1['Lmax']);
 ExcelApp.Cells[12,3].Value :=ss;
 ss:=floattostr(ADOquery1['Lmin']);
 ExcelApp.Cells[13,3].Value :=ss;
 ss:=floattostr(ADOquery1['Ldc']);
 ExcelApp.Cells[14,3].Value :=ss;
 ss:=floattostr(ADOquery1['Lcv']);
 ExcelApp.Cells[15,3].Value :=ss;

 ss:=floattostr(ADOquery1['Emean']);
 ExcelApp.Cells[11,4].Value :=ss;
 ss:=floattostr(ADOquery1['Emax']);
 ExcelApp.Cells[12,4].Value :=ss;
 ss:=floattostr(ADOquery1['Emin']);
 ExcelApp.Cells[13,4].Value :=ss;
 ss:=floattostr(ADOquery1['Edc']);
 ExcelApp.Cells[14,4].Value :=ss;
 ss:=floattostr(ADOquery1['Ecv']);
 ExcelApp.Cells[15,4].Value :=ss;
 ss:=floattostr(ADOquery1['Pmean']);
 ExcelApp.Cells[11,5].Value :=ss;
 ss:=floattostr(ADOquery1['pmax']);
 ExcelApp.Cells[12,5].Value :=ss;
 ss:=floattostr(ADOquery1['pmin']);
 ExcelApp.Cells[13,5].Value :=ss;
 ss:=floattostr(ADOquery1['pdc']);
 ExcelApp.Cells[14,5].Value :=ss;
 ss:=floattostr(ADOquery1['pcv']);
 ExcelApp.Cells[15,5].Value :=ss;

 ss:=floattostr(ADOquery1['Pfmean']);
 ExcelApp.Cells[11,6].Value :=ss;
 ss:=floattostr(ADOquery1['Pfmax']);
 ExcelApp.Cells[12,6].Value :=ss;
 ss:=floattostr(ADOquery1['Pfmin']);
 ExcelApp.Cells[13,6].Value :=ss;
 ss:=floattostr(ADOquery1['Pfdc']);
 ExcelApp.Cells[14,6].Value :=ss;
 ss:=floattostr(ADOquery1['Pfcv']);
 ExcelApp.Cells[15,6].Value :=ss;
 ss:=floattostr(ADOquery1['Pemean']);
 ExcelApp.Cells[11,7].Value :=ss;
 ss:=floattostr(ADOquery1['Pemax']);
 ExcelApp.Cells[12,7].Value :=ss;
 ss:=floattostr(ADOquery1['Pemin']);
 ExcelApp.Cells[13,7].Value :=ss;
 ss:=floattostr(ADOquery1['Pedc']);
 ExcelApp.Cells[14,7].Value :=ss;
 ss:=floattostr(ADOquery1['Pecv']);
 ExcelApp.Cells[15,7].Value :=ss;

 ss:=floattostr(ADOquery1['Wmean']);
 ExcelApp.Cells[11,8].Value :=ss;
 ss:=floattostr(ADOquery1['Wmax']);
 ExcelApp.Cells[12,8].Value :=ss;
 ss:=floattostr(ADOquery1['Wmin']);
 ExcelApp.Cells[13,8].Value :=ss;
 ss:=floattostr(ADOquery1['Wdc']);
 ExcelApp.Cells[14,8].Value :=ss;
 ss:=floattostr(ADOquery1['Wcv']);
 ExcelApp.Cells[15,8].Value :=ss;

 ss:=floattostr(ADOquery1['BFmean']);
 ExcelApp.Cells[11,9].Value :=ss;
 ss:=floattostr(ADOquery1['BFmax']);
 ExcelApp.Cells[12,9].Value :=ss;
 ss:=floattostr(ADOquery1['BFmin']);
 ExcelApp.Cells[13,9].Value :=ss;
 ss:=floattostr(ADOquery1['BFdc']);
 ExcelApp.Cells[14,9].Value :=ss;
 ss:=floattostr(ADOquery1['BFcv']);
 ExcelApp.Cells[15,9].Value :=ss;

 ss:=floattostr(ADOquery1['BLmean']);
 ExcelApp.Cells[11,10].Value :=ss;
 ss:=floattostr(ADOquery1['BLmax']);
 ExcelApp.Cells[12,10].Value :=ss;
 ss:=floattostr(ADOquery1['BLmin']);
 ExcelApp.Cells[13,10].Value :=ss;
 ss:=floattostr(ADOquery1['BLdc']);
 ExcelApp.Cells[14,10].Value :=ss;
 ss:=floattostr(ADOquery1['BLcv']);
 ExcelApp.Cells[15,10].Value :=ss;

 ss:=floattostr(ADOquery1['BEmean']);
 ExcelApp.Cells[11,11].Value :=ss;
 ss:=floattostr(ADOquery1['BEmax']);
 ExcelApp.Cells[12,11].Value :=ss;
 ss:=floattostr(ADOquery1['BEmin']);
 ExcelApp.Cells[13,11].Value :=ss;
 ss:=floattostr(ADOquery1['BEdc']);
 ExcelApp.Cells[14,11].Value :=ss;
 ss:=floattostr(ADOquery1['BEcv']);
 ExcelApp.Cells[15,11].Value :=ss;

 ss:=floattostr(ADOquery1['bPmean']);
 ExcelApp.Cells[11,12].Value :=ss;
 ss:=floattostr(ADOquery1['bPmax']);
 ExcelApp.Cells[12,12].Value :=ss;
 ss:=floattostr(ADOquery1['bPmin']);
 ExcelApp.Cells[13,12].Value :=ss;
 ss:=floattostr(ADOquery1['bPdc']);
 ExcelApp.Cells[14,12].Value :=ss;
 ss:=floattostr(ADOquery1['bPcv']);
 ExcelApp.Cells[15,12].Value :=ss;

 ss:=floattostr(ADOquery1['BWmean']);
 ExcelApp.Cells[11,13].Value :=ss;
 ss:=floattostr(ADOquery1['BWmax']);
 ExcelApp.Cells[12,13].Value :=ss;
 ss:=floattostr(ADOquery1['BWmin']);
 ExcelApp.Cells[13,13].Value :=ss;
 ss:=floattostr(ADOquery1['BWdc']);
 ExcelApp.Cells[14,13].Value :=ss;
 ss:=floattostr(ADOquery1['BWcv']);
 ExcelApp.Cells[15,13].Value :=ss;


 ExcelApp.Cells[17,1].Value :='序号';
 adoquery2.First;
 t:=18;
 repeat
  ExcelApp.Cells[t,1].Value :=floattostr(ADOquery2['serial']);
  ExcelApp.Cells[t,2].Value :=floattostr(ADOquery2['fn']);
  ExcelApp.Cells[t,3].Value :=floattostr(ADOquery2['lmm']);
  ExcelApp.Cells[t,4].Value :=floattostr(ADOquery2['emm']);
  ExcelApp.Cells[t,5].Value :=floattostr(ADOquery2['p']);
  ExcelApp.Cells[t,6].Value :=floattostr(ADOquery2['pf']);
  ExcelApp.Cells[t,7].Value :=floattostr(ADOquery2['pe']);
  ExcelApp.Cells[t,8].Value :=floattostr(ADOquery2['wk']);
  ExcelApp.Cells[t,9].Value :=floattostr(ADOquery2['bf']);
  ExcelApp.Cells[t,10].Value :=floattostr(ADOquery2['bl']);
  ExcelApp.Cells[t,11].Value :=floattostr(ADOquery2['be']);
  ExcelApp.Cells[t,12].Value :=floattostr(ADOquery2['bp']);
  ExcelApp.Cells[t,13].Value :=floattostr(ADOquery2['bw']);
  t:=t+1;
  adoquery2.Next;
 until
  adoquery2.Eof;
  adoquery2.First;
end;


procedure TFormyarnLSlook.CopySeries(DestChart: TChart; SourceChart:TChart;
                                  AOwner:TComponent);
var
 tmpSeries: TChartSeries;
 tmpS: TChartSeriesClass;
 t: Longint;
begin
  for t := 0 to SourceChart.SeriesCount-1 do
  begin
    tmpS := TChartSeriesClass(SourceChart.Series[t].ClassType);
    tmpSeries := tmpS.Create(AOwner);
    tmpSeries.Assign(SourceChart.Series[t]);
    DestChart.AddSeries(tmpSeries);
  end;
end;
procedure TFormyarnLSlook.Button2Click(Sender: TObject);
begin
  OKRightDlg1.ShowModal;
{Application.CreateForm(TFormyanReport, FormyanReport);

 with FormyanReport do begin

  //QRChart1.Chart.Assign(Chart1);
  QRChart2.Chart.Assign(Chart2);
  //CopySeries(QRDBChart1,Chart1, self);
  CopySeries(QRDBChart2,Chart2, self);
  //QRDBChart1.Gradient.Visible := true; // Color in QuickReport Chart1
  //QRDBChart2.Gradient.Visible := true; // Color in QuickReport Chart2
  QuickRep1.Preview;
  QuickRep1.Destroy;
  end; }
end;

procedure TFormyarnLSlook.DataSourceFLRECDataChange(Sender: TObject;
  Field: TField);
var
  df:dd;
  f:file of dd;
  ss:string;
begin
{Series1.Clear;
if ADOTableFLREC['Data']<>null then
 begin
 ss:=ADOTableFLREC['Data'];
 if ss<>''  then
    begin
  assignfile(f,ss);
    reset(f);
    while not eof(F) do
      begin
      read(f,df);
      Series1.AddXY(df.x,df.y);
     end;
    closefile(f);
  end;
 end; }
end;

procedure TFormyarnLSlook.DataSourceFLTOPDataChange(Sender: TObject;
  Field: TField);
var
  df:dd;
  f:file of dd;
  ss:string;
  i,n:integer;
  series:array of TChartSeries;
begin

  {//怎么来清除chart再重新画chart2.FreeAllSeries;
  n:=ADOTableFSTOP['Tnum'];
  SetLength(Series,n);
  for i:=0 to n do
    begin
  series[i]:=Tfastlineseries.Create(chart2);
  series[i].ParentChart:=chart2;
  ss:=ADOTableFLREC['Data'];
  ADOTableFLREC.Next;
  if ss<>''  then
     begin
  assignfile(f,ss);
    reset(f);
    while not eof(F) do
      begin
      read(f,df);
      Series[i].AddXY(df.x,df.y);
      end;
     closefile(f);
    end;
    end; }
 
end;

procedure TFormyarnLSlook.Action1Execute(Sender: TObject);
var
  df:dd;
  f:file of dd;
  ss:string;
  i,n:integer;
  series:array of TChartSeries;
begin

if FormyarnLSlook.Showing=true then
begin
  chart2.RemoveAllSeries;
  n:=ADOQuery2.RecordCount;
  //showmessage(inttostr(n));
  SetLength(Series,n);
   for i:=0 to n-1 do
    begin
  series[i]:=Tfastlineseries.Create(chart2);
  series[i].ParentChart:=chart2;
    end;

for i:=0 to n-1  do
  begin
  ss:=ADOQuery2['Data'];
  if ss<>''  then
     begin
  assignfile(f,ss);
    reset(f);
    while not eof(F) do
      begin
      read(f,df);
      Series[i].AddXY(df.x,df.y);
      end;
     closefile(f);
    end;
  if  not ADOQuery2.Eof then
  ADOQuery2.Next
  else
  exit;
  end;
ADOQuery2.First;
 end;
end;

procedure TFormyarnLSlook.Action2Execute(Sender: TObject);
var
  df:dd;
  f:file of dd;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -