예제 #1
0
        public ActionResult LoadIntialAdd(Bin entity)
        {
            entity.Id = Guid.NewGuid();
            entity.CountryProgrammeId = countryProg.Id;
            entity.PreparedBy         = currentStaff.Id;
            entity.PreparedOn         = DateTime.Now;
            entity.RefNumber          = _binService.GenerateUniquBCNo();
            entity.QTY = 0;
            if (entity.BinType == "OR")
            {
                entity.ProcurementPlanItemId = null;
            }
            else
            {
                entity.OrderRequestItemId = null;
            }
            SCMS.UI.GeneralHelper.UserSession.CurrentSession.NewBin = entity;
            var model = new Model.BinItem()
            {
                GRNItems = new SelectList(_binService.GetGRNItemz4rmbin(entity), "Id", "GRNNoAndQtyDelivered"),
                BinId    = entity.Id
            };

            return(View("LoadAddBCItems", model));
        }
예제 #2
0
        public ActionResult SelectBin()
        {
            var model = new Model.BinItem()
            {
                BinCards = new SelectList(_binService.GetAll(), "Id", "BinNoAndItem")
            };

            return(View(model));
        }
예제 #3
0
 public ActionResult UpdateBinCard(Model.BinItem entity)
 {
     entity.Id           = Guid.NewGuid();
     entity.WHManagerId  = currentStaff.Id;
     entity.IssueDate    = DateTime.Now;
     entity.ExpirelyDate = DateTime.Now;
     _binService.IsBinItemAdded(entity, SCMS.UI.GeneralHelper.UserSession.CurrentSession.NewBin);
     SCMS.UI.GeneralHelper.UserSession.CurrentSession.NewBin = null;
     return(ManageBin(entity.BinId));
 }
예제 #4
0
        public ActionResult LoadIssueBCItems(Guid binId)
        {
            var model = new Model.BinItem()
            {
                WHRItems = new SelectList(_binService.GetWRItemByBinId(binId), "Id", "RefNoAndItemQTY"),
                BinId    = binId
            };

            return(View(model));
        }
예제 #5
0
        public ActionResult LoadAddBCItems(Guid binId)
        {
            var model = new Model.BinItem()
            {
                GRNItems = new SelectList(_binService.GetGRNItemz4rmOR(binId), "Id", "GRNNoAndQtyDelivered"),
                BinId    = binId
            };

            return(View("LoadAddBCItems", model));
        }
예제 #6
0
 public bool IsBinItemAdded(Model.BinItem binItemEntity, Model.Bin binEntity)
 {
     using (var db = new SCMSEntities())
     {
         if (binEntity != null)
         {
             binEntity.QTY = binItemEntity.QTYReceived;
             db.Bins.Add(binEntity);
             binItemEntity.BalanceStock = binItemEntity.QTYReceived;
             db.BinItems.Add(binItemEntity);
         }
         else
         {
             var bin     = db.Bins.FirstOrDefault(p => p.Id == binItemEntity.BinId); bin.BinType = "any";
             var binitem = db.BinItems.Where(p => p.BinId == binItemEntity.BinId).OrderByDescending(k => k.IssueDate).FirstOrDefault();
             if (binItemEntity.QTYReceived > 0)
             {
                 binItemEntity.BalanceStock = binItemEntity.QTYReceived + (binitem != null ? binitem.BalanceStock : 0); bin.QTY += binItemEntity.QTYReceived;
             }
             else
             {
                 binItemEntity.BalanceStock = binitem != null ? binitem.BalanceStock - binItemEntity.QTYIssued : binItemEntity.QTYIssued; bin.QTY -= binItemEntity.QTYIssued;
             }
             db.BinItems.Add(binItemEntity);
             ((IObjectContextAdapter)db).ObjectContext.ObjectStateManager.ChangeObjectState(bin, System.Data.EntityState.Modified);
         }
         if (db.SaveChanges() > 0)
         {
             SessionData.CurrentSession.BinList = null; SessionData.CurrentSession.BinItemList = null;
             SessionData.CurrentSession.GoodsReceivedNoteItemList = null; SessionData.CurrentSession.ReleaseOrderItemList = null; return(true);
         }
         else
         {
             return(false);
         }
     }
 }