Kaynağa Gözat

qc详情接口更改,默认qc处理意见为通过

panxingxin 5 yıl önce
ebeveyn
işleme
34b44a9149

+ 1 - 1
src/app/app-routing.module.ts

@@ -19,7 +19,7 @@ const routes: Routes = [
   { path: 'store-sample-binding', loadChildren: './store-sample-binding/store-sample-binding.module#StoreSampleBindingPageModule' },
   { path: 'store-pending', loadChildren: './store-pending/store-pending.module#StorePendingPageModule' },
   { path: 'store-qc', loadChildren: './store-qc/store-qc.module#StoreQCPageModule' },
-  { path: 'store-qc-detail', loadChildren: './store-qc-detail/store-qc-detail.module#StoreQCDetailPageModule' },
+  { path: 'store-qc-detail/:firstcheckrpid', loadChildren: './store-qc-detail/store-qc-detail.module#StoreQCDetailPageModule' },
   { path: 'store-qc-scanning/:sscId/:pId', loadChildren: './store-qc-scanning/store-qc-scanning.module#StoreQCScanningPageModule' },
   { path: 'store-qc-scanning', loadChildren: './store-qc-scanning/store-qc-scanning.module#StoreQCScanningPageModule' },
   { path: 'store-sample-pending', loadChildren: './store-sample-pending/store-sample-pending.module#StoreSamplePendingPageModule' },

+ 10 - 8
src/app/store-qc-detail/store-qc-detail.page.ts

@@ -6,6 +6,7 @@ import { CameraSetting } from '../../providers/camera-photo'
 import { commonService } from '../../providers/common.service'
 import { ImagePicker, ImagePickerOptions } from '@ionic-native/image-picker/ngx';
 import { Base64 } from '@ionic-native/base64/ngx';
+import { ActivatedRoute } from '@angular/router'
 // import { FullScreenImage } from '@ionic-native/full-screen-image/ngx';
 
 // import { PopoverController } from '@ionic/angular'
@@ -31,6 +32,7 @@ export class StoreQCDetailPage implements OnInit {
   constructor(private storage: Storage,
     public commonService: commonService,
     private cameraSetting: CameraSetting,
+    private activeRoute: ActivatedRoute,
     private base64: Base64,
     private imagePicker: ImagePicker,
     // private fullScreenImage: FullScreenImage,
@@ -40,9 +42,6 @@ export class StoreQCDetailPage implements OnInit {
 
   ngOnInit() {
     this.showDetail = true
-    this.storage.get('QCdetails').then((val) => {
-      this.QCdetails = JSON.parse(val)
-    });
     this.storage.get('qc-pId').then((val) => {
       this.pId = val
     });
@@ -53,16 +52,20 @@ export class StoreQCDetailPage implements OnInit {
 
   ionViewDidEnter() {
     // console.log(this.fullScreenImage)
-    this.getDetail()
+    this.activeRoute.paramMap.subscribe(async params => {
+      this.getDetail(params['params'].firstcheckrpid)
+    })
   }
 
   showFullScreenImage(data) {
     this.commonService.fullScreenImg(data)
   }
 
-  async getDetail() {
-    if (this.QCdetails) {
-      this.qcData = this.QCdetails
+  async getDetail(firstcheckrpid) {
+      let data = await this.userData.getQCDetailByPID(firstcheckrpid)
+      if(data&&data.length!==0) {
+        this.qcData = data[0]
+      }
       for (let i of this.qcData['details']) {
         this.showDetail = false
         // 获取QA日志
@@ -91,7 +94,6 @@ export class StoreQCDetailPage implements OnInit {
         }
       }
       this.defaultHref = `/store-qc`;
-    }
     // if (this.pId && this.sscId) {
     //   let data = await this.userData.getQCDetail(this.pId, this.sscId)
     //   this.defaultHref = `/store-qc-scanning`;

+ 3 - 0
src/app/store-qc-scanning/store-qc-scanning.page.ts

@@ -124,7 +124,10 @@ export class StoreQCScanningPage implements OnInit {
             // i.qcimgUrl = JSON.parse(qclogdata).data[0].picture.split(",")[0]
           }
           // 处理意见转换boolean(无deal)
+
           if (i.deal === undefined) {
+            i.deal = true
+          } else {
             if (i.dealpropose == 1) {
               i.deal = true
             } else {

+ 6 - 5
src/app/store-qc/store-qc.page.ts

@@ -42,11 +42,12 @@ export class StoreQCPage implements OnInit {
   }
 
   getQCdetail(details) {
-    this.storage.set('QCdetails',JSON.stringify(details)).then(()=>{
-      this.storage.remove('qc-pId')
-      this.storage.remove('qc-sscId')
-      this.router.navigateByUrl('/store-qc-detail')
-    })
+    this.router.navigateByUrl(`/store-qc-detail/${details.firstcheckrpid}`)
+    // this.storage.set('QCdetails',JSON.stringify(details)).then(()=>{
+    //   this.storage.remove('qc-pId')
+    //   this.storage.remove('qc-sscId')
+    //   this.router.navigateByUrl('/store-qc-detail')
+    // })
   }
 
   async loadData(event) {

+ 35 - 1
src/providers/user-data.ts

@@ -1205,6 +1205,40 @@ export class UserData {
     });
   }
 
+    // 获取QC验货初检报告列表
+    async getQCDetailByPID(firstcheckrpid ): Promise<any> {
+      const token = await this.getToken();
+      const loading = await this.loadingCtrl.create();
+      await loading.present();
+      this.nativeHttp.setDataSerializer('json');
+      const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
+      return new Promise((resolve, reject) => {
+        from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/qc/mobile?firstcheckrpid=${firstcheckrpid }`, {},
+          headers)).pipe(
+            finalize(() => loading.dismiss())
+          ).subscribe(async data => {
+            if (data.data === null || JSON.parse(data.data).data.records == null) {
+              const toast = await this.toastCtrl.create({
+                message: '无数据',
+                duration: 1000,
+                position: 'top'
+              });
+              await toast.present();
+              resolve([]);
+            }
+            resolve(JSON.parse(data.data).data.records);
+          }, async err => {
+            console.log(err);
+            const toast = await this.toastCtrl.create({
+              message: '查询失败',
+              duration: 1000,
+              position: 'top'
+            });
+            await toast.present();
+          });
+      });
+    }
+
   // qc驳回样品准备
   async rejectSample(sscId: any, pId: any) {
     const token = await this.getToken();
@@ -1295,7 +1329,7 @@ export class UserData {
     });
   }
 
-  // 获取QC验货初检报告详情
+  // 扫描条形码获取QC验货初检报告详情
   async getQCDetail(sscId: number, pId: number): Promise<any> {
     const token = await this.getToken();
     const loading = await this.loadingCtrl.create();