Browse Source

提交代码

yi eason 3 years ago
parent
commit
2a691e7c1f

+ 3 - 0
.gitignore

@@ -343,3 +343,6 @@ healthchecksdb
 /output
 /output.rar
 /2021-10-27热送磅清零
+*.licx
+/自动更新文件
+/修改

+ 33 - 30
CarMeterSystem/App.config

@@ -4,15 +4,11 @@
 		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
 	</startup>
 	<appSettings>
-		<!--<add key="ServiceUrl" value="http://127.0.0.1:9004/v1" />-->
-    <!--<add key="ServiceUrl" value="http://10.104.4.105:9004/v1" />-->
-    <!--<add key="ServiceUrl" value="http://192.168.216.143:9004/v1" />-->
-    <!--<add key="ServiceUrl" value="http://10.104.4.139:9004/v1" />-->
-    <!--<add key="ServiceUrl" value="http://10.104.0.1:9004/v1" />-->
-    <!--<add key="ServiceUrl" value="http://192.168.107.60:8888/icore.icp.winform/pass/jlcar"/>-->
-    <!--<add key="ServiceUrl" value="http://192.168.185.29/icore.icp.winform/pass/jlcar"/>-->
-    <add key="ServiceUrl" value="http://10.99.81.20/icore.icp.web/pass/systemBase/v1"/>
-    <!--<add key="ServiceUrl" value="http://jgwzjl.jiugang.com/icore.icp.web/pass/systemBase/v1"/>-->
+	<!--测试库-->
+	<add key="ServiceUrl" value="http://10.104.4.130:9004/v1" />
+    <!--<add key="ServiceUrl" value="http://10.99.81.20/icore.icp.web/pass/systemBase/v1"/>-->
+    <!--正式库-->
+	<!--<add key="ServiceUrl" value="http://jgwzjl.jiugang.com/icore.icp.web/pass/systemBase/v1"/>-->
     <!--<add key="ServiceUrl" value="http://10.130.1.2/icore.icp.web/pass/systemBase/v1"/>-->
     <!--实时库地址-->
     <add key="icoredbTcp" value="tarantool://guest@10.99.200.86:2101" />
@@ -28,46 +24,53 @@
 		<!--0使用sftp,1使用vsftp-->
 		<add key="ftpType" value="1" />
 		<!--图片压缩-->
-		<add key="imgWidth" value="400" />
-		<add key="imgHeight" value="400" />
+		<add key="imgWidth" value="800" />
+		<add key="imgHeight" value="800" />
 		<!--毛皮差值验证(单位kg)-->
 		<add key="differenceWgt" value="400" />
 		<!--进入测试界面还是正式界面 0测试,1正式,2一码到底测试,3判稳测试工具-->
-		<add key="productType" value="1	" />
+		<add key="productType" value="2" />
 		<!--联达比较重量-->
 		<add key="lianDaWgt" value="200" />
 		<!--联达计量点编号-->
 		<add key="lianDaPointNo" value="00019" />
     
-    <!--期限皮使用方式配置:车号-物料-路线(1),车号-物料-称点(2),车号-物料(3)-->
-    <add key="TareControlType" value="3" />
+		<!--期限皮使用方式配置:车号-物料-路线(1),车号-物料-称点(2),车号-物料(3)-->
+		<add key="TareControlType" value="3" />
 
-    <!--厂内外车配置:001004003(内部),001004002(外部)-->
-    <add key="carTypeNo" value="001004002" />
+		<!--厂内外车配置:001004003(内部),001004002(外部)-->
+		<add key="carTypeNo" value="001004002" />
 
-    <!--厂内外车配置:001004003(内部),001004002(外部)-->
-    <add key="carTypeName" value="外部" />
+		<!--厂内外车配置:001004003(内部),001004002(外部)-->
+		<add key="carTypeName" value="外部" />
 
-		<add key="ClientSettingsProvider.ServiceUri" value="" />
+			<add key="ClientSettingsProvider.ServiceUri" value="" />
 
-    <!--厂内外车配置:001004003(内部),001004002(外部)-->
-    <add key="carAdd" value="1" />
+		<!--厂内外车配置:001004003(内部),001004002(外部)-->
+		<add key="carAdd" value="1" />
 
-    <!--智能料场显示:1(显示),0(不显示)-->
-    <add key="isSendZNLC" value="0" />
-    <add key="isWriteRFID" value="0" />
+		<!--智能料场显示:1(显示),0(不显示)-->
+		<add key="isSendZNLC" value="0" />
+		<add key="isWriteRFID" value="0" />
 
-    <!--语音播放次数-->
-    <add key="voiceNum" value="5" />
+		<!--语音播放次数-->
+		<add key="voiceNum" value="5" />
 
-    <!--是否验证激光和光栅-->
-    <add key="validParkStatuConfig" value="true" />
+		<!--是否验证激光和光栅-->
+		<add key="validParkStatuConfig" value="true" />
     
 		<!--扫码枪参数-->
 		<!--工控机下秤二维码-->
-    <add key="comPara" value="COM11,9600,None,8,1" />
+		<add key="comPara" value="COM11,9600,None,8,1" />
 		<!--司机窗口不下秤二维码-->
-    <add key="comPara2" value="COM3,115200,None,8,1" />
+		<add key="comPara2" value="COM3,115200,None,8,1" />
+		<!--压缩比例,其中第一个是图片为3-7的情况,第一个是图片是1.jpg,2.jpg-->
+		<add key="imgMass" value="40" />
+		<add key="imgMass2" value="50" />
+		<!--波动合理值-->
+		<add key="undulateValue" value="50" />
+		<!--硬盘录像机仪表抓拍设置的通道-->
+		<add key="channel" value="5" />
 	</appSettings>
 	<system.web>
 		<membership defaultProvider="ClientAuthenticationMembershipProvider">

+ 10 - 1
CarMeterSystem/CarMeterSystem.csproj

@@ -42,6 +42,12 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\output\CoreFS.CA06Lite.dll</HintPath>
     </Reference>
+    <Reference Include="DevExpress.Data.Desktop.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.Data.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.Printing.v20.1.Core, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.Sparkline.v20.1.Core, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.Utils.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.XtraEditors.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
     <Reference Include="iCore.Rtdb, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\output\iCore.Rtdb.dll</HintPath>
@@ -57,8 +63,10 @@
       <HintPath>..\output\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Data.Linq" />
     <Reference Include="System.Design" />
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Runtime.Serialization.Formatters.Soap" />
@@ -75,7 +83,8 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="CamerEs.cs" />
+    <Compile Include="OptionCls\CamerEs2.cs" />
+    <Compile Include="OptionCls\CamerEs.cs" />
     <Compile Include="frmMatMsgInfo.cs">
       <SubType>Form</SubType>
     </Compile>

+ 51 - 0
CarMeterSystem/CamerEs.cs → CarMeterSystem/OptionCls/CamerEs.cs

@@ -1,5 +1,6 @@
 using Common;
 using MeterPlugInLibrary;
+using StockMeterPlugInLibrary;
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -98,6 +99,38 @@ namespace CarMeterSystem
             }
         }
 
+        public void Login()
+        {
+            List<loginParam> lt = new List<loginParam>();
+            if (_lg == null)
+            {
+                DebugInfo("请先载入摄像头信息");
+            }
+
+            if (m_lUserID < 0)
+            {
+                string DVRIPAddress = _lg.ip; //设备IP地址或者域名 Device IP
+                Int16 DVRPortNumber = (Int16)_lg.port;
+                string DVRUserName = _lg.userId;//设备登录用户名 User name to login
+                string DVRPassword = _lg.pwd;//设备登录密码 Password to login
+
+                //登录设备 Login the device
+                m_lUserID = CHCNetSDK.NET_DVR_Login_V30(DVRIPAddress, DVRPortNumber, DVRUserName, DVRPassword, ref DeviceInfo);
+                if (m_lUserID < 0)
+                {
+                    iLastErr = CHCNetSDK.NET_DVR_GetLastError();
+                    str = "NET_DVR_Login_V30 failed, error code= " + iLastErr; //登录失败,输出错误号 Failed to login and output the error code
+                    DebugInfo(str);
+                    return;
+                }
+                else
+                {
+                    //登录成功
+                    DebugInfo("NET_DVR_Login_V30 succ!");
+                }
+            }
+        }
+
         public void LoginOut()
         {
             //注销登录 Logout the device
@@ -132,6 +165,24 @@ namespace CarMeterSystem
 
         }
 
