在供应商 "测试供应商A" 下已经有了两个地址,分别为 "地址A","地址B",现在由于某些原因,需要在地址A下面创建新的地点。
由于业务需要,所以使用的是将数据导入ap_supplier_sites_int接口表,再使用 "供应商站点开放接口导入" 请求来创建新的地点。
参考代码如下:根据实际业务补充。
SELECT * FROM ap.ap_supplier_sites_int; / truncate TABLE ap.ap_supplier_sites_int; / SELECT pv.vendor_id,
hl.location_id,
hp.party_id,
hps.party_site_id,
hl.country,
hl.address1,
hps.party_site_name,
hl.address1,
hl.address2,
hl.address3,
hl.address4,
hl.city,
hl.state,
hl.province,
hl.country,
hl.county,
hl.language,
hl.address_style
FROM hz_locations hl,
hz_parties hp,
po_vendors pv,
hz_party_sites hps
WHERE pv.party_id = hp.party_id
AND hps.party_id = hp.party_id
AND hps.location_id = hl.location_id
AND pv.vendor_name = '简单的供应商导入1'
AND hl.address_lines_phonetic = 'Y'; / DECLARE
-- Local variables here l_iface_site_rec ap_supplier_sites_int%ROWTYPE; BEGIN
-- Test statements here FOR cc IN (SELECT pv.vendor_id,
hl.location_id,
hp.party_id,
hps.party_site_id,
hps.party_site_name,
hl.address1,
hl.address2,
hl.address3,
hl.address4,
hl.city,
hl.state,
hl.province,
hl.country,
hl.county,
hl.language,
hl.address_style
FROM hz_locations hl,
hz_parties hp,
po_vendors pv,
hz_party_sites hps
WHERE pv.party_id = hp.party_id
AND hps.party_id = hp.party_id
AND hps.location_id = hl.location_id
AND pv.vendor_name = '简单的供应商导入1'
AND hl.address_lines_phonetic = 'Y') LOOP
l_iface_site_rec.vendor_id := cc.vendor_id; --供应商ID
l_iface_site_rec.location_id := cc.location_id;
l_iface_site_rec.address_line1 := cc.address1;
l_iface_site_rec.address_line2 := cc.address2;
l_iface_site_rec.address_line3 := cc.address3;
l_iface_site_rec.address_line4 := cc.address4;
l_iface_site_rec.city := cc.city;
l_iface_site_rec.state := cc.state;
-- l_iface_site_rec.zip := --此字段我未找到
l_iface_site_rec.province := cc.province;
l_iface_site_rec.country := cc.country;
l_iface_site_rec.county := cc.county;
l_iface_site_rec.language := cc.language;
l_iface_site_rec.address_style := cc.address_style;
--付款标识
l_iface_site_rec.pay_site_flag := 'Y';
--采购标识
l_iface_site_rec.purchasing_site_flag := 'Y';
l_iface_site_rec.org_id := 161; --地点对应的业务实体
l_iface_site_rec.vendor_site_code := substr('地点0626_1',
1,
15);
END LOOP; INSERT INTO ap.ap_supplier_sites_int VALUES l_iface_site_rec; COMMIT;
END; / SELECT * FROM ap.ap_supplier_sites_int;
再执行"供应商站点开放接口导入"请求,导入地点。
参考文章: