Added logic for sfg cycle count in cycle count page #467
@@ -69,13 +69,6 @@ class CycleCount extends Page
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->required(),
|
||||
// Select::make('type')
|
||||
// ->label('Type')
|
||||
// ->reactive()
|
||||
// ->options([
|
||||
// '0' => 'FG',
|
||||
// '1' => 'SFG',
|
||||
// ]),
|
||||
TextInput::make('location')
|
||||
->label('Location')
|
||||
->reactive()
|
||||
@@ -87,7 +80,9 @@ class CycleCount extends Page
|
||||
TextInput::make('bin')
|
||||
->label('Bin')
|
||||
->readOnly(fn (callable $get) => ! $get('plant_id') || ! $get('location'))
|
||||
->reactive(),
|
||||
->reactive()
|
||||
->required()
|
||||
->rules(['min:6']),
|
||||
TextInput::make('qr_code')
|
||||
->label('QR Code')
|
||||
->reactive()
|
||||
@@ -329,6 +324,27 @@ class CycleCount extends Page
|
||||
|
||||
if(!$locationExist){
|
||||
|
||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($existingInOtherLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Location')
|
||||
->body("Location '$location' not found for the type SFG.")
|
||||
@@ -366,6 +382,27 @@ class CycleCount extends Page
|
||||
|
||||
if(!$locationAgaPlant){
|
||||
|
||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($existingInOtherLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Location')
|
||||
->body("Location '$location' not found for the type SFG against plant code '$plantCode'.")
|
||||
@@ -404,6 +441,27 @@ class CycleCount extends Page
|
||||
|
||||
if(!$locationItemAgaPlant){
|
||||
|
||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($existingInOtherLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Item Not Found in Location')
|
||||
->body("Item Code '$this->itemCode' is not available in location '$location' (Type: SFG) for Plant Code '$plantCode'.")
|
||||
@@ -436,6 +494,27 @@ class CycleCount extends Page
|
||||
|
||||
if ($locationItemAgaPlant->batch != $this->batch) {
|
||||
|
||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($existingInOtherLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Batch Mismatch')
|
||||
->body("Location '$location' exists for item code '$this->itemCode', but it belongs to batch '{$locationItemAgaPlant->batch}'.")
|
||||
@@ -468,6 +547,27 @@ class CycleCount extends Page
|
||||
|
||||
if ($locationItemAgaPlant->doc_no != $this->docNo) {
|
||||
|
||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($existingInOtherLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Document Mismatch')
|
||||
->body("Location '$location' exists for item code '$this->itemCode', but it belongs to document number '{$locationItemAgaPlant->doc_no}'.")
|
||||
@@ -549,6 +649,7 @@ class CycleCount extends Page
|
||||
|
||||
$stock->update([
|
||||
'bin' => $bin,
|
||||
'batch' => $this->batch,
|
||||
'scanned_quantity' => $newScannedQty,
|
||||
'scanned_status' => $status
|
||||
]);
|
||||
@@ -757,43 +858,171 @@ class CycleCount extends Page
|
||||
|
||||
$stickerMasterId = $stickerExists->id;
|
||||
|
||||
$quanExist = StockDataMaster::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
$locationExist = StockDataMaster::where('location', $location)
|
||||
->where('type', '1')
|
||||
->first();
|
||||
|
||||
if(!$locationExist){
|
||||
|
||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($existingInOtherLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Location')
|
||||
->body("location '$location' not found in stock data master for the type SFG")
|
||||
->danger()
|
||||
->actions([
|
||||
\Filament\Notifications\Actions\Action::make('confirm')
|
||||
->label('Yes, Update')
|
||||
->button()
|
||||
->dispatch('confirmSerialUpdate', [
|
||||
'plantId' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'serial_number' => $this->sNo,
|
||||
'stickerMasterId' => $stickerMasterId,
|
||||
'batch' => $this->batch,
|
||||
'docNo' => $this->docNo,
|
||||
'quantity' => $this->quantity
|
||||
]),
|
||||
])
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$locationAgaPlant = StockDataMaster::where('plant_id', $plantId)
|
||||
->where('location', $location)
|
||||
->where('type', '1')
|
||||
->first();
|
||||
|
||||
if($quanExist->quantity == '' || $quanExist->quantity == null){
|
||||
Notification::make()
|
||||
->warning()
|
||||
->title('Unknown Quantity')
|
||||
->body("Quantity is missing for serial number '$this->sNo' (Type: SFG) in Plant Code '$plantCode'. Please update it in Stock Data Master.")
|
||||
->seconds(3)
|
||||
->send();
|
||||
if(!$locationAgaPlant){
|
||||
|
||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($existingInOtherLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Location')
|
||||
->body("location '$location' not found in stock data master for the type SFG against plant code '$plantCode'.")
|
||||
->danger()
|
||||
->actions([
|
||||
\Filament\Notifications\Actions\Action::make('confirm')
|
||||
->label('Yes, Update')
|
||||
->button()
|
||||
->dispatch('confirmSerialUpdate', [
|
||||
'plantId' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'serial_number' => $this->sNo,
|
||||
'stickerMasterId' => $stickerMasterId,
|
||||
'batch' => $this->batch,
|
||||
'docNo' => $this->docNo,
|
||||
'quantity' => $this->quantity
|
||||
]),
|
||||
])
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
elseif ((int) $quanExist->quantity > 1) {
|
||||
|
||||
if($bin == '' || $bin == null){
|
||||
Notification::make()
|
||||
->warning()
|
||||
->title('Invalid Quantity')
|
||||
->body("Quantity should be '1' against '$this->sNo' for the type SFG against plant code '$plantCode'!Please update quantity in stock data master.")
|
||||
->seconds(3)
|
||||
->title('Unknown Bin')
|
||||
->body("Bin can't be empty!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$serialExist = StockDataMaster::where('serial_number', $this->sNo)->where('type', '1')->first();
|
||||
|
||||
if(!$serialExist){
|
||||
|
||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($existingInOtherLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Serial Number')
|
||||
->body('Scanned serial number not found in stock data master for the type SFG')
|
||||
->danger()
|
||||
->actions([
|
||||
\Filament\Notifications\Actions\Action::make('confirm_update')
|
||||
\Filament\Notifications\Actions\Action::make('confirm')
|
||||
->label('Yes, Update')
|
||||
->button()
|
||||
->dispatch('confirmSerialUpdate', [
|
||||
@@ -823,6 +1052,27 @@ class CycleCount extends Page
|
||||
|
||||
if(!$serialAgaPlant){
|
||||
|
||||
$sNoExist = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($sNoExist) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Serial Number')
|
||||
->body("Scanned serial number not found in stock data master for the type SFG against plant code '$plantCode'")
|
||||
@@ -856,6 +1106,27 @@ class CycleCount extends Page
|
||||
|
||||
if ($serialAgaPlant->location != $location) {
|
||||
|
||||
$sNoExistLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($sNoExistLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Invalid Location')
|
||||
->body("Serial number '$this->sNo' does not belong to location '$location' for the type SFG against plant code '$plantCode'.")
|
||||
@@ -889,6 +1160,27 @@ class CycleCount extends Page
|
||||
|
||||
if ($serialAgaPlant->sticker_master_id != $stickerMasterId) {
|
||||
|
||||
$sNoExistLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($sNoExistLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Invalid Item Code')
|
||||
->body("Serial number '$this->sNo' does not belong to item code '$this->itemCode' for the type SFG against plant code '$plantCode'.")
|
||||
@@ -923,6 +1215,28 @@ class CycleCount extends Page
|
||||
if ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null) {
|
||||
|
||||
if($serialAgaPlant->batch != $this->batch){
|
||||
|
||||
$sNoExistLocation = NotInStock::where('plant_id', $plantId)
|
||||
->where('serial_number', $this->sNo)
|
||||
->first();
|
||||
|
||||
if ($sNoExistLocation) {
|
||||
Notification::make()
|
||||
->title('Serial Number : Not In Stock')
|
||||
->body("Serial number '{$this->sNo}' already exists against plant code '$plantCode' in not in stock table.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Invalid Batch')
|
||||
->body("Serial number '$this->sNo' does not belong to batch '$this->batch' for the type SFG against plant code '$plantCode'.")
|
||||
@@ -1003,26 +1317,40 @@ class CycleCount extends Page
|
||||
->where('type', '1')
|
||||
->first();
|
||||
|
||||
// if($serial->quantity == '' || $serial->quantity == null){
|
||||
// Notification::make()
|
||||
// ->warning()
|
||||
// ->title('Unknown Quantity')
|
||||
// ->body("Quantity is missing for serial number '$this->sNo' (Type: SFG) in Plant Code '$plantCode'. Please update it in Stock Data Master.")
|
||||
// ->seconds(3)
|
||||
// ->send();
|
||||
if($serial->quantity == '' || $serial->quantity == null){
|
||||
Notification::make()
|
||||
->warning()
|
||||
->title('Unknown Quantity')
|
||||
->body("Quantity is missing for serial number '$this->sNo' (Type: SFG) in Plant Code '$plantCode'. Please update it in Stock Data Master.")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
// return;
|
||||
// }
|
||||
// elseif ((int) $serial->quantity > 1) {
|
||||
// Notification::make()
|
||||
// ->warning()
|
||||
// ->title('Invalid Quantity')
|
||||
// ->body("Quantity should be '1' against '$this->sNo' for the type SFG against plant code '$plantCode'!Please update quantity in stock data master.")
|
||||
// ->seconds(3)
|
||||
// ->send();
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
// return;
|
||||
// }
|
||||
return;
|
||||
}
|
||||
elseif ((int) $serial->quantity > 1) {
|
||||
Notification::make()
|
||||
->warning()
|
||||
->title('Invalid Quantity')
|
||||
->body("Quantity should be '1' against '$this->sNo' for the type SFG against plant code '$plantCode'!Please update quantity in stock data master.")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($serial) {
|
||||
|
||||
@@ -1034,6 +1362,13 @@ class CycleCount extends Page
|
||||
->body("Already completed the scanning process Serial number '$this->sNo' for the type SFG against plant code '$plantCode'.")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1047,6 +1382,13 @@ class CycleCount extends Page
|
||||
'updated_by' => $operatorName
|
||||
]);
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
|
||||
$this->dispatch('refreshSfgNonData', location: $location, plantId: $plantId, serialNumber: $this->sNo, itemCode: $this->itemCode);
|
||||
}
|
||||
}
|
||||
@@ -1105,8 +1447,61 @@ class CycleCount extends Page
|
||||
return;
|
||||
}
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
|
||||
if ($plant) {
|
||||
$plantCode = $plant->code;
|
||||
} else {
|
||||
$plantCode = null;
|
||||
}
|
||||
|
||||
$item = Item::where('plant_id', $plantId)
|
||||
->where('code', $itemCode)
|
||||
->first();
|
||||
|
||||
if(!$item){
|
||||
Notification::make()
|
||||
->title('Invalid Item Code')
|
||||
->body("Item code '$this->itemCode' not found for the type FG against plant code '$plantCode'.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$itemId = $item->id;
|
||||
|
||||
$stickerMaster = StickerMaster::where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if(!$stickerMaster){
|
||||
Notification::make()
|
||||
->title('Invalid Item Code')
|
||||
->body("Item code '$this->itemCode' not found in sticker master for the type FG against plant code '$plantCode'.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$stickerMasterId = $stickerMaster->id;
|
||||
|
||||
$record = StockDataMaster::where('serial_number', $serialNumber)
|
||||
->where('plant_id', $plantId)
|
||||
->where('type', '0')
|
||||
->whereHas('stickerMasterRelation.item', function ($query) use ($itemCode, $plantId) {
|
||||
$query->where('plant_id', $plantId)
|
||||
->where('code', $itemCode);
|
||||
@@ -1114,19 +1509,37 @@ class CycleCount extends Page
|
||||
->first();
|
||||
|
||||
if (! $record) {
|
||||
$this->serialNumber = $serialNumber;
|
||||
$this->itemCode = $itemCode;
|
||||
$this->plantId = $plantId;
|
||||
$this->location = $location;
|
||||
$this->bin = $bin;
|
||||
$message = "serial number not found '$serialNumber' for the type FG against item code '$itemCode' and plant code '$plantCode'";
|
||||
Notification::make()
|
||||
->title('Invalid Item Code')
|
||||
->body($message)
|
||||
->danger()
|
||||
->actions([
|
||||
\Filament\Notifications\Actions\Action::make('confirm_update')
|
||||
->label('Yes, Update')
|
||||
->button()
|
||||
->dispatch('confirmSerialFGUpdate', [
|
||||
'plantId' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'serial_number' => $this->sNo,
|
||||
'stickerMasterId' => $stickerMasterId,
|
||||
]),
|
||||
])
|
||||
->send();
|
||||
|
||||
$this->mountAction('confirmAddToNotInStock');
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'qr_code' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($record->scanned_status == 'Scanned'){
|
||||
|
||||
Notification::make()
|
||||
Notification::make()
|
||||
->title('Duplicate: Item Code')
|
||||
->body("Item code '$itemCode' and serial number '$serialNumber' have already been scanned and exist in the Stock Data Master.")
|
||||
->danger()
|
||||
|
||||
@@ -52,7 +52,7 @@ class StockDataTable extends Component
|
||||
|
||||
public bool $isSfg = false;
|
||||
|
||||
public $itemCode, $serialNumber;
|
||||
public $itemCode, $serialNumber, $serial_number;
|
||||
|
||||
public $scannedSfgData = [];
|
||||
|
||||
@@ -64,6 +64,8 @@ class StockDataTable extends Component
|
||||
'refreshSfgData' => 'loadSfgData',
|
||||
'refreshSfgNonData' => 'loadSfgNonQuanData',
|
||||
'confirmStockUpdate',
|
||||
'confirmSerialUpdate',
|
||||
'confirmSerialFGUpdate'
|
||||
];
|
||||
|
||||
public $capacitorInput = '';
|
||||
@@ -80,6 +82,8 @@ class StockDataTable extends Component
|
||||
|
||||
public $stickerMasterId;
|
||||
|
||||
public $sNo;
|
||||
|
||||
public function confirmStockUpdate($plantId, $location, $bin, $stickerMasterId, $batch, $docNo, $quantity)
|
||||
{
|
||||
|
||||
@@ -124,13 +128,54 @@ class StockDataTable extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function confirmSerialUpdate($plantId, $location, $bin, $sNo, $stickerMasterId, $batch, $docNo, $quantity)
|
||||
public function confirmSerialUpdate($plantId, $location, $bin, $serial_number, $stickerMasterId, $batch, $docNo, $quantity)
|
||||
{
|
||||
$sNo = $serial_number;
|
||||
$record = NotInStock::where('plant_id', $plantId)
|
||||
->where('location', $location)
|
||||
->where('sticker_master_id', $stickerMasterId)
|
||||
->where('serial_number', $sNo)
|
||||
->where('bin', $bin)
|
||||
->first();
|
||||
|
||||
if (!$record) {
|
||||
|
||||
NotInStock::create([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'sticker_master_id' => $stickerMasterId,
|
||||
'type' => '1',
|
||||
'serial_number' => $sNo ?? null,
|
||||
'batch' => $batch ?? null,
|
||||
'doc_no' => $docNo ?? null,
|
||||
'scanned_quantity' => $quantity ?? '1',
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record inserted successfully in not in stock table.')
|
||||
->success()
|
||||
->send();
|
||||
|
||||
} else {
|
||||
|
||||
$record->update([
|
||||
'batch' => $batch ?? null,
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record updated in not in stock table.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
|
||||
public function confirmSerialFGUpdate($plantId, $location, $bin, $sNo, $stickerMasterId)
|
||||
{
|
||||
|
||||
$record = NotInStock::where('plant_id', $plantId)
|
||||
->where('location', $location)
|
||||
->where('sticker_master_id', $stickerMasterId)
|
||||
->where('doc_no', $docNo)
|
||||
->where('bin', $bin)
|
||||
->first();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user