|
|
|
@ -17,15 +17,22 @@
|
|
|
|
|
package com.logpm.basicdata.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataGoodsAllocationEntity; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataGoodsAreaEntity; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataGoodsShelfEntity; |
|
|
|
|
import com.logpm.basicdata.excel.BasicdataGoodsAreaExcel; |
|
|
|
|
import com.logpm.basicdata.mapper.BasicdataGoodsAllocationMapper; |
|
|
|
|
import com.logpm.basicdata.mapper.BasicdataGoodsAreaMapper; |
|
|
|
|
import com.logpm.basicdata.mapper.BasicdataGoodsShelfMapper; |
|
|
|
|
import com.logpm.basicdata.service.IBasicdataGoodsAreaService; |
|
|
|
|
import com.logpm.basicdata.vo.BasicdataGoodsAreaVO; |
|
|
|
|
import com.logpm.basicdata.vo.BasicdataNodeVO; |
|
|
|
|
import com.logpm.basicdata.vo.BasicdataWarehouseVO; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownGoodsClient; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
@ -50,6 +57,11 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
|
|
|
|
|
|
|
|
|
|
private BasicdataGoodsAreaMapper basicdataGoodsAreaMapper; |
|
|
|
|
|
|
|
|
|
private BasicdataGoodsShelfMapper basicdataGoodsShelfMapper; |
|
|
|
|
|
|
|
|
|
private BasicdataGoodsAllocationMapper basicdataGoodsAllocationMapper; |
|
|
|
|
|
|
|
|
|
private IWarehouseUpdownGoodsClient warehouseUpdownGoodsClient; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<BasicdataGoodsAreaVO> selectWarehouseGoodsAreaPage(IPage<BasicdataGoodsAreaVO> page, BasicdataGoodsAreaVO basicdataGoodsAreaVO) { |
|
|
|
@ -99,21 +111,33 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public boolean removeGoodsArea(List<String> ids) { |
|
|
|
|
public R removeGoodsArea(List<Long> ids) { |
|
|
|
|
//删除货区,查看货区下是否存在货架信息
|
|
|
|
|
if (Func.isEmpty(ids)){ |
|
|
|
|
log.error("参数错误:{}"+ids); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
boolean result = false; |
|
|
|
|
for (String id : ids) { |
|
|
|
|
result = SqlHelper.retBool(basicdataGoodsAreaMapper.removeGoodsArea(id)); |
|
|
|
|
if (!result){ |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
// if (Func.isEmpty(ids)){
|
|
|
|
|
// log.error("参数错误:{}"+ids);
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// boolean result = false;
|
|
|
|
|
// for (String id : ids) {
|
|
|
|
|
// result = SqlHelper.retBool(basicdataGoodsAreaMapper.removeGoodsArea(id));
|
|
|
|
|
// if (!result){
|
|
|
|
|
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//查询该货区有无货物
|
|
|
|
|
Integer integer = warehouseUpdownGoodsClient.selectCountByArea(ids); |
|
|
|
|
if (integer>0){ |
|
|
|
|
return R.fail("有货物,无法删除"); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
//删除对应下面的货架货位
|
|
|
|
|
basicdataGoodsShelfMapper.delete(new QueryWrapper<BasicdataGoodsShelfEntity>().lambda() |
|
|
|
|
.in(BasicdataGoodsShelfEntity::getGoodsAreaId,ids) |
|
|
|
|
); |
|
|
|
|
basicdataGoodsAllocationMapper.delete(new QueryWrapper<BasicdataGoodsAllocationEntity>().lambda() |
|
|
|
|
.in(BasicdataGoodsAllocationEntity::getGoodsAreaId,ids) |
|
|
|
|
); |
|
|
|
|
return R.status(this.deleteLogic(ids)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|