Commit 408ec09e authored by 罗林杰's avatar 罗林杰

完善退单

parent 10998c53
...@@ -256,19 +256,20 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos ...@@ -256,19 +256,20 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
@Override @Override
public CyPersistModel merge(StoreGoodsApply storeGoodsApply) { public CyPersistModel merge(StoreGoodsApply storeGoodsApply) {
StoreGoodsLog storeGoodsLog = new StoreGoodsLog(); if(storeGoodsApply.getIsReturn().equals("2")){
storeGoodsLog.setApplyId(storeGoodsApply.getBusinessId()); StoreGoodsLog storeGoodsLog = new StoreGoodsLog();
//根据id查询子表 storeGoodsLog.setApplyId(storeGoodsApply.getBusinessId());
for (StoreGoodsLog box : storeGoodsLogServiceImpl.findAll(storeGoodsLog)) { //根据id查询子表
StoreGoodsStock goodsStock = storeGoodsStockRepository.selectByGoodsId(box.getGoodsId()); for (StoreGoodsLog box : storeGoodsLogServiceImpl.findAll(storeGoodsLog)) {
goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() + box.getGoodsCounts()); StoreGoodsStock goodsStock = storeGoodsStockRepository.selectByGoodsId(box.getGoodsId());
// 返回库存 goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() + box.getGoodsCounts());
storeGoodsStockRepositoryImpl.updateCounts(goodsStock); // 返回库存
storeGoodsStockRepositoryImpl.updateCounts(goodsStock);
}
//修改子表状态
storeGoodsLogServiceImpl.updateStatus(storeGoodsApply);
} }
//修改子表状态
storeGoodsLogServiceImpl.updateStatus(storeGoodsApply);
int line = baseMapper.updateById(storeGoodsApply); int line = baseMapper.updateById(storeGoodsApply);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + storeGoodsApply.getBusinessId() + "的商品申请表信息"); log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + storeGoodsApply.getBusinessId() + "的商品申请表信息");
return new CyPersistModel(line); return new CyPersistModel(line);
......
...@@ -48,5 +48,7 @@ public class StoreGoodsLog extends CyIdIncreEntity<StoreGoodsLog> { ...@@ -48,5 +48,7 @@ public class StoreGoodsLog extends CyIdIncreEntity<StoreGoodsLog> {
* @default * @default
*/ */
private BigDecimal totalPrice; private BigDecimal totalPrice;
private String isReturn;
} }
...@@ -8,6 +8,9 @@ import org.rcisoft.bus.storegoodsapply.service.StoreGoodsApplyService; ...@@ -8,6 +8,9 @@ import org.rcisoft.bus.storegoodsapply.service.StoreGoodsApplyService;
import org.rcisoft.bus.storegoodslog.dao.StoreGoodsLogRepository; import org.rcisoft.bus.storegoodslog.dao.StoreGoodsLogRepository;
import org.rcisoft.bus.storegoodslog.entity.StoreGoodsLog; import org.rcisoft.bus.storegoodslog.entity.StoreGoodsLog;
import org.rcisoft.bus.storegoodslog.service.StoreGoodsLogService; import org.rcisoft.bus.storegoodslog.service.StoreGoodsLogService;
import org.rcisoft.bus.storegoodsstock.dao.StoreGoodsStockRepository;
import org.rcisoft.bus.storegoodsstock.entity.StoreGoodsStock;
import org.rcisoft.bus.storegoodsstock.service.StoreGoodsStockService;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil; import org.rcisoft.core.util.CyUserUtil;
...@@ -33,6 +36,12 @@ public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepositor ...@@ -33,6 +36,12 @@ public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepositor
@Autowired @Autowired
private StoreGoodsApplyService storeGoodsApplyServiceImpl; private StoreGoodsApplyService storeGoodsApplyServiceImpl;
@Autowired
private StoreGoodsStockRepository storeGoodsStockRepository;
@Autowired
private StoreGoodsStockService storeGoodsStockRepositoryImpl;
/** /**
* 保存 商品记录表 * 保存 商品记录表
* *
...@@ -92,12 +101,20 @@ public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepositor ...@@ -92,12 +101,20 @@ public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepositor
StoreGoodsLog oldStoreGoodsLog = storeGoodsLogServiceImpl.findById(storeGoodsLog.getBusinessId()); 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);
}
StoreGoodsApply storeGoodsApply = new StoreGoodsApply(); StoreGoodsApply storeGoodsApply = new StoreGoodsApply();
storeGoodsApply.setBusinessId(oldStoreGoodsLog.getApplyId()); storeGoodsApply.setBusinessId(oldStoreGoodsLog.getApplyId());
storeGoodsApply.setIsReturn("1"); storeGoodsApply.setIsReturn("1");
storeGoodsApplyServiceImpl.merge(storeGoodsApply); storeGoodsApplyServiceImpl.merge(storeGoodsApply);
int line = baseMapper.updateById(storeGoodsLog); oldStoreGoodsLog.setIsReturn("1");
int line = baseMapper.updateById(oldStoreGoodsLog);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + storeGoodsLog.getBusinessId() + "的商品记录表信息"); log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + storeGoodsLog.getBusinessId() + "的商品记录表信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
......
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