@hitsoft/uretim-yonetimi 1.0.38 → 1.0.39

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.
@@ -126,12 +126,14 @@ class HitHelper {
126
126
  .join('\n');
127
127
  }
128
128
  static parseQR(barkod) {
129
- // Yeni barkod yapısı: (240)itemcode(10)partiNo(17)sonKullanmaTarihi(3103)miktar(21)elTerminalKodu
129
+ // Barkod yapısı: (240)itemcode(10)partiNo(17)skt(91)tartimMiktari(21)elTerminalKodu(92)isEmriNo(93)tartimSiraNo
130
130
  const marker240 = '(240)';
131
131
  const marker10 = '(10)';
132
132
  const marker17 = '(17)';
133
- const marker3103 = '(3103)';
133
+ const marker91 = '(91)';
134
134
  const marker21 = '(21)';
135
+ const marker92 = '(92)';
136
+ const marker93 = '(93)';
135
137
  // 240 ile başlıyor
136
138
  if (!barkod.startsWith(marker240))
137
139
  return null;
@@ -146,17 +148,36 @@ class HitHelper {
146
148
  return null;
147
149
  const lotNo = barkod.substring(pos, idx17);
148
150
  pos = idx17 + marker17.length;
149
- const idx3103 = barkod.indexOf(marker3103, pos);
150
- if (idx3103 === -1)
151
+ const idx91 = barkod.indexOf(marker91, pos);
152
+ if (idx91 === -1)
151
153
  return null;
152
- const expDateRaw = barkod.substring(pos, idx3103);
153
- pos = idx3103 + marker3103.length;
154
+ const expDateRaw = barkod.substring(pos, idx91);
155
+ pos = idx91 + marker91.length;
154
156
  const idx21 = barkod.indexOf(marker21, pos);
155
157
  if (idx21 === -1)
156
158
  return null;
157
159
  const weightRaw = barkod.substring(pos, idx21);
158
160
  pos = idx21 + marker21.length;
159
- const terminalCode = barkod.substring(pos);
161
+ // (92) ve (93) opsiyonel — yoksa boş string
162
+ const idx92 = barkod.indexOf(marker92, pos);
163
+ let terminalCode;
164
+ let workOrderNo = '';
165
+ let weighingSequenceNo = '';
166
+ if (idx92 !== -1) {
167
+ terminalCode = barkod.substring(pos, idx92);
168
+ pos = idx92 + marker92.length;
169
+ const idx93 = barkod.indexOf(marker93, pos);
170
+ if (idx93 !== -1) {
171
+ workOrderNo = barkod.substring(pos, idx93);
172
+ weighingSequenceNo = barkod.substring(idx93 + marker93.length);
173
+ }
174
+ else {
175
+ workOrderNo = barkod.substring(pos);
176
+ }
177
+ }
178
+ else {
179
+ terminalCode = barkod.substring(pos);
180
+ }
160
181
  // Tarihi formatla: YYMMDD -> YYYY-MM-DD
161
182
  let expirationDate = '';
162
183
  if (/^\d{6}$/.test(expDateRaw)) {
@@ -165,18 +186,22 @@ class HitHelper {
165
186
  else {
166
187
  expirationDate = expDateRaw;
167
188
  }
168
- const weight = parseInt(weightRaw, 10);
169
- return new Hammadde(itemCode, lotNo, expirationDate, weight, terminalCode);
189
+ // Ham değer / 1.000.000 = gerçek gram değeri (son 6 hane ondalık)
190
+ const weightRawInt = parseInt(weightRaw, 10);
191
+ const weightGr = isNaN(weightRawInt) ? 0 : weightRawInt / 1000000;
192
+ return new Hammadde(itemCode, lotNo, expirationDate, weightGr, terminalCode, workOrderNo, weighingSequenceNo);
170
193
  }
171
194
  }
172
195
  class Hammadde {
173
- constructor(chemicalCode, lotNumber, expirationDate, weight, terminalCode) {
196
+ constructor(chemicalCode, lotNumber, expirationDate, weightGr, terminalCode, workOrderNo = '', weighingSequenceNo = '') {
174
197
  this.chemicalCode = chemicalCode;
175
198
  this.lotNumber = lotNumber;
176
199
  this.expirationDate = expirationDate;
177
- this.weightGr = weight; // Gram cinsinden
178
- this.weightKg = weight ? weight / 1000 : 0; // Kilogram cinsine dönüştürülmüş hali
200
+ this.weightGr = weightGr;
201
+ this.weightKg = weightGr ? weightGr / 1000 : 0;
179
202
  this.terminalCode = terminalCode;
203
+ this.workOrderNo = workOrderNo;
204
+ this.weighingSequenceNo = weighingSequenceNo;
180
205
  }
181
206
  }
182
207
 
@@ -887,6 +912,7 @@ class HitIssuesForProductionsComponent {
887
912
  this.isEmriBarkoduGecerliMi = false;
888
913
  this.searcheBasildiMi = false;
889
914
  this.hammaddeQR = '';
915
+ this.scannedBarcodeKeys = new Set();
890
916
  this.warehouses = [];
891
917
  this.HitHelper = HitHelper;
892
918
  }
@@ -966,6 +992,21 @@ class HitIssuesForProductionsComponent {
966
992
  });
967
993
  return;
968
994
  }
995
+ // Mükerrer barkod kontrolü: aynı iş emri + tartım sıra no kombinasyonu tekrar okutulamaz
996
+ if (parsed.workOrderNo && parsed.weighingSequenceNo) {
997
+ const barcodeKey = `${parsed.workOrderNo}_${parsed.weighingSequenceNo}`;
998
+ if (this.scannedBarcodeKeys.has(barcodeKey)) {
999
+ this.confirmation.error('', 'Aynı barkod tekrar okutulamaz!', this.options).subscribe({
1000
+ next: () => {
1001
+ this.hammaddeQR = '';
1002
+ this.focusQRInput();
1003
+ }
1004
+ });
1005
+ this.isLoading = false;
1006
+ return;
1007
+ }
1008
+ this.scannedBarcodeKeys.add(barcodeKey);
1009
+ }
969
1010
  this.service.get(parsed.chemicalCode, this.productionOrder.absoluteEntry.toString()).subscribe({
970
1011
  next: (response) => {
971
1012
  if (response.isSuccessful) {
@@ -1057,6 +1098,7 @@ class HitIssuesForProductionsComponent {
1057
1098
  this.productionOrder = null;
1058
1099
  this.focusBarkodInput();
1059
1100
  this.unitOfMeasure = null;
1101
+ this.scannedBarcodeKeys.clear();
1060
1102
  }
1061
1103
  getWarehouses() {
1062
1104
  this.isLoading = true;
@@ -1521,6 +1563,7 @@ class HitFillingControlComponent {
1521
1563
  this.qrCode = '';
1522
1564
  this.lines = [];
1523
1565
  this.isDataLoadedFromDb = false; // DB'den veri mi geldi yoksa yeni mi
1566
+ this.scannedBarcodeKeys = new Set();
1524
1567
  }
1525
1568
  ngOnInit() {
1526
1569
  // Initialization logic
@@ -1595,6 +1638,21 @@ class HitFillingControlComponent {
1595
1638
  this.focusQRInput();
1596
1639
  return;
1597
1640
  }
1641
+ // Mükerrer barkod kontrolü: aynı iş emri + tartım sıra no kombinasyonu tekrar okutulamaz
1642
+ if (parsed.workOrderNo && parsed.weighingSequenceNo) {
1643
+ const barcodeKey = `${parsed.workOrderNo}_${parsed.weighingSequenceNo}`;
1644
+ if (this.scannedBarcodeKeys.has(barcodeKey)) {
1645
+ this.confirmation.error('', 'Aynı barkod tekrar okutulamaz!', {
1646
+ hideYesBtn: true,
1647
+ cancelText: 'Kapat',
1648
+ dismissible: false,
1649
+ });
1650
+ this.qrCode = '';
1651
+ this.focusQRInput();
1652
+ return;
1653
+ }
1654
+ this.scannedBarcodeKeys.add(barcodeKey);
1655
+ }
1598
1656
  // Grid'de bu item'ı bul
1599
1657
  const line = this.lines.find(x => x.itemCode === parsed.chemicalCode);
1600
1658
  if (!line) {
@@ -1767,6 +1825,7 @@ class HitFillingControlComponent {
1767
1825
  this.lines = [];
1768
1826
  this.isDataLoadedFromDb = false;
1769
1827
  this.isSaving = false;
1828
+ this.scannedBarcodeKeys.clear();
1770
1829
  this.focusOnIsEmriNo();
1771
1830
  }
1772
1831
  get showKazanDegisimiButton() {
@@ -1811,6 +1870,7 @@ class HitFillingControlComponent {
1811
1870
  // Grid'i refresh et
1812
1871
  this.dataGrid.instance.refresh();
1813
1872
  this.isDataLoadedFromDb = false; // Artık yeni veri girilecek
1873
+ this.scannedBarcodeKeys.clear(); // Yeni kazan için okutulmuş barkodları sıfırla
1814
1874
  // QR input'a focus et
1815
1875
  this.focusOnQrCode();
1816
1876
  }