feat(盘点单创建):修改查询逻辑
This commit is contained in:
parent
ba4a9088e3
commit
e0545072b3
@ -1,6 +1,7 @@
|
||||
package com.foreverwin.mom.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -96,41 +98,48 @@ public class ZWmsInventoryCheckSnapshotServiceImpl extends ServiceImpl<ZWmsInven
|
||||
List<ZWmsInventoryCheckSnapshot> notifySnapshotList = new ArrayList<>();
|
||||
// 判断是否有盘点数据
|
||||
for (ZWmsInventoryCheckSnapshot wmsInventoryCheckSnapshot : zWmsInventoryCheckSnapshotList) {
|
||||
for (ZWmsInventoryCheckCount zWmsInventoryCheckCount : zWmsInventoryCheckCountList) {
|
||||
if (Objects.equals(zWmsInventoryCheckCount.getInventoryId(), wmsInventoryCheckSnapshot.getInventoryId())) {
|
||||
// 快照
|
||||
String wmsStorageBin = wmsInventoryCheckSnapshot.getWmsStorageBin();
|
||||
BigDecimal qtyOnHand = wmsInventoryCheckSnapshot.getQtyOnHand();
|
||||
// 盘点
|
||||
String wmsStorageBinA = zWmsInventoryCheckCount.getWmsStorageBin();
|
||||
BigDecimal qtyOnHandA = zWmsInventoryCheckCount.getQtyOnHand();
|
||||
wmsInventoryCheckSnapshot.setWmsStorageBinActual(wmsStorageBinA);
|
||||
wmsInventoryCheckSnapshot.setQtyOnHandActual(qtyOnHandA);
|
||||
wmsInventoryCheckSnapshot.setDifferenceType("5");
|
||||
if (!Objects.equals(wmsStorageBin, wmsStorageBinA)) {
|
||||
// 货格不一致
|
||||
wmsInventoryCheckSnapshot.setDifferenceType("4");
|
||||
}
|
||||
if (!Objects.equals(qtyOnHand, qtyOnHandA)) {
|
||||
// 数量不一致
|
||||
wmsInventoryCheckSnapshot.setDifferenceType("1");
|
||||
}
|
||||
result.add(wmsInventoryCheckSnapshot);
|
||||
} else {
|
||||
// 判断一下,是否存在,并且不在盘点列表中
|
||||
if (!notifySnapshotList.contains(wmsInventoryCheckSnapshot) &&
|
||||
!zWmsInventoryCheckCountList.stream().map(ZWmsInventoryCheckCount::getInventoryId).collect(Collectors.toList()).contains(wmsInventoryCheckSnapshot.getInventoryId())) {
|
||||
notifySnapshotList.add(wmsInventoryCheckSnapshot);
|
||||
if (CollectionUtil.isNotEmpty(zWmsInventoryCheckCountList)) {
|
||||
for (ZWmsInventoryCheckCount zWmsInventoryCheckCount : zWmsInventoryCheckCountList) {
|
||||
if (Objects.equals(zWmsInventoryCheckCount.getInventoryId(), wmsInventoryCheckSnapshot.getInventoryId())) {
|
||||
// 快照
|
||||
String wmsStorageBin = wmsInventoryCheckSnapshot.getWmsStorageBin();
|
||||
BigDecimal qtyOnHand = wmsInventoryCheckSnapshot.getQtyOnHand();
|
||||
// 盘点
|
||||
String wmsStorageBinA = zWmsInventoryCheckCount.getWmsStorageBin();
|
||||
BigDecimal qtyOnHandA = zWmsInventoryCheckCount.getQtyOnHand();
|
||||
wmsInventoryCheckSnapshot.setWmsStorageBinActual(wmsStorageBinA);
|
||||
wmsInventoryCheckSnapshot.setQtyOnHandActual(qtyOnHandA);
|
||||
wmsInventoryCheckSnapshot.setDifferenceType("5");
|
||||
if (!Objects.equals(wmsStorageBin, wmsStorageBinA)) {
|
||||
// 货格不一致
|
||||
wmsInventoryCheckSnapshot.setDifferenceType("4");
|
||||
}
|
||||
if (!Objects.equals(qtyOnHand, qtyOnHandA)) {
|
||||
// 数量不一致
|
||||
wmsInventoryCheckSnapshot.setDifferenceType("1");
|
||||
}
|
||||
result.add(wmsInventoryCheckSnapshot);
|
||||
} else {
|
||||
// 判断一下,是否存在,并且不在盘点列表中
|
||||
if (!notifySnapshotList.contains(wmsInventoryCheckSnapshot) &&
|
||||
!zWmsInventoryCheckCountList.stream().map(ZWmsInventoryCheckCount::getInventoryId).collect(Collectors.toList()).contains(wmsInventoryCheckSnapshot.getInventoryId())) {
|
||||
notifySnapshotList.add(wmsInventoryCheckSnapshot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
// 不存在于盘点中,但在快照中
|
||||
wmsInventoryCheckSnapshot.setDifferenceType("3");
|
||||
result.add(wmsInventoryCheckSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
if (!notifySnapshotList.isEmpty()) {
|
||||
for (ZWmsInventoryCheckSnapshot wmsInventoryCheckSnapshot : notifySnapshotList) {
|
||||
for (ZWmsInventoryCheckSnapshot wmsInventoryCheckSnapshot2 : notifySnapshotList) {
|
||||
// 不存在于快照中
|
||||
wmsInventoryCheckSnapshot.setDifferenceType("3");
|
||||
result.add(wmsInventoryCheckSnapshot);
|
||||
wmsInventoryCheckSnapshot2.setDifferenceType("3");
|
||||
result.add(wmsInventoryCheckSnapshot2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user