To facilitate rapid, non-destructive, cost-effective continuous detection of Moisture Content in corn kernels, a Near-infrared (VIS-NIR) spectroscopy based in-situ maize ear moisture detection device was developed, utilizing machine learning for predictive modeling. Field experiments(30~35℃) assessed three preprocessing algorithms: z-score normalization (ZS), Orthogonal Signal Correction (OSC), and a ZS-OSC combination, with ZS-OSC selected for its superior performance (R2≥0.90, RMSE≤2.12%, RPD>2.9). Spectral imaging from 410-940 nm was used to develop moisture prediction models via Partial Least Squares Regression (PLSR) and Support Vector Machine (SVM), where PLSR is suited for single variety (R2≥0.82, RMSE≤2.62%, RPD≥2.2) and SVM for both single and mixed varieties. Additionally, grain temperature's impact on model performance was analyzed, showing decreased accuracy across temperatures of 30~35℃, 35~40℃, and 40~45℃. The final device and models excelled in 30~35℃ field tests, achieving R2≥0.88, RPD>2.5, RMSE≤0.901%, with less than 1.82% deviation between predicted and actual values, and all classification indices over 84.38%. The device is proven accurate and effective for corn grain moisture detection, offering valuable insights for in-situ maize moisture content analysis.