/// <summary> /// Get Danh sách số xe và biển số /// </summary> public static void GetVehicleGPS() { try { if (!ThongTinCauHinh.GPS_TrangThai) { return; } // Vehicles_GPS = WCFService_Common.WCFServiceClient.GetVehicles(); if (Vehicles_GPS == null) { Vehicles_GPS = new Dictionary <string, string>(); } var newVehicles_GPS = WCFService_Common.GetVehicles(); newVehicles_GPS.SLeftJoin(Vehicles_GPS, nvo => nvo.Key, vo => vo.Key, (nvo, vo) => { if (nvo.Value != vo.Value) { Vehicles_GPS[nvo.Key] = nvo.Value; } }, nvo => { Vehicles_GPS.Add(nvo.Key, nvo.Value); }); } catch (Exception ex) { LogError.WriteLogError(ex.Message, ex); } }
public void LoadXeOnline() { #region Get Xe online isLoadSuccess = false; if (ThongTinCauHinh.GPS_TrangThai) { try { if (Global.HasGPS) { T_XeOnline[] listXeOnline = WCFService_Common.GetListObjectXeOnline(); if (listXeOnline != null) { UpdateListXeOnline(listXeOnline); } } } catch (Exception ex) { if (new MessageBox.MessageBoxBA().Show("Không thể kết nối đến dịch vụ đồng bộ xe GPS. Bạn có muốn thử lại không?", "Lỗi", MessageBox.MessageBoxButtonsBA.RetryCancel, MessageBox.MessageBoxIconBA.Error) != MessageBox.MessageBoxResult.Retry) { Global.HasGPS = false; isLoadSuccess = true; LogError.WriteLogError("LoadXeOnline: ", ex); } } } #endregion }
private void GetXeDeCu() { try { if (g_CuocGoi.GPS_KinhDo > 0 && g_CuocGoi.GPS_ViDo > 0) { if (MainMap.OverlayXeDeCu != null && MainMap.OverlayXeDeCu.Markers != null) { MainMap.OverlayXeDeCu.Markers.Clear(); } string loaiXeGPS = ""; string loaiXe = g_CuocGoi.LoaiXe; int SoXeTraVe = 4 + Convert.ToInt16(g_CuocGoi.SoLuong); if (string.IsNullOrEmpty(loaiXe)) // neu ko co chon loai xe thi tat ca loai xe { loaiXeGPS = new Taxi.Business.DM.Xe().LayDanhSachLoaiXe_GPS("0,4,7"); } else { loaiXeGPS = new Taxi.Business.DM.Xe().LayDanhSachLoaiXe_GPS(loaiXe); } string dsXeDeCu = string.Empty; //if (!string.IsNullOrEmpty(g_CuocGoi.DanhSachXeDeCu)) //{ // dsXeDeCu = g_CuocGoi.DanhSachXeDeCu; //} //else //{ dsXeDeCu = WCFService_Common.LayDanhSachXeDeCu_ToaDoV2(g_CuocGoi.GPS_KinhDo, g_CuocGoi.GPS_ViDo, ThongTinCauHinh.GPS_MaCungXN, loaiXeGPS, 5000, true, SoXeTraVe, g_CuocGoi.ThoiDiemGoi, g_CuocGoi.IDCuocGoi, g_CuocGoi.PhoneNumber, g_CuocGoi.DiaChiDonKhach); // } if (!string.IsNullOrEmpty(dsXeDeCu)) { setResult(dsXeDeCu.Trim()); } } else { new MessageBox.MessageBoxBA().Show("Cuộc gọi này chưa lấy GPS"); } } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "", DateTime.Now, ex.Message); new MessageBox.MessageBoxBA().Show(ex.Message); } }
private void GetXeDeCu() { try { if (!ThongTinCauHinh.GPS_TrangThai) { return; } if (g_CuocGoi.GPS_KinhDo > 0 && g_CuocGoi.GPS_ViDo > 0) { if (MainMap.OverlayXeDeCu != null && MainMap.OverlayXeDeCu.Markers != null) { MainMap.OverlayXeDeCu.Markers.Clear(); } string loaiXeGPS = ""; string loaiXe = g_CuocGoi.LoaiXe; int SoXeTraVe = 4 + Convert.ToInt16(g_CuocGoi.SoLuong); if (string.IsNullOrEmpty(loaiXe)) // neu ko co chon loai xe thi tat ca loai xe { loaiXeGPS = new Taxi.Business.DM.Xe().LayDanhSachLoaiXe_GPS("0,4,7"); } else { loaiXeGPS = new Taxi.Business.DM.Xe().LayDanhSachLoaiXe_GPS(loaiXe); } string dsXeDeCu = string.Empty; dsXeDeCu = WCFService_Common.LayDanhSachXeDeCu_ToaDoV2(g_CuocGoi.GPS_KinhDo, g_CuocGoi.GPS_ViDo, ThongTinCauHinh.GPS_MaCungXN, loaiXeGPS, 5000, true, SoXeTraVe, g_CuocGoi.ThoiDiemGoi, g_CuocGoi.IDCuocGoi, g_CuocGoi.PhoneNumber, g_CuocGoi.DiaChiDonKhach); setResult(dsXeDeCu.Trim()); } else { } } catch (Exception ex) { ThongTinCauHinh.GPS_TrangThai = false; } }
private void TimXe(string soHieuXe) { try { T_XeOnline XeOnline = new T_XeOnline(); XeOnline = WCFService_Common.GetXeOnlineBySHX(soHieuXe); if (XeOnline == null) { new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); } else { if (XeOnline.ThoiDiemChenDuLieu <= DateTime.Now.AddMinutes(-150)) { new MessageBox.MessageBoxBA().Show(string.Format("Xe {0} đã mất tín hiệu GPS.", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); } else { //new MessageBox.MessageBox().Show(XeOnline.ViDo.ToString() + "-" + XeOnline.KinhDo.ToString()); //PointLatLng point = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo); string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Service_Common.GetAddressByGeoBA((float)XeOnline.ViDo, (float)XeOnline.KinhDo)); int trangThai = 0;//xe tắt máy if ((XeOnline.TrangThai & 3) > 0) { trangThai = 2;//xe co khach } else if ((XeOnline.TrangThai & 8) == 0) { trangThai = 1;//xe bật máy. } //if (MainMap.OverlayXeDeCu != null && MainMap.OverlayXeDeCu.Markers != null) // MainMap.OverlayXeDeCu.Markers.Clear(); //if (MainMap.MarkerXeDeCu != null) // MainMap.MarkerXeDeCu.Overlay.Clear(); MainMap.addMarkerXeDeCu3(trangThai, XeOnline.KinhDo, XeOnline.ViDo, strDiaChi); MainMap.Position = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo); } } } catch (Exception ex) { new MessageBox.MessageBoxBA().Show("Lỗi, không tìm thấy xe", "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); } }
/// <summary> /// Lấy vị trí và hiển trị lên bản đồ nếu có xe /// </summary> public void LoadViTriXe() { if (!string.IsNullOrEmpty(SoXe)) { try { var xe = WCFService_Common.GetXeOnlineBySHX(SoXe); if (xe != null) { MainMap.addMarkerXeNhan(1, xe.KinhDo, xe.ViDo, SoXe); } } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "frmUpdateTrip_Map\\LoadViTriXe", DateTime.Now, ex.Message); } } }
private void txtXeDon_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { try { T_XeOnline_TT xeOnline = WCFService_Common.GetXeDonKhach(txtXeDon.Text.Trim()); if (xeOnline != null) { if (xeOnline.TDDonKhach > DateTime.MinValue) { float KD = xeOnline.KinhDoDonKhach; float VD = xeOnline.ViDoDonKhach; string strDiaChi = string.Format("[{0}] đón khách : {1}", xeOnline.TDDonKhach.ToString("HH:mm:ss"), Service_Common.GetAddressByGeoBA(VD, KD)); if (xeOnline.TDTraKhach > DateTime.MinValue) { //Xe đã trả khách MainMap.addMarkerXeDeCu3(1, KD, VD, strDiaChi); } else { MainMap.addMarkerXeDeCu3(2, KD, VD, strDiaChi); } MainMap.Position = new PointLatLng(VD, KD); } else { new MessageBox.MessageBoxBA().Show(string.Format("Xe không khách"), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information); } } else { new MessageBox.MessageBoxBA().Show(string.Format("Ko tìm thấy xe"), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information); } } catch (Exception) { new MessageBox.MessageBoxBA().Show("Lỗi tìm xe", "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information); } } }
private void kếtThúcToolStripMenuItem_Click(object sender, EventArgs e) { var _model = gridView_Bookings.GetFocusedRow <Booking>(); if (_model == null) { return; } int G_XNCode = ThongTinCauHinh.CompanyID; #region Trường hợp 1:Khách hàng hủy if (_model.OpCommand == m_HuyDieu) { //Bạn có muốn xóa cuốc khách chiều về này không ? // if (new MessageBox.MessageBox().Show("Khách hàng hủy cuốc chiều về ?", "Thông báo", MessageBoxButtons.YesNo).ToLower() == "yes".ToLower()) { try { //cập nhật trạng thái của xe đường dài. var xddd = new XeDiDuongDai(); xddd.UpdateStatus(_model.FK_TaxiReturn, Enum_XeBaoDiDuongDai_TrangThai.ChoGhepKhach, ThongTinDangNhap.USER_ID); _model.UpdateStatus(_model.PK_BooID, Enum_Bookings_OpStatus.KhachHangHuy, m_HuyDieu, ThongTinDangNhap.USER_ID); if (_model.FK_TaxiReturn > 0) { TaxiReturn_Process.TripUpdateStatus(_model.FK_TaxiReturn, G_XNCode, Services.FastTaxi_OperationService.Trip.Status.DangDi); } // this.Close(); } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "ctrlListBook\\kếtThúcToolStripMenuItem_Click", DateTime.Now, ex.Message); // ShowMessageFail("[KH hủy] Quá trình lưu xảy ra bị lỗi"); } } return; } #endregion #region Từ chối if (_model.FK_TaxiReturn == 0) { new MessageBox.MessageBoxBA().Show("Cuốc khách chưa gián xe.\nvui lòng chọn trạng thái từ chối"); return; } #endregion #region Trường hợp 2:Đã ghép. else { #region Mobile đã gặp xe if (_model.OpCommand == m_DaGapXe) { try { string rs = string.Empty; var themTrip = new XeDiDuongDai(); var address = new AutoCompleteAddress(); address.Bind(); #region Khởi tạo trip mới và chưa lưu themTrip.ID = _model.FK_TaxiReturn; try { //Thiếu : Thêm ID cha vào để quan hệ if (themTrip.GetByKey()) { themTrip.ParentID = _model.FK_TaxiReturn; themTrip.ID = 0; themTrip.LoTrinh = string.Empty; themTrip.LoTrinh_Diem = string.Empty; themTrip.KmDuKien = 0; themTrip.TrangThai = (int)Enum_XeBaoDiDuongDai_TrangThai.ChoGhepKhach; themTrip.CreatedDate = TaxiReturn_Process.timerServer; themTrip.CreatedByUser = ThongTinDangNhap.USER_ID; themTrip.UpdatedDate = null; themTrip.UpdatedByUser = string.Empty; // thời điểm bắt đầu của lái xe. themTrip.ThoiDiemDi = themTrip.TGDuKien; //_modelDetail.B themTrip.DiaDiemDen = _model.ToAdress; //address.Text = themTrip.DiaDiemDen; //address.ReSearch(); themTrip.FK_QuanHuyenDenID = address.HuyenId; themTrip.FK_TinhThanhDenID = address.TinhId; themTrip.Den_ViDo = _model.ToLat; themTrip.Den_KinhDo = _model.ToLng; //lấy tọa độ của xe. var _xeOnline = WCFService_Common.GetXeOnlineBySHX(themTrip.FK_SoHieuXe); themTrip.Xe_KinhDo = _xeOnline.KinhDo; themTrip.Xe_ViDo = _xeOnline.ViDo; // Lộ trình này là lộ trình của điểm DC var lotrinh = TaxiReturn_Process.LayLoTrinh(themTrip.Di_ViDo, themTrip.Di_KinhDo, themTrip.Den_ViDo, themTrip.Den_KinhDo); themTrip.LoTrinh = lotrinh.LoTrinh_DiaChi; themTrip.LoTrinh_Diem = lotrinh.LoTrinh_ToaDo; themTrip.KmDuKien = (int)lotrinh.Distance; //Tính thời gian đi của book. int SoPhutDiQuangDuongBC = TaxiReturn_Process.TinhThoiGianDiHetQuangDuong(_model.BC_Route_Distance); themTrip.TGDuKien = themTrip.TGDuKien.AddMinutes(SoPhutDiQuangDuongBC); // là thời điểm đến điểm C. themTrip.ThoiDiemVe = themTrip.TGDuKien; Xe objXe1 = new Xe().GetChiTietXe(themTrip.FK_SoHieuXe); if (objXe1 != null) { themTrip.BienSoXe = objXe1.BienKiemSoat; TinhTienTheoKm objTinhTien = new TinhTienTheoKm(objXe1.LoaiXeID, themTrip.KmDuKien); themTrip.TienDuKien = objTinhTien.TongTien1Chieu; } } } catch (Exception) { } #endregion if (themTrip.KmDuKien >= g_KmDuKien) { rs = new MessageBox.MessageBoxBA().Show("Xe này có muốn đón cuốc chiều về khác không ?", "Thông báo", MessageBoxButtons.YesNo); } if (rs == "Yes") { themTrip.Insert(); } themTrip.UpdateStatusV2(_model.FK_TaxiReturn, Enum_XeBaoDiDuongDai_TrangThai.None, ThongTinDangNhap.USER_ID, true, Enum_Bookings_OpStatus.MobileKetThuc, _model.PK_BooID); #region Send server try { TaxiReturn_Process.TripUpdateStatus(_model.FK_TaxiReturn, G_XNCode, Services.FastTaxi_OperationService.Trip.Status.KetThuc); if (rs == "Yes" && themTrip.ID > 0) { var rsBoot = TaxiReturn_Process.ReplaceTrip(themTrip.ParentID, themTrip); themTrip.UpdateIsAddedStaxi(themTrip.ID, ThongTinDangNhap.USER_ID, rsBoot); } } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "Lưu trên form khách cần xe", DateTime.Now, "Gửi lên server sảy ra lỗi:" + ex.Message); } //chỉ cần Kết thúc cái Book chưa có hàm gửi lên server try { // if (!G_DoNotSendToServer) TaxiReturn_Process.FinishVehicleReturn(_model.ClientKey); } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "Lưu trên form khách cần xe", DateTime.Now, "Gửi lên server sảy ra lỗi:" + ex.Message); } #endregion } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "Lưu trên form khách cần xe", DateTime.Now, "Cập nhật dữ liệu lỗi:" + ex.Message); } } #endregion #region Mobile chưa gặp xe else { try { #region Điều hành kết thúc string rs = string.Empty; var themTrip = new XeDiDuongDai(); var address = new AutoCompleteAddress(); address.Bind(); #region Khởi tạo trip mới và chưa lưu themTrip.ID = _model.FK_TaxiReturn; try { //Thiếu : Thêm ID cha vào để quan hệ if (themTrip.GetByKey()) { themTrip.ParentID = _model.FK_TaxiReturn; themTrip.ID = 0; themTrip.LoTrinh = string.Empty; themTrip.LoTrinh_Diem = string.Empty; themTrip.KmDuKien = 0; themTrip.TrangThai = (int)Enum_XeBaoDiDuongDai_TrangThai.ChoGhepKhach; themTrip.CreatedDate = TaxiReturn_Process.timerServer; themTrip.CreatedByUser = ThongTinDangNhap.USER_ID; themTrip.UpdatedDate = null; themTrip.UpdatedByUser = string.Empty; // thời điểm bắt đầu của lái xe. themTrip.ThoiDiemDi = themTrip.TGDuKien; //_modelDetail.B themTrip.DiaDiemDen = _model.ToAdress; //address.Text = themTrip.DiaDiemDen; //address.ReSearch(); themTrip.FK_QuanHuyenDenID = address.HuyenId; themTrip.FK_TinhThanhDenID = address.TinhId; themTrip.Den_ViDo = _model.ToLat; themTrip.Den_KinhDo = _model.ToLng; //lấy tọa độ của xe. var _xeOnline = WCFService_Common.GetXeOnlineBySHX(themTrip.FK_SoHieuXe); themTrip.Xe_KinhDo = _xeOnline.KinhDo; themTrip.Xe_ViDo = _xeOnline.ViDo; // Lộ trình này là lộ trình của điểm DC var lotrinh = TaxiReturn_Process.LayLoTrinh(themTrip.Di_ViDo, themTrip.Di_KinhDo, themTrip.Den_ViDo, themTrip.Den_KinhDo); themTrip.LoTrinh = lotrinh.LoTrinh_DiaChi; themTrip.LoTrinh_Diem = lotrinh.LoTrinh_ToaDo; themTrip.KmDuKien = (int)lotrinh.Distance; //Tính thời gian đi của book. int SoPhutDiQuangDuongBC = TaxiReturn_Process.TinhThoiGianDiHetQuangDuong(_model.BC_Route_Distance); themTrip.TGDuKien = themTrip.TGDuKien.AddMinutes(SoPhutDiQuangDuongBC); // là thời điểm đến điểm C. themTrip.ThoiDiemVe = themTrip.TGDuKien; Xe objXe1 = new Xe().GetChiTietXe(themTrip.FK_SoHieuXe); if (objXe1 != null) { themTrip.BienSoXe = objXe1.BienKiemSoat; TinhTienTheoKm objTinhTien = new TinhTienTheoKm(objXe1.LoaiXeID, themTrip.KmDuKien); themTrip.TienDuKien = objTinhTien.TongTien1Chieu; } } } catch (Exception) { } #endregion if (themTrip.KmDuKien >= g_KmDuKien) { rs = new MessageBox.MessageBoxBA().Show("Xe này có muốn đón cuốc chiều về khác không ?", "Thông báo", MessageBoxButtons.YesNo); } #region nếu chọn đón cuốc chiều về khác thì Thêm mới Trip if (rs == "Yes") { themTrip.Insert(); } themTrip.UpdateStatusV2(_model.FK_TaxiReturn, Enum_XeBaoDiDuongDai_TrangThai.None, ThongTinDangNhap.USER_ID, true, Enum_Bookings_OpStatus.KetThuc, _model.PK_BooID); #endregion #region Send server try { TaxiReturn_Process.TripUpdateStatus(_model.FK_TaxiReturn, G_XNCode, Services.FastTaxi_OperationService.Trip.Status.KetThuc); if (rs == "Yes" && themTrip.ID > 0) { var rsBoot = TaxiReturn_Process.ReplaceTrip(themTrip.ParentID, themTrip); themTrip.UpdateIsAddedStaxi(themTrip.ID, ThongTinDangNhap.USER_ID, rsBoot); } } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "Lưu trên form khách cần xe", DateTime.Now, "Gửi lên server sảy ra lỗi:" + ex.Message); } //chỉ cần Kết thúc cái Book chưa có hàm gửi lên server try { //if (!G_DoNotSendToServer) TaxiReturn_Process.FinishVehicleReturn(_model.ClientKey); } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "Lưu trên form khách cần xe", DateTime.Now, "Gửi lên server sảy ra lỗi:" + ex.Message); } #endregion #endregion } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "Kết thúc trên lưới Book", DateTime.Now, "Gửi lên server sảy ra lỗi:" + ex.Message); new MessageBox.MessageBoxBA().Show("Quá trình xử lý sảy ra lỗi vui lòng liên hệ với quản trị"); } } #endregion } #endregion }
private void ShowHienTrangXe(VehicleOnline xeonline, string SoHieuXe) { #region --Kiem tra tra trang thai xe va dua thong tin vao panel-- var address = !Taxi.Business.ThongTinCauHinh.GPS_TrangThai ? "" : Service_Common.GetAddressByGeoBA(xeonline.ViDo, xeonline.KinhDo); #region Thông tin xe pnMarker.Visible = true; pnMarker.Refresh(); if ((xeonline.Trangthai & 3) > 0) { TrangThaiXe = "Có khách"; } else if ((xeonline.Trangthai & 3) <= 0) { TrangThaiXe = "Không khách"; } if ((xeonline.Trangthai & 8) == 0) { may = "Bật"; DungXeNoMay = "\r\nDừng xe nổ máy: \t" + xeonline.TGDungXeNoMay; } else if ((xeonline.Trangthai & 8) > 0) { may = "Tắt"; } if ((xeonline.Trangthai & 32) > 0) { DieuHoa = "Tắt"; } else if ((xeonline.Trangthai & 32) == 0) { DieuHoa = "Bật"; } int.TryParse((xeonline.TGGPS - xeonline.ThoiDiemDiChuyenGanNhat).ToString("mm"), out timedung); if ((xeonline.TrangThaiKhac) == -2 && (xeonline.VGPS) >= 3 && timedung < 0) { DaDung = ""; } else { DaDung = "\r\nĐã dừng:\t\t" + timedung.ToString() + " phút"; } var dt = lienlac.Map_HienTrangXe(SoHieuXe); string BienSoXe = ""; if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0]["TenNhanVien"] != null && !dt.Rows[0]["TenNhanVien"].ToString().Equals("")) { //TenLaiXe = "Tên lái xe:\t" + dt.Rows[0]["TenNhanVien"].ToString(); //Phone = "Sđt:\t" + dt.Rows[0]["DiDong"].ToString(); loaixe = dt.Rows[0]["TenLoaiXe"].ToString() + " "; socho = dt.Rows[0]["SoCho"].ToString(); gara = "\r\nGara: \t\t" + dt.Rows[0]["Name"].ToString(); } else if (dt.Rows[0]["TenNhanVien"].ToString().Equals("")) { //TenLaiXe = "Tên lái xe:\t" + dt.Rows[0]["TenNhanVien"].ToString(); //Phone = "Sđt:\t" + dt.Rows[0]["DiDong"].ToString(); loaixe = dt.Rows[0]["TenLoaiXe"].ToString() + " "; socho = dt.Rows[0]["SoCho"].ToString(); gara = "\r\nGara: \t\t" + dt.Rows[0]["Name"].ToString(); } BienSoXe = dt.Rows[0]["BienKiemSoat"].ToString(); loaixe = dt.Rows[0]["TenLoaiXe"].ToString() + " "; socho = dt.Rows[0]["SoCho"].ToString(); gara = "\r\nGara: \t\t" + dt.Rows[0]["Name"].ToString(); #region Thời điểm kd DateTime det = DateTime.MinValue; var tdkd = string.Empty; //txtThoiDiemKD.Visible = true; tdkd += string.Format("Tên lX:\t {0}", dt.Rows[0]["TenNhanVien"]); tdkd += string.Format("\r\nSDT:\t {0}", dt.Rows[0]["DiDong"]); if (DateTime.TryParse(dt.Rows[0]["ThoiDiemBao"].ToString(), out det) && det > DateTime.MinValue) { tdkd += string.Format("\r\nRa KD: {0:HH:mm dd/MM/yyyy}", dt.Rows[0]["ThoiDiemBao"]); } #endregion string strDiemDo = ""; var getInfoKD = lienlac.GetInfoKD(SoHieuXe); if (getInfoKD != null && getInfoKD.Rows.Count > 0) { DiemDoKhaiBao = dt.Rows[0]["DiemDo"] == DBNull.Value ? 0 : int.Parse(dt.Rows[0]["DiemDo"].ToString()); //txtDiemDo.Visible = true; //txtDiemDo.Text = "Điểm đỗ: " + getInfoKD.Rows[0]["ViTriDiemBao"].ToString() // + "\r\nThời điểm: " + ((DateTime)getInfoKD.Rows[0]["ThoiDiemBao"]).ToString("HH:mm dd/MM/yyyy"); strDiemDo = "Điểm đỗ: " + getInfoKD.Rows[0]["ViTriDiemBao"].ToString() + "\r\nThời điểm: " + ((DateTime)getInfoKD.Rows[0]["ThoiDiemBao"]).ToString("HH:mm dd/MM/yyyy"); } var getTrangThai = lienlac.GetTrangThaiBySoXe(SoHieuXe); if (getTrangThai != null && getTrangThai.Rows.Count > 0) { //txtDiemDo.Text = txtDiemDo.Text + "\r\nTrạng thái: " + getTrangThai.Rows[0]["TrangThai"]; strDiemDo += "\r\nTrạng thái: " + getTrangThai.Rows[0]["TrangThai"]; if (getTrangThai.Rows[0]["LyDoVe"] != DBNull.Value && string.IsNullOrEmpty(getTrangThai.Rows[0]["LyDoVe"].ToString())) { strDiemDo += "\r\nLý do về: " + getTrangThai.Rows[0]["LyDoVe"]; //txtDiemDo.Text = txtDiemDo.Text + "\r\nLý do về: " + getTrangThai.Rows[0]["LyDoVe"]; } } txtThoiDiemKD.Text = tdkd + "\r\n" + strDiemDo; } else { BienSoXe = xeonline.BienSoXe; var strXeKhongKD = string.Empty; //kiểm tra xem có xin nghỉ ko đi kinh doanh không - nếu có thì hiển hị lý do nghỉ var nghi = lienlac.GetVehicleNotWorkingBySoXe(SoHieuXe); if (nghi != null && nghi.Rows.Count > 0) { strXeKhongKD += string.Format("\r\nLý do nghỉ: {0}", nghi.Rows[0]["ReasonName"]); } txtThoiDiemKD.Text = strXeKhongKD; } DataTable dtVungDh = (new VungDieuHanh()).VDHById(xeonline.VungID); if (dtVungDh != null && dtVungDh.Rows.Count > 0) { vdh = dtVungDh.Rows[0]["NameVungDH"].ToString(); DiemDoGPS = int.Parse(dtVungDh.Rows[0]["Id"].ToString()); } else { vdh = "Không xác định"; DiemDoGPS = 0; } DateTime hientai = CommonBL.GetTimeServer(); DataTable dtCheckAnCa = lienlac.CheckAnCa(SoHieuXe); if (dtCheckAnCa.Rows.Count > 0) { switch (int.Parse(dtCheckAnCa.Rows[0]["TrangThaiLaiXeBao"].ToString())) { case 6: TrangThaiLaiXe = "ăn ca"; break; case 7: TrangThaiLaiXe = "rời xe"; break; case 11: TrangThaiLaiXe = "mất liên lạc"; break; } ThoiDiemCB = DateTime.Parse(dtCheckAnCa.Rows[0]["ThoiDiemBao"].ToString()); var tongtime = (hientai - ThoiDiemCB); var SoPhut = 0; var strSoPhutBao = ""; int.TryParse(dtCheckAnCa.Rows[0]["SoPhutNghi"].ToString(), out SoPhut); if (SoPhut > 0) { strSoPhutBao = " " + SoPhut + " phút"; } if (TrangThaiLaiXe != "") { TrangThaiLaiXe = ((dt.Rows.Count == 1 && dt.Rows[0]["IsHoatDong"].ToString().Contains("1")) ? "" : "Báo " + TrangThaiLaiXe + strSoPhutBao + "\r\nThời điểm: " + ThoiDiemCB.ToString("HH:mm dd/MM/yyyy")); //txtCanhBao.Visible = true; txtCanhBao.Text = TrangThaiLaiXe + (TrangThaiLaiXe == "" ? "" : "\r\nTổng thời gian: " + tongtime.Hours + " giờ " + tongtime.Minutes + " phút"); } } //txtAddress.BackColor = Color.FromArgb(250, 246, 237); txtInfoHeader.ForeColor = Color.Red; txtInfoHeader.TextAlign = HorizontalAlignment.Center; txtInfoHeader.Font = new Font(txtInfoHeader.Font, FontStyle.Bold); txtInfoHeader.Height = 26; txtInfoHeader.Width = 437; txtInfoHeader.Text = " Hiện trạng xe: " + SoHieuXe + "-" + BienSoXe; txtInfoHeader.ReadOnly = true; txtVitri.Text = "Vị trí: " + address; txtInfoXe.Text = "Loại xe: \t\t" + loaixe + socho + " chỗ" + "\r\nNgày/giờ: \t" + xeonline.TGGPS.ToString("HH:mm dd/MM/yyyy"); //if (!string.IsNullOrEmpty(TenLaiXe)) //{ // txtInfoXe.Text += "\r\n" + TenLaiXe; //} //if (!string.IsNullOrEmpty(Phone)) //{ // txtInfoXe.Text += "\r\n" + Phone; //} string strInfoXe = "Loại xe: \t\t" + loaixe + socho + " chỗ" + "\r\nNgày/giờ: \t" + xeonline.TGGPS.ToString("HH:mm dd/MM/yyyy"); if (TenLaiXe != null && TenLaiXe != "") { strInfoXe += "\r\n" + TenLaiXe; } if (Phone != null && Phone != "") { strInfoXe += "\r\n" + Phone; } strInfoXe += "\r\nVận tốc GPS/Cơ: \t" + xeonline.VGPS + "/" + xeonline.VCo + " Km/h"; if (gara != "") { strInfoXe += gara; } if (DieuHoa != "") { strInfoXe += "\r\nĐiều hòa: \t" + DieuHoa; } if (DungXeNoMay != "") { strInfoXe += DungXeNoMay; } if (may != "") { strInfoXe += "\r\nMáy: \t\t" + may; } if (TrangThaiXe != "") { strInfoXe += "\r\nTrạng thái xe: \t" + TrangThaiXe; } if (vdh != "") { strInfoXe += "\r\nĐiểm đỗ:\t\t" + vdh; } if (DaDung != "") { strInfoXe += DaDung; } txtInfoXe.Text = strInfoXe; #endregion #region Doanh thu xe string strDoanhThuXe = ""; var info = System.Globalization.CultureInfo.GetCultureInfo("vi-VN"); var objTongCuoc = new Taxi.Services.WCFServices.TongCuoc_Ca(); if (Global.HasGPS) { objTongCuoc = WCFService_Common.GetTongCuoc(BienSoXe, false); } if (objTongCuoc != null) { double kmCoKhach = objTongCuoc.kmCoKhachField; double kmRong = objTongCuoc.kmRongField; string strKmCoKhach_Rong = ""; if (xeonline.KmWithPassenger > 0) { kmCoKhach = kmCoKhach - xeonline.KmWithPassenger; xeonline.WaitingTime = xeonline.WaitingTime > 0 ? xeonline.WaitingTime : 0; } kmRong = kmRong + xeonline.EmptyKm; strKmCoKhach_Rong = String.Format("{0} km/{1} km", kmCoKhach, kmRong); strDoanhThuXe = String.Format("Tổng cuốc:\t{0}", objTongCuoc.tongCuocKhachField); if (kmCoKhach > 0) { strDoanhThuXe += String.Format("\r\nKm CK/Rỗng:\t{0}", strKmCoKhach_Rong); } strDoanhThuXe += String.Format(info, "\r\nTổng doanh thu:\t{0:c0}", objTongCuoc.tongTienField); } if ((xeonline.Trangthai & 3) > 0) { strDoanhThuXe += String.Format(info, "\r\nTiền cuốc ht:\t{0:c0}", xeonline.Money); strDoanhThuXe += String.Format("\r\nThời gian chờ:\t{0} phút", xeonline.FreeWatingTime); strDoanhThuXe += String.Format("\r\nKm cuốc đang chạy: {0} km", xeonline.KmWithPassenger); } txtDoanhThu.Text = strDoanhThuXe; #endregion #region Thông tin cuốc hàng var cuochang = ""; if (Global.TaxiOperation_Module == TaxiOperation_Module.DieuXeTai || Global.TaxiOperation_Module == TaxiOperation_Module.Luong) { var db = new TaxiOperation_Truck().GetTruckBySoXe(SoHieuXe.Trim()); if (db != null) { cuochang += string.Format("ĐC đón: {0}", db.DiaChiDon); cuochang += string.Format("\r\nĐiện thoại:{0}", db.SoDT); cuochang += string.Format("\r\nTG Điều: {0:HH:mm dd/MM}", db.TGDieuXe); if (db.TGGap != null) { cuochang += string.Format("\r\nTG Gặp KH: {0:HH:mm dd/MM}", db.TGGap); } if (!String.IsNullOrEmpty(db.DiaChiTra)) { cuochang += string.Format("\r\nĐC Trả: {0}", db.DiaChiTra); } } txtCuocHang.Text = cuochang; txtCuocHang.ForeColor = Color.Black; txtCuocHang.Font = new Font(txtCuocHang.Font.FontFamily, txtCuocHang.Font.Size, FontStyle.Bold); } #endregion pnMarker.Controls.Add(txtInfoHeader); pnMarker.BackColor = Color.White; #endregion -------------------End------------------------------- }
private void txtXe_Leave(object sender, EventArgs e) { if (txtXe.IsForceChangeText && txtXe.Text != "") { try { lblMsg.Text = string.Empty; lblBienSoXe.Text = ""; Xe objXe = new Xe().GetChiTietXe(txtXe.Text); if (objXe != null) { txtDienThoai.EditValue = objXe.DienThoai; txtTenLaiXe.EditValue = objXe.TenNhanVien; this.loaiXe = objXe.LoaiXeID; lblBienSoXe.Text = objXe.BienKiemSoat; } var xe = WCFService_Common.GetXeOnlineBySHX(txtXe.Text); if (xe != null) { // lblBienSoXe.Text = xe.BienSoXe; float lat = (float)xe.ViDo; float lng = (float)xe.KinhDo; auDiaChiDon.Text = string.Empty; if (lng > 0) { string address = Service_Common.GetAddressByGeoBA(lat, lng).RemoveRoutePr(); if (!string.IsNullOrEmpty(address) && address.Trim() != "*") { auDiaChiDon.Text = address; auDiaChiDon.ReSearch(); auDiaChiDon.TempLat = lat; auDiaChiDon.TempLng = lng; } } xe_lat = lat; xe_lng = lng; Model.BienSoXe = xe.BienSoXe; } auDiaChiDon_EventSelectAutoComplete(null); if (txtDienThoai.EditValue == null || txtDienThoai.Text == string.Empty) { txtDienThoai.Focus(); } else if (string.IsNullOrEmpty(auDiaChiDon.Text)) { auDiaChiDon.Focus(); } else { auDiaChiTra.Focus(); } if (XeDiDuongDai.Inst.CheckXeChuaKetThucDuongDai(txtXe.EditValue.To <string>().Trim())) { ShowError(string.Format("Xe {0} chưa kết thúc cuốc đường dài", txtXe.EditValue.To <string>().Trim())); } } catch (Exception ex) { LogError.WriteLogError("txtXe_Leave: ", ex); } } }
private void TimXe(string soHieuXe) { try { if (SearchType.EditValue.To <int>() == 1) { T_XeOnline XeOnline = WCFService_Common.GetXeOnlineBySHX(soHieuXe); if (XeOnline == null) { new MessageBox.MessageBox().Show(string.Format("Không tồn tại xe {0} trên hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error); } else { if (XeOnline.TrangThaiKhac < 0) { new MessageBox.MessageBox().Show( string.Format("Xe {0} đã mất tín hiệu " + XeOnline.TrangThaiKhacText, soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error); } else { //new MessageBox.MessageBox().Show(XeOnline.ViDo.ToString() + "-" + XeOnline.KinhDo.ToString()); //PointLatLng point = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo); string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Taxi.Services.Service_Common.GetAddressByGeoBA((float)XeOnline.ViDo, (float)XeOnline.KinhDo)); int trangThai = 0; //xe tắt máy if ((XeOnline.TrangThai & 3) > 0) { trangThai = 2; //xe co khach } else if ((XeOnline.TrangThai & 8) == 0) { trangThai = 1; //xe bật máy. } MainMap.addMarkerXeDeCu3(trangThai, XeOnline.KinhDo, XeOnline.ViDo, strDiaChi); MainMap.Position = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo); } } } else { string bienso = CommonBL.ConvertSangBienSo(soHieuXe); if (string.IsNullOrEmpty(bienso)) { new MessageBox.MessageBox().Show(string.Format("Không tồn tại xe {0} trên danh sách xe hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error); return; } var rs = Service_Common.ServiceG5.TryGet(p => p.GetVehicleOnlne(bienso)); //if (Global.IsDebug) // new MessageBox.MessageBox().Show(string.Format(bienso)); if (rs.Success && rs.Value != null) { string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Service_Common.GetAddressByGeoBA((float)rs.Value.Lat, (float)rs.Value.Lng)); int trangThai = 0; //xe tắt máy if ((rs.Value.Status & 4096) > 0) //4096 sẵn sàng { trangThai = 1; //xe sẵn sàng } else if ((rs.Value.Status & 8) == 0) { // trangThai = 1; //xe bật máy. } MainMap.AddMarkerXeG5(trangThai, (float)rs.Value.Lng, (float)rs.Value.Lat, strDiaChi); MainMap.Position = new PointLatLng((float)rs.Value.Lat, (float)rs.Value.Lng); } else { new MessageBox.MessageBox().Show(string.Format("Không tìm thấy vị trí xe {0} trên hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error); } } } catch (Exception ex) { new MessageBox.MessageBox().Show("Lỗi, không tìm thấy xe", "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error); } }
private void TimXe(string soHieuXe) { try { if (SearchType.EditValue.To <int>() == 1) { T_XeOnline XeOnline = new T_XeOnline(); XeOnline = WCFService_Common.GetXeOnlineBySHX(soHieuXe); if (XeOnline == null) { new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); } else { if (XeOnline.ThoiDiemChenDuLieu <= DateTime.Now.AddMinutes(-150)) { new MessageBox.MessageBoxBA().Show(string.Format("Xe {0} đã mất tín hiệu GPS.{1}", soHieuXe, XeOnline.TGGPS.ToString("dd/MM/yyyy HH:mm:ss")), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); } else { string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Service_Common.GetAddressByGeoBA(XeOnline.ViDo, XeOnline.KinhDo)); int trangThai = 0; //xe tắt máy if ((XeOnline.TrangThai & 3) > 0) { trangThai = 2; //xe co khach } else if ((XeOnline.TrangThai & 8) == 0) { trangThai = 1; //xe bật máy. } MainMap.addMarkerXeDeCu3(trangThai, XeOnline.KinhDo, XeOnline.ViDo, strDiaChi); MainMap.Position = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo); } } } else { string bienso = CommonBL.ConvertSangBienSo(soHieuXe); if (string.IsNullOrEmpty(bienso)) { new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên danh sách xe hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); return; } var rs = WCFServicesApp.Client.TryGet(p => p.GetVehicleOnlne(bienso)); //if (Global.IsDebug) // new MessageBox.MessageBox().Show(string.Format(bienso)); if (rs.Success && rs.Value != null) { string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Service_Common.GetAddressByGeoBA((float)rs.Value.Lat, (float)rs.Value.Lng)); int trangThai = 0; //xe tắt máy if ((rs.Value.Status & 4096) > 0) //4096 sẵn sàng { trangThai = 1; //xe sẵn sàng } else if ((rs.Value.Status & 8) == 0) { // trangThai = 1; //xe bật máy. } MainMap.AddMarkerXeG5(trangThai, (float)rs.Value.Lng, (float)rs.Value.Lat, strDiaChi); MainMap.Position = new PointLatLng((float)rs.Value.Lat, (float)rs.Value.Lng); } else { new MessageBox.MessageBoxBA().Show(string.Format("Không tìm thấy vị trí xe {0} trên hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); } } } catch (Exception ex) { new MessageBox.MessageBoxBA().Show("Lỗi, không tìm thấy xe", "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); LogError.WriteLogError("TImXe", ex); } }