浏览代码

出库带采集按订单出货验证带采集数不能为负

Hcsy 8 年之前
父节点
当前提交
7472afac99
共有 1 个文件被更改,包括 66 次插入55 次删除
  1. 66 55
      UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.cs

+ 66 - 55
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.cs

@@ -76,7 +76,7 @@ namespace UAS_MES.Warehouse
             {
                 BaseUtil.SetFormValue(this.Controls, dtpi);
             }
-         
+
             if (pi_type.Text == "按订单出货")
             {
                 sql.Clear();
@@ -155,58 +155,66 @@ namespace UAS_MES.Warehouse
 
         private void ProdDetail_Click(object sender, EventArgs e)
         {
-            Warehouse_ProdDetail newpd = new Warehouse_ProdDetail(pi_inoutno.Text,pi_id.Text);
+            Warehouse_ProdDetail newpd = new Warehouse_ProdDetail(pi_inoutno.Text, pi_id.Text);
             BaseUtil.SetFormCenter(newpd);
             newpd.ShowDialog();
         }
 
         private void ConfirmOut_Click(object sender, EventArgs e)
         {
-            String dialog = MessageBox.Show("是否确认出货", "提示", MessageBoxButtons.OKCancel).ToString();
-            if (dialog != "OK")
+            if (ungetqty.Text == "" || int.Parse(ungetqty.Text.ToString()) >= 0)
             {
-                OperateResult.AppendText("取消确认出货\n", Color.Black);
-                return;
-            }
-            else
-            {
-                sql.Clear();
-                sql.Append("select nvl(pi_pdastatus,'未备货')pi_pdastatus,pi_id,pi_type from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                if (dt.Rows.Count > 0)
+                String dialog = MessageBox.Show("是否确认出货", "提示", MessageBoxButtons.OKCancel).ToString();
+                if (dialog != "OK")
                 {
-                    if (dt.Rows[0]["pi_pdastatus"].ToString() == "已出库")
-                    {
-                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "已经出库,无需重复确认\n", Color.Red);
-                        return;
-                    }
-                    else if (dt.Rows[0]["pi_pdastatus"].ToString() == "未备货")
-                    {
-                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "尚未备货,无法确认出货\n", Color.Red);
-                        return;
-                    }
-                    else if (dt.Rows[0]["pi_type"].ToString() == "按订单出货" && dt.Rows[0]["pi_pdastatus"].ToString() == "备货中")
+                    OperateResult.AppendText("取消确认出货\n", Color.Black);
+                    return;
+                }
+                else
+                {
+                    sql.Clear();
+                    sql.Append("select nvl(pi_pdastatus,'未备货')pi_pdastatus,pi_id,pi_type from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
+                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                    if (dt.Rows.Count > 0)
                     {
-                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "未完成备货,无法确认出货\n", Color.Red);
-                        return;
+                        if (dt.Rows[0]["pi_pdastatus"].ToString() == "已出库")
+                        {
+                            OperateResult.AppendText("出货单" + pi_inoutno.Text + "已经出库,无需重复确认\n", Color.Red);
+                            return;
+                        }
+                        else if (dt.Rows[0]["pi_pdastatus"].ToString() == "未备货")
+                        {
+                            OperateResult.AppendText("出货单" + pi_inoutno.Text + "尚未备货,无法确认出货\n", Color.Red);
+                            return;
+                        }
+                        else if (dt.Rows[0]["pi_type"].ToString() == "按订单出货" && dt.Rows[0]["pi_pdastatus"].ToString() == "备货中")
+                        {
+                            OperateResult.AppendText("出货单" + pi_inoutno.Text + "未完成备货,无法确认出货\n", Color.Red);
+                            return;
+                        }
+                        else
+                        {
+                            List<String> ExeSQL = new List<string>();
+                            ExeSQL.Add("update package set pa_status=2 where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode=pa_outboxcode and ((pim_type='PALLET' AND PA_TYPE=3) OR (PIM_TYPE='BOX' AND PA_TYPE IN(1,2)))) AND PA_OUTNO='" + pi_inoutno.Text + "'");
+                            ExeSQL.Add("update prodinout set pi_pdastatus='已出库' where pi_inoutno='" + pi_inoutno.Text + "'");
+                            ExeSQL.Add("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','确认出货','确认出货成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')");
+                            dh.ExecuteSQLTran(ExeSQL.ToArray());
+                            OperateResult.AppendText("出货单" + pi_inoutno.Text + "出库成功\n", Color.Black, pi_inoutno);
+                            BaseUtil.CleanDGVData(InOutDetailDGV);
+                            BaseUtil.CleanControls(panel1.Controls);
+                        }
                     }
                     else
                     {
-                        List<String> ExeSQL = new List<string>();
-                        ExeSQL.Add("update package set pa_status=2 where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode=pa_outboxcode and ((pim_type='PALLET' AND PA_TYPE=3) OR (PIM_TYPE='BOX' AND PA_TYPE IN(1,2)))) AND PA_OUTNO='" + pi_inoutno.Text + "'");
-                        ExeSQL.Add("update prodinout set pi_pdastatus='已出库' where pi_inoutno='" + pi_inoutno.Text + "'");
-                        ExeSQL.Add("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','确认出货','确认出货成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')");
-                        dh.ExecuteSQLTran(ExeSQL.ToArray());   
-                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "出库成功\n", Color.Black,pi_inoutno);
-                        BaseUtil.CleanDGVData(InOutDetailDGV);
-                        BaseUtil.CleanControls(panel1.Controls);
+                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "不存在\n", Color.Red, pi_inoutno);
+                        return;
                     }
                 }
