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

📄 reschildfrm.pas

📁 制造技术资源管理的一个模块
💻 PAS
📖 第 1 页 / 共 5 页
字号:
      dmRes.cdsSta2Equip.commandtext:='select * from Sta2Equip';
      dmRes.cdsSta2Equip.active:=true;
      Notebook1.pageindex:=5;
      caption:='工艺规程用工艺标准件录入窗口';
      ShowModal;
    end
    //********新建工艺规程用辅助材料**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('fuzuEquip')  then
    begin
      dmRes.cdsfuzuEquip.active:=false;
      dmRes.cdsfuzuEquip.commandtext:='select * from fuzuEquip';
      dmRes.cdsfuzuEquip.active:=true;
      Notebook1.pageindex:=21;
      caption:='工艺规程用辅助材料录入窗口';
      ShowModal;
    end
    //********新建工艺规程用金属材料**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('JincaiEquip')  then
    begin
      dmRes.cdsJincaiEquip.active:=false;
      dmRes.cdsJincaiEquip.commandtext:='select * from JincaiEquip';
      dmRes.cdsJincaiEquip.active:=true;
      Notebook1.pageindex:=22;
      caption:='工艺规程用金属材料录入窗口';
      ShowModal;
    end
    //********新建工艺规程用焊接材料**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('HJEquip')  then
    begin
      dmRes.cdsHJEquip.active:=false;
      dmRes.cdsHJEquip.commandtext:='select * from HJEquip';
      dmRes.cdsHJEquip.active:=true;
      Notebook1.pageindex:=23;
      caption:='工艺规程用焊接材料录入窗口';
      ShowModal;
    end
    //********新建通用工装**************
    else
    if (UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('GenEquipInfo'))or(UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('GenEquipInfoCOPY'))  then
    begin
      if (MainForm.UserRightType='A')then
        Button41.visible:=true
      else
        Button41.visible:=false;
      dmRes.cdsGenEquipInfo.active:=false;
      dmRes.cdsGenEquipInfo.commandtext:='select * from GenEquipInfo';
      dmRes.cdsGenEquipInfo.active:=true;
      Notebook1.pageindex:=6;
      caption:='通用工装录入窗口';
      ShowModal;
    end
    //********新建标准工具**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('StaEquipInfo')  then
    begin
      if (MainForm.UserRightType='A')then
        Button42.visible:=true
      else
        Button42.visible:=false;
      dmRes.cdsStaEquipInfo.active:=false;
      dmRes.cdsStaEquipInfo.commandtext:='select * from StaEquipInfo';
      dmRes.cdsStaEquipInfo.active:=true;
      Notebook1.pageindex:=7;
      caption:='标准工具录入窗口';
      ShowModal;
    end
    //********新建工艺标准件**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('Sta2EquipInfo')  then
    begin
      if (MainForm.UserRightType='A')then
        Button43.visible:=true
      else
        Button43.visible:=false;
      dmRes.cdsSta2EquipInfo.active:=false;
      dmRes.cdsSta2EquipInfo.commandtext:='select * from Sta2EquipInfo';
      dmRes.cdsSta2EquipInfo.active:=true;
      Notebook1.pageindex:=8;
      caption:='工艺标准件录入窗口';
      ShowModal;
    end
    //********新建机床参数**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('CG_Machine')  then
    begin
      dmRes.cdsWORKSTRU.active:=false;
      dmRes.cdsWORKSTRU.commandtext:='select * from WORKSTRU';
      dmRes.cdsWORKSTRU.active:=true;

      dmRes.cdsCG_Machine.active:=false;
      dmRes.cdsCG_Machine.commandtext:='select * from CG_Machine';
      dmRes.cdsCG_Machine.active:=true;
      Notebook1.pageindex:=9;
      caption:='机床参数录入窗口';
      ShowModal;
    end
    //********新建材料参数**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('MetalMaterialSpecs')  then
    begin
      dmRes.cdsMetalMaterialSpecs.active:=false;
      dmRes.cdsMetalMaterialSpecs.commandtext:='select * from MetalMaterialSpecs';
      dmRes.cdsMetalMaterialSpecs.active:=true;
      Notebook1.pageindex:=10;
      caption:='材料参数录入窗口';
      ShowModal;
    end
    //********新建操作指导书**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('DepartMentCriterion')  then
    begin
      dmRes.cdsDepartMentCriterion.active:=false;
      dmRes.cdsDepartMentCriterion.commandtext:='select * from DepartMentCriterion';
      dmRes.cdsDepartMentCriterion.active:=true;
      Notebook1.pageindex:=11;
      caption:='操作指导书录入窗口';
      with dmRes.cdsDepartment do
      begin
        wwDBComboBox1.Items.Clear;
        active:=false;
        commandtext:='select * from Department';
        active:=true;
        First;
        While not Eof do
        begin
         wwDBComboBox1.Items.Add(FieldByName('FSTRDEPARTMENTDESC').AsString);
         Next;
        end;
        wwDBComboBox1.ItemIndex:=-1;
      end;
      ShowModal;
    end
    //********新建基础标准**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('BasicCriterion')  then
    begin
      dmRes.cdsBasicCriterion.active:=false;
      dmRes.cdsBasicCriterion.commandtext:='select * from BasicCriterion';
      dmRes.cdsBasicCriterion.active:=true;
      Notebook1.pageindex:=12;
      caption:='基础标准录入窗口';
      ShowModal;
    end
    //********新建部门常用术语**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('TechTerm')  then
    begin
      dmRes.cdsTechTerm.active:=false;
      dmRes.cdsTechTerm.commandtext:='select * from TechTerm';
      dmRes.cdsTechTerm.active:=true;
      Notebook1.pageindex:=13;
      caption:='部门常用术语录入窗口';
      ShowModal;
    end
    //********新建工艺标准术语**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('Term')  then
    begin
      dmRes.cdsTerm.active:=false;
      dmRes.cdsTerm.commandtext:='select * from Term';
      dmRes.cdsTerm.active:=true;
      Notebook1.pageindex:=14;
      caption:='工艺标准术语录入窗口';
      ShowModal;
    end
    //********新建资料归档**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('drawingpigeonhole')  then
    begin
      dmRes.cdsdrawingpigeonhole.active:=false;
      dmRes.cdsdrawingpigeonhole.commandtext:='select * from drawingpigeonhole';
      dmRes.cdsdrawingpigeonhole.active:=true;
      Notebook1.pageindex:=15;
      caption:='资料归档录入窗口';
      ShowModal;
    end
    //********新建资料借阅**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('drawingborrowing')  then
    begin
      DmRes.cdsGZClass4.active:=false;
      dmRes.cdsGZClass4.commandtext:='SELECT FSTREMPLOYEENAME FROM Employee WHERE (FLNGDEPARTMENTID = 80)';
      dmRes.cdsGZClass4.active:=true;
      dmRes.cdsGZClass4.first;
      while not dmRes.cdsGZClass4.eof do
      begin
        DBComboBox1.Items.Add(dmRes.cdsGZClass4.FieldByName('FSTREMPLOYEENAME').Asstring);
        DBComboBox2.Items.Add(dmRes.cdsGZClass4.FieldByName('FSTREMPLOYEENAME').Asstring);
        dmRes.cdsGZClass4.next;
      end;


      dmRes.cdsdrawingborrowing.active:=false;
      dmRes.cdsdrawingborrowing.commandtext:='select * from drawingborrowing';
      dmRes.cdsdrawingborrowing.active:=true;
      dmRes.cdsDepartment.active:=false;
      dmRes.cdsDepartment.commandtext:='select * from Department';
      dmRes.cdsDepartment.active:=true;
      Notebook1.pageindex:=16;
      caption:='资料借阅录入窗口';
      ShowModal;
    end
    //********新建工艺信息**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('routinfo')  then
    begin
      dmRes.cdsroutmode.active:=false;
      dmRes.cdsroutmode.commandtext:='select * from routmode';
      dmRes.cdsroutmode.active:=true;
      dmRes.cdsroutinfo.active:=false;
      dmRes.cdsroutinfo.commandtext:='select * from routinfo';
      dmRes.cdsroutinfo.active:=true;
      Notebook1.pageindex:=17;
      caption:='工艺信息录入窗口';
      ShowModal;
    end
    //********新建工艺方法**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('routmode')  then
    begin
      dmRes.cdsroutmode.active:=false;
      dmRes.cdsroutmode.commandtext:='select * from routmode';
      dmRes.cdsroutmode.active:=true;
      Notebook1.pageindex:=18;
      caption:='工艺信息录入窗口';
      ShowModal;
    end
    //********新建工艺编号规则**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('gybianhao')  then
    begin
      dmRes.cdsgybianhao.active:=false;
      dmRes.cdsgybianhao.commandtext:='select * from gybianhao';
      dmRes.cdsgybianhao.active:=true;
      Notebook1.pageindex:=19;
      caption:='工艺信息录入窗口';
      ShowModal;
    end
    //********新建责任单位代号**************
    else
    if UpperCase(trim(ResDesc.editTableName.Text))=UpperCase('WORKSTRU')  then
    begin
      dmRes.cdsWORKSTRU.active:=false;
      dmRes.cdsWORKSTRU.commandtext:='select * from WORKSTRU';
      dmRes.cdsWORKSTRU.active:=true;
      Notebook1.pageindex:=20;
      caption:='生产单位信息录入窗口';
      ShowModal;
    end;

  finally
    Free;
  end;
  Screen.Cursor:=crDefault;