+        CHCNetSDK.NET_DVR_JPEGPARA jpegPara = new CHCNetSDK.NET_DVR_JPEGPARA();
+        public void CapturePictrue2(string fileUrl)
+        {
+            jpegPara.wPicQuality = 0;
+            jpegPara.wPicSize = 4;
+           
+            Log.GetInstance().WriteLog(35, "完成快速仪表拍照    成功标识:" + PbCache.shotSuccess.ToString() + "车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+            if (!CHCNetSDK.NET_DVR_CaptureJPEGPicture(m_lUserID, 1, ref jpegPara, fileUrl))
+            {
+                iLastErr = CHCNetSDK.NET_DVR_GetLastError();
+                str = "NET_DVR_CaptureJPEGPicture failed, error code= " + iLastErr;
+                DebugInfo(str);
+                return;
+            }
+            Log.GetInstance().WriteLog(35, "结束快速仪表拍照    成功标识:" + PbCache.shotSuccess.ToString() + "车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+
+        }
+
         public void SaveRealData(string fileUrl)
         {
             if (!CHCNetSDK.NET_DVR_SaveRealData_V30(m_lRealHandle, 0x1, fileUrl))

+ 141 - 0
CarMeterSystem/OptionCls/CamerEs2.cs

@@ -0,0 +1,141 @@
+using Common;
+using MeterPlugInLibrary;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace CarMeterSystem
+{
+    public class CamerEs2
+    {
+        public CamerEs2(string _ip, string _port, string _uid, string _pwd)
+        {
+            ip = _ip;
+            port = _port;
+            uid = _uid;
+            pwd = _pwd;
+            _dvr = new HkDvr();
+        }
+
+        private HkDvr _dvr;
+        bool ret = false;
+
+        private string ip = "", port = "", uid = "", pwd = "";
+
+        /// <summary>
+        /// 连接设备
+        /// </summary>
+        /// <param name="Ip">IP地址</param>
+        /// <param name="Port">端口</param>
+        /// <param name="Uid">用户名</param>
+        /// <param name="Pwd">密码</param>
+        public void Connection()
+        {
+            if (_dvr.UserId < 0)
+            {
+                //IP,PORT,UID,PWD
+                ret = _dvr.Init(ip + "," + port + "," + uid + "," + pwd);
+                ret = _dvr.Open();
+            }
+        }
+
+        private bool startTalk = false;
+
+        /// <summary>
+        /// 打开视频
+        /// </summary>
+        /// <param name="picture"></param>
+        /// <param name="i"></param>
+        public void RealPlay(PictureBox picture, int i)
+        {
+            if (_dvr.UserId > -1)
+            {
+                _dvr.RealPlay(i, picture.Handle);
+            }
+        }
+
+        /// <summary>
+        /// 关闭视频
+        /// </summary>
+        /// <param name="i"></param>
+        public void StopRealPlay(int i)
+        {
+            if (_dvr.UserId > -1)
+            {
+                _dvr.StopRealPlay(i);
+            }
+        }
+
+        /// <summary>
+        /// 关闭视频
+        /// </summary>
+        public void Close()
+        {
+            if (_dvr.UserId > -1)
+            {
+                _dvr.Close();
+            }
+        }
+
+        
+
+        
+
+        /// <summary>
+        /// 截图
+        /// </summary>
+        /// <param name="voiType">0抓拍机  1一般的摄像头</param>
+        /// <param name="filePath">文件存储位置及文件名称,文件名称应该是 计量作业编号_计量点_第几张 or 计量作业编号_第几张</param>
+        /// <returns>是否截图成功,true成功,false失败,异常的话会在logs中写入信息</returns>
+        public bool CapPic(int voiType, uint channel, string filePath)
+        {
+            return _dvr.CapturePicture(voiType, channel, filePath);
+
+            /*
+            _dvr.CapturePicture(1, 1, filePath);
+            _dvr.CapturePicture(1, 2, filePath.Substring(0, filePath.Length - 5) + "2.jpg");
+            _dvr.CapturePicture(1, 3, filePath.Substring(0, filePath.Length - 5) + "3.jpg");
+            return true;
+            //*/
+        }
+
+        public bool CapPicFromVedio(uint chanel, string filePath)
+        {
+            try
+            {
+                return _dvr.CapturePicture(chanel, filePath + chanel + ".jpg");
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 硬盘录像机截图
+        /// </summary>
+        /// <param name="filePath"></param>
+        /// <returns></returns>
+        public bool CapPicFromVedio(string filePath)
+        {
+            try
+            {
+                bool a1 = _dvr.CapturePicture(1, filePath + "1.jpg");
+                bool a2 = _dvr.CapturePicture(2, filePath + "2.jpg");
+                bool a3 = _dvr.CapturePicture(3, filePath + "3.jpg");
+                bool a4 = _dvr.CapturePicture(4, filePath + "4.jpg");
+                bool a5 = _dvr.CapturePicture(5, filePath + "5.jpg");
+                bool a6 = _dvr.CapturePicture(6, filePath + "6.jpg");
+                return true;
+            }
+            catch (Exception)
+            {
+                return false;
+
+            }
+        }
+    }
+}

+ 3 - 2
CarMeterSystem/Properties/licenses.licx

@@ -1,3 +1,4 @@
-Infragistics.Win.UltraWinEditors.UltraTextEditor, Infragistics2.Win.UltraWinEditors.v9.2, Version=9.2.20092.1003, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb
-Infragistics.Win.UltraWinDataSource.UltraDataSource, Infragistics2.Win.UltraWinDataSource.v9.2, Version=9.2.20092.1003, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb
+DevExpress.XtraEditors.PictureEdit, DevExpress.XtraEditors.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 Infragistics.Win.UltraWinGrid.UltraGrid, Infragistics2.Win.UltraWinGrid.v9.2, Version=9.2.20092.1003, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb
+Infragistics.Win.UltraWinDataSource.UltraDataSource, Infragistics2.Win.UltraWinDataSource.v9.2, Version=9.2.20092.1003, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb
+Infragistics.Win.UltraWinEditors.UltraTextEditor, Infragistics2.Win.UltraWinEditors.v9.2, Version=9.2.20092.1003, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb

+ 76 - 290
CarMeterSystem/frmMain.cs

@@ -30,7 +30,6 @@ namespace CarMeterSystem
         }
 
         private Log l = Log.GetInstance();
-        private Print printClass = new Print();//打印
 
         //内存表
         private MemoryTableDataSocket MemoClass = new MemoryTableDataSocket("");
@@ -71,8 +70,6 @@ namespace CarMeterSystem
 
         private MeterWorkScheduledHelpService meterWorkScheduledHelpService = new MeterWorkScheduledHelpService();
 
-        //历史皮操作
-        private MeterBaseHisTareDataService hisTareDataService = new MeterBaseHisTareDataService();
 
         /// <summary>
         /// 欢迎界面
@@ -92,7 +89,6 @@ namespace CarMeterSystem
         //扫码修正车号标识
         private bool codeFlag = false;
 
-        private List<ucBusinessType> lu = new List<ucBusinessType>();
 
         private bool isVoiceDownCar = false;//车上人员请下车播放一次
         private bool isShowFrmWelcome = true; //是否显示欢迎界面
@@ -162,36 +158,6 @@ namespace CarMeterSystem
                         }
                         //若未校秤的话,也不允许计量
 
-                        //载入界面业务按钮
-                        if (PbCache.businessType != null && PbCache.businessType.Count > 0)
-                        {
-                            foreach (ComBaseInfo info in PbCache.businessType)
-                            {
-                                ucBusinessType uc = new ucBusinessType();
-                                switch (info.baseCode)
-                                {
-                                    case "001006003":
-                                        uc.setControl(info.baseName, info.memo, info.baseCode);
-                                        break;
-
-                                    case "001006001":
-                                    case "001006002":
-                                        uc.setControl(info.baseName, info.memo, info.baseCode);
-                                        break;
-
-                                    default:
-                                        uc.setControl(info.baseName, info.memo, info.baseCode);
-                                        break;
-                                }
-
-                                uc.Dock = DockStyle.Top;
-                                //uc.setControl("","","",);
-                                uc.ucEvent += new EventHandler(ucEvents);
-                                lu.Add(uc);
-                                //panel7.Controls.Add(uc);
-                            }
-                        }
-
                         //开启基础进程
                         l.WriteLog(0, "系统登录成功");
 
@@ -256,90 +222,7 @@ namespace CarMeterSystem
             //timer1.Start();
         }
 
-        /// <summary>
-        /// 直接打开扫码计量界面
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        //private void timer1_Tick(object sender, EventArgs e)
-        //{
-        //    if (!isOpened && PbCache.collect?.weight > 500)
-        //    {
-        //        l.WriteLog(31, "frmOneYardToEnd页面打开(timer1_Tick:frmMain),车号:" + PbCache.resultCarNo + "||" + (PbCache.collect == null ? "" : PbCache.collect.carno));
-        //        isOpened = true;
-        //        PbCache.bussinessTypeName = "";
-        //        PbCache.bussinessTypeCode = "";
-
-        //        try
-        //        {
-        //            if(fcc.Visible == false)
-        //            {
-        //                fcc.Visible = true;
-        //                fcc.init();
-        //            }
-        //        }
-        //        catch(Exception exp)
-        //        {
-
-        //        }
-        //    }
-        //}
-
-        #region
-        //*
-
-        /// <summary>
-        /// 委托的方式调用控件的点击事件
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        public void ucEvents(object sender, EventArgs e)
-        {
-            Control control = (Control)sender;
-            ucBusinessType um = control.Parent.Parent as ucBusinessType;
-
-            try
-            {
-                switch (control.Name)
-                {
-                    case "btnContext":
-                    case "btnPurchase":
-                        {
-                            PbCache.bussinessTypeName = um._bussiness == null ? "" : um._bussiness;
-                            PbCache.bussinessTypeCode = um._code;
-
-                            switch (um._code)
-                            {
-                                case "001006003":
-                                    frmInternalTransport frm = new frmInternalTransport();
-                                    frm.ShowDialog();
-                                    break;
-                                /*
-                                case "001006001":
-                                case "001006002":
-                                    frmCarSalePurchase frmCar = new frmCarSalePurchase();
-                                    frmCar.ShowDialog();
-                                    break;
-                                //*/
-                                default:
-                                    frmCarSalePurchase frmCar = new frmCarSalePurchase();
-                                    frmCar.ShowDialog();
-                                    break;
-                            }
-                        };
-                        break;
-
-                    default: break;
-                }
-            }
-            catch (Exception ex)
-            {
-                //MessageBox.Show("操作异常:" + ex.Message);
-            }
-        }
-
-        //*/
-        #endregion
+        
 
         #region
 
@@ -389,7 +272,6 @@ namespace CarMeterSystem
         private bool flagCarMonit = false;//车号修正
         private bool bEditCar = false; //手动修正车号
         private bool isOpenMeter = false; //是否已打开计量界面,若已经打开则这里关于超量程及红外的语音将停止播报
-        private string firstCode = "";//上次扫码的信息
 
         private string ledTxt = "";
         private bool isLedWrite = false;//是否写入一次LED
@@ -407,7 +289,6 @@ namespace CarMeterSystem
         private string RFIDCarNo = "";
         private string isWriteRFID = AppConfigCache.isWriteRFID;
 
-        private int num = 0;
         //EventData实例化
         RESTfulResult<string> rmsEventDataLastTime = new RESTfulResult<string>();
         RESTfulResult<List<MeterWorkMonitor>> rmUpdateEventDataMonitor = new RESTfulResult<List<MeterWorkMonitor>>();
@@ -419,13 +300,12 @@ namespace CarMeterSystem
         RESTfulResult<List<PbModelDb>> rmTRFIDEventData = new RESTfulResult<List<PbModelDb>>();
         RESTfulResult<string> rmsmwUpdateEventData = new RESTfulResult<string>();
         MeterWorkScheduledHelp meterWorkScheduledHelp1 = new MeterWorkScheduledHelp();
-        MeterWorkScheduledHelp meterWorkScheduledHelpRFID = new MeterWorkScheduledHelp();
-        RESTfulResult<string> rmsdoUpdateWfEventData = new RESTfulResult<string>();
-        RESTfulResult<string> rmssEventData = new RESTfulResult<string>();
         MeterWorkMonitor meterWorkMonitorEventDataI = new MeterWorkMonitor();
         MeterWorkCarActualFirstService mwcfs = new MeterWorkCarActualFirstService();
         RESTfulResult<string> rmsSweepCodeClass = new RESTfulResult<string>();
         frmOneYardToEnd frmOneYardToEnd = new frmOneYardToEnd();
+
+        int icnt = 0;
         /// <summary>
         /// 数据采集
         /// </summary>
@@ -438,52 +318,28 @@ namespace CarMeterSystem
                 timer1.Enabled = true;
                 //l.WriteLog(32, "定时器重启(timer1_Tick:frmMain),车号:" + PbCache.resultCarNo + "||" + (PbCache.collect == null ? "" : PbCache.collect.carno));
             }
-            #region
-            num++;
+
+            #region 仅做测试用
+            /*
             // BourneCao 20230228 怀疑int超长导致程序长期运行卡死
-            if (num > 200000000) num = 0;
-            //e.weight = 23580;
-            //e.carno = "湘G88888";
-            //e.weight = 23580;
-            //e.weightStatus = 0;
-
-            //if (num > 10)
-            //{
-            //    e.carno = "甘B76917";
-            //    e.weight = 23580;
-            //    e.weightStatus = 0;
-            //}
-
-            //if (num < 20)
-            //{
-            //    e.weight = 23580;
-            //    e.weightStatus = 1;
-            //}
-            //else if (num < 26)
-            //{
-            //    e.weight = 23580;
-            //    e.weightStatus = 0;
-            //}
-            //else if (num < 39)
-            //{
-            //    e.weight = 23580;
-            //    e.weightStatus = 0;
-            //}
-            //else if (num < 45)
-            //{
-            //    e.weight = 15000;
-            //    e.weightStatus = 1;
-            //}
-            //else
-            //{
-            //    e.weight = 400;
-            //}
+            if (icnt > 90) icnt = 0;
+            e.carno = "湘G88888";
+            e.weightStatus = 0;
+
+            if (icnt < 30)
+                e.weight = 23580;
+            else if (icnt < 60)
+                e.weight = 24580;
+            else
+                e.weight = 0;
+            icnt++;
+            //*/
             #endregion
 
 
             //这里每隔0.5秒执行一次
             try
-                {
+            {
                 if (PbCache.carNoSource == 0)
                 {
                     PbCache.carNoSource = 1;
@@ -492,47 +348,8 @@ namespace CarMeterSystem
                 {
                     e.carno = "";
                 }
-                #region 扫码信息
-                //if (string.IsNullOrEmpty(sweepCodeClass.StrCode))
-                //{
-                //    if (string.IsNullOrEmpty(PbCache.strCode))
-                //    {
-                //        codeFlag = false;
-                //        firstCode = "";
-                //        PbCache.strCode = "";
-                //        l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
-                //    }
-                //}
-                //else
-                //{
-                //    codeFlag = true;
-                //    frmOneYardToEnd frmOneYardToEnd = new frmOneYardToEnd();
-                //    Hashtable hashTable = new Hashtable();
-                //    hashTable.Add("message", sweepCodeClass.StrCode);
-                //    rmsSweepCodeClass = mwcfs.DecryptionForWfTest(hashTable);
-                //    if (rmsSweepCodeClass.Code == "0")
-                //    {
-                //        PbCache.collect.carno = rmsSweepCodeClass.Data;
-                //        PbCache.strCode = rmsSweepCodeClass.Data;
-                //    }
-                //    if (rmsSweepCodeClass.Code == "1")
-                //    {
-                //        vicPlayClass.GetVoicePlay("车号二维码已过期", PbCache.collect.carno);
-                //        frmOneYardToEnd.setMsgInfo("车号二维码已过期");
-                //    }
-                //    if (rmsSweepCodeClass.Code == "2")
-                //    {
-                //        vicPlayClass.GetVoicePlay("不是有效车号二维码", PbCache.collect.carno);
-                //        frmOneYardToEnd.setMsgInfo("不是有效车号二维码");
-                //    }
-                //    if (rmsSweepCodeClass.Code == "9")
-                //    {
-                //        vicPlayClass.GetVoicePlay("不是有效车号二维码", PbCache.collect.carno);
-                //        frmOneYardToEnd.setMsgInfo("不是有效车号二维码");
-                //    }
-                //    l.WriteLog(12, "测试扫码值" + rmsSweepCodeClass.Data);
-                //}
 
+                #region 扫码信息
                 // 司机扫码为空,取工控机二维码
                 if (PbCache.sportInfo.scanRequireValid == "1")
                 {
@@ -546,7 +363,6 @@ namespace CarMeterSystem
                                 if (string.IsNullOrEmpty(PbCache.strCode))
                                 {
                                     codeFlag = false;
-                                    firstCode = "";
                                     PbCache.strCode = "";
                                     //l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
                                 }
@@ -590,7 +406,6 @@ namespace CarMeterSystem
                                 {
                                     PbCache.isValidScan = true;
                                     codeFlag = false;
-                                    firstCode = "";
                                     PbCache.strCode = "";
                                     //l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
                                 }
@@ -634,7 +449,6 @@ namespace CarMeterSystem
                             if (string.IsNullOrEmpty(PbCache.strCode))
                             {
                                 codeFlag = false;
-                                firstCode = "";
                                 PbCache.strCode = "";
                                 //l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
                             }
@@ -1011,13 +825,7 @@ namespace CarMeterSystem
                             }
                         }
 
-                        if (!lu[0].bcEnable)
-                        {
-                            foreach (ucBusinessType uc in lu)
-                            {
-                                uc.setControlEnable(true);
-                            }
-                        }
+
 
                         if ((sweepCodeClass.StrCode == "" || sweepCodeClass2.StrCode == "") && !codeFlag)
                         {
@@ -1036,29 +844,11 @@ namespace CarMeterSystem
                             meterWorkScheduledHelpService.add(meterWorkScheduledHelp1);
                         }
                     }
-
-                    //写入LED信息
-                    //if (PbCache.sportInfo != null && PbCache.ledInfo != PbCache.OldLedInfo)
-                    //{
-                    //    PbCache.OldLedInfo = PbCache.ledInfo;
-                    //    if (PbCache.monitor != null && PbCache.monitor.ledKeep == "0")
-                    //    {
-                    //        //led_controler.setOneLineMsg(PbCache.sportInfo.ledIp, PbCache.ledInfo);
-                    //    }
-                    //}
                 }
                 else
                 {
                     isOpened = false; //下次上秤直接打开主界面
 
-                    if (e.weight > 10 && e.weight < 500)
-                    {
-                        //重量小于500,大于10
-                        MeterWorkMonitor mwUpdate = new MeterWorkMonitor();
-                        mwUpdate.pointNo = PbCache.sportInfo.baseSpotNo;
-                        mwUpdate.wgt = e.weight;
-                        rmsdoUpdateWfEventData = meterWorkMonitor.doUpdateWf(mwUpdate);
-                    }
                     if (e.weight > 0 && e.weight < 200)
                     {
                         doOperateLive();
@@ -1068,7 +858,6 @@ namespace CarMeterSystem
                         PbCache.isZeroAlarm = false;
                     }
                     editCarNo = "";
-                    firstCode = ""; //历史的扫码枪的值
                     preCarNo = "";
                     sCarNo = "";
                     sPreNo = "";
@@ -1136,66 +925,64 @@ namespace CarMeterSystem
                     }
 
                     setWelecomeVis(true);
-                    if (lu[0].bcEnable)
-                    {
-                        foreach (ucBusinessType uc in lu)
-                        {
-                            uc.setControlEnable(false);
-                        }
-                    }
-
 
                     noteCode = false;
 
-
-                    meterWorkMonitorEventDataI.pointNo = PbCache.sportInfo.baseSpotNo;
-                    meterWorkMonitorEventDataI.validWgt = "1";
-                    meterWorkMonitorEventDataI.validCarno = "1";
-                    meterWorkMonitorEventDataI.validTareTime = "1";
-                    meterWorkMonitorEventDataI.validMatTime = "1";
-                    meterWorkMonitorEventDataI.validTimeInterval = "1";
-                    meterWorkMonitorEventDataI.validParkStatus = "1";
-                    meterWorkMonitorEventDataI.validExceedWgt = "1";
-                    meterWorkMonitorEventDataI.validPredictionDiff = "1";
-                    meterWorkMonitorEventDataI.validLianda = "1";
-                    meterWorkMonitorEventDataI.validMatClick = "1";
-                    meterWorkMonitorEventDataI.validArea = "1";
-                    meterWorkMonitorEventDataI.setCar = "";
-                    meterWorkMonitorEventDataI.isValidScan = "1";
-                    meterWorkMonitorEventDataI.rfidCar = "";
-                    meterWorkMonitorEventDataI.photoCar = "";
-                    meterWorkMonitorEventDataI.scanCar = "";
-                    meterWorkMonitorEventDataI.editCar = "";
-                    meterWorkMonitorEventDataI.zeroState = "0";
-                    meterWorkMonitorEventDataI.carErr = "0";
-                    meterWorkMonitorEventDataI.ferroalloyResult = "0";
-                    meterWorkMonitorEventDataI.wgtErr = "0";
-                    meterWorkMonitorEventDataI.stopOverTime = "0";
-                    meterWorkMonitorEventDataI.msgInfo = "";
-                    meterWorkMonitorEventDataI.ledWriter = "";
-                    meterWorkMonitorEventDataI.isOverWgt = "";
-                    meterWorkMonitorEventDataI.isHelp = "0";
-                    meterWorkMonitorEventDataI.weightStatus = 0;
-                    meterWorkMonitorEventDataI.wgt = e.weight;
-
-                    // DVR,MOXA,PLC状态监控
-                    // 20220928 by BourneCao
-                    bool DVR_Online = PingIp(PbCache.sportInfo.videoIp);
-                    meterWorkMonitorEventDataI.dvrState = DVR_Online == true ? "0" : "1";
-                    bool Power_Online = PingIp(PbCache.sportInfo.controlIp);
-                    meterWorkMonitorEventDataI.powerState = Power_Online == true ? "0" : "1";
-                    bool MOXA_Online = PingIp(PbCache.sportInfo.moxaIp);
-                    meterWorkMonitorEventDataI.moxaState = MOXA_Online == true ? "0" : "1";
-                    bool PLC_Online = PingIp(PbCache.sportInfo.plcIp);
-                    meterWorkMonitorEventDataI.plcState = PLC_Online == true ? "0" : "1";
-
-                    //*
-                    //另外初始化一次监控数据
-                    RESTfulResult<string> rmssEventData = meterWorkMonitor.doUpdateWf(meterWorkMonitorEventDataI);
-                    if (!rmssEventData.Succeed)
+                    //1秒写一次监控表
+                    if (iCount % 2 == 0) 
                     {
-                        l.WriteLog(0, "frmMain.EventData异常754:写入信息异常");
+                        meterWorkMonitorEventDataI.pointNo = PbCache.sportInfo.baseSpotNo;
+                        meterWorkMonitorEventDataI.validWgt = "1";
+                        meterWorkMonitorEventDataI.validCarno = "1";
+                        meterWorkMonitorEventDataI.validTareTime = "1";
+                        meterWorkMonitorEventDataI.validMatTime = "1";
+                        meterWorkMonitorEventDataI.validTimeInterval = "1";
+                        meterWorkMonitorEventDataI.validParkStatus = "1";
+                        meterWorkMonitorEventDataI.validExceedWgt = "1";
+                        meterWorkMonitorEventDataI.validPredictionDiff = "1";
+                        meterWorkMonitorEventDataI.validLianda = "1";
+                        meterWorkMonitorEventDataI.validMatClick = "1";
+                        meterWorkMonitorEventDataI.validArea = "1";
+                        meterWorkMonitorEventDataI.setCar = "";
+                        meterWorkMonitorEventDataI.isValidScan = "1";
+                        meterWorkMonitorEventDataI.rfidCar = "";
+                        meterWorkMonitorEventDataI.photoCar = "";
+                        meterWorkMonitorEventDataI.scanCar = "";
+                        meterWorkMonitorEventDataI.editCar = "";
+                        meterWorkMonitorEventDataI.zeroState = "0";
+                        meterWorkMonitorEventDataI.carErr = "0";
+                        meterWorkMonitorEventDataI.ferroalloyResult = "0";
+                        meterWorkMonitorEventDataI.wgtErr = "0";
+                        meterWorkMonitorEventDataI.stopOverTime = "0";
+                        meterWorkMonitorEventDataI.msgInfo = "";
+                        meterWorkMonitorEventDataI.ledWriter = "";
+                        meterWorkMonitorEventDataI.isOverWgt = "";
+                        meterWorkMonitorEventDataI.isHelp = "0";
+                        meterWorkMonitorEventDataI.weightStatus = 0;
+                        meterWorkMonitorEventDataI.wgt = e.weight;
+
+                        meterWorkMonitorEventDataI.isZeroState = "1";
+                        meterWorkMonitorEventDataI.isEnableSound = "1";
+
+                        // DVR,MOXA,PLC状态监控
+                        // 20220928 by BourneCao
+                        bool DVR_Online = PingIp(PbCache.sportInfo.videoIp);
+                        meterWorkMonitorEventDataI.dvrState = DVR_Online == true ? "0" : "1";
+                        bool Power_Online = PingIp(PbCache.sportInfo.controlIp);
+                        meterWorkMonitorEventDataI.powerState = Power_Online == true ? "0" : "1";
+                        bool MOXA_Online = PingIp(PbCache.sportInfo.moxaIp);
+                        meterWorkMonitorEventDataI.moxaState = MOXA_Online == true ? "0" : "1";
+                        bool PLC_Online = PingIp(PbCache.sportInfo.plcIp);
+                        meterWorkMonitorEventDataI.plcState = PLC_Online == true ? "0" : "1";
+
+                        //*
+                        //另外初始化一次监控数据
+                        if (!meterWorkMonitor.doUpdateWf(meterWorkMonitorEventDataI).Succeed)
+                        {
+                            l.WriteLog(0, "frmMain.EventData异常754:写入信息异常");
+                        }
                     }
+
                     //*/
                     //LED写入
                     if (isLedWrite)
@@ -1260,14 +1047,12 @@ namespace CarMeterSystem
         }
 
         List<LiveData> lldoLive = new List<LiveData>();
