m3 Security Fixes
This commit is contained in:
@@ -13,6 +13,8 @@ use Str;
|
|||||||
|
|
||||||
class ClosedOrderSaveXls extends Command
|
class ClosedOrderSaveXls extends Command
|
||||||
{
|
{
|
||||||
|
private const XLSX_EXTENSION = '.xlsx';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name and signature of the console command.
|
* The name and signature of the console command.
|
||||||
*
|
*
|
||||||
@@ -75,9 +77,9 @@ class ClosedOrderSaveXls extends Command
|
|||||||
$toreportDateWD = $toPreviousMonth;
|
$toreportDateWD = $toPreviousMonth;
|
||||||
|
|
||||||
if ($WHS == '321') {
|
if ($WHS == '321') {
|
||||||
$prevMonthFile = 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '.xlsx';
|
$prevMonthFile = 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . self::XLSX_EXTENSION;
|
||||||
} else {
|
} else {
|
||||||
$prevMonthFile = $WHS . '/Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '-' . $WHS . '.xlsx';
|
$prevMonthFile = $WHS . '/Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '-' . $WHS . self::XLSX_EXTENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info('Generate Last Month Report...');
|
$this->info('Generate Last Month Report...');
|
||||||
@@ -165,7 +167,7 @@ class ClosedOrderSaveXls extends Command
|
|||||||
if ($WHS == '321') {
|
if ($WHS == '321') {
|
||||||
$currentMonthFile = 'first_of_month_to_current_date.xlsx';
|
$currentMonthFile = 'first_of_month_to_current_date.xlsx';
|
||||||
} else {
|
} else {
|
||||||
$currentMonthFile = $WHS . '/first_of_month_to_current_date_' . $WHS . '.xlsx';
|
$currentMonthFile = $WHS . '/first_of_month_to_current_date_' . $WHS . self::XLSX_EXTENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info('Generate Current Month Report...');
|
$this->info('Generate Current Month Report...');
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ use Str;
|
|||||||
// use Request;
|
// use Request;
|
||||||
class CloseShipment extends Controller
|
class CloseShipment extends Controller
|
||||||
{
|
{
|
||||||
|
private const ZERO_PAD = '000000';
|
||||||
|
private const JSON_CONTENT_TYPE = 'application/json';
|
||||||
|
private const NULL_M3_RESPONSE = 'M3 API responded with null value';
|
||||||
|
|
||||||
// CloseShipmentCoChargeAPI : with URL PARAMS COCharge
|
// CloseShipmentCoChargeAPI : with URL PARAMS COCharge
|
||||||
public static function CloseShipmentCoChargeAPI(Request $request)
|
public static function CloseShipmentCoChargeAPI(Request $request)
|
||||||
{
|
{
|
||||||
@@ -49,7 +53,7 @@ class CloseShipment extends Controller
|
|||||||
$LineAck = [];
|
$LineAck = [];
|
||||||
// PDF File PATH
|
// PDF File PATH
|
||||||
$pdfFilePath = Config::get('arrays.PdfPath');
|
$pdfFilePath = Config::get('arrays.PdfPath');
|
||||||
$DELIVERYNO = $MANIFEST != '' ? $MANIFEST : '000000';
|
$DELIVERYNO = $MANIFEST != '' ? $MANIFEST : self::ZERO_PAD;
|
||||||
|
|
||||||
// Log::channel('dailyCron')->info("Close Manifest:".$MANIFEST.'-WHS: '.$WHS."-CO:".$COMPANY);
|
// Log::channel('dailyCron')->info("Close Manifest:".$MANIFEST.'-WHS: '.$WHS."-CO:".$COMPANY);
|
||||||
|
|
||||||
@@ -89,7 +93,7 @@ class CloseShipment extends Controller
|
|||||||
$IonToken = isset($tokenData->token) ? $tokenData->token : '';
|
$IonToken = isset($tokenData->token) ? $tokenData->token : '';
|
||||||
} else {
|
} else {
|
||||||
$SHDATA = isset($tokenData->message) ? $tokenData->message : '';
|
$SHDATA = isset($tokenData->message) ? $tokenData->message : '';
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
|
|
||||||
// Write to Logs : Error
|
// Write to Logs : Error
|
||||||
$data = [
|
$data = [
|
||||||
@@ -439,7 +443,7 @@ class CloseShipment extends Controller
|
|||||||
|
|
||||||
// If billable=Y and a4ratetcp(FREIGHT)>0 and a4ratem3=blank, then call the freight API CoCharge
|
// If billable=Y and a4ratetcp(FREIGHT)>0 and a4ratem3=blank, then call the freight API CoCharge
|
||||||
if ($BILLABLE == 'Y' && $FREIGHT > 0 && $A4RATEM3 == '') {
|
if ($BILLABLE == 'Y' && $FREIGHT > 0 && $A4RATEM3 == '') {
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
|
|
||||||
if ($SHIPTYPE == 'LTL') {
|
if ($SHIPTYPE == 'LTL') {
|
||||||
$shippingToBill = $FREIGHT * (100.00 - Config::get('arrays.misc.discountCarrierRateForCustomerPriceLTL')) / 100;
|
$shippingToBill = $FREIGHT * (100.00 - Config::get('arrays.misc.discountCarrierRateForCustomerPriceLTL')) / 100;
|
||||||
@@ -496,6 +500,9 @@ class CloseShipment extends Controller
|
|||||||
$ContentLabel = route('m3.M3GetPDFFromCache.index', ['MACPKR' => $AYMACPKR, 'DOCTYPE' => $DOCTYPE]);
|
$ContentLabel = route('m3.M3GetPDFFromCache.index', ['MACPKR' => $AYMACPKR, 'DOCTYPE' => $DOCTYPE]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,7 +609,7 @@ class CloseShipment extends Controller
|
|||||||
// No Errors Proceed in Calling M3 CLose API
|
// No Errors Proceed in Calling M3 CLose API
|
||||||
if ($ErrorMsgs == '') {
|
if ($ErrorMsgs == '') {
|
||||||
// Write to Logs Out : Send JSON Request To M3
|
// Write to Logs Out : Send JSON Request To M3
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
// dump($DELIVERYNO);
|
// dump($DELIVERYNO);
|
||||||
// MAK : Log JSON Manifest # and MACKPKR #
|
// MAK : Log JSON Manifest # and MACKPKR #
|
||||||
// Log::channel('dailyCron')->info('1 >>> JSON Sent for Manifest: '.$MANIFEST.' ,Macpicker: '.$AYMACPKR);
|
// Log::channel('dailyCron')->info('1 >>> JSON Sent for Manifest: '.$MANIFEST.' ,Macpicker: '.$AYMACPKR);
|
||||||
@@ -624,12 +631,12 @@ class CloseShipment extends Controller
|
|||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
|
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'accept' => 'application/json',
|
'accept' => self::JSON_CONTENT_TYPE,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||||
'Connection' => 'close',
|
'Connection' => 'close',
|
||||||
])
|
])
|
||||||
->withToken($token)
|
->withToken($token)
|
||||||
->withBody($JSONCS, 'application/json')
|
->withBody($JSONCS, self::JSON_CONTENT_TYPE)
|
||||||
->timeout(Config::get('arrays.curlTimeOut'))
|
->timeout(Config::get('arrays.curlTimeOut'))
|
||||||
->retry(3, 100)
|
->retry(3, 100)
|
||||||
->post($endPointURL);
|
->post($endPointURL);
|
||||||
@@ -683,8 +690,8 @@ class CloseShipment extends Controller
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$M3APIRESULT = 'Error';
|
$M3APIRESULT = 'Error';
|
||||||
$responseMsg = 'M3 API responded with null value';
|
$responseMsg = self::NULL_M3_RESPONSE;
|
||||||
$M3APIRESULTMsg = 'M3 API responded with null value';
|
$M3APIRESULTMsg = self::NULL_M3_RESPONSE;
|
||||||
$responseResult = '';
|
$responseResult = '';
|
||||||
$M3Errors = $responseStatusCode;
|
$M3Errors = $responseStatusCode;
|
||||||
}
|
}
|
||||||
@@ -692,7 +699,7 @@ class CloseShipment extends Controller
|
|||||||
// If you get a successful response
|
// If you get a successful response
|
||||||
if ($M3APIRESULT != 'Error') {
|
if ($M3APIRESULT != 'Error') {
|
||||||
// Write to Logs Out : Success
|
// Write to Logs Out : Success
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
$data = [
|
$data = [
|
||||||
'SHMACPKR' => $DELIVERYNO,
|
'SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
@@ -718,7 +725,7 @@ class CloseShipment extends Controller
|
|||||||
->update(['A4PICKSTS' => 'a']);
|
->update(['A4PICKSTS' => 'a']);
|
||||||
|
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
$data = [
|
$data = [
|
||||||
'SHMACPKR' => $DELIVERYNO,
|
'SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
@@ -743,7 +750,7 @@ class CloseShipment extends Controller
|
|||||||
// Write to Logs : Error
|
// Write to Logs : Error
|
||||||
// Clear Duplicate messages
|
// Clear Duplicate messages
|
||||||
$ErrorMsgsC = Helper::removeDuplicateSubstrings($ErrorMsgs);
|
$ErrorMsgsC = Helper::removeDuplicateSubstrings($ErrorMsgs);
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
$data = [
|
$data = [
|
||||||
'SHMACPKR' => $DELIVERYNO,
|
'SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
@@ -831,7 +838,7 @@ class CloseShipment extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Write to Logs Out : JSON Request To M3
|
// Write to Logs Out : JSON Request To M3
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
$data = [
|
$data = [
|
||||||
'SHMACPKR' => $DELIVERYNO,
|
'SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
@@ -848,12 +855,12 @@ class CloseShipment extends Controller
|
|||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
|
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'accept' => 'application/json',
|
'accept' => self::JSON_CONTENT_TYPE,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||||
'Connection' => 'close',
|
'Connection' => 'close',
|
||||||
])
|
])
|
||||||
->withToken($token)
|
->withToken($token)
|
||||||
->withBody($JSONCS, 'application/json')
|
->withBody($JSONCS, self::JSON_CONTENT_TYPE)
|
||||||
->timeout(Config::get('arrays.curlTimeOut'))
|
->timeout(Config::get('arrays.curlTimeOut'))
|
||||||
->retry(2, 100)
|
->retry(2, 100)
|
||||||
->post($endPointURL);
|
->post($endPointURL);
|
||||||
@@ -884,14 +891,14 @@ class CloseShipment extends Controller
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
$M3APIRESULT = 'Error';
|
$M3APIRESULT = 'Error';
|
||||||
$responseMsg = 'M3 API responded with null value';
|
$responseMsg = self::NULL_M3_RESPONSE;
|
||||||
$M3APIRESULTMsg = 'M3 API responded with null value';
|
$M3APIRESULTMsg = self::NULL_M3_RESPONSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you get a successful response
|
// If you get a successful response
|
||||||
if ($M3APIRESULT != 'Error') {
|
if ($M3APIRESULT != 'Error') {
|
||||||
// Write to Logs Out : Success
|
// Write to Logs Out : Success
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
$data = [
|
$data = [
|
||||||
'SHMACPKR' => $DELIVERYNO,
|
'SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
@@ -918,7 +925,7 @@ class CloseShipment extends Controller
|
|||||||
->update(['A4PICKSTS' => 'a']);
|
->update(['A4PICKSTS' => 'a']);
|
||||||
|
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
$data = [
|
$data = [
|
||||||
'SHMACPKR' => $DELIVERYNO,
|
'SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
@@ -968,7 +975,7 @@ class CloseShipment extends Controller
|
|||||||
}
|
}
|
||||||
// ## End Zero Pick
|
// ## End Zero Pick
|
||||||
else {
|
else {
|
||||||
$DELIVERYNO = isset($MANIFEST) ? $MANIFEST : '000000';
|
$DELIVERYNO = isset($MANIFEST) ? $MANIFEST : self::ZERO_PAD;
|
||||||
// # Set SHDATA Message
|
// # Set SHDATA Message
|
||||||
$SHDATAMSG = 'No records found in ICM695M1,or URL parameters incomplete';
|
$SHDATAMSG = 'No records found in ICM695M1,or URL parameters incomplete';
|
||||||
// count($ICM695M1TMP)==0 ? 'MacPkr already closed' :
|
// count($ICM695M1TMP)==0 ? 'MacPkr already closed' :
|
||||||
@@ -1000,7 +1007,7 @@ class CloseShipment extends Controller
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
$data = [
|
$data = [
|
||||||
'SHMACPKR' => $DELIVERYNO,
|
'SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
@@ -1051,7 +1058,7 @@ class CloseShipment extends Controller
|
|||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||||
$data = [
|
$data = [
|
||||||
'SHMACPKR' => $DELIVERYNO,
|
'SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ use Str;
|
|||||||
|
|
||||||
class M3Controller extends Controller
|
class M3Controller extends Controller
|
||||||
{
|
{
|
||||||
|
private const FIELD_PREFIX = 'Field: ';
|
||||||
|
private const M3_LIST_SUFFIX = ' M3-Lis-JSN';
|
||||||
|
|
||||||
// Split Data and Write to ICM666M2
|
// Split Data and Write to ICM666M2
|
||||||
public function insertToICM666M2($dataSplit, $commentData)
|
public function insertToICM666M2($dataSplit, $commentData)
|
||||||
{
|
{
|
||||||
@@ -377,18 +380,18 @@ class M3Controller extends Controller
|
|||||||
|
|
||||||
if (! $lengthTest[413] || ! $lengthTest[411] || ! $lengthTest[417]) {
|
if (! $lengthTest[413] || ! $lengthTest[411] || ! $lengthTest[417]) {
|
||||||
if (! $lengthTest[413]) {
|
if (! $lengthTest[413]) {
|
||||||
$message[] = ['code' => '413', 'status' => 'error', 'message' => 'Field: ' . $key . ' is larger then expected'];
|
$message[] = ['code' => '413', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . ' is larger then expected'];
|
||||||
}
|
}
|
||||||
if (! $lengthTest[411]) {
|
if (! $lengthTest[411]) {
|
||||||
$message[] = ['code' => '411', 'status' => 'error', 'message' => 'Field: ' . $key . ' is empty'];
|
$message[] = ['code' => '411', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . ' is empty'];
|
||||||
}
|
}
|
||||||
if (! $lengthTest[417]) {
|
if (! $lengthTest[417]) {
|
||||||
$message[] = ['code' => '417', 'status' => 'error', 'message' => 'Field: ' . $key . 'type is different then Expected type: ' . $value[2]];
|
$message[] = ['code' => '417', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . 'type is different then Expected type: ' . $value[2]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write to Logs Out : Error & JSON
|
// Write to Logs Out : Error & JSON
|
||||||
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-spl',
|
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-spl',
|
||||||
'SHDATA' => json_encode($message) . ' M3-Lis-JSN' . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
'SHDATA' => json_encode($message) . self::M3_LIST_SUFFIX . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
|
|
||||||
return response()->json($message);
|
return response()->json($message);
|
||||||
@@ -485,7 +488,7 @@ class M3Controller extends Controller
|
|||||||
if ($PGMERRORS != '') {
|
if ($PGMERRORS != '') {
|
||||||
// Write to Logs Out : Error & JSON
|
// Write to Logs Out : Error & JSON
|
||||||
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-spl',
|
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-spl',
|
||||||
'SHDATA' => $PGMERRORS . ' M3-Lis-JSN' . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
'SHDATA' => $PGMERRORS . self::M3_LIST_SUFFIX . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,7 +520,7 @@ class M3Controller extends Controller
|
|||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
// Write to Logs Out : Error & JSON
|
// Write to Logs Out : Error & JSON
|
||||||
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-in',
|
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-in',
|
||||||
'SHDATA' => 'General Catchable Error - ' . substr($th, 0, 300) . ' M3-Lis-JSN' . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
'SHDATA' => 'General Catchable Error - ' . substr($th, 0, 300) . self::M3_LIST_SUFFIX . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
|
|
||||||
// Log::error($th);
|
// Log::error($th);
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ use Str;
|
|||||||
|
|
||||||
class M3InventoryReport extends Controller
|
class M3InventoryReport extends Controller
|
||||||
{
|
{
|
||||||
|
private const ZERO_PAD = '000000';
|
||||||
|
private const JSON_CONTENT_TYPE = 'application/json';
|
||||||
|
private const NO_M3_RESPONSE = 'Error: No Response from M3';
|
||||||
|
|
||||||
// M3InventoryReport for Single Part
|
// M3InventoryReport for Single Part
|
||||||
public function M3InventoryReport(Request $request)
|
public function M3InventoryReport(Request $request)
|
||||||
{
|
{
|
||||||
@@ -28,7 +32,7 @@ class M3InventoryReport extends Controller
|
|||||||
// Set SHSOURCE
|
// Set SHSOURCE
|
||||||
$SHSOURCE = 'M3InventoryReport';
|
$SHSOURCE = 'M3InventoryReport';
|
||||||
$M3Errors = '';
|
$M3Errors = '';
|
||||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get Json Contents
|
// Get Json Contents
|
||||||
@@ -49,7 +53,7 @@ class M3InventoryReport extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$SHDATA = isset($tokenData->message) ? $tokenData->message : '';
|
$SHDATA = isset($tokenData->message) ? $tokenData->message : '';
|
||||||
// Write to Logs : Error
|
// Write to Logs : Error
|
||||||
$data = ['SHMACPKR' => '000000', 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => '', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
$data = ['SHMACPKR' => self::ZERO_PAD, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => '', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => $SHDATA, 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => '', 'SHWHS' => $WHS];
|
'SHDATA' => $SHDATA, 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => '', 'SHWHS' => $WHS];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
|
|
||||||
@@ -66,8 +70,8 @@ class M3InventoryReport extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'accept' => 'application/json',
|
'accept' => self::JSON_CONTENT_TYPE,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||||
])
|
])
|
||||||
->withToken($token)
|
->withToken($token)
|
||||||
->timeout(Config::get('arrays.curlTimeOut'))
|
->timeout(Config::get('arrays.curlTimeOut'))
|
||||||
@@ -82,7 +86,7 @@ class M3InventoryReport extends Controller
|
|||||||
$responseJSON = $response->getBody()->getContents();
|
$responseJSON = $response->getBody()->getContents();
|
||||||
$JsonSanytized = Helper::sanityzeString($responseJSON);
|
$JsonSanytized = Helper::sanityzeString($responseJSON);
|
||||||
} else {
|
} else {
|
||||||
$M3Errors = 'Error: No Response from M3';
|
$M3Errors = self::NO_M3_RESPONSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($M3Errors != '') {
|
if ($M3Errors != '') {
|
||||||
@@ -162,7 +166,7 @@ class M3InventoryReport extends Controller
|
|||||||
$REQKPKUS = isset($urlParams['REQKPKUS']) ? $urlParams['REQKPKUS'] : 'WebUser';
|
$REQKPKUS = isset($urlParams['REQKPKUS']) ? $urlParams['REQKPKUS'] : 'WebUser';
|
||||||
$CO = isset($urlParams['CO']) ? $urlParams['CO'] : '';
|
$CO = isset($urlParams['CO']) ? $urlParams['CO'] : '';
|
||||||
$WHS = isset($urlParams['WHS']) ? $urlParams['WHS'] : '';
|
$WHS = isset($urlParams['WHS']) ? $urlParams['WHS'] : '';
|
||||||
$MACPKR = isset($urlParams['MACPKR']) ? $urlParams['MACPKR'] : '000000'; // Delivery Number
|
$MACPKR = isset($urlParams['MACPKR']) ? $urlParams['MACPKR'] : self::ZERO_PAD; // Delivery Number
|
||||||
$PKLN = isset($urlParams['PKLN']) ? $urlParams['PKLN'] : '';
|
$PKLN = isset($urlParams['PKLN']) ? $urlParams['PKLN'] : '';
|
||||||
|
|
||||||
if ($urlParams != '') {
|
if ($urlParams != '') {
|
||||||
@@ -228,11 +232,11 @@ class M3InventoryReport extends Controller
|
|||||||
$token = $IonToken;
|
$token = $IonToken;
|
||||||
|
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'accept' => 'application/json',
|
'accept' => self::JSON_CONTENT_TYPE,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||||
])
|
])
|
||||||
->withToken($token)
|
->withToken($token)
|
||||||
->withBody($JSON, 'application/json')
|
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||||
->timeout(Config::get('arrays.curlTimeOut'))
|
->timeout(Config::get('arrays.curlTimeOut'))
|
||||||
->post($endPointURL);
|
->post($endPointURL);
|
||||||
|
|
||||||
@@ -248,7 +252,7 @@ class M3InventoryReport extends Controller
|
|||||||
$responseArray = json_decode($JsonSanytized, true);
|
$responseArray = json_decode($JsonSanytized, true);
|
||||||
$responseTMP = $responseArray['result'];
|
$responseTMP = $responseArray['result'];
|
||||||
} else {
|
} else {
|
||||||
$M3Errors = 'Error: No Response from M3';
|
$M3Errors = self::NO_M3_RESPONSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate response From M3
|
// Validate response From M3
|
||||||
@@ -262,7 +266,7 @@ class M3InventoryReport extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'code' => '405',
|
'code' => '405',
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
'message' => 'Error: No Response from M3',
|
'message' => self::NO_M3_RESPONSE,
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs : JSON
|
// Write to Logs : JSON
|
||||||
@@ -366,7 +370,7 @@ class M3InventoryReport extends Controller
|
|||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => 'No Records Found in ICM688M2', 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
'SHDATA' => 'No Records Found in ICM688M2', 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
@@ -381,7 +385,7 @@ class M3InventoryReport extends Controller
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => 'No URL Parameters Sent', 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
'SHDATA' => 'No URL Parameters Sent', 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
@@ -395,7 +399,7 @@ class M3InventoryReport extends Controller
|
|||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||||
$getCurlErrors = str_contains($th->getMessage(), 'cURL error');
|
$getCurlErrors = str_contains($th->getMessage(), 'cURL error');
|
||||||
if ($getCurlErrors) {
|
if ($getCurlErrors) {
|
||||||
// dd($getCurlErrors);
|
// dd($getCurlErrors);
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ use Str;
|
|||||||
|
|
||||||
class PdfStorage extends Controller
|
class PdfStorage extends Controller
|
||||||
{
|
{
|
||||||
|
private const ZERO_PAD = '000000';
|
||||||
|
|
||||||
// PdfStorageAPI : PDF file read and save to Cache
|
// PdfStorageAPI : PDF file read and save to Cache
|
||||||
public function PdfStorageAPI(Request $request)
|
public function PdfStorageAPI(Request $request)
|
||||||
{
|
{
|
||||||
@@ -41,8 +43,8 @@ class PdfStorage extends Controller
|
|||||||
if ($urlParams != '') {
|
if ($urlParams != '') {
|
||||||
// Key Combination : COMPANY WHS A4MACPKR DOCTYPE DOCNUM
|
// Key Combination : COMPANY WHS A4MACPKR DOCTYPE DOCNUM
|
||||||
// Document type (PackingList, CarrierLabel, ContentLabel)
|
// Document type (PackingList, CarrierLabel, ContentLabel)
|
||||||
$DELIVERYNO = isset($A4MACPKR) ? $A4MACPKR : '000000';
|
$DELIVERYNO = isset($A4MACPKR) ? $A4MACPKR : self::ZERO_PAD;
|
||||||
$DELIVERYNO = $DELIVERYNO != '' && $DELIVERYNO != null ? $DELIVERYNO : '000000';
|
$DELIVERYNO = $DELIVERYNO != '' && $DELIVERYNO != null ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
// Write to Logs : Params In
|
// Write to Logs : Params In
|
||||||
$IncomingParams = ['COMPANY' => $COMPANY, 'WHS' => $WHS, 'DOCTYPE' => $DOCTYPE, 'FILENAME' => $FILENAME, 'A4MACPKR' => $A4MACPKR, 'DOCNUM' => $DOCNUM];
|
$IncomingParams = ['COMPANY' => $COMPANY, 'WHS' => $WHS, 'DOCTYPE' => $DOCTYPE, 'FILENAME' => $FILENAME, 'A4MACPKR' => $A4MACPKR, 'DOCNUM' => $DOCNUM];
|
||||||
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => '', 'SHINTBOX' => $DOCNUM, 'SHTYPE' => 'M3-Req-out',
|
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => '', 'SHINTBOX' => $DOCNUM, 'SHTYPE' => 'M3-Req-out',
|
||||||
@@ -127,7 +129,7 @@ class PdfStorage extends Controller
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => 'No URL Parameters Sent.', 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $COMPANY, 'SHWHS' => $WHS];
|
'SHDATA' => 'No URL Parameters Sent.', 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $COMPANY, 'SHWHS' => $WHS];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
@@ -143,7 +145,7 @@ class PdfStorage extends Controller
|
|||||||
// Log::error($th);
|
// Log::error($th);
|
||||||
|
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => 'An Error Occured - ' . substr($th, 0, 300), 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $COMPANY, 'SHWHS' => $WHS];
|
'SHDATA' => 'An Error Occured - ' . substr($th, 0, 300), 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $COMPANY, 'SHWHS' => $WHS];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ use Str;
|
|||||||
|
|
||||||
class ReplenAPI extends Controller
|
class ReplenAPI extends Controller
|
||||||
{
|
{
|
||||||
|
private const ZERO_PAD = '000000';
|
||||||
|
private const JSON_CONTENT_TYPE = 'application/json';
|
||||||
|
|
||||||
// M3Replenishement with URL Params
|
// M3Replenishement with URL Params
|
||||||
public function M3InventoryReportReplen(Request $request)
|
public function M3InventoryReportReplen(Request $request)
|
||||||
{
|
{
|
||||||
@@ -25,7 +28,7 @@ class ReplenAPI extends Controller
|
|||||||
// Log::info( $request->all() );
|
// Log::info( $request->all() );
|
||||||
// Get The Calling User
|
// Get The Calling User
|
||||||
$SHUSER = m3_user() !== '' ? Str::upper(m3_user()) : 'WebUser';
|
$SHUSER = m3_user() !== '' ? Str::upper(m3_user()) : 'WebUser';
|
||||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||||
$SHSOURCE = 'M3InventoryReportReplen';
|
$SHSOURCE = 'M3InventoryReportReplen';
|
||||||
$M3Errors = '';
|
$M3Errors = '';
|
||||||
|
|
||||||
@@ -83,11 +86,11 @@ class ReplenAPI extends Controller
|
|||||||
$token = $IonToken;
|
$token = $IonToken;
|
||||||
|
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'accept' => 'application/json',
|
'accept' => self::JSON_CONTENT_TYPE,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||||
])
|
])
|
||||||
->withToken($token)
|
->withToken($token)
|
||||||
->withBody($JSON, 'application/json')
|
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||||
->timeout(Config::get('arrays.curlTimeOut'))
|
->timeout(Config::get('arrays.curlTimeOut'))
|
||||||
->retry(3, 100)
|
->retry(3, 100)
|
||||||
->post($endPointURL);
|
->post($endPointURL);
|
||||||
@@ -226,7 +229,7 @@ class ReplenAPI extends Controller
|
|||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => 'No URL Parameters Sent', 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
'SHDATA' => 'No URL Parameters Sent', 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
||||||
Helper::logToICM699M($data);
|
Helper::logToICM699M($data);
|
||||||
@@ -240,7 +243,7 @@ class ReplenAPI extends Controller
|
|||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||||
|
|
||||||
$getCurlErrors = str_contains($th->getMessage(), 'cURL error');
|
$getCurlErrors = str_contains($th->getMessage(), 'cURL error');
|
||||||
if ($getCurlErrors) {
|
if ($getCurlErrors) {
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ use Str;
|
|||||||
|
|
||||||
class TransferAPI extends Controller
|
class TransferAPI extends Controller
|
||||||
{
|
{
|
||||||
|
private const ZERO_PAD = '000000';
|
||||||
|
private const JSON_CONTENT_TYPE = 'application/json';
|
||||||
|
private const ORDER_CATEGORY_LABEL = ' Order Category: ';
|
||||||
|
private const NO_URL_PARAMETERS = 'No URL Parameters Sent';
|
||||||
|
|
||||||
// TransferAPIURL : with URL PARAMS
|
// TransferAPIURL : with URL PARAMS
|
||||||
public function TransferAPIURL(Request $request)
|
public function TransferAPIURL(Request $request)
|
||||||
{
|
{
|
||||||
@@ -44,7 +49,7 @@ class TransferAPI extends Controller
|
|||||||
$LOTNUMBER = isset($urlParams['LOTNUMBER']) ? $urlParams['LOTNUMBER'] : '';
|
$LOTNUMBER = isset($urlParams['LOTNUMBER']) ? $urlParams['LOTNUMBER'] : '';
|
||||||
$CONUMBER = isset($urlParams['CONUMBER']) ? $urlParams['CONUMBER'] : '';
|
$CONUMBER = isset($urlParams['CONUMBER']) ? $urlParams['CONUMBER'] : '';
|
||||||
$COLINENO = isset($urlParams['COLINENO']) ? $urlParams['COLINENO'] : '';
|
$COLINENO = isset($urlParams['COLINENO']) ? $urlParams['COLINENO'] : '';
|
||||||
$DELIVERYNO = isset($urlParams['DELIVERYNO']) ? $urlParams['DELIVERYNO'] : '000000';
|
$DELIVERYNO = isset($urlParams['DELIVERYNO']) ? $urlParams['DELIVERYNO'] : self::ZERO_PAD;
|
||||||
$PICKLISTSUFFIX = isset($urlParams['PICKLISTSUFFIX']) ? $urlParams['PICKLISTSUFFIX'] : '';
|
$PICKLISTSUFFIX = isset($urlParams['PICKLISTSUFFIX']) ? $urlParams['PICKLISTSUFFIX'] : '';
|
||||||
$ENDFLAG = isset($urlParams['ENDFLAG']) ? $urlParams['ENDFLAG'] : '';
|
$ENDFLAG = isset($urlParams['ENDFLAG']) ? $urlParams['ENDFLAG'] : '';
|
||||||
$TYPE = isset($urlParams['TYPE']) ? $urlParams['TYPE'] : '';
|
$TYPE = isset($urlParams['TYPE']) ? $urlParams['TYPE'] : '';
|
||||||
@@ -65,7 +70,7 @@ class TransferAPI extends Controller
|
|||||||
// 5 = Distribution Order
|
// 5 = Distribution Order
|
||||||
// 9 = Move order
|
// 9 = Move order
|
||||||
|
|
||||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
|
|
||||||
$TRANSTYPE = isset($urlParams['TRANSTYPE']) ? $urlParams['TRANSTYPE'] : ''; // R for Retry
|
$TRANSTYPE = isset($urlParams['TRANSTYPE']) ? $urlParams['TRANSTYPE'] : ''; // R for Retry
|
||||||
$SHDT = isset($urlParams['SHDT']) ? $urlParams['SHDT'] : '';
|
$SHDT = isset($urlParams['SHDT']) ? $urlParams['SHDT'] : '';
|
||||||
@@ -129,7 +134,7 @@ class TransferAPI extends Controller
|
|||||||
$LOTNUMBER = isset($JSONTR->LOTNUMBER) ? $JSONTR->LOTNUMBER : '';
|
$LOTNUMBER = isset($JSONTR->LOTNUMBER) ? $JSONTR->LOTNUMBER : '';
|
||||||
$CONUMBER = isset($JSONTR->CONUMBER) ? $JSONTR->CONUMBER : '';
|
$CONUMBER = isset($JSONTR->CONUMBER) ? $JSONTR->CONUMBER : '';
|
||||||
$COLINENO = isset($JSONTR->COLINENO) ? $JSONTR->COLINENO : '';
|
$COLINENO = isset($JSONTR->COLINENO) ? $JSONTR->COLINENO : '';
|
||||||
$DELIVERYNO = isset($JSONTR->DELIVERYNO) ? $JSONTR->DELIVERYNO : '000000';
|
$DELIVERYNO = isset($JSONTR->DELIVERYNO) ? $JSONTR->DELIVERYNO : self::ZERO_PAD;
|
||||||
$PICKLISTSUFFIX = isset($JSONTR->PICKLISTSUFFIX) ? $JSONTR->PICKLISTSUFFIX : '';
|
$PICKLISTSUFFIX = isset($JSONTR->PICKLISTSUFFIX) ? $JSONTR->PICKLISTSUFFIX : '';
|
||||||
$ENDFLAG = isset($JSONTR->ENDFLAG) ? $JSONTR->ENDFLAG : '';
|
$ENDFLAG = isset($JSONTR->ENDFLAG) ? $JSONTR->ENDFLAG : '';
|
||||||
$TYPE = isset($JSONTR->TYPE) ? $JSONTR->TYPE : '';
|
$TYPE = isset($JSONTR->TYPE) ? $JSONTR->TYPE : '';
|
||||||
@@ -255,11 +260,11 @@ class TransferAPI extends Controller
|
|||||||
$token = $IonToken;
|
$token = $IonToken;
|
||||||
|
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'accept' => 'application/json',
|
'accept' => self::JSON_CONTENT_TYPE,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||||
])
|
])
|
||||||
->withToken($token)
|
->withToken($token)
|
||||||
->withBody($JSON, 'application/json')
|
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||||
->timeout(Config::get('arrays.curlTimeOut'))
|
->timeout(Config::get('arrays.curlTimeOut'))
|
||||||
->post($endPointURL);
|
->post($endPointURL);
|
||||||
$responseStatusCode = $response->getStatusCode();
|
$responseStatusCode = $response->getStatusCode();
|
||||||
@@ -294,7 +299,7 @@ class TransferAPI extends Controller
|
|||||||
'SHERROR' => '',
|
'SHERROR' => '',
|
||||||
'SHINTBOX' => '',
|
'SHINTBOX' => '',
|
||||||
'SHTYPE' => 'M3-Res-out',
|
'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => $responseStatusCode . 'TYPE :' . $TYPE . ' Order Category: ' . $ORDERCATEGORY . '-' . $M3JSONResponse . $M3SessionId . $M3ResponseTime . $M3transferTime,
|
'SHDATA' => $responseStatusCode . 'TYPE :' . $TYPE . self::ORDER_CATEGORY_LABEL . $ORDERCATEGORY . '-' . $M3JSONResponse . $M3SessionId . $M3ResponseTime . $M3transferTime,
|
||||||
'SHUSER' => $SHUSER,
|
'SHUSER' => $SHUSER,
|
||||||
'SHSOURCE' => $SHSOURCE,
|
'SHSOURCE' => $SHSOURCE,
|
||||||
'SHCO' => $DIVI,
|
'SHCO' => $DIVI,
|
||||||
@@ -334,7 +339,7 @@ class TransferAPI extends Controller
|
|||||||
'SHERROR' => 'X',
|
'SHERROR' => 'X',
|
||||||
'SHINTBOX' => '',
|
'SHINTBOX' => '',
|
||||||
'SHTYPE' => 'M3-Res-out',
|
'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => $responseStatusCode . '-' . $M3Errors . '-TYPE:' . $TYPE . ' Order Category: ' . $ORDERCATEGORY . '-' . $M3JSONResponse .
|
'SHDATA' => $responseStatusCode . '-' . $M3Errors . '-TYPE:' . $TYPE . self::ORDER_CATEGORY_LABEL . $ORDERCATEGORY . '-' . $M3JSONResponse .
|
||||||
'M3-JSN-out' . $JSONIN . $M3SessionId . $M3ResponseTime . $M3transferTime,
|
'M3-JSN-out' . $JSONIN . $M3SessionId . $M3ResponseTime . $M3transferTime,
|
||||||
'SHUSER' => $SHUSER,
|
'SHUSER' => $SHUSER,
|
||||||
'SHSOURCE' => $SHSOURCE,
|
'SHSOURCE' => $SHSOURCE,
|
||||||
@@ -346,7 +351,7 @@ class TransferAPI extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'code' => '206',
|
'code' => '206',
|
||||||
'status' => 'Error',
|
'status' => 'Error',
|
||||||
'message' => $responseStatusCode . '-' . $M3Errors . '- TYPE :' . $TYPE . ' Order Category: ' . $ORDERCATEGORY . '-' . $M3JSONResponse,
|
'message' => $responseStatusCode . '-' . $M3Errors . '- TYPE :' . $TYPE . self::ORDER_CATEGORY_LABEL . $ORDERCATEGORY . '-' . $M3JSONResponse,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,14 +366,14 @@ class TransferAPI extends Controller
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $DELIVERYNO,
|
$data = ['SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
'SHTIME' => date('H:i:s'),
|
'SHTIME' => date('H:i:s'),
|
||||||
'SHERROR' => 'X',
|
'SHERROR' => 'X',
|
||||||
'SHINTBOX' => '',
|
'SHINTBOX' => '',
|
||||||
'SHTYPE' => 'M3-Res-out',
|
'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => 'No URL Parameters Sent',
|
'SHDATA' => self::NO_URL_PARAMETERS,
|
||||||
'SHUSER' => $SHUSER,
|
'SHUSER' => $SHUSER,
|
||||||
'SHSOURCE' => $SHSOURCE,
|
'SHSOURCE' => $SHSOURCE,
|
||||||
'SHCO' => $DIVI,
|
'SHCO' => $DIVI,
|
||||||
@@ -380,7 +385,7 @@ class TransferAPI extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'code' => '405',
|
'code' => '405',
|
||||||
'status' => 'Error',
|
'status' => 'Error',
|
||||||
'message' => 'No URL Parameters Sent',
|
'message' => self::NO_URL_PARAMETERS,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
@@ -409,7 +414,7 @@ class TransferAPI extends Controller
|
|||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $DELIVERYNO,
|
$data = ['SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
'SHTIME' => date('H:i:s'),
|
'SHTIME' => date('H:i:s'),
|
||||||
@@ -545,11 +550,11 @@ class TransferAPI extends Controller
|
|||||||
$token = $IonToken;
|
$token = $IonToken;
|
||||||
|
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'accept' => 'application/json',
|
'accept' => self::JSON_CONTENT_TYPE,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||||
])
|
])
|
||||||
->withToken($token)
|
->withToken($token)
|
||||||
->withBody($JSON, 'application/json')
|
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||||
->timeout(Config::get('arrays.curlTimeOut'))
|
->timeout(Config::get('arrays.curlTimeOut'))
|
||||||
->post($endPointURL);
|
->post($endPointURL);
|
||||||
$responseStatusCode = $response->getStatusCode();
|
$responseStatusCode = $response->getStatusCode();
|
||||||
@@ -628,14 +633,14 @@ class TransferAPI extends Controller
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $DELIVERYNO,
|
$data = ['SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
'SHTIME' => date('H:i:s'),
|
'SHTIME' => date('H:i:s'),
|
||||||
'SHERROR' => 'X',
|
'SHERROR' => 'X',
|
||||||
'SHINTBOX' => '',
|
'SHINTBOX' => '',
|
||||||
'SHTYPE' => 'M3-Res-out',
|
'SHTYPE' => 'M3-Res-out',
|
||||||
'SHDATA' => 'No URL Parameters Sent',
|
'SHDATA' => self::NO_URL_PARAMETERS,
|
||||||
'SHUSER' => $SHUSER,
|
'SHUSER' => $SHUSER,
|
||||||
'SHSOURCE' => $SHSOURCE,
|
'SHSOURCE' => $SHSOURCE,
|
||||||
'SHCO' => $DIVI,
|
'SHCO' => $DIVI,
|
||||||
@@ -647,7 +652,7 @@ class TransferAPI extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'code' => '405',
|
'code' => '405',
|
||||||
'status' => 'Error',
|
'status' => 'Error',
|
||||||
'message' => 'No URL Parameters Sent',
|
'message' => self::NO_URL_PARAMETERS,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
@@ -676,7 +681,7 @@ class TransferAPI extends Controller
|
|||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Write to Logs Out : Error
|
// Write to Logs Out : Error
|
||||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||||
$data = ['SHMACPKR' => $DELIVERYNO,
|
$data = ['SHMACPKR' => $DELIVERYNO,
|
||||||
'SHDT' => date('Y-m-d'),
|
'SHDT' => date('Y-m-d'),
|
||||||
'SHTIME' => date('H:i:s'),
|
'SHTIME' => date('H:i:s'),
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ use Str;
|
|||||||
|
|
||||||
class BoxPackToPalletController extends Controller
|
class BoxPackToPalletController extends Controller
|
||||||
{
|
{
|
||||||
|
private const PALLET_TABLE_ALIAS = 'ICM659M as p';
|
||||||
|
private const CONVEYOR_SELECT = 'cnv.R652SORTK as CONVEYOR_NAME';
|
||||||
|
private const CARTON_TABLE_ALIAS = 'ICM695M1 as c';
|
||||||
|
private const CONVEYOR_VALUE_ALIAS = 'ICM688M1 as cv';
|
||||||
|
private const CONVEYOR_TABLE_ALIAS = 'ICM652M as cnv';
|
||||||
|
|
||||||
public static function index(Request $request)
|
public static function index(Request $request)
|
||||||
{
|
{
|
||||||
return view('m3::liberty-theme.pages.BoxPackToPallet');
|
return view('m3::liberty-theme.pages.BoxPackToPallet');
|
||||||
@@ -21,7 +27,7 @@ class BoxPackToPalletController extends Controller
|
|||||||
$userWhsCoPlant = self::getUserWhsCoPlant();
|
$userWhsCoPlant = self::getUserWhsCoPlant();
|
||||||
// dump($userWhsCoPlant);
|
// dump($userWhsCoPlant);
|
||||||
|
|
||||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table('ICM659M as p')
|
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table(self::PALLET_TABLE_ALIAS)
|
||||||
->select(
|
->select(
|
||||||
'p.R659PALT',
|
'p.R659PALT',
|
||||||
'p.R659BOX',
|
'p.R659BOX',
|
||||||
@@ -33,11 +39,11 @@ class BoxPackToPalletController extends Controller
|
|||||||
'c.AYSPR15A01',
|
'c.AYSPR15A01',
|
||||||
'cv.A4APR8N001',
|
'cv.A4APR8N001',
|
||||||
'cv.A4SHSHCT',
|
'cv.A4SHSHCT',
|
||||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
self::CONVEYOR_SELECT,
|
||||||
)
|
)
|
||||||
->leftJoin('ICM695M1 as c', 'p.R659BOX', '=', 'c.AYINTBOX')
|
->leftJoin(self::CARTON_TABLE_ALIAS, 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||||
->where('p.R659PALT', $R659PALT)
|
->where('p.R659PALT', $R659PALT)
|
||||||
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
||||||
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
||||||
@@ -90,17 +96,17 @@ class BoxPackToPalletController extends Controller
|
|||||||
|
|
||||||
// Step 2: Check if Box exists in ICM695M1 (with carrier + conveyor joined)
|
// Step 2: Check if Box exists in ICM695M1 (with carrier + conveyor joined)
|
||||||
$ICM695M1Sel = DB::connection(config('m3.connection', 'pgsql'))
|
$ICM695M1Sel = DB::connection(config('m3.connection', 'pgsql'))
|
||||||
->table('ICM695M1 as c')
|
->table(self::CARTON_TABLE_ALIAS)
|
||||||
->select(
|
->select(
|
||||||
'c.AYINTBOX',
|
'c.AYINTBOX',
|
||||||
'c.AYSPR15A01',
|
'c.AYSPR15A01',
|
||||||
'c.AYTYPE',
|
'c.AYTYPE',
|
||||||
'c.AYMACPKR',
|
'c.AYMACPKR',
|
||||||
'cv.A4APR8N001',
|
'cv.A4APR8N001',
|
||||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
self::CONVEYOR_SELECT,
|
||||||
)
|
)
|
||||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||||
->where('c.AYINTBOX', $R659BOX)
|
->where('c.AYINTBOX', $R659BOX)
|
||||||
->where('c.AYCO', trim($userWhsCoPlant['USERCO']))
|
->where('c.AYCO', trim($userWhsCoPlant['USERCO']))
|
||||||
->where('c.AYWHS', trim($userWhsCoPlant['USERWHS']))
|
->where('c.AYWHS', trim($userWhsCoPlant['USERWHS']))
|
||||||
@@ -123,14 +129,14 @@ class BoxPackToPalletController extends Controller
|
|||||||
// Step 3: Check that all boxes on the pallet share the same Carrier and Conveyor
|
// Step 3: Check that all boxes on the pallet share the same Carrier and Conveyor
|
||||||
if ($boxExistInICM695M && ! $boxisPalletICM695M && ! $exists) {
|
if ($boxExistInICM695M && ! $boxisPalletICM695M && ! $exists) {
|
||||||
$firstPalletBox = DB::connection(config('m3.connection', 'pgsql'))
|
$firstPalletBox = DB::connection(config('m3.connection', 'pgsql'))
|
||||||
->table('ICM659M as p')
|
->table(self::PALLET_TABLE_ALIAS)
|
||||||
->select(
|
->select(
|
||||||
'c.AYSPR15A01',
|
'c.AYSPR15A01',
|
||||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
self::CONVEYOR_SELECT,
|
||||||
)
|
)
|
||||||
->leftJoin('ICM695M1 as c', 'p.R659BOX', '=', 'c.AYINTBOX')
|
->leftJoin(self::CARTON_TABLE_ALIAS, 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||||
->where('p.R659PALT', $R659PALT)
|
->where('p.R659PALT', $R659PALT)
|
||||||
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
||||||
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
||||||
@@ -178,7 +184,7 @@ class BoxPackToPalletController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Step 5: Return the full refreshed box list
|
// Step 5: Return the full refreshed box list
|
||||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table('ICM659M as p')
|
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table(self::PALLET_TABLE_ALIAS)
|
||||||
->select(
|
->select(
|
||||||
'p.R659PALT',
|
'p.R659PALT',
|
||||||
'p.R659BOX',
|
'p.R659BOX',
|
||||||
@@ -190,11 +196,11 @@ class BoxPackToPalletController extends Controller
|
|||||||
'c.AYSPR15A01',
|
'c.AYSPR15A01',
|
||||||
'cv.A4APR8N001',
|
'cv.A4APR8N001',
|
||||||
'cv.A4SHSHCT',
|
'cv.A4SHSHCT',
|
||||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
self::CONVEYOR_SELECT,
|
||||||
)
|
)
|
||||||
->leftJoin('ICM695M1 as c', 'p.R659BOX', '=', 'c.AYINTBOX')
|
->leftJoin(self::CARTON_TABLE_ALIAS, 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||||
->where('p.R659PALT', $R659PALT)
|
->where('p.R659PALT', $R659PALT)
|
||||||
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
||||||
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
||||||
@@ -249,7 +255,7 @@ class BoxPackToPalletController extends Controller
|
|||||||
->delete();
|
->delete();
|
||||||
|
|
||||||
// Return refreshed list
|
// Return refreshed list
|
||||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table('ICM659M as p')
|
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table(self::PALLET_TABLE_ALIAS)
|
||||||
->select(
|
->select(
|
||||||
'p.R659PALT',
|
'p.R659PALT',
|
||||||
'p.R659BOX',
|
'p.R659BOX',
|
||||||
@@ -261,11 +267,11 @@ class BoxPackToPalletController extends Controller
|
|||||||
'c.AYSPR15A01',
|
'c.AYSPR15A01',
|
||||||
'cv.A4APR8N001',
|
'cv.A4APR8N001',
|
||||||
'cv.A4SHSHCT',
|
'cv.A4SHSHCT',
|
||||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
self::CONVEYOR_SELECT,
|
||||||
)
|
)
|
||||||
->leftJoin('ICM695M1 as c', 'p.R659BOX', '=', 'c.AYINTBOX')
|
->leftJoin(self::CARTON_TABLE_ALIAS, 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||||
->where('p.R659PALT', $R659PALT)
|
->where('p.R659PALT', $R659PALT)
|
||||||
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
||||||
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ use Str;
|
|||||||
|
|
||||||
class OrderLinesOfClosedOrder extends Controller
|
class OrderLinesOfClosedOrder extends Controller
|
||||||
{
|
{
|
||||||
|
private const XLSX_EXTENSION = '.xlsx';
|
||||||
|
|
||||||
public static function index(Request $request)
|
public static function index(Request $request)
|
||||||
{
|
{
|
||||||
$IC670M = $ICM688M2 = [];
|
$IC670M = $ICM688M2 = [];
|
||||||
@@ -202,7 +204,7 @@ class OrderLinesOfClosedOrder extends Controller
|
|||||||
|
|
||||||
// Download Excel
|
// Download Excel
|
||||||
// Add true at the end to include fields names in the Header
|
// Add true at the end to include fields names in the Header
|
||||||
return app(SpreadsheetExport::class)->download($ICM688M2Col, 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '.xlsx');
|
return app(SpreadsheetExport::class)->download($ICM688M2Col, 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . self::XLSX_EXTENSION);
|
||||||
// return $ICM688M2Col->downloadExcel('Closedorderlinesreport_'.$reportDateWD.'-'.$toreportDateWD.'.csv',\Maatwebsite\Excel\Excel::CSV,false);
|
// return $ICM688M2Col->downloadExcel('Closedorderlinesreport_'.$reportDateWD.'-'.$toreportDateWD.'.csv',\Maatwebsite\Excel\Excel::CSV,false);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
Log::error($th);
|
Log::error($th);
|
||||||
@@ -302,9 +304,9 @@ class OrderLinesOfClosedOrder extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($WHS == '321') {
|
if ($WHS == '321') {
|
||||||
$prevMonthFile = 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '.xlsx';
|
$prevMonthFile = 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . self::XLSX_EXTENSION;
|
||||||
} else {
|
} else {
|
||||||
$prevMonthFile = $WHS . '/Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '-' . $WHS . '.xlsx';
|
$prevMonthFile = $WHS . '/Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '-' . $WHS . self::XLSX_EXTENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MAK Store the File to Storage
|
// MAK Store the File to Storage
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ use Str;
|
|||||||
|
|
||||||
class execSummaryLineController extends Controller
|
class execSummaryLineController extends Controller
|
||||||
{
|
{
|
||||||
|
private const FIRST_DAY_THIS_MONTH = 'first day of this month';
|
||||||
|
private const LAST_DAY_THIS_MONTH = 'last day of this month';
|
||||||
|
private const ONE_YEAR_AGO = '-1 year';
|
||||||
|
|
||||||
public static function index(Request $request)
|
public static function index(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -82,12 +86,12 @@ class execSummaryLineController extends Controller
|
|||||||
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : null;
|
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : null;
|
||||||
|
|
||||||
$lastDay = (clone $firstDay);
|
$lastDay = (clone $firstDay);
|
||||||
$reportDate = $firstDay->modify('-11 months')->modify('first day of this month')->format('Ymd'); //
|
$reportDate = $firstDay->modify('-11 months')->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd'); //
|
||||||
$toreportDate = $lastDay ? $lastDay->modify('last day of this month')->format('Ymd') : '';
|
$toreportDate = $lastDay ? $lastDay->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd') : '';
|
||||||
// Last Year Dates
|
// Last Year Dates
|
||||||
// Same period, but for Last Year (LY)
|
// Same period, but for Last Year (LY)
|
||||||
$reportDateLY = (clone $firstDay)->modify('-1 year')->modify('first day of this month')->format('Ymd');
|
$reportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
|
||||||
$toreportDateLY = (clone $lastDay)->modify('-1 year')->modify('last day of this month')->format('Ymd');
|
$toreportDateLY = (clone $lastDay)->modify(self::ONE_YEAR_AGO)->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
|
||||||
|
|
||||||
// Build SQL
|
// Build SQL
|
||||||
$selectContent = "with tempfile as (
|
$selectContent = "with tempfile as (
|
||||||
@@ -121,12 +125,12 @@ class execSummaryLineController extends Controller
|
|||||||
case 'custom':
|
case 'custom':
|
||||||
// Set Dates based on reportPeriod type
|
// Set Dates based on reportPeriod type
|
||||||
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : '';
|
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : '';
|
||||||
$reportDate = $firstDay->modify('first day of this month')->format('Ymd');
|
$reportDate = $firstDay->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
|
||||||
$toreportDate = $firstDay->modify('last day of this month')->format('Ymd');
|
$toreportDate = $firstDay->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
|
||||||
|
|
||||||
// Last Year Dates
|
// Last Year Dates
|
||||||
$reportDateLY = (clone $firstDay)->modify('-1 year')->modify('first day of this month')->format('Ymd');
|
$reportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
|
||||||
$toreportDateLY = (clone $firstDay)->modify('-1 year')->modify('last day of this month')->format('Ymd');
|
$toreportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
|
||||||
|
|
||||||
// Build SQL
|
// Build SQL
|
||||||
$selectContent = "with tempfile as (
|
$selectContent = "with tempfile as (
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ use Modules\M3\Services\PostgresProgramBridge;
|
|||||||
|
|
||||||
class userControlController extends Controller
|
class userControlController extends Controller
|
||||||
{
|
{
|
||||||
|
private const AUTH_FAILURE_MESSAGE = 'Could not connect due to wrong user or password.';
|
||||||
|
private const DATABASE_NOT_FOUND_MESSAGE = 'Database not found. Try WRKRDBDIRE to check.';
|
||||||
|
private const CONNECTION_ERROR_PREFIX = 'Could not connect. Error: ';
|
||||||
|
private const PROGRAM_ERROR_PREFIX = 'Error calling program. Code: ';
|
||||||
|
private const MESSAGE_SEPARATOR = ' Msg: ';
|
||||||
|
|
||||||
public static function index(Request $request)
|
public static function index(Request $request)
|
||||||
{
|
{
|
||||||
$connection = config('m3.connection', 'pgsql');
|
$connection = config('m3.connection', 'pgsql');
|
||||||
@@ -85,17 +91,17 @@ class userControlController extends Controller
|
|||||||
case 8001:
|
case 8001:
|
||||||
// "Authorization failure on distributed database connection attempt"
|
// "Authorization failure on distributed database connection attempt"
|
||||||
// Usually means a wrong DB2 user or password
|
// Usually means a wrong DB2 user or password
|
||||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||||
|
|
||||||
return 'error profile3';
|
return 'error profile3';
|
||||||
break;
|
break;
|
||||||
case 42705:
|
case 42705:
|
||||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||||
|
|
||||||
return 'error profile4';
|
return 'error profile4';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||||
|
|
||||||
return 'error profile5';
|
return 'error profile5';
|
||||||
break;
|
break;
|
||||||
@@ -112,7 +118,7 @@ class userControlController extends Controller
|
|||||||
// # $result = $conn->PgmCall(Config::get('eproconf.misc.PGM1'), Config::get('eproconf.misc.libname4'), $params, array(), array());
|
// # $result = $conn->PgmCall(Config::get('eproconf.misc.PGM1'), Config::get('eproconf.misc.libname4'), $params, array(), array());
|
||||||
$result = $conn->PgmCall('ICMUSRPRF', 'EWOBJ', $params, [], []);
|
$result = $conn->PgmCall('ICMUSRPRF', 'EWOBJ', $params, [], []);
|
||||||
if (! $result) {
|
if (! $result) {
|
||||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||||
|
|
||||||
// echo "<script>alert($PGMERRORS);</script>";
|
// echo "<script>alert($PGMERRORS);</script>";
|
||||||
return 'error profile2';
|
return 'error profile2';
|
||||||
@@ -200,13 +206,13 @@ class userControlController extends Controller
|
|||||||
case 8001:
|
case 8001:
|
||||||
// "Authorization failure on distributed database connection attempt"
|
// "Authorization failure on distributed database connection attempt"
|
||||||
// Usually means a wrong DB2 user or password
|
// Usually means a wrong DB2 user or password
|
||||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||||
break;
|
break;
|
||||||
case 42705:
|
case 42705:
|
||||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,7 +246,7 @@ class userControlController extends Controller
|
|||||||
$result = $conn->PgmCall('ICMCHGPRF', 'EWOBJ', $params, [], []);
|
$result = $conn->PgmCall('ICMCHGPRF', 'EWOBJ', $params, [], []);
|
||||||
|
|
||||||
if (! $result) {
|
if (! $result) {
|
||||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||||
// dump($PGMERRORS);
|
// dump($PGMERRORS);
|
||||||
echo "<script>alert($PGMERRORS);</script>";
|
echo "<script>alert($PGMERRORS);</script>";
|
||||||
|
|
||||||
@@ -302,13 +308,13 @@ class userControlController extends Controller
|
|||||||
case 8001:
|
case 8001:
|
||||||
// "Authorization failure on distributed database connection attempt"
|
// "Authorization failure on distributed database connection attempt"
|
||||||
// Usually means a wrong DB2 user or password
|
// Usually means a wrong DB2 user or password
|
||||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||||
break;
|
break;
|
||||||
case 42705:
|
case 42705:
|
||||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,7 +331,7 @@ class userControlController extends Controller
|
|||||||
// echo "<script>alert('After CHGUSRPRF');</script>";
|
// echo "<script>alert('After CHGUSRPRF');</script>";
|
||||||
|
|
||||||
if (! $result) {
|
if (! $result) {
|
||||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||||
dump($PGMERRORS);
|
dump($PGMERRORS);
|
||||||
echo "<script>alert($PGMERRORS);</script>";
|
echo "<script>alert($PGMERRORS);</script>";
|
||||||
|
|
||||||
|
|||||||
@@ -4,69 +4,54 @@ namespace Modules\M3\Http\Middleware;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class BasicAuth
|
class BasicAuth
|
||||||
{
|
{
|
||||||
/**
|
public function handle(Request $request, Closure $next): mixed
|
||||||
* Handle an incoming request.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param Closure $next
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function handle(Request $request, Closure $next)
|
|
||||||
{
|
{
|
||||||
|
$login = trim((string) m3_user());
|
||||||
|
$password = (string) m3_legacy_password();
|
||||||
|
|
||||||
// select md5 or crypt for $mode. md5 is for md5 encoded passwords, crypt is for passwords encoded using apache's httpasswd
|
if ($login !== '' && $this->checkPassword($login, $password, '%%SYSTEM%%')) {
|
||||||
$mode = 'crypt';
|
return $next($request);
|
||||||
if (! m3_user() !== '') {
|
|
||||||
$this->authenticate();
|
|
||||||
} else {
|
|
||||||
if ($this->check_pass(m3_user(), m3_legacy_password(), $mode, '%%SYSTEM%%')) {
|
|
||||||
return $next($request);
|
|
||||||
} else {
|
|
||||||
$this->authenticate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->unauthorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function check_pass($login, $password, $mode, $password_file)
|
private function checkPassword(string $login, string $password, string $passwordFile): bool
|
||||||
{
|
{
|
||||||
if (! $fh = fopen($password_file, 'r')) {
|
if (! is_readable($passwordFile)) {
|
||||||
exit('<P>Could Not Open Password File');
|
return false;
|
||||||
}
|
}
|
||||||
$match = 0;
|
|
||||||
while (! feof($fh)) {
|
$handle = fopen($passwordFile, 'rb');
|
||||||
$line = fgets($fh, 4096);
|
if ($handle === false) {
|
||||||
$from_file = explode(':', $line);
|
return false;
|
||||||
if ($from_file[0] == $login) {
|
}
|
||||||
if ($mode == 'crypt') {
|
|
||||||
$salt = substr($from_file[1], 0, 2);
|
try {
|
||||||
$user_pass = crypt($password, $salt);
|
while (($line = fgets($handle)) !== false) {
|
||||||
} elseif ($mode == 'md5') {
|
$parts = explode(':', trim($line), 2);
|
||||||
$user_pass = md5($password);
|
if (count($parts) !== 2 || ! hash_equals($parts[0], $login)) {
|
||||||
}
|
continue;
|
||||||
if (rtrim($from_file[1]) == $user_pass) {
|
|
||||||
$match = 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$storedHash = trim($parts[1]);
|
||||||
|
|
||||||
|
return $storedHash !== '' && password_verify($password, $storedHash);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fclose($handle);
|
||||||
}
|
}
|
||||||
if ($match) {
|
|
||||||
return 1;
|
return false;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
fclose($fh);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function authenticate()
|
private function unauthorized(): Response
|
||||||
{
|
{
|
||||||
header('WWW-Authenticate: Basic realm="RESTRICTED ACCESS"');
|
return response('INVALID USERNAME OR PASSWORD. ACCESS DENIED', 401)
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
->header('WWW-Authenticate', 'Basic realm="RESTRICTED ACCESS"');
|
||||||
echo '<h1>INVALID USERNAME OR PASSWORD. ACCESS DENIED<h1>';
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$selectedInvalidMessage = $selectedInvalidMessage;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -42,7 +44,7 @@ return [
|
|||||||
'distinct' => 'The :attribute field has a duplicate value.',
|
'distinct' => 'The :attribute field has a duplicate value.',
|
||||||
'email' => 'The :attribute must be a valid email address.',
|
'email' => 'The :attribute must be a valid email address.',
|
||||||
'ends_with' => 'The :attribute must end with one of the following: :values.',
|
'ends_with' => 'The :attribute must end with one of the following: :values.',
|
||||||
'exists' => 'The selected :attribute is invalid.',
|
'exists' => $selectedInvalidMessage,
|
||||||
'file' => 'The :attribute must be a file.',
|
'file' => 'The :attribute must be a file.',
|
||||||
'filled' => 'The :attribute field must have a value.',
|
'filled' => 'The :attribute field must have a value.',
|
||||||
'gt' => [
|
'gt' => [
|
||||||
@@ -58,7 +60,7 @@ return [
|
|||||||
'array' => 'The :attribute must have :value items or more.',
|
'array' => 'The :attribute must have :value items or more.',
|
||||||
],
|
],
|
||||||
'image' => 'The :attribute must be an image.',
|
'image' => 'The :attribute must be an image.',
|
||||||
'in' => 'The selected :attribute is invalid.',
|
'in' => $selectedInvalidMessage,
|
||||||
'in_array' => 'The :attribute field does not exist in :other.',
|
'in_array' => 'The :attribute field does not exist in :other.',
|
||||||
'integer' => 'The :attribute must be an integer.',
|
'integer' => 'The :attribute must be an integer.',
|
||||||
'ip' => 'The :attribute must be a valid IP address.',
|
'ip' => 'The :attribute must be a valid IP address.',
|
||||||
@@ -92,7 +94,7 @@ return [
|
|||||||
'array' => 'The :attribute must have at least :min items.',
|
'array' => 'The :attribute must have at least :min items.',
|
||||||
],
|
],
|
||||||
'multiple_of' => 'The :attribute must be a multiple of :value.',
|
'multiple_of' => 'The :attribute must be a multiple of :value.',
|
||||||
'not_in' => 'The selected :attribute is invalid.',
|
'not_in' => $selectedInvalidMessage,
|
||||||
'not_regex' => 'The :attribute format is invalid.',
|
'not_regex' => 'The :attribute format is invalid.',
|
||||||
'numeric' => 'The :attribute must be a number.',
|
'numeric' => 'The :attribute must be a number.',
|
||||||
'password' => 'The password is incorrect.',
|
'password' => 'The password is incorrect.',
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSyste
|
|||||||
Chart.defaults.global.defaultFontColor = '#292b2c';
|
Chart.defaults.global.defaultFontColor = '#292b2c';
|
||||||
|
|
||||||
// Area Chart Example
|
// Area Chart Example
|
||||||
var ctx = document.getElementById("myAreaChart");
|
let ctx = document.getElementById("myAreaChart");
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
var myLineChart = new Chart(ctx, {
|
let myLineChart = new Chart(ctx, {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: {
|
data: {
|
||||||
labels: ["Mar 1", "Mar 2", "Mar 3", "Mar 4", "Mar 5", "Mar 6", "Mar 7", "Mar 8", "Mar 9", "Mar 10", "Mar 11", "Mar 12", "Mar 13"],
|
labels: ["Mar 1", "Mar 2", "Mar 3", "Mar 4", "Mar 5", "Mar 6", "Mar 7", "Mar 8", "Mar 9", "Mar 10", "Mar 11", "Mar 12", "Mar 13"],
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSyste
|
|||||||
Chart.defaults.global.defaultFontColor = '#292b2c';
|
Chart.defaults.global.defaultFontColor = '#292b2c';
|
||||||
|
|
||||||
// Bar Chart Example
|
// Bar Chart Example
|
||||||
var ctx = document.getElementById("myBarChart");
|
let ctx = document.getElementById("myBarChart");
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
var myLineChart = new Chart(ctx, {
|
let myLineChart = new Chart(ctx, {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {
|
data: {
|
||||||
labels: ["January", "February", "March", "April", "May", "June"],
|
labels: ["January", "February", "March", "April", "May", "June"],
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSyste
|
|||||||
Chart.defaults.global.defaultFontColor = '#292b2c';
|
Chart.defaults.global.defaultFontColor = '#292b2c';
|
||||||
|
|
||||||
// Pie Chart Example
|
// Pie Chart Example
|
||||||
var ctx = document.getElementById("myPieChart");
|
let ctx = document.getElementById("myPieChart");
|
||||||
if (ctx){
|
if (ctx){
|
||||||
var myPieChart = new Chart(ctx, {
|
let myPieChart = new Chart(ctx, {
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
data: {
|
data: {
|
||||||
labels: ["Blue", "Red", "Yellow", "Green"],
|
labels: ["Blue", "Red", "Yellow", "Green"],
|
||||||
|
|||||||
@@ -100,14 +100,14 @@ $(function() {
|
|||||||
stripHtml: true
|
stripHtml: true
|
||||||
},
|
},
|
||||||
customize: function(xlsx,btnObj, tableInst) {
|
customize: function(xlsx,btnObj, tableInst) {
|
||||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
let sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||||
var cellIndexes = tableInst.cells(".bg-danger").indexes();
|
let cellIndexes = tableInst.cells(".bg-danger").indexes();
|
||||||
for (var i = 0; i < cellIndexes.length; i++) {
|
for (let i = 0; i < cellIndexes.length; i++) {
|
||||||
var cellIndex = cellIndexes[i];
|
let cellIndex = cellIndexes[i];
|
||||||
var tblRow = cellIndex['row']+3; // adjusted from 0 indexed
|
let tblRow = cellIndex['row']+3; // adjusted from 0 indexed
|
||||||
var tblCol = cellIndex['column']; // adjusted from 0 indexed
|
let tblCol = cellIndex['column']; // adjusted from 0 indexed
|
||||||
var xlCol = numberToLetters(tblCol);
|
let xlCol = numberToLetters(tblCol);
|
||||||
var excelCell = xlCol+tblRow;
|
let excelCell = xlCol+tblRow;
|
||||||
$('row c[r='+excelCell+']', sheet).attr( 's', '11' );
|
$('row c[r='+excelCell+']', sheet).attr( 's', '11' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
<div class="card mb-4 border-secondary h-100">
|
<div class="card mb-4 border-secondary h-100">
|
||||||
<div class="card-header fw-semibold d-flex justify-content-between align-items-center">
|
<div class="card-header fw-semibold d-flex justify-content-between align-items-center">
|
||||||
<span>Scan Box Barcode</span>
|
<span>Scan Box Barcode</span>
|
||||||
{{-- <span id="scan-alert" class="badge bg-danger d-none">Danger</span> --}}
|
{{-- <span id="scan-alert-badge" class="badge bg-danger d-none">Danger</span> --}}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body py-2">
|
<div class="card-body py-2">
|
||||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- <div id="scan-alert" class="d-none align-self-center"></div> --}}
|
{{-- <div id="scan-alert-1" class="d-none align-self-center"></div> --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -73,12 +73,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Add Modal -->
|
<!-- Add Modal -->
|
||||||
<div class="modal fade" id="addModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"
|
<div class="modal fade" id="addModal" tabindex="-1" aria-labelledby="addModalLabel" aria-hidden="true"
|
||||||
data-bs-backdrop="static">
|
data-bs-backdrop="static">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="exampleModalLabel">Add Record</h5>
|
<h5 class="modal-title" id="addModalLabel">Add Record</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<form class="needs-validation" id="addReplen" method="POST" action="{{ route("m3.replenishmentSettings.store") }}" enctype="multipart/form-data">
|
<form class="needs-validation" id="addReplen" method="POST" action="{{ route("m3.replenishmentSettings.store") }}" enctype="multipart/form-data">
|
||||||
@@ -156,12 +156,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Edit Modal -->
|
<!-- Edit Modal -->
|
||||||
<div class="modal fade" id="editModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"
|
<div class="modal fade" id="editModal" tabindex="-1" aria-labelledby="editModalLabel" aria-hidden="true"
|
||||||
data-bs-backdrop="static">
|
data-bs-backdrop="static">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="exampleModalLabel">Edit Record</h5>
|
<h5 class="modal-title" id="editModalLabel">Edit Record</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<form class="needs-validation" id="editReplen" method="POST" action="replenishmentSettingsUpdate"
|
<form class="needs-validation" id="editReplen" method="POST" action="replenishmentSettingsUpdate"
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
|||||||
|
|
||||||
class SpreadsheetExport
|
class SpreadsheetExport
|
||||||
{
|
{
|
||||||
|
private const EXPORT_DIRECTORY = 'app/m3-exports/';
|
||||||
|
|
||||||
public function download(Collection $rows, string $filename): BinaryFileResponse
|
public function download(Collection $rows, string $filename): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$path = storage_path('app/m3-exports/' . uniqid('', true) . '-' . basename($filename));
|
$path = storage_path(self::EXPORT_DIRECTORY . uniqid('', true) . '-' . basename($filename));
|
||||||
$this->write($rows, $path);
|
$this->write($rows, $path);
|
||||||
|
|
||||||
return response()->download($path, basename($filename))->deleteFileAfterSend(true);
|
return response()->download($path, basename($filename))->deleteFileAfterSend(true);
|
||||||
@@ -20,7 +22,7 @@ class SpreadsheetExport
|
|||||||
|
|
||||||
public function store(Collection $rows, string $filename, ?string $disk = null): string
|
public function store(Collection $rows, string $filename, ?string $disk = null): string
|
||||||
{
|
{
|
||||||
$tmp = storage_path('app/m3-exports/' . uniqid('', true) . '-' . basename($filename));
|
$tmp = storage_path(self::EXPORT_DIRECTORY . uniqid('', true) . '-' . basename($filename));
|
||||||
$this->write($rows, $tmp);
|
$this->write($rows, $tmp);
|
||||||
|
|
||||||
if ($disk && config("filesystems.disks.$disk")) {
|
if ($disk && config("filesystems.disks.$disk")) {
|
||||||
@@ -45,7 +47,7 @@ class SpreadsheetExport
|
|||||||
$sheet->fromArray($array->map(fn ($row) => array_values($row))->all(), null, 'A1');
|
$sheet->fromArray($array->map(fn ($row) => array_values($row))->all(), null, 'A1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tmp = storage_path('app/m3-exports/' . uniqid('', true) . '-' . basename($filename));
|
$tmp = storage_path(self::EXPORT_DIRECTORY . uniqid('', true) . '-' . basename($filename));
|
||||||
if (! is_dir(dirname($tmp))) {
|
if (! is_dir(dirname($tmp))) {
|
||||||
mkdir(dirname($tmp), 0775, true);
|
mkdir(dirname($tmp), 0775, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user