Browse Source

fix:增加零担卸车入库数据

dist.1.2.0^2
pref_mail@163.com 7 months ago
parent
commit
59b8ebd599
  1. 2
      blade-service-api/logpm-business-api/src/main/java/com/logpm/business/dto/BusinessSanDTO.java
  2. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java
  3. 21
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  4. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java
  5. 19
      blade-service/logpm-business/src/main/java/com/logpm/business/api/BusinessPreOrderApi.java
  6. 160
      blade-service/logpm-business/src/main/java/com/logpm/business/service/impl/BusinessPreOrderServiceImpl.java
  7. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  8. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

2
blade-service-api/logpm-business-api/src/main/java/com/logpm/business/dto/BusinessSanDTO.java

@ -38,6 +38,8 @@ public class BusinessSanDTO {
@ApiModelProperty(value = "卸车数量")
private Integer unloadNum;
@ApiModelProperty(value = "状态 1 定制品 2 库存品 3零担")
private String conditions;
}

4
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java

@ -332,11 +332,11 @@ public class DistributionParcelListEntity extends TenantEntity {
@ApiModelProperty(value = "包件冻结状态")
private String orderPackageFreezeStatus;
@ApiModelProperty(value = "包件冻结状态")
@ApiModelProperty(value = "预约状态")
private String orderPackageReservationStatus;
@ApiModelProperty(value = "包件冻结状态")
@ApiModelProperty(value = "预约数量")
@TableField(exist = false)
private Integer reservationNum;

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

@ -102,9 +102,26 @@ public interface IDistributionParcelListClient {
@PostMapping(API_PREFIX + "/update")
void update(@RequestBody DistributionParcelListEntity distributionParcelListEntity);
/**
* 根据 订单号合开单品类查询指定仓库下的零担的品类信息
* @param orderCode
* @param first
* @param warehouseId
* @return
*/
@GetMapping(API_PREFIX + "/findDistributionParcelListEntityByOrderCodeAndFirstName")
DistributionParcelListEntity findDistributionParcelListEntityByOrderCodeAndFirstName(@RequestParam String orderCode, @RequestParam String first,@RequestParam Long warehouseId);
@GetMapping(API_PREFIX + "/SumEntityZkByOrderId")
Integer SumEntityByOrderId(@RequestParam Long orderId, @RequestParam Long warehouseId);
/**
* 根据 订单号合开单品类查询指定租户下的仓库的零担的品类信息
* @param tenantId
* @param orderCode
* @param first
* @param warehouseId
* @return
*/
@GetMapping(API_PREFIX + "/findDistributionParcelListEntityByOrderCodeAndFirstNameAndTenantId")
DistributionParcelListEntity findDistributionParcelListEntityByOrderCodeAndFirstNameAndTenantId(@RequestParam String tenantId,@RequestParam String orderCode, @RequestParam String first,@RequestParam Long warehouseId);
/**

3
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java

@ -75,6 +75,9 @@ public interface IDistributionStockArticleClient {
@GetMapping(API_PREFIX + "/findByOrderSelfNum")
DistributionStockArticleEntity findByOrderSelfNum(@RequestParam String orderCode, @RequestParam Long warehouseId);
@GetMapping(API_PREFIX + "/findByOrderSelfNumAndTenantId")
DistributionStockArticleEntity findByOrderSelfNumAndTenantId(@RequestParam String tenantId,@RequestParam String orderCode, @RequestParam Long warehouseId);
@GetMapping(API_PREFIX + "/deleteById")
void deleteById(@RequestParam Long orderId);

19
blade-service/logpm-business/src/main/java/com/logpm/business/api/BusinessPreOrderApi.java

@ -46,6 +46,12 @@ public class BusinessPreOrderApi {
}
/**
* 商家入库接口
* 零担入库也走这个接口
* @param businessSanDTO
* @return
*/
@PostMapping("/scanOrderPackageCode")
@ApiOperationSupport(order = 1)
public R scanOrderPackageCode(@RequestBody BusinessSanDTO businessSanDTO) {
@ -60,22 +66,9 @@ public class BusinessPreOrderApi {
return resp;
}
@PostMapping("/inputZeroOrderData")
@ApiOperationSupport(order = 1)
public R inputZeroOrderData(@RequestBody List<BusinessSanDTO> businessSanDTOincentices) {
log.info(" >> 请求参数 {}", businessSanDTOincentices);
// 传入的集合对象 中获取
return R.success("操作成功");
}
@GetMapping("/listCarNum")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "条件查询", notes = "传入trayTypeDTO")

160
blade-service/logpm-business/src/main/java/com/logpm/business/service/impl/BusinessPreOrderServiceImpl.java

@ -17,8 +17,10 @@ import com.logpm.business.service.IBusinessAsyncService;
import com.logpm.business.service.IBusinessPreOrderService;
import com.logpm.business.vo.*;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionDeliveryListClient;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.trunkline.dto.InComingDTO;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.feign.IInComingClient;
@ -56,6 +58,8 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
private final BladeRedis bladeRedis;
private final IWarehouseTrayTypeClient warehouseTrayTypeClient;
private final IDistributionDeliveryListClient distributionDeliveryListClient;
private final IDistributionStockArticleClient distributionStockArticleClient;
private final IDistributionParcelListClient distributionParcelListClient;
@Override
@ -201,40 +205,148 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
try {
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
businessSanDTO.setWarehouseId(myCurrentWarehouse.getId());
businessSanDTO.setWarehouseName(myCurrentWarehouse.getName());
String orderPackageCode = businessSanDTO.getOrderPackageCode();
String distrCarNumber = businessSanDTO.getDistrCarNumber();
if ("1".equals(businessSanDTO.getConditions())) {
businessSanDTO.setWarehouseId(myCurrentWarehouse.getId());
businessSanDTO.setWarehouseName(myCurrentWarehouse.getName());
String orderPackageCode = businessSanDTO.getOrderPackageCode();
String distrCarNumber = businessSanDTO.getDistrCarNumber();
if (Func.isAllEmpty(orderPackageCode, distrCarNumber, businessSanDTO.getInWarehouseException())) {
return Resp.scanFail("扫描失败", "没有包件或者车次");
}
// 查询配送车次下面所有的包件
LambdaQueryWrapper<BusinessPreOrderEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BusinessPreOrderEntity::getDistrCarNumber, distrCarNumber);
queryWrapper.eq(BusinessPreOrderEntity::getIsDeleted, 0);
List<BusinessPreOrderEntity> list = baseMapper.selectList(queryWrapper);
if (list.isEmpty()) {
return Resp.scanFail("扫描失败", "车次信息不存在");
}
if (Func.isAllEmpty(orderPackageCode, distrCarNumber, businessSanDTO.getInWarehouseException())) {
return Resp.scanFail("扫描失败", "没有包件或者车次");
}
// 查询配送车次下面所有的包件
LambdaQueryWrapper<BusinessPreOrderEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BusinessPreOrderEntity::getDistrCarNumber, distrCarNumber);
queryWrapper.eq(BusinessPreOrderEntity::getIsDeleted, 0);
List<BusinessPreOrderEntity> list = baseMapper.selectList(queryWrapper);
if (list.isEmpty()) {
return Resp.scanFail("扫描失败", "车次信息不存在");
}
// 异常入库
if (1 == businessSanDTO.getInWarehouseException()) {
Resp a = handleExceptionalWarehourse(businessSanDTO, list, orderPackageCode, distrCarNumber);
if (a != null) return a;
} else {
//正常入口
Resp scanFail = handleNormalWarehourse(businessSanDTO, orderPackageCode, list, distrCarNumber);
if (scanFail != null) return scanFail;
}
} else if ("3".equals(businessSanDTO.getConditions())) {
// 零担
LambdaQueryWrapper<BusinessPreOrderEntity> queryWrapper3 = new LambdaQueryWrapper<>();
queryWrapper3.eq(BusinessPreOrderEntity::getDistrCarNumber, businessSanDTO.getDistrCarNumber());
queryWrapper3.eq(BusinessPreOrderEntity::getReservationCode, businessSanDTO.getReservationCode());
queryWrapper3.eq(BusinessPreOrderEntity::getOrderCode, businessSanDTO.getOrderCode());
queryWrapper3.eq(BusinessPreOrderEntity::getFirsts, businessSanDTO.getFirsts());
List<BusinessPreOrderEntity> list3 = baseMapper.selectList(queryWrapper3);
if (list3.isEmpty()) {
throw new CustomerException("入库数据错误,请联系管理员");
}
BusinessPreOrderEntity businessPreOrderEntity = list3.get(0);
if (1 == businessPreOrderEntity.getInWarehouse()) {
return Resp.scanFail("操作失败", businessSanDTO.getFirsts() + "已入库");
}
// 构建 订单
DistributionStockArticleEntity distributionStockArticleEntity = checkStockArticle(businessPreOrderEntity, myCurrentWarehouse);
// 构建 订单下级【包件】
DistributionParcelListEntity distributionParcelListEntityByOrderCodeAndFirstName = distributionParcelListClient.findDistributionParcelListEntityByOrderCodeAndFirstName(businessPreOrderEntity.getOrderCode(), businessSanDTO.getFirsts(), myCurrentWarehouse.getId());
int temp = 0;
if (distributionParcelListEntityByOrderCodeAndFirstName == null) {
// 执行新增功能
DistributionParcelListEntity distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId = distributionParcelListClient.findDistributionParcelListEntityByOrderCodeAndFirstNameAndTenantId(businessPreOrderEntity.getFromTenantId(), businessPreOrderEntity.getOrderCode(), businessSanDTO.getFirsts(), businessPreOrderEntity.getWarehouseId());
if (distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId != null) {
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setId(null);
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setTenantId(null);
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setCreateUser(null);
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setUpdateUser(null);
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setCreateTime(null);
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setUpdateTime(null);
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setOrderPackageReservationStatus("10");
// 卸车数量作为入库数量
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setQuantity(businessSanDTO.getUnloadNum());
distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId.setStockArticleId(distributionStockArticleEntity.getId());
distributionParcelListClient.add(distributionParcelListEntityByOrderCodeAndFirstNameAndTenantId);
temp = businessSanDTO.getUnloadNum();
}
} else {
// 修改其入库数量
if(distributionParcelListEntityByOrderCodeAndFirstName.getQuantity()<businessSanDTO.getUnloadNum()){
temp = distributionParcelListEntityByOrderCodeAndFirstName.getQuantity() - businessSanDTO.getUnloadNum();
}else{
temp = businessSanDTO.getUnloadNum() - distributionParcelListEntityByOrderCodeAndFirstName.getQuantity();
}
distributionParcelListEntityByOrderCodeAndFirstName.setQuantity(businessSanDTO.getUnloadNum());
distributionParcelListClient.update(distributionParcelListEntityByOrderCodeAndFirstName);
}
distributionStockArticleEntity.setHandQuantity(distributionStockArticleEntity.getHandQuantity() + temp);
distributionStockArticleEntity.setIncomingNum(distributionStockArticleEntity.getIncomingNum() + temp);
distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity);
// 修改预入库数据
businessPreOrderEntity.setInWarehouse(1);
businessPreOrderEntity.setUnloadNum(businessSanDTO.getUnloadNum());
this.updateById(businessPreOrderEntity);
return Resp.scanSuccess("操作成功", "入库"+businessSanDTO.getUnloadNum()+"件");
// 异常入库
if (1 == businessSanDTO.getInWarehouseException()) {
Resp a = handleExceptionalWarehourse(businessSanDTO, list, orderPackageCode, distrCarNumber);
if (a != null) return a;
} else {
//正常入口
Resp scanFail = handleNormalWarehourse(businessSanDTO, orderPackageCode, list, distrCarNumber);
if (scanFail != null) return scanFail;
log.warn("?? 参数传递错误 ");
}
} catch (Exception e) {
log.error("系统异常", e);
throw new CustomerException(e.getMessage());
}
return Resp.scanFail("扫描失败", "系统错误");
return Resp.scanFail("操作失败", "系统错误");
}
/**
* 对订单进行处理 当订单不存在的时候进行新增
*
* @param businessPreOrderEntity
* @param myCurrentWarehouse
* @return
*/
private DistributionStockArticleEntity checkStockArticle(BusinessPreOrderEntity businessPreOrderEntity, BasicdataWarehouseEntity myCurrentWarehouse) {
DistributionStockArticleEntity byOrderSelfNumAndTenantId = distributionStockArticleClient.findByOrderSelfNum(businessPreOrderEntity.getOrderCode(), myCurrentWarehouse.getId());
if (byOrderSelfNumAndTenantId == null) {
// 执行新增功能
byOrderSelfNumAndTenantId = distributionStockArticleClient.findByOrderSelfNumAndTenantId(businessPreOrderEntity.getFromTenantId(), businessPreOrderEntity.getOrderCode(), businessPreOrderEntity.getWarehouseId());
if (byOrderSelfNumAndTenantId != null) {
byOrderSelfNumAndTenantId.setId(null);
byOrderSelfNumAndTenantId.setTenantId(null);
byOrderSelfNumAndTenantId.setCreateUser(null);
byOrderSelfNumAndTenantId.setUpdateUser(null);
byOrderSelfNumAndTenantId.setCreateTime(null);
byOrderSelfNumAndTenantId.setUpdateTime(null);
byOrderSelfNumAndTenantId.setOrderStatus("20");
byOrderSelfNumAndTenantId.setReservationStatus("10");
byOrderSelfNumAndTenantId.setWarehouse(myCurrentWarehouse.getName());
byOrderSelfNumAndTenantId.setWarehouseId(myCurrentWarehouse.getId());
byOrderSelfNumAndTenantId.setDeliveryQuantity(0);
byOrderSelfNumAndTenantId.setStoreTime(null);
byOrderSelfNumAndTenantId.setWaybillId(null);
// 对应新增的订单默认在库件数未0
byOrderSelfNumAndTenantId.setHandQuantity(0);
Long id = distributionStockArticleClient.addData(byOrderSelfNumAndTenantId);
byOrderSelfNumAndTenantId.setId(id);
}
}
return byOrderSelfNumAndTenantId;
}
@ -503,7 +615,7 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
int loadNum = entities.stream().mapToInt(BusinessPreOrderEntity::getLoadNum).sum();
// 卸车数量== 入库数量
int inNum =entities.stream().mapToInt(BusinessPreOrderEntity::getUnloadNum).sum();
int inNum = entities.stream().mapToInt(BusinessPreOrderEntity::getUnloadNum).sum();
/**
* 零担无法进行异常卸车

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

@ -37,6 +37,7 @@ import com.logpm.distribution.vo.DistributionParcelListVO;
import com.logpm.distribution.vo.ZeroPackageSupplyVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.annotations.ChangeAsync;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@ -218,11 +219,20 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
distributionStockArticleService.updateOrderInfo(orderCode, warehouseId);
}
@Override
public DistributionParcelListEntity findDistributionParcelListEntityByOrderCodeAndFirstName(String orderCode, String first, Long warehouseId) {
LambdaQueryWrapper<DistributionParcelListEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DistributionParcelListEntity::getOrderCode, orderCode);
lambdaQueryWrapper.eq(DistributionParcelListEntity::getFirsts, first);
lambdaQueryWrapper.eq(DistributionParcelListEntity::getWarehouseId, warehouseId);
return distributionParcelListService.getOne(lambdaQueryWrapper);
}
@ChangeAsync
@Override
public Integer SumEntityByOrderId(Long orderId, Long warehouseId) {
Integer i = distributionParcelListService.selectSumByOrderId(orderId, warehouseId);
return i;
public DistributionParcelListEntity findDistributionParcelListEntityByOrderCodeAndFirstNameAndTenantId(String tenantId, String orderCode, String first, Long warehouseId) {
return findDistributionParcelListEntityByOrderCodeAndFirstName(orderCode, first, warehouseId);
}
@Override

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -32,6 +32,7 @@ import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.distribution.vo.UpDownStockupAreaVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.annotations.ChangeAsync;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
@ -108,6 +109,12 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
return distributionStockArticleService.getOne(queryWrapper);
}
@ChangeAsync
@Override
public DistributionStockArticleEntity findByOrderSelfNumAndTenantId(String tenantId, String orderCode, Long warehouseId) {
return findByOrderSelfNum(orderCode,warehouseId);
}
@Override
public void deleteById(Long orderId) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();

Loading…
Cancel
Save