t_sendChild.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * Created by Administrator on 2018/8/3.
  3. * 配送子表
  4. */
  5. var mongoose = require("./mongodb");
  6. var Schema = mongoose.Schema;
  7. var moment=require('moment');
  8. var sendChildSchema = new Schema({
  9. ENTERPRISE_CODE:{type: String,default:''},//责任主体编码
  10. ENTERPRISE_NAME:{type: String,default:''},//责任主体名称
  11. SEND_CODE:{type: String,default:''},//物流单号
  12. VARIETY_CODE:{type: String,default:''},//品种编码
  13. VARIETY_NAME:{type: String,default:''},//品种名称
  14. GS1_CODE:{type: String,default:''},//商品条码
  15. GS1_NAME:{type: String,default:''},//商品名称
  16. SPECIFICATION:{type: Number,default:0},//规格
  17. UNIT:{type: String,default:'KG'},//计量单位
  18. AMOUNT:{type: Number,default:0},//交易数量
  19. PRICE:{type: Number,default:0},//单价
  20. BATCH_CODE:{type: String,default:''},//生产批次码
  21. // UP_TRACE_CODE:{type: String,default:''},//上游追溯码
  22. wholesale:{type: Number,default:0},//批发1 零售 2
  23. consume:{type: Number,default:0},//居民消费1 团体消费2
  24. longCode:[
  25. {type: String}
  26. ],//长码数组
  27. ENTERPRISE_TRACEABILITY_LINK:{type: String,default:'https://s.zwsypt.gov.cn/API/traced/'},//企业二维码追溯连接
  28. // ENTERPRISE_TRACEABILITY_CODE:{type: String,default:''},//企业追溯码
  29. UPDATE_TIME:{type: Date,default:Date.now},//信息更新时间
  30. Deleted:{type: Number,default:0},//是否已删除
  31. },{
  32. strict: true,
  33. toObject: {
  34. virtuals: true
  35. },
  36. toJSON: {
  37. virtuals: true
  38. }
  39. });
  40. sendChildSchema.virtual('UPDATE_TIME2').get(function () {
  41. if(this.UPDATE_TIME =="")//判断传入的参数
  42. {
  43. return "";
  44. };
  45. return moment(this.UPDATE_TIME).format('YYYY-MM-DD HH:mm:ss');
  46. });
  47. var sendChild = mongoose.model('sendChild',
  48. sendChildSchema,'t_sendChild');
  49. module.exports = sendChild;