Browse Source

华耘SMT数据获取

callm 5 days ago
parent
commit
dc54269f84

+ 229 - 0
FileWatcher/AutoAnalysisDeviceKS.Designer.cs

@@ -0,0 +1,229 @@
+namespace FileWatcher
+{
+    partial class AutoAnalysisDeviceKS
+    {
+        /// <summary>
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows 窗体设计器生成的代码
+
+        /// <summary>
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            this.XmlWatcher = new System.IO.FileSystemWatcher();
+            this.XmlFolder = new System.Windows.Forms.FolderBrowserDialog();
+            this.StartWatch = new System.Windows.Forms.Button();
+            this.StopWatch = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.FolderPath = new System.Windows.Forms.TextBox();
+            this.ChooseFolder = new System.Windows.Forms.Button();
+            this.OperateResult = new System.Windows.Forms.RichTextBox();
+            this.Clean = new System.Windows.Forms.Button();
+            this.AutoStart = new System.Windows.Forms.CheckBox();
+            this.Timer = new System.Windows.Forms.Timer(this.components);
+            this.Device = new System.Windows.Forms.ComboBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.ATEFile = new System.IO.FileSystemWatcher();
+            ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.ATEFile)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // XmlWatcher
+            // 
+            this.XmlWatcher.EnableRaisingEvents = true;
+            this.XmlWatcher.Filter = "*.log";
+            this.XmlWatcher.SynchronizingObject = this;
+            // 
+            // StartWatch
+            // 
+            this.StartWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.StartWatch.Location = new System.Drawing.Point(290, 557);
+            this.StartWatch.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.StartWatch.Name = "StartWatch";
+            this.StartWatch.Size = new System.Drawing.Size(128, 56);
+            this.StartWatch.TabIndex = 0;
+            this.StartWatch.Text = "开始监控";
+            this.StartWatch.UseVisualStyleBackColor = true;
+            this.StartWatch.Click += new System.EventHandler(this.StartWatch_Click);
+            // 
+            // StopWatch
+            // 
+            this.StopWatch.Enabled = false;
+            this.StopWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.StopWatch.Location = new System.Drawing.Point(498, 557);
+            this.StopWatch.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.StopWatch.Name = "StopWatch";
+            this.StopWatch.Size = new System.Drawing.Size(128, 56);
+            this.StopWatch.TabIndex = 1;
+            this.StopWatch.Text = "停止监控";
+            this.StopWatch.UseVisualStyleBackColor = true;
+            this.StopWatch.Click += new System.EventHandler(this.StopWatch_Click);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(48, 283);
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(162, 38);
+            this.label1.TabIndex = 2;
+            this.label1.Text = "监控文件夹";
+            // 
+            // FolderPath
+            // 
+            this.FolderPath.Enabled = false;
+            this.FolderPath.Location = new System.Drawing.Point(218, 283);
+            this.FolderPath.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.FolderPath.Name = "FolderPath";
+            this.FolderPath.Size = new System.Drawing.Size(436, 35);
+            this.FolderPath.TabIndex = 3;
+            // 
+            // ChooseFolder
+            // 
+            this.ChooseFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ChooseFolder.Location = new System.Drawing.Point(686, 277);
+            this.ChooseFolder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.ChooseFolder.Name = "ChooseFolder";
+            this.ChooseFolder.Size = new System.Drawing.Size(156, 48);
+            this.ChooseFolder.TabIndex = 6;
+            this.ChooseFolder.Text = "选择文件夹";
+            this.ChooseFolder.UseVisualStyleBackColor = true;
+            this.ChooseFolder.Click += new System.EventHandler(this.ChooseFolder_Click);
+            // 
+            // OperateResult
+            // 
+            this.OperateResult.Location = new System.Drawing.Point(892, 22);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.OperateResult.Name = "OperateResult";
+            this.OperateResult.Size = new System.Drawing.Size(517, 535);
+            this.OperateResult.TabIndex = 7;
+            this.OperateResult.Text = "";
+            // 
+            // Clean
+            // 
+            this.Clean.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Clean.Location = new System.Drawing.Point(1096, 580);
+            this.Clean.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.Clean.Name = "Clean";
+            this.Clean.Size = new System.Drawing.Size(112, 48);
+            this.Clean.TabIndex = 8;
+            this.Clean.Text = "清除";
+            this.Clean.UseVisualStyleBackColor = true;
+            this.Clean.Click += new System.EventHandler(this.Clean_Click);
+            // 
+            // AutoStart
+            // 
+            this.AutoStart.AutoSize = true;
+            this.AutoStart.Checked = true;
+            this.AutoStart.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.AutoStart.Location = new System.Drawing.Point(686, 201);
+            this.AutoStart.Margin = new System.Windows.Forms.Padding(6);
+            this.AutoStart.Name = "AutoStart";
+            this.AutoStart.Size = new System.Drawing.Size(186, 28);
+            this.AutoStart.TabIndex = 16;
+            this.AutoStart.Text = "开机自动启动";
+            this.AutoStart.UseVisualStyleBackColor = true;
+            this.AutoStart.CheckedChanged += new System.EventHandler(this.AutoStart_CheckedChanged);
+            // 
+            // Timer
+            // 
+            this.Timer.Interval = 60000;
+            this.Timer.Tick += new System.EventHandler(this.Timer_Tick);
+            // 
+            // Device
+            // 
+            this.Device.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.Device.FormattingEnabled = true;
+            this.Device.Items.AddRange(new object[] {
+            "ATE设备",
+            "老化设备"});
+            this.Device.Location = new System.Drawing.Point(224, 201);
+            this.Device.Margin = new System.Windows.Forms.Padding(6);
+            this.Device.Name = "Device";
+            this.Device.Size = new System.Drawing.Size(436, 32);
+            this.Device.TabIndex = 20;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.Location = new System.Drawing.Point(54, 195);
+            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(133, 38);
+            this.label3.TabIndex = 19;
+            this.label3.Text = "设备选择";
+            // 
+            // ATEFile
+            // 
+            this.ATEFile.EnableRaisingEvents = true;
+            this.ATEFile.Filter = "*.txt";
+            this.ATEFile.SynchronizingObject = this;
+            // 
+            // AutoAnalysisDeviceKS
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1443, 640);
+            this.Controls.Add(this.Device);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.AutoStart);
+            this.Controls.Add(this.Clean);
+            this.Controls.Add(this.OperateResult);
+            this.Controls.Add(this.ChooseFolder);
+            this.Controls.Add(this.FolderPath);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.StopWatch);
+            this.Controls.Add(this.StartWatch);
+            this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.MaximizeBox = false;
+            this.Name = "AutoAnalysisDeviceKS";
+            this.Text = "UAS设备数据解析 2025-03-18  10:05";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
+            this.Load += new System.EventHandler(this.Form1_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.ATEFile)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.IO.FileSystemWatcher XmlWatcher;
+        private System.Windows.Forms.FolderBrowserDialog XmlFolder;
+        private System.Windows.Forms.Button StopWatch;
+        private System.Windows.Forms.Button StartWatch;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.TextBox FolderPath;
+        private System.Windows.Forms.Button ChooseFolder;
+        private System.Windows.Forms.RichTextBox OperateResult;
+        private System.Windows.Forms.Button Clean;
+        private System.Windows.Forms.CheckBox AutoStart;
+        private System.Windows.Forms.Timer Timer;
+        private System.Windows.Forms.ComboBox Device;
+        private System.Windows.Forms.Label label3;
+        private System.IO.FileSystemWatcher ATEFile;
+    }
+}
+

+ 302 - 0
FileWatcher/AutoAnalysisDeviceKS.cs

@@ -0,0 +1,302 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Threading;
+using System.Windows.Forms;
+using System.Xml;
+using System.Text;
+using System.Net;
+using System.Net.Sockets;
+using System.Text.RegularExpressions;
+using Oracle.ManagedDataAccess.Client;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+
+namespace FileWatcher
+{
+    public partial class AutoAnalysisDeviceKS : Form
+    {
+
+        DataHelper dh;
+
+        /// <summary>
+        /// 用户编号
+        /// </summary>
+        string iusercode;
+        /// <summary>
+        /// 岗位资源
+        /// </summary>
+        string isource;
+
+        Tip tipform;
+
+        Thread InitDB;
+
+        StringBuilder sql = new StringBuilder();
+        /// <summary>
+        /// 缓存的文件
+        /// </summary>
+        public static string CachePath = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":/UAS_MES/XmlAnalysor/Cache.xml";
+        /// <summary>
+        /// 缓存的文件夹
+        /// </summary>
+        public static string CachePathFolder = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":/UAS_MES/XmlAnalysor/";
+        /// <summary>
+        /// 需要解析的文件名
+        /// </summary>
+        List<string> _FileName = new List<string>();
+
+        ftpOperater ftp = new ftpOperater();
+
+        public AutoAnalysisDeviceKS()
+        {
+            tipform = new Tip();
+            InitializeComponent();
+            StartPosition = FormStartPosition.CenterScreen;
+        }
+
+        public AutoAnalysisDeviceKS(string iUserName, string iSource, string iMaster)
+        {
+            tipform = new Tip();
+            InitializeComponent();
+            iusercode = iUserName;
+            isource = iSource.ToUpper();
+            StartPosition = FormStartPosition.CenterScreen;
+        }
+        string IPAddress = "";
+
+        private void Form1_Load(object sender, EventArgs e)
+        {
+            tipform.Show();
+            CheckForIllegalCrossThreadCalls = false;
+            FormBorderStyle = FormBorderStyle.FixedSingle;
+            InitDB = new Thread(ConnectDB);
+            //添加监控事件
+            XmlWatcher.Changed += new FileSystemEventHandler(XmlWatcher_Created);
+            //ATEFile.Changed += new FileSystemEventHandler(XmlWatcher_Created);
+            SetLoadingWindow stw = new SetLoadingWindow(InitDB, "正在启动程序");
+            stw.StartPosition = FormStartPosition.CenterScreen;
+            stw.ShowDialog();
+            List<string> CacheInf = new List<string>();
+
+            IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
+            for (int i = 0; i < IpEntry.AddressList.Length; i++)
+            {
+                if (IpEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
+                    IPAddress = IpEntry.AddressList[i].ToString();
+            }
+            //获取缓存信息
+            try
+            {
+                FolderPath.Text = BaseUtil.GetCacheData("FolderPath").ToString();
+                Device.Text = BaseUtil.GetCacheData("Device").ToString();
+                //BackUpFolderPath.Text = BaseUtil.GetCacheData("BackUpFolderPath").ToString();
+                //Master.Text = BaseUtil.GetCacheData("Master").ToString();
+                //AutoStart.Checked = (bool)BaseUtil.GetCacheData("AutoStart");
+            }
+            catch (Exception ex) { MessageBox.Show(ex.Message); }
+            //获取岗位资源相关信息
+            StartWatch.PerformClick();
+        }
+
+        private void ConnectDB()
+        {
+            DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.7)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+            dh = new DataHelper();
+        }
+
+        private void StartWatch_Click(object sender, EventArgs e)
+        {
+            if (FolderPath.Text == "")
+            {
+                OperateResult.AppendText("请选择监控文件夹\n");
+                return;
+            }
+            else
+            {
+                if (!Directory.Exists(FolderPath.Text))
+                {
+                    OperateResult.AppendText("监控文件夹不存在\n");
+                    return;
+                }
+            }
+            XmlWatcher.Path = FolderPath.Text;
+            XmlWatcher.EnableRaisingEvents = true;
+            XmlWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
+            //设置缓存数据
+            BaseUtil.SetCacheData("FolderPath", FolderPath.Text);
+            BaseUtil.SetCacheData("Device", Device.Text);
+            Timer.Interval = 1000 * 60;
+            Timer.Start();
+            //设置按钮不可点击
+            StartWatch.Enabled = false;
+            ChooseFolder.Enabled = false;
+            StopWatch.Enabled = true;
+            OperateResult.AppendText("开始执行监控\n");
+        }
+
+        private void XmlWatcher_Created(object sender, FileSystemEventArgs e)
+        {
+            OperateResult.AppendText("文件修改:" + e.FullPath + "\n");
+            TxtHandleProcess(e.FullPath);
+        }
+
+        string nextLine;
+        private void TxtHandleProcess(string FileName)
+        {
+
+        }
+
+        private void StopWatch_Click(object sender, EventArgs e)
+        {
+            XmlWatcher.EnableRaisingEvents = false;
+            StartWatch.Enabled = true;
+            ChooseFolder.Enabled = true;
+            StopWatch.Enabled = false;
+            OperateResult.AppendText("停止执行监控\n");
+        }
+
+        private void Clean_Click(object sender, EventArgs e)
+        {
+            OperateResult.Clear();
+        }
+
+        private void ChooseFolder_Click(object sender, EventArgs e)
+        {
+            FolderBrowserDialog folder = new FolderBrowserDialog();
+            folder.Description = "选择监控文件夹";
+            DialogResult result = folder.ShowDialog();
+            if (result == DialogResult.OK)
+            {
+                FolderPath.Text = folder.SelectedPath;
+            }
+        }
+
+        private void ChooseBackUpFolder_Click(object sender, EventArgs e)
+        {
+            FolderBrowserDialog folder = new FolderBrowserDialog();
+            folder.Description = "选择备份文件夹";
+            DialogResult result = folder.ShowDialog();
+            if (result == DialogResult.OK)
+            {
+
+            }
+        }
+
+        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            string ExitConfirm = MessageBox.Show(this, "确认退出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+            if (ExitConfirm != "Yes")
+            {
+                WindowState = FormWindowState.Minimized;
+                e.Cancel = true;
+            }
+        }
+
+        private void AutoStart_CheckedChanged(object sender, EventArgs e)
+        {
+            SetAutoRun();
+        }
+        private void SetAutoRun()
+        {
+            if (AutoStart.Checked) //设置开机自启动  
+            {
+                string path = Application.ExecutablePath;
+                RegistryKey rk = Registry.LocalMachine;
+                RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
+                rk2.SetValue("FileWatcher.exe", path);
+                rk2.Close();
+                rk.Close();
+            }
+            else //取消开机自启动  
+            {
+                string path = Application.ExecutablePath;
+                RegistryKey rk = Registry.LocalMachine;
+                RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
+                rk2.DeleteValue("FileWatcher.exe", false);
+                rk2.Close();
+                rk.Close();
+            }
+        }
+
+        private void Timer_Tick(object sender, EventArgs e)
+        {
+            string filePath = FolderPath.Text+ @"\LotLog.csv";
+            string connectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.7)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+            // 读取Excel文件
+            var data = ReadExcelFile(filePath);
+            // 插入Oracle数据库
+            InsertDataIntoOracle(data, connectionString);
+        }
+
+        static List<Dictionary<string, string>> ReadExcelFile(string filePath)
+        {
+            var data = new List<Dictionary<string, string>>();
+
+            using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
+            {
+                XSSFWorkbook workbook = new XSSFWorkbook(file);
+                ISheet sheet = workbook.GetSheetAt(0); // 获取第一个工作表
+
+                IRow headerRow = sheet.GetRow(0); // 获取表头行
+                int cellCount = headerRow.LastCellNum;
+
+                for (int i = 1; i <= sheet.LastRowNum; i++) // 从第二行开始读取数据
+                {
+                    IRow row = sheet.GetRow(i);
+                    if (row == null) continue;
+
+                    var rowData = new Dictionary<string, string>();
+
+                    for (int j = 0; j < cellCount; j++)
+                    {
+                        ICell cell = row.GetCell(j);
+                        string cellValue = cell?.ToString() ?? string.Empty;
+                        string header = headerRow.GetCell(j).ToString();
+
+                        rowData[header] = cellValue;
+                    }
+
+                    data.Add(rowData);
+                }
+            }
+
+            return data;
+        }
+
+        static void InsertDataIntoOracle(List<Dictionary<string, string>> data, string connectionString)
+        {
+            using (OracleConnection connection = new OracleConnection(connectionString))
+            {
+                connection.Open();
+
+                foreach (var row in data)
+                {
+                    string query = @"
+                        INSERT INTO your_table_name (psl_program, psl_begintime, psl_endtime, psl_stop, psl_repair, psl_boards, psl_waitupper, psl_waitlower, psl_move, psl_points, psl_consumes, psl_plat)
+                        VALUES (:psl_program, :psl_begintime, :psl_endtime, :psl_stop, :psl_repair, :psl_boards, :psl_waitupper, :psl_waitlower, :psl_move, :psl_points, :psl_consumes, :psl_plat)";
+
+                    using (OracleCommand command = new OracleCommand(query, connection))
+                    {
+                        command.Parameters.Add("psl_program", OracleDbType.Varchar2).Value = row["基板名"];
+                        command.Parameters.Add("psl_begintime", OracleDbType.Date).Value = DateTime.Parse(row["生产开始时间"]);
+                        command.Parameters.Add("psl_endtime", OracleDbType.Date).Value = DateTime.Parse(row["生产完成时间"]);
+                        command.Parameters.Add("psl_stop", OracleDbType.Int32).Value = int.Parse(row["出错停止时间(秒)"]);
+                        command.Parameters.Add("psl_repair", OracleDbType.Int32).Value = int.Parse(row["出错修复时间(秒)"]);
+                        command.Parameters.Add("psl_boards", OracleDbType.Int32).Value = int.Parse(row["完成贴装的拼板数"]);
+                        command.Parameters.Add("psl_waitupper", OracleDbType.Int32).Value = int.Parse(row["因上游待机的时间(秒)"]);
+                        command.Parameters.Add("psl_waitlower", OracleDbType.Int32).Value = int.Parse(row["因下游待机的时间(秒)"]);
+                        command.Parameters.Add("psl_move", OracleDbType.Int32).Value = int.Parse(row["可动率(%)"]);
+                        command.Parameters.Add("psl_points", OracleDbType.Int32).Value = int.Parse(row["贴装点数"]);
+                        command.Parameters.Add("psl_consumes", OracleDbType.Int32).Value = int.Parse(row["元件消耗数"]);
+                        command.Parameters.Add("psl_plat", OracleDbType.Varchar2).Value = row["输送台"];
+
+                        command.ExecuteNonQuery();
+                    }
+                }
+            }
+        }
+    }
+}

