📄 zfrm_gettechnou.pas
字号:
unit zfrm_gettechnoU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Grids, ExtCtrls, ComCtrls, Buttons;
type
Tzfrm_gettechno = class(TForm)
Label1: TLabel;
Button2: TButton;
Button1: TButton;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
GroupBox1: TGroupBox;
Image1: TImage;
StringGrid1: TStringGrid;
BitBtn1: TBitBtn;
StaticText1: TStaticText;
Label2: TLabel;
procedure FormShow(Sender: TObject);
procedure StringGrid1KeyPress(Sender: TObject; var Key: Char);
procedure StringGrid1SetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: String);
procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
zfrm_gettechno: Tzfrm_gettechno;
z_x:integer =1 ;
z_y:integer =1 ;
z_ExportCount:integer = 1 ; // 专家个数
z_ExportScoreD: Double; // 技术分
implementation
uses zmod_commonDateU, zfrm_AutoGetBidU, zfrm_ProjectParamU,
zmod_CommonFuncProcU;
{$R *.DFM}
procedure Tzfrm_gettechno.FormShow(Sender: TObject);
begin
//
StringGrid1.ColCount := z_ExportCount + 1 ;
StringGrid1.Rows[1].Text := '工期目标:';
StringGrid1.Rows[2].Text := '质量目标:';
StringGrid1.Rows[3].Text := '施工组织设计:';
StringGrid1.Rows[4].Text := '总计:';
StringGrid1.ColWidths[0] := 90 ;
case StringGrid1.ColCount of
2:
begin
StringGrid1.ColWidths[1] := 125 ;
end;
3:
begin
StringGrid1.ColWidths[1] := 110 ;
StringGrid1.ColWidths[2] := 110 ;
end;
4:
begin
StringGrid1.ColWidths[1] := 95 ;
StringGrid1.ColWidths[2] := 95 ;
StringGrid1.ColWidths[3] := 95 ;
end;
5:
begin
StringGrid1.ColWidths[1] := 80 ;
StringGrid1.ColWidths[2] := 80 ;
StringGrid1.ColWidths[3] := 80 ;
StringGrid1.ColWidths[4] := 80 ;
end;
6:
begin
StringGrid1.ColWidths[1] := 65 ;
StringGrid1.ColWidths[2] := 65 ;
StringGrid1.ColWidths[3] := 65 ;
StringGrid1.ColWidths[4] := 65 ;
StringGrid1.ColWidths[5] := 65 ;
end;
7:
begin
StringGrid1.ColWidths[1] := 50 ;
StringGrid1.ColWidths[2] := 50 ;
StringGrid1.ColWidths[3] := 50 ;
StringGrid1.ColWidths[4] := 50 ;
StringGrid1.ColWidths[5] := 50 ;
StringGrid1.ColWidths[6] := 50 ;
end;
end;
StringGrid1.Cols[1].Text := '专家一' ;
StringGrid1.Cols[2].Text := '专家二' ;
StringGrid1.Cols[3].Text := '专家三' ;
StringGrid1.Cols[4].Text := '专家四' ;
StringGrid1.Cols[5].Text := '专家五' ;
StringGrid1.Cols[6].Text := '专家六' ;
StringGrid1.Cols[7].Text := '专家七' ;
StringGrid1.Cols[8].Text := '专家八' ;
StringGrid1.Cols[9].Text := '专家九' ;
StringGrid1.Cols[10].Text := '专家十' ;
//StringGrid1.Cells [1,1] :='safssdfafs';
StaticText1.Caption := '0' ;
//
end;
procedure Tzfrm_gettechno.StringGrid1KeyPress(Sender: TObject;
var Key: Char);
var
Content: string;
begin
//
Content := (Sender as TStringGrid).Cells[z_x,z_y];
If Key=#8 then
begin
Exit;
end;
// 控制,输入字符长度
if length(Content)>4 then
begin
Key := #0 ;
Exit ;
end;
If Key=#46 then //小数点
begin
//控制,只能输一个小数点
If (Key=#46) and (pos('.',Content)>0) then
begin
Key := #0;
end;
Exit;
end
Else
begin
If Key in ['0'..'9'] then
begin
Exit ;
end;
end;
Key := #0 ;
//
end;
procedure Tzfrm_gettechno.StringGrid1SetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: String);
begin
// 激活 “应用”
BitBtn1.Enabled := True ;
//
end;
procedure Tzfrm_gettechno.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
//
z_x := ACol ;
z_y := ARow ;
//
end;
procedure Tzfrm_gettechno.BitBtn1Click(Sender: TObject);
var
I,J: integer;
s1,s2,s3,s:Double;
tempS: string;
z_count: integer;
z_max: Double;
z_min: Double;
begin
// 计算
BitBtn1.Enabled := False ;
// 应该从数据库中得到, "答辩"的项目编号为 30
zg_ai_id := 31 ;
// 得到 参数s值
zh_Select_SQL := 'select s from tm_assessitemvalues where (g_fp_id=' + IntToStr(z_FuncParamPlanI) + ') and (g_ai_id = ' + IntToStr(zg_ai_id) + ')' ;
s1 := zh_PublicQuery4F(zh_Select_SQL) ; //***//
// 应该从数据库中得到, "答辩"的项目编号为 30
zg_ai_id := 32 ;
// 得到 参数s值
zh_Select_SQL := 'select s from tm_assessitemvalues where (g_fp_id=' + IntToStr(z_FuncParamPlanI) + ') and (g_ai_id = ' + IntToStr(zg_ai_id) + ')' ;
s2 := zh_PublicQuery4F(zh_Select_SQL) ; //***//
// 应该从数据库中得到, "答辩"的项目编号为 30
zg_ai_id := 33 ;
// 得到 参数s值
zh_Select_SQL := 'select s from tm_assessitemvalues where (g_fp_id=' + IntToStr(z_FuncParamPlanI) + ') and (g_ai_id = ' + IntToStr(zg_ai_id) + ')' ;
s3 := zh_PublicQuery4F(zh_Select_SQL) ; //***//
//z_ExportCount
// 插入 <定标记录临时表表> 的技术分
zh_Delete_SQL := 'delete from tm_autogetbidTEMP' ;
zh_PublicInsDelUpdQueryP(zh_Delete_SQL); //*****//
// 计算一个专家总计
for J:=1 to z_ExportCount do
begin
//
s := 0 ;
for I:=1 to 3 do
begin
// 应该从数据库中得到, "答辩"的项目编号为 30
tempS := StringGrid1.Cells [J,I] ;
if tempS='' then
begin
// 数据库错
Application.MessageBox(
'输入数据不能为空',
'输入错误',
MB_OK+MB_ICONError) ;
Exit ;
end;
if I=1 then
begin
if StrToFloat(tempS)>s1 then tempS := FloatToStr(s1) ;
end;
if I=2 then
begin
if StrToFloat(tempS)>s2 then tempS := FloatToStr(s2) ;
end;
if I=3 then
begin
if StrToFloat(tempS)>s3 then tempS := FloatToStr(s3) ;
end;
StringGrid1.Cells [J,I] := tempS ;
s := s + StrToFloat(tempS) ;
//
end; // for I - end
// 插入 <定标记录临时表表> 的技术分
StringGrid1.Cells [J,4] := FloatToStr(s) ;
zh_Insert_SQL := 'insert into tm_autogetbidTEMP values(' + FloatToStr(s) + ')' ;
zh_PublicInsDelUpdQueryP(zh_Insert_SQL); //*****//
//
end; // for J - end
// 计算 技术总分
zh_Select_SQL := 'select count(at_s) from tm_autogetbidTEMP' ;
z_count := StrToInt(FloatToStr(zh_PublicQuery4F(zh_Select_SQL))) ;
if z_count<5 then
begin
// 有效标书小于5
zh_Select_SQL := 'select avg(at_s) from tm_autogetbidTEMP' ;
//
end
else
begin
// 有效标书大于5
zh_Select_SQL := 'select min(at_s) from tm_autogetbidTEMP' ;
z_min := zh_PublicQuery4F(zh_Select_SQL) ;
zh_Select_SQL := 'select max(at_s) from tm_autogetbidTEMP' ;
z_max := zh_PublicQuery4F(zh_Select_SQL) ;
zh_Select_SQL := 'select (sum(at_s)-' + FloatToStr(z_max) + '-' + FloatToStr(z_min) + ')/(' + IntToStr(z_count) + '-2) from tm_autogetbidTEMP' ;
//
end;
z_ExportScoreD := zh_PublicQuery4F(zh_Select_SQL) ;
StaticText1.Caption := Format('%2.2f',[z_ExportScoreD]) ;
//
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -