浏览代码

修改采集策略错误,添加中盘单独打印

章政 8 年之前
父节点
当前提交
6d730a97f9

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

@@ -771,6 +771,7 @@ namespace UAS_LabelMachine
         /// <returns></returns>
         public object ExecuteSql(string SQL, string Type, params object[] names)
         {
+            Console.WriteLine(SQL);
             object result = null;
             command = new OracleCommand(SQL, connection);
             //用来拼接参数的

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

@@ -721,7 +721,7 @@
             // ChooseAll
             // 
             this.ChooseAll.Location = new System.Drawing.Point(4, 252);
-            this.ChooseAll.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.ChooseAll.Margin = new System.Windows.Forms.Padding(2);
             this.ChooseAll.Name = "ChooseAll";
             this.ChooseAll.Size = new System.Drawing.Size(38, 22);
             this.ChooseAll.TabIndex = 84;
@@ -771,7 +771,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(56, 74);
+            this.Capacity.Location = new System.Drawing.Point(54, 72);
             this.Capacity.Name = "Capacity";
             this.Capacity.Size = new System.Drawing.Size(0, 17);
             this.Capacity.TabIndex = 75;
@@ -780,7 +780,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(56, 118);
+            this.Process_midboxcode.Location = new System.Drawing.Point(54, 116);
             this.Process_midboxcode.Name = "Process_midboxcode";
             this.Process_midboxcode.Size = new System.Drawing.Size(15, 17);
             this.Process_midboxcode.TabIndex = 74;
@@ -790,7 +790,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(56, 94);
+            this.Process_outboxcode.Location = new System.Drawing.Point(54, 92);
             this.Process_outboxcode.Name = "Process_outboxcode";
             this.Process_outboxcode.Size = new System.Drawing.Size(15, 17);
             this.Process_outboxcode.TabIndex = 73;
@@ -801,7 +801,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(90, 26);
+            this.TotalCount.Location = new System.Drawing.Point(88, 24);
             this.TotalCount.Name = "TotalCount";
             this.TotalCount.Size = new System.Drawing.Size(15, 17);
             this.TotalCount.TabIndex = 72;
@@ -811,7 +811,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(77, 26);
+            this.label17.Location = new System.Drawing.Point(75, 24);
             this.label17.Name = "label17";
             this.label17.Size = new System.Drawing.Size(13, 17);
             this.label17.TabIndex = 71;
@@ -822,7 +822,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(59, 26);
+            this.CollectedCount.Location = new System.Drawing.Point(57, 24);
             this.CollectedCount.Name = "CollectedCount";
             this.CollectedCount.Size = new System.Drawing.Size(15, 17);
             this.CollectedCount.TabIndex = 70;
@@ -832,7 +832,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(6, 95);
+            this.label14.Location = new System.Drawing.Point(4, 93);
             this.label14.Name = "label14";
             this.label14.Size = new System.Drawing.Size(32, 17);
             this.label14.TabIndex = 69;
@@ -842,7 +842,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(6, 118);
+            this.label11.Location = new System.Drawing.Point(4, 116);
             this.label11.Name = "label11";
             this.label11.Size = new System.Drawing.Size(32, 17);
             this.label11.TabIndex = 68;
@@ -852,7 +852,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(6, 54);
+            this.label13.Location = new System.Drawing.Point(4, 52);
             this.label13.Name = "label13";
             this.label13.Size = new System.Drawing.Size(44, 17);
             this.label13.TabIndex = 67;
@@ -862,7 +862,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(56, 54);
+            this.Installed.Location = new System.Drawing.Point(54, 52);
             this.Installed.Name = "Installed";
             this.Installed.Size = new System.Drawing.Size(0, 17);
             this.Installed.TabIndex = 66;
@@ -871,7 +871,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(6, 26);
+            this.Process.Location = new System.Drawing.Point(4, 24);
             this.Process.Name = "Process";
             this.Process.Size = new System.Drawing.Size(44, 17);
             this.Process.TabIndex = 65;
@@ -1166,7 +1166,7 @@
             // 
             this.ViVoPlate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ViVoPlate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ViVoPlate.Location = new System.Drawing.Point(80, 158);
+            this.ViVoPlate.Location = new System.Drawing.Point(100, 156);
             this.ViVoPlate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ViVoPlate.Name = "ViVoPlate";
             this.ViVoPlate.Size = new System.Drawing.Size(68, 26);
@@ -1188,7 +1188,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(80, 195);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(100, 193);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(68, 26);
@@ -1201,7 +1201,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(3, 106);
+            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(7, 110);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelAutoPrint.Name = "SingleLabelAutoPrint";
             this.SingleLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1246,7 +1246,7 @@
             // 
             this.MidLabelNum.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.MidLabelNum.ID = null;
-            this.MidLabelNum.Location = new System.Drawing.Point(44, 172);
+            this.MidLabelNum.Location = new System.Drawing.Point(51, 160);
             this.MidLabelNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MidLabelNum.Name = "MidLabelNum";
             this.MidLabelNum.Size = new System.Drawing.Size(64, 23);
@@ -1259,7 +1259,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(2, 163);
+            this.label5.Location = new System.Drawing.Point(12, 162);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(32, 17);
             this.label5.TabIndex = 50;
@@ -1269,7 +1269,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(2, 135);
+            this.label4.Location = new System.Drawing.Point(12, 134);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(32, 17);
             this.label4.TabIndex = 49;
@@ -1288,7 +1288,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(85, 135);
+            this.label15.Location = new System.Drawing.Point(95, 133);
             this.label15.Name = "label15";
             this.label15.Size = new System.Drawing.Size(20, 17);
             this.label15.TabIndex = 40;
@@ -1297,7 +1297,7 @@
             // MidBoxCapacity
             // 
             this.MidBoxCapacity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MidBoxCapacity.Location = new System.Drawing.Point(45, 142);
+            this.MidBoxCapacity.Location = new System.Drawing.Point(52, 130);
             this.MidBoxCapacity.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MidBoxCapacity.Name = "MidBoxCapacity";
             this.MidBoxCapacity.Size = new System.Drawing.Size(38, 23);
@@ -1319,7 +1319,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(5, 106);
+            this.MidLabelAutoPrint.Location = new System.Drawing.Point(15, 110);
             this.MidLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MidLabelAutoPrint.Name = "MidLabelAutoPrint";
             this.MidLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1369,7 +1369,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(121, 10);
+            this.LogingOut.Location = new System.Drawing.Point(119, 8);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(42, 21);
             this.LogingOut.TabIndex = 77;
@@ -1406,7 +1406,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(4, 175);
+            this.label10.Location = new System.Drawing.Point(4, 182);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(32, 17);
             this.label10.TabIndex = 90;
@@ -1429,7 +1429,7 @@
             // 
             this.label9.AutoSize = true;
             this.label9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label9.Location = new System.Drawing.Point(86, 204);
+            this.label9.Location = new System.Drawing.Point(88, 210);
             this.label9.Name = "label9";
             this.label9.Size = new System.Drawing.Size(32, 17);
             this.label9.TabIndex = 88;
@@ -1452,7 +1452,7 @@
             // 
             this.label8.AutoSize = true;
             this.label8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label8.Location = new System.Drawing.Point(4, 204);
+            this.label8.Location = new System.Drawing.Point(4, 211);
             this.label8.Name = "label8";
             this.label8.Size = new System.Drawing.Size(32, 17);
             this.label8.TabIndex = 83;
@@ -1462,7 +1462,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(4, 142);
+            this.label6.Location = new System.Drawing.Point(4, 150);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(32, 17);
             this.label6.TabIndex = 87;
@@ -1519,7 +1519,7 @@
             // 
             this.OutBoxLabelAutoPrint.AutoSize = true;
             this.OutBoxLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxLabelAutoPrint.Location = new System.Drawing.Point(8, 106);
+            this.OutBoxLabelAutoPrint.Location = new System.Drawing.Point(9, 110);
             this.OutBoxLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxLabelAutoPrint.Name = "OutBoxLabelAutoPrint";
             this.OutBoxLabelAutoPrint.Size = new System.Drawing.Size(75, 21);

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

@@ -1488,7 +1488,7 @@ namespace UAS_LabelMachine
                 }
                 //找到了指定的盒号
                 if (FindMidLabel)
