***************************所有表都得引用公司company表**********************company_id***************

支付类型表：moneyaccount     biz_moneyaccount

订单表：order     biz_order---------------------
        引用表的信息:
        //订单表引用用户信息
        this.db.models.order.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        this.db.models.order.belongsTo(this.db.models.user, { as: 'updateuser', constraints: false, });
        //订单
        this.db.models.order.belongsTo(this.db.models.customerinfo, { constraints: false, });//申请人表（企业或个人）
        this.db.models.order.hasMany(this.db.models.tmstuff, { constraints: false, });//附件表
订单流程：orderflow  biz_orderflow
        引用表的信息:
        this.db.models.orderflow.belongsTo(this.db.models.user,{as:'createuser',constraints: false,}); 



客户信息：customerinfo   biz_customerinfo---------------------
客户联系人：customercontacts  biz_customercontacts
        引用表的信息:
        this.db.models.customercontacts.belongsTo(this.db.models.customerinfo,{constraints: false,}); 



收款单：收入支出receiptvoucher    biz_receiptvoucher
        引用表的信息:
        //收款单引用帐户信息
        this.db.models.receiptvoucher.belongsTo(this.db.models.moneyaccount, { constraints: false, });
        this.db.models.tmstuff.belongsTo(this.db.models.company, { as: 'createcompany', constraints: false, });//创建收款单的公司
        //收款单表引用用户信息
        this.db.models.receiptvoucher.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        this.db.models.receiptvoucher.belongsTo(this.db.models.user, { as: 'updateuser', constraints: false, });
        this.db.models.receiptvoucher.belongsTo(this.db.models.user, { as: 'payuser', constraints: false, });



费用单：expensevoucher    biz_expensevoucher
        引用表的信息:
        //费用表引用帐户信息
        this.db.models.expensevoucher.belongsTo(this.db.models.moneyaccount, { constraints: false, });
        //费用表引用用户信息
        this.db.models.expensevoucher.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        this.db.models.expensevoucher.belongsTo(this.db.models.user, { as: 'updateuser', constraints: false, });



账单：moneyjourney  biz_moneyjourney
        引用表的信息:
        //订单流程表引用用户信息
        this.db.models.moneyjourney.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });


商标表：trademark  biz_trademark
        引用表的信息:
        //商标表引用用户信息
        this.db.models.trademark.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        this.db.models.trademark.belongsTo(this.db.models.user, { as: 'updateuser', constraints: false, });
        this.db.models.trademark.belongsTo(this.db.models.user, { as: 'audituser', constraints: false, });
        this.db.models.trademark.hasMany(this.db.models.tmofficial, { constraints: false, });
商标材料：tmstuff   biz_tmstuff
        引用表的信息:
        //商标官文引用用户表
        this.db.models.tmstuff.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        //商标材料引用订单表
        this.db.models.tmstuff.belongsTo(this.db.models.order, { constraints: false, }); XXXXXXXXXXX删除引用
商标官文：tmofficial  biz_tmofficial
        引用表的信息:
        //商标官文引用用户表
        this.db.models.tmofficial.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        //商标官文引用商标表
        this.db.models.tmofficial.belongsTo(this.db.models.trademark, { constraints: false, }); 
        // 商标官文引用订单表
        this.db.models.tmofficial.belongsTo(this.db.models.order, { constraints: false, });        

发票申请：invoiceapply   biz_invoiceapply
        引用表的信息:
        //发票申请引用用户表
        this.db.models.invoiceapply.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        //发票申请引用订单表
        this.db.models.invoiceapply.belongsTo(this.db.models.order, { constraints: false, });  
        this.db.models.invoiceapply.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        this.db.models.invoiceapply.belongsTo(this.db.models.user, { as: 'audituser', constraints: false, });  

用户地址：useraddr   biz_useraddr
        引用表的信息:
        //发票申请引用用户表
        this.db.models.useraddr.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });


设置表的约束
收款单：收入支出receiptvoucher    biz_receiptvoucher   
        receiptType    收款类型，"sk": "收款","tk": "退款","zz": "转账" ,"csrz": "初始入账" ,"ptdsk": "代收款","ptzz": "平台转账"
        sourceOrderNo  来源单号

费用单：expensevoucher    biz_expensevoucher    
        expenseType     收款类型，"gf": "官费", "sxf": "手续费", "tax": "税金", "salary": "薪酬", "sale": "销售费用", "mag": "管理费用"
        sourceOrderNo   来源单号        

账单：moneyjourney  biz_moneyjourney
        sourceType      来源类型 "order": "订单","expensevoucher": "费用单","receiptvoucher": "收款单", "trademark": "商标单"
        sourceOrderNo   来源单号
        directionType   凭单类型,"sr": "收","zc": "支"



商机公司表：businesscompany　　　bi_businesscompany
        引用表的信息:
        this.db.models.businesscompany.belongsTo(this.db.models.company, { constraints: false, });
        this.db.models.businesscompany.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });
        this.db.models.businesscompany.belongsTo(this.db.models.user, { as: 'updateuser', constraints: false, });

商机表：businessinfo　　　bi_businessinfo
    引用表的信息:
    this.db.models.businessinfo.belongsTo(this.db.models.company, { as: 'createcompany', constraints: false, });//认领人公司
    this.db.models.businessinfo.belongsTo(this.db.models.user, { as: 'createuser', constraints: false, });//认领人
    this.db.models.businessinfo.belongsTo(this.db.models.user, { as: 'updateuser', constraints: false, });




gulp all --name Order --bizfile order

gulp all --name OrderFlow --bizfile orderflow

gulp all --name CustomerInfo --bizfile customerinfo

gulp all --name CustomerContacts --bizfile customercontacts

gulp all --name ReceiptVoucher --bizfile receiptvoucher

gulp all --name ExpenseVoucher --bizfile expensevoucher

gulp all --name MoneyJourney --bizfile moneyjourney

gulp all --name TradeMark --bizfile trademark

gulp all --name TmStuff --bizfile tmstuff

gulp all --name TmOfficial --bizfile tmofficial        

gulp all --name InvoiceApply --bizfile invoiceapply        

gulp all --name UserAddr --bizfile useraddr        

