private void CheckTrangthai() { dgvChiTiet.RefreshDataSource(); dgvChiTiet.SuspendLayout(); int currentProgress = frmProgress.Instance.Value; frmProgress.Instance.Value = 0; frmProgress.Instance.MaxValue = liChiTiet.Count; for (int i = 0; i < liChiTiet.Count; i++) { if (liChiTiet[i].TrangThai == 0 || liChiTiet[i].TrangThai == Convert.ToInt32(TrangThaiSanXuat.ChoXuat) || liChiTiet[i].TrangThai == Convert.ToInt32(TrangThaiSanXuat.DangSX)) { liChiTiet[i].SoLuongHT = SanXuatLenhProvier.GetSoLuongDNSanXuatLenh( Convert.ToInt32(TransactionType.NHAP_THANH_PHAM_SX), liChiTiet[i].MaLenh, currentTrungTam.MaTrungTam); if (liChiTiet[i].SoLuongHT == 0) { liChiTiet[i].TrangThai = Convert.ToInt32(TrangThaiSanXuat.ChoXuat); } if (liChiTiet[i].SoLuongHT > 0 && liChiTiet[i].SoLuongHT < liChiTiet[i].SoLuongTP && (liChiTiet[i].Status != 2 || liChiTiet[i].Status != 3)) { liChiTiet[i].TrangThai = Convert.ToInt32(TrangThaiSanXuat.DangSX); } if (liChiTiet[i].SoLuongHT == liChiTiet[i].SoLuongTP && liChiTiet[i].Status != 2) { liChiTiet[i].TrangThai = Convert.ToInt32(TrangThaiSanXuat.DaSanXuatXong); } if (liChiTiet[i].Status == 2) { liChiTiet[i].TrangThai = Convert.ToInt32(TrangThaiSanXuat.HuyLenh); } if (liChiTiet[i].SoLuongHT != liChiTiet[i].SoLuongTP && liChiTiet[i].Status == 3) { liChiTiet[i].TrangThai = Convert.ToInt32(TrangThaiSanXuat.NgungSanXuat); } SanXuatLenhProvier.Update1(liChiTiet[i]); } frmProgress.Instance.Value += 1; } dgvChiTiet.RefreshDataSource(); dgvChiTiet.ResumeLayout(); frmProgress.Instance.Value = currentProgress; }