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

📄 zfrm_autogetbidu.~pas

📁 专业的评标管理系统
💻 ~PAS
📖 第 1 页 / 共 4 页
字号:
begin
  // 更新 <定标记录表> 的中标标志为空
  zh_Update_SQL := 'update tm_autogetbid set gb_tenderflag=' + '''' + '''' ;
  zh_PublicInsDelUpdQueryP(zh_Update_SQL); //*****//
  
  // 1, 显示最终报价
  z_SelectListView1P ; //***//

  // 2, 计算评标价
  z_GetTenderPriceP ; //***//

  // 3, 更新参数表 - 评标价
  z_UpdateParamPriceP ; //***//

  // 最后设置
  BitBtn2.Enabled := True ;
  //
end;

procedure Tzfrm_AutoGetBid.BitBtn2Click(Sender: TObject);
begin
  // 计算商务分
  // 更新 <定标记录表> 的中标标志为空
  zh_Update_SQL := 'update tm_autogetbid set gb_tenderflag=' + '''' + '''' ;
  zh_PublicInsDelUpdQueryP(zh_Update_SQL); //*****//
  
  // 1, 投标报价
  z_TenderReportPriceP ; //***//

  // 计算其他分数
  z_ACountScroreP ; //***//

  // 得出,商务分
  z_TenderBusinessScoreP ; //***//

  // 刷新
  z_FlashBidListView1P ; //***//

  // 最后设置
  BitBtn3.Enabled := True ;
  z_Answer.Enabled := True ;
  z_Technology.Enabled := True ;
  z_ShowBusiness.Enabled := True ;
  //
end;

procedure Tzfrm_AutoGetBid.FormShow(Sender: TObject);
begin
  // 复位
  z_ResetP ; //***//

  // 方案列表初始化
  z_InitComboBox1P ; //***//

  // 定标记录, 投标单位 显示
  z_ShowBidUnitP ; //***//
  //
end;

procedure Tzfrm_AutoGetBid.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  // 复位
  z_ResetP ; //***//
  //
end;

procedure Tzfrm_AutoGetBid.ComboBox1Change(Sender: TObject);
begin
  //
  if Trim(ComboBox1.Text) = '' then Exit ;
  zh_Select_SQL := 'select * from tm_assessitemplan where fp_name=' + '''' + ComboBox1.Text + '''' ;
  Query2.Close;
  Query2.SQL.Clear;
  Query2.SQL.Add(zh_Select_SQL);
  Query2.Open;
  Query2.First;

  // 方案代码
  if Query2.RecordCount = 0 then Exit ;
  z_FuncParamPlanI := Query2.Fields[0].AsInteger ;
  ComboBox1.Text := Query2.Fields[1].AsString ;
  //
end;

procedure Tzfrm_AutoGetBid.ComboBox1KeyPress(Sender: TObject;
  var Key: Char);
begin
  //
  Key := #0 ;
  //
end;

procedure Tzfrm_AutoGetBid.X1Click(Sender: TObject);
begin
  // 关闭
  Close ;
  //
end;

procedure Tzfrm_AutoGetBid.z_ShowBusinessExecute(Sender: TObject);
var
  I:integer;
begin
  // 商务分明细
  z_SelectedListViewGetValuesP ; //***//
  if z_AutoGet.z_Auto_cancel = '废标' then Exit ;

  with zfrm_showBusiness do
  begin
    label1.Caption := z_AutoGet.z_Auto_ui_name ;
    label2.Caption := '总分: ' + FloatToStr(z_AutoGet.z_Auto_gb_business) ;

    zh_Select_SQL := 'select ai_name from tm_assessitem where ai_preid = 2' ;
    Query1.Close ;
    Query1.SQL.Clear ;
    Query1.SQL.Add(zh_Select_SQL) ;
    Query1.Prepare ;
    Query1.Open ;
    Query1.First ;

    StringGrid1.RowCount := Query1.RecordCount -1 ;

    for I:=0 to StringGrid1.RowCount-1 do
    begin
      StringGrid1.Rows[I].Text := Query1.FieldByName('ai_name').AsString ;
      Query1.Next ;
    end;

    // 得到,定标编号
    zh_Select_SQL := 'select al_values from tm_autogetbidlist where  g_gb_id=' + IntToStr(z_AutoGet.z_Auto_g_gb_id) + ' order by g_ai_id';
    Query4.Close;
    Query4.SQL.Clear;
    Query4.SQL.Add(zh_Select_SQL);
    Query4.Open;
    Query4.First;

    I := 0 ;
    while not Query4.Eof do
    begin
      StringGrid1.Cells[1,I] := Query4.Fields[0].AsString ;
      I := I+1 ;
      Query4.Next;
    end;
    ShowModal ;
  end; // with - end
  //
end;