-        RESTfulResult<string> rmsdoLive = new RESTfulResult<string>();
         MeterWorkMonitor mwmdoLive = new MeterWorkMonitor();
         /// <summary>
         /// 操作Live表的数据:零点报警
         /// </summary>
         private void doLive()
         {
-
             if (PbCache.collect_no == null)
             {
                 return;
@@ -1368,7 +1153,7 @@ namespace CarMeterSystem
                     }
                 }
             }
-            rmsdoLive = meterWorkMonitor.doUpdateWf(mwmdoLive);
+            meterWorkMonitor.doUpdateWf(mwmdoLive);
         }
 
         MeterWorkZeroAlarm workZeroAlarmdoInsertZeroAlarm = new MeterWorkZeroAlarm();
@@ -1584,6 +1369,7 @@ namespace CarMeterSystem
             catch (Exception)
             {
                 bRet = false;
+                l.WriteLog(2, $"网络无法Ping通:{strIP}");
             }
             return bRet;
         }

+ 1 - 14
CarMeterSystem/frmMatMsgInfo.cs

@@ -29,7 +29,7 @@ namespace CarMeterSystem
 
         public string weightType = "";
 
-        string _matName = "", _chkMatName = "",_carNo = "";
+        string _carNo = "";
 
         public frmMatMsgInfo() 
         {
@@ -96,19 +96,6 @@ namespace CarMeterSystem
             this.DialogResult = DialogResult.Cancel;
         }
 
-        private void lbMat1_Click(object sender, EventArgs e)
-        {
-            //_chkMatName = lbMat1.Text;
-            //lbMat1.BackColor = Color.PaleTurquoise;
-            //lbMat2.BackColor = Color.LightBlue;
-        }
-
-        private void lbMat2_Click(object sender, EventArgs e)
-        {
-            //_chkMatName = lbMat2.Text;
-            //lbMat2.BackColor = Color.PaleTurquoise;
-            //lbMat1.BackColor = Color.LightBlue;
-        }
 
         private void btnTare_Click(object sender, EventArgs e)
         {

+ 16 - 28
CarMeterSystem/frmOneYardToEnd.Designer.cs

@@ -28,10 +28,8 @@
         /// </summary>
         private void InitializeComponent()
         {
-            this.components = new System.ComponentModel.Container();
             Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
             this.btnSave = new System.Windows.Forms.Button();
-            this.btnRecover = new System.Windows.Forms.Button();
             this.btnFH = new System.Windows.Forms.Button();
             this.btnTare = new System.Windows.Forms.Button();
             this.btnHelp = new System.Windows.Forms.Button();
@@ -42,7 +40,6 @@
             this.label3 = new System.Windows.Forms.Label();
             this.txtGroess = new System.Windows.Forms.TextBox();
             this.lbPointName = new System.Windows.Forms.Label();
-            this.timer1 = new System.Windows.Forms.Timer(this.components);
             this.printDocument1 = new System.Drawing.Printing.PrintDocument();
             this.lbVsersion = new System.Windows.Forms.Label();
             this.panelCarFormCentered = new System.Windows.Forms.Panel();
@@ -57,10 +54,12 @@
             this.btnSelPreType = new System.Windows.Forms.Button();
             this.ucCarFormButtomJXJG1 = new MeterModuleLibrary.uc.ucCarFormButtomJXJG();
             this.ucCarFormTop_Jisco1 = new MeterModuleLibrary.uc.ucCarFormTop_Jisco();
+            this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.panelCarFormCentered.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.txtCarNo)).BeginInit();
             this.tableLayoutPanelPromptMsg.SuspendLayout();
             this.panelShowWeightJGNoUsed.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             this.SuspendLayout();
             // 
             // btnSave
