Преглед изворни кода

物流单审核反审核更新发货单表体的已核销金额

沈静伟 пре 4 година
родитељ
комит
37d3b82f49
2 измењених фајлова са 17 додато и 3 уклоњено
  1. 15 3
      src/apps/salogis/salogis.java
  2. 2 0
      src/apps/salogis/salogisAppBean.java

+ 15 - 3
src/apps/salogis/salogis.java

@@ -194,19 +194,19 @@ public class salogis extends PaoCust {
 //                "group by t4.saorderdetailid,t4.finvoiceamount\n" +
 //                ")t where t.finvoiceamount-t.finvoiceamount2>0");
 
-        Rows rows=dbConnect.runSqlQuery("\n" +
+        Rows rows = dbConnect.runSqlQuery("\n" +
                 "select convert(bigint,t.saorderdetailid)as saorderdetailid,sum(t.finvoiceamount)-sum(t.finvoiceamount2) as finvoiceamount  from (\n" +
                 "\tselect t4.saorderdetailid,isnull(t4.finvoiceamount,0)as finvoiceamount,0 finvoiceamount2 from salogis t1\n" +
                 "\tinner join salogisdetail t2 on t1.salogisid=t2.fparentid\n" +
                 "\tinner join sainvoicedetail t3 on t2.fsourceid=t3.fparentid and t2.fsourceobject='SAINVOICE'\n" +
                 "\tinner join saorderdetail t4 on t3.fsourceid=t4.saorderdetailid\n" +
-                "\twhere t1.salogisid='"+getUniqueIDValue()+"'\n" +
+                "\twhere t1.salogisid='" + getUniqueIDValue() + "'\n" +
                 "\tunion all\n" +
                 "\tselect t4.fsourceid,0 as finvoiceamount,isnull(t4.finvoiceamount,0) as finvoiceamount2 from salogis t1\n" +
                 "\tinner join salogisdetail t2 on t1.salogisid=t2.fparentid\n" +
                 "\tinner join sainvoicedetail t3 on t2.fsourceid=t3.fparentid and t2.fsourceobject='SAINVOICE'\n" +
                 "\tinner join sainvoicedetail t4 on t3.fsourceid=t4.fsourceid\n" +
-                "\twhere t1.salogisid='"+getUniqueIDValue()+"'\n" +
+                "\twhere t1.salogisid='" + getUniqueIDValue() + "'\n" +
                 "\t\n" +
                 ")t \n" +
                 "group by t.saorderdetailid\n" +
@@ -311,6 +311,18 @@ public class salogis extends PaoCust {
         }
     }
 
+    /**
+     * 更新发货单已核销数量
+     * @throws P2Exception
+     */
+    public void updatesainvoicewriteamount() throws P2Exception {
+        DBConnect dbConnect = new DBConnect();
+        Rows rows = dbConnect.runSqlQuery("select t2.fsourceid as saorderdetailid from salogisdetail t1 inner join sainvoicedetail t2 on t1.fsourceid=t2.fparentid where t1.fparentid='" + getUniqueIDValue() + "'");
+        for (Row row : rows) {
+            dbConnect.runSqlUpdate("exec updatesainvoicewriteoffamount " + row.getString("saorderdetailid"));
+        }
+    }
+
     /**
      * 收货确认验证
      *

+ 2 - 0
src/apps/salogis/salogisAppBean.java

@@ -41,6 +41,7 @@ public class salogisAppBean extends AppBeanCust {
         salogis.check(true);
         this.SAVE();
         byrefresh();
+        salogis.updatesainvoicewriteamount();
         return super.CHECK();
     }
 
@@ -52,6 +53,7 @@ public class salogisAppBean extends AppBeanCust {
         salogis.check(false);
         this.SAVE();
         byrefresh();
+        salogis.updatesainvoicewriteamount();
         return super.UNCHECK();
     }