diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AddWaybillTrackDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AddWaybillTrackDTO.java index 967e0f3b2..a13950a06 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AddWaybillTrackDTO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AddWaybillTrackDTO.java @@ -9,10 +9,26 @@ public class AddWaybillTrackDTO implements Serializable { private Long waybillId; private String waybillNo; + /** + * 已配送 90 + * 已签收 100 + */ private String trackType; + /** + * 状态 -- 运单配送、运单签收 + */ private String refer; + /** + * 操作描述 + */ private String operationRemark; + /** + * 操作人 + */ private String nickName; + /** + * + */ private Long userId; private Long warehouseId; private String warehouseName; diff --git a/blade-service/logpm-distribution/pom.xml b/blade-service/logpm-distribution/pom.xml index c4db43969..a2d6d4875 100644 --- a/blade-service/logpm-distribution/pom.xml +++ b/blade-service/logpm-distribution/pom.xml @@ -116,6 +116,12 @@ ${bladex.project.version} compile + + org.springblade + logpm-trunkline-api + 3.2.0.RELEASE + compile + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java index cbd2915c8..be8c99564 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java @@ -27,6 +27,7 @@ import com.logpm.distribution.dto.DistributionDeliveryAllocationDTO; import com.logpm.distribution.dto.DistributionReservationDTO; import com.logpm.distribution.entity.DistributionReservationEntity; import com.logpm.distribution.excel.DistributionReservationExcel; +import com.logpm.distribution.service.IDistributionAsyncService; import com.logpm.distribution.service.IDistributionReservationService; import com.logpm.distribution.vo.*; import com.logpm.distribution.wrapper.DistributionReservationWrapper; @@ -70,6 +71,7 @@ public class DistributionReservationController extends BladeController { private final IDistributionReservationService reservationService; private final IBasicdataWarehouseClient basicdataWarehouseClient; private final IUserClient userClient; + private final IDistributionAsyncService distributionAsyncService; /** * 预约列表 详情 @@ -293,7 +295,7 @@ public class DistributionReservationController extends BladeController { @ApiOperationSupport(order = 7) @ApiOperation(value = "转商配任务") public R deliveryBusinessTask(@RequestBody DistributionDeliveryAllocationDTO allocationDTO) { - R result = reservationService.deliveryBusinessTask(allocationDTO); + R result = reservationService.deliveryBusinessTask(allocationDTO); return result; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java index 9b7721b79..9f591fb63 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java @@ -214,9 +214,20 @@ public class DistributionStockListController extends BladeController { /** * 库存品管理 删除 */ - @PostMapping("/remove") + @PostMapping("/cancelAddStockListByPackage") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") + public R cancelAddStockListByPackage(@RequestBody DistributionStockListDTO distributionStockListDTO) { + return distributionStockListService.cancelAddStockListByPackage(distributionStockListDTO); + } + + + /** + * 撤销订单转库存品 + */ + @PostMapping("/cancel") + @ApiOperationSupport(order = 7) + @ApiOperation(value = "撤销订单转库存品", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(distributionStockListService.deleteLogic(Func.toLongList(ids))); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionStockListDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionStockListDTO.java index ab70ce18e..0844050cf 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionStockListDTO.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionStockListDTO.java @@ -47,6 +47,21 @@ public class DistributionStockListDTO extends DistributionStockListEntity { * 包装数量 */ private String packageNum; + + /** + * 库存品ID + */ + private Long stockListId; + + /** + * 包件ID + */ + private String packageIds; + + /** + * 包件ID + */ + private String stockListInfoIds; /** * 包装数量 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java index d443f7491..7546d9fdf 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java @@ -477,4 +477,11 @@ public interface DistributionDeliveryListMapper extends BaseMapper selectDeliveryDriverInfo(@Param("deliveryId")Long deliveryId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml index c346fb26e..a36cd515d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml @@ -1980,5 +1980,24 @@ resultType="com.logpm.distribution.entity.DistributionDeliveryListEntity"> SELECT * FROM logpm_distribution_delivery_list WHERE train_number = #{trainNumber} AND warehouse_id =#{warehouseId} + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml index b69b909c6..001597a3c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml @@ -523,10 +523,10 @@ and ldsa.customer_name like concat('%',#{param.customerName},'%') - and + and ldsa.customer_telephone like concat('%',#{param.customerTelephone},'%') - and ldsa.customer_address like + and ldsa.customer_address like concat('%',#{param.customerAddress},'%') and lwtg.tray_code like diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListInfoMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListInfoMapper.xml index eeb142bad..ce9678bca 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListInfoMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListInfoMapper.xml @@ -94,7 +94,7 @@ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java index 8e0f85312..32f6ad154 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java @@ -1,5 +1,6 @@ package com.logpm.distribution.service; +import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO; import com.logpm.distribution.dto.app.StockupDTO; @@ -7,6 +8,8 @@ import com.logpm.distribution.dto.app.StockupZeroDTO; import com.logpm.distribution.entity.DisStockListDetailEntity; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionParcelNumberEntity; +import com.logpm.warehouse.entity.WarehouseWarehouseEntity; +import org.springblade.core.secure.BladeUser; import java.util.List; @@ -305,4 +308,10 @@ public interface IDistributionAsyncService { * @param reservationId */ void releaseSource(Long reservationId,Long warehouseId); + + /** + * 进行干线日志保存 + * @param id + */ + void sendTrunkineLog(Long deliveryId,Long reservationId, BladeUser user, BasicdataWarehouseEntity warehouse,Integer a); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java index 2367447a3..1bb5d54df 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java @@ -189,6 +189,14 @@ public interface IDistributionStockListService extends BaseService distributionParcelListEntities = null; + if (1 ==a ){ + distributionParcelListEntities = distributionDeliveryListMapper.selectPackageListByDeliveryListId(deliveryId); + }else { + distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationId); + } + //查询配送司机信息 + Map driverInfo = distributionDeliveryListMapper.selectDeliveryDriverInfo(distributionDeliveryListEntity.getId()); + if (Func.isNotEmpty(distributionParcelListEntities)){ + Map> listMap = distributionParcelListEntities.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getWaybillNumber)); + listMap.forEach((k, v) ->{ + StringBuilder builder = new StringBuilder(); + //统计已装车数量 + WarehouseWaybillEntity byWaybillNo = waybillClient.findByWaybillNo(k); + AddWaybillTrackDTO addWaybillTrackDTO = new AddWaybillTrackDTO(); + addWaybillTrackDTO.setWaybillId(byWaybillNo.getId()); + addWaybillTrackDTO.setWaybillNo(byWaybillNo.getWaybillNo()); + if (1 ==a){ + int sum = v.stream().filter(p -> OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(p.getOrderPackageLoadingStatus())).mapToInt(DistributionParcelListEntity::getQuantity).sum(); + addWaybillTrackDTO.setTrackType("90"); + addWaybillTrackDTO.setRefer("运单配送"); + String msg = "运单配送:"+sum+"/"+v.size()+"件"; + builder.append(msg); + //拼接配送信息 + String deliveryMsg = "车牌号:"+ driverInfo.get("vehicleNub")+","+"司机姓名:"+driverInfo.get("driverName")+",司机电话:"+driverInfo.get("driverPhone")+",配送时间:"+distributionDeliveryListEntity.getTaskTime(); + builder.append(deliveryMsg); + }else { + int sum = v.stream().filter(p -> OrderPackageStatusConstant.yiqianshou.getValue().equals(p.getOrderPackageStatus())).mapToInt(DistributionParcelListEntity::getQuantity).sum(); + addWaybillTrackDTO.setTrackType("100"); + addWaybillTrackDTO.setRefer("运单签收"); + String msg = "运单签收:"+sum+"/"+v.size()+"件"; + builder.append(msg); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss"); + String deliveryMsg = "最近操作人:"+user.getNickName()+simpleDateFormat.format(new Date()); + builder.append(deliveryMsg); + } + addWaybillTrackDTO.setNickName(user.getNickName()); + addWaybillTrackDTO.setUserId(user.getUserId()); + addWaybillTrackDTO.setWarehouseId(warehouse.getId()); + addWaybillTrackDTO.setWarehouseName(warehouse.getName()); + addWaybillTrackDTO.setOperationRemark(builder.toString()); + trunklineWaybillTrackClient.addWaybillLog(addWaybillTrackDTO); + }); + } + + + + + } /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index 85e63e0be..ddcc77a78 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -4514,6 +4514,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO) { + public R deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO) { if (Func.isEmpty(allocationDTO)) { log.error("参数异常allocationDTO+{" + allocationDTO + "}"); return R.fail("服务器正忙!!!"); @@ -2426,6 +2426,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl 0){ + stockArticleEntity.setGenre(1); + } this.updateById(stockArticleEntity); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java index c225b1ee1..60b03b44c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java @@ -18,6 +18,8 @@ package com.logpm.distribution.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -42,6 +44,7 @@ import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.DictBizConstant; +import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant; import org.springblade.common.utils.QRCodeUtil; import org.springblade.common.utils.TemplateUtil; @@ -102,6 +105,9 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl parcelListEntities = distributionParcelListService.list(Wrappers.query().lambda() + .in(DistributionParcelListEntity::getId, Func.toLongList(packageIds)) + .eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) + ); + String collect = parcelListEntities.stream().filter(f -> OrderPackageStockupStatusConstant.yibeihu.getValue().equals(f.getOrderPackageStockupStatus())).map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.joining(",")); + if (Func.isNotBlank(collect)){ + log.error(method+"撤销物料存在包件已备货,collect:{}",collect); + return R.fail(collect+"已备货,无法撤销!!!"); + } + if (Func.isEmpty(parcelListEntities)){ + log.error(method+"查询包件失败,packageIds:{}",packageIds); + return R.fail(403,"操作失败"); + } + List orderCode = parcelListEntities.stream().map(DistributionParcelListEntity::getOrderCode).collect(Collectors.toList()); + if (Func.isEmpty(orderCode) || orderCode.size()>1){ + log.error(method+"包件数据错误,orderCode:{}",orderCode); + return R.fail(403,"操作失败"); + } + + LambdaUpdateWrapper up = new UpdateWrapper().lambda() + .set(DistributionParcelListEntity::getConditions, 1) + .set(DistributionParcelListEntity::getMaterialId, null) + .set(DistributionParcelListEntity::getMaterialName, null) + .set(DistributionParcelListEntity::getMaterialCode, null) + .set(DistributionParcelListEntity::getMaterialUnit, null) + .in(DistributionParcelListEntity::getId, packageIds); + //清理包件的物料信息 + boolean update = distributionParcelListService.update(up); + //维护订单信息 + distributionStockArticleService.maintenanceOrderInfo(orderCode.get(0),myCurrentWarehouse.getId()); + //维护库存品信息 + DistributionStockListEntity stockListEntity = this.getById(distributionStockListDTO.getStockListId()); + if ((stockListEntity.getQuantityStock() - parcelListEntities.size()) > 0){ + stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - parcelListEntities.size()); + this.updateById(stockListEntity); + }else if ((stockListEntity.getQuantityStock() - parcelListEntities.size()) <= 0){ + this.removeById(stockListEntity); + } + //清理库存品入库记录 + distributionStockListInfoService.removeBatchByIds(Func.toLongList(distributionStockListDTO.getStockListInfoIds())); + + return R.success("操作成功"); + } } // @Override