Browse Source

add:增加配送回库作业节点

dist.1.3.0
pref_mail@163.com 6 months ago
parent
commit
643bf554cb
  1. 30
      blade-biz-common/src/main/java/org/springblade/common/model/workNode/RetentionDataByScanVO.java
  2. 9
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  3. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  4. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  5. 25
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseNodeWorkService.java
  6. 33
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseNodeWorkServiceImpl.java
  7. 147
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java

30
blade-biz-common/src/main/java/org/springblade/common/model/workNode/RetentionDataByScanVO.java

@ -0,0 +1,30 @@
package org.springblade.common.model.workNode;
import lombok.Data;
import org.springblade.common.model.PackageData;
import java.util.List;
/**
* 滞留扫描
*/
@Data
public class RetentionDataByScanVO {
/**
* 配送车次号
*/
private String trainNumber;
/**
* 预约单号
*/
private String reservationCode;
/**
* 自提明细数据
*/
private List<PackageData> packageDataList;
}

9
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -176,6 +176,15 @@ public interface IDistributionParcelListClient {
@GetMapping(API_PREFIX + "/getListByOrderPackageCode")
List<DistributionParcelListEntity> getListByOrderPackageCode(@RequestParam String orderPackageCode);
/**
* 根据仓库ID 和包件码 查询仓库数据
* @param orderPackageCode 包件码
* @param warehouseId 仓库ID
* @return 包件
*/
@GetMapping(API_PREFIX + "/getListByOrderPackageCode")
DistributionParcelListEntity getListByOrderPackageCodeAndWarehouseId(@RequestParam String orderPackageCode,@RequestParam Long warehouseId);
@GetMapping(API_PREFIX + "/findAllStockListByOrderPackageCode")
List<DistributionParcelListEntity> findAllStockListByOrderPackageCode(String orderPackageCode);

9
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -351,6 +351,15 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
return distributionParcelListService.list(queryWrapper);
}
@Override
public DistributionParcelListEntity getListByOrderPackageCodeAndWarehouseId(String orderPackageCode, Long warehouseId) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_package_code", orderPackageCode);
queryWrapper.eq("warehouse_id", warehouseId);
queryWrapper.last(" limit 1");
return distributionParcelListService.getOne(queryWrapper);
}
@Override
public List<DistributionParcelListEntity> findAllStockListByOrderPackageCode(String orderPackageCode) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -3072,7 +3072,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
packageData.setNumber(1);
DistributionParcelListEntity distributionParcelListEntity1 = distributionParcelListService.selectByOrderPackageCode(distributionParcelListEntity.getOrderPackageCode(), distributionParcelListEntity.getWarehouseId());
if (Func.isNotEmpty(distributionParcelListEntity1)) {
packageData.setBrand(distributionParcelListEntity.getBrandName());
packageData.setBrand(distributionParcelListEntity1.getBrandName());
}
data.add(packageData);

25
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseNodeWorkService.java

@ -0,0 +1,25 @@
package com.logpm.warehouse.service;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.workNode.FinishDistributionTrainVO;
import org.springblade.common.model.workNode.RetentionDataByScanVO;
import org.springblade.core.secure.BladeUser;
/**
* 仓库作业节点推送
* @author chao
* @date 2021/08/06
*/
public interface IWarehouseNodeWorkService {
/**
* 回库
* 针对已经出库数据
* 在PDA进行回库扫码的动作
* @param nodeFanoutMsg 推送消息
* @User user
*/
public void returnToTheWarehouse(NodeFanoutMsg<RetentionDataByScanVO> nodeFanoutMsg, BladeUser user);
}

33
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseNodeWorkServiceImpl.java

@ -0,0 +1,33 @@
package com.logpm.warehouse.service.impl;
import com.logpm.warehouse.service.IWarehouseNodeWorkService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.workNode.RetentionDataByScanVO;
import org.springblade.core.secure.BladeUser;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@AllArgsConstructor
@Service
@Slf4j
public class WarehouseNodeWorkServiceImpl implements IWarehouseNodeWorkService {
@Autowired
private RabbitTemplate rabbitTemplate;
@Override
public void returnToTheWarehouse(NodeFanoutMsg<RetentionDataByScanVO> nodeFanoutMsg, BladeUser user) {
try {
if(user != null){
rabbitTemplate.convertAndSend(FanoutConstants.reservation.OwnReservation.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(nodeFanoutMsg));
}
} catch (AmqpException e) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", e);
}
}
}

