{
	"name": "plugin/nc-calc-server/query/storage-query/product-reserved.json",

	"table": [
		{
			"record_type": [""],
			"table": "product"
		}
	],
	"parameter": {
		"production_order_state_open": "plugin/nc-calc-server/constant.json/production_order_state_open",
		"subquery": "SELECT DISTINCT wme.raw_material_id FROM work_material_estimated wme INNER JOIN work_order wo ON wo.work__position_num_id = wme.work__position_num_id WHERE wo.state IN ('KU','AL')",
		"show_sql": true
	},
	"order": ["pr.product_id", ">"],
	"subquery-": {
		"from": "order_row",
		"join_table": "production_order",
		"join_type": "LEFT OUTER JOIN",
		"join_where": [["pro.production_order_id", "=", "ordr.production_order_id"]],
		"query": [["pro.production_order_state", "in", "production_order_state_open"]]
	},
	"query-niu": [["pr.product_id", "in", "subquery"]],
	"query": [
		["pr.product_id", "<>", ""],
		"or",
		["pr.json_data.reserved", "<>", 0],
		"or",
		["pr.json_data.fixed", "<>", 0],
		"or",
		["pr.json_data.available", "<>", 0],
		"or",
		["pr.product_id", "in", "subquery"]
	]
}
