|
|
@@ -43,6 +43,7 @@ import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -99,6 +100,11 @@ public class PreContainersServiceImpl extends ServiceImpl<PreContainersMapper, P
|
|
|
preContainers.setCreateDeptName(deptName);
|
|
|
}
|
|
|
teu += preContainers.getTeu().intValue();
|
|
|
+ if (bills != null) {
|
|
|
+ bills.setMeasurement(bills.getMeasurement().add(preContainers.getMeasurement()));
|
|
|
+ bills.setGrossWeight(bills.getGrossWeight().add(preContainers.getGrossWeight()));
|
|
|
+ bills.setQuantity(bills.getQuantity().add(preContainers.getNumber()));
|
|
|
+ }
|
|
|
} else {
|
|
|
PreContainers preContainers1 = baseMapper.selectById(preContainers.getId());
|
|
|
if (preContainers1.getTeu().compareTo(preContainers.getTeu()) >= 0) {
|
|
|
@@ -109,6 +115,11 @@ public class PreContainersServiceImpl extends ServiceImpl<PreContainersMapper, P
|
|
|
preContainers.setUpdateUser(AuthUtil.getUserId());
|
|
|
preContainers.setUpdateTime(new Date());
|
|
|
preContainers.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ if (bills != null) {
|
|
|
+ bills.setMeasurement(bills.getMeasurement().add(preContainers.getMeasurement()).subtract(preContainers1.getMeasurement()));
|
|
|
+ bills.setGrossWeight(bills.getGrossWeight().add(preContainers.getGrossWeight()).subtract(preContainers1.getGrossWeight()));
|
|
|
+ bills.setQuantity(bills.getQuantity().add(preContainers.getNumber()).subtract(preContainers1.getNumber()));
|
|
|
+ }
|
|
|
}
|
|
|
if (bills != null) {
|
|
|
bills.setCfsMeasurement(new BigDecimal("0.00"));
|
|
|
@@ -212,9 +223,10 @@ public class PreContainersServiceImpl extends ServiceImpl<PreContainersMapper, P
|
|
|
}
|
|
|
}
|
|
|
Bills bills = billsMapper.selectOne(new LambdaQueryWrapper<Bills>()
|
|
|
- .select(Bills::getId,Bills::getCfsMeasurement,Bills::getCfsGrossWeight,Bills::getCfsQuantity
|
|
|
- ,Bills::getUpdateUser,Bills::getUpdateTime,Bills::getUpdateUserName,Bills::getTeu)
|
|
|
- .eq(Bills::getId,preContainersList.get(0).getPid()));
|
|
|
+ .select(Bills::getId, Bills::getCfsMeasurement, Bills::getCfsGrossWeight, Bills::getCfsQuantity
|
|
|
+ , Bills::getUpdateUser, Bills::getUpdateTime, Bills::getUpdateUserName, Bills::getTeu,Bills::getQuantity
|
|
|
+ ,Bills::getMeasurement,Bills::getGrossWeight)
|
|
|
+ .eq(Bills::getId, preContainersList.get(0).getPid()));
|
|
|
if (bills != null) {
|
|
|
bills.setCfsMeasurement(new BigDecimal("0.00"));
|
|
|
bills.setCfsGrossWeight(new BigDecimal("0.00"));
|
|
|
@@ -223,11 +235,35 @@ public class PreContainersServiceImpl extends ServiceImpl<PreContainersMapper, P
|
|
|
bills.setUpdateTime(new Date());
|
|
|
bills.setUpdateUserName(AuthUtil.getUserName());
|
|
|
BigDecimal teu = new BigDecimal("0.00");
|
|
|
+ List<Long> ids = preContainersList.stream().map(PreContainers::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ List<PreContainers> preContainersList1 = new ArrayList<>();
|
|
|
+ if (ObjectUtils.isNotNull(ids) && !ids.isEmpty()){
|
|
|
+ preContainersList1 = baseMapper.selectList(new LambdaQueryWrapper<PreContainers>()
|
|
|
+ .in(PreContainers::getId,ids));
|
|
|
+ }
|
|
|
+ BigDecimal quantity= new BigDecimal("0.00");
|
|
|
+ BigDecimal grossWeight= new BigDecimal("0.00");
|
|
|
+ BigDecimal measurement= new BigDecimal("0.00");
|
|
|
for (PreContainers preContainers : preContainersList) {
|
|
|
- if (ObjectUtils.isNotNull(preContainers.getQuantity()) && ObjectUtils.isNotNull(preContainers.getTeu())){
|
|
|
+ if (ObjectUtils.isNotNull(preContainers.getQuantity()) && ObjectUtils.isNotNull(preContainers.getTeu())) {
|
|
|
teu = teu.add(new BigDecimal(preContainers.getQuantity()).multiply(preContainers.getTeu()));
|
|
|
}
|
|
|
+ if (ObjectUtils.isNotNull(preContainers.getId()) && !preContainersList1.isEmpty()){
|
|
|
+ PreContainers preContainers1 = preContainersList1.stream().filter(e-> e.getId().equals(preContainers.getId())).findFirst().orElse(null);
|
|
|
+ if (preContainers1 != null){
|
|
|
+ measurement = measurement.add(preContainers.getMeasurement()).subtract(preContainers1.getMeasurement());
|
|
|
+ grossWeight = grossWeight.add(preContainers.getGrossWeight()).subtract(preContainers1.getGrossWeight());
|
|
|
+ quantity = quantity.add(preContainers.getNumber()).subtract(preContainers1.getNumber());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ measurement = measurement.add(preContainers.getMeasurement());
|
|
|
+ grossWeight = grossWeight.add(preContainers.getGrossWeight());
|
|
|
+ quantity = quantity.add(preContainers.getNumber());
|
|
|
+ }
|
|
|
}
|
|
|
+ bills.setMeasurement((ObjectUtils.isNotNull(bills.getMeasurement()) ? bills.getMeasurement() : new BigDecimal("0.00")).add(measurement));
|
|
|
+ bills.setGrossWeight((ObjectUtils.isNotNull(bills.getGrossWeight()) ? bills.getGrossWeight() : new BigDecimal("0.00")).add(grossWeight));
|
|
|
+ bills.setQuantity((ObjectUtils.isNotNull(bills.getQuantity()) ? bills.getQuantity() : new BigDecimal("0.00")).add(quantity));
|
|
|
bills.setTeu(teu.intValue());
|
|
|
billsMapper.updateById(bills);
|
|
|
}
|