-                    MidBoxCodePrint(la_id, MidLabelRowIndex);
+                    MidBoxCodePrint(la_id, MidLabelRowIndex,"HandPrint");
                 else
                     MessageBox.Show("该出入库单未找到该中盒号!");
             }
@@ -1642,6 +1642,70 @@ namespace UAS_LabelMachine
             MidDoc.PrintDocument();
         }
 
+        private void MidBoxCodePrint(string la_id, int rowindex,string HandPrint)
+        {
+            DataTable dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
+            for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
+            {
+                //将维护的模板参数和模板本身的参数名称进行比对
+                for (int k = 0; k < dt.Rows.Count; k++)
+                {
+                    //名称相等的时候,取SQL进行值的查询
+                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == dt.Rows[k]["lp_name"].ToString())
+                    {
+                        //获取对应行的pib_id
+                        string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
+                        string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
+                        //获取打印执行的SQL
+                        string sql = dt.Rows[k]["lp_sql"].ToString();
+                        try
+                        {
+                            //获取打印执行的SQL
+                            if (sql.IndexOf("{") == 0)
+                            {
+                                MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
+                                LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + dt.Rows[k]["lp_sql"].ToString() + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
+                            }
+                            else
+                            {
+                                string ExeSQL = "";
+                                if (sql.ToLower().Contains("pib_lotno"))
+                                    MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
+                                else if (sql.ToLower().Contains("pib_datecode"))
+                                    MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
+                                else
+                                {
+                                    ExeSQL = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
+                                    ExeSQL = ExeSQL.Substring(0, ExeSQL.IndexOf("{")) + pib_outboxcode1;
+                                    if (ExeSQL.ToLower().Contains("pib_qty")) {
+                                        ExeSQL += "group by pib_outboxcode1";
+                                    }
+                                    MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(ExeSQL).ToString();
+                                }
+                                LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + ExeSQL + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
+                            }
+                        }
+                        catch (Exception)
+                        {
+                            MessageBox.Show("SQL维护不正确,请检查SQL语句\n" + sql);
+                            return;
+                        }
+                    }
+                    else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == "DateCode1")
+                    {
+                        if (LabelInf.Rows[rowindex].Cells["DateCode1"].Value != null)
+                        {
+                            MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["DateCode1"].Value.ToString();
+                        }
+                    }
+                }
+            }
+            //保存参数打印
+            MidDoc.Save();
+            MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
+            MidDoc.PrintDocument();
+        }
+
         /// <summary>
         /// 执行打印外箱号
         /// </summary>

+ 1 - 1
UAS-出货标签管理/采集策略.cs

@@ -85,7 +85,7 @@ namespace UAS_LabelMachine
                             Enable = 1;
                         }
                         sql.Clear();
-                        sql.Append("update   set si_item='" + Controls["si_item" + i].Text + "',si_detno='" + Controls["si_detno" + i].Text + "',");
+                        sql.Append("update scanitem set si_item='" + Controls["si_item" + i].Text + "',si_detno='" + Controls["si_detno" + i].Text + "',");
                         sql.Append("si_index='" + Controls["si_index" + i].Text + "',si_indexstring='" + Controls["si_indexstring" + i].Text + "',");
                         sql.Append("si_kind='" + Controls["si_kind" + i].Text + "', si_length='" + Controls["si_length" + i].Text + "',");
                         sql.Append("si_expression=:si_expression,si_enable=" + Enable + " where si_id=" + Controls["si_id" + i].Text);