callm 1 месяц назад
Родитель
Сommit
73d9b85e91

+ 130 - 91
UAS_MES_ZKLH/FunctionCode/Query/Query_Barcodeio.Designer.cs

@@ -36,20 +36,21 @@
             this.label2 = new System.Windows.Forms.Label();
             this.label3 = new System.Windows.Forms.Label();
             this.ChooseAll = new System.Windows.Forms.Button();
-            this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.label1 = new System.Windows.Forms.Label();
+            this.de_kind = new System.Windows.Forms.ComboBox();
+            this.label4 = new System.Windows.Forms.Label();
+            this.devcode = new System.Windows.Forms.TextBox();
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.PrintLabel = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.ComboxWithTip(this.components);
             this.PrinterList = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.PrinterCombox();
-            this.PrintBarCode = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.DP_NAME = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
-            this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.label1 = new System.Windows.Forms.Label();
-            this.de_kind = new System.Windows.Forms.ComboBox();
             this.choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.detno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.de_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -59,6 +60,8 @@
             this.de_kind1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.de_startdate = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.lm_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.PrintBarCode = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.DP_NAME = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             ((System.ComponentModel.ISupportInitialize)(this.DGV)).BeginInit();
             this.SuspendLayout();
             // 
@@ -87,11 +90,11 @@
             this.de_kind1,
             this.de_startdate,
             this.lm_id});
-            this.DGV.Location = new System.Drawing.Point(26, 79);
+            this.DGV.Location = new System.Drawing.Point(26, 121);
             this.DGV.Name = "DGV";
             this.DGV.RowHeadersWidth = 82;
             this.DGV.RowTemplate.Height = 37;
-            this.DGV.Size = new System.Drawing.Size(1922, 971);
+            this.DGV.Size = new System.Drawing.Size(1922, 929);
             this.DGV.TabIndex = 218;
             // 
             // label2
@@ -119,7 +122,7 @@
             // 
             // ChooseAll
             // 
-            this.ChooseAll.Location = new System.Drawing.Point(26, 79);
+            this.ChooseAll.Location = new System.Drawing.Point(26, 111);
             this.ChooseAll.Margin = new System.Windows.Forms.Padding(4);
             this.ChooseAll.Name = "ChooseAll";
             this.ChooseAll.Size = new System.Drawing.Size(76, 44);
@@ -128,6 +131,60 @@
             this.ChooseAll.UseVisualStyleBackColor = true;
             this.ChooseAll.Click += new System.EventHandler(this.ChooseAll_Click);
             // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(512, 14);
+            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(146, 41);
+            this.label1.TabIndex = 227;
+            this.label1.Text = "设备种类";
+            // 
+            // de_kind
+            // 
+            this.de_kind.FormattingEnabled = true;
+            this.de_kind.Items.AddRange(new object[] {
+            "机械设备",
+            "办公设备",
+            "运输设备",
+            "检测设备",
+            "其他"});
+            this.de_kind.Location = new System.Drawing.Point(690, 22);
+            this.de_kind.Name = "de_kind";
+            this.de_kind.Size = new System.Drawing.Size(226, 32);
+            this.de_kind.TabIndex = 228;
+            this.de_kind.SelectedIndexChanged += new System.EventHandler(this.de_kind_SelectedIndexChanged);
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label4.Location = new System.Drawing.Point(19, 73);
+            this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(146, 41);
+            this.label4.TabIndex = 229;
+            this.label4.Text = "设备编号";
+            // 
+            // devcode
+            // 
+            this.devcode.Location = new System.Drawing.Point(186, 75);
+            this.devcode.Name = "devcode";
+            this.devcode.Size = new System.Drawing.Size(307, 35);
+            this.devcode.TabIndex = 230;
+            this.devcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.devcode_KeyDown);
+            this.devcode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.devcode_KeyPress);
+            this.devcode.KeyUp += new System.Windows.Forms.KeyEventHandler(this.devcode_KeyUp);
+            // 
+            // dataGridViewCheckBoxColumn1
+            // 
+            this.dataGridViewCheckBoxColumn1.HeaderText = "勾选";
+            this.dataGridViewCheckBoxColumn1.MinimumWidth = 10;
+            this.dataGridViewCheckBoxColumn1.Name = "dataGridViewCheckBoxColumn1";
+            this.dataGridViewCheckBoxColumn1.Width = 200;
+            // 
             // dataGridViewTextBoxColumn1
             // 
             this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
@@ -138,13 +195,6 @@
             this.dataGridViewTextBoxColumn1.Visible = false;
             this.dataGridViewTextBoxColumn1.Width = 10;
             // 
-            // dataGridViewCheckBoxColumn1
-            // 
-            this.dataGridViewCheckBoxColumn1.HeaderText = "勾选";
-            this.dataGridViewCheckBoxColumn1.MinimumWidth = 10;
-            this.dataGridViewCheckBoxColumn1.Name = "dataGridViewCheckBoxColumn1";
-            this.dataGridViewCheckBoxColumn1.Width = 200;
-            // 
             // dataGridViewTextBoxColumn2
             // 
             this.dataGridViewTextBoxColumn2.DataPropertyName = "lm_makecode";
@@ -190,6 +240,24 @@
             this.dataGridViewTextBoxColumn6.ReadOnly = true;
             this.dataGridViewTextBoxColumn6.Width = 200;
             // 
+            // dataGridViewTextBoxColumn7
+            // 
+            this.dataGridViewTextBoxColumn7.DataPropertyName = "lm_mannum";
+            this.dataGridViewTextBoxColumn7.HeaderText = "拉线人数";
+            this.dataGridViewTextBoxColumn7.MinimumWidth = 10;
+            this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
+            this.dataGridViewTextBoxColumn7.Width = 200;
+            // 
+            // dataGridViewTextBoxColumn8
+            // 
+            this.dataGridViewTextBoxColumn8.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.dataGridViewTextBoxColumn8.DataPropertyName = "lm_id";
+            this.dataGridViewTextBoxColumn8.HeaderText = "ID";
+            this.dataGridViewTextBoxColumn8.MinimumWidth = 10;
+            this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
+            this.dataGridViewTextBoxColumn8.Visible = false;
+            this.dataGridViewTextBoxColumn8.Width = 10;
+            // 
             // PrintLabel
             // 
             this.PrintLabel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -209,81 +277,6 @@
             this.PrinterList.Size = new System.Drawing.Size(388, 50);
             this.PrinterList.TabIndex = 222;
             // 
-            // PrintBarCode
-            // 
-            this.PrintBarCode.AllPower = null;
-            this.PrintBarCode.BackColor = System.Drawing.Color.Transparent;
-            this.PrintBarCode.DownImage = ((System.Drawing.Image)(resources.GetObject("PrintBarCode.DownImage")));
-            this.PrintBarCode.Image = null;
-            this.PrintBarCode.IsShowBorder = true;
-            this.PrintBarCode.Location = new System.Drawing.Point(1836, 15);
-            this.PrintBarCode.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
-            this.PrintBarCode.MoveImage = ((System.Drawing.Image)(resources.GetObject("PrintBarCode.MoveImage")));
-            this.PrintBarCode.Name = "PrintBarCode";
-            this.PrintBarCode.NormalImage = ((System.Drawing.Image)(resources.GetObject("PrintBarCode.NormalImage")));
-            this.PrintBarCode.Power = null;
-            this.PrintBarCode.Size = new System.Drawing.Size(112, 45);
-            this.PrintBarCode.TabIndex = 216;
-            this.PrintBarCode.Text = "打印";
-            this.PrintBarCode.UseVisualStyleBackColor = false;
-            this.PrintBarCode.Click += new System.EventHandler(this.Print_Click);
-            // 
-            // DP_NAME
-            // 
-            this.DP_NAME.AllPower = "IFALL";
-            this.DP_NAME.Caller = null;
-            this.DP_NAME.Condition = null;
-            this.DP_NAME.DBTitle = "";
-            this.DP_NAME.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.DP_NAME.FormName = null;
-            this.DP_NAME.Location = new System.Drawing.Point(186, 15);
-            this.DP_NAME.Margin = new System.Windows.Forms.Padding(6);
-            this.DP_NAME.Name = "DP_NAME";
-            this.DP_NAME.Power = "";
-            this.DP_NAME.ReturnData = null;
-            this.DP_NAME.SelectField = null;
-            this.DP_NAME.SetValueField = null;
-            this.DP_NAME.Size = new System.Drawing.Size(307, 46);
-            this.DP_NAME.TabIndex = 213;
-            this.DP_NAME.TableName = null;
-            this.DP_NAME.Tag = "msl_makecode";
-            this.DP_NAME.TextBoxEnable = true;
-            this.DP_NAME.UserControlTextChanged += new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextChange(this.pi_inoutno_UserControlTextChanged);
-            // 
-            // dataGridViewTextBoxColumn7
-            // 
-            this.dataGridViewTextBoxColumn7.DataPropertyName = "lm_mannum";
-            this.dataGridViewTextBoxColumn7.HeaderText = "拉线人数";
-            this.dataGridViewTextBoxColumn7.MinimumWidth = 10;
-            this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
-            this.dataGridViewTextBoxColumn7.Width = 200;
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(512, 14);
-            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(146, 41);
-            this.label1.TabIndex = 227;
-            this.label1.Text = "设备种类";
-            // 
-            // de_kind
-            // 
-            this.de_kind.FormattingEnabled = true;
-            this.de_kind.Items.AddRange(new object[] {
-            "机械设备",
-            "办公设备",
-            "运输设备",
-            "检测设备",
-            "其他"});
-            this.de_kind.Location = new System.Drawing.Point(690, 22);
-            this.de_kind.Name = "de_kind";
-            this.de_kind.Size = new System.Drawing.Size(226, 32);
-            this.de_kind.TabIndex = 228;
-            this.de_kind.SelectedIndexChanged += new System.EventHandler(this.de_kind_SelectedIndexChanged);
-            // 
             // choose
             // 
             this.choose.HeaderText = "勾选";
