Hcsy %!s(int64=8) %!d(string=hai) anos
pai
achega
355e0c99f2

+ 2 - 3
UAS-MES/DataOperate/DataHelper.cs

@@ -819,7 +819,7 @@ namespace UAS_MES.DataOperate
         /// </summary>
         /// <param name="sql"></param>
         /// <param name="names"></param>
-        public int BatchInsert(string sql, params object[][] names)
+        public void BatchInsert(string sql, params object[][] names)
         {
             command = new OracleCommand(sql, connection);
             Reconnect(command);
@@ -831,9 +831,8 @@ namespace UAS_MES.DataOperate
             {
                 command.Parameters.Add(new OracleParameter(names[0][i - 1].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
             }
-            int count= command.ExecuteNonQuery();
+            command.ExecuteNonQuery();
             command.Dispose();
-            return count;
         }
 
         public void BatchInsertDataTable(string sql, string[] param, params object[][] param1)

+ 6 - 14
UAS-MES/FunctionCode/Make/Make_CollectBTMAC.cs

@@ -63,14 +63,7 @@ namespace UAS_MES.Make
 
         private void deleteButton1_Click(object sender, EventArgs e)
         {
-            macode = "";
-            ms_bt = "";
-            isBT = false;
-            isMAC = false;
-            BaseUtil.CleanForm(this);
-            mcd_okqty.Text = printcount + "";
-            OperateResult.AppendText(">>清空数据,输入SN\n", Color.Green);
-            sncode.Focus();
+
         }
 
         private void sncode_KeyDown(object sender, KeyEventArgs e)
@@ -132,7 +125,6 @@ namespace UAS_MES.Make
                         }
                         else
                         {
-                            sncode.Text = "";
                             OperateResult.AppendText("错误" + ErrorMessage2 + "\n", Color.Red);
                         }
 
@@ -152,7 +144,6 @@ namespace UAS_MES.Make
                         ms_bt = dh.getFieldDataByCondition("makeserial", "ms_bt", "ms_id = '" + oMsID + "'").ToString();
                         if (sncode.Text == ms_bt)
                         {
-                            sncode.Text = "";
                             OperateResult.AppendText(">>BT错误,重复\n", Color.Red);
                             OperateResult.AppendText(">>请输入BT\n", Color.Green);
                             return;
@@ -160,12 +151,14 @@ namespace UAS_MES.Make
                         else
                         {
                             ms_bt = sncode.Text;
-                            ErrorMessage = "BT采集完成,请输入MAC";
+                            ErrorMessage = "工单" + sncode.Text + "BT采集完成>>>请输入SN";
                             OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Green);
-                            sncode.Text = "";
                             isBT = false;
                             isMAC = true;
+                            ErrorMessage = ">>>请输入SN";
+                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Green);
                         }
+
                     }
                 }
                 else
@@ -183,7 +176,6 @@ namespace UAS_MES.Make
                     ms_mac = dh.getFieldDataByCondition("makeserial", "ms_mac", "ms_id = '" + oMsID + "'").ToString();
                     if (sncode.Text == ms_mac)
                     {
-                        sncode.Text = "";
                         OperateResult.AppendText(">>MAC错误,重复\n", Color.Red);
                         OperateResult.AppendText(">>请输入MAC\n", Color.Green);
                         return;
@@ -193,7 +185,7 @@ namespace UAS_MES.Make
                         if (LogicHandler.UpdateMakeMessage(sn_code, ms_makecode.Text, "BT/MAC采集", User.UserSourceCode, User.UserCode, "采集完成", out ErrorMessage))
                         {
                             dh.UpdateByCondition("makeserial", "ms_mac = '" + sncode.Text + "' ," + "ms_bt = '" + ms_bt + "'", "ms_id = '" + oMsID + "'");
-                            ErrorMessage = "MAC采集完成,执行更新";
+                            ErrorMessage = "BT/MAC采集完成,执行更新";
                             OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Green);
                             BaseUtil.CleanForm(this);
                             printcount++;

+ 2 - 13
UAS-MES/FunctionCode/Make/Make_CollectNetCode.cs

@@ -98,7 +98,6 @@ namespace UAS_MES.Make
                         }
                     }
                     else {
-                        sncode.Text = "";
                         OperateResult.AppendText("错误" + ErrorMessage2 + "\n", Color.Red);
                     }
                 }
@@ -121,7 +120,6 @@ namespace UAS_MES.Make
                         return;
                     }
                     else if (sncode.Text == net_code) {
-                        sncode.Text = "";
                         OperateResult.AppendText(">>网标错误,重复\n", Color.Red);
                         OperateResult.AppendText(">>请输入网标\n", Color.Green);
                         return;
@@ -162,20 +160,11 @@ namespace UAS_MES.Make
 
         private void deleteButton1_Click(object sender, EventArgs e)
         {
-            if (isnetcode)
-            { 
+            if (isnetcode) {
                 BaseUtil.CleanForm(this);
-                mcd_remainqty.Text = 0 + "";
+                mcd_remainqty.Text = 0+ "";
                 OperateResult.AppendText(">>清除完成,清重新输入SN号\n", Color.Green);
-                mcd_okqty.Text = printcount + "";
                 isnetcode = false;
-                sncode.Focus();
-            }
-            else {
-                BaseUtil.CleanForm(this);
-                mcd_okqty.Text = printcount + "";
-                OperateResult.AppendText(">>输入SN\n", Color.Green);
-                sncode.Focus();
             }
         }
     }

+ 20 - 22
UAS-MES/FunctionCode/Make/Make_ColorBoxLabelPrint.cs

@@ -34,15 +34,11 @@ namespace UAS_MES.Make
         string sn_code;
         //当前提示的索引
         int RemainIndex = 0;
-        //消息提示
-        string ErrorMessage;
         ApplicationClass lbl;
-
         public Make_ColorBoxLabelPrint()
         {
             InitializeComponent();
         }
-
         private void Make_ColorBoxLabelPrint_Load(object sender, EventArgs e)
         {
             dh = new DataHelper();
@@ -50,7 +46,6 @@ namespace UAS_MES.Make
             sncode.Focus();
             asc.controllInitializeSize(this);
         }
-
         private void sn_code_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)
@@ -61,12 +56,15 @@ namespace UAS_MES.Make
                     return;
                 }
                 string oMsID;
-
+                string ErrorMessage2;
                 string oMakeCode;
                 // 获取工单归属工单下一工序是否正确
-                if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
-                {    
+                if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage2))
+                {
+                    if (LogicHandler.GetMakeInfo(sncode.Text, out macode, out ErrorMessage2))
+                    {
                         //判断如果该序列号的归属工单和之前查询的是一致的话,就不进行重复数据的查询
+                      //  macode = dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_sncode='" + sncode.Text + "'").ToString();
                         if (ma_code.Text != macode || macode == "")
                         {
                             //ma_code不为空的时候表示不是第一次加载,提示用户切换工单
@@ -83,10 +81,6 @@ namespace UAS_MES.Make
                         if (dt.Rows.Count > 0)
                         {
                             BaseUtil.SetFormValue(this.Controls, dt);
-                            //提示用户“<<工单号:取ma_makecode”
-                            OperateResult.AppendText("<<工单号:" + ma_code.Text + "\n", Color.Green);
-                            //提示用户“<< 序列号:XXXX”
-                            OperateResult.AppendText("<<序列号:" + sncode.Text + "\n", Color.Green);
                             sn_code = sncode.Text;
                         }
                         else
@@ -94,6 +88,7 @@ namespace UAS_MES.Make
                             OperateResult.AppendText(">>序列号" + sncode.Text + "没有对应工序\n", Color.Red);
 
                         }
+                        string ErrorMessage = "";
                         string result = "";
                         if (int.Parse(mcd_remainqty.Text) <= 0)
                         {
@@ -110,11 +105,11 @@ namespace UAS_MES.Make
                                 Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ma_code.Text, int.Parse(PrintNum.Text));
                                 if (LogicHandler.UpdateMakeMessage(sncode.Text, ma_code.Text, "彩盒打印", User.UserSourceCode, User.UserCode, "彩盒打印成功", out ErrorMessage))
                                 {
-                                    OperateResult.AppendText(">>打印完成, 执行更新\n", Color.Green);
+                                    ErrorMessage = "打印完成,执行更新";
+                                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Green);
                                     mcd_okqty.Text = int.Parse(mcd_okqty.Text) + 1 + "";
                                     mcd_remainqty.Text = int.Parse(mcd_remainqty.Text) - 1 + "";
                                     sncode.Text = "";
-                                    sncode.Focus();
                                 }
                                 else
                                 {
@@ -123,14 +118,21 @@ namespace UAS_MES.Make
                             }
                             else
                             {
-                                OperateResult.AppendText(">>该序列号对应的产品未维护(彩盒)标签模板或打印张数没有选择\n", Color.Red);
+                                ErrorMessage = "该序列号对应的产品未维护(彩盒)标签模板或打印张数没有选择";
+                                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                 return;
                             }
-                            OperateResult.AppendText(">>请输入SN\n", Color.Green);
-                        }         
+                            ErrorMessage = ">>>请输入SN";
+                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Green);
+                        }
+                    }
+                    else
+                    {
+                        OperateResult.AppendText("错误" + ErrorMessage2 + "\n", Color.Red);
+                    }
                 }
                 else {
-                    OperateResult.AppendText( ErrorMessage + "\n", Color.Red);
+                    OperateResult.AppendText("错误" + ErrorMessage2 + "\n", Color.Red);
                 }
             }
         }
