From f5b12bf771057993bed22e0c9991b0827b374cc8 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Mon, 10 Jul 2023 19:51:57 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=BF=90=E5=8D=95=E6=8B=86=E5=8D=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IDistributionStockArticleClient.java | 2 + .../warehouse/entity/WarehouseWaybill.java | 146 ----------- .../entity/WarehouseWaybillEntity.java | 247 ++++++++++++++++++ .../feign/IWarehouseWaybillClient.java | 21 +- .../warehouse/vo/WarehouseWaybillVO.java | 35 +++ .../feign/DistributionStockArticleClient.java | 7 + blade-service/logpm-warehouse/pom.xml | 6 +- .../WarehouseWaybillController.java | 200 +++++++++++++- .../logpm/warehouse/dto/SplitOrderDTO.java | 22 ++ .../warehouse/dto/WarehouseWaybillDTO.java | 34 +++ .../feign/WarehouseWaybillClient.java | 18 +- .../mapper/WarehouseWaybillMapper.java | 42 ++- .../mapper/WarehouseWaybillMapper.xml | 58 ++++ .../service/IWarehouseWaybillService.java | 25 +- .../impl/WarehouseWaybillServiceImpl.java | 80 +++++- .../wrapper/WarehouseWaybillWrapper.java | 50 ++++ 16 files changed, 809 insertions(+), 184 deletions(-) delete mode 100644 blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybill.java create mode 100644 blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java create mode 100644 blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java create mode 100644 blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/SplitOrderDTO.java create mode 100644 blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java create mode 100644 blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseWaybillWrapper.java diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java index 6d08f4d90..734e27be4 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java +++ b/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); } diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybill.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybill.java deleted file mode 100644 index 12ad4f15a..000000000 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybill.java +++ /dev/null @@ -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 ; - -} diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java new file mode 100644 index 000000000..935682c01 --- /dev/null +++ b/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; + +} diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillClient.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillClient.java index 1d0c27a98..9563716c1 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillClient.java +++ b/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 top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + @GetMapping(API_PREFIX + "/findByWaybillNo") - WarehouseWaybill findByWaybillNo(@RequestParam String waybillNo); + WarehouseWaybillEntity findByWaybillNo(@RequestParam String waybillNo); + } diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java new file mode 100644 index 000000000..c434de6d9 --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java index d13520848..c8681d974 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java +++ b/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); + } + } diff --git a/blade-service/logpm-warehouse/pom.xml b/blade-service/logpm-warehouse/pom.xml index 62a4a794a..1e95d65b9 100644 --- a/blade-service/logpm-warehouse/pom.xml +++ b/blade-service/logpm-warehouse/pom.xml @@ -47,19 +47,19 @@ org.springblade - logpm-old-project-api + logpm-basicdata-api 3.1.0.RELEASE compile org.springblade - logpm-basicdata-api + logpm-distribution-api 3.1.0.RELEASE compile org.springblade - logpm-distribution-api + logpm-old-project-api 3.1.0.RELEASE compile diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java index ad6ac80a1..eeeef2a9e 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java +++ b/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 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> list(@ApiIgnore @RequestParam Map warehouseWaybill, Query query) { + IPage 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> page(WarehouseWaybillVO warehouseWaybill, Query query) { + IPage 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 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 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,"系统出现异常"); + } + } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/SplitOrderDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/SplitOrderDTO.java new file mode 100644 index 000000000..c577a1592 --- /dev/null +++ b/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 products = new ArrayList<>(); + +} diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java new file mode 100644 index 000000000..53cb427e2 --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillClient.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillClient.java index 8477f54da..f9ec9f588 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillClient.java +++ b/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 top(Integer current, Integer size) { + Query query = new Query(); + query.setCurrent(current); + query.setSize(size); + IPage 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); } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java index 7e5f679e5..ba95f8dd5 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java +++ b/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{ +public interface WarehouseWaybillMapper extends BaseMapper { + + /** + * 自定义分页 + * + * @param page + * @param warehouseWaybill + * @return + */ + List selectWarehouseWaybillPage(IPage page, WarehouseWaybillVO warehouseWaybill); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml index 7dd8e2426..cd72ce63f 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml @@ -2,5 +2,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java index 37f60f922..882fbeba7 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java +++ b/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 { + + /** + * 自定义分页 + * + * @param page + * @param warehouseWaybill + * @return + */ + IPage selectWarehouseWaybillPage(IPage page, WarehouseWaybillVO warehouseWaybill); + void waybillDataHandler(WaybillDTO waybillDTO); - WarehouseWaybill findByWaybillNo(String waybillNo); + WarehouseWaybillEntity findByWaybillNo(String waybillNo); + + void splitOrder(List splitOrderDTOList, DistributionStockArticleEntity distributionStockArticleEntity); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java index 304fb422c..491d85031 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java +++ b/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 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 selectWarehouseWaybillPage(IPage 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 waybillQueryWrapper = new QueryWrapper<>(); + QueryWrapper 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 queryWrapper = new QueryWrapper<>(); + public WarehouseWaybillEntity findByWaybillNo(String waybillNo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("waybill_no", waybillNo); return warehouseWaybillMapper.selectOne(queryWrapper); } + @Override + @Transactional + public void splitOrder(List 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 products = splitOrderDTO.getProducts(); + StringBuffer stringBuffer = new StringBuffer(); + Integer allNum = 0; + List 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,"保存包件数据失败"); + } + + } + } + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseWaybillWrapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseWaybillWrapper.java new file mode 100644 index 000000000..d1f1118a1 --- /dev/null +++ b/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 { + + 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; + } + + +}