Browse Source

1.干线bug修复

fix-sign
zhenghaoyu 4 months ago
parent
commit
5129ab36d1
  1. 1
      blade-biz-common/src/main/java/org/springblade/common/constant/WorkNodeEnums.java
  2. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java
  3. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java
  4. 8
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml
  5. 57
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

1
blade-biz-common/src/main/java/org/springblade/common/constant/WorkNodeEnums.java

@ -13,6 +13,7 @@ import java.io.Serializable;
@Getter
public enum WorkNodeEnums implements Serializable {
DELETE_DATA_ENTRY(100000, "删除数据"),
INITIAL_DATA_ENTRY(101010, "数据入库"),
INITIAL_WAREHOUSE_ENTRY(101020, "始发仓入库"),

7
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java

@ -93,6 +93,13 @@ public class AdvanceDetailController {
return R.fail(405,"请选择删除的包件");
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"请选择仓库");
return R.fail(405,"请选择仓库");
}
advanceDetailDTO.setWarehouseId(myCurrentWarehouse.getId());
advanceDetailDTO.setWarehouseName(myCurrentWarehouse.getName());
return advanceDetailService.deleteAdvanceDetail(advanceDetailDTO);
}catch (CustomerException e){

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java

@ -102,4 +102,7 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanc
List<CarsLoadScanInfoVO> findCarsLoadScanInfoByOrderPackageCodes(@Param("orderPackageCodes") List<String> orderPackageCodes);
IPage<OrderDetailInfoVO> findOrderDetailsAndTrunklineCarsNo(IPage<Object> page, @Param("param") OrderDetailsDTO orderDetailsDTO);
void deleteListByIds(@Param("advanceDetailIdList") List<Long> advanceDetailIdList);
}

8
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml

@ -735,4 +735,12 @@
AND cmax.cupdateTime = ltcls.create_time
</select>
<delete id="deleteListByIds" >
delete from logpm_trunkline_advance_detail
where id in
<foreach collection="advanceDetailIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>

57
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

@ -20,6 +20,7 @@ import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.entity.TrunklineAdvanceEntity;
import com.logpm.trunkline.mapper.TrunklineAdvanceDetailMapper;
import com.logpm.trunkline.mapper.TrunklineAdvanceMapper;
import com.logpm.trunkline.service.IPackageTrackLogAsyncService;
import com.logpm.trunkline.service.ISendFanoutService;
import com.logpm.trunkline.service.ITrunklineAdvanceDetailService;
import com.logpm.trunkline.vo.*;
@ -43,6 +44,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
@ -67,6 +69,8 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
private final ISendFanoutService sendFanoutService;
private final IPackageTrackLogAsyncService packageTrackLogAsyncService;
@Override
public void updatePackageStatusById(String packageStatus, Long advanceDetailId, Long warehouseId, String warehouseName, Date incomingTime) {
baseMapper.updatePackageStatusById(packageStatus, advanceDetailId, warehouseId, warehouseName, incomingTime);
@ -254,25 +258,44 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public R deleteAdvanceDetail(AdvanceDetailDTO advanceDetailDTO) {
List<Long> advanceDetailIds = advanceDetailDTO.getAdvanceDetailIds();
for (Long advanceDetailId : advanceDetailIds) {
TrunklineAdvanceDetailEntity advanceDetailEntity = getById(advanceDetailId);
Long advanceId = advanceDetailEntity.getAdvanceId();
baseMapper.deleteAdvanceDetailById(advanceDetailId);
//判断暂存单下还有没有包件
List<String> strings = baseMapper.findOrderPackageCodesByAdvanceId(advanceId);
if (0 == strings.size()) {
//删除暂存单
List<Long> advanceIds = new ArrayList<>();
advanceIds.add(advanceId);
advanceMapper.deletedAdvance(advanceIds);
} else {
//数量减一
advanceMapper.subTotalNumByAdvanceId(advanceId);
QueryWrapper<TrunklineAdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", advanceDetailIds);
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = baseMapper.selectList(queryWrapper);
//把advanceDetailEntities通过advanceId进行分组
Map<Long, List<TrunklineAdvanceDetailEntity>> advanceDetailEntityMap = advanceDetailEntities.stream().collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getAdvanceId));
List<String> orderPackageCodes = new ArrayList<>();
advanceDetailEntityMap.keySet().forEach(advanceId -> {
List<TrunklineAdvanceDetailEntity> advanceDetailEntities1 = advanceDetailEntityMap.get(advanceId);
if(CollUtil.isNotEmpty(advanceDetailEntities1)){
//把advanceDetailEntities1的id放入一个List
List<Long> advanceDetailIdList = advanceDetailEntities1.stream().map(TrunklineAdvanceDetailEntity::getId).collect(Collectors.toList());
baseMapper.deleteListByIds(advanceDetailIdList);
List<String> strings = baseMapper.findOrderPackageCodesByAdvanceId(advanceId);
if (0 == strings.size()) {
//删除暂存单
List<Long> advanceIds = new ArrayList<>();
advanceIds.add(advanceId);
advanceMapper.deletedAdvance(advanceIds);
} else {
//数量减一
advanceMapper.subTotalNumByAdvanceId(advanceId);
}
//把advanceDetailEntities1所有元素的orderPackageCode放入一个List
List<String> orderPackageCodeList = advanceDetailEntities1.stream().map(TrunklineAdvanceDetailEntity::getOrderPackageCode).collect(Collectors.toList());
orderPackageCodes.addAll(orderPackageCodeList);
}
}
});
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, advanceDetailDTO.getWarehouseId(), advanceDetailDTO.getWarehouseName(), WorkNodeEnums.DELETE_DATA_ENTRY.getCode(), "包件删除");
return R.success("删除成功");
}

Loading…
Cancel
Save