@@ -147,21 +149,17 @@ namespace UAS_MES.Make
                 ftp.Download(dt.Rows[i]["pl_labelname"].ToString());
             }
         }
-
         private void Make_ColorBoxLabelPrint_Activated(object sender, EventArgs e)
         {
             sncode.Focus();
         }
-
         private void Make_ColorBoxLabelPrint_FormClosing(object sender, FormClosingEventArgs e)
         {
             lbl.Quit();
         }
-
         private void Make_ColorBoxLabelPrint_SizeChanged(object sender, EventArgs e)
         {
             asc.controlAutoSize(this);
         }
-
     }
 }

+ 60 - 66
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.Designer.cs

@@ -58,10 +58,9 @@
             // 
             this.ms_makecode_label.AutoSize = true;
             this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode_label.Location = new System.Drawing.Point(50, 62);
-            this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ms_makecode_label.Location = new System.Drawing.Point(33, 41);
             this.ms_makecode_label.Name = "ms_makecode_label";
-            this.ms_makecode_label.Size = new System.Drawing.Size(110, 31);
+            this.ms_makecode_label.Size = new System.Drawing.Size(74, 21);
             this.ms_makecode_label.TabIndex = 125;
             this.ms_makecode_label.Text = "归属工单";
             // 
@@ -69,10 +68,9 @@
             // 
             this.pr_code_label.AutoSize = true;
             this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code_label.Location = new System.Drawing.Point(378, 62);
-            this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pr_code_label.Location = new System.Drawing.Point(252, 41);
             this.pr_code_label.Name = "pr_code_label";
-            this.pr_code_label.Size = new System.Drawing.Size(110, 31);
+            this.pr_code_label.Size = new System.Drawing.Size(74, 21);
             this.pr_code_label.TabIndex = 126;
             this.pr_code_label.Text = "产品编号";
             // 
@@ -80,10 +78,9 @@
             // 
             this.mcd_okqty_label.AutoSize = true;
             this.mcd_okqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_okqty_label.Location = new System.Drawing.Point(378, 130);
-            this.mcd_okqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.mcd_okqty_label.Location = new System.Drawing.Point(252, 87);
             this.mcd_okqty_label.Name = "mcd_okqty_label";
-            this.mcd_okqty_label.Size = new System.Drawing.Size(110, 31);
+            this.mcd_okqty_label.Size = new System.Drawing.Size(74, 21);
             this.mcd_okqty_label.TabIndex = 127;
             this.mcd_okqty_label.Text = "打印计数";
             // 
@@ -91,10 +88,9 @@
             // 
             this.mcd_remainqty_label.AutoSize = true;
             this.mcd_remainqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_remainqty_label.Location = new System.Drawing.Point(706, 130);
-            this.mcd_remainqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.mcd_remainqty_label.Location = new System.Drawing.Point(471, 87);
             this.mcd_remainqty_label.Name = "mcd_remainqty_label";
-            this.mcd_remainqty_label.Size = new System.Drawing.Size(86, 31);
+            this.mcd_remainqty_label.Size = new System.Drawing.Size(58, 21);
             this.mcd_remainqty_label.TabIndex = 128;
             this.mcd_remainqty_label.Text = "剩余数";
             // 
@@ -102,10 +98,9 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(1121, 222);
-            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label4.Location = new System.Drawing.Point(747, 148);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(110, 31);
+            this.label4.Size = new System.Drawing.Size(74, 21);
             this.label4.TabIndex = 129;
             this.label4.Text = "打印张数";
             // 
@@ -115,10 +110,9 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.sncode_label.AutoSize = true;
             this.sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sncode_label.Location = new System.Drawing.Point(50, 128);
-            this.sncode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.sncode_label.Location = new System.Drawing.Point(33, 85);
             this.sncode_label.Name = "sncode_label";
-            this.sncode_label.Size = new System.Drawing.Size(86, 31);
+            this.sncode_label.Size = new System.Drawing.Size(58, 21);
             this.sncode_label.TabIndex = 145;
             this.sncode_label.Text = "序列号";
             // 
@@ -126,10 +120,9 @@
             // 
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(706, 62);
-            this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pr_detail_label.Location = new System.Drawing.Point(471, 41);
             this.pr_detail_label.Name = "pr_detail_label";
-            this.pr_detail_label.Size = new System.Drawing.Size(110, 31);
+            this.pr_detail_label.Size = new System.Drawing.Size(74, 21);
             this.pr_detail_label.TabIndex = 146;
             this.pr_detail_label.Text = "产品名称";
             // 
@@ -137,10 +130,9 @@
             // 
             this.sncode.AutoSize = true;
             this.sncode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sncode.Location = new System.Drawing.Point(1118, 135);
-            this.sncode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.sncode.Location = new System.Drawing.Point(745, 90);
             this.sncode.Name = "sncode";
-            this.sncode.Size = new System.Drawing.Size(62, 31);
+            this.sncode.Size = new System.Drawing.Size(42, 21);
             this.sncode.TabIndex = 160;
             this.sncode.Text = "标签";
             // 
@@ -148,10 +140,9 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(1118, 58);
-            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Location = new System.Drawing.Point(745, 39);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(86, 31);
+            this.label2.Size = new System.Drawing.Size(58, 21);
             this.label2.TabIndex = 161;
             this.label2.Text = "打印机";
             // 
@@ -159,27 +150,27 @@
             // 
             this.PrintLabel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.PrintLabel.FormattingEnabled = true;
-            this.PrintLabel.Location = new System.Drawing.Point(1233, 135);
+            this.PrintLabel.Location = new System.Drawing.Point(822, 90);
+            this.PrintLabel.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.PrintLabel.Name = "PrintLabel";
-            this.PrintLabel.Size = new System.Drawing.Size(226, 26);
+            this.PrintLabel.Size = new System.Drawing.Size(152, 20);
             this.PrintLabel.TabIndex = 162;
             // 
             // Printer
             // 
-            this.Printer.Location = new System.Drawing.Point(1233, 58);
-            this.Printer.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.Printer.Location = new System.Drawing.Point(822, 39);
+            this.Printer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Printer.Name = "Printer";
-            this.Printer.Size = new System.Drawing.Size(228, 38);
+            this.Printer.Size = new System.Drawing.Size(152, 25);
             this.Printer.TabIndex = 159;
             // 
             // mcd_remainqty
             // 
             this.mcd_remainqty.AutoSize = true;
             this.mcd_remainqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_remainqty.Location = new System.Drawing.Point(848, 130);
-            this.mcd_remainqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.mcd_remainqty.Location = new System.Drawing.Point(565, 87);
             this.mcd_remainqty.Name = "mcd_remainqty";
-            this.mcd_remainqty.Size = new System.Drawing.Size(28, 31);
+            this.mcd_remainqty.Size = new System.Drawing.Size(19, 21);
             this.mcd_remainqty.TabIndex = 158;
             this.mcd_remainqty.Text = "0";
             // 
@@ -187,10 +178,9 @@
             // 
             this.mcd_okqty.AutoSize = true;
             this.mcd_okqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_okqty.Location = new System.Drawing.Point(518, 130);
-            this.mcd_okqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.mcd_okqty.Location = new System.Drawing.Point(345, 87);
             this.mcd_okqty.Name = "mcd_okqty";
-            this.mcd_okqty.Size = new System.Drawing.Size(28, 31);
+            this.mcd_okqty.Size = new System.Drawing.Size(19, 21);
             this.mcd_okqty.TabIndex = 157;
             this.mcd_okqty.Text = "0";
             // 
@@ -198,10 +188,9 @@
             // 
             this.pr_code.AutoSize = true;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code.Location = new System.Drawing.Point(520, 62);
-            this.pr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pr_code.Location = new System.Drawing.Point(347, 41);
             this.pr_code.Name = "pr_code";
-            this.pr_code.Size = new System.Drawing.Size(0, 31);
+            this.pr_code.Size = new System.Drawing.Size(0, 21);
             this.pr_code.TabIndex = 156;
             this.pr_code.TextChanged += new System.EventHandler(this.pr_code_TextChanged);
             // 
@@ -209,20 +198,18 @@
             // 
             this.pr_detail.AutoSize = true;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(852, 62);
-            this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pr_detail.Location = new System.Drawing.Point(568, 41);
             this.pr_detail.Name = "pr_detail";
-            this.pr_detail.Size = new System.Drawing.Size(0, 31);
+            this.pr_detail.Size = new System.Drawing.Size(0, 21);
             this.pr_detail.TabIndex = 154;
             // 
             // ms_makecode
             // 
             this.ms_makecode.AutoSize = true;
             this.ms_makecode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode.Location = new System.Drawing.Point(190, 62);
-            this.ms_makecode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ms_makecode.Location = new System.Drawing.Point(127, 41);
             this.ms_makecode.Name = "ms_makecode";
-            this.ms_makecode.Size = new System.Drawing.Size(0, 31);
+            this.ms_makecode.Size = new System.Drawing.Size(0, 21);
             this.ms_makecode.TabIndex = 152;
             // 
             // PrintNum
@@ -230,12 +217,11 @@
             this.PrintNum.AllPower = null;
             this.PrintNum.BackColor = System.Drawing.Color.White;
             this.PrintNum.ID = null;
-            this.PrintNum.Location = new System.Drawing.Point(1264, 222);
-            this.PrintNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.PrintNum.Location = new System.Drawing.Point(822, 148);
             this.PrintNum.Name = "PrintNum";
             this.PrintNum.Negative = false;
             this.PrintNum.Power = null;
-            this.PrintNum.Size = new System.Drawing.Size(197, 28);
+            this.PrintNum.Size = new System.Drawing.Size(154, 21);
             this.PrintNum.Str = null;
             this.PrintNum.Str1 = null;
             this.PrintNum.Str2 = null;
@@ -244,10 +230,9 @@
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OperateResult.Location = new System.Drawing.Point(56, 195);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.OperateResult.Location = new System.Drawing.Point(37, 130);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(1057, 456);
+            this.OperateResult.Size = new System.Drawing.Size(691, 305);
             this.OperateResult.TabIndex = 143;
             this.OperateResult.Text = "";
             // 
@@ -255,17 +240,21 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label3.Location = new System.Drawing.Point(174, 128);
+            this.label3.Location = new System.Drawing.Point(127, 85);
+            this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(0, 31);
+            this.label3.Size = new System.Drawing.Size(0, 21);
             this.label3.TabIndex = 163;
             // 
             // load
             // 
             this.load.AutoSize = true;
-            this.load.Location = new System.Drawing.Point(72, 679);
+            this.load.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.load.ForeColor = System.Drawing.Color.Blue;
+            this.load.Location = new System.Drawing.Point(37, 447);
+            this.load.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.load.Name = "load";
-            this.load.Size = new System.Drawing.Size(69, 22);
+            this.load.Size = new System.Drawing.Size(60, 25);
             this.load.TabIndex = 164;
             this.load.TabStop = true;
             this.load.Text = "上料";
@@ -274,9 +263,12 @@
             // unload
             // 
             this.unload.AutoSize = true;
-            this.unload.Location = new System.Drawing.Point(247, 679);
+            this.unload.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.unload.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+            this.unload.Location = new System.Drawing.Point(140, 447);
+            this.unload.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.unload.Name = "unload";
-            this.unload.Size = new System.Drawing.Size(69, 22);
+            this.unload.Size = new System.Drawing.Size(60, 25);
             this.unload.TabIndex = 165;
             this.unload.TabStop = true;
             this.unload.Text = "下料";
@@ -287,10 +279,11 @@
             this.code.AllPower = null;
             this.code.BackColor = System.Drawing.Color.White;
             this.code.ID = null;
-            this.code.Location = new System.Drawing.Point(566, 678);
+            this.code.Location = new System.Drawing.Point(339, 450);
+            this.code.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.code.Name = "code";
             this.code.Power = null;
-            this.code.Size = new System.Drawing.Size(196, 28);
+            this.code.Size = new System.Drawing.Size(132, 21);
             this.code.Str = null;
             this.code.Str1 = null;
             this.code.Str2 = null;
@@ -299,17 +292,19 @@
             // code_label
             // 
             this.code_label.AutoSize = true;
-            this.code_label.Location = new System.Drawing.Point(458, 683);
+            this.code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.code_label.Location = new System.Drawing.Point(268, 448);
+            this.code_label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.code_label.Name = "code_label";
-            this.code_label.Size = new System.Drawing.Size(62, 18);
+            this.code_label.Size = new System.Drawing.Size(58, 21);
             this.code_label.TabIndex = 167;
             this.code_label.Text = "录入框";
             // 
             // Make_ColorBoxLoadPrint
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1518, 724);
+            this.ClientSize = new System.Drawing.Size(1012, 483);
             this.Controls.Add(this.code_label);
             this.Controls.Add(this.code);
             this.Controls.Add(this.unload);
@@ -334,7 +329,6 @@
             this.Controls.Add(this.pr_code_label);
             this.Controls.Add(this.ms_makecode_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Name = "Make_ColorBoxLoadPrint";
             this.Tag = "Make!ColorBoxLoadPrint";
             this.Text = "标签打印";

+ 6 - 6
UAS-MES/FunctionCode/Make/Make_ColorBoxWeigh.Designer.cs

@@ -662,17 +662,17 @@
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.彩盒称重_FormClosing);
             this.Load += new System.EventHandler(this.彩盒上料打印_Load);
             this.SizeChanged += new System.EventHandler(this.彩盒称重_SizeChanged);
-            this.panel6.ResumeLayout(false);
+            this.panel6.ResumeLayout(true);
             this.panel6.PerformLayout();
-            this.panel4.ResumeLayout(false);
+            this.panel4.ResumeLayout(true);
             this.panel4.PerformLayout();
-            this.panel3.ResumeLayout(false);
+            this.panel3.ResumeLayout(true);
             this.panel3.PerformLayout();
-            this.panel2.ResumeLayout(false);
+            this.panel2.ResumeLayout(true);
             this.panel2.PerformLayout();
-            this.panel1.ResumeLayout(false);
+            this.panel1.ResumeLayout(true);
             this.panel1.PerformLayout();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 4 - 2
UAS-MES/FunctionCode/Make/Make_FuselageLabelPrint.cs

@@ -7,6 +7,7 @@ using UAS_MES.DataOperate;
 using UAS_MES.PublicMethod;
 using UAS_MES.Entity;
 using LabelManager2;
+using System.IO;
 
 namespace UAS_MES.Make
 {
@@ -151,7 +152,7 @@ namespace UAS_MES.Make
         }
         private void pr_code_TextChanged(object sender, EventArgs e)
         {
-            dt = (DataTable)dh.ExecuteSql("select pl_labelname,pl_labelcode from productlabel where pl_prodcode='" + ma_prodcode.Text + "'and PL_LABELTYPE='机身标' order by pl_isdefault desc", "select");
+            dt = (DataTable)dh.ExecuteSql("select pl_labelname,pl_labelcode,to_char(nvl(pl_indate,sysdate),'YYYY-MM-DD HH24:Mi:SS') pl_indate,pl_labelurl from productlabel where pl_prodcode='" + ma_prodcode.Text + "'and PL_LABELTYPE='机身标' order by pl_isdefault desc", "select");
             if (dt.Rows.Count == 0)
             {
                 OperateResult.AppendText(">>该序列号对应的产品未维护机身标标签模板\n", Color.Red);
@@ -162,7 +163,8 @@ namespace UAS_MES.Make
             ftpOperater ftp = new ftpOperater();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
-                ftp.Download(dt.Rows[i]["pl_labelname"].ToString());
+                //ftp.Download(dt.Rows[i]["pl_labelname"].ToString());
+                BaseUtil.GetPrintLabel(dt.Rows[i]["pl_labelname"].ToString(), dt.Rows[i]["pl_labelurl"].ToString(), dt.Rows[i]["pl_indate"].ToString());
             }
         }
 

+ 1 - 2
UAS-MES/FunctionCode/Make/Make_NewBadCode.Designer.cs

@@ -214,7 +214,7 @@
             this.badgroup.Location = new System.Drawing.Point(123, 134);
             this.badgroup.Margin = new System.Windows.Forms.Padding(2);
             this.badgroup.Name = "badgroup";
-            this.badgroup.Size = new System.Drawing.Size(226, 20);
+            this.badgroup.Size = new System.Drawing.Size(153, 20);
             this.badgroup.TabIndex = 95;
             this.badgroup.SelectedIndexChanged += new System.EventHandler(this.badgroup_SelectedIndexChanged);
             // 
@@ -359,7 +359,6 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.BackColor = System.Drawing.SystemColors.ControlLightLight;
             this.ClientSize = new System.Drawing.Size(548, 486);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.headBar1);

+ 21 - 69
UAS-MES/FunctionCode/Make/Make_NewBadCode.cs

@@ -4,7 +4,6 @@ using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Linq;
-using System.Runtime.InteropServices;
 using System.Text;
 using System.Windows.Forms;
 using UAS_MES.DataOperate;
