Browse Source

可以直接从箱内拿出,栈板数量同时-1

章政 8 years ago
parent
commit
855ffb5a27

+ 14 - 2
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -270,12 +270,12 @@ namespace UAS_MES.Make
                         sql.Clear();
                         sql.Append("select nvl(pa_iostatus,0)pa_iostatus,pa_outno,pa_mothercode from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                        string MotherBoxCode = "";
                         if (dt.Rows.Count > 0)
                         {
                             if (dt.Rows[0]["pa_mothercode"].ToString() != "")
                             {
-                                OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "已被大箱或栈板" + dt.Rows[0]["pa_mothercode"].ToString() + "采集,不允许操作\n", Color.Red, sn_code);
-                                return;
+                                MotherBoxCode = dt.Rows[0]["pa_mothercode"].ToString();
                             }
                             if (dt.Rows[0]["pa_outno"].ToString() != "")
                             {
@@ -329,6 +329,12 @@ namespace UAS_MES.Make
                                     LoadData();
                                     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");
+                                    }
                                     //采集完后如果是第一个装的序列号,把序列号的NextStepCode赋值给箱号
                                     if (pa_currentqty.Text == "1")
                                     {
@@ -364,6 +370,12 @@ namespace UAS_MES.Make
                         {
                             if (LogicHandler.Packing(sn_code.Text, pa_outboxcode.Text, AutoGenBoxCode.Checked, "标准", User.UserSourceCode, User.UserCode, pr_outboxinnerqty.Text, Cancel.Checked, out oOutBoxCode, out ErrorMessage))
                             {
+                                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");
+                                }
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "卡通箱" + pa_outboxcode.Text + "取消采集成功", sn_code.Text, "");
                                 LoadGridData();
                                 pa_status.Text = "0";

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

@@ -345,12 +345,12 @@ namespace UAS_MES.Make
                         sql.Clear();
                         sql.Append("select nvl(pa_iostatus,0) pa_iostatus,pa_outno,pa_mothercode from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                        string MotherBoxCode = "";
                         if (dt.Rows.Count > 0)
                         {
                             if (dt.Rows[0]["pa_mothercode"].ToString() != "")
                             {
-                                OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "已被大箱或栈板" + dt.Rows[0]["pa_mothercode"].ToString() + "采集,不允许操作\n", Color.Red, sn_code);
-                                return;
+                                MotherBoxCode = dt.Rows[0]["pa_mothercode"].ToString();
                             }
                             if (dt.Rows[0]["pa_outno"].ToString() != "")
                             {
@@ -402,6 +402,12 @@ namespace UAS_MES.Make
                                     LastSncode = sn_code.Text;
                                     //满箱更新状态为1
                                     LoadData();
+                                    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");
+                                    }
                                     //采集完后如果是第一个装的序列号,把序列号的NextStepCode赋值给箱号
                                     if (pa_currentqty.Text == "1")
                                     {
@@ -432,6 +438,7 @@ namespace UAS_MES.Make
                                         LogicHandler.CartonBoxStepPass(pa_makecode.Text, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
                                         dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                         LoadCheckQTY();
+
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量完成\n", Color.Green);
                                         if (AutoPrint.Checked)
                                             Print_Click(new object(), new EventArgs());
@@ -447,6 +454,12 @@ namespace UAS_MES.Make
                         {
                             if (LogicHandler.Packing(sn_code.Text, pa_outboxcode.Text, AutoGenBoxCode.Checked, "标准", User.UserSourceCode, User.UserCode, pr_outboxinnerqty.Text, Cancel.Checked, out oOutBoxCode, out ErrorMessage))
                             {
+                                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");
+                                }
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "卡通箱" + pa_outboxcode.Text + "取消采集成功", sn_code.Text, "");
                                 LoadGridData();
                                 pa_status.Text = "0";