Quellcode durchsuchen

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

Hcsy vor 7 Jahren
Ursprung
Commit
6e1b994c54

+ 20 - 0
UAS-出货标签管理(吉利通)/PublicMethod/BaseUtil.cs

@@ -124,6 +124,26 @@ namespace UAS_LabelMachine
             }
             return selectConetnt.Remove(selectConetnt.Length - 1, 1).ToString();
         }
+
+        /// <summary>
+        /// 筛选DataTable
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="condition"></param>
+        /// <returns></returns>
+        public static DataTable filterDataTable(DataTable dt, String condition)
+        {
+            if (dt == null)
+                return new DataTable();
+            //获取筛选条件中的列名,值
+            DataRow[] dataRows = dt.Select(condition);
+            DataTable ndt = dt.Clone();
+            for (int i = 0; i < dataRows.Length; i++)
+            {
+                ndt.Rows.Add(dataRows[i].ItemArray);
+            }
+            return ndt;
+        }
         /// <summary>
         /// 通过字段和其展示的中文值获取查询的内容
         /// </summary>

+ 245 - 232
UAS-出货标签管理(吉利通)/UAS_出货标签管理.Designer.cs

@@ -84,6 +84,7 @@
             this.pi_inoutno_label = new System.Windows.Forms.Label();
             this.PLCStop = new System.Windows.Forms.Button();
             this.PLCStart = new System.Windows.Forms.Button();
+            this.cu_print_regexpression = new System.Windows.Forms.Label();
             this.FrontCollect = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.CollectionProcess = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.label26 = new System.Windows.Forms.Label();
@@ -124,6 +125,32 @@
             this.BackCheck = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.MessageLog = new UAS_LabelMachine.CustomControl.RichText.RichTextAutoBottom();
             this.LabelInf = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
+            this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pib_id1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_ifmodify = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pib_ifupload = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pr_vendprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_madein = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_zxbzs = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_lotno = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_ifpick = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pib_ifprint = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pib_ifrecheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pib_datecode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_custbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_pocode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_custprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_custprodspec = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_outboxcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_outboxcode2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.SingleLabel = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.groupBoxWithBorder4 = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
@@ -184,32 +211,6 @@
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
             this.BackendCheck = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
             this.FrontendCheck = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
-            this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_id1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_ifmodify = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_ifupload = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pr_vendprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_madein = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_zxbzs = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_lotno = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_ifpick = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_ifprint = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_ifrecheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_datecode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_custbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_pocode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_custprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_custprodspec = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_outboxcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_outboxcode2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             this.CollectionProcess.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.LabelInf)).BeginInit();
@@ -707,6 +708,16 @@
             this.PLCStart.Text = "启动";
             this.PLCStart.UseVisualStyleBackColor = true;
             // 
+            // cu_print_regexpression
+            // 
+            this.cu_print_regexpression.AutoSize = true;
+            this.cu_print_regexpression.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.cu_print_regexpression.Location = new System.Drawing.Point(12, 185);
+            this.cu_print_regexpression.Name = "cu_print_regexpression";
+            this.cu_print_regexpression.Size = new System.Drawing.Size(51, 20);
+            this.cu_print_regexpression.TabIndex = 94;
+            this.cu_print_regexpression.Text = "分隔符";
+            // 
             // FrontCollect
             // 
             this.FrontCollect.Enabled = false;
@@ -1228,6 +1239,212 @@
             this.LabelInf.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.LabelInf_CellPainting);
             this.LabelInf.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.LabelInf_DataError);
             // 
+            // Choose
+            // 
+            this.Choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.Choose.HeaderText = "勾选";
+            this.Choose.Name = "Choose";
+            this.Choose.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.Choose.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            this.Choose.Width = 55;
+            // 
+            // pib_id1
+            // 
+            this.pib_id1.DataPropertyName = "pib_id";
+            this.pib_id1.HeaderText = "pib_id";
+            this.pib_id1.Name = "pib_id1";
+            this.pib_id1.Visible = false;
+            this.pib_id1.Width = 66;
+            // 
+            // pib_pdno
+            // 
+            this.pib_pdno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_pdno.DataPropertyName = "pib_pdno";
+            this.pib_pdno.HeaderText = "明细序号";
+            this.pib_pdno.Name = "pib_pdno";
+            this.pib_pdno.ReadOnly = true;
+            this.pib_pdno.Width = 96;
+            // 
+            // pib_prodcode
+            // 
+            this.pib_prodcode.DataPropertyName = "pib_prodcode";
+            this.pib_prodcode.HeaderText = "物料编号";
+            this.pib_prodcode.Name = "pib_prodcode";
+            this.pib_prodcode.ReadOnly = true;
+            this.pib_prodcode.Width = 78;
+            // 
+            // pib_ifmodify
+            // 
+            this.pib_ifmodify.DataPropertyName = "pib_ifmodify";
+            this.pib_ifmodify.HeaderText = "已修改";
+            this.pib_ifmodify.Name = "pib_ifmodify";
+            this.pib_ifmodify.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.pib_ifmodify.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            this.pib_ifmodify.Width = 66;
+            // 
+            // pib_ifupload
+            // 
+            this.pib_ifupload.DataPropertyName = "pib_ifupload";
+            this.pib_ifupload.HeaderText = "已上传";
+            this.pib_ifupload.Name = "pib_ifupload";
+            this.pib_ifupload.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.pib_ifupload.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            this.pib_ifupload.Width = 66;
+            // 
+            // pr_vendprodcode
+            // 
+            this.pr_vendprodcode.DataPropertyName = "pr_vendprodcode";
+            this.pr_vendprodcode.HeaderText = "MPN";
+            this.pr_vendprodcode.Name = "pr_vendprodcode";
+            this.pr_vendprodcode.ReadOnly = true;
+            this.pr_vendprodcode.Width = 48;
+            // 
+            // pib_brand
+            // 
+            this.pib_brand.DataPropertyName = "pib_brand";
+            this.pib_brand.HeaderText = "品牌";
+            this.pib_brand.Name = "pib_brand";
+            this.pib_brand.ReadOnly = true;
+            this.pib_brand.Width = 54;
+            // 
+            // pib_madein
+            // 
+            this.pib_madein.DataPropertyName = "pib_madein";
+            this.pib_madein.HeaderText = "产地";
+            this.pib_madein.Name = "pib_madein";
+            this.pib_madein.Visible = false;
+            this.pib_madein.Width = 54;
+            // 
+            // pr_zxbzs
+            // 
+            this.pr_zxbzs.DataPropertyName = "pr_zxbzs";
+            this.pr_zxbzs.HeaderText = "最小包装数";
+            this.pr_zxbzs.Name = "pr_zxbzs";
+            this.pr_zxbzs.Visible = false;
+            this.pr_zxbzs.Width = 90;
+            // 
+            // pr_unit
+            // 
+            this.pr_unit.DataPropertyName = "pr_unit";
+            this.pr_unit.HeaderText = "单位";
+            this.pr_unit.Name = "pr_unit";
+            this.pr_unit.Width = 54;
+            // 
+            // pib_lotno
+            // 
+            this.pib_lotno.DataPropertyName = "pib_lotno";
+            this.pib_lotno.HeaderText = "LotNo";
+            this.pib_lotno.Name = "pib_lotno";
+            this.pib_lotno.Width = 60;
+            // 
+            // pib_datecode
+            // 
+            this.pib_datecode.DataPropertyName = "pib_datecode";
+            this.pib_datecode.HeaderText = "DateCode";
+            this.pib_datecode.Name = "pib_datecode";
+            this.pib_datecode.Width = 78;
+            // 
+            // pib_ifpick
+            // 
+            this.pib_ifpick.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_ifpick.DataPropertyName = "pib_ifpick";
+            this.pib_ifpick.HeaderText = "已扫描";
+            this.pib_ifpick.Name = "pib_ifpick";
+            this.pib_ifpick.Width = 60;
+            // 
+            // pib_ifprint
+            // 
+            this.pib_ifprint.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_ifprint.DataPropertyName = "pib_ifprint";
+            this.pib_ifprint.HeaderText = "已打标";
+            this.pib_ifprint.Name = "pib_ifprint";
+            this.pib_ifprint.Width = 60;
+            // 
+            // pib_ifrecheck
+            // 
+            this.pib_ifrecheck.DataPropertyName = "pib_ifrecheck";
+            this.pib_ifrecheck.HeaderText = "已复核";
+            this.pib_ifrecheck.Name = "pib_ifrecheck";
+            this.pib_ifrecheck.Width = 47;
+            // 
+            // pib_datecode1
+            // 
+            this.pib_datecode1.DataPropertyName = "pib_datecode1";
+            this.pib_datecode1.HeaderText = "DateCode1";
+            this.pib_datecode1.Name = "pib_datecode1";
+            this.pib_datecode1.Width = 84;
+            // 
+            // pib_qty
+            // 
+            this.pib_qty.DataPropertyName = "pib_qty";
+            this.pib_qty.HeaderText = "数量";
+            this.pib_qty.Name = "pib_qty";
+            this.pib_qty.ReadOnly = true;
+            this.pib_qty.Width = 54;
+            // 
+            // pib_barcode
+            // 
+            this.pib_barcode.DataPropertyName = "pib_barcode";
+            this.pib_barcode.HeaderText = "唯一条码";
+            this.pib_barcode.Name = "pib_barcode";
+            this.pib_barcode.ReadOnly = true;
+            this.pib_barcode.Width = 78;
+            // 
+            // pib_custbarcode
+            // 
+            this.pib_custbarcode.DataPropertyName = "pib_custbarcode";
+            this.pib_custbarcode.HeaderText = "客户条码";
+            this.pib_custbarcode.Name = "pib_custbarcode";
+            this.pib_custbarcode.ReadOnly = true;
+            this.pib_custbarcode.Width = 78;
+            // 
+            // pd_pocode
+            // 
+            this.pd_pocode.DataPropertyName = "pd_pocode";
+            this.pd_pocode.HeaderText = "客户PO";
+            this.pd_pocode.Name = "pd_pocode";
+            this.pd_pocode.ReadOnly = true;
+            this.pd_pocode.Width = 66;
+            // 
+            // pd_custprodcode
+            // 
+            this.pd_custprodcode.DataPropertyName = "pd_custprodcode";
+            this.pd_custprodcode.HeaderText = "客户料号";
+            this.pd_custprodcode.Name = "pd_custprodcode";
+            this.pd_custprodcode.ReadOnly = true;
+            this.pd_custprodcode.Width = 78;
+            // 
+            // pd_custprodspec
+            // 
+            this.pd_custprodspec.DataPropertyName = "pd_custprodspec";
+            this.pd_custprodspec.HeaderText = "客户型号";
+            this.pd_custprodspec.Name = "pd_custprodspec";
+            this.pd_custprodspec.ReadOnly = true;
+            this.pd_custprodspec.Width = 78;
+            // 
+            // pr_spec
+            // 
+            this.pr_spec.DataPropertyName = "pr_spec";
+            this.pr_spec.HeaderText = "规格";
+            this.pr_spec.Name = "pr_spec";
+            this.pr_spec.Width = 54;
+            // 
+            // pib_outboxcode1
+            // 
+            this.pib_outboxcode1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_outboxcode1.DataPropertyName = "pib_outboxcode1";
+            this.pib_outboxcode1.HeaderText = "中盒号";
+            this.pib_outboxcode1.Name = "pib_outboxcode1";
+            this.pib_outboxcode1.Width = 90;
+            // 
+            // pib_outboxcode2
+            // 
+            this.pib_outboxcode2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_outboxcode2.DataPropertyName = "pib_outboxcode2";
+            this.pib_outboxcode2.HeaderText = "外箱号";
+            this.pib_outboxcode2.Name = "pib_outboxcode2";
+            this.pib_outboxcode2.Width = 90;
+            // 
             // pi_inoutno
             // 
             this.pi_inoutno.ID = null;
