zs před 1 rokem
rodič
revize
02c1f97a90
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4 4
      src/service/OrderDetail.service.ts

+ 4 - 4
src/service/OrderDetail.service.ts

@@ -199,7 +199,7 @@ export class OrderDetailService extends BaseService<modelType> {
       await this.model.updateOne({ _id: id }, info);
       arr = await this.model.findById(id);
       yes = arr.s_accounting.every(f => f.status === '1');
-      no = arr.s_accounting.every(f => f.status === '-1');
+      no = arr.s_accounting.some(f => f.status === '-1');
       if (yes) {
         result = this.model.updateOne({ _id: id }, { status: '2' });
       } else {
@@ -220,7 +220,7 @@ export class OrderDetailService extends BaseService<modelType> {
       await this.model.updateOne({ _id: id }, info);
       arr = await this.model.findById(id);
       yes = arr.c_accounting.every(f => f.status === '1');
-      no = arr.c_accounting.every(f => f.status === '-1');
+      no = arr.c_accounting.some(f => f.status === '-1');
       if (yes) {
         result = this.model.updateOne({ _id: id }, { status: '7' });
       } else {
@@ -241,7 +241,7 @@ export class OrderDetailService extends BaseService<modelType> {
       await this.model.updateOne({ _id: id }, info);
       arr = await this.model.findById(id);
       yes = arr.s_leader.every(f => f.status === '1');
-      no = arr.s_leader.every(f => f.status === '-1');
+      no = arr.s_leader.some(f => f.status === '-1');
       if (yes) {
         result = this.model.updateOne({ _id: id }, { status: '4' });
       } else {
@@ -262,7 +262,7 @@ export class OrderDetailService extends BaseService<modelType> {
       await this.model.updateOne({ _id: id }, info);
       arr = await this.model.findById(id);
       yes = arr.c_leader.every(f => f.status === '1');
-      no = arr.c_leader.every(f => f.status === '-1');
+      no = arr.c_leader.some(f => f.status === '-1');
       if (yes) {
         result = this.model.updateOne({ _id: id }, { status: '8' });
       } else {