<?php
/**
 * Created by JetBrains PhpStorm.
 * User: user
 * Date: 15-6-4
 * Time: 下午5:10
 * To change this template use File | Settings | File Templates.
 */
class Service_SwapOrder extends Common_Service
{
    public static $_modelClass = null;

    public static function getModelInstance(){
        if (is_null(self::$_modelClass)){
            self::$_modelClass = new Table_SwapOrder();
        }
        return self::$_modelClass;
    }

    public static function add($row){
        $model = self::getModelInstance();
        return $model->add($row);
    }

    public static function update($row, $value, $field = "swo_id"){
        $model = self::getModelInstance();
        return $model->update($row, $value, $field);
    }

    public static function delete($value, $field = "swo_id"){
        $model = self::getModelInstance();
        return $model->delete($value, $field);
    }

    public static function getByField($value, $field = 'swo_id', $colums = "*"){
        $model = self::getModelInstance();
        return $model->getByField($value, $field, $colums);
    }

    public static function getAll(){
        $model = self::getModelInstance();
        return $model->getAll();
    }

    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 getJoinDetailByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = ""){
        $model = self::getModelInstance();
        return $model->getJoinDetailByCondition($condition, $type, $pageSize, $page, $order);
    }

    public static function getLeftJoinSwapOrderDetailByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = ""){
        $model = self::getModelInstance();
        return $model->getLeftJoinSwapOrderDetailByCondition($condition, $type, $pageSize, $page, $order);
    }

    public  function getFields()
    {
        $row = array(

            'E0'=>'swo_id',
            'E1'=>'swo_code',
            'E2'=>'serial_code',
            'E3'=>'customer_id',
            'E4'=>'customer_code',
            'E5'=>'swo_status',
            'E7'=>'add_time',
            'E8'=>'last_update_time',
            'E9'=>'remark',
            'E10'=>'putway_time',
            'E11'=>'is_abnormal'
        );
        return $row;
    }

}
