Browse Source

修改卡通箱称量功能

章政 8 years ago
parent
commit
aa6485feec

+ 108 - 14
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.Designer.cs

@@ -31,6 +31,11 @@
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Make_CartonBoxWeigh));
             this.ma_code_label = new System.Windows.Forms.Label();
             this.panel6 = new System.Windows.Forms.Panel();
+            this.SendCheck = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.ob_nowcheckqty = new System.Windows.Forms.Label();
+            this.ob_batchqty = new System.Windows.Forms.Label();
+            this.ob_nowcheckqty_label = new System.Windows.Forms.Label();
+            this.ob_batchqty_label = new System.Windows.Forms.Label();
             this.pr_cartongw = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pr_code = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pr_cartongw_label = new System.Windows.Forms.Label();
@@ -68,6 +73,7 @@
             this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.AutoPrint = new UAS_MES.CustomControl.CustomCheckBox.AutoPrintCheckBox();
+            this.ob_checkno = new System.Windows.Forms.Label();
             this.panel6.SuspendLayout();
             this.panel4.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
@@ -77,7 +83,7 @@
             // 
             this.ma_code_label.AutoSize = true;
             this.ma_code_label.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_code_label.Location = new System.Drawing.Point(41, 302);
+            this.ma_code_label.Location = new System.Drawing.Point(41, 416);
             this.ma_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ma_code_label.Name = "ma_code_label";
             this.ma_code_label.Size = new System.Drawing.Size(115, 32);
@@ -87,22 +93,87 @@
             // panel6
             // 
             this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.panel6.Controls.Add(this.pr_cartongw);
-            this.panel6.Controls.Add(this.pr_code);
-            this.panel6.Controls.Add(this.pr_cartongw_label);
-            this.panel6.Controls.Add(this.pr_code_label);
+            this.panel6.Controls.Add(this.SendCheck);
+            this.panel6.Controls.Add(this.ob_nowcheckqty);
+            this.panel6.Controls.Add(this.ob_batchqty);
+            this.panel6.Controls.Add(this.ob_nowcheckqty_label);
+            this.panel6.Controls.Add(this.ob_batchqty_label);
             this.panel6.Location = new System.Drawing.Point(563, 95);
             this.panel6.Margin = new System.Windows.Forms.Padding(4);
             this.panel6.Name = "panel6";
             this.panel6.Size = new System.Drawing.Size(537, 156);
             this.panel6.TabIndex = 90;
             // 
+            // SendCheck
+            // 
+            this.SendCheck.AllPower = "ifall";
+            this.SendCheck.BackColor = System.Drawing.Color.Transparent;
+            this.SendCheck.DownImage = ((System.Drawing.Image)(resources.GetObject("SendCheck.DownImage")));
+            this.SendCheck.Enabled = false;
+            this.SendCheck.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.SendCheck.Image = null;
+            this.SendCheck.IsShowBorder = true;
+            this.SendCheck.Location = new System.Drawing.Point(431, 110);
+            this.SendCheck.Margin = new System.Windows.Forms.Padding(4);
+            this.SendCheck.MoveImage = ((System.Drawing.Image)(resources.GetObject("SendCheck.MoveImage")));
+            this.SendCheck.Name = "SendCheck";
+            this.SendCheck.NormalImage = ((System.Drawing.Image)(resources.GetObject("SendCheck.NormalImage")));
+            this.SendCheck.Power = null;
+            this.SendCheck.Size = new System.Drawing.Size(75, 30);
+            this.SendCheck.TabIndex = 183;
+            this.SendCheck.Tag = "ifread";
+            this.SendCheck.Text = "送检";
+            this.SendCheck.UseVisualStyleBackColor = true;
+            this.SendCheck.Click += new System.EventHandler(this.SendCheck_Click);
+            // 
+            // ob_nowcheckqty
+            // 
+            this.ob_nowcheckqty.AutoSize = true;
+            this.ob_nowcheckqty.Font = new System.Drawing.Font("微软雅黑", 15F);
+            this.ob_nowcheckqty.Location = new System.Drawing.Point(178, 77);
+            this.ob_nowcheckqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ob_nowcheckqty.Name = "ob_nowcheckqty";
+            this.ob_nowcheckqty.Size = new System.Drawing.Size(0, 32);
+            this.ob_nowcheckqty.TabIndex = 182;
+            // 
+            // ob_batchqty
+            // 
+            this.ob_batchqty.AutoSize = true;
+            this.ob_batchqty.Font = new System.Drawing.Font("微软雅黑", 15F);
+            this.ob_batchqty.Location = new System.Drawing.Point(178, 28);
+            this.ob_batchqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ob_batchqty.Name = "ob_batchqty";
+            this.ob_batchqty.Size = new System.Drawing.Size(0, 32);
+            this.ob_batchqty.TabIndex = 181;
+            // 
+            // ob_nowcheckqty_label
+            // 
+            this.ob_nowcheckqty_label.AutoSize = true;
+            this.ob_nowcheckqty_label.Font = new System.Drawing.Font("微软雅黑", 15F);
+            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(46, 77);
+            this.ob_nowcheckqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ob_nowcheckqty_label.Name = "ob_nowcheckqty_label";
+            this.ob_nowcheckqty_label.Size = new System.Drawing.Size(115, 32);
+            this.ob_nowcheckqty_label.TabIndex = 180;
+            this.ob_nowcheckqty_label.Text = "当前批数";
+            // 
+            // ob_batchqty_label
+            // 
+            this.ob_batchqty_label.AutoSize = true;
+            this.ob_batchqty_label.Font = new System.Drawing.Font("微软雅黑", 15F);
+            this.ob_batchqty_label.Location = new System.Drawing.Point(46, 28);
+            this.ob_batchqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ob_batchqty_label.Name = "ob_batchqty_label";
+            this.ob_batchqty_label.Size = new System.Drawing.Size(115, 32);
+            this.ob_batchqty_label.TabIndex = 179;
+            this.ob_batchqty_label.Text = "标准批数";
+            // 
             // pr_cartongw
             // 
             this.pr_cartongw.AutoSize = true;
             this.pr_cartongw.CutLength = null;
             this.pr_cartongw.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartongw.Location = new System.Drawing.Point(205, 91);
+            this.pr_cartongw.Location = new System.Drawing.Point(188, 281);
             this.pr_cartongw.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartongw.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_cartongw.Name = "pr_cartongw";
@@ -115,7 +186,7 @@
             this.pr_code.AutoSize = true;
             this.pr_code.CutLength = null;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code.Location = new System.Drawing.Point(205, 28);
+            this.pr_code.Location = new System.Drawing.Point(188, 348);
             this.pr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_code.Name = "pr_code";
@@ -128,7 +199,7 @@
             // 
             this.pr_cartongw_label.AutoSize = true;
             this.pr_cartongw_label.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartongw_label.Location = new System.Drawing.Point(37, 91);
+            this.pr_cartongw_label.Location = new System.Drawing.Point(41, 281);
             this.pr_cartongw_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartongw_label.Name = "pr_cartongw_label";
             this.pr_cartongw_label.Size = new System.Drawing.Size(115, 32);
@@ -139,7 +210,7 @@
             // 
             this.pr_code_label.AutoSize = true;
             this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code_label.Location = new System.Drawing.Point(36, 28);
+            this.pr_code_label.Location = new System.Drawing.Point(41, 348);
             this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code_label.Name = "pr_code_label";
             this.pr_code_label.Size = new System.Drawing.Size(115, 32);
@@ -214,7 +285,7 @@
             // 
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(41, 502);
+            this.pr_detail_label.Location = new System.Drawing.Point(41, 480);
             this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(115, 32);
@@ -236,7 +307,7 @@
             // 
             this.ma_salecode_label.AutoSize = true;
             this.ma_salecode_label.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_salecode_label.Location = new System.Drawing.Point(41, 401);
+            this.ma_salecode_label.Location = new System.Drawing.Point(41, 546);
             this.ma_salecode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ma_salecode_label.Name = "ma_salecode_label";
             this.ma_salecode_label.Size = new System.Drawing.Size(115, 32);
