浏览代码

返工数据采集自动拆解箱号

章政 7 年之前
父节点
当前提交
9ef0c3dbab
共有 1 个文件被更改,包括 27 次插入2 次删除
  1. 27 2
      UAS-MES/FunctionCode/Make/Make_GetReMakeSN.cs

+ 27 - 2
UAS-MES/FunctionCode/Make/Make_GetReMakeSN.cs

@@ -244,10 +244,35 @@ namespace UAS_MES.Make
                                 SQLS.Add("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id='" + Msid + "'");
                                 if (ms_outboxcode != "")
                                 {
-                                    //更新箱号失效
+                                    string pamothercode = dh.getFieldDataByCondition("package", "pa_mothercode", "pa_outboxcode='" + ms_outboxcode + "'").ToString();
+                                    //如果已装栈板从栈板解除
+                                    if (pamothercode != "")
+                                    {
+                                        sql.Clear();
+                                        sql.Append("insert into packagebackupdetail(pbd_id,pbd_paid,pbd_outboxcode,pbd_innerboxcode,pbd_barcode,pbd_innerqty,pbd_prodcode,pbd_makecode,pbd_buildate,pbd_ymd)");
+                                        sql.Append("select pd_id,pd_paid,pd_outboxcode,pd_innerboxcode,pd_barcode,pd_innerqty,pd_prodcode,pd_makecode,pd_builddate,pd_ymd from packagedetail where ");
+                                        sql.Append("pd_outboxcode='" + pamothercode + "' and pd_innerboxcode='" + ms_outboxcode + "'");
+                                        SQLS.Add(sql.GetString());
+                                        SQLS.Add("delete from packagedetail where pd_outboxcode='" + pamothercode + "' and pd_innerboxcode='" + ms_outboxcode + "'");
+                                        DataTable dt = dh.getFieldsDatasByCondition("packagedetail left join package on pa_id=pd_paid", new string[] { "nvl(sum(pd_innerqty),0)", "count(1)" }, "pa_outboxcode='" + pamothercode + "'");
+                                        string totalqty = dt.Rows[0][0].ToString();
+                                        string currentqty = dt.Rows[0][1].ToString();
+                                        SQLS.Add("update package set PA_TOTALQTY='" + totalqty + "',pa_packageqty='" + currentqty + "',pa_currentqty='" + currentqty + "' where pa_outboxcode='" + pamothercode + "'");
+                                    }
+                                    //备份和删除卡通箱明细
+                                    sql.Clear();
+                                    sql.Append("insert into packagebackup(pab_id,pab_prodcode,pab_outboxcode,pab_packdate,pab_level,pab_packageqty,pab_totalqty,pab_makecode,pab_status,pab_indate,pab_salecode,pab_printcount,pab_custcode,pab_type,");
+                                    sql.Append("pab_weight,pab_currentqty,pab_standardqty,pab_packtype,pab_checkno,pab_downstatus,pab_sccode,pab_ymd,pab_mothercode,pab_currentstep,pab_nextstep,pab_outno,pab_iostatus,pab_remark) ");
+                                    sql.Append("select pa_id,pa_prodcode,pa_outboxcode,pa_packdate,pa_level,pa_packageqty,pa_totalqty,pa_makecode,pa_status,pa_indate,pa_salecode,pa_printcount,pa_custcode,pa_type,pa_weight,pa_currentqty,");
+                                    sql.Append("pa_standardqty,pa_packtype,pa_checkno,pa_downstatus,pa_sccode,pa_ymd,pa_mothercode,pa_currentstep,pa_nextstep,pa_outno,pa_iostatus,pa_remark from package where pa_outboxcode='" + ms_outboxcode + "'");
+                                    SQLS.Add(sql.GetString());
+                                    SQLS.Add("delete from package where pa_outboxcode='" + ms_outboxcode + "'");
                                     sql.Clear();
-                                    sql.Append("update package set pa_status=-1 where pa_outboxcode='" + ms_outboxcode + "' and pa_status<>-1");
+                                    sql.Append("insert into packagebackupdetail(pbd_id,pbd_paid,pbd_outboxcode,pbd_innerboxcode,pbd_barcode,pbd_innerqty,pbd_prodcode,pbd_makecode,pbd_buildate,pbd_ymd)");
+                                    sql.Append("select pd_id,pd_paid,pd_outboxcode,pd_innerboxcode,pd_barcode,pd_innerqty,pd_prodcode,pd_makecode,pd_builddate,pd_ymd from packagedetail where ");
+                                    sql.Append("pd_outboxcode='" + ms_outboxcode + "'");
                                     SQLS.Add(sql.GetString());
+                                    SQLS.Add("delete from packagedetail where pd_outboxcode='" + ms_outboxcode + "' ");
                                 }
                                 sql.Clear();
                                 sql.Append("update makebad set mb_makecode='" + ms_makecode + "' where mb_sncode ='" + sn_code.Text + "' and mb_status=0");