| | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.util.IdUtil; |
| | | import com.consum.model.po.*; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormInventory; |
| | | import com.consum.model.po.LWhFormInventoryGoods; |
| | | import com.consum.model.po.LWhFormOutput; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhFormProcureGoods; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @ClassName LWhFormInventoryCoreService |
| | | |
| | | * @Date 2023/11/1 |
| | | * @Description |
| | | * @Version 1.0 |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class LWhFormInventoryCoreService { |
| | | |
| | | private LWhFormInventoryGoodsServiceImpl lWhFormInventoryGoods; |
| | | private LWhFormOutputCoreService lWhFormOutputCoreService; |
| | | private CodeGeneratorService codeGeneratorService; |
| | |
| | | |
| | | @Autowired |
| | | public LWhFormInventoryCoreService(LWhFormInventoryGoodsServiceImpl lWhFormInventoryGoods, |
| | | LWhFormOutputCoreService lWhFormOutputCoreService, |
| | | CodeGeneratorService codeGeneratorService, |
| | | LWhFormProcureService lWhFormProcureService, |
| | | BaseWarehouseServiceImpl baseWarehouseService, |
| | | LWhFormProcureGoodsService lWhFormProcureGoodsService, |
| | | LWhProcureModelService lWhProcureModelService, |
| | | BaseGoodsTemplateServiceImpl baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | | LWhFormInventoryServiceImpl lWhFormInventoryService, |
| | | LWhFormProcureCoreService lWhFormProcureCoreService, |
| | | LWhFormOutputServiceImpl lWhFormOutputService |
| | | LWhFormOutputCoreService lWhFormOutputCoreService, |
| | | CodeGeneratorService codeGeneratorService, |
| | | LWhFormProcureService lWhFormProcureService, |
| | | BaseWarehouseServiceImpl baseWarehouseService, |
| | | LWhFormProcureGoodsService lWhFormProcureGoodsService, |
| | | LWhProcureModelService lWhProcureModelService, |
| | | BaseGoodsTemplateServiceImpl baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | | LWhFormInventoryServiceImpl lWhFormInventoryService, |
| | | LWhFormProcureCoreService lWhFormProcureCoreService, |
| | | LWhFormOutputServiceImpl lWhFormOutputService |
| | | |
| | | ) { |
| | | this.lWhFormInventoryGoods = lWhFormInventoryGoods; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据 盘点单 生成 出库单 和 入库单 |
| | | * 盘点单中 盘盈物品生成入库单,盘亏生成出库单 |
| | | * 根据 盘点单 生成 出库单 和 入库单 盘点单中 盘盈物品生成入库单,盘亏生成出库单 |
| | | * |
| | | * @param whformInventoryId 盘点单id |
| | | * @return status true/false |
| | | * errMsg 错误消息 |
| | | * @return status true/false errMsg 错误消息 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String createInOutFormByInventoryId(Long whformInventoryId, S_user_core currentUser, FinSysTenantUser sysInfo) { |
| | |
| | | return "没有找到盘点单结果物品"; |
| | | } |
| | | Map<Integer, List<LWhFormInventoryGoods>> inventoryGoodsMap = lWhFormInventoryGoods.stream() |
| | | .filter(goods -> goods.getInventoryResult() == 2 || goods.getInventoryResult() == 3) |
| | | .collect(Collectors.groupingBy(LWhFormInventoryGoods::getInventoryResult)); |
| | | .filter(goods -> goods.getInventoryResult() == 2 || goods.getInventoryResult() == 3) |
| | | .collect(Collectors.groupingBy(LWhFormInventoryGoods::getInventoryResult)); |
| | | if (CollectionUtils.isEmpty(lWhFormInventoryGoods)) { |
| | | // rtnMap.put("status", true); |
| | | return null; |
| | |
| | | inOutMap.putAll(ckMap); |
| | | Long lWhFormOutputId = (Long) inOutMap.get("outId"); |
| | | //2.根据出库单出库 |
| | | Long lWarehouseFlowId = lWhFormOutputCoreService.outFormByTransId(lWhFormOutputId, currentUser, stopTime); |
| | | Long lWarehouseFlowId = lWhFormOutputCoreService.outFormByTransId(lWhFormOutputId, WhBusinessEnum.CAIGOU, currentUser, stopTime); |
| | | if (lWarehouseFlowId == null) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // throw new RuntimeException("创建出库单失败"); |
| | |
| | | * @param currentUser |
| | | */ |
| | | private Map<String, Object> createInFormByInventoryId(Long warehouseId, Long procureTime, List<LWhFormInventoryGoods> inventoryGoodsList, |
| | | S_user_core currentUser) { |
| | | S_user_core currentUser) { |
| | | if (CollectionUtils.isEmpty(inventoryGoodsList)) { |
| | | return null; |
| | | } |
| | |
| | | continue; |
| | | } |
| | | // 查询型号库存 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, (short) 1, null); |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | LWhProcureModel model = new LWhProcureModel(); |
| | | model.setId(NumberGenerator.getLongSequenceNumber()); |
| | | model.setFromProcureGoodsId(fromProcureGoodsId); |
| | |
| | | * @param currentUser |
| | | */ |
| | | private Map<String, Object> createOutFormByInventoryId(Long warehouseId, Long procureTime, List<LWhFormInventoryGoods> inventoryGoodsList, |
| | | S_user_core currentUser, FinSysTenantUser sysInfo) { |
| | | S_user_core currentUser, FinSysTenantUser sysInfo) { |
| | | if (CollectionUtils.isEmpty(inventoryGoodsList)) { |
| | | return null; |
| | | } |
| | |
| | | continue; |
| | | } |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, (short) 1, null); |
| | | int goodsNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | //新增L_WH_PROCURE_MODEL记录 |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | | lWhProcureModel.setId(IdUtil.generateId()); |