Commit fb914e68 authored by 罗林杰's avatar 罗林杰

完善退单

parent 408ec09e
...@@ -256,7 +256,7 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos ...@@ -256,7 +256,7 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
@Override @Override
public CyPersistModel merge(StoreGoodsApply storeGoodsApply) { public CyPersistModel merge(StoreGoodsApply storeGoodsApply) {
if(storeGoodsApply.getIsReturn().equals("2")){ if("2".equals(storeGoodsApply.getIsReturn())){
StoreGoodsLog storeGoodsLog = new StoreGoodsLog(); StoreGoodsLog storeGoodsLog = new StoreGoodsLog();
storeGoodsLog.setApplyId(storeGoodsApply.getBusinessId()); storeGoodsLog.setApplyId(storeGoodsApply.getBusinessId());
//根据id查询子表 //根据id查询子表
...@@ -269,6 +269,9 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos ...@@ -269,6 +269,9 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
//修改子表状态 //修改子表状态
storeGoodsLogServiceImpl.updateStatus(storeGoodsApply); storeGoodsLogServiceImpl.updateStatus(storeGoodsApply);
} }
if("3".equals(storeGoodsApply.getIsReturn())){
storeGoodsApply.setIsReturn("2");
}
int line = baseMapper.updateById(storeGoodsApply); int line = baseMapper.updateById(storeGoodsApply);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + storeGoodsApply.getBusinessId() + "的商品申请表信息"); log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + storeGoodsApply.getBusinessId() + "的商品申请表信息");
......
...@@ -101,16 +101,18 @@ public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepositor ...@@ -101,16 +101,18 @@ public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepositor
StoreGoodsLog oldStoreGoodsLog = storeGoodsLogServiceImpl.findById(storeGoodsLog.getBusinessId()); StoreGoodsLog oldStoreGoodsLog = storeGoodsLogServiceImpl.findById(storeGoodsLog.getBusinessId());
for (StoreGoodsLog box : storeGoodsLogServiceImpl.findAll(oldStoreGoodsLog)) { if(storeGoodsLog.getIsReturn().equals("1")){
StoreGoodsStock goodsStock = storeGoodsStockRepository.selectByGoodsId(box.getGoodsId()); for (StoreGoodsLog box : storeGoodsLogServiceImpl.findAll(oldStoreGoodsLog)) {
goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() + box.getGoodsCounts()); StoreGoodsStock goodsStock = storeGoodsStockRepository.selectByGoodsId(box.getGoodsId());
// 返回库存 goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() + box.getGoodsCounts());
storeGoodsStockRepositoryImpl.updateCounts(goodsStock); // 返回库存
storeGoodsStockRepositoryImpl.updateCounts(goodsStock);
}
} }
StoreGoodsApply storeGoodsApply = new StoreGoodsApply(); StoreGoodsApply storeGoodsApply = new StoreGoodsApply();
storeGoodsApply.setBusinessId(oldStoreGoodsLog.getApplyId()); storeGoodsApply.setBusinessId(oldStoreGoodsLog.getApplyId());
storeGoodsApply.setIsReturn("1"); storeGoodsApply.setIsReturn(storeGoodsLog.getIsReturn());
storeGoodsApplyServiceImpl.merge(storeGoodsApply); storeGoodsApplyServiceImpl.merge(storeGoodsApply);
oldStoreGoodsLog.setIsReturn("1"); oldStoreGoodsLog.setIsReturn("1");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment