Forráskód Böngészése

限制采集的箱号必须封箱才允许采集

章政 8 éve
szülő
commit
1f3102d88f

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

@@ -135,45 +135,49 @@ namespace UAS_MES.Make
                     //如果未装满的话
                     if (packageqty < pa_stanqty)
                     {
-                        dt = (DataTable)dh.ExecuteSql("select nvl(pa_type,1) pa_type,pa_mothercode from package where pa_outboxcode='"+outboxcode.Text+"'", "select");
+                        dt = (DataTable)dh.ExecuteSql("select nvl(pa_status,1) pa_status,pa_mothercode from package where pa_outboxcode='" + outboxcode.Text + "' and pa_type=1", "select");
                         //采集的卡通箱号存在
-                        if (dt.Rows.Count>0)
+                        if (dt.Rows.Count > 0)
                         {
-                            //判断是否已经装箱
-                            if (dt.Rows[0]["pa_mothercode"].ToString()=="")
+                            if (dt.Rows[0]["pa_status"].ToString() != "1")
                             {
-                                //插入大箱明细
-                                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 + "','" + bigoutboxcode.Text + "','" + outboxcode.Text + "'");
-                                sql.Append(",pa_packageqty 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");
-                                //更新采集的子箱记录母箱号
-                                dh.UpdateByCondition("package", "pa_mothercode='" + bigoutboxcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
-                                if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() == "")
+                                //判断是否已经装箱
+                                if (dt.Rows[0]["pa_mothercode"].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='" + bigoutboxcode.Text + "'", "update");
-                                }
-                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
-                                OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
-                                LoadGridData();
-                                LoadCollectNum();
-                                //判断明细和箱内的件数的差是不是1,如果只相差1则表示此时已经采集慢了
-                                if (packageqty + 1 == pa_stanqty)
-                                {
-                                    if (AutoPrint.Checked)
+                                    //插入大箱明细
+                                    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 + "','" + bigoutboxcode.Text + "','" + outboxcode.Text + "'");
+                                    sql.Append(",pa_packageqty 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");
+                                    //更新采集的子箱记录母箱号
+                                    dh.UpdateByCondition("package", "pa_mothercode='" + bigoutboxcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
+                                    if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + bigoutboxcode.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='" + bigoutboxcode.Text + "'", "update");
+                                    }
+                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
+                                    OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
+                                    LoadGridData();
+                                    LoadCollectNum();
+                                    //判断明细和箱内的件数的差是不是1,如果只相差1则表示此时已经采集慢了
+                                    if (packageqty + 1 == pa_stanqty)
                                     {
-                                        OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
-                                        Printlab.PerformClick();
+                                        if (AutoPrint.Checked)
+                                        {
+                                            OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
+                                            Printlab.PerformClick();
+                                        }
+                                        OperateResult.AppendText(">>大箱" + bigoutboxcode.Text + "已采集满\n", Color.Green);
                                     }
-                                    OperateResult.AppendText(">>大箱" + bigoutboxcode.Text + "已采集满\n", Color.Green);
                                 }
+                                else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "已采集\n", Color.Red, outboxcode);
                             }
-                            else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "已采集\n", Color.Red, outboxcode);
+                            else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "尚未封箱\n", Color.Red, outboxcode);
                         }
                         else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
                     }

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

@@ -122,32 +122,36 @@ namespace UAS_MES.Make
                         Packing_Click(new object(), new EventArgs());
                     }
                     //如果未装满的话
-                    dt = (DataTable)dh.ExecuteSql("select pa_mothercode from package where pa_outboxcode='" + outboxcode.Text + "' and nvl(pa_type,2)=2", "select");
+                    dt = (DataTable)dh.ExecuteSql("select pa_mothercode,nvl(pa_status,0) pa_status from package where pa_outboxcode='" + outboxcode.Text + "' and pa_type=2", "select");
                     if (dt.Rows.Count > 0)
                     {
                         //判断是否已经装箱
                         if (dt.Rows[0]["pa_mothercode"].ToString() == "")
                         {
-                            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(",(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");
-                            //更新大箱的栈板号
-                            dh.UpdateByCondition("package", "pa_mothercode='" + palletcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
-                            LoadCollectNum();
-                            if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + palletcode.Text + "'").ToString() == "")
+                            if (dt.Rows[0]["pa_status"].ToString() != "1")
                             {
-                                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='" + palletcode.Text + "'", "update");
+                                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(",(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");
+                                //更新大箱的栈板号
+                                dh.UpdateByCondition("package", "pa_mothercode='" + palletcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
+                                LoadCollectNum();
+                                if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + palletcode.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='" + palletcode.Text + "'", "update");
+                                }
+                                OperateResult.AppendText(">>箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
+                                LoadGridData();
                             }
-                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
-                            LoadGridData();
+                            else OperateResult.AppendText(">>箱号" + outboxcode.Text + "已采集\n", Color.Red, outboxcode);
                         }
-                        else OperateResult.AppendText(">>箱号" + outboxcode.Text + "已采集\n", Color.Red, outboxcode);
+                        else OperateResult.AppendText(">>箱号" + outboxcode.Text + "尚未封箱\n", Color.Red, outboxcode);
                     }
                     else OperateResult.AppendText(">>箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
                 }