Beispiel #1
0
        public DataEditViewModel(IPartsListRipository partsListRipository,
                                 IBomRepository bomRepository)
        {
            _partsListRipository = partsListRipository;
            _bomRepository       = bomRepository;

            PartsList.Clear();
            foreach (var partslist in _partsListRipository.GetPartsList(1))
            {
                PartsList.Add(new PartsListEtity(partslist.Id, partslist.SqkId, partslist.PartsNumber,
                                                 partslist.PartsName, partslist.PartsQuantity));
            }

            BomList.Clear();
            foreach (var bomlist in _bomRepository.GetBoms("test"))
            {
                BomList.Add(new BomEntity(bomlist.Id, bomlist.AircraftNumber, bomlist.AssyNo,
                                          bomlist.PartsNo, bomlist.NeedQuantity, bomlist.ReceivedQuantity, bomlist.Memo));
                OriginalQuantityText += bomlist.ReceivedQuantity;
            }

            UpdateButton = new DelegateCommand(UpdateButtonExecute);

            DivideQuantityText    = 10;
            RemainingQuantityText = DivideQuantityText;
        }
Beispiel #2
0
        public Result InsertBomList(List <BomList> bomList, long userId)
        {
            try
            {
                IInsertingSetupCommon _IDataAccessInsert = new WCMS_Common_Inserting();
                using (var transaction = new TransactionScope(TransactionScopeOption.Required, ApplicationState.TransactionOptions))
                {
                    var result = new Result();


                    foreach (var list in bomList)
                    {
                        var bomLists = new BomList();

                        bomLists.ComponentName = list.ComponentName;
                        bomLists.ComponentCode = list.ComponentCode;
                        bomLists.AddedBy       = userId;
                        bomLists.AddedDate     = DateTime.Now;
                        result.IsSuccess       = _IDataAccessInsert.InsertBomList(bomLists);
                    }



                    if (result.IsSuccess)
                    {
                        transaction.Complete();
                    }
                    return(result);
                }
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #3
0
 public List <BomList> GetMaterialInfo(BomList bomList)
 {
     try
     {
         ISelectingCommon iDataAccessSelect = new DALGetCommonSelecting();
         return(iDataAccessSelect.GetMaterialInfo(bomList));
     }
     catch (Exception ex) { throw ex; }
 }
Beispiel #4
0
 public Result InsertBomList(BomList bomList)
 {
     try
     {
         return(productionManager.InsertBomList(bomList));
     }
     catch (Exception ex)
     {
         return(new Result {
             IsSuccess = false, Message = ex.Message
         });
     }
 }
 public bool InsertBomList(BomList bomLists)
 {
     try
     {
         _entity.BomList.Add(bomLists);
         _entity.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(true);
 }
Beispiel #6
0
        public List <BomList> GetMaterialInfo(BomList bomList)
        {
            var list = new List <BomList>();

            try
            {
                list = _CommonManager.GetMaterialInfo(bomList);
            }
            catch (Exception ex)
            {
            }

            return(list);
        }
Beispiel #7
0
        private void UpdateButtonExecute()
        {
            RemainingQuantityText = 0;
            var remainingQuantity = 0;
            var updateList        = new ObservableCollection <BomEntity>();

            foreach (var bomlist in BomList)
            {
                updateList.Add(new BomEntity(bomlist.Id, bomlist.AircraftNumber, bomlist.AssyNo,
                                             bomlist.PartsNo, bomlist.NeedQuantity, bomlist.ReceivedQuantity, bomlist.Memo));
                remainingQuantity += bomlist.ReceivedQuantity;
            }
            BomList.Clear();
            BomList = updateList;
            RemainingQuantityText = OriginalQuantityText + DivideQuantityText - remainingQuantity;
        }
        public async Task <IActionResult> UpdateBomList(BomList bomListForUpdate)
        {
            var listFromRepo = await _repo.GetBomListById(bomListForUpdate.Id);

            var componentFromRepo = await _search.GetComponentBuhNr(bomListForUpdate.BuhNr);


            if (componentFromRepo != null)
            {
                listFromRepo.BuhNr         = bomListForUpdate.BuhNr;
                listFromRepo.ComponentasId = componentFromRepo.Id;
                listFromRepo.ManufPartNr   = componentFromRepo.Mnf;
            }

            if (await _search.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception($"Updating failed on save");
        }
        public List <BomList> GetMaterialInfo(BomList bomList)
        {
            List <BomList> list;

            try
            {
                list = _wcmsEntities.BomList
                       .WhereIf(bomList.Id != null, x => x.Id == bomList.Id)
                       .WhereIf(!string.IsNullOrEmpty(bomList.ComponentName), x => x.ComponentName == bomList.ComponentName)
                       .WhereIf(!string.IsNullOrEmpty(bomList.ComponentCode), x => x.ComponentCode == bomList.ComponentCode)



                       .AsNoTracking().ToList();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(list);
        }
Beispiel #10
0
        public Result InsertBomList(BomList bomList)
        {
            try
            {
                IProduction _IProductionInsert = new WCMS_DAL_Production();
                using (
                    TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required,
                                                                        ApplicationState.TransactionOptions))
                {
                    Result _Result = new Result();
                    _Result.IsSuccess = _IProductionInsert.InsertBomList(bomList);

                    if (_Result.IsSuccess)
                    {
                        transaction.Complete();
                    }
                    return(_Result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }