Explorar el Código

扫描自动借出销毁

panxingxin hace 5 años
padre
commit
a975f80323

+ 0 - 2
src/app/store-sample-binding/store-sample-binding.page.ts

@@ -37,8 +37,6 @@ export class StoreSampleBindingPage implements OnInit {
       code: this.code
     }
     await this.userData.shelveBinding(form)
-    this.shelves = ''
-    this.code = ''
   }
 
   enterShelves(e) {

+ 11 - 1
src/app/store-sample/store-sample.page.html

@@ -15,7 +15,17 @@
   </ion-refresher>
   <ion-item>
     <ion-label>我司货号:</ion-label>
-    <ion-input clear-on-edit (keyup)="search($event)" [(ngModel)]="code"></ion-input>
+    <ion-input clear-on-edit (keyup)="search($event)" (ionChange)="autoManage()" [(ngModel)]="code"></ion-input>
+    <ion-label *ngIf="autoDestroy">扫描即销毁</ion-label>
+    <ion-label *ngIf="autoLend">扫描即借出</ion-label>
+  </ion-item>
+  <ion-item>
+    <ion-label>自动销毁</ion-label>
+    <ion-checkbox [(ngModel)]="autoDestroy"></ion-checkbox>
+  </ion-item>
+  <ion-item>
+    <ion-label>自动借出</ion-label>
+    <ion-checkbox [(ngModel)]="autoLend"></ion-checkbox>
   </ion-item>
   <ion-card *ngFor="let storeSample of storeSampleList">
     <ion-item-sliding>

+ 11 - 0
src/app/store-sample/store-sample.page.ts

@@ -24,6 +24,8 @@ export class StoreSamplePage implements OnInit {
     lendName: ''
   }]
   public code = ''
+  public autoLend:boolean = false // 自动借出
+  public autoDestroy:boolean = false // 自动销毁
   size: number = 10
   total = 0
   constructor(public userData: UserData, public commonService: commonService, private router: Router, private storage: Storage) { }
@@ -39,6 +41,15 @@ export class StoreSamplePage implements OnInit {
     this.commonService.fullScreenImg(form)
   }
 
+  async autoManage() {
+    if(this.autoLend) {
+      await this.userData.changeShelfLend(this.code)
+    }
+    if(this.autoDestroy) {
+      await this.userData.changeShelfDestroy(this.code)
+    }
+  }
+
   async doRefresh(event) {
     if (this.code) {
       let data = await this.userData.getStoreSampleByCode(this.code)

+ 10 - 0
src/providers/user-data.ts

@@ -307,6 +307,16 @@ export class UserData {
     });
   }
 
+  // 货架销毁
+  async changeShelfDestroy(code: string): Promise<any> {
+    return new Promise((resolve, reject) => {
+      this.api.request('put',`${environment.APP_SERVE_URL}/inventory/shelf/mobile/destroy?code=${code}`,{},{}).then((data)=>{
+        this.api.showToast('操作成功')
+        resolve(data)
+      }).catch(e => {console.log(e)})
+    });
+  }
+
   // 生成条形码
   async createBarCode(code: string): Promise<any> {
     return new Promise((resolve, reject) => {