Parcourir la source

完工从箱内取出更新多层箱内数量

章政 il y a 7 ans
Parent
commit
8cae9d535b

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

@@ -255,7 +255,7 @@ namespace UAS_MES.Make
                         string error;
                         if (int.Parse(pa_totalqty.Text == "" ? "0" : pa_totalqty.Text) > 0)
                         {
-                            if (!LogicHandler.CheckPackRule(pr_packrule.Text, pa_outboxcode.Text, outboxcode.Text, pa_makecode.Text, pa_custcode.Text, pa_prodcode.Text, "大箱", out error))
+                            if (!LogicHandler.CheckPackRule(pr_packrule.Text, pa_outboxcode.Text, outboxcode.Text, pa_makecode.Text, pa_salecode.Text, pa_prodcode.Text, "大箱", out error))
                             {
                                 OperateResult.AppendText(">>" + error + "\n", Color.Red, outboxcode);
                                 return;

+ 42 - 4
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -281,7 +281,7 @@ namespace UAS_MES.Make
                             return;
                         }
                         sql.Clear();
-                        sql.Append("select nvl(pa_iostatus,0)pa_iostatus,pa_outno,pa_mothercode from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
+                        sql.Append("select nvl(pa_iostatus,0)pa_iostatus,pa_outno,pa_mothercode,pa_type from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                         string MotherBoxCode = "";
                         if (dt.Rows.Count > 0)
@@ -367,10 +367,29 @@ namespace UAS_MES.Make
                                     LoadGridData();
                                     LoadCheckQTY();
                                     dh.ExecuteSql("update packagedetail set pd_innerqty=(select pa_packageqty from package where pa_outboxcode='" + pa_outboxcode.Text + "') where pd_innerboxcode='" + pa_outboxcode.Text + "'", "update");
-                                    //如果母箱号不为空,需要更新总数
                                     if (MotherBoxCode != "")
                                     {
-                                        dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "' and pa_type=3", "update");
+                                        dt = (DataTable)dh.ExecuteSql("select pa_mothercode,pa_type from package where pa_outboxcode='" + MotherBoxCode + "'", "select");
+                                        //如果母箱号不为空,需要更新总数
+                                        if (dt.Rows.Count > 0)
+                                        {
+                                            if (dt.Rows[0]["pa_type"].ToString() == "2")
+                                            {
+                                                string MotherCode2 = dt.Rows[0]["pa_mothercode"].ToString();
+                                                //更新大箱数量
+                                                dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
+                                                //外层有栈板则更新栈板数量
+                                                if (MotherCode2 != "")
+                                                {
+                                                    dh.ExecuteSql("update packagedetail set pd_innerqty=(select sum(pd_innerqty) from packagedetail where pd_outboxcode='" + MotherBoxCode + "') where pd_innerboxcode='" + MotherBoxCode + "'", "update");
+                                                    dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherCode2 + "') where pa_outboxcode='" + MotherCode2 + "'", "update");
+                                                }
+                                            }
+                                            if (dt.Rows[0]["pa_type"] == "3")
+                                            {
+                                                dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
+                                            }
+                                        }
                                     }
                                     //采集完后如果是第一个装的序列号,把序列号的NextStepCode赋值给箱号
                                     if (pa_currentqty.Text == "1")
@@ -429,7 +448,26 @@ namespace UAS_MES.Make
                                 //如果母箱号不为空,需要更新总数
                                 if (MotherBoxCode != "")
                                 {
-                                    dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "' and pa_type=3", "update");
+                                    DataTable dt = (DataTable)dh.ExecuteSql("select pa_mothercode,pa_type from package where pa_outboxcode='" + MotherBoxCode + "'", "select");
+                                    if (dt.Rows.Count > 0)
+                                    {
+                                        if (dt.Rows[0]["pa_type"].ToString() == "2")
+                                        {
+                                            string MotherCode2 = dt.Rows[0]["pa_mothercode"].ToString();
+                                            //更新大箱数量
+                                            dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
+                                            //外层有栈板则更新栈板数量
+                                            if (MotherCode2 != "")
+                                            {
+                                                dh.ExecuteSql("update packagedetail set pd_innerqty=(select sum(pd_innerqty) from packagedetail where pd_outboxcode='" + MotherBoxCode + "') where pd_innerboxcode='" + MotherBoxCode + "'", "update");
+                                                dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherCode2 + "') where pa_outboxcode='" + MotherCode2 + "'", "update");
+                                            }
+                                        }
+                                        if (dt.Rows[0]["pa_type"] == "3")
+                                        {
+                                            dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
+                                        }
+                                    }
                                 }
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "卡通箱" + pa_outboxcode.Text + "取消采集成功", sn_code.Text, "");
                                 LoadGridData();

