chenc 4 rokov pred
rodič
commit
8ea4ea1550

+ 2 - 1
src/app/entity/fbs/fbs-workshop-dispatch-list.ts

@@ -35,7 +35,8 @@ export class FbsWorkshopDispatchList extends Page{
 	productionLineId?:string;
 	/**项目名称 */
 	projectName?:string;
-
+	//行号
+	rowNumber?:string;
 	
 	fbsWorkshopDispatchListList?:FbsWorkshopDispatchList[]
 	

+ 93 - 8
src/app/routes/fbs-workshop-dispatch-list/add/add.component.html

@@ -1,8 +1,9 @@
 <nz-spin [nzSpinning]="saveLoading">
-  <nz-table nzSize="small" [nzNoResult]="' '" nzBordered #basicTable [nzShowPagination]="false">
+  <!-- 派工单 -->
+  <!-- <nz-table nzSize="small" [nzNoResult]="' '" nzBordered #basicTable [nzShowPagination]="false">
     <thead>
       <tr>
-        <!-- 派工单 -->
+        
         <th colspan="4">
           <h2><strong>派工单</strong></h2>
         </th>
@@ -37,8 +38,8 @@
         </td>
         <td>产品</td>
         <td>
-          <nz-select [(ngModel)]="fbsWorkshopDispatchList.productId" style="width: 100%;" nzShowSearch
-            nzAllowClear nzPlaceHolder="请选择" (ngModelChange)="productChange($event)">
+          <nz-select [(ngModel)]="fbsWorkshopDispatchList.productId" style="width: 100%;" nzShowSearch nzAllowClear
+            nzPlaceHolder="请选择" (ngModelChange)="productChange($event)">
             <ng-container *ngFor="let produc of productList">
               <nz-option [nzLabel]="produc.cinvname" [nzValue]="produc.cinvcode"> </nz-option>
             </ng-container>
@@ -47,14 +48,20 @@
       </tr>
       <tr>
         <td>任务数量</td>
-        <td><nz-input-number [(ngModel)]="fbsWorkshopDispatchList.numberOfTasks" [nzMin]="0" [nzStep]="1"></nz-input-number></td>
+        <td>
+          <nz-input-number [(ngModel)]="fbsWorkshopDispatchList.numberOfTasks" [nzMin]="0" [nzStep]="1">
+          </nz-input-number>
+        </td>
         <td>标准工时</td>
-        <td><nz-input-number [(ngModel)]="fbsWorkshopDispatchList.standardWorkingHours" [nzMin]="0" [nzStep]="1"></nz-input-number></td>
+        <td>
+          <nz-input-number [(ngModel)]="fbsWorkshopDispatchList.standardWorkingHours" [nzMin]="0" [nzStep]="1">
+          </nz-input-number>
+        </td>
       </tr>
       <tr>
         <td>计划开工时间</td>
         <td>
-          <nz-date-picker [(ngModel)]="fbsWorkshopDispatchList.plannedStartTime" nzPlaceHolder="请选择" >
+          <nz-date-picker [(ngModel)]="fbsWorkshopDispatchList.plannedStartTime" nzPlaceHolder="请选择">
           </nz-date-picker>
         </td>
         <td>计划完工时间</td>
@@ -68,7 +75,85 @@
         <td colSpan="3"><textarea rows="2" nz-input [(ngModel)]="fbsWorkshopDispatchList.memo"></textarea></td>
       </tr>
     </tbody>
-  </nz-table>
+  </nz-table> -->
+
+  <nz-card nzTitle="派工单">
+    <!-- 按钮 -->
+    <div nz-row [nzGutter]="24">
+      <div nz-col nzMd="24" nzLg="24">
+        <button (click)="workshopDispatchAddRow()" nz-button nzType="primary">新增</button>
+      </div>
+    </div>
+    <nz-table style="margin-top: 5px;" nzSize="small" #editRowTable nzBordered [nzData]="workshopDispatchListList"
+      [nzShowPagination]="false" [nzFrontPagination]=false>
+      <thead>
+        <tr>
+          <th nzWidth="2%">序号</th>
+          <th nzWidth="5%">姓名</th>
+          <th nzWidth="5%">日期</th>
+          <th nzWidth="6%">生产订单号</th>
+          <th nzWidth="5%">产品</th>
+          <th nzWidth="5%">任务数量</th>
+          <th nzWidth="5%">标准工时</th>
+          <th nzWidth="5%">计划开工时间</th>
+          <th nzWidth="5%">计划完工时间</th>
+          <th nzWidth="5%">备注</th>
+          <th nzWidth="3%">操作</th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr *ngFor="let data of editRowTable.data">
+          <td>{{data.sort}}</td>
+          <td>
+            <nz-select [(ngModel)]="data.personnelIdU8" style="width: 100%;" nzShowSearch
+              nzAllowClear nzPlaceHolder="请选择" (ngModelChange)="personnelChange($event,data)">
+              <ng-container *ngFor="let proper of properList">
+                <nz-option [nzLabel]="proper.cpersonname" [nzValue]="proper.cpersoncode"> </nz-option>
+              </ng-container>
+            </nz-select>
+          </td>
+          <td>
+            <nz-date-picker [(ngModel)]="data.date" nzPlaceHolder="请选择" nzDisabled>
+            </nz-date-picker>
+          </td>
+          <td>
+            <nz-select [(ngModel)]="data.productionOrderNumberId" style="width: 100%;" nzShowSearch
+              nzAllowClear nzPlaceHolder="请选择" (ngModelChange)="productionOrderNumberChange($event,data)">
+              <ng-container *ngFor="let productionOrderNumber of productionOrderNumberList">
+                <nz-option [nzLabel]="productionOrderNumber.mocode" [nzValue]="productionOrderNumber.moid"> </nz-option>
+              </ng-container>
+            </nz-select>
+          </td>
+          <td>
+            <nz-select [(ngModel)]="data.productId" style="width: 200px" nzShowSearch nzAllowClear
+              nzPlaceHolder="请选择" (ngModelChange)="productChange($event,data)" [nzDropdownMatchSelectWidth]="false">
+              <ng-container *ngFor="let produc of data.productList">
+                <nz-option nzLabel="{{produc.cinvname}}-{{produc.qty}}" [nzValue]="produc.cinvcode"> </nz-option>
+              </ng-container>
+            </nz-select>
+          </td>
+          <td>
+            <nz-input-number [(ngModel)]="data.numberOfTasks" [nzMin]="0" [nzStep]="1">
+            </nz-input-number>
+          </td>
+          <td>
+            <nz-input-number [(ngModel)]="data.standardWorkingHours" [nzMin]="0" [nzStep]="1">
+            </nz-input-number>
+          </td>
+          <td>
+            <nz-date-picker [(ngModel)]="data.plannedStartTime" nzPlaceHolder="请选择">
+            </nz-date-picker>
+          </td>
+          <td>
+            <nz-date-picker [(ngModel)]="data.plannedEndTime" nzPlaceHolder="请选择">
+            </nz-date-picker>
+          </td>
+          <td><textarea rows="2" nz-input [(ngModel)]="data.memo"></textarea></td>
+          <td><a nz-popconfirm nzTitle="是否删除?" (nzOnConfirm)="workshopDispatchDeleteRow(data.sort)">删除</a></td>
+        </tr>
+      </tbody>
+    </nz-table>
+  </nz-card>
 </nz-spin>
 <!-- 底部按钮 -->
 <div class="base">

+ 68 - 15
src/app/routes/fbs-workshop-dispatch-list/add/add.component.ts

@@ -63,17 +63,19 @@ export class FbsWorkshopDispatchListAddComponent implements OnInit {
   /**
    * 人员下拉款选择事件
    */
-  personnelChange(personnelIdU8){
+  personnelChange(personnelIdU8,data){
     //获取名称
     this.properList.forEach(element => {
       if(personnelIdU8===element.cpersoncode){
-        this.fbsWorkshopDispatchList.name=element.cpersonname;
-        this.fbsWorkshopDispatchList.personnelNameU8=element.cpersonname;
-        this.fbsWorkshopDispatchList.productionLineId=element.cdepcode;//生产线id
-        this.fbsWorkshopDispatchList.productionLineName=element.cdepname;//生产线名产
+        data.name=element.cpersonname;
+        data.personnelNameU8=element.cpersonname;
+        data.productionLineId=element.cdepcode;//生产线id
+        data.productionLineName=element.cdepname;//生产线名产
       }
     });
   }
+  
+
 
   /**
    * 初始化生产订单号下拉数据集合
@@ -90,7 +92,7 @@ export class FbsWorkshopDispatchListAddComponent implements OnInit {
   /**
    * 生产订单号选中事件
    */
-  productionOrderNumberChange(productionOrderNumberId){
+  productionOrderNumberChange(productionOrderNumberId,data){
     // this.fbsWorkshopDispatchList.productionLineName="电器组装"
     // this.fbsWorkshopDispatchList.productionOrderNumberName="SC001"
     // this.fbsWorkshopDispatchList.product="产品001"
@@ -99,11 +101,11 @@ export class FbsWorkshopDispatchListAddComponent implements OnInit {
       //获取生产编号
       this.productionOrderNumberList.forEach(element => {
         if(productionOrderNumberId===element.moid){
-          this.fbsWorkshopDispatchList.productionOrderNumberName=element.mocode
+          data.productionOrderNumberName=element.mocode
         }
       });
       //获取产品集合
-      this.getProductList(productionOrderNumberId);
+      this.getProductList(productionOrderNumberId,data);
     }
     
   }
@@ -112,29 +114,32 @@ export class FbsWorkshopDispatchListAddComponent implements OnInit {
    * 根据生产id查询产品
    */
   productList=[];//产品集合
-  getProductList(moId){
+  getProductList(moId,data){
     this.fbsWorkshopDispatchListService.getInventoryGetByOrderId(moId).then((response)=>{
-      this.productList=response.result;
+      // this.productList=response.result;
+      data.productList=response.result;
     })
   }
 
   /**
    * 产品选中事件 获取产品名称
    */
-  productChange(event){
+  productChange(event,data){
     if(event){
-      this.productList.forEach(element => {
+      data.productList.forEach(element => {
         if(element.cinvcode===event){
-          this.fbsWorkshopDispatchList.product=element.cinvname;
+          data.product=element.cinvname;
+          data.projectName=element.CostItemName;
+          data.rowNumber=element.sortSeq;
         }
       });
     }
   }
 
   /**
-   * 保存
+   * 保存(暂未用)
    */
-  save(){
+  saveHistort(){
     //加载效果打开
     this.saveLoading=true;
     //时间格式化
@@ -153,6 +158,54 @@ export class FbsWorkshopDispatchListAddComponent implements OnInit {
     })
   }
 
+  save(){
+    //加载效果打开
+    this.saveLoading=true;
+    if(this.workshopDispatchListList){
+      this.workshopDispatchListList.forEach(element => {
+        element.date=this.datePipe.transform(this.fbsWorkshopDispatchList.date, 'yyyy-MM-dd HH:mm:ss');
+        element.plannedStartTime=this.datePipe.transform(this.fbsWorkshopDispatchList.plannedStartTime, 'yyyy-MM-dd HH:mm:ss');
+        element.plannedEndTime=this.datePipe.transform(this.fbsWorkshopDispatchList.plannedEndTime, 'yyyy-MM-dd HH:mm:ss');
+      });
+    }
+    let workshopDispatchList=new FbsWorkshopDispatchList();
+    workshopDispatchList.fbsWorkshopDispatchListList=this.workshopDispatchListList;
+    this.fbsWorkshopDispatchListService.saveBatch(workshopDispatchList).then((response)=>{
+      if(response.success){//保存成功
+        this.nzNotificationService.success("保存成功","");
+        this.saveLoading=false;//加载效果关闭
+        this.drawerRef.close(true);//关闭抽屉 启动主页面的回调
+      }else{//保存失败
+        this.nzNotificationService.error("保存失败",response.message);
+        this.saveLoading=false;//加载效果关闭
+      }
+    })
+  }
+
+
+  /**
+   * 新增行
+   */
+  sort=1;
+  workshopDispatchListList=[]//派工集合
+  workshopDispatchAddRow(){
+    this.workshopDispatchListList = [
+      ...this.workshopDispatchListList,
+      {
+        date:new Date().toString(),
+        sort: this.sort,
+      },
+    ];
+    this.sort++;
+  }
+
+  /**
+   * 删除行
+   */
+  workshopDispatchDeleteRow(sort){
+    this.workshopDispatchListList = this.workshopDispatchListList.filter(d => d.sort !== sort);
+  }
+
   close() {
      //抽屉关闭
      this.drawerRef.close();

+ 1 - 0
src/app/routes/fbs-workshop-dispatch-list/update/update.component.ts

@@ -119,6 +119,7 @@ export class FbsWorkshopDispatchListUpdateComponent implements OnInit {
         if(element.cinvcode===event){
           this.fbsWorkshopDispatchList.product=element.cinvname;
           this.fbsWorkshopDispatchList.projectName=element.CostItemName;
+          this.fbsWorkshopDispatchList.rowNumber=element.sortSeq;
         }
       });
     }

+ 5 - 0
src/app/services/fbs/fbs-workshop-dispatch-list.service.ts

@@ -63,4 +63,9 @@ export class FbsWorkshopDispatchListService {
    async getSumDispatchReport(): Promise<BaseResponse<FbsWorkshopDispatchList[]>> {
     return await this.http.get<BaseResponse<FbsWorkshopDispatchList[]>>('/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getSumDispatchReport').toPromise();
   }
+
+  // 批量新增
+  async saveBatch(body: FbsWorkshopDispatchList): Promise<BaseResponse<FbsWorkshopDispatchList>> {
+    return await this.http.post<BaseResponse<FbsWorkshopDispatchList>>('/fbsWorkshopDispatchList/fbsWorkshopDispatchList/workSaveBatch', body).toPromise();
+  }
 }

BIN
src/favicon.ico


BIN
src/favicon2.ico