Ejemplo n.º 1
0
        private void  ValidateReqs(DateTime?F1, DateTime?F2, bool accStock)
        {
            //graba Planning data por proveedor,po, material, cantidad
            //actualiza material stock Location en transito con lo que lo
            //tendra en cuenta en el proximo calculo MRP
            CreateVB_cMRP(F1, F2, accStock);
            List <TExpMatd> mode_ = (List <TExpMatd>)ViewBag.ListMatPOT;

            foreach (TExpMatd rec in mode_)
            {
                int?   _idmat = rec.expcomp;
                double?qtyreq = rec.SPoPcRequ;
                int?   _idSup = rec.SupId;
                int?   _idPo  = rec.SPoId;
                //SpocprodId SporeferEx SposupId
                var qpo = (from po in _dbContext.TSPorders where po.SpocprodId == _idmat &&
                           po.SposupId == _idSup
                           select po.SporeferEx).ToList();
                int?_IdRe = qpo[0];
                try{
                    TSPlanning modpl = new TSPlanning();
                    modpl.PlanSupId    = _idSup;
                    modpl.PlanProdId   = _IdRe;
                    modpl.PlanDateFrom = F1;
                    modpl.PlanDateTo   = F2;
                    modpl.PlanQty      = qtyreq;
                    modpl.PlanFirmSt   = "PLAN";
                    _dbContext.TSPlannings.Add(modpl);
                    _dbContext.SaveChanges();
                }
                catch {}
                try{
                    var query = (from ml in _dbContext.TMLocations
                                 join lo in _dbContext.TLocations on ml.MLocLodId equals lo.LocId
                                 where lo.LocType == "TRAN" && ml.MLocMatId == _idmat
                                 select ml.MLocId).ToList();
                    int _locId = query[0];
                    var modlo  = _dbContext.TMLocations
                                 .SingleOrDefault(u => u.MLocId.Equals(_locId));
                    modlo.MLocStock += qtyreq;
                    _dbContext.TMLocations.Update(modlo);
                    _dbContext.SaveChanges();
                }
                catch {}
            }
        }
Ejemplo n.º 2
0
        public IActionResult CharCreate(TChart chart, string actionType)
        {
            ViewData["panel"] = 2;
            if (actionType == "Add")
            {
                if (ModelState.IsValid)
                {
                    try{
                        _dbContext.TCharts.Add(chart);
                        _dbContext.SaveChanges();
                    }
                    catch { return(View("Error")); }
                }
                else
                {
                    CreateViewBags();
                    return(View(chart));
                }
            }
            CreateViewBags();

            return(RedirectToAction("Index", new{ panel = 2 }));
        }
Ejemplo n.º 3
0
        public IActionResult BLHCreate(TInputBLH model, string actionType)
        {
            ViewData["panel"] = 1;
            if (actionType == "Add")
            {
                if (ModelState.IsValid)
                {
                    try{
                        _dbContext.TInputBLHs.Add(model);
                        _dbContext.SaveChanges();
                    }
                    catch { return(View("Error")); }
                }
                else
                {
                    CreateViewBags(0);
                    return(View(model));
                }
            }
            CreateViewBags(0);
            ViewData["panel"] = 1;

            return(RedirectToAction("Index", new{ panel = 1 }));
        }
Ejemplo n.º 4
0
 public IActionResult Create(TCustomer Customer, string actionType)
 {
     if (actionType == "Add")
     {
         if (ModelState.IsValid)
         {
             try{
                 _dbContext.TCustomers.Add(Customer);
                 _dbContext.SaveChanges();
             }
             catch {}
         }
         else
         {
             //CreateViewBags(Customer.CustId,0,0);
             return(View(Customer));
         }
     }
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 5
0
 public IActionResult Create(TPerson person, string actionType)
 {
     if (actionType == "Add")
     {
         if (ModelState.IsValid)
         {
             try{
                 _dbContext.TPersons.Add(person);
                 _dbContext.SaveChanges();
             }
             catch {}
         }
         else
         {
             return(View(person));
         }
     }
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 6
0
 public IActionResult Create(TSuplier suplier, string actionType)
 {
     ViewData["panel"] = 1;
     if (actionType == "Add")
     {
         if (ModelState.IsValid)
         {
             try{
                 _dbContext.TSupliers.Add(suplier);
                 _dbContext.SaveChanges();
             }
             catch {}
         }
         else
         {
             return(View(suplier));
         }
     }
     return(RedirectToAction("Index"));
 }