Advertisement
psi_mmobile

Untitled

Oct 7th, 2021
1,114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 10.69 KB | None | 0 0
  1. SELECT Object.VEHICLE_ID                                                                       AS OBJECT_ID,
  2.   Object.REMOTE_UNIT_ID                                                                        AS OBJECT_REMOTE_UNIT_ID,
  3.   Object.VEHICLE_OWNER_ID                                                                      AS OBJECT_VEHICLE_OWNER_ID,
  4.   Object.PERSON_ID                                                                             AS OBJECT_PERSON_ID,
  5.   Object.NUMBERPLATE                                                                           AS OBJECT_NUMBERPLATE,
  6.   Object.COMPANY_NR                                                                            AS OBJECT_COMPANY_NR,
  7.   Object.COLOR                                                                                 AS OBJECT_COLOR,
  8.   Object.BRAND                                                                                 AS OBJECT_BRAND,
  9.   Object.MODEL                                                                                 AS OBJECT_MODEL,
  10.   Object.DOOR                                                                                  AS OBJECT_DOOR,
  11.   Object.FUEL                                                                                  AS OBJECT_FUEL,
  12.   Object.RU_INSTALL_DATE                                                                       AS OBJECT_RU_INSTALL_DATE,
  13.   Object.LM_COMMENT                                                                            AS OBJECT_LM_COMMENT,
  14.   Object.VO_VEHICLE_CATEGORY_ID                                                                AS OBJECT_VO_CATEGORY_ID,
  15.   Object.RU_INSTALL_COMMENT                                                                    AS OBJECT_RU_INSTALL_COMMENT,
  16.   TO_CHAR(touserdate(VehicleData.gps_full_date,OperationCenter.timezone),'dd/mm/yyyy hh24:mi') AS GPS_FULL_DATE_STR,
  17.   UPPER(ObjectVoCategory.NAME
  18.   || ' '
  19.   || P_VEHICLE.list_vehicle_group_name(Object.VEHICLE_ID)
  20.   ||' '
  21.   ||Object.COMPANY_NR
  22.   ||' '
  23.   ||Object.NUMBERPLATE
  24.   ||' '
  25.   ||Object.BRAND
  26.   ||' '
  27.   ||Object.MODEL
  28.   ||' '
  29.   ||Object.COLOR
  30.   || ' '
  31.   || VehicleData.rg_street_nr
  32.   || DECODE(VehicleData.rg_street_nr,NULL,'',', ')
  33.   || VehicleData.rg_street
  34.   || DECODE(VehicleData.rg_street,NULL,'',' - ')
  35.   || VehicleData.rg_post_code
  36.   || ' '
  37.   || VehicleData.rg_location
  38.   || ' '
  39.   || VehicleData.rg_country
  40.   ||' '
  41.   ||Object.LAST_USERS_CAT
  42.   ||' '
  43.   ||Object.LM_COMMENT
  44.   ||' '
  45.   ||Object.LAST_USERS
  46.   ||' '
  47.   ||p_vd_poi.getVehicleDataPoiName(OperationCenter.operation_center_id, VehicleData.vehicle_data_id)
  48.   ||' '
  49.   ||Str.STR_VALUE
  50.   || ' '
  51.   || EquipmentStorePlace.NAME
  52.   || ' '
  53.   || ObjectVehicleOwner.COMPANY_NAME
  54.   || ' '
  55.   || NVL2 (Container.VEHICLE_ID ,  '['  || ContainerVoCategory.NAME  || ']'  || '.'  || '['  || Container.NUMBERPLATE  || ']', '')
  56.   || ' '
  57.   || (VehicleData.rg_street_nr  || DECODE(VehicleData.rg_street_nr,NULL,'',', ')  || VehicleData.rg_street  || DECODE(VehicleData.rg_street,NULL,'',' - ')  || VehicleData.rg_post_code  || ' '  || VehicleData.rg_location  || ' '  || VehicleData.rg_country)
  58.   || ' '
  59.   || (Person.LAST_NAME  || ' '  || Person.FIRST_NAME)
  60.   || ' '
  61.   || Object.LM_NAME
  62.   || ' '
  63.   || VoClassTree.SHORT_NAME
  64.   || ' '
  65.   || NVL(Str1.STR_VALUE,VoOpStatus.NAME)
  66.   || ' '
  67.   || EquipmentStorePlace.NAME
  68.   || ' '
  69.   || P_OBJECT.list_object_key_strings_with_usage(Object.VEHICLE_ID)
  70.   || ' '
  71.   || p_person.getNameForFiltering(Object.LAST_INVENTORY_PERSON_ID)) AS IDSTRING,
  72.   DECODE(Object.LAST_USERS,NULL,DECODE(Person.PERSON_ID,NULL,'',Person.last_name
  73.   ||' '
  74.   ||SUBSTR(Person.first_name,1)),Object.LAST_USERS) AS OBJECT_LAST_USERS,
  75.   DECODE(Object.LAST_USERS_CAT,NULL,DECODE(Person.PERSON_ID,NULL,'',Person.last_name
  76.   ||' '
  77.   ||SUBSTR(Person.first_name,1)),Object.LAST_USERS_CAT)                                   AS OBJECT_LAST_USERS_CAT,
  78.   ObjectVoCategory.GRAPHICAL_SYMBOL                                                       AS OBJECT_GRAPHICAL_SYMBOL,
  79.   ObjectVoCategory.VO_VEHICLE_CATEGORY_ID                                                 AS OBJECT_VO_CATEGORY_ID1,
  80.   ObjectVoCategory.NAME                                                                   AS OBJECT_CATEGORY_NAME,
  81.   p_vd_poi.getVehicleDataPoiId(GuiUsers.operation_center_id, Object.last_vehicle_data_id) AS OBJECT_POI_LIST,
  82.   P_VEHICLE.list_vehicle_group_name(Object.VEHICLE_ID)                                    AS OBJECT_GROUP,
  83.   ObjectVehicleOwner.COMPANY_NAME                                                         AS OBJECT_COMPANY_NAME,
  84.   ObjectVehicleOwner.VEHICLE_OWNER_ID                                                     AS OBJECT_VEHICLE_OWNER_ID1,
  85.   GuVehicle.VEHICLE_ID AS VEHICLE_ID1,
  86.   GuiUsers.GUI_USER_ID AS GUI_USER_ID1,
  87.   OcEventType.GRAPHICAL_SYMBOL AS EVENT_GRAPHICAL_SYMBOL,
  88.   OcEventType.OPERATION_CENTER_ID,
  89.   OcEventType.EVENT_TYPE_ID,
  90.   VehicleData.VEHICLE_DATA_ID,
  91.   touserdate(NVL(VehicleData.GPS_FULL_DATE,TO_DATE('1970','YYYY')),OperationCenter.timezone) AS GPS_FULL_DATE,
  92.   (VehicleData.rg_street_nr
  93.   || DECODE(VehicleData.rg_street_nr,NULL,'',', ')
  94.   || VehicleData.rg_street
  95.   || DECODE(VehicleData.rg_street,NULL,'',' - ')
  96.   || VehicleData.rg_post_code
  97.   || ' '
  98.   || VehicleData.rg_location
  99.   || ' '
  100.   || VehicleData.rg_country) AS CONTAINER_RG_ADDRESS,
  101.   Str.STR_VALUE              AS EVENT_NAME,
  102.   Str.STR_ID,
  103.   p_vd_poi.getVehicleDataPoiName(OperationCenter.operation_center_id, Object.last_vehicle_data_id) AS CONTAINER_POI_NAME,
  104.   OperationCenter.NAME                                                                             AS OPERATION_CENTER_NAME,
  105.   OperationCenter.OPERATION_CENTER_ID                                                              AS OPERATION_CENTER_ID1,
  106.   Person.PERSON_ID AS OBJECT_DEFAULT_USER_ID,
  107.   Person.LAST_NAME
  108.   || ' '
  109.   || Person.FIRST_NAME             AS OBJECT_DEFAULT_USER,
  110.   Container.VEHICLE_ID             AS CONTAINER_ID,
  111.   Container.NUMBERPLATE            AS CONTAINER_NUMBERPLATE,
  112.   Container.VO_VEHICLE_CATEGORY_ID AS CONTAINER_VO_CATEGORY_ID,
  113.   NVL2 ( Container.VEHICLE_ID ,  '['  || ContainerVoCategory.NAME  || ']'  || '.'  || '['  || Container.NUMBERPLATE  || ']', '') AS CONTAINER_NAME,
  114.   ObjectVehicleOwner.COMPANY_NAME,
  115.   RemoteUnit.IS_CONTAINER AS IS_CONTAINER,
  116.   Object.LM_NAME AS LM_NAME,
  117.   Object.LM_DATE AS LM_DATE,
  118.   EquipmentStorePlace.NAME AS LAST_STORE_PLACE,
  119.   Object.LAST_EQUIPMENT_STORE_PLACE_ID AS LAST_EQUIPMENT_STORE_PLACE_ID,
  120.   Object.GRAPHICAL_SYMBOL_ID,
  121.   (SELECT NAME FROM GRAPHICAL_SYMBOL WHERE GRAPHICAL_SYMBOL_ID = Object.GRAPHICAL_SYMBOL_ID) AS G_SYMBOL,
  122.   NVL(Str1.STR_VALUE,VoOpStatus.NAME) AS OP_STATUS_NAME,
  123.   VoOpStatus.COLOR AS OP_STATUS_COLOR,
  124.   VoClassTree.SHORT_NAME AS CLASSIFICATION_CODE,
  125.   Object.VO_CLASS_TREE_ID,
  126.   P_VO_CLASS_TREE.GETCLASSIFICATIONPATH(Object.VO_CLASS_TREE_ID) AS CLASSIFICATION_PATH,
  127.   P_WBS.getWbsVehicleConflictCount(Object.VEHICLE_ID) AS NBR_CONFLICTS_ON_WBS,
  128.   P_OBJECT.list_object_key_strings_with_usage(Object.VEHICLE_ID) AS KEY_CODE_LIST,
  129.   Object.ERP_SERIAL_NUMBER AS OBJECT_ERP_SERIAL_NUMBER,
  130.   Object.LAST_SERVICE_DATE AS OBJECT_LAST_SERVICE_DATE,
  131.   Object.TECHNICAL_CONTROL_DATE AS OBJECT_TECHNICAL_CONTROL_DATE,
  132.   NVL(Object.VEHICLE_STATUS_ID,0) AS OBJECT_STATUS_ID,
  133.   Object.ERP_ARTICLE_NUMBER AS OBJECT_ERP_ARTICLE_NUMBER,
  134.   Object.ERP_EQUIPMENT_TYPE AS OBJECT_ERP_EQUIPMENT_TYPE,
  135.   Object.ERP_STORE AS OBJECT_ERP_STORE,
  136.   Object.MOTOR_POWER AS OBJECT_MOTOR_POWER,
  137.   Object.ERP_INTERNAL_ORDER_NUM AS OBJECT_INTERNAL_ORDER_NUM,
  138.   Object.IN_SERVICE_DATE AS OBJECT_IN_SERVICE_DATE,
  139.   Object.COST_PER_DAY AS OBJECT_COST_PER_DAY,
  140.   Object.COST_PER_HR AS OBJECT_COST_PER_HR,
  141.   ObjectPoi.NAME AS OBJECT_POI_NAME,
  142.   ObjectWbs.REF_NUMBER AS OBJECT_WBS_REF_NUMBER,
  143.   ObjectVehicleData.RG_LOCATION AS OBJECT_LOCATION,
  144.   Object.LAST_INVENTORY_PERSON_ID AS OBJECT_LAST_INV_PERSON_ID,
  145.   Object.LAST_INVENTORY_DATE AS OBJECT_LAST_INVENTORY_DATE,
  146.   Object.LAST_INVENTORY_BOX_CHECKED AS OBJECT_LAST_INV_BOX_CHECKED,
  147.   p_person.getName(Object.LAST_INVENTORY_PERSON_ID) AS OBJECT_LAST_INV_PERSON_NAME
  148. FROM VEHICLE Object,
  149.   VEHICLE Container,
  150.   REMOTE_UNIT RemoteUnit,
  151.   VO_VEHICLE_CATEGORY ObjectVoCategory,
  152.   VO_VEHICLE_CATEGORY ContainerVoCategory,
  153.   GU_VEHICLE GuVehicle,
  154.   GUI_USERS GuiUsers,
  155.   OC_EVENT_TYPE OcEventType,
  156.   VEHICLE_DATA VehicleData,
  157.   OF_OWNER.STR Str,
  158.   OPERATION_CENTER OperationCenter,
  159.   PERSON Person,
  160.   VEHICLE_OWNER ObjectVehicleOwner,
  161.   EQUIPMENT_STORE_PLACE EquipmentStorePlace,
  162.   OF_OWNER.STR Str1,
  163.   VO_OP_STATUS VoOpStatus,
  164.   VO_CLASS_TREE VoClassTree,
  165.   VEHICLE_DATA ObjectVehicleData,
  166.   VD_POI ObjectVdPoi,
  167.   OC_POI ObjectPoi,
  168.   Wbs ObjectWbs
  169. WHERE GuiUsers.GUI_USER_ID            = ?
  170. AND GuiUsers.OPERATION_CENTER_ID      = OperationCenter.OPERATION_CENTER_ID
  171. AND GuiUsers.GUI_USER_ID              = GuVehicle.GUI_USER_ID
  172. AND GuVehicle.VEHICLE_ID              = Object.VEHICLE_ID
  173. AND Object.LAST_EQUIPMENT_STORE_PLACE_ID = EquipmentStorePlace.EQUIPMENT_STORE_PLACE_ID(+)
  174. AND Container.VO_VEHICLE_CATEGORY_ID  = ContainerVoCategory.VO_VEHICLE_CATEGORY_ID (+)
  175. AND Object.VO_VEHICLE_CATEGORY_ID     = ObjectVoCategory.VO_VEHICLE_CATEGORY_ID
  176. AND Object.VEHICLE_OWNER_ID = ObjectVehicleOwner.VEHICLE_OWNER_ID
  177. AND Object.VO_CLASS_TREE_ID = VoClassTree.VO_CLASS_TREE_ID(+)
  178. AND Object.PERSON_ID                  = Person.PERSON_ID(+)
  179. AND Object.REMOTE_UNIT_ID             = RemoteUnit.REMOTE_UNIT_ID(+)
  180. AND VehicleData.EVENT_TYPE_ID         = OcEventType.EVENT_TYPE_ID(+)
  181. AND (OcEventType.OPERATION_CENTER_ID  = OperationCenter.OPERATION_CENTER_ID
  182. OR OcEventType.EVENT_TYPE_ID         IS NULL)
  183. AND OcEventType.STR_ID                = Str.STR_ID(+)
  184. AND (str.language                     = GuiUsers.language
  185. OR str.language                      IS NULL)
  186. AND Object.VO_OP_STATUS_ID = VoOpStatus.VO_OP_STATUS_ID (+)
  187. AND VoOpStatus.NAME_STR_ID = Str1.STR_ID (+)
  188. AND GuiUsers.LANGUAGE = Str1.LANGUAGE (+)
  189. AND ObjectVoCategory.IS_OBJECT        = 'Y'
  190. AND Object.LAST_CONTAINER_VEHICLE_ID  = Container.VEHICLE_ID(+)
  191. AND Container.LAST_VEHICLE_DATA_ID      = VehicleData.VEHICLE_DATA_ID (+)
  192. AND (?                               IS NULL
  193. OR ?                                  = ''
  194. OR Object.VO_VEHICLE_CATEGORY_ID     IN
  195.   (SELECT regexp_substr(?,'[^,]+', 1, LEVEL)
  196.   FROM dual
  197.     CONNECT BY regexp_substr(?, '[^,]+', 1, LEVEL) IS NOT NULL
  198.   ))
  199. AND (? IS NULL OR Container.VEHICLE_ID = ?)
  200. AND (? IS NULL OR Object.LAST_EQUIPMENT_STORE_PLACE_ID = ?)
  201. AND (NVL(Object.VEHICLE_STATUS_ID,0) = 0 OR ? = 'true')
  202. AND Object.LAST_VEHICLE_DATA_ID = ObjectVehicleData.VEHICLE_DATA_ID(+)
  203. AND ObjectVehicleData.VEHICLE_DATA_ID = ObjectVdPoi.VEHICLE_DATA_ID(+)
  204. AND ObjectVdPoi.POI_ID = ObjectPoi.POI_ID(+)
  205. AND ObjectPoi.POI_ID = ObjectWbs.POI_ID(+)
  206. AND ObjectWbs.IS_PROJECT(+) = 'Y'
  207. AND ObjectWbs.WBS_LEVEL(+) = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement