ranjith-dev #478
@@ -728,6 +728,17 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($scrapQty == null || $scrapQty == '') {
|
||||
$scrapQty = 0;
|
||||
}
|
||||
|
||||
if ($rework == null || $rework == '' || ! $rework) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Rework value can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$line = Line::where('name', $lineName)->first();
|
||||
|
||||
if (! $line) {
|
||||
@@ -895,20 +906,6 @@ class PdfController extends Controller
|
||||
|
||||
$total = $alreadyReceived + $receivedQty;
|
||||
|
||||
if ($total > $orderQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Received quantity should not exceed order quantity! Order Qty = {$orderQty}, Already Received Qty = {$alreadyReceived}, Trying to Insert Qty = {$receivedQty}",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($rework == null || $rework == '' || ! $rework) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Rework value can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($rework != 'Yes' && $rework != 'No') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
@@ -949,6 +946,13 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($total > $orderQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Received quantity should not exceed order quantity! Order Qty = {$orderQty}, Already Received Qty = {$alreadyReceived}, Trying to Insert Qty = {$receivedQty}",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existingCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('line_id', $lineNamePlantId)
|
||||
@@ -994,7 +998,7 @@ class PdfController extends Controller
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if ($coilNo >= 1) {
|
||||
if ($coilNo > 1) {
|
||||
$prevCoilNo = (string) ($coilNo - 1);
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
@@ -1004,7 +1008,7 @@ class PdfController extends Controller
|
||||
if (! $existPrevCoil) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
@@ -1022,6 +1026,19 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', $itemId)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existPrevCoil->received_quantity < $receivedQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Rework received quantity should not exceed exist received quantity! Exist Received Qty = {$existPrevCoil->received_quantity}, Trying to Insert Qty = {$receivedQty}",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$updated = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('line_id', $lineNamePlantId)
|
||||
@@ -1070,7 +1087,7 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($coilNo >= 1) {
|
||||
if ($coilNo > 1) {
|
||||
$prevCoilNo = (string) ($coilNo - 1);
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
@@ -1080,11 +1097,18 @@ class PdfController extends Controller
|
||||
if (! $existPrevCoil) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
if ($total > $orderQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Received quantity should not exceed order quantity! Order Qty = {$orderQty}, Already Received Qty = {$alreadyReceived}, Trying to Insert Qty = {$receivedQty}",
|
||||
], 404);
|
||||
}
|
||||
|
||||
ProcessOrder::Create(
|
||||
[
|
||||
'plant_id' => $plantId,
|
||||
|
||||
Reference in New Issue
Block a user