Ver código fonte

Modificaciones de adquisiciones

JeanBenitez 1 ano atrás
pai
commit
c6f7b323bb
12 arquivos alterados com 118 adições e 91 exclusões
  1. 3 1
      sistema-mantenimiento-front/src/app/components/acquisition-management/acquisition/shopping/shopping.component.css
  2. 17 4
      sistema-mantenimiento-front/src/app/components/acquisition-management/dispatch/order-reception/artitle-list-reception/artitle-list-reception.component.html
  3. 14 0
      sistema-mantenimiento-front/src/app/components/acquisition-management/dispatch/order-reception/artitle-list-reception/artitle-list-reception.component.ts
  4. 2 1
      sistema-mantenimiento-front/src/app/components/acquisition-management/dispatch/order-reception/move-stock/move-stock.component.ts
  5. 16 3
      sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-description-form/artitle-description-form.component.html
  6. 40 13
      sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-description-form/artitle-description-form.component.ts
  7. 6 0
      sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-details-form/artitle-details-form.component.html
  8. 2 2
      sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-details-form/artitle-details-form.component.ts
  9. 1 1
      sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-form/artitle-form.component.html
  10. 13 64
      sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-form/artitle-form.component.ts
  11. 2 2
      sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/priority-article/priority-article.component.html
  12. 2 0
      sistema-mantenimiento-front/src/app/interfaces/acquisition-management/artitle.interface.ts

+ 3 - 1
sistema-mantenimiento-front/src/app/components/acquisition-management/acquisition/shopping/shopping.component.css

@@ -96,7 +96,9 @@
   width: 289px;
   height: 228px;
   /* overflow: auto; */
-  height: 242px;
+  height: 229px;
+  width: 288px;
+  /* height: 242px; */
 }
 
 /* Estilos de la imagen principal de las cards */

+ 17 - 4
sistema-mantenimiento-front/src/app/components/acquisition-management/dispatch/order-reception/artitle-list-reception/artitle-list-reception.component.html

@@ -8,10 +8,23 @@
         <nav class="override-nav">
           <mat-card-title class="mat-card-title centre">Lista de Artículos en Recepción</mat-card-title>
           <div class="override-actions">
-            <app-search-card
-              [dataSource]="dataSource"
-              [disabled]="isLoading || isLoadingForm"
-              (dataValue)="dataSource = $event"/>
+            <div style="display: flex; align-items: center;">
+              <app-search-card
+                [dataSource]="dataSource"
+                [disabled]="isLoading || isLoadingForm"
+                (dataValue)="dataSource = $event"/>
+
+              <button
+                mat-mini-fab
+                class="teal_dark_background white_font override_no_shadow mb-22"
+                [disabled]="validateRegister()"
+                matTooltip="Seleccionar todos mismos artículos"
+                (click)="checkSelected()"
+              >
+                <mat-icon>check_box</mat-icon>
+                <!-- Seleccionar todos -->
+              </button>
+            </div>
             <div class="override-buttons">
               <button 
                 mat-raised-button 

+ 14 - 0
sistema-mantenimiento-front/src/app/components/acquisition-management/dispatch/order-reception/artitle-list-reception/artitle-list-reception.component.ts

@@ -154,6 +154,20 @@ export class ArtitleListReceptionComponent implements OnInit, AfterViewInit{
     }
     return `${this.selection.isSelected(row) ? 'deselect' : 'select'} row ${row.CODIGO_INFORMACION + 1}`;
   }
+
+  checkSelected() {
+    let arrInformation: Array<number> = [];
+    const ID_INFORMACION = this.selection.selected[0].ID_INFORMACION;
+    let arrSelected: TableListArtitleReception[] = [];
+    for (const element of this.dataSource.data)  {
+      if (element.ID_INFORMACION === ID_INFORMACION) {
+        arrSelected.push(element);
+      }
+    }
+    this.selection.select(...arrSelected);
+    
+    return arrInformation.length !== 1;
+  }
   
 }
 

+ 2 - 1
sistema-mantenimiento-front/src/app/components/acquisition-management/dispatch/order-reception/move-stock/move-stock.component.ts

