Browse Source

卡通箱代码调整,

章政 8 years ago
parent
commit
c02564a42f

+ 0 - 16
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.Designer.cs

@@ -53,7 +53,6 @@
             this.PrinterList = new UAS_MES.CustomControl.ComBoxWithFocus.PrinterCombox();
             this.StartWeight = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Confirm = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.pd_barcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.StopWeight = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.ma_code = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.ma_qty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
@@ -373,19 +372,6 @@
             this.Confirm.UseVisualStyleBackColor = true;
             this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
             // 
-            // pd_barcode
-            // 
-            this.pd_barcode.AutoSize = true;
-            this.pd_barcode.CutLength = null;
-            this.pd_barcode.Location = new System.Drawing.Point(1249, 26);
-            this.pd_barcode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.pd_barcode.MaximumSize = new System.Drawing.Size(200, 0);
-            this.pd_barcode.Name = "pd_barcode";
-            this.pd_barcode.Size = new System.Drawing.Size(87, 15);
-            this.pd_barcode.TabIndex = 107;
-            this.pd_barcode.Text = "pd_barcode";
-            this.pd_barcode.Visible = false;
-            // 
             // StopWeight
             // 
             this.StopWeight.AllPower = null;
@@ -579,7 +565,6 @@
             this.Controls.Add(this.PrintLabel);
             this.Controls.Add(this.StartWeight);
             this.Controls.Add(this.Confirm);
-            this.Controls.Add(this.pd_barcode);
             this.Controls.Add(this.StopWeight);
             this.Controls.Add(this.ma_code);
             this.Controls.Add(this.ma_qty);
@@ -639,7 +624,6 @@
         private System.Windows.Forms.Label ma_qty_label;
         private System.Windows.Forms.Label ma_salecode_label;
         private CustomControl.RichText.RichTextAutoBottom OperateResult;
-        private CustomControl.ValueLabel.ValueLabel pd_barcode;
         private CustomControl.ButtonUtil.NormalButton Confirm;
         private CustomControl.ButtonUtil.NormalButton StartWeight;
         private System.Windows.Forms.ComboBox PrintLabel;

+ 24 - 10
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -98,13 +98,18 @@ namespace UAS_MES.Make
         {
             if (e.KeyCode == Keys.Enter)
             {
+                //获取序列号的箱号
+                string ms_outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_sncode='" + outboxcode.Text + "' order by ms_id desc").ToString();
+                if (ms_outboxcode != "")
+                {
+                    outboxcode.Text = ms_outboxcode;
+                }
                 //根据箱号查询表单数据
-                pd_barcode.Text = dh.getFieldDataByCondition("makeserial left join package on ms_prodcode=pa_prodcode", "ms_sncode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
                 sql.Clear();
                 sql.Append("select pa_totalqty,ma_code,mcd_inqty,ma_qty,ma_qty-mcd_inqty as mcd_waitqty,ma_salecode,pr_detail,pr_cartonunit,pr_code,pr_cartongw,");
-                sql.Append("pr_cartonmaxw,pr_cartonminw from package left join product on pr_code=pa_prodcode left join make on ma_prodcode=pr_code and ma_code=pa_makecode  ");
+                sql.Append("pr_cartonmaxw,pr_cartonminw from package left join product on pr_code=pa_prodcode left join make on ma_prodcode=pr_code ");
                 sql.Append("left join makecraftdetail on mcd_macode=ma_code where pa_outboxcode='" + outboxcode.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 //填充Form的值
                 BaseUtil.SetFormValue(this.Controls, dt);
                 //填充打印文件选项的DataGridView
@@ -124,14 +129,25 @@ namespace UAS_MES.Make
                         pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight);
                     else
                         pr_cartongw.Text = MinWeight + "-" + MaxWeight;
+                    if (pr_cartonunit.Text == "kg")
+                    {
+                        weight.Text = (float.Parse(weight.Text) / 1000).ToString();
+                    }
                     double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text);
                     //称量合格或不合格都记录重量
                     if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
                     {
                         if (AutoPrint.Checked)
                         {
-                            doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text.Split(':')[1]);
-                            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
+                            if (PrintLabel.Items.Count > 0)
+                            {
+                                doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
+                                Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
+                            }
+                            else
+                            {
+                                OperateResult.AppendText(">>产品" + pr_code.Text + "未维护卡通标签\n", Color.Green);
+                            }
                         }
                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量合格", outboxcode.Text, "");
                         OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green);
@@ -143,7 +159,7 @@ namespace UAS_MES.Make
                     }
                     ListViewItem lsi = new ListViewItem();
                     lsi.SubItems.Add(outboxcode.Text);
-                    lsi.SubItems.Add(ActualWeight.ToString());
+                    lsi.SubItems.Add(ActualWeight.ToString() + pr_cartonunit.Text);
                     lsi.SubItems.Add(System.DateTime.Now.ToString());
                     WeighRecord.Items.Add(lsi);
                     dh.ExecuteSql("update package set pa_weight='" + weight.Text + "', pa_printcount= nvl(pa_printcount,0)+1 where pa_outboxcode='" + outboxcode.Text + "'", "update");
@@ -168,8 +184,6 @@ namespace UAS_MES.Make
                             try
                             {
                                 weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
-                                if (pr_cartonunit.Text == "kg")
-                                    weight.Text = (float.Parse(weight.Text) / 1000).ToString();
                             }
                             catch (Exception)
                             {
@@ -186,8 +200,8 @@ namespace UAS_MES.Make
         //确认打印
         private void Confirm_Click(object sender, EventArgs e)
         {
-            doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text.Split(':')[1]);
-            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
+            doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
+            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
         }
 
         //停止进程,关闭串口

+ 5 - 4
UAS-MES/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -183,7 +183,8 @@ namespace UAS_MES.Make
                                     weight.Text = (float.Parse(weight.Text) / 1000).ToString();
                                     WeightChange = true;
                                 }
-                                else {
+                                else
+                                {
                                     WeightChange = false;
                                 }
                             }
@@ -237,7 +238,7 @@ namespace UAS_MES.Make
         {
             if (PrintLabel.Items.Count != 0)
             {
-                doc = lbl.Documents.Open(ftpOperater.DownLoadTo+ PrintLabel.Text);
+                doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
                 Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text));
             }
             else
@@ -306,7 +307,7 @@ namespace UAS_MES.Make
             OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Green);
             LogicHandler.InsertMakeProcess(LastSncode, ms_makecode.Text, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
             //记录操作日志
-            LogicHandler.DoCommandLog(Tag.ToString(),User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
+            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
             ob_checkno.Text = "";
         }
 
@@ -341,7 +342,7 @@ namespace UAS_MES.Make
                     OperateResult.AppendText(">>当前采集数量已达到送检数量\n", Color.Red);
                     if (AutoCut)
                     {
-                        OperateResult.AppendText(">>批次"+ob_checkno.Text+"自动断批\n", Color.Green);
+                        OperateResult.AppendText(">>批次" + ob_checkno.Text + "自动断批\n", Color.Green);
                     }
                 }
             }