Sayfayı Yazdır | Pencereyi Kapat

CallBarcodeReaderWithScript

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=924
Tarih: 06 Ocak 2025 Saat 14:21
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: CallBarcodeReaderWithScript
Mesajı Yazan: Habip
Konu: CallBarcodeReaderWithScript
Mesaj Tarihi: 03 Eylül 2024 Saat 10:16

var

  testCombo : TClComboBox;

  MyForm : TclForm;

  QMemList:TclJSonQuery;

  QrAppType:Integer;  //0:qrgenerator 1:Yonetici 2:Normal User

  //YÖNETİCİ EKRANI

  mainPnl : TclProPanel;

  timeContainer : TclLayout;

  CaptionLbl,timeCaptionLbl,timeLbl : TClProLabel;

  QRGen : TClQRCodeGenerator;

  //KULLANICI EKRANI

  descriptionLbl : TClProLabel;

  BtnReadQrCode:TclProButton;

  ReadQrEdt : TclEdit;

  GetTimer: TClTimer;

  yoneticiTakip : Integer;

  clQuery:TCLJSONQuery;

  qryStr:String;

  //WIN EKRANI

  refreshBtn : TClProButton;

  refreshLyt : TclLayout;

  memberListView : TClProListView;

  memberDesignerPanel : TClProListViewDesignerPanel;

  memberName,memberValueDate : TClProLabel;

  jsonStr:string;

 

void PostJSON;

 var

   clomosyQ1:TCLJSONQuery;

   qryTestStr : String;

  clQueryTest : TCLJSONQuery;

 {

     try

                qryTestStr='SELECT TOP 1 * FROM PrgView_tblProjectThreads where CAST(Thread_Value_Text AS nvarchar(max)) =''T2KJE3BJR3'' ORDER BY Rec_Date DESC ';

                clQueryTest = Clomosy.DBCloudSQLSelectWith(qryTestStr);

                ShowMessage(clQueryTest.GetJSONString);

              except

              ShowMessage('İnternet bağlantınızı kontrol ediniz...' + #13 + 'Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);

              }

}

void ComboSelected;

var

  SelectedValue : Integer;

{

  if (testCombo.ItemIndex == -1)

  {

    ShowMessage('Proje listesinde üye yok!');

  } else

  {

    if (testCombo.GetValueIndex(testCombo.ItemIndex) == '00')

    {

      ShowMessage('Lütfen bir ad seçiniz.');

    }

  }

}

void addComboBox;

