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

完善退单

parent 408ec09e
......@@ -256,7 +256,7 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
@Override
public CyPersistModel merge(StoreGoodsApply storeGoodsApply) {
if(storeGoodsApply.getIsReturn().equals("2")){
if("2".equals(storeGoodsApply.getIsReturn())){
StoreGoodsLog storeGoodsLog = new StoreGoodsLog();
storeGoodsLog.setApplyId(storeGoodsApply.getBusinessId());
//根据id查询子表
......@@ -269,6 +269,9 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
//修改子表状态
storeGoodsLogServiceImpl.updateStatus(storeGoodsApply);
}
if("3".equals(storeGoodsApply.getIsReturn())){
storeGoodsApply.setIsReturn("2");
}
int line = baseMapper.updateById(storeGoodsApply);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + storeGoodsApply.getBusinessId() + "的商品申请表信息");
......
......@@ -101,16 +101,18 @@ public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepositor
StoreGoodsLog oldStoreGoodsLog = storeGoodsLogServiceImpl.findById(storeGoodsLog.getBusinessId());
for (StoreGoodsLog box : storeGoodsLogServiceImpl.findAll(oldStoreGoodsLog)) {
StoreGoodsStock goodsStock = storeGoodsStockRepository.selectByGoodsId(box.getGoodsId());
goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() + box.getGoodsCounts());
// 返回库存
storeGoodsStockRepositoryImpl.updateCounts(goodsStock);
if(storeGoodsLog.getIsReturn().equals("1")){
for (StoreGoodsLog box : storeGoodsLogServiceImpl.findAll(oldStoreGoodsLog)) {
StoreGoodsStock goodsStock = storeGoodsStockRepository.selectByGoodsId(box.getGoodsId());
goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() + box.getGoodsCounts());
// 返回库存
storeGoodsStockRepositoryImpl.updateCounts(goodsStock);
}
}
StoreGoodsApply storeGoodsApply = new StoreGoodsApply();
storeGoodsApply.setBusinessId(oldStoreGoodsLog.getApplyId());
storeGoodsApply.setIsReturn("1");
storeGoodsApply.setIsReturn(storeGoodsLog.getIsReturn());
storeGoodsApplyServiceImpl.merge(storeGoodsApply);
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