@@ -361,11 +354,54 @@
             this.lm_id.Visible = false;
             this.lm_id.Width = 10;
             // 
+            // PrintBarCode
+            // 
+            this.PrintBarCode.AllPower = null;
+            this.PrintBarCode.BackColor = System.Drawing.Color.Transparent;
+            this.PrintBarCode.DownImage = ((System.Drawing.Image)(resources.GetObject("PrintBarCode.DownImage")));
+            this.PrintBarCode.Image = null;
+            this.PrintBarCode.IsShowBorder = true;
+            this.PrintBarCode.Location = new System.Drawing.Point(1836, 15);
+            this.PrintBarCode.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+            this.PrintBarCode.MoveImage = ((System.Drawing.Image)(resources.GetObject("PrintBarCode.MoveImage")));
+            this.PrintBarCode.Name = "PrintBarCode";
+            this.PrintBarCode.NormalImage = ((System.Drawing.Image)(resources.GetObject("PrintBarCode.NormalImage")));
+            this.PrintBarCode.Power = null;
+            this.PrintBarCode.Size = new System.Drawing.Size(112, 45);
+            this.PrintBarCode.TabIndex = 216;
+            this.PrintBarCode.Text = "打印";
+            this.PrintBarCode.UseVisualStyleBackColor = false;
+            this.PrintBarCode.Click += new System.EventHandler(this.Print_Click);
+            // 
+            // DP_NAME
+            // 
+            this.DP_NAME.AllPower = "IFALL";
+            this.DP_NAME.Caller = null;
+            this.DP_NAME.Condition = null;
+            this.DP_NAME.DBTitle = "";
+            this.DP_NAME.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.DP_NAME.FormName = null;
+            this.DP_NAME.Location = new System.Drawing.Point(186, 15);
+            this.DP_NAME.Margin = new System.Windows.Forms.Padding(6);
+            this.DP_NAME.Name = "DP_NAME";
+            this.DP_NAME.Power = "";
+            this.DP_NAME.ReturnData = null;
+            this.DP_NAME.SelectField = null;
+            this.DP_NAME.SetValueField = null;
+            this.DP_NAME.Size = new System.Drawing.Size(307, 46);
+            this.DP_NAME.TabIndex = 213;
+            this.DP_NAME.TableName = null;
+            this.DP_NAME.Tag = "msl_makecode";
+            this.DP_NAME.TextBoxEnable = true;
+            this.DP_NAME.UserControlTextChanged += new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextChange(this.pi_inoutno_UserControlTextChanged);
+            // 
             // Query_Barcodeio
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1960, 1075);
+            this.Controls.Add(this.devcode);
+            this.Controls.Add(this.label4);
             this.Controls.Add(this.de_kind);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.ChooseAll);
@@ -419,5 +455,8 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn de_kind1;
         private System.Windows.Forms.DataGridViewTextBoxColumn de_startdate;
         private System.Windows.Forms.DataGridViewTextBoxColumn lm_id;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.TextBox devcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
     }
 }

+ 17 - 2
UAS_MES_ZKLH/FunctionCode/Query/Query_Barcodeio.cs

@@ -91,8 +91,8 @@ namespace UAS_MES_NEW.Query
         }
 
         private void LoadGridData()
