Browse Source

机柜标签打印

callm 3 months ago
parent
commit
5e67de6585

+ 2 - 108
UAS_MES_JC/FunctionCode/Query/Query_SN.Designer.cs

@@ -49,16 +49,8 @@
             this.PrinterList = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.PrinterCombox();
             this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.PrintFuseLabel = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.RePrintSn = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.label8 = new System.Windows.Forms.Label();
             this.PrintByBatch = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.label10 = new System.Windows.Forms.Label();
-            this.PrintBatch = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.SingleRowCount = new System.Windows.Forms.NumericUpDown();
-            this.label9 = new System.Windows.Forms.Label();
-            this.PrintNums = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.SingleRowCount)).BeginInit();
             this.SuspendLayout();
             // 
             // label5
@@ -259,7 +251,7 @@
             this.PrintFuseLabel.DownImage = ((System.Drawing.Image)(resources.GetObject("PrintFuseLabel.DownImage")));
             this.PrintFuseLabel.Image = null;
             this.PrintFuseLabel.IsShowBorder = true;
-            this.PrintFuseLabel.Location = new System.Drawing.Point(502, 784);
+            this.PrintFuseLabel.Location = new System.Drawing.Point(502, 544);
             this.PrintFuseLabel.Margin = new System.Windows.Forms.Padding(6);
             this.PrintFuseLabel.MoveImage = ((System.Drawing.Image)(resources.GetObject("PrintFuseLabel.MoveImage")));
             this.PrintFuseLabel.Name = "PrintFuseLabel";
@@ -271,31 +263,6 @@
             this.PrintFuseLabel.UseVisualStyleBackColor = false;
             this.PrintFuseLabel.Click += new System.EventHandler(this.Print_Click);
             // 
-            // RePrintSn
-            // 
-            this.RePrintSn.AllPower = null;
-            this.RePrintSn.BackColor = System.Drawing.Color.White;
-            this.RePrintSn.ID = null;
-            this.RePrintSn.Location = new System.Drawing.Point(264, 611);
-            this.RePrintSn.Name = "RePrintSn";
-            this.RePrintSn.Power = null;
-            this.RePrintSn.Size = new System.Drawing.Size(388, 35);
-            this.RePrintSn.Str = null;
-            this.RePrintSn.Str1 = null;
-            this.RePrintSn.Str2 = null;
-            this.RePrintSn.TabIndex = 233;
-            // 
-            // label8
-            // 
-            this.label8.AutoSize = true;
-            this.label8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label8.Location = new System.Drawing.Point(35, 605);
-            this.label8.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label8.Name = "label8";
-            this.label8.Size = new System.Drawing.Size(190, 41);
-            this.label8.TabIndex = 232;
-            this.label8.Text = "补打SN号码";
-            // 
             // PrintByBatch
             // 
             this.PrintByBatch.AccessibleRole = System.Windows.Forms.AccessibleRole.PageTabList;
@@ -304,7 +271,7 @@
             this.PrintByBatch.DownImage = ((System.Drawing.Image)(resources.GetObject("PrintByBatch.DownImage")));
             this.PrintByBatch.Image = null;
             this.PrintByBatch.IsShowBorder = true;
-            this.PrintByBatch.Location = new System.Drawing.Point(264, 784);
+            this.PrintByBatch.Location = new System.Drawing.Point(264, 544);
             this.PrintByBatch.Margin = new System.Windows.Forms.Padding(6);
             this.PrintByBatch.MoveImage = ((System.Drawing.Image)(resources.GetObject("PrintByBatch.MoveImage")));
             this.PrintByBatch.Name = "PrintByBatch";
@@ -316,77 +283,12 @@
             this.PrintByBatch.UseVisualStyleBackColor = false;
             this.PrintByBatch.Click += new System.EventHandler(this.PrintByBatch_Click);
             // 