@@ -397,7 +468,7 @@
             this.ma_code.AutoSize = true;
             this.ma_code.CutLength = null;
             this.ma_code.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_code.Location = new System.Drawing.Point(188, 302);
+            this.ma_code.Location = new System.Drawing.Point(188, 416);
             this.ma_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ma_code.MaximumSize = new System.Drawing.Size(200, 0);
             this.ma_code.Name = "ma_code";
@@ -422,7 +493,7 @@
             this.pr_detail.AutoSize = true;
             this.pr_detail.CutLength = null;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(188, 502);
+            this.pr_detail.Location = new System.Drawing.Point(188, 480);
             this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_detail.Name = "pr_detail";
@@ -434,7 +505,7 @@
             this.ma_salecode.AutoSize = true;
             this.ma_salecode.CutLength = null;
             this.ma_salecode.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_salecode.Location = new System.Drawing.Point(188, 401);
+            this.ma_salecode.Location = new System.Drawing.Point(188, 546);
             this.ma_salecode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ma_salecode.MaximumSize = new System.Drawing.Size(200, 0);
             this.ma_salecode.Name = "ma_salecode";
@@ -549,18 +620,35 @@
             this.AutoPrint.Size = new System.Drawing.Size(117, 35);
             this.AutoPrint.TabIndex = 175;
             // 
+            // ob_checkno
+            // 
+            this.ob_checkno.AutoSize = true;
+            this.ob_checkno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ob_checkno.Location = new System.Drawing.Point(1228, 9);
+            this.ob_checkno.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ob_checkno.Name = "ob_checkno";
+            this.ob_checkno.Size = new System.Drawing.Size(0, 27);
+            this.ob_checkno.TabIndex = 184;
+            this.ob_checkno.Visible = false;
+            this.ob_checkno.TextChanged += new System.EventHandler(this.ob_checkno_TextChanged);
+            // 
             // Make_CartonBoxWeigh
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1429, 700);
+            this.Controls.Add(this.ob_checkno);
             this.Controls.Add(this.AutoPrint);
             this.Controls.Add(this.WeighRecord);
             this.Controls.Add(this.ComList);
             this.Controls.Add(this.BaudRate);
+            this.Controls.Add(this.pr_cartongw);
             this.Controls.Add(this.label2);
+            this.Controls.Add(this.pr_cartongw_label);
+            this.Controls.Add(this.pr_code);
             this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.label1);
+            this.Controls.Add(this.pr_code_label);
             this.Controls.Add(this.Printer_label);
             this.Controls.Add(this.PrinterList);
             this.Controls.Add(this.PrintLabel);
@@ -641,5 +729,11 @@
         private System.Windows.Forms.ColumnHeader columnHeader3;
         private System.Windows.Forms.ColumnHeader columnHeader4;
         private CustomControl.CustomCheckBox.AutoPrintCheckBox AutoPrint;
+        private System.Windows.Forms.Label ob_nowcheckqty;
+        private System.Windows.Forms.Label ob_batchqty;
+        private System.Windows.Forms.Label ob_nowcheckqty_label;
+        private System.Windows.Forms.Label ob_batchqty_label;
+        private CustomControl.ButtonUtil.NormalButton SendCheck;
+        private System.Windows.Forms.Label ob_checkno;
     }
 }

+ 102 - 23
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -31,6 +31,8 @@ namespace UAS_MES.Make
         Document doc;
 
         Thread thread;
+
+        string PR_CHECKCARTONW = "0";
         //创建串口实例
         SerialPort serialPort1 = new SerialPort();
 
@@ -98,26 +100,20 @@ 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;
-                }
                 //根据箱号查询表单数据
                 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,nvl(PR_CHECKCARTONW,'0') PR_CHECKCARTONW 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 + "'");
+                sql.Append("select pa_totalqty,ma_code,ma_qty,ma_salecode,pr_detail,pr_cartonunit,pr_code,pr_cartongw,");
+                sql.Append("pr_cartonmaxw,pr_cartonminw,nvl(PR_CHECKCARTONW,'0') PR_CHECKCARTONW from package left join packagedetail ");
+                sql.Append("on pa_id=pd_paid left join makeserial on ms_sncode=pd_barcode and ms_makecode=pa_makecode left join product on pr_code=pd_prodcode left join make on ma_code=pd_makecode ");
+                sql.Append(" where pa_outboxcode='" + outboxcode.Text + "' and pa_nextstep='" + User.CurrentStepCode + "'");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                //填充Form的值
-                BaseUtil.SetFormValue(this.Controls, dt);
                 //填充打印文件选项的DataGridView
                 if (dt.Rows.Count > 0)
                 {
+                    BaseUtil.SetFormValue(this.Controls, dt);
                     string ErrorMessage;
                     //重量的临时变量
-                    string PR_CHECKCARTONW = dt.Rows[0]["PR_CHECKCARTONW"].ToString();
+                    PR_CHECKCARTONW = dt.Rows[0]["PR_CHECKCARTONW"].ToString();
                     string _weight = dt.Rows[0]["pr_cartongw"].ToString();
                     string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
                     string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
@@ -130,10 +126,6 @@ namespace UAS_MES.Make
                         pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight) + dt.Rows[0]["pr_cartonunit"].ToString();
                     else
                         pr_cartongw.Text = MinWeight + "-" + MaxWeight + dt.Rows[0]["pr_cartonunit"].ToString();
-                    //if (pr_cartonunit.Text == "kg")
-                    //{
-                    //    weight.Text = (float.Parse(weight.Text) / 1000).ToString();
-                    //}
                     double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Trim());
                     //需要检查称重重量
                     if (PR_CHECKCARTONW != "0")
@@ -141,18 +133,18 @@ namespace UAS_MES.Make
                         //称量合格或不合格都记录重量
                         if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
                         {
-
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量合格:" + weight.Text, outboxcode.Text, "");
                             OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green);
                         }
                         else
                         {
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不合格:" + weight.Text, outboxcode.Text, "");
-                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测未通过\n", Color.Red);
+                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测未通过\n", Color.Red, outboxcode);
                             return;
                         }
                     }
-                    else {
+                    else
+                    {
                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text, outboxcode.Text, "");
                     }
                     if (AutoPrint.Checked)
@@ -173,17 +165,16 @@ namespace UAS_MES.Make
                     lsi.SubItems.Add(System.DateTime.Now.ToString());
                     WeighRecord.Items.Add(lsi);
                     OperateResult.AppendText(">>箱号" + outboxcode.Text + "称重完成\n", Color.Green);
-                    dh.ExecuteSql("update package set pa_weight='" + ActualWeight + "', pa_printcount= nvl(pa_printcount,0)+1 where pa_outboxcode='" + outboxcode.Text + "'", "update");
-                    dh.UpdateByCondition("package", "pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode.Text + "'");
                     LogicHandler.CartonBoxStepPass(ma_code.Text, User.UserSourceCode, outboxcode.Text, User.UserCode, "卡通箱:" + outboxcode.Text + "整箱过站", out ErrorMessage);
+                    dh.UpdateByCondition("package", "pa_printcount= nvl(pa_printcount,0)+1,pa_weight='" + ActualWeight + "',pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode.Text + "'");
                     dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + outboxcode.Text + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + outboxcode.Text + "'");
+                    LoadCheckQTY();
                     outboxcode.Clear();
                 }
-                else OperateResult.AppendText(">>箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
+                else OperateResult.AppendText(">>箱号" + outboxcode.Text + "当前执行工序不是" + User.CurrentStepCode + "\n", Color.Red, outboxcode);
             }
         }
 
-
         private void getSerialData()
         {
             if (serialPort1.IsOpen)
@@ -283,5 +274,93 @@ namespace UAS_MES.Make
                 PrintNum.Text = (PrintNums == "" ? "1" : PrintNums);
             }
         }
