Selaa lähdekoodia

增加硬盘录像机语音播报

yi eason 3 vuotta sitten
vanhempi
commit
e467aab632

+ 9 - 0
CarMeterSystem/frmOneYardToEnd.cs

@@ -1712,6 +1712,15 @@ namespace CarMeterSystem
                             }
                         }
 
+                        #region eason add 2023-04-26 后期没什么问题可以去掉
+                        lg.WriteLog(10, "车号:" + PbCache.collect.carno + ";对射没对准【" + PbCache.monitorResult.valid_park_status + "】" +
+                                "||重量不是绿色【" + ucWeightT1.isGreenWgt + "】" +
+                                "||重量不稳定 0:重量稳定; 1:重量不稳定;  2:空磅weightStatus:【" + PbCache.collect.weightStatus + "】&& localWeightStatus:【" + localWeightStatus + "】" +
+                                "||不是智能计量状态【" + PbCache.monitor.isTakeOver + "】" +
+                                "||扫码编号为空隐藏【" + firstCode + "】" +
+                                "||一次计量数据已经查询完成【" + bRailwayActual + "】" +
+                                "||界面已锁定【" + PbCache.isLockFrm + "】,保存按钮隐藏!");
+                        #endregion
                     }
                     else
                     {

+ 0 - 120
MeterSceneLibrary/JISCO/private/SaveMethod.cs

@@ -457,67 +457,6 @@ namespace MeterSceneLibrary.JISCO
             return rt;
         }
 
-        /// <summary>
-        /// 产生一次计量数据,同时结净并匹配委托
-        /// </summary>
-        /// <param name="scale"></param>
-        /// <param name="actualFirst"></param>
-        public rtInfo doNetAndScale(PreTrackScale scale, MeterWorkCarActualFirst actualFirst, MeterWorkCarActualFirst actualFirst2)
-        {
-            // 构造结净数据
-            MeterWorkCarActual netDb = new MeterWorkCarActual();
-
-            // 复制对象
-            if (scale != null)
-            {
-                EntityBase<PreTrackScale> entityBase = new EntityBase<PreTrackScale>();
-                netDb = entityBase.format<MeterWorkCarActual>(scale, netDb);
-            }
-
-            netDb.tareTime = DateTime.Now;
-            netDb.tareWeight = actualFirst.meterWeight.Value < PbCache.lockWgt ? actualFirst.meterWeight.Value : PbCache.lockWgt; // 谁小谁是皮 BourneCao
-            netDb.baseSpot2No = PbCache.sportInfo.baseSpotNo;
-            netDb.baseSpot2Name = PbCache.sportInfo.baseSpotName;
-            netDb.tareMode = "2";//1:远程计量;2:智能计量;3:手工录入;4:放行智能计量;5:滞后匹配
-            /* netDb.tare_man_no = "";
-             netDb.tare_man_name = "";
-             netDb.tare_class = "";
-             netDb.tare_group = "";*/
-
-            netDb.actualFirst1No = actualFirst.actualFirstNo;
-            netDb.actualFirst2No = actualFirst.actualFirstNo;
-            netDb.grossTime = actualFirst.createTime;
-            netDb.grossWeight = actualFirst.meterWeight.Value > PbCache.lockWgt ? actualFirst.meterWeight.Value : PbCache.lockWgt; // 谁大谁是毛 BourneCao
-            netDb.baseSpot1No = actualFirst.baseSpotNo;
-            netDb.baseSpot1Name = actualFirst.baseSpotName;
-            netDb.grossMode = "2"; // 1:远程计量;2:智能计量;3:手工录入;4:放行智能计量;5:滞后匹配
-            netDb.grossManNo = actualFirst.createManNo;
-            netDb.grossManName = actualFirst.createManName;
-            netDb.grossClass = actualFirst.meterClass;
-            netDb.grossGroup = actualFirst.meterGroup;
-            netDb.valueFlag = "1";
-
-            netDb.netTime = DateTime.Now;
-
-            //netDb.netManNo = appUser.userid; //净重计量员编码 
-            //netDb.netManName = appUser.username; //净重计量员名称
-            netDb.netSpot3No = PbCache.sportInfo.baseSpotNo; //净重计量点编号
-            netDb.netSpot3Name = PbCache.sportInfo.baseSpotName; //净重计量点
-
-            netDb.addWeight = (actualFirst.addWeight == null ? 0 : actualFirst.addWeight.Value);
-            //净重=毛-皮-附加重量
-            netDb.netWeight = netDb.grossWeight - netDb.tareWeight - netDb.addWeight;
-            netDb.netMode = "1"; //1:正常结净;2:匹配结净
-            netDb.valueFlag = "0"; //0=有效,1=作废
-            netDb.uploadFlag = "0"; //0=待审核;1:待上传;2=已上传
-                                    //要判断下当前是否勾选了不验证皮重
-
-
-            // 保存结净记录,后续改成统一提交模式  BourneCao
-
-            return rt;
-        }
-
         /// <summary>
         /// 产生一次计量数据,同时结净并匹配委托(多委托)
         /// </summary>
