Ejemplo n.º 1
0
 private void procQuanLyDonhang_ViewGridControl_Click(object sender, EventArgs e)
 {
     try
     {
         databinding();
         var db  = new MyDBContextDataContext();
         var lst = (from s in db.DonSanXuat_LanhLieu_QuanLyDonHang_SanXuat_Null() where s.SCD == sCDTextEdit.Text select s).Single();
         if (lst.BoPhanSX != null)
         {
             MessageBox.Show("Đơn hàng đã chuyển đổi bộ phận " + lst.BoPhan + " sang bộ phận " + lst.BoPhanSX + " ");
         }
     }
     catch (Exception)
     {
         //null
     }
 }
Ejemplo n.º 2
0
        private void frmLanhLieu_Load_1(object sender, EventArgs e)
        {
            SearchLookup();
            var db  = new MyDBContextDataContext();
            var lst = (from s in db.DonSanXuat_LanhLieu_QuanLyDonHang_SanXuat_Null() select s).ToList();

            foreach (var collection in lst)
            {
                if (collection.BoPhanSX != null)
                {
                    collection.BoPhan       = collection.BoPhanSX;
                    collection.PhuongPhapIn = collection.PhuongPhapInSX;
                }
                if (collection.VatLieuSX != null)
                {
                    collection.VatLieu = collection.VatLieuSX;
                    collection.Kho     = collection.KhoSX;
                }
            }

            procDonSanXuat_ViewGridControl.DataSource = lst;
            //dsxCtr.LoadData_DonSanXuat_LanhLieu_QuanLyDonHang_SanXuat_Null();
            databing();
        }
Ejemplo n.º 3
0
        public void check()
        {
            var db  = new MyDBContextDataContext();
            var lst = (from s in db.DonSanXuat_LanhLieu_QuanLyDonHang_SanXuat_Null()
                       where s.NghiepVu_XuongDon != null
                       select s).ToList();

            //var lst = (from s in db.tbQuanLyDonHangs join x in db.tbDonSanXuats on s.IDQuanLyDonHang equals x.SCD select s).ToList();
            foreach (var item in lst)
            {
                if (item.BoPhanSX != null)
                {
                    item.BoPhan       = item.BoPhanSX;
                    item.PhuongPhapIn = item.PhuongPhapInSX;
                }
                if (item.VatLieuSX != null)
                {
                    item.VatLieu = item.VatLieuSX;
                    item.Kho     = item.KhoSX;
                }
                if (item.NghiepVu_XuongDon != null)
                {
                    item.NghiepVu_XuongDon     = "True";
                    NghiepvuCheck.ValueChecked = "True";
                }

                if (item.ThietKeNhan != null)
                {
                    item.ThietKeNhan = "True";
                    thietkenhancheck.ValueChecked = "True";
                }

                if (item.ThietKeHoanThanh != null)
                {
                    item.ThietKeHoanThanh       = "True";
                    thietkehtcheck.ValueChecked = "True";
                }

                if (item.CtpNhan != null)
                {
                    item.CtpNhan = "True";
                    CtpNhanCheck.ValueChecked = "True";
                }

                if (item.CtpHoanThanh != null)
                {
                    item.CtpHoanThanh = "True";
                    CtpHoanthanhCheck.ValueChecked = "True";
                }

                if (item.OffsetNhan != null)
                {
                    item.OffsetNhan = "True";
                    OffsetNhanCheck.ValueChecked = "True";
                }

                if (item.OffsetHoanThanh != null)
                {
                    item.OffsetHoanThanh = "True";
                    OffsetHoanthanhCheck.ValueChecked = "True";
                }

                if (item.KyThuatSoNhan != null)
                {
                    item.KyThuatSoNhan        = "True";
                    KtsNhanCheck.ValueChecked = "True";
                }

                if (item.KyThuatSoHoanThanh != null)
                {
                    item.KyThuatSoHoanThanh        = "True";
                    KtsHoanthanhCheck.ValueChecked = "True";
                }

                if (item.DanhThiepNhan != null)
                {
                    item.DanhThiepNhan = "True";
                    DanhthiepNhanCheck.ValueChecked = "True";
                }

                if (item.DanhThiepHoanThanh != null)
                {
                    item.DanhThiepHoanThanh = "True";
                    DanhthiepHoanthanhCheck.ValueChecked = "True";
                }

                if (item.StickerNhan != null)
                {
                    item.StickerNhan = "True";
                    StickerNhanCheck.ValueChecked = "True";
                }

                if (item.StickerHoanThanh != null)
                {
                    item.StickerHoanThanh = "True";
                    StickerHoanthanhCheck.ValueChecked = "True";
                }

                if (item.TemVaiNhan != null)
                {
                    item.TemVaiNhan = "True";
                    TemvaiNhanCheck.ValueChecked = "True";
                }

                if (item.TemVaiHoanThanh != null)
                {
                    item.TemVaiHoanThanh = "True";
                    TemvaiHoanthanhCheck.ValueChecked = "True";
                }

                if (item.InChuNhan != null)
                {
                    item.InChuNhan = "True";
                    InchuNhanCheck.ValueChecked = "True";
                }

                if (item.InChuHoanThanh != null)
                {
                    item.InChuHoanThanh = "True";
                    InchuHoanThanhCheck.ValueChecked = "True";
                }

                if (item.KiemPhamNhan != null)
                {
                    item.KiemPhamNhan = "True";
                    KiemphamNhanCheck.ValueChecked = "True";
                }

                if (item.KiemPhamHoanThanh != null)
                {
                    item.KiemPhamHoanThanh = "True";
                    KiemphamHoanthanhCheck.ValueChecked = "True";
                }

                if (item.KhoBTPNhan != null)
                {
                    item.KhoBTPNhan           = "True";
                    KhoNhanCheck.ValueChecked = "True";
                }

                if (item.KhoBTPHoanThanh != null)
                {
                    item.KhoBTPHoanThanh           = "True";
                    KhoHoanthanhCheck.ValueChecked = "True";
                }

                if (item.SauInNhan != null)
                {
                    item.SauInNhan = "True";
                    SauinNhanCheck.ValueChecked = "True";
                }

                if (item.SauInHoanThanh != null)
                {
                    item.SauInHoanThanh = "True";
                    SauinHoanthanhCheck.ValueChecked = "True";
                }

                if (item.HoanThanh != null)
                {
                    item.HoanThanh = "True";
                    SanxuatHoanThanhCheck.ValueChecked = "True";
                }

                procQuanLyDonhang_ViewGridControl.DataSource = lst;
            }
        }
