@hitsoft/uretim-yonetimi 1.0.11 → 1.0.12

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 (140) hide show
  1. package/.eslintrc.json +44 -0
  2. package/README.md +24 -24
  3. package/config/ng-package.json +7 -0
  4. package/config/src/enums/route-names.ts +3 -0
  5. package/config/src/providers/create-barcode-route.provider.ts +21 -0
  6. package/config/src/providers/issues-for-production-route.provider.ts +21 -0
  7. package/config/src/providers/production-order-route.provider.ts +21 -0
  8. package/config/src/providers/receipt-from-production-route.provider.ts +21 -0
  9. package/config/src/providers/route.provider.ts +26 -0
  10. package/config/src/uretim-yonetimi-config.module.ts +22 -0
  11. package/karma.conf.js +44 -0
  12. package/ng-package.json +7 -0
  13. package/package.json +14 -42
  14. package/src/lib/components/hit-create-barcodes/hit-create-barcodes-component.css +10 -0
  15. package/src/lib/components/hit-create-barcodes/hit-create-barcodes-routing.module.ts +19 -0
  16. package/src/lib/components/hit-create-barcodes/hit-create-barcodes.component.html +80 -0
  17. package/src/lib/components/hit-create-barcodes/hit-create-barcodes.component.ts +219 -0
  18. package/src/lib/components/hit-create-barcodes/hit-create-barcodes.module.ts +39 -0
  19. package/src/lib/components/hit-issues-for-productions/hit-issues-for-productions-routing.module.ts +19 -0
  20. package/src/lib/components/hit-issues-for-productions/hit-issues-for-productions.componenet.css +7 -0
  21. package/src/lib/components/hit-issues-for-productions/hit-issues-for-productions.component.html +96 -0
  22. package/src/lib/components/hit-issues-for-productions/hit-issues-for-productions.component.ts +274 -0
  23. package/src/lib/components/hit-issues-for-productions/hit-issues-for-productions.module.ts +46 -0
  24. package/src/lib/components/hit-production-orders/hit-production-orders-routing.module.ts +19 -0
  25. package/src/lib/components/hit-production-orders/hit-production-orders.component.html +79 -0
  26. package/src/lib/components/hit-production-orders/hit-production-orders.component.ts +214 -0
  27. package/src/lib/components/hit-production-orders/hit-production-orders.module.ts +39 -0
  28. package/src/lib/components/hit-receipt-from-productions/hit-receipt-from-production-component.css +10 -0
  29. package/src/lib/components/hit-receipt-from-productions/hit-receipt-from-production-routing.module.ts +19 -0
  30. package/src/lib/components/hit-receipt-from-productions/hit-receipt-from-productions.component.html +101 -0
  31. package/src/lib/components/hit-receipt-from-productions/hit-receipt-from-productions.component.ts +258 -0
  32. package/src/lib/components/hit-receipt-from-productions/hit-receipt-from-productions.module.ts +38 -0
  33. package/src/lib/components/uretim-yonetimi.component.ts +9 -0
  34. package/src/lib/hit-proxy/devexpress-query-builder/devexpress-load-options.model.ts +20 -0
  35. package/src/lib/hit-proxy/devexpress-query-builder/devexpress-query-builder.ts +51 -0
  36. package/src/lib/hit-proxy/hit-create-barcodes/hit-create-barcodes.service.ts +41 -0
  37. package/src/lib/hit-proxy/hit-create-barcodes/models.ts +6 -0
  38. package/src/lib/hit-proxy/hit-issues-for-productions/hit-issues-for-productions.service.ts +39 -0
  39. package/src/lib/hit-proxy/hit-issues-for-productions/models.ts +42 -0
  40. package/src/lib/hit-proxy/hit-production-orders/hit-production-orders.service.ts +60 -0
  41. package/src/lib/hit-proxy/hit-production-orders/models.ts +137 -0
  42. package/src/lib/hit-proxy/hit-receipt-from-productions/hit-receipt-from-productions.service.ts +32 -0
  43. package/src/lib/hit-proxy/hit-receipt-from-productions/models.ts +43 -0
  44. package/src/lib/hit-proxy/models.ts +105 -0
  45. package/src/lib/uretim-yonetimi-routing.module.ts +30 -0
  46. package/src/lib/uretim-yonetimi.component.spec.ts +24 -0
  47. package/src/lib/uretim-yonetimi.module.ts +52 -0
  48. package/src/lib/uretim-yonetimi.service.spec.ts +15 -0
  49. package/{public-api.d.ts → src/public-api.ts} +4 -0
  50. package/src/test.ts +29 -0
  51. package/tsconfig.lib.json +20 -0
  52. package/tsconfig.lib.prod.json +10 -0
  53. package/tsconfig.spec.json +17 -0
  54. package/config/enums/route-names.d.ts +0 -3
  55. package/config/index.d.ts +0 -5
  56. package/config/providers/create-barcode-route.provider.d.ts +0 -9
  57. package/config/providers/issues-for-production-route.provider.d.ts +0 -9
  58. package/config/providers/production-order-route.provider.d.ts +0 -9
  59. package/config/providers/receipt-from-production-route.provider.d.ts +0 -9
  60. package/config/providers/route.provider.d.ts +0 -8
  61. package/config/uretim-yonetimi-config.module.d.ts +0 -8
  62. package/esm2020/config/enums/index.mjs +0 -2
  63. package/esm2020/config/enums/route-names.mjs +0 -2
  64. package/esm2020/config/hitsoft-uretim-yonetimi-config.mjs +0 -5
  65. package/esm2020/config/providers/create-barcode-route.provider.mjs +0 -19
  66. package/esm2020/config/providers/index.mjs +0 -2
  67. package/esm2020/config/providers/issues-for-production-route.provider.mjs +0 -19
  68. package/esm2020/config/providers/production-order-route.provider.mjs +0 -19
  69. package/esm2020/config/providers/receipt-from-production-route.provider.mjs +0 -19
  70. package/esm2020/config/providers/route.provider.mjs +0 -24
  71. package/esm2020/config/public-api.mjs +0 -4
  72. package/esm2020/config/uretim-yonetimi-config.module.mjs +0 -28
  73. package/esm2020/hitsoft-uretim-yonetimi.mjs +0 -5
  74. package/esm2020/lib/components/hit-create-barcodes/hit-create-barcodes-routing.module.mjs +0 -26
  75. package/esm2020/lib/components/hit-create-barcodes/hit-create-barcodes.component.mjs +0 -186
  76. package/esm2020/lib/components/hit-create-barcodes/hit-create-barcodes.module.mjs +0 -65
  77. package/esm2020/lib/components/hit-issues-for-productions/hit-issues-for-productions-routing.module.mjs +0 -26
  78. package/esm2020/lib/components/hit-issues-for-productions/hit-issues-for-productions.component.mjs +0 -250
  79. package/esm2020/lib/components/hit-issues-for-productions/hit-issues-for-productions.module.mjs +0 -68
  80. package/esm2020/lib/components/hit-production-orders/hit-production-orders-routing.module.mjs +0 -26
  81. package/esm2020/lib/components/hit-production-orders/hit-production-orders.component.mjs +0 -152
  82. package/esm2020/lib/components/hit-production-orders/hit-production-orders.module.mjs +0 -65
  83. package/esm2020/lib/components/hit-receipt-from-productions/hit-receipt-from-production-routing.module.mjs +0 -26
  84. package/esm2020/lib/components/hit-receipt-from-productions/hit-receipt-from-productions.component.mjs +0 -215
  85. package/esm2020/lib/components/hit-receipt-from-productions/hit-receipt-from-productions.module.mjs +0 -62
  86. package/esm2020/lib/components/uretim-yonetimi.component.mjs +0 -11
  87. package/esm2020/lib/hit-proxy/devexpress-query-builder/devexpress-load-options.model.mjs +0 -2
  88. package/esm2020/lib/hit-proxy/devexpress-query-builder/devexpress-query-builder.mjs +0 -54
  89. package/esm2020/lib/hit-proxy/hit-create-barcodes/hit-create-barcodes.service.mjs +0 -35
  90. package/esm2020/lib/hit-proxy/hit-create-barcodes/models.mjs +0 -3
  91. package/esm2020/lib/hit-proxy/hit-issues-for-productions/hit-issues-for-productions.service.mjs +0 -35
  92. package/esm2020/lib/hit-proxy/hit-issues-for-productions/models.mjs +0 -24
  93. package/esm2020/lib/hit-proxy/hit-production-orders/hit-production-orders.service.mjs +0 -44
  94. package/esm2020/lib/hit-proxy/hit-production-orders/models.mjs +0 -65
  95. package/esm2020/lib/hit-proxy/hit-receipt-from-productions/hit-receipt-from-productions.service.mjs +0 -30
  96. package/esm2020/lib/hit-proxy/hit-receipt-from-productions/models.mjs +0 -20
  97. package/esm2020/lib/hit-proxy/models.mjs +0 -81
  98. package/esm2020/lib/services/uretim-yonetimi.service.mjs +0 -18
  99. package/esm2020/lib/uretim-yonetimi-routing.module.mjs +0 -33
  100. package/esm2020/lib/uretim-yonetimi.module.mjs +0 -55
  101. package/esm2020/public-api.mjs +0 -6
  102. package/fesm2015/hitsoft-uretim-yonetimi-config.mjs +0 -121
  103. package/fesm2015/hitsoft-uretim-yonetimi-config.mjs.map +0 -1
  104. package/fesm2015/hitsoft-uretim-yonetimi.mjs +0 -1539
  105. package/fesm2015/hitsoft-uretim-yonetimi.mjs.map +0 -1
  106. package/fesm2020/hitsoft-uretim-yonetimi-config.mjs +0 -121
  107. package/fesm2020/hitsoft-uretim-yonetimi-config.mjs.map +0 -1
  108. package/fesm2020/hitsoft-uretim-yonetimi.mjs +0 -1517
  109. package/fesm2020/hitsoft-uretim-yonetimi.mjs.map +0 -1
  110. package/index.d.ts +0 -5
  111. package/lib/components/hit-create-barcodes/hit-create-barcodes-routing.module.d.ts +0 -7
  112. package/lib/components/hit-create-barcodes/hit-create-barcodes.component.d.ts +0 -45
  113. package/lib/components/hit-create-barcodes/hit-create-barcodes.module.d.ts +0 -16
  114. package/lib/components/hit-issues-for-productions/hit-issues-for-productions-routing.module.d.ts +0 -7
  115. package/lib/components/hit-issues-for-productions/hit-issues-for-productions.component.d.ts +0 -48
  116. package/lib/components/hit-issues-for-productions/hit-issues-for-productions.module.d.ts +0 -16
  117. package/lib/components/hit-production-orders/hit-production-orders-routing.module.d.ts +0 -7
  118. package/lib/components/hit-production-orders/hit-production-orders.component.d.ts +0 -44
  119. package/lib/components/hit-production-orders/hit-production-orders.module.d.ts +0 -16
  120. package/lib/components/hit-receipt-from-productions/hit-receipt-from-production-routing.module.d.ts +0 -7
  121. package/lib/components/hit-receipt-from-productions/hit-receipt-from-productions.component.d.ts +0 -57
  122. package/lib/components/hit-receipt-from-productions/hit-receipt-from-productions.module.d.ts +0 -16
  123. package/lib/components/uretim-yonetimi.component.d.ts +0 -5
  124. package/lib/hit-proxy/devexpress-query-builder/devexpress-load-options.model.d.ts +0 -17
  125. package/lib/hit-proxy/devexpress-query-builder/devexpress-query-builder.d.ts +0 -18
  126. package/lib/hit-proxy/hit-create-barcodes/hit-create-barcodes.service.d.ts +0 -23
  127. package/lib/hit-proxy/hit-create-barcodes/models.d.ts +0 -6
  128. package/lib/hit-proxy/hit-issues-for-productions/hit-issues-for-productions.service.d.ts +0 -17
  129. package/lib/hit-proxy/hit-issues-for-productions/models.d.ts +0 -30
  130. package/lib/hit-proxy/hit-production-orders/hit-production-orders.service.d.ts +0 -19
  131. package/lib/hit-proxy/hit-production-orders/models.d.ts +0 -85
  132. package/lib/hit-proxy/hit-receipt-from-productions/hit-receipt-from-productions.service.d.ts +0 -16
  133. package/lib/hit-proxy/hit-receipt-from-productions/models.d.ts +0 -39
  134. package/lib/hit-proxy/models.d.ts +0 -21
  135. package/lib/services/uretim-yonetimi.service.d.ts +0 -9
  136. package/lib/uretim-yonetimi-routing.module.d.ts +0 -7
  137. package/lib/uretim-yonetimi.module.d.ts +0 -17
  138. /package/config/{enums/index.d.ts → src/enums/index.ts} +0 -0
  139. /package/config/{providers/index.d.ts → src/providers/index.ts} +0 -0
  140. /package/config/{public-api.d.ts → src/public-api.ts} +0 -0
