| | |
| | | package com.consum.base.core.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.service.BaseGoodsModelsService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.WhWarning; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | |
| | | /** |
| | | * @ClassName LWhWarningCoreServiceImpl |
| | |
| | | * @param warehouseId |
| | | * @param baseModelIdList |
| | | */ |
| | | public void updateKuCun(Short warehouseType, Long warehouseId, List<Long> baseModelIdList, FinSysTenantUser sysInfo, Long dealTime) { |
| | | public void updateKuCun(Short warehouseType, Long warehouseId, List<Long> baseModelIdList, FinSysTenantUser sysInfo, |
| | | Long dealTime) { |
| | | if (baseModelIdList == null) { |
| | | baseModelIdList = new ArrayList<>(); |
| | | } |
| | | sysInfo = sysInfo == null ? new FinSysTenantUser() : sysInfo; |
| | | // 获取到达到阈值的物品 |
| | | List<Map<String, Object>> kuCunNotifyList = lWhWarningService.checkKuCun(warehouseType, warehouseId, baseModelIdList); |
| | | // |
| | | List<Map<String, Object>> kuCunNotifyList = |
| | | lWhWarningService.checkKuCun(warehouseType, warehouseId, baseModelIdList); |
| | | // log.info("没有达到阈值的物品"); |
| | | if (CollectionUtils.isEmpty(kuCunNotifyList)) { |
| | | kuCunNormalModel(warehouseType, warehouseId, baseModelIdList); |
| | | return; |
| | | } |
| | | List<Long> allChangModelList = baseModelIdList.stream() |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | List<Long> allChangModelList = baseModelIdList.stream().distinct().collect(Collectors.toList()); |
| | | baseModelIdList = allChangModelList; |
| | | |
| | | // 将数据插入库存预警【WH_WARNING】 |
| | |
| | | |
| | | } |
| | | |
| | | private String KU_CUN_NORMAL_MODEL = "update WH_WARNING set STATES=2 where WAREHOUSE_TYPE=? and BASE_WAREHOUSE_ID=?"; |
| | | private String KU_CUN_NORMAL_MODEL = |
| | | "update WH_WARNING set STATES=2 where WAREHOUSE_TYPE=? and BASE_WAREHOUSE_ID=?"; |
| | | |
| | | /** |
| | | * @param warehouseType |
| | |
| | | |
| | | StringBuilder sql = new StringBuilder(KU_CUN_NORMAL_MODEL); |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(normalBaseModelIdList)) { |
| | | sql.append(" and BASE_GOODS_MODELS_ID in(").append(org.apache.commons.lang3.StringUtils.join(normalBaseModelIdList, ",")).append(")"); |
| | | sql.append(" and BASE_GOODS_MODELS_ID in(") |
| | | .append(org.apache.commons.lang3.StringUtils.join(normalBaseModelIdList, ",")).append(")"); |
| | | } |
| | | return lWhWarningService.update(sql.toString(), params.toArray()); |
| | | } |