|
- <?php
-
- namespace backend\modules\zzcs\models;
-
- use yii\db\ActiveRecord;
-
- /**
- * This is the model class for table "bus_order".
- *
- * @property integer $id
- * @property integer $bus_number
- * @property integer $create_user_id
- * @property string $create_time
- * @property integer $update_user_id
- * @property string $update_time
- * @property integer $cancel_flag
- * @property integer $use_bus_org_id
- * @property string $run_date
- * @property integer $run_bus_id
- * @property integer $run_id
- * @property integer $line_id
- * @property string $start_time
- * @property integer $bus_order_id
- * @property integer $bus_type_res_id
- * @property integer $seat_count
- * @property integer $saled_count
- * @property integer $itinerary_id
- * @property string $itinerary_name
- * @property integer $line_type
- * @property integer $day_num
- * @property integer $bus_cost_type
- * @property string $bus_cost
- * @property string $remark
- * @property string $send_msg
- * @property integer $send_type
- * @property string $send_cost
- * @property integer $send_bus_res_id
- * @property integer $send_bus_driver_res_id
- * @property integer $send_status
- * @property integer $run_status
- * @property integer $finance_status
- * @property integer $end_status
- * @property integer $line_status
- * @property integer $safe
- *
- * @property BaseBus $sendBusRes
- * @property BaseDriver $sendBusDriverRes
- */
- class BusOrder extends ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'bus_order';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['bus_number', 'create_user_id', 'update_user_id', 'run_date', 'seat_count', 'saled_count', 'send_type'], 'required'],
- [['bus_number', 'create_user_id', 'update_user_id', 'cancel_flag', 'use_bus_org_id', 'run_bus_id', 'run_id', 'line_id', 'bus_order_id', 'bus_type_res_id', 'seat_count', 'saled_count', 'itinerary_id', 'line_type', 'day_num', 'bus_cost_type', 'send_type', 'send_bus_res_id', 'send_bus_driver_res_id', 'send_status', 'run_status', 'finance_status', 'end_status', 'line_status', 'safe'], 'integer'],
- [['update_time'], 'safe'],
- [['bus_cost', 'send_cost'], 'number'],
- [['create_time'], 'string', 'max' => 20],
- [['run_date'], 'string', 'max' => 10],
- [['start_time'], 'string', 'max' => 128],
- [['itinerary_name'], 'string', 'max' => 50],
- [['remark'], 'string', 'max' => 100],
- [['send_msg'], 'string', 'max' => 1024],
- [['send_bus_res_id'], 'exist', 'skipOnError' => true, 'targetClass' => BaseBus::className(), 'targetAttribute' => ['send_bus_res_id' => 'BUS_ID']],
- [['send_bus_driver_res_id'], 'exist', 'skipOnError' => true, 'targetClass' => BaseDriver::className(), 'targetAttribute' => ['send_bus_driver_res_id' => 'DRIVER_ID']],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => '主键,自增',
- 'bus_number' => '出车单号',
- 'create_user_id' => 'Create User ID',
- 'create_time' => 'Create Time',
- 'update_user_id' => 'Update User ID',
- 'update_time' => '记录最后更新时间',
- 'cancel_flag' => 'Cancel Flag',
- 'use_bus_org_id' => '用车单位',
- 'run_date' => '用车日期',
- 'run_bus_id' => '车次ID,对应run_bus中的主键ID,用于派车时更新巴士系统车次库存',
- 'run_id' => '班次ID,供同步已有班次使用',
- 'line_id' => '线路ID,供同步数据使用',
- 'start_time' => 'Start Time',
- 'bus_order_id' => '车次号,供同步已有车次使用',
- 'bus_type_res_id' => '用车类型',
- 'seat_count' => '车座数',
- 'saled_count' => '乘客人数',
- 'itinerary_id' => '行程ID',
- 'itinerary_name' => '行程名称',
- 'line_type' => '行程类型,市内或省际 1为省际,2为市内',
- 'day_num' => '行程包含的行程天数',
- 'bus_cost_type' => '车辆计价方式 477为包车计价,478为人数计价',
- 'bus_cost' => '车辆计价金额',
- 'remark' => '用车备注',
- 'send_msg' => '调度原因等调度时候的信息',
- 'send_type' => '内部派车还是外部派车 0:内部 1:外部',
- 'send_cost' => '调派车辆时的价格',
- 'send_bus_res_id' => '调派车辆res_id',
- 'send_bus_driver_res_id' => '调派司机res_id',
- 'send_status' => '调度状态',
- 'run_status' => '出车状态',
- 'finance_status' => '报账状态',
- 'end_status' => '结算状态',
- 'line_status' => '线路牌 0为未亮起 1为亮起',
- 'safe' => '安检 0为未安检 1为已安检',
- ];
- }
-
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getSendBusRes()
- {
- return $this->hasOne(BaseBus::className(), ['BUS_ID' => 'send_bus_res_id']);
- }
-
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getSendBusDriverRes()
- {
- return $this->hasOne(BaseDriver::className(), ['DRIVER_ID' => 'send_bus_driver_res_id']);
- }
- }
|