|
|
@@ -26,15 +26,13 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
+import org.springblade.los.Util.BigDecimalUtils;
|
|
|
import org.springblade.los.Util.BoxNumUtils;
|
|
|
import org.springblade.los.Util.GlobalOperationLogUtils;
|
|
|
import org.springblade.los.Util.OperatorType;
|
|
|
import org.springblade.los.box.excel.ReturnContainerReminderExcel;
|
|
|
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.ContainersMapper;
|
|
|
import org.springblade.los.business.sea.service.IContainersBillsService;
|
|
|
@@ -482,6 +480,7 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ String isOccupyNum = sysClient.getParamService("is.occupyNum");
|
|
|
List<Containers> list = baseMapper.selectList(new LambdaQueryWrapper<Containers>()
|
|
|
.eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Containers::getIsDeleted, 0)
|
|
|
@@ -489,33 +488,70 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
if (list.isEmpty()) {
|
|
|
throw new RuntimeException("未找到配箱信息");
|
|
|
}
|
|
|
- int count;
|
|
|
- if (list.size() >= excelList.size()) {
|
|
|
- count = excelList.size();
|
|
|
- } else {
|
|
|
- count = list.size();
|
|
|
- }
|
|
|
- List<Containers> containersList = new ArrayList<>();
|
|
|
- for (int i = 0; i < count; i++) {
|
|
|
- BoxAndLeadSealNoExcel item = excelList.get(i);
|
|
|
- Containers containers = list.get(i);
|
|
|
- containers.setCntrTypeCode(item.getCntrTypeCode());
|
|
|
- BoxNumUtils.containerNumberVerification(item.getCntrNo());
|
|
|
- containers.setCntrNo(item.getCntrNo().toUpperCase());
|
|
|
- containers.setSealNo(item.getSealNo());
|
|
|
- containers.setMeasurement(ObjectUtils.isNotNull(item.getMeasurement()) ? item.getMeasurement() : new BigDecimal("0.00"));
|
|
|
- containers.setQuantity(ObjectUtils.isNotNull(item.getQuantity()) ? item.getQuantity() : new BigDecimal("0.00"));
|
|
|
- containers.setGrossWeight(ObjectUtils.isNotNull(item.getGrossWeight()) ? item.getGrossWeight() : new BigDecimal("0.00"));
|
|
|
- containers.setTare(ObjectUtils.isNotNull(item.getTare()) ? item.getTare() : new BigDecimal("0.00"));
|
|
|
- containers.setVgmWeight(containers.getGrossWeight().add(containers.getTare()));
|
|
|
- containers.setHblno(item.getHblno());
|
|
|
- containersList.add(containers);
|
|
|
- }
|
|
|
- if (!containersList.isEmpty()) {
|
|
|
- this.updateBatchById(containersList);
|
|
|
- return R.data(containersList);
|
|
|
+ List<String> cntrNoList = list.stream().map(Containers::getCntrNo).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ if ("1".equals(isOccupyNum) && !cntrNoList.isEmpty()) {
|
|
|
+ List<Containers> containersList1 = new ArrayList<>();
|
|
|
+ StringBuilder text = new StringBuilder();
|
|
|
+ for (BoxAndLeadSealNoExcel item : excelList) {
|
|
|
+ if (!cntrNo.contains(item.getCntrNo())) {
|
|
|
+ text.append(item.getCntrNo()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(text.toString())) {
|
|
|
+ throw new RuntimeException("箱号:" + text + "未查到,请确认!");
|
|
|
+ }
|
|
|
+ for (Containers item : list) {
|
|
|
+ if (!excelList.isEmpty()) {
|
|
|
+ BoxAndLeadSealNoExcel containers = excelList.stream().filter(e -> e.getCntrNo().equals(item.getCntrNo()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ if (containers != null) {
|
|
|
+ item.setSealNo(containers.getSealNo());
|
|
|
+ item.setCntrTypeCode(containers.getCntrTypeCode());
|
|
|
+ item.setTare(containers.getTare());
|
|
|
+ item.setVgmWeight(containers.getVgmWeight());
|
|
|
+ item.setQuantity(containers.getQuantity());
|
|
|
+ item.setGrossWeight(containers.getGrossWeight());
|
|
|
+ item.setMeasurement(containers.getMeasurement());
|
|
|
+ item.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ item.setUpdateTime(new Date());
|
|
|
+ item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ containersList1.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!containersList1.isEmpty()) {
|
|
|
+ this.updateBatchById(containersList1);
|
|
|
+ }
|
|
|
+ return R.data(containersList1);
|
|
|
} else {
|
|
|
- return R.fail("导入失败,导入条数为零");
|
|
|
+ int count;
|
|
|
+ if (list.size() >= excelList.size()) {
|
|
|
+ count = excelList.size();
|
|
|
+ } else {
|
|
|
+ count = list.size();
|
|
|
+ }
|
|
|
+ List<Containers> containersList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < count; i++) {
|
|
|
+ BoxAndLeadSealNoExcel item = excelList.get(i);
|
|
|
+ Containers containers = list.get(i);
|
|
|
+ containers.setCntrTypeCode(item.getCntrTypeCode());
|
|
|
+ BoxNumUtils.containerNumberVerification(item.getCntrNo());
|
|
|
+ containers.setCntrNo(item.getCntrNo().toUpperCase());
|
|
|
+ containers.setSealNo(item.getSealNo());
|
|
|
+ containers.setMeasurement(ObjectUtils.isNotNull(item.getMeasurement()) ? item.getMeasurement() : new BigDecimal("0.00"));
|
|
|
+ containers.setQuantity(ObjectUtils.isNotNull(item.getQuantity()) ? item.getQuantity() : new BigDecimal("0.00"));
|
|
|
+ containers.setGrossWeight(ObjectUtils.isNotNull(item.getGrossWeight()) ? item.getGrossWeight() : new BigDecimal("0.00"));
|
|
|
+ containers.setTare(ObjectUtils.isNotNull(item.getTare()) ? item.getTare() : new BigDecimal("0.00"));
|
|
|
+ containers.setVgmWeight(containers.getGrossWeight().add(containers.getTare()));
|
|
|
+ containers.setHblno(item.getHblno());
|
|
|
+ containersList.add(containers);
|
|
|
+ }
|
|
|
+ if (!containersList.isEmpty()) {
|
|
|
+ this.updateBatchById(containersList);
|
|
|
+ return R.data(containersList);
|
|
|
+ } else {
|
|
|
+ return R.fail("导入失败,导入条数为零");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|