Procházet zdrojové kódy

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy před 8 roky
rodič
revize
ae5d12d52d
1 změnil soubory, kde provedl 13 přidání a 3 odebrání
  1. 13 3
      UAS-MES/FunctionCode/Make/Make_BigBoxCollection.cs

+ 13 - 3
UAS-MES/FunctionCode/Make/Make_BigBoxCollection.cs

@@ -135,17 +135,23 @@ namespace UAS_MES.Make
                     //如果未装满的话
                     if (packageqty < pa_stanqty)
                     {
-                        if (dh.CheckExist("Package", "pa_outboxcode='" + outboxcode.Text + "' and nvl(pa_type,1)=1"))
+                        dt = (DataTable)dh.ExecuteSql("select nvl(pa_type,1) pa_type,pa_mothercode from package where pa_outboxcode='"+outboxcode.Text+"'", "select");
+                        //采集的卡通箱号存在
+                        if (dt.Rows.Count>0)
                         {
                             //判断是否已经装箱
-                            if (!dh.CheckExist("PackageDetail", "pd_innerboxcode='" + outboxcode.Text + "'"))
+                            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 + "','" + 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();
@@ -240,8 +246,12 @@ namespace UAS_MES.Make
 
         private void ReleasePallet_Click(object sender, EventArgs e)
         {
+            //将子箱的母箱编号置成空
+            dh.ExecuteSql("update package set pa_mothercode='' where pa_outboxcode in(select PD_INNERBOXCODE from package left join packagedetail on pa_id=pd_paid where pa_outboxcode='" + bigoutboxcode.Text + "')", "update");
+            //删除采集的明细
             dh.ExecuteSql("delete from packagedetail where pd_paid=(select pa_id from package where pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2)", "delete");
-            dh.ExecuteSql("update package set pa_totalqty=0,pa_packageqty=0 where pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2", "update");
+            //更新大箱数量为空
+            dh.ExecuteSql("update package set pa_totalqty=0,pa_currentqty=0,pa_packageqty=0 where pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2", "update");
             OperateResult.AppendText(">>箱号" + outboxcode.Text + "解除成功\n", Color.Green);
             LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "解除大箱" + outboxcode.Text + "成功", bigoutboxcode.Text, "");
             palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));