| | |
| | | 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; |
| | | import com.ld.igds.models.Depot; |
| | | import com.ld.igds.models.DepotConf; |
| | | import com.ld.igds.models.DepotStore; |
| | |
| | | |
| | | @Override |
| | | public List<Depot> getCacheDepotList(String companyId) { |
| | | |
| | | String patten = RedisConst.buildKey(companyId, RedisConst.KEY_DEPOT); |
| | | |
| | | Set<String> keys = redisUtil.keys(patten); |
| | |
| | | public List<Depot> getCacheDepotList(String companyId, String deptId) { |
| | | if (null == deptId) return null; |
| | | String patten = RedisConst.buildKey(companyId, RedisConst.KEY_DEPOT); |
| | | |
| | | Set<String> keys = redisUtil.keys(patten); |
| | | if (null == keys) return null; |
| | | |
| | |
| | | List<DepotConf> data = getCacheDepotConf(companyId); |
| | | if (null == data) return null; |
| | | |
| | | return data.stream().filter(item -> item.getGrainSer().equals(serId)) |
| | | return data.stream().filter(item -> (serId.equals(item.getGrainSer()) || serId.equals(item.getGasSer()) || serId.equals(item.getEsSer()) )) |
| | | .findAny().orElse(null); |
| | | } |
| | | |
| | |
| | | String key = RedisConst.buildKey(Constant.DEFAULT_PARENT_CODE, "COMPANY_LIST"); |
| | | |
| | | return (List<DefaultCompany>) redisUtil.get(key); |
| | | } |
| | | |
| | | @Override |
| | | public void initInoutDepotStore(InoutData data) { |
| | | |
| | | //先从缓存中获取下信息,查看是否已经初始化过数据,如果有则直接跳过,如果没有则重新验证 |
| | | // 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) { |
| | | // 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())) { |
| | | depotStore.setOutDate(new Date()); |
| | | } else { |
| | | depotStore.setStoreDate(new Date()); |
| | | } |
| | | |
| | | if (null != data.getFoodYear()) { |
| | | depotStore.setFoodYear(data.getFoodYear()); |
| | | } |
| | | depotStore.setRemark("系统生成记录,确认调整"); |
| | | |
| | | addDepotStore(depotStore, false); |
| | | commonMapper.updateDepotStatus(depotStore.getCompanyId(), depotStore.getDepotId(), depotStore.getDepotStatus()); |
| | | |
| | | // redisUtil.set(key, depotStatus, 5 * 24 * 60 * 60); |
| | | } |
| | | |
| | | @Override |