{
	"name": "table/local/product/production_order.json",
	"table_name": "production_order",
	"table_prefix": "pro",
	"main_table": "product",
	"record_type": ["", "nxorderpos", "nxif_order"],
	"table_name_language": {
		"": "Production order",
		"nxorderpos": "nx order position",
		"nxif_order": "nx export order"
	},
	"default_field": "table/prf/default_field.json",
	"default_order": [
		{
			"field": "product_id",
			"order": ">"
		},
		{
			"field": "production_order_id",
			"order": ">"
		}
	],
	"save_script": [],
	"calculated_field": {
		"can_be_manufactured": {
			"field_type": "double"
		},
		"remaining_amount": {
			"type": "double"
		},
		"json_data.actual_end_date": {
			"type": "date"
		},
		"json_data.critical_start_date": {
			"type": "date"
		},
		"json_data.critical_end_date": {
			"type": "date"
		},
		"json_data.critical_delayed_end_date": {
			"type": "date"
		},
		"json_data.critical_real_end_date": {
			"type": "date"
		},
		"json_data.material_actual_arrival_date": {
			"type": "date"
		},
		"json_data.material_estimated_arrival_date": {
			"type": "date"
		}
	},
	"field": [
		{
			"field_name": "production_order_id",
			"field_type": "varchar",
			"field_length": 40,
			"constraint": ["primary key"],
			"not_allowed_value": [""]
		},
		{
			"field_name": "row_number",
			"field_type": "integer"
		},
		{
			"field_name": "product_id",
			"field_type": "varchar",
			"field_length": 40,
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "product_id",
					"linked_record_type": "work",
					"linked_table": "product",
					"linking_record_type": ""
				}
			]
		},
		{
			"field_name": "production_order_state",
			"field_type": "varchar",
			"field_length": 40,
			"info": "calculated, move to json"
		},
		{
			"field_name": "drawing_number",
			"field_type": "varchar",
			"field_length": 40
		},
		{
			"field_name": "amount_to_produce",
			"field_type": "double"
		},
		{
			"field_name": "produced_amount",
			"field_type": "double"
		},
		{
			"field_name": "failed_amount",
			"field_type": "double"
		},
		{
			"field_name": "remaining_amount",
			"field_type": "double"
		},
		{
			"field_name": "company_id",
			"field_type": "varchar",
			"field_length": 40,
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "company_id",
					"linked_record_type": "",
					"linked_table": "company",
					"linking_record_type": ""
				}
			],
			"not_allowed_value": [""]
		},
		{
			"field_name": "sales_order_id",
			"field_type": "varchar",
			"field_length": 40,
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "order_id",
					"linked_record_type": "",
					"linked_table": "order",
					"linking_record_type": ""
				}
			]
		},
		{
			"field_name": "sales_order_row",
			"field_type": "integer"
		},
		{
			"field_name": "info",
			"field_type": "text"
		}
	],
	"extra_field": [
		{
			"field_name": "json_data.production_order_number",
			"field_type": "varchar",
			"field_length": 20
		},
		{
			"field_name": "json_data.project_id",
			"field_type": "varchar",
			"field_length": 80
		},
		{
			"field_name": "json_data.start_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.est_finish_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.critical_start_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.critical_end_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.est_finish_difference",
			"field_type": "double"
		},
		{
			"field_name": "json_data.transfer_id",
			"field_type": "varchar",
			"field_length": 120
		},
		{
			"field_name": "json_data.critical_real_end_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.actual_end_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.track_time_status",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.parent_production_lot",
			"field_type": "varchar",
			"field_length": 80
		},
		{
			"field_name": "json_data.critical_start_difference",
			"field_type": "double"
		},
		{
			"field_name": "json_data.material_actual_arrival_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.firm_id",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.start_time",
			"field_type": "time"
		},
		{
			"field_name": "json_data.work__position_num_id",
			"field_type": "varchar",
			"field_length": 60
		},
		{
			"field_name": "json_data.finished_work_phase",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.partial_delivery_number",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.material_estimated_arrival_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.stock_event",
			"field_type": "text"
		},
		{
			"field_name": "json_data.type",
			"field_type": "varchar",
			"field_length": 20
		},
		{
			"field_name": "json_data.critical_delayed_end_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.work_order_type",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.transfer_info",
			"field_type": "text"
		},
		{
			"field_name": "json_data.in_report",
			"field_type": "boolean"
		},
		{
			"field_name": "json_data.est_finish_time",
			"field_type": "time"
		},
		{
			"field_name": "json_data.print_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.pricing_state",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.serial_number",
			"field_type": "varchar",
			"field_length": 80
		},
		{
			"field_name": "json_data.sales_price__unit",
			"field_type": "double"
		},
		{
			"field_name": "json_data.delivery_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.purchase_order_id",
			"field_type": "varchar",
			"field_length": 20
		},
		{
			"field_name": "json_data.transfer_state",
			"field_type": "integer"
		},
		{
			"field_name": "title",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.erp_status",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.mes_status",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.state",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.id",
			"field_type": "bigint"
		},
		{
			"field_name": "json_data.product_name",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.additional_data",
			"field_type": "text"
		},
		{
			"field_name": "json_data.act_finish_week",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.est_finish_week",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.start_week",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.work_phase",
			"info": "lantek",
			"field_type": "text"
		},
		{
			"field_name": "json_data.operation",
			"info": "lantek",
			"field_type": "text"
		},
		{
			"field_name": "json_data.thickness",
			"info": "lantek",
			"field_type": "text"
		},
		{
			"field_name": "json_data.material_id",
			"info": "lantek",
			"field_type": "text"
		},
		{
			"field_name": "json_data.work_phase_list",
			"info": "lantek",
			"field_type": "text"
		},
		{
			"field_name": "json_data.nxorderposid_s",
			"info": "lantek",
			"field_type": "text"
		},
		{
			"field_name": "json_data.nxsheetpathid_s",
			"info": "lantek",
			"field_type": "text"
		}
	],
	"field_change": [
		{
			"name": "amount_to_produce",
			"old_name": ["started_amount"]
		},
		{
			"name": "production_order_state",
			"old_name": ["state"]
		},
		{
			"name": "production_order_id",
			"old_name": ["production_lot"]
		}
	]
}