-                else
-                {
-                    OperateResult.AppendText("出货单" + pi_inoutno.Text + "不存在\n", Color.Red, pi_inoutno);
-                    return;
-                }
+            }
+            else
+            {
+                OperateResult.AppendText("出货单" + pi_inoutno.Text + "待采集数不能为负\n", Color.Red);
+                return;
             }
         }
 
@@ -248,7 +256,7 @@ namespace UAS_MES.Warehouse
                         }
                         else if (bigboxBtn.Checked)
                         {
-                            string outboxcode =  dh.getFieldDataByCondition("makeserial","ms_outboxcode","ms_sncode = '"+input.Text+"'").ToString();
+                            string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_sncode = '" + input.Text + "'").ToString();
                             if (outboxcode != "")
                             {
                                 input.Text = outboxcode;
@@ -333,8 +341,9 @@ namespace UAS_MES.Warehouse
                                 }
                             }
                         }
-                        else {
-                            OperateResult.AppendText("未选择录入数据类型\n", Color.Red,input);
+                        else
+                        {
+                            OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
                             return;
                         }
                         LoadFormData();
@@ -344,12 +353,12 @@ namespace UAS_MES.Warehouse
                             if (int.Parse(dtform.Rows[0]["outqty"].ToString()) > int.Parse(dtform.Rows[0]["getqty"].ToString()))
                             {
                                 dh.UpdateByCondition("prodinout", "pi_pdastatus='备货中'", "pi_inoutno='" + pi_inoutno.Text + "'");
-                                OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功\n", Color.Black,input);
+                                OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功\n", Color.Black, input);
                             }
                             else
                             {
                                 dh.UpdateByCondition("prodinout", "pi_pdastatus='已备货'", "pi_inoutno='" + pi_inoutno.Text + "'");
-                                OperateResult.AppendText("出货单" + pi_inoutno.Text + "已完成备货\n", Color.Black,input);
+                                OperateResult.AppendText("出货单" + pi_inoutno.Text + "已完成备货\n", Color.Black, input);
                                 ConfirmOut_Click(sender, e);
                                 return;
                             }
@@ -357,7 +366,7 @@ namespace UAS_MES.Warehouse
                         else if (dta.Rows[0]["pi_type"].ToString() == "自由出货")
                         {
                             dh.UpdateByCondition("prodinout", "pi_pdastatus='备货中'", "pi_inoutno='" + pi_inoutno.Text + "'");
-                            OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功\n", Color.Black,input);
+                            OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功\n", Color.Black, input);
                         }
                     }
                     else
