<?php
/**
 * 采购Dao
 * Created by PhpStorm.
 * User: XiaoMing
 * Date: 2019/11/11
 * Time: 17:46
 */

namespace JinDouYun\Dao\Purchase;

use JinDouYun\Dao\BaseDao;

class DPurchase extends BaseDao
{
    public function __construct($serviceDB = 'stock')
    {
        $this->_table = 'purchase';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT,
            "no", //char(25) NOT NULL COMMENT '采购单号',
            "shopId", //int(10) DEFAULT NULL COMMENT '商铺id',
            "merchantId", // int(10) NOT NULL DEFAULT '0' COMMENT '商户id',
            "merchantName" ,//varchar(255) NOT NULL COMMENT '商户名称',
            "warehouseId", //int(10) DEFAULT NULL COMMENT '仓库id',
            "warehouseName", //varchar(50) DEFAULT NULL COMMENT '仓库名称',
            "supplierId", //int(10) NOT NULL DEFAULT '0' COMMENT '供应商Id',
            "supplierName", //varchar(255) NOT NULL DEFAULT '' COMMENT '供应商名称',
            "buyerId", //int(10) NOT NULL DEFAULT '0' COMMENT '采购人员Id',
            "buyerName", //varchar(255) NOT NULL DEFAULT '' COMMENT '采购人员名称',
            "remark", //varchar(255) DEFAULT '' COMMENT '备注',
            "operatorId", //int(10) NOT NULL DEFAULT '0' COMMENT '制单人员Id',
            "operatorName", //varchar(255) NOT NULL DEFAULT '' COMMENT '制单人名',
            "purchaseAmount", //decimal(15,4) DEFAULT '0.0000' COMMENT '采购金额',
            "couponAmount", //decimal(15,4) DEFAULT '0.0000' COMMENT '优惠金额',
            "otherAmount", //decimal(15,4) DEFAULT '0.0000' COMMENT '其他金额',
            "goodsNum", //decimal(20,8) NOT NULL COMMENT '采购商品数量',
            "extends", //json DEFAULT NULL COMMENT '拓展字段',
            "returnStatus", //tinyint(3) DEFAULT '0' COMMENT '退货状态 0:未退货 1:部分退货 2:全部退货',
            "purchaseType", // tinyint(3) NOT NULL DEFAULT '4' COMMENT '采购类型  4：采购订单   5：商户采购单',
            "inStatus", //tinyint(3) DEFAULT '4' COMMENT '单据入库状态 4:未入库 5:已入库',
            "auditStatus", //tinyint(3) NOT NULL DEFAULT '1' COMMENT '审核状态  默认1 待审 2审核通过 3审核未通过 4审核中',
            "deleteStatus", //tinyint(3) NOT NULL DEFAULT '5' COMMENT '是否删除 默认5 正常 4删除',
            "auditId", //int(10) NOT NULL DEFAULT '0' COMMENT '审核人员Id',
            "auditName", //varchar(255) NOT NULL DEFAULT '' COMMENT '审核人员名册',
            "auditTime", //int(10) NOT NULL DEFAULT '0' COMMENT '审核时间',
            "createTime", //int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
            "updateTime", //int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            "serialNum", //varchar(50) DEFAULT '' COMMENT '序号',
            'havaRefund'
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}