@@ -115,7 +115,7 @@ export class MoveStockComponent implements OnInit {
   filteredProviders?: Observable<string[]>;
 
   public isFromAdquisition: boolean  = false;
-  private artitleByAdquisicion!: GetInformationToEquipment | null;
+  private artitleByAdquisicion!: GetInformationToEquipment;
   public numberItems: number = 1;
   public readOnlySerial: boolean = false;
   public isUniqueSerial: boolean = false;
@@ -2160,6 +2160,7 @@ export class MoveStockComponent implements OnInit {
         formData.append('level', levelID);
         formData.append('zone', zoneID);
         formData.append('number_items', this.numberItems.toString());
+        formData.append('id_description', this.artitleByAdquisicion.ID_INFORMACION.toString());
         
   
         let imagesArr = JSON.stringify(this.attachedImages);

+ 16 - 3
sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-description-form/artitle-description-form.component.html

@@ -17,7 +17,7 @@
             }
           </mat-form-field>
         </div>
-        <div class="col-flex-12">
+        <div class="col-flex-6">
           <mat-form-field appearance="outline" class="w-100">
             <mat-label>Tipo de unidad</mat-label>
             <mat-select formControlName="TIPO_UNIDAD">
@@ -29,9 +29,22 @@
             @if (formGroup.controls['TIPO_UNIDAD'].hasError('required')) {
               <mat-error>El campo <b>Tipo</b> es requerido</mat-error>
             }
-            <mat-hint align="end">
+            <!-- <mat-hint align="end">
               <span (click)="openManagementUnit()" class="openHint">Abrir administrador de unidades</span>
-            </mat-hint>
+            </mat-hint> -->
+          </mat-form-field>
+        </div>
+        <div class="col-flex-6">
+          <mat-form-field appearance="outline" class="w-100">
+            <mat-label>Cantidad de unidades</mat-label>
+            <input matInput type="number" formControlName="CANTIDAD_UNIDAD" onkeydown="return event.key !== 'e';">
+            <mat-icon matSuffix>filter_list</mat-icon>
+            @if (formGroup.controls['CANTIDAD_UNIDAD'].hasError('required')) {
+              <mat-error>El campo <b>Cantidad de unidades</b> es requerido</mat-error>
+            }
+            @if (formGroup.controls['CANTIDAD_UNIDAD'].hasError('min')) {
+              <mat-error>El campo <b>Cantidad de unidades</b> es debe ser mayor a 0</mat-error>
+            }
           </mat-form-field>
         </div>
         <div class="col-flex-12">

+ 40 - 13
sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-description-form/artitle-description-form.component.ts

@@ -62,15 +62,34 @@ export class ArtitleDescriptionFormComponent implements OnInit {
   async ngOnInit() {
     this.isLoading = true;
     this.txtLoading = "Cargando el formulario";
+    this.type = this.dataDialog.type;
     await this._getProvidersActives();
     await this._getUnits();
     await this.getDataDialog();
     this.isLoading = false;
+
+    this.formGroup.controls['TIPO_UNIDAD'].valueChanges.subscribe((value: GetUnits) => {
+      if (value.UNIDAD === 'Unidad') {
+        this.formGroup.controls['CANTIDAD_UNIDAD'].disable();
+        this.formGroup.controls['CANTIDAD_UNIDAD'].setValue(1);
+      } else {
+        this.formGroup.controls['CANTIDAD_UNIDAD'].enable();
+        this.formGroup.controls['CANTIDAD_UNIDAD'].setValue(null);
+      }
+    })
   }
 
-  private async getDataDialog () {
-    this.type = this.dataDialog.type;
+  private createFormGroup() {
+    return new FormGroup({
+      'PROVEEDOR': new FormControl('', Validators.required),
+      'TIPO_UNIDAD': new FormControl('', Validators.required),
+      'CANTIDAD_UNIDAD': new FormControl({ value: '', disabled: true }, [Validators.required, Validators.min(1)]),
+      'DESCRIPCION': new FormControl('', Validators.required),
+      'CARACTERISTICAS': new FormControl(''),
+    });
+  }
 
+  private async getDataDialog () {
     if (this.type === 'R') {
       this.title = 'Registro de la descripción del artículo';
 
@@ -104,14 +123,7 @@ export class ArtitleDescriptionFormComponent implements OnInit {
     }
   }
 
-  private createFormGroup() {
-    return new FormGroup({
-      'PROVEEDOR': new FormControl('', Validators.required),
-      'TIPO_UNIDAD': new FormControl('', Validators.required),
-      'DESCRIPCION': new FormControl('', Validators.required),
-      'CARACTERISTICAS': new FormControl(''),
-    });
-  }
+  
 
   private async _getProvidersActives() {
     const user: string = this.resourcesService.getUser();
@@ -120,8 +132,17 @@ export class ArtitleDescriptionFormComponent implements OnInit {
       (responseData: ResponseDataGetProvidersActives) => {
         if (!responseData.error) {
 
-          responseData.response = responseData.response.filter((element: GetProvidersActives) => !this.dataDialog.providersSelected.includes(element.NUMERO_PROVEEDOR))
-
+          let arrTemp: GetProvidersActives[] = [];
+          for (const element of responseData.response) {
+            if (!this.dataDialog.providersSelected.includes(element.NUMERO_PROVEEDOR)) {
+              arrTemp.push(element)
+            }
+            if (this.type === 'M' && this.dataDialog.elementData !== undefined && this.dataDialog.elementData.NUMERO_PROVEEDOR === element.NUMERO_PROVEEDOR) {
+              arrTemp.push(element)
+            }
+          }
+          responseData.response = arrTemp;
+          
           if (responseData.response.length === 0 && this.type === 'R') {
             this.resourcesService.openSnackBar(`No hay proveedores disponibles.`);
             this._dialogRef.close(false);
@@ -274,6 +295,11 @@ export class ArtitleDescriptionFormComponent implements OnInit {
     let PROVEEDOR: GetProvidersActives = this.formGroup.controls['PROVEEDOR'].value;
     let TIPO_UNIDAD: GetUnits = this.formGroup.controls['TIPO_UNIDAD'].value;
 
+    let CANTIDAD_UNIDAD = this.formGroup.controls['CANTIDAD_UNIDAD'].value;
+    if (TIPO_UNIDAD.UNIDAD === 'Unidad') {
+      CANTIDAD_UNIDAD = 1;
+    }
+
     let DESCRIPCION = this.formGroup.controls['DESCRIPCION'].value;
     DESCRIPCION = DESCRIPCION.toString().trim();
 
@@ -285,11 +311,12 @@ export class ArtitleDescriptionFormComponent implements OnInit {
       PROVEEDOR: PROVEEDOR.RAZON_SOCIAL,
       ID_UNIDAD: TIPO_UNIDAD.ID_UNIDAD,
       UNIDAD: TIPO_UNIDAD.UNIDAD,
+      CANTIDAD_UNIDAD: CANTIDAD_UNIDAD,
       DESCRIPCION: DESCRIPCION,
       CARACTERISTICAS: CARACTERISTICAS,
       ARCHIVOS: this.dataSource.data,
     }
-
+    console.log(REQUEST_FORM);
     this._dialogRef.close(REQUEST_FORM);
   }
 

+ 6 - 0
sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-details-form/artitle-details-form.component.html

@@ -11,6 +11,9 @@
           @if (formGroup.controls['CODIGO'].hasError('required')) {
             <mat-error title="El campo Código es requerido"> El campo <b>Código</b> es requerido </mat-error>
           }
+          @if (formGroup.controls['CODIGO'].hasError('pattern')) {
+            <mat-error title="El campo Código es requerido"> El campo <b>Código</b> no acepta los caracteres ".", ",", "-", "_", y ":".</mat-error>
+          }
         </mat-form-field>
       </div>
       <div class="col-flex-6">
@@ -21,6 +24,9 @@
           @if (formGroup.controls['MODELO'].hasError('required')) {
             <mat-error title="El campo Modelo es requerido"> El campo <b>Modelo</b> es requerido </mat-error>
           }
+          @if (formGroup.controls['MODELO'].hasError('pattern')) {
+            <mat-error title="El campo Código es requerido"> El campo <b>Código</b> no acepta los caracteres ".", ",", "-", "_", y ":".</mat-error>
+          }
         </mat-form-field>
       </div>
   

+ 2 - 2
sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-details-form/artitle-details-form.component.ts

@@ -62,8 +62,8 @@ export class ArtitleDetailsFormComponent implements OnInit {
 
   private createFormGroup(){
     return new FormGroup({
-      CODIGO : new FormControl( '', Validators.required),
-      MODELO : new FormControl( '', Validators.required),
+      CODIGO : new FormControl( '', [Validators.required, Validators.pattern(/^[^.,\-_:]*$/)]),
+      MODELO : new FormControl( '', [Validators.required, Validators.pattern(/^[^.,\-_:]*$/)]),
       MONEDA : new FormControl( '', Validators.required),
       PRECIO : new FormControl( '', Validators.required),
       MONTO_MINIMO : new FormControl( '', Validators.required),

+ 1 - 1
sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-form/artitle-form.component.html

@@ -89,7 +89,7 @@
               </ng-container>
               <ng-container matColumnDef="CARACTERISTICAS">
                 <th mat-header-cell *matHeaderCellDef>Características</th>
-                <td mat-cell *matCellDef="let element"> {{ element.CARACTERISTICAS === null ? 'Sin características' : element.CARACTERISTICAS }} </td>
+                <td mat-cell *matCellDef="let element"> {{ element.CARACTERISTICAS === null || element.CARACTERISTICAS === '' ? 'Sin características' : element.CARACTERISTICAS }} </td>
               </ng-container>
               <ng-container matColumnDef="CANTIDAD_DETALLES">
                 <th mat-header-cell *matHeaderCellDef>Cantidad de detalles</th>

+ 13 - 64
sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/artitle-form/artitle-form.component.ts

@@ -155,66 +155,6 @@ export class ArtitleFormComponent implements OnInit {
 
           this.dataSource.data = ARTICLE.DESCRIPCION_ARTICULO;
 
-
-          this.dataSource.data = [
-            {
-                "ID_DESCRIPCION": 1,
-                "NUMERO_PROVEEDOR": "0000000001",
-                "PROVEEDOR": "Soler y Palau México",
-                "ID_UNIDAD": 1,
-                "UNIDAD": "Unidad",
-                "DESCRIPCION": "The Catalyst 2960-X and Catalyst 2960-XR switches are Ethernet switches to which you can connect devices such as Cisco IP Phones, Cisco Wireless Access Points, workstations, and other network devices such as servers, routers, and other switches. Some models of the switches support stacking through the Cisco FlexStack-Plus technology. Unless otherwise noted, the term switch refers to both a standalone switch and to a switch stack.",
-                "CARACTERISTICAS": null,
-                "ESTADO": "Activo",
-                "ARCHIVOS": [],
-                "DETALLES": [
-                    {
-                        "ID_DETAILS": 1,
-                        "CODIGO": "2960X",
-                        "MODELO": "Catalyst 2960-X",
-                        "MONEDA": "MXN",
-                        "PRECIO": 3200,
-                        "MONTO_MINIMO": 3200,
-                        "CARACTERISTICAS": "Cisco Catalyst 2960-X Stackable 48 10/100/1000 Power over Ethernet Plus (PoE+) ports (PoE budget of 740 W) and two small form-factor pluggable (SFP)+1 module slots.",
-                        "ESTADO": "Activo"
-                    },
-                    {
-                        "ID_DETAILS": 2,
-                        "CODIGO": "2960XR",
-                        "MODELO": "Catalyst 2960-XR",
-                        "MONEDA": "MXN",
-                        "PRECIO": 4800,
-                        "MONTO_MINIMO": 4800,
-                        "CARACTERISTICAS": "Cisco Catalyst 2960-XR Stackable 48 10/100/1000 Power over Ethernet Plus (PoE+) ports (PoE budget of 740 W), two small form-factor pluggable (SFP)+4 module slots, 1025-W power supply.",
-                        "ESTADO": "Activo"
-                    }
-                ]
-            },
-            {
-                "ID_DESCRIPCION": 0,
-                "NUMERO_PROVEEDOR": "0000000002",
-                "PROVEEDOR": "Mercado Libre",
-                "ID_UNIDAD": 1,
-                "UNIDAD": "Unidad",
-                "DESCRIPCION": "asd",
-                "CARACTERISTICAS": "",
-                "ESTADO": "Activo",
-                "DETALLES": [
-                    {
-                        "ID_DETAILS": 3,
-                        "CODIGO": "sd",
-                        "MODELO": "asd",
-                        "MONEDA": "MXN",
-                        "PRECIO": 100,
-                        "MONTO_MINIMO": 100,
-                        "CARACTERISTICAS": "asd",
-                        "ESTADO": "Activo"
-                    }
-                ],
-                "ARCHIVOS": []
-            }
-        ]
-
         } else { 
           this.resourcesService.openSnackBar(responseData.msg);
         }
@@ -259,6 +199,7 @@ export class ArtitleFormComponent implements OnInit {
       PROVEEDOR: requestForm.PROVEEDOR,
       ID_UNIDAD: requestForm.ID_UNIDAD,
       UNIDAD: requestForm.UNIDAD,
+      CANTIDAD_UNIDAD: requestForm.CANTIDAD_UNIDAD,
       DESCRIPCION: requestForm.DESCRIPCION,
       CARACTERISTICAS: requestForm.CARACTERISTICAS,
       ESTADO: 'Activo',
@@ -277,6 +218,7 @@ export class ArtitleFormComponent implements OnInit {
     datasource[index].PROVEEDOR = requestForm.PROVEEDOR;
     datasource[index].ID_UNIDAD = requestForm.ID_UNIDAD;
     datasource[index].UNIDAD = requestForm.UNIDAD;
+    datasource[index].CANTIDAD_UNIDAD = requestForm.CANTIDAD_UNIDAD;
     datasource[index].DESCRIPCION = requestForm.DESCRIPCION;
     datasource[index].CARACTERISTICAS = requestForm.CARACTERISTICAS;
     datasource[index].ARCHIVOS = requestForm.ARCHIVOS,
@@ -361,7 +303,13 @@ export class ArtitleFormComponent implements OnInit {
     if (dataDescription.ARCHIVOS.length === 0) {
       return 'assets/img/empty_img_2.svg';
     } else {
-      return dataDescription.ARCHIVOS[0].SHOW;
+      let imagen = 'assets/img/empty_img_2.svg';
+      for (const element of dataDescription.ARCHIVOS) {
+        if (element.TYPE !== 'OD') {
+          imagen = element.SHOW;
+        }
+      }
+      return imagen;
     }
   }
   public setAlt (dataDescription: DataDescriptionArticle) {
@@ -398,12 +346,12 @@ export class ArtitleFormComponent implements OnInit {
     if (this.dataSource.data.length > 1) {
       this._dialog.open(PriorityArticleComponent, {
         data: this.dataSource.data,
-        width: '600px'
+        width: '800px'
       }).afterClosed().subscribe(async (response) => {
         if (response) {
           this.dataSource.data = response
+          await this._confirmateSave();
         }
-        await this._confirmateSave();
       });
     } else {
       await this._confirmateSave();
@@ -434,8 +382,8 @@ export class ArtitleFormComponent implements OnInit {
     await lastValueFrom(this._acquisitionServices.registerArticle(FORM_REQUEST)).then(
       async (responseData: ResponseData) => {
         if ( !responseData.error ) {
-          this.resourcesService.openSnackBar('¡Registro exitoso!');
           await this._deleteTempFileDelete();
+          this.resourcesService.openSnackBar('¡Registro exitoso!');
           this._router.navigate(['/sam/GEAD/PROV/GVPA']);
         } else {
           this.resourcesService.openSnackBar(`${responseData.msg}`);
@@ -472,6 +420,7 @@ export class ArtitleFormComponent implements OnInit {
     SUBFAMILIA = SUBFAMILIA.ID_SUBFAMILIA;
 
     let DESCRIPCION_ARTICULO: DataDescriptionArticle[] = this.dataSource.data;
+    console.log(DESCRIPCION_ARTICULO);
     
     const REQUEST_FORM: FormRequestArticle = {
       CODIGO: CODIGO,

+ 2 - 2
sistema-mantenimiento-front/src/app/components/acquisition-management/provider/artitle/priority-article/priority-article.component.html

@@ -6,7 +6,7 @@
             <div class="example-box" cdkDrag>
                 <div class="example-custom-placeholder" *cdkDragPlaceholder></div>
                 <div style="display: flex; align-items: center;">
-                    <div style="height: 100px; width: 100px; padding: 8px;">
+                    <div style="height: 100px; width: 100px; padding: 8px; display: flex; justify-content: center; align-items: center;">
                         <img [src]="setImage(items)" [alt]="setAlt(items)" style="max-height: 100px; max-width: 100px;">
                     </div>
                     <div>
@@ -27,5 +27,5 @@
 </mat-dialog-content>
 <mat-dialog-actions align="end">
     <button mat-button [mat-dialog-close]="false">Cerrar</button>
-    <button mat-button>Aceptar</button>
+    <button mat-button [mat-dialog-close]="true">Aceptar</button>
 </mat-dialog-actions>

+ 2 - 0
sistema-mantenimiento-front/src/app/interfaces/acquisition-management/artitle.interface.ts

@@ -391,6 +391,7 @@ export interface FormRequestInformation {
   NUMERO_PROVEEDOR: string;
   PROVEEDOR: string;
   ID_UNIDAD: number;
+  CANTIDAD_UNIDAD: number;
   UNIDAD: string;
   DESCRIPCION: string;
   CARACTERISTICAS: string;
@@ -404,6 +405,7 @@ export interface DataDescriptionArticle {
   ID_UNIDAD: number;
   UNIDAD: string;
   DESCRIPCION: string;
+  CANTIDAD_UNIDAD: number;
   CARACTERISTICAS: string | null;
   ESTADO: 'Activo' | 'Eliminado';
   DETALLES: DataInformationArticle[];