updates to M3 module

This commit is contained in:
Mark Gregory
2026-09-16 16:46:15 +01:00
parent 13a7e804af
commit ce06aa9fac
20 changed files with 191 additions and 203 deletions
@@ -11,7 +11,7 @@ use Str;
use Log;
use Http;
use File;
use Helper;
use Modules\M3\Helpers\Helper;
use Modules\M3\Http\Controllers\GetContentsController;
//use Request;
@@ -9,7 +9,7 @@ use DB;
use Config;
use Str;
use Log;
use Helper;
use Modules\M3\Helpers\Helper;
class M3Controller extends Controller
{
@@ -14,7 +14,7 @@ use Cache;
use DateTime;
use Smalot\PdfParser\Parser;
use File;
use Helper;
use Modules\M3\Helpers\Helper;
use Json;
class M3InventoryReport extends Controller
@@ -14,7 +14,7 @@ use Cache;
use DateTime;
use Smalot\PdfParser\Parser;
use File;
use Helper;
use Modules\M3\Helpers\Helper;
class PdfStorage extends Controller
{
@@ -14,7 +14,7 @@ use Cache;
use DateTime;
use Smalot\PdfParser\Parser;
use File;
use Helper;
use Modules\M3\Helpers\Helper;
class ReplenAPI extends Controller
{
@@ -14,7 +14,7 @@ use Cache;
use DateTime;
use Smalot\PdfParser\Parser;
use File;
use Helper;
use Modules\M3\Helpers\Helper;
class TransferAPI extends Controller
{
@@ -14,7 +14,7 @@ use Cache;
use DateTime;
use Smalot\PdfParser\Parser;
use File;
use Helper;
use Modules\M3\Helpers\Helper;
class TwoShipAPIs extends Controller
{
@@ -14,33 +14,20 @@ class M3DeliveryController extends Controller
{
public static function index(Request $request) {
$power_user = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
->select('R428PWRUSR','R428US','R428CO','R428PL','R428WH')
->where('R428US','=',strtoUpper(m3_user()))
->first();
$co = $power_user->R428CO;
$plant = $power_user->R428PL;
$whs = $power_user->R428WH;
$ICM664M = DB::connection(config('m3.connection', 'pgsql'))->select("select * from ICM664M
where AVCO='$co' and AVPLANT='$plant' and AVWHS='$whs'");
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->select("select * from IC670M where WDCO='$co' and WDPL='$plant' and WDWHS='$whs'");
$shipvia = DB::connection(config('m3.connection', 'pgsql'))->select("select AXCODE, AXDESC from ICM319M order by 1");
#646 where AXCO='$co' and AXWHS='$whs' and AXPLANT='$plant'
$connection = config('m3.connection', 'pgsql');
$power_user = (object) ['R428PWRUSR'=>'N','R428US'=>strtoUpper(m3_user()),'R428CO'=>'','R428PL'=>'','R428WH'=>''];
if (\Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')) {
$power_user = DB::connection($connection)->table('icm428m')->select('R428PWRUSR','R428US','R428CO','R428PL','R428WH')
->where('R428US',strtoUpper(m3_user()))->first() ?? $power_user;
}
$co=$power_user->R428CO; $plant=$power_user->R428PL; $whs=$power_user->R428WH;
$ICM664M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm664m')
? DB::connection($connection)->table('icm664m')->where('AVCO',$co)->where('AVPLANT',$plant)->where('AVWHS',$whs)->get() : collect();
$IC670M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('ic670m')
? DB::connection($connection)->table('ic670m')->where('WDCO',$co)->where('WDPL',$plant)->where('WDWHS',$whs)->get() : collect();
$shipvia = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm319m')
? DB::connection($connection)->table('icm319m')->select('AXCODE','AXDESC')->orderBy('AXCODE')->get() : collect();
return view('m3::liberty-theme.pages.M3Delivery', compact('ICM664M','IC670M','power_user','shipvia'));
// AVCO AVCO CHARACTER 3 No ' ' Division
// AVWHS AVWHS CHARACTER 3 No ' ' Warehouse
// AVPLANT AVPLANT CHARACTER 3 No ' ' Plant
// AVDELMETH AVDELMETH CHARACTER 4 No ' ' Delivery method
// AVSHPVIA AVSHPVIA CHARACTER 4 No ' ' Sentinel ship via
// AVSHSRT AVSHSRT CHARACTER 6 No ' ' Sentinel route
// AVSHORCL AVSHORCL CHARACTER 3 No ' ' Sentinel intl code
// AVSPR1A01 AVSPR1A01 CHARACTER 1 No ' ' Spare field 1A 01
// AVSPR1A02 AVSPR1A02 CHARACTER 1 No ' ' Spare field 1A 02
// AVSPR10A01 AVSPR10A01 CHARACTER 10 No ' ' Spare field 10A 1
// AVSPR15A01 AVSPR15A01 CHARACTER 15 No ' ' Spare field 15A 1
// AVSPR30A01 AVSPR30A01 CHARACTER 30 No ' ' Spare field 30A 1
}
//
@@ -23,9 +23,10 @@ class M3ErrorsDispController extends Controller
$skipdates = isset($request->skipdates) ? trim($request->skipdates) : "N";
# Get users from ICM428M
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
->select('R428US', 'R428FIRST', 'R428FAMILY')
->get();
$connection = config('m3.connection', 'pgsql');
$ICM428M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')
? DB::connection($connection)->table('icm428m')->select('R428US', 'R428FIRST', 'R428FAMILY')->get()
: collect();
$ICM428MCOL = collect($ICM428M);
$ICM428MCOL->filter(function ($value) {
return $value->R428US = trim($value->R428US);
@@ -19,7 +19,10 @@ class M3GetPDFFromCacheController extends Controller
// Parse PDF file and build necessary objects.
$parser = new \Smalot\PdfParser\Parser();
$aggno = $aggmsg = ""; #$carrier = $trackingno = "";
$aggno = $aggmsg = "";
$IC670M = $PDFArray = $carrier = $trackingno = $ICM688M1 = [];
$AYMACPKR = $WHDDA = $COMPANY = $PLANT = $WHS = '';
#$carrier = $trackingno = "";
# PDF File PATH
$pdfFilePath = Config::get('arrays.PdfPath');
@@ -15,6 +15,10 @@ use Storage;
class OrderLinesOfClosedOrder extends Controller
{
public static function index(Request $request){
$IC670M = $ICM688M2 = [];
$WHDDA = $COMPANY = $PLANT = $WHS = '';
$REPORTDATEDisp = today()->format('Ymd');
$allReportsUrls = [];
try {
$SHUSER = m3_user() !== '' ? Str::upper(trim(m3_user())) : '';
// dd($SHUSER);
@@ -23,10 +23,10 @@ class ReplenishSettingsController extends Controller
# Get Logged user Id
$userId = m3_user() !== '' ? strtoupper(m3_user()) : '' ;
// $userId = 'E1135818'; // Brad : E1135818 Malak : E2011812 ACOM_PDF
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
->where('R428US',$userId)
->where('R428STS','A')
->first();
$connection = config('m3.connection', 'pgsql');
$ICM428M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')
? DB::connection($connection)->table('icm428m')->where('R428US',$userId)->where('R428STS','A')->first()
: null;
$userCO = isset($ICM428M->R428CO) ? $ICM428M->R428CO : '';
$userPL = isset($ICM428M->R428PL) ? $ICM428M->R428PL : '';
@@ -34,11 +34,13 @@ class ReplenishSettingsController extends Controller
if ($userCO!='') {
# Warehouse Table
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')
$IC670M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('ic670m')
? DB::connection($connection)->table('ic670m')
->where('WDCO',$userCO)
->where('WDPL',$userPL)
->where('WDWHS',$userWH)
->get();
->get()
: [];
}
else{
// $REFCAT658 =[];
@@ -151,10 +153,10 @@ class ReplenishSettingsController extends Controller
# Get Logged user Id
$userId = m3_user() !== '' ? strtoupper(m3_user()) : '' ;
// $userId = 'E1135818'; // Brad : E1135818 Malak : E2011812 ACOM_PDF
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
->where('R428US',$userId)
->where('R428STS','A')
->first();
$connection = config('m3.connection', 'pgsql');
$ICM428M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')
? DB::connection($connection)->table('icm428m')->where('R428US',$userId)->where('R428STS','A')->first()
: null;
$userCO = isset($ICM428M->R428CO) ? $ICM428M->R428CO : '';
$userPL = isset($ICM428M->R428PL) ? $ICM428M->R428PL : '';
@@ -8,7 +8,7 @@ use Config;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Modules\M3\Models\ICM160M;
use Helper;
use Modules\M3\Helpers\Helper;
class carrierMaintController extends Controller
@@ -14,24 +14,19 @@ class palletQtyController extends Controller
{
public static function index(Request $request) {
#$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
#$power_user = DB::connection(config('m3.connection', 'pgsql'))->select("select R428PWRUSR, R428CO, R428PL, R428WH from ICM428M where R428US='".strtoUpper(m3_user())."'");
$power_user = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
->select('R428PWRUSR','R428US','R428CO','R428PL','R428WH')
->where('R428US','=',strtoUpper(m3_user()))
->first();
$co = $power_user->R428CO;
$plant = $power_user->R428PL;
$whs = $power_user->R428WH;
$ICM709M = DB::connection(config('m3.connection', 'pgsql'))->table('icm709m')
->where('AT9CO','=',$co)
->where('AT9PLT','=',$plant)
->where('AT9WHS','=',$whs)
->get();
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->select("select * from IC670M where WDCO='$co' and WDPL='$plant' and WDWHS='$whs'");
$connection = config('m3.connection', 'pgsql');
$power_user = (object) ['R428PWRUSR'=>'N','R428US'=>strtoUpper(m3_user()),'R428CO'=>'','R428PL'=>'','R428WH'=>''];
if (\Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')) {
$power_user = DB::connection($connection)->table('icm428m')
->select('R428PWRUSR','R428US','R428CO','R428PL','R428WH')
->where('R428US','=',strtoUpper(m3_user()))->first() ?? $power_user;
}
$co=$power_user->R428CO; $plant=$power_user->R428PL; $whs=$power_user->R428WH;
$ICM709M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm709m')
? DB::connection($connection)->table('icm709m')->where('AT9CO',$co)->where('AT9PLT',$plant)->where('AT9WHS',$whs)->get() : collect();
$IC670M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('ic670m')
? DB::connection($connection)->table('ic670m')->where('WDCO',$co)->where('WDPL',$plant)->where('WDWHS',$whs)->get() : collect();
return view('m3::liberty-theme.pages.palletQty', compact('ICM709M','IC670M','power_user'));
}
//
@@ -14,28 +14,20 @@ class userControlController extends Controller
{
public static function index(Request $request) {
#$sqlstmt="select * from ICM428M";
#$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')->get();
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
->select('R428US','R428CO', 'R428WH')
->where('R428US','=',strtoUpper(m3_user()))
->first();
$co = $ICM428M->R428CO;
$whs = $ICM428M->R428WH;
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->select("SELECT * FROM ICM428M where R428CO='$co' and R428WH='$whs'");
#765 add DATE_PASSWORD_EXPIRES as DATE_EXPIRED, SET_PASSWORD_TO_EXPIRE as EXPIRED
$USER_INFO = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')->selectRaw('R428US as USERPRF, R428STS as STATUS, NULL as DATE_EXPIRED, NULL as EXPIRED')->get()->all();
#echo "<pre>"; var_dump($USER_INFO); echo "</pre>";
$power_user = DB::connection(config('m3.connection', 'pgsql'))->select("select R428PWRUSR, R428CO, R428PL, R428WH from ICM428M where R428US='".strtoUpper(m3_user())."'");
#765
# $expired_users = DB::connection(config('m3.connection', 'pgsql'))->select("SELECT USER_PROFILE FROM TABLE (SYSTOOLS.AUDIT_JOURNAL_CP () ) WHERE PASSWORD_EXPIRED = '*YES'");
# echo "<pre>"; print_r($expired_users); echo "</pre>";
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
$connection = config('m3.connection', 'pgsql');
$profile = null;
if (\Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')) {
$profile = DB::connection($connection)->table('icm428m')->where('R428US',strtoUpper(m3_user()))->first();
}
$co=$profile->R428CO ?? ''; $whs=$profile->R428WH ?? '';
$ICM428M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')
? DB::connection($connection)->table('icm428m')->where('R428CO',$co)->where('R428WH',$whs)->get() : collect();
$USER_INFO = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')
? DB::connection($connection)->table('icm428m')->selectRaw('R428US as USERPRF, R428STS as STATUS, NULL as DATE_EXPIRED, NULL as EXPIRED')->get()->all() : [];
$power_user = [(object)['R428PWRUSR'=>$profile->R428PWRUSR ?? 'N','R428CO'=>$co,'R428PL'=>$profile->R428PL ?? '','R428WH'=>$whs]];
$IC670M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('ic670m')
? DB::connection($connection)->table('ic670m')->get() : collect();
return view('m3::liberty-theme.pages.userControl', compact('ICM428M','IC670M','power_user','USER_INFO'));
}
//