{
	"name": "query/manager/product/product_work/order/postcalc_not_done.json",
	"table": [
		{
			"record_type": ["schedule"],
			"table": "product_work"
		}
	],
	"database": "4d",
	"parameter": {
		"remove_work": ["07056", "02101"],
		"show_sql": false,
		"work_order_open_state": ["EK", "KU", "AL"]
	},
	"field": [
		"prwo.json_data.subtype",
		"prwo.work_phase_state",
		"prwo.json_data.production_lot__work_ph",
		"prwo.production_lot"
	],
	"filter": [
		["if", [["prevRec", "=", "nil"], "or", ["prevRec.prwo.production_lot", "<>", "rec.prwo.production_lot"]], [["if", ["rec.prwo.work_phase_state", "=", "constantTbl.phase_state.finished"], [["filter_value", "=", "true"]], "elseif", [["rec.prwo.work_phase_state", "=", "constantTbl.phase_state.started"], "and", ["rec.prwo.json_data.subtype", "=", "constantTbl.phase_state.finished"]], [["filter_value", "=", "true"]]]]],
		["prevRec", "=", "rec"],
		["filter_value", "=", "false"]
	],
	"order": ["prwo.json_data.production_lot__work_ph", "<"],
	"query": [
		["pro.production_order_state", "in", "work_order_open_state"],
		"and",
		["pro.json_data.work__position_num_id", "not in", "remove_work"]
	]
}