void Yukle_Hareket(int _ID) { if (Yukleme) { return; } try { if (hareket != null && hareket.EntityState != EntityState.Detached) { dbModel.Detach(hareket); } hareket = null; hareket = Isler.Stok.Ver_StokHareket(ref dbModel, _ID); if (hareket == null) { return; } ucKayitBilgi1.Yukle(hareket.KayitKullaniciID, hareket.KayitZaman, hareket.DuzenKullaniciID, hareket.DuzenZaman); } catch (Exception hata) { XtraMessageBox.Show("Stok Hareket Bilgileri Getirilirken Bir Hata Oluştu.\n\nHata:\n" + hata.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static stok_hareket Ver_StokHareket(ref otosisdbEntities DbModel, int ID) { stok_hareket har = null; har = (from abc in DbModel.stok_hareket where abc.ID == ID select abc).FirstOrDefault(); if (har != null) { DbModel.Refresh(RefreshMode.StoreWins, har); } return(har); }
void Kaydet() { if (!Isler.Yetki.Varmi_Yetki(80)) { return; } try { #region Kontroller if (lookUpDepolar.EditValue.ToString() == "-1") { XtraMessageBox.Show("Lütfen Stok Sayımı Yapılacak Depoyu Seçiniz.", "Depo Seçilmedi", MessageBoxButtons.OK, MessageBoxIcon.Warning); lookUpDepolar.Focus(); lookUpDepolar.Select(); return; } #endregion if (sayim != null && sayim.EntityState != EntityState.Detached) { dbModel.Detach(sayim); } sayim = null; sayim = new stok_sayim(); sayim.SirketID = Genel.AktifSirket.SirketID; int temp_DepoID = Convert.ToInt32(lookUpDepolar.EditValue); #region Aktarma sayim.DepoID = temp_DepoID; sayim.SadeceStoktakiler = chkSadeceStoktakiler.Checked; sayim.Aciklama = memoAciklama.Text; if (!string.IsNullOrEmpty(txtRaf1.Text)) { sayim.Raf1 = Convert.ToInt32(txtRaf1.Text); } if (!string.IsNullOrEmpty(txtSira1.Text)) { sayim.Sira1 = Convert.ToInt32(txtSira1.Text); } if (!string.IsNullOrEmpty(txtGoz1.Text)) { sayim.Goz1 = Convert.ToInt32(txtGoz1.Text); } if (!string.IsNullOrEmpty(txtRaf2.Text)) { sayim.Raf2 = Convert.ToInt32(txtRaf2.Text); } if (!string.IsNullOrEmpty(txtSira2.Text)) { sayim.Sira2 = Convert.ToInt32(txtSira2.Text); } if (!string.IsNullOrEmpty(txtGoz2.Text)) { sayim.Goz2 = Convert.ToInt32(txtGoz2.Text); } #endregion #region Kayıt sayim.KayitKullaniciID = Genel.AktifKullanici.KullaniciID; sayim.KayitZaman = DateTime.Now; dbModel.AddTostok_sayim(sayim); dbModel.SaveChanges(); Genel.AlertMesaj.Show(Genel.AnaEkran, "İşlem Başarılı", "Stok Sayımı Başarılı Bir Şekilde Kaydedilmiştir.", null, ResOtoSis.mark_blue); Ara_Sayimlar(); #endregion #region Sayım Kalemleri int? temp_Raf; int? temp_Sira; int? temp_Goz; string temp_ParcaNo = ""; int temp_StokKartID; decimal temp_MevcutMiktar = 0; decimal temp_SayilanMiktar = 0; bool temp_SayimDisi; decimal temp_Fark = 0; for (int i = 0; i < dt_Kalemler.Rows.Count; i++) { temp_SayimDisi = Convert.ToBoolean(dt_Kalemler.Rows[i]["SayimDisi"]); temp_SayilanMiktar = Convert.ToDecimal(dt_Kalemler.Rows[i]["SayilanMiktar"]); temp_MevcutMiktar = Convert.ToDecimal(dt_Kalemler.Rows[i]["MevcutMiktar"]); temp_StokKartID = Convert.ToInt32(dt_Kalemler.Rows[i]["StokKartID"]); temp_ParcaNo = dt_Kalemler.Rows[i]["ParcaNo"].ToString(); temp_Fark = Convert.ToDecimal(dt_Kalemler.Rows[i]["Fark"]); if (dt_Kalemler.Rows[i]["Raf"] == DBNull.Value) { temp_Raf = null; } else { temp_Raf = Convert.ToInt32(dt_Kalemler.Rows[i]["Raf"]); } if (dt_Kalemler.Rows[i]["Sira"] == DBNull.Value) { temp_Sira = null; } else { temp_Sira = Convert.ToInt32(dt_Kalemler.Rows[i]["Sira"]); } if (dt_Kalemler.Rows[i]["Goz"] == DBNull.Value) { temp_Goz = null; } else { temp_Goz = Convert.ToInt32(dt_Kalemler.Rows[i]["Goz"]); } stok_sayim_kalem sayKalem = new stok_sayim_kalem(); sayKalem.SayimID = sayim.SayimID; sayKalem.ParcaNo = temp_ParcaNo; sayKalem.StokKartID = temp_StokKartID; sayKalem.MevcutMiktar = temp_MevcutMiktar; sayKalem.SayilanMiktar = temp_SayilanMiktar; sayKalem.SayimDisi = temp_SayimDisi; sayKalem.Raf = temp_Raf; sayKalem.Sira = temp_Sira; sayKalem.Goz = temp_Goz; dbModel.AddTostok_sayim_kalem(sayKalem); dbModel.SaveChanges(); dbModel.Detach(sayKalem); sayKalem = null; //stok eşitleme işlemi yapılacak //Eğer fark varsa stok_hareket tablosuna işlenecek if (!temp_SayimDisi && temp_Fark != 0) { stok_hareket sh = new stok_hareket(); sh.StokSayimID = sayim.SayimID; sh.StokKartID = temp_StokKartID; sh.StokHareketTipi = ((int)Enumlar.StokHareketTipleri.StokSayimEsitleme).ToString(); sh.Giris = temp_Fark > 0 ? false : true; sh.Miktar = Math.Abs(temp_Fark); sh.ParcaNo = temp_ParcaNo; sh.KayitZaman = DateTime.Now; sh.KayitKullaniciID = Genel.AktifKullanici.KullaniciID; sh.DepoID = temp_DepoID; dbModel.AddTostok_hareket(sh); dbModel.SaveChanges(); dbModel.Detach(sh); sh = null; } } #endregion } catch (Exception hata) { throw; } }
void Kaydet() { try { #region Kontroller if (spinMiktar.Value == 0) { XtraMessageBox.Show("Lütfen Tahsis Miktarını 0'dan Büyük Bir Değer Giriniz.", "Eksik Alan", MessageBoxButtons.OK, MessageBoxIcon.Warning); spinMiktar.Focus(); spinMiktar.Select(); return; } if (ucStokKartDemo1.Secili_KartID <= 0) { XtraMessageBox.Show("Lütfen Stok Tahsis Yapılacak Stok Kalemini Seçiniz.", "Eksik Alan", MessageBoxButtons.OK, MessageBoxIcon.Warning); ucStokKartDemo1.Focus(); ucStokKartDemo1.Select(); return; } int temp_DepoID = Convert.ToInt32(lookUpDepolar.EditValue); if (radioGroup1.SelectedIndex == 1 && !Genel.Varmi_Stokta(ucStokKartDemo1.Secili_KartID, temp_DepoID, spinMiktar.Value)) { return; } if (string.IsNullOrEmpty(memoAciklama.Text.Trim())) { XtraMessageBox.Show("Stok Tahsisi Eklerken Açıklama Girilmesi Zorunludur.", "Eksik Alan", MessageBoxButtons.OK, MessageBoxIcon.Warning); memoAciklama.Focus(); memoAciklama.Select(); return; } if (XtraMessageBox.Show("Stok Tahsis Eklemek İstediğinize Emin Misiniz?", "Kayıt Onay", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } #endregion #region Aktarma - Kayıt if (hareket != null && hareket.EntityState != EntityState.Detached) { dbModel.Detach(hareket); } hareket = null; hareket = new stok_hareket(); if (radioGroup1.SelectedIndex == 0) { hareket.Giris = true; } else { hareket.Giris = false; } hareket.Aciklama = memoAciklama.Text; hareket.StokKartID = ucStokKartDemo1.Secili_KartID; hareket.StokHareketTipi = ((int)Enumlar.StokHareketTipleri.StokTahsisi).ToString(); hareket.Miktar = spinMiktar.Value; hareket.DepoID = temp_DepoID; hareket.ParcaNo = ucStokKartDemo1.sk.ParcaNo; hareket.KayitKullaniciID = Genel.AktifKullanici.KullaniciID; hareket.KayitZaman = DateTime.Now; dbModel.AddTostok_hareket(hareket); dbModel.SaveChanges(); Genel.AlertMesaj.Show(Genel.AnaEkran, "İşlem Başarılı", "Stok Tahsisi Başarılı Bir Şekilde Eklenmiştir.", null, ResOtoSis.mark_blue); #endregion if (XtraMessageBox.Show("Başka Stok Tahsis İşlemi Yapmak İstiyor Musunuz?", "Başka İşlem Yapılacak Mı?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { this.Close(); } else { ucStokKartDemo1.Temizle_Kart(); Temizle_StokTahsis(); } } catch (Exception hata) { XtraMessageBox.Show("Stok Tahsisi Yapılırken Bir Hata Oluştu.\n\nHata:\n" + hata.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void Kaydet() { try { #region Kontroller int temp_KartID; int temp_DepoID; string temp_KalemAdi; for (int i = 0; i < dt_Parcalar.Rows.Count; i++) { if (dt_Parcalar.Rows[i]["KartID"] != DBNull.Value) { temp_KartID = Convert.ToInt32(dt_Parcalar.Rows[i]["KartID"]); temp_DepoID = Convert.ToInt32(dt_Parcalar.Rows[i]["DepoID"]); temp_KalemAdi = dt_Parcalar.Rows[i]["KalemAdi"].ToString(); if (dt_Parcalar.Rows[i]["Miktar"] == DBNull.Value || Convert.ToDecimal(dt_Parcalar.Rows[i]["Miktar"]) <= 0) { XtraMessageBox.Show("Aşağıda Bilgileri Verilen Stok Kalemi Miktarı 0'dan Büyük Olmalıdır.\n\n" + "Kart No : " + temp_KartID.ToString() + "\nKalem Adı : " + temp_KalemAdi, "Miktar Girilmedi", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (radioGiris.SelectedIndex == 1 && Isler.Stok.StokAdet(temp_KartID, temp_DepoID) <= 0) { XtraMessageBox.Show("Aşağıda Bilgileri Verilen Stok Kalemi Seçilen Depoda Bulunmamaktadır.\n\n" + "Kart No : " + temp_KartID.ToString() + "\nKalem Adı : " + temp_KalemAdi, "Depo Seçilmedi", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } } #endregion #region Kayıt int? temp_AracID = null; decimal temp_Miktar; string temp_ParcaNo; for (int i = 0; i < dt_Parcalar.Rows.Count; i++) { if (dt_Parcalar.Rows[i]["KartID"] != DBNull.Value) { temp_KartID = Convert.ToInt32(dt_Parcalar.Rows[i]["KartID"]); temp_ParcaNo = dt_Parcalar.Rows[i]["ParcaNo"].ToString(); temp_DepoID = Convert.ToInt32(dt_Parcalar.Rows[i]["DepoID"]); temp_KalemAdi = dt_Parcalar.Rows[i]["KalemAdi"].ToString(); temp_Miktar = Convert.ToDecimal(dt_Parcalar.Rows[i]["Miktar"]); if (dt_Parcalar.Rows[i]["AracID"] == DBNull.Value) { temp_AracID = null; } else { temp_AracID = Convert.ToInt32(dt_Parcalar.Rows[i]["AracID"]); } sh = new stok_hareket(); sh.StokKartID = temp_KartID; sh.StokHareketTipi = ((int)Enumlar.StokHareketTipleri.StokTahsisi).ToString(); sh.Miktar = temp_Miktar; sh.DepoID = temp_DepoID; sh.ParcaNo = temp_ParcaNo; sh.AracID = temp_AracID; sh.Giris = radioGiris.SelectedIndex == 0 ? true : false; sh.Aciklama = memoAciklama.Text.Trim() == "" ? null : memoAciklama.Text; sh.KayitKullaniciID = Genel.AktifKullanici.KullaniciID; sh.KayitZaman = DateTime.Now; dbModel.AddTostok_hareket(sh); dbModel.SaveChanges(); dbModel.Detach(sh); sh = null; } } Genel.AlertMesaj.Show(Genel.AnaEkran, "İşlem Başarılı", "Stok Tahsisi Başarılı Bir Şekilde Kaydedilmiştir.", null, ResOtoSis.mark_blue); if (XtraMessageBox.Show("Başka Stok Tahsis İşlemi Yapmak İstiyor Musunuz?", "Başka İşlem Yapılacak Mı?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { this.Close(); } else { dt_Parcalar.Rows.Clear(); GridViewParcalar.AddNewRow(); } #endregion } catch (Exception hata) { throw; } }