|
|
@ -291,19 +291,18 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
|
List<AsBusrepairInventorybillDetailSDto> detailList = dto.getDetailList(); |
|
|
|
if (!detailList.isEmpty()) { |
|
|
|
for (AsBusrepairInventorybillDetailSDto sDto : detailList) { |
|
|
|
BigDecimal count = BigDecimal.ZERO; |
|
|
|
if (StringUtils.isNotBlank(sDto.getCount())) { |
|
|
|
count = new BigDecimal(sDto.getCount()); |
|
|
|
} |
|
|
|
if (count.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
AsBusrepairInventorybillDetail detail = new AsBusrepairInventorybillDetail(); |
|
|
|
BeanUtil.copyProperties(sDto, detail,"id","sid"); |
|
|
|
// if (StringUtils.isNotBlank(sDto.getOutboundCount())) {
|
|
|
|
// detail.setCurrentCount(new BigDecimal(sDto.getOutboundCount()));
|
|
|
|
// }
|
|
|
|
if (isEnable == 1) { |
|
|
|
if (StringUtils.isNotBlank(sDto.getCount())) { |
|
|
|
detail.setCurrentCount(new BigDecimal(sDto.getCount())); |
|
|
|
} |
|
|
|
detail.setCurrentCount(count); |
|
|
|
} else if (isEnable == 2) { |
|
|
|
String sid = sDto.getSid(); |
|
|
|
AsBusrepairInventorybillDetail detailUpdate = asBusrepairInventorybillDetailService.fetchBySid(sid); |
|
|
|
BigDecimal count = BigDecimal.ZERO; |
|
|
|
BigDecimal currentCount = BigDecimal.ZERO; |
|
|
|
BigDecimal discount = BigDecimal.ZERO;//折扣
|
|
|
|
BigDecimal cost = BigDecimal.ZERO;//成本单价
|
|
|
@ -312,9 +311,6 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
|
if (null != detailUpdate.getCurrentCount()) { |
|
|
|
currentCount = detailUpdate.getCurrentCount(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(sDto.getCount())) { |
|
|
|
count = new BigDecimal(sDto.getCount()); |
|
|
|
} |
|
|
|
if (null != detailUpdate.getDiscount()) { |
|
|
|
discount = new BigDecimal(detailUpdate.getDiscount()).multiply(new BigDecimal("0.1")); |
|
|
|
} |
|
|
@ -341,10 +337,16 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
|
detail.setBillSid(entity.getSid()); |
|
|
|
String inventorySid = sDto.getInventorySid(); |
|
|
|
WmsInventory inventory = wmsInventoryFeign.fetchEntityBySid(inventorySid).getData(); |
|
|
|
//销售价
|
|
|
|
// BigDecimal goodsPrice = new BigDecimal(sDto.getPrice()).multiply(new BigDecimal(sDto.getDiscount())).multiply(new BigDecimal("0.1"));
|
|
|
|
BigDecimal goodsPrice = new BigDecimal(sDto.getPrice()); |
|
|
|
//税率
|
|
|
|
BigDecimal taxRate = BigDecimal.ZERO; |
|
|
|
if (null != inventory) { |
|
|
|
if (null != inventory.getTaxRate()) { |
|
|
|
if (inventory.getTaxRate().compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
detail.setIsTaxRate(1); |
|
|
|
taxRate = inventory.getTaxRate(); |
|
|
|
} else { |
|
|
|
detail.setIsTaxRate(0); |
|
|
|
} |
|
|
@ -394,7 +396,7 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
|
countQuery.setAddOrReduce(1); |
|
|
|
WmsInventoryRecordDto recordDto = new WmsInventoryRecordDto(); |
|
|
|
BigDecimal wiCount = inventory.getCount(); |
|
|
|
BigDecimal subtractCount = wiCount.subtract(new BigDecimal(sDto.getCount())); |
|
|
|
BigDecimal subtractCount = wiCount.subtract(count); |
|
|
|
recordDto.setInventorySid(inventorySid); |
|
|
|
recordDto.setCreateBySid(dto.getCreateBySid()); |
|
|
|
recordDto.setUseOrgSid(dto.getDeptSid()); |
|
|
@ -412,13 +414,16 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
|
recordDto.setCurrentCount(subtractCount.toString()); |
|
|
|
recordDto.setCustomerSid(customerSid); |
|
|
|
recordDto.setCustomerName(customerName); |
|
|
|
recordDto.setTaxRate(taxRate.toString()); |
|
|
|
recordDto.setCost(goodsPrice.toString()); |
|
|
|
recordDto.setAmount(goodsPrice.multiply(count).toString()); |
|
|
|
wmsInventoryRecordFeign.save(recordDto); |
|
|
|
} else if (busTypeKey.equals("1")) { |
|
|
|
//维修退库
|
|
|
|
countQuery.setAddOrReduce(0); |
|
|
|
WmsInventoryRecordDto recordDto = new WmsInventoryRecordDto(); |
|
|
|
BigDecimal wiCount = inventory.getCount(); |
|
|
|
BigDecimal add = wiCount.add(new BigDecimal(sDto.getCount())); |
|
|
|
BigDecimal add = wiCount.add(count); |
|
|
|
recordDto.setInventorySid(inventorySid); |
|
|
|
recordDto.setCreateBySid(dto.getCreateBySid()); |
|
|
|
recordDto.setUseOrgSid(dto.getDeptSid()); |
|
|
@ -436,10 +441,15 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
|
recordDto.setCurrentCount(add.toString()); |
|
|
|
recordDto.setCustomerSid(customerSid); |
|
|
|
recordDto.setCustomerName(customerName); |
|
|
|
recordDto.setTaxRate(taxRate.toString()); |
|
|
|
recordDto.setCost(goodsPrice.toString()); |
|
|
|
recordDto.setAmount(goodsPrice.multiply(count).toString()); |
|
|
|
wmsInventoryRecordFeign.save(recordDto); |
|
|
|
} |
|
|
|
wmsInventoryFeign.updateInventoryCount(countQuery); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return entity.getSid(); |
|
|
|
} |
|
|
|