Commit e9b42913 by 蒋勇

d

parent 171ce4b7
var system = require("../../../system")
const CtlBase = require("../../ctl.base");
class ProductcostCtl extends CtlBase {
constructor() {
super("product", CtlBase.getServiceName(ProductcostCtl));
// this.pricestrategyService=system.getObject("service.product.pricestrategySve")
}
}
module.exports = ProductcostCtl;
...@@ -73,6 +73,9 @@ class DbFactory{ ...@@ -73,6 +73,9 @@ class DbFactory{
//产品价格引用定价策略 //产品价格引用定价策略
this.db.models.productprice.belongsTo(this.db.models.pricestrategy,{constraints: false,}); this.db.models.productprice.belongsTo(this.db.models.pricestrategy,{constraints: false,});
//成本项目属于productprice
this.db.models.productcost.belongsTo(this.db.models.productprice,{constraints: false,});
} }
//async getCon(){,用于使用替换table模型内字段数据使用 //async getCon(){,用于使用替换table模型内字段数据使用
getCon(){ getCon(){
......
const system=require("../../../system");
const Dao=require("../../dao.base");
class ProductcostDao extends Dao{
constructor(){
super(Dao.getModelName(ProductcostDao));
}
extraModelFilter(){
//return {"key":"include","value":[{model:this.db.models.app,},{model:this.db.models.role,as:"Roles",attributes:["id","name"],joinTableAttributes:['created_at']}]};
return {"key":"include","value":[
{model:this.db.models.productprice,attributes:["id","lowpriceref"]}]};
}
}
module.exports=ProductcostDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
...@@ -21,7 +21,7 @@ module.exports = (db, DataTypes) => { ...@@ -21,7 +21,7 @@ module.exports = (db, DataTypes) => {
allowNull: false, allowNull: false,
}//和user的from相同,在注册user时,去创建 }//和user的from相同,在注册user时,去创建
}, { }, {
paranoid: true,//假的删除 paranoid: false,//假的删除
underscored: true, underscored: true,
version: true, version: true,
freezeTableName: true, freezeTableName: true,
......
...@@ -25,7 +25,7 @@ module.exports = (db, DataTypes) => { ...@@ -25,7 +25,7 @@ module.exports = (db, DataTypes) => {
allowNull: false, allowNull: false,
},//和user的from },//和user的from
}, { }, {
paranoid: true,//假的删除 paranoid: false,//假的删除
underscored: true, underscored: true,
version: true, version: true,
freezeTableName: true, freezeTableName: true,
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig=system.getSysConfig();
module.exports = (db, DataTypes) => {
//定价类型
return db.define("productcost", {
costdesc:{//成本描述
type: DataTypes.STRING,
allowNull: true,
},
expensetype:{//费用类型
type: DataTypes.STRING,
allowNull: true,
},
costratio:{
type: DataTypes.DECIMAL(10, 2) ,
allowNull: true,
},
costamount:{
type: DataTypes.DECIMAL(10, 2) ,
allowNull: true
},
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'p_productcost',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
...@@ -15,10 +15,12 @@ module.exports = (db, DataTypes) => { ...@@ -15,10 +15,12 @@ module.exports = (db, DataTypes) => {
lowpriceref:{ lowpriceref:{
type: DataTypes.DECIMAL(10, 2) , type: DataTypes.DECIMAL(10, 2) ,
allowNull: true, allowNull: true,
defaultValue:0
}, },
hignpriceref:{ hignpriceref:{
type: DataTypes.DECIMAL(10, 2) , type: DataTypes.DECIMAL(10, 2) ,
allowNull: true, allowNull: true,
defaultValue:0
}, },
deliverfile:{ deliverfile:{
type: DataTypes.STRING, type: DataTypes.STRING,
...@@ -40,7 +42,7 @@ module.exports = (db, DataTypes) => { ...@@ -40,7 +42,7 @@ module.exports = (db, DataTypes) => {
defaultValue: false defaultValue: false
} }
}, { }, {
paranoid: true,//假的删除 paranoid: false,//假的删除
underscored: true, underscored: true,
version: true, version: true,
freezeTableName: true, freezeTableName: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment