Merge pull request 'changed pack slip panel logic in panel box validation' (#992) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s
Reviewed-on: #992
This commit was merged in pull request #992.
This commit is contained in:
@@ -1189,16 +1189,28 @@ class PanelBoxValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('/', $state);
|
$parts = explode('/', $state);
|
||||||
|
|
||||||
|
if (count($parts) < 3) {
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid QR Format')
|
||||||
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$extracted = trim(end($parts));
|
$extracted = trim(end($parts));
|
||||||
|
|
||||||
|
$expected = $get('serial_number');
|
||||||
|
|
||||||
if ($extracted == '') {
|
if ($extracted == '') {
|
||||||
$set('packSlipPanelError', "SerialNumber can't be empty!");
|
$set('packSlipPanelError', "SerialNumber can't be empty!");
|
||||||
$set('pack_slip_panel_qr', null);
|
$set('pack_slip_panel_qr', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$expected = $get('serial_number');
|
|
||||||
|
|
||||||
if ($extracted != $expected) {
|
if ($extracted != $expected) {
|
||||||
$set('packSlipPanelError', 'Pack Slip Panel serial does not match.');
|
$set('packSlipPanelError', 'Pack Slip Panel serial does not match.');
|
||||||
$set('pack_slip_panel', null);
|
$set('pack_slip_panel', null);
|
||||||
@@ -1208,13 +1220,13 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('packSlipPanelError', null);
|
$set('packSlipPanelError', null);
|
||||||
$set('pack_slip_panel_qr', $extracted);
|
$set('pack_slip_panel_qr', $extracted);
|
||||||
$set('pack_slip_panel', '1');
|
$set('pack_slip_panel', '1');
|
||||||
$panelParts = array_map('trim', explode('/', $state));
|
$panelParts = explode('/', $state);
|
||||||
|
|
||||||
if (count($panelParts) != 4) {
|
if (count($panelParts) < 3) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
@@ -1223,9 +1235,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
|
|
||||||
$supplier = $panelParts[0];
|
$supplier = $panelParts[0];
|
||||||
$panelBoxCode = $panelParts[1];
|
$panelBoxCode = $panelParts[1];
|
||||||
$yearMonth = $panelParts[2];
|
$panelBoxSerialNo = implode('/', array_slice($panelParts, 2));
|
||||||
$serialNumber = $panelParts[3];
|
|
||||||
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
|
||||||
|
|
||||||
$set('panel_box_supplier', $supplier);
|
$set('panel_box_supplier', $supplier);
|
||||||
$set('panel_box_serial_number', $panelBoxSerialNo);
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
|
|||||||
Reference in New Issue
Block a user