@seniorsistemas/yms-integration 1.37.0 → 1.38.0-0be270cf-7979-4065-88af-d4097b6f6e51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +98 -27
  2. package/bundles/seniorsistemas-yms-integration.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-yms-integration.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-yms-integration.umd.min.js.map +1 -1
  5. package/esm2015/src/wms/components/document-grid/document-grid.component.js +10 -5
  6. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.component.js +46 -16
  7. package/esm2015/src/wms/components/document-grid/register-document/register-document.component.js +40 -4
  8. package/esm2015/src/wms/components/document-list/document-list.component.js +6 -3
  9. package/esm2015/src/wms/entities/document/document.service.js +4 -1
  10. package/esm5/src/wms/components/document-grid/document-grid.component.js +10 -8
  11. package/esm5/src/wms/components/document-grid/insert-key/insert-key.component.js +47 -16
  12. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +41 -4
  13. package/esm5/src/wms/components/document-list/document-list.component.js +6 -3
  14. package/esm5/src/wms/entities/document/document.service.js +4 -1
  15. package/fesm2015/seniorsistemas-yms-integration.js +96 -24
  16. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  17. package/fesm5/seniorsistemas-yms-integration.js +98 -27
  18. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  19. package/package.json +1 -1
  20. package/seniorsistemas-yms-integration.metadata.json +1 -1
  21. package/src/wms/components/document-grid/document-grid.component.d.ts +1 -0
  22. package/src/wms/components/document-grid/insert-key/insert-key.component.d.ts +7 -2
  23. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +9 -1
  24. package/src/wms/entities/document/document.service.d.ts +1 -0
@@ -3316,6 +3316,9 @@
3316
3316
  DocumentService.prototype.getSystemIntegration = function () {
3317
3317
  return this.http.get('yms_int/wms/queries/getSystemIntegration');
3318
3318
  };