@@ -1943,218 +2160,13 @@
             // 
             this.FrontendCheck.Tag = "FrontendCheck";
             // 
-            // Choose
-            // 
-            this.Choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.Choose.HeaderText = "勾选";
-            this.Choose.Name = "Choose";
-            this.Choose.Resizable = System.Windows.Forms.DataGridViewTriState.True;
-            this.Choose.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
-            this.Choose.Width = 55;
-            // 
-            // pib_id1
-            // 
-            this.pib_id1.DataPropertyName = "pib_id";
-            this.pib_id1.HeaderText = "pib_id";
-            this.pib_id1.Name = "pib_id1";
-            this.pib_id1.Visible = false;
-            this.pib_id1.Width = 66;
-            // 
-            // pib_pdno
-            // 
-            this.pib_pdno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_pdno.DataPropertyName = "pib_pdno";
-            this.pib_pdno.HeaderText = "明细序号";
-            this.pib_pdno.Name = "pib_pdno";
-            this.pib_pdno.ReadOnly = true;
-            this.pib_pdno.Width = 96;
-            // 
-            // pib_prodcode
-            // 
-            this.pib_prodcode.DataPropertyName = "pib_prodcode";
-            this.pib_prodcode.HeaderText = "物料编号";
-            this.pib_prodcode.Name = "pib_prodcode";
-            this.pib_prodcode.ReadOnly = true;
-            this.pib_prodcode.Width = 78;
-            // 
-            // pib_ifmodify
-            // 
-            this.pib_ifmodify.DataPropertyName = "pib_ifmodify";
-            this.pib_ifmodify.HeaderText = "已修改";
-            this.pib_ifmodify.Name = "pib_ifmodify";
-            this.pib_ifmodify.Resizable = System.Windows.Forms.DataGridViewTriState.True;
-            this.pib_ifmodify.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
-            this.pib_ifmodify.Width = 66;
-            // 
-            // pib_ifupload
-            // 
-            this.pib_ifupload.DataPropertyName = "pib_ifupload";
-            this.pib_ifupload.HeaderText = "已上传";
-            this.pib_ifupload.Name = "pib_ifupload";
-            this.pib_ifupload.Resizable = System.Windows.Forms.DataGridViewTriState.True;
-            this.pib_ifupload.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
-            this.pib_ifupload.Width = 66;
-            // 
-            // pr_vendprodcode
-            // 
-            this.pr_vendprodcode.DataPropertyName = "pr_vendprodcode";
-            this.pr_vendprodcode.HeaderText = "MPN";
-            this.pr_vendprodcode.Name = "pr_vendprodcode";
-            this.pr_vendprodcode.ReadOnly = true;
-            this.pr_vendprodcode.Width = 48;
-            // 
-            // pib_brand
-            // 
-            this.pib_brand.DataPropertyName = "pib_brand";
-            this.pib_brand.HeaderText = "品牌";
-            this.pib_brand.Name = "pib_brand";
-            this.pib_brand.ReadOnly = true;
-            this.pib_brand.Width = 54;
-            // 
-            // pib_madein
-            // 
-            this.pib_madein.DataPropertyName = "pib_madein";
-            this.pib_madein.HeaderText = "产地";
-            this.pib_madein.Name = "pib_madein";
-            this.pib_madein.Visible = false;
-            this.pib_madein.Width = 54;
-            // 
-            // pr_zxbzs
-            // 
-            this.pr_zxbzs.DataPropertyName = "pr_zxbzs";
-            this.pr_zxbzs.HeaderText = "最小包装数";
-            this.pr_zxbzs.Name = "pr_zxbzs";
-            this.pr_zxbzs.Visible = false;
-            this.pr_zxbzs.Width = 90;
-            // 
-            // pr_unit
-            // 
-            this.pr_unit.DataPropertyName = "pr_unit";
-            this.pr_unit.HeaderText = "单位";
-            this.pr_unit.Name = "pr_unit";
-            this.pr_unit.Width = 54;
-            // 
-            // pib_lotno
-            // 
-            this.pib_lotno.DataPropertyName = "pib_lotno";
-            this.pib_lotno.HeaderText = "LotNo";
-            this.pib_lotno.Name = "pib_lotno";
-            this.pib_lotno.Width = 60;
-            // 
-            // pib_datecode
-            // 
-            this.pib_datecode.DataPropertyName = "pib_datecode";
-            this.pib_datecode.HeaderText = "DateCode";
-            this.pib_datecode.Name = "pib_datecode";
-            this.pib_datecode.Width = 78;
-            // 
-            // pib_ifpick
-            // 
-            this.pib_ifpick.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_ifpick.DataPropertyName = "pib_ifpick";
-            this.pib_ifpick.HeaderText = "已扫描";
-            this.pib_ifpick.Name = "pib_ifpick";
-            this.pib_ifpick.Width = 60;
-            // 
-            // pib_ifprint
-            // 
-            this.pib_ifprint.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_ifprint.DataPropertyName = "pib_ifprint";
-            this.pib_ifprint.HeaderText = "已打标";
-            this.pib_ifprint.Name = "pib_ifprint";
-            this.pib_ifprint.Width = 60;
-            // 
-            // pib_ifrecheck
-            // 
-            this.pib_ifrecheck.DataPropertyName = "pib_ifrecheck";
-            this.pib_ifrecheck.HeaderText = "已复核";
-            this.pib_ifrecheck.Name = "pib_ifrecheck";
-            this.pib_ifrecheck.Width = 47;
-            // 
-            // pib_datecode1
-            // 
-            this.pib_datecode1.DataPropertyName = "pib_datecode1";
-            this.pib_datecode1.HeaderText = "DateCode1";
-            this.pib_datecode1.Name = "pib_datecode1";
-            this.pib_datecode1.Width = 84;
-            // 
-            // pib_qty
-            // 
-            this.pib_qty.DataPropertyName = "pib_qty";
-            this.pib_qty.HeaderText = "数量";
-            this.pib_qty.Name = "pib_qty";
-            this.pib_qty.ReadOnly = true;
-            this.pib_qty.Width = 54;
-            // 
-            // pib_barcode
-            // 
-            this.pib_barcode.DataPropertyName = "pib_barcode";
-            this.pib_barcode.HeaderText = "唯一条码";
-            this.pib_barcode.Name = "pib_barcode";
-            this.pib_barcode.ReadOnly = true;
-            this.pib_barcode.Width = 78;
-            // 
-            // pib_custbarcode
-            // 
-            this.pib_custbarcode.DataPropertyName = "pib_custbarcode";
-            this.pib_custbarcode.HeaderText = "客户条码";
-            this.pib_custbarcode.Name = "pib_custbarcode";
-            this.pib_custbarcode.ReadOnly = true;
-            this.pib_custbarcode.Width = 78;
-            // 
-            // pd_pocode
-            // 
-            this.pd_pocode.DataPropertyName = "pd_pocode";
-            this.pd_pocode.HeaderText = "客户PO";
-            this.pd_pocode.Name = "pd_pocode";
-            this.pd_pocode.ReadOnly = true;
-            this.pd_pocode.Width = 66;
-            // 
-            // pd_custprodcode
-            // 
-            this.pd_custprodcode.DataPropertyName = "pd_custprodcode";
-            this.pd_custprodcode.HeaderText = "客户料号";
-            this.pd_custprodcode.Name = "pd_custprodcode";
-            this.pd_custprodcode.ReadOnly = true;
-            this.pd_custprodcode.Width = 78;
-            // 
-            // pd_custprodspec
-            // 
-            this.pd_custprodspec.DataPropertyName = "pd_custprodspec";
-            this.pd_custprodspec.HeaderText = "客户型号";
-            this.pd_custprodspec.Name = "pd_custprodspec";
-            this.pd_custprodspec.ReadOnly = true;
-            this.pd_custprodspec.Width = 78;
-            // 
-            // pr_spec
-            // 
-            this.pr_spec.DataPropertyName = "pr_spec";
-            this.pr_spec.HeaderText = "规格";
-            this.pr_spec.Name = "pr_spec";
-            this.pr_spec.Width = 54;
-            // 
-            // pib_outboxcode1
-            // 
-            this.pib_outboxcode1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_outboxcode1.DataPropertyName = "pib_outboxcode1";
-            this.pib_outboxcode1.HeaderText = "中盒号";
-            this.pib_outboxcode1.Name = "pib_outboxcode1";
-            this.pib_outboxcode1.Width = 90;
-            // 
-            // pib_outboxcode2
-            // 
-            this.pib_outboxcode2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_outboxcode2.DataPropertyName = "pib_outboxcode2";
-            this.pib_outboxcode2.HeaderText = "外箱号";
-            this.pib_outboxcode2.Name = "pib_outboxcode2";
-            this.pib_outboxcode2.Width = 90;
-            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(1389, 729);
+            this.Controls.Add(this.cu_print_regexpression);
             this.Controls.Add(this.PLCStart);
             this.Controls.Add(this.PLCStop);
             this.Controls.Add(this.ExportData);
@@ -2400,5 +2412,6 @@
         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.Label cu_print_regexpression;
     }
 }

+ 118 - 163
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -56,10 +56,6 @@ namespace UAS_LabelMachine
         /// 弹窗线程
         /// </summary>
         Thread thread;
-        /// <summary>
-        /// 当前品牌
-        /// </summary>
-        string Brand;
         string PI_ID;
         /// <summary>
         /// 当前扫描的所在行
@@ -112,22 +108,25 @@ namespace UAS_LabelMachine
         /// 默认采集了指定的数据上传
         /// </summary>
         int UploadNum = 100;
-        /// <summary>
-        /// 是否获取过箱号
-        /// </summary>
-        bool GetPackingCode = false;
-
-        string SG_Script;
 
-        Dictionary<int, string> Si_Item = new Dictionary<int, string>();
         /*需要重绘的Cell*/
         Dictionary<DataGridViewCell, bool> PaintCell = new Dictionary<DataGridViewCell, bool>();
         /// <summary>
         /// 是否通过选择Combox来改变打开的文件
         /// </summary>
         bool ComBoxClickChangeLabelDoc = false;
-
+        /// <summary>
+        /// 附加信息DataTable
+        /// </summary>
         DataTable Attach;
+        /// <summary>
+        /// 采集策略DataTable
+        /// </summary>
+        DataTable ScanGroup;
+        /// <summary>
+        /// 采集明细DataTable
+        /// </summary>
+        DataTable ScanItem;
 
         public UAS_出货标签打印(string Master)
         {
@@ -230,36 +229,69 @@ namespace UAS_LabelMachine
                 {
                     case "FrontendCheck":
                         FrontCollect.Text = msg;
-                        MatchCollection matchs = reg.Matches(msg);
-                        int index = 0;
-                        foreach (var item in Si_Item)
+                        for (int i = 0; i < ScanGroup.Rows.Count; i++)
                         {
-                            switch (item.Value)
+                            string sg_name = ScanGroup.Rows[i]["sg_name"].ToString();
+                            reg = new Regex(ScanGroup.Rows[i]["sg_script"].ToString());
+                            MatchCollection matchs = reg.Matches(msg);
+                            int index = 0;
+                            DataTable dt = BaseUtil.filterDataTable(ScanItem, "sg_name='" + sg_name + "' and items_num=" + matchs.Count);
+                            if (dt.Rows.Count > 0)
                             {
-                                case "DateCode":
-                                    DateCode = matchs[index].Value;
-                                    break;
-                                case "LotNo":
-                                    LotNo = matchs[index].Value;
-                                    break;
-                                case "PN":
-                                    PN = matchs[index].Value;
-                                    break;
-                                case "Order":
-                                    Order = matchs[index].Value;
-                                    break;
-                                case "QTY":
-                                    QTY = matchs[index].Value;
-                                    break;
-                                case "OutBox":
-                                    OutBox = matchs[index].Value;
-                                    break;
-                                default:
-                                    break;
+                                for (int j = 0; j < dt.Rows.Count; j++)
+                                {
+                                    string si_expression = dt.Rows[j]["si_expression"].ToString();
+                                    Regex si_exp;
+                                    switch (dt.Rows[j]["si_item"].ToString())
+                                    {
+                                        case "DateCode":
+                                            if (si_expression != "")
+                                            {
+                                                si_exp = new Regex(si_expression);
+                                                DateCode = si_exp.Match(matchs[index].Value).Value;
+                                            }
+                                            else
+                                            {
+                                                DateCode = matchs[index].Value;
+                                            }
+                                            LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value = DateCode;
+                                            break;
+                                        case "LotNo":
+                                            LotNo = matchs[index].Value;
+                                            LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value = LotNo;
+                                            break;
+                                        case "PN":
+                                            PN = matchs[index].Value;
+                                            break;
+                                        case "Order":
+                                            Order = matchs[index].Value;
+                                            break;
+                                        case "QTY":
+                                            if (si_expression != "")
+                                            {
+                                                si_exp = new Regex(si_expression);
+                                                QTY = si_exp.Match(matchs[index].Value).Value;
+                                            }
+                                            else
+                                            {
+                                                QTY = matchs[index].Value;
+                                            }
+                                            break;
+                                        case "OutBox":
+                                            OutBox = matchs[index].Value;
+                                            break;
+                                        default:
+                                            break;
+                                    }
+                                    index = index + 1;
+                                }
+                                LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
+                                adh.ExecuteSql("update prodiobarcode set pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1 where pib_id=" + pib_id, "update");
+                                if (CurrentRowIndex + 1 < LabelInf.Rows.Count)
+                                    CurrentRowIndex = CurrentRowIndex + 1;
+                                LabelInf.Refresh();
                             }
-                            index = index + 1;
                         }
-                        adh.ExecuteSql("update prodiobarcode set pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "' where pib_id=" + pib_id, "update");
                         break;
                     case "BackendCheck":
                         BackCheck.Text = msg;
@@ -357,12 +389,6 @@ namespace UAS_LabelMachine
             }
             RefreshProcessData();
             MessageLog.AppendText(">>扫描到数据" + BackCheck.Text + "\n", Color.Blue);
-            //如果所采集的行的物料不一样的话,重新计算箱内容量
-            if (CurrentRowIndex - 1 > 0)
-            {
-                string LastRowProd = LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_prodcode"].Value.ToString();
-                string CurrentRowProd = LabelInf.Rows[CurrentRowIndex].Cells["pib_prodcode"].Value.ToString();
-            }
         }
 
         private void AutoPrintSingleLabel()
@@ -401,65 +427,6 @@ namespace UAS_LabelMachine
             LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
         }
 
-        //
-        /// <summary>
-        /// 设置外箱号
-        /// </summary>
-        /// <param name="BatchCollect">是否批量采集</param>
-        private void SetOutBoxCode2(bool BatchCollect)
-        {
-            if (OutboxCapacity.Value != 0)
-            {
-                //获取当前出入口单最大的外箱号
-                for (int i = 0; i < LabelInf.RowCount; i++)
-                {
-                    string outboxcode = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
-                    if (outboxcode.Contains("-"))
-                    {
-                        if (int.Parse(outboxcode.Split('-')[0] == "" ? "1" : outboxcode.Split('-')[0]) > MaxOutBoxCode)
-                            MaxOutBoxCode = int.Parse(outboxcode.Split('-')[0]);
-                    }
-                    else
-                    {
-                        if (int.Parse(outboxcode == "" ? "0" : outboxcode) > MaxOutBoxCode)
-                            MaxOutBoxCode = int.Parse(outboxcode);
-                    }
-                }
-                //统计最大的箱号存在多少
-                int MaxOutBoxCodeCount = 0;
-                for (int i = 0; i < LabelInf.RowCount; i++)
-                {
-                    if (LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString() == MaxOutBoxCode.ToString())
-                        MaxOutBoxCodeCount = MaxOutBoxCodeCount + 1;
-                }
-                //如果是获取过包装单的话则不再继续追加箱号
-                if (!GetPackingCode)
-                {
-                    //如果箱内的盒数量小于容量,继续使用此箱号赋值,否则箱号+1
-                    if (BatchCollect)
-                    {
-                        if (MaxOutBoxCodeCount < OutboxCapacity.Value)
-                            LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = MaxOutBoxCode;
-                        else
-                        {
-                            MaxOutBoxCode = MaxOutBoxCode + 1;
-                            LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = MaxOutBoxCode;
-                        }
-                    }
-                    else
-                    {
-                        if (MaxOutBoxCodeCount <= OutboxCapacity.Value)
-                            LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = MaxOutBoxCode;
-                        else
-                        {
-                            MaxOutBoxCode = MaxOutBoxCode + 1;
-                            LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = MaxOutBoxCode;
-                        }
-                    }
-                }
-            }
-        }
-
         //关闭窗口前提示用户确认
         private void 贴标机条码打印_FormClosing(object sender, FormClosingEventArgs e)
         {
@@ -607,16 +574,22 @@ namespace UAS_LabelMachine
                                 break;
                         }
                     }
-                    dt = (DataTable)dh.ExecuteSql("select distinct sg_brand from prodiodetail left join product on pd_prodcode=pr_code left join scangroup on nvl(pd_brand,pr_brand)=sg_brand where pd_inoutno='" + pi_inoutno.Text + "' and sg_brand is not null", "select");
-                    for (int i = 0; i < dt.Rows.Count; i++)
-                    {
-                        FrontCombo.DataSource = dt;
-                        FrontCombo.DisplayMember = "sg_brand";
-                        FrontCombo.ValueMember = "sg_brand";
-                        BackCombo.DataSource = dt;
-                        BackCombo.DisplayMember = "sg_brand";
-                        BackCombo.ValueMember = "sg_brand";
-                    }
+                    //查询所有的采集策略
+                    sql.Clear();
+                    sql.Append("select * from (select sg_brand,si_item,sg_name,si_expression,instr(sg_name,si_name) itemindex from (select sg_brand,si_item ");
+                    sql.Append(",max(si_expression)si_expression,sg_name,si_name from prodiodetail left join product on pd_prodcode=pr_code left join scangroup on nvl(pd_brand,pr_brand) ");
+                    sql.Append("=sg_brand left join scanitem on sg_id=si_sgid where pd_inoutno='" + pi_inoutno.Text + "' and si_enable=-1 group by ");
+                    sql.Append("sg_brand,si_item,sg_name,si_name))A left join (select count(1) items_num,sg_name from (select sg_name from prodiodetail ");
+                    sql.Append("left join product on pd_prodcode=pr_code left join scangroup on  nvl(pd_brand,pr_brand)=sg_brand left join scanitem  ");
+                    sql.Append("on sg_id=si_sgid where pd_inoutno='" + pi_inoutno.Text + "' and si_enable=-1 group by sg_brand,si_item,sg_name ");
+                    sql.Append(") group by sg_name)B on A.sg_name=b.sg_name order by A.sg_name,itemindex");
+                    ScanItem = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                    FrontCombo.DataSource = ScanItem;
+                    FrontCombo.DisplayMember = "sg_brand";
+                    FrontCombo.ValueMember = "sg_brand";
+                    BackCombo.DataSource = ScanItem;
+                    BackCombo.DisplayMember = "sg_brand";
+                    BackCombo.ValueMember = "sg_brand";
                     LoadGridData(sender, e);
                     //重新输入单号后清除缓存
                     MidBoxArgument.Clear();