@@ -15,21 +14,6 @@ namespace UAS_MES.Make
 {
     public partial class Make_NewBadCode : Form
     {
-        [DllImport("user32.dll")]
-        public static extern bool ReleaseCapture();
-
-        [DllImport("user32.dll")]
-        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
-
-        [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
-        public static extern int GetWindowLong(HandleRef hWnd, int nIndex);
-
-        [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
-        public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong);
-
-        public const int WM_SYSCOMMAND = 0x0112;
-        public const int SC_MOVE = 0xF010;
-        public const int HTCAPTION = 0x0002;
         /// <summary>
         /// 序列号
         /// </summary>
@@ -54,13 +38,12 @@ namespace UAS_MES.Make
 
         private void Make_NewBadCode_Load(object sender, EventArgs e)
         {
-            this.headBar1.MouseDown += new MouseEventHandler(this.headBar_MouseDown);
             dh = new DataHelper();
             ms_makecode.Text = macode;
             ms_sncode.Text = sncode;
             string pr_code = dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_sncode='" + sncode + "' and ms_makecode='" + macode + "'").ToString();
             sql.Clear();
-            sql.Append("select bg_code||':'||bg_name bg_code,bg_name from product left join productkind  on pr_kind =pk_name ");
+            sql.Append("select bg_code,bg_name from product left join productkind  on pr_kind =pk_name ");
             sql.Append("left join productbadgroup  on  pb_kindcode= pk_code left join badgroup on ");
             sql.Append("bg_code=pb_badgroup  where pr_code='" + pr_code + "' and nvl(pb_kindcode,'')<>''");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -68,7 +51,7 @@ namespace UAS_MES.Make
             if (dt.Rows.Count == 0)
             {
                 sql.Clear();
-                sql.Append("select bg_code||':'||bg_name bg_code from badgroup where bg_statuscode='AUDITED'");
+                sql.Append("select bg_code from badgroup where bg_statuscode='AUDITED'");
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 badgroup.DataSource = dt;
                 badgroup.DisplayMember = "bg_code";
@@ -92,12 +75,6 @@ namespace UAS_MES.Make
             }
         }
 
-        private void headBar_MouseDown(object sender, MouseEventArgs e)
-        {
-            ReleaseCapture();
-            SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
-        }
-
         private void ChooseedReject_Click(object sender, EventArgs e)
         {
             int CheckedNum = 0;
@@ -183,11 +160,10 @@ namespace UAS_MES.Make
                 return;
             }
             int RejectCount = ChoosedRejectList.Items.Count;
-            List<string> bccode = new List<string>();
-            List<string> bcname = new List<string>();
-            List<string> bcremark = new List<string>();
-            List<string> bgcode = new List<string>();
-            List<string> id = new List<string>();
+            string[] bccode = new string[RejectCount];
+            string[] bcremark = new string[RejectCount];
+            string[] bgcode = new string[RejectCount];
+            string[] id = new string[RejectCount];
             string ErrorMessage = "";
             if (ChoosedRejectList.Items.Count == 0)
                 MessageBox.Show("不良品必须选择不良原因和不良代码!");
@@ -196,48 +172,24 @@ namespace UAS_MES.Make
                 //用户未填写不良代码一切按照正常逻辑,填写了从index=1开始执行
                 for (int i = 0; i < RejectCount; i++)
                 {
-                    bgcode.Add(ChoosedRejectList.Items[i].SubItems[1].Text);
-                    //获取不良代码的名称
-                    bcname.Add(ChoosedRejectList.Items[i].SubItems[4].Text);
+                    bgcode[i] = ChoosedRejectList.Items[i].SubItems[1].Text;
                     //获取所有的不良代码
-                    bccode.Add(ChoosedRejectList.Items[i].SubItems[3].Text);
+                    bccode[i] = ChoosedRejectList.Items[i].SubItems[3].Text;
                     //获取所有的不良备注
-                    bcremark.Add(ChoosedRejectList.Items[i].SubItems[5].Text);
-                    id.Add(dh.GetSEQ("MakeBad_seq"));
+                    bcremark[i] = ChoosedRejectList.Items[i].SubItems[5].Text;
+                    id[i] = dh.GetSEQ("MakeBad_seq");
                 }
             }
-            dt = (DataTable)dh.ExecuteSql("select mb_badcode from makebad where mb_sncode='" + sncode + "'", "select");
-            for (int i = 0; i < dt.Rows.Count; i++)
-            {
-                for (int j = 0; j < bgcode.Count; j++)
-                {
-                    if (dt.Rows[i][0].ToString() == bccode[j])
-                    {
-                        ErrorMessage += " " + bcname[j] + " ";
-                        bgcode.Remove(bgcode[j]);
-                        bccode.Remove(bccode[j]);
-                        bcremark.Remove(bcremark[j]);
-                        id.Remove(id[j]);
-                    }
-                }
-            }
-            if (ErrorMessage != "")
-            {
-                ErrorMessage += "重复";
-                MessageBox.Show(ErrorMessage);
-            }
-            if (bgcode.Count > 0)
-            {
-                sql.Clear();
-                sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,");
-                sql.Append("mb_indate,mb_stepcode,mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_soncode,mb_status,mb_badremark)");
-                sql.Append("select makebad_seq.nextval,ma_code,ms_code,ms_sncode,'" + User.UserName + "',sysdate,'" + User.CurrentStepCode + "',ms_sourcecode,:bc_code,:bg_code,'',");
-                sql.Append("sp_soncode,'0',:bc_remark from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
-                sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + sncode + "'");
-                dh.BatchInsert(sql.GetString(), new string[] { "bc_code", "bg_code", "bc_remark" }, bccode.ToArray(), bgcode.ToArray(), bcremark.ToArray());
-                MessageBox.Show("保存成功");
-                Close();
-            }
+            sql.Clear();
+            sql.Append("insert when (not exists(select 1 from makebad where mb_sncode='" + sncode + "' and mb_badcode=:bc_code)) then ");
+            sql.Append("into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,");
+            sql.Append("mb_indate,mb_stepcode,mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_soncode,mb_status,mb_badremark)");
+            sql.Append("select :id,ma_code,ms_code,ms_sncode,'" + User.UserName + "',sysdate,'" + User.CurrentStepCode + "',ms_sourcecode,:bc_code,:bg_code,'',");
+            sql.Append("sp_soncode,'0',:bc_remark from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
+            sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + sncode + "'");
+            dh.BatchInsert(sql.GetString(), new string[] { "bc_code", "id", "bc_code", "bg_code", "bc_remark" }, bccode, id, bccode, bgcode, bcremark);
+            MessageBox.Show("保存成功");
+            Close();
         }
 
         private void badgroup_SelectedIndexChanged(object sender, EventArgs e)
@@ -251,7 +203,7 @@ namespace UAS_MES.Make
         private void LoadBadCodeListView()
         {
             sql.Clear();
-            sql.Append("select bg_code,bg_name,bc_code,bc_name,bc_note from badcode left join badgroup on bc_groupcode=bg_code where bc_groupcode='" + badgroup.Text.Split(':')[0] + "' and bg_code is not null");
+            sql.Append("select bg_code,bg_name,bc_code,bc_name,bc_note from badcode left join badgroup on bc_groupcode=bg_code where bc_groupcode='" + badgroup.Text + "' and bg_code is not null");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             //往listview中添加数据
             WaitRejectList.Items.Clear();

+ 0 - 2
UAS-MES/FunctionCode/Make/Make_NewMatainInf.Designer.cs

@@ -319,13 +319,11 @@
             this.headBar1.Size = new System.Drawing.Size(624, 32);
             this.headBar1.TabIndex = 0;
             this.headBar1.Title = "新增维修信息";
-            this.headBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.headBar1_MouseDown);
             // 
             // Make_NewMatainInf
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.BackColor = System.Drawing.SystemColors.ControlLightLight;
             this.ClientSize = new System.Drawing.Size(624, 488);
             this.Controls.Add(this.Cancel);
             this.Controls.Add(this.Save);

+ 21 - 48
UAS-MES/FunctionCode/Make/Make_NewMatainInf.cs

@@ -4,7 +4,6 @@ using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Linq;
-using System.Runtime.InteropServices;
 using System.Text;
 using System.Windows.Forms;
 using UAS_MES.DataOperate;
@@ -15,21 +14,6 @@ namespace UAS_MES.Make
 {
     public partial class Make_NewMatainInf : Form
     {
-        [DllImport("user32.dll")]
-        public static extern bool ReleaseCapture();
-
-        [DllImport("user32.dll")]
-        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
-
-        [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
-        public static extern int GetWindowLong(HandleRef hWnd, int nIndex);
-
-        [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
-        public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong);
-
-        public const int WM_SYSCOMMAND = 0x0112;
-        public const int SC_MOVE = 0xF010;
-        public const int HTCAPTION = 0x0002;
         /// <summary>
         /// 序列号
         /// </summary>
@@ -141,12 +125,12 @@ namespace UAS_MES.Make
             return CheckedNum;
         }
 
-        private string GetListViewSelectedItemText(ListView lsv, int ItemIndex)
+        private string GetListViewSelectedItemText(ListView lsv)
         {
             for (int i = lsv.Items.Count - 1; i >= 0; i--)
             {
                 if (lsv.Items[i].Selected)
-                    return lsv.Items[i].SubItems[ItemIndex].Text;
+                    return lsv.Items[i].SubItems[0].Text;
             }
             return null;
         }
@@ -175,34 +159,26 @@ namespace UAS_MES.Make
             if (ErrorMessage == "")
             {
                 ErrorMessage = "";
-                string mbccomponent = GetListViewSelectedItemText(mbc_component_lsv, 0);
-                string nrgcode = GetListViewSelectedItemText(nrg_name_lsv, 0);
-                string nrcode = GetListViewSelectedItemText(nr_name_lsv, 0);
-                string nrname = GetListViewSelectedItemText(nr_name_lsv, 1);
-                string mbrdutycode = GetListViewSelectedItemText(mbr_dutycode_lsv, 0);
-                string mbrsolutioncode = GetListViewSelectedItemText(mbr_solutioncode_lsv, 0);
+                string mbccomponent = GetListViewSelectedItemText(mbc_component_lsv);
+                string nrgcode = GetListViewSelectedItemText(nrg_name_lsv);
+                string nrcode = GetListViewSelectedItemText(nr_name_lsv);
+                string mbrdutycode = GetListViewSelectedItemText(mbr_dutycode_lsv);
+                string mbrsolutioncode = GetListViewSelectedItemText(mbr_solutioncode_lsv);
                 dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + sncode + "' and ms_status=3", "select");
                 if (dt.Rows.Count > 0)
                 {
                     string macode = dt.Rows[0]["ms_makecode"].ToString();
                     string mbr_id = dh.GetSEQ("makebadreason_seq");
-                    if (!dh.CheckExist("makebadreason", "mbr_sncode='" + sncode + "' and mbr_brcode='" + nrcode + "' and mbr_badcode='" + bccode + "'"))
-                    {
-                        sql.Clear();
-                        sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
-                        sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
-                        sql.Append("mbr_inman) select '" + mbid + "','" + mbr_id + "','" + nrcode + "',");
-                        sql.Append("'" + mbrsolutioncode + "','" + mbrdutycode + "','" + nrgcode + "','" + bccode + "',");
-                        sql.Append("'" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "' from dual");
-                        dh.ExecuteSql(sql.GetString(), "insert");
-                        MessageBox.Show("不良原因保存成功");
-                    }
-                    else {
-                        ErrorMessage = "不良代码【" + bc_name.Text + "】已存在不良原因【" + nrname + "】";
-                    }
+                    sql.Clear();
+                    sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
+                    sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
+                    sql.Append("mbr_inman) select '" + mbid + "','" + mbr_id + "','" + nrcode + "',");
+                    sql.Append("'" + mbrsolutioncode + "','" + mbrdutycode + "','" + nrgcode + "','" + bccode + "',");
+                    sql.Append("'" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "' from dual");
+                    dh.ExecuteSql(sql.GetString(), "insert");
                     if (mbccomponent != "" || mbccomponent != null)
                     {
-                        if (!dh.CheckExist("makebadrscom", "mbc_badcode='" + bccode + "' and mbc_sncode='" + sncode + "' and mbc_component='" + mbccomponent + "'"))
+                        if (!dh.CheckExist("makebadrscom", "mbc_sncode='" + sncode + "' and mbc_component='" + mbccomponent + "'"))
                         {
                             sql.Clear();
                             sql.Append("insert into makebadrscom (mbc_id,mbc_mbrid,mbc_component,mbc_badcode,");
@@ -215,11 +191,14 @@ namespace UAS_MES.Make
                     }
                     if (ErrorMessage != "")
                         MessageBox.Show(ErrorMessage);
-                    else Close();
+                    else
+                        Close();
                 }
-                else MessageBox.Show("序列号错误,不存在或者不处于维修状态");
+                else
+                    MessageBox.Show("序列号错误,不存在或者不处于维修状态");
             }
-            else MessageBox.Show(ErrorMessage + "未勾选");
+            else
+                MessageBox.Show(ErrorMessage + "未勾选");
         }
 
         private void ListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
@@ -245,11 +224,5 @@ namespace UAS_MES.Make
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             AddDataToListView(nr_name_lsv, dt);
         }
-
-        private void headBar1_MouseDown(object sender, MouseEventArgs e)
-        {
-            ReleaseCapture();
-            SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
-        }
     }
 }

+ 2 - 2
UAS-MES/FunctionCode/Make/Make_Repair.Designer.cs

@@ -306,7 +306,7 @@
             this.panel1.Location = new System.Drawing.Point(163, 280);
             this.panel1.Margin = new System.Windows.Forms.Padding(2);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(829, 1);
+            this.panel1.Size = new System.Drawing.Size(829, 2);
             this.panel1.TabIndex = 108;
             // 
             // GetSNCode_Label
@@ -338,7 +338,7 @@
             this.panel3.Location = new System.Drawing.Point(1, 117);
             this.panel3.Margin = new System.Windows.Forms.Padding(2);
             this.panel3.Name = "panel3";
-            this.panel3.Size = new System.Drawing.Size(995, 1);
+            this.panel3.Size = new System.Drawing.Size(990, 2);
             this.panel3.TabIndex = 109;
             // 
             // BadCodeTree

+ 10 - 22
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -165,14 +165,6 @@ namespace UAS_MES.Make
             }
             if (e.Node.Level == 1)
             {
-                //刷新父节点信息
-                mb_id = e.Node.Parent.Tag.ToString();
-                bc_name.Text = BadInf_1[mb_id]["bc_name"];
-                bc_code.Text = BadInf_1[mb_id]["mb_badcode"];
-                bg_name.Text = BadInf_1[mb_id]["bg_name"];
-                bg_code.Text = BadInf_1[mb_id]["mb_bgcode"];
-                mb_badremark.Text = BadInf_1[mb_id]["mb_badremark"];
-                //展示子节点信息
                 mbr_id = e.Node.Tag.ToString();
                 nrg_name.Text = BadInf_2[mbr_id]["nrg_name"];
                 nr_name.Text = BadInf_2[mbr_id]["nr_name"];
@@ -182,17 +174,15 @@ namespace UAS_MES.Make
                 mbc_component.Text = dh.getFieldDataByCondition("makebadrscom", "mbc_component", "mbc_mbrid=" + mbr_id).ToString();
                 //加载两个Grid的数据源
                 DataTable dt = (DataTable)dh.ExecuteSql("select mbp_id,mbp_part from makebadrspart where mbp_mbrid=" + mbr_id, "select");
-                BaseUtil.FillDgvWithDataTable(mbp_partdgv, dt);
+                BaseUtil.FillDgvWithDataTable(mbp_partdgv,dt);
                 dt = (DataTable)dh.ExecuteSql("select mbl_id,mbl_loc from makebadrsloc where mbl_mbrid=" + mbr_id, "select");
-                BaseUtil.FillDgvWithDataTable(mbl_locdgv, dt);
+                BaseUtil.FillDgvWithDataTable(mbl_locdgv,dt);
             }
         }
 
         private void LoadBadInfTree(object sender, EventArgs e)
         {
             BadCodeTree.Nodes.Clear();
-            BadInf_1.Clear();
-            BadInf_2.Clear();
             sql.Clear();
             sql.Append("select mb_id,mb_sncode,mb_badcode,mb_bgcode,nvl(bc_name,mb_badcode) bc_name,nvl(bg_name,mb_bgcode) bg_name,");
             sql.Append("mb_badremark from makebad left join badcode on bc_code=mb_badcode left join badgroup ");
@@ -246,7 +236,7 @@ namespace UAS_MES.Make
                     dic1.Add("nrg_name", dt1.Rows[j]["nrg_name"].ToString());
                     dic1.Add("nr_name", dt1.Rows[j]["nr_name"].ToString());
                     dic1.Add("nr_code", dt1.Rows[j]["nr_code"].ToString());
-                    tnode_1.Text = dt1.Rows[j]["nr_name"].ToString();
+                    tnode_1.Text = dt1.Rows[j]["mbr_brgcode"].ToString();
                     if (!BadInf_2.ContainsKey(mbr_id))
                         BadInf_2.Add(mbr_id, dic1);
                     tnode_0.Nodes.Add(tnode_1);
@@ -296,8 +286,8 @@ namespace UAS_MES.Make
                     OperatResult.AppendText(">>回流工序不在回流工艺中\n", Color.Red);
                 else
                 {
-                    dh.UpdateByCondition("makeserial", "ms_stepcode='"+User.CurrentStepCode+"',ms_nextstepcode='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_sncode='" + ms_sncode.Text + "'");
-                    LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "维修回流", "回流成功", User.UserCode);
+                    dh.UpdateByCondition("makeserial", "ms_nextstepcode='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_sncode='" + ms_sncode.Text + "'");
+                    dh.ExecuteSql(insert_makeprocess.Replace("#", "完成维修"), "insert", ms_sncode.Text, User.CurrentStepCode);
                     OperatResult.AppendText(">>" + ms_sncode.Text + " 序列号回流成功\n", Color.Green);
                     BaseUtil.CleanForm(this);
                     BadCodeTree.Nodes.Clear();
@@ -308,8 +298,7 @@ namespace UAS_MES.Make
 
         private void Scrap_Click(object sender, EventArgs e)
         {
-            if (ms_sncode.Text != "")
-            {
+            if (ms_sncode.Text != "") {
                 //判断是否有无法维修的记录
                 int ScrapNum = int.Parse(dh.getFieldDataByCondition("makebad", "count(0) cn", "mb_sncode='" + ms_sncode.Text + "'").ToString());
                 if (ScrapNum == 0)
@@ -369,8 +358,9 @@ namespace UAS_MES.Make
                     sql.Append("sysdate,'" + User.UserCode + "' from dual");
                     dh.BatchInsert(sql.GetString(), new string[] { "prodcode" }, prodcode.ToArray());
                 }
+                OperatResult.AppendText(">>不良零件保存成功\n", Color.Green);
             }
-            OperatResult.AppendText(">>不良零件保存成功\n", Color.Green);
+            else OperatResult.AppendText(">>不良零件未维护数据\n", Color.Red);
             //保存不良位置
             dt = (DataTable)mbl_locdgv.DataSource;
             if (dt != null && dt.Rows.Count > 0)
@@ -390,11 +380,9 @@ namespace UAS_MES.Make
                     sql.Append("sysdate,'" + User.UserCode + "' from dual");
                     dh.BatchInsert(sql.GetString(), new string[] { "location" }, location.ToArray());
                 }
+                OperatResult.AppendText(">>不良位置保存成功\n", Color.Green);
             }
-            OperatResult.AppendText(">>不良位置保存成功\n", Color.Green);
-            //将不良备注更新回数据库,同时更新本地缓存数据    
-            dh.ExecuteSql("update makebad set mb_badremark='"+mb_badremark.Text+"' where mb_id='"+mb_id+"'", "update");
-            BadInf_1[mb_id]["mb_badremark"] = mb_badremark.Text;
+            else OperatResult.AppendText(">>不良位置未维护数据\n", Color.Red);
         }
 
         private void DeleteRepairInf_Click(object sender, EventArgs e)

+ 3 - 3
UAS-MES/FunctionCode/Make/Make_TestCollection.cs

@@ -207,7 +207,7 @@ namespace UAS_MES.Make
 
         private void bc_groupcode_SelectedIndexChanged(object sender, EventArgs e)
         {
-            LoadBadCodeListView();
+            LoadBadCodeListView(false);
         }
 
         /// <summary>
@@ -231,7 +231,7 @@ namespace UAS_MES.Make
         /// <summary>
         /// 加载不良代码的ListView的信息
         /// </summary>
-        private void LoadBadCodeListView()
+        private void LoadBadCodeListView(bool Clear)
         {
             object bg_code = bc_groupcode.SelectedValue;
             sql.Clear();
@@ -292,7 +292,7 @@ namespace UAS_MES.Make
             //如果勾选的是不良品
             if (Reject.Checked)
             {
-                LoadBadCodeListView();
+                LoadBadCodeListView(true);
                 LoadChoosedBadListView();
                 OperateResult.AppendText(">>请采集不良代码\n", Color.Green);
                 bc_code.Focus();

+ 1 - 1
UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.designer.cs

@@ -608,7 +608,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1022, 616);
+            this.ClientSize = new System.Drawing.Size(1022, 625);
             this.Controls.Add(this.ob_maxngacceptqty);
             this.Controls.Add(this.ob_aqlcode);
             this.Controls.Add(this.pr_detail);

+ 65 - 62
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.cs

@@ -21,7 +21,7 @@ namespace UAS_MES.OQC
         List<DataGridViewRow> dgvr = new List<DataGridViewRow>();
         LogStringBuilder sql = new LogStringBuilder();
         string[] LevelDefect = new string[] { "A#A", "B#B", "C#C", "D#D" };
-        string ErrorMessage = "";
+
         DataTable TempForCheckType = new DataTable();
 
         public OQC_SamplingDataCollection()
@@ -79,8 +79,8 @@ namespace UAS_MES.OQC
                 //判断当前的检验状态
                 if (ob_status.Text == "待检验" || ob_status.Text == "检验中")
                 {
-                    dt = (DataTable)dh.ExecuteSql("select obd_sncode,ob_source,ob_makecode,ob_checkno from OQCBatchDetail left join OQCBatch  on ob_id=obd_obid where obd_sncode='" + sncode.Text + "'", "select");
-                    if (dt.Rows.Count > 0 && dt.Rows[0]["ob_checkno"].ToString() == ob_checkno.Text)
+                    dt = (DataTable)dh.ExecuteSql("select obd_sncode,ob_source,ob_makecode from OQCBatchDetail left join OQCBatch  on ob_id=obd_obid where obd_sncode='" + sncode.Text + "'", "select");
+                    if (dt.Rows.Count > 0)
                     {
                         if (dt.Rows[0]["ob_source"].ToString() != "工序")
                         {
@@ -88,6 +88,7 @@ namespace UAS_MES.OQC
                         }
                         else
                         {
+                            string ErrorMessage = "";
                             string oMakeCode = "";
                             string oMsID = "";
                             if (LogicHandler.CheckStepSNAndMacode(dt.Rows[0]["ob_makecode"].ToString(), User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
@@ -101,7 +102,7 @@ namespace UAS_MES.OQC
                         }
                     }
                     else {
-                        OperateResult.AppendText(">>序列号" + sncode.Text + "不属于当前抽检批次\n", Color.Red);
+                        OperateResult.AppendText(">>序列号"+sncode.Text+"不属于当前抽检批次\n", Color.Red);
                         return false;
                     }
                 }
@@ -143,7 +144,7 @@ namespace UAS_MES.OQC
                         TempForCheckType.Rows.RemoveAt(i);
                     }
                 }
-                if (TempForCheckType != null && TempForCheckType.Rows.Count > 0)
+                if (TempForCheckType != null && TempForCheckType.Rows.Count>0)
                 {
                     //用于存放更新的数据
                     List<string> ois_ifng_update = new List<string>();
@@ -158,6 +159,7 @@ namespace UAS_MES.OQC
                     for (int i = 0; i < TempForCheckType.Rows.Count; i++)
                     {
                         //将布尔值转换为0,-1
+                        Console.WriteLine(TempForCheckType.Rows[i]["ois_id"].ToString());
                         if (TempForCheckType.Rows[i]["ois_id"].ToString() != "" && TempForCheckType.Rows[i]["ois_id"].ToString() != "0")
                         {
                             ois_ifng_update.Add(TempForCheckType.Rows[i]["oi_ng"].ToString() == "True" ? "-1" : "0");
@@ -225,14 +227,9 @@ namespace UAS_MES.OQC
                         dh.ExecuteSql("update OQCBatch set ob_status='CHECKING' where ob_checkno='" + ob_checkno.Text + "' and ob_status='UNCHECK'", "update");
                         //更新批次中的合格数不合格数:用抽检批检验项目表获取最大的抽检数和不合格数
                         dh.ExecuteSql("update OQCBATCH set (ob_ngqty,ob_okqty)=(select nvl(max(oi_ngqty),0),max(oi_checkqty)-nvl(max(oi_ngqty),0) from OQCItems where oi_checkno ='" + ob_checkno.Text + "') where ob_checkno ='" + ob_checkno.Text + "'", "update");
-                        if (LogicHandler.SetStepFinish(ob_makecode.Text, User.UserSourceCode, sncode.Text, "OQC检查", "抽样数据采集完成", User.UserCode, out ErrorMessage))
-                        {
-                            OperateResult.AppendText(">>操作成功\n", Color.Green);
-                            GetBatch.PerformClick();
-                            ChoosedDGV.DataSource = null;
-                            TempForCheckType.Clear();
-                        }
-                        else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                        OperateResult.AppendText(">>操作成功\n", Color.Green);
+                        GetBatchTypeGridData();
+                        TempForCheckType.Clear();
                     }
                     else OperateResult.AppendText(">>含有未通过项请勾选不良明细\n", Color.Red);
                 }
@@ -355,55 +352,51 @@ namespace UAS_MES.OQC
                 textcell.Value = "检验状态";
                 headerRow.Cells.Add(textcell);
                 headerRow.ReadOnly = true;
-                try
+                CollapseDataGridViewRow cl = (CollapseDataGridViewRow)(CheckTypeDGV.Rows[e.RowIndex]);
+                cl.Rows.Add(headerRow);
+
+                for (int i = 0; i < dt.Rows.Count; i++)
                 {
-                    CollapseDataGridViewRow cl = (CollapseDataGridViewRow)(CheckTypeDGV.Rows[e.RowIndex]);
-                    cl.Rows.Add(headerRow);
+                    DataGridViewRow dataRow = new DataGridViewRow();
+                    //标记展开的子行
+                    dataRow.Tag = "SonRow";
+                    DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
+                    checkcell.Tag = "SonRow";
+                    dataRow.Cells.Add(checkcell);
 
-                    for (int i = 0; i < dt.Rows.Count; i++)
-                    {
-                        DataGridViewRow dataRow = new DataGridViewRow();
-                        //标记展开的子行
-                        dataRow.Tag = "SonRow";
-                        DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
-                        checkcell.Tag = "SonRow";
-                        dataRow.Cells.Add(checkcell);
-
-                        textcell = new DataGridViewTextBoxCell();
-                        textcell.Value = dt.Rows[i]["oi_itemcode"].ToString();
-                        dataRow.Cells.Add(textcell);
-                        textcell.ReadOnly = true;
-
-                        DataGridViewCheckBoxCell checkcel2 = new DataGridViewCheckBoxCell();
-                        checkcel2.Value = dt.Rows[i]["oi_ng"].ToString() != "0" ? true : false;
-                        dataRow.Cells.Add(checkcel2);
-                        textcell.ReadOnly = false;
-
-                        DataGridViewComboBoxCell combocell = new DataGridViewComboBoxCell();
-                        BaseUtil.SetDGVCellComboxData(combocell, "display", "value", LevelDefect);
-                        combocell.Value = dt.Rows[i]["oi_leveldefect"].ToString();
-                        dataRow.Cells.Add(combocell);
-                        textcell.ReadOnly = false;
-
-                        textcell = new DataGridViewTextBoxCell();
-                        textcell.Value = dt.Rows[i]["ois_remark"].ToString();
-                        dataRow.Cells.Add(textcell);
-                        textcell.ReadOnly = false;
-
-                        textcell = new DataGridViewTextBoxCell();
-                        textcell.Value = dt.Rows[i]["ois_status"].ToString();
-                        dataRow.Cells.Add(textcell);
-                        textcell.ReadOnly = true;
-
-                        textcell = new DataGridViewTextBoxCell();
-                        textcell.Value = dt.Rows[i]["ois_id"].ToString();
-                        dataRow.Cells.Add(textcell);
-
-                        cl.Rows.Add(dataRow);
-                    }
-                    dgvr.Add(CheckTypeDGV.Rows[e.RowIndex]);
+                    textcell = new DataGridViewTextBoxCell();
+                    textcell.Value = dt.Rows[i]["oi_itemcode"].ToString();
+                    dataRow.Cells.Add(textcell);
+                    textcell.ReadOnly = true;
+
+                    DataGridViewCheckBoxCell checkcel2 = new DataGridViewCheckBoxCell();
+                    checkcel2.Value = dt.Rows[i]["oi_ng"].ToString() != "0" ? true : false;
+                    dataRow.Cells.Add(checkcel2);
+                    textcell.ReadOnly = false;
+
+                    DataGridViewComboBoxCell combocell = new DataGridViewComboBoxCell();
+                    BaseUtil.SetDGVCellComboxData(combocell, "display", "value", LevelDefect);
+                    combocell.Value = dt.Rows[i]["oi_leveldefect"].ToString();
+                    dataRow.Cells.Add(combocell);
+                    textcell.ReadOnly = false;
+
+                    textcell = new DataGridViewTextBoxCell();
+                    textcell.Value = dt.Rows[i]["ois_remark"].ToString();
+                    dataRow.Cells.Add(textcell);
+                    textcell.ReadOnly = false;
+
+                    textcell = new DataGridViewTextBoxCell();
+                    textcell.Value = dt.Rows[i]["ois_status"].ToString();
+                    dataRow.Cells.Add(textcell);
+                    textcell.ReadOnly = true;
+
+                    textcell = new DataGridViewTextBoxCell();
+                    textcell.Value = dt.Rows[i]["ois_id"].ToString();
+                    dataRow.Cells.Add(textcell);
+
+                    cl.Rows.Add(dataRow);
                 }
-                catch (Exception) { }
+                dgvr.Add(CheckTypeDGV.Rows[e.RowIndex]);
             }
         }
 