3319
+ DocumentService.prototype.getPlanta = function (plantaId) {
3320
+ return this.http.get('yms/patio/entities/planta/' + plantaId);
3321
+ };
3319
3322
  DocumentService = __decorate([
3320
3323
  core.Injectable(),
3321
3324
  __metadata("design:paramtypes", [http.HttpClient, api.MessageService])
@@ -3600,8 +3603,7 @@
3600
3603
  DocumentGridComponent.prototype.wmsSeniorConnectIntegration = function () {
3601
3604
  var columns = __spread([
3602
3605
  { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") }
3603
- ], this.getColumnPartner());
3604
- this.addInvoiceSituationIfNotClienteExterno(columns);
3606
+ ], this.getColumnPartner(), this.getColumnlogistcUnit());
3605
3607
  return columns;
3606
3608
  };
3607
3609
  DocumentGridComponent.prototype.wmsWisIntegration = function () {
@@ -3626,10 +3628,7 @@
3626
3628
  return __spread([
3627
3629
  { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3628
3630
  { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") }
3629
- ], this.getColumnPartner(), [
3630
- { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3631
- { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3632
- ]);
3631
+ ], this.getColumnPartner(), this.getColumnlogistcUnit());
3633
3632
  };
3634
3633
  DocumentGridComponent.prototype.getColumnPartner = function () {
3635
3634
  return [
@@ -3637,6 +3636,12 @@
3637
3636
  { field: "partnerDocument", header: this.translate.instant("yms.int.wms_register_document_partner_document") },
3638
3637
  ];
3639
3638
  };
3639
+ DocumentGridComponent.prototype.getColumnlogistcUnit = function () {
3640
+ return [
3641
+ { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3642
+ { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3643
+ ];
3644
+ };
3640
3645
  DocumentGridComponent.prototype.addInvoiceSituationIfNotClienteExterno = function (columns) {
3641
3646
  if (!this.isClienteExterno) {
3642
3647
  columns.push(this.getColumninvoiceCondition());
@@ -3701,7 +3706,7 @@
3701
3706
  DocumentGridComponent = __decorate([
3702
3707
  core.Component({
3703
3708
  selector: 'document-grid',
3704
- template: "<div *ngIf=\"this.processType === 'RECEBIMENTO_WMS'; else processNotConfigured\">\n <p-panel>\n <p-header>\n <div class=\"buttons\">\n <div>\n <s-button\n label=\"{{'yms.int.wms_add_document' | translate}}\"\n priority=\"primary\"\n [model]=\"getActions()\"\n [auxiliary]=\"false\"\n [disabled]=\"!enableButtonIsClienteExterno\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_view_button' | translate}}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!selection || selection.length !== 1\"\n (onClick)=\"view()\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_delete_button' | translate}}\"\n priority=\"secondary\"\n [disabled]=\"!selection || !selection.length || !enableButtonIsClienteExterno\"\n (click)=\"onDelete()\">\n </s-button>\n </div>\n <s-button\n id=\"refresh-button\"\n priority=\"default\"\n iconClass=\"fa fa-refresh\"\n (onClick)=\"listDocuments(false)\"\n [disabled]=\"notSavedDocuments()\"\n >\n </s-button>\n </div>\n </p-header>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\" *ngIf=\"gridData && gridData.length; else emptyList\">\n <p-table #documentTable [value]=\"gridData\"\n [columns]=\"gridColumns\" dataKey=\"key\" [scrollable]=\"true\" [resizableColumns]=\"true\"\n [paginator]=\"true\" [totalRecords]=\"documentTotalRecords\" rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\" [(selection)]=\"selection\"\n [loading]=\"loading\">\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" [style.width]=\"col.width\"/>\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th id=\"checkbox\" class=\"table-checkbox\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th id=\"col\" *ngFor=\"let col of columns\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-columns let-expanded=\"expanded\">\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"table-checkbox\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"isWmsSeniorConnect()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"key\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceKey\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceNumber\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceSerialNumber\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSeniorConnect() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"partnerName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSeniorConnect() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"partnerDocument\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"logistcUnitName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"logistcUnitDocument\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"ownerName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"ownerDocument\"]}}</span>\n </td>\n <td *ngIf=\"!isClienteExterno\" (click)=\"selection = [rowData]\">\n <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"getFilteredInvoiceConditions(rowData?.invoiceCondition)\"\n appendTo=\"body\"\n [(ngModel)]=\"rowData.invoiceCondition\"\n (onChange)=\"disabled = false\">\n </p-dropdown>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [translate]=\"'yms.main.total_records'\" \n [translateParams]=\"{ value: documentTotalRecords }\">\n </span>\n </ng-template>\n </p-table> \n </div>\n </div>\n <register-document\n [wmsSystem]=\"wmsSystem\"\n [edit]=\"edit\"\n [viewDocument]=\"selection\"\n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleDocumentRegister\"\n [agenda]=\"agenda\"\n [isClienteExterno]=\"isClienteExterno\">\n </register-document> \n <insert-key\n [wmsSystem]=\"wmsSystem\" \n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleInvoiceKey\">\n </insert-key>\n </p-panel>\n</div>\n <div class=\"button-save\">\n <s-button \n priority=\"primary\" [label]=\"'save' | translate\"\n [disabled]=\"disabled || !this.gridData || !enableButtonIsClienteExterno\"\n (click)=\"save()\">\n </s-button>\n </div>\n\n<ng-template #emptyList>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\" [title]=\"'detail_empty_state_title' | translate\"\n [description]=\"'detail_empty_state_description' | translate\">\n </s-empty-state>\n </div>\n</ng-template>\n\n<ng-template #processNotConfigured>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\"\n [title]=\"'yms.int.wms_there_no_process_type_configured_for_this_type_scheduling' | translate\">\n </s-empty-state>\n </div>\n</ng-template>",
3709
+ template: "<div *ngIf=\"this.processType === 'RECEBIMENTO_WMS'; else processNotConfigured\">\n <p-panel>\n <p-header>\n <div class=\"buttons\">\n <div>\n <s-button\n label=\"{{'yms.int.wms_add_document' | translate}}\"\n priority=\"primary\"\n [model]=\"getActions()\"\n [auxiliary]=\"false\"\n [disabled]=\"!enableButtonIsClienteExterno\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_view_button' | translate}}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!selection || selection.length !== 1\"\n (onClick)=\"view()\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_delete_button' | translate}}\"\n priority=\"secondary\"\n [disabled]=\"!selection || !selection.length || !enableButtonIsClienteExterno\"\n (click)=\"onDelete()\">\n </s-button>\n </div>\n <s-button\n id=\"refresh-button\"\n priority=\"default\"\n iconClass=\"fa fa-refresh\"\n (onClick)=\"listDocuments(false)\"\n [disabled]=\"notSavedDocuments()\"\n >\n </s-button>\n </div>\n </p-header>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\" *ngIf=\"gridData && gridData.length; else emptyList\">\n <p-table #documentTable [value]=\"gridData\"\n [columns]=\"gridColumns\" dataKey=\"key\" [scrollable]=\"true\" [resizableColumns]=\"true\"\n [paginator]=\"true\" [totalRecords]=\"documentTotalRecords\" rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\" [(selection)]=\"selection\"\n [loading]=\"loading\">\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" [style.width]=\"col.width\"/>\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th id=\"checkbox\" class=\"table-checkbox\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th id=\"col\" *ngFor=\"let col of columns\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-columns let-expanded=\"expanded\">\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"table-checkbox\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"isWmsSeniorConnect()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"key\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceKey\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceNumber\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceSerialNumber\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSeniorConnect() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"partnerName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSeniorConnect() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"partnerDocument\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt() || isWmsSeniorConnect()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"logistcUnitName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt() || isWmsSeniorConnect()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"logistcUnitDocument\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"ownerName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"ownerDocument\"]}}</span>\n </td>\n <td *ngIf=\"!isClienteExterno && isWmsWIS()\" (click)=\"selection = [rowData]\">\n <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"getFilteredInvoiceConditions(rowData?.invoiceCondition)\"\n appendTo=\"body\"\n [(ngModel)]=\"rowData.invoiceCondition\"\n (onChange)=\"disabled = false\">\n </p-dropdown>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [translate]=\"'yms.main.total_records'\" \n [translateParams]=\"{ value: documentTotalRecords }\">\n </span>\n </ng-template>\n </p-table> \n </div>\n </div>\n <register-document\n [wmsSystem]=\"wmsSystem\"\n [edit]=\"edit\"\n [viewDocument]=\"selection\"\n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleDocumentRegister\"\n [agenda]=\"agenda\"\n [isClienteExterno]=\"isClienteExterno\">\n </register-document> \n <insert-key\n [wmsSystem]=\"wmsSystem\" \n (document)=\"onChangeDocument($event)\"\n [agenda]=\"agenda\"\n [(visible)]=\"visibleInvoiceKey\">\n </insert-key>\n </p-panel>\n</div>\n <div class=\"button-save\">\n <s-button \n priority=\"primary\" [label]=\"'save' | translate\"\n [disabled]=\"disabled || !this.gridData || !enableButtonIsClienteExterno\"\n (click)=\"save()\">\n </s-button>\n </div>\n\n<ng-template #emptyList>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\" [title]=\"'detail_empty_state_title' | translate\"\n [description]=\"'detail_empty_state_description' | translate\">\n </s-empty-state>\n </div>\n</ng-template>\n\n<ng-template #processNotConfigured>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\"\n [title]=\"'yms.int.wms_there_no_process_type_configured_for_this_type_scheduling' | translate\">\n </s-empty-state>\n </div>\n</ng-template>",
3705
3710
  styles: [".buttons{display:flex;justify-content:space-between}.center{flex-direction:column;text-align:center}.ui-g{display:block}.button-save{margin:5px 0}#refresh-button{color:#fff}.table-checkbox{width:50px}.invoice-condition .p-dropdown{position:relative;z-index:1000}"]
3706
3711
  }),
3707
3712
  __metadata("design:paramtypes", [core$1.TranslateService,
@@ -3757,9 +3762,11 @@
3757
3762
  }());
3758
3763
 
3759
3764
  var RegisterDocumentComponent = /** @class */ (function () {
3760
- function RegisterDocumentComponent(fb, translate) {
3765
+ function RegisterDocumentComponent(fb, translate, utils, documentService) {
3761
3766
  this.fb = fb;
3762
3767
  this.translate = translate;
3768
+ this.utils = utils;
3769
+ this.documentService = documentService;
3763
3770
  this.document = new core.EventEmitter();
3764
3771
  this.visible = new core.EventEmitter();
3765
3772
  this.visibleChange = new core.EventEmitter();
@@ -3767,12 +3774,23 @@
3767
3774
  this.invoiceCondition = getInvoiceConditions(this.translate);
3768
3775
  }
3769
3776
  RegisterDocumentComponent.prototype.ngOnInit = function () {
3777
+ this.getYard();
3770
3778
  this.getFormGroup();
3771
3779
  this.watchFormChanges();
3772
3780
  };
3773
3781
  RegisterDocumentComponent.prototype.ngOnChanges = function () {
3774
3782
  this.visibilityConfig();
3775
3783
  };
3784
+ RegisterDocumentComponent.prototype.getYard = function () {
3785
+ var _this = this;
3786
+ this.documentService.getPlanta(this.agenda.planta.id)
3787
+ .pipe(operators.catchError(function (err) {
3788
+ return rxjs.throwError(err);
3789
+ }))
3790
+ .subscribe(function (content) {
3791
+ _this.planta = content;
3792
+ });
3793
+ };
3776
3794
  RegisterDocumentComponent.prototype.visibilityConfig = function () {
3777
3795
  if (!this.edit && this.visible) {
3778
3796
  this.formGroup.disable();
@@ -3823,12 +3841,29 @@
3823
3841
  });
3824
3842
  };
3825
3843
  RegisterDocumentComponent.prototype.save = function () {
3844
+ var logistcUnitDocument = this.formGroup.get("logistcUnitDocument").value;
3845
+ this.validateYardDocument(logistcUnitDocument);
3826
3846
  this.document.emit(Document.fromDto(this.formGroup.getRawValue()));
3827
3847
  this.formGroup.reset();
3828
3848
  };
3849
+ RegisterDocumentComponent.prototype.validateYardDocument = function (logistcUnitDocument) {
3850
+ if (this.isWmsSeniorConnect()) {
3851
+ if (!this.planta.codigo) {
3852
+ this.utils.message("warn", "yms.int.yard_code_not_found_warning_header", "yms.int.yard_code_not_found_warning_description");
3853
+ return;
3854
+ }
3855
+ if (logistcUnitDocument !== this.planta.codigo) {
3856
+ this.utils.message("warn", "yms.int.document_yard_mismatch_agenda_warning_header", "yms.int.document_yard_mismatch_agenda_warning_description");
3857
+ return;
3858
+ }
3859
+ }
3860
+ };
3829
3861
  RegisterDocumentComponent.prototype.isWmsWis = function () {
3830
3862
  return this.wmsSystem === WmsSystem.WIS;
3831
3863
  };
3864
+ RegisterDocumentComponent.prototype.isWmsSenior = function () {
3865
+ return this.wmsSystem === WmsSystem.SENIOR;
3866
+ };
3832
3867
  RegisterDocumentComponent.prototype.isWmsSeniorConnect = function () {
3833
3868
  return this.wmsSystem === WmsSystem.SENIOR_CONNECT;
3834
3869
  };
@@ -3874,9 +3909,12 @@
3874
3909
  RegisterDocumentComponent = __decorate([
3875
3910
  core.Component({
3876
3911
  selector: "register-document",
3877
- template: "<s-sidebar\n [visible]=\"visible\"\n header=\"{{ 'yms.int.wms_register_document_add_document' | translate }} {{ wmsSystem }}\"\n (visibleChange)=\"close()\"\n (onclose)=\"close()\">\n <form [formGroup]=\"formGroup\">\n <div class=\"ui-g ui-fluid\">\n <div class=\"ui-g-6\" *ngIf=\"isWmsSeniorConnect()\">\n <label for=\"key\">{{'yms.int.wms_purchaseOrder' | translate}}</label>\n <input id=\"key\" pInputText type=\"text\" formControlName=\"key\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"invoiceKey\">{{'yms.int.wms_register_document_invoice_key' | translate}}</label>\n <input id=\"invoiceKey\" pInputText type=\"text\" formControlName=\"invoiceKey\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceNumber\">{{'yms.int.wms_register_document_invoice_number' | translate}}</label>\n <input id=\"invoiceNumber\" pInputText type=\"text\" formControlName=\"invoiceNumber\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceSerialNumber\">\n {{'yms.int.wms_register_document_invoice_serial_number' | translate}}\n </label>\n <input id=\"invoiceSerialNumber\" pInputText type=\"text\" formControlName=\"invoiceSerialNumber\">\n </div>\n <div class=\"ui-g-8\">\n <label for=\"logistcUnitName\">{{'yms.int.wms_register_document_logistc_unit_name' | translate}}</label>\n <input id=\"logistcUnitName\" pInputText type=\"text\" formControlName=\"logistcUnitName\">\n </div>\n <div class=\"ui-g-4\">\n <label for=\"logistcUnitDocument\">\n {{'yms.int.wms_register_document_logistc_unit_document' | translate}}\n </label>\n <input id=\"logistcUnitDocument\" pInputText type=\"text\" formControlName=\"logistcUnitDocument\">\n </div>\n <div class=\"ui-g-8\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"documentOwnerName\">{{'yms.int.wms_register_document_owner_name' | translate}}</label>\n <input id=\"documentOwnerName\" pInputText type=\"text\" formControlName=\"ownerName\">\n </div>\n <div class=\"ui-g-4\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"ownerDocument\">{{'yms.int.wms_register_document_owner_document' | translate}}</label>\n <input id=\"ownerDocument\" pInputText type=\"text\" formControlName=\"ownerDocument\">\n </div>\n <div class=\"ui-g-8\">\n <label for=\"partnerName\">{{'yms.int.wms_register_document_partner_name' | translate}}</label>\n <input id=\"partnerName\" pInputText type=\"text\" formControlName=\"partnerName\">\n </div>\n <div class=\"ui-g-4\">\n <label for=\"partnerDocument\">{{'yms.int.wms_register_document_partner_document' | translate}}</label>\n <input id=\"partnerDocument\" pInputText type=\"text\" formControlName=\"partnerDocument\">\n </div>\n <div class=\"ui-g-12\">\n <label for=\"notes\" id=\"notes\">{{'yms.int.wms_register_document_notes' | translate}}</label>\n <textarea id=\"notes\" rows=\"4\" pInputTextarea autoResize=\"autoResize\" formControlName=\"notes\"></textarea>\n </div>\n <div class=\"ui-g-4\">\n <label for=\"code\">\n {{'yms.int.wms_register_document_order_receiving_code' | translate}}\n </label>\n <input id=\"code\" pInputText type=\"text\" formControlName=\"code\">\n </div>\n <div class=\"ui-g-4\" *ngIf=\"!isClienteExterno\">\n <label for=\"invoiceCondition\" id=\"invoiceCondition\">\n {{'yms.int.wms_grid_document_invoice_condition' | translate}}\n </label>\n <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"invoiceCondition\"\n formControlName=\"invoiceCondition\"\n ></p-dropdown>\n </div>\n </div>\n </form>\n <div class=\"space-between\">\n <button\n pButton label=\"{{'save' | translate}}\"\n (click)=\"save()\"\n [attr.data-hidden]=\"hideSaveButton\"\n [disabled]=\"!isSaveFormValid\">\n </button>\n <button\n type=\"button\" class=\"ui-button-link\" pButton label=\"{{'cancel' | translate}}\" (click)=\"close()\">\n </button>\n </div>\n</s-sidebar>"
3912
+ template: "<s-sidebar\n [visible]=\"visible\"\n header=\"{{ 'yms.int.wms_register_document_add_document' | translate }} {{ wmsSystem }}\"\n (visibleChange)=\"close()\"\n (onclose)=\"close()\">\n <form [formGroup]=\"formGroup\">\n <div class=\"ui-g ui-fluid\">\n <div class=\"ui-g-6\" *ngIf=\"isWmsSeniorConnect()\">\n <label for=\"key\">{{'yms.int.wms_purchaseOrder' | translate}}</label>\n <input id=\"key\" pInputText type=\"text\" formControlName=\"key\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"invoiceKey\">{{'yms.int.wms_register_document_invoice_key' | translate}}</label>\n <input id=\"invoiceKey\" pInputText type=\"text\" formControlName=\"invoiceKey\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceNumber\">{{'yms.int.wms_register_document_invoice_number' | translate}}</label>\n <input id=\"invoiceNumber\" pInputText type=\"text\" formControlName=\"invoiceNumber\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceSerialNumber\">\n {{'yms.int.wms_register_document_invoice_serial_number' | translate}}\n </label>\n <input id=\"invoiceSerialNumber\" pInputText type=\"text\" formControlName=\"invoiceSerialNumber\">\n </div>\n <div class=\"ui-g-8\">\n <label for=\"logistcUnitName\">{{'yms.int.wms_register_document_logistc_unit_name' | translate}}</label>\n <input id=\"logistcUnitName\" pInputText type=\"text\" formControlName=\"logistcUnitName\">\n </div>\n <div class=\"ui-g-4\">\n <label for=\"logistcUnitDocument\">\n {{'yms.int.wms_register_document_logistc_unit_document' | translate}}\n </label>\n <input id=\"logistcUnitDocument\" pInputText type=\"text\" formControlName=\"logistcUnitDocument\">\n </div>\n <div class=\"ui-g-8\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"documentOwnerName\">{{'yms.int.wms_register_document_owner_name' | translate}}</label>\n <input id=\"documentOwnerName\" pInputText type=\"text\" formControlName=\"ownerName\">\n </div>\n <div class=\"ui-g-4\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"ownerDocument\">{{'yms.int.wms_register_document_owner_document' | translate}}</label>\n <input id=\"ownerDocument\" pInputText type=\"text\" formControlName=\"ownerDocument\">\n </div>\n <div class=\"ui-g-8\">\n <label for=\"partnerName\">{{'yms.int.wms_register_document_partner_name' | translate}}</label>\n <input id=\"partnerName\" pInputText type=\"text\" formControlName=\"partnerName\">\n </div>\n <div class=\"ui-g-4\">\n <label for=\"partnerDocument\">{{'yms.int.wms_register_document_partner_document' | translate}}</label>\n <input id=\"partnerDocument\" pInputText type=\"text\" formControlName=\"partnerDocument\">\n </div>\n <div class=\"ui-g-12\">\n <label for=\"notes\" id=\"notes\">{{'yms.int.wms_register_document_notes' | translate}}</label>\n <textarea id=\"notes\" rows=\"4\" pInputTextarea autoResize=\"autoResize\" formControlName=\"notes\"></textarea>\n </div>\n <div class=\"ui-g-4\" *ngIf=\"isWmsSenior() || isWmsWis()\">\n <label for=\"code\">\n {{'yms.int.wms_register_document_order_receiving_code' | translate}}\n </label>\n <input id=\"code\" pInputText type=\"text\" formControlName=\"code\">\n </div>\n <div class=\"ui-g-4\" *ngIf=\"!isClienteExterno && isWmsWis()\">\n <label for=\"invoiceCondition\" id=\"invoiceCondition\">\n {{'yms.int.wms_grid_document_invoice_condition' | translate}}\n </label>\n <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"invoiceCondition\"\n formControlName=\"invoiceCondition\"\n ></p-dropdown>\n </div>\n </div>\n </form>\n <div class=\"space-between\">\n <button\n pButton label=\"{{'save' | translate}}\"\n (click)=\"save()\"\n [attr.data-hidden]=\"hideSaveButton\"\n [disabled]=\"!isSaveFormValid\">\n </button>\n <button\n type=\"button\" class=\"ui-button-link\" pButton label=\"{{'cancel' | translate}}\" (click)=\"close()\">\n </button>\n </div>\n</s-sidebar>"
3878
3913
  }),
3879
- __metadata("design:paramtypes", [forms.FormBuilder, core$1.TranslateService])
3914
+ __metadata("design:paramtypes", [forms.FormBuilder,
3915
+ core$1.TranslateService,
3916
+ UtilsMessageService,
3917
+ DocumentService])
3880
3918
  ], RegisterDocumentComponent);
3881
3919
  return RegisterDocumentComponent;
3882
3920
  }());
@@ -3930,8 +3968,8 @@
3930
3968
  this.confirmationService = confirmationService;
3931
3969
  this.translate = translate;
3932
3970
  this.externalTenantService = externalTenantService;
3933
- this.document = new core.EventEmitter();
3934
3971
  this.visible = new core.EventEmitter();
3972
+ this.document = new core.EventEmitter();
3935
3973
  this.visibleChange = new core.EventEmitter();
3936
3974
  this.isLoading = false;
3937
3975
  this.isPartnerloading = false;
@@ -3939,6 +3977,7 @@
3939
3977
  }
3940
3978
  InsertKeyComponent.prototype.ngOnInit = function () {
3941
3979
  var _this = this;
3980
+ this.getYard();
3942
3981
  this.formGroup = this.formBuilder.group({
3943
3982
  key: [undefined],
3944
3983
  purchaseOrder: [undefined],
@@ -3950,6 +3989,16 @@
3950
3989
  _this.validateKeyDetails(nf);
3951
3990
  });
3952
3991
  };
3992
+ InsertKeyComponent.prototype.getYard = function () {
3993
+ var _this = this;
3994
+ this.documentService.getPlanta(this.agenda.planta.id)
3995
+ .pipe(operators.catchError(function (err) {
3996
+ return rxjs.throwError(err);
3997
+ }))
3998
+ .subscribe(function (content) {
3999
+ _this.planta = content;
4000
+ });
4001
+ };
3953
4002
  InsertKeyComponent.prototype.isWmsWis = function () {
3954
4003
  return this.wmsSystem === WmsSystem.WIS;
3955
4004
  };
@@ -3980,7 +4029,7 @@
3980
4029
  _this.utils.message("error", "yms.int.wms_error_search_document_message_header", "yms.int.wms_error_search_document_not_found_message_content");
3981
4030
  }
3982
4031
  else {
3983
- _this.utils.translateMessage("error", "yms.int.wms_error_search_document_message_header", "yms.int.wms_error_unknown_search_document_message_content" + err.error.message);
4032
+ _this.utils.translateMessage("error", "yms.int.wms_error_search_document_message_header", "yms.int.wms_error_unknown_search_document_message_content " + err.error.message);
3984
4033
  }
3985
4034
  _this.confirmInvoiceDialog();
3986
4035
  return rxjs.throwError(err);
@@ -3993,21 +4042,36 @@
3993
4042
  return;
3994
4043
  }
3995
4044
  var document = content.contents[0];
4045
+ _this.validateYardDocument(document.logistcUnitDocument);
3996
4046
  document.invoiceKey = _this.formGroup.get('key').value;
3997
4047
  document.invoiceCondition = InvoiceCondition.AUTHORIZED;
3998
4048
  _this.document.emit(document);
3999
4049
  _this.formGroup.reset();
4000
4050
  });
4001
4051
  };
4052
+ InsertKeyComponent.prototype.validateYardDocument = function (logistcUnitDocument) {
4053
+ if (this.isWmsSeniorConnect()) {
4054
+ if (!this.planta.codigo) {
4055
+ this.utils.message("warn", "yms.int.yard_code_not_found_warning_header", "yms.int.yard_code_not_found_warning_description");
4056
+ return;
4057
+ }
4058
+ if (logistcUnitDocument !== this.planta.codigo) {
4059
+ this.utils.message("warn", "yms.int.document_yard_mismatch_agenda_warning_header", "yms.int.document_yard_mismatch_agenda_warning_description");
4060
+ return;
4061
+ }
4062
+ }
4063
+ };
4002
4064
  InsertKeyComponent.prototype.confirmInvoiceDialog = function () {
4003
4065
  var _this = this;
4004
- this.confirmationService.confirm({
4005
- message: this.translate.instant("yms.int.wms_message_confirm_invoice_dialog"),
4006
- acceptLabel: this.translate.instant("yms.int.wms_accept_confirm_invoice_dialog"),
4007
- rejectLabel: this.translate.instant("yms.int.wms_reject_confirm_invoice_dialog"),
4008
- header: this.translate.instant("yms.int.wms_header_content_confirm_invoice_dialog"),
4009
- accept: function () { return _this.buildInvoice(); }
4010
- });
4066
+ if (this.isWmsWis()) {
4067
+ this.confirmationService.confirm({
4068
+ message: this.translate.instant("yms.int.wms_message_confirm_invoice_dialog"),
4069
+ acceptLabel: this.translate.instant("yms.int.wms_accept_confirm_invoice_dialog"),
4070
+ rejectLabel: this.translate.instant("yms.int.wms_reject_confirm_invoice_dialog"),
4071
+ header: this.translate.instant("yms.int.wms_header_content_confirm_invoice_dialog"),
4072
+ accept: function () { return _this.buildInvoice(); }
4073
+ });
4074
+ }
4011
4075
  };
4012
4076
  InsertKeyComponent.prototype.buildInvoice = function () {
4013
4077
  var _this = this;
@@ -4080,18 +4144,22 @@
4080
4144
  InsertKeyComponent.prototype.onDialogShow = function () {
4081
4145
  this.formGroup.reset();
4082
4146
  };
4083
- __decorate([
4084
- core.Output(),
4085
- __metadata("design:type", core.EventEmitter)
4086
- ], InsertKeyComponent.prototype, "document", void 0);
4087
4147
  __decorate([
4088
4148
  core.Input(),
4089
- __metadata("design:type", core.EventEmitter)
4090
- ], InsertKeyComponent.prototype, "visible", void 0);
4149
+ __metadata("design:type", Agenda)
4150
+ ], InsertKeyComponent.prototype, "agenda", void 0);
4091
4151
  __decorate([
4092
4152
  core.Input(),
4093
4153
  __metadata("design:type", String)
4094
4154
  ], InsertKeyComponent.prototype, "wmsSystem", void 0);
4155
+ __decorate([
4156
+ core.Input(),
4157
+ __metadata("design:type", core.EventEmitter)
4158
+ ], InsertKeyComponent.prototype, "visible", void 0);
4159
+ __decorate([
4160
+ core.Output(),
4161
+ __metadata("design:type", core.EventEmitter)
4162
+ ], InsertKeyComponent.prototype, "document", void 0);
4095
4163
  __decorate([
4096
4164
  core.Output(),
4097
4165
  __metadata("design:type", Object)
@@ -4267,6 +4335,9 @@
4267
4335
  { field: "key", label: 'yms.int.wms_purchaseOrder' },
4268
4336
  { field: "partnerName", label: 'yms.int.wms_register_document_invoice_partner_name' },
4269
4337
  { field: "partnerDocument", label: 'yms.int.wms_register_document_invoice_partner_document' },
4338
+ { field: "logistcUnitName", label: 'yms.int.wms_register_document_logistc_unit_name' },
4339
+ { field: "logistcUnitDocument", label: 'yms.int.wms_register_document_logistc_unit_document' },
4340
+ { field: "notes", label: 'yms.int.wms_register_document_notes' },
4270
4341
  ];
4271
4342
  }
4272
4343
  return __spread([
@@ -4361,8 +4432,8 @@
4361
4432
  ], DocumentListComponent.prototype, "wmsSystem", void 0);
4362
4433
  DocumentListComponent = __decorate([
4363
4434
  core.Component({
4364
- template: "<div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-table\n selectionMode=\"single\"\n [(selection)]=\"selected\"\n [value]=\"documents\"\n [columns]=\"getColumns\"\n dataKey=\"id\"\n rows=\"10\"\n [paginator]=\"true\"\n [totalRecords]=\"gridTotalRecords\"\n [lazy]=\"true\"\n [resizableColumns]=\"true\"\n (onLazyLoad)=\"updateGridData($event)\"\n *sLoadingState=\"gridLoading\"\n sortMode=\"multiple\"\n styleClass=\"sds-table-scrollable\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100, 200]\"\n paginatorDropdownScrollHeight=\"250px\"\n [scrollable]=\"true\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" class=\"table-col-width\">\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\" pResizableColumn [pSortableColumn]=\"col.field\" scope=\"col\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.label | translate }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr *ngIf=\"isWmsWIS()\">\n <td>{{ rowData?.invoiceNumber || 'N/A' }}</td>\n <td>{{ rowData?.invoiceSerialNumber || 'N/A' }}</td>\n <td>{{ rowData?.invoiceKey || 'N/A' }}</td>\n <td>{{ rowData?.partnerName || 'N/A' }}</td>\n <td>{{ rowData?.partnerDocument || 'N/A' }}</td>\n <td>{{ rowData?.code || 'N/A' }}</td>\n <td>\n <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"getFilteredInvoiceConditions(rowData?.invoiceCondition)\"\n appendTo=\"body\"\n [(ngModel)]=\"rowData.invoiceCondition\"\n [disabled]=\"isAuthorized(rowData.invoiceCondition)\"\n (onChange)=\"onInvoiceConditionChange($event, rowData)\">\n </p-dropdown>\n </td>\n <td>{{ rowData?.notes || 'N/A' }}</td>\n </tr>\n <tr *ngIf=\"isWmsSeniorConnect()\">\n <td>{{rowData?.key}}</td>\n <td>{{rowData?.partnerName}}</td>\n <td>{{rowData?.partnerDocument}}</td>\n </tr>\n <tr *ngIf=\"!isWmsWIS() && !isWmsSeniorConnect()\">\n <td>{{rowData?.invoiceKey}}</td>\n <td>{{rowData?.invoiceNumber}}</td>\n <td>{{rowData?.invoiceSerialNumber}}</td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <span>\n {{ gridTotalRecords + \" \" + \n ('yms.int.wms_register_document_total_elements' | translate:{value: gridTotalRecords}) }}\n </span>\n </ng-template>\n </p-table>\n <div class=\"button-save\">\n <s-button priority=\"primary\" [label]=\"'save' | translate\"\n [disabled]=\"!disabled || !this.documents\"\n (click)=\"save()\">\n </s-button>\n </div>\n </div>\n</div>",
4365
- styles: [".table-col-width{width:250px}.button-save{margin:5px 0}"]
4435
+ template: "<div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-table\n selectionMode=\"single\"\n [(selection)]=\"selected\"\n [value]=\"documents\"\n [columns]=\"getColumns\"\n dataKey=\"id\"\n rows=\"10\"\n [paginator]=\"true\"\n [totalRecords]=\"gridTotalRecords\"\n [lazy]=\"true\"\n [resizableColumns]=\"true\"\n (onLazyLoad)=\"updateGridData($event)\"\n *sLoadingState=\"gridLoading\"\n sortMode=\"multiple\"\n styleClass=\"sds-table-scrollable\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100, 200]\"\n paginatorDropdownScrollHeight=\"250px\"\n [scrollable]=\"true\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" [style.width]=\"col.field === 'notes' ? '400px' : '250px'\">\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\" pResizableColumn [pSortableColumn]=\"col.field\" scope=\"col\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.label | translate }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr *ngIf=\"isWmsWIS()\">\n <td>{{ rowData?.invoiceNumber || 'N/A' }}</td>\n <td>{{ rowData?.invoiceSerialNumber || 'N/A' }}</td>\n <td>{{ rowData?.invoiceKey || 'N/A' }}</td>\n <td>{{ rowData?.partnerName || 'N/A' }}</td>\n <td>{{ rowData?.partnerDocument || 'N/A' }}</td>\n <td>{{ rowData?.code || 'N/A' }}</td>\n <td>\n <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"getFilteredInvoiceConditions(rowData?.invoiceCondition)\"\n appendTo=\"body\"\n [(ngModel)]=\"rowData.invoiceCondition\"\n [disabled]=\"isAuthorized(rowData.invoiceCondition)\"\n (onChange)=\"onInvoiceConditionChange($event, rowData)\">\n </p-dropdown>\n </td>\n <td>{{ rowData?.notes || 'N/A' }}</td>\n </tr>\n <tr *ngIf=\"isWmsSeniorConnect()\">\n <td>{{rowData?.key}}</td>\n <td>{{rowData?.partnerName}}</td>\n <td>{{rowData?.partnerDocument}}</td>\n <td>{{rowData?.logistcUnitName}}</td>\n <td>{{rowData?.logistcUnitDocument}}</td>\n <td>{{rowData?.notes}}</td>\n </tr>\n <tr *ngIf=\"!isWmsWIS() && !isWmsSeniorConnect()\">\n <td>{{rowData?.invoiceKey}}</td>\n <td>{{rowData?.invoiceNumber}}</td>\n <td>{{rowData?.invoiceSerialNumber}}</td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <span>\n {{ gridTotalRecords + \" \" + \n ('yms.int.wms_register_document_total_elements' | translate:{value: gridTotalRecords}) }}\n </span>\n </ng-template>\n </p-table>\n <div class=\"button-save\">\n <s-button priority=\"primary\" [label]=\"'save' | translate\"\n [disabled]=\"!disabled || !this.documents\"\n (click)=\"save()\">\n </s-button>\n </div>\n </div>\n</div>",
4436
+ styles: [".button-save{margin:5px 0}"]
4366
4437
  }),
4367
4438
  __metadata("design:paramtypes", [DocumentService,
4368
4439
  core$1.TranslateService,