<?php
/**
 * 采购商品明细Dao
 * Created by PhpStorm.
 * User: XiaoMing
 * Date: 2019/11/11
 * Time: 17:53
 */

namespace JinDouYun\Dao\Purchase;

use JinDouYun\Dao\BaseDao;

class DPurchaseGoods extends BaseDao
{
    public function __construct($serviceDB = 'stock')
    {
        $this->_table = 'purchase_goods';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT,
            "purchaseId", //int(10) NOT NULL DEFAULT '0' COMMENT '采购单id',
            "goodsCode", //varchar(50) NOT NULL DEFAULT '' COMMENT '商品编码',
            "goodsName", //varchar(50) NOT NULL DEFAULT '' COMMENT '商品名称',
            "categoryId", //int(10) DEFAULT NULL COMMENT '分类id',
            "categoryName", //varchar(255) DEFAULT NULL COMMENT '分类名称',
            "unitName", //varchar(255) DEFAULT NULL COMMENT '单位名称',
            "skuName", //varchar(255) DEFAULT NULL COMMENT '属性名称',
            "buyerNum", //decimal(20,8) DEFAULT '0.00000000' COMMENT '采购数量',
            "inNum", //decimal(20,8) DEFAULT '0.00000000' COMMENT '入库数量',
            "otherNum",// decimal(20,8) DEFAULT '0.00000000' COMMENT '其他单位数量',
            "inOfNum", //decimal(20,8) DEFAULT '0.00000000' COMMENT '未入库数量',
            "returnOnNum", //decimal(20,8) DEFAULT NULL COMMENT '可退数量',
            "returnNum", //decimal(20,8) DEFAULT '0.00000000' COMMENT '退货数量',
            "buyerUnitPrice", //decimal(15,4) DEFAULT '0.0000' COMMENT '采购单价',
            "subtotalPrice", //decimal(15,4) DEFAULT '0.0000' COMMENT '小计金额(数量*单价)',
            "couponAmount", //decimal(15,4) DEFAULT '0.0000' COMMENT '优惠金额',
            "otherAmount", //decimal(15,4) DEFAULT '0.0000' COMMENT '其他金额',
            "inStatus", //tinyint(1) DEFAULT '4' COMMENT '入库状态 4:未入库 5:全部入库 6:部分入库',
            "returnStatus", //tinyint(3) DEFAULT '0' COMMENT '退货状态 0未退货 1部分退货 2全部退货',
            "deleteStatus", //tinyint(3) NOT NULL DEFAULT '5' COMMENT '是否删除 默认5 正常 4删除',
            "extends", //json DEFAULT NULL COMMENT '拓展字段',
            "createTime", //int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
            "updateTime", //int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            "basicGoodsId", //int(10) NOT NULL DEFAULT '0' COMMENT '基础商品id',
            "skuId", //int(10) DEFAULT NULL COMMENT 'skuId',
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}