Przeglądaj źródła

修改栈板采集自动生成箱号

章政 8 lat temu
rodzic
commit
9f083be951

+ 2 - 2
UAS-MES/FunctionCode/Make/Make_BigBoxCollection.cs

@@ -241,9 +241,9 @@ namespace UAS_MES.Make
                     {
                         //插入大箱明细
                         sql.Clear();
-                        sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_innerboxcode, pd_innerqty,pd_makecode,pd_prodcode)");
+                        sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_innerboxcode, pd_innerqty,pd_makecode,pd_prodcode,pd_builddate)");
                         sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + bigoutboxcode.Text + "','" + outboxcode.Text + "'");
-                        sql.Append(",pa_packageqty,'" + pa_makecode.Text + "','" + pa_prodcode.Text + "' from package where pa_outboxcode='" + outboxcode.Text + "'");
+                        sql.Append(",pa_packageqty,'" + pa_makecode.Text + "','" + pa_prodcode.Text + "',sysdate from package where pa_outboxcode='" + outboxcode.Text + "'");
                         dh.ExecuteSql(sql.GetString(), "insert");
                         //箱内计数+1
                         dh.UpdateByCondition("package", "PA_CURRENTQTY=PA_CURRENTQTY+1,PA_PACKAGEQTY=PA_PACKAGEQTY+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + bigoutboxcode.Text + "')", "pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2");

+ 38 - 5
UAS-MES/FunctionCode/Make/Make_PalletCollection.Designer.cs

@@ -63,6 +63,8 @@
             this.pa_makecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_currentqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_outboxcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
+            this.AutoOutBoxCode = new System.Windows.Forms.CheckBox();
+            this.pa_status = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PackageInf)).BeginInit();
             this.SuspendLayout();
@@ -220,7 +222,7 @@
             this.Packing.DownImage = ((System.Drawing.Image)(resources.GetObject("Packing.DownImage")));
             this.Packing.Image = ((System.Drawing.Image)(resources.GetObject("Packing.Image")));
             this.Packing.IsShowBorder = true;
-            this.Packing.Location = new System.Drawing.Point(1168, 265);
+            this.Packing.Location = new System.Drawing.Point(1203, 253);
             this.Packing.Margin = new System.Windows.Forms.Padding(4);
             this.Packing.MoveImage = ((System.Drawing.Image)(resources.GetObject("Packing.MoveImage")));
             this.Packing.Name = "Packing";
@@ -265,6 +267,7 @@
             this.pa_prodcode.Size = new System.Drawing.Size(0, 27);
             this.pa_prodcode.TabIndex = 170;
             this.pa_prodcode.Tag = "1";
+            this.pa_prodcode.TextChanged += new System.EventHandler(this.pa_prodcode_TextChanged);
             // 
             // Clean
             // 
@@ -336,7 +339,7 @@
             this.Printlab.DownImage = ((System.Drawing.Image)(resources.GetObject("Printlab.DownImage")));
             this.Printlab.Image = ((System.Drawing.Image)(resources.GetObject("Printlab.Image")));
             this.Printlab.IsShowBorder = true;
-            this.Printlab.Location = new System.Drawing.Point(1168, 209);
+            this.Printlab.Location = new System.Drawing.Point(1096, 253);
             this.Printlab.Margin = new System.Windows.Forms.Padding(4);
             this.Printlab.MoveImage = ((System.Drawing.Image)(resources.GetObject("Printlab.MoveImage")));
             this.Printlab.Name = "Printlab";
@@ -355,7 +358,7 @@
             this.ReleasePallet.DownImage = ((System.Drawing.Image)(resources.GetObject("ReleasePallet.DownImage")));
             this.ReleasePallet.Image = ((System.Drawing.Image)(resources.GetObject("ReleasePallet.Image")));
             this.ReleasePallet.IsShowBorder = true;