147
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java

@ -25,6 +25,7 @@ import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionLoadscanEntity;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.feign.*;
import com.logpm.distribution.vo.DistributionDeliveryListVO;
import com.logpm.warehouse.bean.Resp;
@ -33,6 +34,7 @@ import com.logpm.warehouse.entity.WarehouseRetentionRecordEntity;
import com.logpm.warehouse.entity.WarehouseRetentionScanEntity;
import com.logpm.warehouse.excel.WarehouseRetentionRecordExcel;
import com.logpm.warehouse.mapper.WarehouseRetentionRecordMapper;
import com.logpm.warehouse.service.IWarehouseNodeWorkService;
import com.logpm.warehouse.service.IWarehouseRetentionRecordService;
import com.logpm.warehouse.service.IWarehouseRetentionScanService;
import com.logpm.warehouse.vo.WarehouseRetentionRecordVO;
@ -43,9 +45,16 @@ import com.logpm.warehouse.wrapper.WarehouseRetentionScanWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.retention.RetentionTypeConstant;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.enums.PackageTypeEnums;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
import org.springblade.common.model.workNode.FinishDistributionTrainVO;
import org.springblade.common.model.workNode.RetentionDataByScanVO;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
@ -54,7 +63,9 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.cache.DictBizCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -86,6 +97,9 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
private final IDistributionSignforClient distributionSignforClient;
private final IDistributionLoadscanAbnormalClient distributionLoadscanAbnormalClient;
private final BladeRedis redis;
private final IWarehouseNodeWorkService warehouseNodeWorkService;
private final IDistributionStockListClient stockListClient;
@Override
public IPage<WarehouseRetentionRecordVO> selectWarehouseRetentionRecordPage(IPage<WarehouseRetentionRecordVO> page, WarehouseRetentionRecordVO warehouseRetentionRecord) {
@ -439,10 +453,10 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
public R scanRetention(WarehouseRetentionScanDTO warehouseRetentionScanDTO) {
String method = "########################################WarehouseRetenntionServiceImpl.scanRetention";
if (Objects.isNull(warehouseRetentionScanDTO.getOrderPackageCode())) {
log.error(method + "OrderPackageCode参数缺失");
log.error("{} OrderPackageCode参数缺失", method);
return Resp.scanFail("参数缺失,请联系管理员", "参数缺失,请联系管理员");
}
//查询此列表此包件是否存在任务
BasicdataWarehouseEntity myCurrentWarehouseAndConfig = warehouseClient.getMyCurrentWarehouseAndConfig();
if (Objects.isNull(myCurrentWarehouseAndConfig)) {
return R.fail(403, "未授权");
@ -451,63 +465,148 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
String orderPackageCode = warehouseRetentionScanDTO.getOrderPackageCode();
List<WarehouseRetentionScanEntity> retentionScanEntityList = warehouseRetentionScanService.getEntityByCodeAndWarehouseId(orderPackageCode, myCurrentWarehouseAndConfig.getId());
if (retentionScanEntityList.isEmpty()) {
//返回当前包件的配送信息准备进行新增
// 返回当前包件的配送信息准备进行新增
return R.fail(1500, "新增回库任务");
}
AtomicBoolean saveFlah = new AtomicBoolean(false);
for (WarehouseRetentionScanEntity warehouseRetentionScanEntity : retentionScanEntityList) {
String isLock = redis.get(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScanEntity.getWarehouseId() + ":retentionTaskCode:" + warehouseRetentionScanEntity.getTaskCode() + ":orderPackageCode:" + warehouseRetentionScanEntity.getOrderPackageCode());
String lockKey = AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScanEntity.getWarehouseId() + ":retentionTaskCode:" + warehouseRetentionScanEntity.getTaskCode() + ":orderPackageCode:" + warehouseRetentionScanEntity.getOrderPackageCode();
String isLock = redis.get(lockKey);
if (!isLock.isEmpty()) {
return Resp.scanFail("请勿频繁操作!!!", "请勿频繁操作!!!");
}
boolean result = false;
switch (warehouseRetentionScanEntity.getConditions()) {
case 1:
//订制品
if (RetentionTypeConstant.yichangjuqian.getValue().equals(warehouseRetentionScanEntity.getRetentionType())){
saveFlah.set(distributionDeliveryListClient.retentionDeliveryReservationPackage(
case 1: // 订制品
if (RetentionTypeConstant.yichangjuqian.getValue().equals(warehouseRetentionScanEntity.getRetentionType())) {
result = distributionDeliveryListClient.retentionDeliveryReservationPackage(
warehouseRetentionScanEntity.getDeliveryId(),
warehouseRetentionScanEntity.getReservationId(),
warehouseRetentionScanEntity.getOrderPackageId(),
warehouseRetentionScanEntity.getConditions())
warehouseRetentionScanEntity.getConditions()
);
} else {
result = distributionParcelListClient.maintainInWarehouse(warehouseRetentionScanEntity.getOrderPackageId(), warehouseRetentionScanEntity.getTaskCode());
}
saveFlah.set(distributionParcelListClient.maintainInWarehouse(warehouseRetentionScanEntity.getOrderPackageId(),warehouseRetentionScanEntity.getTaskCode()));
break;
case 2:
//回库指定数量的零担包件
saveFlah.set(distributionDeliveryListClient.retentionReservationZeroPackageByNum(warehouseRetentionScanEntity.getDeliveryId(),
case 2: // 回库指定数量的零担包件
result = distributionDeliveryListClient.retentionReservationZeroPackageByNum(
warehouseRetentionScanEntity.getDeliveryId(),
warehouseRetentionScanEntity.getReservationId(),
warehouseRetentionScanEntity.getOrderPackageId(),
warehouseRetentionScanEntity.getRetentionQuantity(),
warehouseRetentionScanEntity.getOrderId(),
warehouseRetentionScanEntity.getLoadingId()));
warehouseRetentionScanEntity.getLoadingId()
);
break;
case 3:
//库存品
saveFlah.set(distributionDeliveryListClient.retentionDeliveryReservationInventory(warehouseRetentionScanEntity.getDeliveryId(), warehouseRetentionScanEntity.getReservationId(), warehouseRetentionScanEntity.getOrderPackageId()));
case 3: // 库存品
result = distributionDeliveryListClient.retentionDeliveryReservationInventory(
warehouseRetentionScanEntity.getDeliveryId(),
warehouseRetentionScanEntity.getReservationId(),
warehouseRetentionScanEntity.getOrderPackageId()
);
break;
default:
log.error("{} >>>>> warehouseRetentionScanEntity.getConditions()={}", method, warehouseRetentionScanEntity.getConditions());
break;
}
if (saveFlah.get()) {
redis.del(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScanEntity.getWarehouseId() + ":orderPackageCode:" + warehouseRetentionScanEntity.getOrderPackageCode()+ ":retentionSave:"+warehouseRetentionScanEntity.getTaskCode());
if (result) {
saveFlah.set(true);
String saveKey = AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScanEntity.getWarehouseId() + ":orderPackageCode:" + warehouseRetentionScanEntity.getOrderPackageCode() + ":retentionSave:" + warehouseRetentionScanEntity.getTaskCode();
redis.del(saveKey);
warehouseRetentionScanEntity.setConfirmStatus(true);
warehouseRetentionScanEntity.setRetentionScanUsername(AuthUtil.getNickName());
warehouseRetentionScanEntity.setRetentionScanUserId(AuthUtil.getUserId());
warehouseRetentionScanEntity.setRetentionScanTime(DateUtil.now());
warehouseRetentionScanService.updateById(warehouseRetentionScanEntity);
//维护签收表的异常状态
//推送作业数据
NodeFanoutMsg<RetentionDataByScanVO> nodeFanoutMsg = buildNodeFanoutMsgByRetentionDataByScanVO(warehouseRetentionScanEntity, AuthUtil.getUser());
warehouseNodeWorkService.returnToTheWarehouse(nodeFanoutMsg, AuthUtil.getUser());
distributionSignforClient.maintainIsHaveAbnormalPackage(warehouseRetentionScanEntity.getReservationId());
//对此回库任务绑定的异常标注完成
if (Func.isNotEmpty(warehouseRetentionScanEntity.getAbnormalId())){
if (Func.isNotEmpty(warehouseRetentionScanEntity.getAbnormalId())) {
distributionLoadscanAbnormalClient.completeAbnormal(warehouseRetentionScanEntity.getAbnormalId());
}
}
redis.setEx(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScanEntity.getWarehouseId() + ":retentionTaskCode:" , warehouseRetentionScanEntity.getTaskCode() + ":orderPackageCode:" + warehouseRetentionScanEntity.getOrderPackageCode(),60L);
redis.setEx(lockKey, "1", 60L);
}
if (saveFlah.get()) {
return Resp.scanSuccess("操作成功", "操作成功");
} else {
throw new CustomerException("服务器正忙...");
}
}
private NodeFanoutMsg<RetentionDataByScanVO> buildNodeFanoutMsgByRetentionDataByScanVO(WarehouseRetentionScanEntity warehouseRetentionScanEntity, BladeUser user) {
NodeFanoutMsg<RetentionDataByScanVO> nodeFanoutMsg = new NodeFanoutMsg<>();
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD);
nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_RETENTION);
nodeFanoutMsg.setWarehouse(warehouseRetentionScanEntity.getWarehouseName());
nodeFanoutMsg.setWarehouseId(warehouseRetentionScanEntity.getWarehouseId());
nodeFanoutMsg.setOperator(user.getNickName());
nodeFanoutMsg.setOperatorTime(new Date());
nodeFanoutMsg.setTenantId(user.getTenantId());
RetentionDataByScanVO retentionDataByScanVO = new RetentionDataByScanVO();
retentionDataByScanVO.setTrainNumber(warehouseRetentionScanEntity.getTrainNumber());
retentionDataByScanVO.setReservationCode(warehouseRetentionScanEntity.getReservationCode());
List<PackageData> packageDataList = new ArrayList<>();
PackageData packageData = new PackageData();
// 包件
if (warehouseRetentionScanEntity.getConditions() == 1) {
packageData.setPackageCode(warehouseRetentionScanEntity.getOrderPackageCode());
packageData.setPackageType(PackageTypeEnums.CMP);
packageData.setNumber(1);
DistributionParcelListEntity distributionParcelListEntity1 = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(warehouseRetentionScanEntity.getOrderPackageCode(), warehouseRetentionScanEntity.getWarehouseId());
if (Func.isNotEmpty(distributionParcelListEntity1)) {
packageData.setBrand(distributionParcelListEntity1.getBrandName());
}
// 零担
} else if (warehouseRetentionScanEntity.getConditions() == 2) {
packageData.setPackageType(PackageTypeEnums.LTL);
packageData.setNumber(warehouseRetentionScanEntity.getRetentionQuantity());
DistributionParcelListEntity byId = distributionParcelListClient.getParcelListId(warehouseRetentionScanEntity.getOrderPackageId() + "");
if (Func.isNotEmpty(byId)) {
packageData.setOrderCode(byId.getOrderCode());
packageData.setBrand(byId.getBrandName());
packageData.setWaybillNumber(byId.getWaybillNumber());
packageData.setProductName(byId.getFirsts());
}
// 库存品
} else if (warehouseRetentionScanEntity.getConditions() == 3) {
DistributionStockListEntity byIds = stockListClient.getStockListById(warehouseRetentionScanEntity.getInventoryId());
if (Func.isNotEmpty(byIds)) {
packageData.setPackageCode(warehouseRetentionScanEntity.getOrderPackageCode());
packageData.setBrand(byIds.getBrandName());
packageData.setMallName(StringUtil.isBlank(byIds.getMallName()) ? byIds.getMarketName() : byIds.getMallName());
// packageData.setProductName(byId.getDescriptionGoods());
packageData.setMaterialCode(byIds.getCargoNumber());
packageData.setMaterialName(byIds.getDescriptionGoods());
packageData.setPickupBatch(byIds.getIncomingBatch());
packageData.setPackageType(PackageTypeEnums.INV);
} else {
log.error(" tage buildNodeFanoutMsgByRetentionDataByScanVO>>> 错误的数据类型");
return null;
}
packageDataList.add(packageData);
}
return nodeFanoutMsg;
}
}

Loading…
Cancel
Save