@@ -78,21 +77,6 @@
             this.btnSave.Visible = false;
             this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
             // 
-            // btnRecover
-            // 
-            this.btnRecover.BackColor = System.Drawing.Color.DodgerBlue;
-            this.btnRecover.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.btnRecover.Font = new System.Drawing.Font("楷体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)), true);
-            this.btnRecover.ForeColor = System.Drawing.Color.White;
-            this.btnRecover.Location = new System.Drawing.Point(673, 780);
-            this.btnRecover.Name = "btnRecover";
-            this.btnRecover.Size = new System.Drawing.Size(240, 38);
-            this.btnRecover.TabIndex = 644;
-            this.btnRecover.Text = "保存(复磅)";
-            this.btnRecover.UseVisualStyleBackColor = false;
-            this.btnRecover.Visible = false;
-            this.btnRecover.Click += new System.EventHandler(this.btnRecover_Click);
-            // 
             // btnFH
             // 
             this.btnFH.BackColor = System.Drawing.Color.DodgerBlue;
@@ -114,9 +98,9 @@
             this.btnTare.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.btnTare.Font = new System.Drawing.Font("楷体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)), true);
             this.btnTare.ForeColor = System.Drawing.Color.White;
-            this.btnTare.Location = new System.Drawing.Point(394, 781);
+            this.btnTare.Location = new System.Drawing.Point(510, 772);
             this.btnTare.Name = "btnTare";
-            this.btnTare.Size = new System.Drawing.Size(260, 37);
+            this.btnTare.Size = new System.Drawing.Size(234, 54);
             this.btnTare.TabIndex = 643;
             this.btnTare.Text = "期限皮重";
             this.btnTare.UseVisualStyleBackColor = false;
@@ -210,11 +194,6 @@
             this.lbPointName.Size = new System.Drawing.Size(0, 76);
             this.lbPointName.TabIndex = 4;
             // 
-            // timer1
-            // 
-            this.timer1.Interval = 1000;
-            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
-            // 
             // printDocument1
             // 
             this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
@@ -237,7 +216,6 @@
             this.panelCarFormCentered.Controls.Add(this.tableLayoutPanelPromptMsg);
             this.panelCarFormCentered.Controls.Add(this.ucWeightT1);
             this.panelCarFormCentered.Controls.Add(this.panelShowWeightJGNoUsed);
-            this.panelCarFormCentered.Controls.Add(this.btnRecover);
             this.panelCarFormCentered.Controls.Add(this.btnSelPreType);
             this.panelCarFormCentered.Controls.Add(this.btnSave);
             this.panelCarFormCentered.Controls.Add(this.btnHelp);
@@ -383,12 +361,22 @@
             this.ucCarFormTop_Jisco1.Size = new System.Drawing.Size(1280, 95);
             this.ucCarFormTop_Jisco1.TabIndex = 595;
             // 
+            // pictureBox1
+            // 
+            this.pictureBox1.Location = new System.Drawing.Point(0, 0);
+            this.pictureBox1.Name = "pictureBox1";
+            this.pictureBox1.Size = new System.Drawing.Size(800, 450);
+            this.pictureBox1.TabIndex = 596;
+            this.pictureBox1.TabStop = false;
+            this.pictureBox1.Visible = false;
+            // 
             // frmOneYardToEnd
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.White;
             this.ClientSize = new System.Drawing.Size(1280, 1024);
+            this.Controls.Add(this.pictureBox1);
             this.Controls.Add(this.ucCarFormButtomJXJG1);
             this.Controls.Add(this.panelCarFormCentered);
             this.Controls.Add(this.lbPointName);
@@ -411,6 +399,7 @@
             this.tableLayoutPanelPromptMsg.PerformLayout();
             this.panelShowWeightJGNoUsed.ResumeLayout(false);
             this.panelShowWeightJGNoUsed.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -427,12 +416,10 @@
         private MeterModuleLibrary.ucWeightT ucWeightT1;
         private System.Windows.Forms.Label lbPointName;
         private System.Windows.Forms.Button btnSave;
-        private System.Windows.Forms.Timer timer1;
         private System.Drawing.Printing.PrintDocument printDocument1;
         private System.Windows.Forms.Button btnFH;
         private System.Windows.Forms.Button btnTare;
         private System.Windows.Forms.Label lbVsersion;
-        private System.Windows.Forms.Button btnRecover;
         private System.Windows.Forms.Panel panelCarFormCentered;
         private MeterModuleLibrary.uc.ucCarFormButtomJXJG ucCarFormButtomJXJG1;
         private System.Windows.Forms.Panel panelShowWeightJGNoUsed;
@@ -444,5 +431,6 @@
         private MeterModuleLibrary.uc.ucCarFormTop_Jisco ucCarFormTop_Jisco1;
         private MeterModuleLibrary.ucCarMeterInfoJisco ucCarMeterInfoJisco1;
         private System.Windows.Forms.Button btnSelPreType;
+        private System.Windows.Forms.PictureBox pictureBox1;
     }
 }

