瀏覽代碼

已入库的箱号不允许再采集

章政 8 年之前
父節點
當前提交
34f2b2f37a
共有 2 個文件被更改,包括 66 次插入34 次删除
  1. 33 17
      UAS-MES/FunctionCode/Make/Make_BigBoxCollection.cs
  2. 33 17
      UAS-MES/FunctionCode/Make/Make_PalletCollection.cs

+ 33 - 17
UAS-MES/FunctionCode/Make/Make_BigBoxCollection.cs

@@ -113,8 +113,14 @@ namespace UAS_MES.Make
                         OperateResult.AppendText(">>卡通箱号不能为空\n", Color.Red);
                         return;
                     }
+                    string pallteiostatus = dh.getFieldDataByCondition("package", "nvl(pa_iostatus,0)", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
+                    if (pallteiostatus != "" && pallteiostatus != "0")
+                    {
+                        OperateResult.AppendText(">>大箱" + pa_outboxcode.Text + "已入库不允许采集\n", Color.Red, outboxcode);
+                        return;
+                    }
                     sql.Clear();
-                    sql.Append("select pa_makecode pd_makecode,nvl(pa_downstatus,0)pa_downstatus,pa_salecode pd_salecode,pr_packrule,pa_id,pa_prodcode pd_prodcode,pa_status,pa_mothercode,pa_nextstep,nvl(pr_bigboxinnerqty,0) pa_standardqty  ");
+                    sql.Append("select nvl(pa_iostatus,0)pa_iostatus,pa_makecode pd_makecode,nvl(pa_downstatus,0)pa_downstatus,pa_salecode pd_salecode,pr_packrule,pa_id,pa_prodcode pd_prodcode,pa_status,pa_mothercode,pa_nextstep,nvl(pr_bigboxinnerqty,0) pa_standardqty  ");
                     sql.Append("from packagedetail left join package on pd_paid=pa_id left join product on pd_prodcode=pr_code where pd_outboxcode='" + outboxcode.Text + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     //判断采集的卡通箱是否有明细
@@ -126,6 +132,11 @@ namespace UAS_MES.Make
                             OperateResult.AppendText(">>箱号" + outboxcode.Text + "下地状态不允许采集\n", Color.Red, outboxcode);
                             return;
                         }
+                        if (dt.Rows[0]["pa_iostatus"].ToString() != "0")
+                        {
+                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "已入库不允许采集\n", Color.Red, outboxcode);
+                            return;
+                        }
                         //之前装过箱加载明细
                         if (dt.Rows[0]["pa_mothercode"].ToString() != "")
                         {
@@ -293,24 +304,29 @@ namespace UAS_MES.Make
                     }
                     else
                     {
-                        if (dh.CheckExist("packagedetail", "pd_outboxcode='" + pa_outboxcode.Text + "' and pd_innerboxcode='" + outboxcode.Text + "'"))
-                        {
-                            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=pa_currentqty-1,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());
-                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "取消采集成功\n", Color.Green);
-                            LoadCollectNum();
-                            LoadGridData();
-                            outboxcode.Clear();
-                        }
-                        else
+                        sql.Clear();
+                        sql.Append("select nvl(pa_iostatus,0)pa_iostatus from packagedetail left join package on pa_id =pd_paid where pd_outboxcode='" + pa_outboxcode.Text + "' ");
+                        sql.Append("and pd_innerboxcode='" + outboxcode.Text + "'");
+                        DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                        if (dt.Rows.Count > 0)
                         {
-                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "不在大箱" + pa_outboxcode.Text + "\n", Color.Green);
+                            if (dt.Rows[0]["pa_iostatus"].ToString() == "0")
+                            {
+                                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=pa_currentqty-1,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());
+                                OperateResult.AppendText(">>箱号" + outboxcode.Text + "取消采集成功\n", Color.Green);
+                                LoadCollectNum();
+                                LoadGridData();
+                                outboxcode.Clear();
+                            }
+                            else OperateResult.AppendText(">>大箱" + pa_outboxcode.Text + "已入库,不允许取消采集\n", Color.Red);
                         }
