Rodeo+New Script
Rodeo+New Script
// @name NewRodeo
// @namespace ORY1
// @version 20220602
// @updateURL https://drive.corp.amazon.com/view/ORY1Scripts/NewRodeo.user.js
// @downloadURL https://drive.corp.amazon.com/view/ORY1Scripts/NewRodeo.user.js
// @include https://rodeo-*.amazon.com/*/ItemList?*
// @include https://rodeo-*.amazon.com/*/Search?*
// @include https://rodeo-*.amazon.com/*/ExSD?*
// @require
https://drive.corp.amazon.com/view/ORY1Scripts/libs/jquery/3.2.1/jquery.min.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// ==/UserScript==
// ORY1 - [email protected]
// _______________________________________
//-------------------------------------------------------------
// Don't make any changes after this line
//-------------------------------------------------------------
$(document).ready(function () {
nrs_setup();
if (V.Action == 'ExSD'){ExSD();}
if (V.Action != 'ExSD'){noExSD();}
});
function ExSD(){
if (rodeoSettings.HighlightActivePP){
/*------------------------------
- Highlight Active Process Path
*/
if ($('#PickingNotYetPickedTable').length){
$('#PickingNotYetPickedTable tbody tr.header-row')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">In Scan</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">Pickers</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">Instant<br />Pick Rate</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">Instant<br />UPH</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">Batches<br />Active</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">Batch<br />Limit</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">Totes<br />Active</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">Tote<br />Limit</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">AutoFlow<br />Pick Rate Avg</th>')
.append('<th style="background-color:#f4c99c;min-width:50px;text-
align:center">AutoFlow<br />Pick TUR</th>');
$('#TotalTable tr:first').append('<th>State</th>');
$('#TotalTable tr:not(:first)').each(function(){
$(this).append('<td></td>');
});
if (rodeoSettings.UseNewConsole){
// New console
GM_xmlhttpRequest({
method: "GET",
url: "https://picking-console." + V.Region2 +
".picking.aft.a2z.com/api/fcs/" + V.FCname + "/process-paths/information",
headers: {
'Accept':'application/json',
'Content-Type':'application/json'
},
onload: function(response) {
var js = JSON.parse(response.responseText);
if (typeof js.status != 'undefined'){
if (js.status == '405'){
$('#nrs-info').html('<i class="nrs-warn"></i><a
href="https://picking-console.eu.picking.aft.a2z.com/fc/' + V.FCname + '/process-
paths" target="_blank">' + nrsl[V.BrowserLanguage]['e']['openpickpp'] + '</a>');
}
}
if (typeof js.processPathInformationMap != 'undefined'){
$.each(js.processPathInformationMap, function(ppName, obj){
var _ProcessPath = ppName.toLowerCase();
if (obj.Status == null){obj.Status = ''}
var _Status = obj.Status.toLowerCase();
if (_ProcessPath != ''){
if (_Status == 'active'){
$("th:contains('" + ppName + "')").css("background-color",
"#ccffbf").parent().css("background-color", "#ccffbf");
$('.tr_' + _ProcessPath).css("background-color", "#ccffbf");
$('.th_' + _ProcessPath).css("background-color", "#ccffbf");
$('.totes_' + _ProcessPath).text(obj.ToteCount);
$('.pickers_' + _ProcessPath).text(obj.PickerCount);
$('.pickrate_' +
_ProcessPath).text(Math.trunc(obj.UnitsPerHour/obj.PickerCount));
$('.uph_' + _ProcessPath).text(obj.UnitsPerHour);
$('.batches_' + _ProcessPath).text(obj.BatchCount);
$('.inscan_' + _ProcessPath).text(obj.UnitsInScanner);
}
$('#TotalTable tr').each(function() {
if ($.trim($(this).find('th:first').text()).toLowerCase() ==
_ProcessPath){
$(this).find('td:last').text(_Status);
}
});
}
});
GM_xmlhttpRequest({
method: "GET",
url: "https://process-path." + V.Region2 +
".picking.aft.a2z.com/api/processpath/" + V.FCname +
"/processPathWithUserSettingsList",
headers: {
'Accept':'application/json',
'Content-Type':'application/json'
},
onload: function(response) {
var js = JSON.parse(response.responseText);
if (typeof js.processPaths != 'undefined'){
$.each(js.processPaths, function(index, obj){
var _ProcessPath = obj.processPathName.toLowerCase();
$('.pra_' + _ProcessPath).text(obj.pickRateAverage);
$('.tur_' + _ProcessPath).text(obj.unitRateTarget);
$('.batchlimit_' +
_ProcessPath).text(obj.openBatchQuantityLimit);
$('.totelimit_' +
_ProcessPath).text(obj.containerQuantityLimit);
});
}
}
});
}
}
});
} else {
// old console
GM_xmlhttpRequest({
method: "GET",
url: "https://" + V.FCname + "-portal.amazon.com/gp/picking/processpaths-
new.html?pickProcessFilter=All_Pick_Processes",
headers: {'Content-Type': 'text/html; charset=utf-8'},
onload: function(response) {
$(response.responseText).find('#t1 tr').each(function(){
var ppName = $.trim($(this).find("td[title=' Process Path
']").text());
var _Status = $.trim($(this).find("td[title=' Status
']").text()).toLowerCase();
var _InScanner = $.trim($(this).find("td[title=' In Scanner
']").text());
var _Totes = $.trim($(this).find("td[title=' Totes ']").html());
var _Pickers = $.trim($(this).find("td[title=' Pickers ']").text());
var _UPH = $.trim($(this).find("td[title=' UPH ']").html());
var _UPT = $.trim($(this).find("td[title=' UPT ']").text());
var _ProcessPath = ppName.toLowerCase();
if (_ProcessPath != ''){
if (_Status == 'active'){
$("th:contains('" + ppName + "')").css("background-color",
"#ccffbf").parent().css("background-color", "#ccffbf");
$('.tr_' + _ProcessPath).css("background-color", "#ccffbf");
$('.th_' + _ProcessPath).css("background-color", "#ccffbf");
$('.inscan_' + _ProcessPath).text(_InScanner);
$('.totes_' + _ProcessPath).text(_Totes);
$('.pickers_' + _ProcessPath).text(_Pickers);
$('.uph_' + _ProcessPath).text(_UPH);
}
$('#TotalTable tr').each(function() {
if ($.trim($(this).find('th:first').text()).toLowerCase() ==
_ProcessPath){
$(this).find('td:last').text(_Status);
}
});
}
});
}
});
GM_xmlhttpRequest({
method: "GET",
url: "https://" + V.FCname +
"-portal.amazon.com/gp/picking/config/processPaths.html",
headers: {'Content-Type': 'text; charset=utf-8'},
onload: function(response) {
$(response.responseText).find('#t1 tr').each(function(){
var ppName = $.trim($(this).find("td[title=' Process Path
']").text());
var _Status = $.trim($(this).find("td[title=' Status
']").text()).toLowerCase();
var _TargetUnitRate = $.trim($(this).find("td[title=' Target Unit
Rate ']").html());
var _PickRateAve = $.trim($(this).find("td[title=' Pick Rate Ave
']").text());
var _BatchLimit = $.trim($(this).find("td[title=' Batch Limit
']").text());
var _ProcessPath = ppName.toLowerCase();
$('.pra_' + _ProcessPath).text(_PickRateAve);
$('.tur_' + _ProcessPath).text(_TargetUnitRate);
$('.batchlimit_' + _ProcessPath).text(_BatchLimit);
});
}
});
}
}
/*
- Highlight Process Path
------------------------------*/
}
} /* function ExSD() */
function noExSD(){
// Columns location
V.cols.OuScId = $(".result-table thead tr th:contains('" +
nrsl[V.BrowserLanguage]['colnames']['OuterScannableID'] + "')").index(".result-
table thead tr th") + 1;
V.cols.ScId = $(".result-table thead tr th:contains('" +
nrsl[V.BrowserLanguage]['colnames']['ScannableID'] + "')").index(".result-table
thead tr th") + 1;
V.cols.Co = $(".result-table thead tr th:contains('" +
nrsl[V.BrowserLanguage]['colnames']['Condition'] + "')").index(".result-table thead
tr th") + 1;
V.cols.ShId = $(".result-table thead tr th:contains('" +
nrsl[V.BrowserLanguage]['colnames']['ShipmentID'] + "')").index(".result-table
thead tr th") + 1;
V.cols.PiBaId = $(".result-table thead tr th:contains('" +
nrsl[V.BrowserLanguage]['colnames']['PickBatchID'] + "')").index(".result-table
thead tr th") + 1;
V.cols.WoPo = $(".result-table thead tr th:contains('" +
nrsl[V.BrowserLanguage]['colnames']['WorkPool'] + "')").index(".result-table thead
tr th") + 1;
V.cols.SKU = $(".result-table thead tr th:contains('" +
nrsl[V.BrowserLanguage]['colnames']['FNSKU'] + "')").index(".result-table thead tr
th") + 1;
V.cols.TrReId = $(".result-table thead tr th:contains('" +
nrsl[V.BrowserLanguage]['colnames']['TransferRequestID'] + "')").index(".result-
table thead tr th") + 1;
if (rodeoSettings.PickingNotYetPickedDetails &&
document.URL.indexOf('WorkPool=PickingNotYetPicked') > -1 && $('.result-table
tr').length <= rodeoSettings.PickingNotYetPickedLimit){
V.PNYPok = true;
}
if (!V.isAuthenticated){
$('#nrs-info').html('<i class="nrs-warn"></i><a
href="https://fcmenu.amazon.com/" target="_blank">' + nrsl[V.BrowserLanguage]['e']
['notloggedconsole'] + '</a>');
throw 'Not logged in console';
}
if (V.shipmentType == 'CUSTOMER_SHIPMENT'){
// Check needed columns
if (V.cols.OuScId == 0){$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['OuterScannableID']);throw 'One column is missing';}
if (V.cols.ScId == 0) {$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['ScannableID']);throw 'One column is missing';}
if (V.cols.Co == 0) {$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['Condition']);throw 'One column is missing';}
if (V.cols.ShId == 0) {$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['ShipmentID']);throw 'One column is missing';}
if (V.cols.PiBaId == 0){$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['PickBatchID']);throw 'One column is missing';}
if (V.cols.WoPo == 0) {$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['WorkPool']);throw 'One column is missing';}
if (V.cols.SKU == 0) {$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['FNSKU']);throw 'One column is missing';}
// PickingNotYetPicked details
if (V.PNYPok && index == 0){
$(this).append('<th style="text-align:center">' + nrsl[V.BrowserLanguage]
['e']['unitstate'] + '</th>');
}
if (V.PNYPok && index > 0){
if (_workpool.indexOf('PickingNotYetPicked') > -1 && _workpool !=
'PickingNotYetPickedHardCapped'){
$(this).append('<td class="us_' + _shipmentid + _fnsku + _scannableid +
'"></td>');
if ($.inArray(_shipmentid + '|' + _fnsku + '|' + _scannableid,
_PickingNotYetPicked) == -1){
_PickingNotYetPicked.push(_shipmentid + '|' + _fnsku + '|' +
_scannableid);
}
} else {
$(this).append('<td class="us_xx">-</td>');
}
}
// Add Wall Location
if (rodeoSettings.AddWallsLocation){
if ((_condition == '4' || _condition == '704') && _outerscannableid != ''){
if ($.inArray(_outerscannableid + '|' + _pickbatchid, _WallsLocation) ==
-1){
_WallsLocation.push(_outerscannableid + '|' + _pickbatchid);
}
}
}
// Add BoxRec
if (rodeoSettings.AddBoxRec){
if ((_condition == '7' || _condition == '15' || _condition == '704' ||
_condition == '13' || _condition == '1320') && _shipmentid != ''){
if ($.inArray(_shipmentid, _BoxRec) == -1){
_BoxRec.push(_shipmentid);
}
}
}
// Add Ship location
if (rodeoSettings.AddShipLocation){
if ((_condition == '13' || _condition == '1320') && _shipmentid != ''){
if ($.inArray(_shipmentid, _ShipLocation) == -1){
_ShipLocation.push(_shipmentid);
}
}
}
// Add Tracking ID
if (rodeoSettings.AddTrackingID){
if ((_condition == '13' || _condition == '1320') && _shipmentid != ''){
if ($.inArray(_shipmentid, _TrackingID) == -1){
_TrackingID.push(_shipmentid);
}
}
}
// Add cvAtPM00002 details
if (rodeoSettings.cvAtPM00002LastPick || rodeoSettings.cvAtPM00002PickerName
|| rodeoSettings.cvAtPM00002PickerLocation){
if (_outerscannableid == 'cvAtPM00002' || _outerscannableid.substring(0, 3)
== 'pmP' || _outerscannableid.substring(0, 3) == 'ws-'){
if ($.inArray(_scannableid + '|' + _shipmentid + '|' + _fnsku + '|0',
_cvAtPM00002) == -1){
_cvAtPM00002.push(_scannableid + '|' + _shipmentid + '|' + _fnsku + '|
0');
}
}
}
} /* V.shipmentType == 'CUSTOMER_SHIPMENT' */
if (V.shipmentType == 'TRANSSHIPMENT'){
// Check needed columns
if (V.cols.OuScId == 0){$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['OuterScannableID']);throw 'One column is missing';}
if (V.cols.ScId == 0) {$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['ScannableID']);throw 'One column is missing';}
if (V.cols.TrReId == 0){$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['TransferRequestID']);throw 'One column is missing';}
if (V.cols.WoPo == 0) {$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['WorkPool']);throw 'One column is missing';}
if (V.cols.SKU == 0) {$('#nrs-info').html('<i class="nrs-warn"></i>' +
nrsl[V.BrowserLanguage]['e']['missingcolumn'] + '<br />' + nrsl[V.BrowserLanguage]
['colnames']['FNSKU']);throw 'One column is missing';}
// Browse each rodeo row & pick up datas
$('.result-table tr').each(function (index) {
// PickingNotYetPicked details
if (V.PNYPok && index == 0){
$(this).append('<th style="text-align:center">' + nrsl[V.BrowserLanguage]
['e']['unitstate'] + '</th>');
}
if (V.PNYPok && index > 0){
if (_workpool.indexOf('PickingNotYetPicked') > -1 && _workpool !=
'PickingNotYetPickedHardCapped'){
$(this).append('<td class="us_' + _shipmentid + _fnsku + _scannableid +
'"></td>');
if ($.inArray(_shipmentid + '|' + _fnsku + '|' + _scannableid,
_PickingNotYetPicked) == -1){
_PickingNotYetPicked.push(_shipmentid + '|' + _fnsku + '|' +
_scannableid);
}
} else {
$(this).append('<td class="us_xx">-</td>');
}
}
} /* V.shipmentType == 'TRANSSHIPMENT' */
ShowResults();
} /* function noExSD() */
function HighlightAsinInOverage(){
OverageWallChecked++;
if (OverageWallChecked == rodeoSettings.OverageWallName.length){
$('.result-table tbody tr').each(function() {
var FnSku = $.trim($(this).find('td:nth-child(' + V.cols.SKU + ')').text());
if ($.inArray(FnSku , TblAsinInOverageWall) != -1){
$(this).css("background-color", "#ffbfbf");
}
});
}
}
function ShowResults(){
// PickingNotYetPicked details
if (_PickingNotYetPicked.length > 0){
$.each(_PickingNotYetPicked, function( i, unitspec ) {
var unitShipment = unitspec.split('|')[0];
var unitSKU = unitspec.split('|')[1];
var unitBin = unitspec.split('|')[2];
GM_xmlhttpRequest({
method: 'GET',
url: 'https://picking-console.' + V.Region2 +
'.picking.aft.a2z.com/api/fcs/' + V.FCname + '/pick-research/type/' +
V.newShipmentType + '/id/' + unitShipment,
headers: {
'Accept':'application/json',
'Content-Type':'application/json'
},
onload: function(response){
var js = JSON.parse(response.responseText);
if (typeof js.pickResearchData != 'undefined'){
if (Object.keys(_Actions).length == 0){
$('.result-table .us_' + unitShipment + unitSKU +
unitBin).html('<div style="padding:0 3px">Scheduler Assigned</div>');
return;
}
}
}
}
});
});
} /* _PickingNotYetPicked.length > 0 */
// Add BoxRec
if (_BoxRec.length > 0){
$.each(_BoxRec, function( i, shipment ) {
GM_xmlhttpRequest({
method: 'GET',
url: 'https://hero.' + V.Region2 + '.picking.aft.a2z.com/api/fcs/' +
V.FCname + '/entities/type/CUSTOMER_SHIPMENT/id/' + shipment + '/events',
headers: {
'Accept':'application/json, text/javascript',
'Content-Type':'application/json; charset=UTF-8'
},
onload: function(response) {
var js = JSON.parse(response.responseText);
if (typeof js.EventList != 'undefined'){
var EventD1 = '';
var EventD2 = '';
for (i = js.EventList.length-1; i >= 0; i--){
if (js.EventList[i].eventType == 'CREATE_PACKAGE'){
EventD1 = js.EventList[i].eventDetailsKey;
EventD2 = js.EventList[i].requestId;
break;
}
}
if (EventD1 != '' && EventD2 != ''){
GM_xmlhttpRequest({
method: 'GET',
url: 'https://hero.' + V.Region2 +
'.picking.aft.a2z.com/api/fcs/' + V.FCname + '/entities/type/CUSTOMER_SHIPMENT/id/'
+ shipment + '/events/id/' + EventD2 + '/details/key/' + EventD1,
headers: {
'Accept':'application/json, text/javascript',
'Content-Type':'application/json; charset=UTF-8'
},
onload: function(response) {
var js = JSON.parse(response.responseText);
if (typeof js.eventDetails != 'undefined'){
if (typeof js.eventDetails.message != 'undefined'){
var boxrec =
js.eventDetails.message.match(/boxRecommendation=(.*?),/);
$('.result-table tbody tr').each(function () {
if ($.trim($(this).find('td:nth-child(' + V.cols.ShId +
')').text()) == shipment){
$(this).find('td:nth-child(' + V.cols.ScId + ')
div').append(' / ' + boxrec[1]);
}
});
}
}
}
});
}
}
}
});
});
} /* _BoxRec.length > 0 */
// Add Tracking ID
if (_TrackingID.length > 0){
var ccounter = [];
$.each(_TrackingID, function(i, shipment){
eagleeyecounter ++;
ccounter[eagleeyecounter] = setTimeout(function()
{getTrackingID(shipment);}, (1200 * eagleeyecounter));
});
}
// PickingNotYetPicked details
if (_PickingNotYetPicked.length > 0){
$.each(_PickingNotYetPicked, function( i, unitspec ) {
var unitShipment = unitspec.split('|')[0];
var unitSKU = unitspec.split('|')[1];
var unitBin = unitspec.split('|')[2];
GM_xmlhttpRequest({
method: 'GET',
url: 'https://picking-nexus.' + V.Region + '.amazon.com/' + V.FCname +
'/pickinspector/CUSTOMER_SHIPMENT/' + unitShipment,
headers: {'Content-Type': 'text/html; charset=utf-8'},
onload: function(response) {
var Inspectorcol = false;
var Actionscol = false;
var _PickInspectorColName = ['status', 'shipment_id', 'requested_sku',
'user_id'];
var _PickInspectorcolPos = {};
var _PickActionsColName = ['action_time', 'action_type', 'shipment_id',
'fcsku', 'source_scannable_id'];
var _PickActionscolPos = {};
var _Actions = {};
var _OrderedActions = {};
$(response.responseText).find('#demand_item_table thead tr
th').each(function(index){
if ($.inArray(this.className, _PickInspectorColName) > -1){
_PickInspectorcolPos[this.className] = index + 1;
}
});
$(response.responseText).find('#pick_actions_table thead tr
th').each(function(index){
if ($.inArray(this.className, _PickActionsColName) > -1){
_PickActionscolPos[this.className] = index + 1;
}
});
if (Object.keys(_PickInspectorcolPos).length ==
_PickInspectorColName.length){Inspectorcol = true;}
if (Object.keys(_PickActionscolPos).length ==
_PickActionsColName.length){Actionscol = true;}
if (Inspectorcol){
$(response.responseText).find('#demand_item_table tbody
tr').each(function(){
var _returnstatus = '';
var _return = '';
var _checkAction;
var status = $.trim($(this).find('td:nth-child(' +
_PickInspectorcolPos['status'] + ')').text());
var shipment_id = $.trim($(this).find('td:nth-child(' +
_PickInspectorcolPos['shipment_id'] + ')').text());
var requested_sku = $.trim($(this).find('td:nth-child(' +
_PickInspectorcolPos['requested_sku'] + ')').text());
var user_id = $.trim($(this).find('td:nth-child(' +
_PickInspectorcolPos['user_id'] + ')').text());
if (shipment_id == unitShipment && requested_sku == unitSKU){
switch(status){
case 'In Scanner':
_returnstatus = '<div style="background:#93fffd">In Scanner:
' + user_id + '</div>';
_checkAction = true;
break;
case 'Picked':
_returnstatus = '<div style="background:#94ff98;padding:0
3px">Picked</div>';
_checkAction = false;
break;
default:
_returnstatus = status;
_checkAction = true;
}
if (_checkAction && Actionscol){
$(response.responseText).find('#pick_actions_table tbody
tr').each(function(){
var PA_action_time = $(this).find('td:nth-child(' +
_PickActionscolPos['action_time'] + ')').text();
var PA_action_type = $(this).find('td:nth-child(' +
_PickActionscolPos['action_type'] + ')').text();
var PA_shipment_id = $(this).find('td:nth-child(' +
_PickActionscolPos['shipment_id'] + ')').text();
var PA_fcsku = $(this).find('td:nth-child(' +
_PickActionscolPos['fcsku'] + ')').text();
var PA_source_scannable_id = $(this).find('td:nth-child(' +
_PickActionscolPos['source_scannable_id'] + ')').text();
if (PA_shipment_id == unitShipment && PA_fcsku == unitSKU &&
PA_source_scannable_id == unitBin && PA_action_type.indexOf('PICK_ASSIGNMENT') == -
1){
_Actions[PA_action_time] = PA_action_type;
//_return += '<div
style="background:#ff0000;color:#ffffff;padding:0 3px">' + PA_action_type +
'</div>';
}
});
Object.keys(_Actions).sort().forEach(function(key) {
_OrderedActions[key] = _Actions[key];
});
$.each(_OrderedActions, function( key, value ) {
_return += '<div
style="background:#ff0000;color:#ffffff;padding:0 3px">' + value + '</div>';
});
}
_return = _return + _returnstatus;
$('.result-table .us_' + unitShipment + unitSKU +
unitBin).html(_return);
return false;
}
});
} else {
// Columns not found
$('.result-table .us_' + unitShipment + unitSKU + unitBin).text('?');
}
}
});
});
} /* _PickingNotYetPicked.length > 0 */
// Add BoxRec
if (_BoxRec.length > 0){
$.each(_BoxRec, function( i, shipment ) {
GM_xmlhttpRequest({
method: "GET",
url: "https://hero-ui-prod-eu.amazon.com/" + V.FCname +
"/CUSTOMER_SHIPMENT/" + shipment,
headers: {'Content-Type': 'text/html; charset=utf-8'},
onload: function(response) {
var onclickattr = $
(response.responseText).find('td:contains(CREATE_PACKAGE)').parent('tr').attr('oncl
ick');
var EventDetails = onclickattr.match(/'(.*?)'/g);
EventDetails[1] = EventDetails[1].replace(/(^')|('$)/g, '');
EventDetails[2] = EventDetails[2].replace(/(^')|('$)/g, '');
GM_xmlhttpRequest({
method: "GET",
url: "https://hero-ui-prod-eu.amazon.com/get/EventDetails/" +
EventDetails[1] + "/" + EventDetails[2],
headers: {'Content-Type': 'text/html; charset=utf-8'},
onload: function(response) {
var boxrec =
response.responseText.match(/boxRecommendation=(.*?),/);
$('.result-table tbody tr').each(function () {
if ($.trim($(this).find('td:nth-child(' + V.cols.ShId +
')').text()) == shipment){
$(this).find('td:nth-child(' + V.cols.ScId + ')
div').append(' / ' + boxrec[1]);
}
});
}
});
}
});
});
} /* _BoxRec.length > 0 */
// Add Tracking ID
if (_TrackingID.length > 0){
var ccounter = [];
$.each(_TrackingID, function(i, shipment){
eagleeyecounter ++;
ccounter[eagleeyecounter] = setTimeout(function()
{getTrackingID(shipment);}, (1200 * eagleeyecounter));
});
}
function getTrackingID(shipment){
GM_xmlhttpRequest({
method: 'GET',
url: 'https://eagleeye-eu.amazon.com/shipment/' + shipment + '/false',
headers: {
'Accept':'application/json',
'Content-Type':'application/json'
},
onload: function(response){
var js = JSON.parse(response.responseText);
console.log(js);
if (typeof js['message'] != 'undefined'){
if (typeof eagleeyeretry[shipment] == 'undefined'){
eagleeyeretry[shipment] = 0;
}
eagleeyeretry[shipment] += 1;
if (eagleeyeretry[shipment] <= maxretry){
setTimeout(function(){ChercheTrackingID(shipment);}, 1000);
}
return false;
}
var trackid = js[0].package.trackingId;
$('.result-table tbody tr').each(function () {
if ($.trim($(this).find('td:nth-child(' + V.cols.ShId + ')').text()) ==
shipment){
$(this).find('td:nth-child(' + V.cols.OuScId + ')').append(' / ' +
trackid);
}
});
}
});
}
function nextcvAtPM00002NewC(){
$.each(_cvAtPM00002, function(i, unitspec) {
var unitTote = unitspec.split('|')[0];
var unitShipment = unitspec.split('|')[1];
var unitSKU = unitspec.split('|')[2];
var unitTransferrequestid = unitspec.split('|')[3];
GM_xmlhttpRequest({
method: 'GET',
url: 'https://picking-console.' + V.Region2 + '.picking.aft.a2z.com/api/fcs/'
+ V.FCname + '/pick-research/type/' + V.newShipmentType + '/id/' + unitShipment,
headers: {
'Accept':'application/json',
'Content-Type':'application/json'
},
onload: function(response){
var js = JSON.parse(response.responseText);
if (typeof js.pickResearchData != 'undefined'){
// browser language
try {
var browser_language = get_language().toLowerCase();
if (SupportedLanguages.indexOf(browser_language) < 0){
browser_language = browser_language.replace(/-.*/, '');
if (SupportedLanguages.indexOf(browser_language) < 0){
$('#nrs-info').html('<i class="nrs-warn"></i>Unsupported<br />browser
language');
throw 'Unsupported browser language';
}
}
V.BrowserLanguage = browser_language;
} catch (e) {
throw e;
}
var nrsmenu = `
<div id="nrs-button"></div>
<div id="nrs-settings">
<table class="nrs-tbl">
<tr><td>_%usenewconsolelinks%_</td><td>
<input type="checkbox" class="nrsw-input" id="nrs-set1" /><div class="nrsw-
div"><label class="nrsw-lbl" for="nrs-set1"></label></div></td></tr>
</table>
<br />
<table class="nrs-tbl">
<tr><td>_%highlightactivepp%_ <i class="nrs-info"></i></td><td>
<input type="checkbox" class="nrsw-input" id="nrs-set2" /><div class="nrsw-
div"><label class="nrsw-lbl" for="nrs-set2"></label></div></td></tr>
<tr><td>_%addwallslocation%_ <i class="nrs-info"></i></td><td>
<input type="checkbox" class="nrsw-input" id="nrs-set3" /><div class="nrsw-
div"><label class="nrsw-lbl" for="nrs-set3"></label></div></td></tr>
<tr><td>_%addboxrec%_ <i class="nrs-info"></i></td><td>
<input type="checkbox" class="nrsw-input" id="nrs-set4" /><div class="nrsw-
div"><label class="nrsw-lbl" for="nrs-set4"></label></div></td></tr>
if (rodeoSettings.UseNewConsole){$('#nrs-set1').prop('checked', true);}
if (rodeoSettings.HighlightActivePP){$('#nrs-set2').prop('checked', true);}
if (rodeoSettings.AddWallsLocation){$('#nrs-set3').prop('checked', true);}
if (rodeoSettings.AddBoxRec){$('#nrs-set4').prop('checked', true);}
if (rodeoSettings.HighlightOverageWall){$('#nrs-set5').prop('checked', true);}
$('#nrs-set13').val(rodeoSettings.OverageWallName.join());
if (rodeoSettings.AddShipLocation){$('#nrs-set6').prop('checked', true);}
if (rodeoSettings.AddTrackingID){$('#nrs-set7').prop('checked', true);}
if (rodeoSettings.PickingNotYetPickedDetails){$('#nrs-set8').prop('checked',
true);}
$('#nrs-set9').val(rodeoSettings.PickingNotYetPickedLimit);
if (rodeoSettings.cvAtPM00002LastPick){$('#nrs-set10').prop('checked', true);}
if (rodeoSettings.cvAtPM00002PickerName){$('#nrs-set11').prop('checked',
true);}
if (rodeoSettings.cvAtPM00002PickerLocation){$('#nrs-set12').prop('checked',
true);}
$('#nrs-button').click(function(){
$("#newrodeoscript").toggleClass('expand');
});
$('.nrs-info').hover(function(){
divinfo = '#info_' + $(this).parent().parent().find(':input').prop('id');
//console.log(divinfo);
$(divinfo).show();
infomove($(this),divinfo);
},function(){
$(divinfo).hide();
});
$('#nrs-update').click(function(){
rodeoSettings.UseNewConsole = $('#nrs-set1').prop('checked');
rodeoSettings.HighlightActivePP = $('#nrs-set2').prop('checked');
rodeoSettings.AddWallsLocation = $('#nrs-set3').prop('checked');
rodeoSettings.AddBoxRec = $('#nrs-set4').prop('checked');
rodeoSettings.HighlightOverageWall = $('#nrs-set5').prop('checked');
rodeoSettings.OverageWallName = $('#nrs-set13').val().split(',');
rodeoSettings.AddShipLocation = $('#nrs-set6').prop('checked');
rodeoSettings.AddTrackingID = $('#nrs-set7').prop('checked');
rodeoSettings.PickingNotYetPickedDetails = $('#nrs-set8').prop('checked');
if ($('#nrs-set9').val() > 300){
rodeoSettings.PickingNotYetPickedLimit = 300;
} else {
rodeoSettings.PickingNotYetPickedLimit = $('#nrs-set9').val();
}
rodeoSettings.cvAtPM00002LastPick = $('#nrs-set10').prop('checked');
rodeoSettings.cvAtPM00002PickerName = $('#nrs-set11').prop('checked');
rodeoSettings.cvAtPM00002PickerLocation = $('#nrs-set12').prop('checked');
GM_setValue('newrodeosettings', JSON.stringify(rodeoSettings));
$("#newrodeoscript").toggleClass('expand');
location.reload();
});
} catch (e) {
throw e;
}
// console authentication
try {
var login = readCookie("fcmenu-employeeLogin");
if (login && login != '' && login != '\"\"'){
V.isAuthenticated = true;
V.login = login;
}
} catch (e) {
throw e;
}
}
function infomove(btninfo, divinfo){
$(btninfo).bind('mousemove',function(event){
var xpos = event.pageX + 20;
var ypos = event.pageY - 100;
$(divinfo).css({
'left':xpos,
'top' :ypos
});
});
}
function get_language() {
if (typeof navigator === 'undefined'){
return 'en';
}
if (navigator.languages){
return navigator.languages[0];
}
return navigator.language || navigator.userLanguage;
}
function setSettings(opts) {
opts = $.extend({
'UseNewConsole': true,
'HighlightActivePP': true,
'AddWallsLocation': true,
'AddBoxRec': true,
'HighlightOverageWall': false,
'OverageWallName':
['chC8_Overage1','chC8_Overage2','chC8_Overage3','chC8_Overage4'],
'AddShipLocation': false,
'AddTrackingID': false,
'PickingNotYetPickedDetails': true,
'PickingNotYetPickedLimit': 200,
'cvAtPM00002LastPick': true,
'cvAtPM00002PickerName': true,
'cvAtPM00002PickerLocation': true,
}, opts);
return opts;
}
function readCookie(name) {
var nameEQ = name + '=';
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return false;
}