@@ -0,0 +1,219 @@
1
+ import {ListService, TrackByService} from '@abp/ng.core';
2
+ import {
3
+ Confirmation,
4
+ ConfirmationService,
5
+ } from '@abp/ng.theme.shared';
6
+ import {DateAdapter} from '@abp/ng.theme.shared/extensions';
7
+ import {ChangeDetectionStrategy, Component, ViewChild, NgZone} from '@angular/core';
8
+ import {NgbDateAdapter} from '@ng-bootstrap/ng-bootstrap';
9
+ import {HitCreateBarcodesService} from '../../hit-proxy/hit-create-barcodes/hit-create-barcodes.service';
10
+ import {HitProductionOrdersService} from '../../hit-proxy/hit-production-orders/hit-production-orders.service';
11
+ import {DxDataGridComponent, DxTextBoxComponent} from 'devextreme-angular';
12
+ import {GetProductionOrderDto} from '../../hit-proxy/hit-receipt-from-productions/models';
13
+ import {ReceiptFromProductions} from '../../hit-proxy/hit-create-barcodes/models';
14
+ import {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';
15
+
16
+ @Component({
17
+ selector: 'lib-hit-create-barcodes',
18
+ changeDetection: ChangeDetectionStrategy.Default,
19
+ providers: [ListService, { provide: NgbDateAdapter, useClass: DateAdapter }],
20
+ templateUrl: './hit-create-barcodes.component.html',
21
+ styles: [],
22
+ styleUrls: ['./hit-create-barcodes-component.css'],
23
+ })
24
+ export class HitCreateBarcodesComponent {
25
+ @ViewChild('barkodNumarasiRef', {static: false}) nmbBoxBarkodNumarasi: DxTextBoxComponent;
26
+ @ViewChild('gridRFP', {static: false}) dataGrid: DxDataGridComponent;
27
+
28
+
29
+ constructor(
30
+ private ngZone: NgZone,
31
+ public readonly list: ListService,
32
+ public readonly track: TrackByService,
33
+ public readonly service: HitCreateBarcodesService,
34
+ private confirmation: ConfirmationService,
35
+ private productionOrdersService: HitProductionOrdersService,
36
+ private sanitizer: DomSanitizer
37
+ ) {}
38
+
39
+ isLoading: boolean = false;
40
+ isEmriBarkoduGecerliMi: boolean = false;
41
+ searchBasildiMi: boolean = false;
42
+ isEmriBarkodu: number;
43
+ productionOrder: GetProductionOrderDto;
44
+ printingQuantity: number = 1;
45
+ showModal: boolean = false;
46
+ pdfSrc: SafeResourceUrl | null = null;
47
+ blobUrl: string;
48
+
49
+ async getProductionOrder() {
50
+ if (!this.isEmriBarkodu) {
51
+ return;
52
+ }
53
+
54
+ this.isLoading = true;
55
+ this.isEmriBarkoduGecerliMi = false;
56
+ this.searchBasildiMi = true;
57
+
58
+ this.productionOrdersService.get(this.isEmriBarkodu).subscribe({
59
+ next: response => {
60
+ if (response?.isSuccessful) {
61
+ this.productionOrder = response.items;
62
+ this.isEmriBarkoduGecerliMi = true;
63
+ this.getReceiptFromProductions();
64
+ } else {
65
+ this.isEmriBarkoduGecerliMi = false;
66
+ }
67
+ },
68
+ error: e => {
69
+ this.isEmriBarkoduGecerliMi = false;
70
+ this.searchBasildiMi = true;
71
+ this.confirmation.status$.subscribe({
72
+ next: () => {
73
+ this.clearAll();
74
+ },
75
+ });
76
+ },
77
+ });
78
+ this.isLoading = false;
79
+ }
80
+
81
+ ngAfterViewInit() {
82
+ this.focusOnBarkodNumarasi();
83
+ }
84
+
85
+ clearAll() {
86
+ this.isEmriBarkoduGecerliMi = false;
87
+ this.searchBasildiMi = false;
88
+ this.isEmriBarkodu = null;
89
+ this.productionOrder = null;
90
+ this.receiptFromProductions = null;
91
+ this.focusOnBarkodNumarasi();
92
+ }
93
+
94
+ generateReport() {
95
+ this.service
96
+ .getBarcodeInfo(
97
+ this.isEmriBarkodu,
98
+ this.selectedReceiptFromProductions.docEntry,
99
+ this.printingQuantity
100
+ )
101
+ .subscribe({
102
+ next: response => {
103
+ const base64Data = response.base64; // base64 string (sadece veri kısmı, "data:application/pdf;base64,..." değilse)
104
+
105
+ // Base64'ü decode edip binary veriye çeviriyoruz
106
+ const byteCharacters = atob(base64Data);
107
+ const byteNumbers = new Array(byteCharacters.length);
108
+ for (let i = 0; i < byteCharacters.length; i++) {
109
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
110
+ }
111
+ const byteArray = new Uint8Array(byteNumbers);
112
+
113
+ // Blob oluşturuyoruz
114
+ const blob = new Blob([byteArray], { type: 'application/pdf' });
115
+
116
+ // Blob'tan URL oluşturup yeni sekmede açıyoruz (veya download edebilirsin)
117
+ this.blobUrl = URL.createObjectURL(blob);
118
+ this.pdfSrc = this.bypassAndSanitize(this.blobUrl);
119
+ },
120
+ });
121
+ }
122
+
123
+ bypassAndSanitize(url): SafeResourceUrl {
124
+ return this.sanitizer.bypassSecurityTrustResourceUrl(url);
125
+ }
126
+
127
+ downloadPdf(blobUrl) {
128
+ const a = document.createElement('a');
129
+ a.href = blobUrl;
130
+ const parts = blobUrl.split('/');
131
+ const lastPart = parts.pop(); // "myfile.pdf"
132
+ a.download = lastPart + '.pdf'; // Kaydedilecek dosya adı
133
+ a.style.display = 'none';
134
+
135
+ // iOS'ta desteklenmesi için target=_blank eklenebilir
136
+ a.target = '_blank';
137
+
138
+ // DOM'a ekleyip tıklat
139
+ document.body.appendChild(a);
140
+ a.click();
141
+ document.body.removeChild(a);
142
+ }
143
+
144
+ receiptFromProductions: ReceiptFromProductions[];
145
+
146
+ async getReceiptFromProductions() {
147
+ if (!this.isEmriBarkodu) {
148
+ return;
149
+ }
150
+
151
+ this.isLoading = true;
152
+
153
+ this.service.getReceiptFromProductions(this.isEmriBarkodu + '').subscribe({
154
+ next: response => {
155
+ if (response?.isSuccessful) {
156
+ this.receiptFromProductions = response.items;
157
+ this.receiptFromProductions.forEach((item: ReceiptFromProductions) => {
158
+ item.docDateString = this.formatDate(item.docDate);
159
+ });
160
+
161
+ setTimeout(() => {
162
+ if (this.receiptFromProductions?.length === 1) {
163
+ const key = this.receiptFromProductions[0];
164
+ this.dataGrid.instance.selectRows([key], false);
165
+ }
166
+ });
167
+ } else {
168
+ this.confirmation.status$.subscribe({
169
+ next: () => {
170
+ this.clearAll();
171
+ },
172
+ });
173
+ }
174
+ },
175
+ error: e => {
176
+ this.confirmation.status$.subscribe({
177
+ next: () => {
178
+ this.clearAll();
179
+ },
180
+ });
181
+ },
182
+ });
183
+
184
+ this.isLoading = false;
185
+ }
186
+
187
+ selectedReceiptFromProductions: ReceiptFromProductions;
188
+
189
+ selectReceiptFromProductions(e) {
190
+ e.component.byKey(e.currentSelectedRowKeys[0]).done(receiptFromProductions => {
191
+ if (receiptFromProductions) {
192
+ this.selectedReceiptFromProductions = receiptFromProductions;
193
+ }
194
+ });
195
+ }
196
+
197
+ formatDate(date: Date): string {
198
+ if (!date) return '';
199
+
200
+ const pad = (n: number) => n.toString().padStart(2, '0');
201
+ const d = new Date(date);
202
+
203
+ const day = pad(d.getDate());
204
+ const month = pad(d.getMonth() + 1); // Aylar 0-indexli
205
+ const year = d.getFullYear();
206
+ const hour = pad(d.getHours());
207
+ const minute = pad(d.getMinutes());
208
+
209
+ return `${day}/${month}/${year} ${hour}:${minute}`;
210
+ }
211
+
212
+ focusOnBarkodNumarasi() {
213
+ this.ngZone.run(() => {
214
+ setTimeout(() => {
215
+ this.nmbBoxBarkodNumarasi.instance.focus();
216
+ }, 0);
217
+ });
218
+ }
219
+ }
@@ -0,0 +1,39 @@
1
+ import {CoreModule} from '@abp/ng.core';
2
+ import {ThemeSharedModule} from '@abp/ng.theme.shared';
3
+ import {NgModule} from '@angular/core';
4
+ import {
5
+ NgbCollapseModule,
6
+ NgbDatepickerModule,
7
+ NgbDropdownModule,
8
+ } from '@ng-bootstrap/ng-bootstrap';
9
+ import {NgxValidateCoreModule} from '@ngx-validate/core';
10
+ import {CommercialUiModule} from '@volo/abp.commercial.ng.ui';
11
+ import {PageModule} from '@abp/ng.components/page';
12
+ import {HitCreateBarcodesComponent} from "./hit-create-barcodes.component";
13
+ import {HitCreateBarcodesRoutingModule} from "./hit-create-barcodes-routing.module";
14
+ import {DxButtonModule, DxDataGridModule, DxNumberBoxModule, DxTextBoxModule} from "devextreme-angular";
15
+
16
+ @NgModule({
17
+ declarations: [HitCreateBarcodesComponent],
18
+ imports: [
19
+ HitCreateBarcodesRoutingModule,
20
+ CoreModule,
21
+ ThemeSharedModule,
22
+ CommercialUiModule,
23
+ NgxValidateCoreModule,
24
+ NgbCollapseModule,
25
+ NgbDatepickerModule,
26
+ NgbDropdownModule,
27
+ PageModule,
28
+ DxButtonModule,
29
+ DxNumberBoxModule,
30
+ DxTextBoxModule,
31
+ DxDataGridModule,
32
+ ],
33
+ })
34
+ export class HitCreateBarcodesModule {
35
+ }
36
+
37
+ export function loadHitCreateBarcodesAsChild() {
38
+ return Promise.resolve(HitCreateBarcodesModule);
39
+ }
@@ -0,0 +1,19 @@
1
+ import {AuthGuard, PermissionGuard} from '@abp/ng.core';
2
+ import {NgModule} from '@angular/core';
3
+ import {RouterModule, Routes} from '@angular/router';
4
+ import {HitIssuesForProductionsComponent} from "./hit-issues-for-productions.component";
5
+
6
+ const routes: Routes = [
7
+ {
8
+ path: '',
9
+ component: HitIssuesForProductionsComponent,
10
+ canActivate: [AuthGuard, PermissionGuard],
11
+ },
12
+ ];
13
+
14
+ @NgModule({
15
+ imports: [RouterModule.forChild(routes)],
16
+ exports: [RouterModule],
17
+ })
18
+ export class HitIssuesForProductionsRoutingModule {
19
+ }
@@ -0,0 +1,7 @@
1
+ ::ng-deep .hit-green-row {
2
+ background-color: #daf5dc !important;
3
+ }
4
+
5
+ ::ng-deep .hit-grey-row {
6
+ background-color: #80808070 !important;
7
+ }
@@ -0,0 +1,96 @@
1
+ <abp-page [breadcrumb]="false">
2
+ <abp-page-toolbar-container class="col">
3
+ <div class="row">
4
+ <h3 class="page-title">
5
+ {{ 'UretimYonetimi::IssuesForProductions.Title' | abpLocalization }}
6
+ </h3>
7
+ </div>
8
+ <div class="row text-lg-end pt-2">
9
+ <div class="col-8">
10
+ <button class="btn btn-success btn-sm" type="button" (click)="postIssuesForProduction()"
11
+ [disabled]="!isEmriBarkoduGecerliMi">
12
+ <i class="fa fa-plus me-1"></i>
13
+ {{ 'UretimYonetimi::IssuesForProductions.Create' | abpLocalization }}
14
+ </button>
15
+ </div>
16
+ <div class="col-4">
17
+ <button class="btn btn-warning btn-sm" type="button" (click)="clearAll()">
18
+ <i class="fa fa-broom me-1"></i>
19
+ {{ 'UretimYonetimi::IssuesForProductions.Clean' | abpLocalization }}
20
+ </button>
21
+ </div>
22
+ </div>
23
+ </abp-page-toolbar-container>
24
+ <div class="card mt-2">
25
+ <div class="card-body">
26
+ <div style="display: flex; align-items: center;">
27
+ <dx-number-box #barkodNumarasiRef class="me-1" style="width:100%;"
28
+ [label]="'UretimYonetimi::IssuesForProductions.WorkOrderNo' | abpLocalization" [(value)]="isEmriBarkodu"
29
+ (onChange)="getProductionOrder()" (onEnterKey)="getProductionOrder()" [disabled]="searcheBasildiMi || isEmriBarkoduGecerliMi">
30
+ </dx-number-box>
31
+ <dx-button style="margin-top: 7.5px;" icon="search" type="default" (onClick)="getProductionOrder()"
32
+ [disabled]="searcheBasildiMi || isEmriBarkoduGecerliMi">
33
+ </dx-button>
34
+ </div>
35
+ <div class="mt-3" *ngIf="isEmriBarkoduGecerliMi">
36
+ <dx-text-box style="width:100%;"
37
+ [label]="'UretimYonetimi::IssuesForProductions.WorkOrderName' | abpLocalization"
38
+ [(value)]="productionOrder.productDescription" [disabled]="true">
39
+ </dx-text-box>
40
+ <dx-number-box style="width:100%;" [label]="'UretimYonetimi::IssuesForProductions.PlannedQty' | abpLocalization"
41
+ [(value)]="productionOrder.plannedQuantity" [disabled]="true"
42
+ [format]="HitHelper.getMeasurementFormatted(unitOfMeasure)">
43
+ </dx-number-box>
44
+
45
+ <div style="display: flex; align-items: center;">
46
+ <dx-text-box #hammaddeQRRef style="width:100%;" class="me-1"
47
+ [label]="'UretimYonetimi::IssuesForProductions.IssueQRCode' | abpLocalization" [maxLength]="256"
48
+ [(value)]="hammaddeQR" (onEnterKey)="parseAndAddQR()"
49
+ [placeholder]="'UretimYonetimi::IssuesForProductions.IssueQRCode.Placeholder' | abpLocalization">
50
+ </dx-text-box>
51
+ <dx-button style="margin-top: 7.5px;" icon="plus" type="default" (onClick)="parseAndAddQR()">
52
+ </dx-button>
53
+ </div>
54
+
55
+ <div *ngIf="productionOrder.getProductionOrderLine?.length" class="mt-3">
56
+ <dx-data-grid #getProductionOrderLineGrid [dataSource]="productionOrder.getProductionOrderLine"
57
+ [showBorders]="true" [columnAutoWidth]="true" [sorting]="{ mode: 'none' }"
58
+ (onRowPrepared)="onRowPrepared($event)">
59
+ <dxi-column dataField="itemName"
60
+ caption="{{'UretimYonetimi::IssuesForProductions.ItemName' | abpLocalization}}"></dxi-column>
61
+ <dxi-column cellTemplate="templateQty"
62
+ caption="{{ 'UretimYonetimi::IssuesForProductions.Quantity' | abpLocalization }}"
63
+ dataType="number"></dxi-column>
64
+ <dxi-column cellTemplate="templatePlannedQty"
65
+ caption="{{'UretimYonetimi::IssuesForProductions.PlannedQty' | abpLocalization}}"
66
+ dataType="number"></dxi-column>
67
+ <dxi-column cellTemplate="templateIssuedQty"
68
+ caption="{{'UretimYonetimi::IssuesForProductions.CompletedQty' | abpLocalization}}"
69
+ dataType="number"></dxi-column>
70
+ <dxi-column dataField="itemCode"
71
+ caption="{{'UretimYonetimi::IssuesForProductions.ItemCode' | abpLocalization}}"
72
+ [width]="150"></dxi-column>
73
+ <dxi-column dataField="batchNumber"
74
+ caption="{{'UretimYonetimi::IssuesForProductions.BatchNumber' | abpLocalization}}"
75
+ [width]="120"></dxi-column>
76
+ <dxi-column dataField="warehouse"
77
+ caption="{{'UretimYonetimi::IssuesForProductions.Warehouse' | abpLocalization}}" [width]="120">
78
+
79
+ <dxo-lookup [dataSource]="warehouses" displayExpr="whsName" valueExpr="whsCode">
80
+ </dxo-lookup>
81
+ </dxi-column>
82
+ <div *dxTemplate="let data of 'templateQty'">
83
+ {{ HitHelper.getMeasurementFormattedWithLocalization(data.key.quantity, data.key.unitOfMeasurement) }}
84
+ </div>
85
+ <div *dxTemplate="let data of 'templatePlannedQty'">
86
+ {{ HitHelper.getMeasurementFormattedWithLocalization(data.key.plannedQty, data.key.unitOfMeasurement) }}
87
+ </div>
88
+ <div *dxTemplate="let data of 'templateIssuedQty'">
89
+ {{ HitHelper.getMeasurementFormattedWithLocalization(data.key.issuedQty, data.key.unitOfMeasurement) }}
90
+ </div>
91
+ </dx-data-grid>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ </abp-page>
@@ -0,0 +1,274 @@
1
+ import {ABP, ListService, PagedResultDto, TrackByService} from '@abp/ng.core';
2
+ import {Confirmation, ConfirmationService} from '@abp/ng.theme.shared';
3
+ import {DateAdapter} from '@abp/ng.theme.shared/extensions';
4
+ import {AfterViewInit, ChangeDetectionStrategy, Component, OnInit, ViewChild, NgZone} from '@angular/core';
5
+ import {FormBuilder} from '@angular/forms';
6
+ import {NgbDateAdapter} from '@ng-bootstrap/ng-bootstrap';
7
+ import {
8
+ HitIssuesForProductionsService
9
+ } from "../../hit-proxy/hit-issues-for-productions/hit-issues-for-productions.service";
10
+ import {HitProductionOrdersService} from "../../hit-proxy/hit-production-orders/hit-production-orders.service";
11
+ import {
12
+ BatchNumber,
13
+ IssueLine,
14
+ IssuesForProductionPostDto
15
+ } from "../../hit-proxy/hit-issues-for-productions/models";
16
+ import {GetProductionOrderDto} from "../../hit-proxy/hit-receipt-from-productions/models";
17
+ import {DxDataGridComponent, DxTextBoxComponent} from "devextreme-angular";
18
+ import {Warehouse} from "../../hit-proxy/hit-production-orders/models";
19
+ import {HitHelper} from "../../hit-proxy/models";
20
+
21
+ @Component({
22
+ selector: 'lib-hit-issues-for-productions',
23
+ changeDetection: ChangeDetectionStrategy.Default,
24
+ providers: [ListService, {provide: NgbDateAdapter, useClass: DateAdapter}],
25
+ templateUrl: './hit-issues-for-productions.component.html',
26
+ styleUrls: ['./hit-issues-for-productions.componenet.css'],
27
+ })
28
+ export class HitIssuesForProductionsComponent implements OnInit, AfterViewInit {
29
+ @ViewChild('barkodNumarasiRef', {static: false}) nmbBoxBarkodNumarasi: DxTextBoxComponent;
30
+ @ViewChild('hammaddeQRRef', {static: false}) nmbBoxHammaddeQR: DxTextBoxComponent;
31
+ @ViewChild('getProductionOrderLineGrid', {static: false}) dataGrid: DxDataGridComponent;
32
+
33
+ options: Partial<Confirmation.Options> = {
34
+ hideYesBtn: true,
35
+ cancelText: 'Kapat',
36
+ dismissible: false,
37
+ };
38
+
39
+ constructor(
40
+ private ngZone: NgZone,
41
+ public readonly list: ListService,
42
+ public readonly track: TrackByService,
43
+ public readonly service: HitIssuesForProductionsService,
44
+ private confirmation: ConfirmationService,
45
+ private fb: FormBuilder,
46
+ private productionOrdersService: HitProductionOrdersService,
47
+ ) {
48
+ }
49
+
50
+ ngAfterViewInit() {
51
+ this.focusBarkodInput();
52
+ }
53
+
54
+ ngOnInit(): void {
55
+ this.clearAll();
56
+ this.getWarehouses();
57
+ }
58
+
59
+ isLoading: boolean = false;
60
+ isEmriBarkoduGecerliMi: boolean = false;
61
+ searcheBasildiMi: boolean = false;
62
+ isEmriBarkodu: number;
63
+ hammaddeQR: string = '';
64
+ productionOrder: GetProductionOrderDto;
65
+ issuesForProductionPost: IssuesForProductionPostDto;
66
+ unitOfMeasure: string;
67
+
68
+ async getProductionOrder() {
69
+ if (!this.isEmriBarkodu) {
70
+ this.focusBarkodInput();
71
+ return;
72
+ }
73
+
74
+ this.isLoading = true;
75
+ this.isEmriBarkoduGecerliMi = false;
76
+ this.searcheBasildiMi = true;
77
+
78
+ this.productionOrdersService.get(this.isEmriBarkodu).subscribe({
79
+ next: (response) => {
80
+ if (response.isSuccessful) {
81
+ this.productionOrder = response.items;
82
+ this.isEmriBarkoduGecerliMi = true;
83
+ this.unitOfMeasure = response.items.unitOfMeasurement;
84
+
85
+ const issueLines: IssueLine[] = this.productionOrder.getProductionOrderLine.map((issueLine) => {
86
+ issueLine.quantity = 0;
87
+ const newIssueLine = new IssueLine();
88
+ newIssueLine.ItemCode = issueLine.itemCode;
89
+ newIssueLine.BaseLine = issueLine.lineNum;
90
+ newIssueLine.WarehouseCode = issueLine.warehouse;
91
+ newIssueLine.BaseEntry = issueLine.absoluteEntry;
92
+ newIssueLine.BatchNumbers = [new BatchNumber(issueLine.batchNumber, issueLine.plannedQty)];
93
+ return newIssueLine;
94
+ });
95
+ this.issuesForProductionPost = new IssuesForProductionPostDto(issueLines);
96
+
97
+ this.ngZone.run(() => {
98
+ setTimeout(() => {
99
+ this.nmbBoxHammaddeQR.instance.focus();
100
+ }, 0);
101
+ });
102
+ } else {
103
+ this.isEmriBarkoduGecerliMi = false;
104
+ this.searcheBasildiMi = false;
105
+ }
106
+ },
107
+ error: (e) => {
108
+ this.isLoading = false;
109
+ this.isEmriBarkoduGecerliMi = false;
110
+ this.searcheBasildiMi = false;
111
+ this.confirmation.status$.subscribe({
112
+ next: () => {
113
+ this.clearAll();
114
+ }
115
+ });
116
+ this.focusBarkodInput();
117
+ }
118
+ });
119
+
120
+ this.isLoading = false;
121
+ }
122
+
123
+ async parseAndAddQR() {
124
+ if (!this.hammaddeQR) {
125
+ this.focusQRInput();
126
+ return;
127
+ }
128
+ this.isLoading = true;
129
+
130
+ const parsed = HitHelper.parseQR(this.hammaddeQR);
131
+ if (!parsed){
132
+ this.confirmation.error('', 'Geçersiz barkod!', this.options).subscribe({
133
+ next: () => {
134
+ this.hammaddeQR = '';
135
+ this.focusQRInput();
136
+ }
137
+ });
138
+ return;
139
+ }
140
+
141
+ this.service.get(parsed.chemicalCode, this.productionOrder.absoluteEntry.toString()).subscribe({
142
+ next: (response) => {
143
+ if (response.isSuccessful) {
144
+ const issueLine = this.productionOrder.getProductionOrderLine.find((x) => x.itemCode === parsed.chemicalCode);
145
+ if(issueLine == null){
146
+ this.confirmation.error('', "Bu iş emrinde " + parsed.chemicalCode + " kodlu stok bulunmuyor. ", this.options);
147
+ }
148
+ const issueLineForPost = this.issuesForProductionPost.DocumentLines.find((x) => x.ItemCode === parsed.chemicalCode);
149
+ if (issueLine) {
150
+ if (issueLine.issuedQty + issueLine.quantity + parsed.weightKg > issueLine.plannedQty + (issueLine.plannedQty * 0.02)) {
151
+ this.confirmation.error('', 'Toplanan miktar planlanan miktarı aşıyor!', this.options);
152
+ return;
153
+ }
154
+ issueLine.quantity += parsed.weightKg;
155
+ issueLine.batchNumber = parsed.lotNumber;
156
+ issueLineForPost.Quantity += parsed.weightKg;
157
+
158
+ if (issueLineForPost.IsQRReady) {
159
+ issueLineForPost.BatchNumbers.push(new BatchNumber(parsed.lotNumber, parsed.weightKg));
160
+ } else {
161
+
162
+ issueLineForPost.BatchNumbers = [new BatchNumber(parsed.lotNumber, parsed.weightKg)];
163
+ issueLineForPost.IsQRReady = true;
164
+ }
165
+ }
166
+ }
167
+ },
168
+ error: (e) => {
169
+ this.confirmation.status$.subscribe({
170
+ next: () => {
171
+ this.focusQRInput();
172
+ this.hammaddeQR = '';
173
+ this.isLoading = false;
174
+ }
175
+ });
176
+ },
177
+ complete: () => {
178
+ this.focusQRInput();
179
+ this.hammaddeQR = '';
180
+ this.isLoading = false;
181
+ }
182
+ });
183
+ }
184
+
185
+ async postIssuesForProduction() {
186
+ if (!this.issuesForProductionPost) {
187
+ this.focusBarkodInput();
188
+ return;
189
+ }
190
+ this.isLoading = true;
191
+ this.issuesForProductionPost.DocumentLines.forEach((x) => {
192
+ x.BaseEntry = this.productionOrder.absoluteEntry;
193
+ });
194
+ this.issuesForProductionPost.DocumentLines = this.issuesForProductionPost.DocumentLines.filter((x) => x.IsQRReady);
195
+
196
+ this.service.post(this.issuesForProductionPost).subscribe({
197
+ next: (response) => {
198
+ if (response.isSuccessful) {
199
+ this.confirmation.success('', 'İşlem başarılı!', this.options).subscribe(() => {
200
+ this.clearAll();
201
+ });
202
+ } else {
203
+ this.confirmation.status$.subscribe({
204
+ next: () => {
205
+ this.focusQRInput();
206
+ }
207
+ });
208
+ }
209
+ },
210
+ error: (e) => {
211
+ this.confirmation.status$.subscribe({
212
+ next: () => {
213
+ this.focusQRInput();
214
+ }
215
+ });
216
+ }
217
+ });
218
+
219
+ this.isLoading = false;
220
+ }
221
+
222
+ clearAll() {
223
+ this.isEmriBarkoduGecerliMi = false;
224
+ this.searcheBasildiMi = false;
225
+ this.issuesForProductionPost = null;
226
+ this.isEmriBarkodu = null;
227
+ this.hammaddeQR = '';
228
+ this.productionOrder = null;
229
+ this.focusBarkodInput();
230
+ this.unitOfMeasure = null;
231
+ }
232
+
233
+ warehouses: Warehouse[] = [];
234
+
235
+ getWarehouses() {
236
+ this.isLoading = true;
237
+ this.productionOrdersService.getWarehouses().subscribe({
238
+ next: (result) => {
239
+ if (result.items) {
240
+ this.warehouses = result.items.slice();
241
+ }
242
+ }
243
+ });
244
+ this.isLoading = false;
245
+ }
246
+
247
+ protected readonly HitHelper = HitHelper;
248
+
249
+ onRowPrepared(e: any): void {
250
+ if (e.rowType === 'data') {
251
+ if (e.data.plannedQty <= e.data.issuedQty) {
252
+ e.rowElement.classList.add('hit-grey-row');
253
+ } else if (e.data.quantity > 0) {
254
+ e.rowElement.classList.add('hit-green-row');
255
+ }
256
+ }
257
+ }
258
+
259
+ focusQRInput() {
260
+ this.ngZone.run(() => {
261
+ setTimeout(() => {
262
+ this.nmbBoxHammaddeQR.instance.focus();
263
+ }, 0);
264
+ });
265
+ }
266
+
267
+ focusBarkodInput() {
268
+ this.ngZone.run(() => {
269
+ setTimeout(() => {
270
+ this.nmbBoxBarkodNumarasi.instance.focus();
271
+ }, 0);
272
+ });
273
+ }
274
+ }