浏览代码

瑞梓仪器数据读取

callm 4 月之前
父节点
当前提交
c2a3ae99ad

+ 60 - 10
FileWatcher/AutoAnalysisXml.Designer.cs

@@ -50,6 +50,10 @@
             this.MAC = new System.Windows.Forms.RadioButton();
             this.SN = new System.Windows.Forms.RadioButton();
             this.GetFiles = new System.Windows.Forms.Timer(this.components);
+            this.sc_code = new System.Windows.Forms.TextBox();
+            this.sc_code_label = new System.Windows.Forms.Label();
+            this.em_code = new System.Windows.Forms.TextBox();
+            this.label5 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             this.SuspendLayout();
             // 
@@ -88,7 +92,7 @@
             // 
             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, 400);
+            this.label1.Location = new System.Drawing.Point(48, 290);
             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);
@@ -98,7 +102,7 @@
             // FolderPath
             // 
             this.FolderPath.Enabled = false;
-            this.FolderPath.Location = new System.Drawing.Point(218, 400);
+            this.FolderPath.Location = new System.Drawing.Point(218, 290);
             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);
@@ -107,7 +111,7 @@
             // 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, 394);
+            this.ChooseFolder.Location = new System.Drawing.Point(686, 284);
             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);
@@ -141,7 +145,7 @@
             // 
             this.MakeCode_lable.AutoSize = true;
             this.MakeCode_lable.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MakeCode_lable.Location = new System.Drawing.Point(48, 311);
+            this.MakeCode_lable.Location = new System.Drawing.Point(48, 201);
             this.MakeCode_lable.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.MakeCode_lable.Name = "MakeCode_lable";
             this.MakeCode_lable.Size = new System.Drawing.Size(104, 38);
@@ -186,7 +190,7 @@
             // 
             // ma_code
             // 
-            this.ma_code.Location = new System.Drawing.Point(218, 311);
+            this.ma_code.Location = new System.Drawing.Point(218, 201);
             this.ma_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.ma_code.Name = "ma_code";
             this.ma_code.Size = new System.Drawing.Size(436, 35);
@@ -195,7 +199,7 @@
             // BatchAnalysus
             // 
             this.BatchAnalysus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.BatchAnalysus.Location = new System.Drawing.Point(686, 308);
+            this.BatchAnalysus.Location = new System.Drawing.Point(686, 198);
             this.BatchAnalysus.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.BatchAnalysus.Name = "BatchAnalysus";
             this.BatchAnalysus.Size = new System.Drawing.Size(156, 48);
@@ -216,7 +220,7 @@
             this.Device.Items.AddRange(new object[] {
             "AOI设备",
             "测试设备"});
-            this.Device.Location = new System.Drawing.Point(218, 222);
+            this.Device.Location = new System.Drawing.Point(218, 112);
             this.Device.Margin = new System.Windows.Forms.Padding(6);
             this.Device.Name = "Device";
             this.Device.Size = new System.Drawing.Size(436, 32);
@@ -226,7 +230,7 @@
             // 
             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(48, 222);
+            this.label3.Location = new System.Drawing.Point(48, 112);
             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);
@@ -237,7 +241,7 @@
             // 
             this.MAC.AutoSize = true;
             this.MAC.Checked = true;
-            this.MAC.Location = new System.Drawing.Point(218, 473);
+            this.MAC.Location = new System.Drawing.Point(216, 465);
             this.MAC.Name = "MAC";
             this.MAC.Size = new System.Drawing.Size(77, 28);
             this.MAC.TabIndex = 21;
@@ -248,7 +252,7 @@
             // SN
             // 
             this.SN.AutoSize = true;
-            this.SN.Location = new System.Drawing.Point(334, 473);
+            this.SN.Location = new System.Drawing.Point(332, 465);
             this.SN.Name = "SN";
             this.SN.Size = new System.Drawing.Size(65, 28);
             this.SN.TabIndex = 22;
@@ -260,11 +264,53 @@
             this.GetFiles.Interval = 60000;
             this.GetFiles.Tick += new System.EventHandler(this.GetFiles_Tick);
             // 
+            // sc_code
+            // 
+            this.sc_code.Location = new System.Drawing.Point(218, 370);
+            this.sc_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.sc_code.Name = "sc_code";
+            this.sc_code.Size = new System.Drawing.Size(158, 35);
+            this.sc_code.TabIndex = 24;
+            // 
+            // sc_code_label
+            // 
+            this.sc_code_label.AutoSize = true;
+            this.sc_code_label.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.sc_code_label.Location = new System.Drawing.Point(48, 370);
+            this.sc_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.sc_code_label.Name = "sc_code_label";
+            this.sc_code_label.Size = new System.Drawing.Size(133, 38);
+            this.sc_code_label.TabIndex = 23;
+            this.sc_code_label.Text = "岗位资源";
+            // 
+            // em_code
+            // 
+            this.em_code.Location = new System.Drawing.Point(594, 370);
+            this.em_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.em_code.Name = "em_code";
+            this.em_code.Size = new System.Drawing.Size(158, 35);
+            this.em_code.TabIndex = 26;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.Location = new System.Drawing.Point(424, 370);
+            this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(104, 38);
+            this.label5.TabIndex = 25;
+            this.label5.Text = "用户名";
+            // 
             // AutoAnalysisXml
             // 
             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.em_code);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.sc_code);
+            this.Controls.Add(this.sc_code_label);
             this.Controls.Add(this.SN);
             this.Controls.Add(this.MAC);
             this.Controls.Add(this.Device);
@@ -317,6 +363,10 @@
         private System.Windows.Forms.RadioButton SN;
         private System.Windows.Forms.RadioButton MAC;
         private System.Windows.Forms.Timer GetFiles;
+        private System.Windows.Forms.TextBox em_code;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.TextBox sc_code;
+        private System.Windows.Forms.Label sc_code_label;
     }
 }
 

+ 19 - 13
FileWatcher/AutoAnalysisXml.cs

@@ -8,6 +8,7 @@ using System.Windows.Forms;
 using System.Xml;
 using System.Text;
 using System.Media;
+using NPOI.SS.Formula.Functions;
 
 namespace FileWatcher
 {
@@ -94,8 +95,8 @@ namespace FileWatcher
             //获取缓存信息
             try
             {
-                //FolderPath.Text = BaseUtil.GetCacheData("FolderPath").ToString();
-                //BackUpFolderPath.Text = BaseUtil.GetCacheData("BackUpFolderPath").ToString();
+                sc_code.Text = BaseUtil.GetCacheData("SCCODE").ToString();
+                em_code.Text = BaseUtil.GetCacheData("EMCODE").ToString();
                 //Master.Text = BaseUtil.GetCacheData("Master").ToString();
                 //AutoStart.Checked = (bool)BaseUtil.GetCacheData("AutoStart");
             }
@@ -153,11 +154,14 @@ namespace FileWatcher
                 OperateResult.AppendText("工单不存在或者未下放\n");
                 return;
             }
+            if (sc_code.Text == "" || em_code.Text == "")
+            {
+                OperateResult.AppendText("用户名和岗位资源不能为空\n");
+                return;
+            }
             //设置缓存数据
-            //BaseUtil.SetCacheData("FolderPath", FolderPath.Text);
-            //BaseUtil.SetCacheData("BackUpFolderPath", BackUpFolderPath.Text);
-            //BaseUtil.SetCacheData("Master", Master.Text);
-            //BaseUtil.SetCacheData("AutoStart", AutoStart.Checked);
+            BaseUtil.SetCacheData("SCCODE", sc_code.Text);
+            BaseUtil.SetCacheData("EMCODE", em_code.Text);
             //设置按钮不可点击
             StartWatch.Enabled = false;
             ChooseFolder.Enabled = false;
@@ -221,8 +225,8 @@ namespace FileWatcher
                 string stepcode = "";
                 string oErrMessage = "";
                 string oMSID = "";
-                isource = "ZZ_TEST2";
-                iusercode = "HUAG_26";
+                isource = sc_code.Text;
+                iusercode = em_code.Text;
                 DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
                 if (dt.Rows.Count > 0)
                 {
@@ -309,8 +313,8 @@ namespace FileWatcher
                             string oErrMessage = "";
                             string oMSID = "";
                             string ms_sncode = dh.getFieldDataByCondition("makeserial", "ms_sncode", "substr(ms_sncode,0,12)='" + SN + "' order by ms_id").ToString();
-                            isource = "ZZ_TEST2";
-                            iusercode = "HUAG_26";
+                            isource = sc_code.Text;
+                            iusercode = em_code.Text;
                             DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
                             if (dt.Rows.Count > 0)
                             {
@@ -326,7 +330,7 @@ namespace FileWatcher
                                     try
                                     {
                                         string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
-                                        //ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
+                                        ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
                                         int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where substr(ms_sncode,0,12)='" + SN + "'", "insert").ToString());
                                         if (num > 0)
                                         {
@@ -365,8 +369,8 @@ namespace FileWatcher
                             string oErrMessage = "";
                             string oMSID = "";
                             string ms_sncode = dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_sncode='" + SN + "' order by ms_id").ToString();
-                            isource = "ZZ_TEST2";
-                            iusercode = "HUAG_26";
+                            isource = sc_code.Text;
+                            iusercode = em_code.Text;
                             DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
                             if (dt.Rows.Count > 0)
                             {
@@ -382,7 +386,9 @@ namespace FileWatcher
                                     try
                                     {
                                         string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
+                                        OperateResult.AppendText(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff")+"\n");
                                         ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
+                                        OperateResult.AppendText(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
                                         int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where ms_sncode='" + SN + "'", "insert").ToString());
                                         if (num > 0)
                                         {

+ 33 - 54
FileWatcher/AutoMakeQTYRZ.cs

@@ -51,6 +51,9 @@ namespace FileWatcher
 
         ftpOperater ftp = new ftpOperater();
 
+        private bool waitingForStableData = false;
+        private DateTime lastCurrentReadingTime;
+
         public AutoMakeQTYRZ()
         {
             InitializeComponent();
@@ -167,22 +170,25 @@ namespace FileWatcher
             return f2;
         }
 
-        double lastqty = 0;
         string data = "";
-        bool getSeconddata = false;
         bool realwritedata = false;
+
+        private bool canRecordData = true; // 初始为true,允许第一次记录
+        private bool currentWasZero = true; // 初始状态假设电流为0
         private void SerialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
         {
             try
             {
                 int len = serialPort1.BytesToRead;
                 Byte[] readBuffer = new Byte[len];
-                serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
+                serialPort1.Read(readBuffer, 0, len);
                 data = BitConverter.ToString(readBuffer, 0, readBuffer.Length).Replace("-", "");
+
                 if (data.Length > 48)
                 {
                     data = data.Substring(0, 48);
                 }
+
                 if (data.Length == 48)
                 {
                     float 电压数据 = getdata(data.Substring(6, 8));
@@ -190,70 +196,43 @@ namespace FileWatcher
                     float 功率数据 = getdata(data.Substring(22, 8));
                     float 频率数据 = getdata(data.Substring(30, 8));
                     float 功率因素 = getdata(data.Substring(38, 8));
-                    //如果电流是0,则下次重新获取数据
+
+                    // 检查电流状态变化
                     if (电流数据 == 0)
                     {
-                        writedata = false;
-                        //if (电流数据 == 0 && !writedata)
-                        //{
-                        //    writedata = true;
-                        //}
-                    }
-                    else {
-                        writedata = true;
+                        currentWasZero = true;
+                        canRecordData = true; // 电流归零后,允许下次记录
+                        OperateResult.AppendText("电流归零,准备下次记录\n");
                     }
-                    //如果电流不为0,则获取数据,本次获取的数据判断有效
-                    if (writedata)
+                    else if (电流数据 != 0 && currentWasZero && canRecordData)
                     {
-                        if (电流数据 != 0)
+                        // 电流从0变为非0,且允许记录
+                        double num, num1;
+                        if (double.TryParse(FunctionNum.Text, out num) &&
+                            double.TryParse(FunctionNum1.Text, out num1))
                         {
-                            realwritedata = true;
-                            writedata = false;
-                            Thread.Sleep(2000);
-                            OperateResult.AppendText("获取数据\n");
-                            byte[] data = HexStringToBytes("55 00 10 65");
-                            serialPort1.Write(data, 0, data.Length);
-                        }
-                    }
-                    //写入获取电流数据2秒后的数据
-                    if (realwritedata)
-                    {
-                        if (电流数据 > 0)
-                        {
-                            double num;
-                            double num1;
-                            if (double.TryParse(FunctionNum.Text, out num) && double.TryParse(FunctionNum1.Text, out num1))
+                            if (功率数据 > num && 功率数据 < num1)
                             {
-                                if (功率数据 > num && 功率数据 < num1)
-                                {
-                                    OperateResult.AppendText("数据上传成功,功率[" + 功率数据 + "]\n");
-                                    dh.ExecuteSql("insert into currenttest(CT_ID,ct_linecode, CT_MAKECODE, CT_VOLTAGE, CT_CURRENT, CT_POWER, CT_FREQUENCY, CT_POWER1)" +
-                                     "VALUES(currenttest_SEQ.NEXTVAL,'" + li_code.Text + "','" + ma_code.Text + "','" + 电压数据 + "','" + 电流数据 + "','" + 功率数据 + "','" + 频率数据 + "','" + 功率因素 + "')", "insert");
-                                    NowQTY.Text = dh.getRowCount("currenttest", "ct_makecode='" + ma_code.Text + "'").ToString();
-                                    realwritedata = false;
-                                }
-                                else
-                                {
-                                    OperateResult.AppendText("功率数据异常\n");
-                                }
+                                OperateResult.AppendText("检测到有效电流,记录数据,功率[" + 功率数据 + "]\n");
+                                dh.ExecuteSql("insert into currenttest(CT_ID,ct_linecode, CT_MAKECODE, CT_VOLTAGE, CT_CURRENT, CT_POWER, CT_FREQUENCY, CT_POWER1) " +
+                                    "VALUES(currenttest_SEQ.NEXTVAL,'" + li_code.Text + "','" + ma_code.Text + "','" + 电压数据 + "','" + 电流数据 + "','" + 功率数据 + "','" + 频率数据 + "','" + 功率因素 + "')", "insert");
+                                NowQTY.Text = dh.getRowCount("currenttest", "ct_makecode='" + ma_code.Text + "'").ToString();
+
+                                // 记录后禁止再次记录,直到电流归零
+                                canRecordData = false;
+                                currentWasZero = false;
                             }
                             else
                             {
-                                OperateResult.AppendText("请填写功率标准值\n");
+                                OperateResult.AppendText("功率数据异常\n");
                             }
                         }
+                        else
+                        {
+                            OperateResult.AppendText("请填写功率标准值\n");
+                        }
                     }
                 }
-                else
-                {
-                    //realwritedata = true;
-                    //writedata = false;
-                    //Thread.Sleep(1000);
-                    //OperateResult.AppendText("获取数据1\n");
-                    //byte[] data = HexStringToBytes("55 00 10 65");
-                    //serialPort1.Write(data, 0, data.Length);
-                    //OperateResult.AppendText(data + "数据格式异常\n");
-                }
             }
             catch (Exception ex)
             {

+ 8 - 8
FileWatcher/DataHelper.cs

@@ -14,16 +14,16 @@ namespace FileWatcher
         //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)));";
 
 
-        ////PNE
-        //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=10.1.81.208)(PORT=11665)))(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=10.1.81.208)(PORT=11665)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //RZ
+        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=10.10.6.28)(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=10.10.6.28)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
 
-        //HG
-        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)));";
+        ////HG
+        //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)));";
 
 
         ////HY

+ 327 - 13
FileWatcher/Form4.Designer.cs

@@ -45,6 +45,33 @@
             this.label7 = new System.Windows.Forms.Label();
             this.comboBox1 = new System.Windows.Forms.ComboBox();
             this.label8 = new System.Windows.Forms.Label();
+            this.checkBox1 = new System.Windows.Forms.CheckBox();
+            this.checkBox2 = new System.Windows.Forms.CheckBox();
+            this.checkBox3 = new System.Windows.Forms.CheckBox();
+            this.label9 = new System.Windows.Forms.Label();
+            this.textBox6 = new System.Windows.Forms.TextBox();
+            this.label10 = new System.Windows.Forms.Label();
+            this.textBox7 = new System.Windows.Forms.TextBox();
+            this.label11 = new System.Windows.Forms.Label();
+            this.textBox8 = new System.Windows.Forms.TextBox();
+            this.label12 = new System.Windows.Forms.Label();
+            this.textBox9 = new System.Windows.Forms.TextBox();
+            this.label13 = new System.Windows.Forms.Label();
+            this.textBox10 = new System.Windows.Forms.TextBox();
+            this.label14 = new System.Windows.Forms.Label();
+            this.textBox11 = new System.Windows.Forms.TextBox();
+            this.label15 = new System.Windows.Forms.Label();
+            this.textBox12 = new System.Windows.Forms.TextBox();
+            this.label16 = new System.Windows.Forms.Label();
+            this.textBox13 = new System.Windows.Forms.TextBox();
+            this.label17 = new System.Windows.Forms.Label();
+            this.textBox14 = new System.Windows.Forms.TextBox();
+            this.label18 = new System.Windows.Forms.Label();
+            this.textBox15 = new System.Windows.Forms.TextBox();
+            this.label20 = new System.Windows.Forms.Label();
+            this.label23 = new System.Windows.Forms.Label();
+            this.textBox20 = new System.Windows.Forms.TextBox();
+            this.textBox16 = new System.Windows.Forms.TextBox();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             this.SuspendLayout();
             // 
@@ -61,7 +88,7 @@
             // 
             // textBox1
             // 
-            this.textBox1.Location = new System.Drawing.Point(1006, 340);
+            this.textBox1.Location = new System.Drawing.Point(867, 223);
             this.textBox1.Name = "textBox1";
             this.textBox1.Size = new System.Drawing.Size(125, 35);
             this.textBox1.TabIndex = 22;
@@ -69,7 +96,7 @@
             // label3
             // 
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(882, 343);
+            this.label3.Location = new System.Drawing.Point(743, 226);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(106, 24);
             this.label3.TabIndex = 23;
@@ -78,7 +105,7 @@
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(882, 209);
+            this.label1.Location = new System.Drawing.Point(743, 92);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(58, 24);
             this.label1.TabIndex = 25;
@@ -86,7 +113,7 @@
             // 
             // textBox2
             // 
-            this.textBox2.Location = new System.Drawing.Point(1006, 206);
+            this.textBox2.Location = new System.Drawing.Point(867, 89);
             this.textBox2.Name = "textBox2";
             this.textBox2.Size = new System.Drawing.Size(125, 35);
             this.textBox2.TabIndex = 24;
@@ -94,7 +121,7 @@
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(882, 400);
+            this.label2.Location = new System.Drawing.Point(743, 283);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(82, 24);
             this.label2.TabIndex = 26;
@@ -103,7 +130,7 @@
             // label4
             // 
             this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(882, 143);
+            this.label4.Location = new System.Drawing.Point(743, 26);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(58, 24);
             this.label4.TabIndex = 28;
@@ -111,7 +138,7 @@
             // 
             // textBox3
             // 
-            this.textBox3.Location = new System.Drawing.Point(1006, 140);
+            this.textBox3.Location = new System.Drawing.Point(867, 23);
             this.textBox3.Name = "textBox3";
             this.textBox3.Size = new System.Drawing.Size(125, 35);
             this.textBox3.TabIndex = 27;
@@ -119,7 +146,7 @@
             // label5
             // 
             this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(882, 274);
+            this.label5.Location = new System.Drawing.Point(743, 157);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(58, 24);
             this.label5.TabIndex = 30;
@@ -127,7 +154,7 @@
             // 
             // textBox4
             // 
-            this.textBox4.Location = new System.Drawing.Point(1006, 271);
+            this.textBox4.Location = new System.Drawing.Point(867, 154);
             this.textBox4.Name = "textBox4";
             this.textBox4.Size = new System.Drawing.Size(125, 35);
             this.textBox4.TabIndex = 29;
@@ -161,7 +188,7 @@
             // 
             // pictureBox1
             // 
-            this.pictureBox1.Location = new System.Drawing.Point(185, 317);
+            this.pictureBox1.Location = new System.Drawing.Point(51, 45);
             this.pictureBox1.Name = "pictureBox1";
             this.pictureBox1.Size = new System.Drawing.Size(600, 379);
             this.pictureBox1.TabIndex = 34;
@@ -179,7 +206,7 @@
             // comboBox1
             // 
             this.comboBox1.FormattingEnabled = true;
-            this.comboBox1.Location = new System.Drawing.Point(185, 62);
+            this.comboBox1.Location = new System.Drawing.Point(851, 361);
             this.comboBox1.Name = "comboBox1";
             this.comboBox1.Size = new System.Drawing.Size(121, 32);
             this.comboBox1.TabIndex = 36;
@@ -187,17 +214,277 @@
             // label8
             // 
             this.label8.AutoSize = true;
-            this.label8.Location = new System.Drawing.Point(61, 65);
+            this.label8.Location = new System.Drawing.Point(727, 364);
             this.label8.Name = "label8";
             this.label8.Size = new System.Drawing.Size(58, 24);
             this.label8.TabIndex = 37;
             this.label8.Text = "原因";
             // 
+            // checkBox1
+            // 
+            this.checkBox1.AutoSize = true;
+            this.checkBox1.Location = new System.Drawing.Point(79, 62);
+            this.checkBox1.Name = "checkBox1";
+            this.checkBox1.Size = new System.Drawing.Size(90, 28);
+            this.checkBox1.TabIndex = 38;
+            this.checkBox1.Text = "推边";
+            this.checkBox1.UseVisualStyleBackColor = true;
+            // 
+            // checkBox2
+            // 
+            this.checkBox2.AutoSize = true;
+            this.checkBox2.Location = new System.Drawing.Point(223, 62);
+            this.checkBox2.Name = "checkBox2";
+            this.checkBox2.Size = new System.Drawing.Size(90, 28);
+            this.checkBox2.TabIndex = 39;
+            this.checkBox2.Text = "裁切";
+            this.checkBox2.UseVisualStyleBackColor = true;
+            // 
+            // checkBox3
+            // 
+            this.checkBox3.AutoSize = true;
+            this.checkBox3.Location = new System.Drawing.Point(382, 62);
+            this.checkBox3.Name = "checkBox3";
+            this.checkBox3.Size = new System.Drawing.Size(90, 28);
+            this.checkBox3.TabIndex = 40;
+            this.checkBox3.Text = "打点";
+            this.checkBox3.UseVisualStyleBackColor = true;
+            // 
+            // label9
+            // 
+            this.label9.AutoSize = true;
+            this.label9.Location = new System.Drawing.Point(5, 517);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(82, 24);
+            this.label9.TabIndex = 42;
+            this.label9.Text = "订单号";
+            // 
+            // textBox6
+            // 
+            this.textBox6.Location = new System.Drawing.Point(114, 514);
+            this.textBox6.Name = "textBox6";
+            this.textBox6.Size = new System.Drawing.Size(173, 35);
+            this.textBox6.TabIndex = 41;
+            this.textBox6.Text = "mpd_ordercode";
+            // 
+            // label10
+            // 
+            this.label10.AutoSize = true;
+            this.label10.Location = new System.Drawing.Point(277, 520);
+            this.label10.Name = "label10";
+            this.label10.Size = new System.Drawing.Size(82, 24);
+            this.label10.TabIndex = 44;
+            this.label10.Text = "工单号";
+            // 
+            // textBox7
+            // 
+            this.textBox7.Location = new System.Drawing.Point(386, 512);
+            this.textBox7.Name = "textBox7";
+            this.textBox7.Size = new System.Drawing.Size(125, 35);
+            this.textBox7.TabIndex = 43;
+            this.textBox7.Text = "ma_code";
+            // 
+            // label11
+            // 
+            this.label11.AutoSize = true;
+            this.label11.Location = new System.Drawing.Point(545, 523);
+            this.label11.Name = "label11";
+            this.label11.Size = new System.Drawing.Size(106, 24);
+            this.label11.TabIndex = 46;
+            this.label11.Text = "工单数量";
+            // 
+            // textBox8
+            // 
+            this.textBox8.Location = new System.Drawing.Point(657, 517);
+            this.textBox8.Name = "textBox8";
+            this.textBox8.Size = new System.Drawing.Size(164, 35);
+            this.textBox8.TabIndex = 45;
+            this.textBox8.Text = "ma_qty";
+            // 
+            // label12
+            // 
+            this.label12.AutoSize = true;
+            this.label12.Location = new System.Drawing.Point(827, 523);
+            this.label12.Name = "label12";
+            this.label12.Size = new System.Drawing.Size(106, 24);
+            this.label12.TabIndex = 48;
+            this.label12.Text = "当日报工";
+            // 
+            // textBox9
+            // 
+            this.textBox9.Location = new System.Drawing.Point(936, 520);
+            this.textBox9.Name = "textBox9";
+            this.textBox9.Size = new System.Drawing.Size(125, 35);
+            this.textBox9.TabIndex = 47;
+            this.textBox9.Text = "nowqty";
+            // 
+            // label13
+            // 
+            this.label13.AutoSize = true;
+            this.label13.Location = new System.Drawing.Point(1078, 523);
+            this.label13.Name = "label13";
+            this.label13.Size = new System.Drawing.Size(106, 24);
+            this.label13.TabIndex = 50;
+            this.label13.Text = "累计报工";
+            // 
+            // textBox10
+            // 
+            this.textBox10.Location = new System.Drawing.Point(1187, 520);
+            this.textBox10.Name = "textBox10";
+            this.textBox10.Size = new System.Drawing.Size(183, 35);
+            this.textBox10.TabIndex = 49;
+            this.textBox10.Text = "sumqty";
+            // 
+            // label14
+            // 
+            this.label14.AutoSize = true;
+            this.label14.Location = new System.Drawing.Point(1078, 602);
+            this.label14.Name = "label14";
+            this.label14.Size = new System.Drawing.Size(106, 24);
+            this.label14.TabIndex = 60;
+            this.label14.Text = "首件状态";
+            // 
+            // textBox11
+            // 
+            this.textBox11.Location = new System.Drawing.Point(1187, 599);
+            this.textBox11.Name = "textBox11";
+            this.textBox11.Size = new System.Drawing.Size(183, 35);
+            this.textBox11.TabIndex = 59;
+            this.textBox11.Text = "ma_firststatus";
+            // 
+            // label15
+            // 
+            this.label15.AutoSize = true;
+            this.label15.Location = new System.Drawing.Point(827, 599);
+            this.label15.Name = "label15";
+            this.label15.Size = new System.Drawing.Size(106, 24);
+            this.label15.TabIndex = 58;
+            this.label15.Text = "首件数量";
+            // 
+            // textBox12
+            // 
+            this.textBox12.Location = new System.Drawing.Point(936, 596);
+            this.textBox12.Name = "textBox12";
+            this.textBox12.Size = new System.Drawing.Size(125, 35);
+            this.textBox12.TabIndex = 57;
+            // 
+            // label16
+            // 
+            this.label16.AutoSize = true;
+            this.label16.Location = new System.Drawing.Point(545, 596);
+            this.label16.Name = "label16";
+            this.label16.Size = new System.Drawing.Size(106, 24);
+            this.label16.TabIndex = 56;
+            this.label16.Text = "排产日期";
+            // 
+            // textBox13
+            // 
+            this.textBox13.Location = new System.Drawing.Point(657, 593);
+            this.textBox13.Name = "textBox13";
+            this.textBox13.Size = new System.Drawing.Size(164, 35);
+            this.textBox13.TabIndex = 55;
+            this.textBox13.Text = "mp_begintime";
+            // 
+            // label17
+            // 
+            this.label17.AutoSize = true;
+            this.label17.Location = new System.Drawing.Point(277, 596);
+            this.label17.Name = "label17";
+            this.label17.Size = new System.Drawing.Size(106, 24);
+            this.label17.TabIndex = 54;
+            this.label17.Text = "产品名称";
+            // 
+            // textBox14
+            // 
+            this.textBox14.Location = new System.Drawing.Point(386, 593);
+            this.textBox14.Name = "textBox14";
+            this.textBox14.Size = new System.Drawing.Size(125, 35);
+            this.textBox14.TabIndex = 53;
+            this.textBox14.Text = "pr_detail";
+            // 
+            // label18
+            // 
+            this.label18.AutoSize = true;
+            this.label18.Location = new System.Drawing.Point(5, 593);
+            this.label18.Name = "label18";
+            this.label18.Size = new System.Drawing.Size(106, 24);
+            this.label18.TabIndex = 52;
+            this.label18.Text = "产品编号";
+            // 
+            // textBox15
+            // 
+            this.textBox15.Location = new System.Drawing.Point(114, 590);
+            this.textBox15.Name = "textBox15";
+            this.textBox15.Size = new System.Drawing.Size(157, 35);
+            this.textBox15.TabIndex = 51;
+            this.textBox15.Text = "pr_code";
+            // 
+            // label20
+            // 
+            this.label20.AutoSize = true;
+            this.label20.Location = new System.Drawing.Point(711, 677);
+            this.label20.Name = "label20";
+            this.label20.Size = new System.Drawing.Size(58, 24);
+            this.label20.TabIndex = 68;
+            this.label20.Text = "备注";
+            // 
+            // label23
+            // 
+            this.label23.AutoSize = true;
+            this.label23.Location = new System.Drawing.Point(5, 674);
+            this.label23.Name = "label23";
+            this.label23.Size = new System.Drawing.Size(58, 24);
+            this.label23.TabIndex = 62;
+            this.label23.Text = "规格";
+            // 
+            // textBox20
+            // 
+            this.textBox20.Location = new System.Drawing.Point(114, 671);
+            this.textBox20.Name = "textBox20";
+            this.textBox20.Size = new System.Drawing.Size(550, 35);
+            this.textBox20.TabIndex = 61;
+            this.textBox20.Text = "pr_spec";
+            // 
+            // textBox16
+            // 
+            this.textBox16.Location = new System.Drawing.Point(795, 671);
+            this.textBox16.Name = "textBox16";
+            this.textBox16.Size = new System.Drawing.Size(550, 35);
+            this.textBox16.TabIndex = 69;
+            this.textBox16.Text = "MPD_REMARK";
+            // 
             // Form4
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1419, 820);
+            this.ClientSize = new System.Drawing.Size(1703, 820);
+            this.Controls.Add(this.textBox16);
+            this.Controls.Add(this.label20);
+            this.Controls.Add(this.label23);
+            this.Controls.Add(this.textBox20);
+            this.Controls.Add(this.label14);
+            this.Controls.Add(this.textBox11);
+            this.Controls.Add(this.label15);
+            this.Controls.Add(this.textBox12);
+            this.Controls.Add(this.label16);
+            this.Controls.Add(this.textBox13);
+            this.Controls.Add(this.label17);
+            this.Controls.Add(this.textBox14);
+            this.Controls.Add(this.label18);
+            this.Controls.Add(this.textBox15);
+            this.Controls.Add(this.label13);
+            this.Controls.Add(this.textBox10);
+            this.Controls.Add(this.label12);
+            this.Controls.Add(this.textBox9);
+            this.Controls.Add(this.label11);
+            this.Controls.Add(this.textBox8);
+            this.Controls.Add(this.label10);
+            this.Controls.Add(this.textBox7);
+            this.Controls.Add(this.label9);
+            this.Controls.Add(this.textBox6);
+            this.Controls.Add(this.checkBox3);
+            this.Controls.Add(this.checkBox2);
+            this.Controls.Add(this.checkBox1);
             this.Controls.Add(this.label8);
             this.Controls.Add(this.comboBox1);
             this.Controls.Add(this.label7);
@@ -242,5 +529,32 @@
         private System.Windows.Forms.Label label7;
         private System.Windows.Forms.ComboBox comboBox1;
         private System.Windows.Forms.Label label8;
+        private System.Windows.Forms.CheckBox checkBox1;
+        private System.Windows.Forms.CheckBox checkBox2;
+        private System.Windows.Forms.CheckBox checkBox3;
+        private System.Windows.Forms.Label label9;
+        private System.Windows.Forms.TextBox textBox6;
+        private System.Windows.Forms.Label label10;
+        private System.Windows.Forms.TextBox textBox7;
+        private System.Windows.Forms.Label label11;
+        private System.Windows.Forms.TextBox textBox8;
+        private System.Windows.Forms.Label label12;
+        private System.Windows.Forms.TextBox textBox9;
+        private System.Windows.Forms.Label label13;
+        private System.Windows.Forms.TextBox textBox10;
+        private System.Windows.Forms.Label label14;
+        private System.Windows.Forms.TextBox textBox11;
+        private System.Windows.Forms.Label label15;
+        private System.Windows.Forms.TextBox textBox12;
+        private System.Windows.Forms.Label label16;
+        private System.Windows.Forms.TextBox textBox13;
+        private System.Windows.Forms.Label label17;
+        private System.Windows.Forms.TextBox textBox14;
+        private System.Windows.Forms.Label label18;
+        private System.Windows.Forms.TextBox textBox15;
+        private System.Windows.Forms.Label label20;
+        private System.Windows.Forms.Label label23;
+        private System.Windows.Forms.TextBox textBox20;
+        private System.Windows.Forms.TextBox textBox16;
     }
 }

+ 5 - 74
FileWatcher/Form5.Designer.cs

@@ -28,56 +28,18 @@
         /// </summary>
         private void InitializeComponent()
         {
-            this.textBox1 = new System.Windows.Forms.TextBox();
-            this.label1 = new System.Windows.Forms.Label();
-            this.label13 = new System.Windows.Forms.Label();
-            this.textBox5 = new System.Windows.Forms.TextBox();
             this.button1 = new System.Windows.Forms.Button();
             this.textBox2 = new System.Windows.Forms.TextBox();
             this.label5 = new System.Windows.Forms.Label();
-            this.label3 = new System.Windows.Forms.Label();
-            this.label4 = new System.Windows.Forms.Label();
             this.SuspendLayout();
             // 
-            // textBox1
-            // 
-            this.textBox1.Location = new System.Drawing.Point(210, 100);
-            this.textBox1.Name = "textBox1";
-            this.textBox1.Size = new System.Drawing.Size(243, 35);
-            this.textBox1.TabIndex = 0;
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(89, 103);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(82, 24);
-            this.label1.TabIndex = 1;
-            this.label1.Text = "工单号";
-            // 
-            // label13
-            // 
-            this.label13.AutoSize = true;
-            this.label13.Location = new System.Drawing.Point(89, 258);
-            this.label13.Name = "label13";
-            this.label13.Size = new System.Drawing.Size(106, 24);
-            this.label13.TabIndex = 30;
-            this.label13.Text = "人员编号";
-            // 
-            // textBox5
-            // 
-            this.textBox5.Location = new System.Drawing.Point(210, 255);
-            this.textBox5.Name = "textBox5";
-            this.textBox5.Size = new System.Drawing.Size(243, 35);
-            this.textBox5.TabIndex = 29;
-            // 
             // button1
             // 
-            this.button1.Location = new System.Drawing.Point(241, 741);
+            this.button1.Location = new System.Drawing.Point(228, 115);
             this.button1.Name = "button1";
             this.button1.Size = new System.Drawing.Size(137, 48);
             this.button1.TabIndex = 32;
-            this.button1.Text = "保存";
+            this.button1.Text = "获取";
             this.button1.UseVisualStyleBackColor = true;
             // 
             // textBox2
@@ -92,27 +54,9 @@
             this.label5.AutoSize = true;
             this.label5.Location = new System.Drawing.Point(89, 33);
             this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(82, 24);
+            this.label5.Size = new System.Drawing.Size(106, 24);
             this.label5.TabIndex = 38;
-            this.label5.Text = "扫码框";
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(89, 160);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(106, 24);
-            this.label3.TabIndex = 3;
-            this.label3.Text = "产品编号";
-            // 
-            // label4
-            // 
-            this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(89, 210);
-            this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(106, 24);
-            this.label4.TabIndex = 4;
-            this.label4.Text = "产品名称";
+            this.label5.Text = "机台编号";
             // 
             // Form5
             // 
@@ -122,30 +66,17 @@
             this.Controls.Add(this.label5);
             this.Controls.Add(this.textBox2);
             this.Controls.Add(this.button1);
-            this.Controls.Add(this.label13);
-            this.Controls.Add(this.textBox5);
-            this.Controls.Add(this.label4);
-            this.Controls.Add(this.label3);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.textBox1);
             this.Name = "Form5";
             this.Text = "Form4";
             this.Load += new System.EventHandler(this.Form4_Load);
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
 
         #endregion
-
-        private System.Windows.Forms.TextBox textBox1;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.Label label13;
-        private System.Windows.Forms.TextBox textBox5;
         private System.Windows.Forms.Button button1;
         private System.Windows.Forms.TextBox textBox2;
         private System.Windows.Forms.Label label5;
-        private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.Label label4;
     }
 }

+ 1 - 1
FileWatcher/Program.cs

@@ -47,7 +47,7 @@ namespace FileWatcher
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                 {
                     //Application.Run(new AutoAnalysisDeviceKS());
-                    Application.Run(new AutoAnalysisXml());
+                    Application.Run(new AutoMakeQTYRZ());
                     //Application.Run(new AutoAnalysisXmlByStep());
                     //Application.Run(new SOP_PNE("", ""));
                     //Application.Run(new AutoMakeQTY());

+ 0 - 48
FileWatcher/UploadMakePlan.Designer.cs

@@ -41,10 +41,6 @@
             this.ImportExcel1 = new System.Windows.Forms.OpenFileDialog();
             this.Upload = new System.Windows.Forms.Button();
             this.ChooseFile = new System.Windows.Forms.Button();
-            this.label1 = new System.Windows.Forms.Label();
-            this.DateTime1 = new System.Windows.Forms.DateTimePicker();
-            this.label3 = new System.Windows.Forms.Label();
-            this.DateTime2 = new System.Windows.Forms.DateTimePicker();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             this.SuspendLayout();
             // 
@@ -125,51 +121,11 @@
             this.ChooseFile.UseVisualStyleBackColor = true;
             this.ChooseFile.Click += new System.EventHandler(this.ChooseFile_Click);
             // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(48, 128);
-            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(165, 41);
-            this.label1.TabIndex = 209;
-            this.label1.Text = "计划日期1";
-            // 
-            // DateTime1
-            // 
-            this.DateTime1.Location = new System.Drawing.Point(222, 133);
-            this.DateTime1.Name = "DateTime1";
-            this.DateTime1.Size = new System.Drawing.Size(200, 35);
-            this.DateTime1.TabIndex = 208;
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(48, 190);
-            this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(165, 41);
-            this.label3.TabIndex = 211;
-            this.label3.Text = "计划日期2";
-            // 
-            // DateTime2
-            // 
-            this.DateTime2.Location = new System.Drawing.Point(222, 195);
-            this.DateTime2.Name = "DateTime2";
-            this.DateTime2.Size = new System.Drawing.Size(200, 35);
-            this.DateTime2.TabIndex = 210;
-            // 
             // UploadMakePlan
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1498, 640);
-            this.Controls.Add(this.label3);
-            this.Controls.Add(this.DateTime2);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.DateTime1);
             this.Controls.Add(this.ChooseFile);
             this.Controls.Add(this.Upload);
             this.Controls.Add(this.label2);
@@ -202,10 +158,6 @@
         private System.Windows.Forms.OpenFileDialog ImportExcel1;
         private System.Windows.Forms.Button Upload;
         private System.Windows.Forms.Button ChooseFile;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.DateTimePicker DateTime1;
-        private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.DateTimePicker DateTime2;
     }
 }
 