@@ -1115,16 +1088,18 @@ namespace UAS_LabelMachine
         private void LoadGridData(object sender, EventArgs e)
         {
             AllCollect = false;
-            dt = (DataTable)adh.ExecuteSql("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "select");
+            dt = (DataTable)adh.ExecuteSql("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by pib_id", "select");
             if (dt.Rows.Count == 0)
             {
                 sql.Clear();
-                sql.Append("select pd_custprodcode,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,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,pi_title,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 prodinout on pib_piid=pi_id 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 ");
-                sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
+                sql.Append("select pd_custprodcode,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,");
+                sql.Append("pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,");
+                sql.Append("pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join prodinout on pib_piid=pi_id 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 where pib_piid='" + PI_ID + "' order by to_number(pib_id)");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                //检验查询的字段和本地数据库字段是否匹配
+                adh.AddColumFromDataTable(dt, "prodiobarcode");
+                //将数据保存在本地数据库
                 adh.SaveDataTable(dt, "prodiobarcode");
             }
             //获取系统设置的上传数量,如参数异常则默认为100
@@ -1134,21 +1109,8 @@ namespace UAS_LabelMachine
             }
             MidSource.DataSource = dt;
             BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
-            if (LabelInf.RowCount > 0)
-            {
-                Brand = LabelInf.Rows[0].Cells["pib_brand"].FormattedValue.ToString();
-                if (Brand != "")
-                {
-                    dt = (DataTable)dh.ExecuteSql("select sg_script,sg_id from scangroup where sg_brand='" + Brand + "'", "select");
-                    if (dt.Rows.Count > 0)
-                    {
-                        string sgid = dt.Rows[0]["sg_id"].ToString();
-                        SG_Script = dt.Rows[0]["sg_script"].ToString();
-                        reg = new Regex(SG_Script);
-                        DataTable dt1 = (DataTable)dh.ExecuteSql("select si_name,si_item,si_expression from scanitem where si_sgid='" + sgid + "' and si_enable<>0", "select");
-                    }
-                }
-            }
+            //获取所有的匹配脚本
+            ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_script,sg_name from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null", "select");
             //绑定数据之后往下找到未采集的数据显示在当前采集的栏目
             for (int i = 0; i < LabelInf.RowCount; i++)
             {
@@ -1182,38 +1144,31 @@ namespace UAS_LabelMachine
                 }
                 if (e.RowIndex >= 0)
                 {
-                    //重绘制定的Cell,表示采集的数量不匹配
-                    if (LabelInf.Columns[e.ColumnIndex].Name == "pib_qty" && PaintCell.ContainsKey(LabelInf.Rows[e.RowIndex].Cells["pib_qty"]))
-                    {
-                        SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
-                        e.Graphics.FillRectangle(PaintCell[LabelInf.Rows[e.RowIndex].Cells["pib_qty"]] ? Brushes.ForestGreen : Brushes.Red, e.CellBounds);
-                        Rectangle border = e.CellBounds;
-                        border.Width -= 1;
-                        e.Graphics.DrawRectangle(Pens.Black, border);
-                        e.PaintContent(e.CellBounds);
-                        e.Handled = true;
-                    }
-                    //表示采集的供应商物料编号不匹配
-                    if (LabelInf.Columns[e.ColumnIndex].Name == "pr_vendprodcode" && PaintCell.ContainsKey(LabelInf.Rows[e.RowIndex].Cells["pr_vendprodcode"]))
+                    if (LabelInf.Rows[e.RowIndex].Cells["pib_ifpick"].FormattedValue.ToString() == "True")
                     {
-                        SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
-                        e.Graphics.FillRectangle(PaintCell[LabelInf.Rows[e.RowIndex].Cells["pr_vendprodcode"]] ? Brushes.ForestGreen : Brushes.Red, e.CellBounds);
-                        Rectangle border = e.CellBounds;
-                        border.Width -= 1;
-                        e.Graphics.DrawRectangle(Pens.Black, border);
-                        e.PaintContent(e.CellBounds);
-                        e.Handled = true;
+                        if (LabelInf.Columns[e.ColumnIndex].Name == "pib_lotno" || LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
+                        {
+                            SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
+                            e.Graphics.FillRectangle(Brushes.ForestGreen, e.CellBounds);
+                            Rectangle border = e.CellBounds;
+                            border.Width -= 1;
+                            e.Graphics.DrawRectangle(Pens.Black, border);
+                            e.PaintContent(e.CellBounds);
+                            e.Handled = true;
+                        }
                     }
-                    //表示采集的供应商物料编号不匹配
-                    if (LabelInf.Columns[e.ColumnIndex].Name == "pib_brand" && PaintCell.ContainsKey(LabelInf.Rows[e.RowIndex].Cells["pib_brand"]))
+                    if (LabelInf.Rows[e.RowIndex].Cells["pib_ifrecheck"].FormattedValue.ToString() == "True")
                     {
-                        SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
-                        e.Graphics.FillRectangle(PaintCell[LabelInf.Rows[e.RowIndex].Cells["pib_brand"]] ? Brushes.ForestGreen : Brushes.Red, e.CellBounds);
-                        Rectangle border = e.CellBounds;
-                        border.Width -= 1;
-                        e.Graphics.DrawRectangle(Pens.Black, border);
-                        e.PaintContent(e.CellBounds);
-                        e.Handled = true;
+                        if (LabelInf.Columns[e.ColumnIndex].Name == "pib_custbarcode")
+                        {
+                            SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
+                            e.Graphics.FillRectangle(Brushes.CadetBlue, e.CellBounds);
+                            Rectangle border = e.CellBounds;
+                            border.Width -= 1;
+                            e.Graphics.DrawRectangle(Pens.Black, border);
+                            e.PaintContent(e.CellBounds);
+                            e.Handled = true;
+                        }
                     }
                 }
             }

+ 1 - 2
UAS-出货标签管理(吉利通)/采集策略_NEW.cs

@@ -144,12 +144,11 @@ namespace UAS_LabelMachine
                     SGID = dh.getFieldDataByCondition("scangroup", "sg_id", "sg_name='" + sgname + "' and sg_brand='" + SGBrand + "'").ToString();
                 }
             }
-            //每次保存的时候明细删除重新插入
-            dh.ExecuteSql("delete from scanitem where si_sgid=" + SGID, "delete");
             //更新主表数据
             sql.Clear();
             sql.Append("update scangroup set sg_name=:sg_name,sg_script=:sg_script,sg_step=:sg_step,sg_autolabel=:sg_autolabel where sg_id=" + SGID);
             dh.ExecuteSql(sql.ToString(), "update", sgname, sg_script.Text, sg_step.Value, sg_autolabel.Checked ? "-1" : "0");
+            dh.ExecuteSql("delete from scanitem where si_sgid="+SGID , "delete");
             sql.Clear();
             sql.Append("insert into scanitem(si_id,si_sgid,si_item,si_expression,si_remark,si_name,");
             sql.Append("si_enable) values(scanitem_seq.nextval,'" + SGID + "',:si_item,:si_expression,:si_remark,:si_name,:si_enable)");