NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

public void KasaTalepKontrolYeni(Uretim UretimEntity, int MakineRefKey, DateTime _tarih)
{
DataBase = new BtDataContext();
//Üretimi açarken alt detaylardan biri eksik ise uyarı verip üretimi açıcak fakat diger malzemeleride talep etmicek
//Üretim devam ederken alt detay olmasa bile malzeme yok diye talep açılıcak
bool siradakiTalep = false;
islemler = new Datalar();
decimal birimSure = 0;
var stok = DataBase.StokTanims.Where(p => p.RefKey == UretimEntity.StokRefKey).ToList();
var isemri = DataBase.IsEmriTanims.Where(p => p.RefKey == UretimEntity.IsEmriRefKey).FirstOrDefault();

if (stok.Count == 0) return;
List<StokReceteTanim> detaystoklar = new List<StokReceteTanim>();
// Sıradaki iş kontrol parmetrik

int yenikontrol = SiradakiIs(UretimEntity.IsEmriNo);


if (yenikontrol == 0)
return;
else if (yenikontrol > 1) // yeni işemri Refkey varsa
{
isemri = DataBase.IsEmriTanims.Where(p => p.RefKey == yenikontrol).FirstOrDefault();
stok = DataBase.StokTanims.Where(p => p.RefKey == isemri.StokRefKey).ToList();

//işemrine göre detay kodlarını aldık
var donus = sapIslemler.IsEmriRecete(isemri.KokIsEmri, uretimyeri_, stok.First().StokKodu).Select(p => p.DetayKodu);
detaystoklar = DataBase.StokReceteTanims.Where(p => p.StokKodu == stok[0].StokKodu && donus.Contains(p.DetayKodu)).ToList();
siradakiTalep = true;
birimSure = Convert.ToDecimal(isemri.BirimSure);
}
else
{
detaystoklar = DataBase.StokReceteTanims.Where(p => p.StokKodu == stok[0].StokKodu && p.Aktif == true).ToList();
birimSure = UretimEntity.BirimSure.Value;
}

#region Boş kasa işlemleri
//boş kasa ekleme işlemide hatyanı stok gibi Oppanelden yapılacak
var boskasaKontrol = DataBase.KasaHarekets.Where(p => p.MakineRefKey == MakineRefKey && p.StokKodu == stok.FirstOrDefault().StokKodu && p.StokTuruRefKey == 3 && (p.Durum == 11 || p.Durum == 5)).ToList();
if (boskasaKontrol.Count == 0) // başarısız veya bekleyen talep varsa atla
{
var kasaTeslim = DataBase.KasaHarekets.Where(p => p.MakineRefKey == MakineRefKey && p.StokKodu == stok.FirstOrDefault().StokKodu && p.StokTuruRefKey == 3 && p.Durum == 3).ToList();
if (kasaTeslim.Count > 0)
{
decimal KalanSure = ((kasaTeslim.Sum(p => p.KalanMiktar).Value) * birimSure) / Convert.ToDecimal(isemri.CarpimAdedi.Replace(".", ","));

if (KalanSure < talepsuresi_)
{
BosKasaTalep(stok.FirstOrDefault().StokKodu, isemri.KokIsEmri, birimSure);
}
}
else if (siradakiTalep)
{
BosKasaTalep(stok.FirstOrDefault().StokKodu, isemri.KokIsEmri, birimSure);
}
}
#endregion

for (int i = 0; i < detaystoklar.Count; i++)
{
//Eger daha önceden açilan talep varsa kontrol edilir.
var kontrol = DataBase.KasaHarekets.Where(p => p.MakineRefKey == MakineRefKey && p.StokDetayKodu == detaystoklar[i].DetayKodu && (p.Durum == 11 || p.Durum == 5)).ToList();
//var kontrol = DataBase.KasaHarekets.Where(p => p.MakineRefKey == MakineRefKey && p.StokDetayKodu == detaystoklar[i].DetayKodu && (p.Durum == 11 || p.Durum == 5) && p.StokKodu == detaystoklar[i].StokKodu).ToList();
if (kontrol.Count > 0) continue;

// yarım + tam kasa varsa ? take ! yanlış olur
var kasaTeslim = DataBase.KasaHarekets.Where(p => p.MakineRefKey == MakineRefKey && p.Durum == 3 && p.StokDetayKodu == detaystoklar[i].DetayKodu).ToList();

if (kasaTeslim.Count > 0)
{
//Hat yanina koyulan toplam kasa miktarlarina göre hesap yapilir.Birim süreye ve kalan miktara göre ne kadar zaman kalmis hesapla
decimal KalanSure = ((kasaTeslim.Sum(p => p.KalanMiktar).Value / detaystoklar[i].KullanimMiktari.Value) * birimSure) / Convert.ToDecimal(isemri.CarpimAdedi.Replace(".", ","));

//Süre parametrik çekilir ve belli süreden az ise talep olustur.
if (KalanSure < talepsuresi_)
{
for (int t = 0; t < detaystoklar[i].TalepMiktari; t++) // Talep miktarı kadar talep aç
{
TalepOlustur(detaystoklar[i], isemri.KokIsEmri, birimSure);
}
}
}
else if (siradakiTalep) //siradaki plana geçişin ilk anında hiç olmayan stokdetaylar için talepaçılacak. önceki ile ortak olan stokdetaylar zaten üstteki kodda işlem görmeli
{
for (int t = 0; t < detaystoklar[i].TalepMiktari; t++)
{
TalepOlustur(detaystoklar[i], isemri.KokIsEmri, birimSure);
}
}
}

} // 3.0
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.