Browse Source

Merge remote-tracking branch 'origin/dev' into dev

test
0.0 2 years ago
parent
commit
35c9f163d3
  1. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java
  2. 146
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybill.java
  3. 247
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java
  4. 21
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillClient.java
  5. 35
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java
  6. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  7. 6
      blade-service/logpm-warehouse/pom.xml
  8. 200
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java
  9. 22
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/SplitOrderDTO.java
  10. 34
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java
  11. 18
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillClient.java
  12. 42
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java
  13. 58
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml
  14. 25
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java
  15. 80
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java
  16. 50
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseWaybillWrapper.java

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

@ -64,4 +64,6 @@ public interface IDistributionStockArticleClient {
@GetMapping(API_PREFIX + "/findByOrderSelfNum")
DistributionStockArticleEntity findByOrderSelfNum(@RequestParam String waybillNo);
@GetMapping(API_PREFIX + "/deleteById")
void deleteById(@RequestParam Long orderId);
}

146
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybill.java

@ -1,146 +0,0 @@
package com.logpm.warehouse.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tenant.mp.TenantEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 运单;
* @author : http://www.chiner.pro
* @date : 2023-7-4
*/
@Data
@ApiModel(value = "运单",description = "")
@TableName("logpm_warehouse_waybill")
public class WarehouseWaybill extends TenantEntity {
/** 运单号 */
@ApiModelProperty(name = "运单号",notes = "")
private String waybillNo ;
/** 订单自编号 */
@ApiModelProperty(name = "订单自编号",notes = "")
private String orderNo ;
/** 目的仓 */
@ApiModelProperty(name = "目的仓",notes = "")
private String destinationWarehouse ;
/** 发站仓 */
@ApiModelProperty(name = "发站仓",notes = "")
private String departureWarehouse ;
/** 客户车次 */
@ApiModelProperty(name = "客户车次",notes = "")
private String customerTrain ;
/** 品牌 */
@ApiModelProperty(name = "品牌",notes = "")
private String brand ;
/** 发货单位id */
@ApiModelProperty(name = "发货单位id",notes = "")
private Long shipperId ;
/** 发货单位 */
@ApiModelProperty(name = "发货单位",notes = "")
private String shipper ;
/** 发货人 */
@ApiModelProperty(name = "发货人",notes = "")
private String shipperName ;
/** 发货方手机号 */
@ApiModelProperty(name = "发货方手机号",notes = "")
private String shipperMobile ;
/** 发货方地址 */
@ApiModelProperty(name = "发货方地址",notes = "")
private String shipperAddress ;
/** 收货单位id */
@ApiModelProperty(name = "收货单位id",notes = "")
private Long consigneeId ;
/** 收货单位 */
@ApiModelProperty(name = "收货单位",notes = "")
private String consignee ;
/** 收货人 */
@ApiModelProperty(name = "收货人",notes = "")
private String consigneeName ;
/** 收货方手机号 */
@ApiModelProperty(name = "收货方手机号",notes = "")
private String consigneeMobile ;
/** 收货方地址 */
@ApiModelProperty(name = "收货方地址",notes = "")
private String consigneeAddress ;
/** 到站 */
@ApiModelProperty(name = "到站",notes = "")
private String destination ;
/** 货物名称 */
@ApiModelProperty(name = "货物名称",notes = "")
private String goodsName ;
/** 总数 */
@ApiModelProperty(name = "总数",notes = "")
private Integer totalCount ;
/** 在库数 */
@ApiModelProperty(name = "在库数",notes = "")
private Integer stockCount ;
/** 总重量 */
@ApiModelProperty(name = "总重量",notes = "")
private BigDecimal totalWeight ;
/** 总体积 */
@ApiModelProperty(name = "总体积",notes = "")
private BigDecimal totalVolume ;
/** 送货方式 */
@ApiModelProperty(name = "送货方式",notes = "")
private Integer deliveryMethod ;
/** 紧急度 */
@ApiModelProperty(name = "紧急度",notes = "")
private Integer urgency ;
/** 回单数 */
@ApiModelProperty(name = "回单数",notes = "")
private Integer receiptCount ;
/** 回单要求 */
@ApiModelProperty(name = "回单要求",notes = "")
private String receiptRequirement ;
/** 经办人 */
@ApiModelProperty(name = "经办人",notes = "")
private String agent ;
/** 经办人id */
@ApiModelProperty(name = "经办人id",notes = "")
private Long agentId ;
/** 发展仓id */
@ApiModelProperty(name = "发展仓id",notes = "")
private Long departureWarehouseId ;
/** 目的仓id */
@ApiModelProperty(name = "目的仓id",notes = "")
private Long destinationWarehouseId ;
/** 制单时间 */
@ApiModelProperty(name = "制单时间",notes = "")
private Date documentMakingTime ;
/** 备注 */
@ApiModelProperty(name = "备注",notes = "")
private String remark ;
/** 批次号 */
@ApiModelProperty(name = "批次号",notes = "")
private String batchNo ;
/** 服务类型 */
@ApiModelProperty(name = "服务类型",notes = "")
private Integer serviceType ;
/** 服务号 */
@ApiModelProperty(name = "服务号",notes = "")
private String serviceNo ;
/** 冻结状态 */
@ApiModelProperty(name = "冻结状态",notes = "")
private Integer freezeStatus ;
/** 预留1 */
@ApiModelProperty(name = "预留1",notes = "")
private String reserve1 ;
/** 预留2 */
@ApiModelProperty(name = "预留2",notes = "")
private String reserve2 ;
/** 预留3 */
@ApiModelProperty(name = "预留3",notes = "")
private String reserve3 ;
/** 预留4 */
@ApiModelProperty(name = "预留4",notes = "")
private String reserve4 ;
/** 预留5 */
@ApiModelProperty(name = "预留5",notes = "")
private String reserve5 ;
}

