M3 Integration fixes
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\M3\Http\Controllers;
|
||||
|
||||
use Config;
|
||||
use DB;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class MFOrdersController extends Controller
|
||||
{
|
||||
public static function index(Request $request)
|
||||
{
|
||||
$mF = isset($request->id) ? trim($request->id) : '';
|
||||
|
||||
// dd("MFOrders ".$mF);
|
||||
// Get Users from ICM428M
|
||||
$iCM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
|
||||
->select('R428US', 'R428CO', 'R428WH', 'R428PL')
|
||||
->where('R428US', '=', strtoupper(m3_user()))
|
||||
->first();
|
||||
$co = $iCM428M->R428CO;
|
||||
$whs = $iCM428M->R428WH;
|
||||
$plant = $iCM428M->R428PL;
|
||||
|
||||
// ICM705M1 Statement
|
||||
$sqlstmt = "select APMANIFEST,APDOCKDOOR,APCARRIER,APTRUCKIDT,APSPARE1,APLDSTRU,APLDSTRD,APLDSTRT,
|
||||
APLDCLOU,APLDCLOD,APLDCLOT,APCO,APWHS,APPLT,APSPARE2,APLDCLOZ
|
||||
from ICM705M1
|
||||
where APMANIFEST = $mF and APCO='$co' and APWHS='$whs' and APPLT='$plant' limit 1";
|
||||
|
||||
$iCM705M1 = DB::connection(config('m3.connection', 'pgsql'))->select($sqlstmt);
|
||||
$carrier = isset($iCM705M1[0]->APCARRIER) ? trim($iCM705M1[0]->APCARRIER) : '';
|
||||
|
||||
if ($mF != '') {
|
||||
$status_ICM688M1_array = Config::get('arrays.status_ICM688M1_array');
|
||||
|
||||
$sqlstmt = "SELECT AYCO,AYPLANT,AYMACPKR,AYONO,A4SHSHNM,A4PICKSTS,AYSPR15A01,SUM(AYLNWGHT) AS TOTWEIGHT,COUNT(*) AS BOXPAL FROM ICM695M1
|
||||
LEFT JOIN ICM688M1 ON AYCO=A4CO AND AYPLANT=A4PLANT AND AYMACPKR=A4MACPKR
|
||||
WHERE AYAPRF1551= $mF and AYCO='$co' and AYWHS='$whs' and AYPLANT='$plant'
|
||||
GROUP BY AYCO,AYPLANT,AYMACPKR,AYONO,A4SHSHNM,A4PICKSTS,AYSPR15A01";
|
||||
|
||||
$iCM695M1 = DB::connection(config('m3.connection', 'pgsql'))->select($sqlstmt);
|
||||
|
||||
return view(
|
||||
'm3::liberty-theme.pages.MFOrders',
|
||||
['ICM695M1' => $iCM695M1, 'status_ICM688M1_array' => $status_ICM688M1_array, 'MF' => $mF, 'carrier' => $carrier],
|
||||
);
|
||||
} else {
|
||||
abort(404, 'Manifest Not Found');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user