unit U_GetDllForm;   //LA30

interface

uses
  Windows, Messages, forms, OleCtnrs, DateUtils, SysUtils, ADODB, dxCore,
  IniFiles, ActiveX;

function GetDllForm(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd; export; stdcall;

function ConnData(): Boolean;

implementation

uses
  U_DataLink, U_purview, U_QCRKList, U_LLRKList, U_ZHCPList, U_KuWeiList,
  U_KuWeiKCList, U_ZHCPDJList, U_CGRKList, U_CGPriceChk_BF, U_CPListDML,
  U_CPXiaoShouList, U_MYSC_CKTJ, U_CKCR_TJCX, U_QCCKList_CK, U_QCRKList_SD,
  U_PBCGRKList, U_PBCGRKList_RCGL, U_PBCGRKList_PBKC, U_PBCGRKList_QCKC,
  U_MCGRKList, U_BPZdy_LRM, U_CPTypeM, U_MCGRKList_MKC, U_BPZdy_LRX, U_XCGRKList,
  U_KCPBCGRKList_RCDJ, U_PBCGRKList_RCDJ, U_MCGRKList_XKC, U_MCGRKList_HBKC,
  U_PBCGRKList_PBCK, U_MLProductOrderNewList, U_MLConTract_NX, U_YX_WorkRZ,
  U_YX_WorkGS, U_MCGRKList_THCK, U_PMCGRKList, U_BPZdy_LRPM, U_XCGRKList_TH,
  U_LLRKList_WJG, U_LLRKList_CP, U_MCGRKList_PTCL, U_PBCGRKList_CP, U_FLCGRKList,
  U_PMCGRKList_TH, U_ProductOrderNewList_New, U_ProductOrderNewList_BQNew,
  U_MJManageNewFDNew_New, U_JYJT_New, U_MainWFBCKList, U_MianWFBKCList,
  U_MPDRKList, U_PBKCList, U_JGCKList, U_PBRKMX, U_MCGCKList, U_MCGKCList,
  U_CGCX, U_MLSC, U_MLX, U_MCP, U_MCGKCListNew, U_MPZKCListNew, U_MPDRKListNew,
  U_MPDCKListNew, U_NameDY, U_LLCKList, U_LLKCList;

       /////////////////////////////////////////////////////////////////
      //         功能说明:取Dll中得窗体                              //
     //        参数说明：App>>调用应用程序；                        //
    //                 FormH>>调用窗口句柄 ；                      //
   //                 FormID>>窗口号;                             //
  //                 Language>>语言种类;                         //
 //                 WinStyle>>窗口类型；                        //
/////////////////////////////////////////////////////////////////

var
  frmZHCPListGQX, frmZHCPListLR, frmZHCPListCX, frmZHCPListKC: TfrmZHCPList;
  frmZHCPDJListDJ, frmZHCPDJListDJGQX, frmZHCPDJListBJ: TfrmZHCPDJList;
  frmCPListDMLGQX, frmCPListDMLLR, frmCPListDMLCX, frmCPListDMLKC: TfrmCPListDML;
  frmPBCGRKList_RCDJLR, frmPBCGRKList_RCDJGL: TfrmPBCGRKList_RCDJ;
  frmJGCKListLR, frmJGCKListGL: TfrmJGCKList;
  frmMCGRKListOld, frmMCGRKListNew: TfrmMCGRKList;
  frmMCPGL, frmMCPLR: TfrmMCP;

function GetDllForm(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd;
var
  i: Integer;
  bFound: Boolean;
  mnewHandle: hwnd;
  mstyle: TFormStyle;     // 0:子窗口; 1：普通窗口
  mstate: TWindowState;
  mborderstyle: TFormBorderStyle;
begin
  mnewHandle := 0;
  DName := PChar(GName);
  DCode := PChar(GCode);
  DdataBase := DataBase;
  DTitCaption := Title;
  DParameters1 := Parameters1;
  DParameters2 := Parameters2;
  DParameters3 := Parameters3;
  DParameters4 := Parameters4;
  DParameters5 := Parameters5;
  DParameters6 := Parameters6;
  DParameters7 := Parameters7;
  DParameters8 := Parameters8;
  DParameters9 := Parameters9;
  DParameters10 := Parameters10;

  MainApplication := App;
  DCurHandle := FormH;
  IsDelphiLanguage := Language;

  Application := TApplication(App);
  DCurHandle := 0;


   //赋值链接字符串
  SetLength(server, 255);
  SetLength(dtbase, 255);
  SetLength(user, 255);
  SetLength(pswd, 255);

  server := '106.14.113.234,7781';
  dtbase := 'yunxiangdata';
  user := 'sa';
  pswd := 'rightsoft@123';
  DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
//  DConString := DataBaseStr;
  if trim(DataBaseStr) <> '' then
    DConString := DataBaseStr;
  DParameters1 := '高权限';
//  DParameters3:='1';
  if not ConnData() then
  begin
    result := 0;
    exit;
  end;
   // 定义窗口类型 、状态
  if WinStyle = 0 then
  begin
    mstyle := fsMDIChild;
    mstate := wsMaximized;
    mborderstyle := bsSizeable;
  end
  else
  begin
    mstyle := fsNormal;
    mstate := wsNormal;
    mborderstyle := bsSizeable;
  end;

  /////////////////////销售
  //调用子模块窗口
  case FormID of
    -1:  //公司产品录入(高)*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '公司产品录入(高)*' then
          begin
            BringWindowToTop(frmZHCPListGQX.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmZHCPListGQX := TfrmZHCPList.Create(application.MainForm);
          with frmZHCPListGQX do
          begin
            Title := '公司产品录入(高)*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmZHCPListGQX.BringToFront;
       //句柄
        mnewHandle := frmZHCPListGQX.Handle;
      end;
    -2:  //公司产品录入*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '公司产品录入*' then
          begin
            BringWindowToTop(frmZHCPListLR.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
        begin
          frmZHCPListLR := TfrmZHCPList.Create(application.MainForm);
          with frmZHCPListLR do
          begin
            Title := '公司产品录入*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmZHCPListLR.BringToFront;
       //句柄
        mnewHandle := frmZHCPListLR.Handle;
      end;
    -3:  //公司产品查询*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '公司产品查询*' then
          begin
            BringWindowToTop(frmZHCPListCX.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmZHCPListCX := TfrmZHCPList.Create(application.MainForm);
          with frmZHCPListCX do
          begin
            Title := '公司产品查询*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmZHCPListCX.BringToFront;
       //句柄
        mnewHandle := frmZHCPListCX.Handle;
      end;
    -6:  //挂钩库存查询*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '挂钩库存查询*' then
          begin
            BringWindowToTop(frmZHCPListKC.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmZHCPListKC := TfrmZHCPList.Create(application.MainForm);
          with frmZHCPListKC do
          begin
            Title := '挂钩库存查询*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmZHCPListKC.BringToFront;
       //句柄
        mnewHandle := frmZHCPListKC.Handle;
      end;
    -5:  //库位管理
      begin
        if frmKuWeiList = nil then
        begin
          frmKuWeiList := TfrmKuWeiList.Create(application.MainForm);
          with frmKuWeiList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmKuWeiList.BringToFront;
       //句柄
        mnewHandle := frmKuWeiList.Handle;
      end;
    -7:  //库位库存查询
      begin
        if frmKuWeiKCList = nil then
        begin
          frmKuWeiKCList := TfrmKuWeiKCList.Create(application.MainForm);
          with frmKuWeiKCList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmKuWeiKCList.BringToFront;
       //句柄
        mnewHandle := frmKuWeiKCList.Handle;
      end;
    -8:  //报价登记*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '报价登记*' then
          begin
            BringWindowToTop(frmZHCPDJListDJ.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmZHCPDJListDJ := TfrmZHCPDJList.Create(application.MainForm);
          with frmZHCPDJListDJ do
          begin
            Title := '报价登记*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmZHCPDJListDJ.BringToFront;
       //句柄
        mnewHandle := frmZHCPDJListDJ.Handle;
      end;
    -9:  //报价管理*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '报价管理*' then
          begin
            BringWindowToTop(frmZHCPDJListBJ.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmZHCPDJListBJ := TfrmZHCPDJList.Create(application.MainForm);
          with frmZHCPDJListBJ do
          begin
            Title := '报价管理*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmZHCPDJListBJ.BringToFront;
       //句柄
        mnewHandle := frmZHCPDJListBJ.Handle;
      end;
    -10:  //报价登记(高权限)*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '报价登记(高权限)*' then
          begin
            BringWindowToTop(frmZHCPDJListDJGQX.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then                        
       //if frmBaoGuanListBGZL=nil then
        begin
          frmZHCPDJListDJGQX := TfrmZHCPDJList.Create(application.MainForm);
          with frmZHCPDJListDJGQX do
          begin
            Title := '报价登记(高权限)*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmZHCPDJListDJGQX.BringToFront;
       //句柄
        mnewHandle := frmZHCPDJListDJGQX.Handle;
      end;

    0:  //权限控制
      begin
        if frmpurviewDL = nil then
        begin
          frmpurviewDL := TfrmpurviewDL.Create(application.MainForm);
          with frmpurviewDL do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmpurviewDL.BringToFront;
       //句柄
        mnewHandle := frmpurviewDL.Handle;
      end;

    97:  //公司资料登记
      begin
        if frmYX_WorkGS = nil then
        begin
          frmYX_WorkGS := TfrmYX_WorkGS.Create(application.MainForm);
          with frmYX_WorkGS do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmYX_WorkGS.BringToFront;
       //句柄
        mnewHandle := frmYX_WorkGS.Handle;
      end;

    98:  //工作日志
      begin
        if frmYX_WorkRZ = nil then
        begin
          frmYX_WorkRZ := TfrmYX_WorkRZ.Create(application.MainForm);
          with frmYX_WorkRZ do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmYX_WorkRZ.BringToFront;
       //句柄
        mnewHandle := frmYX_WorkRZ.Handle;
      end;

    99:  //内销合同信息管理
      begin
        if frmMLConTract_NX = nil then
        begin
          frmMLConTract_NX := TfrmMLConTract_NX.Create(application.MainForm);
          with frmMLConTract_NX do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMLConTract_NX.BringToFront;
       //句柄
        mnewHandle := frmMLConTract_NX.Handle;
      end;

    100:  //面料染色计划单
      begin
        if frmMLProductOrderNewList = nil then
        begin
          frmMLProductOrderNewList := TfrmMLProductOrderNewList.Create(application.MainForm);
          with frmMLProductOrderNewList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMLProductOrderNewList.BringToFront;
       //句柄
        mnewHandle := frmMLProductOrderNewList.Handle;
      end;

    1:  //期初入库
      begin
        if frmQCRKList = nil then
        begin
          frmQCRKList := TfrmQCRKList.Create(application.MainForm);
          with frmQCRKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmQCRKList.BringToFront;
       //句柄
        mnewHandle := frmQCRKList.Handle;
      end;

    2:  //客户来料入库
      begin
        if frmLLRKList = nil then
        begin
          frmLLRKList := TfrmLLRKList.Create(application.MainForm);
          with frmLLRKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmLLRKList.BringToFront;
       //句柄
        mnewHandle := frmLLRKList.Handle;
      end;

    23:  //客户来料出库
      begin
        if frmLLCKList = nil then
        begin
          frmLLCKList := TfrmLLCKList.Create(application.MainForm);
          with frmLLCKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmLLCKList.BringToFront;
       //句柄
        mnewHandle := frmLLCKList.Handle;
      end;

    24:  //客户来料库存
      begin
        if frmLLKCList = nil then
        begin
          frmLLKCList := TfrmLLKCList.Create(application.MainForm);
          with frmLLKCList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmLLKCList.BringToFront;
       //句柄
        mnewHandle := frmLLKCList.Handle;
      end;

    21:  //外加工入库
      begin
        if frmLLRKList_WJG = nil then
        begin
          frmLLRKList_WJG := TfrmLLRKList_WJG.Create(application.MainForm);
          with frmLLRKList_WJG do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmLLRKList_WJG.BringToFront;
       //句柄
        mnewHandle := frmLLRKList_WJG.Handle;
      end;

    22:  //成品入库
      begin
        if frmLLRKList_CP = nil then
        begin
          frmLLRKList_CP := TfrmLLRKList_CP.Create(application.MainForm);
          with frmLLRKList_CP do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmLLRKList_CP.BringToFront;
       //句柄
        mnewHandle := frmLLRKList_CP.Handle;
      end;

    3:  //坯布采购入库
      begin
        if frmPBCGRKList = nil then
        begin
          frmPBCGRKList := TfrmPBCGRKList.Create(application.MainForm);
          with frmPBCGRKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPBCGRKList.BringToFront;
       //句柄
        mnewHandle := frmPBCGRKList.Handle;
      end;

    3101:  //加工码单登记*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '加工码单登记*' then
          begin
            BringWindowToTop(frmPBCGRKList_RCDJLR.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmPBCGRKList_RCDJLR := TfrmPBCGRKList_RCDJ.Create(application.MainForm);
          with frmPBCGRKList_RCDJLR do
          begin
            Title := '加工码单登记*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPBCGRKList_RCDJLR.BringToFront;
       //句柄
        mnewHandle := frmPBCGRKList_RCDJLR.Handle;
      end;

    3102:  //加工码单管理*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '加工码单管理*' then
          begin
            BringWindowToTop(frmPBCGRKList_RCDJGL.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmPBCGRKList_RCDJGL := TfrmPBCGRKList_RCDJ.Create(application.MainForm);
          with frmPBCGRKList_RCDJGL do
          begin
            Title := '加工码单管理*';
            canshu1 := '高权限';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPBCGRKList_RCDJGL.BringToFront;
       //句柄
        mnewHandle := frmPBCGRKList_RCDJGL.Handle;
      end;
    666:  //库存
      begin
        if frmKCPBCGRKList_RCDJ = nil then
        begin
          frmKCPBCGRKList_RCDJ := TfrmKCPBCGRKList_RCDJ.Create(application.MainForm);
          with frmKCPBCGRKList_RCDJ do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmKCPBCGRKList_RCDJ.BringToFront;
       //句柄
        mnewHandle := frmKCPBCGRKList_RCDJ.Handle;
      end;

    3103:  //加工出库
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '加工出库*' then
          begin
            BringWindowToTop(frmJGCKListLR.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmJGCKListLR := TfrmJGCKList.Create(application.MainForm);
          with frmJGCKListLR do
          begin
            Title := '加工出库*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmJGCKListLR.BringToFront;
       //句柄
        mnewHandle := frmJGCKListLR.Handle;
      end;

    300:  //坯布库存
      begin
        if frmPBKCList = nil then
        begin
          frmPBKCList := TfrmPBKCList.Create(application.MainForm);
          with frmPBKCList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPBKCList.BringToFront;
       //句柄
        mnewHandle := frmPBKCList.Handle;
      end;

    301:  //坯布出库管理
      begin
        if frmPBCGRKList_PBCK = nil then
        begin
          frmPBCGRKList_PBCK := TfrmPBCGRKList_PBCK.Create(application.MainForm);
          with frmPBCGRKList_PBCK do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPBCGRKList_PBCK.BringToFront;
       //句柄
        mnewHandle := frmPBCGRKList_PBCK.Handle;
      end;

    302:  //期初库存
      begin
        if frmPBCGRKList_QCKC = nil then
        begin
          frmPBCGRKList_QCKC := TfrmPBCGRKList_QCKC.Create(application.MainForm);
          with frmPBCGRKList_QCKC do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPBCGRKList_QCKC.BringToFront;
       //句柄
        mnewHandle := frmPBCGRKList_QCKC.Handle;
      end;

    303:  //棉品名录入
      begin
        if frmBPZDY_LRM = nil then
        begin
          frmBPZDY_LRM := TfrmBPZDY_LRM.Create(application.MainForm);
          with frmBPZDY_LRM do
          begin
            flag := 'MName';
            flagName := '棉';
            ToolButton1.Visible := False;
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmBPZDY_LRM.BringToFront;
       //句柄
        mnewHandle := frmBPZDY_LRM.Handle;
      end;

//    304:  //棉采购入库 (旧)
//      begin
//        if frmMCGRKList = nil then
//        begin
//          frmMCGRKList := TfrmMCGRKList.Create(application.MainForm);
//          with frmMCGRKList do
//          begin
//            caption := Trim(Title);
//            FormStyle := mstyle;
//            windowState := mstate;
//            BorderStyle := mborderstyle;
//           //show;
//          end;
//        end
//        else
//          frmMCGRKList.BringToFront;
//       //句柄
//        mnewHandle := frmMCGRKList.Handle;
//      end;
      304:  //棉采购入库 (旧)
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '棉采购入库 (旧)' then
          begin
            BringWindowToTop(frmMCGRKListOld.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
        begin
          frmMCGRKListOld := TfrmMCGRKList.Create(application.MainForm);
          with frmMCGRKListOld do
          begin
            Title := '棉采购入库 (旧)';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGRKListOld.BringToFront;
       //句柄
        mnewHandle := frmMCGRKListOld.Handle;
      end;

    3111:  //棉出库
      begin
        if frmMCGCKList = nil then
        begin
          frmMCGCKList := TfrmMCGCKList.Create(application.MainForm);
          with frmMCGCKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGCKList.BringToFront;
       //句柄
        mnewHandle := frmMCGCKList.Handle;
      end;
    3222:  //棉库存
      begin
        if frmMCGKCList = nil then
        begin
          frmMCGKCList := TfrmMCGKCList.Create(application.MainForm);
          with frmMCGKCList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGKCList.BringToFront;
       //句柄
        mnewHandle := frmMCGKCList.Handle;
      end;
    3333:  //采购查询
      begin
        if frmCGCX = nil then
        begin
          frmCGCX := TfrmCGCX.Create(application.MainForm);
          with frmCGCX do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCGCX.BringToFront;
       //句柄
        mnewHandle := frmCGCX.Handle;
      end;

    3411:  //面料生产单
      begin
        if frmMLSC = nil then
        begin
          frmMLSC := TfrmMLSC.Create(application.MainForm);
          with frmMLSC do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMLSC.BringToFront;
       //句柄
        mnewHandle := frmMLSC.Handle;
      end;

    3040:  //棉退货出库
      begin
        if frmMCGRKList_THCK = nil then
        begin
          frmMCGRKList_THCK := TfrmMCGRKList_THCK.Create(application.MainForm);
          with frmMCGRKList_THCK do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGRKList_THCK.BringToFront;
       //句柄
        mnewHandle := frmMCGRKList_THCK.Handle;
      end;

    3041:  //普通材料入库
      begin
        if frmMCGRKList_PTCL = nil then
        begin
          frmMCGRKList_PTCL := TfrmMCGRKList_PTCL.Create(application.MainForm);
          with frmMCGRKList_PTCL do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGRKList_PTCL.BringToFront;
       //句柄
        mnewHandle := frmMCGRKList_PTCL.Handle;
      end;
    3042:  //棉盘点入库
      begin
        if frmMPDRKList = nil then
        begin
          frmMPDRKList := TfrmMPDRKList.Create(application.MainForm);
          with frmMPDRKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMPDRKList.BringToFront;
       //句柄
        mnewHandle := frmMPDRKList.Handle;
      end;
    3051:  //棉&无纺布出库查询
      begin
        if frmMainWFBCKList = nil then
        begin
          frmMainWFBCKList := TfrmMainWFBCKList.Create(application.MainForm);
          with frmMainWFBCKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMainWFBCKList.BringToFront;
       //句柄
        mnewHandle := frmMainWFBCKList.Handle;
      end;
    305:  //棉&无纺布库存
      begin
        if frmMianWFBKCList = nil then
        begin
          frmMianWFBKCList := TfrmMianWFBKCList.Create(application.MainForm);
          with frmMianWFBKCList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMianWFBKCList.BringToFront;
       //句柄
        mnewHandle := frmMianWFBKCList.Handle;
      end;
     {305:  //棉库存
     begin
       if frmMCGRKList_MKC=nil then
       begin
         frmMCGRKList_MKC:= TfrmMCGRKList_MKC.Create(application.MainForm);
         with frmMCGRKList_MKC do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmMCGRKList_MKC.BringToFront;
       //句柄
       mNewHandle:=frmMCGRKList_MKC.Handle;
     end ;  }

    306:  //线品名
      begin
        if frmBPZDY_LRX = nil then
        begin
          frmBPZDY_LRX := TfrmBPZDY_LRX.Create(application.MainForm);
          with frmBPZDY_LRX do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            ViewFlag := false;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmBPZDY_LRX.BringToFront;
       //句柄
        mnewHandle := frmBPZDY_LRX.Handle;
      end;

    307:  //线采购入库
      begin
        if frmXCGRKList = nil then
        begin
          frmXCGRKList := TfrmXCGRKList.Create(application.MainForm);
          with frmXCGRKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmXCGRKList.BringToFront;
       //句柄
        mnewHandle := frmXCGRKList.Handle;
      end;

    3070:  //线退货出库
      begin
        if frmXCGRKList_TH = nil then
        begin
          frmXCGRKList_TH := TfrmXCGRKList_TH.Create(application.MainForm);
          with frmXCGRKList_TH do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmXCGRKList_TH.BringToFront;
       //句柄
        mnewHandle := frmXCGRKList_TH.Handle;
      end;

    308:  //线库存
      begin
        if frmMCGRKList_XKC = nil then
        begin
          frmMCGRKList_XKC := TfrmMCGRKList_XKC.Create(application.MainForm);
          with frmMCGRKList_XKC do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGRKList_XKC.BringToFront;
       //句柄
        mnewHandle := frmMCGRKList_XKC.Handle;
      end;

    309:  //泡棉采购入库
      begin
        if frmPMCGRKList = nil then
        begin
          frmPMCGRKList := TfrmPMCGRKList.Create(application.MainForm);
          with frmPMCGRKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPMCGRKList.BringToFront;
       //句柄
        mnewHandle := frmPMCGRKList.Handle;
      end;

    310:  //泡绵品名录入
      begin
        if frmBPZDY_LRPM = nil then
        begin
          frmBPZDY_LRPM := TfrmBPZDY_LRPM.Create(application.MainForm);
          with frmBPZDY_LRPM do
          begin
            flag := 'PMName';
            flagName := '泡绵';
            ToolButton1.Visible := False;
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmBPZDY_LRPM.BringToFront;
       //句柄
        mnewHandle := frmBPZDY_LRPM.Handle;
      end;

    311:  //仓库库存汇总查询
      begin
        if frmMCGRKList_HBKC = nil then
        begin
          frmMCGRKList_HBKC := TfrmMCGRKList_HBKC.Create(application.MainForm);
          with frmMCGRKList_HBKC do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGRKList_HBKC.BringToFront;
       //句柄
        mnewHandle := frmMCGRKList_HBKC.Handle;
      end;
    312: //泡绵退货
      begin
        if frmPMCGRKList_TH = nil then
        begin
          frmPMCGRKList_TH := TfrmPMCGRKList_TH.Create(application.MainForm);
          with frmPMCGRKList_TH do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPMCGRKList_TH.BringToFront;
       //句柄
        mnewHandle := frmPMCGRKList_TH.Handle;
      end;

     {314:  //辅料入库
     begin
       if frmFLCGRKList=nil then
       begin
         frmFLCGRKList:= TfrmFLCGRKList.Create(application.MainForm);
         with frmFLCGRKList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmFLCGRKList.BringToFront;
       //句柄
       mNewHandle:=frmFLCGRKList.Handle;
     end ;}

    315:  //坯布出库管理
      begin
        if frmPBCGRKList_PBCK = nil then
        begin
          frmPBCGRKList_PBCK := TfrmPBCGRKList_PBCK.Create(application.MainForm);
          with frmPBCGRKList_PBCK do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPBCGRKList_PBCK.BringToFront;
       //句柄
        mnewHandle := frmPBCGRKList_PBCK.Handle;
      end;

    -990:  //采购入库
      begin
        if frmCGRKList = nil then
        begin
          frmCGRKList := TfrmCGRKList.Create(application.MainForm);
          with frmCGRKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCGRKList.BringToFront;
       //句柄
        mnewHandle := frmCGRKList.Handle;
      end;

    4:  //销售码单登记
      begin
        if frmCPXiaoShouList = nil then
        begin
          frmCPXiaoShouList := TfrmCPXiaoShouList.Create(application.MainForm);
          with frmCPXiaoShouList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCPXiaoShouList.BringToFront;
       //句柄
        mnewHandle := frmCPXiaoShouList.Handle;
      end;
    5:  //仓库入库统计查询
      begin
        if frmMYSC_CKTJ = nil then
        begin
          frmMYSC_CKTJ := TfrmMYSC_CKTJ.Create(application.MainForm);
          with frmMYSC_CKTJ do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMYSC_CKTJ.BringToFront;
       //句柄
        mnewHandle := frmMYSC_CKTJ.Handle;
      end;

    6:  //仓库入库汇总统计查询
      begin
        if frmCKCR_TJCX = nil then
        begin
          frmCKCR_TJCX := TfrmCKCR_TJCX.Create(application.MainForm);
          with frmCKCR_TJCX do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCKCR_TJCX.BringToFront;
       //句柄
        mnewHandle := frmCKCR_TJCX.Handle;
      end;

    7:  //加工出库
      begin
        if frmQCCKList_CK = nil then
        begin
          frmQCCKList_CK := TfrmQCCKList_CK.Create(application.MainForm);
          with frmQCCKList_CK do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmQCCKList_CK.BringToFront;
       //句柄
        mnewHandle := frmQCCKList_CK.Handle;
      end;

     {8:  //手动入库
     begin
       if frmQCRKList_SD=nil then
       begin
         frmQCRKList_SD:= TfrmQCRKList_SD.Create(application.MainForm);
         with frmQCRKList_SD do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmQCRKList_SD.BringToFront;
       //句柄
       mNewHandle:=frmQCRKList_SD.Handle;
     end ;}

    9:  //客户对账审核
      begin
        if frmCGPriceChk_BF = nil then
        begin
          frmCGPriceChk_BF := TfrmCGPriceChk_BF.Create(application.MainForm);
          with frmCGPriceChk_BF do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCGPriceChk_BF.BringToFront;
       //句柄
        mnewHandle := frmCGPriceChk_BF.Handle;
      end;

    -11:  //单面料录入(高)*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '单面料录入(高)*' then
          begin
            BringWindowToTop(frmCPListDMLGQX.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmCPListDMLGQX := TfrmCPListDML.Create(application.MainForm);
          with frmCPListDMLGQX do
          begin
            Title := '单面料录入(高)*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCPListDMLGQX.BringToFront;
       //句柄
        mnewHandle := frmCPListDMLGQX.Handle;
      end;
    -12:  //单面料录入*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '单面料录入*' then
          begin
            BringWindowToTop(frmCPListDMLLR.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmCPListDMLLR := TfrmCPListDML.Create(application.MainForm);
          with frmCPListDMLLR do
          begin
            Title := '单面料录入*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCPListDMLLR.BringToFront;
       //句柄
        mnewHandle := frmCPListDMLLR.Handle;
      end;
    -13:  //单面料查询*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '单面料查询*' then
          begin
            BringWindowToTop(frmCPListDMLCX.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmCPListDMLCX := TfrmCPListDML.Create(application.MainForm);
          with frmCPListDMLCX do
          begin
            Title := '单面料查询*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCPListDMLCX.BringToFront;
       //句柄
        mnewHandle := frmCPListDMLCX.Handle;
      end;
    -14:  //挂钩库存查询(单面料)*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '挂钩库存查询(单面料)*' then
          begin
            BringWindowToTop(frmCPListDMLKC.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
       //if frmBaoGuanListBGZL=nil then
        begin
          frmCPListDMLKC := TfrmCPListDML.Create(application.MainForm);
          with frmCPListDMLKC do
          begin
            Title := '挂钩库存查询(单面料)*';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmCPListDMLKC.BringToFront;
       //句柄
        mnewHandle := frmCPListDMLKC.Handle;
      end;
    411:  //缩率计算
      begin
        if frmPBRKMX = nil then
        begin
          frmPBRKMX := TfrmPBRKMX.Create(application.MainForm);
          with frmPBRKMX do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmPBRKMX.BringToFront;
       //句柄
        mnewHandle := frmPBRKMX.Handle;
      end;

    511:  //棉类型定义
      begin
        if frmMLX = nil then
        begin
          frmMLX := TfrmMLX.Create(application.MainForm);
          with frmMLX do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMLX.BringToFront;
       //句柄
        mnewHandle := frmMLX.Handle;
      end;
    5121:  //棉品名(高权限)*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '棉品名(高权限)*' then
          begin
            BringWindowToTop(frmMCPGL.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
        begin
          frmMCPGL := TfrmMCP.Create(application.MainForm);
          with frmMCPGL do
          begin
            Title := '棉品名(高权限)*';
            sfPrice := 1;
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCPGL.BringToFront;
       //句柄
        mnewHandle := frmMCPGL.Handle;
      end;

    5122:  //棉品名(低权限)*
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '棉品名(低权限)*' then
          begin
            BringWindowToTop(frmMCPLR.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
        begin
          frmMCPLR := TfrmMCP.Create(application.MainForm);
          with frmMCPLR do
          begin
            Title := '棉品名(低权限)*';
            sfPrice := 0;
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCPLR.BringToFront;
       //句柄
        mnewHandle := frmMCPLR.Handle;
      end;

    513:  //棉采购入库 (新)
      begin
        bFound := FALSE;
        for i := (App.MainForm.MDIChildCount - 1) downto 0 do
        begin
          if App.MainForm.MDIChildren[i].Caption = '棉采购入库 (新)' then
          begin
            BringWindowToTop(frmMCGRKListNew.Handle);
            bFound := TRUE;
            Break;
          end;
        end;
        if not bFound then
        begin
          frmMCGRKListNew := TfrmMCGRKList.Create(application.MainForm);
          with frmMCGRKListNew do
          begin
            Title := '棉采购入库 (新)';
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGRKListNew.BringToFront;
       //句柄
        mnewHandle := frmMCGRKListNew.Handle;
      end;

    514:  //棉库存(新)
      begin
        if frmMPZKCListNew = nil then
        begin
          frmMPZKCListNew := TfrmMPZKCListNew.Create(application.MainForm);
          with frmMPZKCListNew do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMPZKCListNew.BringToFront;
       //句柄
        mnewHandle := frmMPZKCListNew.Handle;
      end;

    515:  //棉盘点入库(新)
      begin
        if frmMPDRKListNew = nil then
        begin
          frmMPDRKListNew := TfrmMPDRKListNew.Create(application.MainForm);
          with frmMPDRKListNew do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMPDRKListNew.BringToFront;
       //句柄
        mnewHandle := frmMPDRKListNew.Handle;
      end;
    516:  //棉盘点出库(新)
      begin
        if frmMPDCKListNew = nil then
        begin
          frmMPDCKListNew := TfrmMPDCKListNew.Create(application.MainForm);
          with frmMPDCKListNew do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMPDCKListNew.BringToFront;
       //句柄
        mnewHandle := frmMPDCKListNew.Handle;
      end;
    517:  //棉出库(新)
      begin
        if frmMCGCKList = nil then
        begin
          frmMCGCKList := TfrmMCGCKList.Create(application.MainForm);
          with frmMCGCKList do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmMCGCKList.BringToFront;
       //句柄
        mnewHandle := frmMCGCKList.Handle;
      end;
    611:  //名字打印
      begin
        if frmNameDY = nil then
        begin
          frmNameDY := TfrmNameDY.Create(application.MainForm);
          with frmNameDY do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmNameDY.BringToFront;
       //句柄
        mnewHandle := frmNameDY.Handle;
      end;
  end;

  Result := mnewHandle;

end;
//===========================================================
  //建立数据库连接池
//===========================================================

function ConnData(): Boolean;
var
  IniFile: TIniFile;
begin
  try
    IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'SYSTEMSET.INI');
    PicSvr := IniFile.ReadString('SERVER', '服务器地址', '127.0.0.1');
    UserDataFlag := IniFile.ReadString('SERVER', '服务器地址类型', '-1');
  finally
    IniFile.Free;
  end;
  if not Assigned(DataLink_MYSC) then
    DataLink_MYSC := TDataLink_MYSC.Create(Application);
  try
    with DataLink_MYSC.ADOLink do
    begin
      //if not Connected then
      begin
        Connected := false;
        ConnectionString := DConString;
        LoginPrompt := false;
        Connected := true;
      end;
    end;
    Result := true;
  except
    Result := false;
    application.MessageBox('数据库连接失败！', '错误', mb_Ok + MB_ICONERROR);
  end;

end;

initialization
  CoInitialize(nil);
  dxUnitsLoader.Initialize;


finalization
  DataLink_MYSC.Free;
  application := NewDllApp;
  dxUnitsLoader.Finalize;

end.

