Merge pull request 'changed pattern for process order wire master' (#599) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #599
This commit was merged in pull request #599.
This commit is contained in:
2026-05-15 06:01:32 +00:00

View File

@@ -3,6 +3,7 @@
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
use App\Filament\Resources\WireMasterPackingResource;
use App\Models\CustomerPoMaster;
use App\Models\Item;
use App\Models\Plant;
use App\Models\WireMasterPacking;
@@ -81,7 +82,8 @@ class CreateWireMasterPacking extends CreateRecord
return;
}
$pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
// $pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
$pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
if (!preg_match($pattern, $processOrder, $matches))
{
@@ -182,6 +184,60 @@ class CreateWireMasterPacking extends CreateRecord
]);
return;
}
$customerPoRecord = CustomerPoMaster::where('id', $customerPo)
->where('plant_id', $plantId)
->first();
$customerPoName = $customerPoRecord->customer_po;
if ($customerPoRecord) {
$customerPoName = $customerPoRecord->customer_po;
} else {
$customerPoName = null;
}
if(!$customerPoRecord)
{
Notification::make()
->title("PO Not Found")
->body("Customer PO '$customerPoName' for Item '$materialCode' not found against Plant '$plantcode'")
->danger()
->duration(5000)
->send();
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
if($weight > $customerPoRecord->quantity)
{
Notification::make()
->title("Scanned Weight Exceeds PO Quantity")
->body("Scanned weight '$weight' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPo' and Item '$materialCode'")
->danger()
->duration(5000)
->send();
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
try
{
$existingPallet = WireMasterPacking::where('plant_id', $plantId)