{

  try

    QMemList = TCLJSONQuery.Create(nil);

    QMemList = Clomosy.DBCloudQueryWith(ftMembers,'','ISNULL(PMembers.Rec_Deleted,0)=0');

    testCombo.AddItem('Adınızı Seçiniz..','00');

    with QMemList do

     {

       if (Found)

       {

         First;

         while (not EOF)

         {

            testCombo.AddItem(FieldByName('Member_Name').AsString,FieldByName('Member_GUID').AsString);

            MyForm.AddNewEvent(testCombo,tbeOnChange,'ComboSelected');

            Next;

         }

       }

     }

  except

    ShowMessage('İnternet bağlantınızı kontrol ediniz...' + #13 + 'Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);

  }

}

  void BtnNewQrCodeClick;

  {

    QRGen.Text =  FormatDateTime('hhnn', Now);

    timeLbl.Text = FormatDateTime('hh', Now)+ ':' +FormatDateTime('nn', Now);

  }

  void SaveRecordThread;

  {

    if (ReadQrEdt.Text == FormatDateTime('hhnn', Now))

    {

       if (yoneticiTakip == 1){

         if (testCombo.GetValueIndex(testCombo.ItemIndex) == '00'){

            ShowMessage('Lütfen bir kullanıcı seçiniz.');

          }else{

          ShowMessage('Yönetici hesabı : kayıt gerçekleşti.');

         

          qryStr='SELECT TOP 1 * FROM PrgView_tblProjectThreads where CAST(Thread_Value_Text AS nvarchar(max)) ='+QuotedStr(testCombo.GetValueIndex(testCombo.ItemIndex))+' ORDER BY Rec_Date DESC '; // TOP => İLK KAYIT GELİYOR   ORDER BY Rec_Date DESC LIMIT 1

 

          try

         

            clQuery = Clomosy.DBCloudSQLSelectWith(qryStr);

            with clQuery do

            {

              if (Found)

              {

                Clomosy.DBCloudPostJSON(ftThreads,'[{"Thread_GUID":"'+FieldByName('Thread_GUID').AsString+'","Thread_Value_Str":"'+testCombo.Items[testCombo.ItemIndex]+'|'+FormatDateTime('yyyy-mm-dd/hh:nn', Now)+'","Thread_Quantity":1,"Thread_Value_Text":"'+testCombo.GetValueIndex(testCombo.ItemIndex)+'"}]'); //,"Member_Name":"'+testCombo.Items[testCombo.ItemIndex]+'","Thread_Member_GUID":"'+testCombo.GetValueIndex(testCombo.ItemIndex)+'","Thread_RecMember_GUID":"'+testCombo.GetValueIndex(testCombo.ItemIndex)+'","Thread_RecUpMember_GUID":"'+testCombo.GetValueIndex(testCombo.ItemIndex)+'"

               

              }else{

 

                Clomosy.DBCloudPostJSON(ftThreads,'[{"Thread_Value_Str":"'+testCombo.Items[testCombo.ItemIndex]+'|'+FormatDateTime('yyyy-mm-dd/hh:nn', Now)+'","Thread_Quantity":1,"Thread_Value_Text":"'+testCombo.GetValueIndex(testCombo.ItemIndex)+'"}]'); //,"Member_Name":"'+testCombo.Items[testCombo.ItemIndex]+'","Thread_Member_GUID":"'+testCombo.GetValueIndex(testCombo.ItemIndex)+'","Thread_RecMember_GUID":"'+testCombo.GetValueIndex(testCombo.ItemIndex)+'","Thread_RecUpMember_GUID":"'+testCombo.GetValueIndex(testCombo.ItemIndex)+'"

              }

            }

         

          except

            ShowMessage('İnternet bağlantınızı kontrol ediniz...' + #13 + 'Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);

          }

          }

        

       }else{

          Clomosy.DBCloudPostJSON(ftThreads,'[{"Thread_Value_Str":"'+Clomosy.AppUserDisplayName+'|'+FormatDateTime('yyyy-mm-dd/hh:nn', Now)+'","Thread_Quantity":1,"Thread_Value_Text":"'+Clomosy.AppUserGUID+'"}]'); //Thread_Member_GUID

          BtnReadQrCode.Text ='Okutuldu...';

          descriptionLbl.Text = 'Qr kod okutma işlemi başarılı. Windows ekranına giriş saatiniz eklenmiştir.';

          clComponent.SetupComponent(descriptionLbl,'{"TextColor":"#12b021"}');

          BtnReadQrCode.Enabled = False;

       }

    } else

      ShowMessage('Yanlış! Lütfen, tekrar deneyiniz..');

  }

  void BtnReadQrCodeClick;

  {

    MyForm.CallBarcodeReaderWithScript(ReadQrEdt,'SaveRecordThread');//runs script after read qr code

  }

  void timerShow;

  {

    BtnNewQrCodeClick;

  }

 

