Rev 204 | Blame | Compare with Previous | Last modification | View Log | Download
public PVB_MPV_File_DateTime_Read(4) as Datesub mpv_lees_file (ByVal PVB_Nr as Integer)Dim PVB_mpv_lotnummer(50) as StringDim PVB_mpv_vormmachine(50) as StringDim PVB_mpv_code(50) as StringDim PVB_mpv_waarde(50) as StringDim PVB_mpv_plus_min(50) as StringDim PVB_mpv_regelgrens(50) as StringDim PVB_mpv_afkeurgrens(50) as StringDim PVB_count as IntegerDim PVB_RecNr as IntegerDIM PVB_CokesNr as IntegerDIM PVB_PekNr as IntegerDIM PVB_File as IntegerDIM PVB_MPV_File_DateTime(4) as DateCriticalPVB_count = 0Do while (mf_MPV_LOG_Busy) and (PVB_count < 10)Sleep 500PVB_count = PVB_count + 1Loopif PVB_count > 0 thenPVB_count = 0Do while (PVB_count < 10)Sleep 500PVB_count = PVB_count + 1Loopend ifif (mf_MPV_LOG_Busy = 0) and (mf_MPV_count(PVB_Nr)>1) then 'check op mf_MPV_count om trigger bij reset counter te voorkomenmf_MPV_LOG_Busy = PVB_Nrmf_MPV_Status(PVB_Nr) = ""' mf_MPV_Lotnr(PVB_Nr) = ""On Error Goto Trap1' Check for a new filemf_MPV_Status(PVB_Nr) = TIME & " Check for new MPV file"PVB_MPV_File_DateTime(PVB_Nr)=FileDateTime("c:/inetpub/ftproot/ftps" & PVB_Nr & ".txt")mf_MPV_File_DateTime(PVB_Nr)=Format(PVB_MPV_File_DateTime(PVB_Nr),"General date")if PVB_MPV_File_DateTime(PVB_Nr)<>PVB_MPV_File_DateTime_Read(PVB_Nr) then' new filemf_MPV_Status(PVB_Nr) = TIME & " Openen MPV file"PVB_File = FreeFileOpen "c:/inetpub/ftproot/ftps" & PVB_Nr & ".txt" for input lock read write as PVB_FilePVB_count = 1Do while (NOT EOF(PVB_File)) and (PVB_count < 50)input PVB_File, PVB_mpv_lotnummer(PVB_count)input PVB_File, PVB_mpv_vormmachine(PVB_count)input PVB_File, PVB_mpv_code(PVB_count)input PVB_File, PVB_mpv_waarde(PVB_count)input PVB_File, PVB_mpv_plus_min(PVB_count)input PVB_File, PVB_mpv_regelgrens(PVB_count)input PVB_File, PVB_mpv_afkeurgrens(PVB_count)PVB_count = PVB_count + 1Loopmf_MPV_Status(PVB_Nr) = TIME & " Sluiten MPV file"if PVB_count > 1 thenPVB_MPV_File_DateTime_Read(PVB_Nr)=PVB_MPV_File_DateTime(PVB_Nr)elseErr = 999Close PVB_Filegoto Trap1end ifClose PVB_Filefor PVB_CokesNr=1 to 5mf_MPV_LOG_Cokes(PVB_CokesNr)=""mf_MPV_LOG_CokesP(PVB_CokesNr)=0next PVB_CokesNrPVB_CokesNr=1for PVB_PekNr=1 to 2mf_MPV_LOG_Peksoort(PVB_PekNr)=""mf_MPV_LOG_PeksoortP(PVB_PekNr)=0next PVB_PekNrPVB_PekNr=1for PVB_RecNr=1 to PVB_count-1select case PVB_mpv_code(PVB_RecNr)case "C99999"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)=""mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90010"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Lingen"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90020"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Esso"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90030"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Marathon"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90040"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Mongstad"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90050"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Veba"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90060"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Conoco"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90300"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Great Lakes"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90310"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Copetro"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90320"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="CII"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90330"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Reynolds"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90350"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="BP ARCO"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90400"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="ALBA"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90500"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Petrobras"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90600"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="Sumitomo"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90650"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="ZCP"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "C90670"if PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)="ZCGG"mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1end ifcase "P92100"if PVB_PekNr<=2 thenmf_MPV_LOG_Peksoort(PVB_PekNr)="Cindu"mf_MPV_LOG_PeksoortP(PVB_PekNr)=PVB_mpv_waarde(PVB_RecNr)PVB_PekNr=PVB_PekNr+1end ifcase "P92200"if PVB_PekNr<=2 thenmf_MPV_LOG_Peksoort(PVB_PekNr)="Tarco"mf_MPV_LOG_PeksoortP(PVB_PekNr)=PVB_mpv_waarde(PVB_RecNr)PVB_PekNr=PVB_PekNr+1end ifcase "P92300"if PVB_PekNr<=2 thenmf_MPV_LOG_Peksoort(PVB_PekNr)="Deza"mf_MPV_LOG_PeksoortP(PVB_PekNr)=PVB_mpv_waarde(PVB_RecNr)PVB_PekNr=PVB_PekNr+1end ifcase "P92400"if PVB_PekNr<=2 thenmf_MPV_LOG_Peksoort(PVB_PekNr)="Vft"mf_MPV_LOG_PeksoortP(PVB_PekNr)=PVB_mpv_waarde(PVB_RecNr)PVB_PekNr=PVB_PekNr+1end ifcase "P92500"if PVB_PekNr<=2 thenmf_MPV_LOG_Peksoort(PVB_PekNr)="Tarpol"mf_MPV_LOG_PeksoortP(PVB_PekNr)=PVB_mpv_waarde(PVB_RecNr)PVB_PekNr=PVB_PekNr+1end ifcase "P92600"if PVB_PekNr<=2 thenmf_MPV_LOG_Peksoort(PVB_PekNr)="Nalon"mf_MPV_LOG_PeksoortP(PVB_PekNr)=PVB_mpv_waarde(PVB_RecNr)PVB_PekNr=PVB_PekNr+1end ifcase "DOS_1"' pekdoseringmf_MPV_LOG_Pek=PVB_mpv_waarde(PVB_RecNr)case "DOS_2"' molenstofmf_MPV_LOG_Molenstof=PVB_mpv_waarde(PVB_RecNr)case "DOS_3"' korrel 0.25-1mf_MPV_LOG_Korrel(1)=PVB_mpv_waarde(PVB_RecNr)case "DOS_4"' korrel 1-2mf_MPV_LOG_Korrel(3)=PVB_mpv_waarde(PVB_RecNr)case "DOS_5","DOSS_03"' korrel 2-4mf_MPV_LOG_Korrel(4)=PVB_mpv_waarde(PVB_RecNr)case "DOS_6","DOSS_02"' korrel 4-8mf_MPV_LOG_Korrel(5)=PVB_mpv_waarde(PVB_RecNr)case "DOS_7","DOSS_01"' korrel 8-16mf_MPV_LOG_Korrel(2)=PVB_mpv_waarde(PVB_RecNr)case "DOS_8"' fijne restenmf_MPV_LOG_Fijne_Resten=PVB_mpv_waarde(PVB_RecNr)case "DOS_9"' resten.cokesmf_MPV_LOG_Grove_Resten=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Verd_Cokes=100-PVB_mpv_waarde(PVB_RecNr)case "VAR_1A","VAR_2A","VAR_3A"mf_MPV_LOG_Gr_Toeslag=PVB_mpv_waarde(PVB_RecNr)case "VAR_1B","VAR_2B","VAR_3B"mf_MPV_LOG_Doorzet=PVB_mpv_waarde(PVB_RecNr)case "MASSA_1"mf_MPV_LOG_Pek_T=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Pek_T_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_Pek_T_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "MASSA_2"mf_MPV_LOG_Vw_T=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Vw_T_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_Vw_T_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "MASSA_3"mf_MPV_LOG_Bm_T=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Bm_T_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_Bm_T_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "MASSA_4"mf_MPV_LOG_Om_T=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Om_T_Afw=PVB_mpv_plus_min(PVB_RecNr)mf_MPV_LOG_Om_T_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_Om_T_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "MASSA_5"mf_MPV_LOG_Vw_Rpm=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Vw_Rpm_Afw=PVB_mpv_plus_min(PVB_RecNr)case "MASSA_7"mf_MPV_LOG_Bm_Rpm=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Bm_Rpm_Afw=PVB_mpv_plus_min(PVB_RecNr)case "MASSA_8"mf_MPV_LOG_Om_Rpm=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Om_Rpm_Afw=PVB_mpv_plus_min(PVB_RecNr)case "MASSA_9"mf_MPV_LOG_K_Kwton=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_K_Kwton_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_K_Kwton_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "MASSA10"mf_MPV_LOG_Blain=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Blain_Afw=PVB_mpv_plus_min(PVB_RecNr)case "MASSA11"mf_MPV_LOG_Vulgr=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Vulgr_Afw=PVB_mpv_plus_min(PVB_RecNr)case "VORM_1"mf_MPV_LOG_Hoogte=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Hoogte_Afw=PVB_mpv_plus_min(PVB_RecNr)mf_MPV_LOG_Hoogte_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_Hoogte_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "VORM_2"mf_MPV_LOG_Gewicht=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Gewicht_Afw=PVB_mpv_plus_min(PVB_RecNr)mf_MPV_LOG_Gewicht_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_Gewicht_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "VORM_3","VORM_3A"mf_MPV_LOG_Temp=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Temp_Afw=PVB_mpv_plus_min(PVB_RecNr)mf_MPV_LOG_Temp_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_Temp_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "VORM_4"mf_MPV_LOG_Sg_Factor=PVB_mpv_waarde(PVB_RecNr)case "VORM_4A"mf_MPV_LOG_Sg=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Sg_Reg=PVB_mpv_regelgrens(PVB_RecNr)mf_MPV_LOG_Sg_Afk=PVB_mpv_afkeurgrens(PVB_RecNr)case "VORM_5","VORM_8"mf_MPV_LOG_Rpm_P_Inst=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Rpm_P_Inst_Afw=PVB_mpv_plus_min(PVB_RecNr)case "VORM_6","VORM_6A"mf_MPV_LOG_Tijd=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Tijd_Afw=PVB_mpv_plus_min(PVB_RecNr)case "VORM_7"mf_MPV_LOG_Balg=PVB_mpv_waarde(PVB_RecNr)mf_MPV_LOG_Balg_Afw=PVB_mpv_plus_min(PVB_RecNr)case elseif PVB_CokesNr<=5 thenmf_MPV_LOG_Cokes(PVB_CokesNr)=PVB_mpv_code(PVB_RecNr)mf_MPV_LOG_CokesP(PVB_CokesNr)=PVB_mpv_waarde(PVB_RecNr)PVB_CokesNr=PVB_CokesNr+1elsemf_MPV_Status(PVB_Nr) = "onbekend label in MPV file (" & PVB_mpv_code(PVB_RecNr) & " )"end ifend selectnext PVB_RecNrmf_MPV_LOG_Lotnr=PVB_mpv_lotnummer(1)mf_MPV_LOG_Systeem=PVB_NRmf_MPV_LOG_V_Machine=PVB_mpv_vormmachine(1)mf_MPV_Status(PVB_Nr) = TIME & " Lezen MPV file OK"'if (mf_MPV_Lotnr(PVB_Nr) <> mf_MPV_LOG_Lotnr) thenmf_MPV_Lotnr(PVB_Nr) = mf_MPV_LOG_Lotnrmf_MPV_Update.force 1'end ifelsemf_MPV_Status(PVB_Nr) = TIME & " Geen nieuwe MPV file"mf_MPV_LOG_Busy = 0end ifend ifExit SubTrap1:mf_MPV_Status(PVB_Nr) = TIME & " ERROR tijdens lezen MPV file (" & Err & " )"mf_MPV_LOG_Busy = 0Exit Subend sub