{
	"name": "query/manager/product/product_work/order/work_order_schedule_state/query.json",
	"database": "4d",
	"table": [{
			"record_type": ["schedule"],
			"table": "product_work"
		},
		{
			"record_type": [""],
			"table": "production_order"
		},
		{
			"record_type": ["product"],
			"table": "product"
		},
		{
			"record_type": ["sales"],
			"table": "order_row"
		},
		{
			"record_type": ["sales"],
			"table": "order"
		}
	],
	"parameter": {
		"order_number": "",
		"selection_id": [],
		"show_sql": true
	},
	"limit": 1000,
	"optional_parameter": ["order_number", "selection_id"],
	"set": {
		"query_set": [
			["ord.company_reference_number", "starts", "order_number"],
			"or",
			["ord.order_id", "starts", "order_number"],
			"or",
			["ord.company_id", "starts", "order_number"]
		]
	},
	"qry_set_not_in_use": [
		["prwo.production_lot", "starts", "order_number"],
		"or",
		["ord.record_id", "in", "selection_id"]
	],
	"query": [
		"query_set",
		"and",
		["prwo.work_phase_number", ">", 0],
		"and",
		["ordr.delivery_state", "=", ""]
	],
	"order": [
		"pro.sales_order_id",
		">",
		"prwo.work_phase_number",
		">",
		"prwo.production_lot",
		">"
	]
}