summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--collect_fulfillment.ktr103
1 files changed, 52 insertions, 51 deletions
diff --git a/collect_fulfillment.ktr b/collect_fulfillment.ktr
index 1771619..1956379 100644
--- a/collect_fulfillment.ktr
+++ b/collect_fulfillment.ktr
@@ -544,6 +544,45 @@
</hop>
</order>
<step>
+ <name>Add constants</name>
+ <type>Constant</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <field>
+ <name>created_by_id</name>
+ <type>Integer</type>
+ <format/>
+ <currency/>
+ <decimal/>
+ <group/>
+ <nullif>1</nullif>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ </field>
+ </fields>
+ <attributes/>
+ <cluster_schema/>
+ <remotesteps>
+ <input>
+ </input>
+ <output>
+ </output>
+ </remotesteps>
+ <GUI>
+ <xloc>1008</xloc>
+ <yloc>224</yloc>
+ <draw>Y</draw>
+ </GUI>
+ </step>
+ <step>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
@@ -655,43 +694,33 @@
<fields>
<field>
<name>sale_order_id</name>
- <rename/>
</field>
<field>
<name>sale_order_line_id</name>
- <rename/>
</field>
<field>
<name>product_id</name>
- <rename/>
</field>
<field>
<name>so_qty</name>
- <rename/>
</field>
<field>
<name>current_date</name>
- <rename/>
</field>
<field>
<name>delivered_qty</name>
- <rename/>
</field>
<field>
<name>reserved_stock_qty</name>
- <rename/>
</field>
<field>
<name>po_qty</name>
- <rename/>
</field>
<field>
<name>received_qty</name>
- <rename/>
</field>
<field>
<name>created_by_id</name>
- <rename/>
</field>
<select_unspecified>N</select_unspecified>
</fields>
@@ -1062,7 +1091,17 @@ order by posm.sale_line_id, sml.product_id</sql>
<schema_name/>
</partitioning>
<connection>erp indoteknik production (localhost)</connection>
- <sql>select sm.sale_line_id as sale_order_line_id, sml.product_id, sum(sml.product_uom_qty) as reserved_stock_qty
+ <sql>--select sm.sale_line_id as sale_order_line_id, sml.product_id, sum(sml.product_uom_qty) as reserved_stock_qty
+--from stock_move_line sml
+--join stock_move sm on sm.id = sml.move_id
+--join stock_picking sp on sp.id = sm.picking_id
+--where 1=1
+--and sp.state not in ('cancel')
+--and sm.sale_line_id is not null
+--and sm.write_date >= (now() - '180 days'::interval)
+--group by sm.sale_line_id, sml.product_id
+--order by sm.sale_line_id, sml.product_id
+select sm.sale_line_id as sale_order_line_id, sml.product_id, sum(sml.product_uom_qty) as reserved_stock_qty
from stock_move_line sml
join stock_move sm on sm.id = sml.move_id
join stock_picking sp on sp.id = sm.picking_id
@@ -1070,8 +1109,9 @@ where 1=1
and sp.state not in ('cancel')
and sm.sale_line_id is not null
and sm.write_date >= (now() - '180 days'::interval)
+and (sp.name like '%BU/PICK%' or sp.name like '%BU/OUT%')
group by sm.sale_line_id, sml.product_id
-order by sm.sale_line_id, sml.product_id</sql>
+order by sm.sale_line_id, sml.product_id</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@@ -1459,45 +1499,6 @@ order by sol.id, sol.product_id</sql>
<draw>Y</draw>
</GUI>
</step>
- <step>
- <name>Add constants</name>
- <type>Constant</type>
- <description/>
- <distribute>Y</distribute>
- <custom_distribution/>
- <copies>1</copies>
- <partitioning>
- <method>none</method>
- <schema_name/>
- </partitioning>
- <fields>
- <field>
- <name>created_by_id</name>
- <type>Integer</type>
- <format/>
- <currency/>
- <decimal/>
- <group/>
- <nullif>1</nullif>
- <length>-1</length>
- <precision>-1</precision>
- <set_empty_string>N</set_empty_string>
- </field>
- </fields>
- <attributes/>
- <cluster_schema/>
- <remotesteps>
- <input>
- </input>
- <output>
- </output>
- </remotesteps>
- <GUI>
- <xloc>1008</xloc>
- <yloc>224</yloc>
- <draw>Y</draw>
- </GUI>
- </step>
<step_error_handling>
</step_error_handling>
<slave-step-copy-partition-distribution>