ソースを参照

OQC回流功能提交

callm 3 年 前
コミット
69e16ed2a9

+ 10 - 8
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -1749,7 +1749,7 @@ namespace UAS_LabelMachine
         DataTable CSPrcode;
         private void LoadPrcodeData()
         {
-            DataTable Prcode = (DataTable)dh.ExecuteSql("select '' pd_piid,pd_inoutno,pd_custprodcode,pd_pocode,pd_whcode,pd_prodcode,'0' CollectedNum,'0' UnCollectedNum,pd_outqty,pr_unit,pd_brand,pjd_zxbzs_user,pjd_id,pd_pdno,pr_spec,0 checknum from prodiodetail left join prodinout on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode left join product on pd_prodcode=pr_code where pi_id='" + PI_ID + "' order by pd_pdno", "select");
+            DataTable Prcode = (DataTable)dh.ExecuteSql("select '' pd_piid,pd_inoutno,pd_remark,pd_custprodcode,pd_pocode,pd_whcode,pd_prodcode,'0' CollectedNum,'0' UnCollectedNum,pd_outqty,pr_unit,pd_brand,pjd_zxbzs_user,pjd_id,pd_pdno,pr_spec,0 checknum from prodiodetail left join prodinout on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode left join product on pd_prodcode=pr_code where pi_id='" + PI_ID + "' order by pd_pdno", "select");
             GridPrcode.DataSource = Prcode;
             List<int> RemoveIndex = new List<int>();
             double CollectNum = 0;
@@ -1761,9 +1761,9 @@ namespace UAS_LabelMachine
                 combined = 2;
             if (CombindetailThree.Checked)
                 combined = 3;
-            if (Combindetail.Checked || CombindetailTwo.Checked|| CombindetailThree.Checked)
+            if (Combindetail.Checked || CombindetailTwo.Checked || CombindetailThree.Checked)
             {
-                CSPrcode = (DataTable)dh.ExecuteSql("select pd_piid,pd_pdno,pd_custprodcode,pd_whcode,pd_prodcode,CollectedNum,UnCollectedNum,pd_outqty,pr_unit,pr_spec,pd_brand,pjd_zxbzs_user,pjd_id,pd_inoutno,pd_pocode,nvl(checknum,0)checknum from CS$InoutPrcode where pd_inoutno='" + pi_inoutno.Text + "' and combined=" + combined + " order by  pd_pdno", "select");
+                CSPrcode = (DataTable)dh.ExecuteSql("select pd_piid,pd_pdno,pd_custprodcode,pd_whcode,pd_prodcode,CollectedNum,UnCollectedNum,pd_outqty,pr_unit,pr_spec,pd_brand,pjd_zxbzs_user,pjd_id,pd_inoutno,pd_pocode,nvl(checknum,0)checknum,pd_remark from CS$InoutPrcode where pd_inoutno='" + pi_inoutno.Text + "' and combined=" + combined + " order by  pd_pdno", "select");
                 if (CSPrcode.Rows.Count == 0)
                 {
                     int CurrentIndex = 0;
@@ -1794,13 +1794,15 @@ namespace UAS_LabelMachine
                             string BPrUnit = GridPrcode.Rows[i].Cells["pr_unit"].Value.ToString();
                             string BPrBrand = GridPrcode.Rows[i].Cells["pd_brand"].Value.ToString();
                             string BPoCode = GridPrcode.Rows[i].Cells["pd_pocode1"].Value.ToString();
+                            string BRemark = GridPrcode.Rows[i].Cells["pd_remark"].Value.ToString();
                             string FProdCode = GridPrcode.Rows[i + 1].Cells["pd_prodcode"].Value.ToString();
                             string FCustProdCode = GridPrcode.Rows[i + 1].Cells["pd_custprodcode1"].Value.ToString();
                             string FPrUnit = GridPrcode.Rows[i + 1].Cells["pr_unit"].Value.ToString();
                             string FrBrand = GridPrcode.Rows[i + 1].Cells["pd_brand"].Value.ToString();
                             string FWhCode = GridPrcode.Rows[i + 1].Cells["pd_whcode"].Value.ToString();
                             string FPoCode = GridPrcode.Rows[i + 1].Cells["pd_pocode1"].Value.ToString();
-                            if (BProdCode == FProdCode && BPrBrand == FrBrand && BCustProdCode == FCustProdCode && (CombindetailTwo.Checked && FPoCode == BPoCode || Combindetail.Checked))
+                            string FRemark = GridPrcode.Rows[i + 1].Cells["pd_remark"].Value.ToString();
+                            if (BProdCode == FProdCode && BPrBrand == FrBrand && BCustProdCode == FCustProdCode && (CombindetailTwo.Checked && FPoCode == BPoCode || Combindetail.Checked || CombindetailThree.Checked && FRemark == BRemark))
                             {
                                 GridPrcode.Rows[CurrentIndex].Cells["pd_outqty"].Value = double.Parse(GridPrcode.Rows[CurrentIndex].Cells["pd_outqty"].Value.ToString()) + double.Parse(GridPrcode.Rows[i + 1].Cells["pd_outqty"].Value.ToString());
                                 GridPrcode.Rows[CurrentIndex].Cells["CollectedNum"].Value = double.Parse(GridPrcode.Rows[CurrentIndex].Cells["CollectedNum"].Value.ToString()) + double.Parse(GridPrcode.Rows[i + 1].Cells["CollectedNum"].Value.ToString());
@@ -1821,7 +1823,7 @@ namespace UAS_LabelMachine
             }
             else
             {
-                CSPrcode = (DataTable)dh.ExecuteSql("select pd_piid,pd_pdno,pd_custprodcode,pd_whcode,pd_prodcode,CollectedNum,UnCollectedNum,pd_outqty,pr_unit,pr_spec,pd_brand,pjd_zxbzs_user,pjd_id,pd_inoutno,pd_pocode,nvl(checknum,0)checknum from CS$InoutPrcode where pd_inoutno='" + pi_inoutno.Text + "' and combined=" + combined + " order by pd_pdno", "select");
+                CSPrcode = (DataTable)dh.ExecuteSql("select pd_piid,pd_pdno,pd_custprodcode,pd_whcode,pd_prodcode,CollectedNum,UnCollectedNum,pd_outqty,pr_unit,pr_spec,pd_brand,pjd_zxbzs_user,pjd_id,pd_inoutno,pd_pocode,nvl(checknum,0)checknum,pd_remark from CS$InoutPrcode where pd_inoutno='" + pi_inoutno.Text + "' and combined=" + combined + " order by pd_pdno", "select");
                 if (CSPrcode.Rows.Count == 0)
                 {
                     for (int i = 0; i < GridPrcode.Rows.Count; i++)
@@ -1849,8 +1851,8 @@ namespace UAS_LabelMachine
             {
                 sql.Clear();
                 sql.Append("insert into CS$InoutPrcode (pd_piid,pd_pdno,pd_custprodcode,pd_whcode,pd_prodcode,");
-                sql.Append("CollectedNum,UnCollectedNum,pd_outqty,pr_unit,pr_spec,pd_brand,pjd_zxbzs_user,pjd_id,pd_inoutno,combined,pd_pocode)");
-                sql.Append("values ('',:pd_pdno,:pd_custprodcode,:pd_whcode,:pd_prodcode,:CollectedNum,:UnCollectedNum,:pd_outqty,:pr_unit,:pr_spec,:pd_brand,:pjd_zxbzs_user,:pjd_id,:pd_inoutno,'" + combined + "',:pd_pocode)");
+                sql.Append("CollectedNum,UnCollectedNum,pd_outqty,pr_unit,pr_spec,pd_brand,pjd_zxbzs_user,pjd_id,pd_inoutno,combined,pd_pocode,pd_remark)");
+                sql.Append("values ('',:pd_pdno,:pd_custprodcode,:pd_whcode,:pd_prodcode,:CollectedNum,:UnCollectedNum,:pd_outqty,:pr_unit,:pr_spec,:pd_brand,:pjd_zxbzs_user,:pjd_id,:pd_inoutno,'" + combined + "',:pd_pocode,:pd_remark)");
                 dh.SaveDataTable((GridPrcode.DataSource as DataTable), "CS$InoutPrcode", "pd_piid", sql.ToString());
             }
             else
@@ -3260,6 +3262,6 @@ namespace UAS_LabelMachine
             }
         }
 
-       
+
     }
 }

+ 21 - 6
UAS-出货标签管理(贸易版)/PublicMethod/DataHelper.cs

@@ -25,15 +25,28 @@ namespace UAS_LabelMachine
         ////Oracle端口
         //public static readonly string OraclePort = "1521";
 
-        private readonly string ConnectionStrings = "Data Source=183.237.197.78/orcl;User ID=N_HC;PassWord=select!#%*(";
+        //private readonly string ConnectionStrings = "Data Source=183.237.197.78/orcl;User ID=N_HC;PassWord=select!#%*(";
 
-        private readonly string IPConnectionStrings = "Data Source=183.237.197.78/orcl;User ID=N_HC;PassWord=select!#%*(";
+        //private readonly string IPConnectionStrings = "Data Source=183.237.197.78/orcl;User ID=N_HC;PassWord=select!#%*(";
+        ////海创ERP地址
+        //public static readonly string ERPAddesss = "http://183.237.197.78:8099/ERP/";
+        ////海创FTP
+        //public static readonly string FTPAddress = "ftp://183.237.197.78|HCFTP|Admin1@#";
+
+        //public static readonly string InnerFTPAddress = "ftp://192.168.1.8|HCFTP|Admin1@#";
+        ////Oracle端口
+        //public static readonly string OraclePort = "1521";
+
+
+        private readonly string ConnectionStrings = "Data Source=81.71.42.91/orcl;User ID=MES;PassWord=select!#%*(";
+
+        private readonly string IPConnectionStrings = "Data Source=81.71.42.91/orcl;User ID=MES;PassWord=select!#%*(";
         //海创ERP地址
-        public static readonly string ERPAddesss = "http://183.237.197.78:8099/ERP/";
+        public static readonly string ERPAddesss = "http://81.71.42.91:8099/mes/";
         //海创FTP
-        public static readonly string FTPAddress = "ftp://183.237.197.78|HCFTP|Admin1@#";
+        public static readonly string FTPAddress = "ftp://81.71.42.91|vsftpd|uas321vsftpd2021";
 
-        public static readonly string InnerFTPAddress = "ftp://192.168.1.8|HCFTP|Admin1@#";
+        public static readonly string InnerFTPAddress = "ftp://81.71.42.91|vsftpd|uas321vsftpd2021";
         //Oracle端口
         public static readonly string OraclePort = "1521";
 
@@ -837,6 +850,7 @@ namespace UAS_LabelMachine
         {
             object result = null;
             command = new OracleCommand(SQL, connection);
+            Console.WriteLine(SQL);
             //用来拼接参数的
             if (names.Length > 0)
             {
@@ -875,8 +889,9 @@ namespace UAS_LabelMachine
                         ad.Fill((DataTable)result);
                         ad.Dispose();
                     }
-                    catch (Exception)
+                    catch (Exception ex)
                     {
+                        Console.WriteLine(ex.Message+ex.StackTrace);
                         connection = new OracleConnection(DBConnectionString);
                         connection.Open();
                         command.Connection = connection;

+ 50 - 50
UAS-出货标签管理(贸易版)/UAS_出货标签管理.Designer.cs

@@ -914,7 +914,7 @@
             // 
             this.Order_Prod.AutoSize = true;
             this.Order_Prod.Checked = true;
-            this.Order_Prod.Location = new System.Drawing.Point(52, 363);
+            this.Order_Prod.Location = new System.Drawing.Point(54, 365);
             this.Order_Prod.Name = "Order_Prod";
             this.Order_Prod.Size = new System.Drawing.Size(149, 28);
             this.Order_Prod.TabIndex = 92;
@@ -926,7 +926,7 @@
             // Order_Detno
             // 
             this.Order_Detno.AutoSize = true;
-            this.Order_Detno.Location = new System.Drawing.Point(52, 420);
+            this.Order_Detno.Location = new System.Drawing.Point(54, 422);
             this.Order_Detno.Name = "Order_Detno";
             this.Order_Detno.Size = new System.Drawing.Size(149, 28);
             this.Order_Detno.TabIndex = 91;
@@ -938,7 +938,7 @@
             // 
             this.label18.AutoSize = true;
             this.label18.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label18.Location = new System.Drawing.Point(143, 281);
+            this.label18.Location = new System.Drawing.Point(145, 283);
             this.label18.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label18.Name = "label18";
             this.label18.Size = new System.Drawing.Size(24, 31);
@@ -973,7 +973,7 @@
             // 
             this.label16.AutoSize = true;
             this.label16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label16.Location = new System.Drawing.Point(141, 135);
+            this.label16.Location = new System.Drawing.Point(143, 137);
             this.label16.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label16.Name = "label16";
             this.label16.Size = new System.Drawing.Size(24, 31);
@@ -1008,7 +1008,7 @@
             // 
             this.label12.AutoSize = true;
             this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label12.Location = new System.Drawing.Point(25, 227);
+            this.label12.Location = new System.Drawing.Point(27, 229);
             this.label12.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label12.Name = "label12";
             this.label12.Size = new System.Drawing.Size(110, 31);
@@ -1019,7 +1019,7 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(25, 85);
+            this.label7.Location = new System.Drawing.Point(27, 87);
             this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(110, 31);
@@ -1073,7 +1073,7 @@
             // 
             this.Capacity.AutoSize = true;
             this.Capacity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Capacity.Location = new System.Drawing.Point(123, 141);
+            this.Capacity.Location = new System.Drawing.Point(125, 143);
             this.Capacity.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.Capacity.Name = "Capacity";
             this.Capacity.Size = new System.Drawing.Size(0, 31);
@@ -1083,7 +1083,7 @@
             // 
             this.Process_midboxcode.AutoSize = true;
             this.Process_midboxcode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Process_midboxcode.Location = new System.Drawing.Point(123, 229);
+            this.Process_midboxcode.Location = new System.Drawing.Point(125, 231);
             this.Process_midboxcode.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.Process_midboxcode.Name = "Process_midboxcode";
             this.Process_midboxcode.Size = new System.Drawing.Size(28, 31);
@@ -1094,7 +1094,7 @@
             // 
             this.Process_outboxcode.AutoSize = true;
             this.Process_outboxcode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Process_outboxcode.Location = new System.Drawing.Point(123, 181);
+            this.Process_outboxcode.Location = new System.Drawing.Point(125, 183);
             this.Process_outboxcode.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.Process_outboxcode.Name = "Process_outboxcode";
             this.Process_outboxcode.Size = new System.Drawing.Size(28, 31);
@@ -1106,7 +1106,7 @@
             this.TotalCount.AutoSize = true;
             this.TotalCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.TotalCount.ForeColor = System.Drawing.Color.Blue;
-            this.TotalCount.Location = new System.Drawing.Point(191, 45);
+            this.TotalCount.Location = new System.Drawing.Point(193, 47);
             this.TotalCount.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.TotalCount.Name = "TotalCount";
             this.TotalCount.Size = new System.Drawing.Size(28, 31);
@@ -1117,7 +1117,7 @@
             // 
             this.label17.AutoSize = true;
             this.label17.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label17.Location = new System.Drawing.Point(163, 45);
+            this.label17.Location = new System.Drawing.Point(165, 47);
             this.label17.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label17.Name = "label17";
             this.label17.Size = new System.Drawing.Size(24, 31);
@@ -1129,7 +1129,7 @@
             this.CollectedCount.AutoSize = true;
             this.CollectedCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.CollectedCount.ForeColor = System.Drawing.Color.Red;
-            this.CollectedCount.Location = new System.Drawing.Point(127, 45);
+            this.CollectedCount.Location = new System.Drawing.Point(129, 47);
             this.CollectedCount.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.CollectedCount.Name = "CollectedCount";
             this.CollectedCount.Size = new System.Drawing.Size(28, 31);
@@ -1140,7 +1140,7 @@
             // 
             this.label14.AutoSize = true;
             this.label14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label14.Location = new System.Drawing.Point(23, 181);
+            this.label14.Location = new System.Drawing.Point(25, 183);
             this.label14.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label14.Name = "label14";
             this.label14.Size = new System.Drawing.Size(62, 31);
@@ -1151,7 +1151,7 @@
             // 
             this.label11.AutoSize = true;
             this.label11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label11.Location = new System.Drawing.Point(23, 227);
+            this.label11.Location = new System.Drawing.Point(25, 229);
             this.label11.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label11.Name = "label11";
             this.label11.Size = new System.Drawing.Size(62, 31);
@@ -1162,7 +1162,7 @@
             // 
             this.label13.AutoSize = true;
             this.label13.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label13.Location = new System.Drawing.Point(23, 101);
+            this.label13.Location = new System.Drawing.Point(25, 103);
             this.label13.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label13.Name = "label13";
             this.label13.Size = new System.Drawing.Size(86, 31);
@@ -1173,7 +1173,7 @@
             // 
             this.Installed.AutoSize = true;
             this.Installed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Installed.Location = new System.Drawing.Point(123, 101);
+            this.Installed.Location = new System.Drawing.Point(125, 103);
             this.Installed.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.Installed.Name = "Installed";
             this.Installed.Size = new System.Drawing.Size(0, 31);
@@ -1183,7 +1183,7 @@
             // 
             this.Process.AutoSize = true;
             this.Process.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Process.Location = new System.Drawing.Point(23, 45);
+            this.Process.Location = new System.Drawing.Point(25, 47);
             this.Process.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.Process.Name = "Process";
             this.Process.Size = new System.Drawing.Size(86, 31);
@@ -1321,7 +1321,7 @@
             this.pr_midboxcapacity_user.HeaderText = "pr_midboxcapacity_user";
             this.pr_midboxcapacity_user.Name = "pr_midboxcapacity_user";
             this.pr_midboxcapacity_user.Visible = false;
-            this.pr_midboxcapacity_user.Width = 162;
+            this.pr_midboxcapacity_user.Width = 319;
             // 
             // pib_ifpick
             // 
@@ -1345,7 +1345,7 @@
             this.pib_id1.HeaderText = "pib_id";
             this.pib_id1.Name = "pib_id1";
             this.pib_id1.Visible = false;
-            this.pib_id1.Width = 66;
+            this.pib_id1.Width = 127;
             // 
             // pib_pdno
             // 
@@ -1400,7 +1400,7 @@
             this.pr_zxbzs.HeaderText = "最小包装数";
             this.pr_zxbzs.Name = "pr_zxbzs";
             this.pr_zxbzs.Visible = false;
-            this.pr_zxbzs.Width = 90;
+            this.pr_zxbzs.Width = 118;
             // 
             // pr_unit
             // 
@@ -1408,7 +1408,7 @@
             this.pr_unit.HeaderText = "单位";
             this.pr_unit.Name = "pr_unit";
             this.pr_unit.Visible = false;
-            this.pr_unit.Width = 54;
+            this.pr_unit.Width = 97;
             // 
             // pib_lotno
             // 
@@ -1463,7 +1463,7 @@
             this.pib_barcode.Name = "pib_barcode";
             this.pib_barcode.ReadOnly = true;
             this.pib_barcode.Visible = false;
-            this.pib_barcode.Width = 78;
+            this.pib_barcode.Width = 118;
             // 
             // pib_custbarcode
             // 
@@ -1506,7 +1506,7 @@
             // 
             // pr_spec
             // 
-            this.pr_spec.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+            this.pr_spec.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
             this.pr_spec.DataPropertyName = "pr_spec";
             this.pr_spec.HeaderText = "规格";
             this.pr_spec.Name = "pr_spec";
@@ -1565,7 +1565,7 @@
             // 
             this.LabelSpace.AutoSize = true;
             this.LabelSpace.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.LabelSpace.Location = new System.Drawing.Point(23, 283);
+            this.LabelSpace.Location = new System.Drawing.Point(25, 285);
             this.LabelSpace.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.LabelSpace.Name = "LabelSpace";
             this.LabelSpace.Size = new System.Drawing.Size(142, 35);
@@ -1578,7 +1578,7 @@
             // 
             this.label8.AutoSize = true;
             this.label8.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.label8.Location = new System.Drawing.Point(15, 45);
+            this.label8.Location = new System.Drawing.Point(17, 47);
             this.label8.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label8.Name = "label8";
             this.label8.Size = new System.Drawing.Size(102, 35);
@@ -1588,7 +1588,7 @@
             // SingleDocRefresh
             // 
             this.SingleDocRefresh.AutoSize = true;
-            this.SingleDocRefresh.Location = new System.Drawing.Point(123, 45);
+            this.SingleDocRefresh.Location = new System.Drawing.Point(125, 47);
             this.SingleDocRefresh.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.SingleDocRefresh.Name = "SingleDocRefresh";
             this.SingleDocRefresh.Size = new System.Drawing.Size(82, 41);
@@ -1611,7 +1611,7 @@
             // 
             this.SingleLabelPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.SingleLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelPrint.Location = new System.Drawing.Point(161, 420);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(132, 416);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(136, 52);
@@ -1624,7 +1624,7 @@
             // 
             this.SingleLabelAutoPrint.AutoSize = true;
             this.SingleLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(25, 227);
+            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(27, 229);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.SingleLabelAutoPrint.Name = "SingleLabelAutoPrint";
             this.SingleLabelAutoPrint.Size = new System.Drawing.Size(142, 35);
@@ -1672,7 +1672,7 @@
             // MidLabelPreView
             // 
             this.MidLabelPreView.AutoSize = true;
-            this.MidLabelPreView.Location = new System.Drawing.Point(201, 45);
+            this.MidLabelPreView.Location = new System.Drawing.Point(203, 47);
             this.MidLabelPreView.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.MidLabelPreView.Name = "MidLabelPreView";
             this.MidLabelPreView.Size = new System.Drawing.Size(82, 41);
@@ -1697,7 +1697,7 @@
             // 
             this.label9.AutoSize = true;
             this.label9.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.label9.Location = new System.Drawing.Point(15, 45);
+            this.label9.Location = new System.Drawing.Point(17, 47);
             this.label9.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label9.Name = "label9";
             this.label9.Size = new System.Drawing.Size(102, 35);
@@ -1707,7 +1707,7 @@
             // MidDocRefresh
             // 
             this.MidDocRefresh.AutoSize = true;
-            this.MidDocRefresh.Location = new System.Drawing.Point(119, 45);
+            this.MidDocRefresh.Location = new System.Drawing.Point(121, 47);
             this.MidDocRefresh.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.MidDocRefresh.Name = "MidDocRefresh";
             this.MidDocRefresh.Size = new System.Drawing.Size(82, 41);
@@ -1733,7 +1733,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label5.Location = new System.Drawing.Point(21, 353);
+            this.label5.Location = new System.Drawing.Point(23, 355);
             this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(62, 31);
@@ -1744,7 +1744,7 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(21, 291);
+            this.label4.Location = new System.Drawing.Point(23, 293);
             this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(62, 31);
@@ -1765,7 +1765,7 @@
             // 
             this.label15.AutoSize = true;
             this.label15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label15.Location = new System.Drawing.Point(203, 293);
+            this.label15.Location = new System.Drawing.Point(205, 295);
             this.label15.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label15.Name = "label15";
             this.label15.Size = new System.Drawing.Size(38, 31);
@@ -1798,7 +1798,7 @@
             // 
             this.MidLabelAutoPrint.AutoSize = true;
             this.MidLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MidLabelAutoPrint.Location = new System.Drawing.Point(15, 217);
+            this.MidLabelAutoPrint.Location = new System.Drawing.Point(17, 219);
             this.MidLabelAutoPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.MidLabelAutoPrint.Name = "MidLabelAutoPrint";
             this.MidLabelAutoPrint.Size = new System.Drawing.Size(142, 35);
@@ -1847,7 +1847,7 @@
             // 
             this.DiffCustOutBoxCode.AutoSize = true;
             this.DiffCustOutBoxCode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.DiffCustOutBoxCode.Location = new System.Drawing.Point(199, 337);
+            this.DiffCustOutBoxCode.Location = new System.Drawing.Point(201, 339);
             this.DiffCustOutBoxCode.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffCustOutBoxCode.Name = "DiffCustOutBoxCode";
             this.DiffCustOutBoxCode.Size = new System.Drawing.Size(142, 35);
@@ -1876,7 +1876,7 @@
             // 
             this.cu_print_ordercode.AutoSize = true;
             this.cu_print_ordercode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_ordercode.Location = new System.Drawing.Point(17, 139);
+            this.cu_print_ordercode.Location = new System.Drawing.Point(19, 141);
             this.cu_print_ordercode.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.cu_print_ordercode.Name = "cu_print_ordercode";
             this.cu_print_ordercode.Size = new System.Drawing.Size(142, 35);
@@ -1888,7 +1888,7 @@
             // 
             this.cu_print_outpo.AutoSize = true;
             this.cu_print_outpo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_outpo.Location = new System.Drawing.Point(17, 93);
+            this.cu_print_outpo.Location = new System.Drawing.Point(19, 95);
             this.cu_print_outpo.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.cu_print_outpo.Name = "cu_print_outpo";
             this.cu_print_outpo.Size = new System.Drawing.Size(142, 35);
@@ -1900,7 +1900,7 @@
             // 
             this.cu_print_outdc.AutoSize = true;
             this.cu_print_outdc.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_outdc.Location = new System.Drawing.Point(17, 235);
+            this.cu_print_outdc.Location = new System.Drawing.Point(19, 237);
             this.cu_print_outdc.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.cu_print_outdc.Name = "cu_print_outdc";
             this.cu_print_outdc.Size = new System.Drawing.Size(80, 35);
@@ -1912,7 +1912,7 @@
             // 
             this.cu_print_outlotno.AutoSize = true;
             this.cu_print_outlotno.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_outlotno.Location = new System.Drawing.Point(17, 185);
+            this.cu_print_outlotno.Location = new System.Drawing.Point(19, 187);
             this.cu_print_outlotno.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.cu_print_outlotno.Name = "cu_print_outlotno";
             this.cu_print_outlotno.Size = new System.Drawing.Size(117, 35);
@@ -1924,7 +1924,7 @@
             // 
             this.cu_print_outprod.AutoSize = true;
             this.cu_print_outprod.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.cu_print_outprod.Location = new System.Drawing.Point(17, 43);
+            this.cu_print_outprod.Location = new System.Drawing.Point(19, 45);
             this.cu_print_outprod.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.cu_print_outprod.Name = "cu_print_outprod";
             this.cu_print_outprod.Size = new System.Drawing.Size(142, 35);
@@ -1936,7 +1936,7 @@
             // 
             this.label19.AutoSize = true;
             this.label19.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.label19.Location = new System.Drawing.Point(11, 47);
+            this.label19.Location = new System.Drawing.Point(13, 49);
             this.label19.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label19.Name = "label19";
             this.label19.Size = new System.Drawing.Size(102, 35);
@@ -1946,7 +1946,7 @@
             // OutDocRefresh
             // 
             this.OutDocRefresh.AutoSize = true;
-            this.OutDocRefresh.Location = new System.Drawing.Point(117, 47);
+            this.OutDocRefresh.Location = new System.Drawing.Point(119, 49);
             this.OutDocRefresh.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.OutDocRefresh.Name = "OutDocRefresh";
             this.OutDocRefresh.Size = new System.Drawing.Size(82, 41);
@@ -1958,7 +1958,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(199, 47);
+            this.LogingOut.Location = new System.Drawing.Point(201, 49);
             this.LogingOut.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(146, 41);
@@ -1996,7 +1996,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(191, 289);
+            this.label10.Location = new System.Drawing.Point(193, 291);
             this.label10.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(62, 31);
@@ -2007,7 +2007,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(189, 229);
+            this.label6.Location = new System.Drawing.Point(191, 231);
             this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(62, 31);
@@ -2299,6 +2299,10 @@
         private System.Windows.Forms.CheckBox cu_print_ordercode;
         private System.Windows.Forms.CheckBox LabelSpace;
         private System.Windows.Forms.CheckBox DiffCustOutBoxCode;
+        private System.Windows.Forms.LinkLabel MidLabelPreView;
+        private System.Windows.Forms.RadioButton Order_Prod;
+        private System.Windows.Forms.RadioButton Order_Detno;
+        private System.Windows.Forms.CheckBox FTPModel;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_midboxcapacity_user;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifpick;
@@ -2327,9 +2331,5 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode2;
-        private System.Windows.Forms.LinkLabel MidLabelPreView;
-        private System.Windows.Forms.RadioButton Order_Prod;
-        private System.Windows.Forms.RadioButton Order_Detno;
-        private System.Windows.Forms.CheckBox FTPModel;
     }
 }

+ 2 - 2
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -155,7 +155,7 @@ namespace UAS_LabelMachine
 
         public static DataTable Attach;
 
-        public string PrintMethod = "CodeSoft";
+        public string PrintMethod = "";
         /// <summary>
         /// 用于记录外箱号和当前的箱号进行比对,判断当前行和上一行是否是同一个箱号,从而判断是否要打印空白页
         /// </summary>
@@ -257,7 +257,7 @@ namespace UAS_LabelMachine
                 LabelSpace.Visible = true;
                 LabelSpace.Checked = true;
             }
-            if (Code == "")
+            if (Code != "")
             {
                 try
                 {

+ 1 - 1
UAS-出货标签管理(贸易版)/客户标签维护.cs

@@ -222,7 +222,7 @@ namespace UAS_LabelMachine
             //根据勾选的不同设置不同的文件后缀过滤
             if (CodeSoft.Checked)
             {
-                openFileDialog1.Filter = "(*.lab)|*.lab";
+                openFileDialog1.Filter = "(*.btw)|*.btw";
             }
             if (BarTender.Checked)
             {

+ 215 - 203
UAS-出货标签管理(贸易版)/生成条码.cs

@@ -98,238 +98,245 @@ namespace UAS_LabelMachine
         /// <param name="e"></param>
         private void GenerateBarCode_Click(object sender, EventArgs e)
         {
-            //获取编码规则
-            DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + CustCode + "' order by nrd_detno", "select");
-            //如果没有则取公共规则
-            if (Nr.Rows.Count == 0)
-                Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
-            //用于过滤参数的正则表达式
-            if (Nr.Rows.Count > 0)
+            try
             {
-                NrCode = Nr.Rows[0]["nr_code"].ToString();
-            }
-            Regex match = new Regex("{\\w+}");
-            //用于存放每一项的明细的数据
-            string[] NrData = new string[Nr.Rows.Count];
-            //流水号的索引
-            int SerialNumIndex = 0;
-            //流水长度
-            int SerialNumLength = 0;
-            //存放键值对
-            int Radix = 10;
-            string PrefixFixed = "";
-            for (int m = 0; m < Nr.Rows.Count; m++)
-            {
-                switch (Nr.Rows[m]["nrd_type"].ToString())
+                //获取编码规则
+                DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + CustCode + "' order by nrd_detno", "select");
+                //如果没有则取公共规则
+                if (Nr.Rows.Count == 0)
+                    Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
+                //用于过滤参数的正则表达式
+                if (Nr.Rows.Count > 0)
                 {
-                    //常量直接进行拼接
-                    case "常量":
-                        NrData[m] = Nr.Rows[m]["nrd_sql"].ToString();
-                        Prefix += NrData[m];
-                        Suffix += NrData[m];
-                        break;
-                    case "SQL":
-                        string SQL = Nr.Rows[m]["nrd_sql"].ToString();
-                        DataTable Temp;
-                        //如果不包含参数替换
-                        if (SQL.IndexOf("{") == 0)
-                        {
-                            Temp = (DataTable)dh.ExecuteSql(SQL, "select");
-                        }
-                        else
-                        {
-                            //替换参数后重新执行SQL
-                            foreach (Match mch in match.Matches(SQL))
+                    NrCode = Nr.Rows[0]["nr_code"].ToString();
+                }
+                Regex match = new Regex("{\\w+}");
+                //用于存放每一项的明细的数据
+                string[] NrData = new string[Nr.Rows.Count];
+                //流水号的索引
+                int SerialNumIndex = 0;
+                //流水长度
+                int SerialNumLength = 0;
+                //存放键值对
+                int Radix = 10;
+                string PrefixFixed = "";
+                for (int m = 0; m < Nr.Rows.Count; m++)
+                {
+                    switch (Nr.Rows[m]["nrd_type"].ToString())
+                    {
+                        //常量直接进行拼接
+                        case "常量":
+                            NrData[m] = Nr.Rows[m]["nrd_sql"].ToString();
+                            Prefix += NrData[m];
+                            Suffix += NrData[m];
+                            break;
+                        case "SQL":
+                            string SQL = Nr.Rows[m]["nrd_sql"].ToString();
+                            DataTable Temp;
+                            //如果不包含参数替换
+                            if (SQL.IndexOf("{") == 0)
                             {
-                                SQL = SQL.Replace(mch.Value.Trim(), "'" + pi_inoutno.Text + "'");
+                                Temp = (DataTable)dh.ExecuteSql(SQL, "select");
                             }
-                            Temp = (DataTable)dh.ExecuteSql(SQL, "select");
-                        }
-                        if (Temp.Rows.Count > 0)
+                            else
+                            {
+                                //替换参数后重新执行SQL
+                                foreach (Match mch in match.Matches(SQL))
+                                {
+                                    SQL = SQL.Replace(mch.Value.Trim(), "'" + pi_inoutno.Text + "'");
+                                }
+                                Temp = (DataTable)dh.ExecuteSql(SQL, "select");
+                            }
+                            if (Temp.Rows.Count > 0)
+                            {
+                                NrData[m] = Temp.Rows[0][0].ToString();
+                                Prefix += NrData[m];
+                                Suffix += NrData[m];
+                            }
+                            else
+                            {
+                                NrData[m] = "";
+                                Prefix += NrData[m];
+                                Suffix += NrData[m];
+                            }
+                            break;
+                        //流水需要通过MaxNumber去取
+                        case "流水":
+                            NrData[m] = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "'").ToString();
+                            Suffix = "";
+                            PrefixFixed = Prefix;
+                            //设置当前流水
+                            custserialnum = int.Parse(NrData[m] == "" ? "0" : NrData[m]);
+                            SerialNumIndex = m;
+                            SerialNumLength = int.Parse(Nr.Rows[m]["nrd_length"].ToString());
+                            Radix = int.Parse(Nr.Rows[m]["nrd_radix"].ToString());
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                //获取最大的流水号
+                string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'").ToString();
+                //如果流水号为空则插入一条新记录,从1开始取
+                if (maxnum == "")
+                {
+                    dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + NrCode + "','" + Prefix + "','1')", "insert");
+                    custserialnum = 1;
+                }
+                //如果流水号不为空则取当前流水
+                else
+                {
+                    custserialnum = int.Parse(maxnum);
+                }
+                //有错误需要提醒的内容
+                int CheckedRowCount = 0;
+                string ErrRowIndex = "";
+                //遍历整个Grid,勾选的项目全部进行条码生成
+                for (int i = 0; i < ProdIoInfDGV.RowCount; i++)
+                {
+                    if (ProdIoInfDGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
+                    {
+                        CheckedRowCount++;
+                        List<string> pib_inqty = new List<string>();
+                        string pd_id = ProdIoInfDGV.Rows[i].Cells["pd_id"].FormattedValue.ToString();
+                        string pd_prodcode = ProdIoInfDGV.Rows[i].Cells["pd_prodcode"].FormattedValue.ToString();
+                        string pr_id = ProdIoInfDGV.Rows[i].Cells["pr_id"].FormattedValue.ToString();
+                        string pd_ordercode = ProdIoInfDGV.Rows[i].Cells["pd_ordercode"].FormattedValue.ToString();
+                        string pd_pdno = ProdIoInfDGV.Rows[i].Cells["pd_pdno"].FormattedValue.ToString();
+                        string pd_orderdetno = ProdIoInfDGV.Rows[i].Cells["pd_orderdetno"].FormattedValue.ToString();
+                        string pr_brand = ProdIoInfDGV.Rows[i].Cells["pr_brand"].FormattedValue.ToString();
+                        //总数
+                        decimal pd_totalqty = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].FormattedValue.ToString());
+                        //本次数量
+                        decimal pd_qty = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pd_qty"].FormattedValue.ToString());
+                        //最小包装数
+                        decimal pr_zxbzs = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].FormattedValue.ToString());
+                        //中盒容量
+                        int mid_qty;
+                        try
                         {
-                            NrData[m] = Temp.Rows[0][0].ToString();
-                            Prefix += NrData[m];
-                            Suffix += NrData[m];
+                            mid_qty = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_qty"].FormattedValue.ToString());
                         }
-                        else
+                        catch (Exception)
                         {
-                            NrData[m] = "";
-                            Prefix += NrData[m];
-                            Suffix += NrData[m];
+                            MessageBox.Show("请检查中盒容量");
+                            return;
                         }
-                        break;
-                    //流水需要通过MaxNumber去取
-                    case "流水":
-                        NrData[m] = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "'").ToString();
-                        Suffix = "";
-                        PrefixFixed = Prefix;
-                        //设置当前流水
-                        custserialnum = int.Parse(NrData[m] == "" ? "0" : NrData[m]);
-                        SerialNumIndex = m;
-                        SerialNumLength = int.Parse(Nr.Rows[m]["nrd_length"].ToString());
-                        Radix = int.Parse(Nr.Rows[m]["nrd_radix"].ToString());
-                        break;
-                    default:
-                        break;
-                }
-            }
-            //获取最大的流水号
-            string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'").ToString();
-            //如果流水号为空则插入一条新记录,从1开始取
-            if (maxnum == "")
-            {
-                dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + NrCode + "','" + Prefix + "','1')", "insert");
-                custserialnum = 1;
-            }
-            //如果流水号不为空则取当前流水
-            else
-            {
-                custserialnum = int.Parse(maxnum);
-            }
-            //有错误需要提醒的内容
-            int CheckedRowCount = 0;
-            string ErrRowIndex = "";
-            //遍历整个Grid,勾选的项目全部进行条码生成
-            for (int i = 0; i < ProdIoInfDGV.RowCount; i++)
-            {
-                if (ProdIoInfDGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
-                {
-                    CheckedRowCount++;
-                    List<string> pib_inqty = new List<string>();
-                    string pd_id = ProdIoInfDGV.Rows[i].Cells["pd_id"].FormattedValue.ToString();
-                    string pd_prodcode = ProdIoInfDGV.Rows[i].Cells["pd_prodcode"].FormattedValue.ToString();
-                    string pr_id = ProdIoInfDGV.Rows[i].Cells["pr_id"].FormattedValue.ToString();
-                    string pd_ordercode = ProdIoInfDGV.Rows[i].Cells["pd_ordercode"].FormattedValue.ToString();
-                    string pd_pdno = ProdIoInfDGV.Rows[i].Cells["pd_pdno"].FormattedValue.ToString();
-                    string pd_orderdetno = ProdIoInfDGV.Rows[i].Cells["pd_orderdetno"].FormattedValue.ToString();
-                    string pr_brand = ProdIoInfDGV.Rows[i].Cells["pr_brand"].FormattedValue.ToString();
-                    //总数
-                    decimal pd_totalqty = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].FormattedValue.ToString());
-                    //本次数量
-                    decimal pd_qty = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pd_qty"].FormattedValue.ToString());
-                    //最小包装数
-                    decimal pr_zxbzs = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].FormattedValue.ToString());
-                    //中盒容量
-                    int mid_qty;
-                    try
-                    {
-                        mid_qty = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_qty"].FormattedValue.ToString());
-                    }
-                    catch (Exception)
-                    {
-                        MessageBox.Show("请检查中盒容量");
-                        return;
-                    }
-                    //如果中盘盒数量为1且有尾数则表示一箱未装满
-                    int mid_num = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_num"].FormattedValue.ToString());
-                    //中盒尾数
-                    decimal mid_remain = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["mid_remain"].FormattedValue.ToString());
-                    string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
-                    //中盒数量*中盒容量=需要打印的单盘标签
-                    ArrayList<string> midcode = new ArrayList<string>();
-                    ArrayList<string> barcode = new ArrayList<string>();
-                    ArrayList<string> custbarcode = new ArrayList<string>();
-                    decimal restqty1 = 0;
-                    if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value != null && ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
-                    {
-                        string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
-                        for (int k = 0; k < restqty.Length; k++)
+                        //如果中盘盒数量为1且有尾数则表示一箱未装满
+                        int mid_num = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_num"].FormattedValue.ToString());
+                        //中盒尾数
+                        decimal mid_remain = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["mid_remain"].FormattedValue.ToString());
+                        string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
+                        //中盒数量*中盒容量=需要打印的单盘标签
+                        ArrayList<string> midcode = new ArrayList<string>();
+                        ArrayList<string> barcode = new ArrayList<string>();
+                        ArrayList<string> custbarcode = new ArrayList<string>();
+                        decimal restqty1 = 0;
+                        if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value != null && ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
                         {
-                            string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
-                            decimal.TryParse(restqty[k], out restqty1);
-                            barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
-                            custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
-                            midcode.Add(mid_code);
-                            pib_inqty.Add(restqty1.ToString());
-                            //剩余生成的数量需要减掉尾数
+                            string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
+                            for (int k = 0; k < restqty.Length; k++)
+                            {
+                                string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
+                                decimal.TryParse(restqty[k], out restqty1);
+                                barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
+                                custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                                midcode.Add(mid_code);
+                                pib_inqty.Add(restqty1.ToString());
+                                //剩余生成的数量需要减掉尾数
+                            }
                         }
-                    }
-                    //循环中盒号的个数,取当前出入库单最大 的中盒号+1
-                    for (int j = 0; j < mid_num; j++)
-                    {
-                        //获取中盘的编号
-                        string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+" + (j + 1), "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
-                        //如果尾数不为0,并且已经遍历到了最后一箱(未装满的箱)
-                        int count = 0;
-                        decimal AddNum = pr_zxbzs;
-                        if (mid_remain != 0 && j + 1 == mid_num)
+                        //循环中盒号的个数,取当前出入库单最大 的中盒号+1
+                        for (int j = 0; j < mid_num; j++)
                         {
-                            //剩下的尾数刚好够整数的最小包或者加上一个未装满的最小包
-                            int num = 0;
-                            if (int.TryParse((mid_remain % pr_zxbzs).ToString(), out num))
+                            //获取中盘的编号
+                            string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+" + (j + 1), "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
+                            //如果尾数不为0,并且已经遍历到了最后一箱(未装满的箱)
+                            int count = 0;
+                            decimal AddNum = pr_zxbzs;
+                            if (mid_remain != 0 && j + 1 == mid_num)
                             {
-                                //如果小于最小包装数就是一条尾数
-                                if (mid_remain > pr_zxbzs)
+                                //剩下的尾数刚好够整数的最小包或者加上一个未装满的最小包
+                                int num = 0;
+                                if (int.TryParse((mid_remain % pr_zxbzs).ToString(), out num))
                                 {
-                                    if (mid_remain % pr_zxbzs != 0)
-                                        count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString()) + 1;
+                                    //如果小于最小包装数就是一条尾数
+                                    if (mid_remain > pr_zxbzs)
+                                    {
+                                        if (mid_remain % pr_zxbzs != 0)
+                                            count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString()) + 1;
+                                        else
+                                            count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString());
+                                    }
                                     else
-                                        count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString());
+                                        count = 1;
                                 }
                                 else
-                                    count = 1;
+                                {
+                                    count = int.Parse(Math.Ceiling(mid_remain / pr_zxbzs).ToString());
+                                }
                             }
                             else
                             {
-                                count = int.Parse(Math.Ceiling(mid_remain / pr_zxbzs).ToString());
+                                //循环中盒的箱内容量
+                                count = mid_qty;
+                            }
+                            for (int k = 0; k < count; k++)
+                            {
+                                //将箱号添加进List
+                                barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
+                                custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                                midcode.Add(mid_code);
+                                if (mid_remain % pr_zxbzs != 0 && k + 1 == count && j + 1 == mid_num)
+                                    AddNum = mid_remain % pr_zxbzs;
+                                pib_inqty.Add(AddNum.ToString());
                             }
                         }
-                        else
+                        if (barcode.Count > 0)
                         {
-                            //循环中盒的箱内容量
-                            count = mid_qty;
+                            //插入条码
+                            sql.Clear();
+                            sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_CUSTBARCODE,PIB_PDNO,");
+                            sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO,pib_orderdetno)");
+                            sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "','" + User.UserName + "',sysdate,'" + pi_inoutno.Text + "'," + pi_id + ",'" + pr_brand + "',:barcode,:custbarcode,'" + pd_pdno + "','" + pd_id + "',");
+                            sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',:midcode,0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "')");
+                            dh.BatchInsert(sql.ToString(), new string[] { "barcode", "custbarcode", "pib_inqty", "midcode" }, barcode.ToArray(), custbarcode.ToArray(), pib_inqty.ToArray(), midcode.ToArray());
+                            //更新最大流水号
+                            dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
                         }
-                        for (int k = 0; k < count; k++)
+                        else
                         {
-                            //将箱号添加进List
-                            barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
-                            custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
-                            midcode.Add(mid_code);
-                            if (mid_remain % pr_zxbzs != 0 && k + 1 == count && j + 1 == mid_num)
-                                AddNum = mid_remain % pr_zxbzs;
-                            pib_inqty.Add(AddNum.ToString());
+                            ErrRowIndex += (i + 1) + ",";
                         }
                     }
-                    if (barcode.Count > 0)
-                    {
-                        //插入条码
-                        sql.Clear();
-                        sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_CUSTBARCODE,PIB_PDNO,");
-                        sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO,pib_orderdetno)");
-                        sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "','" + User.UserName + "',sysdate,'" + pi_inoutno.Text + "'," + pi_id + ",'" + pr_brand + "',:barcode,:custbarcode,'" + pd_pdno + "','" + pd_id + "',");
-                        sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',:midcode,0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "')");
-                        dh.BatchInsert(sql.ToString(), new string[] { "barcode", "custbarcode", "pib_inqty", "midcode" }, barcode.ToArray(), custbarcode.ToArray(), pib_inqty.ToArray(), midcode.ToArray());
-                        //更新最大流水号
-                        dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
-                    }
-                    else
-                    {
-                        ErrRowIndex += (i + 1) + ",";
-                    }
                 }
+                if (ErrRowIndex != "")
+                {
+                    MessageBox.Show(ErrRowIndex + "行无可用条码,请检查本次数量");
+                    return;
+                }
+                if (CheckedRowCount > 0)
+                {
+                    LoadData();
+                    MessageBox.Show("生成条码成功!");
+                }
+                else
+                {
+                    MessageBox.Show("未勾选需要生成的明细!");
+                }
+                //如果含有内容不符合的选项,进行提示
+                string str = "";
+                foreach (string ss in NotPass.Values)
+                {
+                    str += ss + "\n";
+                }
+                if (str != "")
+                    MessageBox.Show(str);
             }
-            if (ErrRowIndex != "")
-            {
-                MessageBox.Show(ErrRowIndex + "行无可用条码,请检查本次数量");
-                return;
-            }
-            if (CheckedRowCount > 0)
-            {
-                LoadData();
-                MessageBox.Show("生成条码成功!");
-            }
-            else
-            {
-                MessageBox.Show("未勾选需要生成的明细!");
-            }
-            //如果含有内容不符合的选项,进行提示
-            string str = "";
-            foreach (string ss in NotPass.Values)
+            catch (Exception ex)
             {
-                str += ss + "\n";
+                MessageBox.Show(ex.Message + ex.StackTrace);
             }
-            if (str != "")
-                MessageBox.Show(str);
         }
 
         //生成唯一条码
@@ -507,10 +514,10 @@ namespace UAS_LabelMachine
             {
                 pi_id = dt.Rows[0]["pi_id"].ToString();
                 BaseUtil.SetFormValue(this.Controls, dt);
+                string outsql = "";
                 switch (pi_class.Text)
                 {
                     case "出货单":
-                        string outsql = "";
                         LogicHandler.GenerateBarCode(pi_id, CustCode + "|" + DataType, out outsql);
                         sql.Clear();
                         sql.Append(outsql);
@@ -524,6 +531,11 @@ namespace UAS_LabelMachine
                         sql.Append("from prodiodetail  group by pd_piid,pd_ordercode, pd_orderdetno,pd_pdno)T left join product ");
                         sql.Append("on pr_code=pd_prodcode )  where  pd_piid='" + pi_id + "' order by pd_pdno");
                         break;
+                    case "其它出库单":
+                        LogicHandler.GenerateBarCode(pi_id, CustCode + "|" + DataType, out outsql);
+                        sql.Clear();
+                        sql.Append(outsql);
+                        break;
                     default:
                         break;
                 }

+ 4 - 4
UAS-出货标签管理/PublicMethod/DataHelper.cs

@@ -12,12 +12,12 @@ namespace UAS_LabelMachine
     {
 
         //富为外网地址
-        private readonly string ConnectionStrings = "Data Source=richwell.3322.org/orcl;User ID=FW;PassWord=select!#%*(";
-        private readonly string InnerConnectionStrings = "Data Source=richwell.3322.org/orcl;User ID=FW;PassWord=select!#%*(";
+        private readonly string ConnectionStrings = "Data Source=fuw.ubtob.net/orcl;User ID=FW;PassWord=select!#%*(";
+        private readonly string InnerConnectionStrings = "Data Source=fuw.ubtob.net/orcl;User ID=FW;PassWord=select!#%*(";
         //富为ERP地址
-        public static readonly string ERPAddesss = "http://richwellgroup.com.cn:8099/ERP/";
+        public static readonly string ERPAddesss = "http://fuw.ubtob.net:8099/ERP/";
         //富为FTP
-        public static readonly string FTPAdress = "ftp://richwell.3322.org|printuser|printuser";
+        public static readonly string FTPAdress = "ftp://fuw.ubtob.net|printuser|printuser";
         //Oracle端口
         public static readonly string OraclePort = "1521";
         //需要显示的账套

+ 5 - 5
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -225,7 +225,7 @@ namespace UAS_LabelMachine
                 MidLabelAutoPrint.Checked = true;
                 pib_madein.Visible = true;
             }
-            if (!(DataHelper.DBConnectionString.Contains("richwell") || DataHelper.DBConnectionString.Contains("192.168.0.88")))
+            if (!(DataHelper.DBConnectionString.Contains("fuw") || DataHelper.DBConnectionString.Contains("192.168.0.88")))
             {
                 pib_cusbarcode.Visible = false;
                 pib_cusoutboxcode.Visible = false;
@@ -2058,10 +2058,10 @@ namespace UAS_LabelMachine
             AllCollect = false;
             PrintedVivoOutboxCode.Clear();
             //如果是富为则使用特殊的查询语句                                
-            if (DataHelper.DBConnectionString.Contains("richwell") || DataHelper.DBConnectionString.Contains("192.168.0.88"))
+            if (DataHelper.DBConnectionString.Contains("fuw") || DataHelper.DBConnectionString.Contains("192.168.0.88"))
             {
                 sql.Clear();
-                sql.Append("select pib_ifrecheck,pd_custprodcode,pd_pocode,pd_inoutno,pib_datecode1,pib_custoutboxcode,pib_madein,pib_custbarcode,pib_brand,pib_cusbarcode,pib_cusoutboxcode,pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,");
+                sql.Append("select pib_ifrecheck,pd_custprodcode,pd_pocode,pd_inoutno,' 'pib_datecode1,pib_custoutboxcode,pib_madein,pib_custbarcode,pib_brand,pib_cusbarcode,pib_cusoutboxcode,pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,");
                 sql.Append("pr_brand,pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pib_barcode,pib_outboxcode1,pib_outboxcode2,pib_ifpick,pib_ifprint,");
                 sql.Append("pr_spec,pd_prodcode,pd_pocode,pr_code from prodiobarcode  left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno ");
                 sql.Append("and pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join (select pd_prodcode ");
@@ -2073,7 +2073,7 @@ namespace UAS_LabelMachine
             else
             {
                 sql.Clear();
-                sql.Append("select 0 choose,pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
+                sql.Append("select 0 choose,pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,' 'pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
                 sql.Append("pib_lotno,pib_datecode,pib_qty,pr_spec,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint");
                 sql.Append(" from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
                 sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
@@ -2268,7 +2268,7 @@ namespace UAS_LabelMachine
         {
             if (e.RowIndex >= 0)
             {
-                if (!(DataHelper.DBConnectionString.Contains("richwell") || DataHelper.DBConnectionString.Contains("192.168.0.88")))
+                if (!(DataHelper.DBConnectionString.Contains("fuw") || DataHelper.DBConnectionString.Contains("192.168.0.88")))
                 {
                     if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
                     {

+ 7 - 0
UAS_AutoPass/Login.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Data;
 using System.Windows.Forms;
 using UAS_AutoPass.ToolClass;
 
@@ -7,6 +8,8 @@ namespace UAS_AutoPass
     public partial class Login : Form
     {
 
+        DataHelper dh = new DataHelper();
+
         public Login()
         {
             StartPosition = FormStartPosition.CenterScreen;
@@ -34,6 +37,10 @@ namespace UAS_AutoPass
 
         private void Login_Load(object sender, EventArgs e)
         {
+            DataTable DB = (DataTable)dh.ExecuteSql("select ms_pwd,ma_user,ma_address,ma_inneraddress from master where ma_user='MES'", "select");
+            Master.DataSource = DB;
+            Master.DisplayMember = "ma_user";
+            Master.ValueMember = "ma_user";
             UserName.Text = BaseUtil.GetCacheData("UserName").ToString();
             Source.Text = BaseUtil.GetCacheData("Source").ToString();
             if (UserName.Text != "")

+ 26 - 16
UAS_MES_PW/FunctionCode/Make/Make_GetTestFileData.cs

@@ -82,24 +82,32 @@ namespace UAS_MES_NEW.Make
                     ma_code.Text = omakeCode;
                     LoadCollectedNum();
                     //发送对应平台的指令
-                    if (MTK.Checked)
-                    {
-                        BaseUtil.GetDataFromDevice("MTK");
-                    }
-                    else
-                    {
-                        BaseUtil.GetDataFromDevice("ZHANXUN");
-                    }
+                    //if (MTK.Checked)
+                    //{
+                    //    BaseUtil.GetDataFromDevice("MTK");
+                    //}
+                    //else
+                    //{
+                    //    BaseUtil.GetDataFromDevice("ZHANXUN");
+                    //}
                     string ms_prodcode = dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id='" + oMsid + "'").ToString();
                     DataTable dt = new DataTable();
                     if (Directory.Exists(Application.StartupPath + "/" + DateTime.Now.ToString("yyyy-MM-dd") + @"/" + sncode.Text))
                     {
                         DirectoryInfo di = new DirectoryInfo(Application.StartupPath + "/" + DateTime.Now.ToString("yyyy-MM-dd") + @"/" + sncode.Text);
-                        di.Delete(true);
+                     //   di.Delete(true);
                     }
-                    BaseUtil.GetDataFromDevice("GETFILE", WatchPath.Text + " ./" + DateTime.Now.ToString("yyyy-MM-dd") + @"/" + sncode.Text);
+                    //BaseUtil.GetDataFromDevice("GETFILE", WatchPath.Text + " ./" + DateTime.Now.ToString("yyyy-MM-dd") + @"/" + sncode.Text);
                     string[] files = Directory.GetFiles(Application.StartupPath + "/" + DateTime.Now.ToString("yyyy-MM-dd") + @"/" + sncode.Text + "", "*.csv");
-                    BaseUtil.OpenCSVFile(ref dt, files[0]);
+
+                    if (!BaseUtil.OpenCSVFile(ref dt, files[0]))
+                    {
+                        if (files.Length > 1)
+                        {
+                            dt = new DataTable();
+                            BaseUtil.OpenCSVFile(ref dt, files[1]);
+                        }
+                    }
                     //移除标题行
                     dt.Rows.RemoveAt(0);
                     //设置列名绑定数据
@@ -113,11 +121,13 @@ namespace UAS_MES_NEW.Make
                     dt.Columns[7].ColumnName = "std_googlekey";
                     dt.Columns[8].ColumnName = "std_videotest";
                     dt.Columns[9].ColumnName = "std_version";
-                    if (dt.Columns.Count > 11) {
+                    if (dt.Columns.Count > 11)
+                    {
                         dt.Columns[10].ColumnName = "std_rom";
                         dt.Columns[11].ColumnName = "std_ram";
                     }
-                    if (dt.Rows.Count > 0) {
+                    if (dt.Rows.Count > 0)
+                    {
                         PSN.Text = dt.Rows[0]["std_sn"].ToString();
                         MAC.Text = dt.Rows[0]["std_mac"].ToString().Replace(":", "").ToUpper();
                         BT.Text = dt.Rows[0]["std_bt"].ToString().Replace(":", "").ToUpper();
@@ -157,7 +167,7 @@ namespace UAS_MES_NEW.Make
                         }
                         else
                         {
-                            OperateResult.AppendText(PSN.Text + "读取【IMEI1】:"+IMEI1.Text+",系统导入:"+imei1+",比对失败\n", Color.Red);
+                            OperateResult.AppendText(PSN.Text + "读取【IMEI1】:" + IMEI1.Text + ",系统导入:" + imei1 + ",比对失败\n", Color.Red);
                         }
                         if (IMEI2.Text == imei2 && IMEI2.Text != "")
                         {
@@ -170,7 +180,7 @@ namespace UAS_MES_NEW.Make
                     }
                     else
                     {
-                        OperateResult.AppendText(PSN.Text + "未导入IMEI\n",Color.Red);
+                        OperateResult.AppendText(PSN.Text + "未导入IMEI\n", Color.Red);
                     }
                     //MAC核对
                     dt = (DataTable)dh.ExecuteSql("select mal_mac,mal_bt from makeaddresslist where mal_sncode='" + PSN.Text + "'", "select");
@@ -197,7 +207,7 @@ namespace UAS_MES_NEW.Make
                     }
                     else
                     {
-                        OperateResult.AppendText(PSN.Text + "未导入MAC/BT\n",Color.Red);
+                        OperateResult.AppendText(PSN.Text + "未导入MAC/BT\n", Color.Red);
                     }
 
                     //if (Aging.Text == "")

+ 1 - 0
UAS_MES_PW/FunctionCode/Make/Make_TestCollection.cs

@@ -796,6 +796,7 @@ namespace UAS_MES_NEW.Make
                 dh.ExecuteSql("delete from sninfo where si_sn='" + ms_sncode + "'", "delete");
                 dh.ExecuteSql("delete from makesnrelation where sn='" + ms_sncode + "' and makecode='" + ms_makecode + "'", "delete");
                 dh.ExecuteSql("update makeserial set ms_sncode=ms_firstsn,ms_imei1='',ms_mac='',ms_bt='',ms_netcode='',ms_imei2='',ms_beforesn='',ms_nextstepcode='B_WRITE' where ms_sncode='" + ms_sncode + "' and ms_makecode='" + ma_code.Text + "'", "update");
+                LogicHandler.DoCommandLog(Tag.ToString(),User.UserCode,ma_code.Text,User.UserLineCode,User.UserSourceCode,"取消绑定","取消绑定成功",ms_sncode,"");
                 OperateResult.AppendText(">>" + ms_sncode + "解绑成功\n", Color.Green);
             }
             else

+ 3 - 1
UAS_MES_YD/FunctionCode/Make/Make_FuselageLabelPrint.cs

@@ -66,7 +66,7 @@ namespace UAS_MES_NEW.Make
             ma_code.FormName = Name;
             ma_code.SetValueField = new string[] { "ma_code", "ma_prodcode", "pr_detail" };
             ma_code.DbChange += Ma_code_DbChange;
-            ma_code.Condition = "ma_statuscode='STARTED' or ma_statuscode='FINISH'";
+            ma_code.Condition = "(ma_statuscode='STARTED' or ma_statuscode='FINISH')";
             dh = SystemInf.dh;
             StepCount.StepCode = User.CurrentStepCode;
             StepCount.Source = User.UserSourceCode;
@@ -122,6 +122,8 @@ namespace UAS_MES_NEW.Make
                     //调用公共方法CheckStepSNAndMacode判断工序是否正确
                     string status = "";
                     LogicHandler.GetMakeInfo(sncode.Text, out oMakeCode, out status, out oErrorMessage);
+                    if (oMakeCode == "" || oMakeCode == null)
+                        oMakeCode = ma_code.Text;
                     if (LogicHandler.CheckStepSNAndMacode(oMakeCode, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsId, out oErrorMessage))
                     {
                         //IF (如果ma_code 为空)THEN

+ 130 - 66
UAS_MES_YD/FunctionCode/Special/Special_CancelImei.Designer.cs

@@ -29,25 +29,28 @@
         private void InitializeComponent()
         {
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Special_CancelImei));
-            this.Pallet_label = new System.Windows.Forms.Label();
+            this.SN_label = new System.Windows.Forms.Label();
             this.bc_code = new System.Windows.Forms.Label();
-            this.nr_name_label = new System.Windows.Forms.Label();
+            this.st_rstepcode_label = new System.Windows.Forms.Label();
+            this.ma_craftcode_label = new System.Windows.Forms.Label();
+            this.cd_stepcode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.cr_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
             this.SaveRepairInf = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.IMEI = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.Reason = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.SN = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.cd_stepno = new System.Windows.Forms.Label();
             this.SuspendLayout();
             // 
-            // Pallet_label
+            // SN_label
             // 
-            this.Pallet_label.AutoSize = true;
-            this.Pallet_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Pallet_label.Location = new System.Drawing.Point(253, 266);
-            this.Pallet_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.Pallet_label.Name = "Pallet_label";
-            this.Pallet_label.Size = new System.Drawing.Size(85, 41);
-            this.Pallet_label.TabIndex = 1;
-            this.Pallet_label.Text = "IMEI";
+            this.SN_label.AutoSize = true;
+            this.SN_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.SN_label.Location = new System.Drawing.Point(115, 90);
+            this.SN_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.SN_label.Name = "SN_label";
+            this.SN_label.Size = new System.Drawing.Size(62, 41);
+            this.SN_label.TabIndex = 1;
+            this.SN_label.Text = "SN";
             // 
             // bc_code
             // 
@@ -61,22 +64,79 @@
             this.bc_code.TabIndex = 146;
             this.bc_code.Visible = false;
             // 
-            // nr_name_label
-            // 
-            this.nr_name_label.AutoSize = true;
-            this.nr_name_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.nr_name_label.ForeColor = System.Drawing.Color.Black;
-            this.nr_name_label.Location = new System.Drawing.Point(255, 347);
-            this.nr_name_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.nr_name_label.Name = "nr_name_label";
-            this.nr_name_label.Size = new System.Drawing.Size(82, 41);
-            this.nr_name_label.TabIndex = 141;
-            this.nr_name_label.Text = "原因";
+            // st_rstepcode_label
+            // 
+            this.st_rstepcode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.st_rstepcode_label.AutoSize = true;
+            this.st_rstepcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.st_rstepcode_label.Location = new System.Drawing.Point(115, 257);
+            this.st_rstepcode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.st_rstepcode_label.Name = "st_rstepcode_label";
+            this.st_rstepcode_label.Size = new System.Drawing.Size(146, 41);
+            this.st_rstepcode_label.TabIndex = 152;
+            this.st_rstepcode_label.Text = "回流工序";
+            // 
+            // ma_craftcode_label
+            // 
+            this.ma_craftcode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.ma_craftcode_label.AutoSize = true;
+            this.ma_craftcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_craftcode_label.Location = new System.Drawing.Point(114, 177);
+            this.ma_craftcode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_craftcode_label.Name = "ma_craftcode_label";
+            this.ma_craftcode_label.Size = new System.Drawing.Size(146, 41);
+            this.ma_craftcode_label.TabIndex = 153;
+            this.ma_craftcode_label.Text = "回流途程";
+            // 
+            // cd_stepcode
+            // 
+            this.cd_stepcode.AllPower = "ifall";
+            this.cd_stepcode.Caller = null;
+            this.cd_stepcode.Condition = null;
+            this.cd_stepcode.DBTitle = "回流工序";
+            this.cd_stepcode.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.cd_stepcode.FormName = null;
+            this.cd_stepcode.Location = new System.Drawing.Point(279, 257);
+            this.cd_stepcode.Margin = new System.Windows.Forms.Padding(6);
+            this.cd_stepcode.Name = "cd_stepcode";
+            this.cd_stepcode.Power = "ifspecial";
+            this.cd_stepcode.ReturnData = null;
+            this.cd_stepcode.SelectField = null;
+            this.cd_stepcode.SetValueField = null;
+            this.cd_stepcode.Size = new System.Drawing.Size(318, 44);
+            this.cd_stepcode.TabIndex = 155;
+            this.cd_stepcode.TableName = null;
+            this.cd_stepcode.Tag = "";
+            this.cd_stepcode.TextBoxEnable = false;
+            // 
+            // cr_code
+            // 
+            this.cr_code.AllPower = "ifall";
+            this.cr_code.Caller = null;
+            this.cr_code.Condition = null;
+            this.cr_code.DBTitle = "回流途程";
+            this.cr_code.Enabled = false;
+            this.cr_code.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.cr_code.FormName = null;
+            this.cr_code.Location = new System.Drawing.Point(279, 177);
+            this.cr_code.Margin = new System.Windows.Forms.Padding(6);
+            this.cr_code.Name = "cr_code";
+            this.cr_code.Power = "ifspecial";
+            this.cr_code.ReturnData = null;
+            this.cr_code.SelectField = null;
+            this.cr_code.SetValueField = null;
+            this.cr_code.Size = new System.Drawing.Size(318, 46);
+            this.cr_code.TabIndex = 154;
+            this.cr_code.TableName = null;
+            this.cr_code.Tag = "ma_craftcode";
+            this.cr_code.TextBoxEnable = false;
             // 
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OperateResult.Location = new System.Drawing.Point(791, 109);
+            this.OperateResult.Location = new System.Drawing.Point(812, 50);
             this.OperateResult.Margin = new System.Windows.Forms.Padding(8);
             this.OperateResult.Name = "OperateResult";
             this.OperateResult.Size = new System.Drawing.Size(460, 614);
@@ -90,7 +150,7 @@
             this.SaveRepairInf.DownImage = ((System.Drawing.Image)(resources.GetObject("SaveRepairInf.DownImage")));
             this.SaveRepairInf.Image = null;
             this.SaveRepairInf.IsShowBorder = true;
-            this.SaveRepairInf.Location = new System.Drawing.Point(443, 500);
+            this.SaveRepairInf.Location = new System.Drawing.Point(307, 449);
             this.SaveRepairInf.Margin = new System.Windows.Forms.Padding(6);
             this.SaveRepairInf.MoveImage = ((System.Drawing.Image)(resources.GetObject("SaveRepairInf.MoveImage")));
             this.SaveRepairInf.Name = "SaveRepairInf";
@@ -99,56 +159,57 @@
             this.SaveRepairInf.Size = new System.Drawing.Size(172, 48);
             this.SaveRepairInf.TabIndex = 145;
             this.SaveRepairInf.Tag = "IfRead";
-            this.SaveRepairInf.Text = "确认取消";
+            this.SaveRepairInf.Text = "确认回流";
             this.SaveRepairInf.UseVisualStyleBackColor = true;
             this.SaveRepairInf.Click += new System.EventHandler(this.SaveRepairInf_Click);
             // 
-            // IMEI
-            // 
-            this.IMEI.AllPower = null;
-            this.IMEI.BackColor = System.Drawing.Color.White;
-            this.IMEI.ID = null;
-            this.IMEI.Location = new System.Drawing.Point(375, 272);
-            this.IMEI.Margin = new System.Windows.Forms.Padding(4);
-            this.IMEI.Name = "IMEI";
-            this.IMEI.Power = null;
-            this.IMEI.Size = new System.Drawing.Size(318, 35);
-            this.IMEI.Str = null;
-            this.IMEI.Str1 = null;
-            this.IMEI.Str2 = null;
-            this.IMEI.TabIndex = 2;
-            // 
-            // Reason
-            // 
-            this.Reason.AllPower = null;
-            this.Reason.BackColor = System.Drawing.Color.White;
-            this.Reason.ID = null;
-            this.Reason.Location = new System.Drawing.Point(375, 356);
-            this.Reason.Margin = new System.Windows.Forms.Padding(4);
-            this.Reason.Name = "Reason";
-            this.Reason.Power = null;
-            this.Reason.Size = new System.Drawing.Size(318, 35);
-            this.Reason.Str = null;
-            this.Reason.Str1 = null;
-            this.Reason.Str2 = null;
-            this.Reason.TabIndex = 151;
+            // SN
+            // 
+            this.SN.AllPower = null;
+            this.SN.BackColor = System.Drawing.Color.White;
+            this.SN.ID = null;
+            this.SN.Location = new System.Drawing.Point(279, 96);
+            this.SN.Margin = new System.Windows.Forms.Padding(4);
+            this.SN.Name = "SN";
+            this.SN.Power = null;
+            this.SN.Size = new System.Drawing.Size(318, 35);
+            this.SN.Str = null;
+            this.SN.Str1 = null;
+            this.SN.Str2 = null;
+            this.SN.TabIndex = 2;
+            this.SN.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SN_KeyDown);
+            // 
+            // cd_stepno
+            // 
+            this.cd_stepno.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.cd_stepno.AutoSize = true;
+            this.cd_stepno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.cd_stepno.Location = new System.Drawing.Point(125, 343);
+            this.cd_stepno.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.cd_stepno.Name = "cd_stepno";
+            this.cd_stepno.Size = new System.Drawing.Size(0, 41);
+            this.cd_stepno.TabIndex = 156;
             // 
             // Special_CancelImei
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1384, 1054);
-            this.Controls.Add(this.Reason);
+            this.ClientSize = new System.Drawing.Size(1384, 713);
+            this.Controls.Add(this.cd_stepno);
+            this.Controls.Add(this.cd_stepcode);
+            this.Controls.Add(this.st_rstepcode_label);
+            this.Controls.Add(this.ma_craftcode_label);
+            this.Controls.Add(this.cr_code);
             this.Controls.Add(this.OperateResult);
             this.Controls.Add(this.bc_code);
             this.Controls.Add(this.SaveRepairInf);
-            this.Controls.Add(this.nr_name_label);
-            this.Controls.Add(this.IMEI);
-            this.Controls.Add(this.Pallet_label);
+            this.Controls.Add(this.SN);
+            this.Controls.Add(this.SN_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Special_CancelImei";
-            this.Tag = "Special!BoxSplit";
+            this.Tag = "Special!CancelOQC";
             this.Text = "拆箱处理";
             this.Load += new System.EventHandler(this.Special_BoxSplit_Load);
             this.ResumeLayout(false);
@@ -157,12 +218,15 @@
         }
 
         #endregion
-        private System.Windows.Forms.Label Pallet_label;
-        private CustomControl.TextBoxWithIcon.EnterTextBox IMEI;
+        private System.Windows.Forms.Label SN_label;
+        private CustomControl.TextBoxWithIcon.EnterTextBox SN;
         private System.Windows.Forms.Label bc_code;
         private CustomControl.ButtonUtil.NormalButton SaveRepairInf;
-        private System.Windows.Forms.Label nr_name_label;
         private CustomControl.RichText.RichTextAutoBottom OperateResult;
-        private CustomControl.TextBoxWithIcon.EnterTextBox Reason;
+        private CustomControl.TextBoxWithIcon.SearchTextBox cd_stepcode;
+        private System.Windows.Forms.Label st_rstepcode_label;
+        private System.Windows.Forms.Label ma_craftcode_label;
+        private CustomControl.TextBoxWithIcon.SearchTextBox cr_code;
+        private System.Windows.Forms.Label cd_stepno;
     }
 }

+ 48 - 48
UAS_MES_YD/FunctionCode/Special/Special_CancelImei.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Data;
+using System.Text;
 using System.Windows.Forms;
 using UAS_MES_NEW.DataOperate;
 using UAS_MES_NEW.Entity;
@@ -13,6 +14,9 @@ namespace UAS_MES_NEW.Special
 
         LogStringBuilder sql = new LogStringBuilder();
 
+
+        DataTable Dbfind;
+
         public Special_CancelImei()
         {
             InitializeComponent();
@@ -21,62 +25,58 @@ namespace UAS_MES_NEW.Special
         private void Special_BoxSplit_Load(object sender, EventArgs e)
         {
             dh = SystemInf.dh;
+
+            cd_stepcode.FormName = Name;
+            cd_stepcode.TableName = "craftdetail left join step on st_code=cd_stepcode left join craft on cd_crid=cr_id";
+            cd_stepcode.SetValueField = new string[] { "cd_stepcode", "cd_stepno" };
+            cd_stepcode.SelectField = "cd_stepname # 工序名称 ,cd_stepcode # 工序编号,cd_stepno # 执行顺序";
+            cd_stepcode.DBTitle = "回流工序";
+            cd_stepcode.DbChange += Cd_stepcode_DbChange;
         }
 
-        private void Split_Click(object sender, EventArgs e)
+        private void Cd_stepcode_DbChange(object sender, EventArgs e)
         {
-
+            Dbfind = cd_stepcode.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
         }
+        string ms_id = "";
 
         private void SaveRepairInf_Click(object sender, EventArgs e)
         {
-            if (Reason.Text == "")
-            {
-                MessageBox.Show("必须填写原因");
-                return;
-            }
-            DataTable dt = (DataTable)dh.ExecuteSql("select ms_sncode,ms_imei1 from makeserial where ms_imei1 ='" + IMEI.Text + "'", "select");
-            if (dt.Rows.Count > 0)
-            {
-                dt = (DataTable)dh.ExecuteSql("select ms_sncode,substr(pr_detail,0,15)pr_detail from makeserial left join product on pr_code=ms_prodcode where ms_imei1='" + IMEI.Text + "'", "select");
-                if (dt.Rows.Count > 0)
-                {
-                    string sn = dt.Rows[0]["ms_sncode"].ToString();
-                    string pr_detail = dt.Rows[0]["pr_detail"].ToString();
-                    dh.ExecuteSql("update makeserial set ms_imei='" + Reason.Text + "',ms_imei1='' where ms_imei1='" + IMEI.Text + "'", "update");
-                    dh.ExecuteSql("update sninfo set si_imei1='' where si_imei1='" + IMEI.Text + "'", "update");
-                    LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, sn+" "+Reason.Text, "取消成功", IMEI.Text, "");
-                    OperateResult.AppendText("SN:" + sn + ",IMEI:" + IMEI.Text + ",机型:" + pr_detail + "取消成功\n", System.Drawing.Color.Black);
-                }
-                else
-                {
-                    OperateResult.AppendText(IMEI.Text + "未录入系统\n", System.Drawing.Color.Black);
-                }
-            }
-            else
+            if (ms_id == "") { OperateResult.AppendText(">>请先获取SN\n"); return; }
+            if (cd_stepcode.Text == "") { OperateResult.AppendText(">>请选择回流工序\n"); return; }
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_firstsn,ms_sncode,ms_prodcode from makeserial where ms_id='" + ms_id + "' and instr(ms_paststep,'" + cd_stepcode.Text + "')>0 ", "select");
+
+            if (dt.Rows.Count == 0) { OperateResult.AppendText(">>" + SN.Text + "不存在或未执行过" + cd_stepcode.Text + "工序\n"); return; }
+            string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
+            string ms_firstsn = dt.Rows[0]["ms_firstsn"].ToString();
+            string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+
+            StringBuilder sql = new StringBuilder();
+            sql.Append("update craftmaterial set cm_status=-1 where  cm_stepcode in (select cd_stepcode from craft left join ");
+            sql.Append("craftdetail on cd_crid = cr_id where cr_prodcode = '" + ms_prodcode + "'  and cd_detno >= " + cd_stepno.Text + ") ");
+            sql.Append("and cm_firstsn='" + ms_firstsn + "' and cm_makecode='" + ms_makecode + "'");
+            dh.ExecuteSql(sql.ToString(), "update");
+
+            dh.ExecuteSql("update makeserial set ms_nextstepcode='" + cd_stepcode.Text + "' where ms_id='" + ms_id + "'", "update");
+
+            OperateResult.AppendText(">>" + SN.Text + "回流成功\n");
+            ms_id = "";
+        }
+
+        private void SN_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
             {
-                dt = (DataTable)dh.ExecuteSql("select ms_sncode,ms_imei1 from makeserial where ms_imei2 ='" + IMEI.Text + "'", "select");
-                if (dt.Rows.Count > 0)
-                {
-                    dt = (DataTable)dh.ExecuteSql("select ms_sncode,substr(pr_detail,0,15)pr_detail from makeserial left join product on pr_code=ms_prodcode where ms_imei2='" + IMEI.Text + "'", "select");
-                    if (dt.Rows.Count > 0)
-                    {
-                        string sn = dt.Rows[0]["ms_sncode"].ToString();
-                        string pr_detail = dt.Rows[0]["pr_detail"].ToString();
-                        dh.ExecuteSql("update makeserial set ms_imei='" + Reason.Text + "',ms_imei2='' where ms_imei2='" + IMEI.Text + "'", "update");
-                        dh.ExecuteSql("update sninfo set si_imei2='' where si_imei2='" + IMEI.Text + "'", "update");
-                        LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, sn+" "+Reason.Text, "取消成功", IMEI.Text, "");
-                        OperateResult.AppendText("SN:" + sn + ",IMEI:" + IMEI.Text + ",机型:" + pr_detail + "取消成功\n", System.Drawing.Color.Black);
-                    }
-                    else
-                    {
-                        OperateResult.AppendText(IMEI.Text + "未录入系统\n", System.Drawing.Color.Black);
-                    }
-                }
-                else
-                {
-                    OperateResult.AppendText(IMEI.Text + "未录入系统\n", System.Drawing.Color.Black);
-                }
+                DataTable dt = (DataTable)dh.ExecuteSql("select ms_id,ms_craftcode,ms_prodcode from makeserial where ms_sncode='" + SN.Text + "' order by ms_id desc", "select");
+
+                if (dt.Rows.Count == 0) { OperateResult.AppendText(">>" + SN.Text + "不存在\n"); return; }
+
+                ms_id = dt.Rows[0]["ms_id"].ToString();
+                cr_code.Text = dt.Rows[0]["ms_craftcode"].ToString();
+                string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode + "' order by cd_stepno";
+
             }
         }
     }