
unit U_GetDllForm;
interface
uses
  Windows, Messages, forms, OleCtnrs, DateUtils, SysUtils, ADODB,IniFiles, dxcore,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;
Function GetsysParam(muserId:pchar;fparam1:pchar):Boolean;

implementation
uses
  U_DataLink,U_Fun,U_iniParam,U_MJManageNewFDNew,U_ProductOrderList,U_ProductOrderAnPai,U_SetBanZu
  ,U_BangAdd,U_MJEdit,U_JYOrderCDOne,U_JYOrderCDMore,U_CpCkSaoMNewSel,U_CKProductBCPInList
  ,U_CKProductBCPOutList,U_BanCpHCSaoM,U_CKProductBCPHCList,U_CKProductBCPKCList,
  U_CKProductBCPKCHZList,U_CpRkSaoMNew,U_ClothContractList,U_ClothContractListDH,U_ClothContractListLL,
  U_ClothContractKCList,U_ContractList,U_ProductOrderNewList,U_ClothContractListWJG,U_ClothPDInfoList,
  U_OrderJDList,U_ProductOrderAnPaiGQX,U_ClothHCList,U_ContractListNX,U_ClothContractListSX,U_ClothContractListDHSX
  ,U_ClothContractListLLSX,U_ClothContractListHZ,U_ProductOrderLBNameSet,U_ClothContractListDHSXQJG,U_ProductOrderNewList_JD,
  U_ProductOrderNewList_CY,U_HCList,U_OrderInPut_HYWT,U_ModulePromptList,U_ProductOrderNewList_FB,U_FanYangList,U_FanYangListHZ,
  U_CKProductRKHZList,U_CKProductCKHZList,U_CKJYList,U_ProductOrderLBNameSetFZ,U_Contract_Main,U_frmFabList,U_ProductOrderNewList_FB_MX,
  U_FanYangOther_List,U_ProductOrderNewList_JD10,U_FrmCgBJList,U_ProductOrderNewList_JDXin;

       /////////////////////////////////////////////////////////////////
      //         功能说明:取Dll中得窗体                              //
     //        参数说明：App>>调用应用程序；                        //
    //                 FormH>>调用窗口句柄 ；                      //
   //                 FormID>>窗口号;                             //
  //                 Language>>语言种类;                         //
 //                 WinStyle>>窗口类型；                        //
/////////////////////////////////////////////////////////////////
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
  mnewHandle: hwnd;
  mstyle: TFormStyle;     // 0:子窗口; 1：普通窗口
  mstate: TWindowState;
  mborderstyle: TFormBorderStyle;
begin
   mNewHandle:=0;
   DName:=GName;
   DCode:=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:='192.168.1.99';     //192.168.1.113
   //dtbase:='powertexdata';
   server:='.';                           
   server:='101.132.179.122,7781';     // 122.224.36.142,7781
   dtbase:='beiqidata'; //jinzhicaidata
   user:='sa';
   pswd:='rightsoft@123';
//   pswd:='numlock';
   DConString := 'Provider=SQLOLEDB.1;Password='+pswd+';Persist Security Info=True;User ID='
     +user+';Initial Catalog='+dtbase+';Data Source='+server;
   IF trim(DataBaseStr)<>''then                        
   DConString := DataBaseStr;
