{
	"name": "query/manager/product/product_work/actual/latest.json",
	"table": [
		{
			"record_type": ["actual"],
			"table": "product_work"
		}
	],
	"database": "4d",
	"parameter": {
		"days_before": 15,
		"last_date": "",
		"start_date": "",
		"start_minutes_before": 60,
		"start_time": "",
		"start_type": ["AL"],
		"maintenance_work_not_in_use": ["16279", "16280", "16281"],
		"maintenance_work": []
	},
	"field": ["prwo.record_id"],
	"limit": 1000000,
	"map_parameter": [
		["maintenance_work", "=", ["preferenceTagValue", ["manager/maintenance.json", "work_number_arr"]]],
		["days_before_negative", "=", ["-", ["days_before"]]],
		["last_date", "=", ["daysToCurrentDateStringAdd", ["days_before_negative"]]],
		["current_dt", "=", ["currentDateTime"]],
		["start_minutes_before_negative", "=", ["-", ["start_minutes_before"]]],
		["start_seconds_before_negative", "=", ["start_minutes_before_negative", "*", 60]],
		["start_dt", "=", ["secondsAdd", ["current_dt", "start_seconds_before_negative"]]],
		["start_date", "=", ["dateTimeToDateString", ["start_dt"]]],
		["start_time", "=", ["dateTimeToTimeString", ["start_dt"]]]
	],
	"order": ["prwo.json_data.end_date", "<", "prwo.json_data.end_time", "<"],
	"query": ["valid_date_or_started", "and", ["wpa_work__position_num_id", "not in", "maintenance_work"]],
	"set": {
		"valid_date_or_started": [["prwo.json_data.end_date", ">=", "last_date"], "or", "started"],
		"started": ["started_1", "or", "started_2"],
		"started_1": [
			["prwo.work_phase_type", "in", "start_type"],
			"and",
			["prwo.json_data.start_date", "=", "start_date"],
			"and",
			["prwo.json_data.start_time", ">=", "start_time"]
		],
		"started_2": [["wpa_type_", "in", "start_type"], "and", ["wpa_start_date", ">", "start_date"]]
	},
	"order": ["prwo.json_data.end_date", "<", "wpa_end_time", "<"],
	"limit": 1000000,
	"field": ["wpa_record_id"]
}
