|
@@ -27,18 +27,15 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.los.Util.IDeptUtils;
|
|
import org.springblade.los.Util.IDeptUtils;
|
|
|
import org.springblade.los.business.sea.dto.WaitingBox;
|
|
import org.springblade.los.business.sea.dto.WaitingBox;
|
|
|
-import org.springblade.los.business.sea.entity.Bills;
|
|
|
|
|
-import org.springblade.los.business.sea.entity.Containers;
|
|
|
|
|
-import org.springblade.los.business.sea.entity.ContainersBills;
|
|
|
|
|
-import org.springblade.los.business.sea.entity.ContainersCommodity;
|
|
|
|
|
|
|
+import org.springblade.los.business.sea.entity.*;
|
|
|
import org.springblade.los.business.sea.mapper.BillsMapper;
|
|
import org.springblade.los.business.sea.mapper.BillsMapper;
|
|
|
import org.springblade.los.business.sea.mapper.ContainersMapper;
|
|
import org.springblade.los.business.sea.mapper.ContainersMapper;
|
|
|
|
|
+import org.springblade.los.business.sea.mapper.PreContainersMapper;
|
|
|
import org.springblade.los.business.sea.service.IContainersBillsService;
|
|
import org.springblade.los.business.sea.service.IContainersBillsService;
|
|
|
import org.springblade.los.business.sea.service.IContainersCommodityService;
|
|
import org.springblade.los.business.sea.service.IContainersCommodityService;
|
|
|
import org.springblade.los.business.sea.service.IContainersService;
|
|
import org.springblade.los.business.sea.service.IContainersService;
|
|
|
import org.springblade.los.business.sea.vo.ContainersVO;
|
|
import org.springblade.los.business.sea.vo.ContainersVO;
|
|
|
import org.springblade.los.excel.BoxAndLeadSealNoExcel;
|
|
import org.springblade.los.excel.BoxAndLeadSealNoExcel;
|
|
|
-import org.springblade.system.entity.Dept;
|
|
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -70,6 +67,8 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
|
|
|
|
|
private final IContainersCommodityService containersCommodityService;
|
|
private final IContainersCommodityService containersCommodityService;
|
|
|
|
|
|
|
|
|
|
+ private final PreContainersMapper preContainersMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public IPage<ContainersVO> selectContainersPage(IPage<ContainersVO> page, ContainersVO containers) {
|
|
public IPage<ContainersVO> selectContainersPage(IPage<ContainersVO> page, ContainersVO containers) {
|
|
|
return page.setRecords(baseMapper.selectContainersPage(page, containers));
|
|
return page.setRecords(baseMapper.selectContainersPage(page, containers));
|
|
@@ -373,11 +372,58 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
if (sealNo.size() != excelList.size()) {
|
|
if (sealNo.size() != excelList.size()) {
|
|
|
throw new RuntimeException("铅封号不允许重复");
|
|
throw new RuntimeException("铅封号不允许重复");
|
|
|
}
|
|
}
|
|
|
- List<String> ids = excelList.stream().map(BoxAndLeadSealNoExcel::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
+ List<String> ids = excelList.stream().map(BoxAndLeadSealNoExcel::getId).distinct().collect(Collectors.toList());
|
|
|
List<Containers> list = baseMapper.selectList(new LambdaQueryWrapper<Containers>()
|
|
List<Containers> list = baseMapper.selectList(new LambdaQueryWrapper<Containers>()
|
|
|
.eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
.eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Containers::getIsDeleted, 0)
|
|
.eq(Containers::getIsDeleted, 0)
|
|
|
.in(Containers::getId, ids));
|
|
.in(Containers::getId, ids));
|
|
|
|
|
+ if (list.size() != excelList.size()){
|
|
|
|
|
+ throw new RuntimeException("导入数据与待配箱数据不一致,请重新下载模版");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> pid = list.stream().map(Containers::getPid).distinct().collect(Collectors.toList());
|
|
|
|
|
+ List<PreContainers> preContainersList = preContainersMapper.selectList(new LambdaQueryWrapper<PreContainers>()
|
|
|
|
|
+ .eq(PreContainers::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(PreContainers::getIsDeleted, 0)
|
|
|
|
|
+ .in(PreContainers::getId, pid)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (preContainersList.isEmpty()){
|
|
|
|
|
+ throw new RuntimeException("未查到具体箱型数量数据信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal quantity = new BigDecimal("0.00");
|
|
|
|
|
+ BigDecimal grossWeight = new BigDecimal("0.00");
|
|
|
|
|
+ BigDecimal netWeight = new BigDecimal("0.00");
|
|
|
|
|
+ BigDecimal measurement = new BigDecimal("0.00");
|
|
|
|
|
+ List<String> cntry = excelList.stream().map(BoxAndLeadSealNoExcel::getCntrTypeCode).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
+ for (String item :cntry){
|
|
|
|
|
+ List<BoxAndLeadSealNoExcel> boxList = excelList.stream().filter(e-> e.getCntrTypeCode().equals(item)).collect(Collectors.toList());
|
|
|
|
|
+ if (!boxList.isEmpty()){
|
|
|
|
|
+ PreContainers preContainersDetails = preContainersList.stream().filter(e-> e.getCntrTypeCode().equals(item)
|
|
|
|
|
+ && e.getPid().equals(Long.parseLong(boxList.get(0).getId()))).findFirst().orElse(null);
|
|
|
|
|
+ BigDecimal quantity1 = boxList.stream().map(BoxAndLeadSealNoExcel::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
+ BigDecimal grossWeight1 = boxList.stream().map(BoxAndLeadSealNoExcel::getGrossWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
+ BigDecimal netWeight1 = boxList.stream().map(BoxAndLeadSealNoExcel::getNetWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
+ BigDecimal measurement1 = boxList.stream().map(BoxAndLeadSealNoExcel::getMeasurement).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
+ if (preContainersDetails != null){
|
|
|
|
|
+ preContainersDetails.setNumber(quantity1);
|
|
|
|
|
+ preContainersDetails.setMeasurement(grossWeight1);
|
|
|
|
|
+ preContainersDetails.setNetWeight(netWeight1);
|
|
|
|
|
+ preContainersDetails.setMeasurement(measurement1);
|
|
|
|
|
+ preContainersMapper.updateById(preContainersDetails);
|
|
|
|
|
+ }
|
|
|
|
|
+ quantity = quantity.add(quantity1);
|
|
|
|
|
+ grossWeight = grossWeight.add(grossWeight1);
|
|
|
|
|
+ netWeight = netWeight.add(netWeight1);
|
|
|
|
|
+ measurement = measurement.add(measurement1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ Bills bills = billsMapper.selectById(preContainersList.get(0).getPid());
|
|
|
|
|
+ if (bills != null){
|
|
|
|
|
+ bills.setQuantity(quantity);
|
|
|
|
|
+ bills.setMeasurement(grossWeight);
|
|
|
|
|
+ bills.setNetWeight(netWeight);
|
|
|
|
|
+ bills.setMeasurement(measurement);
|
|
|
|
|
+ billsMapper.updateById(bills);
|
|
|
|
|
+ }
|
|
|
List<Containers> containersList = new ArrayList<>();
|
|
List<Containers> containersList = new ArrayList<>();
|
|
|
String regex = "^[a-zA-Z0-9]+$";
|
|
String regex = "^[a-zA-Z0-9]+$";
|
|
|
Pattern pattern = Pattern.compile(regex);
|
|
Pattern pattern = Pattern.compile(regex);
|
|
@@ -392,6 +438,12 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
}
|
|
}
|
|
|
containers.setCntrNo(item.getCntrNo().toUpperCase());
|
|
containers.setCntrNo(item.getCntrNo().toUpperCase());
|
|
|
containers.setSealNo(item.getSealNo());
|
|
containers.setSealNo(item.getSealNo());
|
|
|
|
|
+ containers.setMeasurement(item.getMeasurement());
|
|
|
|
|
+ containers.setQuantity(item.getQuantity());
|
|
|
|
|
+ containers.setGrossWeight(item.getGrossWeight());
|
|
|
|
|
+ containers.setNetWeight(item.getNetWeight());
|
|
|
|
|
+ containers.setMarks(item.getMarks());
|
|
|
|
|
+ containers.setRemarks(item.getRemarks());
|
|
|
containersList.add(containers);
|
|
containersList.add(containers);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|