//   DParameters1:='高权限'; 
   //DCode:='002';
   //DName:='ADMIN';
   //DParameters2:='管理';                          
   //DataBase:='高权限';                          
   if not ConnData() then
   begin
     result:=0;
     exit;
   end;
   if IsINIFile() then
      ReadINIFile()
   else
      WriteINIFile ;
   GetsysParam('','');
   // 定义窗口类型 、状态
   if WinStyle=0 then
   begin
     mstyle := fsMDIChild  ;
     mstate := wsMaximized ;
     mborderstyle := bsSizeable;
   end
   else
   begin
     mstyle := fsNormal	;
     mstate := wsNormal ;
     mborderstyle := bsSizeable;
   end;

  /////////////////////
  //调用子模块窗口
   case FormId of
     0: //订单合同(外销)
     begin
       if frmContractList=nil then
       begin
         frmContractList:= TfrmContractList.Create(application.MainForm);
         with frmContractList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmContractList.BringToFront;
       //句柄
       mNewHandle:=frmContractList.Handle;

     end ;
     1: //订单合同(内销)
     begin
       if frmContractListNX=nil then
       begin
         frmContractListNX:= TfrmContractListNX.Create(application.MainForm);
         with frmContractListNX do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmContractListNX.BringToFront;
       //句柄
       mNewHandle:=frmContractListNX.Handle;
     end ;
     201:  //生产指示单
     begin
       if frmProductOrderNewList=nil then
       begin
         frmProductOrderNewList:= TfrmProductOrderNewList.Create(application.MainForm);
         with frmProductOrderNewList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderNewList.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderNewList.Handle;

     end;
     3:  //采购合同
     begin
       if frmClothContractListHZ=nil then
       begin
         frmClothContractListHZ:= TfrmClothContractListHZ.Create(application.MainForm);
         with frmClothContractListHZ do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end                             
       else
         frmClothContractListHZ.BringToFront;
       //句柄
       mNewHandle:=frmClothContractListHZ.Handle;

     end ;
     4:  //纱线 到货
     begin
       if frmClothContractListDHSX=nil then
       begin
         frmClothContractListDHSX:= TfrmClothContractListDHSX.Create(application.MainForm);
         with frmClothContractListDHSX do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractListDHSX.BringToFront;
       //句柄
       mNewHandle:=frmClothContractListDHSX.Handle;

     end ;
     41:  //染纱
     begin
       if frmClothContractListDHSXQJG=nil then
       begin
         frmClothContractListDHSXQJG:= TfrmClothContractListDHSXQJG.Create(application.MainForm);
         with frmClothContractListDHSXQJG do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractListDHSXQJG.BringToFront;
       //句柄
       mNewHandle:=frmClothContractListDHSXQJG.Handle;
     end ;
     5:  //纱线织成品出库
     begin
       if frmClothContractListLLSX=nil then
       begin
         frmClothContractListLLSX:= TfrmClothContractListLLSX.Create(application.MainForm);
         with frmClothContractListLLSX do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractListLLSX.BringToFront;
       //句柄
       mNewHandle:=frmClothContractListLLSX.Handle;
     end ;

     61:  //提示窗口
     begin
       if frmModulePromptList=nil then
       begin
         frmModulePromptList:= TfrmModulePromptList.Create(application.MainForm);
         with frmModulePromptList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmModulePromptList.BringToFront;
       //句柄
       mNewHandle:=frmModulePromptList.Handle;
     end ;
     6:  //坯布采购
     begin
       if frmClothContractList=nil then
       begin
         frmClothContractList:= TfrmClothContractList.Create(application.MainForm);
         with frmClothContractList do
         begin
           caption:=Trim(Title);
           FType:=trim(database);
           FType:='';
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractList.BringToFront;
       //句柄
       mNewHandle:=frmClothContractList.Handle;
     end ;
     611:  //采购合同
     begin
       if frmContract_Main=nil then
       begin
         frmContract_Main:= TfrmContract_Main.Create(application.MainForm);
         with frmContract_Main do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end                             
       else
         frmContract_Main.BringToFront;
       //句柄
       mNewHandle:=frmContract_Main.Handle;
     end ;
     
     7:  //坯布 到货
     begin
       if frmClothContractListDH=nil then
       begin
         frmClothContractListDH:= TfrmClothContractListDH.Create(application.MainForm);
         with frmClothContractListDH do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractListDH.BringToFront;
       //句柄
       mNewHandle:=frmClothContractListDH.Handle;

     end ;
     
     8:  //坯布领料
     begin
       if frmClothContractListLL=nil then
       begin
         frmClothContractListLL:= TfrmClothContractListLL.Create(application.MainForm);
         with frmClothContractListLL do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractListLL.BringToFront;
       //句柄
       mNewHandle:=frmClothContractListLL.Handle;

     end ;
     9: //外加工
     begin
       if frmClothContractListWJG=nil then
       begin
         frmClothContractListWJG:= TfrmClothContractListWJG.Create(application.MainForm);
         with frmClothContractListWJG do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractListWJG.BringToFront;
       //句柄
       mNewHandle:=frmClothContractListWJG.Handle;

     end ;
     10:  //回仓管理
     begin
       if frmProductOrderAnPai=nil then
       begin
         frmProductOrderAnPai:= TfrmProductOrderAnPai.Create(application.MainForm);
         with frmProductOrderAnPai do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderAnPai.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderAnPai.Handle;

     end ;
     2: // 成品检验
     begin
       if frmMJManageNewFDNewSF=nil then
       begin
         frmMJManageNewFDNewSF:= TfrmMJManageNewFDNewSF.Create(application.MainForm);
         with frmMJManageNewFDNewSF do
         begin
        //   fmanage:='高权限';
           fmanage:=Trim(database);
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmMJManageNewFDNewSF.BringToFront;
       //句柄
       mNewHandle:=frmMJManageNewFDNewSF.Handle;
     end ;
     11:  //标签皮重设置
     begin
       if frmProductOrderLBNameSet=nil then
       begin
         frmProductOrderLBNameSet:= TfrmProductOrderLBNameSet.Create(application.MainForm);
         with frmProductOrderLBNameSet do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderLBNameSet.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderLBNameSet.Handle;

     end ;
     12:  //布匹管理
     begin
       if frmMJEdit=nil then
       begin
         frmMJEdit:= TfrmMJEdit.Create(application.MainForm);
         with frmMJEdit do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmMJEdit.BringToFront;
       //句柄
       mNewHandle:=frmMJEdit.Handle;

     end ;
     13:  //入库扫描
     begin
       if frmCpRkSaoMNew=nil then
       begin
         frmCpRkSaoMNew:= TfrmCpRkSaoMNew.Create(application.MainForm);
         with frmCpRkSaoMNew do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCpRkSaoMNew.BringToFront;
       //句柄
       mNewHandle:=frmCpRkSaoMNew.Handle;

     end ;
     14:  //成品出库
     begin
       if frmCpCkSaoMNewSel=nil then
       begin
         frmCpCkSaoMNewSel:= TfrmCpCkSaoMNewSel.Create(application.MainForm);
         with frmCpCkSaoMNewSel do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCpCkSaoMNewSel.BringToFront;
       //句柄
       mNewHandle:=frmCpCkSaoMNewSel.Handle;

     end ;
     15:  //成品入库列表
     begin
       if frmCKProductBCPInList=nil then
       begin
         frmCKProductBCPInList:= TfrmCKProductBCPInList.Create(application.MainForm);
         with frmCKProductBCPInList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCKProductBCPInList.BringToFront;
       //句柄
       mNewHandle:=frmCKProductBCPInList.Handle;

     end ;
     16:  //成品出库列表
     begin
       if frmCKProductBCPOutList=nil then
       begin
         frmCKProductBCPOutList:= TfrmCKProductBCPOutList.Create(application.MainForm);
         with frmCKProductBCPOutList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCKProductBCPOutList.BringToFront;
       //句柄
       mNewHandle:=frmCKProductBCPOutList.Handle;

     end ;
     17:  //库存列表
     begin
       if frmCKProductBCPKCList=nil then
       begin
         frmCKProductBCPKCList:= TfrmCKProductBCPKCList.Create(application.MainForm);
         with frmCKProductBCPKCList do
         begin                             
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCKProductBCPKCList.BringToFront;
       //句柄
       mNewHandle:=frmCKProductBCPKCList.Handle;

     end ;
     18:  //库存汇总列表
     begin
       if frmCKProductBCPKCHZList=nil then
       begin
         frmCKProductBCPKCHZList:= TfrmCKProductBCPKCHZList.Create(application.MainForm);
         with frmCKProductBCPKCHZList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCKProductBCPKCHZList.BringToFront;
       //句柄
       mNewHandle:=frmCKProductBCPKCHZList.Handle;

     end ;
     19:  //检验报告
     begin
       if frmJYOrderCDOne=nil then
       begin
         frmJYOrderCDOne:= TfrmJYOrderCDOne.Create(application.MainForm);
         with frmJYOrderCDOne do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmJYOrderCDOne.BringToFront;
       //句柄
       mNewHandle:=frmJYOrderCDOne.Handle;

     end ;
     20:  //检验分析
     begin
       if frmJYOrderCDMore=nil then
       begin
         frmJYOrderCDMore:= TfrmJYOrderCDMore.Create(application.MainForm);
         with frmJYOrderCDMore do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmJYOrderCDMore.BringToFront;
       //句柄
       mNewHandle:=frmJYOrderCDMore.Handle;

     end ;
     21: //待检布库存
     begin
       if frmClothPDInfoList=nil then
       begin
         frmClothPDInfoList:= TfrmClothPDInfoList.Create(application.MainForm);
         with frmClothPDInfoList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothPDInfoList.BringToFront;
       //句柄
       mNewHandle:=frmClothPDInfoList.Handle;

     end ;
     22:  //回仓查询
     begin
       if frmClothHCList=nil then
       begin
         frmClothHCList:= TfrmClothHCList.Create(application.MainForm);
         with frmClothHCList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothHCList.BringToFront;
       //句柄
       mNewHandle:=frmClothHCList.Handle;

     end ;

     23:  //生产指示单进度查询
     begin
       if frmProductOrderNewList_JD=nil then
       begin
         frmProductOrderNewList_JD:= TfrmProductOrderNewList_JD.Create(application.MainForm);
         with frmProductOrderNewList_JD do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderNewList_JD.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderNewList_JD.Handle;

     end ;
     231:  //生产指示单进度查询
     begin
       if frmProductOrderNewList_JD10=nil then
       begin
         frmProductOrderNewList_JD10:= TfrmProductOrderNewList_JD10.Create(application.MainForm);
         with frmProductOrderNewList_JD10 do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderNewList_JD10.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderNewList_JD10.Handle;

     end ;
         2311:  //生产指示单进度查询(新)
     begin
       if frmProductOrderNewList_JDXin=nil then
       begin
         frmProductOrderNewList_JDXin:= TfrmProductOrderNewList_JDXin.Create(application.MainForm);
         with frmProductOrderNewList_JDXin do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderNewList_JDXin.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderNewList_JDXin.Handle;

     end ;

     24:  //坯布库存汇总查询
     begin
       if frmClothContractKCList=nil then
       begin
         frmClothContractKCList:= TfrmClothContractKCList.Create(application.MainForm);
         with frmClothContractKCList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractKCList.BringToFront;
       //句柄
       mNewHandle:=frmClothContractKCList.Handle;

     end ;

     25:  //出运计划
     begin
       if frmProductOrderNewList_CY=nil then
       begin
         frmProductOrderNewList_CY:= TfrmProductOrderNewList_CY.Create(application.MainForm);
         with frmProductOrderNewList_CY do
         begin                                       
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderNewList_CY.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderNewList_CY.Handle;
     end ;

     26: //货运委托
     begin
       if frmorderInput_HYWT=nil then
       begin
         frmorderInput_HYWT:=TfrmorderInput_HYWT.create(application.MainForm);
         with frmorderInput_HYWT do
         begin
           caption:=Trim(Title);
           FormStyle:=mstyle;
           windowState:=mstate;
           BorderStyle:=mborderstyle;
         end;
       end
       else
         frmorderInput_HYWT.BringToFront;
       mNewHandle:=frmorderInput_HYWT.Handle;
     end ;

     27:  //发票信息
     begin
       if frmProductOrderNewList_FB=nil then
       begin
         frmProductOrderNewList_FB:= TfrmProductOrderNewList_FB.Create(application.MainForm);
         with frmProductOrderNewList_FB do
         begin
           caption:=Trim(Title);
           ftype:='输入';
        //   ftype:=trim(DataBase);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderNewList_FB.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderNewList_FB.Handle;
     end ;

     28:  //放样指示单
     begin
       if FrmFanYangList=nil then
       begin
         FrmFanYangList:= TFrmFanYangList.Create(application.MainForm);
         with FrmFanYangList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         FrmFanYangList.BringToFront;
       //句柄
       mNewHandle:=FrmFanYangList.Handle;
     end ;

     29:  //放样指示单汇总
     begin
       if FrmFanYangListHZ=nil then
       begin
         FrmFanYangListHZ:= TFrmFanYangListHZ.Create(application.MainForm);
         with FrmFanYangListHZ do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         FrmFanYangListHZ.BringToFront;
       //句柄
       mNewHandle:=FrmFanYangListHZ.Handle;
     end ;
     30:  //入库汇总
     begin
       if frmCKProductRKHZList=nil then
       begin
         frmCKProductRKHZList:= TfrmCKProductRKHZList.Create(application.MainForm);
         with frmCKProductRKHZList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCKProductRKHZList.BringToFront;
       //句柄
       mNewHandle:=frmCKProductRKHZList.Handle;
     end ;
     31:  //出库汇总
     begin
       if frmCKProductCKHZList=nil then
       begin
         frmCKProductCKHZList:= TfrmCKProductCKHZList.Create(application.MainForm);
         with frmCKProductCKHZList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCKProductCKHZList.BringToFront;
       //句柄
       mNewHandle:=frmCKProductCKHZList.Handle;
     end ;
     32:  //出库汇总
     begin
       if frmCKJYList=nil then
       begin
         frmCKJYList:= TfrmCKJYList.Create(application.MainForm);
         with frmCKJYList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmCKJYList.BringToFront;
       //句柄
       mNewHandle:=frmCKJYList.Handle;
     end ;
     33:  //标签皮重设置
     begin
       if frmProductOrderLBNameSetFZ=nil then
       begin
         frmProductOrderLBNameSetFZ:= TfrmProductOrderLBNameSetFZ.Create(application.MainForm);
         with frmProductOrderLBNameSetFZ do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderLBNameSetFZ.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderLBNameSetFZ.Handle;
     end ;
     34:  //发票明细查询
     begin
       if frmProductOrderNewList_FB_MX=nil then
       begin
         frmProductOrderNewList_FB_MX:= TfrmProductOrderNewList_FB_MX.Create(application.MainForm);
         with frmProductOrderNewList_FB_MX do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmProductOrderNewList_FB_MX.BringToFront;
       //句柄
       mNewHandle:=frmProductOrderNewList_FB_MX.Handle;
     end ;
     35:  //发票明细查询
     begin
       if frmFanYangOther_List=nil then
       begin
         frmFanYangOther_List:= TfrmFanYangOther_List.Create(application.MainForm);
         with frmFanYangOther_List do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmFanYangOther_List.BringToFront;
       //句柄
       mNewHandle:=frmFanYangOther_List.Handle;
     end ;
     62:  //坯布申请
     begin
       if frmFabList=nil then
       begin
         frmFabList:= TfrmFabList.Create(application.MainForm);
         with frmFabList do
         begin
           caption:=Trim(Title);
           FType:=trim(Dparameters1);     
         //  FType:='';
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;                           
       end                                             
       else
         frmFabList.BringToFront;
       //句柄                           
       mNewHandle:=frmFabList.Handle;
     end ;
     63:  //采购报价
      begin
        if FrmCgBJList = nil then
        begin
          FrmCgBJList := TFrmCgBJList.Create(application.MainForm);
          with FrmCgBJList do
          begin
            caption := Trim(Title);
            FType := trim(Dparameters1);
         //  FType:='';
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          FrmCgBJList.BringToFront;
       //句柄
        mnewHandle := FrmCgBJList.Handle;
      end;

        



   end ;  // end case

   Result:= mnewHandle;
 //  NewDllApp:=Application ;
end;
Function GetsysParam(muserId:pchar;fparam1:pchar):Boolean;
begin
  result:=true;
  //////////////////////////////
  shortDateFormat:='yyyy-MM-dd';
  //服务器日期
  with DataLink_TradeManage.AdoDataLink do
  begin
    close;
    sql.Clear;
    sql.Add('select getDate()as dt');
    open;
    DServerDate:=fieldByName('dt').AsDatetime;
  end;
  result:=true;
end;
//===========================================================
  //建立数据库连接池
//===========================================================
function ConnData():Boolean;
begin
   if not Assigned(DataLink_TradeManage) then
     DataLink_TradeManage:=TDataLink_TradeManage.Create(Application);
  Try
    with DataLink_TradeManage.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_TradeManage.Free;
   application:=NewDllApp;
   dxUnitsLoader.Finalize;

end.