@@ -375,16 +384,17 @@ namespace UAS_MES.Warehouse
                         if (palletBtn.Checked)
                         {
                             sql.Clear();
-                            sql.Append("select * from prodiomac where pim_inoutno='"+ pi_inoutno.Text + "' and pim_outboxcode='"+input.Text+"' and pim_type='PALLET'");
+                            sql.Append("select * from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='PALLET'");
                             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                             if (dt.Rows.Count > 0)
                             {
                                 dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='PALLET'", "delete");
-                                dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='"+input.Text+ "'");
-                                OperateResult.AppendText("栈板号" + input.Text + "取消备货成功\n", Color.Black,input);
+                                dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='" + input.Text + "'");
+                                OperateResult.AppendText("栈板号" + input.Text + "取消备货成功\n", Color.Black, input);
                             }
-                            else {
-                                OperateResult.AppendText("栈板号" + input.Text + "不在备货数据中\n", Color.Red,input);
+                            else
+                            {
+                                OperateResult.AppendText("栈板号" + input.Text + "不在备货数据中\n", Color.Red, input);
                                 return;
                             }
                         }
@@ -425,7 +435,7 @@ namespace UAS_MES.Warehouse
                                 else
                                 {
                                     dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_mac='" + input.Text + "'", "delete");
-                                    dh.UpdateByCondition("makeserial", "ms_iostatus=1", "ms_sncode='"+input.Text+"' and ms_prodcode='"+ dt.Rows[0]["pim_prodcode"].ToString() + "' and ms_iostatus=2");
+                                    dh.UpdateByCondition("makeserial", "ms_iostatus=1", "ms_sncode='" + input.Text + "' and ms_prodcode='" + dt.Rows[0]["pim_prodcode"].ToString() + "' and ms_iostatus=2");
                                     OperateResult.AppendText("序列号" + input.Text + "取消备货成功\n", Color.Black, input);
                                 }
                             }
@@ -470,13 +480,13 @@ namespace UAS_MES.Warehouse
             {
                 pib_type = "PALLET";
             }
-            else if(type == "箱号")
+            else if (type == "箱号")
             {
                 pib_type = "BOX";
             }
             sql.Clear();
             sql.Append("insert into prodiomac(pim_id,pim_inoutno,pim_piid,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type,pim_outboxcode)");
-            sql.Append("select prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "',v_prodcode,v_barcode,sysdate,'" + User.UserCode + "','"+ pib_type + "','" + input.Text + "' from mes_package_view where v_outboxcode='" + input.Text + "'");
+            sql.Append("select prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "',v_prodcode,v_barcode,sysdate,'" + User.UserCode + "','" + pib_type + "','" + input.Text + "' from mes_package_view where v_outboxcode='" + input.Text + "'");
             dh.ExecuteSql(sql.GetString(), "insert");
         }
 
@@ -567,9 +577,10 @@ namespace UAS_MES.Warehouse
                 ExeSQL.Add("update prodinout set pi_pdastatus='未备货' where pi_inoutno='" + pi_inoutno.Text + "'");
                 ExeSQL.Add("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','清除全部备货明细','清除备货明细成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')");
                 dh.ExecuteSQLTran(ExeSQL.ToArray());
-                OperateResult.AppendText("出货单" + pi_inoutno.Text + "取消明细成功\n", Color.Black,input);
+                OperateResult.AppendText("出货单" + pi_inoutno.Text + "取消明细成功\n", Color.Black, input);
             }
-            else {
+            else
+            {
                 OperateResult.AppendText("出货单" + pi_inoutno.Text + "不存在\n", Color.Red, pi_inoutno);
                 return;
             }