|
|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.nov.KgLowDurable.service.impl; |
|
|
|
package com.nov.KgLowDurable.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
@ -127,6 +129,7 @@ public class LdOneOutStorageServiceImpl extends ServiceImpl<LdOneOutStorageMappe |
|
|
|
// 保存出库记录
|
|
|
|
// 保存出库记录
|
|
|
|
LdInventoryRecord inventoryRecord = new LdInventoryRecord() |
|
|
|
LdInventoryRecord inventoryRecord = new LdInventoryRecord() |
|
|
|
.setOneFromId(oneForm.getId()) |
|
|
|
.setOneFromId(oneForm.getId()) |
|
|
|
|
|
|
|
.setOneOutStorageId(dto.getId()) |
|
|
|
.setTransactionType(BatchConstant.OUT_WAREHOUSE) |
|
|
|
.setTransactionType(BatchConstant.OUT_WAREHOUSE) |
|
|
|
.setQuantity(ldOneOutStorageDetail.getTheOutboundQuantity()) |
|
|
|
.setQuantity(ldOneOutStorageDetail.getTheOutboundQuantity()) |
|
|
|
.setOperatorId(dto.getUserInfoVO().getUserId()) |
|
|
|
.setOperatorId(dto.getUserInfoVO().getUserId()) |
|
|
|
@ -260,7 +263,7 @@ public class LdOneOutStorageServiceImpl extends ServiceImpl<LdOneOutStorageMappe |
|
|
|
demandEndRelations.add(demandEndRelation); |
|
|
|
demandEndRelations.add(demandEndRelation); |
|
|
|
|
|
|
|
|
|
|
|
// 计算已出库总量
|
|
|
|
// 计算已出库总量
|
|
|
|
calculateOutboundSumQuantity(detailEntity, detailVO.getLdDemandEndId(), detailVO.getTheOutboundQuantity()); |
|
|
|
//calculateOutboundSumQuantity(detailEntity, detailVO.getLdDemandEndId(), detailVO.getTheOutboundQuantity());
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -459,4 +462,52 @@ public class LdOneOutStorageServiceImpl extends ServiceImpl<LdOneOutStorageMappe |
|
|
|
ldOneOutStorageInfoVO.setLdOneOutStorageDetails(ldOneOutStorageDetailList); |
|
|
|
ldOneOutStorageInfoVO.setLdOneOutStorageDetails(ldOneOutStorageDetailList); |
|
|
|
return ldOneOutStorageInfoVO; |
|
|
|
return ldOneOutStorageInfoVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
|
|
public boolean delete(Long id) { |
|
|
|
|
|
|
|
//根据id删除一级出库表
|
|
|
|
|
|
|
|
this.removeById(id); |
|
|
|
|
|
|
|
//根据id查询一级出库明细
|
|
|
|
|
|
|
|
List<LdOneOutStorageDetail> oneOutStorageDetails = oneOutStorageDetailService.list(Wrappers.<LdOneOutStorageDetail>lambdaQuery().eq(LdOneOutStorageDetail::getOneOutStorageId,id)); |
|
|
|
|
|
|
|
//还原库存
|
|
|
|
|
|
|
|
for (LdOneOutStorageDetail ldOneOutStorageDetail : oneOutStorageDetails) { |
|
|
|
|
|
|
|
System.out.println(ldOneOutStorageDetail.getOneFormId()); |
|
|
|
|
|
|
|
// 库存
|
|
|
|
|
|
|
|
LdOneForm oneForm = oneFormService.getByMaterialCode(ldOneOutStorageDetail.getMaterialCode(),ldOneOutStorageDetail.getOneFormId()); |
|
|
|
|
|
|
|
// 计算数量 金额
|
|
|
|
|
|
|
|
BigDecimal result = oneForm.getNum().add(ldOneOutStorageDetail.getOutboundQuantity()); |
|
|
|
|
|
|
|
oneForm.setNum(result); |
|
|
|
|
|
|
|
oneFormService.updateById(oneForm); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<Long> detailIdList = oneOutStorageDetails.stream().map(LdOneOutStorageDetail::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(detailIdList)){ |
|
|
|
|
|
|
|
oneOutStorageDetailService.removeByIds(detailIdList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//根据id查询末端关联表
|
|
|
|
|
|
|
|
List<LdOneOutStorageDemandEnd> demandEndList = oneOutStorageDemandEndService.list(Wrappers.<LdOneOutStorageDemandEnd>lambdaQuery().eq(LdOneOutStorageDemandEnd::getOneOutStorageId,id)); |
|
|
|
|
|
|
|
List<Long> demandIdList = demandEndList.stream().map(LdOneOutStorageDemandEnd::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(demandIdList)){ |
|
|
|
|
|
|
|
oneOutStorageDemandEndService.removeByIds(demandIdList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//根据id查询出库记录
|
|
|
|
|
|
|
|
List<LdInventoryRecord> inventoryRecordList = iLdInventoryRecordService.list(Wrappers.<LdInventoryRecord>lambdaQuery().eq(LdInventoryRecord::getOneOutStorageId,id)); |
|
|
|
|
|
|
|
List<Long> recordIdList = inventoryRecordList.stream().map(LdInventoryRecord::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(recordIdList)){ |
|
|
|
|
|
|
|
iLdInventoryRecordService.removeByIds(recordIdList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//根据id查询二级入库表
|
|
|
|
|
|
|
|
LdTwoPutStorage twoPutStorage = twoPutStorageService.getOne(Wrappers.<LdTwoPutStorage>lambdaQuery().eq(LdTwoPutStorage::getOneOutStorageId,id)); |
|
|
|
|
|
|
|
if(ObjectUtils.isNotEmpty(twoPutStorage)){ |
|
|
|
|
|
|
|
twoPutStorageService.removeById(twoPutStorage.getId()); |
|
|
|
|
|
|
|
//根据二级入库表查询二级入库明细
|
|
|
|
|
|
|
|
List<LdTwoPutStorageDetail> twoPutStorageDetails = twoPutStorageDetailService.list(Wrappers.<LdTwoPutStorageDetail>lambdaQuery().eq(LdTwoPutStorageDetail::getTwoPutStorageId,twoPutStorage.getId())); |
|
|
|
|
|
|
|
List<Long> twoDetailIdList = twoPutStorageDetails.stream().map(LdTwoPutStorageDetail::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(twoDetailIdList)){ |
|
|
|
|
|
|
|
twoPutStorageDetailService.removeByIds(twoDetailIdList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|