List<OutStoreDetailEntity> items = outStore.getItems(); for (OutStoreDetailEntity item : items){ Long planDetailId = item.getPlanDetailId(); PlanDetailEntity planDetailEntity = planDetailDao.selectById(planDetailId); if(!(planDetailEntity.getIssuedCount()<=planDetailEntity.getCount())&&!((planDetailEntity.getIssuedCount()+item.getCount()) <= planDetailEntity.getIssuedCount())){ } planDetailEntity.setIssuedCount(item.getCount()+planDetailEntity.getIssuedCount()); planDetailDao.updateById(planDetailEntity); }
时间: 2024-03-12 07:46:50 浏览: 13
这段代码的作用是将一个出库单中的每个出库明细对应的计划明细的已发数量进行更新,同时进行判断是否超出计划数量。
具体流程如下:
1. 获取出库单中的所有出库明细。
```java
List<OutStoreDetailEntity> items = outStore.getItems();
```
2. 遍历每个出库明细,获取对应的计划明细,并更新已发数量。
```java
for (OutStoreDetailEntity item : items){
Long planDetailId = item.getPlanDetailId(); // 获取计划明细ID
PlanDetailEntity planDetailEntity = planDetailDao.selectById(planDetailId); // 获取计划明细实体
planDetailEntity.setIssuedCount(item.getCount()+planDetailEntity.getIssuedCount()); // 更新已发数量
planDetailDao.updateById(planDetailEntity); // 更新计划明细实体
}
```
3. 对于每个更新后的计划明细,判断是否超出计划数量。如果超出,则需要进行相应的处理。
```java
if(!(planDetailEntity.getIssuedCount()<=planDetailEntity.getCount())&&!((planDetailEntity.getIssuedCount()+item.getCount()) <= planDetailEntity.getIssuedCount())){
// 处理超出计划数量的情况
}
```
其中,`planDetailEntity.getIssuedCount()`表示已发数量,`planDetailEntity.getCount()`表示计划数量,`item.getCount()`表示出库数量。如果已发数量加上出库数量超过计划数量,则表示超出计划数量。
相关推荐
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/msword](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)