File diff suppressed because it is too large
+ 174 - 494
CarMeterSystem/frmOneYardToEnd.cs


+ 0 - 3
CarMeterSystem/frmOneYardToEnd.resx

@@ -117,9 +117,6 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
   <metadata name="printDocument1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>344, 17</value>
   </metadata>

+ 5 - 3
CarMeterSystem/frmVoice.Designer.cs

@@ -34,22 +34,24 @@ namespace CarMeterSystem
             // 
             // flowLayoutPanel1
             // 
+            this.flowLayoutPanel1.AutoScroll = true;
             this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
             this.flowLayoutPanel1.Name = "flowLayoutPanel1";
-            this.flowLayoutPanel1.Size = new System.Drawing.Size(390, 224);
+            this.flowLayoutPanel1.Size = new System.Drawing.Size(845, 661);
             this.flowLayoutPanel1.TabIndex = 1;
             // 
             // frmVoice
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(390, 224);
+            this.ClientSize = new System.Drawing.Size(845, 661);
             this.Controls.Add(this.flowLayoutPanel1);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.Name = "frmVoice";
             this.Text = "frmVoice";
+            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmVoice_FormClosing);
-            this.Load += new System.EventHandler(this.frmVoice_Load);
             this.ResumeLayout(false);
 
         }

+ 47 - 49
CarMeterSystem/frmVoice.cs

@@ -1,14 +1,17 @@
-using Common;
+using CarMeterSystem.OptionCls;
+using Common;
 using MeterPlugInLibrary;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
+using System.Drawing.Drawing2D;
 using System.IO;
 using System.Linq;
 using System.Runtime.InteropServices;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -27,11 +30,15 @@ namespace CarMeterSystem
             int i = 1;
             foreach (loginParam lp in lt) 
             {
+                //最多载入4个摄像头,因为这边截图最多4摄像头带1屏幕图
+                if (i > 4) break;
+
                 CamerEs c = new CamerEs(lp);
                 PictureBox pb = new PictureBox();
                 pb.Name = $"pb{i++}";
-                pb.Height = 100;
-                pb.BackColor = Color.Black;
+                pb.Width = AppConfigCache.imgWidth;
+                pb.Height = Convert.ToInt32(AppConfigCache.imgWidth / 1.8);
+                //pb.BackColor = Color.Black;
                 pb.Dock = DockStyle.Top;
                 flowLayoutPanel1.Controls.Add(pb);
                 c.Login(pb);
@@ -47,73 +54,64 @@ namespace CarMeterSystem
             }
         }
 
+
+
         /// <summary>
         /// 传入了值,则按传入的路径及Ip进行截图,否则则全部截图
         /// </summary>
         /// <param name="imgUrl"></param>
         /// <param name="ip"></param>
-        public void CapturePictrue(string actualFirstNo, string imgUrl = default, string ip = default)
+        public void CapturePictrue(string actualFirstNo,Form fm, string imgUrl = default, string ip = default)
         {
-            string strUrl = imgUrl ?? PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, 1);
-            lc[0]?.CapturePictrue(strUrl);
-            /*
-             * 只截取第一张图片
-            if (!string.IsNullOrEmpty(ip))
-            {
-                string strUrl = imgUrl ?? PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, 1);
-                lc.Where(s => s._lg?.ip == ip).FirstOrDefault()?.CapturePictrue(strUrl);
-            }
-            else
+            //*
+            this.TopMost = true;
+            Thread.Sleep(1000);
+            //*
+            int i = 1;
+            foreach (Control cn in flowLayoutPanel1.Controls) 
             {
-                string strUrl = imgUrl ?? $"{Environment.CurrentDirectory}/imgShort/formalImg";
-                int i = 1;
-                foreach (CamerEs lp in lc)
+                if (cn.Name.Contains("pb")) 
                 {
+                    //截屏的方式只截取第一个摄像头的图片
+                    if (i == 1)
+                    {
+                        PictureBox pb = (PictureBox)cn;
+                        Bitmap bit = new Bitmap(800, 450);//实例化一个和窗体一样大的bitmap
+                        Graphics g = Graphics.FromImage(bit);
+                        g.CompositingQuality = CompositingQuality.HighQuality;//质量设为最高 HighQuality
+                        g.CopyFromScreen(pb.Left, pb.Top, 0, 0, new Size(800, 450));//保存整个窗体为图片       
+                        bit.Save($"{PbCache.path}/imgShort/formalImg/{PbCache.sportInfo.baseSpotNo}_C{actualFirstNo}_{i}.jpg");//默认保存格式为PNG,保存成jpg格式质量不是很好
+                        bit.Dispose();
 
-                    //lp.CapturePictrue($"{strUrl}/{DateTime.Now.ToString("yyyyMMddHHmmss")}_{i++}.jpg");
+                        this.TopMost = false;
+                        fm.TopMost = true;
+                    }
+                    else 
+                    {
+                        //_ = BeginInvoke(new Action(() => {
+                        //    lc[i - 1].CapturePictrue($"{PbCache.path}/imgShort/formalImg/{PbCache.sportInfo.baseSpotNo}_C{actualFirstNo}_{i}.jpg");
+                        //}));
+                        lc[i - 1].CapturePictrue2($"{PbCache.path}/imgShort/formalImg/{PbCache.sportInfo.baseSpotNo}_C{actualFirstNo}_{i}.jpg");
+                    }
+                    if (i < flowLayoutPanel1.Controls.Count) i++;
                 }
             }
-            */
-        }
-
-        /// <summary>
-        /// 传入了值,则按传入的路径及Ip进行截图,否则则全部截图
-        /// </summary>
-        /// <param name="imgUrl"></param>
-        /// <param name="ip"></param>
-        public void SaveRealData(string actualFirstNo)
-        {
-            string strUrl = PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.3gp", PbCache.sportInfo.baseSpotNo, "V" + actualFirstNo, 1);
-            lc[0]?.SaveRealData(strUrl);
-            
+            //*/
         }
 
-        /// <summary>
-        /// 传入了值,则按传入的路径及Ip进行截图,否则则全部截图
-        /// </summary>
-        /// <param name="imgUrl"></param>
-        /// <param name="ip"></param>
-        public void StopRealData()
-        {
-            lc[0]?.StopRealData();
-
-        }
 
         internal void LoadVoiceInfo() 
         {
             List<MeterBaseVideoChild> lt = PbCache.videoChild;
             List<loginParam> lp = new List<loginParam>();
-            
-            lp.Add(new loginParam { ip = lt[0].p_ip, port = int.Parse(lt[0].vdo_port), userId = lt[0].vdo_user, pwd = lt[0].vdo_pwd });
-           
+            foreach (MeterBaseVideoChild t in lt)
+            {
+                lp.Add(new loginParam { ip = t.p_ip, port = int.Parse(t.vdo_port), userId = t.vdo_user, pwd = t.vdo_pwd });
+            }
             LoadVoice(lp);
-            this.Hide();
+            //this.Hide();
         }
 
-        private void frmVoice_Load(object sender, EventArgs e)
-        {
-            
-        }
 
         private void frmVoice_FormClosing(object sender, FormClosingEventArgs e)
         {

+ 0 - 1
CarMeterSystem/frmWelcome_Jisco.Designer.cs

@@ -136,7 +136,6 @@
             this.Name = "frmWelcome_Jisco";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "欢迎界面";
-            this.TopMost = true;
             this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
             this.Load += new System.EventHandler(this.frmWelcome_Load);
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();

+ 27 - 27
CarRemoteMeter/frmMeterMain.Designer.cs

@@ -615,8 +615,8 @@
             this.ultraTabSharedControlsPage2 = new Infragistics.Win.UltraWinTabControl.UltraTabSharedControlsPage();
             this.timer1 = new System.Windows.Forms.Timer(this.components);
             this.timer2 = new System.Windows.Forms.Timer(this.components);
-            this.plImgShow = new System.Windows.Forms.Panel();
             this.pictureShow = new System.Windows.Forms.PictureBox();
+            this.plImgShow = new System.Windows.Forms.Panel();
             this.ultraTabPageControl5.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.ultraGridYb)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
