|
@@ -297,6 +297,33 @@ class rptMemChange extends RptMemBase {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async getMaterialExponent(fields) {
|
|
|
+ if (!this.ctx.material) return [];
|
|
|
+
|
|
|
+ const materials = await this.ctx.service.material.getAllDataByCondition({
|
|
|
+ where: {tid: this.ctx.material.tid},
|
|
|
+ orders: [['order', 'desc']],
|
|
|
+ });
|
|
|
+ if (materials.length === 0) return [];
|
|
|
+
|
|
|
+ let result, material;
|
|
|
+ material = this.ctx.material;
|
|
|
+ if (materials[0].order === material.order) {
|
|
|
+ result = await this.ctx.service.materialExponent.getAllDataByCondition({
|
|
|
+ where: { tid: material.tid }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ const sql = 'SELECT me.id, me.tid, me.mid, mb.type, mb.symbol, mb.symbol_desc, mb.code, mb.remark, mb.in_time,' +
|
|
|
+ ' meh.type, meh.weight_num, meh.basic_price, meh.basic_times, meh.m_price, meh.calc_num, meh.is_summary' +
|
|
|
+ ' FROM ' + this.ctx.service.materialExponentHistory.tableName + ' meh ' +
|
|
|
+ ' LEFT JOIN ' + this.ctx.service.materialExponent.tableName + ' me ON meh.me_id = me.id ' +
|
|
|
+ ' WHERE meh.tid = ? And meh.mid = ?'+
|
|
|
+ ' ORDER By me.id';
|
|
|
+ result = await this.ctx.app.mysql.query(sql, [material.tid, material.id]);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
getCommonData(params, tableName, fields, customDefine, customSelect) {
|
|
|
switch (tableName) {
|
|
|
case 'mem_project':
|
|
@@ -323,6 +350,8 @@ class rptMemChange extends RptMemBase {
|
|
|
return this.getMaterialPos(fields);
|
|
|
case 'mem_material_stage':
|
|
|
return this.getMaterialStage(fields);
|
|
|
+ case 'mem_material_exponent':
|
|
|
+ return this.getMaterialExponent(fields);
|
|
|
default:
|
|
|
return [];
|
|
|
}
|