Exemple #1
0
        public static bool TezgahAtkiGirisiEkle(vTezgahAtkiGiris atkiGiris)
        {
            tblTezgahAtkiGiris tbl = atkiGiris.ViewToTbl();
            bool snc = new DBEvents().SaveGeneric <tblTezgahAtkiGiris>(ref tbl);

            return(snc);
        }
Exemple #2
0
        /// <summary>
        /// Atkı girişleri tezgah planlarını öteler.
        /// </summary>
        /// <param name="atkiGiris">Atkı girişi, ilgili tarihteki plan metresinin yarısının %20 fazlasından az ise tezgahtaki planlar 1 gün ötelenir.</param>
        /// <returns></returns>
        public int TezgahPlanOtele(tblTezgahAtkiGiris atkiGiris)
        {
            tblPlanlama plan = db.GetGeneric <tblPlanlama>(c => c.TezgahId == atkiGiris.TezgahId && c.Tarih == atkiGiris.Tarih && c.TipId == atkiGiris.TipId).FirstOrDefault();

            if (plan == null)
            {
                return(1);
            }
            tblKumas tip = db.GetGeneric <tblKumas>(c => c.Id == atkiGiris.TipId).FirstOrDefault();

            double?dokMetre = null;
            int    fark     = atkiGiris.AtkiBitis - atkiGiris.AtkiBaslangic;

            if (tip.AtkiSiklik.HasValue)
            {
                dokMetre = fark * 1000 * 2 / (tip.AtkiSiklik.Value * 100);
            }

            if (dokMetre.HasValue == false)
            {
                return(0);
            }

            if (dokMetre < (plan.Miktar / 2) + (plan.Miktar * 0.2))
            {
                int snc = this.TezgahPlanOtele(atkiGiris.TezgahId, atkiGiris.Tarih.Value, 1, atkiOtelemesiMi: true);
                if (snc == 1)
                {
                    atkiGiris.PlanOteledi = true;
                    db.UpdateGeneric <tblTezgahAtkiGiris>(atkiGiris);
                }
                return(snc);
            }

            return(1);
        }