duyong 4 éve
szülő
commit
30a36234cb

+ 10 - 9
CarMeterSystem/Form1.cs

@@ -175,7 +175,7 @@ namespace CarMeterSystem
                         collection.Start(PbCache.sportInfo.baseSpotNo, PbCache.sportInfo.baseSpotName);
 
                         imageCurlControl.Start(); //图片采集线程
-                        //sweepCodeClass.StartThreadSweep(); //扫码线程
+                        sweepCodeClass.StartThreadSweep(); //扫码线程
                         ////***********************暂时注释掉*****************************************************
                         ////sweepCodeClass.StartThreadSweep();
                         ////**************************************************************************************
@@ -543,15 +543,16 @@ namespace CarMeterSystem
                         //e.RfidNos = "0003";
                         if (!string.IsNullOrEmpty(e.RfidNos))
                         {
-                            if (PbCache.ltCarCard != null && PbCache.ltCarCard.Count > 0)
+                            string sqls = @"SELECT RFID_ID id,CAR_NO text FROM METER_BASE_RFID_INFO where RFID_CODE = '" + e.RfidNos + "'";
+
+                            PbModelDbService<List<PbModelDb>> pbp = new PbModelDbService<List<PbModelDb>>();
+                            RESTfulResult<List<PbModelDb>> rmT = pbp.executeSqlDataWf(sqls);
+                            if (rmT.Data == null || rmT.Data.Count == 0)
+                            {}
+                            else
                             {
-                                MeterBaseCarCard carCard = PbCache.ltCarCard.Where(s => s.cardNo == e.RfidNos).FirstOrDefault();
-                                if (carCard != null)
-                                {
-                                    mwUpdate.rfidCar = carCard.carNo;
-                                    sCarNo = carCard.carNo;
-                                    //PbCache.collect.carno = carCard.carNo;
-                                }
+                                mwUpdate.rfidCar = rmT.Data[0].text;
+                                sCarNo = rmT.Data[0].text;
                             }
                         }
 

+ 9 - 9
CarMeterSystem/frmMain.cs

@@ -580,16 +580,16 @@ namespace CarMeterSystem
 
                         if (!string.IsNullOrEmpty(e.RfidNos))
                         {
-                            if (PbCache.ltCarCard != null && PbCache.ltCarCard.Count > 0)
+                            string sqls = @"SELECT RFID_ID id,CAR_NO text FROM METER_BASE_RFID_INFO where RFID_CODE = '" + e.RfidNos + "'";
+
+                            PbModelDbService<List<PbModelDb>> pbp = new PbModelDbService<List<PbModelDb>>();
+                            RESTfulResult<List<PbModelDb>> rmT = pbp.executeSqlDataWf(sqls);
+                            if (rmT.Data == null || rmT.Data.Count == 0)
+                            { }
+                            else
                             {
-                                MeterBaseCarCard carCard = PbCache.ltCarCard.Where(s => s.cardNo == e.RfidNos).FirstOrDefault();
-                                if (carCard != null && !string.IsNullOrEmpty(carCard.carNo))
-                                {
-                                    mwUpdate.rfidCar = carCard.carNo;
-                                    sCarNo = carCard.carNo;
-                                    flagCarMonit = true;
-                                    //PbCache.collect.carno = carCard.carNo;
-                                }
+                                mwUpdate.rfidCar = rmT.Data[0].text;
+                                sCarNo = rmT.Data[0].text;
                             }
                         }
                         #endregion

+ 15 - 1
CarMeterSystem/frmOneYardToEnd.cs

@@ -34,7 +34,8 @@ namespace CarMeterSystem
         private MeterWorkCarActualFirstService workCarActualFirstService = new MeterWorkCarActualFirstService(); //一次计量数据
         private PreTrackScaleService trackService = new PreTrackScaleService();//查询预报信息
         private MeterBaseMatterInfoService matterInfoService = new MeterBaseMatterInfoService(); //物料信息
-        private PreTrackScaleService PreTrackScaleService = new PreTrackScaleService(); 
+        private PreTrackScaleService PreTrackScaleService = new PreTrackScaleService();
+        private MeterWorkScheduledHelpService meterWorkScheduledHelpService = new MeterWorkScheduledHelpService();
 
         private validTermTareCar termTareCar = new validTermTareCar();//验证是否可留期限皮
         private validRecoverInfo recoverInfo = new validRecoverInfo();//验证是否需要复磅以及是否满足复磅条件
@@ -500,6 +501,19 @@ namespace CarMeterSystem
                     //
                     #endregion 期限皮显示及保存
 