+ 132 - 0
FileWatcher/AutoAnalysisDeviceKS.resx

@@ -0,0 +1,132 @@
+<?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>
+  <metadata name="XmlWatcher.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+  <metadata name="XmlFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>164, 17</value>
+  </metadata>
+  <metadata name="Timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>296, 17</value>
+  </metadata>
+  <metadata name="ATEFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>435, 17</value>
+  </metadata>
+</root>

+ 1 - 1
FileWatcher/AutoAnalysisXmlByStep.cs

@@ -38,7 +38,7 @@ namespace FileWatcher
         Thread InitDB;
         /// <summary>
         /// 线别
-        /// </summary>
+        /// </summary> 
         string ilinecode;
         /// <summary>
         /// 不良代码组

+ 45 - 3
FileWatcher/AutoMakeQTY.Designer.cs

@@ -50,6 +50,9 @@
             this.li_code = new FileWatcher.SearchTextBox();
             this.label5 = new System.Windows.Forms.Label();
             this.ma_code = new FileWatcher.SearchTextBox();
+            this.ChooseFolder = new System.Windows.Forms.Button();
+            this.FolderPath = new System.Windows.Forms.TextBox();
+            this.label6 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.ATEFile)).BeginInit();
             this.SuspendLayout();
@@ -134,7 +137,8 @@
             this.Type.FormattingEnabled = true;
             this.Type.Items.AddRange(new object[] {
             "投入",
-            "产出"});
+            "产出",
+            "印刷机"});
             this.Type.Location = new System.Drawing.Point(204, 366);
             this.Type.Name = "Type";
             this.Type.Size = new System.Drawing.Size(436, 32);
