chen 3 年之前
父節點
當前提交
cea4ed7666

+ 15 - 6
src/app/routes/fbs-abnormal-working-hours/add/add.component.html

@@ -332,9 +332,17 @@
               <td>{{data.costItemCode}}</td>
               <td>{{data.projectName}}</td>
               <td>{{data.workCenter}}</td>
-              <td>{{data.productionOrderNumberName}}</td>
               <td>
-                <ng-container >
+                
+                <nz-input-group [nzSuffix]="suffixIconSearch">
+                  <input nz-input name="data.productionOrderNumberName" [(ngModel)]="data.productionOrderNumberName" />
+                </nz-input-group>
+                <ng-template #suffixIconSearch>
+                  <i (click)="productChange(data.productionOrderNumberName,data)" style="cursor:pointer" nz-icon nzType="search"></i>
+                </ng-template>
+              </td>
+              <td>
+                <!-- <ng-container >
                   <nz-select [(ngModel)]="data.productId" style="width: 100%;" nzShowSearch nzAllowClear
                     nzPlaceHolder="请选择" (ngModelChange)="productChange($event,data)"
                     [nzDropdownMatchSelectWidth]="false">
@@ -342,7 +350,8 @@
                       <nz-option [nzLabel]="produc.productId" [nzValue]="produc.productId"> </nz-option>
                     </ng-container>
                   </nz-select>
-                </ng-container>
+                </ng-container> -->
+                {{data.productId}}
               </td>
               <!-- <td>
                 <nz-select [(ngModel)]="data.type" style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="请选择"
@@ -352,10 +361,10 @@
                 </nz-select>
                 
               </td> -->
-              <td>
+              <td>{{data.product}}
                 <!-- 选择产品 -->
                 <!-- <ng-container *ngIf="data.type=='产品'"> -->
-                  <ng-container >
+                  <!-- <ng-container >
                   <nz-select [(ngModel)]="data.productId" style="width: 100%;" nzShowSearch nzAllowClear
                     nzPlaceHolder="请选择" (ngModelChange)="productChange($event,data)"
                     [nzDropdownMatchSelectWidth]="false">
@@ -363,7 +372,7 @@
                       <nz-option [nzLabel]="produc.product" [nzValue]="produc.productId"> </nz-option>
                     </ng-container>
                   </nz-select>
-                </ng-container>
+                </ng-container> -->
                 <!-- 选择物料 -->
                 <!-- <ng-container *ngIf="data.type=='物料'">
                   <input [(ngModel)]="data.product" nz-input

+ 43 - 16
src/app/routes/fbs-abnormal-working-hours/add/add.component.ts