-            // label10
-            // 
-            this.label10.AutoSize = true;
-            this.label10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(79, 692);
-            this.label10.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label10.Name = "label10";
-            this.label10.Size = new System.Drawing.Size(146, 41);
-            this.label10.TabIndex = 237;
-            this.label10.Text = "补打批号";
-            // 
-            // PrintBatch
-            // 
-            this.PrintBatch.AllPower = null;
-            this.PrintBatch.BackColor = System.Drawing.Color.White;
-            this.PrintBatch.ID = null;
-            this.PrintBatch.Location = new System.Drawing.Point(264, 698);
-            this.PrintBatch.Name = "PrintBatch";
-            this.PrintBatch.Power = null;
-            this.PrintBatch.Size = new System.Drawing.Size(388, 35);
-            this.PrintBatch.Str = null;
-            this.PrintBatch.Str1 = null;
-            this.PrintBatch.Str2 = null;
-            this.PrintBatch.TabIndex = 238;
-            // 
-            // SingleRowCount
-            // 
-            this.SingleRowCount.Location = new System.Drawing.Point(264, 544);
-            this.SingleRowCount.Name = "SingleRowCount";
-            this.SingleRowCount.Size = new System.Drawing.Size(120, 35);
-            this.SingleRowCount.TabIndex = 234;
-            this.SingleRowCount.Value = new decimal(new int[] {
-            1,
-            0,
-            0,
-            0});
-            // 
-            // label9
-            // 
-            this.label9.AutoSize = true;
-            this.label9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label9.Location = new System.Drawing.Point(88, 538);
-            this.label9.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(146, 41);
-            this.label9.TabIndex = 235;
-            this.label9.Text = "单排数量";
-            // 
-            // PrintNums
-            // 
-            this.PrintNums.AutoSize = true;
-            this.PrintNums.Location = new System.Drawing.Point(432, 549);
-            this.PrintNums.Name = "PrintNums";
-            this.PrintNums.Size = new System.Drawing.Size(186, 28);
-            this.PrintNums.TabIndex = 236;
-            this.PrintNums.Text = "打印多联标签";
-            this.PrintNums.UseVisualStyleBackColor = true;
-            // 
             // Query_SN
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1494, 1075);
             this.Controls.Add(this.PrintByBatch);
-            this.Controls.Add(this.PrintBatch);
-            this.Controls.Add(this.label10);
-            this.Controls.Add(this.PrintNums);
-            this.Controls.Add(this.label9);
-            this.Controls.Add(this.SingleRowCount);
-            this.Controls.Add(this.RePrintSn);
-            this.Controls.Add(this.label8);
             this.Controls.Add(this.ma_printcount);
             this.Controls.Add(this.ma_qty);
             this.Controls.Add(this.lade);
@@ -412,7 +314,6 @@
             this.Text = "Query_SpecialReport";
             this.Load += new System.EventHandler(this.Query_SpecialReport_Load);
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.SingleRowCount)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -438,13 +339,6 @@
         private System.Windows.Forms.Label lade;
         private System.Windows.Forms.Label ma_qty;
         private System.Windows.Forms.Label ma_printcount;
-        private CustomControl.TextBoxWithIcon.EnterTextBox RePrintSn;
-        private System.Windows.Forms.Label label8;
         private CustomControl.ButtonUtil.NormalButton PrintByBatch;
-        private System.Windows.Forms.Label label10;
-        private CustomControl.TextBoxWithIcon.EnterTextBox PrintBatch;
-        private System.Windows.Forms.NumericUpDown SingleRowCount;
-        private System.Windows.Forms.Label label9;
-        private System.Windows.Forms.CheckBox PrintNums;
     }
 }

+ 36 - 100
UAS_MES_JC/FunctionCode/Query/Query_SN.cs

@@ -56,7 +56,7 @@ namespace UAS_MES_NEW.Query
         {
             Dbfind = ma_code.ReturnData;
             BaseUtil.SetFormValue(this.Controls, Dbfind);
-            DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,mil_makecode from makeimeilist where mil_printstatus=-1 group by mil_makecode) on mil_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
             if (dt.Rows.Count > 0)
             {
                 pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
@@ -82,127 +82,63 @@ namespace UAS_MES_NEW.Query
         {
             DataTable dt = new DataTable();
             string ErrorMessage = "";
-            if (!PrintNums.Checked)
+
+            dt = (DataTable)dh.ExecuteSql("select msl_sncode from makesnlist where msl_makecode='" + ma_code.Text + "' and nvl(msl_printstatus,0)=0   order by msl_sncode", "select");
+            if (dt.Rows.Count < PrintNum.Value)
+            {
+                OperateResult.AppendText("未打印数量不足,剩余" + dt.Rows.Count + "未打印\n");
+                return;
+            }
+            for (int i = 0; i < PrintNum.Value; i++)
             {
-                string batch = System.DateTime.Now.ToString("yyyyMMddhhmiss");
-                if (RePrintSn.Text == "")
+                string mil_sncode = dt.Rows[i]["msl_sncode"].ToString();
+                string oMakecode = "";
+                string oErrMessage = "";
+                string oMsid = "";
+                if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, mil_sncode, User.UserCode, out oMakecode, out oMsid, out oErrMessage))
                 {
-                    dt = (DataTable)dh.ExecuteSql("select msl_sncode from makesnlist where msl_makecode='" + ma_code.Text + "' and nvl(msl_printstatus,0)=0   order by msl_sncode", "select");
-                    if (dt.Rows.Count < PrintNum.Value)
+                    if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, mil_sncode, int.Parse("1"), ma_code.Text, pr_code.Text, "机身标", "0", out ErrorMessage))
                     {
-                        OperateResult.AppendText("未打印数量不足,剩余" + dt.Rows.Count + "未打印\n");
-                        return;
+                        //提示用户打印成功
+                        dh.ExecuteSql("update makesnlist set msl_printstatus=-1 where msl_sncode='" + mil_sncode + "'", "update");
+                        OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
                     }
-                    for (int i = 0; i < PrintNum.Value; i++)
+                    else
                     {
-                        string mil_sncode = dt.Rows[i]["msl_sncode"].ToString();
-                        if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, mil_sncode, int.Parse("1"), ma_code.Text, pr_code.Text, "机身标", "0", out ErrorMessage))
-                        {
-                            //提示用户打印成功
-                            dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
-                            dh.ExecuteSql("update makesnlist set msl_printstatus=-1,msl_printbatch='" + batch + "' where msl_sncode='" + mil_sncode + "'", "update");
-                            OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
-                        }
-                        else
-                        {
-                            dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
-                            dh.ExecuteSql("update makesnlist set msl_printstatus=-1,msl_printbatch='" + batch + "' where msl_sncode='" + mil_sncode + "'", "update");
-                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                        }
+                        dh.ExecuteSql("update makesnlist set msl_printstatus=-1where msl_sncode='" + mil_sncode + "'", "update");
+                        OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                     }
-                    dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
-                    if (dt.Rows.Count > 0)
+
+                    if (!LogicHandler.SetTestResult(ma_code.Text, User.UserSourceCode, mil_sncode, "", "OK", User.UserCode, out ErrorMessage))
                     {
-                        pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
-                        ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
-                        ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
-                        pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
+                        OperateResult.AppendText(">>ErrorMessage\n", Color.Red);
                     }
                 }
                 else
                 {
-                    dt = (DataTable)dh.ExecuteSql("select msl_sncode from makesnlist left join makeimeilist on mil_sncode=msl_sncode and mil_makecode=msl_makecode where msl_makecode='" + ma_code.Text + "' and (msl_sncode='" + RePrintSn.Text + "' or mil_imei1='"+RePrintSn.Text+"' or mil_imei2='"+RePrintSn.Text + "')order by msl_sncode", "select");
-                    if (dt.Rows.Count > 0)
-                    {
-                        string mil_sncode = dt.Rows[0]["msl_sncode"].ToString();
-                        if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, mil_sncode, int.Parse("1"), ma_code.Text, pr_code.Text, "机身标", "0", out ErrorMessage))
-                        {
-                            //提示用户打印成功
-                            dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
-                            dh.ExecuteSql("update makesnlist set msl_printstatus=-1,msl_printbatch='" + batch + "' where msl_sncode='" + mil_sncode + "'", "update");
-                            OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
-                        }
-                        else
-                        {
-                            dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
-                            dh.ExecuteSql("update makesnlist set msl_printstatus=-1,msl_printbatch='" + batch + "' where msl_sncode='" + mil_sncode + "'", "update");
-                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                        }
-                    }
-                    else
-                    {
-                        OperateResult.AppendText("序列号:" + RePrintSn.Text + "不在工单" + ma_code.Text + "\n", Color.Red, RePrintSn);
-                    }
+                    OperateResult.AppendText(">>ErrorMessage\n", Color.Red);
                 }
             }
