Example #1
0
        private RepairRecipe GetGenericRepairRecipe(List<SkuInfo> skuInfo)
        {
            ReworkFactory factory = new ReworkFactory();
            //var palletValidationRequirements = factory.GetPalletValidationRequirements(skuInfo);
            int lineId = skuInfo[0].LineId;
            
            ReworkDataContext db = new ReworkDataContext();
            int genericrecipeid = 4;
            if (lineId == 1)
                genericrecipeid = 3;

            RepairRecipe recipe = new RepairRecipe
            {
                RecipeId = genericrecipeid,
                Priority = 0,
                Title = "Generic Repair",
                RequireRepaired = false,
                BarcodeRepairs = (from t in db.IWS_SP_GetSerialRequirementByRecipeDefinitionId(genericrecipeid)
                                  select new BarcodeRepair
                                  {
                                      Description = t.Description,
                                      LineId = t.LineId,
                                      Repaired = false,
                                  }).ToList(),
                TorqueRepairs = (from t in db.IWS_SP_GetTorqueRequirementByRecipeDefinitionId(genericrecipeid)
                                 select new TorqueRepair
                                 {
                                     ControllerName = t.ControllerName.Trim(),
                                     Repaired = t.Pset == 0 ? true : false,
                                     Description = t.Description,
                                     Pset = t.Pset,
                                     TorquesPresent = 0,
                                     TorquesRequired = (int)t.TorquesRequired
                                 }).ToList()

            };
            return recipe;
        }
Example #2
0
        public List<RepairRecipe> GetRepairRecipes(List<SkuInfo> skuInfo, List<IntegramREST.Models.Disposition.Disposition> disposition, int actionId) 
        {
            List<RepairRecipe> repairRecipes = new List<RepairRecipe>();

            ReworkDataContext db = new ReworkDataContext();

            foreach (var disp in disposition)
            {
                var recipes = (from r in db.IWS_SP_GetRecipeDefinitions(disp.SeatType.TypeID, disp.SeatSide.SideID, disp.SeatPortion.SeatPortionID,
                                   disp.SeatCommodity.CommodityID, disp.SeatDefect.DefectID, disp.SeatDefectDetail.DefectDetailID, actionId)
                               select r).ToList();

                foreach (var recipe in recipes)
                {

                    var torqueReq = (from t in db.IWS_SP_GetTorqueRequirementByRecipeDefinitionId(recipe.Id)
                                   join part in skuInfo
                                   on t.LineId equals part.LineId
                                   where ((part.BuildCode & t.SeatOptions) == (part.BuildCode & t.SeatOptions2Check)) &&
                                   ((part.BuildCode & t.SeatOptions) == (t.SeatOptions & t.SeatOptions2Check))
                                   select new TorqueRepair
                                   {
                                       ControllerName = t.ControllerName.Trim(),
                                       Repaired = t.Pset == 0 ? true : false,
                                       Description = t.Description,
                                       Pset = t.Pset,
                                       TorquesPresent = 0,
                                       TorquesRequired = (int)t.TorquesRequired
                                   }).Distinct<TorqueRepair>().ToList();

                    //then sort out the options

                    //var serialReq = (from s in db.IWS_SP_GetSerialRequirementByRecipeDefinitionId(recipe.Id)
                    //                 select s).ToList();

                    //then sort out the serial


                    RepairRecipe tmpRecipe = new RepairRecipe
                    {
                        RecipeId = recipe.Id,
                        Priority = recipe.Priority,
                        Repaired = false,
                        RequireRepaired = true,
                        Title = recipe.Description,
                        TorqueRepairs = torqueReq,
                        BarcodeRepairs = new List<BarcodeRepair>()
                    };
                    repairRecipes.Add(tmpRecipe);
                }
            }



            //repairRecipe.AddRange(GetCommodityRepairRecipe(skuInfo, dispositionList));
            repairRecipes.Add(GetGenericRepairRecipe(skuInfo));
            return repairRecipes;
        }