@@ -76,28 +76,55 @@ export class FbsAbnormalWorkingHoursAddComponent implements OnInit {
   getProductList(){
     //时间格式化
     let date=this.datePipe.transform(new Date(), 'yyyy-MM-dd HH:mm:ss');
-    this.fbsAbnormalWorkingHoursService.getDispatchListByDate(date).then((response)=>{
-      this.productList=response.result;
-    })
+    // this.fbsAbnormalWorkingHoursService.getDispatchListByDate(date).then((response)=>{
+    //   this.productList=response.result;
+    // })
   }
 
   /**
-   * 产品选择事件(获取产品名称、派工id)
+   * 订单号输入事件 ( 产品选择事件(获取产品名称、派工id)--前期逻辑根据选择的产品匹配)
    */
   productChange(event,data){
-    if(event){
-      this.productList.forEach(element => {
-        if(event===element.productId){
-          data.workshopDispatchListId=element.id;//派工单id
-          data.product=element.product;//产品名称
-          data.plannedQuantity=element.plannedQuantity;//计划数量
-          data.productionOrderNumberName=element.productionOrderNumberName;
-          data.costItemCode=element.costItemCode;//项目编码
-          data.projectName=element.projectName;//项目名称
-          data.workCenter=element.workCenter;//工作中心
-        }
-      });
+    if(!event){
+      this.nzNotificationService.warning("验证","请输入订单编号");
+      return;
     }
+    this.fbsAbnormalWorkingHoursService.getDispatchListByDate(null,event).then((response)=>{
+      if(response.success){
+        this.productList=response.result;
+        if(this.productList==null||this.productList.length==0){
+          this.nzNotificationService.warning("验证","派工单未找到订单编号");
+          return;
+        }
+        let element=this.productList[0]
+        data.workshopDispatchListId=element.id;//派工单id
+        data.productId=element.productId;
+        data.product=element.product;//产品名称
+        data.plannedQuantity=element.plannedQuantity;//计划数量
+        data.productionOrderNumberName=element.productionOrderNumberName;
+        data.costItemCode=element.costItemCode;//项目编码
+        data.projectName=element.projectName;//项目名称
+        data.workCenter=element.workCenter;//工作中心
+      }else{
+        this.nzNotificationService.warning("搜索失败",response.message);
+      }
+      
+    })
+
+
+    // if(event){
+    //   this.productList.forEach(element => {
+    //     if(event===element.productId){
+    //       data.workshopDispatchListId=element.id;//派工单id
+    //       data.product=element.product;//产品名称
+    //       data.plannedQuantity=element.plannedQuantity;//计划数量
+    //       data.productionOrderNumberName=element.productionOrderNumberName;
+    //       data.costItemCode=element.costItemCode;//项目编码
+    //       data.projectName=element.projectName;//项目名称
+    //       data.workCenter=element.workCenter;//工作中心
+    //     }
+    //   });
+    // }
   }
 
   /**

+ 13 - 6
src/app/routes/fbs-abnormal-working-hours/update/update.component.html

@@ -330,9 +330,16 @@
               <td>{{data.costItemCode}}</td>
               <td>{{data.projectName}}</td>
               <td>{{data.workCenter}}</td>
-              <td>{{data.productionOrderNumberName}}</td>
               <td>
-                <ng-container >
+                <nz-input-group [nzSuffix]="suffixIconSearch">
+                  <input nz-input name="data.productionOrderNumberName" [(ngModel)]="data.productionOrderNumberName" />
+                </nz-input-group>
+                <ng-template #suffixIconSearch>
+                  <i (click)="productChange(data.productionOrderNumberName,data)" style="cursor:pointer" nz-icon nzType="search"></i>
+                </ng-template>
+              </td>
+              <td>{{data.productId}}
+                <!-- <ng-container >
                   <nz-select [(ngModel)]="data.productId" style="width: 100%;" nzShowSearch nzAllowClear
                     nzPlaceHolder="请选择" (ngModelChange)="productChange($event,data)"
                     [nzDropdownMatchSelectWidth]="false">
@@ -340,7 +347,7 @@
                       <nz-option [nzLabel]="produc.productId" [nzValue]="produc.productId"> </nz-option>
                     </ng-container>
                   </nz-select>
-                </ng-container>
+                </ng-container> -->
               </td>
               <!-- <td>
                 <nz-select [(ngModel)]="data.type" style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="请选择"
@@ -349,10 +356,10 @@
                   <nz-option nzLabel="物料" nzValue="物料"> </nz-option>
                 </nz-select>
               </td> -->
-              <td>
+              <td>{{data.product}}
                 <!-- 选择产品 -->
                 <!-- <ng-container *ngIf="data.type=='产品'"> -->
-                  <ng-container >
+                  <!-- <ng-container >
                   <nz-select [(ngModel)]="data.productId" style="width: 100%;" nzShowSearch nzAllowClear
                     nzPlaceHolder="请选择" (ngModelChange)="productChange($event,data)"
                     [nzDropdownMatchSelectWidth]="false">
@@ -360,7 +367,7 @@
                       <nz-option [nzLabel]="produc.product" [nzValue]="produc.productId"> </nz-option>
                     </ng-container>
                   </nz-select>
-                </ng-container>
+                </ng-container> -->
                 <!-- 选择物料 -->
                 <!-- <ng-container *ngIf="data.type=='物料'">
                   <input [(ngModel)]="data.product" nz-input

+ 48 - 21
src/app/routes/fbs-abnormal-working-hours/update/update.component.ts

@@ -50,9 +50,9 @@ export class FbsAbnormalWorkingHoursUpdateComponent implements OnInit {
       // .then(() => {
       //   return this.getTypeById();
       // })
-      .then(() => {
-        return this.getProductList();
-      })
+      // .then(() => {
+      //   return this.getProductList();
+      // })
       .then(() => {
         this.saveLoading = false;
       });
@@ -146,30 +146,57 @@ export class FbsAbnormalWorkingHoursUpdateComponent implements OnInit {
     return new Promise(resolve => {
       //时间格式化
       let date = this.datePipe.transform(this.fbsAbnormalWorkingHours.date, 'yyyy-MM-dd HH:mm:ss');
-      this.fbsAbnormalWorkingHoursService.getDispatchListByDate(date).then(response => {
-        this.productList = response.result;
-        resolve();
-      });
+      // this.fbsAbnormalWorkingHoursService.getDispatchListByDate(date).then(response => {
+      //   this.productList = response.result;
+      //   resolve();
+      // });
     });
   }
 
   /**
-   * 产品选择事件(获取产品名称、派工id)
+   * 订单号输入事件 ( 产品选择事件(获取产品名称、派工id)--前期逻辑根据选择的产品匹配)
    */
-  productChange(event,data){
-    if(event){
-      this.productList.forEach(element => {
-        if(event===element.productId){
-          data.workshopDispatchListId=element.id;//派工单id
-          data.product=element.product;//产品名称
-          data.plannedQuantity=element.plannedQuantity;//计划数量
-          data.productionOrderNumberName=element.productionOrderNumberName;
-          data.costItemCode=element.costItemCode;//项目编码
-          data.projectName=element.projectName;//项目名称
-          data.workCenter=element.workCenter;//工作中心
-        }
-      });
+   productChange(event,data){
+    if(!event){
+      this.nzNotificationService.warning("验证","请输入订单编号");
+      return;
     }
+    this.fbsAbnormalWorkingHoursService.getDispatchListByDate(null,event).then((response)=>{
+      if(response.success){
+        this.productList=response.result;
+        if(this.productList==null||this.productList.length==0){
+          this.nzNotificationService.warning("验证","派工单未找到订单编号");
+          return;
+        }
+        let element=this.productList[0]
+        data.workshopDispatchListId=element.id;//派工单id
+        data.productId=element.productId;
+        data.product=element.product;//产品名称
+        data.plannedQuantity=element.plannedQuantity;//计划数量
+        data.productionOrderNumberName=element.productionOrderNumberName;
+        data.costItemCode=element.costItemCode;//项目编码
+        data.projectName=element.projectName;//项目名称
+        data.workCenter=element.workCenter;//工作中心
+      }else{
+        this.nzNotificationService.warning("搜索失败",response.message);
+      }
+      
+    })
+
+
+    // if(event){
+    //   this.productList.forEach(element => {
+    //     if(event===element.productId){
+    //       data.workshopDispatchListId=element.id;//派工单id
+    //       data.product=element.product;//产品名称
+    //       data.plannedQuantity=element.plannedQuantity;//计划数量
+    //       data.productionOrderNumberName=element.productionOrderNumberName;
+    //       data.costItemCode=element.costItemCode;//项目编码
+    //       data.projectName=element.projectName;//项目名称
+    //       data.workCenter=element.workCenter;//工作中心
+    //     }
+    //   });
+    // }
   }
 
   /**

+ 2 - 2
src/app/services/fbs/fbs-abnormal-working-hours.service.ts

@@ -77,8 +77,8 @@ export class FbsAbnormalWorkingHoursService {
   }
 
   // 根据时间查询派工单产品
-  async getDispatchListByDate(date:string): Promise<BaseResponse<any>> {
-    return await this.http.get<BaseResponse<any>>('/fbsAbnormalWorkingHours/fbsAbnormalWorkingHours/getDispatchListByDate',{params:{date:date}}).toPromise();
+  async getDispatchListByDate(date:string,productionOrderNumberName:string): Promise<BaseResponse<any>> {
+    return await this.http.get<BaseResponse<any>>('/fbsAbnormalWorkingHours/fbsAbnormalWorkingHours/getDispatchListByDate',{params:{date:date,productionOrderNumberName:productionOrderNumberName}}).toPromise();
   }
 
   //明细导出事件