Browse Source

添加取消装箱

章政 8 years ago
parent
commit
cfd1a49a9a

+ 71 - 56
UAS-MES/FunctionCode/Make/Make_BigBoxCollection.Designer.cs

@@ -51,6 +51,11 @@
             this.NewPallet = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.pa_custcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.PackageInf = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
+            this.pd_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_innerqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pa_makecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_standardqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_currentqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
@@ -59,11 +64,7 @@
             this.AutoOutBoxCode = new System.Windows.Forms.CheckBox();
             this.pa_status = new System.Windows.Forms.Label();
             this.PrintNum = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.pd_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_innerqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.Cancel = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.PackageInf)).BeginInit();
             this.SuspendLayout();
             // 
@@ -107,7 +108,7 @@
             this.AutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.AutoPrint.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.AutoPrint.Location = new System.Drawing.Point(1004, 216);
-            this.AutoPrint.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.AutoPrint.Margin = new System.Windows.Forms.Padding(4);
             this.AutoPrint.Name = "AutoPrint";
             this.AutoPrint.Size = new System.Drawing.Size(154, 31);
             this.AutoPrint.TabIndex = 153;
@@ -140,7 +141,7 @@
             // 
             this.outboxcode_label.AutoSize = true;
             this.outboxcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.outboxcode_label.Location = new System.Drawing.Point(999, 349);
+            this.outboxcode_label.Location = new System.Drawing.Point(952, 347);
             this.outboxcode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.outboxcode_label.Name = "outboxcode_label";
             this.outboxcode_label.Size = new System.Drawing.Size(92, 27);
@@ -194,7 +195,7 @@
             // PrinterList
             // 
             this.PrinterList.Location = new System.Drawing.Point(771, 99);
-            this.PrinterList.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
+            this.PrinterList.Margin = new System.Windows.Forms.Padding(5);
             this.PrinterList.Name = "PrinterList";
             this.PrinterList.Size = new System.Drawing.Size(195, 25);
             this.PrinterList.TabIndex = 171;
@@ -221,7 +222,7 @@
             this.Clean.Image = null;
             this.Clean.IsShowBorder = true;
             this.Clean.Location = new System.Drawing.Point(1105, 640);
-            this.Clean.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Clean.Margin = new System.Windows.Forms.Padding(4);
             this.Clean.MoveImage = ((System.Drawing.Image)(resources.GetObject("Clean.MoveImage")));
             this.Clean.Name = "Clean";
             this.Clean.NormalImage = ((System.Drawing.Image)(resources.GetObject("Clean.NormalImage")));
@@ -236,7 +237,7 @@
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.OperateResult.Location = new System.Drawing.Point(953, 434);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(4);
             this.OperateResult.Name = "OperateResult";
             this.OperateResult.Size = new System.Drawing.Size(368, 198);
             this.OperateResult.TabIndex = 167;
@@ -247,11 +248,11 @@
             this.outboxcode.AllPower = "ifall";
             this.outboxcode.BackColor = System.Drawing.Color.White;
             this.outboxcode.ID = null;
-            this.outboxcode.Location = new System.Drawing.Point(1096, 349);
-            this.outboxcode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.outboxcode.Location = new System.Drawing.Point(1049, 347);
+            this.outboxcode.Margin = new System.Windows.Forms.Padding(4);
             this.outboxcode.Name = "outboxcode";
             this.outboxcode.Power = "ifread";
-            this.outboxcode.Size = new System.Drawing.Size(209, 25);
+            this.outboxcode.Size = new System.Drawing.Size(145, 25);
             this.outboxcode.Str = null;
             this.outboxcode.Str1 = null;
             this.outboxcode.Str2 = null;
@@ -265,7 +266,7 @@
             this.pa_outboxcode.BackColor = System.Drawing.Color.White;
             this.pa_outboxcode.ID = null;
             this.pa_outboxcode.Location = new System.Drawing.Point(111, 36);
-            this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(4);
             this.pa_outboxcode.Name = "pa_outboxcode";
             this.pa_outboxcode.Power = "ifread";
             this.pa_outboxcode.Size = new System.Drawing.Size(140, 25);
@@ -284,7 +285,7 @@
             this.Printlab.Image = null;
             this.Printlab.IsShowBorder = true;
             this.Printlab.Location = new System.Drawing.Point(1107, 280);
-            this.Printlab.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Printlab.Margin = new System.Windows.Forms.Padding(4);
             this.Printlab.MoveImage = ((System.Drawing.Image)(resources.GetObject("Printlab.MoveImage")));
             this.Printlab.Name = "Printlab";
             this.Printlab.NormalImage = ((System.Drawing.Image)(resources.GetObject("Printlab.NormalImage")));
@@ -303,7 +304,7 @@
             this.ReleasePallet.Image = null;
             this.ReleasePallet.IsShowBorder = true;
             this.ReleasePallet.Location = new System.Drawing.Point(1004, 280);
-            this.ReleasePallet.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.ReleasePallet.Margin = new System.Windows.Forms.Padding(4);
             this.ReleasePallet.MoveImage = ((System.Drawing.Image)(resources.GetObject("ReleasePallet.MoveImage")));
             this.ReleasePallet.Name = "ReleasePallet";
             this.ReleasePallet.NormalImage = ((System.Drawing.Image)(resources.GetObject("ReleasePallet.NormalImage")));
@@ -322,7 +323,7 @@
             this.NewPallet.Image = null;
             this.NewPallet.IsShowBorder = true;
             this.NewPallet.Location = new System.Drawing.Point(1236, 12);
-            this.NewPallet.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.NewPallet.Margin = new System.Windows.Forms.Padding(4);
             this.NewPallet.MoveImage = ((System.Drawing.Image)(resources.GetObject("NewPallet.MoveImage")));
             this.NewPallet.Name = "NewPallet";
             this.NewPallet.NormalImage = ((System.Drawing.Image)(resources.GetObject("NewPallet.NormalImage")));
@@ -359,12 +360,48 @@
             this.Column5});
             this.PackageInf.EnableContentClick = true;
             this.PackageInf.Location = new System.Drawing.Point(4, 161);
-            this.PackageInf.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.PackageInf.Margin = new System.Windows.Forms.Padding(4);
             this.PackageInf.Name = "PackageInf";
             this.PackageInf.RowTemplate.Height = 23;
             this.PackageInf.Size = new System.Drawing.Size(941, 519);
             this.PackageInf.TabIndex = 156;
             // 
+            // pd_outboxcode
+            // 
+            this.pd_outboxcode.DataPropertyName = "code";
+            this.pd_outboxcode.HeaderText = "卡通箱号";
+            this.pd_outboxcode.Name = "pd_outboxcode";
+            this.pd_outboxcode.ReadOnly = true;
+            // 
+            // pd_innerqty
+            // 
+            this.pd_innerqty.DataPropertyName = "pd_innerqty";
+            this.pd_innerqty.HeaderText = "数量";
+            this.pd_innerqty.Name = "pd_innerqty";
+            this.pd_innerqty.ReadOnly = true;
+            // 
+            // Column3
+            // 
+            this.Column3.DataPropertyName = "pd_prodcode";
+            this.Column3.HeaderText = "产品编号";
+            this.Column3.Name = "Column3";
+            this.Column3.ReadOnly = true;
+            // 
+            // Column4
+            // 
+            this.Column4.DataPropertyName = "pd_makecode";
+            this.Column4.HeaderText = "工单号";
+            this.Column4.Name = "Column4";
+            this.Column4.ReadOnly = true;
+            // 
+            // Column5
+            // 
+            this.Column5.DataPropertyName = "pa_custcode";
+            this.Column5.HeaderText = "客户";
+            this.Column5.MinimumWidth = 100;
+            this.Column5.Name = "Column5";
+            this.Column5.ReadOnly = true;
+            // 
             // pa_makecode
             // 
             this.pa_makecode.AutoSize = true;
