|
|
@ -8,12 +8,20 @@ import com.win.module.eam.controller.countadjustPlan.vo.CountadjustPlanExportReq |
|
|
|
import com.win.module.eam.controller.countadjustPlan.vo.CountadjustPlanPageReqVO; |
|
|
|
import com.win.module.eam.controller.countadjustPlan.vo.CountadjustPlanUpdateReqVO; |
|
|
|
import com.win.module.eam.convert.countadjustPlan.CountadjustPlanConvert; |
|
|
|
import com.win.module.eam.dal.dataobject.adjustRecord.AdjustRecordDetailDO; |
|
|
|
import com.win.module.eam.dal.dataobject.adjustRecord.AdjustRecordMainDO; |
|
|
|
import com.win.module.eam.dal.dataobject.countJobDetail.CountJobDetailDO; |
|
|
|
import com.win.module.eam.dal.dataobject.countJobMain.CountJobMainDO; |
|
|
|
import com.win.module.eam.dal.dataobject.countRecord.CountRecordDetailDO; |
|
|
|
import com.win.module.eam.dal.dataobject.countRecord.CountRecordMainDO; |
|
|
|
import com.win.module.eam.dal.dataobject.countadjustPlan.CountadjustPlanDO; |
|
|
|
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO; |
|
|
|
import com.win.module.eam.dal.mysql.adjustRecord.AdjustRecordDetailMapper; |
|
|
|
import com.win.module.eam.dal.mysql.adjustRecord.AdjustRecordMainMapper; |
|
|
|
import com.win.module.eam.dal.mysql.countJobMain.CountJobDetailMapper; |
|
|
|
import com.win.module.eam.dal.mysql.countJobMain.CountJobMainMapper; |
|
|
|
import com.win.module.eam.dal.mysql.countRecord.CountRecordDetailMapper; |
|
|
|
import com.win.module.eam.dal.mysql.countRecord.CountRecordMainMapper; |
|
|
|
import com.win.module.eam.dal.mysql.countadjustPlan.CountadjustPlanMapper; |
|
|
|
import com.win.module.eam.dal.mysql.itemaccounts.ItemAccountsMapper; |
|
|
|
import com.win.module.eam.enums.basic.BooleanTypeEnum; |
|
|
@ -49,6 +57,17 @@ public class CountadjustPlanServiceImpl implements CountadjustPlanService { |
|
|
|
@Resource |
|
|
|
private SerialNumberApi serialNumberApi; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private CountRecordMainMapper countRecordMainMapper; |
|
|
|
@Resource |
|
|
|
private CountRecordDetailMapper countRecordDetailMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private AdjustRecordMainMapper adjustRecordMainMapper; |
|
|
|
@Resource |
|
|
|
private AdjustRecordDetailMapper adjustRecordDetailMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Long createCountadjustPlan(CountadjustPlanCreateReqVO createReqVO) { |
|
|
@ -94,9 +113,50 @@ public class CountadjustPlanServiceImpl implements CountadjustPlanService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public Integer deleteCountadjustPlan(Long id) { |
|
|
|
// 校验存在
|
|
|
|
validateCountadjustPlanExists(id); |
|
|
|
CountadjustPlanDO countadjustPlanDO = countadjustPlanMapper.selectById(id); |
|
|
|
if (countadjustPlanDO == null) { |
|
|
|
throw exception(COUNTADJUST_PLAN_NOT_EXISTS); |
|
|
|
} |
|
|
|
QueryWrapper<CountJobMainDO> jobMainDO = new QueryWrapper<>(); |
|
|
|
jobMainDO.eq("number",countadjustPlanDO.getNumber()); |
|
|
|
CountJobMainDO countJobMainDO = countJobMainMapper.selectOne(jobMainDO);//盘点工单主
|
|
|
|
if(countJobMainDO!=null){//有关联删除
|
|
|
|
countJobMainMapper.deleteById(countJobMainDO.getId());//删除关联工单
|
|
|
|
QueryWrapper<CountJobDetailDO> jobDetailsDO = new QueryWrapper<>(); |
|
|
|
jobDetailsDO.eq("master_id",countJobMainDO.getId()); |
|
|
|
List<CountJobDetailDO> countJobDetailDOS = countJobDetailMapper.selectList(jobDetailsDO);//盘点工单子
|
|
|
|
for(CountJobDetailDO en:countJobDetailDOS){//删除工单子表
|
|
|
|
countJobDetailMapper.deleteById(en.getId()); |
|
|
|
} |
|
|
|
QueryWrapper<CountRecordMainDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("job_number",countJobMainDO.getNumber()); |
|
|
|
CountRecordMainDO countRecordMainDO = countRecordMainMapper.selectOne(queryWrapper);//盘点记录主
|
|
|
|
if(countRecordMainDO!=null){//盘点记录
|
|
|
|
countRecordMainMapper.deleteById(countRecordMainDO.getId()); |
|
|
|
QueryWrapper<CountRecordDetailDO> queryWrapper1 = new QueryWrapper<>(); |
|
|
|
queryWrapper1.eq("master_id",countJobMainDO.getId()); |
|
|
|
List<CountRecordDetailDO> countRecordDetailDOS = countRecordDetailMapper.selectList(queryWrapper1);//盘点记录子
|
|
|
|
for(CountRecordDetailDO en:countRecordDetailDOS){ |
|
|
|
countRecordDetailMapper.deleteById(en.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
QueryWrapper<AdjustRecordMainDO> queryAdjustMain = new QueryWrapper<>(); |
|
|
|
queryAdjustMain.eq("plan_number",countadjustPlanDO.getNumber()); |
|
|
|
AdjustRecordMainDO adjustRecordMainDO = adjustRecordMainMapper.selectOne(queryAdjustMain);//盘点调整记录主
|
|
|
|
if(adjustRecordMainDO!=null){ |
|
|
|
adjustRecordMainMapper.deleteById(adjustRecordMainDO.getId()); |
|
|
|
QueryWrapper<AdjustRecordDetailDO> queryAdjustDetails = new QueryWrapper<>(); |
|
|
|
queryAdjustDetails.eq("master_id",adjustRecordMainDO.getId()); |
|
|
|
List<AdjustRecordDetailDO> adjustRecordDetailDOS = adjustRecordDetailMapper.selectList(queryAdjustDetails);//盘点调整记录子
|
|
|
|
for(AdjustRecordDetailDO en:adjustRecordDetailDOS){ |
|
|
|
adjustRecordDetailMapper.deleteById(en.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// 删除
|
|
|
|
return countadjustPlanMapper.deleteById(id); |
|
|
|
} |
|
|
|