見出し画像

🐦‍🔥⑥オッズ・払い戻しの読込み

Sub 個別ALL取得()

個別発走時刻
個別開催情報
個別オッズ
個別払い戻し

End Sub


Sub 個別払い戻し()

JvMode = 6 'Private Sub CommandButton1_Clickで呼び出し
With データラボ 'UserForm1
   .Show (vbModeless) '(vbModal)
   .CommandButton1.value = True 'SendKeys使わず直接
End With

If Er = 0 And CkHr = 1 Then Sheets("出馬表").Cells(YJv, 1).Interior.ColorIndex = 15

Beep
End Sub


Sub 個別オッズ()
Er = 0
JvTc = ""

JvMode = 5 'Private Sub CommandButton1_Clickで呼び出し
With データラボ 'UserForm1
   .Show (vbModeless) '(vbModal)
   .CommandButton1.value = True 'SendKeys使わず直接
End With

If Er = 0 And RTime <> "End" Then
    Sheets("出馬表").Cells(YJv, 1).Interior.ColorIndex = 3
    'TxtOz保存
End If
If JvTc = "0000" Then
    Sheets("出馬表").Cells(YJv, 1).Interior.ColorIndex = 15 'レース中止
End If


Beep
End Sub
Sub 払い戻しin()

If JvMode = 6 Then 'END

    データラボ.Caption = "払い戻しin取得中"
    データラボ.BackColor = RGB(0, 0, 0)
    
    Cancelflg = False
    DLflg = False
    
    Erase JvHr

    Er = 0
    CkHr = 0 '払い戻し確認
    Sheets("出馬表").払い戻し読込JvYSt
    If RTime = "End" Or RTime = "" Then
        ラボEND
        Exit Sub
    End If
    
   開催日場トラックR
   
   '************************************************************************************HR
   JVLink1.JVInit ("EXCELSAMPLE") 'JVLinkを初期化
   Retval = JVLink1.JVRTOpen("0B15", MyDay)
   If Retval <> 0 Then
        ErNo = Retval
        JVエラー
        Exit Sub
   End If
   
   ダウンロード中
   
   While Retval <> 0
      If Cancelflg = True Then ラボEND  'キャンセルボタンチェック
      Retval = JVLink1.JVRead(Buff, 83286, Filename)
        
      If (Retval < -1) Then
            ErNo = Retval
            JVエラー
            Exit Sub
      End If
      '---------------------------------------------------------------------------HR 払戻
      If Left(Buff, 2) = "HR" Then
            JvHr(5) = 0
            JvHr(6) = 0
            Dim mRaDataHR As JV_HR_PAY
            Call SetData_HR(Buff, mRaDataHR)
         
            With mRaDataHR
                JvDay = .id.MonthDay
                If Mid(MyDay, 5, 4) = JvDay And JvJo = .id.JyoCD And RNo = .id.RaceNum Then '中止はRNo飛ばす
                    JvHr(1) = .PayTansyo(0).Umaban '1A馬番
                    JvHr(2) = .PayTansyo(1).Umaban '1B馬番
                    If Val(JvHr(2)) = 0 Then '1着同着無し
                        JvHr(3) = Mid$(.PayUmatan(0).Kumi, 3, 2) '2A馬番
                        JvHr(4) = Mid$(.PayUmatan(1).Kumi, 3, 2) '2B馬番
                    Else '1着同着
                        JvHr(3) = 0 '2A馬番
                        JvHr(4) = 0 '2B馬番
                    End If
                    If Val(JvHr(4)) = 0 Then '2着同着無し
                        '-------------------------------------3連単から着順
                        St1 = Mid$(.PaySanrenpuku(0).Kumi, 1, 2) '1N馬番
                        St2 = Mid$(.PaySanrenpuku(0).Kumi, 3, 2) '2N馬番
                        St3 = Mid$(.PaySanrenpuku(0).Kumi, 5, 2) '3N馬番
                        If St1 <> JvHr(1) And St1 <> JvHr(2) And St1 <> JvHr(3) Then
                            JvHr(5) = St1 '3A馬番
                        Else
                            If St2 <> JvHr(1) And St2 <> JvHr(2) And St2 <> JvHr(3) Then
                            JvHr(5) = St2 '3A馬番
                            Else
                            JvHr(5) = St3 '3A馬番
                            End If
                        End If
                        If Val(.PaySanrenpuku(1).Pay) <> 0 Then '3B'3着同着
                            St1 = Mid$(.PaySanrenpuku(1).Kumi, 1, 2)
                            St2 = Mid$(.PaySanrenpuku(1).Kumi, 3, 2)
                            St3 = Mid$(.PaySanrenpuku(1).Kumi, 5, 2)
                            If St1 <> JvHr(1) And St1 <> JvHr(2) And St1 <> JvHr(3) Then
                              JvHr(6) = St1 '3B馬番
                            Else
                               If St2 <> JvHr(1) And St2 <> JvHr(2) And St2 <> JvHr(3) Then
                                 JvHr(6) = St2 '3B馬番
                               Else
                                 JvHr(6) = St3 '3B馬番
                               End If
                         End If
                      End If
                     Else '2着同時
                       JvHr(5) = 0 '3A馬番
                       JvHr(6) = 0 '3B馬番
                     End If
                     '---------------------------------------払い
                    JvHr(7) = .PayTansyo(0).Pay '単A
                    JvHr(8) = .PayTansyo(1).Pay '単B
                    JvHr(9) = .PayFukusyo(0).Pay '複A
                    JvHr(10) = .PayFukusyo(1).Pay '複B
                    JvHr(11) = .PayFukusyo(2).Pay '複C
                    JvHr(12) = .PayFukusyo(3).Pay '複D
                    JvHr(13) = .PayFukusyo(4).Pay '複E
                    JvHr(14) = .PayUmaren(0).Pay '馬A
                    JvHr(15) = .PayUmaren(1).Pay '馬B
                    JvHr(16) = .PayWakuren(0).Pay '枠A
                    JvHr(17) = .PayWakuren(1).Pay '枠B
                    JvHr(18) = .PayWide(0).Pay 'ワイドA 1-2
                    JvHr(19) = .PayWide(1).Pay 'ワイドB 1-3
                    JvHr(20) = .PayWide(2).Pay 'ワイドC 2-3
                    JvHr(21) = .PayWide(3).Pay 'ワイドD
                    JvHr(22) = .PayWide(4).Pay 'ワイドE
                    JvHr(23) = .PayWide(5).Pay 'ワイドF
                    JvHr(24) = .PayUmatan(0).Pay '馬単A
                    JvHr(25) = .PayUmatan(1).Pay '馬単B
                    JvHr(26) = .PaySanrenpuku(0).Pay '三連複A
                    JvHr(27) = .PaySanrenpuku(1).Pay '三連複B
                    JvHr(28) = .PaySanrentan(0).Pay '三連単A
                    JvHr(29) = .PaySanrentan(1).Pay '三連単B
                    
                    XJv = 13
                    For A = 1 To 6 '着順(読込順)
                        If Val(JvHr(A)) > 0 Then
                            Sheets("出馬表").Cells(YJv, XJv) = JvHr(A)
                            XJv = XJv + 1
                        End If
                    Next
                    XJv = 17
                    For A = 9 To 13 '複勝払い戻し(読込順)
                        If Val(JvHr(A)) > 0 Then
                            Sheets("出馬表").Cells(YJv, XJv) = JvHr(A)
                            XJv = XJv + 1
                        End If
                    Next
                    CkHr = 1
                   
                End If
            End With
      End If
      
        Label1.Caption = Buff
        DoEvents
        If Retval = -203 Then
            ErNo = Retval
            JVエラー
            Exit Sub
        End If
    Wend
    ラボEND