void adminScreen;

  {

      QRGen= MyForm.AddNewQRCodeGenerator(mainPnl,'QRGen','Merhaba Dünya');

      QRGen.Height = 200;

      QRGen.Width = 200;

      QRGen.Align = alCenter;

      QRGen.Visible = False;

 

      timeContainer = MyForm.AddNewLayout(mainPnl,'timeContainer');

      timeContainer.Align=AlTop;

      timeContainer.Height = 50;

      timeContainer.Margins.Left  = 20;

      timeContainer.Margins.Top = 50;

     

      timeCaptionLbl = MyForm.AddNewProLabel(timeContainer,'timeCaptionLbl','SAAT > ');

      clComponent.SetupComponent(timeCaptionLbl,'{"Align" : "MostLeft","Width" :90,"TextColor":"#90646D",

      "TextSize":26,"TextVerticalAlign":"center","TextHorizontalAlign":"left","TextBold":"yes"}');

      

       timeLbl = MyForm.AddNewProLabel(timeContainer,'timeLbl','--:--');

      clComponent.SetupComponent(timeLbl,'{"Align" : "Left","Width" :90,"TextColor":"#90646D","MarginLeft":15,

      "TextSize":26,"TextVerticalAlign":"center","TextHorizontalAlign":"left","TextBold":"yes"}');

 

    if (Clomosy.AppUserGUID == 'E517JC367S') //QR KOD ÜRETİLECEK ALANIN BULUNDUĞU YÖNETİCİ EKRANI

    {

      testCombo = MyForm.AddNewComboBox(mainPnl,'testCombo');

      testCombo.Align = alTop;

      testCombo.Width = 150;

      testCombo.Margins.Top=10;

      testCombo.Margins.Left =50;

      testCombo.Margins.Right =50;

      addComboBox;

      yoneticiTakip = 1;

      BtnReadQrCode.Visible = True;

     

    }else

      QRGen.Visible = True;

 

    BtnNewQrCodeClick;

    GetTimer.Enabled  = True;

    MyForm.AddNewEvent(GetTimer,tbeOnTimer,'timerShow');

  }

  void usersScrenn;

  {

    descriptionLbl = MyForm.AddNewProLabel(mainPnl,'descriptionLbl','QR Kod tarama için aşağıdaki butona basmalısınız. Ardından qr kodu taratın...');

    clComponent.SetupComponent(descriptionLbl,'{"Align" : "Top","MarginTop":50,"MarginLeft":20,"MarginRight":20,"Height":10,"TextColor":"#3B599C","TextSize":18,"TextVerticalAlign":"center",

    "TextHorizontalAlign":"center","AutoSize":"Vertical","BackgroundColor":"null"}');

   

    BtnReadQrCode.Visible = True;

  }

void refreshMemberTable;

var

  qryPlayersData:TCLJSONQuery;

{

    try

   

      qryPlayersData = TCLJSONQuery.Create(nil);

      qryPlayersData = Clomosy.ClDataSetFromJSON(jsonStr);

      with qryPlayersData do

       {

       memberListView.clLoadProListViewDataFromDataset(qryPlayersData);

       }

   

    except

   

      ShowMessage('İnternet bağlantınızı kontrol ediniz...' + #13 + 'Exception Class: '+LastExceptionClassName+' refreshMemberTable Exception Message: '+LastExceptionMessage);

    }

}

void AddDataToListview;

var

  membersListQuery: TClJSONQuery;

  qryTestStr,originalDateString,formattedDateString: String;

  clQueryTest: TCLJSONQuery;

  isFirstRecord: Boolean;

  originalDate: TclDateTime;

  list:TclStringList;

  str, membernameTxt,memberTimeTxt:String;

  