+                    #region 求助写入
+
+                    if (PbCache.monitorResultMessage != "")
+                    {
+                        MeterWorkScheduledHelp meterWorkScheduledHelp = new MeterWorkScheduledHelp();
+                        meterWorkScheduledHelp.baseSpotNo = PbCache.sportInfo.baseSpotNo;
+                        meterWorkScheduledHelp.baseSpotName = PbCache.sportInfo.baseSpotName;
+                        meterWorkScheduledHelp.carNo = PbCache.collect.carno;
+                        meterWorkScheduledHelp.helpContent = PbCache.monitorResultMessage;
+                        meterWorkScheduledHelpService.add(meterWorkScheduledHelp);
+                    }
+
+                    #endregion
 
                     #region LED写入
                     PbCache.ledInfo = string.Format("计量完成,车号:{0},车重:{1},物资:{2}", PbCache.lockCarNo, PbCache.lockWgt, preTrack != null ? preTrack.matterName : "");

+ 2 - 0
Common/Common.csproj

@@ -102,6 +102,7 @@
     <Compile Include="DbOption\work\MeterWorkPreWgttypeService.cs" />
     <Compile Include="DbOption\work\MeterWorkRailwayMotorialReceivedService.cs" />
     <Compile Include="DbOption\work\MeterWorkRailwayRecMainService.cs" />
+    <Compile Include="DbOption\work\MeterWorkScheduledHelpService.cs" />
     <Compile Include="DbOption\work\MeterWorkStorageCalibrationService.cs" />
     <Compile Include="DbOption\scale\PreStorageScalePreService.cs" />
     <Compile Include="DbOption\scale\PreTrackTemEntrustService.cs" />
@@ -131,6 +132,7 @@
     <Compile Include="vo\work\MeterWorkBeltTiminginfo.cs" />
     <Compile Include="vo\work\MeterWorkCraneActual.cs" />
     <Compile Include="vo\work\MeterWorkPreWgttype.cs" />
+    <Compile Include="vo\work\MeterWorkScheduledHelp.cs" />
     <Compile Include="vo\work\MeterWorkStorageCalibration.cs" />
     <Compile Include="vo\work\MeterWorkStorageSingleWgt.cs" />
     <Compile Include="vo\base\MeterBaseCarModify.cs" />

+ 19 - 0
Common/DbOption/work/MeterWorkScheduledHelpService.cs

@@ -0,0 +1,19 @@
+using com.hnshituo.core.webapp.vo;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Common
+{
+    public class MeterWorkScheduledHelpService
+    {
+        public RESTfulResult<List<MeterWorkScheduledHelp>> add(MeterWorkScheduledHelp info)
+        {
+            DbHelper db = new DbHelper();
+            RESTfulResult<List<MeterWorkScheduledHelp>> rm = db.doOption<List<MeterWorkScheduledHelp>>("meterworkscheduledhelps", "/", new object[] { info }, 1);
+            return rm;
+        }
+    }
+}

+ 83 - 0
Common/vo/work/MeterWorkScheduledHelp.cs

@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Common
+{
+    public class MeterWorkScheduledHelp
+    {
+        /// <summary>
+        /// 主键
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string helpId { get; set; }
+
+        /// <summary>
+        /// 车号
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string carNo { get; set; }
+
+        /// <summary>
+        /// 报警内容
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string helpContent { get; set; }
+
+        /// <summary>
+        /// 报警时间
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string createTime { get; set; }
+
+        /// <summary>
+        /// 结束时间
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string endTime { get; set; }
+
+        /// <summary>
+        /// 处理人编号
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string createNo { get; set; }
+
+        /// <summary>
+        /// 处理人
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string createName { get; set; }
+
+        /// <summary>
+        /// 处理结果
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string result { get; set; }
+
+        /// <summary>
+        /// 是否处理(0:未处理,1:已处理)
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string valueFlag { get; set; }
+
+        /// <summary>
+        /// 计量站点编号
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string baseSpotNo { get; set; }
+
+        /// <summary>
+        /// 计量站点名称
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string baseSpotName { get; set; }
+
+        /// <summary>
+        /// 是否上传智能料场
+        /// <summary>
+        //[AttributeID("pointNo")]
+        public string measureTaskNum { get; set; }
+    }
+}

+ 2 - 0
MeterSceneLibrary/JISCO/InnerCarJISCO.cs

@@ -82,6 +82,8 @@ namespace MeterSceneLibrary
             PbCache.isActual = false;
             PbCache.isInnerCar = false;
             PbCache.ResultMessage = "";
+            PbCache.monitorResultMessage = "";
+            PbCache.LEDResultMessage = "";
 
             // 根据车号查询重量类型预处理表
             RESTfulResult<List<MeterWorkPreWgttype>> rmX = wgttypeService.doQueryWf(new MeterWorkPreWgttype { carNo = PbCache.lockCarNo, valueFlag = "1" });

+ 2 - 0
MeterSceneLibrary/JISCO/OuterCarJISCO.cs

@@ -71,6 +71,8 @@ namespace MeterSceneLibrary
             PbCache.isActual = false;
             PbCache.isInnerCar = false;
             PbCache.ResultMessage = "";