@@ -460,10 +453,13 @@ namespace UAS_MES.OQC
                 CheckTypeDGV.Rows[e.RowIndex].Cells[0].Value = true;
             try
             {
-                if (CheckTypeDGV.Rows[e.RowIndex].Cells[0].Tag != null)
+                if (e.ColumnIndex == 0)
                 {
-                    if (CheckTypeDGV.Rows[e.RowIndex].Cells[0].Tag.ToString() == "SonRow")
-                        BaseUtil.GetExpandDGVCheckedRow(CheckTypeDGV, TempForCheckType, e.RowIndex, 1);
+                    if (CheckTypeDGV.Rows[e.RowIndex].Cells[0].Tag != null)
+                    {
+                        if (CheckTypeDGV.Rows[e.RowIndex].Cells[0].Tag.ToString() == "SonRow")
+                            BaseUtil.GetExpandDGVCheckedRow(CheckTypeDGV, TempForCheckType, e.RowIndex, 1);
+                    }
                 }
             }
             catch (Exception)
@@ -481,6 +477,7 @@ namespace UAS_MES.OQC
         private void CheckTypeDGV_CellContentClick(object sender, DataGridViewCellEventArgs e)
         {
             BaseUtil.ExpandDGVCheck(CheckTypeDGV, e);
+
         }
 
         private void bccode_KeyDown(object sender, KeyEventArgs e)
@@ -504,19 +501,25 @@ namespace UAS_MES.OQC
         private void ob_checkno_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)
+            {
                 GetBatch.PerformClick();
+            }
         }
 
         private void ms_sncode_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)
+            {
                 GetBatch.PerformClick();
+            }
         }
 
         private void obd_outboxcode_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)
+            {
                 GetBatch.PerformClick();
+            }
         }
     }
 }

+ 3 - 27
UAS-MES/FunctionCode/SystemSetting/SystemSetting_LabelMaintain.cs

@@ -222,10 +222,6 @@ namespace UAS_MES.SystemSetting
                     {
                         LabelDataGridView.Rows[i].Cells["pl_labelsoft"].Value = LabelSoft;
                     }
-                    
-                    //if (LabelDataGridView.Rows[i].Cells["pl_isdefault"].Value.ToString() == "1") {
-                    //    LabelDataGridView.Rows[i].Cells["pl_isdefault"].Value = isdefault(LabelDataGridView.Rows[i].Cells["pl_prodcode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["pl_labeltype"].Value.ToString());
-                    //}
                 }
                 string sql = "Insert into productlabel (PL_ID,PL_PRODCODE,PL_LABELTYPE,PL_LABELCODE,PL_LABELURL,PL_DETNO,PL_LABELSOFT,PL_ISDEFAULT) values( ProductLabel_seq.nextval,'" + pr_code.Text + "',:PL_LABELTYPE,:PL_LABELCODE,:PL_LABELURL,:PL_DETNO,:PL_LABELSOFT,:PL_ISDEFAULT )";
                 dh.SaveDataTable(dt.GetChanges(), "productlabel", "pl_id", sql.ToLower());
@@ -296,26 +292,6 @@ namespace UAS_MES.SystemSetting
             //覆盖参数错误的事件,使得不会报错    
         }
 
-        //判断与维护标签相同ID是否具有默认模板
-        private int isdefault(string pl_prodcode,string pl_labeltype)
-        {
-            LogStringBuilder sql2 = new LogStringBuilder();
-            sql2.Append("select la_id,pl_labelname,pl_labelurl,pl_labeltype,pl_isdefault,pl_prodcode,pl_id,pl_labelcode,pl_detno,pl_labelsoft,pr_detail,pr_spec,");
-            sql2.Append("pr_code from productlabel left join product on pl_prodcode=pr_code left join label on pl_labelcode=la_code");
-            sql2.Append(" where pl_isdefault = '1' and pl_prodcode = '" + pl_prodcode+ "'  and pl_labeltype = '"+pl_labeltype+"'");
-            dt = (DataTable)dh.ExecuteSql(sql2.GetString(), "select");
-            if (dt.Rows.Count > 0)
-            {
-                sql2.Clear();
-                return 0;
-            }
-            else
-            {
-                sql2.Clear();
-                return 1;
-            }
-        } 
-
         private void LoadData()
         {
        
@@ -366,14 +342,14 @@ namespace UAS_MES.SystemSetting
                     {
                         sql.Clear();
                         sql.Append("update productlabel set pl_labelcode=:pl_labelcode,pl_labeltype=:pl_labeltype,pl_labelname=:pl_labelname,");
-                        sql.Append("pl_prodcode=:pl_prodcode where pl_id='" + pl_id2 + "'");
+                        sql.Append("pl_prodcode=:pl_prodcode,pl_indate=sysdate where pl_id='" + pl_id2 + "'");
                         dh.ExecuteSql(sql.GetString(), "update", la_code.Text, la_type.Text, la_name.Text, pr_code.Text);
                     }
                     else
                     {
                         sql.Clear();
-                        sql.Append("insert into productlabel (pl_id,pl_labelcode,pl_labeltype,pl_isdefault,pl_labelurl,pl_labelsoft,pl_labelname,pl_prodcode) values( productlabel_seq.nextval, ");
-                        sql.Append("'" + la_code.Text + "','" + la_type.Text + "','" +isdefault(pr_code.Text, la_type.Text) + "','" + ftpOperater.FTPAddress + la_name.Text + "','" + SoftWare + "','" + la_name.Text + "','" + pr_code.Text + "')");
+                        sql.Append("insert into productlabel (pl_id,pl_labelcode,pl_labeltype,pl_labelurl,pl_labelsoft,pl_labelname,pl_prodcode,pl_indate) values( productlabel_seq.nextval, ");
+                        sql.Append("'" + la_code.Text + "','" + la_type.Text + "','" + ftpOperater.FTPAddress + la_name.Text + "','" + SoftWare + "','" + la_name.Text + "','" + pr_code.Text + "',sysdate)");
                         dh.ExecuteSql(sql.GetString(), "insert");
                     }
                     pl_id2 = "";

+ 10 - 4
UAS-MES/Login.cs

@@ -60,7 +60,12 @@ namespace UAS_MES
                 PassWord.Select();
             else
                 UserName.Select();
+            //本来static是不要实例化的,但是需要调用触发添加键值对的构造函数
+            if (lgc == null)
+                lgc = new LogicHandler();
             BaseUtil.SetFormCenter(this);
+            //try { CertImport(); }
+            //catch (Exception) { }
         }
 
         //点击登陆按钮的时候
@@ -77,6 +82,7 @@ namespace UAS_MES
                     SystemInf.ScreenWidth = Screen.PrimaryScreen.WorkingArea.Width;
                     SystemInf.ScreenHeight = Screen.PrimaryScreen.WorkingArea.Height;
                     SystemInf.ConnectionString = "Data Source=" + DbComboxData.Rows[i]["ma_address"] + ";User ID=" + DbComboxData.Rows[i]["ma_user"] + ";PassWord=" + DbComboxData.Rows[i]["ms_pwd"];
+                    Console.WriteLine(SystemInf.ConnectionString);
                     DataHelper.DBConnectionString = SystemInf.ConnectionString;
                     //重新执行一遍构造函数使得重置之后的链接字符串生效
                     dh = new DataHelper();
@@ -93,15 +99,15 @@ namespace UAS_MES
                     this.Hide();
                     SetInf();//设置User的全局变量
                     LogManager.DoLog("登陆成功" + User.UserName + ",超级用户");
-                    string Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
-                    LogicHandler.RecordLogInf(User.UserCode, User.UserName, Version, BaseUtil.GetLocalIP(), "CS");
                     Main dialog = new Main();
                     dialog.ShowDialog();
                     this.Close();
                 }
-                else MessageBox.Show(ErrorMessage);
+                else
+                    MessageBox.Show(ErrorMessage);
             }
-            else MessageBox.Show(ErrorMessage);
+            else
+                MessageBox.Show(ErrorMessage);
         }
 
         /// <summary>

+ 3 - 3
UAS-MES/Properties/AssemblyInfo.cs

@@ -16,7 +16,7 @@ using System.Runtime.InteropServices;
 //将 ComVisible 设置为 false 将使此程序集中的类型
 //对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
 //请将此类型的 ComVisible 特性设置为 true。
