futian.liu
2023-11-30 33f4541719f5bf8f98616e3bcfcae1c416c69551
consum-base/src/main/java/com/consum/base/service/LWhFormInventoryServiceImpl.java
@@ -30,6 +30,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/**
@@ -46,11 +47,7 @@
    @Autowired
    private BaseWarehouseServiceImpl baseWarehouseService;
    @Autowired
    private FinSysTenantUserServiceImpl finSysTenantUserService;
    @Autowired
    private LWhFormInventoryGoodsServiceImpl inventoryGoodsService;
    @Autowired
    private BaseGoodsTemplateServiceImpl baseGoodsTemplateService;
    @Autowired
    private LWhGoodsService lWhGoodsService;
    @Autowired
@@ -160,7 +157,7 @@
    }
    public void saveInventory(FormInventoryVO dto, Long id) {
    public List<FormInventoryGoodsVO> saveInventory(FormInventoryVO dto, Long id) {
        //1.根据盘点单id查询盘点单
        LWhFormInventory lWhFormInventory = this.get(new LWhFormInventory(id));
        if (lWhFormInventory == null) {
@@ -178,11 +175,9 @@
        if (CollectionUtils.isEmpty(formInventoryGoodsList)) {
            log.error("盘点单物品为空");
        }
        int num = inventoryGoodsService.add(formInventoryGoodsList, id);
        if (num != formInventoryGoodsList.size()) {
            log.error("更新盘点单物品失败");
        }
        List<FormInventoryGoodsVO> result = inventoryGoodsService.add(formInventoryGoodsList, id);
        return result;
    }
@@ -192,6 +187,7 @@
     * @author 卢庆阳
     * @date 2023/10/31
     */
    @Transactional(rollbackFor = Exception.class)
    public int updateInventoryInfo(LWhFormInventoryParam dto, Integer state, S_user_core currentUser, FinSysTenantUser sysInfo) {
        //1.根据盘点单id查询盘点单
        LWhFormInventory lWhFormInventory = this.get(new LWhFormInventory(dto.getId()));
@@ -229,51 +225,6 @@
        return 1;
    }
    /**
     * 完成盘点
     *
     * @author 卢庆阳
     * @date 2023/10/31
     */
//    public int finishPd(LWhFormInventoryParam dto) {
//        //1.根据盘点单id查询盘点单
//        LWhFormInventory lWhFormInventory = this.get(new LWhFormInventory(dto.getId()));
//        if (lWhFormInventory == null) {
//            log.error("根据盘点单id查询盘点单 失败");
//            return 0;
//        }
//        //2.修改盘点单
//        lWhFormInventory.setStates(2);
//        lWhFormInventory.setStopTime(DateUtils.getDateTimeNumber(System.currentTimeMillis()));
//        int flag1 = this.update(lWhFormInventory);
//        if (flag1 == 0) {
//            log.error("修改盘点单 失败");
//            return 0;
//        }
//        //3.更新盘点单物品
//        List<LWhFormInventoryGoods> inventoryGoodsList = dto.getInventoryGoodsList();
//        if (CollectionUtils.isEmpty(inventoryGoodsList)) {
//            log.error("盘点单物品 为空");
//            return 0;
//        }
//        for (LWhFormInventoryGoods inventoryGoods : inventoryGoodsList) {
//            int errorCounts = inventoryGoods.getInitCounts() - inventoryGoods.getInventoryCounts();
//            if (errorCounts > 0) {
//                inventoryGoods.setInventoryResult(3);
//            } else if (errorCounts < 0) {
//                inventoryGoods.setInventoryResult(2);
//            } else {
//                inventoryGoods.setInventoryResult(1);
//            }
//            inventoryGoods.setErrorCounts(Math.abs(errorCounts));
//        }
//        int flag2 = inventoryGoodsService.update(inventoryGoodsList);
//        if (flag2 != inventoryGoodsList.size()) {
//            log.error("更新盘点单物品 失败");
//            return 0;
//        }
//        return 1;
//    }
    /**
     * @return
@@ -344,6 +295,7 @@
                formInventoryDetailVO.getInventoryResult() == null ? null : (formInventoryDetailVO.getInventoryResult() == 2 ? "盘盈" : "盘亏"));
            formInventoryDetailVO.setInventoryType(
                formInventoryDetailVO.getInventoryResult() == null ? null : (formInventoryDetailVO.getInventoryResult() == 2 ? "盘盈入库" : "盘亏出库"));
            formInventoryDetailVO.setWarehouseFormCode(formInventoryDetailVO.getWarehouseFormCode());
            result.add(formInventoryDetailVO);
        });
        pageUtil.setDatas(result);
@@ -384,7 +336,7 @@
        formInventoryVO.setWarehouseName(inventory.getWarehouseName());
        String sql =
            "select bgm.id,bgt.id baseGoodsTemplateId,bgt.GOODS_NAME goodsTemplateName,bgm.MODEL_NAME baseGoodsModelsName,bgt.CLASSIFICATION type,bgm.UNIT "
            "select bgt.id baseGoodsTemplateId,bgt.GOODS_NAME goodsTemplateName,bgm.MODEL_NAME baseGoodsModelsName,bgt.CLASSIFICATION type,bgm.UNIT "
                + "from base_goods_models bgm left join base_goods_template bgt on bgm.GOODS_TEMPLATES_ID = bgt.id "
                + "where bgt.AGENCY_ID = :agencyId";
        HashMap<String, Object> param = new HashMap<>();