@@ -423,7 +460,7 @@
             this.Packing.Image = null;
             this.Packing.IsShowBorder = true;
             this.Packing.Location = new System.Drawing.Point(1213, 280);
-            this.Packing.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Packing.Margin = new System.Windows.Forms.Padding(4);
             this.Packing.MoveImage = ((System.Drawing.Image)(resources.GetObject("Packing.MoveImage")));
             this.Packing.Name = "Packing";
             this.Packing.NormalImage = ((System.Drawing.Image)(resources.GetObject("Packing.NormalImage")));
@@ -439,7 +476,7 @@
             this.AutoOutBoxCode.AutoSize = true;
             this.AutoOutBoxCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.AutoOutBoxCode.Location = new System.Drawing.Point(259, 32);
-            this.AutoOutBoxCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.AutoOutBoxCode.Margin = new System.Windows.Forms.Padding(4);
             this.AutoOutBoxCode.Name = "AutoOutBoxCode";
             this.AutoOutBoxCode.Size = new System.Drawing.Size(114, 31);
             this.AutoOutBoxCode.TabIndex = 179;
@@ -464,7 +501,7 @@
             this.PrintNum.Enabled = false;
             this.PrintNum.ID = null;
             this.PrintNum.Location = new System.Drawing.Point(1117, 166);
-            this.PrintNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.PrintNum.Margin = new System.Windows.Forms.Padding(4);
             this.PrintNum.Name = "PrintNum";
             this.PrintNum.Power = null;
             this.PrintNum.Size = new System.Drawing.Size(188, 25);
@@ -473,47 +510,24 @@
             this.PrintNum.Str2 = null;
             this.PrintNum.TabIndex = 181;
             // 
-            // pd_outboxcode
-            // 
-            this.pd_outboxcode.DataPropertyName = "code";
-            this.pd_outboxcode.HeaderText = "卡通箱号";
-            this.pd_outboxcode.Name = "pd_outboxcode";
-            this.pd_outboxcode.ReadOnly = true;
-            // 
-            // pd_innerqty
-            // 
-            this.pd_innerqty.DataPropertyName = "pd_innerqty";
-            this.pd_innerqty.HeaderText = "数量";
-            this.pd_innerqty.Name = "pd_innerqty";
-            this.pd_innerqty.ReadOnly = true;
-            // 
-            // Column3
-            // 
-            this.Column3.DataPropertyName = "pd_prodcode";
-            this.Column3.HeaderText = "产品编号";
-            this.Column3.Name = "Column3";
-            this.Column3.ReadOnly = true;
-            // 
-            // Column4
-            // 
-            this.Column4.DataPropertyName = "pd_makecode";
-            this.Column4.HeaderText = "工单号";
-            this.Column4.Name = "Column4";
-            this.Column4.ReadOnly = true;
-            // 
-            // Column5
+            // Cancel
             // 
-            this.Column5.DataPropertyName = "pa_custcode";
-            this.Column5.HeaderText = "客户";
-            this.Column5.MinimumWidth = 100;
-            this.Column5.Name = "Column5";
-            this.Column5.ReadOnly = true;
+            this.Cancel.AutoSize = true;
+            this.Cancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Cancel.Location = new System.Drawing.Point(1202, 343);
+            this.Cancel.Margin = new System.Windows.Forms.Padding(4);
+            this.Cancel.Name = "Cancel";
+            this.Cancel.Size = new System.Drawing.Size(114, 31);
+            this.Cancel.TabIndex = 182;
+            this.Cancel.Text = "取消采集";
+            this.Cancel.UseVisualStyleBackColor = true;
             // 
             // Make_BigBoxCollection
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1329, 690);
+            this.Controls.Add(this.Cancel);
             this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.pa_status);
             this.Controls.Add(this.AutoOutBoxCode);
@@ -545,7 +559,7 @@
             this.Controls.Add(this.pa_totalqty_label);
             this.Controls.Add(this.pa_outboxcode_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Make_BigBoxCollection";
             this.Tag = "Make!BigBoxCollection";
             this.Text = "栈板采集";
@@ -594,5 +608,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
         private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
         private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
+        private System.Windows.Forms.CheckBox Cancel;
     }
 }

+ 51 - 35
UAS-MES/FunctionCode/Make/Make_BigBoxCollection.cs

@@ -174,49 +174,65 @@ namespace UAS_MES.Make
                         OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "未采集内容或不存在,不允许装大箱\n", Color.Red, outboxcode);
                         return;
                     }
-                    pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
-                    if (pa_standardqty.Text == pa_currentqty.Text && pa_status.Text == "0")
+                    if (!Cancel.Checked)
                     {
-                        dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
-                        pa_status.Text = "1";
-                    }
-                    //如果箱号为空的时候并且勾选了自动生成
-                    if (pa_outboxcode.Text == "" && AutoOutBoxCode.Checked || pa_status.Text == "1")
-                    {
-                        //箱已采集满并且未勾选自动生成
-                        if (pa_standardqty.Text == pa_currentqty.Text && !AutoOutBoxCode.Checked)
+                        pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
+                        if (pa_standardqty.Text == pa_currentqty.Text && pa_status.Text == "0")
+                        {
+                            dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
+                            pa_status.Text = "1";
+                        }
+                        //如果箱号为空的时候并且勾选了自动生成
+                        if (pa_outboxcode.Text == "" && AutoOutBoxCode.Checked || pa_status.Text == "1")
                         {
-                            OperateResult.AppendText(">>大箱" + pa_outboxcode.Text + "已采集满\n", Color.Red, outboxcode);
+                            //箱已采集满并且未勾选自动生成
+                            if (pa_standardqty.Text == pa_currentqty.Text && !AutoOutBoxCode.Checked)
+                            {
+                                OperateResult.AppendText(">>大箱" + pa_outboxcode.Text + "已采集满\n", Color.Red, outboxcode);
+                                return;
+                            }
+                            else
+                            {
+                                pa_outboxcode.Text = LogicHandler.GetOutBoxCode("BIGBOX", "", pa_prodcode.Text, User.UserCode);
+                            }
+                        }
+                        else if (pa_outboxcode.Text == "")
+                        {
+                            OperateResult.AppendText(">>大箱号不能为空\n", Color.Red);
                             return;
                         }
+                        //箱号不存在进行插入
+                        dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
+                        if (dt.Rows.Count == 0)
+                        {
+                            pa_id = dh.GetSEQ("package_seq");
+                            sql.Clear();
+                            sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_standardqty,pa_sccode,pa_currentstep)values");
+                            sql.Append("(" + pa_id + ",'" + pa_outboxcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',2,'" + pa_prodcode.Text + "',0,'','" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
+                            dh.ExecuteSql(sql.GetString(), "insert");
+                        }
                         else
                         {
-                            pa_outboxcode.Text = LogicHandler.GetOutBoxCode("BIGBOX", "", pa_prodcode.Text, User.UserCode);
+                            pa_id = dt.Rows[0]["pa_id"].ToString();
                         }
+                        //如果未装满的话
+                        CollectBox();
                     }
-                    else if (pa_outboxcode.Text == "")
-                    {
-                        OperateResult.AppendText(">>大箱号不能为空\n", Color.Red);
-                        return;
-                    }
-                    //箱号不存在进行插入
-                    dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
-                    if (dt.Rows.Count == 0)
-                    {
-                        pa_id = dh.GetSEQ("package_seq");
-                        sql.Clear();
-                        sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_standardqty,pa_sccode,pa_currentstep)values");
-                        sql.Append("(" + pa_id + ",'" + pa_outboxcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',2,'" + pa_prodcode.Text + "',0,'','" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
-                        dh.ExecuteSql(sql.GetString(), "insert");
-                    }
-                    else
-                    {
-                        pa_id = dt.Rows[0]["pa_id"].ToString();
-                    }
-                    //如果未装满的话
-                    CollectBox();
+                    else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, outboxcode);
+                }
+                else
+                {
+                    List<string> SQLS = new List<string>();
+                    //删除明细
+                    SQLS.Add("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "' and pd_innerboxcode='" + outboxcode.Text + "'");
+                    //减少箱内容量
+                    SQLS.Add("update package set pa_packageqty=pa_packageqty-1,pa_totalqty=pa_totalqty-(select pa_totalqty from package where pa_outboxcode='" + outboxcode.Text + "'),pa_currentqty=0,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'");
+                    SQLS.Add("update package set pa_mothercode='' where pa_outboxcode='" + outboxcode.Text + "'");
+                    dh.ExecuteSQLTran(SQLS.ToArray());
+                    LoadCollectNum();
+                    LoadGridData();
+                    outboxcode.Clear();
                 }
-                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, outboxcode);
             }
         }
 
