解决多单位商品,大单位时分批出库的时候的bug

This commit is contained in:
神话
2022-04-27 23:48:42 +08:00
parent b75076a5d4
commit 2df1e02080
2 changed files with 14 additions and 4 deletions

View File

@@ -701,7 +701,7 @@ public class DepotItemService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public BigDecimal getFinishNumber(Long mId, Long headerId) {
public BigDecimal getFinishNumber(Long mId, Long headerId, Unit unitInfo, String materialUnit) {
String goToType = "";
DepotHead depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
String linkNumber = depotHead.getNumber(); //订单号
@@ -712,6 +712,16 @@ public class DepotItemService {
goToType = BusinessConstants.SUB_TYPE_SALES;
}
BigDecimal count = depotItemMapperEx.getFinishNumber(mId, linkNumber, goToType);
//根据多单位情况进行数量的转换
if(materialUnit.equals(unitInfo.getOtherUnit()) && unitInfo.getRatio() != 0) {
count = count.divide(BigDecimal.valueOf(unitInfo.getRatio()),2,BigDecimal.ROUND_HALF_UP);
}
if(materialUnit.equals(unitInfo.getOtherUnitTwo()) && unitInfo.getRatioTwo() != 0) {
count = count.divide(BigDecimal.valueOf(unitInfo.getRatioTwo()),2,BigDecimal.ROUND_HALF_UP);
}
if(materialUnit.equals(unitInfo.getOtherUnitThree()) && unitInfo.getRatioThree() != 0) {
count = count.divide(BigDecimal.valueOf(unitInfo.getRatioThree()),2,BigDecimal.ROUND_HALF_UP);
}
return count;
}