+            PbCache.monitorResultMessage = "";
+            PbCache.LEDResultMessage = "";
 
             // VALUE_FLAG 状态(0=作废,1=有效(已匹配),2=结净,3=未匹配)
             // 根据车号查询最近的一次计量数据

+ 61 - 0
TrainVideoDataDispose/Form2.Designer.cs

@@ -0,0 +1,61 @@
+
+namespace TrainVideoDataDispose
+{
+    partial class Form2
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.button1 = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(75, 51);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 0;
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // Form2
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(800, 450);
+            this.Controls.Add(this.button1);
+            this.Name = "Form2";
+            this.Text = "Form2";
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button button1;
+    }
+}

+ 26 - 0
TrainVideoDataDispose/Form2.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace TrainVideoDataDispose
+{
+    public partial class Form2 : Form
+    {
+        public Form2()
+        {
+            InitializeComponent();
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            //ftpHelper.GetFilesDirList();
+            string[] s = ftpHelper.GetFilesDirList();
+        }
+    }
+}

+ 120 - 0
TrainVideoDataDispose/Form2.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 1 - 1
TrainVideoDataDispose/Program.cs

@@ -15,7 +15,7 @@ namespace TrainVideoDataDispose
         {
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
-            Application.Run(new text());
+            Application.Run(new Form2());
         }
     }
 }

+ 10 - 0
TrainVideoDataDispose/TrainVideoDataDispose.csproj

@@ -116,6 +116,13 @@
     <Compile Include="Form1.Designer.cs">
       <DependentUpon>Form1.cs</DependentUpon>
     </Compile>
+    <Compile Include="Form2.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form2.Designer.cs">
+      <DependentUpon>Form2.cs</DependentUpon>
+    </Compile>
+    <Compile Include="ftpHelper.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="text.cs">
@@ -127,6 +134,9 @@
     <EmbeddedResource Include="Form1.resx">
       <DependentUpon>Form1.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Form2.resx">
+      <DependentUpon>Form2.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>

+ 92 - 0
TrainVideoDataDispose/ftpHelper.cs

@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TrainVideoDataDispose
+{
+    public class ftpHelper
+    {
+        /// <summary>
+        /// 获取当前目录下文件夹
+        /// </summary>
+        /// <returns></returns>
+        public static string[] GetFilesDirList()
+        {
+            try
+            {
+                List<string> result = new List<string>();//如果要修改字符串而不创建新的对象,则可以使用 System.Text.StringBuilder 类。
+                List<string> result1 = new List<string>();//如果要修改字符串而不创建新的对象,则可以使用 System.Text.StringBuilder 类。
+                FtpWebRequest ftp;
+                ftp = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://10.111.16.113"));//"ftp://10.12.12.9";
+                ftp.Credentials = new NetworkCredential("300t", "300t");
+                ftp.Method = WebRequestMethods.Ftp.ListDirectoryDetails;//目录
+                WebResponse response = ftp.GetResponse();//response为一个ftp的WebResponse
+                StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.Default);//读入responses所创建的数据流
+                string line = reader.ReadLine();//输入流中的下一行;如果到达了输入流的末尾,则为空引用
+                while (line != null)
+                {
+                    result.Add(line);//)Append 方法可用来将文本或对象的字符串表示形式添加到由当前 StringBuilder 对象表示的字符串的结尾处。
+                    line = reader.ReadLine();
+                    //Download();
+                }
+                foreach (var item in result)
+                {
+                    if (item.Contains(".txt"))
+                    {
+                        result1.Add(item);
+                    }
+                }
+                string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "textFtp";
+                string fileName = result1[0].Substring(result1[0].Length - 23);
+                Download(path, fileName);
+                reader.Close();
+                response.Close();
+                return result.ToString().Split('\n');
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        /// <summary>  
+        /// 下载  filePath是下载到本机的地址fileName是需要下载的文件的名字
+        /// </summary>
+        public static void Download(string filePath, string fileName)
+        {
+            try
+            {
+                string path = filePath + "\\" + fileName;
+                FileStream outputStream = new FileStream(path, FileMode.Create);
+                FtpWebRequest reqFTP;
+                reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://10.111.16.113/" + fileName));
+                reqFTP.Credentials = new NetworkCredential("300t", "300t");
+                reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
+                reqFTP.UseBinary = true;
+                FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
+                Stream ftpStream = response.GetResponseStream();
+                long cl = response.ContentLength;
+                int bufferSize = 2048;
+                int readCount;
+                byte[] buffer = new byte[bufferSize];
+                readCount = ftpStream.Read(buffer, 0, bufferSize);
+                while (readCount > 0)
+                {
+                    outputStream.Write(buffer, 0, readCount);
+                    readCount = ftpStream.Read(buffer, 0, bufferSize);
+                }
+                ftpStream.Close();
+                outputStream.Close();
+                response.Close();
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+    }
+}