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

完善退单

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