+ 40 - 2
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -401,7 +401,26 @@ namespace UAS_MES.Make
                                     //如果母箱号不为空,需要更新总数
                                     if (MotherBoxCode != "")
                                     {
-                                        dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "' and pa_type=3", "update");
+                                        DataTable dt = (DataTable)dh.ExecuteSql("select pa_mothercode,pa_type from package where pa_outboxcode='" + MotherBoxCode + "'", "select");
+                                        if (dt.Rows.Count > 0)
+                                        {
+                                            if (dt.Rows[0]["pa_type"].ToString() == "2")
+                                            {
+                                                string MotherCode2 = dt.Rows[0]["pa_mothercode"].ToString();
+                                                //更新大箱数量
+                                                dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
+                                                //外层有栈板则更新栈板数量
+                                                if (MotherCode2 != "")
+                                                {
+                                                    dh.ExecuteSql("update packagedetail set pd_innerqty=(select sum(pd_innerqty) from packagedetail where pd_outboxcode='" + MotherBoxCode + "') where pd_innerboxcode='" + MotherBoxCode + "'", "update");
+                                                    dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherCode2 + "') where pa_outboxcode='" + MotherCode2 + "'", "update");
+                                                }
+                                            }
+                                            if (dt.Rows[0]["pa_type"] == "3")
+                                            {
+                                                dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
+                                            }
+                                        }
                                     }
                                     //采集完后如果是第一个装的序列号,把序列号的NextStepCode赋值给箱号
                                     if (pa_currentqty.Text == "1")
@@ -471,7 +490,26 @@ namespace UAS_MES.Make
                                 //如果母箱号不为空,需要更新总数
                                 if (MotherBoxCode != "")
                                 {
-                                    dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "' and pa_type=3", "update");
+                                    DataTable dt = (DataTable)dh.ExecuteSql("select pa_mothercode,pa_type from package where pa_outboxcode='" + MotherBoxCode + "'", "select");
+                                    if (dt.Rows.Count > 0)
+                                    {
+                                        if (dt.Rows[0]["pa_type"].ToString() == "2")
+                                        {
+                                            string MotherCode2 = dt.Rows[0]["pa_mothercode"].ToString();
+                                            //更新大箱数量
+                                            dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
+                                            //外层有栈板则更新栈板数量
+                                            if (MotherCode2 != "")
+                                            {
+                                                dh.ExecuteSql("update packagedetail set pd_innerqty=(select sum(pd_innerqty) from packagedetail where pd_outboxcode='" + MotherBoxCode + "') where pd_innerboxcode='" + MotherBoxCode + "'", "update");
+                                                dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherCode2 + "') where pa_outboxcode='" + MotherCode2 + "'", "update");
+                                            }
+                                        }
+                                        if (dt.Rows[0]["pa_type"] == "3")
+                                        {
+                                            dh.ExecuteSql("update package set PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + MotherBoxCode + "') where pa_outboxcode='" + MotherBoxCode + "'", "update");
+                                        }
+                                    }
                                 }
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "卡通箱" + pa_outboxcode.Text + "取消采集成功", sn_code.Text, "");
                                 LoadGridData();