根据车辆上的有效日期, 判断若是与当前日期相差30天,则提示预警(方法中保留此判断,预警方式目前未定); 超过有效日期,则自动将有效标志变为 N;
Public Function DecideVehicle() As BooleanDim bResult As Boolean = False
Dim oMT As New AWSvcMain.MTVehicle
Dim strOrderSQL As String = ""
strOrderSQL = "select MTVehicle.VehicleNo,* from MTVehicle where datediff(dd,EffectiveDate,getdate())=30"
Dim rs As ADODB.Recordset = G_objService.DB_ExecSelectSQL(strOrderSQL)
If rs.EOF = False Then
oMT.SetService(G_objService)
Dim strKey As String
Dim strSQL As String = ""
strSQL = "select * from MTVehicle where datediff(dd,EffectiveDate,getdate())>30"
Dim rs1 As ADODB.Recordset = G_objService.DB_ExecSelectSQL(strSQL)
Do Until rs1.EOF = True
strKey = rs1.Fields(0).Value
If oMT.LoadFromDB(strKey) = True Then
oMT.ValidFlag = 0
If oMT.SaveToDB() = True Then
bResult = True
End If
End If
rs1.MoveNext()
Loop
End If
Return bResult
End Function