From 534219a0336019451f1761b279eadce2c32b650b Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期日, 28 九月 2025 10:08:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wuhuyancao' into wuhuyancao
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformWmsJobServiceImpl.java | 80 +++++++++++++++++++++++++++++++++++++--
1 files changed, 75 insertions(+), 5 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformWmsJobServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformWmsJobServiceImpl.java
index 1c94748..5753f76 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformWmsJobServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformWmsJobServiceImpl.java
@@ -1,20 +1,31 @@
package com.doumee.service.business.impl;
-import com.doumee.core.model.PageData;
-import com.doumee.core.model.PageWrap;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.service.business.third.model.PageData;
+import com.doumee.service.business.third.model.PageWrap;
+import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.PlatformWmsDetailMapper;
import com.doumee.dao.business.PlatformWmsJobMapper;
+import com.doumee.dao.business.model.PlatformWmsDetail;
import com.doumee.dao.business.model.PlatformWmsJob;
+import com.doumee.dao.business.vo.WmsJobContractVO;
import com.doumee.service.business.PlatformWmsJobService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
-import java.util.List;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.function.BinaryOperator;
+import java.util.function.Function;
+import java.util.stream.Collectors;
/**
* 鏈堝彴_WMS浣滀笟閫氱煡鍗曡鏁版嵁Service瀹炵幇
@@ -26,6 +37,9 @@
@Autowired
private PlatformWmsJobMapper platformWmsJobMapper;
+
+ @Autowired
+ private PlatformWmsDetailMapper platformWmsDetailMapper;
@Override
public Integer create(PlatformWmsJob platformWmsJob) {
@@ -72,6 +86,64 @@
return platformWmsJobMapper.selectById(id);
}
+
+
+ @Override
+ public PlatformWmsJob findByDetailId(Integer id) {
+ PlatformWmsJob platformWmsJob = platformWmsJobMapper.selectOne(new QueryWrapper<PlatformWmsJob>().
+ lambda().eq(PlatformWmsJob::getIsdeleted, Constants.ZERO)
+ .eq(PlatformWmsJob::getJobId,id).last(" limit 1 "));
+ if(Objects.isNull(platformWmsJob)){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌杩愬崟淇℃伅");
+ }
+ List<PlatformWmsDetail> platformWmsDetailList = platformWmsDetailMapper.selectList(new QueryWrapper<PlatformWmsDetail>()
+ .lambda().eq(PlatformWmsDetail::getJobId,id).eq(PlatformWmsDetail::getIsdeleted, Constants.ZERO));
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformWmsDetailList)){
+ platformWmsJob.setIoQty(
+ platformWmsDetailList.stream().map(m->m.getIoQty()).reduce(BigDecimal.ZERO,BigDecimal::add)
+ );
+ //鑾峰彇鎵�鏈夊悎鍚屽彿(鍘婚噸锛�
+ List<String> ioCodeList = platformWmsDetailList.stream().map(m->m.getContractNum()).distinct().collect(Collectors.toList());
+ Set<String> ioCodeSet = new HashSet<String>(ioCodeList);
+ List<WmsJobContractVO> wmsJobContractVOList = new ArrayList<>();
+ for (String ioCode:ioCodeSet) {
+ if(StringUtils.isBlank(ioCode)){
+// continue;
+ }
+ WmsJobContractVO wmsJobContractVO = new WmsJobContractVO();
+ wmsJobContractVO.setContractCode(ioCode);
+ wmsJobContractVO.setPlatformWmsDetailList(
+ platformWmsDetailList.stream().filter(i-> StringUtils.equals(i.getContractNum(),ioCode)).collect(Collectors.toList())
+ );
+ if(wmsJobContractVO.getPlatformWmsDetailList()!=null&& wmsJobContractVO.getPlatformWmsDetailList().size()>0){
+ wmsJobContractVO.setAddress(wmsJobContractVO.getPlatformWmsDetailList().get(0).getRepertotyAddress());
+ }
+ if(Objects.isNull(wmsJobContractVO.getLockStatus())&&
+ com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(wmsJobContractVO.getPlatformWmsDetailList())){
+ if(Constants.equalsInteger(platformWmsJob.getType(),Constants.ONE)){
+ if(Objects.isNull(wmsJobContractVO.getPlatformWmsDetailList().get(Constants.ZERO).getLockStatus())){
+ wmsJobContractVO.setLockStatus(Constants.ZERO
+ );
+ }else{
+ wmsJobContractVO.setLockStatus(
+ wmsJobContractVO.getPlatformWmsDetailList().get(Constants.ZERO).getLockStatus()
+ );
+ }
+ wmsJobContractVO.setStatus(
+ wmsJobContractVO.getPlatformWmsDetailList().get(Constants.ZERO).getStatus()
+ );
+ }
+ }
+ wmsJobContractVOList.add(wmsJobContractVO);
+ }
+
+ platformWmsJob.setWmsJobContractVOList(wmsJobContractVOList);
+ }else{
+ platformWmsJob.setIoQty(BigDecimal.ZERO);
+ }
+ return platformWmsJob;
+ }
+
@Override
public PlatformWmsJob findOne(PlatformWmsJob platformWmsJob) {
QueryWrapper<PlatformWmsJob> wrapper = new QueryWrapper<>(platformWmsJob);
@@ -106,8 +178,6 @@
.eq(pageWrap.getModel().getDriverName() != null, PlatformWmsJob::getDriverName, pageWrap.getModel().getDriverName())
.eq(pageWrap.getModel().getCarrierName() != null, PlatformWmsJob::getCarrierName, pageWrap.getModel().getCarrierName())
.eq(pageWrap.getModel().getCarryBillCode() != null, PlatformWmsJob::getCarryBillCode, pageWrap.getModel().getCarryBillCode())
- .ge(pageWrap.getModel().getIoCreatedate() != null, PlatformWmsJob::getIoCreatedate, Utils.Date.getStart(pageWrap.getModel().getIoCreatedate()))
- .le(pageWrap.getModel().getIoCreatedate() != null, PlatformWmsJob::getIoCreatedate, Utils.Date.getEnd(pageWrap.getModel().getIoCreatedate()))
.eq(pageWrap.getModel().getStatus() != null, PlatformWmsJob::getStatus, pageWrap.getModel().getStatus())
.ge(pageWrap.getModel().getCancelDate() != null, PlatformWmsJob::getCancelDate, Utils.Date.getStart(pageWrap.getModel().getCancelDate()))
.le(pageWrap.getModel().getCancelDate() != null, PlatformWmsJob::getCancelDate, Utils.Date.getEnd(pageWrap.getModel().getCancelDate()))
--
Gitblit v1.9.3