futian.liu
2023-12-11 6586db1ec90fd6fbf0e4c7795137379b80ee31c1
consum-base/src/main/java/com/consum/base/service/impl/LWhFormInventoryGoodsServiceImpl.java
File was renamed from consum-base/src/main/java/com/consum/base/service/LWhFormInventoryGoodsServiceImpl.java
@@ -1,4 +1,4 @@
package com.consum.base.service;
package com.consum.base.service.impl;
import java.util.ArrayList;
import java.util.List;
@@ -7,8 +7,10 @@
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.consum.base.core.type.InventoryResultType;
import com.consum.base.core.utils.IdUtil;
import com.consum.base.pojo.response.FormInventoryGoodsVO;
import com.consum.base.service.LWhFormInventoryGoodsService;
import com.consum.model.po.LWhFormInventoryGoods;
import com.walker.jdbc.service.BaseServiceImpl;
@@ -22,20 +24,16 @@
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED)
public class LWhFormInventoryGoodsServiceImpl extends BaseServiceImpl {
public class LWhFormInventoryGoodsServiceImpl extends BaseServiceImpl implements LWhFormInventoryGoodsService {
    /**
     * @return
     * @Description 根据盘点单id查询盘点单物品
     * @Author 卢庆阳
     * @Date 2023/10/31
     */
    @Override
    public List<LWhFormInventoryGoods> getByInventoryId(Long id) {
        LWhFormInventoryGoods inventoryGoods = new LWhFormInventoryGoods();
        inventoryGoods.setWhFormInventoryId(id);
        return this.select(inventoryGoods);
    }
    @Override
    public List<FormInventoryGoodsVO> add(List<FormInventoryGoodsVO> inventoryGoodsList, Long inventoryId) {
        List<LWhFormInventoryGoods> goodsList = new ArrayList<>();
        for (FormInventoryGoodsVO inventoryGoods : inventoryGoodsList) {
@@ -56,6 +54,7 @@
        return inventoryGoodsList;
    }
    @Override
    public int updateInventoryGoods(List<FormInventoryGoodsVO> inventoryGoodsList) {
        List<LWhFormInventoryGoods> goodsList = new ArrayList<>();
        for (FormInventoryGoodsVO inventoryGoods : inventoryGoodsList) {
@@ -68,13 +67,14 @@
                lWhFormInventoryGoods.setInventoryCounts(realNum);
                lWhFormInventoryGoods.setErrorCounts(Math.abs(errorCount));
                // 盘点结果(1=正常;2=盘盈;3=盘亏)
                lWhFormInventoryGoods.setInventoryResult((errorCount > 0) ? 2 : (errorCount < 0) ? 3 : 1);
                // TODO 批量更新
                this.update(lWhFormInventoryGoods);
                // goodsList.add(lWhFormInventoryGoods);
                lWhFormInventoryGoods.setInventoryResult((errorCount > 0) ? InventoryResultType.SURPLUS.getValue()
                    : (errorCount < 0) ? InventoryResultType.LOSS.getValue() : InventoryResultType.NORMAL.getValue());
                // this.update(lWhFormInventoryGoods);
                goodsList.add(lWhFormInventoryGoods);
            }
        }
        this.updateBatch(goodsList);
        return 1;
    }