247
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java

@ -0,0 +1,247 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.warehouse.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 运单表 实体类
*
* @author zhy
* @since 2023-07-10
*/
@Data
@TableName("logpm_warehouse_waybill")
@ApiModel(value = "WarehouseWaybill对象", description = "运单表")
@EqualsAndHashCode(callSuper = true)
public class WarehouseWaybillEntity extends TenantEntity {
/**
* 运单号
*/
@ApiModelProperty(value = "运单号")
private String waybillNo;
/**
* 订单自编号
*/
@ApiModelProperty(value = "订单自编号")
private String orderNo;
/**
* 目的仓
*/
@ApiModelProperty(value = "目的仓")
private String destinationWarehouse;
/**
* 发站仓
*/
@ApiModelProperty(value = "发站仓")
private String departureWarehouse;
/**
* 客户车次
*/
@ApiModelProperty(value = "客户车次")
private String customerTrain;
/**
* 品牌
*/
@ApiModelProperty(value = "品牌")
private String brand;
/**
* 发货单位
*/
@ApiModelProperty(value = "发货单位")
private String shipper;
/**
* 发货人
*/
@ApiModelProperty(value = "发货人")
private String shipperName;
/**
* 发货方手机号
*/
@ApiModelProperty(value = "发货方手机号")
private String shipperMobile;
/**
* 发货方地址
*/
@ApiModelProperty(value = "发货方地址")
private String shipperAddress;
/**
* 收货单位
*/
@ApiModelProperty(value = "收货单位")
private String consignee;
/**
* 收货人
*/
@ApiModelProperty(value = "收货人")
private String consigneeName;
/**
* 收货方手机号
*/
@ApiModelProperty(value = "收货方手机号")
private String consigneeMobile;
/**
* 收货方地址
*/
@ApiModelProperty(value = "收货方地址")
private String consigneeAddress;
/**
* 到站
*/
@ApiModelProperty(value = "到站")
private String destination;
/**
* 货物名称
*/
@ApiModelProperty(value = "货物名称")
private String goodsName;
/**
* 总数
*/
@ApiModelProperty(value = "总数")
private Integer totalCount;
/**
* 在库数
*/
@ApiModelProperty(value = "在库数")
private Integer stockCount;
/**
* 总重量
*/
@ApiModelProperty(value = "总重量")
private BigDecimal totalWeight;
/**
* 总体积
*/
@ApiModelProperty(value = "总体积")
private BigDecimal totalVolume;
/**
* 送货方式
*/
@ApiModelProperty(value = "送货方式")
private Integer deliveryMethod;
/**
* 紧急度
*/
@ApiModelProperty(value = "紧急度")
private Integer urgency;
/**
* 回单数
*/
@ApiModelProperty(value = "回单数")
private Integer receiptCount;
/**
* 回单要求
*/
@ApiModelProperty(value = "回单要求")
private String receiptRequirement;
/**
* 经办人
*/
@ApiModelProperty(value = "经办人")
private String agent;
/**
* 经办人id
*/
@ApiModelProperty(value = "经办人id")
private Long agentId;
/**
* 收货单位id
*/
@ApiModelProperty(value = "收货单位id")
private Long consigneeId;
/**
* 发货单位id
*/
@ApiModelProperty(value = "发货单位id")
private Long shipperId;
/**
* 发展仓id
*/
@ApiModelProperty(value = "发展仓id")
private Long departureWarehouseId;
/**
* 目的仓id
*/
@ApiModelProperty(value = "目的仓id")
private Long destinationWarehouseId;
/**
* 制单时间
*/
@ApiModelProperty(value = "制单时间")
private Date documentMakingTime;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
/**
* 批次号
*/
@ApiModelProperty(value = "批次号")
private String batchNo;
/**
* 服务类型
*/
@ApiModelProperty(value = "服务类型")
private Integer serviceType;
/**
* 服务号
*/
@ApiModelProperty(value = "服务号")
private String serviceNo;
/**
* 冻结状态
*/
@ApiModelProperty(value = "冻结状态")
private Integer freezeStatus;
/**
* 预留1
*/
@ApiModelProperty(value = "预留1")
private String reserve1;
/**
* 预留2
*/
@ApiModelProperty(value = "预留2")
private String reserve2;
/**
* 预留3
*/
@ApiModelProperty(value = "预留3")
private String reserve3;
/**
* 预留4
*/
@ApiModelProperty(value = "预留4")
private String reserve4;
/**
* 预留5
*/
@ApiModelProperty(value = "预留5")
private String reserve5;
}