+ 17 - 277
FileWatcher/UploadMakePlan.cs

@@ -6,6 +6,8 @@ using System.Text;
 using NPOI.SS.UserModel;
 using NPOI.XSSF.UserModel;
 using Oracle.ManagedDataAccess.Client;
+using System.Reflection.Emit;
+using Microsoft.Office.Interop.Excel;
 
 namespace FileWatcher
 {
@@ -40,7 +42,7 @@ namespace FileWatcher
             string todayDate = today.ToString("MMdd");
             string code = dh.GetSerialNumberByCaller("MakePlan");
             string id = "";
-            DataTable dt = (DataTable)dh.ExecuteSql("select mp_id from MakePlan where to_char(mp_begintime,'yyyymmdd')='" + today.ToString("yyyyMMdd") + "'", "select");
+            System.Data.DataTable dt = (System.Data.DataTable)dh.ExecuteSql("select mp_id from MakePlan where to_char(mp_begintime,'yyyymmdd')='" + today.ToString("yyyyMMdd") + "'", "select");
             if (dt.Rows.Count == 0)
             {
                 id = dh.GetSEQ("MakePlan_seq");
@@ -144,19 +146,19 @@ namespace FileWatcher
                                             return;
                                         }
                                         //销售订单+订单序号存在ERP中,才允许上传
-                                        if (dh.CheckExist("saledetail@ERP left join sale@ERP on sa_id=sd_said", "SD_DETNO='" + orderdetno + "' and sa_code='" + ordercode + "'"))
+                                        if (!dh.CheckExist("saledetail@ERP left join sale@ERP on sa_id=sd_said", "SD_DETNO='" + orderdetno + "' and sa_code='" + ordercode + "'"))
                                         {
                                             OperateResult.AppendText(" 序号'" + orderdetno + "' 销售订单'" + ordercode + "'不存在");
                                             return;
                                         }
-                                        if (dh.CheckExist("saledetail@ERP left join sale@ERP on sa_id=sd_said left join (select min(mpd_outqty)mpd_outqty, mpd_ordercode," +
-                                            " mpd_orderdetno  from(select sum(mpd_outqty)mpd_outqty, mpd_ordercode, mpd_orderdetnofrom MakePlanDetail  group by " +
-                                            "mpd_ordercode, mpd_orderdetno, MPD_WCCODE)group by mpd_ordercode, mpd_orderdetno) on sa_code = mpd_ordercode and sd_detno" +
-                                            " = mpd_orderdetno", "sd_qty<mpd_outqty+" + planqty + " and sa_code='" + ordercode + "' and sd_detno='" + orderdetno + "'"))
-                                        {
-                                            OperateResult.AppendText(" 序号'" + orderdetno + "' 销售订单'" + ordercode + "'累计排产数量超出");
-                                            return;
-                                        }
+                                        //if (dh.CheckExist("saledetail@ERP left join sale@ERP on sa_id=sd_said left join (select min(mpd_outqty)mpd_outqty, mpd_ordercode," +
+                                        //    " mpd_orderdetno  from(select sum(mpd_outqty)mpd_outqty, mpd_ordercode, mpd_orderdetno from MakePlanDetail  group by " +
+                                        //    "mpd_ordercode, mpd_orderdetno, MPD_WCCODE)group by mpd_ordercode, mpd_orderdetno) on sa_code = mpd_ordercode and sd_detno" +
+                                        //    " = mpd_orderdetno", "sd_qty<mpd_outqty+" + planqty + " and sa_code='" + ordercode + "' and sd_detno='" + orderdetno + "'"))
+                                        //{
+                                        //    OperateResult.AppendText(" 序号'" + orderdetno + "' 销售订单'" + ordercode + "'累计排产数量超出");
+                                        //    //return;
+                                        //}
                                         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))
                                         {
@@ -174,276 +176,14 @@ namespace FileWatcher
                         }
                         dh.ExecuteSql("delete from MakePlanDetail where mpd_orderdetno is null", "delete");
                         OperateResult.AppendText("计划上传成功");
