示例#1
0
        public void BoyahaneProcessSec(vPartiProcessleri partiProcess)
        {
            vBoyahaneProcess process = null;

            if (partiProcess != null)
            {
                process = db.GetGeneric <vBoyahaneProcess>(c => c.PartiId == partiProcess.PartiId && c.ProcessId == partiProcess.ProcessId && c.Sira == partiProcess.Sira).LastOrDefault();
            }
            if (process != null)
            {
                _SecilenProcess = process;
            }
            else if (partiProcess != null)
            {
                _SecilenProcess = new vBoyahaneProcess()
                {
                    PartiId   = partiProcess.PartiId,
                    ProcessId = partiProcess.ProcessId,
                    Sira      = partiProcess.Sira
                };
            }
            else if (partiProcess == null)
            {
                _SecilenProcess = new vBoyahaneProcess();
            }
        }
示例#2
0
        public bool ProsesDahaOnceOkutulduMu(vPartiProcessleri process)
        {
            tblBoyahaneProcess prc = db.GetGeneric <tblBoyahaneProcess>(c => c.ProcessId == process.ProcessId && c.PartiId == process.PartiId && c.Sira == process.Sira && c.CikisTarih.HasValue == true && c.Silindi == false).FirstOrDefault();

            if (prc == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#3
0
 public bool ProcessSil(vPartiProcessleri process)
 {
     if (process.Id == 0)
     {
         this._Processler.Remove(process);
         return(true);
     }
     else
     {
         if (db.DeleteGeneric <tblPartiProsesleri>(process.ViewToTbl()))
         {
             this._Processler.Remove(process);
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
示例#4
0
        //Gökhan 16.05.2014
        public bool ProcessKaydet(vPartiProcessleri partiProcess, string btn, string comment, double metre)
        {
            if (PartiProcessleri.Exists(c => c.ProcessId == _SecilenProcess.ProcessId))
            {
                if (btn == "Bitir")
                {
                    if (SecilenProcess.Metre < Parti.PartiMetre * 0.90)
                    {
                        throw new Exception("Az kumaş açılmış..!");
                    }

                    if (SecilenProcess.Metre > Parti.PartiMetre * 1.10)
                    {
                        throw new Exception("Fazla kumaş açılmış..!");
                    }
                }

                vBoyahaneProcess sonOkutulan = db.GetGeneric <vBoyahaneProcess>(c => c.PartiId == this.Parti.Id && c.Silindi == false).OrderBy(e => e.Sira).LastOrDefault();

                if (sonOkutulan != null)
                {
                    //25.06.15 Mehmet
                    //Fasona sevk edildi mi kontrolü yapılacak.
                    bool FasonaSevkEdilmisMi = Mamul.FasonaSevkEdilmisMi(Parti.Id);

                    if (sonOkutulan.FasonMu && FasonaSevkEdilmisMi == false)
                    {
                        throw new Exception("Fason gönderime hazır.\n\nMamul kaliteye geçmelisiniz..!");
                    }

                    if (DateTime.Now.TimeOfDay.Subtract(sonOkutulan.Saat.TimeOfDay) < new TimeSpan(0, 15, 0)) //process okutma hızı kontrolü
                    {
                        if (CabukOkutmaIsaretle() == false)
                        {
                            throw new Exception("Hata oluştu.\n\nKaydedilemedi..!\nHiZ");
                        }
                    }

                    tblBoyahaneProcess cikisiOkutulmayan = db.GetGeneric <tblBoyahaneProcess>(c => c.PartiId == this.Parti.Id && c.CikisTarih.HasValue == false && c.Silindi == false && c.Id != _SecilenProcess.Id).FirstOrDefault();
                    tblBoyahaneProcess durmusVarMi       = db.GetGeneric <tblBoyahaneProcess>(c => c.PartiId == this.Parti.Id && c.CikisTarih.HasValue == false && c.Durdu == true).FirstOrDefault();
                    if (cikisiOkutulmayan != null)
                    {
                        if (cikisiOkutulmayan.ProcessId != this._SecilenProcess.ProcessId)
                        {
                            throw new Exception("Devam eden Process var.\n\nEklenemez..!");
                        }
                    }

                    int ind = PartiProcessleri.FindIndex(c => c.Sira == sonOkutulan.Sira && c.ProcessId == sonOkutulan.ProcessId);
                    if (PartiProcessleri.Count() != (ind + 1))
                    {
                        if (PartiProcessleri[ind + 1].Sira < partiProcess.Sira)
                        {
                            throw new Exception("Daha önceki process okutulmamış.\n\nEklenemez...!");
                        }
                    }
                }
                else
                {
                    if (this.PartiProcessleri[0].ProcessId != this._SecilenProcess.ProcessId)
                    {
                        throw new Exception("Daha önceki process okutulmamış.\n\nEklenemez..!");
                    }
                }
            }
            else
            {
                throw new Exception("Process bulunamadı..!");
            }

            tblBoyahaneProcess tblProcess = _SecilenProcess.ViewToTbl();

            tblProcess.PartiId = Parti.Id;
            int tempControl = -1;

            if (tblProcess.Id == 0)
            {
                tblProcess.Tarih = DateTime.Today;
                tblProcess.Saat  = DateTime.Now;
            }
            else
            {
                tblBoyahaneProcess iptalEdilecek;
                try
                {
                    iptalEdilecek = db.GetGeneric <tblBoyahaneProcess>(c => c.PartiId == this.Parti.Id).OrderBy(e => e.Id).Last();
                    if (iptalEdilecek.CikisTarih.HasValue != false)
                    {
                        iptalEdilecek = null;
                    }
                }
                catch (Exception)
                {
                    iptalEdilecek = null;
                }
                tblBoyahaneProcess cikisiOkutulmayan = db.GetGeneric <tblBoyahaneProcess>(c => c.PartiId == this.Parti.Id && c.CikisTarih.HasValue == false && c.Durdu != true).OrderBy(e => e.Sira).LastOrDefault();
                tblBoyahaneProcess ikinciBaslami     = db.GetGeneric <tblBoyahaneProcess>(c => c.PartiId == this.Parti.Id && c.CikisTarih.HasValue == false && c.Durdu != false).OrderBy(e => e.Sira).LastOrDefault();

                if (btn == "Başla")
                {
                    if (cikisiOkutulmayan == null)
                    {
                        tblProcess.Id         = 0;
                        tblProcess.CikisTarih = null;
                        tblProcess.CikisSaat  = null;
                        tblProcess.Tarih      = DateTime.Today;
                        tblProcess.Saat       = DateTime.Now;
                        tblProcess.Durdu      = false;
                        tblProcess.Silindi    = false;
                        tblProcess.Aciklama   = null;
                        tblProcess.ArizaId    = null;
                        tempControl           = 0;
                    }
                    else
                    {
                        if (ikinciBaslami != null)
                        {
                            tblProcess.CikisTarih = DateTime.Today;
                            tblProcess.CikisSaat  = DateTime.Now;
                            tblProcess.Durdu      = true;
                            tempControl           = 3;
                        }
                        else
                        {
                            throw new Exception("Devam eden process var!...");
                        }
                    }
                }
                else if (btn == "Bitir")
                {
                    if (cikisiOkutulmayan != null)
                    {
                        if (ikinciBaslami == null)
                        {
                            tblProcess            = cikisiOkutulmayan;
                            tempControl           = 2;
                            tblProcess.CikisTarih = DateTime.Today;
                            tblProcess.CikisSaat  = DateTime.Now;
                            tblProcess.Durdu      = false;
                        }
                        else
                        {
                            throw new Exception("Devam eden process var!...");
                        }
                    }
                    else
                    {
                        throw new Exception("Başlatılmış process yok!...");
                    }
                }
                else if (btn == "Dur")
                {
                    if (cikisiOkutulmayan != null)
                    {
                        if (ikinciBaslami == null)
                        {
                            tblProcess.Id         = 0;
                            tblProcess.CikisTarih = null;
                            tblProcess.CikisSaat  = null;
                            tblProcess.Tarih      = DateTime.Today;
                            tblProcess.Saat       = DateTime.Now;
                            tblProcess.Durdu      = true;
                            tblProcess.ArizaId    = Convert.ToInt32(comment.Substring(0, comment.IndexOf("?")));
                            if ((comment.Length - comment.IndexOf("?") > 1))
                            {
                                tblProcess.Aciklama = comment.Substring(comment.IndexOf("?") + 1, (comment.Length - comment.IndexOf("?") - 1));
                            }
                            else
                            {
                                tblProcess.Aciklama = null;
                            }
                            tblProcess.Silindi = false;
                            tempControl        = 1;
                        }
                        else
                        {
                            throw new Exception("Durdurulmuş işlem var!...");
                        }
                    }
                    else
                    {
                        throw new Exception("Başlatılmış process yok!...");
                    }
                }
                else if (btn == "Iptal")
                {
                    if (iptalEdilecek != null)
                    {
                        tblProcess            = iptalEdilecek;
                        tempControl           = 3;
                        tblProcess.Silindi    = true;
                        tblProcess.CikisTarih = DateTime.Today;
                        tblProcess.CikisSaat  = DateTime.Now;
                    }
                    else
                    {
                        throw new Exception("İptal edilebilecek process yok!...");
                    }
                }
                else if (btn == "Not")
                {
                    tblProcess.Aciklama = comment;
                    tempControl         = 4;
                }
            }

            tblProcess.Sira  = partiProcess.Sira;
            tblProcess.Metre = metre; //txtmetre alanından geliyor.
            if (btn == "Başla")
            {
                if (tblProcess.Id == 0)
                {
                    tblProcess.Durdu   = false;
                    tblProcess.Silindi = false;
                    if (tblProcess.Id == 0)
                    {
                        if (tblProcess.ProcessId == 60)
                        {
                            tblProcess.CikisSaat  = DateTime.Now;
                            tblProcess.CikisTarih = DateTime.Now;
                        }
                        if (db.SaveGeneric <tblBoyahaneProcess>(tblProcess) == false)
                        {
                            throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                        }
                    }
                    if (tblProcess.Id != 0)
                    {
                        if (db.UpdateGeneric <tblBoyahaneProcess>(tblProcess) == false)
                        {
                            throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                        }
                    }
                }
                else
                {
                    if (tempControl == 0)
                    {
                        if (db.SaveGeneric <tblBoyahaneProcess>(tblProcess) == false)
                        {
                            throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                        }
                    }
                    else
                    {
                        if (db.UpdateGeneric <tblBoyahaneProcess>(tblProcess) == false)
                        {
                            throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                        }
                    }
                }
            }
            else if (btn == "Dur")
            {
                if (tempControl == 1)
                {
                    if (db.SaveGeneric <tblBoyahaneProcess>(tblProcess) == false)
                    {
                        throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                    }
                }
                else
                {
                    throw new Exception("Başlamamış Processi duraklatamazsın..!");
                }
            }
            else if (btn == "Bitir")
            {
                if (tempControl == 2)
                {
                    if (BesDakikaOlduMu(tblProcess.PartiId, tblProcess.ProcessId))
                    {
                        if (db.UpdateGeneric <tblBoyahaneProcess>(tblProcess) == false)
                        {
                            throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                        }
                    }
                    else
                    {
                        throw new Exception("5 dakika dolmadan process bitirilemez..!");
                    }
                }
                else
                {
                    throw new Exception("Önce Processi başlatmalısınız..!");
                }
            }
            else if (btn == "Iptal")
            {
                if (tempControl == 3)
                {
                    if (db.UpdateGeneric <tblBoyahaneProcess>(tblProcess) == false)
                    {
                        throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                    }
                }
                else
                {
                    throw new Exception("İptal edilecek Process bulunamadı..!");
                }
            }
            else
            {
                if (tempControl == 4)
                {
                    if (db.UpdateGeneric <tblBoyahaneProcess>(tblProcess) == false)
                    {
                        throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                    }
                }
                else
                {
                    throw new Exception("not edilecek Process bulunamadı..!");
                }
            }

            return(true);
        }
示例#5
0
        public bool ProcessKaydet(vPartiProcessleri partiProcess)
        {
            if (PartiProcessleri.Exists(c => c.ProcessId == _SecilenProcess.ProcessId))
            {
                //List<tblBoyahaneProcess> listBoyahane = db.GetGeneric<tblBoyahaneProcess>(c => c.PartiId == Parti.Id);

                if (SecilenProcess.Metre < Parti.PartiMetre * 0.90)
                {
                    throw new Exception("Az kumaş açılmış..!");
                }

                if (SecilenProcess.Metre > Parti.PartiMetre * 1.10)
                {
                    throw new Exception("Fazla kumaş açılmış..!");
                }

                vBoyahaneProcess sonOkutulan = db.GetGeneric <vBoyahaneProcess>(c => c.PartiId == this.Parti.Id).OrderBy(e => e.Sira).LastOrDefault();

                if (sonOkutulan != null)
                {
                    if (sonOkutulan.FasonMu)
                    {
                        throw new Exception("Fason gönderime hazır.\n\nMamul kaliteye geçmelisiniz..!");
                    }

                    if (DateTime.Now.TimeOfDay.Subtract(sonOkutulan.Saat.TimeOfDay) < new TimeSpan(0, 15, 0)) //process okutma hızı kontrolü
                    {
                        if (CabukOkutmaIsaretle() == false)
                        {
                            throw new Exception("Hata oluştu.\n\nKaydedilemedi..!\nHiZ");
                        }
                    }

                    tblBoyahaneProcess cikisiOkutulmayan = db.GetGeneric <tblBoyahaneProcess>(c => c.PartiId == this.Parti.Id && c.CikisTarih.HasValue == false && c.Id != _SecilenProcess.Id).FirstOrDefault();
                    if (cikisiOkutulmayan != null)
                    {
                        throw new Exception("Önceki process'in çıkış okutması yapılmamış.\n\nEklenemez..!");
                    }

                    int ind = PartiProcessleri.FindIndex(c => c.Sira == sonOkutulan.Sira && c.ProcessId == sonOkutulan.ProcessId);
                    if (PartiProcessleri[ind + 1].Sira < partiProcess.Sira)
                    {
                        throw new Exception("Daha önceki process okutulmamış.\n\nEklenemez..!");
                    }

                    if (ReProcessIsaretle() == false)
                    {
                        throw new Exception("Hata oluştu.\n\nKaydedilemedi..!\nReP");
                    }
                }
                else
                {
                    if (this.PartiProcessleri[0].ProcessId != this._SecilenProcess.ProcessId)
                    {
                        throw new Exception("Daha önceki process okutulmamış.\n\nEklenemez..!");
                    }
                }
            }
            else
            {
                throw new Exception("Process bulunamadı..!");
            }

            tblBoyahaneProcess tblProcess = _SecilenProcess.ViewToTbl();

            tblProcess.PartiId = Parti.Id;
            if (tblProcess.Id == 0)
            {
                tblProcess.Tarih = DateTime.Today;
                tblProcess.Saat  = DateTime.Now;
            }
            else
            {
                if (tblProcess.CikisTarih.HasValue == false)
                {
                    tblProcess.CikisTarih = DateTime.Today;
                    tblProcess.CikisSaat  = DateTime.Now;
                }
                else
                {
                    tblProcess.Id         = 0;
                    tblProcess.CikisTarih = null;
                    tblProcess.CikisSaat  = null;
                    tblProcess.Tarih      = DateTime.Today;
                    tblProcess.Saat       = DateTime.Now;
                }
            }
            tblProcess.Sira = partiProcess.Sira;

            if (tblProcess.Id == 0)
            {
                if (db.SaveGeneric <tblBoyahaneProcess>(tblProcess) == false)
                {
                    throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                }
            }
            if (tblProcess.Id != 0)
            {
                if (db.UpdateGeneric <tblBoyahaneProcess>(tblProcess) == false)
                {
                    throw new Exception("Hata oluştu.\n\nKaydedilemedi..!");
                }
            }

            return(true);
        }