Browse Source

发货计划生成销售出库单新增字段

hu 1 tháng trước cách đây
mục cha
commit
dc9cc4fcb1

+ 7 - 6
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -1610,12 +1610,13 @@ public class Order extends Controller {
 
         Row orderRow = rows.get(0);
         Rows departmenthrrows =dbConnect.runSqlQuery("select t1.*,t2.depname from sys_departmenthrid t1 left join sys_department t2 on t1.departmentid=t2.departmentid where t1.hrid="+hrid);
-
+        Rows accountbalancerows = dbConnect.runSqlQuery("select * from  sa_accountbalance t1 inner join sa_accountclass t2 on  t1.sa_accountclassid=t2.sa_accountclassid and t1.siteid=t2.siteid where t2.accountname='现金账户' and t1.sys_enterpriseid=" + orderRow.getLong("sys_enterpriseid"));
         long st_stockbillid = createTableID("st_stockbill");
         InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "st_stockbill");
         insertSQL.setUniqueid(st_stockbillid);
         insertSQL.setSiteid(siteid);
         insertSQL.setValue("sys_enterpriseid", orderRow.getLong("sys_enterpriseid"));
+        insertSQL.setValue("sa_accountclassid",accountbalancerows.isNotEmpty()?accountbalancerows.get(0).getLong("sa_accountclassid"):0);
         insertSQL.setValue("rec_contactsid",  orderRow.getLong("rec_contactsid"));
         insertSQL.setValue("departmentid", departmenthrrows.isNotEmpty()?departmenthrrows.get(0).getLong("departmentid"):0);
         insertSQL.setValue("stockid", 0);
