@fluxhub/fluxhub-lib 1.0.234 → 1.0.236

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.
@@ -2681,9 +2681,8 @@ class FHUploadComponent {
2681
2681
  * @return {?}
2682
2682
  */
2683
2683
  ngOnInit() {
2684
- console.log('INIT');
2685
2684
  /** @type {?} */
2686
- var uo = {};
2685
+ let uo = {};
2687
2686
  uo.headers = [{ name: 'Authorization', value: 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token") }];
2688
2687
  this.uploader.setOptions(uo);
2689
2688
  this.uploader.onCompleteAll = () => {
@@ -3262,6 +3261,8 @@ class FHUploadPanelComponent {
3262
3261
  this.b_False = false;
3263
3262
  this.b_mobile = false;
3264
3263
  this.b_ini = false;
3264
+ this.m_p_tipo = "";
3265
+ this.m_programma_da_eseguire = "";
3265
3266
  }
3266
3267
  /**
3267
3268
  * @param {?} ax
@@ -3319,24 +3320,27 @@ class FHUploadPanelComponent {
3319
3320
  * @return {?}
3320
3321
  */
3321
3322
  ngOnInit() {
3322
- console.log('INIT1');
3323
3323
  this.upc.single = false;
3324
3324
  this.b_mobile = this._appservice.getState().pageFullscreen;
3325
3325
  this
3326
3326
  .upc
3327
- .init(this.App, this.K, 'Descrizione Allegato');
3327
+ .init(this.App, this.K, 'Descrizione Allegato', this.m_p_tipo, this.m_programma_da_eseguire);
3328
3328
  this.ref_allegato();
3329
3329
  }
3330
3330
  /**
3331
3331
  * @param {?} p_app
3332
3332
  * @param {?} p_k
3333
+ * @param {?=} p_tipo
3334
+ * @param {?=} programma_da_eseguire
3333
3335
  * @return {?}
3334
3336
  */
3335
- init(p_app, p_k) {
3337
+ init(p_app, p_k, p_tipo = "", programma_da_eseguire = "") {
3336
3338
  this.App = p_app;
3337
3339
  this.K = p_k;
3338
3340
  this.b_ini = true;
3339
3341
  this.b_edit_loaded = false;
3342
+ this.m_p_tipo = p_tipo;
3343
+ this.m_programma_da_eseguire = programma_da_eseguire;
3340
3344
  this.ngOnInit();
3341
3345
  }
3342
3346
  /**
@@ -11706,53 +11710,90 @@ win_log.propDecorators = {
11706
11710
  * @fileoverview added by tsickle
11707
11711
  * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
11708
11712
  */
11713
+ class OfficeOperation {
11714
+ }
11709
11715
  class OfficeAutomatorService {
11710
11716
  /**
11711
- *
11712
11717
  * @param {?} dataService
11713
11718
  * @param {?} fileService
11714
11719
  * @param {?} toastr
11715
- * @param {?} utility
11716
11720
  */
11717
- constructor(dataService, fileService, toastr, utility) {
11721
+ constructor(dataService, fileService, toastr) {
11718
11722
  this.dataService = dataService;
11719
11723
  this.fileService = fileService;
11720
11724
  this.toastr = toastr;
11721
- this.utility = utility;
11725
+ /**
11726
+ * @param commands
11727
+ * @param options
11728
+ * @export
11729
+ */
11730
+ this.eprog = 0;
11722
11731
  }
11723
11732
  /**
11724
- * @export
11725
- * @param {?} commands
11726
- * @param {?} options
11733
+ * @param {?} operazione
11734
+ * @param {?} v1
11735
+ * @param {?} v2
11736
+ * @param {?} ordine
11727
11737
  * @return {?}
11728
11738
  */
11729
- runCommands(commands, options) {
11730
- /** @type {?} */
11731
- const uiid = this.utility.newGuid();
11732
- // TODO: check order
11733
- // TODO: check id
11734
- // create job in db
11739
+ operation(operazione, v1, v2, ordine) {
11735
11740
  /** @type {?} */
11736
- let q = '';
11737
- for (let i = 0; i < commands.length; i++) {
11738
- if (q != "") {
11739
- q = q + ";;;";
11740
- }
11741
- q = q + (commands[i].id || uiid) + ";;;" + commands[i].op + ";;;" + (commands[i].v1 || ' ') + ";;;" + (commands[i].v2 || ' ') + ";;;" + (commands[i].ord);
11742
- }
11741
+ let op = new OfficeOperation();
11742
+ op.op = operazione;
11743
+ op.v1 = v1;
11744
+ op.v2 = v2;
11745
+ op.ord = ordine;
11746
+ return op;
11747
+ }
11748
+ /**
11749
+ * @private
11750
+ * @param {?=} dialogRef_W
11751
+ * @return {?}
11752
+ */
11753
+ progress_update(dialogRef_W = null) {
11754
+ if (dialogRef_W == null)
11755
+ return;
11756
+ if (dialogRef_W.componentInstance == null)
11757
+ return;
11758
+ if (this.eprog >= 100)
11759
+ return;
11760
+ this.eprog += 10;
11761
+ dialogRef_W.componentInstance.update_progess(this.eprog);
11762
+ setTimeout(() => {
11763
+ this.progress_update(dialogRef_W);
11764
+ }, 2000);
11765
+ }
11766
+ /**
11767
+ * @param {?} uiid
11768
+ * @param {?} commands
11769
+ * @param {?} dialogRef_W
11770
+ * @return {?}
11771
+ */
11772
+ runCommands(uiid, commands, dialogRef_W) {
11773
+ this.eprog = 0;
11743
11774
  /** @type {?} */
11744
11775
  const p = new QParam();
11745
- p.sql = "INSERT_CMD_STAMPA_MULTI";
11746
- p.types = ['string', 'string', 'string', 'string', 'int'];
11747
- p.values = [q];
11776
+ p.sql = "INSERT_OFFICE_OPERATION";
11777
+ p.types = ['string', 'string'];
11778
+ commands.sort((left, right) => {
11779
+ if (left.ord < right.ord)
11780
+ return -1;
11781
+ if (left.ord > right.ord)
11782
+ return 1;
11783
+ });
11784
+ console.log('commands ', commands);
11785
+ p.values = [uiid, JSON.stringify(commands)];
11748
11786
  return this.dataService.doQuery(p).pipe(flatMap(data => {
11749
11787
  if (data != null) {
11750
11788
  if (data.result_msg == "OK") {
11751
- // create job file
11752
11789
  /** @type {?} */
11753
11790
  const p = new FSInput();
11754
- p.command = "wg_create";
11755
- p.p1 = uiid;
11791
+ p.command = "exec_app";
11792
+ p.p1 = "print_manager";
11793
+ p.p2 = uiid;
11794
+ setTimeout(() => {
11795
+ this.progress_update(dialogRef_W);
11796
+ }, 2000);
11756
11797
  return this.fileService.doQuery(p).pipe(flatMap(data => {
11757
11798
  if (data != null && data.result_msg == "OK") {
11758
11799
  // check the job is done
@@ -11764,35 +11805,31 @@ class OfficeAutomatorService {
11764
11805
  /** @type {?} */
11765
11806
  const timeoutTimer = setTimeout(() => {
11766
11807
  isTimeout = true;
11767
- }, options.timeout || 3 * 60 * 1000);
11768
- // 3 min default timeout
11769
- /** @type {?} */
11770
- let logOffset = 0;
11771
- ck_files();
11808
+ }, 3 * 60 * 1000);
11809
+ ck_files(uiid);
11772
11810
  /**
11773
- *
11811
+ * @param {?} uiid
11774
11812
  * @return {?}
11775
11813
  */
11776
- function ck_files() {
11814
+ function ck_files(uiid) {
11777
11815
  /** @type {?} */
11778
- const p = new FSInput();
11779
- p.command = "wg_getlog";
11780
- p.p1 = uiid;
11781
- p.p2 = logOffset.toString();
11782
- self.fileService.doQuery(p).subscribe(data => {
11816
+ const p = new QParam();
11817
+ p.sql = "SELECT_OFFICE_OPERATION_FINISCHED";
11818
+ p.types = ['string'];
11819
+ p.values = [uiid];
11820
+ self.dataService.doQuery(p).subscribe(data => {
11783
11821
  if (data != null && data.result_msg == 'OK') {
11784
11822
  /** @type {?} */
11785
- const chunkInfo = data.result_data[0];
11786
- logOffset += chunkInfo.chunk.length;
11787
- subscriber.next(chunkInfo);
11788
- if (chunkInfo.done) {
11823
+ const chunkInfo = data.result_data;
11824
+ if (chunkInfo.length == 1) {
11825
+ subscriber.next({ message: chunkInfo[0].result_message, result: chunkInfo[0].result });
11789
11826
  subscriber.complete();
11790
11827
  }
11791
11828
  else {
11792
11829
  if (!isTimeout) {
11793
11830
  setTimeout(() => {
11794
- ck_files();
11795
- }, options.checkInterval || 3000); // 3 sec default check interval
11831
+ ck_files(uiid);
11832
+ }, 3000); // 3 sec default check interval
11796
11833
  }
11797
11834
  else {
11798
11835
  console.log('Timeout');
@@ -11802,9 +11839,11 @@ class OfficeAutomatorService {
11802
11839
  }
11803
11840
  }
11804
11841
  else {
11805
- console.error(data);
11806
- subscriber.error(data);
11807
- subscriber.complete();
11842
+ if (!isTimeout) {
11843
+ setTimeout(() => {
11844
+ ck_files(uiid);
11845
+ }, 3000); // 3 sec default check interval
11846
+ }
11808
11847
  }
11809
11848
  });
11810
11849
  }
@@ -11815,29 +11854,6 @@ class OfficeAutomatorService {
11815
11854
  }
11816
11855
  }));
11817
11856
  }
11818
- /**
11819
- * @param {?} fs_path
11820
- * @param {?} web_path
11821
- * @param {?=} error_msg
11822
- * @return {?}
11823
- */
11824
- send_file_to_user(fs_path, web_path, error_msg = 'errore nella creazione del file') {
11825
- /** @type {?} */
11826
- let p = new FSInput();
11827
- p.p1 = fs_path;
11828
- p.command = "check_file";
11829
- this.fileService.doQuery(p).subscribe(data => {
11830
- if (data != null)
11831
- if (data.msg != "N") {
11832
- window.open(web_path);
11833
- }
11834
- else {
11835
- if (error_msg != null)
11836
- if (error_msg != '')
11837
- this.toastr.error(error_msg);
11838
- }
11839
- });
11840
- }
11841
11857
  }
11842
11858
  OfficeAutomatorService.decorators = [
11843
11859
  { type: Injectable, args: [{
@@ -11848,10 +11864,9 @@ OfficeAutomatorService.decorators = [
11848
11864
  OfficeAutomatorService.ctorParameters = () => [
11849
11865
  { type: QueryService },
11850
11866
  { type: FileService },
11851
- { type: ToastrService },
11852
- { type: UtilityService }
11867
+ { type: ToastrService }
11853
11868
  ];
11854
- /** @nocollapse */ OfficeAutomatorService.ngInjectableDef = defineInjectable({ factory: function OfficeAutomatorService_Factory() { return new OfficeAutomatorService(inject(QueryService), inject(FileService), inject(ToastrService), inject(UtilityService)); }, token: OfficeAutomatorService, providedIn: "root" });
11869
+ /** @nocollapse */ OfficeAutomatorService.ngInjectableDef = defineInjectable({ factory: function OfficeAutomatorService_Factory() { return new OfficeAutomatorService(inject(QueryService), inject(FileService), inject(ToastrService)); }, token: OfficeAutomatorService, providedIn: "root" });
11855
11870
 
11856
11871
  /**
11857
11872
  * @fileoverview added by tsickle