+
+        private void SendCheck_Click(object sender, EventArgs e)
+        {
+            DataTable dt = (DataTable)dh.ExecuteSql("select wm_concat(pa_outboxcode) pa_outboxcode from package where pa_checkno='" + ob_checkno.Text + "' and pa_status=0 ", "select");
+            if (dt.Rows[0][0].ToString() != "")
+            {
+                OperateResult.AppendText(">>批次" + ob_checkno.Text + "存在箱号" + dt.Rows[0][0].ToString() + "未封箱,请先进行封箱\n", Color.Red);
+                return;
+            }
+            sql.Clear();
+            sql.Append("update oqcbatch set ob_status='UNCHECK' where ob_checkno ='" + ob_checkno.Text + "'");
+            dh.ExecuteSql(sql.GetString(), "select");
+            ob_nowcheckqty.Text = "";
+            ob_batchqty.Text = "";
+            ob_nowcheckqty.ForeColor = Color.Black;
+            SendCheck.Enabled = false;
+            OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Green);
+            LogicHandler.InsertMakeProcess("", ma_code.Text, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
+            //记录操作日志
+            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
+            ob_checkno.Text = "";
+        }
+        bool AutoCut;
+
+        private void LoadCheckQTY()
+        {
+            sql.Clear();
+            string condition = "";
+            int nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
+            int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
+            if (nowcheckqty + 1 == batchqty && AutoCut)
+            {
+                condition = "and ob_status='UNCHECK' and ob_checkno='" + ob_checkno.Text + "'";
+            }
+            else
+            {
+                condition = "and ob_status='ENTERING' ";
+            }
+            sql.Append("select ob_batchqty,ob_nowcheckqty,ob_checkno from oqcbatch where ");
+            sql.Append("ob_linecode='" + User.UserLineCode + "' and ob_prodcode='" + pr_code.Text + "' and ");
+            sql.Append("ob_stepcode='" + User.CurrentStepCode + "' " + condition);
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            if (dt.Rows.Count > 0)
+            {
+                ob_batchqty.Text = dt.Rows[0]["ob_batchqty"].ToString();
+                ob_nowcheckqty.Text = dt.Rows[0]["ob_nowcheckqty"].ToString();
+                ob_checkno.Text = dt.Rows[0]["ob_checkno"].ToString();
+                nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
+                batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
+                if (nowcheckqty == batchqty)
+                {
+                    ob_nowcheckqty.ForeColor = Color.Red;
+                    OperateResult.AppendText(">>当前采集数量已达到送检数量\n", Color.Red);
+                    if (AutoCut)
+                    {
+                        OperateResult.AppendText(">>批次" + ob_checkno.Text + "自动断批\n", Color.Green);
+                    }
+                }
+            }
+            else
+            {
+                ob_batchqty.Text = "";
+                ob_nowcheckqty.Text = "";
+                ob_checkno.Text = "";
+                SendCheck.Enabled = false;
+            }
+            if (ob_batchqty.Text != "")
+            {
+                SendCheck.Enabled = true;
+            }
+            else
+            {
+                SendCheck.Enabled = false;
+            }
+        }
+
+        private void ob_checkno_TextChanged(object sender, EventArgs e)
+        {
+            if (ob_checkno.Text != "")
+            {
+                string Cut = dh.getFieldDataByCondition("product left join oqcbatch on ob_prodcode=pr_code", "pr_ifautocutcheckno", "ob_checkno='" + ob_checkno.Text + "'").ToString();
+                if (Cut == "" || Cut == "0")
+                    AutoCut = false;
+                else
+                    AutoCut = true;
+                SendCheck.Enabled = true;
+            }
+        }
     }
 }

+ 38 - 0
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.resx

@@ -118,6 +118,44 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="SendCheck.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="SendCheck.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="SendCheck.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
   <data name="StartWeight.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m

+ 7 - 12
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -130,6 +130,7 @@ namespace UAS_MES.Make
             {
                 LoadData();
                 LoadGridData();
+                sn_code.Focus();
             }
         }
 
@@ -148,7 +149,7 @@ namespace UAS_MES.Make
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
                         }
