diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AdvanceDetailDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AdvanceDetailDTO.java index 24272a741..a3922ef51 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AdvanceDetailDTO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AdvanceDetailDTO.java @@ -3,6 +3,9 @@ package com.logpm.trunkline.dto; import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; import lombok.Data; +import java.util.ArrayList; +import java.util.List; + @Data public class AdvanceDetailDTO extends TrunklineAdvanceDetailEntity { @@ -11,4 +14,6 @@ public class AdvanceDetailDTO extends TrunklineAdvanceDetailEntity { private Long advanceId; + private List advanceDetailIds = new ArrayList<>(); + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java index 164c47fd4..e93c19619 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java @@ -17,6 +17,7 @@ import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -74,4 +75,32 @@ public class AdvanceDetailController { } + + @ResponseBody + @PostMapping("/deleteAdvanceDetail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "暂存单分页列表", notes = "传入advanceDetailDTO") + public R deleteAdvanceDetail(@RequestBody AdvanceDetailDTO advanceDetailDTO) { + String method = "############deleteAdvanceDetail: "; + log.info(method+"请求参数{}",advanceDetailDTO); + try{ + List advanceDetailIds = advanceDetailDTO.getAdvanceDetailIds(); + + if(0 == advanceDetailIds.size()){ + log.warn(method+"请选择删除的包件"); + return R.fail(405,"请选择删除的包件"); + } + + + return advanceDetailService.deleteAdvanceDetail(advanceDetailDTO); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常",e); + return R.fail(500,"系统异常"); + } + } + + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java index d0445bff9..2be2198bd 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java @@ -36,4 +36,5 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper findOrderPackageCodesByAdvanceId(@Param("advanceId") Long advanceId); + void deleteAdvanceDetailById(@Param("advanceDetailId") Long advanceDetailId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml index fb09163ec..8a47d7dd4 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml @@ -144,4 +144,10 @@ where advance_id = #{advanceId} + + + delete from logpm_trunkline_advance_detail + where id = #{advanceDetailId} + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.java index 7b99e3e1a..5d0f84c77 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.java @@ -26,4 +26,8 @@ public interface TrunklineAdvanceMapper extends BaseMapper findCustomerInfoList(@Param("advanceIds") List advanceIds); void updateTotalNumById(@Param("id") Long id, @Param("totalNum") int totalNum); + + void deletedAdvance(@Param("advanceIds") List advanceIds); + + void subTotalNumByAdvanceId(@Param("advanceId") Long advanceId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml index 806934a94..007d76d8c 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml @@ -97,4 +97,22 @@ where id = #{id} + + delete from logpm_trunkline_advance + + + and id in + + #{item} + + + + + + + update logpm_trunkline_advance + set total_num = total_num - 1 + where id = #{advanceId} + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java index 3e96b1d3c..438f5ad89 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java @@ -9,6 +9,7 @@ import com.logpm.trunkline.vo.AdvanceDetailStockNumVO; import com.logpm.trunkline.vo.BillladingPackageVO; import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.api.R; import java.util.List; import java.util.Map; @@ -45,4 +46,5 @@ public interface ITrunklineAdvanceDetailService extends BaseService advanceIds); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 1d301de07..68fa2fb00 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -735,7 +735,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { for (Long advanceId:advanceIds){ advanceDetailService.deleteByAdvanceId(advanceId); } - advanceService.deleteLogic(advanceIds); + advanceService.deletedAdvance(advanceIds); } @Override diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java index e0ea94919..7ef927161 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java @@ -26,6 +26,7 @@ import org.springblade.common.utils.QRCodeUtil; import org.springblade.common.utils.TemplateUtil; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; @@ -193,4 +194,30 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl advanceDetailIds = advanceDetailDTO.getAdvanceDetailIds(); + for (Long advanceDetailId : advanceDetailIds) { + + TrunklineAdvanceDetailEntity advanceDetailEntity = getById(advanceDetailId); + Long advanceId = advanceDetailEntity.getAdvanceId(); + baseMapper.deleteAdvanceDetailById(advanceDetailId); + + //判断暂存单下还有没有包件 + List strings = baseMapper.findOrderPackageCodesByAdvanceId(advanceId); + if(0 == strings.size()){ + //删除暂存单 + List advanceIds = new ArrayList<>(); + advanceIds.add(advanceId); + advanceMapper.deletedAdvance(advanceIds); + }else{ + //数量减一 + advanceMapper.subTotalNumByAdvanceId(advanceId); + } + + } + + return R.success("删除成功"); + } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java index c1dfb5867..82a5ee3a2 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java @@ -320,4 +320,9 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl advanceIds) { + baseMapper.deletedAdvance(advanceIds); + } + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java index 090894032..57c826396 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java @@ -765,21 +765,24 @@ public class TaskQuestServiceImpl extends BaseServiceImpl>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}", 1); List list = new ArrayList<>(); AtomicBoolean s = new AtomicBoolean(false); - taskSearchDTO.getQuestDetailIds().forEach(i -> { + taskSearchDTO.getQuestDetailIds().stream().forEach(i -> { log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}", i); - if(ObjectUtils.isNotNull(i)){ - //查询当前包件盘点状态 - - QuestDetailEntity questDetail = new QuestDetailEntity(); - questDetail.setId(Long.valueOf(i)); - questDetail.setQuestStatus(1); - questDetail.setUpdateUser(user.getUserId()); - questDetail.setUpdateTime(new Date()); - questDetail.setInventoryUser(user.getUserId()); - questDetail.setInventoryTime(new Date()); - list.add(questDetail); - } + //查询当前包件盘点状态 +// boolean b = questDetailList.stream().anyMatch(q -> q.getId().equals(i) && q.getQuestStatus().equals(1)); +// if(b){ +// s.set(true); +// } + QuestDetailEntity questDetail = new QuestDetailEntity(); + questDetail.setId(Long.valueOf(i)); + questDetail.setQuestStatus(1); + questDetail.setUpdateUser(user.getUserId()); + questDetail.setUpdateTime(new Date()); + questDetail.setInventoryUser(user.getUserId()); + questDetail.setInventoryTime(new Date()); +// questDetail.setId(Long.valueOf(i)); +// questDetail.setQuestStatus(1); + list.add(questDetail); }); log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}", 1);