@@ -195,7 +199,7 @@
             // 
             // NowQTY
             // 
-            this.NowQTY.Location = new System.Drawing.Point(204, 443);
+            this.NowQTY.Location = new System.Drawing.Point(204, 487);
             this.NowQTY.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.NowQTY.Name = "NowQTY";
             this.NowQTY.Size = new System.Drawing.Size(146, 35);
@@ -205,7 +209,7 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(34, 440);
+            this.label4.Location = new System.Drawing.Point(34, 484);
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(133, 38);
@@ -266,11 +270,46 @@
             this.ma_code.TableName = null;
             this.ma_code.TextBoxEnable = false;
             // 
+            // ChooseFolder
+            // 
+            this.ChooseFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ChooseFolder.Location = new System.Drawing.Point(672, 420);
+            this.ChooseFolder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.ChooseFolder.Name = "ChooseFolder";
+            this.ChooseFolder.Size = new System.Drawing.Size(156, 48);
+            this.ChooseFolder.TabIndex = 32;
+            this.ChooseFolder.Text = "选择文件夹";
+            this.ChooseFolder.UseVisualStyleBackColor = true;
+            this.ChooseFolder.Click += new System.EventHandler(this.ChooseFolder_Click);
+            // 
+            // FolderPath
+            // 
+            this.FolderPath.Enabled = false;
+            this.FolderPath.Location = new System.Drawing.Point(204, 426);
+            this.FolderPath.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.FolderPath.Name = "FolderPath";
+            this.FolderPath.Size = new System.Drawing.Size(436, 35);
+            this.FolderPath.TabIndex = 31;
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label6.Location = new System.Drawing.Point(34, 426);
+            this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(162, 38);
+            this.label6.TabIndex = 30;
+            this.label6.Text = "监控文件夹";
+            // 
             // AutoMakeQTY
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1443, 640);
+            this.Controls.Add(this.ChooseFolder);
+            this.Controls.Add(this.FolderPath);
+            this.Controls.Add(this.label6);
             this.Controls.Add(this.ma_code);
             this.Controls.Add(this.li_code);
             this.Controls.Add(this.label5);