procedure Tzfrm_AutoGetBid.z_AnswerExecute(Sender: TObject);
var
  temp: string; // 返回值
  s:double;
begin
  //答辩评分
  z_SelectedListViewGetValuesP ; //***//
  if z_AutoGet.z_Auto_cancel = '废标' then Exit ;

  with zfrm_answer do
  begin
    label1.Caption := z_AutoGet.z_Auto_ui_name ;
    Edit1.Text:='';
    //判断是否确认增加
    if ShowModal<>mrOk then Exit ;
    temp := Trim(Edit1.Text) ;
    if temp = '' then Exit ;
  end;

  // 应该从数据库中得到, "答辩"的项目编号为 30
  zg_ai_id := 30 ;
  // 得到 参数z值
  zh_Select_SQL := 'select s from tm_assessitemvalues where (g_fp_id=' + IntToStr(z_FuncParamPlanI) + ') and (g_ai_id = ' + IntToStr(zg_ai_id) + ')' ;
  s := z_PublicQuery4F(zh_Select_SQL) ; //***//

  if StrToFloat(temp)>s then temp := FloatToStr(s) ;

  // 更新答辩分
  zh_Update_SQL := 'update tm_autogetbid set gb_answer=' + temp + ' where g_gb_id=' + IntToStr(z_AutoGet.z_Auto_g_gb_id) ;
  zh_PublicInsDelUpdQueryP(zh_Update_SQL); //*****//

  // 计算总得分
  z_TenderCountScoreP ; //***//

  // 刷新
  z_FlashBidListView1P ; //***//

  //
end;

procedure Tzfrm_AutoGetBid.z_TechnologyExecute(Sender: TObject);
var
  temp: string;
begin
  // 技术标分数
  //答辩评分
  z_SelectedListViewGetValuesP ; //***//
  if z_AutoGet.z_Auto_cancel = '废标' then Exit ;

  with zfrm_ExportCount do
  begin
    label1.Caption := z_AutoGet.z_Auto_ui_name ;
    Edit1.Text:='';
    //判断是否确认增加
    if ShowModal<>mrOk then Exit ;
    temp := Trim(Edit1.Text) ;
    if temp = '' then Exit ;
  end;

  z_ExportCount := StrToInt(temp) ;
  if z_ExportCount<=0 then Exit ;

  if z_ExportCount>11 then
  begin
    // 数据库错
    Application.MessageBox(
      '请输入不大于10的正数数字',
      '输入错误',
       MB_OK+MB_ICONError);
    Exit ;
    //
  end;

  z_ExportScoreD := 0 ;
  with zfrm_gettechno do
  begin
    label1.Caption := z_AutoGet.z_Auto_ui_name ;
    //判断是否确认增加
    if ShowModal<>mrOk then Exit ;
    if z_ExportScoreD = 0 then Exit ;
  end;

  // 更新 <定标记录表> 的技术总分
  zh_Update_SQL := 'update tm_autogetbid set gb_technoscore=' + FloatToStr(z_ExportScoreD) + ' where g_gb_id=' + IntToStr(z_AutoGet.z_Auto_g_gb_id) ;
  zh_PublicInsDelUpdQueryP(zh_Update_SQL); //*****//

  // 计算总得分
  z_TenderCountScoreP ; //***//

  // 刷新
  z_FlashBidListView1P ; //***//
  //
end;

procedure Tzfrm_AutoGetBid.BitBtn3Click(Sender: TObject);
var
  I,J: integer;
  temp1,temp2:double;