+                        string Error = "";
+                        string[] param = new string[] { id, "0", Error };
+                        dh.CallProcedure("USER_PLANSPLIT_COMMIT", ref param);
+                        dh.CallProcedure("USER_PLANINSERT_WORK", ref param);
                     }
                 }
             }
-            //上传日期1
-            if (DateTime1.Value != DateTime.Value)
-            {
-                today = DateTime1.Value;
-                todayDate = today.ToString("MMdd");
-                code = dh.GetSerialNumberByCaller("MakePlan");
-                id = "";
-                dt = (DataTable)dh.ExecuteSql("select mp_id from MakePlan where to_char(mp_begintime,'yyyymmdd')='" + today.ToString("yyyyMMdd") + "'", "select");
-                if (dt.Rows.Count == 0)
-                {
-                    id = dh.GetSEQ("MakePlan_seq");
-                    dh.ExecuteSql("insert into MakePlan(MP_ID, MP_CODE, MP_KIND, MP_INDATE, MP_STATUS, MP_STATUSCODE, MP_BEGINTIME)" +
-                        "values(" + id + ",'" + code + "','日计划',sysdate,'在录入','ENTERING',to_date('" + today.ToString("yyyyMMdd") + "','yyyymmdd'))", "insert");
-                }
-                else
-                {
-                    id = dt.Rows[0]["mp_id"].ToString();
-                    dh.ExecuteSql("delete from MakePlandetail where mpd_mpid=" + id, "delete");
-                }
-
-                using (FileStream file = new FileStream(FilePath.Text, FileMode.Open, FileAccess.Read))
-                {
-                    XSSFWorkbook workbook = new XSSFWorkbook(file);
-                    int detno = 1;
-
-                    for (int i = 0; i < workbook.NumberOfSheets; i++)
-                    {
-                        ISheet sheet = workbook.GetSheetAt(i);
-                        string sheetName = sheet.SheetName;
-                        if (sheetName.Contains(todayDate))
-                        {
-                            OperateResult.AppendText(sheetName);
-                            OperateResult.AppendText($"Processing sheet: {sheetName}\n");
-                            //Console.WriteLine($"Processing sheet: {sheetName}");
-
-                            // 获取标题行(第4行)
-                            IRow headerRow = sheet.GetRow(3); // 第4行索引为3
-                            if (headerRow == null)
-                            {
-                                Console.WriteLine("Header row not found.");
-                                continue;
-                            }
-
-                            // 获取标题列的索引
-                            int wccodeIndex = -1;
-                            int orderdetnoIndex = -1;
-                            int ordercodeIndex = -1;
-                            int planqtyIndex = -1;
-                            int remarkIndex = -1;
-
-                            for (int colIndex = 0; colIndex < headerRow.LastCellNum; colIndex++)
-                            {
-                                ICell cell = headerRow.GetCell(colIndex);
-                                if (cell != null)
-                                {
-                                    string headerValue = cell.ToString().Trim().Replace("\r\n", "").Replace("\n", "").Replace("\r", "");
-                                    if (headerValue == "工作中心")
-                                    {
-                                        wccodeIndex = colIndex;
-                                    }
-                                    else if (headerValue == "订单序号")
-                                    {
-                                        orderdetnoIndex = colIndex;
-                                    }
-                                    else if (headerValue == "订单编号")
-                                    {
-                                        ordercodeIndex = colIndex;
-                                    }
-                                    else if (headerValue == "计划数量")
-                                    {
-                                        planqtyIndex = colIndex;
-                                    }
-                                    else if (headerValue.Contains("备注") && !headerValue.Contains("生产异常备注"))
-                                    {
-                                        remarkIndex = colIndex;
-                                    }
-                                }
-                            }
-
-                            if (wccodeIndex == -1 || orderdetnoIndex == -1 || ordercodeIndex == -1 || planqtyIndex == -1 || remarkIndex == -1)
-                            {
-                                Console.WriteLine("Required columns not found in the header.");
-                                continue;
-                            }
-
-                            using (OracleConnection conn = new OracleConnection(connectionString))
-                            {
-                                conn.Open();
-                                for (int rowIndex = 4; rowIndex <= sheet.LastRowNum; rowIndex++) // 从第5行开始解析数据
-                                {
-                                    IRow row = sheet.GetRow(rowIndex);
-                                    if (row != null)
-                                    {
-                                        string wccode = row.GetCell(wccodeIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).StringCellValue.ToString();
-                                        if (wccode == "")
-                                        {
-                                            continue;
-                                        }
-                                        string orderdetno = row.GetCell(orderdetnoIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
-                                        string ordercode = row.GetCell(ordercodeIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
-                                        string planqty = row.GetCell(planqtyIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).NumericCellValue.ToString();
-                                        string remark = row.GetCell(remarkIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
-                                        if (!string.IsNullOrEmpty(wccode) && !string.IsNullOrEmpty(orderdetno) && !string.IsNullOrEmpty(ordercode))
-                                        {
-                                            string day = today.ToString("yyyy-MM-dd");
-                                            if (!dh.CheckExist("MakePlanDetail left join makeplan on mpd_mpid=mp_id ", "trunc(mp_begintime)=to_date('" + day + "','yyyy-mm-dd') and mpd_orderdetno='" + orderdetno + "' and mpd_ordercode='" + ordercode + "' and mpd_wccode='" + wccode + "'"))
-                                            {
-                                                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));
-                                                    cmd.Parameters.Add(new OracleParameter(":2", orderdetno));
-                                                    cmd.Parameters.Add(new OracleParameter(":3", ordercode));
-                                                    cmd.Parameters.Add(new OracleParameter(":4", planqty));
-                                                    cmd.Parameters.Add(new OracleParameter(":5", remark));
-                                                    cmd.ExecuteNonQuery();
-                                                }
-                                            }
-                                            else
-                                            {
-                                                OperateResult.AppendText(" 序号'" + orderdetno + "' 销售订单'" + ordercode + "' 工作中心'" + wccode + "' 重复");
-                                            }
-                                        }
-                                    }
-                                    detno = detno + 1;
-                                }
-                            }
-                            dh.ExecuteSql("delete from MakePlanDetail where mpd_orderdetno is null", "delete");
-                            OperateResult.AppendText("计划上传成功");
-                        }
-                    }
-                }
-            }
-
-            //上传日期2
-            if (DateTime2.Value != DateTime1.Value && DateTime2.Value != DateTime.Value)
-            {
-                today = DateTime2.Value;
-                todayDate = today.ToString("MMdd");
-                code = dh.GetSerialNumberByCaller("MakePlan");
-                id = "";
-                dt = (DataTable)dh.ExecuteSql("select mp_id from MakePlan where to_char(mp_begintime,'yyyymmdd')='" + today.ToString("yyyyMMdd") + "'", "select");
-                if (dt.Rows.Count == 0)
-                {
-                    id = dh.GetSEQ("MakePlan_seq");
-                    dh.ExecuteSql("insert into MakePlan(MP_ID, MP_CODE, MP_KIND, MP_INDATE, MP_STATUS, MP_STATUSCODE, MP_BEGINTIME)" +
-                        "values(" + id + ",'" + code + "','日计划',sysdate,'在录入','ENTERING',to_date('" + today.ToString("yyyyMMdd") + "','yyyymmdd'))", "insert");
-                }
-                else
-                {
-                    id = dt.Rows[0]["mp_id"].ToString();
-                    dh.ExecuteSql("delete from MakePlandetail where mpd_mpid=" + id, "delete");
-                }
-
-                using (FileStream file = new FileStream(FilePath.Text, FileMode.Open, FileAccess.Read))
-                {
-                    XSSFWorkbook workbook = new XSSFWorkbook(file);
-                    int detno = 1;
-
-                    for (int i = 0; i < workbook.NumberOfSheets; i++)
-                    {
-                        ISheet sheet = workbook.GetSheetAt(i);
-                        string sheetName = sheet.SheetName;
-                        if (sheetName.Contains(todayDate))
-                        {
-                            OperateResult.AppendText(sheetName);
-                            OperateResult.AppendText($"Processing sheet: {sheetName}\n");
-                            //Console.WriteLine($"Processing sheet: {sheetName}");
-
-                            // 获取标题行(第4行)
-                            IRow headerRow = sheet.GetRow(3); // 第4行索引为3
-                            if (headerRow == null)
-                            {
-                                Console.WriteLine("Header row not found.");
-                                continue;
-                            }
-
-                            // 获取标题列的索引
-                            int wccodeIndex = -1;
-                            int orderdetnoIndex = -1;
-                            int ordercodeIndex = -1;
-                            int planqtyIndex = -1;
-                            int remarkIndex = -1;
-
-                            for (int colIndex = 0; colIndex < headerRow.LastCellNum; colIndex++)
-                            {
-                                ICell cell = headerRow.GetCell(colIndex);
-                                if (cell != null)
-                                {
-                                    string headerValue = cell.ToString().Trim().Replace("\r\n", "").Replace("\n", "").Replace("\r", "");
-                                    if (headerValue == "工作中心")
-                                    {
-                                        wccodeIndex = colIndex;
-                                    }
-                                    else if (headerValue == "订单序号")
-                                    {
-                                        orderdetnoIndex = colIndex;
-                                    }
-                                    else if (headerValue == "订单编号")
-                                    {
-                                        ordercodeIndex = colIndex;
-                                    }
-                                    else if (headerValue == "计划数量")
-                                    {
-                                        planqtyIndex = colIndex;
-                                    }
-                                    else if (headerValue.Contains("备注") && !headerValue.Contains("生产异常备注"))
-                                    {
-                                        remarkIndex = colIndex;
-                                    }
-                                }
-                            }
-
-                            if (wccodeIndex == -1 || orderdetnoIndex == -1 || ordercodeIndex == -1 || planqtyIndex == -1 || remarkIndex == -1)
-                            {
-                                Console.WriteLine("Required columns not found in the header.");
-                                continue;
-                            }
-
-                            using (OracleConnection conn = new OracleConnection(connectionString))
-                            {
-                                conn.Open();
-                                for (int rowIndex = 4; rowIndex <= sheet.LastRowNum; rowIndex++) // 从第5行开始解析数据
-                                {
-                                    IRow row = sheet.GetRow(rowIndex);
-                                    if (row != null)
-                                    {
-                                        string wccode = row.GetCell(wccodeIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).StringCellValue.ToString();
-                                        if (wccode == "")
-                                        {
-                                            continue;
-                                        }
-                                        string orderdetno = row.GetCell(orderdetnoIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
-                                        string ordercode = row.GetCell(ordercodeIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
-                                        string planqty = row.GetCell(planqtyIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).NumericCellValue.ToString();
-                                        string remark = row.GetCell(remarkIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
-                                        if (!string.IsNullOrEmpty(wccode) && !string.IsNullOrEmpty(orderdetno) && !string.IsNullOrEmpty(ordercode))
-                                        {
-                                            string day = today.ToString("yyyy-MM-dd");
-                                            if (!dh.CheckExist("MakePlanDetail left join makeplan on mpd_mpid=mp_id ", "trunc(mp_begintime)=to_date('" + day + "','yyyy-mm-dd') and mpd_orderdetno='" + orderdetno + "' and mpd_ordercode='" + ordercode + "' and mpd_wccode='" + wccode + "'"))
-                                            {
-                                                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));
-                                                    cmd.Parameters.Add(new OracleParameter(":2", orderdetno));
-                                                    cmd.Parameters.Add(new OracleParameter(":3", ordercode));
-                                                    cmd.Parameters.Add(new OracleParameter(":4", planqty));
-                                                    cmd.Parameters.Add(new OracleParameter(":5", remark));
-                                                    cmd.ExecuteNonQuery();
-                                                }
-                                            }
-                                            else
-                                            {
-                                                OperateResult.AppendText(" 序号'" + orderdetno + "' 销售订单'" + ordercode + "' 工作中心'" + wccode + "' 重复");
-                                            }
-                                        }
-                                    }
-                                    detno = detno + 1;
-                                }
-                            }
-                            dh.ExecuteSql("delete from MakePlanDetail where mpd_orderdetno is null", "delete");
-                            OperateResult.AppendText("计划上传成功");
-                        }
-                    }
-                }
-            }
+          
         }
 
         private void ChooseFile_Click(object sender, EventArgs e)

+ 4 - 5
FileWatcher/ftpOperater.cs

@@ -19,11 +19,13 @@ namespace FileWatcher
         private string ftpUser;
         private string ftpPwd;
 
+        FtpWebRequest reqFTP;
+
         public ftpOperater()
         {
             //string[] FTPInf = "ftp://172.16.51.3|vsftpd|vsftpd3cd79014ef".Split('|');
             //次元FTP
-            string[] FTPInf = "ftp://113.98.196.181:8098|vsftpd|Az789***".Split('|');
+            string[] FTPInf = "ftp://113.98.196.181:8097|vsftpd|Az789***".Split('|');
             this.ftpServerIP = FTPInf[0];
             this.ftpUser = FTPInf[1];
             this.ftpPwd = FTPInf[2];
@@ -78,17 +80,14 @@ namespace FileWatcher
                         fs.Close();
                         fs.Dispose();
                     }
-                    file.Delete();
+                    //file.Delete();
                 }
-             
-                //Thread.Sleep(1000);
             }
             catch (Exception ex)
             {
                 return ex.Message;
             }
             return "";
-            //File.Delete(filepath + "/" + filename);
         }
 
         private static void BeginWriteCallBack(IAsyncResult ar)