import BaseController from "../baseController";
|
import { Post } from "egg-shell-decorators";
|
import { TMSAbnormal } from "../../entity/express/tms/tmsAbnormal";
|
import { SysParamValue } from "../../entity/sys/core/sysParamValue";
|
|
/**
|
* 异常处理
|
*/
|
export default class AbnormalController extends BaseController {
|
//#region 保存禁止组板
|
/// <summary>
|
/// 保存禁止组板(普通组板)
|
/// </summary>
|
/// <param name="body"></param>
|
/// <returns></returns>
|
@Post()
|
public async saveAbnormal() {
|
let { ctx } = this;
|
let body = ctx.request.body;
|
let userInfo = await this.userInfo;
|
|
try {
|
let abnormal = new TMSAbnormal();
|
abnormal = Object.assign(abnormal, body);
|
|
if (body.abnormal_Id == 0) {
|
abnormal.createID = userInfo.user_Id;
|
abnormal.creator = userInfo.userTrueName;
|
abnormal.createDate = new Date();
|
// 设置账套信息
|
await this.setAccountInfo(abnormal);
|
} else {
|
abnormal.modifyDate = new Date();
|
abnormal.modifier = userInfo.userTrueName;
|
}
|
await this.setAccountInfo(abnormal);
|
await this.dbWrite.save(abnormal);
|
|
this.info.result = true;
|
this.info.msg = "保存成功";
|
} catch (e) {
|
this.info.result = false;
|
this.info.msg = e.message;
|
}
|
ctx.body = this.info;
|
}
|
//#endregion
|
|
//#region 获取数据分类
|
/// <summary>
|
/// 获取数据分类
|
/// </summary>
|
/// <returns></returns>
|
@Post()
|
public async getdataTypeList() {
|
let { ctx } = this;
|
try {
|
let dataList = await this.dbRead.find(SysParamValue, {
|
where: {
|
type_Id: 807,
|
enable: 1
|
},
|
order: {
|
orderNo: "DESC"
|
}
|
});
|
|
this.info.result = true;
|
this.info.data = dataList.map(item => {
|
return {
|
id: item.value01,
|
name: item.value02
|
};
|
});
|
} catch (e) {
|
this.info.result = false;
|
this.info.msg = e.message;
|
}
|
ctx.body = this.info;
|
}
|
//#endregion
|
|
//#region 获取异常分类
|
/// <summary>
|
/// 获取异常分类
|
/// </summary>
|
/// <returns></returns>
|
@Post()
|
public async getabnormalTypelist() {
|
let { ctx } = this;
|
try {
|
let dataList = await this.dbRead.find(SysParamValue, {
|
where: {
|
type_Id: 805,
|
enable: 1
|
},
|
order: {
|
orderNo: "DESC"
|
}
|
});
|
this.info.result = true;
|
this.info.data = dataList.map(item => {
|
return {
|
id: item.value01,
|
name: item.value02
|
};
|
});
|
} catch (e) {
|
this.info.result = false;
|
this.info.msg = e.message;
|
}
|
ctx.body = this.info;
|
}
|
//#endregion
|
}
|