private string GetSeatSummaryDescription(string itemNumber, int lineId) { var items = ItemMasterCacheManager.ItemNumberDescriptions.Where(i => i.ItemNumber.Trim() == itemNumber).ToList(); string description = ""; ItemDetailsModel model = new ItemDetailsModel(); var item = model.GetItemInfo(itemNumber); if (items.Count() > 0) { if (lineId == 1) { var first = item.ItemInfos.Where(s => s.PartIndex == 1).FirstOrDefault(); var second = item.ItemInfos.Where(s => s.PartIndex == 2).FirstOrDefault(); if (first != null) { description = model.GetOptionValue(first, 100) + " " + model.GetOptionValue(first, 101) + " " + model.GetOptionValue(first, 3) + " " + model.GetOptionValue(first, 10); } } else if (lineId == 2) { var first = item.ItemInfos.Where(s => s.PartIndex == 1).FirstOrDefault(); var second = item.ItemInfos.Where(s => s.PartIndex == 2).FirstOrDefault(); if (first != null) { if (first.ItemType == "2B") description = "BENCH"; else { description = model.GetOptionValue(first, 100) + " " + model.GetOptionValue(first, 101) + " " + model.GetOptionValue(first, 10) + " " + model.GetOptionValue(first, 9) + " " + model.GetOptionValue(first, 13) + " " + model.GetOptionValue(first, 11); } } } else if (lineId == 3) { var third = item.ItemInfos.Where(s => s.PartIndex == 3).FirstOrDefault(); var fourth = item.ItemInfos.Where(s => s.PartIndex == 4).FirstOrDefault(); if (third != null) { description = model.GetOptionValue(third, 100) + " " + model.GetOptionValue(third, 101) + " " + model.GetOptionValue(third, 3) + " " + model.GetOptionValue(third, 7) + " " + model.GetOptionValue(third, 9) + " " + model.GetOptionValue(third, 10); } } return System.Text.RegularExpressions.Regex.Replace(description, @"\s+", " "); } return "*Unknown Sku* (" + itemNumber + ")"; }
public List<TestRepairRequirement> GetRearRepairTestRequirements(Item item, int jobId, int palletId, int testerMode) { ItemDetailsModel model = new ItemDetailsModel(); List<TestRepairRequirement> testRepairReqs = new List<TestRepairRequirement>(); if (item.ItemInfos.Count() > 0) { var first = item.ItemInfos.Where(i => i.PartIndex == 1).FirstOrDefault(); var second = item.ItemInfos.Where(i => i.PartIndex == 2).FirstOrDefault(); var third = item.ItemInfos.Where(i => i.PartIndex == 3).FirstOrDefault(); var fourth = item.ItemInfos.Where(i => i.PartIndex == 4).FirstOrDefault(); if (isRU(item.ItemInfos[0].ItemType)) { if (first != null) { int firstBuildcode = first.Buildcode; //ru //heat var testName = "RU 2nd Row Repair Test"; if (model.GetOptionValue(first, 112) == "HT") testName = testName + " Heat"; if (model.GetOptionValue(first, 112) != "HT" && model.GetOptionValue(first, 113) == "LXQD") firstBuildcode = 0; if (firstBuildcode != 0) { testRepairReqs.Add(new TestRepairRequirement { JobId = jobId, PalletId = palletId, TestId = 3, Group = "REAR", Repaired = false, Dtm = DateTime.Now, TestName = testName, BuildCode = firstBuildcode }); } } if (third != null) { int thirdBuildcode = (int)Math.Pow(2, 14); //ru //heat or pwr if (model.GetOptionValue(third, 112) == "HT" || model.GetOptionValue(third, 103) == "PWR") { var testName = "RU 3rd Row Repair Test"; if (model.GetOptionValue(third, 112) == "HT") { thirdBuildcode = thirdBuildcode + (int)Math.Pow(2, 2); testName = testName + " Heat"; } if (model.GetOptionValue(third, 103) == "PWR") { thirdBuildcode = thirdBuildcode + (int)Math.Pow(2, 2); testName = testName + " Power"; } testRepairReqs.Add(new TestRepairRequirement { JobId = jobId, PalletId = palletId, TestId = 4, Group = "REAR", Repaired = false, Dtm = DateTime.Now, TestName = testName, BuildCode = third.Buildcode }); } } } else { #region RT Legacy Code //RT Legacy Code int buildcode1 = 0; if (testerMode == 1) //RT Legacy { if (model.GetOptionValue(first, 10) == "HT" && model.GetOptionValue(first, 11) != "LXQD") buildcode1 = 1 + (int)Math.Pow(2, 9); else if (model.GetOptionValue(first, 10) == "HT" && model.GetOptionValue(first, 11) == "LXQD") buildcode1 = 1 + (int)Math.Pow(2, 11); } else if (testerMode == 2) { if (model.GetOptionValue(first, 10) == "HT") buildcode1 = first.Buildcode; } if (buildcode1 != 0) { testRepairReqs.Add(new TestRepairRequirement { JobId = jobId, PalletId = palletId, TestId = 3, Group = "REAR", Repaired = false, Dtm = DateTime.Now, TestName = "2nd Row Repair Test Heat", BuildCode = buildcode1 }); } int buildcode2 = 0; if (testerMode == 1 && model.GetOptionValue(third, 103) == "PWR") //RT Legacy buildcode2 = 2; else if (testerMode == 2 && model.GetOptionValue(third, 103) == "PWR") buildcode2 = third.Buildcode; if (buildcode2 != 0) { testRepairReqs.Add(new TestRepairRequirement { JobId = jobId, PalletId = palletId, TestId = 4, Group = "REAR", Repaired = false, Dtm = DateTime.Now, TestName = "3rd Row Repair Test Power", BuildCode = buildcode2 }); } #endregion } return testRepairReqs; } return null; }
public RepairBarcodeValidateResponse ValidateBarcodeFault([FromBody]ReworkBarcodeValidateRequest request, string barcode) { ItemDetailsModel model = new ItemDetailsModel(); RequirementsDataContext db = new RequirementsDataContext(); RepairBarcodeValidateResponse response = new RepairBarcodeValidateResponse(); if (request.SkuInfo.Count() > 0) { var sku = request.SkuInfo[0].Sku; var lineId = request.SkuInfo[0].LineId; var cstype = request.BarcodeFault.CSType; var bcregex = db.BarcodeRegexes.Where(r=>r.CSType == request.BarcodeFault.CSType && r.LineId == lineId).FirstOrDefault(); if (bcregex != null) { var regex = new Regex(@bcregex.Regex.Trim()); var bcmatch = regex.Match(barcode); if (bcmatch.Success) //validate barcode { //still need to validate barcode var itemInfo = model.GetItemInfo(sku); var partItem = itemInfo.ItemInfos.Where(p => p.PartIndex == bcregex.PartIndex).FirstOrDefault(); switch (cstype) { case 1: case 2: var pretensionerPart = bcmatch.Groups["PART"].Value; var pretensionerTrack = bcmatch.Groups["TRACKING"].Value; if (partItem != null) { string expectedPretPart = model.GetOptionValue(partItem, (int)bcregex.OptionNumber); if (expectedPretPart == pretensionerPart) { //part okay to update and save response.Success = true; } else { response.ErrorMessage = "Ops, Wrong Part Expecting: " + expectedPretPart; response.ExpectedValue = expectedPretPart; response.Success = false; } } break; case 7: case 8: var headrestPart = bcmatch.Groups["PARTNO"].Value; string expectedHeadRestPart = model.GetOptionValue(partItem, (int)bcregex.OptionNumber); if (expectedHeadRestPart.IndexOf(headrestPart) != -1) { //part okay to update and save response.Success = true; } else { response.ErrorMessage = "Ops, Wrong Part Expecting: " + expectedHeadRestPart; response.ExpectedValue = expectedHeadRestPart; response.Success = false; } break; case 11: case 12: var backDocusew = bcmatch.Groups["BC"].Value; response.Success = true; break; case 23: case 24: var airbagTrack = bcmatch.Groups["AIRBAGTRCK"].Value; response.Success = true; break; default: break; } return response; } else { return new RepairBarcodeValidateResponse { ErrorMessage = "Error: Incorrect Barcode Pattern Match", Success = false, }; } } } return new RepairBarcodeValidateResponse { ErrorMessage = "Error: Cannot Locate Part Info", Success = false, }; }
public List<SkuInfo> GetSkuInfo(Item item) { ItemDetailsModel model = new ItemDetailsModel(); List<SkuInfo> skuInfo = new List<SkuInfo>(); foreach(var part in item.ItemInfos) { skuInfo.Add(new SkuInfo { LineId = part.LineId, BitmapGUID = GetBitmapGUID(part.LineId), BuildCode = model.GetBuildcodeOption(part), Description = part.ItemDescription, PartIndex = (short)part.PartIndex, PartNum = part.ItemComponent, Sku = part.ItemNumber, TrimColour = model.GetOptionValue(part, 101), TrimStyle = model.GetOptionValue(part, 100), }); } return skuInfo; }