Procházet zdrojové kódy

修改装箱采集BUG

章政 před 8 roky
rodič
revize
2c12cf9cda

+ 14 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollection.Designer.cs

@@ -77,6 +77,7 @@
             this.pa_checkno = new System.Windows.Forms.Label();
             this.pa_downstatus = new System.Windows.Forms.Label();
             this.ms_makecode = new System.Windows.Forms.Label();
+            this.pa_standardqty = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -687,11 +688,23 @@
             this.ms_makecode.TabIndex = 179;
             this.ms_makecode.Visible = false;
             // 
+            // pa_standardqty
+            // 
+            this.pa_standardqty.AutoSize = true;
+            this.pa_standardqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pa_standardqty.Location = new System.Drawing.Point(1132, 588);
+            this.pa_standardqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pa_standardqty.Name = "pa_standardqty";
+            this.pa_standardqty.Size = new System.Drawing.Size(0, 27);
+            this.pa_standardqty.TabIndex = 180;
+            this.pa_standardqty.Visible = false;
+            // 
             // Make_PackageCollection
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1172, 730);
+            this.Controls.Add(this.pa_standardqty);
             this.Controls.Add(this.ms_makecode);
             this.Controls.Add(this.pa_downstatus);
             this.Controls.Add(this.pa_checkno);
@@ -780,5 +793,6 @@
         private System.Windows.Forms.Label pa_checkno;
         private System.Windows.Forms.Label pa_downstatus;
         private System.Windows.Forms.Label ms_makecode;
+        private System.Windows.Forms.Label pa_standardqty;
     }
 }

+ 59 - 49
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -77,21 +77,10 @@ namespace UAS_MES.Make
         {
             //加载表单数据
             string Err = "";
-            if (pa_outboxcode.Text != "")
-            {
-                sql.Clear();
-                sql.Append("select pr_code,pa_outboxcode,pa_makecode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,pr_outboxinnerqty)pr_outboxinnerqty,pa_currentqty from package left join product on pa_prodcode=");
-                sql.Append("pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
-                Err = "箱号";
-            }
-            else
-            {
-                sql.Clear();
-                sql.Append("select ms_makecode,pr_code,pa_makecode,pa_status,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,pr_code,pr_detail,nvl(pa_standardqty,pr_outboxinnerqty) pr_outboxinnerqty,pa_packageqty,pa_currentqty,");
-                sql.Append("pa_outboxcode from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
-                sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
-                Err = "序列号";
-            }
+            sql.Clear();
+            sql.Append("select pr_code,pa_outboxcode,pa_makecode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,pa_status,pr_packrule,pr_detail,pa_packageqty,pa_standardqty,pr_outboxinnerqty,pa_currentqty from package left join product on pa_prodcode=");
+            sql.Append("pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
+            Err = "箱号";
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             if (dt.Rows.Count > 0)
             {
@@ -146,14 +135,31 @@ namespace UAS_MES.Make
                 {
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
                     {
+                        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,nvl(pa_standardqty,pr_outboxinnerqty) ");
+                        sql.Append("pr_outboxinnerqty from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
+                        sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
+                        dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
+                            BaseUtil.SetFormValue(this.Controls, dt);
+                        }
+                        if (pa_standardqty.Text != "0")
+                        {
+                            pr_outboxinnerqty.Text = pa_standardqty.Text;
+                        }
                         if (pa_outboxcode.Text == "")
                         {
-                            LoadData();
-                            if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
+                            string boxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
+                            if (boxcode != "")
+                            {
+                                pa_outboxcode.Text = boxcode;
                                 LoadGridData();
+                            }
                             else
                             {
-                                if (AutoGenBoxCode.Checked)
+                                if (AutoGenBoxCode.Checked && (pa_status.Text == "1" || pa_status.Text == ""))
                                     pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
                             }
                         }
@@ -162,41 +168,44 @@ namespace UAS_MES.Make
                             OperateResult.AppendText(">>箱号不能为空\n", Color.Red, sn_code);
                             return;
                         }
-                        //按工单核对装箱
-                        switch (pr_packrule.Text.ToUpper())
+                        if (pa_status.Text != "1")
                         {
-                            case "MAKE":
-                                if (dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_id='" + oMsID + "'").ToString() != pa_makecode.Text && pa_makecode.Text != "")
-                                {
-                                    OperateResult.AppendText(">>序列号" + sn_code.Text + "所属工单和当前箱号工单不相等\n", Color.Red, sn_code);
-                                    return;
-                                }
-                                break;
-                            case "SALE":
-                                if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
-                                {
-                                    sql.Clear();
-                                    sql.Append("select 1 from package left join make on pa_salecode=ma_salecode left join makeserial ");
-                                    sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
-                                    DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                    if (dt.Rows.Count == 0)
+                            //按工单核对装箱
+                            switch (pr_packrule.Text.ToUpper())
+                            {
+                                case "MAKE":
+                                    if (dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_id='" + oMsID + "'").ToString() != pa_makecode.Text && pa_makecode.Text != "")
                                     {
-                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号和当前箱号订单不相等\n", Color.Red, sn_code);
+                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "所属工单和当前箱号工单不相等\n", Color.Red, sn_code);
                                         return;
                                     }
-                                }
-                                break;
-                            case "PROD":
-                                if (dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id='" + oMsID + "'").ToString() != pr_code.Text)
-                                {
-                                    OperateResult.AppendText(">>序列号" + sn_code.Text + "对应物料和该箱所装物料不同\n", Color.Red, sn_code);
-                                    return;
-                                }
-                                break;
-                            case "MIX":
-                                break;
-                            default:
-                                break;
+                                    break;
+                                case "SALE":
+                                    if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
+                                    {
+                                        sql.Clear();
+                                        sql.Append("select 1 from package left join make on pa_salecode=ma_salecode left join makeserial ");
+                                        sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
+                                        DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                                        if (dt.Rows.Count == 0)
+                                        {
+                                            OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号和当前箱号订单不相等\n", Color.Red, sn_code);
+                                            return;
+                                        }
+                                    }
+                                    break;
+                                case "PROD":
+                                    if (dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id='" + oMsID + "'").ToString() != pr_code.Text)
+                                    {
+                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "对应物料和该箱所装物料不同\n", Color.Red, sn_code);
+                                        return;
+                                    }
+                                    break;
+                                case "MIX":
+                                    break;
+                                default:
+                                    break;
+                            }
                         }
                         //判断箱内总数必须大于0
                         if (pr_outboxinnerqty.Text == "" || pr_outboxinnerqty.Text == "0")
@@ -254,6 +263,7 @@ namespace UAS_MES.Make
                             {
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "取消采集成功", sn_code.Text, "");
                                 LoadGridData();
+                                pa_status.Text = "0";
                                 OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.Green, sn_code);
                             }
                             else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sn_code);

+ 14 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.Designer.cs

@@ -86,6 +86,7 @@
             this.pa_checkno = new System.Windows.Forms.Label();
             this.pa_sccode = new System.Windows.Forms.Label();
             this.ms_makecode = new System.Windows.Forms.Label();
+            this.pa_standardqty = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -802,11 +803,23 @@
             this.ms_makecode.TabIndex = 182;
             this.ms_makecode.Visible = false;
             // 
+            // pa_standardqty
+            // 
+            this.pa_standardqty.AutoSize = true;
+            this.pa_standardqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pa_standardqty.Location = new System.Drawing.Point(1047, 589);
+            this.pa_standardqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pa_standardqty.Name = "pa_standardqty";
+            this.pa_standardqty.Size = new System.Drawing.Size(0, 27);
+            this.pa_standardqty.TabIndex = 183;
+            this.pa_standardqty.Visible = false;
+            // 
             // Make_PackageCollectionWeigh
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1172, 727);
+            this.Controls.Add(this.pa_standardqty);
             this.Controls.Add(this.ms_makecode);
             this.Controls.Add(this.pa_sccode);
             this.Controls.Add(this.pa_checkno);
@@ -909,5 +922,6 @@
         private System.Windows.Forms.Label pr_outboxinnerqty_label;
         private System.Windows.Forms.Label pr_code;
         private System.Windows.Forms.Label ms_makecode;
+        private System.Windows.Forms.Label pa_standardqty;
     }
 }

+ 61 - 54
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -143,23 +143,11 @@ namespace UAS_MES.Make
         {
             //加载表单数据
             string Err = "";
-            if (pa_outboxcode.Text != "")
-            {
-                sql.Clear();
-                sql.Append("select pr_cartonmaxw,pa_makecode,pr_cartonunit,pr_cartonminw,pr_cartongw,pa_outboxcode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,");
-                sql.Append("pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,pr_outboxinnerqty)pr_outboxinnerqty,pa_currentqty from package left join ");
-                sql.Append("product on pa_prodcode=pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
-                Err = "箱号";
-            }
-            else
-            {
-                sql.Clear();
-                sql.Append("select pr_cartonmaxw,pa_makecode,pr_cartonunit,pr_cartonminw,pr_cartongw,ms_makecode,pa_status,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,");
-                sql.Append("pa_checkno,pr_packrule,pr_code,pr_detail,nvl(pa_standardqty,pr_outboxinnerqty) pr_outboxinnerqty,pa_packageqty,pa_currentqty,");
-                sql.Append("pa_outboxcode from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
-                sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
-                Err = "序列号";
-            }
+            sql.Clear();
+            sql.Append("select pr_cartonmaxw,pa_makecode,pr_cartonunit,pr_cartonminw,pr_cartongw,pa_outboxcode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,");
+            sql.Append("pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,pr_outboxinnerqty)pr_outboxinnerqty,pa_currentqty from package left join ");
+            sql.Append("product on pa_prodcode=pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
+            Err = "箱号";
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             if (dt.Rows.Count > 0)
             {
@@ -225,17 +213,31 @@ namespace UAS_MES.Make
                 {
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
                     {
+                        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,nvl(pa_standardqty,pr_outboxinnerqty) ");
+                        sql.Append("pr_outboxinnerqty from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
+                        sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
+                        dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
+                            BaseUtil.SetFormValue(this.Controls, dt);
+                        }
+                        if (pa_standardqty.Text != "0")
+                        {
+                            pr_outboxinnerqty.Text = pa_standardqty.Text;
+                        }
                         if (pa_outboxcode.Text == "")
                         {
-                            LoadData();
-                            if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
+                            string boxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
+                            if (boxcode != "")
+                            {
+                                pa_outboxcode.Text = boxcode;
                                 LoadGridData();
+                            }
                             else
                             {
-                                pa_outboxcode.MakeCode = pa_makecode.Text;
-                                pa_outboxcode.ProdCode = pr_code.Text;
-                                pa_outboxcode.Caller = "PACKAGE";
-                                if (AutoGenBoxCode.Checked)
+                                if (AutoGenBoxCode.Checked && (pa_status.Text == "1" || pa_status.Text == ""))
                                     pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
                             }
                         }
@@ -244,41 +246,44 @@ namespace UAS_MES.Make
                             OperateResult.AppendText(">>箱号不能为空\n", Color.Red, sn_code);
                             return;
                         }
-                        //按工单核对装箱
-                        switch (pr_packrule.Text.ToUpper())
+                        if (pa_status.Text != "1")
                         {
-                            case "MAKE":
-                                if (dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_id='" + oMsID + "'").ToString() != pa_makecode.Text)
-                                {
-                                    OperateResult.AppendText(">>序列号" + sn_code.Text + "所属工单和当前箱号工单不相等\n", Color.Red, sn_code);
-                                    return;
-                                }
-                                break;
-                            case "SALE":
-                                if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
-                                {
-                                    sql.Clear();
-                                    sql.Append("select 1 from package left join make on pa_salecode=ma_salecode left join makeserial ");
-                                    sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
-                                    DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                    if (dt.Rows.Count == 0)
+                            //按工单核对装箱
+                            switch (pr_packrule.Text.ToUpper())
+                            {
+                                case "MAKE":
+                                    if (dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_id='" + oMsID + "'").ToString() != pa_makecode.Text)
                                     {
-                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号和当前箱号订单不相等\n", Color.Red, sn_code);
+                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "所属工单和当前箱号工单不相等\n", Color.Red, sn_code);
                                         return;
                                     }
-                                }
-                                break;
-                            case "PROD":
-                                if (dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id='" + oMsID + "'").ToString() != pr_code.Text)
-                                {
-                                    OperateResult.AppendText(">>序列号" + sn_code.Text + "对应物料和该箱所装物料不同\n", Color.Red, sn_code);
-                                    return;
-                                }
-                                break;
-                            case "MIX":
-                                break;
-                            default:
-                                break;
+                                    break;
+                                case "SALE":
+                                    if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
+                                    {
+                                        sql.Clear();
+                                        sql.Append("select 1 from package left join make on pa_salecode=ma_salecode left join makeserial ");
+                                        sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
+                                        DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                                        if (dt.Rows.Count == 0)
+                                        {
+                                            OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号和当前箱号订单不相等\n", Color.Red, sn_code);
+                                            return;
+                                        }
+                                    }
+                                    break;
+                                case "PROD":
+                                    if (dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id='" + oMsID + "'").ToString() != pr_code.Text)
+                                    {
+                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "对应物料和该箱所装物料不同\n", Color.Red, sn_code);
+                                        return;
+                                    }
+                                    break;
+                                case "MIX":
+                                    break;
+                                default:
+                                    break;
+                            }
                         }
                         //判断箱内总数必须大于0
                         if (pr_outboxinnerqty.Text == "" || pr_outboxinnerqty.Text == "0")
@@ -339,6 +344,7 @@ namespace UAS_MES.Make
                             {
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "取消采集成功", sn_code.Text, "");
                                 LoadGridData();
+                                pa_status.Text = "0";
                                 OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.Green, sn_code);
                             }
                             else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sn_code);
@@ -393,6 +399,7 @@ namespace UAS_MES.Make
             {
                 dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                 pa_status.Text = "1";
+                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "封箱成功", pa_outboxcode.Text, "");
                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "封箱成功\n", Color.Green);
             }
             else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "错误或者已封箱\n", Color.Red);