<?php

class Service_InvtOrderSb extends Common_Service
{
    /**
     * @var null
     */
    public static $_modelClass = null;

    /**
     * @return Table_Bank|null
     */
    public static function getModelInstance() {
        if (is_null(self::$_modelClass)) {
            self::$_modelClass = new Table_InvtOrderSb();
        }
        return self::$_modelClass;
    }

    /**
     * @param $row
     * @return mixed
     */
    public static function add($row) {
        $model = self::getModelInstance();
        return $model->add($row);
    }


    /**
     * @param $row
     * @param $value
     * @param string $field
     * @return mixed
     */
    public static function update($row, $value, $field = "ios_id") {
        $model = self::getModelInstance();
        return $model->update($row, $value, $field);
    }

    /**
     * Note:导出查验车辆信息
     * User: Yao
     * Date: 2021/10/16
     * Time: 15:54
     * @param $invtNo
     * @return mixed
     */
    public static function getExportCheckInfo($invtNo){
        $model = self::getModelInstance();
        return $model->getExportCheckInfo($invtNo);
    }
    public static function updateBatch($row, $value, $field = "ios_id") {
        $model = self::getModelInstance();
        return $model->updateBatch($row, $value, $field);
    }

    public static function updateByCondition($row,$condition) {
        $model = self::getModelInstance();
        return $model->updateByCondition($row, $condition);
    }


    /**
     * @param $value
     * @param string $field
     * @return mixed
     */
    public static function delete($value, $field = "ios_id") {
        $model = self::getModelInstance();
        return $model->delete($value, $field);
    }
    public static function deleteByOrderInv($orderCode,$etpsInnerInvtNo) {
        $model = self::getModelInstance();
        return $model->deleteByOrderInv($orderCode,$etpsInnerInvtNo);
    }

    /**
     * @param $value
     * @param string $field
     * @param string $colums
     * @return mixed
     */
    public static function getByField($value, $field = 'ios_id', $colums = "*") {
        $model = self::getModelInstance();
        return $model->getByField($value, $field, $colums);
    }

    /**
     * @return mixed
     */
    public static function getAll() {
        $model = self::getModelInstance();
        return $model->getAll();
    }

    /**
     * @param array $condition
     * @param string $type
     * @param int $pageSize
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public static function getByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = "") {
        $model = self::getModelInstance();
        return $model->getByCondition($condition, $type, $pageSize, $page, $order);
    }

    public static function getColByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = "") {
        $model = self::getModelInstance();
        return $model->getColByCondition($condition, $type, $pageSize, $page, $order);
    }
    /**
     * @param $val
     * @return array
     */
    public static function validator($val) {
        $validateArr = $error = array();

        return Common_Validator::formValidator($validateArr);
    }

    public static function getGiftProductByCondition($imId,$type,$groupBy){
        $model = self::getModelInstance();
        return $model->getGiftProductByCondition($imId, $type,$groupBy);
    }


    /**
     * @param array $params
     * @return array
     */
    public function getFields() {
        $row = array(
            'E0' => 'ios_id',
            'E1' => 'order_code',
            'E2' => 'tracking_number',
            'E3' => 'reference_no',
            'E4' => 'form_id_xml',
            'E5' => 'form_id_port',
            'E6' => 'EtpsInnerInvtNo',
            'E7' => 'add_time',
            'E8' => 'ios_status',
            'E9' => 'remark',
            'E10' => 'ios_fileld1',
            'E11' => 'ios_fileld2',
            'E12' => 'ios_field3',
            'E13' => 'ios_field4',
        );
        return $row;
    }

}