ranjith-dev #287

Merged
jothi merged 2 commits from ranjith-dev into master 2026-01-31 05:07:02 +00:00
2 changed files with 73 additions and 23 deletions

View File

@@ -211,7 +211,7 @@ class Scheduler extends Command
}
break;
case 'Daily':
if (now()->format('H:i') == '10:45') {
if (now()->format('H:i') == '11:00') {
try {
\Artisan::call('send:invoice-transit-report', [
'schedule_type' => $rule->schedule_type,

View File

@@ -2875,7 +2875,7 @@ class CharacteristicsController extends Controller
// $pendingCharacteristics = [];
// foreach ($characteristics as $char) {
// $charName = strtolower($char['characteristic_name']) ?? null;
// $charName = strtoupper($char['characteristic_name']) ?? null;
// $pendingExists = RequestCharacteristic::where('aufnr', $jobNo)
// ->where('characteristic_name', $charName)
// ->latest()
@@ -2948,7 +2948,7 @@ class CharacteristicsController extends Controller
// 'item_id' => $ItemId,
// 'characteristic_approver_master_id' => $charId,
// 'aufnr' => $jobNo,
// 'characteristic_name' => strtolower($char['characteristic_name']),
// 'characteristic_name' => strtoupper($char['characteristic_name']),//strtolower
// 'current_value' => $char['current_value'],
// 'update_value' => $char['update_value'],
// 'created_by' => $userName,
@@ -3037,7 +3037,7 @@ class CharacteristicsController extends Controller
}
if ($charField == null || $charField == '') {
$charField = 'nil';
$charField = 'NIL';
}
$plant = Plant::where('code', $plantCode)->first();
@@ -3132,6 +3132,24 @@ class CharacteristicsController extends Controller
$MachineId = $machineAgaPlant->id;
$iCode = Item::where('code', $itemCode)->first();
if (! $iCode) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' not found!",
], 404);
}
$iCodeAgaPlant = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
if (! $iCodeAgaPlant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' not found for the plant code '{$plantCode}'!",
], 404);
}
$ItemId = $iCodeAgaPlant->id;
$pCode = CharacteristicApproverMaster::where('plant_id', $plantId)->first();
if (! $pCode) {
return response()->json([
@@ -3172,46 +3190,76 @@ class CharacteristicsController extends Controller
], 404);
}
$mNameAgaWorkCenter = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->first();
if (! $mNameAgaWorkCenter) {
$cField = CharacteristicApproverMaster::where('characteristic_field', $charField)->first();
if (! $cField) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Master characteristic field value '{$charField}' not found in characteristic approver master!",
], 404);
}
$cFieldAgaPlant = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('plant_id', $plantId)->first();
if (! $cFieldAgaPlant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Master characteristic field value '{$charField}' not found for the plant code '{$plantCode}' in characteristic approver master!",
], 404);
}
$mNameAndWorkCenter = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->first();
if (! $mNameAndWorkCenter) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Machine name '{$machineName}' and work center '{$workCenter}' not found in characteristic approver master!",
], 404);
}
$mNameAgaWorkCenterForPlant = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->where('plant_id', $plantId)->first();
if (! $mNameAgaWorkCenterForPlant) {
$mNameAndWorkCenterAgaPlant = CharacteristicApproverMaster::where('machine_name', $machineName)->where('machine_id', $MachineId)->where('plant_id', $plantId)->first();
if (! $mNameAndWorkCenterAgaPlant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Machine name '{$machineName}' and work center '{$workCenter}' not found for the plant code '{$plantCode}' in characteristic approver master!",
], 404);
}
$charId = $mNameAgaWorkCenterForPlant->id;
$iCode = Item::where('code', $itemCode)->first();
if (! $iCode) {
$cFieldAndWorkCent = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('machine_id', $MachineId)->first();
if (! $cFieldAndWorkCent) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' not found!",
'status_description' => "Master characteristic field value '{$charField}' not found for the work center '{$workCenter}' in characteristic approver master!",
], 404);
}
$iCodeAgaPlant = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
if (! $iCodeAgaPlant) {
$cFieldAndWorkCentAgaPlant = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('machine_id', $MachineId)->where('plant_id', $plantId)->first();
if (! $cFieldAndWorkCentAgaPlant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' not found for the plant code '{$plantCode}'!",
'status_description' => "Master characteristic field value '{$charField}' and work center '{$workCenter}' not found for the plant code '{$plantCode}' in characteristic approver master!",
], 404);
}
$ItemId = $iCodeAgaPlant->id;
$cFieldAndMach = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('machine_name', $machineName)->first();
if (! $cFieldAndMach) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Master characteristic field value '{$charField}' not found for the machine name '{$machineName}' in characteristic approver master!",
], 404);
}
$cFieldAndWorkCentAndMachAgaPlant = CharacteristicApproverMaster::where('characteristic_field', $charField)->where('machine_id', $MachineId)->where('machine_name', $machineName)->where('plant_id', $plantId)->first();
if (! $cFieldAndWorkCentAndMachAgaPlant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Master characteristic field value '{$charField}', work center '{$workCenter}', and machine name '{$machineName}' not found for the plant code '{$plantCode}' in characteristic approver master!",
], 404);
}
$charId = $cFieldAndWorkCentAndMachAgaPlant->id;
$pendingCharacteristics = [];
foreach ($characteristics as $char) {
$charName = strtolower($char['characteristic_name']) ?? null;
$charName = strtoupper($char['characteristic_name']) ?? null;
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('characteristic_name', $charName)->latest()->first();
if ($pendingExists) {
@@ -3292,7 +3340,7 @@ class CharacteristicsController extends Controller
'item_id' => $ItemId,
'characteristic_approver_master_id' => $charId,
'aufnr' => $jobNo,
'characteristic_name' => strtolower($char['characteristic_name']),
'characteristic_name' => strtoupper($char['characteristic_name']), // strtolower
'current_value' => $char['current_value'],
'update_value' => $char['update_value'],
'created_by' => $userName,
@@ -3720,6 +3768,8 @@ class CharacteristicsController extends Controller
], 404);
}
$workFlowId = strtoupper($workFlowId);
if (! $workFlowId) {
$records = RequestCharacteristic::with('approver')->where([
@@ -3782,14 +3832,14 @@ class CharacteristicsController extends Controller
], 404);
}
if (! str_ends_with(strtolower($filename), '.pdf')) {
$filename .= '.pdf';
}
// if (! str_ends_with(strtolower($filename), '.pdf')) {
// $filename .= '.pdf';
// }
if (! Storage::disk('local')->exists($filePath)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Pdf File not found for the provided work flow id number!',
'status_description' => "Pdf File not found for the provided 'Work Flow ID' number!",
], 404);
}