@@ -675,14 +675,14 @@
             this.groupBox1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.ultraTabControlPW)).BeginInit();
             this.ultraTabControlPW.SuspendLayout();
-            this.plImgShow.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureShow)).BeginInit();
+            this.plImgShow.SuspendLayout();
             this.SuspendLayout();
             // 
             // ultraTabPageControl5
             // 
             this.ultraTabPageControl5.Controls.Add(this.ultraGridYb);
-            this.ultraTabPageControl5.Location = new System.Drawing.Point(1, 25);
+            this.ultraTabPageControl5.Location = new System.Drawing.Point(-10000, -10000);
             this.ultraTabPageControl5.Margin = new System.Windows.Forms.Padding(2);
             this.ultraTabPageControl5.Name = "ultraTabPageControl5";
             this.ultraTabPageControl5.Size = new System.Drawing.Size(804, 308);
@@ -3237,7 +3237,7 @@
             // ultraTabPageControl9
             // 
             this.ultraTabPageControl9.Controls.Add(this.ultraGridPW);
-            this.ultraTabPageControl9.Location = new System.Drawing.Point(1, 25);
+            this.ultraTabPageControl9.Location = new System.Drawing.Point(-10000, -10000);
             this.ultraTabPageControl9.Name = "ultraTabPageControl9";
             this.ultraTabPageControl9.Size = new System.Drawing.Size(292, 147);
             // 
@@ -3405,7 +3405,7 @@
             // 
             // ultraTabSharedControlsPage1
             // 
-            this.ultraTabSharedControlsPage1.Location = new System.Drawing.Point(-10000, -10000);
+            this.ultraTabSharedControlsPage1.Location = new System.Drawing.Point(1, 25);
             this.ultraTabSharedControlsPage1.Margin = new System.Windows.Forms.Padding(2);
             this.ultraTabSharedControlsPage1.Name = "ultraTabSharedControlsPage1";
             this.ultraTabSharedControlsPage1.Size = new System.Drawing.Size(804, 308);
@@ -4215,7 +4215,7 @@
             this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F));
             this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F));
             this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F));
-            this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 147F));
+            this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 151F));
             this.tableLayoutPanel7.Controls.Add(this.txtCarNo, 6, 0);
             this.tableLayoutPanel7.Controls.Add(this.cbCarNo, 5, 0);
             this.tableLayoutPanel7.Controls.Add(this.lbPointName, 1, 0);
@@ -4235,10 +4235,10 @@
             // 
             this.txtCarNo.Dock = System.Windows.Forms.DockStyle.Fill;
             this.txtCarNo.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.txtCarNo.Location = new System.Drawing.Point(658, 2);
+            this.txtCarNo.Location = new System.Drawing.Point(654, 2);
             this.txtCarNo.Margin = new System.Windows.Forms.Padding(2);
             this.txtCarNo.Name = "txtCarNo";
-            this.txtCarNo.Size = new System.Drawing.Size(144, 24);
+            this.txtCarNo.Size = new System.Drawing.Size(148, 24);
             this.txtCarNo.TabIndex = 81;
             this.txtCarNo.Text = " ";
             this.txtCarNo.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCarNo_KeyDown);
@@ -4311,7 +4311,7 @@
             "琼",
             "",
             "云"});
-            this.cbCarNo.Location = new System.Drawing.Point(598, 2);
+            this.cbCarNo.Location = new System.Drawing.Point(594, 2);
             this.cbCarNo.Margin = new System.Windows.Forms.Padding(2);
             this.cbCarNo.Name = "cbCarNo";
             this.cbCarNo.Size = new System.Drawing.Size(56, 24);
@@ -4327,7 +4327,7 @@
             this.lbPointName.ForeColor = System.Drawing.Color.Black;
             this.lbPointName.Location = new System.Drawing.Point(73, 0);
             this.lbPointName.Name = "lbPointName";
-            this.lbPointName.Size = new System.Drawing.Size(258, 30);
+            this.lbPointName.Size = new System.Drawing.Size(255, 30);
             this.lbPointName.TabIndex = 3;
             this.lbPointName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
@@ -4352,7 +4352,7 @@
             this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
             this.label2.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label2.ForeColor = System.Drawing.Color.Blue;
-            this.label2.Location = new System.Drawing.Point(549, 0);
+            this.label2.Location = new System.Drawing.Point(545, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(44, 30);
             this.label2.TabIndex = 8;
@@ -4366,7 +4366,7 @@
             this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.label1.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label1.ForeColor = System.Drawing.Color.Blue;
-            this.label1.Location = new System.Drawing.Point(337, 0);
+            this.label1.Location = new System.Drawing.Point(334, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(64, 30);
             this.label1.TabIndex = 7;
@@ -4380,9 +4380,9 @@
             this.lbMeterMan.Dock = System.Windows.Forms.DockStyle.Fill;
             this.lbMeterMan.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.lbMeterMan.ForeColor = System.Drawing.Color.Black;
-            this.lbMeterMan.Location = new System.Drawing.Point(407, 0);
+            this.lbMeterMan.Location = new System.Drawing.Point(404, 0);
             this.lbMeterMan.Name = "lbMeterMan";
-            this.lbMeterMan.Size = new System.Drawing.Size(136, 30);
+            this.lbMeterMan.Size = new System.Drawing.Size(135, 30);
             this.lbMeterMan.TabIndex = 5;
             this.lbMeterMan.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
@@ -4671,7 +4671,7 @@
             // 
             // ultraTabSharedControlsPage2
             // 
-            this.ultraTabSharedControlsPage2.Location = new System.Drawing.Point(-10000, -10000);
+            this.ultraTabSharedControlsPage2.Location = new System.Drawing.Point(1, 25);
             this.ultraTabSharedControlsPage2.Margin = new System.Windows.Forms.Padding(2);
             this.ultraTabSharedControlsPage2.Name = "ultraTabSharedControlsPage2";
             this.ultraTabSharedControlsPage2.Size = new System.Drawing.Size(292, 147);
@@ -4686,16 +4686,6 @@
             this.timer2.Interval = 2000;
             this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
             // 
-            // plImgShow
-            // 
-            this.plImgShow.Controls.Add(this.pictureShow);
-            this.plImgShow.Location = new System.Drawing.Point(270, 94);
-            this.plImgShow.Margin = new System.Windows.Forms.Padding(2);
-            this.plImgShow.Name = "plImgShow";
-            this.plImgShow.Size = new System.Drawing.Size(907, 603);
-            this.plImgShow.TabIndex = 41;
-            this.plImgShow.Visible = false;
-            // 
             // pictureShow
             // 
             this.pictureShow.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
@@ -4708,6 +4698,16 @@
             this.pictureShow.TabStop = false;
             this.pictureShow.Click += new System.EventHandler(this.pictureShow_DoubleClick);
             // 
+            // plImgShow
+            // 
+            this.plImgShow.Controls.Add(this.pictureShow);
+            this.plImgShow.Location = new System.Drawing.Point(270, 94);
+            this.plImgShow.Margin = new System.Windows.Forms.Padding(2);
+            this.plImgShow.Name = "plImgShow";
+            this.plImgShow.Size = new System.Drawing.Size(907, 603);
+            this.plImgShow.TabIndex = 41;
+            this.plImgShow.Visible = false;
+            // 
             // frmMeterMain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -4790,8 +4790,8 @@
             this.groupBox1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.ultraTabControlPW)).EndInit();
             this.ultraTabControlPW.ResumeLayout(false);
-            this.plImgShow.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.pictureShow)).EndInit();
+            this.plImgShow.ResumeLayout(false);
             this.ResumeLayout(false);
 
         }
@@ -5134,8 +5134,8 @@
         private System.Data.DataColumn dataColumn212;
         private System.Data.DataColumn dataColumn213;
         private System.Data.DataColumn dataColumn214;
-        private System.Windows.Forms.Panel plImgShow;
         private System.Windows.Forms.PictureBox pictureShow;
+        private System.Windows.Forms.Panel plImgShow;
     }
 }
 

+ 12 - 0
CarRemoteMeter/frmMeterMain.resx

