Browse Source

修复调差清单导入bug

ellisran 1 month ago
parent
commit
6eeac8fe6f
1 changed files with 10 additions and 1 deletions
  1. 10 1
      app/service/material_list.js

+ 10 - 1
app/service/material_list.js

@@ -673,7 +673,16 @@ module.exports = app => {
         }
         }
 
 
         async cover() {
         async cover() {
-            return await this.db.delete(this.ctx.service.materialList.tableName, { tid: this.ctx.tender.id, mid: this.ctx.material.id, is_self: 0 });
+            const transaction = await this.db.beginTransaction();
+            try {
+                await transaction.delete(this.tableName, { tid: this.ctx.tender.id, mid: this.ctx.material.id, is_self: 0 });
+                await transaction.delete(this.ctx.service.materialListGcl.tableName, { tid: this.ctx.tender.id, mid: this.ctx.material.id });
+                await transaction.update(this.ctx.service.materialChecklist.tableName, { had_bills: 0 }, { where: { tid: this.ctx.tender.id, mid: this.ctx.material.id } });
+                await transaction.commit();
+            } catch (err) {
+                await transaction.rollback();
+                throw err;
+            }
         }
         }
 
 
         /**
         /**