|
@@ -214,10 +214,10 @@ public class stockbill extends Controller {
|
|
|
updateSQL.setValue("isconfirm", isconfirm);
|
|
updateSQL.setValue("isconfirm", isconfirm);
|
|
|
if (type.equals("销售出库")) {
|
|
if (type.equals("销售出库")) {
|
|
|
updateSQL.setValue("payamount", content.getBigDecimal("payamount"));
|
|
updateSQL.setValue("payamount", content.getBigDecimal("payamount"));
|
|
|
- updateSQL.setValue("paydiscountamount", content.getBigDecimal("paydiscountamount"));
|
|
|
|
|
|
|
+ updateSQL.setValue("paydiscountamount", content.getString("rb").equals("1")?content.getBigDecimal("paydiscountamount"):content.getBigDecimal("paydiscountamount").negate());
|
|
|
if (content.getBigDecimal("payamount").compareTo(rows.get(0).getBigDecimal("payamount")) != 0
|
|
if (content.getBigDecimal("payamount").compareTo(rows.get(0).getBigDecimal("payamount")) != 0
|
|
|
- || content.getBigDecimal("paydiscountamount").compareTo(rows.get(0).getBigDecimal("paydiscountamount")) != 0) {
|
|
|
|
|
- sqlList.add(DataContrlLog.createLog(this, "st_stockbill", st_stockbillid, "金额更新变更", "销售出库单更支付金额:" + content.getBigDecimal("payamount") + ",优惠金额:" + content.getBigDecimal("paydiscountamount")).getSQL());
|
|
|
|
|
|
|
+ || content.getBigDecimal("paydiscountamount").abs().compareTo(rows.get(0).getBigDecimal("paydiscountamount").abs()) != 0) {
|
|
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "st_stockbill", st_stockbillid, "金额更新变更", "销售出库单更支付金额:" + content.getBigDecimal("payamount") + ",优惠金额:" + (content.getString("rb").equals("1")?content.getBigDecimal("paydiscountamount"):content.getBigDecimal("paydiscountamount").negate())).getSQL());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -299,6 +299,7 @@ public class stockbill extends Controller {
|
|
|
Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
|
|
Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
|
|
|
Rows rowsdetail = dbConnect.runSqlQuery("select amount,qty from st_stockbill_items where st_stockbillid=" + st_stockbillid);
|
|
Rows rowsdetail = dbConnect.runSqlQuery("select amount,qty from st_stockbill_items where st_stockbillid=" + st_stockbillid);
|
|
|
row.put("receivableamount", rowsdetail.sum("amount"));
|
|
row.put("receivableamount", rowsdetail.sum("amount"));
|
|
|
|
|
+ row.put("paydiscountamount",row.getBigDecimal("paydiscountamount").abs());
|
|
|
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=" + row.getLong("sys_enterpriseid"));
|
|
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=" + row.getLong("sys_enterpriseid"));
|
|
|
Rows stockbillrows_hong = dbConnect.runSqlQuery("select billno from st_stockbill t1 where t1.rb=0 and t1.sourceobject='st_stockbill' and t1.sourceid=" + st_stockbillid);
|
|
Rows stockbillrows_hong = dbConnect.runSqlQuery("select billno from st_stockbill t1 where t1.rb=0 and t1.sourceobject='st_stockbill' and t1.sourceid=" + st_stockbillid);
|
|
|
Rows expressformrows = dbConnect.runSqlQuery("select t1.* from expressform t1 inner join sa_expressform_stockbill t2 on t1.expressformid=t2.expressformid and t1.siteid=t2.siteid where t2.st_stockbillid ='"
|
|
Rows expressformrows = dbConnect.runSqlQuery("select t1.* from expressform t1 inner join sa_expressform_stockbill t2 on t1.expressformid=t2.expressformid and t1.siteid=t2.siteid where t2.st_stockbillid ='"
|
|
@@ -430,6 +431,7 @@ public class stockbill extends Controller {
|
|
|
for (Row row : rows) {
|
|
for (Row row : rows) {
|
|
|
if (reportMap.containsKey(row.getLong("st_stockbillid"))) {
|
|
if (reportMap.containsKey(row.getLong("st_stockbillid"))) {
|
|
|
row.put("printcount", reportMap.get(row.getLong("st_stockbillid")));
|
|
row.put("printcount", reportMap.get(row.getLong("st_stockbillid")));
|
|
|
|
|
+ row.put("paydiscountamount",row.getBigDecimal("paydiscountamount").abs());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (billtypes.contains("返修出库")) {
|
|
if (billtypes.contains("返修出库")) {
|
|
@@ -1007,7 +1009,7 @@ public class stockbill extends Controller {
|
|
|
insertSQL.setDateValue("changedate");
|
|
insertSQL.setDateValue("changedate");
|
|
|
insertSQL.setValue("status", "新建");
|
|
insertSQL.setValue("status", "新建");
|
|
|
insertSQL.setValue("payamount", rows.get(0).getString("payamount"));
|
|
insertSQL.setValue("payamount", rows.get(0).getString("payamount"));
|
|
|
- insertSQL.setValue("paydiscountamount", rows.get(0).getString("paydiscountamount"));
|
|
|
|
|
|
|
+ insertSQL.setValue("paydiscountamount", rows.get(0).getBigDecimal("paydiscountamount").negate());
|
|
|
sqlList.add(insertSQL.getSQL());
|
|
sqlList.add(insertSQL.getSQL());
|
|
|
sqlList.add(DataContrlLog.createLog(this, "st_stockbill", st_stockbillid, "新建", "由" + rows.get(0).getString("billno") + "单红冲生成").getSQL());
|
|
sqlList.add(DataContrlLog.createLog(this, "st_stockbill", st_stockbillid, "新建", "由" + rows.get(0).getString("billno") + "单红冲生成").getSQL());
|
|
|
|
|
|
|
@@ -1162,7 +1164,7 @@ public class stockbill extends Controller {
|
|
|
&& (skuRowsMap.get(FMACHINECODE).get(0).getString("stockno")
|
|
&& (skuRowsMap.get(FMACHINECODE).get(0).getString("stockno")
|
|
|
.equals("103") || skuRowsMap.get(FMACHINECODE).get(0).getString("stockno").equals("109")) ? "101"
|
|
.equals("103") || skuRowsMap.get(FMACHINECODE).get(0).getString("stockno").equals("109")) ? "101"
|
|
|
: skuRowsMap.get(FMACHINECODE).get(0).getString("stockno");
|
|
: skuRowsMap.get(FMACHINECODE).get(0).getString("stockno");
|
|
|
-
|
|
|
|
|
|
|
+ //String stockno =skuRowsMap.get(FMACHINECODE).get(0).getString("stockno");
|
|
|
Rows stockrows = dbConnect.runSqlQuery("select *from st_stock where stockno='" + stockno + "'");
|
|
Rows stockrows = dbConnect.runSqlQuery("select *from st_stock where stockno='" + stockno + "'");
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1173,14 +1175,7 @@ public class stockbill extends Controller {
|
|
|
stockbillitemskurows = dbConnect.runSqlQuery("select t1.*,t2.itemid from st_stockbill_items_sku t1 left join sa_itemsku t2 on t1.sku=t2.sku where t1.st_stockbillid ='"
|
|
stockbillitemskurows = dbConnect.runSqlQuery("select t1.*,t2.itemid from st_stockbill_items_sku t1 left join sa_itemsku t2 on t1.sku=t2.sku where t1.st_stockbillid ='"
|
|
|
+ st_stockbillid + "' and t1.siteid='" + siteid + "'");
|
|
+ st_stockbillid + "' and t1.siteid='" + siteid + "'");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if (stockrows.isNotEmpty()) {
|
|
|
|
|
- skustockid = stockrows.get(0).getLong("stockid");
|
|
|
|
|
- }
|
|
|
|
|
- if (stockid == 0) {
|
|
|
|
|
- skustockid = st_stockbill.getLong("stockid");
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ if (stockid != 0) {
|
|
|
skustockid = stockid;
|
|
skustockid = stockid;
|
|
|
}
|
|
}
|
|
|
InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "st_stockbill_items_sku");
|
|
InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "st_stockbill_items_sku");
|
|
@@ -1645,7 +1640,7 @@ public class stockbill extends Controller {
|
|
|
rowresult.put("agentnum", row.getString("agentnum"));
|
|
rowresult.put("agentnum", row.getString("agentnum"));
|
|
|
rowresult.put("remarks", row.getString("remarks"));
|
|
rowresult.put("remarks", row.getString("remarks"));
|
|
|
rowresult.put("payamount", StringUtils.isNotBlank(row.getString("payamount")) ? row.getDouble("payamount") : 0);
|
|
rowresult.put("payamount", StringUtils.isNotBlank(row.getString("payamount")) ? row.getDouble("payamount") : 0);
|
|
|
- rowresult.put("paydiscountamount", StringUtils.isNotBlank(row.getString("paydiscountamount")) ? row.getDouble("paydiscountamount") : 0);
|
|
|
|
|
|
|
+ rowresult.put("paydiscountamount",row.getString("rb").equals("1")?Math.abs(StringUtils.isNotBlank(row.getString("paydiscountamount")) ? row.getDouble("paydiscountamount") : 0):-Math.abs(StringUtils.isNotBlank(row.getString("paydiscountamount")) ? row.getDouble("paydiscountamount") : 0));
|
|
|
rowresult.put("rb", row.getString("rb"));
|
|
rowresult.put("rb", row.getString("rb"));
|
|
|
rowresult.put("outplace", row.getString("outplace"));
|
|
rowresult.put("outplace", row.getString("outplace"));
|
|
|
|
|
|