@@ -324,6 +363,9 @@
         private SearchTextBox li_code;
         private System.Windows.Forms.Label label5;
         private SearchTextBox ma_code;
+        private System.Windows.Forms.Button ChooseFolder;
+        private System.Windows.Forms.TextBox FolderPath;
+        private System.Windows.Forms.Label label6;
     }
 }
 

+ 66 - 19
FileWatcher/AutoMakeQTY.cs

@@ -10,6 +10,7 @@ using System.Net;
 using System.Net.Sockets;
 using System.IO.Ports;
 using System.Linq.Expressions;
+using System.Linq;
 
 namespace FileWatcher
 {
@@ -217,28 +218,35 @@ namespace FileWatcher
                 OperateResult.AppendText("线别不能为空\n");
                 return;
             }
-            string ExitConfirm = MessageBox.Show(this, "确认计数器是否置为0?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
-            if (ExitConfirm != "Yes")
-            {
-                return;
-            }
-            //设置按钮不可点击
-            StartWatch.Enabled = false;
-            ma_code.Enabled = false;
-            StopWatch.Enabled = true;
-            try
+            if (Type.Text == "印刷机")
             {
-                serialPort1.PortName = ComPort.Text;
-                serialPort1.BaudRate = int.Parse(BaudRate.Text);
-                serialPort1.Open();
-                Timer.Start();
+              
             }
-            catch (Exception mes)
+            else
             {
-                if (BaudRate.Text == "" || BaudRate.Text == "")
-                    OperateResult.AppendText(">>请先维护波特率和串口\n");
-                else
-                    OperateResult.AppendText(">>" + mes.Message + "\n");
+                string ExitConfirm = MessageBox.Show(this, "确认计数器是否置为0?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                if (ExitConfirm != "Yes")
+                {
+                    return;
+                }
+                //设置按钮不可点击
+                StartWatch.Enabled = false;
+                ma_code.Enabled = false;
+                StopWatch.Enabled = true;
+                try
+                {
+                    serialPort1.PortName = ComPort.Text;
+                    serialPort1.BaudRate = int.Parse(BaudRate.Text);
+                    serialPort1.Open();
+                    Timer.Start();
+                }
+                catch (Exception mes)
+                {
+                    if (BaudRate.Text == "" || BaudRate.Text == "")
+                        OperateResult.AppendText(">>请先维护波特率和串口\n");
+                    else
+                        OperateResult.AppendText(">>" + mes.Message + "\n");
+                }
             }
             OperateResult.AppendText("开始执行监控\n");
         }
@@ -291,6 +299,35 @@ namespace FileWatcher
                 byte[] data = HexStringToBytes("01 03 00 01 00 06 94 08");
                 serialPort1.Write(data, 0, data.Length);
             }
