t_processWarehouse.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Created by Administrator on 2018/7/25.
  3. * 加工出入库记录
  4. */
  5. var mongoose = require("./mongodb");
  6. var Schema = mongoose.Schema;
  7. var moment=require('moment');
  8. var processWarehouseSchema = new Schema(
  9. {
  10. SOCIAL_CREDIT_CODE:{type: String,default:''},//统一社会信用代码
  11. OP_CODE:{type: Number},//类别 1.原料普通入库 2 原料挑选出库 3原料挑选入库 4原料生产出库 5 半成品入库 6 半成品出库 7 成品入库 8 成品出库
  12. Job:{type: String,default:""},//工序名称
  13. source:{type: String,default:''},//来源
  14. destination:{type: String,default:''},//去往
  15. ID:{type: String,default:''},//物料ID
  16. CODE:{type: String,default:''},//物料编码
  17. NAME:{type: String,default:''},//物料名称
  18. batchCode:{type: String,default:''},//批次码
  19. batchType:{type: String,default:''},//批次码类别
  20. ORDER_NUMBER:{type: String,default:''},//出入库单号
  21. DATE:{type: Date,default:Date.now},//日期
  22. UNIT:{type: String,default:'KG'},//计量单位,默认KG
  23. NUM:{type: Number,default:0},//数量
  24. PERSON_IN_CHARGE:{type: String,default:''},//负责人姓名
  25. CONTACT_TEL:{type: String,default:''},//负责人联系方式
  26. Operator:{type: String,default:''},//操作人
  27. Workgroup:{type: String,default:''},//工人班组
  28. Deleted:{type: Number,default:0}//是否已删除 默认0未删除 1已删除
  29. },{
  30. strict: true,
  31. toObject: {
  32. virtuals: true
  33. },
  34. toJSON: {
  35. virtuals: true
  36. }
  37. });
  38. processWarehouseSchema.virtual('DATE2').get(function () {
  39. if(this.DATE =="")//判断传入的参数
  40. {
  41. return "";
  42. };
  43. return moment(this.DATE).format('YYYY-MM-DD HH:mm:ss');
  44. });
  45. var processWarehouse = mongoose.model('processWarehouse',
  46. processWarehouseSchema,'t_processWarehouse');
  47. module.exports = processWarehouse;