abirama62

cek_data_hantu_do

Sep 2nd, 2021 (edited)
179
131 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- A. get data dropship RG balance
  2. SELECT A.*
  3. FROM sl_so_dropship_receive_goods_balance A
  4. INNER JOIN pu_receive_goods_item B ON A.tenant_id = B.tenant_id AND A.receive_goods_id = B.receive_goods_id AND A.receive_goods_item_id = B.receive_goods_item_id    
  5. INNER JOIN sl_so_item C ON A.so_item_id = C.so_item_id
  6. WHERE C.so_id = 213;
  7.  
  8. -- B. get data referensi DO
  9. SELECT A.doc_no, A.doc_date, B.ref_id, C.receive_goods_id, C.receive_goods_item_id, C.update_datetime, C.update_user_id
  10. FROM sl_do A
  11. INNER JOIN sl_do_item B ON A.do_id = B.do_id
  12. INNER JOIN sl_so_dropship_receive_goods_balance C ON B.ref_id = C.so_item_id --> untungnya tiap DO cuma ada 1 item
  13. WHERE A.doc_no = 'DO-MF/2108/001376'
  14. --> DO dibuat tanggal 25 Agustus 2021, cek record `sl_so_dropship_receive_goods_balance` yang update tgl 25 Agustus 2021
  15. --> kok ada 2 record?
  16.  
  17. -- C. get data RG
  18. SELECT A.*
  19. FROM pu_receive_goods A
  20. WHERE A.receive_goods_id IN (1385, 230)
  21. --> kok cuma ada 1 record?
  22.  
  23. -- D. get data RG yang dilaporkan
  24. SELECT *
  25. FROM pu_receive_goods A
  26. WHERE A.doc_no IN ('RG-MF/2108/000220', 'RG-MF/2108/000221')
  27.  
  28. -- E. cek GR id yang tadi hilang di poin C
  29. SELECT * FROM t_process_message
  30. WHERE process_name = 'pu_submit_receive_goods' AND process_no LIKE '230_%'
  31. --> aha! ada prefix '_1' di process_no-nya, update_datetime-nya juga tanggal 25-08-2021
  32.  
  33. SELECT * FROM t_process_message
  34. WHERE process_name = 'pu_submit_receive_goods' AND process_no LIKE '%_RG-MF/2108/000221%'
  35. --> Nah! Ternyata di `t_process_message` ada dokumen GR yang sama, tapi id-nya beda
  36.  
  37. /*
  38. Kunci:
  39. 1. Ada 2 GR, tapi ada 3 DO?
  40. 2. Kedua GR, jaraknya tanggalnya beda jauh?
  41. 3. DO "DO-MF/2108/001376", ada 2 relasi di `sl_so_dropship_receive_goods_balance`?
  42.   1. Dan ref id GR di `sl_so_dropship_receive_goods_balance` cuma ada 1??
  43. */
RAW Paste Data