+                        else OperateResult.AppendText(">>箱号" + outboxcode.Text + "不在大箱" + pa_outboxcode.Text + "\n", Color.Red);
                     }
                 }
                 else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, outboxcode);

+ 33 - 17
UAS-MES/FunctionCode/Make/Make_PalletCollection.cs

@@ -110,8 +110,14 @@ namespace UAS_MES.Make
                         OperateResult.AppendText(">>箱号不能为空\n", Color.Red);
                         return;
                     }
+                    string pallteiostatus = dh.getFieldDataByCondition("package", "nvl(pa_iostatus,0)", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
+                    if (pallteiostatus != "" && pallteiostatus != "0")
+                    {
+                        OperateResult.AppendText(">>栈板" + pa_outboxcode.Text + "已入库不允许采集\n", Color.Red, outboxcode);
+                        return;
+                    }
                     sql.Clear();
-                    sql.Append("select pa_makecode pd_makecode,nvl(pa_downstatus,0)pa_downstatus,pa_salecode pd_salecode,pr_packrule,pa_id,pa_prodcode pd_prodcode,pa_status,pa_mothercode,pa_nextstep  ");
+                    sql.Append("select nvl(pa_iostatus,0)pa_iostatus,pa_makecode pd_makecode,nvl(pa_downstatus,0)pa_downstatus,pa_salecode pd_salecode,pr_packrule,pa_id,pa_prodcode pd_prodcode,pa_status,pa_mothercode,pa_nextstep  ");
                     sql.Append("from packagedetail left join package on pd_paid=pa_id left join product on pd_prodcode=pr_code where pd_outboxcode='" + outboxcode.Text + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     if (dt.Rows.Count > 0)
@@ -122,6 +128,11 @@ namespace UAS_MES.Make
                             OperateResult.AppendText(">>箱号" + outboxcode.Text + "下地状态不允许采集\n", Color.Red, outboxcode);
                             return;
                         }
+                        if (dt.Rows[0]["pa_iostatus"].ToString() != "0")
+                        {
+                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "已入库不允许采集\n", Color.Red, outboxcode);
+                            return;
+                        }
                         if (dt.Rows[0]["pa_mothercode"].ToString() != "")
                         {
                             if (pa_outboxcode.Text == "")
@@ -275,24 +286,29 @@ namespace UAS_MES.Make
                     //进行拆箱操作
                     else
                     {
-                        if (dh.CheckExist("packagedetail", "pd_outboxcode='" + pa_outboxcode.Text + "' and pd_innerboxcode='" + outboxcode.Text + "'"))
-                        {
-                            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=pa_currentqty-1,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());
-                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "取消采集成功\n", Color.Green);
-                            LoadCollectNum();
-                            LoadGridData();
-                            outboxcode.Clear();
-                        }
-                        else
+                        sql.Clear();
+                        sql.Append("select nvl(pa_iostatus,0)pa_iostatus from packagedetail left join package on pa_id =pd_paid where pd_outboxcode='" + pa_outboxcode.Text + "' ");
+                        sql.Append("and pd_innerboxcode='" + outboxcode.Text + "'");
+                        DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                        if (dt.Rows.Count > 0)
                         {
-                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "不在栈板" + pa_outboxcode.Text + "\n", Color.Green);
+                            if (dt.Rows[0]["pa_iostatus"].ToString() == "0")
+                            {
+                                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=pa_currentqty-1,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());
+                                OperateResult.AppendText(">>箱号" + outboxcode.Text + "取消采集成功\n", Color.Green);
+                                LoadCollectNum();
+                                LoadGridData();
+                                outboxcode.Clear();
+                            }
+                            else OperateResult.AppendText(">>栈板" + pa_outboxcode.Text + "已入库,不允许取消采集\n", Color.Red);
                         }
+                        else OperateResult.AppendText(">>箱号" + outboxcode.Text + "不在栈板" + pa_outboxcode.Text + "\n", Color.Red);
                     }
                 }
             }