Skip to content

Commit

Permalink
Changed loading logic for Business P. address name and HO addre… (#5937)
Browse files Browse the repository at this point in the history
Changed loading logic for Business P. address name and HO address
  • Loading branch information
metas-ts committed Dec 18, 2019
2 parents 1575b59 + f878e36 commit d67ab78
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 7 deletions.
@@ -1,4 +1,5 @@
CREATE OR REPLACE VIEW edi_desadvpack_sscc_label

CREATE OR REPLACE VIEW edi_desadvpack_sscc_label
(no_of_labels, SSCC, order_reference, date_shipped, GTIN, product_description, amount, weight, best_before, lot_no,
bp_address_GLN, bp_address_name1, bp_address_name2, bp_address_street, bp_address_zip_code, bp_address_city,
ho_address_GLN, ho_address_name1, ho_address_name2, ho_address_street, ho_address_zip_code, ho_address_city,
Expand All @@ -16,15 +17,15 @@ SELECT
dl_pack.bestBeforeDate AS best_before,
dl_pack.lotnumber AS lot_no,
bp_address.GLN AS bp_address_gln,
bp_address.name AS bp_address_name1,
''::text AS bp_address_name2,
bp_address_location.address1 || bp_address_location.address2 AS bp_address_street,
bp_address_location.address1 AS bp_address_name1,
bp_address_location.address2 AS bp_address_name2,
concat(bp_address_location.address1,' ', bp_address_location.address2) AS bp_address_street,
bp_address_location.postal AS bp_address_zip_code,
bp_address_location.city AS bp_address_city,
ho_address.GLN AS ho_address_gln,
ho_address.name AS ho_address_name1,
''::text AS ho_address_name2,
ho_address_location.address1 || bp_address_location.address2 AS ho_address_street,
ho_address_location.address1 AS ho_address_name1,
ho_address_location.address2 AS ho_address_name2,
concat(ho_address_location.address1,' ', ho_address_location.address2) AS ho_address_street,
ho_address_location.postal AS ho_address_zip_code,
ho_address_location.city AS ho_address_city,
t_sel.ad_pinstance_id AS p_instance_id
Expand Down
@@ -0,0 +1,40 @@
drop view if exists edi_desadvpack_sscc_label;

CREATE VIEW edi_desadvpack_sscc_label
(no_of_labels, SSCC, order_reference, date_shipped, GTIN, product_description, amount, weight, best_before, lot_no,
bp_address_GLN, bp_address_name1, bp_address_name2, bp_address_street, bp_address_zip_code, bp_address_city,
ho_address_GLN, ho_address_name1, ho_address_name2, ho_address_street, ho_address_zip_code, ho_address_city,
p_instance_id)
AS
SELECT
1 AS no_of_labels,
dl_pack.ipa_sscc18 AS sscc,
dh.poreference AS order_reference,
dh.movementdate AS date_shipped,
dl.GTIN AS GTIN,
dl.productDescription AS product_description,
dl_pack.movementqty AS amount,
null::numeric AS weight,
dl_pack.bestBeforeDate AS best_before,
dl_pack.lotnumber AS lot_no,
bp_address.GLN AS bp_address_gln,
bp_address_location.address1 AS bp_address_name1,
bp_address_location.address2 AS bp_address_name2,
concat(bp_address_location.address1,' ', bp_address_location.address2) AS bp_address_street,
bp_address_location.postal AS bp_address_zip_code,
bp_address_location.city AS bp_address_city,
ho_address.GLN AS ho_address_gln,
ho_address_location.address1 AS ho_address_name1,
ho_address_location.address2 AS ho_address_name2,
concat(ho_address_location.address1,' ', ho_address_location.address2) AS ho_address_street,
ho_address_location.postal AS ho_address_zip_code,
ho_address_location.city AS ho_address_city,
t_sel.ad_pinstance_id AS p_instance_id
from t_selection t_sel
inner join edi_desadvline_pack dl_pack on t_sel.t_selection_id = dl_pack.edi_desadvline_pack_id
inner join edi_desadvline dl on dl_pack.edi_desadvline_id = dl.edi_desadvline_id
inner join edi_desadv dh on dl_pack.edi_desadv_id = dh.edi_desadv_id
left join c_bpartner_location bp_address on dh.c_bpartner_location_id = bp_address.c_bpartner_location_id
left join c_location bp_address_location on bp_address.c_location_id = bp_address_location.c_location_id
left join c_bpartner_location ho_address on dh.handover_location_id = ho_address.c_bpartner_location_id
left join c_location ho_address_location on ho_address.c_location_id = ho_address_location.c_location_id;

0 comments on commit d67ab78

Please sign in to comment.