+
+            if (Type.Text == "印刷机")
+            {
+                DateTime targetDate = new DateTime(2025, 3, 17);
+                var AllXmls = Directory.GetFiles(FolderPath.Text, "*.*", SearchOption.AllDirectories).Where(s => s.ToUpper().EndsWith(".CSV") || s.ToUpper().EndsWith(".INI"));
+                foreach (var Xml in AllXmls)
+                {
+                    //解析当天日志
+                    if (Xml.Contains(DateTime.Now.ToString("yyyy-MM-dd")))
+                    {
+                        var filteredLines = File.ReadLines(Xml).Skip(1) // 跳过标题行
+                        .Where(line =>
+                        {
+                            string[] parts = line.Split(',');
+                            if (parts.Length < 2) return false;
+                            if (DateTime.TryParse(parts[1], out DateTime timestamp))
+                            {
+                                return timestamp > DateTime.Now.AddDays(-10);
+                            }
+                            return false;
+                        });
+                        foreach (var line in filteredLines)
+                        {
+                            dh.ExecuteSql("insert into makehourcount(mhc_id,mhc_macode,mhc_indate,mhc_type,mhc_qty,mhc_linecode)" +
+                         "values(makehourcount_seq.nextval,'" + ma_code.Text + "',sysdate,'" + Type.Text + "','1','" + li_code.Text + "')", "insert");
+                        }
+                    }
+                }
+            }
         }
 
         private void AutoStart_CheckedChanged(object sender, EventArgs e)