-            this.ReleasePallet.Location = new System.Drawing.Point(1041, 265);
+            this.ReleasePallet.Location = new System.Drawing.Point(992, 253);
             this.ReleasePallet.Margin = new System.Windows.Forms.Padding(4);
             this.ReleasePallet.MoveImage = ((System.Drawing.Image)(resources.GetObject("ReleasePallet.MoveImage")));
             this.ReleasePallet.Name = "ReleasePallet";
@@ -374,7 +377,7 @@
             this.NewPalletCode.DownImage = ((System.Drawing.Image)(resources.GetObject("NewPalletCode.DownImage")));
             this.NewPalletCode.Image = ((System.Drawing.Image)(resources.GetObject("NewPalletCode.Image")));
             this.NewPalletCode.IsShowBorder = true;
-            this.NewPalletCode.Location = new System.Drawing.Point(1041, 209);
+            this.NewPalletCode.Location = new System.Drawing.Point(1221, 13);
             this.NewPalletCode.Margin = new System.Windows.Forms.Padding(4);
             this.NewPalletCode.MoveImage = ((System.Drawing.Image)(resources.GetObject("NewPalletCode.MoveImage")));
             this.NewPalletCode.Name = "NewPalletCode";
@@ -384,6 +387,7 @@
             this.NewPalletCode.TabIndex = 159;
             this.NewPalletCode.Text = "新增栈板";
             this.NewPalletCode.UseVisualStyleBackColor = true;
+            this.NewPalletCode.Visible = false;
             this.NewPalletCode.Click += new System.EventHandler(this.NewPallet_Click);
             // 
             // pa_custcode
@@ -492,11 +496,38 @@
             this.pa_outboxcode.TabIndex = 103;
             this.pa_outboxcode.Tag = "1";
             // 
+            // AutoOutBoxCode
+            // 
+            this.AutoOutBoxCode.AutoSize = true;
+            this.AutoOutBoxCode.Checked = true;
+            this.AutoOutBoxCode.CheckState = System.Windows.Forms.CheckState.Checked;
+            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(1105, 204);
+            this.AutoOutBoxCode.Margin = new System.Windows.Forms.Padding(4);
+            this.AutoOutBoxCode.Name = "AutoOutBoxCode";
+            this.AutoOutBoxCode.Size = new System.Drawing.Size(154, 31);
+            this.AutoOutBoxCode.TabIndex = 180;
+            this.AutoOutBoxCode.Text = "自动生成箱号";
+            this.AutoOutBoxCode.UseVisualStyleBackColor = true;
+            // 
+            // pa_status
+            // 
+            this.pa_status.AutoSize = true;
+            this.pa_status.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pa_status.Location = new System.Drawing.Point(1000, 208);
+            this.pa_status.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pa_status.Name = "pa_status";
+            this.pa_status.Size = new System.Drawing.Size(0, 27);
+            this.pa_status.TabIndex = 181;
+            this.pa_status.Visible = false;
+            // 
             // 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.pa_status);
+            this.Controls.Add(this.AutoOutBoxCode);
             this.Controls.Add(this.Packing);
             this.Controls.Add(this.pa_standardqty);
             this.Controls.Add(this.pa_packageqty_label);
@@ -530,7 +561,7 @@
             this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Make_PalletCollection";
             this.Tag = "Make!BigBoxCollection";
-            this.Text = "栈板采集";
+            this.Text = "7";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Make_PalletCollection_FormClosing);
             this.Load += new System.EventHandler(this.栈板称重_Load);
             this.SizeChanged += new System.EventHandler(this.栈板称重_SizeChanged);
@@ -577,5 +608,7 @@
         private CustomControl.ValueLabel.ValueLabel pa_standardqty;
         private System.Windows.Forms.Label pa_packageqty_label;
         private CustomControl.ButtonUtil.NormalButton Packing;
+        private System.Windows.Forms.CheckBox AutoOutBoxCode;
+        private System.Windows.Forms.Label pa_status;
     }
 }

+ 80 - 18
UAS-MES/FunctionCode/Make/Make_PalletCollection.cs

