From 762a713f978e8a7753bdcbfd00ee026290b18956 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Fri, 28 Feb 2025 09:28:44 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E6=98=A0=E5=B0=84=E5=93=81?= =?UTF-8?q?=E7=B1=BB=E5=AD=90=E7=B1=BB=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/BasicdataClientEntity.java | 7 + .../entity/BasicdataMainCategoryEntity.java | 58 ++ .../statistics/dto/MerchantStatisticsDTO.java | 1 + .../com/logpm/trunkline/dto/AdvanceDTO.java | 3 +- .../feign/IWarehouseWaybillClient.java | 3 + .../BasicdataForwardingUnitController.java | 106 +++ .../BasicdataMainCategoryController.java | 111 +++ .../controller/BasicdataMainController.java | 31 +- .../basicdata/dto/ForwardingUnitDTO.java | 27 + .../java/com/logpm/basicdata/dto/MainDTO.java | 23 + .../mapper/BasicdataForwardingUnitMapper.java | 9 + .../mapper/BasicdataForwardingUnitMapper.xml | 34 + .../mapper/BasicdataMainCategoryMapper.java | 16 + .../mapper/BasicdataMainCategoryMapper.xml | 24 + .../basicdata/mapper/BasicdataMainMapper.java | 4 + .../basicdata/mapper/BasicdataMainMapper.xml | 12 + .../IBasicdataForwardingUnitService.java | 9 + .../IBasicdataMainCategoryService.java | 15 + .../service/IBasicdataMainService.java | 7 +- .../BasicdataForwardingUnitServiceImpl.java | 51 ++ .../BasicdataMainCategoryServiceImpl.java | 58 ++ .../impl/BasicdataMainServiceImpl.java | 10 + .../mapper/StatisticsOrderInfoMapper.xml | 13 + .../trunkline/config/ExecutorConfig.java | 1 - .../mapper/TrunklineAdvanceDetailMapper.xml | 1 + .../service/impl/OpenOrderServiceImpl.java | 653 +++++++++--------- .../feign/WarehouseWaybillClient.java | 5 + .../service/IWarehouseWaybillService.java | 1 + .../impl/WarehouseWaybillServiceImpl.java | 11 + 29 files changed, 981 insertions(+), 323 deletions(-) create mode 100644 blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataMainCategoryEntity.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataForwardingUnitController.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataMainCategoryController.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/ForwardingUnitDTO.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/MainDTO.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataForwardingUnitMapper.xml create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainCategoryMapper.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainCategoryMapper.xml create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataMainCategoryService.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataMainCategoryServiceImpl.java diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataClientEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataClientEntity.java index ec021bc91..6235c6232 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataClientEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataClientEntity.java @@ -250,4 +250,11 @@ public class BasicdataClientEntity extends TenantEntity { @ApiModelProperty(value = "是否是新用户 0否 1是") private Integer isNew; + + @ApiModelProperty(value = "主体id ") + private Long mainId; + + @ApiModelProperty(value = "主体名称 ") + private String mainName; + } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataMainCategoryEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataMainCategoryEntity.java new file mode 100644 index 000000000..648a4dd0e --- /dev/null +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataMainCategoryEntity.java @@ -0,0 +1,58 @@ +package com.logpm.basicdata.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; + +@Data +@TableName("logpm_basicdata_main_category") +@ApiModel(value = "BasicdataMainCategory对象", description = "物料映射子表") +@EqualsAndHashCode(callSuper = true) +public class BasicdataMainCategoryEntity extends TenantEntity { + + /** + * 预留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; + + @ApiModelProperty(value = "映射品类id") + private Long factoryCategoryId; + + @ApiModelProperty(value = "品类id") + private Long categoryId; + + @ApiModelProperty(value = "品类名称") + private String category; + + @ApiModelProperty(value = "主体id") + private Long mainId; + + @ApiModelProperty(value = "主体名称") + private String mainName; + + +} diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java index 7e45adaa0..45b7001ef 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java @@ -49,6 +49,7 @@ public class MerchantStatisticsDTO implements Serializable { * 运单号 */ private String waybillNo; + private List waybillNos; /** * 订单号 */ diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AdvanceDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AdvanceDTO.java index fe352db75..706605547 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AdvanceDTO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/AdvanceDTO.java @@ -56,6 +56,7 @@ public class AdvanceDTO implements Serializable { private Integer isTimeOut; - + private Long clientId; + private Long mainId; } 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 b763c5ed8..41bf317da 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 @@ -109,4 +109,7 @@ public interface IWarehouseWaybillClient { @GetMapping(API_PREFIX + "/findWaybillVOByOrderCode") List findWaybillVOByOrderCode(@RequestParam String orderCode); + + @GetMapping(API_PREFIX+"/deleteAllByWaybillId") + void deleteAllByWaybillId(@RequestParam Long waybillId); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataForwardingUnitController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataForwardingUnitController.java new file mode 100644 index 000000000..f68625584 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataForwardingUnitController.java @@ -0,0 +1,106 @@ +package com.logpm.basicdata.controller; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.logpm.basicdata.dto.ForwardingUnitDTO; +import com.logpm.basicdata.entity.BasicdataForwardingUnitEntity; +import com.logpm.basicdata.service.IBasicdataForwardingUnitService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.exception.CustomerException; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; + +@Slf4j +@RestController +@AllArgsConstructor +@RequestMapping("/forwardingUnit") +@Api(value = "始发仓默认发货单位", tags = "始发仓默认发货单位") +public class BasicdataForwardingUnitController { + + private final IBasicdataForwardingUnitService basicdataForwardingUnitService; + + @ResponseBody + @PostMapping("/pageList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "默认发货单位列表", notes = "传入forwardingUnitDTO") + public R pageList(@RequestBody ForwardingUnitDTO forwardingUnitDTO) { + String method = "############pageList: "; + log.info(method + "请求参数{}", forwardingUnitDTO); + try { + + IPage pages = basicdataForwardingUnitService.pageList(forwardingUnitDTO); + return R.data(pages); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error(method + "系统异常", e); + return R.fail(500, method + "系统异常"); + } + } + + @ResponseBody + @PostMapping("/editUnit") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增或更新默认发货单位", notes = "传入forwardingUnitDTO") + public R editUnit(@RequestBody ForwardingUnitDTO forwardingUnitDTO) { + String method = "############editUnit: "; + log.info(method + "请求参数{}", forwardingUnitDTO); + try { + Long warehouseId = forwardingUnitDTO.getWarehouseId(); + if(Objects.isNull(warehouseId)){ + log.warn(method+"仓库id为空"); + return R.fail(405,"仓库id为空"); + } + Long clientId = forwardingUnitDTO.getClientId(); + if(Objects.isNull(clientId)){ + log.warn(method+"客户id为空"); + return R.fail(405,"客户id为空"); + } + + return basicdataForwardingUnitService.editUnit(forwardingUnitDTO); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error(method + "系统异常", e); + return R.fail(500, method + "系统异常"); + } + } + + + @ResponseBody + @PostMapping("/removeUnit") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "删除默认发货单位", notes = "传入forwardingUnitDTO") + public R removeUnit(@RequestBody ForwardingUnitDTO forwardingUnitDTO) { + String method = "############removeUnit: "; + log.info(method + "请求参数{}", forwardingUnitDTO); + try { + List ids = forwardingUnitDTO.getIds(); + if(CollUtil.isEmpty(ids)){ + log.warn(method+"移除id为空"); + return R.fail(405,"移除id为空"); + } + + return basicdataForwardingUnitService.removeUnit(forwardingUnitDTO); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error(method + "系统异常", e); + return R.fail(500, method + "系统异常"); + } + } + + + + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataMainCategoryController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataMainCategoryController.java new file mode 100644 index 000000000..a1135d01a --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataMainCategoryController.java @@ -0,0 +1,111 @@ +package com.logpm.basicdata.controller; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.logpm.basicdata.dto.MainDTO; +import com.logpm.basicdata.entity.BasicdataMainCategoryEntity; +import com.logpm.basicdata.service.IBasicdataMainCategoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.exception.CustomerException; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; + +@Slf4j +@RestController +@AllArgsConstructor +@RequestMapping("/basicdataMainCategory") +@Api(value = "主体结算品类", tags = "主体结算品类") +public class BasicdataMainCategoryController { + + private final IBasicdataMainCategoryService basicdataMainCategoryService; + + @ResponseBody + @PostMapping("/pageList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "映射品类子类列表", notes = "传入mainDTO") + public R pageList(@RequestBody MainDTO mainDTO) { + String method = "############pageList: "; + log.info(method + "请求参数{}", mainDTO); + try { + + IPage pages = basicdataMainCategoryService.pageList(mainDTO); + return R.data(pages); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error(method + "系统异常", e); + return R.fail(500, method + "系统异常"); + } + } + + @ResponseBody + @PostMapping("/editMainCategory") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增或更新映射品类子类", notes = "传入mainDTO") + public R editMainCategory(@RequestBody MainDTO mainDTO) { + String method = "############editMainCategory: "; + log.info(method + "请求参数{}", mainDTO); + try { + Long factoryCategoryId = mainDTO.getFactoryCategoryId(); + if(Objects.isNull(factoryCategoryId)){ + log.warn(method+"映射id为空"); + return R.fail(405,"映射id为空"); + } + Long mainId = mainDTO.getMainId(); + if(Objects.isNull(mainId)){ + log.warn(method+"主体id为空"); + return R.fail(405,"主体id为空"); + } + + Long categoryId = mainDTO.getCategoryId(); + if(Objects.isNull(categoryId)){ + log.warn(method+"品类id为空"); + return R.fail(405,"品类id为空"); + } + + return basicdataMainCategoryService.editMainCategory(mainDTO); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error(method + "系统异常", e); + return R.fail(500, method + "系统异常"); + } + } + + + @ResponseBody + @PostMapping("/removeMainCategory") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "删除主体映射", notes = "传入mainDTO") + public R removeMainCategory(@RequestBody MainDTO mainDTO) { + String method = "############removeMainCategory: "; + log.info(method + "请求参数{}", mainDTO); + try { + List ids = mainDTO.getIds(); + if(CollUtil.isEmpty(ids)){ + log.warn(method+"移除id为空"); + return R.fail(405,"移除id为空"); + } + + return basicdataMainCategoryService.removeMainCategory(mainDTO); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error(method + "系统异常", e); + return R.fail(500, method + "系统异常"); + } + } + + + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataMainController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataMainController.java index b75c3fa71..0caf99d57 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataMainController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataMainController.java @@ -2,22 +2,23 @@ package com.logpm.basicdata.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.logpm.basicdata.entity.BasicdataGoodsAreaEntity; +import com.logpm.basicdata.dto.MainDTO; import com.logpm.basicdata.entity.BasicdataMainEntity; -import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.service.IBasicdataMainService; -import com.logpm.basicdata.vo.BasicdataGoodsAreaVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.exception.CustomerException; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; -import java.util.Objects; +import java.util.List; +@Slf4j @RestController @AllArgsConstructor @RequestMapping("/basicdataMain") @@ -56,4 +57,26 @@ public class BasicdataMainController { return R.data(pages); } + + @ResponseBody + @PostMapping("/mainList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "主体列表", notes = "传入mainDTO") + public R mainList(@RequestBody MainDTO mainDTO) { + String method = "############mainList: "; + log.info(method + "请求参数{}", mainDTO); + try { + + List list = basicdataMainService.mainList(mainDTO); + return R.data(list); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error(method + "系统异常", e); + return R.fail(500, method + "系统异常"); + } + } + + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/ForwardingUnitDTO.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/ForwardingUnitDTO.java new file mode 100644 index 000000000..aa7fa0cea --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/ForwardingUnitDTO.java @@ -0,0 +1,27 @@ +package com.logpm.basicdata.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class ForwardingUnitDTO implements Serializable { + + private Integer pageNum; + private Integer pageSize; + + private List warehouseIds; + + private List ids; + + + private Long warehouseId; + private String warehouseName; + + private Long clientId; + private String clientName; + + + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/MainDTO.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/MainDTO.java new file mode 100644 index 000000000..e5bc3c3a7 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/MainDTO.java @@ -0,0 +1,23 @@ +package com.logpm.basicdata.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class MainDTO implements Serializable { + + private String mainName; + + private Integer pageNum; + private Integer pageSize; + + private Long factoryCategoryId; + private Long mainId; + private Long categoryId; + private String category; + + private List ids; + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataForwardingUnitMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataForwardingUnitMapper.java index 9192e3050..9abe94fc1 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataForwardingUnitMapper.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataForwardingUnitMapper.java @@ -1,11 +1,20 @@ package com.logpm.basicdata.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.basicdata.dto.ForwardingUnitDTO; import com.logpm.basicdata.entity.BasicdataForwardingUnitEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; @Mapper public interface BasicdataForwardingUnitMapper extends BaseMapper { + IPage pageList(IPage page, @Param("param") ForwardingUnitDTO forwardingUnitDTO); + + BasicdataForwardingUnitEntity findByWarehouseId(@Param("warehouseId") Long warehouseId); + void removeUnit(@Param("ids") List ids); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataForwardingUnitMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataForwardingUnitMapper.xml new file mode 100644 index 000000000..53a9f1c3f --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataForwardingUnitMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + delete from logpm_basicdata_forwarding_unit + where id in + + #{id} + + + + diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainCategoryMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainCategoryMapper.java new file mode 100644 index 000000000..01072a9c9 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainCategoryMapper.java @@ -0,0 +1,16 @@ +package com.logpm.basicdata.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.basicdata.dto.MainDTO; +import com.logpm.basicdata.entity.BasicdataMainCategoryEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +@Mapper +public interface BasicdataMainCategoryMapper extends BaseMapper { + + IPage pageList(IPage page, @Param("param") MainDTO mainDTO); + + BasicdataMainCategoryEntity findEntityByParam(@Param("param") MainDTO mainDTO); +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainCategoryMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainCategoryMapper.xml new file mode 100644 index 000000000..2affcb994 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainCategoryMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainMapper.java index ad7f07e94..66a86bc65 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainMapper.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainMapper.java @@ -2,12 +2,16 @@ package com.logpm.basicdata.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.basicdata.dto.MainDTO; import com.logpm.basicdata.entity.BasicdataMainEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper public interface BasicdataMainMapper extends BaseMapper { List selectBasicdataMainEntityPage(IPage page, BasicdataMainEntity basicdataMainEntity); + + List mainList(@Param("param") MainDTO mainDTO); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainMapper.xml index f07d4b4e7..80d64a97f 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataMainMapper.xml @@ -6,4 +6,16 @@ + + + + diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataForwardingUnitService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataForwardingUnitService.java index b33601025..678121a0f 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataForwardingUnitService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataForwardingUnitService.java @@ -1,7 +1,16 @@ package com.logpm.basicdata.service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.basicdata.dto.ForwardingUnitDTO; import com.logpm.basicdata.entity.BasicdataForwardingUnitEntity; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.api.R; public interface IBasicdataForwardingUnitService extends BaseService { + + IPage pageList(ForwardingUnitDTO forwardingUnitDTO); + + R editUnit(ForwardingUnitDTO forwardingUnitDTO); + + R removeUnit(ForwardingUnitDTO forwardingUnitDTO); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataMainCategoryService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataMainCategoryService.java new file mode 100644 index 000000000..2e52449cf --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataMainCategoryService.java @@ -0,0 +1,15 @@ +package com.logpm.basicdata.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.basicdata.dto.MainDTO; +import com.logpm.basicdata.entity.BasicdataMainCategoryEntity; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.api.R; + +public interface IBasicdataMainCategoryService extends BaseService { + IPage pageList(MainDTO mainDTO); + + R editMainCategory(MainDTO mainDTO); + + R removeMainCategory(MainDTO mainDTO); +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataMainService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataMainService.java index 76a25df25..5480ab746 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataMainService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataMainService.java @@ -1,13 +1,18 @@ package com.logpm.basicdata.service; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.logpm.basicdata.entity.BasicdataHistoricalContractEntity; +import com.logpm.basicdata.dto.MainDTO; import com.logpm.basicdata.entity.BasicdataMainEntity; import org.springblade.core.mp.base.BaseService; +import java.util.List; + /** * 结算主体表 服务类 */ public interface IBasicdataMainService extends BaseService { IPage selectBasicdataMainEntityPage(IPage page, BasicdataMainEntity basicdataMainEntity); + + List mainList(MainDTO mainDTO); + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataForwardingUnitServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataForwardingUnitServiceImpl.java index 5b4e2331a..046607508 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataForwardingUnitServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataForwardingUnitServiceImpl.java @@ -1,16 +1,67 @@ package com.logpm.basicdata.service.impl; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.logpm.basicdata.dto.ForwardingUnitDTO; import com.logpm.basicdata.entity.BasicdataForwardingUnitEntity; import com.logpm.basicdata.mapper.BasicdataForwardingUnitMapper; import com.logpm.basicdata.service.IBasicdataForwardingUnitService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Objects; + @Slf4j @Service @AllArgsConstructor public class BasicdataForwardingUnitServiceImpl extends BaseServiceImpl implements IBasicdataForwardingUnitService { + @Override + public IPage pageList(ForwardingUnitDTO forwardingUnitDTO) { + + IPage page = new Page<>(); + page.setCurrent(forwardingUnitDTO.getPageNum()); + page.setSize(forwardingUnitDTO.getPageSize()); + + IPage pageList = baseMapper.pageList(page,forwardingUnitDTO); + + return pageList; + } + + @Override + public R editUnit(ForwardingUnitDTO forwardingUnitDTO) { + + Long warehouseId = forwardingUnitDTO.getWarehouseId(); + + BasicdataForwardingUnitEntity forwardingUnitEntity = baseMapper.findByWarehouseId(warehouseId); + + if(Objects.isNull(forwardingUnitEntity)){ + forwardingUnitEntity = new BasicdataForwardingUnitEntity(); + } + + forwardingUnitEntity.setWarehouseId(warehouseId); + forwardingUnitEntity.setWarehouseName(forwardingUnitDTO.getWarehouseName()); + forwardingUnitEntity.setClientId(forwardingUnitDTO.getClientId()); + forwardingUnitEntity.setClientName(forwardingUnitDTO.getClientName()); + + saveOrUpdate(forwardingUnitEntity); + + return R.success("操作成功"); + } + + @Override + public R removeUnit(ForwardingUnitDTO forwardingUnitDTO) { + + List ids = forwardingUnitDTO.getIds(); + +// baseMapper.removeUnit(ids); + + deleteLogic(ids); + + return R.success("操作成功"); + } } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataMainCategoryServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataMainCategoryServiceImpl.java new file mode 100644 index 000000000..486452c27 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataMainCategoryServiceImpl.java @@ -0,0 +1,58 @@ +package com.logpm.basicdata.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.logpm.basicdata.dto.MainDTO; +import com.logpm.basicdata.entity.BasicdataMainCategoryEntity; +import com.logpm.basicdata.mapper.BasicdataMainCategoryMapper; +import com.logpm.basicdata.service.IBasicdataMainCategoryService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +@Slf4j +@AllArgsConstructor +@Service +public class BasicdataMainCategoryServiceImpl extends BaseServiceImpl implements IBasicdataMainCategoryService { + @Override + public IPage pageList(MainDTO mainDTO) { + IPage page = new Page<>(); + page.setCurrent(mainDTO.getPageNum()); + page.setSize(mainDTO.getPageSize()); + + IPage pageList = baseMapper.pageList(page,mainDTO); + + return pageList; + } + + @Override + public R editMainCategory(MainDTO mainDTO) { + BasicdataMainCategoryEntity mainCategoryEntity = baseMapper.findEntityByParam(mainDTO); + + if(Objects.isNull(mainCategoryEntity)){ + mainCategoryEntity = new BasicdataMainCategoryEntity(); + mainCategoryEntity.setFactoryCategoryId(mainDTO.getFactoryCategoryId()); + mainCategoryEntity.setMainId(mainDTO.getMainId()); + mainCategoryEntity.setMainName(mainDTO.getMainName()); + } + + mainCategoryEntity.setCategory(mainDTO.getCategory()); + mainCategoryEntity.setCategoryId(mainDTO.getCategoryId()); + + saveOrUpdate(mainCategoryEntity); + + return R.success("操作成功"); + } + + @Override + public R removeMainCategory(MainDTO mainDTO) { + + deleteLogic(mainDTO.getIds()); + + return R.success("操作成功"); + } +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataMainServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataMainServiceImpl.java index f6d7bf784..6e4476a6f 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataMainServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataMainServiceImpl.java @@ -1,12 +1,17 @@ package com.logpm.basicdata.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.basicdata.dto.MainDTO; +import com.logpm.basicdata.entity.BasicdataForwardingUnitEntity; import com.logpm.basicdata.entity.BasicdataMainEntity; import com.logpm.basicdata.mapper.BasicdataMainMapper; import com.logpm.basicdata.service.IBasicdataMainService; import org.springblade.core.mp.base.BaseServiceImpl; import org.springframework.stereotype.Service; +import java.util.Collections; +import java.util.List; + @Service public class BasicdataMainServiceImpl extends BaseServiceImpl implements IBasicdataMainService { @Override @@ -15,4 +20,9 @@ public class BasicdataMainServiceImpl extends BaseServiceImpl mainList(MainDTO mainDTO) { + return baseMapper.mainList(mainDTO); + } } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml index 3d156f776..b35b1c2a5 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml @@ -69,6 +69,12 @@ and Locate(#{param.waybillNo},lww.waybill_no) > 0 + + and lww.waybill_no in + + #{item} + + and Locate(#{param.orderCode},lww.order_no) > 0 @@ -718,6 +724,13 @@ and Locate(#{param.waybillNo},lww.waybill_no) > 0 + + and lww.waybill_no in + + #{item} + + + and Locate(#{param.orderCode},lww.order_no) > 0 diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java index 89003ea0a..15f5ca30f 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java @@ -57,7 +57,6 @@ public class ExecutorConfig { RequestAttributes context = RequestContextHolder.currentRequestAttributes(); String tenantId = AuthUtil.getTenantId(); - Map all = ThreadLocalUtil.getAll(); Map mdcMap = MDC.getCopyOfContextMap(); return () -> { diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml index 923d23412..0e23e45eb 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml @@ -516,6 +516,7 @@ IFNULL(lbfc1.category,'其他') incomeCategoryName from logpm_trunkline_advance_detail ltad left join logpm_basicdata_factory_category lbfc1 on lbfc1.brand = ltad.brand and IFNULL(lbfc1.firsts,1) = IFNULL(ltad.first_pack_name,1) and IFNULL(lbfc1.seconds,2) = IFNULL(ltad.second_pack_name,2) and IFNULL(lbfc1.thirds,3) = IFNULL(ltad.third_pack_name,3) and lbfc1.type = 1 AND IFNULL(lbfc1.materiel_name,4) = IFNULL(ltad.material_name,4) AND lbfc1.is_deleted = 0 + left join logpm_basicdata_main_category lbmc on lbmc.factory_category_id = lbfc1.id and lbmc.main_id = #{param.mainId} and lbmc.is_deleted = 0 where ltad.is_deleted = 0 and ltad.advance_id in diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 9e10938d5..f94ea784b 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -815,249 +815,255 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity); waybillEntity.setId(waybillId); - List details = new ArrayList<>(); - if (!Objects.isNull(waybillId)) { - log.info("#################openWaybill: 运单保存成功"); - //保存运单货物明细 - List waybillDetailList = openOrderDTO.getWaybillDetailList(); - for (WaybillDetailDTO waybillDetailDTO : waybillDetailList) { - WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); - warehouseWayBillDetail.setWaybillId(waybillId); - warehouseWayBillDetail.setWaybillNo(waybillEntity.getWaybillNo()); - Long goodsId = waybillDetailDTO.getGoodsId(); - String goodsName = waybillDetailDTO.getGoodsName(); -// if (Objects.isNull(goodsId)) { -// //如果品名id没有就先通过goodsName查寻,没有就新增 -// BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName); -// if (Objects.isNull(basicdataCategoryEntity)) { -// basicdataCategoryEntity = new BasicdataCategoryEntity(); -// basicdataCategoryEntity.setName(goodsName); -// basicdataCategoryEntity.setType(1); -// goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity); -// } else { -// goodsId = basicdataCategoryEntity.getId(); + try{ + List details = new ArrayList<>(); + if (!Objects.isNull(waybillId)) { + log.info("#################openWaybill: 运单保存成功"); + //保存运单货物明细 + List waybillDetailList = openOrderDTO.getWaybillDetailList(); + for (WaybillDetailDTO waybillDetailDTO : waybillDetailList) { + WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); + warehouseWayBillDetail.setWaybillId(waybillId); + warehouseWayBillDetail.setWaybillNo(waybillEntity.getWaybillNo()); + Long goodsId = waybillDetailDTO.getGoodsId(); + String goodsName = waybillDetailDTO.getGoodsName(); +// if (Objects.isNull(goodsId)) { +// //如果品名id没有就先通过goodsName查寻,没有就新增 +// BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName); +// if (Objects.isNull(basicdataCategoryEntity)) { +// basicdataCategoryEntity = new BasicdataCategoryEntity(); +// basicdataCategoryEntity.setName(goodsName); +// basicdataCategoryEntity.setType(1); +// goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity); +// } else { +// goodsId = basicdataCategoryEntity.getId(); +// } // } -// } - warehouseWayBillDetail.setCreateUser(AuthUtil.getUserId()); - warehouseWayBillDetail.setUpdateUser(AuthUtil.getUserId()); - Date date = new Date(); - warehouseWayBillDetail.setCreateTime(date); - warehouseWayBillDetail.setUpdateTime(date); - warehouseWayBillDetail.setStatus(1); - warehouseWayBillDetail.setIsDeleted(0); - warehouseWayBillDetail.setProductId(goodsId); - warehouseWayBillDetail.setProductName(goodsName); - Integer num = waybillDetailDTO.getNum(); - BigDecimal volume = waybillDetailDTO.getVolume(); - BigDecimal weight = waybillDetailDTO.getWeight(); - warehouseWayBillDetail.setNum(num); - warehouseWayBillDetail.setVolume(volume); - warehouseWayBillDetail.setWeight(weight); - BigDecimal price = waybillDetailDTO.getPrice(); - Integer chargeType = waybillDetailDTO.getChargeType(); - BigDecimal subtotalFreight = waybillDetailDTO.getSubtotalFreight(); - if(price.compareTo(BigDecimal.ZERO) == 0){ + warehouseWayBillDetail.setCreateUser(AuthUtil.getUserId()); + warehouseWayBillDetail.setUpdateUser(AuthUtil.getUserId()); + Date date = new Date(); + warehouseWayBillDetail.setCreateTime(date); + warehouseWayBillDetail.setUpdateTime(date); + warehouseWayBillDetail.setStatus(1); + warehouseWayBillDetail.setIsDeleted(0); + warehouseWayBillDetail.setProductId(goodsId); + warehouseWayBillDetail.setProductName(goodsName); + Integer num = waybillDetailDTO.getNum(); + BigDecimal volume = waybillDetailDTO.getVolume(); + BigDecimal weight = waybillDetailDTO.getWeight(); + warehouseWayBillDetail.setNum(num); + warehouseWayBillDetail.setVolume(volume); + warehouseWayBillDetail.setWeight(weight); + BigDecimal price = waybillDetailDTO.getPrice(); + Integer chargeType = waybillDetailDTO.getChargeType(); + BigDecimal subtotalFreight = waybillDetailDTO.getSubtotalFreight(); + if(price.compareTo(BigDecimal.ZERO) == 0){ + + if(chargeType.equals(1)){ + price = subtotalFreight.divide(new BigDecimal(num),6, RoundingMode.HALF_UP); + }else if(chargeType.equals(2)){ + price = subtotalFreight.divide(volume,6, RoundingMode.HALF_UP); + }else if(chargeType.equals(3)){ + price = subtotalFreight.divide(weight,6, RoundingMode.HALF_UP); + } - if(chargeType.equals(1)){ - price = subtotalFreight.divide(new BigDecimal(num),6, RoundingMode.HALF_UP); - }else if(chargeType.equals(2)){ - price = subtotalFreight.divide(volume,6, RoundingMode.HALF_UP); - }else if(chargeType.equals(3)){ - price = subtotalFreight.divide(weight,6, RoundingMode.HALF_UP); } + warehouseWayBillDetail.setPrice(price); + warehouseWayBillDetail.setSubtotalFreight(subtotalFreight); + warehouseWayBillDetail.setChargeType(chargeType); + warehouseWayBillDetail.setDeliveryPrice(waybillDetailDTO.getDeliveryPrice()); + warehouseWayBillDetail.setSubtotalDeliveryFee(waybillDetailDTO.getSubtotalDeliveryFee()); + warehouseWayBillDetail.setPickupPrice(waybillDetailDTO.getPickupPrice()); + warehouseWayBillDetail.setFreightPrice(waybillDetailDTO.getFreightPrice()); + warehouseWayBillDetail.setSystemChargeType(waybillDetailDTO.getSystemChargeType()); + warehouseWayBillDetail.setSystemDeliveryChargeType(waybillDetailDTO.getSystemDeliveryChargeType()); + warehouseWayBillDetail.setSystemPickupChargeType(waybillDetailDTO.getSystemPickupChargeType()); + warehouseWayBillDetail.setSystemWarehouseChargeType(waybillDetailDTO.getSystemWarehouseChargeType()); + details.add(warehouseWayBillDetail); } - - warehouseWayBillDetail.setPrice(price); - warehouseWayBillDetail.setSubtotalFreight(subtotalFreight); - warehouseWayBillDetail.setChargeType(chargeType); - warehouseWayBillDetail.setDeliveryPrice(waybillDetailDTO.getDeliveryPrice()); - warehouseWayBillDetail.setSubtotalDeliveryFee(waybillDetailDTO.getSubtotalDeliveryFee()); - warehouseWayBillDetail.setPickupPrice(waybillDetailDTO.getPickupPrice()); - warehouseWayBillDetail.setFreightPrice(waybillDetailDTO.getFreightPrice()); - warehouseWayBillDetail.setSystemChargeType(waybillDetailDTO.getSystemChargeType()); - warehouseWayBillDetail.setSystemDeliveryChargeType(waybillDetailDTO.getSystemDeliveryChargeType()); - warehouseWayBillDetail.setSystemPickupChargeType(waybillDetailDTO.getSystemPickupChargeType()); - warehouseWayBillDetail.setSystemWarehouseChargeType(waybillDetailDTO.getSystemWarehouseChargeType()); - details.add(warehouseWayBillDetail); + warehouseWaybillDetailClient.addList(details); + } else { + log.info("#################openWaybill: 运单保存失败"); + throw new CustomerException(405, "运单保存失败"); } - warehouseWaybillDetailClient.addList(details); - } else { - log.info("#################openWaybill: 运单保存失败"); - throw new CustomerException(405, "运单保存失败"); - } - //绑定订单和运单的关系 - List advanceEntityList = advanceService.findListByIds(advanceIds); - List waybillOrderEntities = new ArrayList<>(); - List updateAdvanceEntityList = new ArrayList<>(); - Set orderCodeSet = new HashSet<>(); - for (TrunklineAdvanceEntity advanceEntity : advanceEntityList) { - orderCodeSet.add(advanceEntity.getOrderCode()); - Long advanceId = advanceEntity.getId(); - String waybillStatus = advanceEntity.getWaybillStatus(); - if ("1".equals(waybillStatus)) { - log.error("###############openWaybill: 已存在已开单的暂存单"); - throw new CustomerException(405, "已存在已开单的暂存单"); + //绑定订单和运单的关系 + List advanceEntityList = advanceService.findListByIds(advanceIds); + List waybillOrderEntities = new ArrayList<>(); + List updateAdvanceEntityList = new ArrayList<>(); + Set orderCodeSet = new HashSet<>(); + for (TrunklineAdvanceEntity advanceEntity : advanceEntityList) { + orderCodeSet.add(advanceEntity.getOrderCode()); + Long advanceId = advanceEntity.getId(); + String waybillStatus = advanceEntity.getWaybillStatus(); + if ("1".equals(waybillStatus)) { + log.error("###############openWaybill: 已存在已开单的暂存单"); + throw new CustomerException(405, "已存在已开单的暂存单"); + } + TrunklineWaybillOrderEntity waybillOrderEntity = new TrunklineWaybillOrderEntity(); + waybillOrderEntity.setWarehouseId(warehouseId); + waybillOrderEntity.setWarehouseName(basicdataWarehouseEntity.getName()); + waybillOrderEntity.setWaybillId(waybillId); + waybillOrderEntity.setWaybillNo(waybillNo); + waybillOrderEntity.setAdvanceId(advanceId); + waybillOrderEntity.setOrderCode(advanceEntity.getOrderCode()); + waybillOrderEntity.setTotalNumber(advanceEntity.getTotalNum()); + Integer incomingNum = advanceDetailService.getIncomingNum(advanceId); + waybillOrderEntity.setHandleNumber(incomingNum); + waybillOrderEntities.add(waybillOrderEntity); + +// orderCodes.add(advanceEntity.getOrderCode()); + + TrunklineAdvanceEntity updateAdvanceEntity = new TrunklineAdvanceEntity(); + updateAdvanceEntity.setId(advanceId); + updateAdvanceEntity.setWaybillStatus("1"); + updateAdvanceEntity.setWaybillNo(waybillNo); + updateAdvanceEntityList.add(updateAdvanceEntity); } - TrunklineWaybillOrderEntity waybillOrderEntity = new TrunklineWaybillOrderEntity(); - waybillOrderEntity.setWarehouseId(warehouseId); - waybillOrderEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - waybillOrderEntity.setWaybillId(waybillId); - waybillOrderEntity.setWaybillNo(waybillNo); - waybillOrderEntity.setAdvanceId(advanceId); - waybillOrderEntity.setOrderCode(advanceEntity.getOrderCode()); - waybillOrderEntity.setTotalNumber(advanceEntity.getTotalNum()); - Integer incomingNum = advanceDetailService.getIncomingNum(advanceId); - waybillOrderEntity.setHandleNumber(incomingNum); - waybillOrderEntities.add(waybillOrderEntity); + trunklineWaybillOrderService.saveBatch(waybillOrderEntities); + //修改暂存单的状态为已开单 + advanceService.updateBatchById(updateAdvanceEntityList); -// orderCodes.add(advanceEntity.getOrderCode()); + //更新暂存单包件的运单信息 - TrunklineAdvanceEntity updateAdvanceEntity = new TrunklineAdvanceEntity(); - updateAdvanceEntity.setId(advanceId); - updateAdvanceEntity.setWaybillStatus("1"); - updateAdvanceEntity.setWaybillNo(waybillNo); - updateAdvanceEntityList.add(updateAdvanceEntity); - } - trunklineWaybillOrderService.saveBatch(waybillOrderEntities); - //修改暂存单的状态为已开单 - advanceService.updateBatchById(updateAdvanceEntityList); - - //更新暂存单包件的运单信息 + List list = advanceDetailService.findListByAdvanceIds(advanceIds); + trunklineWaybillPackageService.saveList(list, waybillEntity); - List list = advanceDetailService.findListByAdvanceIds(advanceIds); - trunklineWaybillPackageService.saveList(list, waybillEntity); - - List updateAdvanceDetailList = openOrderDTO.getUpdateAdvanceDetailList(); + List updateAdvanceDetailList = openOrderDTO.getUpdateAdvanceDetailList(); - //把updateAdvanceDetailList转化成以orderPackageCode为key的Map - Map advanceDetailEntityMap = updateAdvanceDetailList.stream().collect(Collectors.toMap(TrunklineAdvanceDetailEntity::getOrderPackageCode, Function.identity())); + //把updateAdvanceDetailList转化成以orderPackageCode为key的Map + Map advanceDetailEntityMap = updateAdvanceDetailList.stream().collect(Collectors.toMap(TrunklineAdvanceDetailEntity::getOrderPackageCode, Function.identity())); - List orderPackageCodes = new ArrayList<>(); - String finalWaybillNo = waybillNo; + List orderPackageCodes = new ArrayList<>(); + String finalWaybillNo = waybillNo; - updateAdvanceDetailList.forEach(detail -> { - Long id = detail.getId(); - detail.setWaybillId(waybillId); - detail.setWaybillNo(finalWaybillNo); - orderPackageCodes.add(detail.getOrderPackageCode()); - }); + updateAdvanceDetailList.forEach(detail -> { + Long id = detail.getId(); + detail.setWaybillId(waybillId); + detail.setWaybillNo(finalWaybillNo); + orderPackageCodes.add(detail.getOrderPackageCode()); + }); - if (CollUtil.isNotEmpty(orderPackageCodes)) { + if (CollUtil.isNotEmpty(orderPackageCodes)) { - //把orderPackageCodes每500条分为一组 - List> orderPackageCodeList = CollUtil.split(orderPackageCodes, 500); - List parcelListEntities = new ArrayList<>(); - orderPackageCodeList.forEach(orderPackageCodeList1 -> { - log.info("###############openWaybill: 分组查询订单包裹信息, {}", orderPackageCodeList1); - parcelListEntities.addAll(distributionParcelListClient.findListByOrderPackageCodes(orderPackageCodeList1)); - }); + //把orderPackageCodes每500条分为一组 + List> orderPackageCodeList = CollUtil.split(orderPackageCodes, 500); + List parcelListEntities = new ArrayList<>(); + orderPackageCodeList.forEach(orderPackageCodeList1 -> { + log.info("###############openWaybill: 分组查询订单包裹信息, {}", orderPackageCodeList1); + parcelListEntities.addAll(distributionParcelListClient.findListByOrderPackageCodes(orderPackageCodeList1)); + }); - String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); - String destinationWarehouseName = waybillEntity.getDestinationWarehouseName(); - Long consigneeId1 = waybillEntity.getConsigneeId(); - BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(consigneeId1); - - Set stockArticleIds = new TreeSet<>(); - parcelListEntities.forEach(parcelListEntity -> { - TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity = advanceDetailEntityMap.get(parcelListEntity.getOrderPackageCode()); - if(!Objects.isNull(trunklineAdvanceDetailEntity)){ - parcelListEntity.setWeight(trunklineAdvanceDetailEntity.getWeight()); - parcelListEntity.setVolume(trunklineAdvanceDetailEntity.getVolume()); - } - Long packageWarehouseId = parcelListEntity.getWarehouseId(); - parcelListEntity.setWaybillId(waybillId); - parcelListEntity.setWaybillNumber(finalWaybillNo); - parcelListEntity.setSendWarehouseId(departureWarehouseId); - parcelListEntity.setSendWarehouseName(departureWarehouseName); - parcelListEntity.setAcceptWarehouseId(destinationWarehouseId); - parcelListEntity.setAcceptWarehouseName(destinationWarehouseName); - if (departureWarehouseId.equals(destinationWarehouseId)) { - parcelListEntity.setIsTransfer(0); - } else { - if (destinationWarehouseId.equals(packageWarehouseId)) { + String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); + String destinationWarehouseName = waybillEntity.getDestinationWarehouseName(); + Long consigneeId1 = waybillEntity.getConsigneeId(); + BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(consigneeId1); + + Set stockArticleIds = new TreeSet<>(); + parcelListEntities.forEach(parcelListEntity -> { + TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity = advanceDetailEntityMap.get(parcelListEntity.getOrderPackageCode()); + if(!Objects.isNull(trunklineAdvanceDetailEntity)){ + parcelListEntity.setWeight(trunklineAdvanceDetailEntity.getWeight()); + parcelListEntity.setVolume(trunklineAdvanceDetailEntity.getVolume()); + } + Long packageWarehouseId = parcelListEntity.getWarehouseId(); + parcelListEntity.setWaybillId(waybillId); + parcelListEntity.setWaybillNumber(finalWaybillNo); + parcelListEntity.setSendWarehouseId(departureWarehouseId); + parcelListEntity.setSendWarehouseName(departureWarehouseName); + parcelListEntity.setAcceptWarehouseId(destinationWarehouseId); + parcelListEntity.setAcceptWarehouseName(destinationWarehouseName); + if (departureWarehouseId.equals(destinationWarehouseId)) { parcelListEntity.setIsTransfer(0); } else { - parcelListEntity.setIsTransfer(1); - } - } - stockArticleIds.add(parcelListEntity.getStockArticleId()); - }); - - distributionParcelListClient.updateList(parcelListEntities); - - //根据订单id获取每个订单的运单拼接数据 - if (!stockArticleIds.isEmpty()) { - List newList = new ArrayList<>(stockArticleIds); - List stockArticleEntities = distributionStockArticleClient.findStockListByIds(newList); - -// List stockArticleEntities = distributionStockArticleClient.findWaybillNoByOrderIds(stockArticleIds); - - List updateStockArticleList = new ArrayList<>(); - stockArticleEntities.forEach(stockArticleEntity -> { - String waybillNumber = stockArticleEntity.getWaybillNumber(); - DistributionStockArticleEntity updateEntity = new DistributionStockArticleEntity(); - updateEntity.setId(stockArticleEntity.getId()); - if(StringUtil.isBlank(waybillNumber)){ - updateEntity.setWaybillNumber(finalWaybillNo); - }else{ - if(!waybillNumber.contains(finalWaybillNo)){ - waybillNumber = waybillNumber + "," + finalWaybillNo; - updateEntity.setWaybillNumber(waybillNumber); + if (destinationWarehouseId.equals(packageWarehouseId)) { + parcelListEntity.setIsTransfer(0); + } else { + parcelListEntity.setIsTransfer(1); } } + stockArticleIds.add(parcelListEntity.getStockArticleId()); + }); - updateEntity.setMallId(consigneeId1); - updateEntity.setMallCode(basicdataClientEntity.getClientCode()); - updateEntity.setMallName(basicdataClientEntity.getClientName()); - updateEntity.setTypeService(basicdataClientEntity.getTypeService() + ""); - updateEntity.setConsigneePerson(waybillEntity.getConsigneeName()); - updateEntity.setConsigneeMobile(waybillEntity.getConsigneeMobile()); - updateEntity.setConsigneeAddress(waybillEntity.getConsigneeAddress()); - updateEntity.setConsigneeUnit(basicdataClientEntity.getClientName()); - updateStockArticleList.add(updateEntity); + distributionParcelListClient.updateList(parcelListEntities); + + //根据订单id获取每个订单的运单拼接数据 + if (!stockArticleIds.isEmpty()) { + List newList = new ArrayList<>(stockArticleIds); + List stockArticleEntities = distributionStockArticleClient.findStockListByIds(newList); + +// List stockArticleEntities = distributionStockArticleClient.findWaybillNoByOrderIds(stockArticleIds); + + List updateStockArticleList = new ArrayList<>(); + stockArticleEntities.forEach(stockArticleEntity -> { + String waybillNumber = stockArticleEntity.getWaybillNumber(); + DistributionStockArticleEntity updateEntity = new DistributionStockArticleEntity(); + updateEntity.setId(stockArticleEntity.getId()); + if(StringUtil.isBlank(waybillNumber)){ + updateEntity.setWaybillNumber(finalWaybillNo); + }else{ + if(!waybillNumber.contains(finalWaybillNo)){ + waybillNumber = waybillNumber + "," + finalWaybillNo; + updateEntity.setWaybillNumber(waybillNumber); + } + } - }); - if (CollUtil.isNotEmpty(updateStockArticleList)) { - distributionStockArticleClient.updateByBatchId(updateStockArticleList); + updateEntity.setMallId(consigneeId1); + updateEntity.setMallCode(basicdataClientEntity.getClientCode()); + updateEntity.setMallName(basicdataClientEntity.getClientName()); + updateEntity.setTypeService(basicdataClientEntity.getTypeService() + ""); + updateEntity.setConsigneePerson(waybillEntity.getConsigneeName()); + updateEntity.setConsigneeMobile(waybillEntity.getConsigneeMobile()); + updateEntity.setConsigneeAddress(waybillEntity.getConsigneeAddress()); + updateEntity.setConsigneeUnit(basicdataClientEntity.getClientName()); + updateStockArticleList.add(updateEntity); + + }); + if (CollUtil.isNotEmpty(updateStockArticleList)) { + distributionStockArticleClient.updateByBatchId(updateStockArticleList); + } } - } - } - //修改暂存单明细的结算品类 - //把updateAdvanceDetailList分成每300条一组 - List> updateAdvanceDetailListList = CollUtil.split(updateAdvanceDetailList, 300); - updateAdvanceDetailListList.forEach(updateAdvanceDetailList1 -> { - advanceDetailService.updateBatchById(updateAdvanceDetailList1); - }); + } + //修改暂存单明细的结算品类 + //把updateAdvanceDetailList分成每300条一组 + List> updateAdvanceDetailListList = CollUtil.split(updateAdvanceDetailList, 300); + updateAdvanceDetailListList.forEach(updateAdvanceDetailList1 -> { + advanceDetailService.updateBatchById(updateAdvanceDetailList1); + }); - trunklineWaybillPackageService.updateWaybillStatus(waybillEntity); + trunklineWaybillPackageService.updateWaybillStatus(waybillEntity); - //计算扫码入库的包件是否需要把运单和提货单挂上 - openOrderAsyncService.dealwithBillladingInfo(advanceIds, warehouseId, warehouseName, waybillId, waybillNo); + //计算扫码入库的包件是否需要把运单和提货单挂上 + openOrderAsyncService.dealwithBillladingInfo(advanceIds, warehouseId, warehouseName, waybillId, waybillNo); - //异步存入日志 - String nickName = AuthUtil.getNickName(); - Long userId = AuthUtil.getUserId(); + //异步存入日志 + String nickName = AuthUtil.getNickName(); + Long userId = AuthUtil.getUserId(); - String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToStringGeneral(new Date()); - openOrderAsyncService.saveLog(waybillId, waybillNo, "10", "创建运单", createOperationRemark, nickName, userId, warehouseId, warehouseName); + String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToStringGeneral(new Date()); + openOrderAsyncService.saveLog(waybillId, waybillNo, "10", "创建运单", createOperationRemark, nickName, userId, warehouseId, warehouseName); - openOrderAsyncService.syncUnloadScanWaybillInfo(advanceIds,waybillEntity); + openOrderAsyncService.syncUnloadScanWaybillInfo(advanceIds,waybillEntity); - //队列处理包件补数据 - carsLoadService.sendRabbitMessageOpenOrder(advanceIds, waybillId); + //队列处理包件补数据 + carsLoadService.sendRabbitMessageOpenOrder(advanceIds, waybillId); - //发布开单广播 -// openOrderAsyncService.sendOpenWaybillFanout(waybillEntity, details, advanceIds); + //发布开单广播 +// openOrderAsyncService.sendOpenWaybillFanout(waybillEntity, details, advanceIds); - advanceDetailService.sendReportAdvanceOpenData(AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName, updateAdvanceDetailList, waybillEntity); + advanceDetailService.sendReportAdvanceOpenData(AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName, updateAdvanceDetailList, waybillEntity); - advanceIds.forEach(advanceId ->{ - bladeRedis.del(openAdvanceIds+advanceId); - }); + advanceIds.forEach(advanceId ->{ + bladeRedis.del(openAdvanceIds+advanceId); + }); + }catch (Exception e){ + log.error("#####openWaybill:开单失败",e); + warehouseWaybillClient.deleteAllByWaybillId(waybillId); + throw new CustomerException(405,"开单失败"); + } return R.data(waybillId); } @@ -1221,125 +1227,132 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity); waybillEntity.setId(waybillId); - List details = new ArrayList<>(); - if (!Objects.isNull(waybillId)) { - log.info("#################openZeroWaybill: 运单保存成功"); - //保存运单货物明细 - List waybillDetailList = openOrderDTO.getAddList(); - for (WaybillDetailDTO waybillDetailDTO : waybillDetailList) { - WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); - warehouseWayBillDetail.setCreateUser(AuthUtil.getUserId()); - warehouseWayBillDetail.setUpdateUser(AuthUtil.getUserId()); - Date date = new Date(); - warehouseWayBillDetail.setCreateTime(date); - warehouseWayBillDetail.setUpdateTime(date); - warehouseWayBillDetail.setStatus(1); - warehouseWayBillDetail.setIsDeleted(0); - warehouseWayBillDetail.setWaybillId(waybillId); - warehouseWayBillDetail.setWaybillNo(waybillEntity.getWaybillNo()); - Long goodsId = waybillDetailDTO.getGoodsId(); - String goodsName = waybillDetailDTO.getGoodsName(); - if (Objects.isNull(goodsId)) { - //如果品名id没有就先通过goodsName查寻,没有就新增 - if(StringUtil.isNotBlank(goodsName)){ - BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName.trim()); - if (Objects.isNull(basicdataCategoryEntity)) { - basicdataCategoryEntity = new BasicdataCategoryEntity(); - basicdataCategoryEntity.setName(goodsName); - basicdataCategoryEntity.setType("1"); - goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity); - } else { - goodsId = basicdataCategoryEntity.getId(); + + try{ + List details = new ArrayList<>(); + if (!Objects.isNull(waybillId)) { + log.info("#################openZeroWaybill: 运单保存成功"); + //保存运单货物明细 + List waybillDetailList = openOrderDTO.getAddList(); + + for (WaybillDetailDTO waybillDetailDTO : waybillDetailList) { + WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); + warehouseWayBillDetail.setCreateUser(AuthUtil.getUserId()); + warehouseWayBillDetail.setUpdateUser(AuthUtil.getUserId()); + Date date = new Date(); + warehouseWayBillDetail.setCreateTime(date); + warehouseWayBillDetail.setUpdateTime(date); + warehouseWayBillDetail.setStatus(1); + warehouseWayBillDetail.setIsDeleted(0); + warehouseWayBillDetail.setWaybillId(waybillId); + warehouseWayBillDetail.setWaybillNo(waybillEntity.getWaybillNo()); + Long goodsId = waybillDetailDTO.getGoodsId(); + String goodsName = waybillDetailDTO.getGoodsName(); + if (Objects.isNull(goodsId)) { + //如果品名id没有就先通过goodsName查寻,没有就新增 + if(StringUtil.isNotBlank(goodsName)){ + BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName.trim()); + if (Objects.isNull(basicdataCategoryEntity)) { + basicdataCategoryEntity = new BasicdataCategoryEntity(); + basicdataCategoryEntity.setName(goodsName); + basicdataCategoryEntity.setType("1"); + goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity); + } else { + goodsId = basicdataCategoryEntity.getId(); + } } } - } - warehouseWayBillDetail.setProductId(goodsId); - warehouseWayBillDetail.setProductName(goodsName); - Integer num = waybillDetailDTO.getNum(); - BigDecimal volume = waybillDetailDTO.getVolume(); - BigDecimal weight = waybillDetailDTO.getWeight(); - warehouseWayBillDetail.setNum(num); - warehouseWayBillDetail.setVolume(volume); - warehouseWayBillDetail.setWeight(weight); - BigDecimal price = waybillDetailDTO.getPrice(); - Integer chargeType = waybillDetailDTO.getChargeType(); - BigDecimal subtotalFreight = waybillDetailDTO.getSubtotalFreight(); - if(price.compareTo(BigDecimal.ZERO) == 0){ + warehouseWayBillDetail.setProductId(goodsId); + warehouseWayBillDetail.setProductName(goodsName); + Integer num = waybillDetailDTO.getNum(); + BigDecimal volume = waybillDetailDTO.getVolume(); + BigDecimal weight = waybillDetailDTO.getWeight(); + warehouseWayBillDetail.setNum(num); + warehouseWayBillDetail.setVolume(volume); + warehouseWayBillDetail.setWeight(weight); + BigDecimal price = waybillDetailDTO.getPrice(); + Integer chargeType = waybillDetailDTO.getChargeType(); + BigDecimal subtotalFreight = waybillDetailDTO.getSubtotalFreight(); + if(price.compareTo(BigDecimal.ZERO) == 0){ + + if(chargeType.equals(1)){ + price = subtotalFreight.divide(new BigDecimal(num),6, RoundingMode.HALF_UP); + }else if(chargeType.equals(2)){ + price = subtotalFreight.divide(volume,6, RoundingMode.HALF_UP); + }else if(chargeType.equals(3)){ + price = subtotalFreight.divide(weight,6, RoundingMode.HALF_UP); + } - if(chargeType.equals(1)){ - price = subtotalFreight.divide(new BigDecimal(num),6, RoundingMode.HALF_UP); - }else if(chargeType.equals(2)){ - price = subtotalFreight.divide(volume,6, RoundingMode.HALF_UP); - }else if(chargeType.equals(3)){ - price = subtotalFreight.divide(weight,6, RoundingMode.HALF_UP); } + warehouseWayBillDetail.setPrice(price); + warehouseWayBillDetail.setSubtotalFreight(subtotalFreight); + warehouseWayBillDetail.setChargeType(chargeType); + warehouseWayBillDetail.setDeliveryPrice(waybillDetailDTO.getDeliveryPrice()); + warehouseWayBillDetail.setSubtotalDeliveryFee(waybillDetailDTO.getSubtotalDeliveryFee()); + warehouseWayBillDetail.setPickupPrice(waybillDetailDTO.getPickupPrice()); + warehouseWayBillDetail.setFreightPrice(waybillDetailDTO.getFreightPrice()); + warehouseWayBillDetail.setSystemChargeType(waybillDetailDTO.getChargeType()); + warehouseWayBillDetail.setSystemDeliveryChargeType(waybillDetailDTO.getSystemDeliveryChargeType()); + warehouseWayBillDetail.setSystemPickupChargeType(waybillDetailDTO.getSystemPickupChargeType()); + warehouseWayBillDetail.setSystemWarehouseChargeType(waybillDetailDTO.getSystemWarehouseChargeType()); + details.add(warehouseWayBillDetail); + } + warehouseWaybillDetailClient.addList(details); + } else { + log.info("#################openZeroWaybill: 运单保存失败"); + return R.fail(405, "运单保存失败"); + } + + if (advanceIds != null && advanceIds.size() > 0) { + List advanceEntityList = advanceService.findListByIds(advanceIds); + for (TrunklineAdvanceEntity advanceEntity : advanceEntityList) { + advanceEntity.setWaybillNo(waybillNo); + advanceEntity.setWaybillStatus("1"); } - warehouseWayBillDetail.setPrice(price); - warehouseWayBillDetail.setSubtotalFreight(subtotalFreight); - warehouseWayBillDetail.setChargeType(chargeType); - warehouseWayBillDetail.setDeliveryPrice(waybillDetailDTO.getDeliveryPrice()); - warehouseWayBillDetail.setSubtotalDeliveryFee(waybillDetailDTO.getSubtotalDeliveryFee()); - warehouseWayBillDetail.setPickupPrice(waybillDetailDTO.getPickupPrice()); - warehouseWayBillDetail.setFreightPrice(waybillDetailDTO.getFreightPrice()); - warehouseWayBillDetail.setSystemChargeType(waybillDetailDTO.getChargeType()); - warehouseWayBillDetail.setSystemDeliveryChargeType(waybillDetailDTO.getSystemDeliveryChargeType()); - warehouseWayBillDetail.setSystemPickupChargeType(waybillDetailDTO.getSystemPickupChargeType()); - warehouseWayBillDetail.setSystemWarehouseChargeType(waybillDetailDTO.getSystemWarehouseChargeType()); - details.add(warehouseWayBillDetail); + advanceService.updateBatchById(advanceEntityList); } - warehouseWaybillDetailClient.addList(details); - } else { - log.info("#################openZeroWaybill: 运单保存失败"); - return R.fail(405, "运单保存失败"); - } + //异步存入日志 + Date date = new Date(); + String nickName = AuthUtil.getNickName(); + Long userId = AuthUtil.getUserId(); + String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToStringGeneral(date); + openOrderAsyncService.saveLog(waybillId, waybillNo, "10", "创建运单", createOperationRemark, nickName, userId, warehouseId, warehouseName); - if (advanceIds != null && advanceIds.size() > 0) { - List advanceEntityList = advanceService.findListByIds(advanceIds); - for (TrunklineAdvanceEntity advanceEntity : advanceEntityList) { - advanceEntity.setWaybillNo(waybillNo); - advanceEntity.setWaybillStatus("1"); + Integer totalCount = waybillEntity.getTotalCount(); + Integer stockCount = waybillEntity.getStockCount(); + if (totalCount.equals(stockCount)) { + createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【零担开单及入库】,入库时间:" + CommonUtil.dateToStringGeneral(date); + openOrderAsyncService.saveLog(waybillId, waybillNo, "20", "已入库", createOperationRemark, nickName, userId, warehouseId, warehouseName); } - advanceService.updateBatchById(advanceEntityList); - } - - //异步存入日志 - Date date = new Date(); - String nickName = AuthUtil.getNickName(); - Long userId = AuthUtil.getUserId(); - String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToStringGeneral(date); - openOrderAsyncService.saveLog(waybillId, waybillNo, "10", "创建运单", createOperationRemark, nickName, userId, warehouseId, warehouseName); - Integer totalCount = waybillEntity.getTotalCount(); - Integer stockCount = waybillEntity.getStockCount(); - if (totalCount.equals(stockCount)) { - createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【零担开单及入库】,入库时间:" + CommonUtil.dateToStringGeneral(date); - openOrderAsyncService.saveLog(waybillId, waybillNo, "20", "已入库", createOperationRemark, nickName, userId, warehouseId, warehouseName); + //创建零担订单 + createStockArticle(waybillEntity); + + //存入运单与订单关联信息 + TrunklineWaybillOrderEntity trunklineWaybillOrderEntity = new TrunklineWaybillOrderEntity(); + trunklineWaybillOrderEntity.setWarehouseId(warehouseId); + trunklineWaybillOrderEntity.setWarehouseName(basicdataWarehouseEntity.getName()); + trunklineWaybillOrderEntity.setWaybillId(waybillId); + trunklineWaybillOrderEntity.setWaybillNo(waybillNo); + trunklineWaybillOrderEntity.setOrderCode(waybillNo); + trunklineWaybillOrderEntity.setTotalNumber(waybillEntity.getTotalCount()); + trunklineWaybillOrderEntity.setHandleNumber(waybillEntity.getTotalCount()); + trunklineWaybillOrderService.save(trunklineWaybillOrderEntity); + + //发布开单广播 + openOrderAsyncService.sendOpenWaybillFanout(waybillEntity, details, null); + + //发送零担开单广播 + sendOpenZeroWaybillFanout(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, waybillEntity, details); + }catch (Exception e){ + log.error("#####openWaybill:开单失败",e); + warehouseWaybillClient.deleteAllByWaybillId(waybillId); + throw new CustomerException(405,"开单失败"); } - //创建零担订单 - createStockArticle(waybillEntity); - - //存入运单与订单关联信息 - TrunklineWaybillOrderEntity trunklineWaybillOrderEntity = new TrunklineWaybillOrderEntity(); - trunklineWaybillOrderEntity.setWarehouseId(warehouseId); - trunklineWaybillOrderEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - trunklineWaybillOrderEntity.setWaybillId(waybillId); - trunklineWaybillOrderEntity.setWaybillNo(waybillNo); - trunklineWaybillOrderEntity.setOrderCode(waybillNo); - trunklineWaybillOrderEntity.setTotalNumber(waybillEntity.getTotalCount()); - trunklineWaybillOrderEntity.setHandleNumber(waybillEntity.getTotalCount()); - trunklineWaybillOrderService.save(trunklineWaybillOrderEntity); - - //发布开单广播 - openOrderAsyncService.sendOpenWaybillFanout(waybillEntity, details, null); - - //发送零担开单广播 - sendOpenZeroWaybillFanout(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, waybillEntity, details); - - Map map = new HashMap<>(); map.put("waybillId", waybillId); map.put("waybillNo", waybillNo); @@ -4632,7 +4645,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { } - //TODO 还需要加上生成了预存单的无法进行作废 + //生成了预存单的无法进行作废 Integer status = orderInfoClient.findCreateRencilitionOrderStatus(waybillId); if (status == 1) { log.warn("##########abolishWaybill: 运单已有预存单确认 waybillId={}", waybillId); @@ -4802,6 +4815,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { public R findAdvanceDetailListByAdvanceIds(AdvanceDTO advanceDTO) { List advanceIds = advanceDTO.getAdvanceIds(); + Long clientId = advanceDTO.getClientId(); + if(!Objects.isNull(clientId)){ + BasicdataClientEntity clientEntity = basicdataClientClient.findEntityById(clientId); + if(!Objects.isNull(clientEntity)){ + advanceDTO.setMainId(clientEntity.getMainId()); + } + } + List advanceDetailVOList = advanceDetailService.findAdvanceDetailListByAdvanceIds(advanceDTO); return R.data(advanceDetailVOList); @@ -5596,9 +5617,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Long newDestinationWarehouseId = openOrderDTO.getDestinationWarehouseId(); String newDestinationWarehouseName = openOrderDTO.getDestinationWarehouseName(); Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); - String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); + String destinationWarehouseName = waybillEntity.getDestinationWarehouseName(); if (!ObjectUtil.equals(destinationWarehouseId, newDestinationWarehouseId)) { - stringBuilder.append("目的仓:").append(departureWarehouseName).append("-->").append(newDestinationWarehouseName).append(";"); + stringBuilder.append("目的仓:").append(destinationWarehouseName).append("-->").append(newDestinationWarehouseName).append(";"); waybillEntity.setDestinationWarehouseId(newDestinationWarehouseId); waybillEntity.setDestinationWarehouseName(newDestinationWarehouseName); //查询所有该运单的包件 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 2b05582ed..c75d3794e 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 @@ -139,4 +139,9 @@ public class WarehouseWaybillClient implements IWarehouseWaybillClient { public List findWaybillVOByOrderCode(String orderCode) { return warehouseWaybillService.findWaybillVOByOrderCode(orderCode); } + + @Override + public void deleteAllByWaybillId(Long waybillId) { + warehouseWaybillService.deleteAllByWaybillId(waybillId); + } } 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 4423e9ce0..88eba6e57 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 @@ -98,4 +98,5 @@ public interface IWarehouseWaybillService extends BaseService waybillIds = Arrays.asList(waybillId); + + baseMapper.deleteByWaybillIds(waybillIds); + + warehouseWayBillDetailService.deleteByWaybillIds(waybillIds); + + } + }