@@ -348,5 +385,15 @@ namespace FileWatcher
             return b;
         }
 
+        private void ChooseFolder_Click(object sender, EventArgs e)
+        {
+            FolderBrowserDialog folder = new FolderBrowserDialog();
+            folder.Description = "选择监控文件夹";
+            DialogResult result = folder.ShowDialog();
+            if (result == DialogResult.OK)
+            {
+                FolderPath.Text = folder.SelectedPath;
+            }
+        }
     }
 }

+ 7 - 4
FileWatcher/AutoMakeQTYRZ.cs

@@ -194,10 +194,13 @@ namespace FileWatcher
                     if (电流数据 == 0)
                     {
                         writedata = false;
-                        if (电流数据 == 0 && !writedata)
-                        {
-                            writedata = true;
-                        }
+                        //if (电流数据 == 0 && !writedata)
+                        //{
+                        //    writedata = true;
+                        //}
+                    }
+                    else {
+                        writedata = true;
                     }
                     //如果电流不为0,则获取数据,本次获取的数据判断有效
                     if (writedata)

+ 7 - 7
FileWatcher/DataHelper.cs

@@ -8,14 +8,14 @@ namespace FileWatcher
 {
     public class DataHelper
     {
-        // 系统默认的的连接字符串
-        //private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        ////用户选择的数据库的连接字符串
-        //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-
-        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.7)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //系统默认的的连接字符串
+        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=YD_CYZZ;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11701)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
-        public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.7)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=YD_CYZZ;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11701)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+
+        //private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.7)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        ////用户选择的数据库的连接字符串
+        //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.7)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
         public static OracleConnection connection = null;
         OracleCommand command = null;

+ 9 - 0
FileWatcher/FileWatcher.csproj

@@ -96,6 +96,12 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="AutoAnalysisDeviceKS.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="AutoAnalysisDeviceKS.Designer.cs">
+      <DependentUpon>AutoAnalysisDeviceKS.cs</DependentUpon>
+    </Compile>
     <Compile Include="AutoAnalysisXLSJC.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -284,6 +290,9 @@
     <Compile Include="测试记录解析DCW.Designer.cs">
       <DependentUpon>测试记录解析DCW.cs</DependentUpon>
     </Compile>
+    <EmbeddedResource Include="AutoAnalysisDeviceKS.resx">
+      <DependentUpon>AutoAnalysisDeviceKS.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="AutoAnalysisXLSJC.resx">
       <DependentUpon>AutoAnalysisXLSJC.cs</DependentUpon>
     </EmbeddedResource>