{

  jsonStr = '';

  jsonStr = '[';

  isFirstRecord = True;

  try

 

    membersListQuery = Clomosy.DBCloudQueryWith(ftMembers, '', 'ISNULL(PMembers.Rec_Deleted,0)=0');

    try

   

      with membersListQuery do

      {

        First;

        while (not Eof)

        {

          qryTestStr = 'SELECT TOP 1 Thread_Value_Str as memberName, Thread_VAT_Value as memberValueDate FROM PrgView_tblProjectThreads where CAST(Thread_Value_Text AS nvarchar(max)) =' + QuotedStr(FieldByName('Member_GUID').AsString) + ' ORDER BY Rec_Date DESC ';

          clQueryTest = Clomosy.DBCloudSQLSelectWith(qryTestStr);

          try

            with clQueryTest do

            {

              if (Found)

              {

                // İlk kayıt için virgül eklenmemesi için kontrol

                if (not isFirstRecord)

                  jsonStr = jsonStr + ',';

                 

                  str = FieldByName('memberName').AsString;

                  list = Clomosy.StringListNew;

                 

                  List.StrictDelimiter =True;

                  List.Delimiter = '|';

                  List.DelimitedText = str;

                 

                  membernameTxt = Clomosy.StringListItemString(List,0);

                  memberTimeTxt = Clomosy.StringListItemString(List,1);

                jsonStr = jsonStr + '{"memberName":"' + membernameTxt + '","memberValueDate":"' +memberTimeTxt+ '"}'; //DateTimeToStr(FormatDateTime('yyyy-mm-dd hh:nn',StrToDateTime(FieldByName('memberValueDate').AsString)))

 

                isFirstRecord = False;

                str = '';

                List.Free;

              }

            }

         

          finally

         

            clQueryTest.Close;

            clQueryTest.Free;

          }

          Next;

        }

      }

    except

     ShowMessage('İnternet bağlantınızı kontrol ediniz...' + #13 + 'Exception Class: '+LastExceptionClassName+' AddDataToListview Exception Message: '+LastExceptionMessage);

    }

  finally

    membersListQuery.Close;

    membersListQuery.Free;

  }

  jsonStr = jsonStr +']';

  refreshMemberTable;

}

 

 void CreateMembersNameAndDate;

 {

    memberName = MyForm.AddNewProLabel(memberDesignerPanel,'memberName','test');

    clComponent.SetupComponent(memberName,'{"MarginTop":10,"MarginLeft":10,"MarginBottom":10,"TextSize":18,"Width":60,"Align":"MostLeft"}');

    memberDesignerPanel.AddPanelObject(memberName,clCaption);

    memberName.Properties.AutoSize = True;

   

    memberValueDate = MyForm.AddNewProLabel(memberDesignerPanel,'memberValueDate','test');

    clComponent.SetupComponent(memberValueDate,'{"MarginTop":10,"MarginLeft":10,"MarginRight":10,"MarginBottom":10 ,"TextSize":18,

    "TextVerticalAlign":"center", "TextHorizontalAlign":"center","Height":20,"Align" : "MostRight","Width":60}');

    memberDesignerPanel.AddPanelObject(memberValueDate,clText);

    memberValueDate.Properties.AutoSize = True;

 }

 

  void CreateDesignerPanel;

 {

     memberDesignerPanel = MyForm.AddNewProListViewDesignerPanel(memberListView,'memberDesignerPanel');

     clComponent.SetupComponent(memberDesignerPanel,'{"Align":"Top","Height":70,"BackgroundColor":"#f5f1e9","BorderColor":"#3B599C","BorderWidth":2,"RoundHeight":20,"RoundWidth":20}');

     memberListView.SetDesignerPanel(memberDesignerPanel);

 }

 

  void CreateListView;

 {

    memberListView = MyForm.AddNewProListView(mainPnl,'memberListView');

    memberListView.Properties.ItemSpace = 10;

    clComponent.SetupComponent(memberListView,'{"Height" : 150,"Align":"Client","MarginBottom":20,"MarginTop":20,"MarginRight":20,"MarginLeft":20, "ListType":"Cart","ItemColumnCount" : 1,"ItemHeight" : 60,"ItemWidth":150,

    "BorderColor":"#3B599C", "BorderWidth":2,"RoundWidth":5, "RoundHeight":5,"BackgroundColor":"null"}');

    memberListView.ListType = 'vertical';

 }

 

void mainListView;

{

  CreateListView;

  CreateDesignerPanel;

  CreateMembersNameAndDate;

  AddDataToListview;

}

void mainScreen;