end;

procedure TResChild.wwDBGrid1DrawDataCell(Sender: TObject;
  const Rect: TRect; Field: TField; State: TGridDrawState);
  procedure TextParse(Canvas: TCanvas; const Str: String; const Rect: TRect);
  var
    r: TRect;
    i, j, L, L2: Integer;
    S1, S2, S3, S4: String;
  begin
    Canvas.FillRect(Rect);
    R:= Rect;

    S1:= Str;
    S2:= S1;

    While True do
    begin
      if Length(S2)<1 then Break;
      i:= Pos('{{', S2);
      if i>0 then
      begin
        S1:= Copy(S2, 0, i-1);
        S2:= Copy(S2, i+2, Length(S2)-i-1);

        L:= Canvas.TextWidth(S1);
        R.Right:= R.Left+L;
        Canvas.TextRect(R, R.Left, R.Top, S1);
        R.Left:= R.Left+L;

        i:= Pos('}}', S2);
        if i>0 then
        begin
          S1:= Copy(S2, 0, i-1);
          S2:= Copy(S2, i+2, Length(S2)-i-1);
  //          Canvas.Font:= F;

          j:= Pos(',', S1);
          if j>0 then
          begin
            S3:= UpperCase(Copy(S1, 0, j-1));
            if S3='GC' then
            begin
              S4:= Copy(S1, j+1, Length(S1)-j);
              j:= Pos(',', S4);
              S3:= Copy(S4, 0, j-1);

              L:= Canvas.TextWidth(S3);
              R.Right:= R.Left+L;
              Canvas.TextRect(R, R.Left, R.Top, S3);
              R.Left:= R.Left+L;

              // 上偏差
              Canvas.Font.Size:=8;
              S4:= Copy(S4, j+1, Length(S4)-j);
              j:= Pos(',', S4);
              S3:= Copy(S4, 0, j-1);

              R.Bottom:= R.Top+11;

              L2:= Canvas.TextWidth(S3);
              R.Right:= R.Left+L2;
              Canvas.TextRect(R, R.Left, R.Top, S3);

              // 下偏差
              S3:= Copy(S4, j+1, Length(S4)-j);
              R.Top := Rect.Top + (Rect.Bottom-Rect.Top) div 2;
              R.Bottom:= R.Top+9;

              if L2<Canvas.TextWidth(S3) then
                L2:= Canvas.TextWidth(S3);
              R.Right:= R.Left+L2;
              Canvas.TextRect(R, R.Left, R.Top, S3);

              R.Left:= R.Left+L2;
              R.Top:= Rect.Top;
              R.Bottom:= Rect.Bottom;
              Canvas.Font.Size:=13;
            end;
          end;
        end
        else begin
        end;
        Continue;
      end
      else
      begin
        if Length(S2)>0 then
        begin
          L:= Canvas.TextWidth(S2);
          R.Right:= R.Left+L+2;
          Canvas.TextRect(R, R.Left+2, R.Top, S2);
          Break;
        end;
      end;
    end;
  end;