-[assembly: ComVisible(true)]
+[assembly: ComVisible(false)]
 
 // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
 [assembly: Guid("411dee44-b893-47e0-a0c2-797a3dae2466")]
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
 // 方法是按如下所示使用“*”: :
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.1")]
-[assembly: AssemblyFileVersion("1.0.0.1")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 39 - 0
UAS-MES/PublicMethod/BaseUtil.cs

@@ -3,6 +3,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
+using System.IO;
 using System.Net;
 using System.Net.Sockets;
 using System.Reflection;
@@ -204,6 +205,44 @@ namespace UAS_MES.PublicMethod
             }
         }
 
+        /// <summary>
+        /// 获取打印标签
+        /// </summary>
+        /// <param name="labelName"></param>
+        /// <param name="labelUrl"></param>
+        /// <param name="indate"></param>
+        public static void GetPrintLabel(string labelName, string labelUrl, string indate)
+        {
+            string LabelUrl = labelUrl;
+            string LabelName = labelName;
+            System.DateTime time = Convert.ToDateTime(indate);
+            FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
+            if (time.ToString() != file.LastWriteTime.ToString())
+                BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
+        }
+
+        /// <summary>
+        /// 获取标签的路径
+        /// </summary>
+        /// <param name="URL"></param>
+        /// <param name="LabelName"></param>
+        /// <param name="time"></param>
+        /// <returns></returns>
+        public static string GetLabelUrl(string URL, string LabelName, DateTime time)
+        {
+            //如果是传入的数据是从FTP取的文件
+            if (URL.Contains("ftp:"))
+            {
+                ftpOperater ftp = new ftpOperater();
+                return ftp.Download(LabelName, time);
+            }
+            else
+            {
+                return URL;
+            }
+        }
+
+
         /// <summary>
         /// 移除重复行
         /// </summary>

+ 11 - 23
UAS-MES/PublicMethod/LogicHandler.cs

@@ -919,20 +919,20 @@ namespace UAS_MES.PublicMethod
         /// <param name="iMakeCode"></param>
         /// <param name="iMPKind"></param>
         /// <param name="result"></param>
-        /// <param name="iUserCode"></param>
-        public static void InsertMakeProcess(string iSnCode, string iMakeCode, string iSourceCode, string iMPKind, string result, string iUserCode)
+        /// <param name="iUserName"></param>
+        public static void InsertMakeProcess(string iSnCode, string iMakeCode,string iSourceCode, string iMPKind, string result, string iUserName)
         {
             string CurrentStep = "";
             string LineCode = "";
             string CurrentStepName = "";
-            GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
+            GetStepCodeAndNameAndLineBySource(iSourceCode,ref CurrentStep,ref CurrentStepName ,ref LineCode);
             sql.Clear();
             sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,");
             sql.Append("mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno,mp_snoutboxcode)");
             sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,mcd_stepcode,mcd_stepname,");
-            sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserCode + "',ma_wccode,'" + LineCode + "','" + iSourceCode + "',");
+            sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserName + "',ma_wccode,'"+ LineCode + "','"+ iSourceCode + "',");
             sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makecraftdetail on mcd_macode=ma_code left join makeserial on ms_makecode=ma_code ");
-            sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and mcd_stepcode='" + CurrentStep + "'");
+            sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and mcd_stepcode='"+ CurrentStep + "'");
             dh.ExecuteSql(sql.ToString(), "insert");
             sql.Clear();
         }
@@ -953,18 +953,6 @@ namespace UAS_MES.PublicMethod
             dh.ExecuteSql(sql.ToString(), "insert");
         }
 
-        /// <summary>
-        /// 记录登陆信息
-        /// </summary>
-        /// <param name="iUserCode"></param>
-        /// <param name="iIP"></param>
-        public static void RecordLogInf(string iUserCode,string iUserName,string iVersion, string iIP,string iType)
-        {
-            sql.Clear();
-            sql.Append("insert into LOGINFO(ID,SIP,USCODE,USNAME,VERSIONCODE,INDATE,TERMINALTYPE) values(LOGINFO_seq.nextval,'" + iIP + "','" + iUserCode + "','"+ iUserName + "','"+ iVersion + "',sysdate,'"+iType+"')");
-            dh.ExecuteSql(sql.ToString(), "insert");
-        }
-
         /// <summary>
         /// 保存Mac地址和BT地址
         /// </summary>
@@ -1005,6 +993,8 @@ namespace UAS_MES.PublicMethod
             oErrorMessage = "";
             string StepCode = dh.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
             string CurrentStep = GetStepCodeBySource(iSourceCode);
+            Console.WriteLine("StepCode" + StepCode);
+            Console.WriteLine("CurrentStep" + CurrentStep);
             if (StepCode == CurrentStep)
             {
                 InsertMakeProcess(iSN, iMakeCode, iSourceCode, iMPKind, iResult, iUserCode);
@@ -1109,14 +1099,12 @@ namespace UAS_MES.PublicMethod
             sql.Append("sp_soncode,'0',:bc_remark from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
             sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSnCode + "'");
             dh.BatchInsert(sql.ToString(), new string[] { "bc_code", "bg_code", "bc_remark" }, iBadCode, iBadGroupCode, iBadRemark);
+            //更新序列号已经采集的工序 ms_paststep 已采集数据,更新下一工序
+            dh.UpdateByCondition("makeserial", "ms_paststep = ms_paststep ||'," + StepCode + "',ms_status=3", "ms_sncode='" + iSnCode + "'");
             //判断当前采集点是否为扣料工序cd_ifreduce =-1 则为扣料工序
             //之前保存的不良就不再调用
             if (ms_status != "3")
-            {
-                //更新序列号已经采集的工序 ms_paststep 已采集数据,更新下一工序
-                dh.UpdateByCondition("makeserial", "ms_paststep = ms_paststep ||'," + StepCode + "',ms_status=3", "ms_sncode='" + iSnCode + "'");
                 SetStepFinish(iMakeCode, iSourceCode, iSnCode, "不良采集", iResult, iUserCode, out oErrorMessage);
-            }
             return true;
         }
 
@@ -1254,7 +1242,7 @@ namespace UAS_MES.PublicMethod
         /// <param name="iUserName"></param>
         /// <param name="oErrorMessage"></param>
         /// <returns></returns>
-        public static bool SetMaterialDown(string iSnCode, string iBarCode, string iSourceCode, string iCurrentStep, string iUserName, out string oErrorMessage)
+        public static bool SetMaterialDown(string iSnCode, string iBarCode,string iSourceCode, string iCurrentStep, string iUserName, out string oErrorMessage)
         {
             //序列号不为空的时候
             oErrorMessage = "";
@@ -1292,7 +1280,7 @@ namespace UAS_MES.PublicMethod
                     string cm_stepcode = dt.Rows[0]["cm_stepcode"].ToString();
                     string cm_mccode = dt.Rows[0]["cm_mccode"].ToString();
                     dh.ExecuteSql("delete from Craftmaterial where cm_id=" + cm_id, "delete");
-                    InsertMakeProcess(ms_macode, iSnCode, iSourceCode, "下料操作", "下料成功", iUserName);
+                    InsertMakeProcess(ms_macode, iSnCode, iSourceCode,"下料操作", "下料成功", iUserName);
                     int count = dh.getRowCount("craftMaterial", "cm_mccode='" + cm_mccode + "' and cm_stepcode='" + cm_stepcode + "' and cm_sncode='" + iSnCode + "'");
                     if (count == 0)
                         dh.UpdateByCondition("makecraftdetail ", "mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty = mcd_okqty - 1", "mcd_mccode='" + cm_mccode + "' and mcd_stepcode='" + cm_stepcode + "'");

+ 43 - 0
UAS-MES/PublicMethod/ftpOperater.cs

@@ -177,6 +177,49 @@ namespace UAS_MES.PublicMethod
             return fileSize;
         }
 
+        /// <summary>
+        /// 实现ftp下载操作
+        /// </summary>
+        /// <param name="fileName">远程文件名</param>
+        public string Download(string fileName,DateTime time)
+        {
+            FtpWebRequest reqFTP;
+            try
+            {
+                FileStream outputStream = new FileStream(DownLoadTo + @"\" + fileName, FileMode.Create);
+                reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpServerIP + "/" + fileName));
+                reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
+                reqFTP.UseBinary = true;
+                reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
+                reqFTP.UsePassive = true;
+                FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
+                Stream ftpStream = response.GetResponseStream();
+                long cl = response.ContentLength;
+                int bufferSize = 2048;
+                int readCount;
+                byte[] buffer = new byte[bufferSize];
+
+                readCount = ftpStream.Read(buffer, 0, bufferSize);
+                while (readCount > 0)
+                {
+                    outputStream.Write(buffer, 0, readCount);
+                    readCount = ftpStream.Read(buffer, 0, bufferSize);
+                }
+                ftpStream.Close();
+                outputStream.Close();
+                response.Close();
+                //设置最后修改文件时间为服务器时间
+                FileInfo f = new FileInfo(DownLoadTo + @"\" + fileName);
+                f.LastWriteTime = time;
+                return DownLoadTo + @"\" + fileName;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+                return "";
+            }
+        }
+
         /// <summary>
         /// 实现ftp下载操作
         /// </summary>

+ 1 - 1
UAS-MES/UAS-MES.csproj

@@ -41,7 +41,7 @@
     <MinimumRequiredVersion>1.0.0.201</MinimumRequiredVersion>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <WebPage>publish.htm</WebPage>
-    <ApplicationRevision>244</ApplicationRevision>
+    <ApplicationRevision>248</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>true</UseApplicationTrust>
     <CreateDesktopShortcut>true</CreateDesktopShortcut>