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

📄 djjcom.~pas

📁 用delphi串口技术写成的土工试验自动衡量模块
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:



  

end;

procedure TForm1.RadioButton2Click(Sender: TObject);
begin
  if label27.caption='环号' then label27.caption:='盒号';
  edit4.SetFocus;
end;

procedure TForm1.RadioButton1Click(Sender: TObject);
begin
  if label27.caption='盒号' then label27.caption:='环号';
  edit4.SetFocus;
end;


procedure TForm1.BitBtn2Click(Sender: TObject);
var g_weight:single;
begin
  g_weight:=strtofloat(trim(memo2.text));
  //检查一下数据有没搞错
  if (radioButton1.checked=true) and (g_weight<85) then
    if messagedlg('嘿嘿!土的密度这么轻啊,是不是正在称量含水量湿土重呀?',mtConfirmation, [mbYes, mbNo,mbCancel], 0) = mrYes then
    begin
      radioButton1.checked:=false;
      radioButton2.checked:=true;
    end;
  if (radioButton2.checked=true) and (g_weight>=85) then
    if messagedlg('嘿嘿!含水量湿土怎么会这么重啊,是不是正在称环刀土重呀?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    begin
      radioButton2.checked:=false;
      radioButton1.checked:=true;;
    end;

  if radioButton1.checked=true then
    memo1.Lines.add(label27.caption+':'+edit4.Text+'  '+'密度:  '+FloatTostrF(g_weight/60,ffFixed,5,3))
  else
    memo1.Lines.add(label27.caption+':'+edit4.Text+'  '+'土重:  '+FloatTostrF(g_weight,ffFixed,6,2));
  with table1 do
  if Locate('室编号;原编号',varArrayof([comboBox16.text,comboBox17.text]),[]) then
  begin
    table1.Edit;
    if radioButton1.Checked=true then  //测容重
    begin
      if (table1.FieldByName('环刀号1').value=null) or (table1.FieldByName('环刀号1').value=edit4.text) then
      begin
        table1.FieldByName('环刀号1').value:=edit4.text;
        table1.FieldByName('p_湿土1').value:=g_weight;
        table1.FieldByName('密度1').value:=g_weight/60;
      end else if (table1.FieldByName('环刀号2').value=null) or (table1.FieldByName('环刀号2').value=edit4.text) then
      begin
        table1.FieldByName('环刀号2').value:=edit4.text;
        table1.FieldByName('p_湿土2').value:=g_weight;
        table1.FieldByName('密度2').value:=g_weight/60;
      end else if (table1.FieldByName('环刀号3').value=null) or (table1.FieldByName('环刀号3').value=edit4.text) then
      begin
        table1.FieldByName('环刀号3').value:=edit4.text;
        table1.FieldByName('p_湿土3').value:=g_weight;
        table1.FieldByName('密度3').value:=g_weight/60;
      end else if (table1.FieldByName('环刀号4').value=null) or (table1.FieldByName('环刀号4').value=edit4.text) then
      begin
        table1.FieldByName('环刀号4').value:=edit4.text;
        table1.FieldByName('p_湿土4').value:=g_weight;
        table1.FieldByName('密度4').value:=g_weight/60;
      end else if (table1.FieldByName('环刀号5').value=null) or (table1.FieldByName('环刀号5').value=edit4.text) then
      begin
        table1.FieldByName('环刀号5').value:=edit4.text;
        table1.FieldByName('p_湿土5').value:=g_weight;
        table1.FieldByName('密度5').value:=g_weight/60;
      end else if (table1.FieldByName('环刀号6').value=null) or (table1.FieldByName('环刀号6').value=edit4.text) then
      begin
        table1.FieldByName('环刀号6').value:=edit4.text;
        table1.FieldByName('p_湿土6').value:=g_weight;
        table1.FieldByName('密度6').value:=g_weight/60;
      end else if (table1.FieldByName('环刀号7').value=null) or (table1.FieldByName('环刀号7').value=edit4.text) then
      begin
        table1.FieldByName('环刀号7').value:=edit4.text;
        table1.FieldByName('p_湿土7').value:=g_weight;
        table1.FieldByName('密度7').value:=g_weight/60;
      end else if (table1.FieldByName('环刀号8').value=null) or (table1.FieldByName('环刀号8').value=edit4.text) then
      begin
        table1.FieldByName('环刀号8').value:=edit4.text;
        table1.FieldByName('p_湿土8').value:=g_weight;
        table1.FieldByName('密度8').value:=g_weight/60;
      end else if (table1.FieldByName('环刀号9').value=null) or (table1.FieldByName('环刀号9').value=edit4.text) then
      begin
        table1.FieldByName('环刀号9').value:=edit4.text;
        table1.FieldByName('p_湿土9').value:=g_weight;
        table1.FieldByName('密度9').value:=g_weight/60;
      end;
      table1.Post;
    end else //含水率
    begin
      if (table1.FieldByName('铝合号1').value=null) or (table1.FieldByName('铝合号1').value=edit4.text) then
      begin
        table1.FieldByName('w_湿土1').value:=g_weight;
        table1.FieldByName('铝合号1').value:=edit4.text;
        if checkBox55.checked=true then table1.FieldByName('试验项目').value:='扰动样含水率';
      end else if (table1.FieldByName('铝合号2').value=null) or (table1.FieldByName('铝合号2').value=edit4.text)  then
      begin
        table1.FieldByName('铝合号2').value:=edit4.text;
        table1.FieldByName('w_湿土2').value:=g_weight;
        if checkBox55.checked=true then table1.FieldByName('试验项目').value:='扰动样含水率';
      end else if (table1.FieldByName('铝合号3').value=null) or (table1.FieldByName('铝合号3').value=edit4.text)  then
      begin
        table1.FieldByName('铝合号3').value:=edit4.text;
        table1.FieldByName('w_湿土3').value:=g_weight;
      end;
      table1.Post;

    end;
  end else  //插入新记录
  begin
    table1.Edit;
    table1.Insert;
    table1.FieldByName('室编号').value:=comboBox16.Text;
    table1.FieldByName('原编号').value:=comboBox17.Text;
    if radioButton1.Checked=true then  //测容重
    begin
      table1.FieldByName('环刀号1').value:=edit4.Text;
      table1.FieldByName('p_湿土1').value:=g_weight;
      table1.FieldByName('密度1').value:=g_weight/60;
    end else
    begin
      table1.FieldByName('铝合号1').value:=edit4.Text;
      table1.FieldByName('w_湿土1').value:=g_weight;
    end;
    table1.post;
  end;
  //扰动样含水率
  if checkBox55.checked=true then
  begin
    table1.close;
    table1.open;
    table1.Locate('室编号;原编号',varArrayof([comboBox16.text,comboBox17.text]),[]);
    if table1.FieldByName('铝合号2').value<>null then
    begin
      table1.next;
      combobox16.Text:=table1.fieldbyname('室编号').asstring;
      combobox17.Text:=table1.fieldbyname('原编号').asstring;
      memo1.Text:='';
      if table1.fieldbyname('铝合号1').value<>null then
        memo1.Lines.add('盒号:'+table1.fieldbyname('铝合号1').asstring+'  土重:  '+table1.fieldbyname('W_湿土1').asstring);
      if table1.fieldbyname('铝合号2').value<>null then
        memo1.Lines.add('盒号:'+table1.fieldbyname('铝合号2').asstring+'  土重:  '+table1.fieldbyname('W_湿土2').asstring);
      if table1.fieldbyname('铝合号3').value<>null then
        memo1.Lines.add('盒号:'+table1.fieldbyname('铝合号3').asstring+'  土重:  '+table1.fieldbyname('W_湿土3').asstring);
    end;
  end;
  edit4.text:='';
  edit4.SetFocus;
  BitBtn2.Enabled:=false;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  memo1.Text:='';
  memo2.Text:='';
  label31.Caption:=datetostr(date());
end;

procedure TForm1.BitBtn4Click(Sender: TObject);
  var ypzkstr,txmsstr,bhwstr,color,syxmstr:string;
begin
  panel2.Visible:=false;
  BitBtn8.Enabled:=true;
  ypzkstr:='';
  txmsstr:='';
  bhwstr:='';
  color:='';
  syxmstr:='';
  label34.Visible:=false;
  label35.Visible:=false;
  label36.Visible:=false;
  label37.Visible:=false;
  label38.Visible:=false;
  label39.Visible:=false;
  label40.Visible:=false;
  label41.Visible:=false;
  label42.Visible:=false;

  if checkBox1.checked=true then ypzkstr:='完好,';
  if checkBox2.checked=true then ypzkstr:=ypzkstr+'局部扰动,';
  if checkBox3.checked=true then ypzkstr:=ypzkstr+'严重扰动,';
  if checkBox4.checked=true then ypzkstr:=ypzkstr+'假样,';
  if checkBox5.checked=true then ypzkstr:=ypzkstr+'样品不足,';
  if checkBox6.checked=true then ypzkstr:=ypzkstr+'失水,';
  if checkBox22.checked=true then ypzkstr:=ypzkstr+'芯样,';
  if checkBox24.checked=true then ypzkstr:=ypzkstr+'受冻,';
  if checkBox25.checked=true then ypzkstr:=ypzkstr+'曝晒,';
  if checkBox26.checked=true then ypzkstr:=ypzkstr+'开裂,';
  if checkBox27.checked=true then ypzkstr:=ypzkstr+'孔洞,';
  if checkBox23.checked=true then ypzkstr:=ypzkstr+'松散';
  txmsstr:=comboBox5.text+comboBox6.text+comboBox7.text+comboBox8.text;
  if checkBox7.checked=true then bhwstr:='碎石,';
  if checkBox8.checked=true then bhwstr:=bhwstr+'植物根系,';
  if checkBox9.checked=true then bhwstr:=bhwstr+'腐殖质,';
  if checkBox10.checked=true then bhwstr:=bhwstr+'砂礓,';
  if checkBox11.checked=true then bhwstr:=bhwstr+'结核,';
  if checkBox12.checked=true then bhwstr:=bhwstr+'贝壳';
  if checkBox13.checked=true then color:='黑';
  if checkBox14.checked=true then color:=color+'灰';
  if checkBox15.checked=true then color:=color+'棕';
  if checkBox16.checked=true then color:=color+'黄';
  if checkBox17.checked=true then color:=color+'褐';
  if checkBox18.checked=true then color:=color+'青';
  if checkBox19.checked=true then color:=color+'绿';
  if checkBox20.checked=true then color:=color+'白';
  if checkBox21.checked=true then color:=color+'红';
  if checkBox28.checked=true then syxmstr:='物指,';
  if checkBox29.checked=true then syxmstr:=syxmstr+'常规,';
  if checkBox30.checked=true then syxmstr:=syxmstr+'固快,';
  if checkBox31.checked=true then syxmstr:=syxmstr+'Cv,';
  if checkBox32.checked=true then syxmstr:=syxmstr+'Pc,';
  if checkBox33.checked=true then syxmstr:=syxmstr+'UU,';
  if checkBox34.checked=true then syxmstr:=syxmstr+'CU,';
  if checkBox35.checked=true then syxmstr:=syxmstr+'qu,';
  if checkBox36.checked=true then syxmstr:=syxmstr+'K20,';
  if checkBox37.checked=true then syxmstr:=syxmstr+'K20_,';
  if checkBox38.checked=true then syxmstr:=syxmstr+'Ch,';
  if checkBox39.checked=true then syxmstr:=syxmstr+'d,';
  if checkBox40.checked=true then syxmstr:=syxmstr+'自由膨胀率,';
  if checkBox41.checked=true then syxmstr:=syxmstr+'膨胀力,';
  if checkBox42.checked=true then syxmstr:=syxmstr+'无荷载膨胀率,';
  if checkBox43.checked=true then syxmstr:=syxmstr+'胀缩总率,';
  if checkBox44.checked=true then syxmstr:=syxmstr+'有机质,';
  if checkBox45.checked=true then syxmstr:=syxmstr+'PH';
  with table1 do
  if Locate('室编号;原编号',varArrayof([comboBox16.text,comboBox17.text]),[]) then
  begin
    table1.Edit;
    table1.FieldByName('样品状况').value:=ypzkstr;
    table1.FieldByName('土性描述').value:=txmsstr;
    table1.FieldByName('包含物').value:=bhwstr;
    table1.FieldByName('颜色').value:=color;
    table1.FieldByName('气味').value:=comboBox9.text;
    table1.FieldByName('湿感').value:=comboBox10.text;
    table1.FieldByName('稠度').value:=comboBox11.text;
    table1.FieldByName('切削难度').value:=comboBox12.text;
    table1.FieldByName('均一性').value:=comboBox13.text;
    if (table1.FieldByName('环刀号6').value<>null) and (checkBox30.checked=false) then
        //判断可以有固快
        if messagedlg('有固结快剪吗吧,是不是忘记勾选啦?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then syxmstr:=syxmstr+'固快,';
    table1.FieldByName('试验项目').value:=syxmstr;
    table1.FieldByName('补充说明').value:=edit1.text;
    table1.FieldByName('开土人').value:=comboBox14.text;
    table1.FieldByName('记录人').value:=comboBox15.text;
    table1.FieldByName('开样日期').value:=date();
    table1.Post;
  end else
  begin
    table1.Edit;
    table1.Insert;
    table1.FieldByName('室编号').value:=comboBox16.text;
    table1.FieldByName('原编号').value:=comboBox17.text;
    table1.FieldByName('样品状况').value:=ypzkstr;
    table1.FieldByName('土性描述').value:=txmsstr;
    table1.FieldByName('包含物').value:=bhwstr;
    table1.FieldByName('颜色').value:=color;
    table1.FieldByName('气味').value:=comboBox9.text;
    table1.FieldByName('湿感').value:=comboBox10.text;
    table1.FieldByName('稠度').value:=comboBox11.text;
    table1.FieldByName('切削难度').value:=comboBox12.text;
    table1.FieldByName('均一性').value:=comboBox13.text;
    table1.FieldByName('试验项目').value:=syxmstr;
    table1.FieldByName('补充说明').value:=edit1.text;
    table1.FieldByName('开土人').value:=comboBox14.text;
    table1.FieldByName('记录人').value:=comboBox15.text;
    table1.FieldByName('开样日期').value:=date();
    table1.Post;
  end;
  table1.Edit;
  if checkBox46.checked=true then table1.FieldByName('环刀号1').value:=table1.FieldByName('环刀号1').value+'*'
    else if pos('*',table1.FieldByName('环刀号1').asstring)>0
      then table1.FieldByName('环刀号1').value:=copy(table1.FieldByName('环刀号1').asstring,0,strlen(Pchar(table1.FieldByName('环刀号1').asstring))-1);
  if checkBox47.checked=true then table1.FieldByName('环刀号2').value:=table1.FieldByName('环刀号2').value+'*'
    else if pos('*',table1.FieldByName('环刀号2').asstring)>0
      then table1.FieldByName('环刀号2').value:=copy(table1.FieldByName('环刀号2').asstring,0,strlen(Pchar(table1.FieldByName('环刀号2').asstring))-1);
  if checkBox48.checked=true then table1.FieldByName('环刀号3').value:=table1.FieldByName('环刀号3').value+'*'
    else if pos('*',table1.FieldByName('环刀号3').asstring)>0
      then table1.FieldByName('环刀号3').value:=copy(table1.FieldByName('环刀号3').asstring,0,strlen(Pchar(table1.FieldByName('环刀号3').asstring))-1);
  if checkBox49.checked=true then table1.FieldByName('环刀号4').value:=table1.FieldByName('环刀号4').value+'*'
    else if pos('*',table1.FieldByName('环刀号4').asstring)>0
      then table1.FieldByName('环刀号4').value:=copy(table1.FieldByName('环刀号4').asstring,0,strlen(Pchar(table1.FieldByName('环刀号4').asstring))-1);
  if checkBox50.checked=true then table1.FieldByName('环刀号5').value:=table1.FieldByName('环刀号5').value+'*'

⌨️ 快捷键说明

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