123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 'use strict';
- const _ = require('lodash');
- const moment = require('moment');
- const meta = require('./.transport.js');
- const Controller = require('egg').Controller;
- const { CrudController } = require('naf-framework-mongoose/lib/controller');
- // 运输
- class TransportController extends Controller {
- constructor(ctx) {
- super(ctx);
- this.service = this.ctx.service.order.transport;
- }
- /**
- * 运输签收
- */
- async sign() {
- const res = await this.service.sign(this.ctx.request.body);
- this.ctx.ok(res);
- }
- /**
- * 获取运输单号
- */
- async getNo() {
- const no = `t_${moment().format('YYYYMMDDHHmmss')}_${_.random(100, 999)}`;
- this.ctx.ok({ data: no });
- }
- /**
- * 单趟核算
- */
- async calculate() {
- const data = await this.service.calculate(this.ctx.request.body);
- this.ctx.ok({ data });
- }
- /**
- * 单车核算
- */
- async carCalculate() {
- const data = await this.service.carCalculate(this.ctx.request.body);
- this.ctx.ok({ data });
- }
- /**
- * 核算导出
- */
- async toExport() {
- const data = await this.service.toExport(this.ctx.request.body);
- this.ctx.ok({ data });
- }
- /**
- * 供应商结算导出
- */
- async supplierExport() {
- const res = await this.service.supplierExport(this.ctx.request.body);
- this.ctx.ok({ data: res });
- }
- /**
- * 供应商支出结算
- */
- async supplierJs() {
- const res = await this.service.js(this.ctx.request.body);
- this.ctx.ok({ data: res });
- }
- }
- module.exports = CrudController(TransportController, meta);
|