lrf402788946 4 éve
szülő
commit
7e1b1bc200

+ 1 - 1
app/model/dictionary.js

@@ -7,7 +7,7 @@ const Dictionary = {
   pid: { type: String, required: false, maxLength: 200 }, // 上级
   label: { type: String, required: false, maxLength: 200 }, // 显示内容
   value: { type: String, required: false, maxLength: 200 }, // 存储内容
-  status: { type: String, required: true, maxLength: 200 }, // 状态:0=>使用;1禁用
+  status: { type: String, required: true, maxLength: 200, default: '使用' }, // 状态:使用;
   dstatus: { type: Boolean, default: false }, // 可删除权限,true:只有开发模式和修改数据库可以进行数据本体操作,否则不允许用户使用,哪怕是用户管理员
 };
 

+ 1 - 1
app/model/order.js

@@ -10,7 +10,7 @@ const sendList = new Schema({
   number: { type: Number, maxLength: 200 }, // 数量
   weight: { type: Number, maxLength: 200 }, // 重量
   volume: { type: Number, maxLength: 200 }, // 体积
-  time: { type: String, maxLength: 200, default: moment().format('YYYY-MM-DD HH:mm:ss') }, // 货时间
+  time: { type: String, maxLength: 200, default: moment().format('YYYY-MM-DD HH:mm:ss') }, // 货时间
   remark: { type: String, maxLength: 200 },
 });
 // 签收数据

+ 4 - 0
app/model/transport.js

@@ -75,6 +75,10 @@ const transport = {
     type: [ goodsList ],
     field: { label: '货物列表' },
   },
+  send_time: {
+    type: String,
+    field: { label: '发出时间' },
+  },
   sign_time: {
     type: String,
     field: { label: '签收时间' },

+ 3 - 2
app/service/order/order.js

@@ -160,13 +160,14 @@ class OrderService extends CrudService {
    * 发货,添加记录及修改状态
    * @param {Array} goods 发货的货物列表
    * @param {String} no 运输单号
+   * @param {String} time 发货日期
    */
-  async sendGoods(goods, no) {
+  async sendGoods(goods, no, time) {
     for (const g of goods) {
       const { split_id, name, number, weight, volume } = g;
       const order = await this.model.findOne({ 'split._id': ObjectId(split_id) });
       if (!order) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, `未找到该${name}所在的订单信息`);
-      const obj = { split_id, name, number, weight, volume, no };
+      const obj = { split_id, name, number, weight, volume, no, time };
       // 添加该货物的发货记录
       order.send_time.push(obj);
       // 修改该货物的状态

+ 2 - 2
app/service/order/transport.js

@@ -11,9 +11,9 @@ class TransportService extends CrudService {
   }
 
   async create(data) {
-    const { goods, no } = data;
+    const { goods, no, send_time } = data;
     // 需要将发走的货物找到其对应的订单,然后添加订单的发货数据记录
-    await this.os.sendGoods(goods, no);
+    await this.os.sendGoods(goods, no, send_time);
     const res = await this.model.create(data);
     return res;
   }