import * as mssql from "mssql";
|
import { Post } from "egg-shell-decorators";
|
import { SaleOuter } from "../../entity/outbound/sale/saleOuter";
|
import BaseController from "../baseController";
|
|
export default class OuterController extends BaseController {
|
//#region 生成一次性费用
|
/**
|
* 生成一次性费用
|
*/
|
@Post()
|
public async getFeeItem() {
|
let { ctx } = this;
|
let body = ctx.request.body;
|
if (!Array.isArray(body.ids) || !body.ids.length) {
|
this.info.result = false;
|
this.info.msg = "数据不存在 ";
|
ctx.body = this.info;
|
return;
|
}
|
try {
|
const connection: any = await this.dbWrite.connection;
|
let request = new mssql.Request(connection.driver.master);
|
let msg = [];
|
|
for (let outer_Id of body.ids) {
|
request.input("Outer_Id", outer_Id);
|
request.output("outMsg", mssql.NVarChar(2000));
|
let result = await request.execute("sp_Fee_Base_OneCharge_Out");
|
let outMsg = result.output.outMsg;
|
|
if (outMsg) {
|
msg.push(outMsg);
|
} else {
|
let outerInfo = await this.dbRead.findOne(SaleOuter, outer_Id);
|
msg.push(outerInfo.outerCode + "执行完成");
|
}
|
}
|
this.info.msg = msg.join(",");
|
this.info.result = true;
|
} catch (error) {
|
this.info.msg = error.message;
|
this.info.result = false;
|
}
|
this.ctx.body = this.info;
|
}
|
//#endregion
|
}
|