+ 4 - 1
FileWatcher/Program.cs

@@ -45,7 +45,10 @@ namespace FileWatcher
                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
-                    Application.Run(new UploadMakePlan());
+                {
+                    //Application.Run(new UploadMakePlan());
+                    Application.Run(new SOP("", ""));
+                }
                 else
                 {
                     //创建启动对象

+ 9 - 7
FileWatcher/SOP.cs

@@ -90,13 +90,15 @@ namespace FileWatcher
             {
                 for (int i = 0; i < workbook.Worksheets.Count; i++)
                 {
-                    OperatResult.AppendText("正在解析Sheet" + workbook.Worksheets[i].Name + "\n");
-                    Worksheet she = workbook.Worksheets[i];
-                    if (JPG.Checked)
-                    {
-                        var myThread = new Thread(() => SaveFileToJPG(she));
-                        myThread.Start();
-                        filename.Add(she.Name + ".jpg");
+                    if (workbook.Worksheets[i].Name != "物料清单") {
+                        OperatResult.AppendText("正在解析Sheet" + workbook.Worksheets[i].Name + "\n");
+                        Worksheet she = workbook.Worksheets[i];
+                        if (JPG.Checked)
+                        {
+                            var myThread = new Thread(() => SaveFileToJPG(she));
+                            myThread.Start();
+                            filename.Add(she.Name + ".jpg");
+                        }
                     }
                 }
             }

+ 5 - 15
FileWatcher/UploadMakePlan.cs

@@ -1,21 +1,11 @@
-using Microsoft.Win32;
-using System;
-using System.Collections.Generic;
+using System;
 using System.Data;
 using System.IO;
-using System.Threading;
 using System.Windows.Forms;
-using System.Xml;
 using System.Text;
-using System.Media;
-using System.Linq;
-using NPOI.SS.Formula.Functions;
-using System.Windows.Media.TextFormatting;
-using UMESDLLService;
 using NPOI.SS.UserModel;
 using NPOI.XSSF.UserModel;
 using Oracle.ManagedDataAccess.Client;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
 
 namespace FileWatcher
 {
@@ -115,14 +105,14 @@ namespace FileWatcher
                                 {
                                     planqtyIndex = colIndex;
                                 }
-                                else if (headerValue.Contains("备注"))
+                                else if (headerValue.Contains("备注") &&!headerValue .Contains( "生产异常备注"))
                                 {
                                     remarkIndex = colIndex;
                                 }
                             }
                         }
-                        
-                        if (wccodeIndex == -1 || orderdetnoIndex == -1 || ordercodeIndex == -1 || planqtyIndex == -1||remarkIndex==-1)
+
+                        if (wccodeIndex == -1 || orderdetnoIndex == -1 || ordercodeIndex == -1 || planqtyIndex == -1 || remarkIndex == -1)
                         {
                             Console.WriteLine("Required columns not found in the header.");
                             continue;
@@ -147,7 +137,7 @@ namespace FileWatcher
                                     string remark = row.GetCell(remarkIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
                                     if (!string.IsNullOrEmpty(wccode) && !string.IsNullOrEmpty(orderdetno) && !string.IsNullOrEmpty(ordercode))
                                     {
-                                        string insertQuery = "INSERT INTO MakePlanDetail (mpd_mpid,mpd_detno,mpd_id,mpd_wccode, mpd_orderdetno, mpd_ordercode,mpd_outqty,mpd_remark) VALUES (" + id + ","+ detno + ",MakePlanDetail_seq.nextval,:1, :2, :3,:4,:5)";
+                                        string insertQuery = "INSERT INTO MakePlanDetail (mpd_mpid,mpd_detno,mpd_id,mpd_wccode, mpd_orderdetno, mpd_ordercode,mpd_outqty,mpd_remark) VALUES (" + id + "," + detno + ",MakePlanDetail_seq.nextval,:1, :2, :3,:4,:5)";
                                         using (OracleCommand cmd = new OracleCommand(insertQuery, conn))
                                         {
                                             cmd.Parameters.Add(new OracleParameter(":1", wccode));