//public JsonResult EPartCompare(int? LOID, int? ROID) //{ // List<EPart> CompareEBom = getListCompareEbom(0, LOID, ROID); // return Json(CompareEBom); //} public JsonResult EPartCompare(int?LOID, int?ROID) { int level = 0; List <EBOM> CompareList = new List <EBOM>(); EPart LPataData = EPartRepository.SelEPartObject(new EPart { OID = LOID }); EPart RPataData = EPartRepository.SelEPartObject(new EPart { OID = ROID }); //EBOM LEom = EPartRepository.getListEbom(0, Convert.ToInt32(LOID)); //EBOM REom = EPartRepository.getListEbom(0, Convert.ToInt32(ROID)); List <EBOM> LList = new List <EBOM>(); List <EBOM> RList = new List <EBOM>(); List <EBOM> LEPartList = EPartRepository.SelRootChildEBomList(new EBOM { FromOID = Convert.ToInt32(LOID) }); EBOM LEPartObj = new EBOM(); LEPartObj.Level = 0; LEPartObj.FromOID = 0; LEPartObj.ToOID = LOID; LEPartList.Insert(0, LEPartObj); List <EBOM> REPartList = EPartRepository.SelRootChildEBomList(new EBOM { FromOID = Convert.ToInt32(ROID) }); EBOM REPartObj = new EBOM(); REPartObj.Level = 0; REPartObj.FromOID = 0; REPartObj.ToOID = LOID; REPartList.Insert(0, REPartObj); //EBomStructureToList(LEom, LList, level); //EBomStructureToList(REom, RList, level); //List<EBOM> LEPartList = EPartRepository.SelRootChildEBomList(new EBOM { FromOID = Convert.ToInt32(LOID) }); //List<EBOM> REPartList = EPartRepository.SelRootChildEBomList(new EBOM { FromOID = Convert.ToInt32(ROID) }); // //리스트 만들기 LEPartList.ForEach(item => { int compareIndex = CompareList.FindIndex(innerItem => { return(((EBOM)innerItem).FromOID == item.FromOID && ((EBOM)innerItem).ToOID == item.ToOID); }); if (compareIndex < 0) { int RListIndex = REPartList.FindIndex(innerItem => { return(((EBOM)innerItem).Ord == item.Ord && ((EBOM)innerItem).Level == item.Level); }); if (RListIndex > -1) { item.Action = PmsConstant.ACTION_ADD; item.Ord = REPartList[RListIndex].Ord; item.RToOID = REPartList[RListIndex].ToOID; CompareList.Add(item); REPartList.RemoveAt(RListIndex); } else if (RListIndex < 0) { item.Action = PmsConstant.ACTION_LEFT; CompareList.Add(item); } } }); REPartList.ForEach(item => { item.Action = PmsConstant.ACTION_RIGHT; item.LToOID = item.ToOID; CompareList.Add(item); }); //return Json(0); return(Json(getListCompareEPartStructure(level, LOID, ROID, LPataData, RPataData, CompareList))); }
public JsonResult SelectReverseEBom(EPart _param) { EBOM lBom = EPartRepository.getListReverseEbom(0, Convert.ToInt32(_param.OID)); return(Json(lBom)); }