Compare commits
6 Commits
164a1becac
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdc0aed31c | ||
|
|
947aacb074 | ||
|
|
b7b5db068b | ||
|
|
d42ae70e46 | ||
|
|
be2e7b00d7 | ||
|
|
1ce7995105 |
@@ -39,8 +39,6 @@ class ProductionCharacteristicExporter extends Exporter
|
||||
->label('OBSERVED VALUE'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('inspection_status')
|
||||
->label('INSPECTION STATUS'),
|
||||
ExportColumn::make('remark')
|
||||
->label('REMARK'),
|
||||
ExportColumn::make('created_at')
|
||||
|
||||
@@ -128,7 +128,8 @@ class CycleCount extends Page
|
||||
$operatorName = $user->name;
|
||||
|
||||
$pattern1 = '/^[^#]*#[^#]*#[^#]*#[^#]*#$/';
|
||||
$pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
||||
// $pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
||||
$pattern2 = '/^[^|]+\|[^|]+(?:\|[^|]*)?$/';
|
||||
$pattern3 = '/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/';
|
||||
|
||||
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
||||
@@ -678,7 +679,7 @@ class CycleCount extends Page
|
||||
$stock->update([
|
||||
'bin' => $bin,
|
||||
'batch' => $this->batch,
|
||||
// 'doc_no' =>$this->docNo,
|
||||
'doc_no' =>$this->docNo,
|
||||
'scanned_quantity' => $newScannedQty,
|
||||
'scanned_status' => $status,
|
||||
]);
|
||||
@@ -721,13 +722,28 @@ class CycleCount extends Page
|
||||
$parts = explode('|', $value);
|
||||
|
||||
$this->itemCode = $parts[0] ?? null;
|
||||
if (strlen($parts[1]) > strlen($parts[2])) {
|
||||
|
||||
if (count($parts) == 2) {
|
||||
// Format: itemcode|serialnumber
|
||||
$this->sNo = $parts[1];
|
||||
$this->batch = $parts[2];
|
||||
$this->batch = null;
|
||||
} else {
|
||||
$this->batch = $parts[1];
|
||||
$this->sNo = $parts[2];
|
||||
// Format: itemcode|value1|value2
|
||||
if (strlen($parts[1]) > strlen($parts[2])) {
|
||||
$this->sNo = $parts[1];
|
||||
$this->batch = $parts[2];
|
||||
} else {
|
||||
$this->batch = $parts[1];
|
||||
$this->sNo = $parts[2];
|
||||
}
|
||||
}
|
||||
// if (strlen($parts[1]) > strlen($parts[2])) {
|
||||
// $this->sNo = $parts[1];
|
||||
// $this->batch = $parts[2];
|
||||
// } else {
|
||||
// $this->batch = $parts[1];
|
||||
// $this->sNo = $parts[2];
|
||||
// }
|
||||
|
||||
if (strlen($this->itemCode) < 6) {
|
||||
Notification::make()
|
||||
@@ -759,7 +775,7 @@ class CycleCount extends Page
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif (strlen($this->batch) < 5) {
|
||||
} elseif (count($parts) !== 2 && strlen($this->batch) < 5) {
|
||||
Notification::make()
|
||||
->title('Unknown Batch')
|
||||
->body("Batch should contain minimum 5 digits '$this->batch'")
|
||||
@@ -927,7 +943,7 @@ class CycleCount extends Page
|
||||
'bin' => $bin,
|
||||
'serial_number' => $this->sNo,
|
||||
'stickerMasterId' => $stickerMasterId,
|
||||
'batch' => $this->batch,
|
||||
'batch' => $this->batch ?? null,
|
||||
'docNo' => $this->docNo,
|
||||
'quantity' => $this->quantity,
|
||||
]),
|
||||
@@ -1240,7 +1256,7 @@ class CycleCount extends Page
|
||||
return;
|
||||
}
|
||||
|
||||
if ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null) {
|
||||
if (count($parts) !== 2 && ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null)){
|
||||
|
||||
if ($serialAgaPlant->batch != $this->batch) {
|
||||
|
||||
@@ -1396,7 +1412,7 @@ class CycleCount extends Page
|
||||
'bin' => $bin,
|
||||
'serial_number' => $this->sNo,
|
||||
'stickerMasterId' => $stickerMasterId,
|
||||
'batch' => $this->batch,
|
||||
'batch' => $this->batch ?? null,
|
||||
'docNo' => $this->docNo,
|
||||
'quantity' => $this->quantity,
|
||||
]),
|
||||
@@ -1415,8 +1431,8 @@ class CycleCount extends Page
|
||||
|
||||
$serial->update([
|
||||
'bin' => $bin ?? null,
|
||||
'batch' => $this->batch ?? null,
|
||||
'doc_no' => $this->docNo ?? null,
|
||||
'batch' => count($parts) !== 2 ? $this->batch : $serial->batch,
|
||||
// 'doc_no' => $this->docNo ?? null,
|
||||
'scanned_status' => 'Scanned',
|
||||
'scanned_quantity' => '1',
|
||||
'updated_at' => now(),
|
||||
@@ -2132,6 +2148,7 @@ class CycleCount extends Page
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -56,6 +57,78 @@ class PlantController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function getItemCode(Request $request){
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$plantCode = $request->header('plant-code');
|
||||
|
||||
$itemCode = $request->header('item-code');
|
||||
|
||||
if (! $plantCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant Code value can't be empty",
|
||||
], 404);
|
||||
} elseif (! $itemCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item code cannot be empty!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
$plantId = $plant->id;
|
||||
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant Code '{$plantCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemCodeExist = Item::where('code', $itemCode)->first();
|
||||
|
||||
if (! $itemCodeExist) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item code not found',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemCodePlantExist = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||
|
||||
if (! $itemCodePlantExist) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code not found against plant code '$plantCode'",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (empty(trim($itemCodePlantExist->description ?? ''))) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Description is empty in Item Master against item code '$itemCode'.",
|
||||
], 404);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'SUCCESS',
|
||||
'status_description' => [
|
||||
'description' => $itemCodePlantExist->description,
|
||||
],
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
|
||||
@@ -234,3 +234,7 @@ Route::post('file/store', [SapFileController::class, 'store'])->name('file.store
|
||||
Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])->name('print.pallet');
|
||||
|
||||
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
||||
|
||||
//..Item Code
|
||||
|
||||
Route::get('item-code', [PlantController::class, 'getItemCode']);
|
||||
|
||||
Reference in New Issue
Block a user