예제 #1
0
        public static bool IsAvailable(string[] productkey, MaterialMatrix avaiMat)
        {
            if (avaiMat == null)
            {
                throw new Exception("Availibility Matrix is null (" + avaiMat + ")");
            }
            // only RKP II
            MaterialMatrix matMat = GetMaterials(productkey);

            if (matMat == null)
            {
                return(false);
            }
            MaterialMatrix m3 = avaiMat - matMat;

            return(m3.IsNotNegativ());
        }
예제 #2
0
        public static Statistics CalcStatistics(ExcelWrapper excelWrapper, MaterialMatrix materialMat)
        {
            Statistics ret = new Statistics();

#if !DEBUG
            try
#endif
            {
                if (materialMat == null || !materialMat.IsNotNegativ() || materialMat.CountNonNegativeEntrys() < 3)
                {
                    return(null);
                }
                MaterialMatrix tmpMaterialMatrix = materialMat.Clone();

                for (int colInd = 49; colInd < excelWrapper.GetRowCount(); colInd++)
                {
                    string[] obj          = excelWrapper.GetRow(colInd);
                    bool     isAvai       = false;
                    bool     isResolvable = false;
                    if (string.IsNullOrWhiteSpace(obj[0]))
                    {
                        throw new Exception();
                    }
#if !DEBUG
                    try
#endif
                    {
                        isAvai       = AvailabilityCheck.IsAvailable(obj, tmpMaterialMatrix);
                        isResolvable = AvailabilityCheck.CanResolve(obj);
                    }
#if !DEBUG
                    catch (Exception) { }
#endif
                    if (isAvai)
                    {
                        ret.countAllAvai++;
                        ret.allAvaiPumps.Add(obj);
                    }
                    ret.countAll++;
                    ret.allPumps.Add(obj);
                    if (obj[11] == "RKP" || obj[11] == "FRP")
                    {
                        ret.countRKP++;
                        ret.RKPPumps.Add(obj);
                        if (isAvai)
                        {
                            ret.countRKPAvai++;
                            ret.RKPAvaiPumps.Add(obj);
                        }
                    }
                    if (isResolvable)
                    {
                        ret.resolvable++;
                        ret.resolvablePumps.Add(obj);
                        if (isAvai)
                        {
                            ret.resolvableAvai++;
                            ret.resolvableAvaiPumps.Add(obj);
                        }
                    }
                    if (string.IsNullOrWhiteSpace(obj[0]))
                    {
                        throw new Exception();
                    }
                }
            }
#if !DEBUG
            catch (Exception) { return(ret); }
#endif
            return(ret);
        }