@@ -183,6 +183,18 @@
         1IhUqAIcrXAlgT8JylA0oxSm7A+CJknJSlrykqPU5CY52QkGR0jCEprwhChMoQpXyELeBAQAOw==
 </value>
   </data>
+  <metadata name="panel19.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="panel20.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="lb2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="lb1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="lb2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>

+ 2 - 2
Common/DbOption/work/MeterWorkScheduledHelpService.cs

@@ -9,10 +9,10 @@ namespace Common
 {
     public class MeterWorkScheduledHelpService
     {
-        public RESTfulResult<List<MeterWorkScheduledHelp>> add(MeterWorkScheduledHelp info)
+        public RESTfulResult<string> add(MeterWorkScheduledHelp info)
         {
             DbHelper db = new DbHelper();
-            RESTfulResult<List<MeterWorkScheduledHelp>> rm = db.doOption<List<MeterWorkScheduledHelp>>("meterworkscheduledhelps", "/", new object[] { info }, 1);
+            RESTfulResult<string> rm = db.doOption<string>("meterworkscheduledhelps", "/", new object[] { info }, 1);
             return rm;
         }
     }

+ 5 - 0
Common/cacheCls/AppConfigCache.cs

@@ -114,5 +114,10 @@ namespace Common
         /// </summary>
         public static readonly string isSendZNLC = ConfigurationManager.AppSettings["isSendZNLC"].ToString().Trim();
 
+
+        public static readonly int imgMass = Convert.ToInt32(ConfigurationManager.AppSettings["imgMass"].ToString().Trim());
+
+        public static readonly int imgMass2 = Convert.ToInt32(ConfigurationManager.AppSettings["imgMass"].ToString().Trim());
+
     }
 }

+ 20 - 26
MeterPlugInLibrary/图片处理/ImageCurlControl.cs

@@ -63,7 +63,6 @@ namespace MeterPlugInLibrary
                     //为了避免给图片编号与这边压缩同时操作一个图片,所以需等车辆下去后进行该操作
                     if (PbCache.collect?.weight < 500 && !string.IsNullOrEmpty(PbCache.oldTempImgId) && !string.IsNullOrEmpty(PbCache.oldActualFirstNo))
                     {
-
                         string sPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "imgShort\\";
                         string picPath = Path.Combine(sPath, "formalImg");
                         ArrayList UnZipedFiles = GetFiles(picPath, ".jpg");//tmp!
@@ -90,51 +89,46 @@ namespace MeterPlugInLibrary
 
         private void ZipFiles(ArrayList UnzipedFiles)
         {
-            ImageZip iz = new ImageZip();
-
+            //ImageZip iz = new ImageZip();
+            string oldTempImgId = PbCache.oldTempImgId, oldActualFirstNo = PbCache.oldActualFirstNo;
             if (UnzipedFiles == null || UnzipedFiles.Count == 0) return;
             foreach (string fn in UnzipedFiles)
             {
                 if (string.IsNullOrEmpty(fn)) continue;
                 if (!File.Exists(fn)) continue;
                 //如果带tempImg则说明没有压缩过,需要压缩
+                int i = fn.Length;
                 if (fn.Contains("tempImg"))
                 {
                     //临时目录图片压缩后存储与正式目录
-                    string jpgFile = fn.Replace("tempImg", "").Replace(PbCache.oldTempImgId, PbCache.oldActualFirstNo);
+                    string jpgFile = fn.Replace("_tempImg", "").Replace(oldTempImgId, oldActualFirstNo);
 
                     Image img = ImageZip.BytesToBitmap(ImageZip.ZipImageByte(fn));
-                    if (img.Width > AppConfigCache.imgWidth && img.Height > AppConfigCache.imgHeight)
+                    if (fn.Contains("_2.jpg")) //fn.Contains("_1.jpg") || 
                     {
-                        if (img != null)
-                        {
-                            iz.ResourceImage = img;
-                            //压缩图片并保存
-                            iz.GetReducedImage(AppConfigCache.imgWidth, AppConfigCache.imgHeight).Save(jpgFile);
-
-                            img.Save(jpgFile);
-                            File.Delete(fn);//删除临时目录数据
-                        }
+                        ImageZip.CompressionImage(img, jpgFile, AppConfigCache.imgMass > 100 ? 100 : AppConfigCache.imgMass);
                     }
                     else
                     {
-                        //这个是仪表的那个图
-                        // 将原图片重命名为正式图片名称
-                        if (File.Exists(fn) && fn.Contains(PbCache.oldTempImgId))
-                        {
-                            File.Move(fn, jpgFile);
-                        }
+                        ImageZip.CompressionImage(img, jpgFile, AppConfigCache.imgMass2 > 100 ? 100 : AppConfigCache.imgMass2);
                     }
+                    File.Delete(fn);//删除临时目录数据
                 }
-                else if(!fn.Contains(PbCache.oldTempImgId) && !fn.Contains(PbCache.oldActualFirstNo))
+                else if (!fn.Contains(oldTempImgId) && !fn.Contains(oldActualFirstNo))
                 {
-                    string path= AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "imgShort\\bakImg";
-                    if (!Directory.Exists(path))//如果不存在就创建file文件夹
+                    string[] lastName = fn.Split('\\');
+                    if (lastName[lastName.Length-1].Length > 34) 
                     {
-                        Directory.CreateDirectory(path);
+                        string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "imgShort\\bakImg";
+                        if (!Directory.Exists(path))//如果不存在就创建file文件夹
+                        {
+                            Directory.CreateDirectory(path);
+                        }
+                        //要是正常,则以后这里直接File.Delete(fn);
+                        File.Move(fn, fn.Replace("formalImg", "bakImg"));
                     }
-                    //要是正常,则以后这里直接File.Delete(fn);
-                    File.Move(fn, fn.Replace("formalImg", "bakImg"));
+
+                    
                 }
             }
         }

+ 54 - 0
MeterPlugInLibrary/图片处理/ImageZip.cs

@@ -3,6 +3,7 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using System;
 using System.Diagnostics;
+using System.Linq;
 
 namespace MeterPlugInLibrary
 {
@@ -310,7 +311,60 @@ namespace MeterPlugInLibrary
                 Debug.Print(ex.Message);
                 return null;
             }
+        }
+
+
+
+
+
+
+
+
+        #region 按比例压缩
+        /// <summary>
+        /// 图片压缩
+        /// </summary>
+        /// <param name="imagePath">图片文件路径</param>
+        /// <param name="targetFolder">保存位置</param>
+        /// <param name="quality">压缩质量</param>
+        /// <param name="fileSuffix">压缩后的文件名后缀(防止直接覆盖原文件)</param>
+        public static void CompressionImage(Image img, string targetFolder, long quality = 100, string fileSuffix = "compress")
+        {
+            var fileFullName = targetFolder;
+
+            var imageByte = CompressionImage(img, quality);
+            var ms = new MemoryStream(imageByte);
+            var image = Image.FromStream(ms);
+            image.Save(fileFullName);
+            ms.Close();
+            ms.Dispose();
+            image.Dispose();
+        }
 
+        private static byte[] CompressionImage(Image img, long quality)
+        {
+            using (var bitmap = new Bitmap(img))
+            {
+                var codecInfo = GetEncoder(img.RawFormat);
+                var myEncoder = System.Drawing.Imaging.Encoder.Quality;
+                var myEncoderParameters = new EncoderParameters(1);
+                var myEncoderParameter = new EncoderParameter(myEncoder, quality);
+                myEncoderParameters.Param[0] = myEncoderParameter;
+                using (var ms = new MemoryStream())
+                {
+                    bitmap.Save(ms, codecInfo, myEncoderParameters);
+                    myEncoderParameters.Dispose();
+                    myEncoderParameter.Dispose();
+                    return ms.ToArray();
+                }
+            }
+        }
+
+        private static ImageCodecInfo GetEncoder(ImageFormat format)
+        {
+            var codecs = ImageCodecInfo.GetImageDecoders();
+            return codecs.FirstOrDefault(codec => codec.FormatID == format.Guid);
         }
+        #endregion
     }
 }

+ 2 - 3
MeterPlugInLibrary/海康摄像头截图/DhCameraShot.cs

@@ -12,15 +12,14 @@ namespace MeterPlugInLibrary
     /// </summary>
     public class DhCameraShot
     {
+        private HkDvr _dvr;
         public DhCameraShot()
         {
             _dvr = new HkDvr();
         }
 
-        private HkDvr _dvr;
+        
         bool ret = false;
-
-
         public string ip { get; set; }
         public string port { get; set; }
         public string uid { get; set; }

Some files were not shown because too many files changed in this diff