Browse Source

winfrom提交

duyong 3 years ago
parent
commit
c485637e48

+ 5 - 5
CarMeterSystem/App.config

@@ -5,13 +5,13 @@
 	</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://10.104.4.105:9004/v1" />
     <!--<add key="ServiceUrl" value="http://192.168.216.143:9004/v1" />-->
     <!--<add key="ServiceUrl" value="http://192.168.137.136: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://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"/>-->
     <!--实时库地址-->
@@ -32,7 +32,7 @@
 		<!--毛皮差值验证(单位kg)-->
 		<add key="differenceWgt" value="400" />
 		<!--进入测试界面还是正式界面 0测试,1正式,2一码到底测试,3判稳测试工具-->
-		<add key="productType" value="1" />
+		<add key="productType" value="0" />
 		<!--联达比较重量-->
 		<add key="lianDaWgt" value="200" />
 		<!--联达计量点编号-->
@@ -57,9 +57,9 @@
   
 		<!--扫码枪参数-->
 		<!--工控机下秤二维码-->
-    <add key="comPara" value="" />
+    <add key="comPara" value="COM11,9600,None,8,1" />
 		<!--司机窗口不下秤二维码-->
-    <add key="comPara2" value="COM3,9600,None,8,1" />
+    <add key="comPara2" value="COM3,115200,None,8,1" />
 	</appSettings>
 	<system.web>
 		<membership defaultProvider="ClientAuthenticationMembershipProvider">

+ 8 - 2
CarMeterSystem/Form1.cs

@@ -347,7 +347,6 @@ namespace CarMeterSystem
                 if (!string.IsNullOrEmpty(sweepCodeClass2.StrCode))
                 {
                     Console.WriteLine("code:"+sweepCodeClass2.StrCode);
-
                 }
 
                 // 司机扫码为空,取工控机二维码
@@ -1296,7 +1295,14 @@ namespace CarMeterSystem
                             mwm.amplifierState = lv.Value.ToString();
                             break;
                         case "LampState":
-                            mwm.lampState = lv.Value.ToString();
+                            if (lv.Value.ToString() == "2")
+                            {
+                                mwm.lampState = "0";
+                            }
+                            else
+                            {
+                                mwm.lampState = lv.Value.ToString();
+                            }
                             break;
                         case "InfraredLeft":
                             if (lv.Value.ToString() == "2")

+ 23 - 0
CarMeterSystem/OptionCls/CameraShotCls.cs

@@ -2,6 +2,7 @@
 using MeterPlugInLibrary;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -55,11 +56,33 @@ namespace CarMeterSystem.OptionCls
         /// <param name="actualFirstNo"></param>
         public void CapPicFromVideo(string actualFirstNo)
         {
+            string fullfilename = Path.Combine(AppConfigCache.ftpPath, DateTime.Now.ToString("yyyy-MM-dd"));
+            if (fullfilename.Substring(0, 8) == "https://")
+            {
+                fullfilename = fullfilename.Substring(0, 8) + fullfilename.Substring(8).Replace("//", "/").Replace("//", "/");
+            }
+            else if (fullfilename.Substring(0, 7) == "http://")
+            {
+                fullfilename = fullfilename.Substring(0, 7) + fullfilename.Substring(7).Replace("//", "/").Replace("//", "/");
+            }
+            else
+            {
+                fullfilename = fullfilename.Replace("//", "/").Replace("//", "/");
+            }
+
+            fullfilename = fullfilename.Replace("upload", "download");
+
             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.CapPicFromVedio(PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo));
+                PbCache.listImage[0].imageFile1 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "1.jpg";
+                PbCache.listImage[0].imageFile2 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "2.jpg";
+                PbCache.listImage[0].imageFile3 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "3.jpg";
+                PbCache.listImage[0].imageFile4 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "4.jpg";
+                PbCache.listImage[0].imageFile5 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "5.jpg";
+                PbCache.listImage[0].imageFile6 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "6.jpg";
             }
 
         }

+ 9 - 2
CarMeterSystem/frmMain.cs

@@ -1069,8 +1069,15 @@ namespace CarMeterSystem
                         case "AmplifierState":
                             mwmdoLive.amplifierState = lv.Value.ToString();
                             break;
-                        case "LampState":
-                            mwmdoLive.lampState = lv.Value.ToString();
+                        case "Lamp":
+                            if (lv.Value.ToString() == "2")
+                            {
+                                mwmdoLive.lampState = "0";
+                            }
+                            else
+                            {
+                                mwmdoLive.lampState = lv.Value.ToString();
+                            }
                             break;
                         case "InfraredLeft":
                             if (lv.Value.ToString() == "2")

+ 54 - 6
CarMeterSystem/frmOneYardToEnd.cs

@@ -10,6 +10,7 @@ using System.Collections.Generic;
 using System.Configuration;
 using System.Data;
 using System.Drawing;
+using System.IO;
 using System.Linq;
 using System.Threading;
 using System.Windows.Forms;
@@ -177,6 +178,7 @@ namespace CarMeterSystem
                 PreTrackScale preTrack = ucCarMeterInfoJisco1._preTrack;
                 string strMsg = "";
 
+
                 #region 间隔时间太短
                 vti.ValidMethod(new PreTrackScale(), "2", null);
                 if (!PbCache.monitorResult.valid_time_interval)
@@ -386,6 +388,14 @@ namespace CarMeterSystem
                     //    PbCache.isLockFrm = false;
                     //    btnSave.Enabled = true;
                     //}
+
+                    //判断储存图片list是否为空,为空则保存图片
+                    if (PbCache.listImage.Count == 0)
+                    {
+                        _ = BeginInvoke(new Action(() => { shotImage(); }));
+                    }
+
+
                     isStop = true;
                     #region 酒钢业务流程判断
                     if (isCompare)
@@ -734,9 +744,6 @@ namespace CarMeterSystem
                     //    }
                     //}
 
-                    //图片截取
-                    // BourneCao暂时注释
-                    _ = BeginInvoke(new Action(() => { shotImage(); }));
 
                     //语音提醒部分
                     //flag =true表示称重成功
@@ -855,6 +862,14 @@ namespace CarMeterSystem
                 lg.WriteLog(3, PbCache.lockCarNo + "计量完成,但重量信息提示失败:" + PbCache.actualFirstNo + ex.Message); ;
             }
         }
+        /// <summary>
+        /// 图片名称修改
+        /// </summary>
+        //public void updateImage()
+        //{
+        //    //string.Format("{0}imgShort\\formalImg\\{1}_{2}_{3}.jpg",AppDomain.CurrentDomain.SetupInformation.ApplicationBase,PbCache.sportInfo.baseSpotNo, "C" + PbCache.actualFirstNo, 7)
+        //    File.Move();
+        //}
 
         /// <summary>
         /// 终端截图
@@ -864,6 +879,23 @@ namespace CarMeterSystem
             {
                 #region 截取图片信息
 
+                string fullfilename = Path.Combine(AppConfigCache.ftpPath, DateTime.Now.ToString("yyyy-MM-dd"));
+                if (fullfilename.Substring(0, 8) == "https://")
+                {
+                    fullfilename = fullfilename.Substring(0, 8) + fullfilename.Substring(8).Replace("//", "/").Replace("//", "/");
+                }
+                else if (fullfilename.Substring(0, 7) == "http://")
+                {
+                    fullfilename = fullfilename.Substring(0, 7) + fullfilename.Substring(7).Replace("//", "/").Replace("//", "/");
+                }
+                else
+                {
+                    fullfilename = fullfilename.Replace("//", "/").Replace("//", "/");
+                }
+
+                fullfilename = fullfilename.Replace("upload", "download");
+
+                string actualFirstNo = DateTime.Now.ToString("yyyyMMddHHmmssffff");//替换PbCache.actualFirstNo
                 //截取屏幕信息
 
                 Point screenPoint = this.PointToScreen(new Point());
@@ -871,15 +903,22 @@ namespace CarMeterSystem
                 Image img = new Bitmap(rect.Width, rect.Height);
                 Graphics g = Graphics.FromImage(img);
                 g.CopyFromScreen(rect.X - 1, rect.Y - 1, 0, 0, rect.Size);//"D://file/1.jpg"
+                //img.Save(string.Format("{0}imgShort\\formalImg\\{1}_{2}_{3}.jpg",
+                //    AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
+                //    PbCache.sportInfo.baseSpotNo, "C" + PbCache.actualFirstNo, 7), System.Drawing.Imaging.ImageFormat.Jpeg);
                 img.Save(string.Format("{0}imgShort\\formalImg\\{1}_{2}_{3}.jpg",
                     AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
-                    PbCache.sportInfo.baseSpotNo, "C" + PbCache.actualFirstNo, 7), System.Drawing.Imaging.ImageFormat.Jpeg);
+                    PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, 7), System.Drawing.Imaging.ImageFormat.Jpeg);
                 //(PbCache.videoChild.Count + 1)), System.Drawing.Imaging.ImageFormat.Jpeg);
-
+                MeterWorkImage meterWorkImage = new MeterWorkImage();
+                meterWorkImage.imageFile7 = string.Format("{0}{1}_{2}_{3}.jpg",
+                    fullfilename + "/",
+                    PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, 7);
+                PbCache.listImage.Add(meterWorkImage);
                 //*
                 //最后进行截图操作
                 CameraShotCls cameraShot = new CameraShotCls();
-                cameraShot.CapMethod(PbCache.actualFirstNo);
+                cameraShot.CapMethod(actualFirstNo);
                 //*/
 
                 #endregion 截取图片信息
@@ -2373,6 +2412,12 @@ namespace CarMeterSystem
                 ucWeightCarTJXJG1.setWeightType(" ");
                 ucCarMeterInfoJisco1.setFormControlValue(new MeterWorkCarActualFirst() { });
 
+                //重置保存返回的一次编号
+                PbCache.actualFirstNo = "";
+
+                //清楚临时储存的listImage
+                PbCache.listImage.Clear();
+
                 // 重置PbCache变量
                 PbCache.isLockFrm = false;  // 清除页面锁定
                 PbCache.lockCarNo = "";
@@ -2516,6 +2561,9 @@ namespace CarMeterSystem
                 case 25:
                     voiceContent = "称重数据保存失败";//计量成功,存在多条未结净一次数据,请联系计量大厅
                     break;
+                case 26:
+                    voiceContent = "皮重选择成毛重";//计量成功,存在多条未结净一次数据,请联系计量大厅
+                    break;
                 default:
                     voiceContent = "程序处理异常";
                     break;

+ 10 - 0
Common/cacheCls/PbCache.cs

@@ -51,6 +51,11 @@ namespace Common
         /// </summary>
         public static bool isTest { get; set; }
 
+        /// <summary>
+        /// 是否通过皮重
+        /// </summary>
+        public static bool isTareWgt { get; set; }
+
         /// <summary>
         /// 是否打开手动选择毛皮
         /// </summary>
@@ -138,6 +143,11 @@ namespace Common
         /// </summary>
         public static string strQRCode { get; set; }
 
+        /// <summary>
+        /// 存储图片对象
+        /// </summary>
+        public static List<MeterWorkImage> listImage = new List<MeterWorkImage>();
+
         /// <summary>
         /// 提示信息,用于写入到界面的ListBox中
         /// </summary>

+ 9 - 2
MeterPlugInLibrary/图片处理/ImageCurlControl.cs

@@ -136,7 +136,6 @@ namespace MeterPlugInLibrary
                     //filename :  计量作业编号_序号.jpg   计量作业编号:计量点编号+年月日时分秒
                     MeterWorkImage ci = ParseFileName(filename, ftpdir.Replace("upload", "download"));
 
-
                     if (ci == null) continue;
 
                     // 上传文件
@@ -252,7 +251,15 @@ namespace MeterPlugInLibrary
             }
 
             //ci.image_time = DateTime.ParseExact(segs[0].Substring(segs[0].Length - 14, 14), "yyyyMMddHHmmss", CultureInfo.CurrentCulture);
-            ci.actualFirstNo = segs[1];
+            if (!string.IsNullOrEmpty(PbCache.actualFirstNo))
+            {
+                PbCache.listImage[0].actualFirstNo = "C" + PbCache.actualFirstNo;
+                ci = PbCache.listImage[0];
+            }
+            else
+            {
+                return null;
+            }
             return ci;
         }
 

+ 8 - 0
MeterSceneLibrary/JISCO/InnerCarJISCO.cs

@@ -677,6 +677,14 @@ namespace MeterSceneLibrary
                                 // 重量类型为皮重
                                 if (list[0].weightTypeNo == "001033002")
                                 {
+                                    if (PbCache.lockWgt > 25)
+                                    {
+                                        rt = saveMethod.doError(string.Format("当前重量:{0},请确认是否为皮重", PbCache.lockWgt));
+                                        PbCache.voiceType = 26;
+                                        PbCache.LEDResultMessage = string.Format("当前重量:{0},请确认是否为皮重", PbCache.lockWgt);
+                                        return rt;
+                                    }
+
                                     // 历史皮重验证
                                     rt = saveMethod.validHisTare(list[0].weightTypeNo);
                                     if (firstList == null || firstList.Count == 0)