@@ -1697,7 +1698,6 @@ public class Order extends Controller {
         dbConnect.runSqlUpdate(sqlList);
 
         String depname= departmenthrrows.isNotEmpty()?departmenthrrows.get(0).getString("depname"):"";
-        Rows accountbalancerows = dbConnect.runSqlQuery("select * from  sa_accountbalance t1 inner join sa_accountclass t2 on  t1.sa_accountclassid=t2.sa_accountclassid and t1.siteid=t2.siteid where t2.accountname='现金账户' and t1.sys_enterpriseid=" + orderRow.getLong("sys_enterpriseid"));
         if(depname.equals("售后部")){
             if(accountbalancerows.isNotEmpty()){
                 if(accountbalancerows.get(0).getBigDecimal("discountamount").compareTo(BigDecimal.ZERO)>0){
@@ -1770,13 +1770,13 @@ public class Order extends Controller {
         Row orderRow = rows.get(0);
         Rows departmenthrrows =dbConnect.runSqlQuery("select t1.*,t2.depname from sys_departmenthrid t1 left join sys_department t2 on t1.departmentid=t2.departmentid where t1.hrid="+hrid);
         Rows accountbalancerows = dbConnect.runSqlQuery("select * from  sa_accountbalance t1 inner join sa_accountclass t2 on  t1.sa_accountclassid=t2.sa_accountclassid and t1.siteid=t2.siteid where t2.accountname='现金账户' and t1.sys_enterpriseid=" + orderRow.getLong("sys_enterpriseid"));
-
         long st_stockbillid = createTableID("st_stockbill");
         InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "st_stockbill");
         insertSQL.setUniqueid(st_stockbillid);
         insertSQL.setSiteid(siteid);
         insertSQL.setValue("sys_enterpriseid", orderRow.getLong("sys_enterpriseid"));
         insertSQL.setValue("rec_contactsid",  orderRow.getLong("rec_contactsid"));
+        insertSQL.setValue("sa_accountclassid",accountbalancerows.isNotEmpty()?accountbalancerows.get(0).getLong("sa_accountclassid"):0);
         insertSQL.setValue("departmentid", departmenthrrows.isNotEmpty()?departmenthrrows.get(0).getLong("departmentid"):0);
         insertSQL.setValue("stockid", 0);
         insertSQL.setValue("type", "销售出库");
@@ -1788,8 +1788,8 @@ public class Order extends Controller {
         insertSQL.setValue("billno", createBillCode("stockbill"));
 
         insertSQL.setValue("outplace", rowsdetail.get(0).getString("outplace"));
-        insertSQL.setValue("delivery", "");
-        insertSQL.setValue("logisticsmethod", orderRow.getString("logisticsmethod"));
+        insertSQL.setValue("delivery", orderRow.getString("delivery"));
+        insertSQL.setValue("logisticsmethod", "");
         insertSQL.setValue("invoice_enterprisename", orderRow.getString("invoicename"));
         insertSQL.setValue("invoice_address", orderRow.getString("invoiceaddress"));
         insertSQL.setValue("invoice_taxno", orderRow.getString("invoicetaxno"));
@@ -2057,6 +2057,7 @@ public class Order extends Controller {
                     insertSQL.setSiteid(siteid);
                     insertSQL.setValue("sys_enterpriseid", sys_enterpriseid);
                     insertSQL.setValue("rec_contactsid",  orderdetailRows.get(0).getLong("rec_contactsid"));
+                    insertSQL.setValue("sa_accountclassid",accountbalancerows.isNotEmpty()?accountbalancerows.get(0).getLong("sa_accountclassid"):0);
                     insertSQL.setValue("departmentid", departmenthrrows.isNotEmpty()?departmenthrrows.get(0).getLong("departmentid"):0);
                     insertSQL.setValue("stockid", 0);
                     insertSQL.setValue("type", "销售出库");
@@ -2069,7 +2070,7 @@ public class Order extends Controller {
 
                     insertSQL.setValue("outplace", orderdetailRows.get(0).getString("outplace"));
                     insertSQL.setValue("delivery", orderdetailRows.get(0).getString("delivery"));
-                    insertSQL.setValue("logisticsmethod", orderdetailRows.get(0).getString("logisticsmethod"));
+                    insertSQL.setValue("logisticsmethod","");
                     insertSQL.setValue("invoice_enterprisename",enterprisefinancerowsMap.containsKey(sys_enterpriseid)?enterprisefinancerowsMap.get(sys_enterpriseid).get(0).getString("enterprisename"):"");
                     insertSQL.setValue("invoice_address",enterprisefinancerowsMap.containsKey(sys_enterpriseid)?enterprisefinancerowsMap.get(sys_enterpriseid).get(0).getString("address"):"");
                     insertSQL.setValue("invoice_taxno",enterprisefinancerowsMap.containsKey(sys_enterpriseid)?enterprisefinancerowsMap.get(sys_enterpriseid).get(0).getString("taxno"):"");

+ 6 - 2
src/custom/restcontroller/webmanage/sale/sendplan/SQL/销售出库单新增.sql

@@ -1,2 +1,6 @@
-insert into st_stockbill (siteid, st_stockbillid,createby, createdate, billno,billdate,changeby, changedate,checkby,checkdate,sys_enterpriseid, rb,type,remarks,status,departmentid,outplace,rec_contactsid,delivery)
-values ($siteid$, $st_stockbillid$,$createby$, $createdate$, $billno$,$billdate$, $changeby$, $changedate$,$checkby$,$checkdate$,$sys_enterpriseid$,$rb$,$type$,$remarks$,'新建',$departmentid$,$outplace$,$rec_contactsid$,$delivery$);
+insert into st_stockbill (siteid, st_stockbillid,createby, createdate, billno,billdate,changeby, changedate,checkby,checkdate,sys_enterpriseid,
+                          rb,type,remarks,status,departmentid,outplace,rec_contactsid,delivery,logisticsmethod,invoice_enterprisename,invoice_address,
+                          invoice_taxno,name,phonenumber,address)
+values ($siteid$, $st_stockbillid$,$createby$, $createdate$, $billno$,$billdate$, $changeby$, $changedate$,$checkby$,$checkdate$,$sys_enterpriseid$,
+        $rb$,$type$,$remarks$,'新建',$departmentid$,$outplace$,$rec_contactsid$,$delivery$,$logisticsmethod$,$invoice_enterprisename$,$invoice_address$,
+        $invoice_taxno$,$name$,$phonenumber$,$address$);

+ 17 - 2
src/custom/restcontroller/webmanage/sale/sendplan/sendplandetail.java

@@ -367,11 +367,25 @@ public class sendplandetail extends Controller {
                 if (firstItem != null) {
                     sqlFactory.addParameter("outplace", firstItem.getStringValue("outplace"));
                     sqlFactory.addParameter("rec_contactsid", firstItem.getStringValue("rec_contactsid"));
-                    sqlFactory.addParameter("delivery", firstItem.getStringValue("delivery"));
+                    sqlFactory.addParameter("delivery", "");
+                    sqlFactory.addParameter("logisticsmethod", firstItem.getStringValue("logisticsmethod"));
+                    sqlFactory.addParameter("invoice_enterprisename", firstItem.getStringValue("invoicename"));
+                    sqlFactory.addParameter("invoice_address", firstItem.getStringValue("invoiceaddress"));
+                    sqlFactory.addParameter("invoice_taxno", firstItem.getStringValue("invoicetaxno"));
+                    sqlFactory.addParameter("name", firstItem.getStringValue("contact"));
+                    sqlFactory.addParameter("phonenumber", firstItem.getStringValue("phonenumber"));
+                    sqlFactory.addParameter("address", firstItem.getStringValue("address"));
                 } else {
                     sqlFactory.addParameter("outplace", "");
                     sqlFactory.addParameter("rec_contactsid", 0);
                     sqlFactory.addParameter("delivery", "");
+                    sqlFactory.addParameter("logisticsmethod", "");
+                    sqlFactory.addParameter("invoice_enterprisename", "");
+                    sqlFactory.addParameter("invoice_address","");
+                    sqlFactory.addParameter("invoice_taxno", "");
+                    sqlFactory.addParameter("name", "");
+                    sqlFactory.addParameter("phonenumber", "");
+                    sqlFactory.addParameter("address", "");
                 }
 
 
@@ -451,7 +465,8 @@ public class sendplandetail extends Controller {
         sqlFactory.addParameter("siteid", siteid);
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_sendplandetail", "sa_sendplanid", "sa_sendplandetailid", "colorflag", "outplace", "sendqty", "willoutqty", "willinqty", "canuseqty");
         querySQL.setTableAlias("t1");
-        querySQL.addJoinTable(JOINTYPE.left, "sa_order", "t2", "t1.siteid = t2.siteid and t1.sa_orderid = t2.sa_orderid", "sonum", "checkdate", "sys_enterpriseid", "sa_orderid", "rec_contactsid", "delivery", "invoicename", "invoiceaddress");
+        querySQL.addJoinTable(JOINTYPE.left, "sa_order", "t2", "t1.siteid = t2.siteid and t1.sa_orderid = t2.sa_orderid", "sonum", "checkdate", "sys_enterpriseid", "sa_orderid", "rec_contactsid", "delivery","logisticsmethod"
+                , "invoicename", "invoiceaddress","invoicetaxno","contact","phonenumber","address");
         querySQL.addJoinTable(JOINTYPE.left, "sa_orderitems", "t3", "t3.siteid = t1.siteid and t3.sa_orderitemsid = t1.sa_orderitemsid", "rowno", "remarks", "sa_orderitemsid");
         querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t4", "t4.siteid = t1.siteid and t4.sa_agentsid = t1.sa_agentsid", "agentnum");
         querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t5", "t5.siteid = t4.siteid and t5.sys_enterpriseid = t4.sys_enterpriseid", "enterprisename", "abbreviation");