Ejemplo n.º 4
0
        private void procDonSanXuat_ViewGridControl_Click(object sender, EventArgs e)
        {
            chieudai = kichThuocTextEdit.Text.ToUpper().Replace("MM", "");
            // xóa dữ liệu
            Clear();

            // click chọn sẽ tab đến bộ phận của đơn hàng đó
            try
            {
                var db = new MyDBContextDataContext();
                var ll = (from s in db.DonSanXuat_LanhLieu_QuanLyDonHang_SanXuat_Null() where s.SCD == sCDTextEdit.Text select s).Single();
                if (ll.BoPhanSX != null)
                {
                    boPhanTextEdit.Text = ll.BoPhanSX;
                    MessageBox.Show("Đơn hàng đã chuyển đổi bộ phận " + ll.BoPhanSX + " , mọi người xem kỹ khi tính liệu");
                }

                var vatlieu = (from s in db.VatLieu_4C() where s.TenHangHoa == vatLieuTextEdit.Text select s).ToList();
                if (boPhanTextEdit.Text == offset)
                {
                    xtraTabControl1.SelectedTabPage        = tpOffset;
                    QuycachOffset.Properties.DataSource    = vatlieu;//vlCtr.GetData1C(vatLieuTextEdit.Text);
                    QuycachOffset.Properties.DisplayMember = "QuyCach";
                    QuycachOffset.Properties.ValueMember   = "QuyCach";
                    if (ll.LanhLieu == null)
                    {
                        if (tenKhachHangTextEdit.Text == PrintRibbon.AD)
                        {
                            SLSXOffset.Value = soLuongTextEdit.Value;
                        }
                        else
                        {
                            SLSXOffset.Value = soLuongTextEdit.Value * 115 / 100;
                        }
                        if (khoTextEdit.Text == banthanhpham || khoTextEdit.Text == thanhpham)
                        {
                            CatGiayOffset.Text = "1K";
                        }
                    }
                    else
                    {
                        KhoGiayInOffset.Text         = ll.KhoGiayIn;
                        CatGiayOffset.Text           = ll.CatGiay;
                        soLuongDanTrangTextEdit.Text = ll.SoLuongDanTrang.ToString();
                        SLSXOffset.Text        = ll.SoLuongSanXuat.ToString();
                        soTrangInTextEdit.Text = ll.SoTrangIn;
                        buHaoTextEdit.Text     = ll.BuHao.ToString();
                        ctpOffsetTextEdit.Text = ll.CtpOffset.ToString();
                        QuycachOffset.Text     = ll.QuyCach;
                        if (ll.Kho == nguyenvatlieu)
                        {
                            var vl = (from a in db.tbVatLieus
                                      where a.TenHangHoa == ll.VatLieu && a.QuyCach == ll.QuyCach
                                      select a).Single();
                            btnTinhOffset.Text = ll.LanhLieu + " " + ll.DonViTinh + " (" + vatLieuTextEdit.Text +
                                                 ") " +
                                                 " " + ll.QuyCach;
                        }
                        else
                        {
                            btnTinhOffset.Text = ll.LanhLieu + " " + ll.DonViTinh + " " + vatLieuTextEdit.Text;
                        }
                    }
                }
                else if (boPhanTextEdit.Text == temvai)
                {
                    //var vatlieu = (from s in db.VatLieu_4C() where s.TenHangHoa == vatLieuTextEdit.Text select s).ToList();
                    QuyCachTemVaiSearch.Properties.DataSource    = vatlieu;
                    QuyCachTemVaiSearch.Properties.DisplayMember = "QuyCach";
                    QuyCachTemVaiSearch.Properties.ValueMember   = "QuyCach";

                    xtraTabControl1.SelectedTabPage = tpTemVai;
                    var _kichthuoc = chieudai.Split('*');
                    txtChieuDai.Text = _kichthuoc[1];
                    if (ll.LanhLieu == null)
                    {
                        txtSLSXTemVai.Value = soLuongTextEdit.Value;
                        txtChieuDai.Text    = _kichthuoc[1];

                        if (tenKhachHangTextEdit.Text == PrintRibbon.AD)
                        {
                            txtBuHaoTemVai.Value = (decimal)1.06;
                            foreach (var item in vatlieu)
                            {
                                QuyCachTemVaiSearch.Text = item.QuyCach;
                                break;
                            }
                        }
                        else
                        {
                            txtBuHaoTemVai.Value = (decimal)1.06;
                        }
                    }
                    else
                    {
                        if (ll.SoLuongSanXuat != null)
                        {
                            txtSLSXTemVai.Value = ll.SoLuongSanXuat.Value;
                        }
                        txtBuHaoTemVai.Text      = ll.BuHao.ToString();
                        btnTinhTemVai.Text       = ll.LanhLieu.ToString();
                        QuyCachTemVaiSearch.Text = ll.QuyCach;
                    }
                }
                else if (boPhanTextEdit.Text == danhthiep)
                {
                    xtraTabControl1.SelectedTabPage = tpDanhThiep;
                    if (ll.LanhLieu == null)
                    {
                        txtBuHaoDanhThiep.Text = "1.04";
                        txtSLDTDanhThiep.Value = 1;
                    }
                    else
                    {
                        txtSLSX_DanhThiep.Text = ll.SoLuongSanXuat.ToString();
                        txtSLDTDanhThiep.Text  = ll.SoLuongDanTrang.ToString();
                        txtBuHaoDanhThiep.Text = ll.BuHao.ToString();
                        txtCTPDanhThiep.Text   = ll.CtpOffset.ToString();
                        btnTinhDanhThiep.Text  = ll.LanhLieu + " " + ll.DonViTinh;
                    }
                }
                else if (boPhanTextEdit.Text == sticker)
                {
                    //var vatlieu = (from s in db.VatLieu_4C() where s.TenHangHoa == vatLieuTextEdit.Text select s).ToList();
                    QuyCachStickerSearch.Properties.DataSource    = vatlieu;
                    QuyCachStickerSearch.Properties.DisplayMember = "QuyCach";
                    QuyCachStickerSearch.Properties.ValueMember   = "QuyCach";

                    xtraTabControl1.SelectedTabPage = tpSticker;
                    var chon = chieudai.Split('*');
                    if (radioGroup1.SelectedIndex == 0)
                    {
                        _dantrang = Math.Round(Convert.ToDouble(chon[0]), 0);
                        _tinhlieu = Math.Round(Convert.ToDouble(chon[1]), 0);
                    }
                    else
                    {
                        _dantrang = Math.Round(Convert.ToDouble(chon[1]), 0);
                        _tinhlieu = Math.Round(Convert.ToDouble(chon[0]), 0);
                    }
                    if (ll.LanhLieu == null)
                    {
                        txtBuHaoSticker.Text = "1.05";
                        txtSLDTSticker.Text  = "2";
                    }
                    else
                    {
                        txtSLSXSticker.Text       = ll.SoLuongSanXuat.ToString();
                        txtSLDTSticker.Text       = ll.SoLuongDanTrang.ToString();
                        txtBuHaoSticker.Text      = ll.BuHao.ToString();
                        btnTinhSticker.Text       = ll.LanhLieu + " " + ll.DonViTinh;
                        QuyCachStickerSearch.Text = ll.QuyCach;
                    }
                }
                else if (boPhanTextEdit.Text == inchu)
                {
                    //var vatlieu = (from s in db.VatLieu_4C() where s.TenHangHoa == vatLieuTextEdit.Text select s).ToList();
                    QuyCachInChuSearch.Properties.DataSource    = vatlieu;
                    QuyCachInChuSearch.Properties.DisplayMember = "QuyCach";
                    QuyCachInChuSearch.Properties.ValueMember   = "QuyCach";
                    xtraTabControl1.SelectedTabPage             = tpInChuViTinh;
                    var chon = chieudai.Split('*');
                    if (radioGroup2.SelectedIndex == 0)
                    {
                        _dantrang = Math.Round(Convert.ToDouble(chon[0]), 0);
                        _tinhlieu = Math.Round(Convert.ToDouble(chon[1]), 0);
                    }
                    else
                    {
                        _dantrang = Math.Round(Convert.ToDouble(chon[0]), 0);
                        _tinhlieu = Math.Round(Convert.ToDouble(chon[1]), 0);
                    }


                    if (ll.LanhLieu == null)
                    {
                        txtBuHaoInChu.Text = "1.03";
                        if (ll.LoaiSanPham == "TEM GIẤY")
                        {
                            txtSLSXInChu.BackColor  = Color.LightGreen;
                            txtSLDTInChu.BackColor  = Color.LightGreen;
                            txtBuHaoInChu.BackColor = Color.LightGreen;
                            txtSLDTInChu.Text       = "1";
                        }
                        else if (ll.LoaiSanPham == "STICKER")
                        {
                            txtSLSXInChu.BackColor  = Color.LightSalmon;
                            txtSLDTInChu.BackColor  = Color.LightSalmon;
                            txtBuHaoInChu.BackColor = Color.LightSalmon;
                            radioGroup2.BackColor   = Color.LightSalmon;
                            txtSLDTInChu.Text       = "2";
                        }
                    }
                    else
                    {
                        txtSLSXInChu.Text       = ll.SoLuongSanXuat.ToString();
                        txtSLDTInChu.Text       = ll.SoLuongDanTrang.ToString();
                        txtBuHaoInChu.Text      = ll.BuHao.ToString();
                        btnTinhInChu.Text       = ll.LanhLieu + " " + ll.DonViTinh;
                        QuyCachInChuSearch.Text = ll.QuyCach;
                    }
                }
                else if (boPhanTextEdit.Text == sauin)
                {
                    xtraTabControl1.SelectedTabPage = tpSauIn;

                    txtKhoGiayInSauIn.Text = ll.KhoGiayIn;
                    txtCatGiaySauIn.Text   = ll.CatGiay;
                    txtSLDTSauIn.Text      = ll.SoLuongDanTrang.ToString();
                    txtSLSXSauIn.Text      = ll.SoLuongSanXuat.ToString();
                    txtSLTISauIn.Text      = ll.SoTrangIn;
                    txtBuHaoSauIn.Text     = ll.BuHao.ToString();
                    var khoGiayIn = (from a in db.tbKhoGiayIns where a.KhoIn == txtKhoGiayInSauIn.Text && a.CatGiay == txtCatGiaySauIn.Text select a).Single();
                    btnTinhSauIn.Text = ll.LanhLieu + " " + ll.DonViTinh + " (" + ll.VatLieu + ") " + khoGiayIn.GiayLon;
                }
                else if (boPhanTextEdit.Text == kts)
                {
                    xtraTabControl1.SelectedTabPage = tpKyThuatSo;
                    if (ll.LanhLieu == null)
                    {
                        if (soLuongTextEdit.Value < 5000)
                        {
                            txtBuHaoKTS.Text = "3";
                        }
                        else
                        {
                            txtBuHaoKTS.Text = "5";
                        }
                    }
                    else
                    {
                        txtSLSXKyThuatSo.Text  = ll.SoLuongSanXuat.ToString();
                        txtKhoGiayInKTS.Text   = ll.KhoGiayIn;
                        txtBuHaoKTS.Text       = ll.BuHao.ToString();
                        txtSoLuongSizeKTS.Text = ll.SoLuongSize.ToString();
                        txtSLDTKTS.Text        = ll.SoLuongDanTrang.ToString();
                        btnTinhKTS.Text        = ll.LanhLieu + " " + ll.DonViTinh + " " + ll.KhoGiayIn;
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }
        }