21
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillClient.java

@ -16,8 +16,8 @@
*/
package com.logpm.warehouse.feign;
import com.logpm.warehouse.entity.WarehouseWaybill;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.mp.support.BladePage;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -26,16 +26,27 @@ import org.springframework.web.bind.annotation.RequestParam;
* 运单表 Feign接口类
*
* @author zhy
* @since 2023-07-04
* @since 2023-07-10
*/
@FeignClient(
value = ModuleNameConstant.APPLICATION_WAREHOUSE_NAME
value = "logpm-warehouse"
)
public interface IWarehouseWaybillClient {
String API_PREFIX = "/client";
String TOP = API_PREFIX + "/top";
/**
* 获取运单表列表
*
* @param current 页号
* @param size 页数
* @return BladePage
*/
@GetMapping(TOP)
BladePage<WarehouseWaybillEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
@GetMapping(API_PREFIX + "/findByWaybillNo")
WarehouseWaybill findByWaybillNo(@RequestParam String waybillNo);
WarehouseWaybillEntity findByWaybillNo(@RequestParam String waybillNo);
}

35
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java

@ -0,0 +1,35 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.warehouse.vo;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 运单表 视图实体类
*
* @author zhy
* @since 2023-07-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WarehouseWaybillVO extends WarehouseWaybillEntity {
private static final long serialVersionUID = 1L;
}

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

@ -91,4 +91,11 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
return distributionStockArticleService.getOne(queryWrapper);
}
@Override
public void deleteById(Long orderId) {
DistributionStockArticleEntity entity = distributionStockArticleService.getById(orderId);
entity.setIsDeleted(1);
distributionStockArticleService.updateById(entity);
}
}

6
blade-service/logpm-warehouse/pom.xml