-            else
+            dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
+            if (dt.Rows.Count > 0)
             {
-                dh.ExecuteSql("update make set ma_printqty='" + SingleRowCount.Value + "' where ma_code='" + ma_code.Text + "'", "update");
-                dt = (DataTable)dh.ExecuteSql("select msl_sncode from (select msl_sncode from makesnlist where msl_makecode='" + ma_code.Text + "' and nvl(msl_printstatus,0)=0   order by msl_sncode) where   rownum<='" + PrintNum.Value * SingleRowCount.Value + "'", "select");
-                decimal rowcount = 0;
-                for (int i = 0; i < dt.Rows.Count; i = i + 1)
-                {
-                    string mil_sncode = dt.Rows[i]["msl_sncode"].ToString();
-                    if (rowcount % SingleRowCount.Value == 0)
-                    {
-                        if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, mil_sncode, int.Parse("1"), ma_code.Text, pr_code.Text, "机身标", "0", out ErrorMessage))
-                        {
-                            //提示用户打印成功
-                            dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
-                            dh.ExecuteSql("update makesnlist set msl_printstatus=-1 where msl_sncode='" + mil_sncode + "'", "update");
-                            OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
-                        }
-                        else
-                        {
-                            dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
-                            dh.ExecuteSql("update makesnlist set msl_printstatus=-1 where msl_sncode='" + mil_sncode + "'", "update");
-                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                        }
-                    }
-                    else
-                    {
-                        dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
-                        dh.ExecuteSql("update makesnlist set msl_printstatus=-1 where msl_sncode='" + mil_sncode + "'", "update");
-                        OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
-                    }
-                    rowcount = rowcount + 1;
-                }
-                dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
-                if (dt.Rows.Count > 0)
-                {
-                    pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
-                    ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
-                    ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
-                    pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
-                }
+                pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
+                ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
+                ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
+                pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
             }
         }
 
         private void pr_code_TextChanged(object sender, EventArgs e)
         {
-            _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault,replace(LA_SOFTTYPE,';',',')LA_SOFTTYPE from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='机身标' and la_statuscode='AUDITED' order by la_isdefault", "select");
+            _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='机身标' and la_statuscode='AUDITED' order by la_isdefault", "select");
             if (_dt.Rows.Count == 0)
             {
-                _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault,replace(LA_SOFTTYPE,';',',')LA_SOFTTYPE from label where la_prodcode is null and la_templatetype='机身标' and la_statuscode='AUDITED' order by la_isdefault", "select");
-            }
-            if (_dt.Rows.Count > 0)
-            {
-                string la_id = _dt.Rows[0]["la_id"].ToString();
-                _dt = (DataTable)dh.ExecuteSql("select fp_name la_url,'" + la_id + "' la_id from FILEPATH where fp_id in (select *  from table(select parsestring(LA_SOFTTYPE,';') from label where la_templatetype='机身标' and la_id='" + la_id + "') where COLUMN_VALUE is not null)", "select");
-                PrintLabel.DataSource = _dt;
-                PrintLabel.DisplayMember = "la_url";
-                PrintLabel.ValueMember = "la_id";
+                _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode is null and la_templatetype='机身标' and la_statuscode='AUDITED' order by la_isdefault", "select");
             }
+            PrintLabel.DataSource = _dt;
+            PrintLabel.DisplayMember = "la_url";
+            PrintLabel.ValueMember = "la_id";
         }
 
         private void PrintByBatch_Click(object sender, EventArgs e)