@@ -27,6 +27,7 @@ namespace UAS_MES.Make
 
         Make_NewPallet NewPallet;
 
+        string pa_nextstep = "";
         //箱类型
         string pa_type;
         //物料编号
@@ -117,23 +118,75 @@ namespace UAS_MES.Make
                         OperateResult.AppendText(">>箱号不能为空\n", Color.Red);
                         return;
                     }
-                    string pa_nextstep = dh.getFieldDataByCondition("package", "pa_nextstep", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
-                    if (pa_nextstep != User.CurrentStepCode && pa_nextstep != "")
+                    sql.Clear();
+                    sql.Append("select pd_makecode pa_makecode,pa_id,pd_prodcode pa_prodcode,pa_status,pa_nextstep  from packagedetail ");
+                    sql.Append("left join package on pd_paid=pa_id where pd_outboxcode='" + outboxcode.Text + "'");
+                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                    if (dt.Rows.Count > 0)
+                    {
+                        BaseUtil.SetFormValue(this.Controls, dt);
+                        pa_nextstep = dt.Rows[0]["pa_nextstep"].ToString();
+                        if (pa_nextstep != User.CurrentStepCode && pa_nextstep != "")
+                        {
+                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "的下一工序不是当前岗位资源对应工序\n", Color.Red, outboxcode);
+                            return;
+                        }
+                        //未空表示线外
+                        if (pa_nextstep == "")
+                        {
+                            //判断线外,必须已完工并且未入库
+                            dt = (DataTable)dh.ExecuteSql("select wm_concat(ms_sncode) from mes_package_view  left join makeserial on v_barcode=ms_sncode where  v_outboxcode='" + outboxcode.Text + "' and ms_status<>2", "select");
+                            if (dt.Rows[0][0].ToString() == "")
+                            {
+                                //判断箱未入库
+                                dt = (DataTable)dh.ExecuteSql("select count(1) from package where pa_outboxcode='" + outboxcode.Text + "' and nvl(pa_iostatus,0)<>0", "select");
+                                if (dt.Rows[0][0].ToString() != "0")
+                                {
+                                    OperateResult.AppendText(">>序列号" + dt.Rows[0][0].ToString() + "已入库,不允许装箱\n", Color.Red);
+                                    return;
+                                }
+                            }
+                            else
+                            {
+                                OperateResult.AppendText(">>序列号" + dt.Rows[0][0].ToString() + "尚未完工\n", Color.Red);
+                                return;
+                            }
+                        }
+                    }
+                    else
                     {
-                        OperateResult.AppendText(">>箱号" + outboxcode.Text + "的下一工序不是当前岗位资源对应工序\n", Color.Red, outboxcode);
+                        OperateResult.AppendText(">>箱号" + outboxcode.Text + "未采集内容,不允许装栈板箱\n", Color.Red, outboxcode);
                         return;
                     }
-                    string pa_status = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + palletcode.Text + "'").ToString();
-                    if (pa_status == "1")
+                    pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + palletcode.Text + "'").ToString();
+                    if (pa_status.Text == "1" && AutoOutBoxCode.Checked)
                     {
                         palletcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
+                        pa_status.Text = "1";
+                    }
+                    else if (palletcode.Text == "" && AutoOutBoxCode.Checked)
+                    {
+                        palletcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
+                    }
+                    else if (palletcode.Text == "" && !AutoOutBoxCode.Checked)
+                    {
+                        OperateResult.AppendText(">>栈板号箱号不能为空\n", Color.Red, outboxcode);
+                        return;
+                    }
+                    pa_outboxcode.Text = palletcode.Text;
+                    dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + palletcode.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_standardqty,pa_sccode,pa_currentstep)values");
-                        sql.Append("(package_seq.nextval,'" + palletcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',3,'" + pa_prodcode.Text + "',0,'" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
+                        sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_sccode,pa_currentstep)values");
+                        sql.Append("(" + pa_id + ",'" + palletcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',3,'" + pa_prodcode.Text + "',0,0,'" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
                         dh.ExecuteSql(sql.GetString(), "insert");
-                        palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
                     }
