|
|
@ -6,10 +6,12 @@ import com.logpm.report.mapper.WarehouseIndexMapper; |
|
|
|
import com.logpm.report.service.IWarehouseIndexService; |
|
|
|
import com.logpm.report.service.IWarehouseIndexService; |
|
|
|
import com.logpm.report.vo.*; |
|
|
|
import com.logpm.report.vo.*; |
|
|
|
import com.logpm.report.vo.indexCount.IndexDeliveryDataVO; |
|
|
|
import com.logpm.report.vo.indexCount.IndexDeliveryDataVO; |
|
|
|
|
|
|
|
import com.logpm.report.vo.indexCount.IndexOpenItemDataByWarWarehouseIdVO; |
|
|
|
import com.logpm.report.vo.indexCount.IndexOpenItemDataVO; |
|
|
|
import com.logpm.report.vo.indexCount.IndexOpenItemDataVO; |
|
|
|
import com.logpm.report.vo.indexCount.IndexSignforDataVO; |
|
|
|
import com.logpm.report.vo.indexCount.IndexSignforDataVO; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.springblade.common.cache.CacheNames; |
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
@ -19,10 +21,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.*; |
|
|
|
import java.util.Calendar; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@Service |
|
|
@ -35,8 +34,15 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IndexOpenOrderDataVO openOrderData(IndexDTO indexDTO) { |
|
|
|
public IndexOpenOrderDataVO openOrderData(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "openOrderData" + ":" + indexDTO.toString()); |
|
|
|
|
|
|
|
IndexOpenOrderDataVO indexOpenOrderDataVO = bladeRedis.get(key); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Objects.isNull(indexOpenOrderDataVO)) { |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
IndexOpenOrderDataVO indexOpenOrderDataVO = new IndexOpenOrderDataVO(); |
|
|
|
indexOpenOrderDataVO = new IndexOpenOrderDataVO(); |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
return indexOpenOrderDataVO; |
|
|
|
return indexOpenOrderDataVO; |
|
|
|
} |
|
|
|
} |
|
|
@ -85,14 +91,110 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
IndexOpenItemDataVO monthNumVO = warehouseIndexMapper.findTotalNum(indexDTO); |
|
|
|
IndexOpenItemDataVO monthNumVO = warehouseIndexMapper.findTotalNum(indexDTO); |
|
|
|
indexOpenOrderDataVO.setMonthNum(monthNumVO.getTotalNum()); |
|
|
|
indexOpenOrderDataVO.setMonthNum(monthNumVO.getTotalNum()); |
|
|
|
indexOpenOrderDataVO.setMonthCount(monthNumVO.getTotalCount()); |
|
|
|
indexOpenOrderDataVO.setMonthCount(monthNumVO.getTotalCount()); |
|
|
|
|
|
|
|
bladeRedis.setEx(key, indexOpenOrderDataVO, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexOpenOrderDataVO; |
|
|
|
return indexOpenOrderDataVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<IndexOpenOrderDataByWarehouseVO> openOrderDataByWarWarehouseId(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "openOrderDataByWarWarehouseId" + ":" + indexDTO.toString()); |
|
|
|
|
|
|
|
List<IndexOpenOrderDataByWarehouseVO> indexOpenOrderDataVOList = bladeRedis.get(key); |
|
|
|
|
|
|
|
if (Objects.isNull(indexOpenOrderDataVOList)) { |
|
|
|
|
|
|
|
// 获取总计数据
|
|
|
|
|
|
|
|
List<IndexOpenItemDataByWarWarehouseIdVO> indexOpenItemDataByWarWarehouseIdList = warehouseIndexMapper.findTotalNumByWarWarehouseId(indexDTO); |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
|
|
|
calendar.set(Calendar.MINUTE, 0); |
|
|
|
|
|
|
|
calendar.set(Calendar.SECOND, 0); |
|
|
|
|
|
|
|
calendar.set(Calendar.MILLISECOND, 0); |
|
|
|
|
|
|
|
Date dayStart = calendar.getTime(); |
|
|
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
|
|
|
|
calendar.set(Calendar.MINUTE, 59); |
|
|
|
|
|
|
|
calendar.set(Calendar.SECOND, 59); |
|
|
|
|
|
|
|
calendar.set(Calendar.MILLISECOND, 999); |
|
|
|
|
|
|
|
Date dayEnd = calendar.getTime(); |
|
|
|
|
|
|
|
indexDTO.setStartDate(dayStart); |
|
|
|
|
|
|
|
indexDTO.setEndDate(dayEnd); |
|
|
|
|
|
|
|
// 获取当前日数
|
|
|
|
|
|
|
|
List<IndexOpenItemDataByWarWarehouseIdVO> indexOpenItemDataByWarWarehouseIdListOfDay = warehouseIndexMapper.findTotalNumByWarWarehouseId(indexDTO); |
|
|
|
|
|
|
|
// 获取当月数据
|
|
|
|
|
|
|
|
// 设置日为1,以获取当前月的第一天
|
|
|
|
|
|
|
|
calendar.set(Calendar.DAY_OF_MONTH, 1); |
|
|
|
|
|
|
|
// 将小时、分钟、秒和毫秒设置为0,确保获取的是完整的第一天
|
|
|
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
|
|
|
calendar.set(Calendar.MINUTE, 0); |
|
|
|
|
|
|
|
calendar.set(Calendar.SECOND, 0); |
|
|
|
|
|
|
|
calendar.set(Calendar.MILLISECOND, 0); |
|
|
|
|
|
|
|
Date firstDayOfMonth = calendar.getTime(); // 获取第一天
|
|
|
|
|
|
|
|
// 获取下个月的第一天
|
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH, 1); |
|
|
|
|
|
|
|
// 再将日减1,以得到当前月的最后一天
|
|
|
|
|
|
|
|
calendar.set(Calendar.DAY_OF_MONTH, 1); |
|
|
|
|
|
|
|
calendar.add(Calendar.DATE, -1); |
|
|
|
|
|
|
|
// 同样确保时间部分为0
|
|
|
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
|
|
|
|
calendar.set(Calendar.MINUTE, 59); |
|
|
|
|
|
|
|
calendar.set(Calendar.SECOND, 59); |
|
|
|
|
|
|
|
calendar.set(Calendar.MILLISECOND, 999); |
|
|
|
|
|
|
|
Date lastDayOfMonth = calendar.getTime(); // 获取最后一天
|
|
|
|
|
|
|
|
indexDTO.setStartDate(firstDayOfMonth); |
|
|
|
|
|
|
|
indexDTO.setEndDate(lastDayOfMonth); |
|
|
|
|
|
|
|
List<IndexOpenItemDataByWarWarehouseIdVO> indexOpenItemDataByWarWarehouseIdListOfMonth = warehouseIndexMapper.findTotalNumByWarWarehouseId(indexDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
indexOpenOrderDataVOList = buildIndexOpenOrderDataVOList(indexOpenItemDataByWarWarehouseIdList, indexOpenItemDataByWarWarehouseIdListOfDay, indexOpenItemDataByWarWarehouseIdListOfMonth); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bladeRedis.setEx(key, indexOpenOrderDataVOList, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexOpenOrderDataVOList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<IndexOpenOrderDataByWarehouseVO> buildIndexOpenOrderDataVOList(List<IndexOpenItemDataByWarWarehouseIdVO> indexOpenItemDataByWarWarehouseIdList, List<IndexOpenItemDataByWarWarehouseIdVO> indexOpenItemDataByWarWarehouseIdListOfDay, List<IndexOpenItemDataByWarWarehouseIdVO> indexOpenItemDataByWarWarehouseIdListOfMonth) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<IndexOpenOrderDataByWarehouseVO> indexOpenOrderDataVOList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (IndexOpenItemDataByWarWarehouseIdVO indexOpenItemDataByWarWarehouseIdVO : indexOpenItemDataByWarWarehouseIdList) { |
|
|
|
|
|
|
|
IndexOpenOrderDataByWarehouseVO indexOpenOrderDataByWarWarehouseIdVO = new IndexOpenOrderDataByWarehouseVO(); |
|
|
|
|
|
|
|
// 总数
|
|
|
|
|
|
|
|
indexOpenOrderDataByWarWarehouseIdVO.setTotalNum(indexOpenItemDataByWarWarehouseIdVO.getTotalNum()); |
|
|
|
|
|
|
|
indexOpenOrderDataByWarWarehouseIdVO.setTotalCount(indexOpenItemDataByWarWarehouseIdVO.getTotalCount()); |
|
|
|
|
|
|
|
indexOpenOrderDataByWarWarehouseIdVO.setWarehouseId(indexOpenItemDataByWarWarehouseIdVO.getWarehouseId()); |
|
|
|
|
|
|
|
indexOpenOrderDataByWarWarehouseIdVO.setWarehouseName(indexOpenItemDataByWarWarehouseIdVO.getWarehouseName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Optional<IndexOpenItemDataByWarWarehouseIdVO> first = indexOpenItemDataByWarWarehouseIdListOfMonth.stream().filter(i -> i.getWarehouseId().equals(indexOpenItemDataByWarWarehouseIdVO.getWarehouseId())).findFirst(); |
|
|
|
|
|
|
|
if (first.isPresent()) { |
|
|
|
|
|
|
|
indexOpenOrderDataByWarWarehouseIdVO.setMonthNum(first.get().getTotalNum()); |
|
|
|
|
|
|
|
indexOpenOrderDataByWarWarehouseIdVO.setMonthCount(first.get().getTotalCount()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Optional<IndexOpenItemDataByWarWarehouseIdVO> second = indexOpenItemDataByWarWarehouseIdListOfDay.stream().filter(i -> i.getWarehouseId().equals(indexOpenItemDataByWarWarehouseIdVO.getWarehouseId())).findFirst(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (second.isPresent()) { |
|
|
|
|
|
|
|
indexOpenOrderDataByWarWarehouseIdVO.setDayNum(second.get().getTotalNum()); |
|
|
|
|
|
|
|
indexOpenOrderDataByWarWarehouseIdVO.setDayCount(second.get().getTotalCount()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
indexOpenOrderDataVOList.add(indexOpenOrderDataByWarWarehouseIdVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexOpenOrderDataVOList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IndexOpenOrderIncomeVO openOrderIncome(IndexDTO indexDTO) { |
|
|
|
public IndexOpenOrderIncomeVO openOrderIncome(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//增加缓存
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "openOrderIncome" + ":" + indexDTO.toString()); |
|
|
|
|
|
|
|
IndexOpenOrderIncomeVO indexOpenOrderIncomeVO = bladeRedis.get(key); |
|
|
|
|
|
|
|
if (Objects.isNull(indexOpenOrderIncomeVO)) { |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
IndexOpenOrderIncomeVO indexOpenOrderIncomeVO = new IndexOpenOrderIncomeVO(); |
|
|
|
indexOpenOrderIncomeVO = new IndexOpenOrderIncomeVO(); |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
return indexOpenOrderIncomeVO; |
|
|
|
return indexOpenOrderIncomeVO; |
|
|
|
} |
|
|
|
} |
|
|
@ -118,6 +220,9 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
indexOpenOrderIncomeVO.setMonthTrunklineFee(incomeMonth.getBigDecimal("trunklineFee")); |
|
|
|
indexOpenOrderIncomeVO.setMonthTrunklineFee(incomeMonth.getBigDecimal("trunklineFee")); |
|
|
|
indexOpenOrderIncomeVO.setMonthWarehouseFee(incomeMonth.getBigDecimal("warehouseFee")); |
|
|
|
indexOpenOrderIncomeVO.setMonthWarehouseFee(incomeMonth.getBigDecimal("warehouseFee")); |
|
|
|
indexOpenOrderIncomeVO.setMonthDistributionFee(incomeMonth.getBigDecimal("distributionFee")); |
|
|
|
indexOpenOrderIncomeVO.setMonthDistributionFee(incomeMonth.getBigDecimal("distributionFee")); |
|
|
|
|
|
|
|
bladeRedis.setEx(key, indexOpenOrderIncomeVO, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexOpenOrderIncomeVO; |
|
|
|
return indexOpenOrderIncomeVO; |
|
|
|
} |
|
|
|
} |
|
|
@ -126,12 +231,12 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
public IndexHandOrderDataVO handOrderData(IndexDTO indexDTO) { |
|
|
|
public IndexHandOrderDataVO handOrderData(IndexDTO indexDTO) { |
|
|
|
//增加缓存
|
|
|
|
//增加缓存
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
// String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "handOrderData");
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "handOrderData" + ":" + indexDTO.toString()); |
|
|
|
// IndexHandOrderDataVO indexHandOrderDataVO = bladeRedis.get(key);
|
|
|
|
IndexHandOrderDataVO indexHandOrderDataVO = bladeRedis.get(key); |
|
|
|
//
|
|
|
|
|
|
|
|
// if (Objects.isNull(indexHandOrderDataVO)) {
|
|
|
|
if (Objects.isNull(indexHandOrderDataVO)) { |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
IndexHandOrderDataVO indexHandOrderDataVO = new IndexHandOrderDataVO(); |
|
|
|
indexHandOrderDataVO = new IndexHandOrderDataVO(); |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
return indexHandOrderDataVO; |
|
|
|
return indexHandOrderDataVO; |
|
|
|
} |
|
|
|
} |
|
|
@ -144,24 +249,61 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
//已打托数量
|
|
|
|
//已打托数量
|
|
|
|
Integer trayNum = warehouseIndexMapper.findTrayNum(indexDTO); |
|
|
|
Integer trayNum = warehouseIndexMapper.findTrayNum(indexDTO); |
|
|
|
indexHandOrderDataVO.setTrayNum(trayNum); |
|
|
|
indexHandOrderDataVO.setTrayNum(trayNum); |
|
|
|
// bladeRedis.setEx(key, indexHandOrderDataVO, 3600L);
|
|
|
|
bladeRedis.setEx(key, indexHandOrderDataVO, 3600L); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexHandOrderDataVO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<IndexHandOrderDataByWarehouseIdVO> handOrderDataByWarehouseId(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "handOrderDataByWarehouseId" + ":" + indexDTO.toString()); |
|
|
|
|
|
|
|
List<IndexHandOrderDataByWarehouseIdVO> indexHandOrderDataVO = bladeRedis.get(key); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Objects.isNull(indexHandOrderDataVO)) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<IndexHandOrderDataByWarehouseIdVO> indexHandOrderDataByWarehouseIdVO = warehouseIndexMapper.handOrderDataByWarehouseId(indexDTO); |
|
|
|
|
|
|
|
//当前在库的库存品
|
|
|
|
|
|
|
|
List<WarehouseNumberVO> stockNumberDataByWarehouseIdVO = warehouseIndexMapper.findHandStockListNumByWarehouseId(indexDTO); |
|
|
|
|
|
|
|
//已打托数量
|
|
|
|
|
|
|
|
List<WarehouseNumberVO> trayNumList = warehouseIndexMapper.findTrayNumByWarehouseId(indexDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
indexHandOrderDataVO = buildIndexHandOrderDataByWarehouseIdVO(indexHandOrderDataByWarehouseIdVO, stockNumberDataByWarehouseIdVO, trayNumList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bladeRedis.setEx(key, indexHandOrderDataVO, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return indexHandOrderDataVO; |
|
|
|
return indexHandOrderDataVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<IndexHandOrderDataByWarehouseIdVO> buildIndexHandOrderDataByWarehouseIdVO(List<IndexHandOrderDataByWarehouseIdVO> indexHandOrderDataByWarehouseIdVO, List<WarehouseNumberVO> stockNumberDataByWarehouseIdVO, List<WarehouseNumberVO> trayNumList) { |
|
|
|
|
|
|
|
for (IndexHandOrderDataByWarehouseIdVO indexHandOrderDataByWarehouseIdVO1 : indexHandOrderDataByWarehouseIdVO) { |
|
|
|
|
|
|
|
WarehouseNumberVO warehouseNumberVO1 = stockNumberDataByWarehouseIdVO.stream().filter(warehouseNumberVO -> warehouseNumberVO.getWarehouseId().equals(indexHandOrderDataByWarehouseIdVO1.getWarehouseId())).findFirst().orElse(null); |
|
|
|
|
|
|
|
Integer upshelfNum = Objects.isNull(warehouseNumberVO1) ? 0 : warehouseNumberVO1.getCountNumber(); |
|
|
|
|
|
|
|
indexHandOrderDataByWarehouseIdVO1.setTotalNum(indexHandOrderDataByWarehouseIdVO1.getTotalNum() + upshelfNum); |
|
|
|
|
|
|
|
WarehouseNumberVO warehouseNumberVO = trayNumList.stream().filter(trayNum -> trayNum.getWarehouseId().equals(indexHandOrderDataByWarehouseIdVO1.getWarehouseId())).findFirst().orElse(null); |
|
|
|
|
|
|
|
Integer trayNum = Objects.isNull(warehouseNumberVO) ? 0 : warehouseNumberVO.getCountNumber(); |
|
|
|
|
|
|
|
indexHandOrderDataByWarehouseIdVO1.setTrayNum(trayNum); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexHandOrderDataByWarehouseIdVO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IndexAllocationDataVO allocationData(IndexDTO indexDTO) { |
|
|
|
public IndexAllocationDataVO allocationData(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
|
|
//增加缓存
|
|
|
|
//增加缓存
|
|
|
|
// BladeUser user = AuthUtil.getUser();
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
// String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "allocationData");
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "allocationData:" + indexDTO.toString()); |
|
|
|
// IndexAllocationDataVO indexAllocationDataVO = bladeRedis.get(key);
|
|
|
|
IndexAllocationDataVO indexAllocationDataVO = bladeRedis.get(key); |
|
|
|
//
|
|
|
|
//
|
|
|
|
// if (Objects.isNull(indexAllocationDataVO)) {
|
|
|
|
if (Objects.isNull(indexAllocationDataVO)) { |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
IndexAllocationDataVO indexAllocationDataVO = new IndexAllocationDataVO(); |
|
|
|
indexAllocationDataVO = new IndexAllocationDataVO(); |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
return indexAllocationDataVO; |
|
|
|
return indexAllocationDataVO; |
|
|
|
} |
|
|
|
} |
|
|
@ -183,21 +325,80 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
indexAllocationDataVO.setNullNum(totalAllocationNum - useAllocationNum); |
|
|
|
indexAllocationDataVO.setNullNum(totalAllocationNum - useAllocationNum); |
|
|
|
indexAllocationDataVO.setUpshelfNum(upshelfNum); |
|
|
|
indexAllocationDataVO.setUpshelfNum(upshelfNum); |
|
|
|
indexAllocationDataVO.setNoUpshelfNum(totalNum - upshelfNum); |
|
|
|
indexAllocationDataVO.setNoUpshelfNum(totalNum - upshelfNum); |
|
|
|
// bladeRedis.setEx(key, indexAllocationDataVO, 3600L);
|
|
|
|
bladeRedis.setEx(key, indexAllocationDataVO, 3600L); |
|
|
|
// }
|
|
|
|
} |
|
|
|
return indexAllocationDataVO; |
|
|
|
return indexAllocationDataVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<IndexAllocationDataByWarehouseIdVO> allocationDataByWarehouseId(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
//增加缓存
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "allocationDataByWarehouseId:" + indexDTO.toString()); |
|
|
|
|
|
|
|
List<IndexAllocationDataByWarehouseIdVO> indexAllocationDataByWarehouseIdVO = bladeRedis.get(key); |
|
|
|
|
|
|
|
if (Objects.isNull(indexAllocationDataByWarehouseIdVO)) { |
|
|
|
|
|
|
|
// 定制品在库数
|
|
|
|
|
|
|
|
List<IndexHandOrderDataByWarehouseIdVO> indexHandOrderDataByWarehouseIdVO = warehouseIndexMapper.handOrderDataByWarehouseId(indexDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 库存品在库数
|
|
|
|
|
|
|
|
List<WarehouseNumberVO> stockNumberDataByWarehouseIdVO = warehouseIndexMapper.findHandStockListNumByWarehouseId(indexDTO); |
|
|
|
|
|
|
|
// 货位数
|
|
|
|
|
|
|
|
List<WarehouseNumberVO> totalAllocationNumDataByWarehouseIdVO = warehouseIndexMapper.findTotalAllocationNumByWarehouseId(indexDTO); |
|
|
|
|
|
|
|
// 已使用库位数
|
|
|
|
|
|
|
|
List<WarehouseNumberVO> useAllocationNumByWarehouseIdVO = warehouseIndexMapper.findUseAllocationNumByWarehouseId(indexDTO); |
|
|
|
|
|
|
|
//已上架件数
|
|
|
|
|
|
|
|
List<WarehouseNumberVO> upshelfNumList = warehouseIndexMapper.findUpshelfNumByWarehouseId(indexDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
indexAllocationDataByWarehouseIdVO = buildIndexAllocationDataByWarehouseIdVO(indexHandOrderDataByWarehouseIdVO, stockNumberDataByWarehouseIdVO, |
|
|
|
|
|
|
|
totalAllocationNumDataByWarehouseIdVO, useAllocationNumByWarehouseIdVO, upshelfNumList); |
|
|
|
|
|
|
|
bladeRedis.setEx(key, indexAllocationDataByWarehouseIdVO, 3600L); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return indexAllocationDataByWarehouseIdVO; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<IndexAllocationDataByWarehouseIdVO> buildIndexAllocationDataByWarehouseIdVO(List<IndexHandOrderDataByWarehouseIdVO> indexHandOrderDataByWarehouseIdVO, List<WarehouseNumberVO> stockNumberDataByWarehouseIdVO, List<WarehouseNumberVO> totalAllocationNumDataByWarehouseIdVO, List<WarehouseNumberVO> useAllocationNumByWarehouseIdVO, List<WarehouseNumberVO> upshelfNumList) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<IndexAllocationDataByWarehouseIdVO> indexAllocationDataByWarehouseIdVOList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (IndexHandOrderDataByWarehouseIdVO handOrderDataByWarehouseIdVO : indexHandOrderDataByWarehouseIdVO) { |
|
|
|
|
|
|
|
IndexAllocationDataByWarehouseIdVO indexAllocationDataVO = new IndexAllocationDataByWarehouseIdVO(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WarehouseNumberVO warehouseNumberVO1 = stockNumberDataByWarehouseIdVO.stream().filter(warehouseNumberVO -> warehouseNumberVO.getWarehouseId().equals(handOrderDataByWarehouseIdVO.getWarehouseId())).findFirst().orElse(null); |
|
|
|
|
|
|
|
Integer totalNum = handOrderDataByWarehouseIdVO.getTotalNum() + (Objects.isNull(warehouseNumberVO1) ? 0 : warehouseNumberVO1.getCountNumber()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WarehouseNumberVO warehouseNumberVO2 = totalAllocationNumDataByWarehouseIdVO.stream().filter(warehouseNumberVO -> warehouseNumberVO.getWarehouseId().equals(handOrderDataByWarehouseIdVO.getWarehouseId())).findFirst().orElse(null); |
|
|
|
|
|
|
|
Integer totalAllocationNum = Objects.isNull(warehouseNumberVO2) ? 0 : warehouseNumberVO2.getCountNumber(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WarehouseNumberVO warehouseNumberVO3 = useAllocationNumByWarehouseIdVO.stream().filter(warehouseNumberVO -> warehouseNumberVO.getWarehouseId().equals(handOrderDataByWarehouseIdVO.getWarehouseId())).findFirst().orElse(null); |
|
|
|
|
|
|
|
Integer useAllocationNum = Objects.isNull(warehouseNumberVO3) ? 0 : warehouseNumberVO3.getCountNumber(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WarehouseNumberVO warehouseNumberVO4 = upshelfNumList.stream().filter(warehouseNumberVO -> warehouseNumberVO.getWarehouseId().equals(handOrderDataByWarehouseIdVO.getWarehouseId())).findFirst().orElse(null); |
|
|
|
|
|
|
|
Integer upshelfNum = Objects.isNull(warehouseNumberVO4) ? 0 : warehouseNumberVO4.getCountNumber(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
indexAllocationDataVO.setTotalNum(totalAllocationNum); |
|
|
|
|
|
|
|
indexAllocationDataVO.setUseNum(useAllocationNum); |
|
|
|
|
|
|
|
indexAllocationDataVO.setNullNum(totalAllocationNum - useAllocationNum); |
|
|
|
|
|
|
|
indexAllocationDataVO.setUpshelfNum(upshelfNum); |
|
|
|
|
|
|
|
indexAllocationDataVO.setNoUpshelfNum(totalNum - upshelfNum); |
|
|
|
|
|
|
|
indexAllocationDataByWarehouseIdVOList.add(indexAllocationDataVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return indexAllocationDataByWarehouseIdVOList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IndexTrunklineHandOrderDataVO trunklineHandOrderData(IndexDTO indexDTO) { |
|
|
|
public IndexTrunklineHandOrderDataVO trunklineHandOrderData(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
|
|
// BladeUser user = AuthUtil.getUser();
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
// String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "trunklineHandOrderData");
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "trunklineHandOrderData:" + indexDTO.toString()); |
|
|
|
// IndexTrunklineHandOrderDataVO indexTrunklineHandOrderDataVO = bladeRedis.get(key);
|
|
|
|
IndexTrunklineHandOrderDataVO indexTrunklineHandOrderDataVO = bladeRedis.get(key); |
|
|
|
//
|
|
|
|
|
|
|
|
// if (Objects.isNull(indexTrunklineHandOrderDataVO)) {
|
|
|
|
if (Objects.isNull(indexTrunklineHandOrderDataVO)) { |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
IndexTrunklineHandOrderDataVO indexTrunklineHandOrderDataVO = new IndexTrunklineHandOrderDataVO(); |
|
|
|
indexTrunklineHandOrderDataVO = new IndexTrunklineHandOrderDataVO(); |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
return indexTrunklineHandOrderDataVO; |
|
|
|
return indexTrunklineHandOrderDataVO; |
|
|
|
} |
|
|
|
} |
|
|
@ -219,32 +420,44 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
indexTrunklineHandOrderDataVO.setHandleNum(packageHandleNum + zeroHandleNum); |
|
|
|
indexTrunklineHandOrderDataVO.setHandleNum(packageHandleNum + zeroHandleNum); |
|
|
|
indexTrunklineHandOrderDataVO.setHandleWeight(packageHandleWeight.add(zeroHandleWeight)); |
|
|
|
indexTrunklineHandOrderDataVO.setHandleWeight(packageHandleWeight.add(zeroHandleWeight)); |
|
|
|
indexTrunklineHandOrderDataVO.setHandleVolume(packageHandleVolume.add(zeroHandleVolume)); |
|
|
|
indexTrunklineHandOrderDataVO.setHandleVolume(packageHandleVolume.add(zeroHandleVolume)); |
|
|
|
// }
|
|
|
|
bladeRedis.setEx(key, indexTrunklineHandOrderDataVO, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return indexTrunklineHandOrderDataVO; |
|
|
|
return indexTrunklineHandOrderDataVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IndexTrunklineCarsDataVO trunklineCarsData(IndexDTO indexDTO) { |
|
|
|
public IndexTrunklineCarsDataVO trunklineCarsData(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "trunklineCarsData:" + indexDTO.toString()); |
|
|
|
|
|
|
|
IndexTrunklineCarsDataVO indexTrunklineCarsDataVO = bladeRedis.get(key); |
|
|
|
|
|
|
|
if (Objects.isNull(indexTrunklineCarsDataVO)) { |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
IndexTrunklineCarsDataVO indexTrunklineCarsDataVO = new IndexTrunklineCarsDataVO(); |
|
|
|
indexTrunklineCarsDataVO = new IndexTrunklineCarsDataVO(); |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
return indexTrunklineCarsDataVO; |
|
|
|
return indexTrunklineCarsDataVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
indexTrunklineCarsDataVO = warehouseIndexMapper.trunklineCarsData(indexDTO); |
|
|
|
indexTrunklineCarsDataVO = warehouseIndexMapper.trunklineCarsData(indexDTO); |
|
|
|
|
|
|
|
bladeRedis.setEx(key, indexTrunklineCarsDataVO, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexTrunklineCarsDataVO; |
|
|
|
return indexTrunklineCarsDataVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IndexUnloadAbnormalDataVO unloadAbnormalData(IndexDTO indexDTO) { |
|
|
|
public IndexUnloadAbnormalDataVO unloadAbnormalData(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "unloadAbnormalData:" + indexDTO.toString()); |
|
|
|
|
|
|
|
IndexUnloadAbnormalDataVO indexUnloadAbnormalDataVO = bladeRedis.get(key); |
|
|
|
|
|
|
|
if (Objects.isNull(indexUnloadAbnormalDataVO)) { |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
IndexUnloadAbnormalDataVO indexUnloadAbnormalDataVO = new IndexUnloadAbnormalDataVO(); |
|
|
|
indexUnloadAbnormalDataVO = new IndexUnloadAbnormalDataVO(); |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
return indexUnloadAbnormalDataVO; |
|
|
|
return indexUnloadAbnormalDataVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
indexDTO.setStartDate(CommonUtil.getDayStart()); |
|
|
|
indexDTO.setStartDate(CommonUtil.getDayStart()); |
|
|
|
indexDTO.setEndDate(CommonUtil.getDayEnd()); |
|
|
|
indexDTO.setEndDate(CommonUtil.getDayEnd()); |
|
|
|
JSONObject dayJson = warehouseIndexMapper.findAbnormalData(indexDTO); |
|
|
|
JSONObject dayJson = warehouseIndexMapper.findAbnormalData(indexDTO); |
|
|
@ -274,14 +487,22 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
monthRate = new BigDecimal(sendMonthNum).divide(new BigDecimal(unloadMonthNum), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); |
|
|
|
monthRate = new BigDecimal(sendMonthNum).divide(new BigDecimal(unloadMonthNum), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); |
|
|
|
} |
|
|
|
} |
|
|
|
indexUnloadAbnormalDataVO.setAbnormalMonthRate(monthRate); |
|
|
|
indexUnloadAbnormalDataVO.setAbnormalMonthRate(monthRate); |
|
|
|
|
|
|
|
bladeRedis.setEx(key, indexUnloadAbnormalDataVO, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexUnloadAbnormalDataVO; |
|
|
|
return indexUnloadAbnormalDataVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<IndexDeliveryDataVO> deliveryData(IndexDTO indexDTO) { |
|
|
|
public List<IndexDeliveryDataVO> deliveryData(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "deliveryData:" + indexDTO.toString()); |
|
|
|
|
|
|
|
List<IndexDeliveryDataVO> indexDeliveryDataVOList = bladeRedis.get(key); |
|
|
|
|
|
|
|
if (Objects.isNull(indexDeliveryDataVOList)) { |
|
|
|
//查询商市配的信息
|
|
|
|
//查询商市配的信息
|
|
|
|
List<IndexDeliveryDataVO> indexDeliveryDataVOList = new ArrayList<>(); |
|
|
|
indexDeliveryDataVOList = new ArrayList<>(); |
|
|
|
List<IndexDeliveryDataVO> indexDeliveryDataVOS = warehouseIndexMapper.findDeliveryTotal(indexDTO); |
|
|
|
List<IndexDeliveryDataVO> indexDeliveryDataVOS = warehouseIndexMapper.findDeliveryTotal(indexDTO); |
|
|
|
if (!indexDeliveryDataVOS.isEmpty()) { |
|
|
|
if (!indexDeliveryDataVOS.isEmpty()) { |
|
|
|
for (IndexDeliveryDataVO indexDeliveryDataVO : indexDeliveryDataVOS) { |
|
|
|
for (IndexDeliveryDataVO indexDeliveryDataVO : indexDeliveryDataVOS) { |
|
|
@ -344,12 +565,23 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
indexTripartiteDeliveryCityDataVO.setTotalVolume(tripartiteTotalVolume); |
|
|
|
indexTripartiteDeliveryCityDataVO.setTotalVolume(tripartiteTotalVolume); |
|
|
|
indexDeliveryDataVOList.add(indexTripartiteDeliveryCityDataVO); |
|
|
|
indexDeliveryDataVOList.add(indexTripartiteDeliveryCityDataVO); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bladeRedis.setEx(key, indexDeliveryDataVOList, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return indexDeliveryDataVOList; |
|
|
|
return indexDeliveryDataVOList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<IndexSignforDataVO> signforData(IndexDTO indexDTO) { |
|
|
|
public List<IndexSignforDataVO> signforData(IndexDTO indexDTO) { |
|
|
|
List<IndexSignforDataVO> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "signforData:" + indexDTO.toString()); |
|
|
|
|
|
|
|
List<IndexSignforDataVO> list = bladeRedis.get(key); |
|
|
|
|
|
|
|
if (Objects.isNull(list)) { |
|
|
|
|
|
|
|
list = new ArrayList<>(); |
|
|
|
Date date = new Date(); |
|
|
|
Date date = new Date(); |
|
|
|
SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String day = dayFormat.format(date); |
|
|
|
String day = dayFormat.format(date); |
|
|
@ -501,6 +733,10 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { |
|
|
|
indexBillLadingSignforMonthDataVO.setClerkOverTimeScale(signScale); |
|
|
|
indexBillLadingSignforMonthDataVO.setClerkOverTimeScale(signScale); |
|
|
|
} |
|
|
|
} |
|
|
|
list.add(indexBillLadingSignforMonthDataVO); |
|
|
|
list.add(indexBillLadingSignforMonthDataVO); |
|
|
|
|
|
|
|
bladeRedis.setEx(key, list, 3600L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
return list; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|