{

  refreshLyt = MyForm.AddNewLayout(mainPnl,'refreshLyt');

  refreshLyt.Align=ALTop;

  refreshLyt.Height = 40;

  refreshLyt.Margins.Top = 2;

 

  refreshBtn = MyForm.AddNewProButton(refreshLyt,'refreshBtn','');

  clComponent.SetupComponent(refreshBtn,'{"Align" : "Center","Height":'+IntToStr(refreshLyt.Height)+',"Width" :'+IntToStr(refreshLyt.Width)+'}');

  MyForm.SetImage(refreshBtn,' https://clomosy.com/educa/refresh.png" rel="nofollow - https://clomosy.com/educa/refresh.png ');

  MyForm.AddNewEvent(refreshBtn,tbeOnClick,'AddDataToListview');

 

  mainListView;

}

 

{

  if (Clomosy.PlatformIsMobile)

    QrAppType = 2;//0:qrgenerator 1:Yonetici 2:Normal User

 

  if(Not Clomosy.PlatformIsMobile)  //win üzeirinde açılı olan kullanıcı members listesini görsün

    QrAppType = 1;//0:qrgenerator 1:Yonetici 2:Normal User

 

  if (Clomosy.AppUserProfile== 1 )  

     QrAppType=0;

 

  yoneticiTakip = 0;

 

  MyForm = TclForm.Create(Self);

  MyForm.SetFormBGImage(' https://clomosy.com/demos/bg4.jpg" rel="nofollow - https://clomosy.com/demos/bg4.jpg ');

  GetTimer = MyForm.AddNewTimer(MyForm,'GetTimer',1000);

 

  mainPnl=MyForm.AddNewProPanel(MyForm,'mainPnl');

  clComponent.SetupComponent(mainPnl,'{"Align" : "Client","BackgroundColor":"null"}');

   

  CaptionLbl = MyForm.AddNewProLabel(mainPnl,'CaptionLbl','QR PDKS UYGULAMASI');

  clComponent.SetupComponent(CaptionLbl,'{"Align" : "MostTop","MarginTop":30,"Height":40,

  "TextColor":"#3B599C","TextSize":30,"TextVerticalAlign":"center","TextHorizontalAlign":"center","TextBold":"yes","AutoSize":"Horizontal"}');

 

  BtnReadQrCode = MyForm.AddNewProButton(mainPnl,'BtnReadQrCode','');

  clComponent.SetupComponent(BtnReadQrCode,'{"caption":"QRKod Oku","Align" : "Bottom","MarginLeft" :'+IntToStr(mainPnl.Width/4)+',"MarginRight" :'+IntToStr(mainPnl.Width/4)+',

  "MarginBottom":20,"TextColor":"#3B599C","TextSize":25,

  "Height":70,"BackgroundColor":"#d1daf0","RoundHeight":15,"RoundWidth":15,"BorderColor":"#3B599C","BorderWidth":3}');

  MyForm.AddNewEvent(BtnReadQrCode,tbeOnClick,'BtnReadQrCodeClick');

  BtnReadQrCode.Visible = False;

 

  ReadQrEdt = MyForm.AddNewEdit(mainPnl,'ReadQrEdt','Barkod Okutunuz...');

  ReadQrEdt.Align = alBottom;

  ReadQrEdt.ReadOnly = True;

  ReadQrEdt.Visible = False;

 

  if (QrAppType== 0 )//QRGenerator ise

  {

    adminScreen;

  }

  if (QrAppType== 1 )  //WINDOWS

    mainScreen;

   

  if(QrAppType==2)//QRReader ise Normal User

  {

    usersScrenn;

  }

  if (Clomosy.PlatformIsMobile)

  MyForm.Run;

  else

  MyForm.RunModal;

}

 

 

 

 

 

 

 

Ana koda yazınca bu kodu çalışıyor ancak unit olarak çağırınca CallBarcodeReaderWithScript kısmı hata veriyor




Cevaplar:
Mesajı Yazan: Developer
Mesaj Tarihi: 03 Eylül 2024 Saat 15:18
Merhaba Habib,
Oluşan duruma bakılıyor.



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net