@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.
@@ -125,12 +125,14 @@ class HitHelper {
125
125
  .join('\n');
126
126
  }
127
127
  static parseQR(barkod) {
128
- // Yeni barkod yapısı: (240)itemcode(10)partiNo(17)sonKullanmaTarihi(3103)miktar(21)elTerminalKodu
128
+ // Barkod yapısı: (240)itemcode(10)partiNo(17)skt(91)tartimMiktari(21)elTerminalKodu(92)isEmriNo(93)tartimSiraNo
129
129
  const marker240 = '(240)';
130
130
  const marker10 = '(10)';
131
131
  const marker17 = '(17)';
132
- const marker3103 = '(3103)';
132
+ const marker91 = '(91)';
133
133
  const marker21 = '(21)';
134
+ const marker92 = '(92)';
135
+ const marker93 = '(93)';
134
136
  // 240 ile başlıyor
135
137
  if (!barkod.startsWith(marker240))
136
138
  return null;
@@ -145,17 +147,36 @@ class HitHelper {
145
147
  return null;
146
148
  const lotNo = barkod.substring(pos, idx17);
147
149
  pos = idx17 + marker17.length;
148
- const idx3103 = barkod.indexOf(marker3103, pos);
149
- if (idx3103 === -1)
150
+ const idx91 = barkod.indexOf(marker91, pos);
151
+ if (idx91 === -1)
150
152
  return null;
151
- const expDateRaw = barkod.substring(pos, idx3103);
152
- pos = idx3103 + marker3103.length;
153
+ const expDateRaw = barkod.substring(pos, idx91);
154
+ pos = idx91 + marker91.length;
153
155
  const idx21 = barkod.indexOf(marker21, pos);
154
156
  if (idx21 === -1)
155
157
  return null;
156
158
  const weightRaw = barkod.substring(pos, idx21);
157
159
  pos = idx21 + marker21.length;
158
- const terminalCode = barkod.substring(pos);
160
+ // (92) ve (93) opsiyonel — yoksa boş string
161
+ const idx92 = barkod.indexOf(marker92, pos);
162
+ let terminalCode;
163
+ let workOrderNo = '';
164
+ let weighingSequenceNo = '';
165
+ if (idx92 !== -1) {
166
+ terminalCode = barkod.substring(pos, idx92);
167
+ pos = idx92 + marker92.length;
168
+ const idx93 = barkod.indexOf(marker93, pos);
169
+ if (idx93 !== -1) {
170
+ workOrderNo = barkod.substring(pos, idx93);
171
+ weighingSequenceNo = barkod.substring(idx93 + marker93.length);
172
+ }
173
+ else {
174
+ workOrderNo = barkod.substring(pos);
175
+ }
176
+ }
177
+ else {
178
+ terminalCode = barkod.substring(pos);
179
+ }
159
180
  // Tarihi formatla: YYMMDD -> YYYY-MM-DD
160
181
  let expirationDate = '';
161
182
  if (/^\d{6}$/.test(expDateRaw)) {
@@ -164,18 +185,22 @@ class HitHelper {
164
185
  else {
165
186
  expirationDate = expDateRaw;
166
187
  }
167
- const weight = parseInt(weightRaw, 10);
168
- return new Hammadde(itemCode, lotNo, expirationDate, weight, terminalCode);
188
+ // Ham değer / 1.000.000 = gerçek gram değeri (son 6 hane ondalık)
189
+ const weightRawInt = parseInt(weightRaw, 10);
190
+ const weightGr = isNaN(weightRawInt) ? 0 : weightRawInt / 1000000;
191
+ return new Hammadde(itemCode, lotNo, expirationDate, weightGr, terminalCode, workOrderNo, weighingSequenceNo);
169
192
  }
170
193
  }
171
194
  class Hammadde {
172
- constructor(chemicalCode, lotNumber, expirationDate, weight, terminalCode) {
195
+ constructor(chemicalCode, lotNumber, expirationDate, weightGr, terminalCode, workOrderNo = '', weighingSequenceNo = '') {
173
196
  this.chemicalCode = chemicalCode;
174
197
  this.lotNumber = lotNumber;
175
198
  this.expirationDate = expirationDate;
176
- this.weightGr = weight; // Gram cinsinden
177
- this.weightKg = weight ? weight / 1000 : 0; // Kilogram cinsine dönüştürülmüş hali
199
+ this.weightGr = weightGr;
200
+ this.weightKg = weightGr ? weightGr / 1000 : 0;
178
201
  this.terminalCode = terminalCode;
202
+ this.workOrderNo = workOrderNo;
203
+ this.weighingSequenceNo = weighingSequenceNo;
179
204
  }
180
205
  }
181
206
 
@@ -876,6 +901,7 @@ class HitIssuesForProductionsComponent {
876
901
  this.isEmriBarkoduGecerliMi = false;
877
902
  this.searcheBasildiMi = false;
878
903
  this.hammaddeQR = '';
904
+ this.scannedBarcodeKeys = new Set();
879
905
  this.warehouses = [];
880
906
  this.HitHelper = HitHelper;
881
907
  }
@@ -952,6 +978,21 @@ class HitIssuesForProductionsComponent {
952
978
  });
953
979
  return;
954
980
  }
981
+ // Mükerrer barkod kontrolü: aynı iş emri + tartım sıra no kombinasyonu tekrar okutulamaz
982
+ if (parsed.workOrderNo && parsed.weighingSequenceNo) {
983
+ const barcodeKey = `${parsed.workOrderNo}_${parsed.weighingSequenceNo}`;
984
+ if (this.scannedBarcodeKeys.has(barcodeKey)) {
985
+ this.confirmation.error('', 'Aynı barkod tekrar okutulamaz!', this.options).subscribe({
986
+ next: () => {
987
+ this.hammaddeQR = '';
988
+ this.focusQRInput();
989
+ }
990
+ });
991
+ this.isLoading = false;
992
+ return;
993
+ }
994
+ this.scannedBarcodeKeys.add(barcodeKey);
995
+ }
955
996
  this.service.get(parsed.chemicalCode, this.productionOrder.absoluteEntry.toString()).subscribe({
956
997
  next: (response) => {
957
998
  if (response.isSuccessful) {
@@ -1040,6 +1081,7 @@ class HitIssuesForProductionsComponent {
1040
1081
  this.productionOrder = null;
1041
1082
  this.focusBarkodInput();
1042
1083
  this.unitOfMeasure = null;
1084
+ this.scannedBarcodeKeys.clear();
1043
1085
  }
1044
1086
  getWarehouses() {
1045
1087
  this.isLoading = true;
@@ -1499,6 +1541,7 @@ class HitFillingControlComponent {
1499
1541
  this.qrCode = '';
1500
1542
  this.lines = [];
1501
1543
  this.isDataLoadedFromDb = false; // DB'den veri mi geldi yoksa yeni mi
1544
+ this.scannedBarcodeKeys = new Set();
1502
1545
  }
1503
1546
  ngOnInit() {
1504
1547
  // Initialization logic
@@ -1570,6 +1613,21 @@ class HitFillingControlComponent {
1570
1613
  this.focusQRInput();
1571
1614
  return;
1572
1615
  }
1616
+ // Mükerrer barkod kontrolü: aynı iş emri + tartım sıra no kombinasyonu tekrar okutulamaz
1617
+ if (parsed.workOrderNo && parsed.weighingSequenceNo) {
1618
+ const barcodeKey = `${parsed.workOrderNo}_${parsed.weighingSequenceNo}`;
1619
+ if (this.scannedBarcodeKeys.has(barcodeKey)) {
1620
+ this.confirmation.error('', 'Aynı barkod tekrar okutulamaz!', {
1621
+ hideYesBtn: true,
1622
+ cancelText: 'Kapat',
1623
+ dismissible: false,
1624
+ });
1625
+ this.qrCode = '';
1626
+ this.focusQRInput();
1627
+ return;
1628
+ }
1629
+ this.scannedBarcodeKeys.add(barcodeKey);
1630
+ }
1573
1631
  // Grid'de bu item'ı bul
1574
1632
  const line = this.lines.find(x => x.itemCode === parsed.chemicalCode);
1575
1633
  if (!line) {
@@ -1742,6 +1800,7 @@ class HitFillingControlComponent {
1742
1800
  this.lines = [];
1743
1801
  this.isDataLoadedFromDb = false;
1744
1802
  this.isSaving = false;
1803
+ this.scannedBarcodeKeys.clear();
1745
1804
  this.focusOnIsEmriNo();
1746
1805
  }
1747
1806
  get showKazanDegisimiButton() {
@@ -1786,6 +1845,7 @@ class HitFillingControlComponent {
1786
1845
  // Grid'i refresh et
1787
1846
  this.dataGrid.instance.refresh();
1788
1847
  this.isDataLoadedFromDb = false; // Artık yeni veri girilecek
1848
+ this.scannedBarcodeKeys.clear(); // Yeni kazan için okutulmuş barkodları sıfırla
1789
1849
  // QR input'a focus et
1790
1850
  this.focusOnQrCode();
1791
1851
  }