|
@@ -184,6 +184,7 @@ module.exports = app => {
|
|
|
if (data.sgfh_qty !== undefined || data.sjcl_qty !== undefined || data.qtcl_qty !== undefined) {
|
|
|
const op = await this.getDataById(data.id);
|
|
|
const bills = await this.ctx.service.ledger.getDataById(op.lid);
|
|
|
+ if (!bills) throw '数据错误';
|
|
|
const billsPos = await this.getAllDataByCondition({where: {tid: tid, lid: op.lid} });
|
|
|
|
|
|
const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
|
|
@@ -309,11 +310,11 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async _deletePosData(tid, data) {
|
|
|
- if (!data || data.length === 0) {
|
|
|
- throw '提交数据错误';
|
|
|
- }
|
|
|
+ if (!data || data.length === 0) throw '提交数据错误';
|
|
|
|
|
|
const pos = await this.getPosData({tid: tid, id: data});
|
|
|
+ if (!pos || pos.length === 0) throw '删除的计量单元不存在';
|
|
|
+
|
|
|
const bills = await this.ctx.service.ledger.getDataById(pos[0].lid);
|
|
|
const billsPos = await this.getAllDataByCondition({ where: {tid: tid, lid: bills.id} });
|
|
|
const updateBills = {id: bills.id, sgfh_qty: null, sjcl_qty: null, qtcl_qty: null, quantity: null};
|