`

查询未发货订单SQL

阅读更多

查询未发货订单语句:

select msi.segment1                      产品编码,
       msi.description                   产品说明,
       ooh.order_number                  订单头编号,
       ool.ordered_quantity              订单行订购数量,
       ool.line_number                   行编号,
       ool.flow_status_code              订单状态,
       ool.line_id                       订单行id,
       ool.org_id                        组织机构id,
       ool.header_id                     订单头id,
       ool.line_type_id                  订单行类型id,
       ool.line_number                   订单行号,
       ool.ordered_item                  项目编码,
       ool.request_date                  计划发货日期,
       ool.promise_date                  承诺到货日期,
       ool.schedule_ship_date            产品可用计划理货日期,
       ool.order_quantity_uom            定购uom,
       ool.cancelled_quantity            取消数量,
       ool.shipped_quantity              发货数量,
       ool.ordered_quantity              订购数量,
       ool.shipping_quantity_uom         发运uom,
       ool.delivery_lead_time            发运在途时间,
       ool.ship_from_org_id              发货库存组织id,
       ool.ship_to_org_id                发货至客户accountid,
       ool.invoice_to_org_id             开票至客户accountid,
       ool.ship_to_contact_id            发货至联系人id,
       ool.invoice_to_contact_id         开票至联系人id,
       ool.sold_to_org_id                客户accountid,
       ool.cust_po_number                合同号,
       ool.inventory_item_id             项目id,
       ool.invoice_interface_status_code ar接口状态,
       ool.demand_class_code             需求分类,
       ool.price_list_id                 价目表id,
       ool.shipping_method_code          发运方法code,
       ool.freight_terms_code            运费方法code,
       ool.fob_point_code                fobcode,
       ool.payment_term_id               付款条件id,
       ool.invoicing_rule_id             开票规则id,
       ool.accounting_rule_id            会计规则id,
       ool.item_revision                 item版本,
       ool.unit_selling_price            销售单价,
       ool.unit_list_price               价目表价格,
       ool.context                       标准产品,
       ool.attribute1                    直发行,
       ool.attribute2                    item,
       ool.attribute3                    财务分类,
       ool.attribute4                    工程评审单价,
       ool.attribute5                    订单行备注,
       ool.attribute6,
       ool.attribute7,
       ool.attribute8,
       ool.attribute9,
       ool.attribute10,
       ool.attribute11,
       ool.attribute12,
       ool.attribute13,
       ool.attribute14,
       ool.creation_date                 输入日期,
       ool.created_by                    输入人id,
       ool.last_update_date              更新日期,
       ool.last_updated_by               更新人id,
       ool.last_update_login             更新人用户,
       ool.top_model_line_id             顶层模型行id,
       ool.link_to_line_id               上层行id,
       ool.item_type_code                项目类型,
       ool.visible_demand_flag           是否挂需求,
       ool.line_category_code            行类别,
       ool.ato_line_id                   最临近的ato模型行id,
       ool.schedule_arrival_date         计划到货日期,
       ool.schedule_status_code          计划状态,
       ool.cancelled_flag                取消标记,
       ool.open_flag,
       ool.booked_flag                   登记标记,
       ool.salesrep_id                   销售员id,
       ool.return_reason_code            退货原因code,
       ool.ordered_item_id               项目id,
       ool.shipping_interfaced_flag      是否已经到发运接口,
       ool.fulfilled_flag,
       ool.invoiced_quantity             开票数量,
       ool.shippable_flag                是否可发运,
       ool.flow_status_code              行工作流状态,
       ool.subinventory                  发货子库存
  from oe_order_lines_all   ool, --订单行
       oe_order_headers_all ooh, --订单头
       mtl_system_items_b   msi
 where 1 = 1
   and msi.organization_id = 103 --组织机构id
   and msi.inventory_item_id = ool.inventory_item_id --物料id
      
   and ool.header_id = ooh.header_id --订单头
   and ool.ordered_item is not null --产品编码
   and ool.shipped_quantity is null --发运数量
   and ool.flow_status_code != 'CANCELLED' --订单行状态
   and ool.flow_status_code != 'CLOSED' --订单行状态
   and ool.ordered_quantity > 0 --订单行订购数量
   and msi.segment1 in ('C.HP.MT01.BKE.300-060ZB-KJ01-30075') --产品编码
--and ooh.order_type_id in ('1007', '1172', '1232', '1253', '1021', '1009', '1014', '1018', '1292')--订单类型
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics