using Common; using MeterPlugInLibrary; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CarMeterSystem.OptionCls { /// /// 截图调用类 /// public class CameraShotCls { public void Connection() { foreach (DhCameraShot shot in CarCache.cameraShots) { shot.Connection(); } } public void Close() { foreach (DhCameraShot shot in CarCache.cameraShots) { shot.Close(); } } /// /// 截图 /// /// 作业编号 public void CapPic(string actualFirstNo) { int iCnt = 1; //抓拍摄像头配置顺序必须是前面2个 foreach (DhCameraShot shot in CarCache.cameraShots) { //放在tempImg文件夹下面就进行图片的压缩操作,否则不进行图片压缩 //shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\tempImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt)); shot.CapPic(iCnt < 2 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt)); // 第一次抓拍为仪表重量 //if(iCnt == 1) //{ // Log.GetInstance().WriteLog(35, "完成仪表拍照 成功标识:" + PbCache.shotSuccess.ToString() + "车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString()); //} iCnt++; } } /// /// 从硬盘录像机 进行截图 /// /// public void CapPicFromVideo(string actualFirstNo) { foreach (DhCameraShot shot in CarCache.cameraShots) { //放在tempImg文件夹下面就进行图片的压缩操作,否则不进行图片压缩 //shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\tempImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt)); bool shotSuccess = shot.CapPicFromVedio(PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo)); PbCache.shotSuccess = shotSuccess; } } /// /// 连接视频截图并关闭 /// /// 作业编号 public void CapMethod(string actualFirstNo) { Connection(); CapPic(actualFirstNo); //CapPicFromVideo(actualFirstNo); Close(); } } }