unit U_GetDllForm;

interface

uses
  Windows, Messages, forms, OleCtnrs, DateUtils, SysUtils, ADODB, 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_ContractListJG,
  U_ProductOrderNewList_PB;


       /////////////////////////////////////////////////////////////////
      //         功能说明:取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 := '139.224.12.182,7781';                         
  dtbase := 'aidengdata';                   
  user := 'aidengsa';
  pswd := 'rightsoft@3203';
  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 := '高权限';
//  DParameters2 := '合并权限';
 // DParameters2:='棉厂';                       
//  DCode := 'ADMIN';                              
//  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;
   ////////////////////
  { GetSWLDZ('192.168.1.246');
   if IpCall<>0 then
   begin
     Result:=0;
     Application.MessageBox('！！网络不通！！','提示',0);
     Exit;
   end;
   if Trim(IpWLDZStr)<>'D4:AE:52:BE:9F:02'  then
   begin
     Result:=0;
     Application.MessageBox('！！数据库连接失败！！','提示',0);
     Exit;
   end;   }
  /////////////////////
  //调用子模块窗口
  case FormID of

    -1: //订单合同(外销)
      begin
        if frmContractListJG = nil then
        begin
          frmContractListJG := TfrmContractListJG.Create(application.MainForm);
          with frmContractListJG do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmContractListJG.BringToFront;
       //句柄
        mnewHandle := frmContractListJG.Handle;

      end;
    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;
    2011:  //生产指示单排版
      begin
        if frmProductOrderNewList_PB = nil then
        begin
          frmProductOrderNewList_PB := TfrmProductOrderNewList_PB.Create(application.MainForm);
          with frmProductOrderNewList_PB do
          begin
            caption := Trim(Title);
            FormStyle := mstyle;
            windowState := mstate;
            BorderStyle := mborderstyle;
           //show;
          end;
        end
        else
          frmProductOrderNewList_PB.BringToFront;
       //句柄
        mnewHandle := frmProductOrderNewList_PB.Handle;

      end;
    { 3:  //纱线采购
     begin
       if frmClothContractListSX=nil then
       begin
         frmClothContractListSX:= TfrmClothContractListSX.Create(application.MainForm);
         with frmClothContractListSX do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmClothContractListSX.BringToFront;
       //句柄
       mNewHandle:=frmClothContractListSX.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 := 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;

    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;
        
     {

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

     end ;


     3:  // 班组设置
     begin
       if frmSetBanZu=nil then
       begin
         frmSetBanZu:= TfrmSetBanZu.Create(application.MainForm);
         with frmSetBanZu do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmSetBanZu.BringToFront;
       //句柄
       mNewHandle:=frmSetBanZu.Handle;

     end ;




     8:  //成品回仓
     begin
       if frmBanCpHCSaoM=nil then
       begin
         frmBanCpHCSaoM:= TfrmBanCpHCSaoM.Create(application.MainForm);
         with frmBanCpHCSaoM do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmBanCpHCSaoM.BringToFront;
       //句柄
       mNewHandle:=frmBanCpHCSaoM.Handle;

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

     end ;

     22: //订单进度查询
     begin
       if frmOrderJDList=nil then
       begin
         frmOrderJDList:= TfrmOrderJDList.Create(application.MainForm);
         with frmOrderJDList do
         begin
           caption:=Trim(Title);
           FormStyle := mstyle ;
           windowState := mstate ;
           BorderStyle := mborderstyle;
           //show;
         end;
       end
       else
         frmOrderJDList.BringToFront;
       //句柄
       mNewHandle:=frmOrderJDList.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.