-                    //如果未装满的话
+                    else
+                    {
+                        pa_id = dt.Rows[0]["pa_id"].ToString();
+                    }
                     dt = (DataTable)dh.ExecuteSql("select pa_mothercode,nvl(pa_status,0) pa_status from package where pa_outboxcode='" + outboxcode.Text + "'", "select");
                     if (dt.Rows.Count > 0)
                     {
@@ -142,15 +195,17 @@ namespace UAS_MES.Make
                         {
                             if (dt.Rows[0]["pa_status"].ToString() == "1")
                             {
+                                List<string> SQLS = new List<string>();
                                 sql.Clear();
-                                sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode, pd_innerboxcode, pd_innerqty)");
-                                sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + palletcode.Text + "','" + outboxcode.Text + "' ");
+                                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 + "','" + palletcode.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 + "') from package where pa_outboxcode='" + outboxcode.Text + "'");
-                                dh.ExecuteSql(sql.GetString(), "insert");
-                                dh.UpdateByCondition("package", "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='" + palletcode.Text + "')", "pa_outboxcode='" + palletcode.Text + "' and pa_type=3");
+                                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='" + palletcode.Text + "') where pa_outboxcode='" + palletcode.Text + "' and pa_type=3");
+                                SQLS.Add("update package set pa_mothercode='" + palletcode.Text + "' where pa_outboxcode='" + outboxcode.Text + "'");
+                                dh.ExecuteSQLTran(SQLS.ToArray());
                                 //更新大箱的栈板号
-                                dh.UpdateByCondition("package", "pa_mothercode='" + palletcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
                                 LoadCollectNum();
                                 if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + palletcode.Text + "'").ToString() == "")
                                 {
@@ -160,6 +215,7 @@ namespace UAS_MES.Make
                                 }
                                 //已箱号过站
                                 LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "栈板采集成功,栈板号:" + palletcode.Text, "栈板采集");
+                                LoadGridData();
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "栈板采集", "栈板采集成功", palletcode.Text, "");
                                 OperateResult.AppendText(">>箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
                                 LoadGridData();
@@ -249,10 +305,10 @@ namespace UAS_MES.Make
                     dh.ExecuteSQLTran(SQLS.ToArray());
                 }
                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "栈板采集", "解除栈板" + palletcode.Text + "成功", palletcode.Text, "");
-                OperateResult.AppendText(">>栈板号" + outboxcode.Text + "解除成功\n", Color.Green);
+                OperateResult.AppendText(">>栈板号" + palletcode.Text + "解除成功\n", Color.Green);
                 palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
             }
-            OperateResult.AppendText(">>栈板号" + outboxcode.Text + "未采集箱\n", Color.Red);
+            else OperateResult.AppendText(">>栈板号" + palletcode.Text + "未采集箱\n", Color.Red);
         }
 
         private void Make_PalletCollection_FormClosing(object sender, FormClosingEventArgs e)
@@ -264,8 +320,9 @@ namespace UAS_MES.Make
         {
             if (pa_prodcode.Text != "" && palletcode.Text != "")
             {
-                OperateResult.AppendText(">>" + palletcode.Text + "装栈板成功\n", Color.Black);
+                OperateResult.AppendText(">>" + palletcode.Text + "装栈板成功\n", Color.Green);
                 dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + palletcode.Text + "'", "update");
+                pa_status.Text = "1";
             }
             else OperateResult.AppendText(">>栈板号不能为空\n", Color.Red);
         }
@@ -278,5 +335,10 @@ namespace UAS_MES.Make
                 PrintNum.Text = (PrintNums == "" ? "1" : PrintNums);
             }
         }
+
+        private void pa_prodcode_TextChanged(object sender, EventArgs e)
+        {
+            FillPrintLabel();
+        }
     }
 }

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

@@ -788,19 +788,4 @@
   <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>