public static MaterialMatrix GetMaterials(string[] produktkey) { // only RKP II if (!produktkey[0].StartsWith("D")) { return(null); } MaterialMatrix resultMat = new MaterialMatrix(); string[] tmp_prodkey = (string[])produktkey.Clone(); bool next_pump_avai = false; do { string old_pos19 = tmp_prodkey[19]; if (old_pos19 != "" && old_pos19 != "DS1") { tmp_prodkey[19] = "DS1"; next_pump_avai = true; } else { next_pump_avai = false; } MaterialMatrix soloMat = GetMaterialsSolo(tmp_prodkey); if (soloMat == null || soloMat.CountNonNegativeEntrys() != 3) { return(null); } resultMat = resultMat + soloMat; tmp_prodkey[19] = old_pos19; if (next_pump_avai) { // remove repeating part to simulate solo pump // articlenum might be false then but its only for detect of RKP II for (int cnt = 0; (19 + cnt) < tmp_prodkey.Length; cnt++) { tmp_prodkey[11 + cnt] = tmp_prodkey[19 + cnt]; } // all following stages of RKP's have XX cover tmp_prodkey[10] = "XX"; } } while (next_pump_avai); return(resultMat); }
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); }