| | |
| | | @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.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())) { |
| | |
| | | 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 |