@@ -708,65 +647,6 @@ namespace MeterSceneLibrary.JISCO
             return rt;
         }
 
-        /// <summary>
-        /// 一车多卸
-        /// a. 取第一条委托正常洁净产生一条净重记录
-        /// b.并自动生成一条一次毛重计量数据并和第二条委托匹配,重量值为当次计量数据中的毛重
-        /// </summary>
-        /// <param name="scale"></param>
-        /// <param name="actualFirst"></param>
-        public rtInfo doNetMass(List<PreTrackScale> scale, MeterWorkCarActualFirst actualFirst, MeterWorkCarActualFirst actualFirst1)
-        {
-            // 构造结净数据
-            MeterWorkCarActual netDb = new MeterWorkCarActual();
-
-            // 复制对象
-            if (scale != null)
-            {
-                EntityBase<PreTrackScale> entityBase = new EntityBase<PreTrackScale>();
-                netDb = entityBase.format<MeterWorkCarActual>(scale[0], netDb);
-            }
-
-            netDb.tareTime = DateTime.Now;
-            netDb.tareWeight = actualFirst.meterWeight.Value < PbCache.lockWgt ? actualFirst.meterWeight.Value : PbCache.lockWgt; // 谁小谁是皮 BourneCao
-            netDb.baseSpot2No = PbCache.sportInfo.baseSpotNo;
-            netDb.baseSpot2Name = PbCache.sportInfo.baseSpotName;
-            netDb.tareMode = "2";//1:远程计量;2:智能计量;3:手工录入;4:放行智能计量;5:滞后匹配
-            /* netDb.tare_man_no = "";
-             netDb.tare_man_name = "";
-             netDb.tare_class = "";
-             netDb.tare_group = "";*/
-
-            netDb.actualFirst1No = actualFirst.actualFirstNo;
-            netDb.grossTime = actualFirst.createTime;
-            netDb.grossWeight = actualFirst.meterWeight.Value > PbCache.lockWgt ? actualFirst.meterWeight.Value : PbCache.lockWgt; // 谁大谁是毛 BourneCao
-            netDb.baseSpot1No = actualFirst.baseSpotNo;
-            netDb.baseSpot1Name = actualFirst.baseSpotName;
-            netDb.grossMode = "2"; // 1:远程计量;2:智能计量;3:手工录入;4:放行智能计量;5:滞后匹配
-            netDb.grossManNo = actualFirst.createManNo;
-            netDb.grossManName = actualFirst.createManName;
-            netDb.grossClass = actualFirst.meterClass;
-            netDb.grossGroup = actualFirst.meterGroup;
-
-            netDb.netTime = DateTime.Now;
-
-            //netDb.netManNo = appUser.userid; //净重计量员编码 
-            //netDb.netManName = appUser.username; //净重计量员名称
-            netDb.netSpot3No = PbCache.sportInfo.baseSpotNo; //净重计量点编号
-            netDb.netSpot3Name = PbCache.sportInfo.baseSpotName; //净重计量点
-
-            netDb.addWeight = (actualFirst.addWeight == null ? 0 : actualFirst.addWeight.Value);
-            //净重=毛-皮-附加重量
-            netDb.netWeight = netDb.grossWeight - netDb.tareWeight - netDb.addWeight;
-            netDb.netMode = "1"; //1:正常结净;2:匹配结净
-            netDb.valueFlag = "0"; //0=有效,1=作废
-            netDb.uploadFlag = "0"; //0=待审核;1:待上传;2=已上传
-                                    //要判断下当前是否勾选了不验证皮重
-
-            // 保存结净记录,后续改成统一提交模式  BourneCao
-
-            return rt;
-        }
 
         public rtInfo validHisTare(string WeightType = "001033001")
         {

+ 50 - 0
RailLocalMeter/OptionCls/Voice/CamerEs.cs

@@ -163,5 +163,55 @@ namespace RailLocalMeter
             }
             return true;
         }
