|
|
|
@ -56,6 +56,8 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.system.cache.UserCache; |
|
|
|
|
import org.springblade.system.entity.User; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
@ -867,13 +869,170 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<QuestContrastVO> getContrastInfo(QuestDetailDTO questDetailDTO, IPage<Object> page) { |
|
|
|
|
|
|
|
|
|
List<QuestContrastVO> voList = new ArrayList<>(); |
|
|
|
|
//查询的有数据的信息
|
|
|
|
|
// questDetailDTO.setQuestTarget(1);
|
|
|
|
|
List<QuestContrastVO> list = baseMapper.selectContrastDataInfo(questDetailDTO.getQuestNum(),questDetailDTO); |
|
|
|
|
list.stream().forEach(i ->{ |
|
|
|
|
String[] split = i.getQuestStatus().split(","); |
|
|
|
|
//盘点状态;0 待盘点 1. 已盘 2未盘点 3已排除
|
|
|
|
|
Integer yiPan = 0; |
|
|
|
|
for (String s : split) { |
|
|
|
|
switch (s){ |
|
|
|
|
case "1": |
|
|
|
|
yiPan += 1; |
|
|
|
|
i.setQuestStatusName("部分盘点"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(ObjectUtils.isNotNull(i.getUpdateUser())){ |
|
|
|
|
StringBuffer buffer = new StringBuffer(); |
|
|
|
|
String[] split1 = i.getUpdateUser().split(","); |
|
|
|
|
for (String s : split1) { |
|
|
|
|
User user = UserCache.getUser(Long.valueOf(s)); |
|
|
|
|
buffer.append(user.getAccount()); |
|
|
|
|
} |
|
|
|
|
i.setUpdateUser(buffer.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
i.setQuestNum(yiPan); |
|
|
|
|
int i1 = i.getHandQuantity() - yiPan; |
|
|
|
|
i.setDifferenceNum(i1); |
|
|
|
|
if(ObjectUtils.isNull(i.getGroundingPositionCode())){ |
|
|
|
|
i.setGroundingPositionCode("无更新"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
//查询零担
|
|
|
|
|
QuestDetailEntity questContrastVO = new QuestDetailEntity(); |
|
|
|
|
questContrastVO.setQuestId(questDetailDTO.getQuestId()); |
|
|
|
|
questContrastVO.setQuestTarget(2); |
|
|
|
|
List<QuestDetailEntity> list1 = baseMapper.selectQuestDetailList(questDetailDTO.getQuestNum(), questContrastVO); |
|
|
|
|
if(ObjectUtils.isNotNull(list1)){ |
|
|
|
|
list1.stream().collect(Collectors.groupingBy(QuestDetailEntity::getOrderId)).forEach((k,v) ->{ |
|
|
|
|
|
|
|
|
|
//查询订单信息
|
|
|
|
|
DistributionStockArticleEntity entityByStockArticle = distributionStockArticleClient.findEntityByStockArticleId(k); |
|
|
|
|
if(ObjectUtils.isNull(entityByStockArticle)){ |
|
|
|
|
log.info("没有订单数据!!"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//已盘数量
|
|
|
|
|
AtomicReference<Integer> yi = new AtomicReference<>(0); |
|
|
|
|
StringBuffer buffer = new StringBuffer(); |
|
|
|
|
QuestContrastVO q = new QuestContrastVO(); |
|
|
|
|
q.setQuestNum(yi.get()); //盘点数
|
|
|
|
|
q.setTotalNumber(entityByStockArticle.getTotalNumber()); |
|
|
|
|
q.setHandQuantity(entityByStockArticle.getHandQuantity()); |
|
|
|
|
q.setBrandName(entityByStockArticle.getBrand()); |
|
|
|
|
q.setMallName(entityByStockArticle.getMallName()); |
|
|
|
|
q.setCustomerName(entityByStockArticle.getCustomerName()); |
|
|
|
|
q.setMaterialName(entityByStockArticle.getDescriptionGoods()); |
|
|
|
|
|
|
|
|
|
v.stream().forEach( i ->{ |
|
|
|
|
switch (i.getQuestStatus()){ |
|
|
|
|
case 1: |
|
|
|
|
yi.updateAndGet(v1 -> v1 + 1); |
|
|
|
|
q.setQuestStatusName("部分盘点"); |
|
|
|
|
User user = UserCache.getUser(i.getUpdateUser()); |
|
|
|
|
q.setUpdateUser(user.getAccount()); |
|
|
|
|
q.setUpdateTime(i.getUpdateTime()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
q.setOrderCode(i.getOrderCode()); |
|
|
|
|
if(ObjectUtils.isNull(i.getGroundingPositionCode())){ |
|
|
|
|
q.setGroundingPositionCode("无更新"); |
|
|
|
|
} |
|
|
|
|
//库位
|
|
|
|
|
if(ObjectUtils.isNull(buffer) && ObjectUtils.isNotNull( i.getPositionCode())){ |
|
|
|
|
buffer.append(i.getPositionCode()); |
|
|
|
|
}else if(ObjectUtils.isNotNull(buffer) && ObjectUtils.isNotNull( i.getPositionCode()) && !buffer.toString().contains(i.getPositionCode())){ |
|
|
|
|
buffer.append(",").append(i.getPositionCode()); |
|
|
|
|
} |
|
|
|
|
//托盘
|
|
|
|
|
if(ObjectUtils.isNotNull(i.getTrayCode())){ |
|
|
|
|
if(ObjectUtils.isNull(q.getTrayCode()) ){ |
|
|
|
|
q.setTrayCode(i.getPositionCode()); |
|
|
|
|
}else if(ObjectUtils.isNotNull(q.getTrayCode()) && !q.getTrayCode().contains(i.getTrayCode())){ |
|
|
|
|
q.setTrayCode(q.getTrayCode()+","+i.getPositionCode()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//更新的货位
|
|
|
|
|
if(ObjectUtils.isNotNull(i.getGroundingPositionCode())){ |
|
|
|
|
if(ObjectUtils.isNull(q.getGroundingPositionCode())){ |
|
|
|
|
q.setGroundingPositionCode(i.getGroundingPositionCode()); |
|
|
|
|
}else if(ObjectUtils.isNotNull(q.getGroundingPositionCode()) && !q.getGroundingPositionCode().contains(i.getGroundingPositionCode())){ |
|
|
|
|
q.setGroundingPositionCode(q.getGroundingPositionCode()+","+i.getGroundingPositionCode()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
q.setDifferenceNum(entityByStockArticle.getHandQuantity() - yi.get()); |
|
|
|
|
q.setPositionCode(buffer.toString()); |
|
|
|
|
voList.add(q); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询库存品
|
|
|
|
|
questContrastVO.setQuestTarget(3); |
|
|
|
|
List<QuestDetailEntity> list2 = baseMapper.selectQuestDetailList(questDetailDTO.getQuestNum(), questContrastVO); |
|
|
|
|
if(ObjectUtils.isNotNull(list2)){ |
|
|
|
|
list2.stream().collect(Collectors.groupingBy(QuestDetailEntity::getStockId)).forEach( (k,v) ->{ |
|
|
|
|
DistributionStockListEntity stockListBy = distributionStockListClient.getStockListById(k); |
|
|
|
|
if(ObjectUtils.isNull(stockListBy)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
QuestContrastVO q = new QuestContrastVO(); |
|
|
|
|
q.setOrderCode(stockListBy.getOrderCode()); |
|
|
|
|
q.setIncomingBatch(stockListBy.getIncomingBatch()); |
|
|
|
|
q.setTotalNumber(stockListBy.getQuantityStock()); |
|
|
|
|
q.setHandQuantity(stockListBy.getQuantityStock()); |
|
|
|
|
q.setBrandName(stockListBy.getBrandName()); |
|
|
|
|
q.setMaterialName(stockListBy.getDescriptionGoods()); |
|
|
|
|
StringBuffer buffer = new StringBuffer(); |
|
|
|
|
//已盘数量
|
|
|
|
|
AtomicReference<Integer> yi = new AtomicReference<>(0); |
|
|
|
|
v.stream().forEach( i ->{ |
|
|
|
|
switch (i.getQuestStatus()){ |
|
|
|
|
case 1: |
|
|
|
|
yi.updateAndGet(v1 -> v1 + 1); |
|
|
|
|
q.setQuestStatusName("部分盘点"); |
|
|
|
|
User user = UserCache.getUser(i.getUpdateUser()); |
|
|
|
|
q.setUpdateUser(user.getAccount()); |
|
|
|
|
q.setUpdateTime(i.getUpdateTime()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
//库位
|
|
|
|
|
if(ObjectUtils.isNull(buffer) && ObjectUtils.isNotNull( i.getPositionCode())){ |
|
|
|
|
buffer.append(i.getPositionCode()); |
|
|
|
|
}else if(ObjectUtils.isNotNull(buffer) && ObjectUtils.isNotNull( i.getPositionCode()) && !buffer.toString().contains(i.getPositionCode())){ |
|
|
|
|
buffer.append(",").append(i.getPositionCode()); |
|
|
|
|
} |
|
|
|
|
//托盘
|
|
|
|
|
if(ObjectUtils.isNotNull(i.getTrayCode())){ |
|
|
|
|
if(ObjectUtils.isNull(q.getTrayCode()) ){ |
|
|
|
|
q.setTrayCode(i.getPositionCode()); |
|
|
|
|
}else if(ObjectUtils.isNotNull(q.getTrayCode()) && !q.getTrayCode().contains(i.getTrayCode())){ |
|
|
|
|
q.setTrayCode(q.getTrayCode()+","+i.getPositionCode()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//更新的货位
|
|
|
|
|
if(ObjectUtils.isNotNull(i.getGroundingPositionCode())){ |
|
|
|
|
if(ObjectUtils.isNull(q.getGroundingPositionCode())){ |
|
|
|
|
q.setGroundingPositionCode(i.getGroundingPositionCode()); |
|
|
|
|
}else if(ObjectUtils.isNotNull(q.getGroundingPositionCode()) && !q.getGroundingPositionCode().contains(i.getGroundingPositionCode())){ |
|
|
|
|
q.setGroundingPositionCode(q.getGroundingPositionCode()+","+i.getGroundingPositionCode()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
q.setDifferenceNum(stockListBy.getQuantityStock() - yi.get()); |
|
|
|
|
q.setPositionCode(buffer.toString()); |
|
|
|
|
voList.add(q); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
voList.addAll(list); |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
return voList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|