-        {
-            DataTable dt = (DataTable)dh.ExecuteSql("select ROW_NUMBER() OVER (ORDER BY de_currentcentername)   detno,de_kind,de_code,de_name,de_spec,de_currentcentername,to_char(de_startdate,'yyyy-mm-dd')de_startdate from device  where de_currentcentername like '%" + DP_NAME.Text + "%' and de_kind like '%" + de_kind.Text + "%' order by de_currentcentername", "select");
+        { 
+            DataTable dt = (DataTable)dh.ExecuteSql("select ROW_NUMBER() OVER (ORDER BY de_currentcentername)   detno,de_kind,de_code,de_name,de_spec,de_currentcentername,to_char(de_startdate,'yyyy-mm-dd')de_startdate from device  where de_currentcentername like '%" + DP_NAME.Text + "%' and de_kind like '%" + de_kind.Text + "%' and de_code like '%"+devcode.Text+"%' order by de_currentcentername", "select");
             BaseUtil.FillDgvWithDataTable(DGV, dt);
         }
 
@@ -170,5 +170,20 @@ namespace UAS_MES_NEW.Query
         {
             LoadGridData() ;
         }
+
+        private void devcode_KeyDown(object sender, KeyEventArgs e)
+        {
+            
+        }
+
+        private void devcode_KeyPress(object sender, KeyPressEventArgs e)
+        {
+           
+        }
+
+        private void devcode_KeyUp(object sender, KeyEventArgs e)
+        {
+            LoadGridData();
+        }
     }
 }

+ 7 - 19
UAS_MES_ZKLH/FunctionCode/Query/Query_SOP.cs

@@ -129,7 +129,7 @@ namespace UAS_MES_NEW.Query
 
                             // ========== 获取原始工作表 ==========
                             Worksheet originalSheet = workbook.Worksheets[i];
-
+                            Console.WriteLine(originalSheet.Name);
                             int lastColIndex = originalSheet.Cells.MaxDataColumn + 3;
                             string lastColLetter = CellsHelper.ColumnIndexToName(lastColIndex);
 
@@ -155,7 +155,8 @@ namespace UAS_MES_NEW.Query
                                 }
                                 else
                                 {
-                                    break;
+                                    totalDataRows++;
+                                    //break;
                                 }
                             }
 
@@ -164,7 +165,7 @@ namespace UAS_MES_NEW.Query
 
                             int imageIndex = 1;
 
-                            for (int page = 0; page < totalPages; page++)
+                            for (int page = 0; page < (totalPages == 0 ? 1 : totalPages); page++)
                             {
                                 // ========== 关键修复:每次循环复制一份新的工作表 ==========
                                 // 复制原始工作表到新的临时工作表
@@ -197,21 +198,7 @@ namespace UAS_MES_NEW.Query
                                 int newTotalRows = she.Cells.MaxDataRow + 1;
 
 
-                                //int endRow = Math.Min(startRow + rowSliceSize - 1, totalRows - 1);
-
-                                //// 1. 动态设置原表的打印区域(模拟切片)
-                                //if (endRow < rowSliceSize)
-                                //{
-                                //    Console.WriteLine($"A{startRow + 1}:{lastColLetter}{rowSliceSize + 1}");
-                                //    she.PageSetup.PrintArea = $"A{startRow + 1}:{lastColLetter}{rowSliceSize + 1}";
-                                //}
-                                //else
-                                //{
-                                //    Console.WriteLine($"A{startRow + 1}:{lastColLetter}{endRow + 1}");
-                                //    she.PageSetup.PrintArea = $"A{startRow + 1}:{lastColLetter}{endRow + 1}";
-                                //}
-
-                                string newPrintArea = $"A1:{lastColLetter}{newTotalRows}";
+                                string newPrintArea = $"A1:{lastColLetter}{(totalPages == 0 ? dataRowsPerPage : newTotalRows)}";
                                 she.PageSetup.PrintArea = newPrintArea;
 
                                 she.PageSetup.CenterHorizontally = true;
@@ -219,7 +206,7 @@ namespace UAS_MES_NEW.Query
                                 she.PageSetup.LeftMargin = 0;
                                 she.PageSetup.RightMargin = 0;
                                 she.PageSetup.TopMargin = 0;
-                                she.PageSetup.BottomMargin = 0;
+                                she.PageSetup.BottomMargin = 2;
 
                                 // ========== 添加图片/水印 ==========
                                 if (File.Exists(PrintPath.Text))
@@ -230,6 +217,7 @@ namespace UAS_MES_NEW.Query
                                 }
 
                                 // ========== 写入页脚 ==========
+
                                 string pageFooter = $"第 {imageIndex} 页 / 共 {totalPages} 页";
                                 she.PageSetup.SetFooter(1, pageFooter);