+
+
+        public bool SendVoice(string soundName)
+        {
+            bool ret = false;
+            _dvr.SetVolume(0xffff);
+            bool voiceOpend = false;
+            if (_dvr.VoiceHandle > -1) //播放语音前,需要关闭对讲
+            {
+                _dvr.StopTalk();
+                voiceOpend = true;
+            }
+            bool b = _dvr.OpenSound();
+            string path = AppConfigCache.path + "\\Sound\\" + soundName + ".wav";
+            ret = _dvr.SendVoiceData(path);
+            _dvr.CloseSound();
+            if (voiceOpend)
+            {
+                _dvr.StartTalk();
+            }
+            return ret;
+        }
+
+        public bool SendVoiceWrw(string soundName)
+        {
+
+            bool ret = false;
+            _dvr.SetVolume(0xffff);
+            bool voiceOpend = false;
+            if (_dvr.VoiceHandle > -1) //播放语音前,需要关闭对讲
+            {
+                _dvr.StopTalk();
+                voiceOpend = true;
+
+            }
+            bool b = _dvr.OpenSound();
+            string path = AppConfigCache.path + "\\Sound\\" + soundName + ".wav";
+            for (int i = 0; i < 5; i++)
+            {
+                ret = _dvr.SendVoiceDataWrw(path);
+                if (ret) break;
+            }
+            _dvr.CloseSound();
+            if (voiceOpend)
+            {
+                _dvr.StartTalk();
+            }
+            //LogController.GetInstance().WriteLog(33, $"发送语音\"{soundName}\",结果:{ret}");
+            return ret;
+        }
     }
 }

+ 24 - 6
RailLocalMeter/OptionCls/Voice/HkDvr.cs

@@ -295,13 +295,31 @@ namespace RailLocalMeter
             _user_id = -1;
            return true;
        }
-       #endregion
-   
+        #endregion
+
+        public bool SendVoiceDataWrw(string fileName)
+        {
+            IntPtr pUser = new IntPtr(88);
+
+            if (_voice_handle > -1) StopTalk();
+            //if (_call_back == null) _call_back = new HCNetSDK.VoiceDataCallBack(OnVoiceData);
+            _voice_handle = HCNetSDK.NET_DVR_StartVoiceCom_MR_V30(_user_id, 1, _call_back, pUser);//VIOCE_CHANNEL  //_dev_info.byStartDTalkChan
+            if (_voice_handle < 0)
+            {
+                string error = GetErrorMessage();
+                return false;
+            }
+            if (!File.Exists(fileName)) return false;
+            //_wav_thread = new Thread(new ParameterizedThreadStart(SendWavFile));
+            //_wav_thread.Start(fileName);
+            SendWavFile(fileName);
+            return true;
+        }
 
-       //-----------------------------API-------------------------------
-       #region<DVR 函数>   
-       // 登录DVR系统
-       public bool Login()
+        //-----------------------------API-------------------------------
+        #region<DVR 函数>   
+        // 登录DVR系统
+        public bool Login()
        {
            string error = "";
            uint error_code = 0;

+ 6 - 6
RailLocalMeter/frmMain.Designer.cs

@@ -2547,7 +2547,7 @@ namespace RailLocalMeter
             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, 150F));
             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, 99F));
+            this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
             this.tableLayoutPanel7.Controls.Add(this.lbPointName, 1, 0);
             this.tableLayoutPanel7.Controls.Add(this.txtCarNo, 3, 0);
             this.tableLayoutPanel7.Controls.Add(this.lbPntName, 0, 0);
@@ -2573,7 +2573,7 @@ namespace RailLocalMeter
             this.lbPointName.Location = new System.Drawing.Point(86, 1);
             this.lbPointName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.lbPointName.Name = "lbPointName";
-            this.lbPointName.Size = new System.Drawing.Size(483, 36);
+            this.lbPointName.Size = new System.Drawing.Size(482, 36);
             this.lbPointName.TabIndex = 3;
             this.lbPointName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
@@ -2581,7 +2581,7 @@ namespace RailLocalMeter
             // 
             this.txtCarNo.Enabled = false;
             this.txtCarNo.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.txtCarNo.Location = new System.Drawing.Point(638, 3);
+            this.txtCarNo.Location = new System.Drawing.Point(637, 3);
             this.txtCarNo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.txtCarNo.Name = "txtCarNo";
             this.txtCarNo.Size = new System.Drawing.Size(144, 32);
@@ -2610,7 +2610,7 @@ namespace RailLocalMeter
             this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
             this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label2.ForeColor = System.Drawing.Color.Blue;
-            this.label2.Location = new System.Drawing.Point(578, 1);
+            this.label2.Location = new System.Drawing.Point(577, 1);
             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(52, 36);
@@ -2625,7 +2625,7 @@ namespace RailLocalMeter
             this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label1.ForeColor = System.Drawing.Color.Blue;
-            this.label1.Location = new System.Drawing.Point(790, 1);
+            this.label1.Location = new System.Drawing.Point(789, 1);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(52, 36);
@@ -2636,7 +2636,7 @@ namespace RailLocalMeter
             // pbLineOn
             // 
             this.pbLineOn.Image = ((System.Drawing.Image)(resources.GetObject("pbLineOn.Image")));
-            this.pbLineOn.Location = new System.Drawing.Point(850, 4);
+            this.pbLineOn.Location = new System.Drawing.Point(849, 4);
             this.pbLineOn.Name = "pbLineOn";
             this.pbLineOn.Size = new System.Drawing.Size(39, 30);
             this.pbLineOn.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

+ 9 - 6
RailLocalMeter/frmMain.cs

@@ -402,7 +402,8 @@ namespace RailLocalMeter
                                 if ((AppConfigCache.maxRange * 1000 < CacleCls.weight) || CacleCls.weight.ToString().Substring(CacleCls.weight.ToString().Length - 1, 1) != "0")
                                 {
                                     //超量程
-                                    vicPlayClass.GetVoicePlay(VoiceEnum.车辆超重, CacleCls.lockCarNo);
+                                    ce?.SendVoice("车辆超重");
+                                    //vicPlayClass.GetVoicePlay(VoiceEnum.车辆超重, CacleCls.lockCarNo);
                                     txtMsgInfo.Text = "当前重量已超量程,秤体量程为【" + AppConfigCache.maxRange + "】T";
                                     led_controler?.setStaticLineMsg(AppConfigCache.ledIp, "当前重量已超量程,秤体量程为【" + AppConfigCache.maxRange + "】T");
                                     CacleCls.isLock = false;
@@ -412,7 +413,8 @@ namespace RailLocalMeter
                                 if ((CacleCls.topJg == "1" || CacleCls.bottomJg == "1"))
                                 {
                                     //重量稳定,且对射验证不合格
-                                    vicPlayClass.GetVoicePlay(VoiceEnum.车辆未停到位, CacleCls.lockCarNo);
+                                    ce?.SendVoice("车辆未停到位");
+                                    //vicPlayClass.GetVoicePlay(VoiceEnum.车辆未停到位, CacleCls.lockCarNo);
                                     txtMsgInfo.Text = "车辆超出秤台,请调整车位";
                                     led_controler?.setStaticLineMsg(AppConfigCache.ledIp, "车辆超出秤台,请调整车位");
                                     CacleCls.isLock = false;
@@ -424,7 +426,7 @@ namespace RailLocalMeter
                                 {
                                     txtMsgInfo.Text = "";
                                     isVoiceDownCar = true;
-                                    vicPlayClass.GetVoicePlay(VoiceEnum.开始计量, CacleCls.lockCarNo);//只播放一次
+                                    //vicPlayClass.GetVoicePlay(VoiceEnum.开始计量, CacleCls.lockCarNo);//只播放一次
 
                                     lg.WriteLog(LogType.SystemLog, CacleCls.lockCarNo + "开始保存:" + DateTime.Now.ToLongTimeString());
                                 }
@@ -443,7 +445,8 @@ namespace RailLocalMeter
                                 {
                                     if (CacleCls.voiceOver)
                                     {
-                                        vicPlayClass.GetVoicePlay(VoiceEnum.计量完成, CacleCls.lockCarNo);
+                                        ce?.SendVoice("计量完成");
+                                        //vicPlayClass.GetVoicePlay(VoiceEnum.计量完成, CacleCls.lockCarNo);
                                         voiceNum++;
                                     }
                                 }
@@ -581,8 +584,8 @@ namespace RailLocalMeter
 
                 if (!CacleCls.lockWgt.ToString().EndsWith("0")) //个位不是0则说明超量程了
                 {
-                    //txtMsgInfo.Text = "仪表重量[" + CacleCls.lockWgt + "]不是以0结尾,禁止计量操作!";
-                    vicPlayClass.GetVoicePlay(VoiceEnum.车辆超重, CacleCls.lockCarNo);
+                    ce.SendVoice("车辆超重");
+                    //vicPlayClass.GetVoicePlay(VoiceEnum.车辆超重, CacleCls.lockCarNo);
                     txtMsgInfo.Text = "当前重量已超量程,秤体量程为【" + AppConfigCache.maxRange + "】T";
                     return;
                 }