-                        PR_CHECKCARTONW =  dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
+                        PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
                         //获取序列号信息
                         sql.Clear();
                         sql.Append("select pr_code,ms_makecode,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,pr_code,pr_detail,");
@@ -254,8 +255,6 @@ namespace UAS_MES.Make
                                 ////箱号不存在的情况
                                 if (LogicHandler.Packing(sn_code.Text, pa_outboxcode.Text, AutoGenBoxCode.Checked, "标准", User.UserSourceCode, User.UserCode, pr_outboxinnerqty.Text, Cancel.Checked, out oOutBoxCode, out ErrorMessage))
                                 {
-                                    //if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
-                                    //{
                                     //提示正确返回时传递的信息
                                     if (ErrorMessage.Contains("AFTERSUCCESS"))
                                         OperateResult.AppendText(">>" + ErrorMessage + "\n");
@@ -278,22 +277,18 @@ namespace UAS_MES.Make
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "满箱采集完成,封箱成功\n", Color.Green);
                                         pa_status.Text = "1";
                                         pa_standardqty.Text = "";
+                                        if (AutoPrint.Checked)
+                                            Print_Click(new object(), new EventArgs());
                                         if (PR_CHECKCARTONW != "0")
                                         {
-                                            OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "满箱处于称重工序,请在卡通箱称重界面进行称重打印\n", Color.Black,sn_code);
+                                            OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "满箱处于称重工序,请在卡通箱称重界面进行称重打印\n", Color.Black, sn_code);
                                             return;
                                         }
                                         LogicHandler.CartonBoxStepPass(oMakeCode, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
                                         dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                         LoadCheckQTY();
-                                        if (AutoPrint.Checked)
-                                            Print_Click(new object(), new EventArgs());
                                     }
                                     sn_code.Clear();
-                                  
-
-                                    //}
-                                    //else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                 }
                                 else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                             }
@@ -356,11 +351,11 @@ namespace UAS_MES.Make
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "封箱成功", pa_outboxcode.Text, "");
                     if (PR_CHECKCARTONW != "0")
                     {
-                        OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "处于称重工序,请在卡通箱称重界面进行操作\n", Color.Black,sn_code);
+                        OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "处于称重工序,请在卡通箱称重界面进行操作\n", Color.Black, sn_code);
                         return;
                     }
                     LogicHandler.CartonBoxStepPass(oMakeCode, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
-                    dh.UpdateByCondition("package", "pa_nextstep='" +dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='"+pa_outboxcode.Text+"'").ToString()+ "' PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                    dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString() + "' PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                     LoadCheckQTY();
                 }
             }

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

@@ -215,6 +215,7 @@ namespace UAS_MES.Make
             {
                 LoadData();
                 LoadGridData();
+                sn_code.Focus();
             }
         }
 
@@ -233,7 +234,7 @@ namespace UAS_MES.Make
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
                         }
-                       // PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
+                        // PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
                         sql.Clear();
                         sql.Append("select ms_makecode,pr_code,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,pr_code,pr_detail,");
                         sql.Append("nvl(pr_outboxinnerqty,0)pr_outboxinnerqty from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
@@ -356,7 +357,7 @@ namespace UAS_MES.Make
                                     if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == int.Parse(pr_outboxinnerqty.Text))
                                     {
                                         float weigh = float.Parse(weight.Text.Replace("kg", "").Trim());
-                                        dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty,pa_weight=" + weight + "", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                        dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty,pa_weight=" + weigh + "", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                         pa_standardqty.Text = "";
                                         pa_status.Text = "1";
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "满箱封箱成功\n", Color.Green);
@@ -369,7 +370,7 @@ namespace UAS_MES.Make
                                             }
                                         }
                                         LogicHandler.CartonBoxStepPass(oMakeCode, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
-                                        dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString() + "' PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                        dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                         LoadCheckQTY();
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量完成\n", Color.Green);
                                         if (AutoPrint.Checked)
@@ -685,8 +686,6 @@ namespace UAS_MES.Make
                 }
                 else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在\n", Color.Red);
             }
-
         }
-
     }
 }