jiazx0107@163.com
2023-05-29 135e1039d78e767536d91bcbce04d2efedb2f7b2
igds-core/src/main/java/com/ld/igds/common/impl/CommonDataServiceImpl.java
@@ -7,7 +7,6 @@
import com.ld.igds.common.dto.THDto;
import com.ld.igds.common.mapper.CommonMapper;
import com.ld.igds.constant.Constant;
import com.ld.igds.constant.DepotStatus;
import com.ld.igds.constant.RedisConst;
import com.ld.igds.inout.InoutConstant;
import com.ld.igds.inout.dto.InoutData;
@@ -51,7 +50,6 @@
    @Override
    public List<Depot> getCacheDepotList(String companyId) {
        String patten = RedisConst.buildKey(companyId, RedisConst.KEY_DEPOT);
        Set<String> keys = redisUtil.keys(patten);
@@ -318,40 +316,34 @@
    @Override
    public void initInoutDepotStore(InoutData data) {
        String depotStatus = DepotStatus.STATUS_03.getCode();
        if (InoutConstant.TYPE_OUT.equals(data.getType())) {
            depotStatus = DepotStatus.STATUS_04.getCode();
        }
        //先从缓存中获取下信息,查看是否已经初始化过数据,如果有则直接跳过,如果没有则重新验证
        String key = RedisConst.buildKey(data.getDepotId(), "DEPOT_STORE", depotStatus);
        String tag = (String) redisUtil.get(key);
        if (null != tag) return;
       // String key = RedisConst.buildKey(data.getDepotId(), "DEPOT_STORE", depotStatus);
//        String tag = (String) redisUtil.get(key);
//        if (null != tag) return;
        //获取当前仓库最后一个库存记录
        DepotStore depotStore = getLastDepotStore(data.getDepotId());
        //如果有数据,并且状态类一致,表示缓存没有了,但是已经做过初始化
        if (null != depotStore && depotStatus.equals(depotStore.getDepotStatus())) {
            redisUtil.set(key, depotStatus, 5 * 24 * 60 * 60);
            return;
        }
//        if (null != depotStore && depotStatus.equals(depotStore.getDepotStatus())) {
//            redisUtil.set(key, depotStatus, 5 * 24 * 60 * 60);
//            return;
//        }
        //从来没有做个库存管理调整
        if (null == depotStore) {
            Depot depot = this.getCacheDepot(data.getCompanyId(), data.getDepotId());
            depotStore = new DepotStore(depot, depotStatus);
            if (null != data.getFoodYear()) {
                depotStore.setFoodYear(data.getFoodYear());
            }
        } else { //有记录,但是状态与当前作业不一致,也需要初始化
            depotStore.setDepotStatus(depotStatus);
            depotStore.setUpdateDate(new Date());
            depotStore.setCreateDate(new Date());
            depotStore.setUpdateUser(null);
        }
//        if (null == depotStore) {
//            Depot depot = this.getCacheDepot(data.getCompanyId(), data.getDepotId());
//            depotStore = new DepotStore(depot, depotStatus);
//            if (null != data.getFoodYear()) {
//                depotStore.setFoodYear(data.getFoodYear());
//            }
//
//        } else { //有记录,但是状态与当前作业不一致,也需要初始化
//            depotStore.setDepotStatus(depotStatus);
//            depotStore.setUpdateDate(new Date());
//            depotStore.setUpdateUser(null);
//        }
        depotStore.setId(null);
        if (InoutConstant.TYPE_OUT.equals(data.getType())) {
@@ -368,7 +360,7 @@
        addDepotStore(depotStore, false);
        commonMapper.updateDepotStatus(depotStore.getCompanyId(), depotStore.getDepotId(), depotStore.getDepotStatus());
        redisUtil.set(key, depotStatus, 5 * 24 * 60 * 60);
       // redisUtil.set(key, depotStatus, 5 * 24 * 60 * 60);
    }
    @Override
@@ -378,7 +370,6 @@
    @Override
    public void addDepotStore(DepotStore store, boolean updateDepot) {
        if (null == store.getCreateDate()) store.setCreateDate(new Date());
        if (null == store.getUpdateDate()) store.setUpdateDate(new Date());
        if (null == store.getId()) store.setId(ContextUtil.getUUID());