<?php
class Service_PackedRecord extends Common_Service{
    
    public static $modelClass = null;
    
    public static function getModelInstance(){
        if(is_null($modelClass)){
            self::$modelClass = new Table_PackedRecord();
        }
        return  self::$modelClass;
    }
    
    public static function add($row)
    {
        $model = self::getModelInstance();
        return $model->add($row);
    }
    
    public static function update($row, $value, $field = "cof_id")
    {
        $model = self::getModelInstance();
        return $model->update($row, $value, $field);
    }
    
    public static function delete($value, $field = "cof_id")
    {
        $model = self::getModelInstance();
        return $model->delete($value, $field);
    }
    
    public static function getByField($value, $field = 'pr_id', $colums = "*")
    {
        $model = self::getModelInstance();
        return $model->getByField($value, $field, $colums);
    }
    
    public static function getByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = "")
    {
        $model = self::getModelInstance();
        return $model->getByCondition($condition, $type, $pageSize, $page, $order);
    }
    
    public  function getFields()
    {
        $row = array(
            'E0'=> 'pr_id',
            'E1'=> 'customer_code',
            'E2'=> 'pr_refer_code',
            'E3'=> 'pr_packing_quantity',
            'E4'=> 'pr_packing_time',
            'E5'=> 'pr_add_time',
            'E6'=> 'user_id',
            'E7'=> 'fee_id',
        );
        return $row;
    }
}