begin
  // 自动定标
  temp1 := 0 ;
  z_CanAutoGetTenderFlag := False ;
  J := ListView1.Items.Count-1 ;
  for I:=0 to J do
  begin
    // 得到 ListView1 中值
    if ListView1.Items.Item[I].SubItems[6] = '废标' then continue ;
    if ListView1.Items.Item[I].SubItems[2] = '' then   // 总分数
    begin
      z_CanAutoGetTenderFlag := True ;
      break;
    end
  end;

  if z_CanAutoGetTenderFlag then
  begin
    Application.MessageBox(
        '有效标的总分不能为空',
        '总分为空',
        MB_OK+MB_ICONError) ;
    Exit ;
  end;

  // 定标

  // 更新 <定标记录表> 的中标标志为空
  zh_Update_SQL := 'update tm_autogetbid set gb_tenderflag=' + '''' + '''' ;
  zh_PublicInsDelUpdQueryP(zh_Update_SQL); //*****//

  case ComboBox2.ItemIndex of
    0: // 最高分中标
    begin
      zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_sumscore desc' ;
      try  {try <1> S}
        Query4.Close ;
        Query4.SQL.Clear ;
        Query4.SQL.Add(zh_Select_SQL) ;
        Query4.Prepare ;
        Query4.Open ;
        Query4.First ;
      except
          // 数据库错
        Application.MessageBox(
          '数据库连接错误,请您检查或系统管理员联系',
          '数据库错',
          MB_OK+MB_ICONError) ;
          Exit ;
      end; {try <1> E}
      // 更新 <定标记录表> 的中标标志为中标
      zh_Update_SQL := 'update tm_autogetbid set gb_tenderflag=' + '''' + '●' + '''' + ' where g_gb_id=' + Query4.Fields[0].AsString;
      zh_PublicInsDelUpdQueryP(zh_Update_SQL); //*****//

      // 降序
      zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_sumscore desc' ;
      z_ResetListView1P(zh_Select_SQL) ; //***//
    end;
    1: // 自动推荐—前两名
    begin
      zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_sumscore desc' ;
      try  {try <1> S}
        Query4.Close ;
        Query4.SQL.Clear ;
        Query4.SQL.Add(zh_Select_SQL) ;
        Query4.Prepare ;
        Query4.Open ;
        Query4.First ;
      except
          // 数据库错
        Application.MessageBox(
          '数据库连接错误,请您检查或系统管理员联系',
          '数据库错',
          MB_OK+MB_ICONError) ;
          Exit ;
      end; {try <1> E}
      // 更新 <定标记录表> 的中标标志为中标
      for I:=1 to 2 do
      begin
        if I=1 then temp1 := Query4.FieldByName('gb_sumscore').AsInteger ;
        if I=2 then
        begin
          temp2 := Query4.FieldByName('gb_sumscore').AsInteger ;
          if ((temp1-temp2)>=2) and ((temp1-temp2)<=5) then
            //
          else
            Break ;   
        end;
        zh_Update_SQL := 'update tm_autogetbid set gb_tenderflag=' + '''' + '●' + '''' + ' where g_gb_id=' + Query4.Fields[0].AsString;
        zh_PublicInsDelUpdQueryP(zh_Update_SQL); //*****//
        Query4.Next ;
      end;

      // 降序
      zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_sumscore desc' ;
      z_ResetListView1P(zh_Select_SQL) ; //***//
    end;
    2: // 最低价中标
    begin
      zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_reportprice' ;
      try  {try <1> S}
        Query4.Close ;
        Query4.SQL.Clear ;
        Query4.SQL.Add(zh_Select_SQL) ;
        Query4.Prepare ;
        Query4.Open ;
        Query4.First ;
      except
          // 数据库错
        Application.MessageBox(
          '数据库连接错误,请您检查或系统管理员联系',
          '数据库错',
          MB_OK+MB_ICONError) ;
          Exit ;
      end; {try <1> E}
      // 更新 <定标记录表> 的中标标志为中标
      while not Query4.Eof do
      begin
        if Query4.Fields[9].AsInteger >=StrToFloat(Trim(Edit1.Text)) then
        begin
          zh_Update_SQL := 'update tm_autogetbid set gb_tenderflag=' + '''' + '●' + '''' + ' where g_gb_id=' + Query4.Fields[0].AsString;
          zh_PublicInsDelUpdQueryP(zh_Update_SQL); //*****//
          Break ;
        end;
        Query4.Next ;
      end;

      // 升序
      zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_reportprice' ;
      z_ResetListView1P(zh_Select_SQL) ; //***//
    end;
  end;
  //
end;

procedure Tzfrm_AutoGetBid.ListView1ColumnClick(Sender: TObject;
  Column: TListColumn);
begin
  //
  case Column.ID of
    2: // 最终报价
    begin
      if z_PriceListFlag then
      begin
        z_PriceListFlag := False ;
        // 降序
        zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_reportprice desc' ;
        z_ResetListView1P(zh_Select_SQL) ; //***//
      end
      else
      begin
        z_PriceListFlag := True ;
        // 升序
        zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_reportprice' ;
        z_ResetListView1P(zh_Select_SQL) ; //***//
      end;
    end;
    3: // 总分数
    begin
      if z_SumListFlag then
      begin
        z_SumListFlag := False ;
        // 降序
        zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_sumscore desc' ;
        z_ResetListView1P(zh_Select_SQL) ; //***//
      end
      else
      begin
        z_SumListFlag := True ;
        // 升序
        zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' + ' order by gb_sumscore' ;
        z_ResetListView1P(zh_Select_SQL) ; //***//
      end;
    end;
  end;
  //
end;

procedure Tzfrm_AutoGetBid.Image1MouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  //
  if (ssShift in Shift) and (ssCtrl in Shift) then
  begin
    // 更新 <定标记录表> 的中标标志为空
    zh_Delete_SQL := 'delete from tm_autogetbid' ;
    zh_PublicInsDelUpdQueryP(zh_Delete_SQL); //*****//
    // 数据库错
    Application.MessageBox(
      '定标数据库表清除成功',
      '数据库',
      MB_OK+MB_ICONINFORMATION) ;
  end;
  //
end;

end.

⌨️ 快捷键说明

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