begin
 if Pos('{{', Field.AsString)>0 then
  TextParse(wwDBGrid1.Canvas,Field.AsString, Rect);
end;

procedure TResChild.Button5Click(Sender: TObject);
var
  bm: TBookmark;
  col, row,COPYNUM,DISCARDNUM,i: Integer;
  sline: String;
  mem: TMemo;
  ExcelApp,WorkBook: Variant;
  xlsFileName:String;
  COPYTOTALPRICE,DISCARDTOTALPRICE:double;
begin
  if cdsResQuery.RecordCount=0 then exit;
  SaveDialog1.Options := [ofReadOnly,ofFileMustExist];
  SaveDialog1.Filter := 'excel files (*.xls)|*.xls';//|AutoCAD files (*.dwg)|*.dwg|All files (*.*)|*.*
  SaveDialog1.FilterIndex := 1;
  if SaveDialog1.Execute then
  begin
    Screen.Cursor:=crHourGlass;
    xlsFileName :=SaveDialog1.FileName;
    try
      ExcelApp:=CreateOleObject('Excel.Application');
      WorkBook:=CreateOleobject('Excel.Sheet');
    except
      ShowMessage('您的机器里未安装Microsoft Excel');
      Screen.Cursor:=crDefault;
      Exit;
    end;
    workBook:=ExcelApp.workBooks.Add;

⌨️ 快捷键说明

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