@ -47,19 +47,19 @@
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-old-project-api</artifactId>
<artifactId>logpm-basicdata-api</artifactId>
<version>3.1.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-basicdata-api</artifactId>
<artifactId>logpm-distribution-api</artifactId>
<version>3.1.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-distribution-api</artifactId>
<artifactId>logpm-old-project-api</artifactId>
<version>3.1.0.RELEASE</version>
<scope>compile</scope>
</dependency>

200
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java

@ -1,18 +1,204 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.warehouse.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.warehouse.dto.ProductDTO;
import com.logpm.warehouse.dto.SplitOrderDTO;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.service.IWarehouseWaybillService;
import com.logpm.warehouse.vo.WarehouseWaybillVO;
import com.logpm.warehouse.wrapper.WarehouseWaybillWrapper;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 运单;(logpm_mainline_waybill)表控制层
* @author : http://www.chiner.pro
* @date : 2023-7-4
* 运单表 控制器
*
* @author zhy
* @since 2023-07-10
*/
@Api(tags = "运单对象功能接口")
@Log4j2
@RestController
@AllArgsConstructor
@RequestMapping("/warehouseWaybill")
public class WarehouseWaybillController {
@Api(value = "运单表", tags = "运单表接口")
public class WarehouseWaybillController extends BladeController {
private final IWarehouseWaybillService warehouseWaybillService;
private final IDistributionStockArticleClient distributionStockArticleClient;
/**
* 运单表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入warehouseWaybill")
public R<WarehouseWaybillVO> detail(WarehouseWaybillEntity warehouseWaybill) {
WarehouseWaybillEntity detail = warehouseWaybillService.getOne(Condition.getQueryWrapper(warehouseWaybill));
return R.data(WarehouseWaybillWrapper.build().entityVO(detail));
}
/**
* 运单表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入warehouseWaybill")
public R<IPage<WarehouseWaybillVO>> list(@ApiIgnore @RequestParam Map<String, Object> warehouseWaybill, Query query) {
IPage<WarehouseWaybillEntity> pages = warehouseWaybillService.page(Condition.getPage(query), Condition.getQueryWrapper(warehouseWaybill, WarehouseWaybillEntity.class));
return R.data(WarehouseWaybillWrapper.build().pageVO(pages));
}
/**
* 运单表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "分页", notes = "传入warehouseWaybill")
public R<IPage<WarehouseWaybillVO>> page(WarehouseWaybillVO warehouseWaybill, Query query) {
IPage<WarehouseWaybillVO> pages = warehouseWaybillService.selectWarehouseWaybillPage(Condition.getPage(query), warehouseWaybill);
return R.data(pages);
}
/**
* 运单表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入warehouseWaybill")
public R save(@Valid @RequestBody WarehouseWaybillEntity warehouseWaybill) {
return R.status(warehouseWaybillService.save(warehouseWaybill));
}
/**
* 运单表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入warehouseWaybill")
public R update(@Valid @RequestBody WarehouseWaybillEntity warehouseWaybill) {
return R.status(warehouseWaybillService.updateById(warehouseWaybill));
}
/**
* 运单表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入warehouseWaybill")
public R submit(@Valid @RequestBody WarehouseWaybillEntity warehouseWaybill) {
return R.status(warehouseWaybillService.saveOrUpdate(warehouseWaybill));
}
/**
* 运单表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(warehouseWaybillService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/splitOrder")
@ResponseBody
@ApiOperationSupport(order = 8)
@ApiOperation(value = "拆单", notes = "传入ids")
public R splitOrder(@RequestBody List<SplitOrderDTO> splitOrderDTOList) {
//先查询运单数据
if(splitOrderDTOList.size() < 1){
log.warn("################splitOrder: 没有拆单数据");
return R.fail(405,"没有拆单数据");
}
String waybillNo = splitOrderDTOList.get(0).getWaybillNo();//运单号
//查询运单
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillService.findByWaybillNo(waybillNo);
if(Objects.isNull(warehouseWaybillEntity)){
log.warn("################splitOrder: 未找到运单信息 waybillNo={}",waybillNo);
return R.fail(405,"未找到运单信息");
}
Integer totalCount = warehouseWaybillEntity.getTotalCount();//包件总数量
Integer stockCount = warehouseWaybillEntity.getStockCount();//包件在库数量
//如果在库数量不等总数量 则不能进行拆单
if(!totalCount.equals(stockCount)){
log.warn("################splitOrder: 在库数量不等于总数量,不能拆单 waybillNo={}",waybillNo);
return R.fail(405,"在库数量不等于总数量");
}
//判断运单对应的订单是否已经
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo);
if(Objects.isNull(distributionStockArticleEntity)){
log.warn("################splitOrder: 当前在库订单已转库存品,不能拆单 waybillNo={}",waybillNo);
return R.fail(405,"当前在库订单已转库存品");
}
Integer state = distributionStockArticleEntity.getState();//订单状态
Long orderId = distributionStockArticleEntity.getId();//订单id
if(!state.equals(1)){
log.warn("################splitOrder: 当前在库订单已进入配送流程,不能拆单 waybillNo={}",waybillNo);
return R.fail(405,"当前在库订单已进入配送流程");
}
//判断拆单后的数值是否等于总数量
Integer total = new Integer("1");
for (SplitOrderDTO splitOrderDTO:splitOrderDTOList){
List<ProductDTO> products = splitOrderDTO.getProducts();
for (ProductDTO productDTO:products){
total = total + productDTO.getNum();
}
}
if(!totalCount.equals(total)){
log.warn("################splitOrder: 拆单数量不等于总数量 waybillNo={}",waybillNo);
return R.fail(405,"拆单数量不等于总数量");
}
try{
//拆单操作
warehouseWaybillService.splitOrder(splitOrderDTOList,distributionStockArticleEntity);
//拆单完成去把以前的订单逻辑删除
distributionStockArticleClient.deleteById(orderId);
return R.success("拆单成功");
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.warn("系统出现异常",e);
return R.fail(500,"系统出现异常");
}
}
}

22
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/SplitOrderDTO.java

@ -0,0 +1,22 @@
package com.logpm.warehouse.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
public class SplitOrderDTO implements Serializable {
private String waybillNo;
private String customerPerson;
private String customerMobile;
private String customerAddress;
private List<ProductDTO> products = new ArrayList<>();
}

34
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java

@ -0,0 +1,34 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.warehouse.dto;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 运单表 数据传输对象实体类
*
* @author zhy
* @since 2023-07-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WarehouseWaybillDTO extends WarehouseWaybillEntity {
private static final long serialVersionUID = 1L;
}

18
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillClient.java

@ -1,8 +1,12 @@
package com.logpm.warehouse.feign;
import com.logpm.warehouse.entity.WarehouseWaybill;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.service.IWarehouseWaybillService;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@ -16,9 +20,19 @@ public class WarehouseWaybillClient implements IWarehouseWaybillClient {
private final IWarehouseWaybillService warehouseWaybillService;
@Override
@GetMapping(TOP)
public BladePage<WarehouseWaybillEntity> top(Integer current, Integer size) {
Query query = new Query();
query.setCurrent(current);
query.setSize(size);
IPage<WarehouseWaybillEntity> page = warehouseWaybillService.page(Condition.getPage(query));
return BladePage.of(page);
}
@Override
@GetMapping(API_PREFIX + "/findByWaybillNo")
public WarehouseWaybill findByWaybillNo(String waybillNo) {
public WarehouseWaybillEntity findByWaybillNo(String waybillNo) {
return warehouseWaybillService.findByWaybillNo(waybillNo);
}
}

42
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java

@ -1,15 +1,43 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.warehouse.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.warehouse.entity.WarehouseWaybill;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.vo.WarehouseWaybillVO;
import java.util.List;
/**
* 运单;(logpm_mainline_waybill)表数据库访问层
* @author : http://www.chiner.pro
* @date : 2023-7-4
* 运单表 Mapper 接口
*
* @author zhy
* @since 2023-07-10
*/
@Mapper
public interface WarehouseWaybillMapper extends BaseMapper<WarehouseWaybill>{
public interface WarehouseWaybillMapper extends BaseMapper<WarehouseWaybillEntity> {
/**
* 自定义分页
*
* @param page
* @param warehouseWaybill
* @return
*/
List<WarehouseWaybillVO> selectWarehouseWaybillPage(IPage page, WarehouseWaybillVO warehouseWaybill);
}

58
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml

@ -2,5 +2,63 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.warehouse.mapper.WarehouseWaybillMapper">
<!-- 通用查询映射结果 -->
<resultMap id="warehouseWaybillResultMap" type="com.logpm.warehouse.entity.WarehouseWaybillEntity">
<result column="id" property="id"/>
<result column="waybill_no" property="waybillNo"/>
<result column="order_no" property="orderNo"/>
<result column="destination_warehouse" property="destinationWarehouse"/>
<result column="departure_warehouse" property="departureWarehouse"/>
<result column="customer_train" property="customerTrain"/>
<result column="brand" property="brand"/>
<result column="shipper" property="shipper"/>
<result column="shipper_name" property="shipperName"/>
<result column="shipper_mobile" property="shipperMobile"/>
<result column="shipper_address" property="shipperAddress"/>
<result column="consignee" property="consignee"/>
<result column="consignee_name" property="consigneeName"/>
<result column="consignee_mobile" property="consigneeMobile"/>
<result column="consignee_address" property="consigneeAddress"/>
<result column="destination" property="destination"/>
<result column="goods_name" property="goodsName"/>
<result column="total_count" property="totalCount"/>
<result column="stock_count" property="stockCount"/>
<result column="total_weight" property="totalWeight"/>
<result column="total_volume" property="totalVolume"/>
<result column="delivery_method" property="deliveryMethod"/>
<result column="urgency" property="urgency"/>
<result column="receipt_count" property="receiptCount"/>
<result column="receipt_requirement" property="receiptRequirement"/>
<result column="agent" property="agent"/>
<result column="agent_id" property="agentId"/>
<result column="consignee_id" property="consigneeId"/>
<result column="shipper_id" property="shipperId"/>
<result column="departure_warehouse_id" property="departureWarehouseId"/>
<result column="destination_warehouse_id" property="destinationWarehouseId"/>
<result column="document_making_time" property="documentMakingTime"/>
<result column="remark" property="remark"/>
<result column="batch_no" property="batchNo"/>
<result column="service_type" property="serviceType"/>
<result column="service_no" property="serviceNo"/>
<result column="freeze_status" property="freezeStatus"/>
<result column="tenant_id" property="tenantId"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="create_dept" property="createDept"/>
<result column="reserve1" property="reserve1"/>
<result column="reserve2" property="reserve2"/>
<result column="reserve3" property="reserve3"/>
<result column="reserve4" property="reserve4"/>
<result column="reserve5" property="reserve5"/>
</resultMap>
<select id="selectWarehouseWaybillPage" resultMap="warehouseWaybillResultMap">
select * from logpm_warehouse_waybill where is_deleted = 0
</select>
</mapper>

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

@ -1,17 +1,36 @@
package com.logpm.warehouse.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.warehouse.dto.SplitOrderDTO;
import com.logpm.warehouse.dto.WaybillDTO;
import com.logpm.warehouse.entity.WarehouseWaybill;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.vo.WarehouseWaybillVO;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* 运单;(logpm_mainline_waybill)表服务接口
* @author : http://www.chiner.pro
* @date : 2023-7-4
*/
public interface IWarehouseWaybillService {
public interface IWarehouseWaybillService extends BaseService<WarehouseWaybillEntity> {
/**
* 自定义分页
*
* @param page
* @param warehouseWaybill
* @return
*/
IPage<WarehouseWaybillVO> selectWarehouseWaybillPage(IPage<WarehouseWaybillVO> page, WarehouseWaybillVO warehouseWaybill);
void waybillDataHandler(WaybillDTO waybillDTO);
WarehouseWaybill findByWaybillNo(String waybillNo);
WarehouseWaybillEntity findByWaybillNo(String waybillNo);
void splitOrder(List<SplitOrderDTO> splitOrderDTOList, DistributionStockArticleEntity distributionStockArticleEntity);
}

80
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

@ -1,6 +1,8 @@
package com.logpm.warehouse.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
@ -14,16 +16,19 @@ import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.oldproject.entity.WayBillEntity;
import com.logpm.oldproject.feign.IWayBillClient;
import com.logpm.warehouse.dto.ProductDTO;
import com.logpm.warehouse.dto.SplitOrderDTO;
import com.logpm.warehouse.dto.WaybillDTO;
import com.logpm.warehouse.entity.WarehouseWayBillDetail;
import com.logpm.warehouse.entity.WarehouseWaybill;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.mapper.WarehouseWaybillMapper;
import com.logpm.warehouse.service.IWarehouseWayBillDetailService;
import com.logpm.warehouse.service.IWarehouseWaybillService;
import com.logpm.warehouse.vo.WarehouseWaybillVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.exception.CustomerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -38,10 +43,10 @@ import java.util.Objects;
* @author : http://www.chiner.pro
* @date : 2023-7-4
*/
@Slf4j
@Log4j2
@Service
@AllArgsConstructor
public class WarehouseWaybillServiceImpl implements IWarehouseWaybillService {
public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybillMapper, WarehouseWaybillEntity> implements IWarehouseWaybillService {
private final WarehouseWaybillMapper warehouseWaybillMapper;
private final IWayBillClient wayBillClient;
private final IBasicdataWarehouseClient basicdataWarehouseClient;
@ -52,6 +57,11 @@ public class WarehouseWaybillServiceImpl implements IWarehouseWaybillService {
private final IDistributionStockArticleClient distributionStockArticleClient;
@Override
public IPage<WarehouseWaybillVO> selectWarehouseWaybillPage(IPage<WarehouseWaybillVO> page, WarehouseWaybillVO warehouseWaybill) {
return page.setRecords(baseMapper.selectWarehouseWaybillPage(page, warehouseWaybill));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void waybillDataHandler(WaybillDTO waybillDTO) {
@ -67,9 +77,9 @@ public class WarehouseWaybillServiceImpl implements IWarehouseWaybillService {
log.info("###############waybillDataHandler: 处理数据开始 waybillNo={}", waybillNo);
//通过运单号先去查询新系统是否存在这个运单号
QueryWrapper<WarehouseWaybill> waybillQueryWrapper = new QueryWrapper<>();
QueryWrapper<WarehouseWaybillEntity> waybillQueryWrapper = new QueryWrapper<>();
waybillQueryWrapper.eq("waybill_no", waybillNo);
WarehouseWaybill warehouseWaybill = warehouseWaybillMapper.selectOne(waybillQueryWrapper);
WarehouseWaybillEntity warehouseWaybill = warehouseWaybillMapper.selectOne(waybillQueryWrapper);
if (Objects.isNull(warehouseWaybill)) {
//如果新系统中不存在这个运单,那么就去查询老系统的运单数据
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNo);
@ -88,7 +98,7 @@ public class WarehouseWaybillServiceImpl implements IWarehouseWaybillService {
throw new CustomerException("运单的总数量异常");
}
warehouseWaybill = new WarehouseWaybill();
warehouseWaybill = new WarehouseWaybillEntity();
warehouseWaybill.setWaybillNo(waybillNo);
warehouseWaybill.setDestinationWarehouse(warehouseName);
warehouseWaybill.setDestinationWarehouseId(Objects.isNull(endhouse) ? null : endhouse.getId());
@ -188,7 +198,7 @@ public class WarehouseWaybillServiceImpl implements IWarehouseWaybillService {
log.info("###############waybillDataHandler: 处理数据结束 waybillNo={}", waybillNo);
}
private final void createStockArticle(WarehouseWaybill warehouseWaybill) {
private final void createStockArticle(WarehouseWaybillEntity warehouseWaybill) {
//判断新系统是否有这条订单数据
//自动生成的在库订单就用运单号作为订单号
String waybillNo = warehouseWaybill.getWaybillNo();
@ -273,10 +283,58 @@ public class WarehouseWaybillServiceImpl implements IWarehouseWaybillService {
@Override
public WarehouseWaybill findByWaybillNo(String waybillNo) {
QueryWrapper<WarehouseWaybill> queryWrapper = new QueryWrapper<>();
public WarehouseWaybillEntity findByWaybillNo(String waybillNo) {
QueryWrapper<WarehouseWaybillEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("waybill_no", waybillNo);
return warehouseWaybillMapper.selectOne(queryWrapper);
}
@Override
@Transactional
public void splitOrder(List<SplitOrderDTO> splitOrderDTOList, DistributionStockArticleEntity distributionStockArticleEntity) {
log.info("###########splitOrder: 开始拆单 ");
for (int i = 0; i < splitOrderDTOList.size();i++){
SplitOrderDTO splitOrderDTO = splitOrderDTOList.get(i);
DistributionStockArticleEntity entity = new DistributionStockArticleEntity();
BeanUtil.copyProperties(distributionStockArticleEntity,entity);
entity.setOrderSelfNumbering(entity.getOrderSelfNumbering()+"-"+(i+1));
entity.setCustomerName(splitOrderDTO.getCustomerPerson());
entity.setCustomerTelephone(splitOrderDTO.getCustomerMobile());
entity.setCustomerAddress(splitOrderDTO.getCustomerAddress());
List<ProductDTO> products = splitOrderDTO.getProducts();
StringBuffer stringBuffer = new StringBuffer();
Integer allNum = 0;
List<DistributionParcelListEntity> list = new ArrayList<>();
for (ProductDTO productDTO:products){
if(StringUtil.isBlank(stringBuffer.toString())){
stringBuffer.append(productDTO.getProductName());
}else{
stringBuffer.append(",").append(productDTO.getProductName());
}
allNum = allNum + productDTO.getNum();
DistributionParcelListEntity distributionParcelListEntity = new DistributionParcelListEntity();
distributionParcelListEntity.setMaterialName(productDTO.getProductName());
distributionParcelListEntity.setQuantity(productDTO.getNum());
list.add(distributionParcelListEntity);
}
entity.setDescriptionGoods(stringBuffer.toString());
entity.setTotalNumber(allNum);
entity.setHandQuantity(allNum);
Long aLong = distributionStockArticleClient.addData(entity);
if(aLong == 0){
log.warn("###########splitOrder: 保存新订单数据失败");
throw new CustomerException(405,"保存新订单数据失败");
}
for (DistributionParcelListEntity distributionParcelListEntity:list){
distributionParcelListEntity.setStockArticleId(aLong);
}
boolean b = distributionParcelListClient.addBatch(list);
if(!b){
log.warn("###########splitOrder: 保存包件数据失败");
throw new CustomerException(405,"保存包件数据失败");
}
}
}
}

50
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseWaybillWrapper.java

@ -0,0 +1,50 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.warehouse.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.vo.WarehouseWaybillVO;
import java.util.Objects;
/**
* 运单表 包装类,返回视图层所需的字段
*
* @author zhy
* @since 2023-07-10
*/
public class WarehouseWaybillWrapper extends BaseEntityWrapper<WarehouseWaybillEntity, WarehouseWaybillVO> {
public static WarehouseWaybillWrapper build() {
return new WarehouseWaybillWrapper();
}
@Override
public WarehouseWaybillVO entityVO(WarehouseWaybillEntity warehouseWaybill) {
WarehouseWaybillVO warehouseWaybillVO = Objects.requireNonNull(BeanUtil.copy(warehouseWaybill, WarehouseWaybillVO.class));
//User createUser = UserCache.getUser(warehouseWaybill.getCreateUser());
//User updateUser = UserCache.getUser(warehouseWaybill.getUpdateUser());
//warehouseWaybillVO.setCreateUserName(createUser.getName());
//warehouseWaybillVO.setUpdateUserName(updateUser.getName());
return warehouseWaybillVO;
}
}
Loading…
Cancel
Save