<?php
/**
 * 入库管理Dao
 * Created by PhpStorm.
 * User: 小威
 * Date: 2019/11/11
 * Time: 18:30
 */

namespace JinDouYun\Dao\Stock;

use JinDouYun\Dao\BaseDao;

class DInventoryIn extends BaseDao
{
    public function __construct($serviceDB = 'stock')
    {
        $this->_table = 'inventory_in';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT COMMENT '主键自增',
            "no", //char(25) NOT NULL COMMENT '入库单号',
            "sourceId", //int(10) NOT NULL COMMENT '来源id',
            "sourceNo", //char(25) NOT NULL COMMENT '来源单号',
            "originNo", //char(25) NOT NULL COMMENT '源头单号',
            "merchantId", // int(10) NOT NULL DEFAULT '0' COMMENT '商户id',
            "originId", //int(10) DEFAULT NULL COMMENT '源头id',
            "materielNum", //int(10) DEFAULT NULL COMMENT '入库商品数量',
            "amount", //decimal(15,4) DEFAULT NULL COMMENT '入库总金额',
            "costAllocationType", //tinyint(1) DEFAULT NULL COMMENT '成本分摊类型',
            "costAllocation", //decimal(15,4) DEFAULT '0.0000' COMMENT '成本分摊费用',
            "shopId", //int(10) DEFAULT '0' COMMENT '商铺id',
            "warehouseId", //int(10) DEFAULT NULL COMMENT '仓库id',
            "warehouseName", //varchar(255) DEFAULT NULL COMMENT '仓库名称',
            "operatorId", //int(10) DEFAULT NULL COMMENT '操作人id',
            "operatorName", //varchar(255) DEFAULT NULL COMMENT '操作人姓名',
            "auditId", //int(10) DEFAULT NULL COMMENT '审核人id',
            "auditName", //varchar(20) DEFAULT NULL COMMENT '审核人姓名',
            "remark", //varchar(255) DEFAULT NULL COMMENT '备注',
            "deleteStatus", //tinyint(3) DEFAULT NULL COMMENT '删除状态 5:正常 4:删除',
            "source", //tinyint(3) DEFAULT NULL COMMENT '订单来源(入库类型)',
            "type", //tinyint(3) DEFAULT NULL COMMENT '单据类型',
            "auditStatus", //tinyint(3) DEFAULT NULL COMMENT '审核状态 1:未审核 2:已审核',
            "auditTime", //int(10) DEFAULT NULL COMMENT '审核日期',
            "createTime", //int(10) DEFAULT NULL COMMENT '创建时间/制单时间',
            "updateTime", //int(10) DEFAULT NULL COMMENT '修改时间',
            "extend", //json DEFAULT NULL COMMENT '拓展字段',
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}