|
|
@@ -14,6 +14,7 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import restcontroller.R;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
@API(title = "销售出库U8上传")
|
|
|
@@ -698,12 +699,12 @@ public class u8 extends Controller {
|
|
|
BigDecimal taxprice = BigDecimal.ZERO;
|
|
|
BigDecimal price = BigDecimal.ZERO;
|
|
|
if (changetype.equals("百分比")) {
|
|
|
- taxprice = row.getBigDecimal("saleprice").multiply(BigDecimal.valueOf(100).add(changevalue)).divide(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- price = taxprice.multiply(BigDecimal.valueOf(100).add(row.getBigDecimal("taxrate"))).divide(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ taxprice = row.getBigDecimal("saleprice").multiply(BigDecimal.valueOf(100).add(changevalue)).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
+ price = taxprice.multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(100).add(row.getBigDecimal("taxrate")), 6, RoundingMode.HALF_UP);
|
|
|
|
|
|
} else if (changetype.equals("金额")) {
|
|
|
taxprice = row.getBigDecimal("saleprice").add(changevalue);
|
|
|
- price = taxprice.multiply(BigDecimal.valueOf(100).add(row.getBigDecimal("taxrate"))).divide(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ price = taxprice.multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(100).add(row.getBigDecimal("taxrate")), 6, RoundingMode.HALF_UP);
|
|
|
|
|
|
}
|
|
|
sqllist.add("update u8itemprice set price=" + price + ",taxprice=" + taxprice + " where u8itempriceid=" + row.getLong("u8itempriceid"));
|
|
|
@@ -742,11 +743,11 @@ public class u8 extends Controller {
|
|
|
JSONArray detail = new JSONArray();
|
|
|
|
|
|
Rows rows = dbConnect.runSqlQuery("select t3.itemno,t1.itemid,t1.stockno,ifnull(t1.qty,0) qty,ifnull(t2.price,0) price,ifnull(t2.taxprice,0) taxprice,ifnull(t2.taxrate,0) taxrate,t2.stockid from (\n" +
|
|
|
- "select distinct t1.itemid,t1.u8id,case when t2.outplace='谈桥' then '103' when t2.outplace='马桥' then '109' else t3.stockno end as stockno,sum(t1.qty)qty from u8billcodes t1\n" +
|
|
|
+ "select distinct t1.itemid,t1.u8id,case when t2.outplace='谈桥' then 1605 when t2.outplace='马桥' then 2320 else t1.stockid end stockid,case when t2.outplace='谈桥' then '103' when t2.outplace='马桥' then '109' else t3.stockno end as stockno,sum(t1.qty)qty from u8billcodes t1\n" +
|
|
|
"inner join u8bills t2 on t1.billno=t2.billno and t1.u8id=t2.u8id \n" +
|
|
|
"left join st_stock t3 on t1.stockid=t3.stockid\n" +
|
|
|
"where t1.rb='1' and t1.u8id=" + u8id +
|
|
|
- " group by t1.itemid,case when t2.outplace='谈桥' then '103' when t2.outplace='马桥' then '109' else t3.stockno end,t1.u8id )t1 left join u8itemprice t2 on t1.u8id=t2.u8id and t1.itemid=t2.itemid left join plm_item t3 on t1.itemid=t3.itemid");
|
|
|
+ " group by t1.itemid,case when t2.outplace='谈桥' then '103' when t2.outplace='马桥' then '109' else t3.stockno end,t1.u8id,case when t2.outplace='谈桥' then 1605 when t2.outplace='马桥' then 2320 else t1.stockid end )t1 left join u8itemprice t2 on t1.u8id=t2.u8id and t1.itemid=t2.itemid and t1.stockid=t2.stockid left join plm_item t3 on t1.itemid=t3.itemid");
|
|
|
int rowno = 1;
|
|
|
for (Row row : rows) {
|
|
|
BigDecimal qty = row.getBigDecimal("qty");
|
|
|
@@ -815,11 +816,11 @@ public class u8 extends Controller {
|
|
|
JSONArray detail = new JSONArray();
|
|
|
|
|
|
Rows rows = dbConnect.runSqlQuery("select t1.itemid,t1.stockno,ifnull(-t1.qty,0) qty,ifnull(t2.price,0) price,ifnull(t2.taxprice,0) taxprice,ifnull(t2.taxrate,0) taxrate,t3.itemno,t2.stockid from (\n" +
|
|
|
- "select distinct t1.itemid,t1.u8id,case when t2.outplace='谈桥' then '103' when t2.outplace='马桥' then '109' else t3.stockno end as stockno,sum(t1.qty)qty from u8billcodes t1\n" +
|
|
|
+ "select distinct t1.itemid,t1.u8id,case when t2.outplace='谈桥' then 1605 when t2.outplace='马桥' then 2320 else t1.stockid end stockid,case when t2.outplace='谈桥' then '103' when t2.outplace='马桥' then '109' else t3.stockno end as stockno,sum(t1.qty)qty from u8billcodes t1\n" +
|
|
|
"inner join u8bills t2 on t1.billno=t2.billno and t1.u8id=t2.u8id \n" +
|
|
|
"left join st_stock t3 on t1.stockid=t3.stockid\n" +
|
|
|
"where t1.rb='0' and t1.u8id=" + u8id +
|
|
|
- " group by t1.itemid,case when t2.outplace='谈桥' then '103' when t2.outplace='马桥' then '109' else t3.stockno end,t1.u8id )t1 left join u8itemprice t2 on t1.u8id=t2.u8id and t1.itemid=t2.itemid left join plm_item t3 on t1.itemid=t3.itemid");
|
|
|
+ " group by t1.itemid,case when t2.outplace='谈桥' then '103' when t2.outplace='马桥' then '109' else t3.stockno end,t1.u8id,case when t2.outplace='谈桥' then 1605 when t2.outplace='马桥' then 2320 else t1.stockid end )t1 left join u8itemprice t2 on t1.u8id=t2.u8id and t1.itemid=t2.itemid and t1.stockid=t2.stockid left join plm_item t3 on t1.itemid=t3.itemid");
|
|
|
int rowno = 1;
|
|
|
for (Row row : rows) {
|
|
|
BigDecimal qty = row.getBigDecimal("qty");
|