End If

End Sub


Sub オッズin()

Dim mRaData1 As JV_O1_ODDS_TANFUKUWAKU
Dim mRaData2 As JV_O2_ODDS_UMAREN
Dim mRaData3 As JV_O3_ODDS_WIDE
Dim mRaData4 As JV_O4_ODDS_UMATAN
Dim mRaData5 As JV_O5_ODDS_SANREN
Static mRaData6(0) As JV_O6_ODDS_SANRENTAN

If JvMode = 5 Then

    データラボ.Caption = "オッズin取得中"
    データラボ.BackColor = RGB(255, 0, 0)
    
    Cancelflg = False
    DLflg = False
    
    Er = 0
    Sheets("出馬表").オッズ読込JvYSt
    If RTime = "End" Or RTime = "" Then
        ラボEND
        Exit Sub
    End If
   
   
    Erase StOz
    Erase Bt
    Erase Bf
    Erase Bf2
    Erase Bw
    Erase By
    Erase By2
    Erase Be
    Erase B3f
    Erase B3t
    
   Buff = ""
   Filename = ""
   開催日場トラックR
   
   '********************************************************************O1-O6
   JVLink1.JVInit ("EXCELSAMPLE") 'JVLinkを初期化
   
   Retval = JVLink1.JVRTOpen("0B30", MyDay & JvJo & RNo)
   変換JV場
   
   If Retval <> 0 Then
        ErNo = Retval
        JVエラー
        Exit Sub
   End If
   
   ダウンロード中
   
   While Retval <> 0
      If Cancelflg = True Then ラボEND 'キャンセルボタンチェック
      Retval = JVLink1.JVRead(Buff, 83286, Filename) 'JVOpenで指定したデータを1レコードずつfilenameに取り込み
      ' JVReadエラー処理
      If (Retval < -1) Then
        ErNo = Retval
        JVエラー
        Exit Sub
      End If
      '--------------------------------------------------------------------O1 単複枠 & stoz & 中止
      If Left(Buff, 2) = "O1" Then
         Call SetData_O1(Buff, mRaData1)
         With mRaData1
            JvDay = .id.MonthDay
            If Mid(MyDay, 5, 4) = JvDay Then
                If .head.DataKubun = "9" Then '--中止 "1"=中間 "4"=確定 "9"=中止 !オッズ提供後に中止の場合のみ"9"提供前中止はヌル
                   JvTc = "0000"
                End If
                TimeOz = .HappyoTime.Hour & ":" & .HappyoTime.Minute 'Oz発表時間

                Sheets("出馬表").Cells(YJv, 12) = TimeOz
                
                StOz(1) = MyDay & Mid(JvJo, 1, 2) & RNo '----年月日場R 8b
                StOz(2) = .TorokuTosu '' 登録頭数 2b
                StOz(3) = .SyussoTosu '' 出走頭数 2b
                
                StOz(4) = .FukusyoFlag '' 発売フラグ 1b
                StOz(5) = .WakurenFlag '' 発売フラグ 枠連 1b
                StOz(6) = .WakurenFlag '' 複勝着払キー 1b
                
                StOz(7) = .TotalHyosuTansyo '' 単勝票数合計 11b
                StOz(8) = .TotalHyosuFukusyo '' 複勝票数合計 11b
                StOz(9) = .TotalHyosuWakuren '' 枠連票数合計 11b
                
                For A = 0 To 17
                    St1 = .OddsTansyoInfo(A).Umaban
                    If IsNumeric(St1) = True Then
                        Bt(St1, 1) = Val(.OddsTansyoInfo(A).Odds) '4b*18
                        
                        Uma = St1
                        Uma位置
                        Sheets("出馬表").Cells(YJv, XJv + 1) = Bt(St1, 1) / 10
                    End If
                Next
                For A = 0 To 17
                   St1 = .OddsFukusyoInfo(A).Umaban
                   If IsNumeric(St1) = True Then
                      Bf(St1, 1) = Val(.OddsFukusyoInfo(A).OddsLow) '4b*18
                      Bf2(St1, 1) = Val(.OddsFukusyoInfo(A).OddsHigh) '4b*18
                   End If
                Next
                For A = 0 To 35
                   St1 = .OddsWakurenInfo(A).Kumi
                   If IsNumeric(St1) = True Then
                      U1 = Mid$(St1, 1, 1)
                      U2 = Mid$(St1, 2, 1)
                      Bw(U1, U2, 1) = Val(.OddsWakurenInfo(A).Odds) '5b*36
                   End If
                Next
            End If
         End With
      End If
      '----------------------------------------------------------------------O2 馬連
      If Left(Buff, 2) = "O2" Then
         Call SetData_O2(Buff, mRaData2)
         With mRaData2
            JvDay = .id.MonthDay
            If Mid(MyDay, 5, 4) = JvDay Then
                StOz(10) = .TotalHyosuUmaren '' 馬連票数合計 11b
                For A = 0 To 152
                   St1 = .OddsUmarenInfo(A).Kumi
                   If IsNumeric(St1) = True Then
                      U1 = Mid$(St1, 1, 2)
                      U2 = Mid$(St1, 3, 2)
                      Bu(U1, U2, 1) = Val(.OddsUmarenInfo(A).Odds) '6b*153
                   End If
                Next
            End If
         End With
      End If
      '----------------------------------------------------------------------O3 ワイドLow
      If Left(Buff, 2) = "O3" Then
         Call SetData_O3(Buff, mRaData3)
         With mRaData3
            JvDay = .id.MonthDay
            If Mid(MyDay, 5, 4) = JvDay Then
                StOz(11) = .TotalHyosuWide  '' ワイド票数合計 11b
                For A = 0 To 152
                   St1 = .OddsWideInfo(A).Kumi
                   If IsNumeric(St1) = True Then
                      U1 = Mid$(St1, 1, 2)
                      U2 = Mid$(St1, 3, 2)
                      By(U1, U2, 1) = Val(.OddsWideInfo(A).OddsLow) '5b*153
                      By2(U1, U2, 1) = Val(.OddsWideInfo(A).OddsHigh) '5b*153
                   End If
                Next
            End If
         End With
      End If
      '-----------------------------------------------------------------------O4 馬単
      If Left(Buff, 2) = "O4" Then
         Call SetData_O4(Buff, mRaData4)
         With mRaData4
            JvDay = .id.MonthDay
            If Mid(MyDay, 5, 4) = JvDay Then
                StOz(12) = .TotalHyosuUmatan  '' 馬単票数合計 11b
               For A = 0 To 305
                  St1 = .OddsUmatanInfo(A).Kumi
                  If IsNumeric(St1) = True Then
                     U1 = Mid$(St1, 1, 2)
                     U2 = Mid$(St1, 3, 2)
                     Be(U1, U2, 1) = Val(.OddsUmatanInfo(A).Odds) '6b*306
                  End If
               Next
            End If
         End With
      End If
      '-----------------------------------------------------------------------O5 3連複
      If Left(Buff, 2) = "O5" Then
         Call SetData_O5(Buff, mRaData5)
         With mRaData5
            JvDay = .id.MonthDay
            If Mid(MyDay, 5, 4) = JvDay Then
                StOz(13) = .TotalHyosuSanrenpuku  '' 3連複票数合計 11b
                For A = 0 To 815
                   St1 = .OddsSanrenInfo(A).Kumi
                   If IsNumeric(St1) = True Then
                      U1 = Mid$(St1, 1, 2)
                      U2 = Mid$(St1, 3, 2)
                      U3 = Mid$(St1, 5, 2)
                      B3f(U1, U2, U3, 1) = Val(.OddsSanrenInfo(A).Odds) '6b*816
                   End If
                Next
            End If
         End With
      End If
      '----------------------------------------------------------------------O6 3連単
      If Left(Buff, 2) = "O6" Then
         Call SetData_O6(Buff, mRaData6(0))
         With mRaData6(0)
            JvDay = .id.MonthDay
            If Mid(MyDay, 5, 4) = JvDay Then
                StOz(14) = .TotalHyosuSanrentan  '' 3連単票数合計 11b
                For A = 0 To 4895
                   St1 = .OddsSanrentanInfo(A).Kumi
                   If IsNumeric(St1) = True Then
                      U1 = Mid$(St1, 1, 2)
                      U2 = Mid$(St1, 3, 2)
                      U3 = Mid$(St1, 5, 2)
                      B3t(U1, U2, U3, 1) = Val(.OddsSanrentanInfo(A).Odds) '7b*4896
                   End If
                Next
            End If
         End With
      End If

        Label1.Caption = Buff
        DoEvents
        If Retval = -203 Then
            ErNo = Retval
            JVエラー
            Exit Sub
        End If
    Wend
    ラボEND
End If

End Sub

競馬のプログラム作成お疲れ様でした😎


いいなと思ったら応援しよう!

お風呂にバブ
応援あれば、とっても嬉しいです😁