Last active
August 19, 2016 21:22
-
-
Save rafarocha/a9c71977e6d44fa3c93963f572cf178b to your computer and use it in GitHub Desktop.
Testando indicadores de ponto de pedido
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package indicadores; | |
public class Main { | |
public static double PesoCurvaA = 0.8, PesoCurvaB = 0.15, PesoCurvaC = 0.05; | |
public static double PesoNivelR = 1, PesoNivelM = 3, PesoNivelZ = 5; | |
/* | |
* problemas | |
* 1. e casos que mais saem em qt por dia? | |
* - exemplo: | |
* 30Hnk + 10variados = 31 produtos para o dia mas, sao 11 produtos | |
* neste caso nao importa a quantidade, o valor do mínimo é que indica o mínimo do produto | |
* se ele está no mínimo precisa repor uma quantidade de X baseado em preço e N fatores | |
* | |
* 2. posso incluir uma variável de ajuste padrão ou colocar para o usuário do App indicar | |
* - exemplo: colocar 1 dia a menos do ponto do pedido devido a problemas com dias úteis | |
* - exemplo: não considerar finais de semanas, feriados locais, segundas-feiras, entre outros | |
*/ | |
public static void main(String[] args) { | |
Stock A = new Stock(0,0,0); | |
Stock B = new Stock(0,1,0); | |
Stock C = new Stock(10,34,8); | |
double PT = A.qna() + B.qna() + C.qna(); | |
double TA = 02d, TB = 01d, TC = 08d; | |
double VA = 5d, VB = 5d, VC = 10d; | |
// o motivo de incluir a quantidade é para não relaxar a dispersão de itens por classe | |
double XA = ((TA/VA) * PesoCurvaA * A.qna() ); | |
double XB = ((TB/VB) * PesoCurvaB * B.qna() ); | |
double XC = ((TC/VC) * PesoCurvaC * C.qna() ); | |
double sum = (XA + XB + XC); | |
double coef = sum < 0 ? sum * -1 : sum; | |
double PA = (XA *100 / coef); | |
double PB = (XB *100 / coef); | |
double PC = (XC *100 / coef); | |
// start log | |
System.out.println( "Tabela QNC" ); | |
System.out.println( "A = " + A.r + " " + A.m + " " + A.z ); | |
System.out.println( "B = " + B.r + " " + B.m + " " + B.z ); | |
System.out.println( "C = " + C.r + " " + C.m + " " + C.z ); | |
// QNA | |
System.out.println( "\nQNA-A = " + A.qna() + "\nQNA-B = " + B.qna() + "\nQNA-C = " + C.qna() + "\nQNA-Total = " + PT ); | |
System.out.println( "\nCPP-A = " + XA + "\nCPP-B = " + XB + "\nCPP-C = " + XC ); | |
System.out.println( "\nCoeficiente? " + coef ); | |
System.out.println( "\nPercentuais" ); | |
System.out.println( "PA = " + PA ); | |
System.out.println( "PB = " + PB ); | |
System.out.println( "PC = " + PC); | |
System.out.println( "Soma=" + (PA + PB + PC) ); | |
System.out.println( "\ncor = " + qualCor(PA, PB, PC) ); | |
System.out.println( "progresso = " + qualProgresso(PA, PB, PC) ); | |
// A = 80%, B = 15%, C = 5% | |
System.out.println( "Perc.A = " + 0.8 * (PA/100) ); | |
System.out.println( "Perc.B = " + 0.15 * (PB/100) ); | |
System.out.println( "Perc.C = " + 0.05 * (PC/100) ); | |
} | |
private static String qualCor(double PA, double PB, double PC) { | |
if (PA > 90 || PB > 70) return "vermelho"; | |
if (PB > 10) return "amarelo"; | |
return "verde"; | |
} | |
private static String qualProgresso(double PA, double PB, double PC) { | |
if (PA > 90) return "vermelho"; | |
if (PB > 10) return "amarelo"; | |
return "verde"; | |
} | |
// antigo | |
enum sit { | |
A(05, 10), B(03, 20), C(15, 30); | |
sit (int v, int t) { | |
this.v = v; | |
this.t = t; | |
} | |
int v, t; | |
} | |
// int VA = 05, VB = 03, VC = 15; | |
// int TA = 10, TB = 20, TC = 30; | |
} | |
import static indicadores.Main.PesoNivelR; | |
import static indicadores.Main.PesoNivelM; | |
import static indicadores.Main.PesoNivelZ; | |
public class Stock { | |
double r, m, z; | |
public Stock (double r, double m, double z) { | |
this.r = r; | |
this.m = m; | |
this.z = z; | |
} | |
public double qna() { | |
return r * PesoNivelR + m * PesoNivelM + z * PesoNivelZ; | |
} | |
public double total() { | |
return r + m + z; | |
} | |
public double te() { | |
return r + m; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment