Browse Source

提交代码

yi eason 3 years ago
parent
commit
f46186281f

+ 6 - 0
RailLocalMeter/OptionCls/DbUpload.cs

@@ -57,6 +57,7 @@ namespace RailLocalMeter
                             List<MeterWorkRailwayActFirst> lm = FileOption.ReadDb<MeterWorkRailwayActFirst>(FileTypeEnum.一次数据, ref bReadFlag, ref strRtMsgInfo);
                             if (bReadFlag)
                             {
+                                CacleCls.isUploadFirstOver = false;
                                 //进行数据上传操作
                                 RESTfulResult<List<DjPbModel>> rmRst = firstService.doDbUpload(lm);
                                 if (rmRst.Succeed)
@@ -96,6 +97,8 @@ namespace RailLocalMeter
                                     }
 
                                     if (dic.Count > 0) imgControl.ZipFiles(dic);
+
+                                    CacleCls.isUploadFirstOver = true;
                                 }
                                 else
                                 {
@@ -116,6 +119,7 @@ namespace RailLocalMeter
                             List<MeterWorkRailwayActual> lmNet = FileOption.ReadDb<MeterWorkRailwayActual>(FileTypeEnum.结净数据, ref bReadFlag, ref strRtMsgInfo);
                             if (bReadFlag)
                             {
+                                CacleCls.isUploadNetOver = false;
                                 //进行数据上传操作
                                 RESTfulResult<List<DjPbModel>> rmRst = netService.doDbUpload(lmNet);
                                 if (rmRst.Succeed)
@@ -155,6 +159,8 @@ namespace RailLocalMeter
                                     }
 
                                     if (dic.Count > 0) imgControl.ZipFiles(dic);
+
+                                    CacleCls.isUploadNetOver = true;
                                 }
                                 else
                                 {

+ 1 - 2
RailLocalMeter/OptionCls/RfidRailWayNo.cs

@@ -118,8 +118,7 @@ namespace RailLocalMeter
                                     strOldNo = strInfo.Substring(0, 20);
                                     if (CacleCls.rfidCarNo != strOldNo)
                                     {
-                                        CacleCls.rfidCarNo = strInfo.Substring(0,20);
-                                        strOldNo = CacleCls.rfidCarNo;
+                                        CacleCls.rfidCarNo = strOldNo;
                                         lg.WriteLog(LogType.RfidLoc, $"提供给界面的读卡器数据:{strInfo.Substring(0, 20)}");
                                         if (strInfo.Length > 20)
                                             strInfo = strInfo.Substring(20);

+ 2 - 0
RailLocalMeter/PbCls/CacleCls.cs

@@ -150,6 +150,8 @@ namespace RailLocalMeter
         public static DateTime? updateRfidInfoTime = null;
         public static Dictionary<string, string> rifdInfo = new Dictionary<string, string>();
 
+        public static bool isUploadFirstOver = false;
+        public static bool isUploadNetOver = false;
 
         /// <summary>
         /// 重量小于500时执行一次

+ 0 - 7
RailLocalMeter/Program.cs

@@ -14,13 +14,6 @@ namespace RailLocalMeter
         [STAThread]
         static void Main()
         {
-            byte[] bt = new byte[10];
-            bt[0] = 31;
-            bt[1] = 32;
-            bt[2] = 20;
-            string strtmp = System.Text.Encoding.UTF8.GetString(bt)?.Trim();
-
-
             bool createNew;
             using (System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out createNew))
             {

+ 6 - 8
RailLocalMeter/frmMain.Designer.cs

@@ -2072,7 +2072,6 @@ namespace RailLocalMeter
             this.cbSetFirst.TabIndex = 14;
             this.cbSetFirst.Text = "设为一次计量";
             this.cbSetFirst.UseVisualStyleBackColor = true;
-            this.cbSetFirst.CheckedChanged += new System.EventHandler(this.cbSetFirst_CheckedChanged);
             // 
             // cbJg
             // 
@@ -2548,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, 89F));
+            this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 99F));
             this.tableLayoutPanel7.Controls.Add(this.lbPointName, 1, 0);
             this.tableLayoutPanel7.Controls.Add(this.txtCarNo, 3, 0);
             this.tableLayoutPanel7.Controls.Add(this.lbPntName, 0, 0);
@@ -2574,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(493, 36);
+            this.lbPointName.Size = new System.Drawing.Size(483, 36);
             this.lbPointName.TabIndex = 3;
             this.lbPointName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
@@ -2582,12 +2581,11 @@ 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(648, 3);
+            this.txtCarNo.Location = new System.Drawing.Point(638, 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);
             this.txtCarNo.TabIndex = 0;
-            this.txtCarNo.TextChanged += new System.EventHandler(this.txtCarNo_TextChanged);
             this.txtCarNo.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCarNo_KeyDown);
             // 
             // lbPntName
@@ -2612,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(588, 1);
+            this.label2.Location = new System.Drawing.Point(578, 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);
@@ -2627,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(800, 1);
+            this.label1.Location = new System.Drawing.Point(790, 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);
@@ -2638,7 +2636,7 @@ namespace RailLocalMeter
             // pbLineOn
             // 
             this.pbLineOn.Image = ((System.Drawing.Image)(resources.GetObject("pbLineOn.Image")));
-            this.pbLineOn.Location = new System.Drawing.Point(860, 4);
+            this.pbLineOn.Location = new System.Drawing.Point(850, 4);
             this.pbLineOn.Name = "pbLineOn";
             this.pbLineOn.Size = new System.Drawing.Size(39, 30);
             this.pbLineOn.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

+ 60 - 40
RailLocalMeter/frmMain.cs

@@ -162,6 +162,7 @@ namespace RailLocalMeter
             List<string> lcs = strAll.Distinct().OrderBy(s => s).ToList(); //
 
             lc.Add(AppConfigCache.channelCarNo);
+            lc.Add(AppConfigCache.channel);
             foreach (string str in lcs)
             {
                 if ($"{AppConfigCache.channel}" != str && $"{AppConfigCache.channelCarNo}" != str)
@@ -272,10 +273,13 @@ namespace RailLocalMeter
             {
                 try
                 {
+                    //******************待提交、待结净的数据界面没有显示 已上传数据界面没有清空   数据插入到库重复*****************
                     this.plMain.Invoke(new Action(() => {
-                        ucWeightT1.setWgt(Math.Round((double)CacleCls.weight / 1000, 2)); //2021年5月10日界面显示单位,调整为T
+                        ucWeightT1.setWgt(Math.Round((double)CacleCls.weight / 1000, 2)); 
                         ucWeightT1.setStable(CacleCls.isWd != 1 ? true : false);
                         ucWeightT1.setExceed(CacleCls.weight > AppConfigCache.maxRange * 1000 ? false : true);
+                        picQRed.Load($"{AppConfigCache.path}\\image\\icon\\{(CacleCls.topJg=="1"?"red": "green")}.gif");
+                        picHRed.Load($"{AppConfigCache.path}\\image\\icon\\{(CacleCls.bottomJg == "1" ? "red" : "green")}.gif");
 
                         if (CacleCls.isWd == 0)
                         {
@@ -455,6 +459,17 @@ namespace RailLocalMeter
                             lockWgtImg = CacleCls.weight;
                             isVoiceDownCar = false;
 
+                            if (CacleCls.isUploadFirstOver) 
+                            {
+                                CacleCls.isUploadFirstOver = false;
+                                BindTable<MeterWorkRailwayActFirst>(ultraGridLocalFirst, dataTableLocalFirst, "localFirstx");
+                            }
+                            if (CacleCls.isUploadNetOver)
+                            { 
+                                CacleCls.isUploadNetOver = false;
+                                BindTable<MeterWorkRailwayActual>(ultraGridLocalNet, dataTableLocalNet, "localNetx");
+                            }
+
                             if (!CacleCls.isClear)
                             {
                                 BindTable<MeterWorkRailwayActFirst>(ultraGridFirst, dataTableFirst, "firstx");
@@ -678,7 +693,7 @@ namespace RailLocalMeter
                 txtMsgInfo.Text = "称重保存中......";
 
                 CacleCls.isLock = true;
-                txtCarNo.Enabled = false;
+                //txtCarNo.Enabled = false;
 
                 string strGuid = Guid.NewGuid().ToString();
 
@@ -699,7 +714,7 @@ namespace RailLocalMeter
                         firstDb.valueFlag = "2";
                         if (string.IsNullOrEmpty(firstDb.railwayNo)) 
                         {
-                            firstDb.railwayNo = "车号未识别";
+                            firstDb.railwayNo = "未识别车号";
                         }
 
                         RESTfulResult<ResponseData> rt = firstService.doIdentifyWeight(firstDb, out msgInfo);
@@ -784,7 +799,7 @@ namespace RailLocalMeter
 
                             if (string.IsNullOrEmpty(firstDb.railwayNo))
                             {
-                                firstDb.railwayNo = "车号未识别";
+                                firstDb.railwayNo = "未识别车号";
                             }
 
                             RESTfulResult<ResponseData> rt = firstService.add(firstDb, out msgInfo);
@@ -872,12 +887,17 @@ namespace RailLocalMeter
                                     CacleCls.preTrackScale.format(firstDb);
                                 }
 
+                                if (string.IsNullOrEmpty(firstDb.railwayNo))
+                                {
+                                    firstDb.railwayNo = "未识别车号";
+                                }
                                 RESTfulResult<ResponseData> rt = firstService.add(firstDb, out msgInfo);
                                 if (rt.Succeed)
                                 {
                                     //保存成功
                                     isMeasureSuccess = true;
-                                    CaptionImg(rt.Data.firsts[0].actualFirstNo);
+                                    lg.WriteLog(LogType.serverLog, "准备截图");
+                                    CaptionImg(rt.Data?.firsts[0]?.actualFirstNo);
                                 }
                                 else
                                 {
@@ -946,7 +966,7 @@ namespace RailLocalMeter
                     txtMsgInfo.Focus();
 
 
-                    BindTable<PreRailwayScale>(ultraGridWaitFirst, dataTableWaitFirst, "firstWait");
+                    BindTable<MeterWorkRailwayActFirst>(ultraGridWaitFirst, dataTableWaitFirst, "firstWait");
                     BindTable<MeterWorkRailwayActual>(ultraGridWaitNet, dataTableWaitNet, "netWait");
                     BindTable<MeterWorkRailwayActFirst>(ultraGridLocalFirst, dataTableLocalFirst, "localFirst");
                     BindTable<MeterWorkRailwayActual>(ultraGridLocalNet, dataTableLocalNet, "localNet");
@@ -961,40 +981,49 @@ namespace RailLocalMeter
             finally
             {
                 CacleCls.isLock = false;
-                txtCarNo.Enabled = true;
+                //txtCarNo.Enabled = true;
             }
         }
 
-
         private void CaptionImg(string actNo) 
         {
-            #region 截图
-            //屏幕截图操作
-            //_ = BeginInvoke(new Action(() => { shotImageScreen(actNo); }));
-
-            for (int i = 0; i < lc.Count(); i++)
+            if (!string.IsNullOrEmpty(actNo))
             {
-                //从_2开始,因为_1是仪表图片  2是车号快照抓拍
-                ce.CapPic((uint)lc[i], $"{AppConfigCache.path}/imgShort/formalImg/{AppConfigCache.pointNo}_R{actNo}{(CacleCls.serverFlag?"":"_tempImg")}_{i + 2}.jpg");
-            }
-
-            foreach (Control cn in panel1.Controls)
-            {
-                if (cn.Name.Substring(cn.Name.Length - 1) == $"{AppConfigCache.channel}")
+                #region 截图
+                //屏幕截图操作
+                try
                 {
-                    if (cn is PictureBox)
+                    for (int i = 0; i < lc.Count(); i++)
                     {
-                        Bitmap bit = new Bitmap(cn.Width, cn.Height);//实例化一个和窗体一样大的bitmap
-                        Graphics g = Graphics.FromImage(bit);
-                        g.CompositingQuality = CompositingQuality.HighQuality;//质量设为最高 HighQuality
-                        g.CopyFromScreen(panel1.Left, panel1.Top + 25, 0, 0, new Size(cn.Width, cn.Height));//保存整个窗体为图片       
-                        bit.Save($"{AppConfigCache.path}/imgShort/formalImg/{AppConfigCache.pointNo}_R{actNo}{(CacleCls.serverFlag ? "" : "_tempImg")}_1.jpg");//默认保存格式为PNG,保存成jpg格式质量不是很好
-                        bit.Dispose();
-                        break;
+                        //从_2开始,因为_1是仪表图片  2是车号快照抓拍   这后面的 i+2改为了i+1
+                        ce.CapPic((uint)lc[i], $"{AppConfigCache.path}/imgShort/formalImg/{AppConfigCache.pointNo}_R{actNo}{(CacleCls.serverFlag ? "" : "_tempImg")}_{i + 1}.jpg");
                     }
+
+                    /*
+                    foreach (Control cn in panel1.Controls)
+                    {
+                        if (cn.Name.Substring(cn.Name.Length - 1) == $"{AppConfigCache.channel}")
+                        {
+                            if (cn is PictureBox)
+                            {
+                                Bitmap bit = new Bitmap(cn.Width, cn.Height);//实例化一个和窗体一样大的bitmap
+                                Graphics g = Graphics.FromImage(bit);
+                                g.CompositingQuality = CompositingQuality.HighQuality;//质量设为最高 HighQuality
+                                g.CopyFromScreen(panel1.Left, panel1.Top + 25, 0, 0, new Size(cn.Width, cn.Height));//保存整个窗体为图片       
+                                bit.Save($"{AppConfigCache.path}/imgShort/formalImg/{AppConfigCache.pointNo}_R{actNo}{(CacleCls.serverFlag ? "" : "_tempImg")}_1.jpg");//默认保存格式为PNG,保存成jpg格式质量不是很好
+                                bit.Dispose();
+                                break;
+                            }
+                        }
+                    }
+                    //*/
+                }
+                catch (Exception ex)
+                {
+                    lg.WriteLog(LogType.SystemLog, "截图失败:" + ex.Message);
                 }
+                #endregion
             }
-            #endregion
         }
 
 
@@ -1091,7 +1120,6 @@ namespace RailLocalMeter
                         if (rmWaitFirstList.Succeed)
                         {
                             lm = rmWaitFirstList.Data as List<T>;
-                            flagQP = true;
                         }
                         else
                         {
@@ -1106,7 +1134,6 @@ namespace RailLocalMeter
                         if (rmWaitNetList.Succeed)
                         {
                             lm = rmWaitNetList.Data as List<T>;
-                            flagQP = true;
                         }
                         else
                         {
@@ -1259,6 +1286,7 @@ namespace RailLocalMeter
                         MessageBox.Show("操作失败:" + msgInfo);
                         lg.WriteLog(LogType.serverLog, "操作失败:" + msgInfo);
                     }
+                    BindTable<MeterWorkRailwayActFirst>(ultraGridWaitFirst, dataTableWaitFirst, "firstWait");
                 }
             }
         }
@@ -1294,6 +1322,7 @@ namespace RailLocalMeter
                         MessageBox.Show("操作失败:" + msgInfo);
                         lg.WriteLog(LogType.serverLog, "操作失败:" + msgInfo);
                     }
+                    BindTable<MeterWorkRailwayActual>(ultraGridWaitNet, dataTableWaitNet, "netWait");
                 }
             }
 
@@ -1347,10 +1376,6 @@ namespace RailLocalMeter
         [DllImport("kernel32.dll")]
         private static extern bool SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize);
 
-        private void cbSetFirst_CheckedChanged(object sender, EventArgs e)
-        {
-
-        }
 
         //刷新存储器
         private static void FlushMemory()
@@ -1362,11 +1387,6 @@ namespace RailLocalMeter
                 SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
             }
         }
-
-        private void txtCarNo_TextChanged(object sender, EventArgs e)
-        {
-
-        }
         #endregion
 
         #region