<?php
class Service_BgPriEntryDataDetailBodyHead extends Common_Service
{
    /**
     * @var null
     */
    public static $_modelClass = null;

    /**
     * @return Table_BgPriEntryDataDetailBodyHead|null
     */
    public static function getModelInstance()
    {
        if (is_null(self::$_modelClass)) {
            self::$_modelClass = new Table_BgPriEntryDataDetailBodyHead();
        }
        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 = "bpedbh_id")
    {
        $model = self::getModelInstance();
        return $model->update($row, $value, $field);
    }

    /**
     * @param $value
     * @param string $field
     * @return mixed
     */
    public static function delete($value, $field = "bpedbh_id")
    {
        $model = self::getModelInstance();
        return $model->delete($value, $field);
    }

    /**
     * @param $value
     * @param string $field
     * @param string $colums
     * @return mixed
     */
    public static function getByField($value, $field = 'bpedbh_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);
    }

    /**
     * @param $val
     * @return array
     */
    public static function validator($val)
    {
        $validateArr = $error = array();
        
        return  Common_Validator::formValidator($validateArr);
    }


    /**
     * @param array $params
     * @return array
     */
    public  function getFields()
    {
        $row = array(
                                      'E0'=>'bpedbh_id',
                                      'E1'=>'bpedd_id',
                                      'E2'=>'bpd_ref_no',
                                      'E3'=>'pt_code',
                                      'E4'=>'ie_flag',
                                      'E5'=>'declare_port',
                                      'E6'=>'ie_port',
                                      'E7'=>'enty_port_code',
                                      'E8'=>'ems_no',
                                      'E9'=>'ems_cop_no',
                                      'E10'=>'cop_gb_code',
                                      'E11'=>'platenumber',
                                      'E12'=>'traf_name',
                                      'E13'=>'traf_mode',
                                      'E14'=>'voyage_no',
                                      'E15'=>'bill_no',
                                      'E16'=>'wrap_type',
                                      'E17'=>'net_wt',
                                      'E18'=>'gross_wt',
                                      'E19'=>'pack_no',
                                      'E20'=>'duty_mode',
                                      'E21'=>'trade_mode',
                                      'E22'=>'trans_mode',
                                      'E23'=>'trade_country',
                                      'E24'=>'trade_area_code',
                                      'E25'=>'destination_port',
                                      'E26'=>'num',
                                      'E27'=>'turn_no',
                                      'E28'=>'trade_co',
                                      'E29'=>'trade_name',
                                      'E30'=>'agent_code',
                                      'E31'=>'agent_name',
                                      'E32'=>'owner_code',
                                      'E33'=>'owner_name',
                                      'E34'=>'rlt_entry_rvsngd_etps_sccd',
                                      'E35'=>'rlt_entry_rcvgd_etpsno',
                                      'E36'=>'rlt_entry_rcvgd_etps_nm',
                                      'E37'=>'rlt_entry_bizop_etps_sccd',
                                      'E38'=>'rlt_entry_bizop_etpsno',
                                      'E39'=>'rlt_entry_bizop_etps_nm',
                                      'E40'=>'add_time',
                                      'E41'=>'update_time',
                                      'E42'=>'remark',
                                      'E43'=>'ofile1',
                                      'E44'=>'ofile2',
                                      'E45'=>'ofile3',
                                );
        return $row;
    }

}