@@ -262,7 +278,7 @@ namespace UAS_MES.Make
                             pa_makecode.Text = carton_macode;
                             dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                         }
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "大箱"+pa_outboxcode.Text+ "采集卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "大箱" + pa_outboxcode.Text + "采集卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
                         //记录卡通箱所有序列号操作日志
                         if (pa_nextstep != "")
                         {

+ 18 - 3
UAS-MES/FunctionCode/Make/Make_PalletCollection.Designer.cs

@@ -64,6 +64,7 @@
             this.pa_totalqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.PrintNum = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.pa_standardqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.Cancel = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.PackageInf)).BeginInit();
             this.SuspendLayout();
             // 
@@ -126,7 +127,7 @@
             // 
             this.outboxcode_label.AutoSize = true;
             this.outboxcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.outboxcode_label.Location = new System.Drawing.Point(981, 324);
+            this.outboxcode_label.Location = new System.Drawing.Point(954, 326);
             this.outboxcode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.outboxcode_label.Name = "outboxcode_label";
             this.outboxcode_label.Size = new System.Drawing.Size(52, 27);
@@ -300,11 +301,11 @@
             this.outboxcode.AllPower = "ifall";
             this.outboxcode.BackColor = System.Drawing.Color.White;
             this.outboxcode.ID = null;
-            this.outboxcode.Location = new System.Drawing.Point(1061, 324);
+            this.outboxcode.Location = new System.Drawing.Point(1014, 326);
             this.outboxcode.Margin = new System.Windows.Forms.Padding(4);
             this.outboxcode.Name = "outboxcode";
             this.outboxcode.Power = "ifread";
-            this.outboxcode.Size = new System.Drawing.Size(207, 25);
+            this.outboxcode.Size = new System.Drawing.Size(175, 25);
             this.outboxcode.Str = null;
             this.outboxcode.Str1 = null;
             this.outboxcode.Str2 = null;
@@ -512,11 +513,24 @@
             this.pa_standardqty.KeyDown += new System.Windows.Forms.KeyEventHandler(this.pa_standardqty_KeyDown);
             this.pa_standardqty.Leave += new System.EventHandler(this.pa_standardqty_Leave);
             // 
+            // Cancel
+            // 
+            this.Cancel.AutoSize = true;
+            this.Cancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Cancel.Location = new System.Drawing.Point(1200, 323);
+            this.Cancel.Margin = new System.Windows.Forms.Padding(4);
+            this.Cancel.Name = "Cancel";
+            this.Cancel.Size = new System.Drawing.Size(114, 31);
+            this.Cancel.TabIndex = 185;
+            this.Cancel.Text = "取消采集";
+            this.Cancel.UseVisualStyleBackColor = true;
+            // 
             // Make_PalletCollection
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1329, 690);
+            this.Controls.Add(this.Cancel);
             this.Controls.Add(this.pa_standardqty);
             this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.AutoPrint);
@@ -597,5 +611,6 @@
         private System.Windows.Forms.CheckBox AutoPrint;
         private CustomControl.TextBoxWithIcon.EnterTextBox PrintNum;
         private CustomControl.TextBoxWithIcon.EnterTextBox pa_standardqty;
+        private System.Windows.Forms.CheckBox Cancel;
     }
 }

