@seniorsistemas/yms-integration 1.31.1 → 1.32.0-887e4c69-9c5d-48b3-8b94-14e4ed34ce2a

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.
@@ -3776,6 +3776,7 @@ var InsertKeyComponent = /** @class */ (function () {
3776
3776
  this.isLoading = false;
3777
3777
  }
3778
3778
  InsertKeyComponent.prototype.ngOnInit = function () {
3779
+ var _this = this;
3779
3780
  this.formGroup = this.formBuilder.group({
3780
3781
  key: [undefined],
3781
3782
  purchaseOrder: [undefined],
@@ -3783,6 +3784,9 @@ var InsertKeyComponent = /** @class */ (function () {
3783
3784
  invoiceSerie: [undefined],
3784
3785
  partnerDocument: [undefined]
3785
3786
  });
3787
+ this.formGroup.get('key').valueChanges.subscribe(function (nf) {
3788
+ _this.validateKeyDetails(nf);
3789
+ });
3786
3790
  };
3787
3791
  InsertKeyComponent.prototype.isWmsWis = function () {
3788
3792
  return this.wmsSystem === WmsSystem.WIS;
@@ -3828,6 +3832,38 @@ var InsertKeyComponent = /** @class */ (function () {
3828
3832
  _this.formGroup.reset();
3829
3833
  });
3830
3834
  };
3835
+ InsertKeyComponent.prototype.validateKeyDetails = function (nf) {
3836
+ if (!nf) {
3837
+ this.keyErrorMessage = null;
3838
+ this.setValuesOfKey(undefined, undefined, undefined);
3839
+ return;
3840
+ }
3841
+ var nfLength = 44;
3842
+ if (nf.length === nfLength) {
3843
+ this.keyErrorMessage = null;
3844
+ this.extractKeyDetails(nf);
3845
+ }
3846
+ else {
3847
+ this.keyErrorMessage = "yms.int.wms_error_key_message";
3848
+ }
3849
+ };
3850
+ InsertKeyComponent.prototype.extractKeyDetails = function (nf) {
3851
+ var startCnpj = 6;
3852
+ var endCnpj = 20;
3853
+ var cnpj = nf.substring(startCnpj, endCnpj);
3854
+ var startSerie = 22;
3855
+ var endSerie = 25;
3856
+ var serie = nf.substring(startSerie, endSerie);
3857
+ var startInvoice = 25;
3858
+ var endInvoice = 34;
3859
+ var invoice = nf.substring(startInvoice, endInvoice);
3860
+ this.setValuesOfKey(invoice, serie, cnpj);
3861
+ };
3862
+ InsertKeyComponent.prototype.setValuesOfKey = function (invoiceNumber, invoiceSerie, partnerDocument) {
3863
+ this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
3864
+ this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
3865
+ this.formGroup.get('partnerDocument').setValue(partnerDocument);
3866
+ };
3831
3867
  InsertKeyComponent.prototype.cancel = function () {
3832
3868
  this.visibleChange.emit(false);
3833
3869
  };
@@ -3853,8 +3889,8 @@ var InsertKeyComponent = /** @class */ (function () {
3853
3889
  InsertKeyComponent = __decorate([
3854
3890
  Component({
3855
3891
  selector: "insert-key",
3856
- template: "<form [formGroup]=\"formGroup\">\n <p-dialog [(visible)]=\"visible\" [modal]=\"true\" \n [draggable]=\"false\" (visibleChange)=\"cancel()\" (onShow)=\"onDialogShow()\">\n <p-header>{{'yms.int.wms_search_document' | translate}} {{ wmsSystem }}</p-header>\n <s-loading-state [loading]=\"isLoading\">\n <div class=\"flex py-2 justify-content-center spacing-bottom\" \n *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"key\">{{'yms.int.wms_insert_key_label' | translate}}</label>\n <input id=\"key\" class=\"size-input\" pInputText type=\"text\" formControlName=\"key\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsSeniorConnect()\">\n <label for=\"purchaseOrder\">{{'yms.int.wms_purchaseOrder' | translate}} </label>\n <input id=\"purchaseOrder\" class=\"size-input\" pInputText type=\"text\" formControlName=\"purchaseOrder\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"invoiceNumber\">{{'yms.int.wms_invoice_number' | translate}}</label>\n <input id=\"invoiceNumber\" class=\"size-input\" pInputText type=\"text\" formControlName=\"invoiceNumber\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"invoiceSerie\">{{'yms.int.wms_invoice_serie' | translate}}</label>\n <input id=\"invoiceSerie\" class=\"size-input\" pInputText type=\"text\" formControlName=\"invoiceSerie\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"partnerDocument\">{{'yms.int.wms_partner_document' | translate}}</label>\n <input id=\"partnerDocument\" class=\"size-input\" pInputText type=\"text\" formControlName=\"partnerDocument\">\n </div>\n <div class=\"separator\"></div>\n <div class=\"spacing-top\">\n <s-button pButton label=\"{{'yms.int.wms_search' | translate}}\" (click)=\"add()\"></s-button>\n <s-button\n type=\"button\"\n class=\"ui-button-link\"\n pButton label=\"{{'cancel' | translate}}\"\n (click)=\"cancel()\">\n </s-button>\n </div>\n </s-loading-state>\n </p-dialog>\n\n</form>\n",
3857
- styles: [".spacing-top{margin-top:10px}.spacing-bottom{margin-bottom:10px}.separator{width:100%;margin:5px 0;height:1px;background-color:#ccc}.size-input{width:480px}"]
3892
+ template: "<form [formGroup]=\"formGroup\">\n <p-dialog [(visible)]=\"visible\" [modal]=\"true\" \n [draggable]=\"false\" (visibleChange)=\"cancel()\" (onShow)=\"onDialogShow()\">\n <p-header>{{'yms.int.wms_search_document' | translate}} {{ wmsSystem }}</p-header>\n <s-loading-state [loading]=\"isLoading\">\n <div class=\"flex py-2 justify-content-center spacing-bottom\"\n *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"key\">{{'yms.int.wms_insert_key_label' | translate}}</label>\n <input id=\"key\" class=\"size-input\" pInputText type=\"text\" formControlName=\"key\">\n <span class=\"error-message\">{{keyErrorMessage | translate}}</span>\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsSeniorConnect()\">\n <label for=\"purchaseOrder\">{{'yms.int.wms_purchaseOrder' | translate}} </label>\n <input id=\"purchaseOrder\" class=\"size-input\" pInputText type=\"text\" formControlName=\"purchaseOrder\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"invoiceNumber\">{{'yms.int.wms_invoice_number' | translate}}</label>\n <input id=\"invoiceNumber\" class=\"size-input\" pInputText type=\"text\" formControlName=\"invoiceNumber\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"invoiceSerie\">{{'yms.int.wms_invoice_serie' | translate}}</label>\n <input id=\"invoiceSerie\" class=\"size-input\" pInputText type=\"text\" formControlName=\"invoiceSerie\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"partnerDocument\">{{'yms.int.wms_partner_document' | translate}}</label>\n <input id=\"partnerDocument\" class=\"size-input\" pInputText type=\"text\" formControlName=\"partnerDocument\">\n </div>\n <div class=\"separator\"></div>\n <div class=\"spacing-top\">\n <s-button pButton label=\"{{'yms.int.wms_search' | translate}}\" (click)=\"add()\"></s-button>\n <s-button\n type=\"button\"\n class=\"ui-button-link\"\n pButton label=\"{{'cancel' | translate}}\"\n (click)=\"cancel()\">\n </s-button>\n </div>\n </s-loading-state>\n </p-dialog>\n\n</form>\n",
3893
+ styles: [".spacing-top{margin-top:10px}.spacing-bottom{margin-bottom:10px}.separator{width:100%;margin:5px 0;height:1px;background-color:#ccc}.size-input{width:480px}.error-message{color:#c13018;display:flex}"]
3858
3894
  }),
3859
3895
  __metadata("design:paramtypes", [FormBuilder,
3860
3896
  DocumentService,
@@ -12907,7 +12943,7 @@ var RecebimentoFormComponent = /** @class */ (function () {
12907
12943
  return name + " eq '" + value + "'";
12908
12944
  })
12909
12945
  .join(" or ");
12910
- filterQuery = "(" + filterQuery + ")" + (!!filterQuery ? ' and ' : "") + "situacao eq 'ATIVO' and fornecedor eq true";
12946
+ filterQuery = "(" + filterQuery + ")" + (!!filterQuery ? ' and ' : "") + "(situacao eq 'ATIVO' or precadastro eq true) and fornecedor eq true";
12911
12947
  var displayFields = mergeUnique(this.fornecedorLookupDisplayFields, this.fornecedorAdvancedDisplayFields);
12912
12948
  this.pessoaService
12913
12949
  .list({ sort: sort, filterQuery: filterQuery, displayFields: displayFields })
@@ -12952,7 +12988,7 @@ var RecebimentoFormComponent = /** @class */ (function () {
12952
12988
  return name + " eq '" + value + "'";
12953
12989
  })
12954
12990
  .join(" and ");
12955
- filterQuery = filterQuery.concat((!!filterQuery ? ' and ' : "") + "situacao eq 'ATIVO' and fornecedor eq true");
12991
+ filterQuery = filterQuery.concat((!!filterQuery ? ' and ' : "") + "(situacao eq 'ATIVO' or precadastro eq true) and fornecedor eq true");
12956
12992
  var displayFields = mergeUnique(this.fornecedorLookupDisplayFields, this.fornecedorAdvancedDisplayFields);
12957
12993
  this.pessoaService
12958
12994
  .list({ page: page, sort: sort, filterQuery: filterQuery, displayFields: displayFields })
@@ -13931,7 +13967,11 @@ var RecebimentoFormComponent = /** @class */ (function () {
13931
13967
  return false;
13932
13968
  }
13933
13969
  return true;
13934
- }), mergeMap(function (value) { return _this.pessoaEnderecoService.list({ size: 10, page: 0, filterQuery: "situacao eq 'ATIVO' and pessoa.id eq '" + value.id + "'" })
13970
+ }), mergeMap(function (value) { return _this.pessoaEnderecoService.list({
13971
+ size: 10,
13972
+ page: 0,
13973
+ filterQuery: "(situacao eq 'ATIVO' or pessoa.precadastro eq 'true') and pessoa.id eq '" + value.id + "'"
13974
+ })
13935
13975
  .pipe(takeUntil(_this.ngUnsubscribe)); }))
13936
13976
  .subscribe(function (_a) {
13937
13977
  var contents = _a.contents;