Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Выгрузка заказа из ERP. Для типа '700' создаем заказ, отправку(shipment) и поток заказов(wave). Для остальных типов только заказ+отправка. -->
- <download name="download_order" no_confirm="yes" checking_script="check_order_action()" processing_script="test">
- <field name="order_id" type="string"/>
- <field name="client_id" type="string" default="0" checking_script="get_id_by_field( 'client', 'sdid' )"/>
- <field name="type" type="string" checking_script="convert_order_type()"/>
- <field name="date_to_ship" type="string" checking_script="date_utils_date2ctime()"/>
- <field name="shipping_address" type="string" default=""/>
- <field name="shipment_id" type="string" default="0"/>
- <field name="ship_seq" type="string" default="0"/>
- <field name="responsible" type="string" default=""/>
- <field name="comments" type="string" default=""/>
- <action type="db" action_on="insert">
- insert into orders (id, sdid, status, client_id,
- type, date_to_ship, shipping_address, shipment, ship_seq,
- responsible,
- comments, created_by)
- values (
- $_internal_id,
- '$order_id',
- 'R',
- '$client_id',
- '$type',
- $date_to_ship,
- '$shipping_address',
- '$shipment_id',
- '$ship_seq',
- '$responsible',
- '$comments',
- 'GATEWAY')
- </action>
- <action type="db" action_on="insert_shipment">
- begin
- insert into shipment (shipment_id, id, date_to_ship, sdid, created_by)
- values (
- $_internal_id_s,
- '$shipment_id',
- $date_to_ship,
- '$shipment_id',
- 'GATEWAY');
- insert into orders (id, sdid, status, client_id,
- type, date_to_ship, shipping_address, shipment, ship_seq,
- responsible,
- comments, created_by)
- values (
- $_internal_id,
- '$order_id',
- 'R',
- '$client_id',
- '$type',
- $date_to_ship,
- '$shipping_address',
- '$shipment_id',
- '$ship_seq',
- '$responsible',
- '$comments',
- 'GATEWAY');
- end;
- </action>
- <action type="db" action_on="insert_shipment_wave">
- begin
- insert into shipment (shipment_id, id, date_to_ship, sdid, created_by)
- values (
- $_internal_id_s,
- '$shipment_id',
- $date_to_ship,
- '$shipment_id',
- 'GATEWAY');
- insert into wave (id, status, type, drop_place, shipment_id, created_by)
- values (
- $_internal_id_s,
- 'O',
- 'q',
- 0,
- '$shipment_id',
- 'GATEWAY');
- insert into orders (id, sdid, status, client_id,
- type, date_to_ship, shipping_address, shipment, ship_seq, wave_id,
- responsible,
- comments, created_by)
- values (
- $_internal_id,
- '$order_id',
- 'R',
- '$client_id',
- '$type',
- $date_to_ship,
- '$shipping_address',
- '$shipment_id',
- '$ship_seq',
- $_internal_id_s,
- '$responsible',
- '$comments',
- 'GATEWAY');
- end;
- </action>
- <action type="db" action_on="insert_wave">
- begin
- insert into orders (id, sdid, status, client_id,
- type, date_to_ship, shipping_address, shipment, ship_seq, wave_id,
- responsible,
- comments, created_by)
- values (
- $_internal_id,
- '$order_id',
- 'R',
- '$client_id',
- '$type',
- $date_to_ship,
- '$shipping_address',
- '$shipment_id',
- '$ship_seq',
- (select id from wave where shipment_id='$shipment_id'),
- '$responsible',
- '$comments',
- 'GATEWAY');
- end;
- </action>
- <action type="db" action_on="insert_only_shipment_wave">
- begin
- insert into shipment (shipment_id, id, date_to_ship, sdid, created_by)
- values (
- $_internal_id_s,
- '$shipment_id',
- $date_to_ship,
- '$shipment_id',
- 'GATEWAY');
- insert into wave (id, status, type, drop_place, shipment_id, created_by)
- values (
- $_internal_id_s,
- 'O',
- 'q',
- 0,
- '$shipment_id',
- 'GATEWAY');
- end;
- </action>
- <action type="db" action_on="update">
- begin
- update orders set
- client_id='$client_id',
- type='$type',
- date_to_ship=$date_to_ship,
- shipping_address='$shipping_address',
- comments='$comments',
- modified=sysdate,
- modified_by='GATEWAY'
- where id=$_internal_id;
- delete from order_details where order_id = $_internal_id;
- end;
- </action>
- <action type="db" action_on="update_shipment">
- begin
- update orders set
- shipping_address='$shipping_address',
- shipment='$shipment_id',
- ship_seq='$ship_seq',
- modified=sysdate,
- modified_by='GATEWAY'
- where id=$_internal_id;
- delete from order_details where order_id = $_internal_id;
- end;
- </action>
- <action type="db" action_on="update_wave">
- begin
- update orders set
- shipping_address='$shipping_address',
- shipment='$shipment_id',
- ship_seq='$ship_seq',
- wave_id=(select id from wave where shipment_id='$shipment_id'),
- modified=sysdate,
- modified_by='GATEWAY'
- where id=$_internal_id;
- delete from order_details where order_id = $_internal_id;
- end;
- </action>
- <action type="db" action_on="delete">
- begin
- delete from order_details where order_id = $_internal_id;
- delete from orders where id = $_internal_id;
- end;
- </action>
- <post-action type="db" action_on="insert_only_shipment_wave">
- begin
- update orders set
- shipping_address='$shipping_address',
- shipment='$shipment_id',
- ship_seq='$ship_seq',
- wave_id=(select id from wave where shipment_id='$shipment_id'),
- modified=sysdate,
- modified_by='GATEWAY'
- where id=$_internal_id;
- delete from order_details where order_id = $_internal_id;
- end;
- </post-action>
- <post-action type="pl-send" action_on="insert">
- order_new( $_internal_id, [ autor( gateway ) ] ).
- </post-action>
- <post-action type="pl-send" action_on="update">
- order_new( $_internal_id, [ autor( gateway ) ] ).
- </post-action>
- </download>
Add Comment
Please, Sign In to add comment