+ 96 - 79
UAS-MES/FunctionCode/Make/Make_PalletCollection.cs

@@ -168,102 +168,119 @@ namespace UAS_MES.Make
                         OperateResult.AppendText(">>箱号" + outboxcode.Text + "未采集内容或不存在,不允许装栈板\n", Color.Red, outboxcode);
                         return;
                     }
-                    pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
-                    if (pa_outboxcode.Text == "" && AutoOutBoxCode.Checked || pa_status.Text == "1")
+                    if (!Cancel.Checked)
                     {
-                        //箱已采集满并且未勾选自动生成
-                        if (pa_standardqty.Text == pa_totalqty.Text && !AutoOutBoxCode.Checked)
+                        pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
+                        if (pa_outboxcode.Text == "" && AutoOutBoxCode.Checked || pa_status.Text == "1")
                         {
-                            OperateResult.AppendText(">>栈板" + pa_outboxcode.Text + "已采集满\n", Color.Red, outboxcode);
+                            //箱已采集满并且未勾选自动生成
+                            if (pa_standardqty.Text == pa_totalqty.Text && !AutoOutBoxCode.Checked)
+                            {
+                                OperateResult.AppendText(">>栈板" + pa_outboxcode.Text + "已采集满\n", Color.Red, outboxcode);
+                                return;
+                            }
+                            else
+                            {
+                                pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
+                            }
+                        }
+                        else if (pa_outboxcode.Text == "")
+                        {
+                            OperateResult.AppendText(">>栈板号不能为空\n", Color.Red);
                             return;
                         }
+                        dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
+                        if (dt.Rows.Count == 0)
+                        {
+                            pa_id = dh.GetSEQ("package_seq");
+                            sql.Clear();
+                            sql.Append("insert into package (pa_id,pa_outboxcode,PA_STANDARDQTY,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_sccode,pa_currentstep)values");
+                            sql.Append("(" + pa_id + ",'" + pa_outboxcode.Text + "','" + pa_standardqty.Text + "','" + pa_makecode.Text + "',sysdate,'0',3,'" + pa_prodcode.Text + "',0,0,'" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
+                            dh.ExecuteSql(sql.GetString(), "insert");
+                        }
                         else
                         {
-                            pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
+                            pa_id = dt.Rows[0]["pa_id"].ToString();
                         }
-                    }
-                    else if (pa_outboxcode.Text == "")
-                    {
-                        OperateResult.AppendText(">>栈板号不能为空\n", Color.Red);
-                        return;
-                    }
-                    dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
-                    if (dt.Rows.Count == 0)
-                    {
-                        pa_id = dh.GetSEQ("package_seq");
-                        sql.Clear();
-                        sql.Append("insert into package (pa_id,pa_outboxcode,PA_STANDARDQTY,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_sccode,pa_currentstep)values");
-                        sql.Append("(" + pa_id + ",'" + pa_outboxcode.Text + "','" + pa_standardqty.Text + "','" + pa_makecode.Text + "',sysdate,'0',3,'" + pa_prodcode.Text + "',0,0,'" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
-                        dh.ExecuteSql(sql.GetString(), "insert");
-                    }
-                    else
-                    {
-                        pa_id = dt.Rows[0]["pa_id"].ToString();
-                    }
-                    dt = (DataTable)dh.ExecuteSql("select pa_totalqty,pa_mothercode,nvl(pa_status,0) pa_status from package where pa_outboxcode='" + outboxcode.Text + "'", "select");
-                    if (dt.Rows.Count > 0)
-                    {
-                        //判断是否已经装箱
-                        int sonboxtotalqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
-                        if (dt.Rows[0]["pa_mothercode"].ToString() == "")
+                        dt = (DataTable)dh.ExecuteSql("select pa_totalqty,pa_mothercode,nvl(pa_status,0) pa_status from package where pa_outboxcode='" + outboxcode.Text + "'", "select");
+                        if (dt.Rows.Count > 0)
                         {
-                            if (dt.Rows[0]["pa_status"].ToString() == "1")
+                            //判断是否已经装箱
+                            int sonboxtotalqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
+                            if (dt.Rows[0]["pa_mothercode"].ToString() == "")
                             {
-                                pa_totalqty.Text = dh.getFieldDataByCondition("package", "pa_totalqty", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
-                                if (int.Parse(pa_totalqty.Text == "" ? "0" : pa_totalqty.Text) + sonboxtotalqty > int.Parse(pa_standardqty.Text))
-                                {
-                                    OperateResult.AppendText(">>采集箱号" + outboxcode.Text + "后超出容量\n", Color.Red, outboxcode);
-                                    return;
-                                }
-                                List<string> SQLS = new List<string>();
-                                sql.Clear();
-                                sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_makecode,pd_prodcode,pd_innerboxcode, pd_innerqty,pd_builddate)");
-                                sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + pa_makecode.Text + "','" + pa_prodcode.Text + "','" + outboxcode.Text + "' ");
-                                sql.Append(",(select nvl(sum(pd_innerqty),0) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode=");
-                                sql.Append("'" + outboxcode.Text + "'),sysdate from package where pa_outboxcode='" + outboxcode.Text + "'");
-                                SQLS.Add(sql.GetString());
-                                //如果采集完这个超出了容量提示
-                                SQLS.Add("update package set PA_CURRENTQTY=nvl(PA_CURRENTQTY,0)+1,PA_PACKAGEQTY=nvl(PA_PACKAGEQTY,0)+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "') where pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=3");
-                                SQLS.Add("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + outboxcode.Text + "'");
-                                dh.ExecuteSQLTran(SQLS.ToArray());
-                                //更新大箱的栈板号
-                                if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "")
-                                {
-                                    string carton_macode = dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
-                                    pa_makecode.Text = carton_macode;
-                                    dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
-                                }
-                                LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "栈板采集成功,栈板号:" + pa_outboxcode.Text, "栈板采集");
-                                if (pa_totalqty.Text == "1")
-                                {
-                                    string nextstepcode = dh.getFieldDataByCondition("mes_package_view left join makeserial on ms_sncode=v_barcode", "ms_nextstepcode", "v_outboxcode='" + outboxcode.Text + "'").ToString();
-                                    dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-                                }
-                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "栈板采集", "栈板" + pa_outboxcode.Text + "采集箱" + outboxcode.Text + "成功", pa_outboxcode.Text, "");
-                                OperateResult.AppendText(">>箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
-                                LoadCollectNum();
-                                LoadGridData();
-                                if (pa_standardqty.Text == pa_totalqty.Text)
+                                if (dt.Rows[0]["pa_status"].ToString() == "1")
                                 {
-                                    dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
-                                    if (AutoPrint.Checked)
+                                    pa_totalqty.Text = dh.getFieldDataByCondition("package", "pa_totalqty", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
+                                    if (int.Parse(pa_totalqty.Text == "" ? "0" : pa_totalqty.Text) + sonboxtotalqty > int.Parse(pa_standardqty.Text))
+                                    {
+                                        OperateResult.AppendText(">>采集箱号" + outboxcode.Text + "后超出容量\n", Color.Red, outboxcode);
+                                        return;
+                                    }
+                                    List<string> SQLS = new List<string>();
+                                    sql.Clear();
+                                    sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_makecode,pd_prodcode,pd_innerboxcode, pd_innerqty,pd_builddate)");
+                                    sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + pa_makecode.Text + "','" + pa_prodcode.Text + "','" + outboxcode.Text + "' ");
+                                    sql.Append(",(select nvl(sum(pd_innerqty),0) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode=");
+                                    sql.Append("'" + outboxcode.Text + "'),sysdate from package where pa_outboxcode='" + outboxcode.Text + "'");
+                                    SQLS.Add(sql.GetString());
+                                    //如果采集完这个超出了容量提示
+                                    SQLS.Add("update package set PA_CURRENTQTY=nvl(PA_CURRENTQTY,0)+1,PA_PACKAGEQTY=nvl(PA_PACKAGEQTY,0)+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "') where pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=3");
+                                    SQLS.Add("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + outboxcode.Text + "'");
+                                    dh.ExecuteSQLTran(SQLS.ToArray());
+                                    //更新大箱的栈板号
+                                    if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "")
+                                    {
+                                        string carton_macode = dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
+                                        pa_makecode.Text = carton_macode;
+                                        dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
+                                    }
+                                    LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "栈板采集成功,栈板号:" + pa_outboxcode.Text, "栈板采集");
+                                    if (pa_totalqty.Text == "1")
+                                    {
+                                        string nextstepcode = dh.getFieldDataByCondition("mes_package_view left join makeserial on ms_sncode=v_barcode", "ms_nextstepcode", "v_outboxcode='" + outboxcode.Text + "'").ToString();
+                                        dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                    }
+                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "栈板采集", "栈板" + pa_outboxcode.Text + "采集箱" + outboxcode.Text + "成功", pa_outboxcode.Text, "");
+                                    OperateResult.AppendText(">>箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
+                                    LoadCollectNum();
+                                    LoadGridData();
+                                    if (pa_standardqty.Text == pa_totalqty.Text)
                                     {
-                                        OperateResult.AppendText(">>栈板已装满,自动打印!\n", Color.Green);
-                                        Printlab.PerformClick();
+                                        dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
+                                        if (AutoPrint.Checked)
+                                        {
+                                            OperateResult.AppendText(">>栈板已装满,自动打印!\n", Color.Green);
+                                            Printlab.PerformClick();
+                                        }
                                     }
                                 }
+                                else OperateResult.AppendText(">>箱号" + outboxcode.Text + "尚未封箱\n", Color.Red, outboxcode);
                             }
-                            else OperateResult.AppendText(">>箱号" + outboxcode.Text + "尚未封箱\n", Color.Red, outboxcode);
-                        }
-                        else
-                        {
-                            if (dt.Rows[0]["pa_mothercode"].ToString() == pa_outboxcode.Text)
-                                OperateResult.AppendText(">>箱号" + outboxcode.Text + "已在本栈板内\n", Color.Red, outboxcode);
                             else
-                                OperateResult.AppendText(">>箱号" + outboxcode.Text + "已采集至栈板" + dt.Rows[0]["pa_mothercode"].ToString() + "\n", Color.Red, outboxcode);
+                            {
+                                if (dt.Rows[0]["pa_mothercode"].ToString() == pa_outboxcode.Text)
+                                    OperateResult.AppendText(">>箱号" + outboxcode.Text + "已在本栈板内\n", Color.Red, outboxcode);
+                                else
+                                    OperateResult.AppendText(">>箱号" + outboxcode.Text + "已采集至栈板" + dt.Rows[0]["pa_mothercode"].ToString() + "\n", Color.Red, outboxcode);
+                            }
                         }
+                        else OperateResult.AppendText(">>箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
+                    }
+                    //进行拆箱操作
+                    else
+                    {
+                        List<string> SQLS = new List<string>();
+                        //删除明细
+                        SQLS.Add("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "' and pd_innerboxcode='" + outboxcode.Text + "'");
+                        //减少箱内容量
+                        SQLS.Add("update package set pa_packageqty=pa_packageqty-1,pa_totalqty=pa_totalqty-(select pa_totalqty from package where pa_outboxcode='" + outboxcode.Text + "'),pa_currentqty=0,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'");
+                        SQLS.Add("update package set pa_mothercode='' where pa_outboxcode='" + outboxcode.Text + "'");
+                        dh.ExecuteSQLTran(SQLS.ToArray());
+                        LoadCollectNum();
+                        LoadGridData();
+                        outboxcode.Clear();
                     }
-                    else OperateResult.AppendText(">>箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
                 }
             }
         }

+ 15 - 0
UAS-MES/FunctionCode/Make/Make_PalletCollection.resx

@@ -788,4 +788,19 @@
   <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pd_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
 </root>