1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| Public Sub Allotissement(ByVal dat As Date, ByVal Zon As Object)
Dim base As Integer, tvh As Integer, pal As Integer, lig As Integer, A As Integer, D As Integer, Z As Integer
Dim seg As Double
Dim deb As Date, fin As Date, Debu As Date, fini As Date, ref() As Date
Dim db As New allotissementDC
Dim query = From vagues In db.Vagues _
Join ligne In db.Lignes On vagues.Ligne Equals ligne.N_ _
Join point In db.Points On ligne.depart Equals point.N_ _
Join point1 In db.Points1 On ligne.arrivee Equals point1.N_ _
Where vagues.date = Format(CDate(dat), "MM/dd/yyyy") _
And point1.Zone = Zon _
Select vagues.N_, vagues.Nb_pal, vagues.poid, vagues.Ligne, vagues.date, vagues.OK, vagues.ref_pal, vagues.ref_poid, vagues.lock, _
ligne.offset, ligne.depart, _
point1.Zone
For Each enr In query
lig = enr.Ligne
base = CInt(findall(lig, "nb de palette"))
seg = enr.ref_poid / base
seg = Math.Round(seg + 0.49, 0)
deb = CDate(findall(lig, "Livraison debut"))
fin = CDate(findall(lig, "livraison Fin"))
D = CInt(findall(lig, "depart"))
A = CInt(findall(lig, "arrivee"))
Z = CInt(findpoint(A, "Zone"))
For i = 1 To seg Step 1
tvh = IIf(i < seg, CInt(findall(lig, "typevh")), 4)
pal = IIf(i < seg, base, enr.ref_poid - ((i - 1) * base))
ref = findnextdate(A, lig, enr.offset, CDate(enr.date))
Debu = ref(0)
fini = ref(1)
Call makeseg(lig, tvh, pal, Debu, fini, False, D, A, Z, D, CDate(enr.date))
Next i
enr.OK = True
Next
db.SubmitChanges()
Call expurge()
End Sub |
Partager