12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- /**
- * Created by Administrator on 2018/8/3.
- * 配送子表
- */
- var mongoose = require("./mongodb");
- var Schema = mongoose.Schema;
- var moment=require('moment');
- var sendChildSchema = new Schema({
- ENTERPRISE_CODE:{type: String,default:''},//责任主体编码
- ENTERPRISE_NAME:{type: String,default:''},//责任主体名称
- SEND_CODE:{type: String,default:''},//物流单号
- VARIETY_CODE:{type: String,default:''},//品种编码
- VARIETY_NAME:{type: String,default:''},//品种名称
- GS1_CODE:{type: String,default:''},//商品条码
- GS1_NAME:{type: String,default:''},//商品名称
- SPECIFICATION:{type: Number,default:0},//规格
- UNIT:{type: String,default:'KG'},//计量单位
- AMOUNT:{type: Number,default:0},//交易数量
- PRICE:{type: Number,default:0},//单价
- BATCH_CODE:{type: String,default:''},//生产批次码
- // UP_TRACE_CODE:{type: String,default:''},//上游追溯码
- wholesale:{type: Number,default:0},//批发1 零售 2
- consume:{type: Number,default:0},//居民消费1 团体消费2
- longCode:[
- {type: String}
- ],//长码数组
- ENTERPRISE_TRACEABILITY_LINK:{type: String,default:'https://s.zwsypt.gov.cn/API/traced/'},//企业二维码追溯连接
- // ENTERPRISE_TRACEABILITY_CODE:{type: String,default:''},//企业追溯码
- UPDATE_TIME:{type: Date,default:Date.now},//信息更新时间
- Deleted:{type: Number,default:0},//是否已删除
- },{
- strict: true,
- toObject: {
- virtuals: true
- },
- toJSON: {
- virtuals: true
- }
- });
- sendChildSchema.virtual('UPDATE_TIME2').get(function () {
- if(this.UPDATE_TIME =="")//判断传入的参数
- {
- return "";
- };
- return moment(this.UPDATE_TIME).format('YYYY-MM-DD HH:mm:ss');
- });
- var sendChild = mongoose.model('sendChild',
- sendChildSchema,'t_sendChild');
- module.exports = sendChild;
|