Browse Source

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

dev-warehouse
0.0 2 years ago
parent
commit
299d6a9966
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 5
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStoreBrandEntity.java
  3. 11
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBrandClient.java
  4. 22
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java
  5. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionServiceLogEntity.java
  6. 12
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java
  7. 25
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java
  8. 26
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java
  9. 6
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java
  10. 9
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java
  11. 30
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/feign/IMtOrderMainClinet.java
  12. 31
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/vo/MTOrderPackageRelationVO.java
  13. 2
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java
  14. 10
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataStoreBrandClient.java
  15. 33
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java
  16. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java
  17. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java
  18. 76
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  19. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java
  20. 28
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml
  21. 20
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java
  22. 245
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  23. 59
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  24. 42
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java
  25. 20
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/UnloadCarDTO.java
  26. 22
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java
  27. 20
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java
  28. 27
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtOrderMainClinet.java
  29. 5
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java
  30. 14
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml
  31. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java
  32. 9
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryOrderMainService.java
  33. 59
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java
  34. 12
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java
  35. 1
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java
  36. 139
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java
  37. 138
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java
  38. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml
  39. 24
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/WarehousingEntryDetailExcel.java
  40. 22
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -8,7 +8,7 @@ public interface ModuleNameConstant {
/** /**
* 如果不需要 "" * 如果不需要 ""
*/ */
public static final String DEVAUTH ="-tjj"; public static final String DEVAUTH ="";
/** /**

5
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStoreBrandEntity.java

@ -72,6 +72,11 @@ public class BasicdataStoreBrandEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "品牌ID") @ApiModelProperty(value = "品牌ID")
private String brandId; private String brandId;
/**
* 品牌名称
*/
@ApiModelProperty(value = "品牌名称")
private String brandName;
/** /**
* 客户名称 * 客户名称
*/ */

11
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBrandClient.java

@ -36,6 +36,7 @@ public interface IBasicdataStoreBrandClient {
String API_PREFIX = "/client"; String API_PREFIX = "/client";
String TOP = API_PREFIX + "/top7"; String TOP = API_PREFIX + "/top7";
String BRANDLIST = API_PREFIX + "/brandList";
/** /**
* 获取门店品牌中间表列表 * 获取门店品牌中间表列表
@ -47,4 +48,14 @@ public interface IBasicdataStoreBrandClient {
@GetMapping(TOP) @GetMapping(TOP)
BladePage<BasicdataStoreBrandEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); BladePage<BasicdataStoreBrandEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
/**
* 根据客户查询对应的品牌
*
* @param clientId 客户
* @param brandName 品牌
* @return BladePage
*/
@GetMapping(BRANDLIST)
BasicdataStoreBrandEntity getBrandList(@RequestParam("clientId") Long clientId, @RequestParam("brandName") String brandName);
} }

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

@ -118,12 +118,22 @@ public class DistributionParcelListEntity extends TenantEntity {
* 物料Id * 物料Id
*/ */
@ApiModelProperty(value = "物料ID") @ApiModelProperty(value = "物料ID")
private String material; private Long material;
/** /**
* 物料名称 * 物料名称
*/ */
@ApiModelProperty(value = "物料名称") @ApiModelProperty(value = "物料名称")
private String materialName; private String materialName;
/**
* 物料编号
*/
@ApiModelProperty(value = "物料编号")
private String materialCode;
/**
* 物料单位
*/
@ApiModelProperty(value = "物料单位")
private String materialUnit;
/** /**
* 数量 * 数量
*/ */
@ -145,5 +155,15 @@ public class DistributionParcelListEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "服务号") @ApiModelProperty(value = "服务号")
private String serviceNumber; private String serviceNumber;
/**
* 品牌ID
*/
@ApiModelProperty(value = "品牌ID")
private String brandId;
/**
* 品牌名称
*/
@ApiModelProperty(value = "品牌名称")
private String brandName;
} }

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionServiceLogEntity.java

@ -66,7 +66,7 @@ public class DistributionServiceLogEntity extends TenantEntity {
* 服务类型 * 服务类型
*/ */
@ApiModelProperty(value = "服务类型") @ApiModelProperty(value = "服务类型")
private Integer typeService; private String typeService;
/** /**
* 费用 * 费用
*/ */

12
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java

@ -124,6 +124,11 @@ public class DistributionStockArticleEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "仓库") @ApiModelProperty(value = "仓库")
private String warehouse; private String warehouse;
/**
* 车次号
*/
@ApiModelProperty(value = "车次号")
private String trainNumber;
/** /**
* 仓库ID * 仓库ID
@ -176,7 +181,7 @@ public class DistributionStockArticleEntity extends TenantEntity {
* 服务类型 * 服务类型
*/ */
@ApiModelProperty(value = "服务类型") @ApiModelProperty(value = "服务类型")
private Integer typeService; private String typeService;
/** /**
* 顾客名字 * 顾客名字
*/ */
@ -399,6 +404,11 @@ public class DistributionStockArticleEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "订单码") @ApiModelProperty(value = "订单码")
private String stockArticleCode; private String stockArticleCode;
/**
* 工厂车次
*/
@ApiModelProperty(value = "工厂车次")
private String factoryTrain;
} }

25
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java

@ -113,6 +113,31 @@ public class DistributionStockEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "在库包件ID") @ApiModelProperty(value = "在库包件ID")
private Long parcelListId; private Long parcelListId;
/**
* 预约ID
*/
@ApiModelProperty(value = "预约ID")
private Long reservationId;
/**
* 预约编号
*/
@ApiModelProperty(value = "预约编号")
private String reservationCode;
/**
* 出库类型
*/
@ApiModelProperty(value = "出库类型")
private Long outboundType;
/**
* 配送Id
*/
@ApiModelProperty(value = "配送Id")
private Long deliveryListId;
/**
* 配送编号
*/
@ApiModelProperty(value = "配送编号")
private Long deliveryListCode;

26
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java

@ -98,6 +98,32 @@ public class DistributionStockListEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "货物名称") @ApiModelProperty(value = "货物名称")
private String descriptionGoods; private String descriptionGoods;
/**
* 车牌
*/
@ApiModelProperty(value = "车牌")
private String licensePlate;
/**
* 品牌名称
*/
@ApiModelProperty(value = "品牌名称")
private String brandName;
/**
* 品牌Id
*/
@ApiModelProperty(value = "品牌ID")
private Long brandId;
/**
* 入库时间
*/
@ApiModelProperty(value = "入库时间")
private Date warehousingTime;
/**
* 拆包数
*/
@ApiModelProperty(value = "拆包数")
private Integer unpackingQuantity;
/** /**
* 货物编号 * 货物编号
*/ */

6
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java

@ -42,14 +42,12 @@ public class DistributionReservationVO extends DistributionReservationEntity {
* 库存品信息列表 * 库存品信息列表
*/ */
@ApiModelProperty(value = "库存品信息列表") @ApiModelProperty(value = "库存品信息列表")
private List<DistributionStockListEntity> inventoryList; private List<DistributionStockListVO> inventoryList;
/** /**
* 订单信息列表 * 订单信息列表
*/ */
@ApiModelProperty(value = "订单信息列表") @ApiModelProperty(value = "订单信息列表")
private List<DistributionStockArticleEntity> stockArticleList; private List<DistributionStockArticleVO> stockArticleList;
} }

9
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java

@ -8,6 +8,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
import java.util.Date;
@Data @Data
@TableName("mt_factory_order_main") @TableName("mt_factory_order_main")
@ApiModel(value = "MtFactoryOrderMain对象", description = "梦天工厂订单主对象") @ApiModel(value = "MtFactoryOrderMain对象", description = "梦天工厂订单主对象")
@ -58,4 +60,11 @@ public class MtFactoryOrderMain extends BaseEntity {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@JsonProperty("反馈梦天状态")
@ApiModelProperty(value = "反馈梦天状态")
private Integer pushStatus;
@JsonProperty("推送时间")
@ApiModelProperty(value = "推送时间")
private Date pushTime;
} }

30
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/feign/IMtOrderMainClinet.java

@ -0,0 +1,30 @@
package com.logpm.factory.snm.feign;
import com.logpm.factory.snm.entity.StationlinenumEntity;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;
@FeignClient(
value = ModuleNameConstant.APPLICATION_FACTORY_NAME
)
public interface IMtOrderMainClinet {
String API_PREFIX = "/mtclient";
String TOP = API_PREFIX + "/top";
/**
* 获取梦天工厂订单 包间 主订单 的关系
*
* @return
*/
@GetMapping(TOP)
R<List<MTOrderPackageRelationVO>> mtOrderPackageRelation();
}

31
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/vo/MTOrderPackageRelationVO.java

@ -0,0 +1,31 @@
package com.logpm.factory.snm.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 梦天 订单 主订单 包间 关系 用于判断车次中的订单是否包含
*/
@Data
public class MTOrderPackageRelationVO implements Serializable {
/**
* 包件码
*/
private String packageCode;
/**
* 订单号
*/
private String orderCode;
/**
* 主订单号
*/
private String invoiceOrderCode;
}

2
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java

@ -85,6 +85,6 @@ public interface IAdvanceDetailClient {
* @param unloadCarNum * @param unloadCarNum
* @return * @return
*/ */
@GetMapping(API_PREFIX + "/getOneByUnitNo") @GetMapping(API_PREFIX + "/getByCarNum")
List<AdvanceDetailEntity> getByCarNum(@RequestParam String unloadCarNum); List<AdvanceDetailEntity> getByCarNum(@RequestParam String unloadCarNum);
} }

10
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataStoreBrandClient.java

@ -17,6 +17,7 @@
package com.logpm.basicdata.feign; package com.logpm.basicdata.feign;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
@ -50,4 +51,13 @@ public class BasicdataStoreBrandClient implements IBasicdataStoreBrandClient {
return BladePage.of(page); return BladePage.of(page);
} }
@Override
@GetMapping(BRANDLIST)
public BasicdataStoreBrandEntity getBrandList(Long clientId, String brandName) {
return basicdataStoreBrandService.getOne(Wrappers.<BasicdataStoreBrandEntity>query().lambda()
.eq(BasicdataStoreBrandEntity::getClientId,clientId)
.eq(BasicdataStoreBrandEntity::getBrandName,brandName)
);
}
} }

33
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java

@ -233,4 +233,37 @@ public class DistributionReservationController extends BladeController {
boolean result = reservationService.cancelReservation(reservationDTO); boolean result = reservationService.cancelReservation(reservationDTO);
return R.status(result); return R.status(result);
} }
/**
* 预约列表 详情
*/
@GetMapping("/getReservationDetail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入distrbutionReservation")
public R<?> getReservationDetail(@RequestParam String id) {
R<?> reservationVO = reservationService.getReservationDetail(id);
return R.data(reservationVO);
}
/**
* 预约列表 详情
*/
@GetMapping("/getReservationPackage")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入distrbutionReservation")
public R<?> getReservationPackage(@RequestParam String reservationId,@RequestParam String id) {
R<?> reservationPackage = reservationService.getReservationPackage(reservationId,id);
return reservationPackage;
}
/**
* 预约列表 详情
*/
@GetMapping("/getReservationPackageList")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入distrbutionReservation")
public R<?> getReservationPackageList(@RequestParam String reservationId) {
R<?> reservationPackage = reservationService.getReservationPackageList(reservationId);
return reservationPackage;
}
} }

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java

@ -90,7 +90,7 @@ public class DistributionStockArticleController extends BladeController {
} }
IPage<DistributionStockArticleEntity> pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper); IPage<DistributionStockArticleEntity> pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper);
pages.getRecords().forEach( i ->{ pages.getRecords().forEach( i ->{
Integer typeService = i.getTypeService(); String typeService = i.getTypeService();
//计算在库天数 //计算在库天数
// SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); // SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
long time1 = i.getWarehouseEntryTime().getTime(); //入库 long time1 = i.getWarehouseEntryTime().getTime(); //入库
@ -114,7 +114,7 @@ public class DistributionStockArticleController extends BladeController {
R<List<DictBiz>> distribution_type = dictBizClient.getList("distribution_type"); R<List<DictBiz>> distribution_type = dictBizClient.getList("distribution_type");
if(!Objects.isNull(typeService)){ if(!Objects.isNull(typeService)){
if(Func.isNotEmpty(distribution_type.getData())){ if(Func.isNotEmpty(distribution_type.getData())){
DictBiz dictBiz = distribution_type.getData().get(typeService-1); DictBiz dictBiz = distribution_type.getData().get(Integer.parseInt(typeService)-1);
i.setTypeName(dictBiz.getDictValue()); i.setTypeName(dictBiz.getDictValue());
switch (i.getState()){ switch (i.getState()){
case 1: case 1:

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java

@ -20,8 +20,10 @@ import com.logpm.distribution.entity.DistributionReservationEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.excel.DistributionReservationExcel; import com.logpm.distribution.excel.DistributionReservationExcel;
import com.logpm.distribution.vo.DistributionReservationVO; import com.logpm.distribution.vo.DistributionReservationVO;
import com.logpm.distribution.vo.DistributionStockArticleVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -54,4 +56,6 @@ public interface DistributionReservationMapper extends BaseMapper<DistributionRe
Integer addReservations(@Param("list")List<Long> toLongList); Integer addReservations(@Param("list")List<Long> toLongList);
DistributionReservationVO getReservationDetail(String reservationId); DistributionReservationVO getReservationDetail(String reservationId);
List<DistributionStockArticleVO> getStockArticleList(@Param("id") String reservationId);
} }

76
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

@ -80,5 +80,81 @@
AND AND
reservation.reservation.id=#{reservationId} reservation.reservation.id=#{reservationId}
</select> </select>
<select id="getStockArticleList" resultType="com.logpm.distribution.vo.DistributionStockArticleVO">
SELECT
ldsa.tenant_id,
ldsa.id,
ldsa.create_user,
ldsa.create_time,
ldsa.update_user,
ldsa.update_time,
ldsa.status,
ldsa.is_deleted,
ldsa.create_dept,
ldsa.service_number,
ldsa.order_self_numbering,
ldsa.mall_id,
ldsa.mall_code,
ldsa.mall_name,
ldsa.store_name,
ldsa.store_code,
ldsa.store_id,
ldsa.description_goods,
ldsa.warehouse_id,
ldsa.warehouse,
ldsa.warehouse_entry_time,
ldsa.store_time,
ldsa.total_number,
ldsa.hand_quantity,
ldsa.complete_set,
ldsa.brand,
ldsa.type_service,
ldsa.customer_name,
ldsa.customer_telephone,
ldsa.customer_address,
ldsa.genre,
ldsa.state,
ldsa.notification,
ldsa.fee,
ldsa.rate,
ldsa.advance_id,
ldsa.waybill_number,
ldsa.consignee_unit,
ldsa.collect_fee,
ldsa.storage_fee,
ldsa.consignee_person,
ldsa.consignee_address,
ldsa.consignee_mobile,
ldsa.warehouse_entry_time_end,
ldsa.sorting_quantity,
ldsa.delivery_quantity,
ldsa.transfer_quantity,
ldsa.signin_quantity,
ldsa.grounding_status,
ldsa.allocation,
ldsa.resource,
ldsa.trays,
ldsa.is_opai,
ldsa.inventory_date,
ldsa.inventory_person,
ldsa.inventory_person_id,
ldsa.freeze_status,
ldsa.available_quantity,
ldsa.is_have_data,
ldsa.stock_article_code,
ldsa.dealer_name,
ldsa.dealer_code,
ldrs.reservation_num AS reservationNum
FROM
logpm_distribution_reservation ldr
INNER JOIN logpm_distribution_reservation_stockarticle ldrs ON ldr.id = ldrs.reservation_id
INNER JOIN logpm_distribution_stock_article ldsa ON ldrs.stock_article_id = ldsa.id
<where>
<if test="id != '' and id != null">
ldr.id = #{id}
</if>
</where>
</select>
</mapper> </mapper>

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java

@ -16,6 +16,8 @@
*/ */
package com.logpm.distribution.mapper; package com.logpm.distribution.mapper;
import com.logpm.distribution.dto.DistributionReservationPackageDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionReservationPackageEntity; import com.logpm.distribution.entity.DistributionReservationPackageEntity;
import com.logpm.distribution.vo.DistributionReservationPackageVO; import com.logpm.distribution.vo.DistributionReservationPackageVO;
import com.logpm.distribution.excel.DistributionReservationPackageExcel; import com.logpm.distribution.excel.DistributionReservationPackageExcel;
@ -57,4 +59,18 @@ public interface DistributionReservationPackageMapper extends BaseMapper<Distrib
* @return * @return
*/ */
int deleteReservationPackage(@Param("id")Long id); int deleteReservationPackage(@Param("id")Long id);
/**
* 查询订单下的包件信息
* @param reservationPackageDTO
* @return
*/
List<DistributionParcelListEntity> getReservationPackage(@Param("po")DistributionReservationPackageDTO reservationPackageDTO);
/**
* 查询预约单的所有包件信息
* @param reservationId
* @return
*/
List<DistributionParcelListEntity> getReservationPackageList(@Param("id")String reservationId);
} }

28
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml

@ -36,5 +36,33 @@
<select id="exportDistributionReservationPackage" resultType="com.logpm.distribution.excel.DistributionReservationPackageExcel"> <select id="exportDistributionReservationPackage" resultType="com.logpm.distribution.excel.DistributionReservationPackageExcel">
SELECT * FROM logpm_distribution_reservation_package ${ew.customSqlSegment} SELECT * FROM logpm_distribution_reservation_package ${ew.customSqlSegment}
</select> </select>
<select id="getReservationPackage" resultType="com.logpm.distribution.entity.DistributionParcelListEntity">
SELECT
ldpl.*
FROM
logpm_distribution_reservation_package ldrp
INNER JOIN logpm_distribution_parcel_list ldpl ON ldrp.parce_list_id = ldpl.id
<where>
<if test="po.reservationId !='' and po.reservationId != null">
and ldrp.reservation_id = #{po.reservationId}
</if>
<if test="po.id !='' and po.id != null">
and ldrp.stock_article_id = #{po.id}
</if>
</where>
</select>
<select id="getReservationPackageList" resultType="com.logpm.distribution.entity.DistributionParcelListEntity">
SELECT
ldpl.*
FROM
`logpm_distribution_reservation_package` ldrp
INNER JOIN logpm_distribution_parcel_list ldpl ON ldrp.parce_list_id = ldpl.id
<where>
<if test="id != '' and id !=null">
and ldrp.reservation_id = #{id}
</if>
</where>
</select>
</mapper> </mapper>

20
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java

@ -66,7 +66,7 @@ public interface IDistributionReservationService extends BaseService<Distributio
* @param reservationId 预约信息ID * @param reservationId 预约信息ID
* @return * @return
*/ */
DistributionReservationVO getReservationDetail(String reservationId); R<?> getReservationDetail(String reservationId);
/** /**
* 新增预约列表数据 * 新增预约列表数据
@ -120,10 +120,24 @@ public interface IDistributionReservationService extends BaseService<Distributio
R<?> deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO); R<?> deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO);
/** /**
* *取消预约
* @param allocationDTO * @param reservationDTO
* @return * @return
*/ */
boolean cancelReservation(DistributionReservationDTO reservationDTO); boolean cancelReservation(DistributionReservationDTO reservationDTO);
/**
* 查询预约下的包件信息
* @param reservationId
* @param id
* @return
*/
R<?> getReservationPackage(String reservationId, String id);
/**
* 查询预约单下的所有包件信息
* @param reservationId
* @return
*/
R<?> getReservationPackageList(String reservationId);
} }

245
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -26,7 +26,10 @@ import com.logpm.distribution.mapper.DistributionReservationPackageMapper;
import com.logpm.distribution.mapper.DistributionReservationStockarticleMapper; import com.logpm.distribution.mapper.DistributionReservationStockarticleMapper;
import com.logpm.distribution.mapper.DistributionReservationStocklistMapper; import com.logpm.distribution.mapper.DistributionReservationStocklistMapper;
import com.logpm.distribution.service.*; import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.DistributionReservationStockarticleVO;
import com.logpm.distribution.vo.DistributionReservationVO; import com.logpm.distribution.vo.DistributionReservationVO;
import com.logpm.distribution.vo.DistributionStockArticleVO;
import com.logpm.distribution.vo.DistributionStockListVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.common.serviceConstant.ServiceConstant; import org.springblade.common.serviceConstant.ServiceConstant;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
@ -98,10 +101,6 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
private final IDistributionSignforService distributionSignforService; private final IDistributionSignforService distributionSignforService;
@Override @Override
public IPage<DistributionReservationVO> selectDistrbutionReservationPage(IPage<DistributionReservationVO> page, DistributionReservationVO distrbutionReservation) { public IPage<DistributionReservationVO> selectDistrbutionReservationPage(IPage<DistributionReservationVO> page, DistributionReservationVO distrbutionReservation) {
return page.setRecords(baseMapper.selectDistrbutionReservationPage(page, distrbutionReservation)); return page.setRecords(baseMapper.selectDistrbutionReservationPage(page, distrbutionReservation));
@ -138,9 +137,34 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
} }
@Override @Override
public DistributionReservationVO getReservationDetail(String reservationId) { public R<?> getReservationDetail(String reservationId) {
DistributionReservationVO distributionReservationVO = distributionReservationMapper.getReservationDetail(reservationId); if (Func.isBlank(reservationId)) {
return distributionReservationVO; log.error("参数异常reservationId+{" + reservationId + "}");
return R.fail("服务器正忙!!");
}
//创建预约对象
//2、查询预约单下的包件信息列表
//3、查询预约单下的库存品信息列表
DistributionReservationEntity reservationEntity = this.getById(reservationId);
DistributionReservationVO reservationVO = Func.copy(reservationEntity, DistributionReservationVO.class);
String reservationStatus = reservationVO.getReservationStatus();
Integer typeService = reservationVO.getTypeService();
switch (reservationStatus) {
case "2":
reservationVO.setReservationStatus("已确定");
break;
case "1":
reservationVO.setReservationStatus("待确定");
break;
}
//1、查询预约单下的订单列表信息
List<DistributionStockArticleVO> stockArticleEntityList = distributionReservationMapper.getStockArticleList(reservationId);
if (stockArticleEntityList.size() >= 1) {
reservationVO.setStockArticleList(stockArticleEntityList);
}
// DistributionReservationVO distributionReservationVO = distributionReservationMapper.getReservationDetail(reservationId);
return R.data(reservationVO);
} }
@Override @Override
@ -154,9 +178,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
DistributionReservationEntity reservationEntity = new DistributionReservationEntity(); DistributionReservationEntity reservationEntity = new DistributionReservationEntity();
Func.copy(distributionReservationDTO, reservationEntity); Func.copy(distributionReservationDTO, reservationEntity);
//新建预约单为待确认状态 //新建预约单为待确认状态
reservationEntity.setReservationStatus("1"); reservationEntity.setReservationStatus(ServiceConstant.RESERVATION_STATE_WAIT_CONFIRM);
//新建预约单订单处于未备货状态 //新建预约单订单处于未备货状态
reservationEntity.setStockupStatus("1"); reservationEntity.setStockupStatus(ServiceConstant.STOCkUP_STATE_NOT_EXECUTION);
this.save(reservationEntity); this.save(reservationEntity);
//获取新增预约信息的编号 //获取新增预约信息的编号
Long reservationId = reservationEntity.getId(); Long reservationId = reservationEntity.getId();
@ -177,45 +201,40 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//预约订单数量 //预约订单数量
AtomicInteger packageNum = new AtomicInteger(); AtomicInteger packageNum = new AtomicInteger();
List<DistributionParcelListEntity> packageList = s.getPackageList(); List<DistributionParcelListEntity> packageList = s.getPackageList();
if (s.getIsHaveData().equals(ServiceConstant.ORDER_HAVE_DATA)){ if (packageList.size() == 0) {
if (packageList.size() == 0){ if (s.getIsHaveData() == 2) {
if (s.getIsHaveData() == 2 ){ Map<String, Object> map = new HashMap<>();
Map<String,Object> map = new HashMap<>(); map.put("stockArticleId", s.getId());
map.put("stockArticleId",s.getId()); QueryWrapper<DistributionParcelListEntity> qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class);
QueryWrapper<DistributionParcelListEntity> qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class); //添加订单下的所有在库订单的包件
//添加订单下的所有在库订单的包件 List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw);
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw); distributionParcelListEntities.forEach(p -> {
distributionParcelListEntities.forEach(p->{
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(reservationId);
distributionReservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageEntity.setStockArticleId(s.getId());
distributionReservationPackageEntity.setPacketBarCode(p.getPacketBarCode());
//维护订单下包件信息
distributionReservationPackageService.save(distributionReservationPackageEntity);
//此时订单下的所有包件都处于预约状态,可用数为0
packageNum.getAndIncrement();
});
}
s.setAvailableQuantity(0);
}else {
//维护选中的包件信息
packageList.forEach(p->{
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(reservationId); distributionReservationPackageEntity.setReservationId(reservationId);
distributionReservationPackageEntity.setParceListId(p.getId()); distributionReservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageEntity.setStockArticleId(s.getId()); distributionReservationPackageEntity.setStockArticleId(s.getId());
distributionReservationPackageMapper.insert(distributionReservationPackageEntity); distributionReservationPackageEntity.setPacketBarCode(p.getPacketBarCode());
//维护订单下包件信息
distributionReservationPackageService.save(distributionReservationPackageEntity);
//此时订单下的所有包件都处于预约状态,可用数为0
packageNum.getAndIncrement(); packageNum.getAndIncrement();
}); });
//设置订单可用数量为
s.setAvailableQuantity(s.getHandQuantity() - s.getReservationNum());
} }
distributionReservationStockarticleEntity.setReservationNum(packageNum.get()); s.setAvailableQuantity(0);
}else { } else {
distributionReservationStockarticleEntity.setIsHaveData(ServiceConstant.ORDER_NOT_HAVE_DATA); //维护选中的包件信息
distributionReservationStockarticleEntity.setReservationNum(s.getTotalNumber()); packageList.forEach(p -> {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(reservationId);
distributionReservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageEntity.setStockArticleId(s.getId());
distributionReservationPackageMapper.insert(distributionReservationPackageEntity);
packageNum.getAndIncrement();
});
//设置订单可用数量为
s.setAvailableQuantity(s.getHandQuantity() - s.getReservationNum());
} }
distributionReservationStockarticleEntity.setReservationNum(packageNum.get());
//订单无数据源,不需要进行包件信息维护 //订单无数据源,不需要进行包件信息维护
//修改订单状态为已预约 //修改订单状态为已预约
s.setState(ServiceConstant.ORDER_STATE_ALREADY_RESERVATION); s.setState(ServiceConstant.ORDER_STATE_ALREADY_RESERVATION);
@ -276,7 +295,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationEntity.setDeliveryType(ServiceConstant.DELIVERY_TYPE_CUSTOMER); reservationEntity.setDeliveryType(ServiceConstant.DELIVERY_TYPE_CUSTOMER);
//设置预约配送方式为送货 //设置预约配送方式为送货
reservationEntity.setDeliveryWay(ServiceConstant.DELIVERY_GOODS_WAY); reservationEntity.setDeliveryWay(ServiceConstant.DELIVERY_GOODS_WAY);
reservationEntity.setServiceNumber(String.join(",",serviceNumber)); reservationEntity.setServiceNumber(String.join(",", serviceNumber));
reservationEntity.setReservationNum(count); reservationEntity.setReservationNum(count);
distributionReservationMapper.updateById(reservationEntity); distributionReservationMapper.updateById(reservationEntity);
return true; return true;
@ -369,8 +388,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//这里站配送任务主要有两个方面 //这里站配送任务主要有两个方面
//1、针对市配订单需要将预约信息填充至配送计划中 //1、针对市配订单需要将预约信息填充至配送计划中
//2、商配跳过预约阶段直接将订单信息和配送计划进行关联 //2、商配跳过预约阶段直接将订单信息和配送计划进行关联
if (Func.isEmpty(allocationDTO)){ if (Func.isEmpty(allocationDTO)) {
log.error("参数异常allocationDTO:+{"+allocationDTO+"}"); log.error("参数异常allocationDTO:+{" + allocationDTO + "}");
return R.fail("服务器正忙!!!"); return R.fail("服务器正忙!!!");
} }
String reservationIds = allocationDTO.getReservationIds(); String reservationIds = allocationDTO.getReservationIds();
@ -388,10 +407,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//设置车次号 //设置车次号
String today = DateUtil.today(); String today = DateUtil.today();
String random = Func.random(7, RandomType.ALL); String random = Func.random(7, RandomType.ALL);
distributionDeliveryListEntity.setTrainNumber(random+today); distributionDeliveryListEntity.setTrainNumber(random + today);
distributionDeliveryListService.save(distributionDeliveryListEntity); distributionDeliveryListService.save(distributionDeliveryListEntity);
List<Long> ids = Func.toLongList(reservationIds); List<Long> ids = Func.toLongList(reservationIds);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
//获取备货任务的编号 //获取备货任务的编号
Long stockupEntityId = distributionStockupEntity.getId(); Long stockupEntityId = distributionStockupEntity.getId();
//统计包件数量 //统计包件数量
@ -410,25 +429,25 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
StringBuilder vehicleNubs = new StringBuilder(); StringBuilder vehicleNubs = new StringBuilder();
//司机名称拼接 //司机名称拼接
StringBuilder driverNames = new StringBuilder(); StringBuilder driverNames = new StringBuilder();
ids.forEach(i->{ ids.forEach(i -> {
//查询备货任务 //查询备货任务
map.put("reservationId",i); map.put("reservationId", i);
QueryWrapper<DistributionStockupInfoEntity> qw = Condition.getQueryWrapper(map, DistributionStockupInfoEntity.class); QueryWrapper<DistributionStockupInfoEntity> qw = Condition.getQueryWrapper(map, DistributionStockupInfoEntity.class);
DistributionStockupInfoEntity distributionStockupInfoEntity = distributionStockupInfoService.getOne(qw); DistributionStockupInfoEntity distributionStockupInfoEntity = distributionStockupInfoService.getOne(qw);
if (Func.isEmpty(distributionStockupInfoEntity)){ if (Func.isEmpty(distributionStockupInfoEntity)) {
//1、预约单不存在备货任务 //1、预约单不存在备货任务
//利用中间表建立起预约和备货表之间的关系 //利用中间表建立起预约和备货表之间的关系
DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity(); DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity();
stockupInfoEntity.setReservationId(i); stockupInfoEntity.setReservationId(i);
stockupInfoEntity.setStockupId(stockupEntityId); stockupInfoEntity.setStockupId(stockupEntityId);
distributionStockupInfoService.save(stockupInfoEntity); distributionStockupInfoService.save(stockupInfoEntity);
}else { } else {
//TODO 这里还需要考虑一个备货任务下只有一条记录 //TODO 这里还需要考虑一个备货任务下只有一条记录
//获取备货任务编号 //获取备货任务编号
Long stockupId = distributionStockupInfoEntity.getStockupId(); Long stockupId = distributionStockupInfoEntity.getStockupId();
DistributionStockupEntity stockupEntity = distributionStockupService.getById(stockupId); DistributionStockupEntity stockupEntity = distributionStockupService.getById(stockupId);
//2、预约单存在备货任务还未指派 //2、预约单存在备货任务还未指派
if (Func.equals(stockupEntity.getAssignStatus(),ServiceConstant.STOCkUP_ASSIGNSTATUS_ABSENCE)){ if (Func.equals(stockupEntity.getAssignStatus(), ServiceConstant.STOCkUP_ASSIGNSTATUS_ABSENCE)) {
//对原有的备货关系进行修改 //对原有的备货关系进行修改
distributionStockupInfoEntity.setStockupId(stockupEntityId); distributionStockupInfoEntity.setStockupId(stockupEntityId);
distributionStockupInfoService.updateById(distributionStockupInfoEntity); distributionStockupInfoService.updateById(distributionStockupInfoEntity);
@ -464,8 +483,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
QueryWrapper<DistributionReservationPackageEntity> o = Condition.getQueryWrapper(map, DistributionReservationPackageEntity.class); QueryWrapper<DistributionReservationPackageEntity> o = Condition.getQueryWrapper(map, DistributionReservationPackageEntity.class);
o.lambda().eq(DistributionReservationPackageEntity::getReservationId, reservationEntity.getId()); o.lambda().eq(DistributionReservationPackageEntity::getReservationId, reservationEntity.getId());
List<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationPackageService.getBaseMapper().selectList(o); List<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationPackageService.getBaseMapper().selectList(o);
if (!Func.isEmpty(reservationStockarticleEntityList)){ if (!Func.isEmpty(reservationStockarticleEntityList)) {
reservationStockarticleEntityList.forEach(r->{ reservationStockarticleEntityList.forEach(r -> {
//查询订单信息,完成对订单的信息修改 //查询订单信息,完成对订单的信息修改
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(r.getStockArticleId()); DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(r.getStockArticleId());
//拼接订单编号 //拼接订单编号
@ -505,7 +524,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
// distributionLoadscanService.save(distributionLoadscanEntity); // distributionLoadscanService.save(distributionLoadscanEntity);
// } // }
//存在数据来源,维护订单、包件和配送的关系 //存在数据来源,维护订单、包件和配送的关系
if (stockArticleEntity.getHandQuantity()> r.getReservationNum()){ if (stockArticleEntity.getHandQuantity() > r.getReservationNum()) {
//这里表示订单下的包件没有进行全部配送 //这里表示订单下的包件没有进行全部配送
//修改订单状态为部分配送 //修改订单状态为部分配送
stockArticleEntity.setState(4); stockArticleEntity.setState(4);
@ -516,9 +535,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
} }
}); });
} }
if (!Func.isEmpty(reservationStocklistEntityList)){ if (!Func.isEmpty(reservationStocklistEntityList)) {
//对库存品进行操作 //对库存品进行操作
reservationStocklistEntityList.forEach(l->{ reservationStocklistEntityList.forEach(l -> {
DistributionStockListEntity stockListEntity = distributionStockListService.getById(l.getStocklistId()); DistributionStockListEntity stockListEntity = distributionStockListService.getById(l.getStocklistId());
stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - l.getReservationNum()); stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - l.getReservationNum());
hashSet.add(stockListEntity.getOrderSelfNumbering()); hashSet.add(stockListEntity.getOrderSelfNumbering());
@ -539,7 +558,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
Long deliveryListId = distributionDeliveryListEntity.getId(); Long deliveryListId = distributionDeliveryListEntity.getId();
//操作司机信息 //操作司机信息
DistributionDeliveryTripartiteDTO tripartite = allocationDTO.getTripartite(); DistributionDeliveryTripartiteDTO tripartite = allocationDTO.getTripartite();
if (Func.isEmpty(tripartite)){ if (Func.isEmpty(tripartite)) {
//这里就是三方配送 //这里就是三方配送
DistributionDeliveryTripartiteEntity tripartiteEntity = Func.copy(tripartite, DistributionDeliveryTripartiteEntity.class); DistributionDeliveryTripartiteEntity tripartiteEntity = Func.copy(tripartite, DistributionDeliveryTripartiteEntity.class);
// tripartiteEntity.setReservationIds(reservationIds); // tripartiteEntity.setReservationIds(reservationIds);
@ -553,10 +572,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliveryListEntity.setDistributionCompany(tripartite.getDistributionCompany()); distributionDeliveryListEntity.setDistributionCompany(tripartite.getDistributionCompany());
distributionDeliveryListEntity.setDistributionCompanyId(tripartite.getDistributionCompanyId()); distributionDeliveryListEntity.setDistributionCompanyId(tripartite.getDistributionCompanyId());
//TODO 这里可以对三方配送的机构编号进行添加 //TODO 这里可以对三方配送的机构编号进行添加
}else { } else {
//这里就是自主配送 //这里就是自主配送
List<DistributionDeliverySelfDTO> allocationInfo = allocationDTO.getAllocationInfo(); List<DistributionDeliverySelfDTO> allocationInfo = allocationDTO.getAllocationInfo();
allocationInfo.forEach(a->{ allocationInfo.forEach(a -> {
DistributionDeliverySelfEntity distributionDeliverySelfEntity = Func.copy(a, DistributionDeliverySelfEntity.class); DistributionDeliverySelfEntity distributionDeliverySelfEntity = Func.copy(a, DistributionDeliverySelfEntity.class);
//设置车辆编号 //设置车辆编号
distributionDeliverySelfEntity.setDeliveryId(Long.parseLong(a.getDriverId())); distributionDeliverySelfEntity.setDeliveryId(Long.parseLong(a.getDriverId()));
@ -568,9 +587,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliverySelfEntity.setDriverPhone(a.getDriverPhone()); distributionDeliverySelfEntity.setDriverPhone(a.getDriverPhone());
distributionDeliverySelfEntity.setVehicleNub(a.getVehicleNub()); distributionDeliverySelfEntity.setVehicleNub(a.getVehicleNub());
//设置是否为主司机 //设置是否为主司机
if (Func.equals(allocationDTO.getMasterDriverName(),a.getDriver())){ if (Func.equals(allocationDTO.getMasterDriverName(), a.getDriver())) {
//设置主司机 //设置主司机
distributionDeliverySelfEntity.setIsMaster(1); distributionDeliverySelfEntity.setIsMaster(ServiceConstant.IS_MASTER_YES);
} }
//完成对自主配送司机信息保存 //完成对自主配送司机信息保存
distributionDeliverySelfEntity.setDeliveryId(deliveryListId); distributionDeliverySelfEntity.setDeliveryId(deliveryListId);
@ -580,8 +599,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
driverNames.append(a.getDriver()).append(","); driverNames.append(a.getDriver()).append(",");
}); });
distributionDeliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF); distributionDeliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF);
distributionDeliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length()-1).toString()); distributionDeliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString());
distributionDeliveryListEntity.setVehicleName(vehicleNubs.deleteCharAt(vehicleNubs.length()-1).toString()); distributionDeliveryListEntity.setVehicleName(vehicleNubs.deleteCharAt(vehicleNubs.length() - 1).toString());
} }
//对配送信息进行修改 //对配送信息进行修改
distributionDeliveryListEntity.setState(ServiceConstant.DELIVERY_TYPE_CUSTOMER); distributionDeliveryListEntity.setState(ServiceConstant.DELIVERY_TYPE_CUSTOMER);
@ -592,9 +611,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliveryListEntity.setCustomersNumber(reservationIds.split(",").length); distributionDeliveryListEntity.setCustomersNumber(reservationIds.split(",").length);
distributionDeliveryListEntity.setOrderNumber(orderNum.get()); distributionDeliveryListEntity.setOrderNumber(orderNum.get());
distributionDeliveryListEntity.setType(ServiceConstant.DELIVERY_TYPE_CUSTOMER); distributionDeliveryListEntity.setType(ServiceConstant.DELIVERY_TYPE_CUSTOMER);
distributionDeliveryListEntity.setOrderSelfNumbering(String.join(",",hashSet)); distributionDeliveryListEntity.setOrderSelfNumbering(String.join(",", hashSet));
if (orderIds.length()>1){ if (orderIds.length() > 1) {
distributionDeliveryListEntity.setOrderId(orderIds.deleteCharAt(orderIds.length()-1).toString()); distributionDeliveryListEntity.setOrderId(orderIds.deleteCharAt(orderIds.length() - 1).toString());
} }
distributionDeliveryListEntity.setReservationId(reservationIds); distributionDeliveryListEntity.setReservationId(reservationIds);
distributionDeliveryListEntity.setDeliveryNumber(packageNum.get()); distributionDeliveryListEntity.setDeliveryNumber(packageNum.get());
@ -604,6 +623,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliveryListService.updateById(distributionDeliveryListEntity); distributionDeliveryListService.updateById(distributionDeliveryListEntity);
return R.status(true); return R.status(true);
} }
@Override @Override
public R<DistributionReservationVO> getReservationInfo(String reservationId) { public R<DistributionReservationVO> getReservationInfo(String reservationId) {
//查询出预约信息 //查询出预约信息
@ -624,8 +644,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
stockArticleEntity.setReservationNum(a1.getReservationNum()); stockArticleEntity.setReservationNum(a1.getReservationNum());
stockArticleEntityList.add(stockArticleEntity); stockArticleEntityList.add(stockArticleEntity);
}); });
List<DistributionStockArticleVO> stockArticleVOList = Func.copy(stockArticleEntityList, DistributionStockArticleVO.class);
//查询出 库存信息 //查询出 库存信息
reservationVO.setStockArticleList(stockArticleEntityList); reservationVO.setStockArticleList(stockArticleVOList);
} }
if (!Func.isEmpty(reservationStocklistEntityList)) { if (!Func.isEmpty(reservationStocklistEntityList)) {
List<DistributionStockListEntity> stockArticleEntityList = new ArrayList<>(); List<DistributionStockListEntity> stockArticleEntityList = new ArrayList<>();
@ -634,8 +655,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
stockListEntity.setReservationNum(a2.getReservationNum()); stockListEntity.setReservationNum(a2.getReservationNum());
stockArticleEntityList.add(stockListEntity); stockArticleEntityList.add(stockListEntity);
}); });
List<DistributionStockListVO> stockListVOList = Func.copy(stockArticleEntityList, DistributionStockListVO.class);
//查询出 库存信息 //查询出 库存信息
reservationVO.setInventoryList(stockArticleEntityList); reservationVO.setInventoryList(stockListVOList);
} }
return R.data(reservationVO); return R.data(reservationVO);
} }
@ -677,7 +699,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationStocklistEntityList.forEach(r1 -> { reservationStocklistEntityList.forEach(r1 -> {
Long stocklistId = r1.getStocklistId(); Long stocklistId = r1.getStocklistId();
DistributionStockListEntity stockListEntity = distributionStockListService.getById(stocklistId); DistributionStockListEntity stockListEntity = distributionStockListService.getById(stocklistId);
stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied()-r1.getReservationNum()); stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - r1.getReservationNum());
stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() + r1.getReservationNum()); stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() + r1.getReservationNum());
//这里对原表进行物理删除 //这里对原表进行物理删除
distributionStockListService.updateById(stockListEntity); distributionStockListService.updateById(stockListEntity);
@ -703,13 +725,13 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
stockArticleList.forEach(s -> { stockArticleList.forEach(s -> {
List<DistributionParcelListEntity> packageList = s.getPackageList(); List<DistributionParcelListEntity> packageList = s.getPackageList();
AtomicInteger packageNum = new AtomicInteger(); AtomicInteger packageNum = new AtomicInteger();
if (packageList.size() == 0){ if (packageList.size() == 0) {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("stockArticleId",s.getId()); map.put("stockArticleId", s.getId());
QueryWrapper<DistributionParcelListEntity> qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class); QueryWrapper<DistributionParcelListEntity> qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class);
//添加订单下的所有在库订单 //添加订单下的所有在库订单
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw); List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw);
distributionParcelListEntities.forEach(p->{ distributionParcelListEntities.forEach(p -> {
packageNum.getAndIncrement(); packageNum.getAndIncrement();
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId()); distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId());
@ -721,9 +743,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
}); });
//设置订单可用数为0 //设置订单可用数为0
s.setAvailableQuantity(0); s.setAvailableQuantity(0);
}else { } else {
//维护选中的包件信息 //维护选中的包件信息
packageList.forEach(p->{ packageList.forEach(p -> {
packageNum.getAndIncrement(); packageNum.getAndIncrement();
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId()); distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId());
@ -781,8 +803,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
@Override @Override
@Transactional @Transactional
public R<?> deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO) { public R<?> deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO) {
if (Func.isEmpty(allocationDTO)){ if (Func.isEmpty(allocationDTO)) {
log.error("参数异常allocationDTO+{"+allocationDTO+"}"); log.error("参数异常allocationDTO+{" + allocationDTO + "}");
return R.fail("服务器正忙!!!"); return R.fail("服务器正忙!!!");
} }
//1、添加配送任务 //1、添加配送任务
@ -801,7 +823,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionStockupService.save(stockupEntity); distributionStockupService.save(stockupEntity);
//4、维护配送表数据 //4、维护配送表数据
DistributionDeliveryListEntity distributionDeliveryListEntity = new DistributionDeliveryListEntity(); DistributionDeliveryListEntity distributionDeliveryListEntity = new DistributionDeliveryListEntity();
distributionDeliveryListEntity.setTrainNumber(Func.random(7,RandomType.ALL)+DateUtil.today()); distributionDeliveryListEntity.setTrainNumber(Func.random(7, RandomType.ALL) + DateUtil.today());
distributionDeliveryListEntity.setType(ServiceConstant.DELIVERY_TYPE_BUSINESS); distributionDeliveryListEntity.setType(ServiceConstant.DELIVERY_TYPE_BUSINESS);
distributionDeliveryListEntity.setState(ServiceConstant.DELIVERLIST_STATE_WAIT); distributionDeliveryListEntity.setState(ServiceConstant.DELIVERLIST_STATE_WAIT);
distributionDeliveryListService.save(distributionDeliveryListEntity); distributionDeliveryListService.save(distributionDeliveryListEntity);
@ -812,7 +834,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
List<DistributionStockArticleDTO> distributionStockArticleDTOS = storeClient.get(""); List<DistributionStockArticleDTO> distributionStockArticleDTOS = storeClient.get("");
Map<String, List<DistributionStockArticleDTO>> mallClient = distributionStockArticleDTOS.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getMallName)); Map<String, List<DistributionStockArticleDTO>> mallClient = distributionStockArticleDTOS.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getMallName));
//3、维护订单和客户 //3、维护订单和客户
storeClient.forEach((k,v)->mallClient.merge(k,v,(v1,v2)->v2)); storeClient.forEach((k, v) -> mallClient.merge(k, v, (v1, v2) -> v2));
//统计客户数 //统计客户数
AtomicInteger clientNum = new AtomicInteger(); AtomicInteger clientNum = new AtomicInteger();
@ -822,8 +844,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
AtomicInteger orderTotal = new AtomicInteger(); AtomicInteger orderTotal = new AtomicInteger();
//订单拼接 //订单拼接
StringBuilder orderSelfNumbering = new StringBuilder(); StringBuilder orderSelfNumbering = new StringBuilder();
mallClient.forEach((k,v)->{ mallClient.forEach((k, v) -> {
if (!Func.isBlank(k)){ if (!Func.isBlank(k)) {
////统计客户数 ////统计客户数
//预约任务是在客户的维度上进行数据维护 //预约任务是在客户的维度上进行数据维护
DistributionReservationDTO reservation = allocationDTO.getReservation(); DistributionReservationDTO reservation = allocationDTO.getReservation();
@ -849,7 +871,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
AtomicReference<BigDecimal> initTotal = new AtomicReference<>(BigDecimal.ZERO); AtomicReference<BigDecimal> initTotal = new AtomicReference<>(BigDecimal.ZERO);
//统计包件数量 //统计包件数量
AtomicInteger packageNum = new AtomicInteger(); AtomicInteger packageNum = new AtomicInteger();
v.forEach(a->{ v.forEach(a -> {
orderTotal.getAndIncrement(); orderTotal.getAndIncrement();
//TODO 这里还需要对库存品进行筛选 //TODO 这里还需要对库存品进行筛选
DistributionStockArticleEntity stockArticleEntity = Func.copy(a, DistributionStockArticleEntity.class); DistributionStockArticleEntity stockArticleEntity = Func.copy(a, DistributionStockArticleEntity.class);
@ -862,16 +884,16 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//订单存在数据源,维护订单包件信息 //订单存在数据源,维护订单包件信息
//维护预约和订单关系 //维护预约和订单关系
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity(); DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity();
if (stockArticleEntity.getIsHaveData().equals(ServiceConstant.ORDER_HAVE_DATA)){ if (stockArticleEntity.getIsHaveData().equals(ServiceConstant.ORDER_HAVE_DATA)) {
List<DistributionParcelListEntity> packageList = a.getPackageList(); List<DistributionParcelListEntity> packageList = a.getPackageList();
if (a.getPackageList().size() == 0){ if (a.getPackageList().size() == 0) {
Map<String,Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
//这里就是默认添加订单下的所有包件 //这里就是默认添加订单下的所有包件
map.put("stockArticleId",stockArticleEntity.getId()); map.put("stockArticleId", stockArticleEntity.getId());
QueryWrapper<DistributionParcelListEntity> o = Condition.getQueryWrapper(map, DistributionParcelListEntity.class); QueryWrapper<DistributionParcelListEntity> o = Condition.getQueryWrapper(map, DistributionParcelListEntity.class);
// o.lambda().eq(DistributionParcelListEntity::getStockArticleId, stockArticleEntity.getId()); // o.lambda().eq(DistributionParcelListEntity::getStockArticleId, stockArticleEntity.getId());
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(o); List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(o);
parcelListEntityList.forEach(p->{ parcelListEntityList.forEach(p -> {
packageCount.getAndIncrement(); packageCount.getAndIncrement();
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setReservationId(reservationEntity.getId()); reservationPackageEntity.setReservationId(reservationEntity.getId());
@ -880,9 +902,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationPackageEntity.setParceListId(p.getId()); reservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageService.save(reservationPackageEntity); distributionReservationPackageService.save(reservationPackageEntity);
}); });
}else { } else {
//订单选择了指定包件进行配送 //订单选择了指定包件进行配送
packageList.forEach(p->{ packageList.forEach(p -> {
packageCount.getAndIncrement(); packageCount.getAndIncrement();
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setReservationId(reservationEntity.getId()); reservationPackageEntity.setReservationId(reservationEntity.getId());
@ -895,7 +917,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationStockarticleEntity.setReservationNum(packageCount.get()); reservationStockarticleEntity.setReservationNum(packageCount.get());
reservationStockarticleEntity.setIsHaveData(ServiceConstant.ORDER_HAVE_DATA); reservationStockarticleEntity.setIsHaveData(ServiceConstant.ORDER_HAVE_DATA);
//对订单下的包件进行累加 //对订单下的包件进行累加
}else { } else {
reservationStockarticleEntity.setIsHaveData(ServiceConstant.ORDER_NOT_HAVE_DATA); reservationStockarticleEntity.setIsHaveData(ServiceConstant.ORDER_NOT_HAVE_DATA);
reservationStockarticleEntity.setReservationNum(stockArticleEntity.getTotalNumber()); reservationStockarticleEntity.setReservationNum(stockArticleEntity.getTotalNumber());
} }
@ -906,10 +928,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum()); packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
}); });
//这里将预约信息进行完善 //这里将预约信息进行完善
reservationEntity.setStockArticleId(orderSelfNumbering.deleteCharAt(orderSelfNumbering.length()-1).toString()); reservationEntity.setStockArticleId(orderSelfNumbering.deleteCharAt(orderSelfNumbering.length() - 1).toString());
//预约添加订单数量 //预约添加订单数量
reservationEntity.setReservationNum(packageNum.get()); reservationEntity.setReservationNum(packageNum.get());
reservationEntity.setReservationCode(Func.random(7,RandomType.ALL)+DateUtil.today()); reservationEntity.setReservationCode(Func.random(7, RandomType.ALL) + DateUtil.today());
this.updateById(reservationEntity); this.updateById(reservationEntity);
DistributionSignforEntity distributionSignforEntity = new DistributionSignforEntity(); DistributionSignforEntity distributionSignforEntity = new DistributionSignforEntity();
distributionSignforEntity.setReservationId(reservationEntity.getId()); distributionSignforEntity.setReservationId(reservationEntity.getId());
@ -925,7 +947,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//司机名称拼接 //司机名称拼接
StringBuilder driverNames = new StringBuilder(); StringBuilder driverNames = new StringBuilder();
DistributionDeliveryTripartiteDTO tripartite = allocationDTO.getTripartite(); DistributionDeliveryTripartiteDTO tripartite = allocationDTO.getTripartite();
if (Func.isEmpty(tripartite)){ if (Func.isEmpty(tripartite)) {
//三方配送 //三方配送
//这里就是三方配送 //这里就是三方配送
DistributionDeliveryTripartiteEntity tripartiteEntity = Func.copy(tripartite, DistributionDeliveryTripartiteEntity.class); DistributionDeliveryTripartiteEntity tripartiteEntity = Func.copy(tripartite, DistributionDeliveryTripartiteEntity.class);
@ -937,10 +959,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliveryListEntity.setVehicleName(tripartiteEntity.getVehicleNum()); distributionDeliveryListEntity.setVehicleName(tripartiteEntity.getVehicleNum());
distributionDeliveryListEntity.setDistributionCompany(tripartite.getDistributionCompany()); distributionDeliveryListEntity.setDistributionCompany(tripartite.getDistributionCompany());
distributionDeliveryListEntity.setDistributionCompanyId(tripartite.getDistributionCompanyId()); distributionDeliveryListEntity.setDistributionCompanyId(tripartite.getDistributionCompanyId());
}else { } else {
//自主配送 //自主配送
List<DistributionDeliverySelfDTO> allocationInfo = allocationDTO.getAllocationInfo(); List<DistributionDeliverySelfDTO> allocationInfo = allocationDTO.getAllocationInfo();
allocationInfo.forEach(a->{ allocationInfo.forEach(a -> {
DistributionDeliverySelfEntity distributionDeliverySelfEntity = Func.copy(a, DistributionDeliverySelfEntity.class); DistributionDeliverySelfEntity distributionDeliverySelfEntity = Func.copy(a, DistributionDeliverySelfEntity.class);
//设置车辆编号 //设置车辆编号
distributionDeliverySelfEntity.setDeliveryId(Long.parseLong(a.getDriverId())); distributionDeliverySelfEntity.setDeliveryId(Long.parseLong(a.getDriverId()));
@ -952,7 +974,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliverySelfEntity.setDriverPhone(a.getDriverPhone()); distributionDeliverySelfEntity.setDriverPhone(a.getDriverPhone());
distributionDeliverySelfEntity.setVehicleNub(a.getVehicleNub()); distributionDeliverySelfEntity.setVehicleNub(a.getVehicleNub());
//设置是否为主司机 //设置是否为主司机
if (allocationDTO.getMasterDriverName().equals(a.getDriverName())){ if (allocationDTO.getMasterDriverName().equals(a.getDriverName())) {
//设置主司机 //设置主司机
distributionDeliverySelfEntity.setIsMaster(ServiceConstant.IS_MASTER_YES); distributionDeliverySelfEntity.setIsMaster(ServiceConstant.IS_MASTER_YES);
} }
@ -964,14 +986,14 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
driverNames.append(a.getDriverName()).append(","); driverNames.append(a.getDriverName()).append(",");
}); });
distributionDeliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF); distributionDeliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF);
distributionDeliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length()-1).toString()); distributionDeliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString());
distributionDeliveryListEntity.setVehicleName(vehicleNubs.deleteCharAt(vehicleNubs.length()-1).toString()); distributionDeliveryListEntity.setVehicleName(vehicleNubs.deleteCharAt(vehicleNubs.length() - 1).toString());
} }
//完善配送信息 //完善配送信息
distributionDeliveryListEntity.setLoadingTeamName(stockup.getLoaderName()); distributionDeliveryListEntity.setLoadingTeamName(stockup.getLoaderName());
distributionDeliveryListEntity.setLoadingTeamId(stockup.getLoaderId()); distributionDeliveryListEntity.setLoadingTeamId(stockup.getLoaderId());
distributionDeliveryListEntity.setLeadTime(stockup.getStockupDate()); distributionDeliveryListEntity.setLeadTime(stockup.getStockupDate());
distributionDeliveryListEntity.setOrderSelfNumbering(orderSelfNumbering.deleteCharAt(orderSelfNumbering.length()-1).toString()); distributionDeliveryListEntity.setOrderSelfNumbering(orderSelfNumbering.deleteCharAt(orderSelfNumbering.length() - 1).toString());
distributionDeliveryListEntity.setOrderNumber(orderTotal.get()); distributionDeliveryListEntity.setOrderNumber(orderTotal.get());
distributionDeliveryListEntity.setDeliveryNumber(packageTotal.get()); distributionDeliveryListEntity.setDeliveryNumber(packageTotal.get());
distributionDeliveryListEntity.setCustomersNumber(clientNum.get()); distributionDeliveryListEntity.setCustomersNumber(clientNum.get());
@ -984,13 +1006,13 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
@Override @Override
@Transactional @Transactional
public boolean cancelReservation(DistributionReservationDTO reservationDTO) { public boolean cancelReservation(DistributionReservationDTO reservationDTO) {
if (Func.isEmpty(reservationDTO)){ if (Func.isEmpty(reservationDTO)) {
log.error("参数异常allocationDTO+{"+reservationDTO+"}"); log.error("参数异常allocationDTO+{" + reservationDTO + "}");
return false; return false;
} }
DistributionReservationEntity reservationEntity = this.getById(reservationDTO.getId()); DistributionReservationEntity reservationEntity = this.getById(reservationDTO.getId());
if (Func.isEmpty(reservationEntity)){ if (Func.isEmpty(reservationEntity)) {
log.error("参数异常reservationEntity+{"+reservationEntity+"}"); log.error("参数异常reservationEntity+{" + reservationEntity + "}");
return false; return false;
} }
boolean result = false; boolean result = false;
@ -999,4 +1021,23 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
result = this.updateById(reservationEntity); result = this.updateById(reservationEntity);
return result; return result;
} }
@Override
public R<?> getReservationPackage(String reservationId, String id) {
DistributionReservationPackageDTO reservationPackageDTO = new DistributionReservationPackageDTO();
reservationPackageDTO.setReservationId(Long.parseLong(reservationId));
reservationPackageDTO.setStockArticleId(Long.parseLong(id));
List<DistributionParcelListEntity> parcelListEntityList = distributionReservationPackageMapper.getReservationPackage(reservationPackageDTO);
return R.data(parcelListEntityList);
}
@Override
public R<?> getReservationPackageList(String reservationId) {
if (Func.isBlank(reservationId)) {
log.error("参数异常reservationId+{" + reservationId + "}");
return R.fail("服务器正忙!!");
}
List<DistributionParcelListEntity> distributionParcelListEntityList = distributionReservationPackageMapper.getReservationPackageList(reservationId);
return R.data(distributionParcelListEntityList);
}
} }

59
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -17,6 +17,7 @@
package com.logpm.distribution.service.impl; package com.logpm.distribution.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -32,6 +33,7 @@ import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.DistributionStockArticleVO; import com.logpm.distribution.vo.DistributionStockArticleVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -39,6 +41,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -243,38 +247,33 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
DistributionStockListEntity distributionStockListEntity = new DistributionStockListEntity(); DistributionStockListEntity distributionStockListEntity = new DistributionStockListEntity();
distributionStockListEntity.setStockArticleId(distributionParcelList.getStockArticleId()); //订单ID distributionStockListEntity.setStockArticleId(Optional.ofNullable(distributionParcelList.getStockArticleId()).orElse(null)); //订单ID
distributionStockListEntity.setOrderSelfNumbering(distributionStockArticleEntity.getOrderSelfNumbering()); //订单自编号 distributionStockListEntity.setOrderSelfNumbering(Optional.ofNullable(distributionStockArticleEntity.getOrderSelfNumbering()).orElse(null)); //订单自编号
distributionStockListEntity.setIncomingBatch("入库批次号"); //入库批次号 // distributionStockListEntity.setIncomingBatch(distributionStockArticleEntity.get); //入库批次号
distributionStockListEntity.setServiceNumber("服务号"); //服务号 distributionStockListEntity.setServiceNumber(Optional.ofNullable(distributionStockArticleEntity.getServiceNumber()).orElse(null)); //服务号
distributionStockListEntity.setDescriptionGoods(distributionStockArticleEntity.getDescriptionGoods()); //货物名称 distributionStockListEntity.setDescriptionGoods(Optional.ofNullable(distributionParcelList.getMaterialName()).orElse(null)); //物料名称
distributionStockListEntity.setCargoNumber("货物编号"); //货物编号 distributionStockListEntity.setCargoNumber(Optional.ofNullable(distributionParcelList.getMaterialCode()).orElse(null)); //物料编号
distributionStockListEntity.setWarehouseName(Optional.ofNullable(distributionStockArticleEntity.getWarehouse() ).orElse(null)); //仓库
distributionStockListEntity.setWarehouseName(distributionStockArticleEntity.getWarehouse() ); //仓库 distributionStockListEntity.setWarehouseId(Optional.ofNullable(distributionStockArticleEntity.getWarehouseId()).orElse(null) ); //仓库ID
distributionStockListEntity.setWarehouseId(distributionStockArticleEntity.getWarehouseId() ); //仓库ID distributionStockListEntity.setMarketId(Optional.ofNullable(distributionStockArticleEntity.getMallId()).orElse(null)); //商场
distributionStockListEntity.setCargoUnit(Optional.ofNullable(distributionParcelList.getMaterialUnit()).orElse(null)); //货物单位
distributionStockListEntity.setMarketId(Long.parseLong("456456465")); //商场 distributionStockListEntity.setStorageLocation(Optional.ofNullable(distributionParcelList.getGoodsAllocation()).orElse(null)); //库位信息
distributionStockListEntity.setCargoUnit("货物单位"); //货物单位 distributionStockListEntity.setMallName(Optional.ofNullable(distributionStockArticleEntity.getMallName()).orElse(null)); //商场名称
// distributionStockListEntity.setShop("门店"); //门店 distributionStockListEntity.setQuantityStock(Optional.ofNullable(distributionStockArticleEntity.getHandQuantity()).orElse(null)); //库存数量
distributionStockListEntity.setStorageLocation("库位信息"); //库位信息 distributionStockListEntity.setOutboundQuantity(Optional.ofNullable(distributionStockArticleEntity.getHandQuantity()).orElse(null)); //出库数量
distributionStockListEntity.setMallName(distributionStockArticleEntity.getMallName()); //商场名称 distributionStockListEntity.setDespatch(Optional.ofNullable(distributionStockArticleEntity.getTrainNumber()).orElse(null));//车次号
distributionStockListEntity.setQuantityStock(distributionStockArticleEntity.getHandQuantity()); //库存数量 distributionStockListEntity.setUnit(Optional.ofNullable(distributionParcelList.getMaterialUnit()).orElse(null));//单位
distributionStockListEntity.setOutboundQuantity(distributionStockArticleEntity.getHandQuantity()); //出库数量 distributionStockListEntity.setStoreId( Optional.ofNullable(distributionStockArticleEntity.getStoreId()).orElse(null) );//门店ID
distributionStockListEntity.setDespatch("车次号");//车次号 distributionStockListEntity.setMarketCode(Optional.ofNullable(distributionStockArticleEntity.getMallCode()).orElse(null));//商场编码
distributionStockListEntity.setUnit("单位");//单位 distributionStockListEntity.setMarketName(Optional.ofNullable(distributionStockArticleEntity.getMallName()).orElse(null));//商场名称
distributionStockListEntity.setStoreId(Long.parseLong("12312"));//门店ID distributionStockListEntity.setStoreCode(Optional.ofNullable(distributionStockArticleEntity.getStoreCode()).orElse(null));//门店编码
// distributionStockListEntity.setShoppingMall("所属商场");//所属商场 distributionStockListEntity.setStoreName(Optional.ofNullable(distributionStockArticleEntity.getStoreName()).orElse(null));//门店名称
// distributionStockListEntity.setShoppingMall("所属商场");//所属商场 distributionStockListEntity.setFactory(Optional.ofNullable(distributionStockArticleEntity.getFactoryTrain()).orElse(null));//工厂车次
distributionStockListEntity.setMarketCode("商场编码");//商场编码 distributionStockListEntity.setCategory(Optional.ofNullable(distributionParcelList.getBrandId()).orElse(null));//品分类
distributionStockListEntity.setMarketName("商场名称");//商场名称 distributionStockListEntity.setMaterialId(Optional.ofNullable(distributionParcelList.getMaterial()).orElse(null));//货物ID
distributionStockListEntity.setStoreCode("门店编码");//门店编码
distributionStockListEntity.setStoreName("门店名称");//门店名称
distributionStockListEntity.setFactory("工厂车次");//工厂车次
distributionStockListEntity.setCategory("品分类");//品分类
distributionStockListEntity.setMaterialId(Long.parseLong("456456") );//货物ID
distributionStockListEntity.setStoreName("门店名称");//门店名称
distributionStockListEntity.setParcelListId(distributionParcelList.getId());//包件id distributionStockListEntity.setParcelListId(distributionParcelList.getId());//包件id
distributionStockListEntity.setQuantityOccupied(0);//冻结数量 distributionStockListEntity.setQuantityOccupied(0);//冻结数量
distributionStockListEntity.setServiceType(distributionStockArticleEntity.getTypeService());//冻结数量
distributionStockListService.save(distributionStockListEntity); distributionStockListService.save(distributionStockListEntity);
return distributionStockArticleEntity; return distributionStockArticleEntity;
} }

42
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java

@ -5,6 +5,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.factory.comfac.dto.OrderInfoDTO; import com.logpm.factory.comfac.dto.OrderInfoDTO;
import com.logpm.factory.comfac.dto.OrderStatusDTO; import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.comfac.dto.ReceiveInfoDTO; import com.logpm.factory.comfac.dto.ReceiveInfoDTO;
import com.logpm.factory.comfac.dto.UnloadCarDTO;
import com.logpm.factory.comfac.service.IFactoryCommonService; import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.factory.comfac.service.IOrderStatusLogService; import com.logpm.factory.comfac.service.IOrderStatusLogService;
import com.logpm.factory.snm.entity.OrderStatusLog; import com.logpm.factory.snm.entity.OrderStatusLog;
@ -146,4 +147,45 @@ public class FactoryCommonController {
} }
// 卸车完成推送
@ResponseBody
@PostMapping("/sendUnloadCarComInfo")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "卸车完成推送", notes = "传入receiveInfoDTO")
public R sendUnloadCarComInfo(@RequestBody UnloadCarDTO receiveInfoDTO) {
log.info("############sendUnloadCarComInfo: 请求参数{}", receiveInfoDTO);
//处理数据
// R r = factoryCommonService.sendReceiveInfo(receiveInfoDTO);
try{
//先保存原始请求数据
OrderStatusLog orderStatusLog = new OrderStatusLog();
orderStatusLog.setArgs(JSONObject.toJSONString(receiveInfoDTO));
orderStatusLog.setStatus(1);
orderStatusLog.setType(5);
orderStatusLogService.save(orderStatusLog);
Map<String,Object> map=new HashMap<>();
map.put("messageId", CommonUtil.getUUID());
map.put("logId", orderStatusLog.getId());
map.put("messageData",receiveInfoDTO);
map.put("createTime",new Date().getTime());
//将消息携带绑定键值
// rabbitTemplate.convertAndSend(RabbitConstant.UNLOAD_CAR_COM_INFO_EXCHANGE, RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING, map);
return R.success("调用成功");
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error("############sendReceiveInfo: 系统异常",e);
return R.fail(500,"############sendReceiveInfo: 系统异常");
}
}
} }

20
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/UnloadCarDTO.java

@ -0,0 +1,20 @@
package com.logpm.factory.comfac.dto;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
/**
* 卸车完成推送
*/
@Data
public class UnloadCarDTO implements Serializable {
@NotEmpty(message = "卸车车次号不能为空")
private String unloadCarNum;
private String completeDate;
}

22
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java

@ -175,5 +175,27 @@ public class RabbitMqConfiguration {
} }
/***/
@Bean
public Queue unloadCarNumQueue() {
return new Queue(RabbitConstant.UNLOAD_CAR_COM_INFO_QUEUE, true);
}
@Bean
public CustomExchange unloadCarNumExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.UNLOAD_CAR_COM_INFO_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding unloadCarNumBinding(Queue receiveInfoQueue, CustomExchange receiveInfoExchange) {
return BindingBuilder.bind(receiveInfoQueue).to(receiveInfoExchange).with(RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING).noargs();
}
} }

20
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java

@ -0,0 +1,20 @@
package com.logpm.factory.mt.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class MtUnLoadCarNumDTO implements Serializable {
@JsonProperty("发货单编号")
private String invoiceOrderCode;
@JsonProperty("确认收货时间")
private Date invoiceTime;
}

27
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtOrderMainClinet.java

@ -0,0 +1,27 @@
package com.logpm.factory.mt.feign;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
import com.logpm.factory.snm.feign.IMtOrderMainClinet;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import lombok.AllArgsConstructor;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
@NonDS
@ApiIgnore
@RestController
@AllArgsConstructor
public class MtOrderMainClinet implements IMtOrderMainClinet {
private final IMtFactoryOrderMainService mtFactoryOrderMainService;
@Override
public R<List<MTOrderPackageRelationVO>> mtOrderPackageRelation() {
List<MTOrderPackageRelationVO> data =mtFactoryOrderMainService.mtOrderPackageRelation();
return R.data(data);
}
}

5
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java

@ -2,6 +2,11 @@ package com.logpm.factory.mt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factory.snm.entity.MtFactoryOrderMain; import com.logpm.factory.snm.entity.MtFactoryOrderMain;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import java.util.List;
public interface MtFactoryOrderMainMapper extends BaseMapper<MtFactoryOrderMain> { public interface MtFactoryOrderMainMapper extends BaseMapper<MtFactoryOrderMain> {
List<MTOrderPackageRelationVO> mtOrderPackageRelation();
} }

14
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml

@ -17,4 +17,18 @@
<!-- <result column="create_dept" property="createDept"/>--> <!-- <result column="create_dept" property="createDept"/>-->
<!-- </resultMap>--> <!-- </resultMap>-->
<select id="mtOrderPackageRelation" resultType="com.logpm.factory.snm.vo.MTOrderPackageRelationVO">
SELECT
mpi.package_code,
mfo.order_code,
mfom.invoice_order_code
FROM
mt_package_info mpi
LEFT JOIN mt_factory_order mfo ON mpi.order_id = mfo.id
LEFT JOIN mt_factory_order_main mfom ON mfom.id = mfo.main_id
where mfom.push_status is null
</select>
</mapper> </mapper>

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java

@ -8,6 +8,8 @@ import com.logpm.factory.mt.dto.MtFactoryDataDTO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.util.Date;
/** /**
* 工厂推送数据接口 * 工厂推送数据接口
@ -21,4 +23,12 @@ public interface IMtFactoryDataService {
R handleStatusData(OrderStatusDTO orderStatusDTO) throws JsonProcessingException, NoSuchAlgorithmException; R handleStatusData(OrderStatusDTO orderStatusDTO) throws JsonProcessingException, NoSuchAlgorithmException;
R sendReceiveInfo(ReceiveInfoDTO receiveInfoDTO) throws JsonProcessingException, NoSuchAlgorithmException; R sendReceiveInfo(ReceiveInfoDTO receiveInfoDTO) throws JsonProcessingException, NoSuchAlgorithmException;
/**
*
* @param unloadCarNum 发货单编号
* @param data 确认收货时间
* @return
*/
R sendUnloadCarNum(String unloadCarNum, Date data) throws ParseException, JsonProcessingException, NoSuchAlgorithmException;
} }

9
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryOrderMainService.java

@ -1,8 +1,17 @@
package com.logpm.factory.mt.service; package com.logpm.factory.mt.service;
import com.logpm.factory.snm.entity.MtFactoryOrderMain; import com.logpm.factory.snm.entity.MtFactoryOrderMain;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import java.util.List;
public interface IMtFactoryOrderMainService extends BaseService<MtFactoryOrderMain> { public interface IMtFactoryOrderMainService extends BaseService<MtFactoryOrderMain> {
List<MTOrderPackageRelationVO> mtOrderPackageRelation();
} }

59
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java

@ -38,6 +38,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.*; import java.util.*;
@Slf4j @Slf4j
@ -231,7 +233,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
* 获取梦天的工厂的数据token * 获取梦天的工厂的数据token
* @return * @return
*/ */
public String getMtToken() throws NoSuchAlgorithmException { private String getMtToken() throws NoSuchAlgorithmException {
String mtToken =bladeRedis.get("mt_token"); String mtToken =bladeRedis.get("mt_token");
if(StringUtil.isBlank(mtToken)){ if(StringUtil.isBlank(mtToken)){
// 重新获取 // 重新获取
@ -348,7 +350,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
logger.info("##############handleStatusData: 推送包件状态请求参数 {}",s); logger.info("##############handleStatusData: 推送包件状态请求参数 {}",s);
//处理逻辑 //处理逻辑
String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/Auth/text") String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/ShouHuoRuKu")
.header("APPKEY",mtFactoryProperties.getAppkey()) .header("APPKEY",mtFactoryProperties.getAppkey())
.header("Authorization",token) .header("Authorization",token)
.header("USERID",mtFactoryProperties.getUserid()) .header("USERID",mtFactoryProperties.getUserid())
@ -455,7 +457,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
logger.info("##############sendReceiveInfo: 推送包件状态请求参数 {}",s); logger.info("##############sendReceiveInfo: 推送包件状态请求参数 {}",s);
//处理逻辑 //处理逻辑
String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/Auth/text2") String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/QianShouDan")
.header("APPKEY",mtFactoryProperties.getAppkey()) .header("APPKEY",mtFactoryProperties.getAppkey())
.header("Authorization",token) .header("Authorization",token)
.header("USERID",mtFactoryProperties.getUserid()) .header("USERID",mtFactoryProperties.getUserid())
@ -482,4 +484,55 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
return R.success("处理签收数据完成"); return R.success("处理签收数据完成");
} }
@Override
public R sendUnloadCarNum(String unloadCarNum, Date data) throws ParseException, JsonProcessingException, NoSuchAlgorithmException {
MtUnLoadCarNumDTO unLoadCarNumDTO = new MtUnLoadCarNumDTO();
unLoadCarNumDTO.setInvoiceOrderCode(unloadCarNum);
unLoadCarNumDTO.setInvoiceTime(data);
ObjectMapper objectMapper = new ObjectMapper();
String s = objectMapper.writeValueAsString(unLoadCarNumDTO);
//推送数据到梦天
//先获取token
String token = getMtToken();
//请求参数
logger.info("##############sendReceiveInfo: 推送包件状态请求参数 {}",s);
//处理逻辑
String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/QueRenShouHuo")
.header("APPKEY",mtFactoryProperties.getAppkey())
.header("Authorization",token)
.header("USERID",mtFactoryProperties.getUserid())
.header("USERPWD",MD5Utils.md5Hex(mtFactoryProperties.getUserpwd().getBytes(StandardCharsets.UTF_8)))
.header("Content-Type","application/json")
.body(s).timeout(5 * 1000)
.execute().body();
logger.info("##############sendReceiveInfo: 车次作业确认完成 {}",result);
//把结果字符串转为json对象
JSONObject jsonObject = JSONObject.parseObject(result);
if(!Objects.isNull(jsonObject)){
Integer code = jsonObject.getInteger("Result");
String message = jsonObject.getString("Message");
if(code.equals(0)){
logger.info("##########sendReceiveInfo: 物流状态传递成功");
}else{
return Resp.fail(405,message);
}
}else{
return Resp.fail(405,"返回格式有误:"+result);
}
return R.success("处理签收数据完成");
}
} }

12
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java

@ -3,13 +3,25 @@ package com.logpm.factory.mt.service.impl;
import com.logpm.factory.snm.entity.MtFactoryOrderMain; import com.logpm.factory.snm.entity.MtFactoryOrderMain;
import com.logpm.factory.mt.mapper.MtFactoryOrderMainMapper; import com.logpm.factory.mt.mapper.MtFactoryOrderMainMapper;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService; import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@Service @Service
public class MtFactoryOrderMainServiceImpl extends BaseServiceImpl<MtFactoryOrderMainMapper, MtFactoryOrderMain> implements IMtFactoryOrderMainService { public class MtFactoryOrderMainServiceImpl extends BaseServiceImpl<MtFactoryOrderMainMapper, MtFactoryOrderMain> implements IMtFactoryOrderMainService {
private final MtFactoryOrderMainMapper mtFactoryOrderMainMapper;
@Override
public List<MTOrderPackageRelationVO> mtOrderPackageRelation() {
return mtFactoryOrderMainMapper.mtOrderPackageRelation();
}
} }

1
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

@ -421,7 +421,6 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
// 增加订单 经销商信息 和门店信息 // 增加订单 经销商信息 和门店信息
buildDealerAndStore(distributionStockArticleEntity, advanceEntity); buildDealerAndStore(distributionStockArticleEntity, advanceEntity);
distributionStockArticleEntity.setCreateUser(1123598821738675201L); distributionStockArticleEntity.setCreateUser(1123598821738675201L);
id = distributionStockArticleClient.addData(distributionStockArticleEntity); id = distributionStockArticleClient.addData(distributionStockArticleEntity);

139
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java

@ -0,0 +1,139 @@
package com.logpm.factory.receiver;
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.logpm.factory.comfac.dto.OrderInfoDTO;
import com.logpm.factory.comfac.dto.UnloadCarDTO;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
import com.logpm.factory.snm.entity.MtFactoryOrderMain;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.feign.IAdvanceClient;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.core.tool.api.R;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 卸车完成处理队列
*/
@Slf4j
@RabbitListener(queues = RabbitConstant.UNLOAD_CAR_COM_INFO_QUEUE)
@Component
public class UnloadCarComHandler {
@Autowired
private IAdvanceDetailClient advanceDetailClient;
@Autowired
private IMtFactoryOrderMainService mtFactoryOrderMainService;
@Autowired
private IMtFactoryDataService mtFactoryDataService;
@RabbitHandler
public void unloadCarComDataHandler(Map map, Message message, Channel channel) {
/*
1.得到传递的车次
2. 需要判断这个车次是否市梦天的
3. 查询这个车次上的运单是否市梦天的
4.查询包间对应的梦天发给我们的批次号
*/
UnloadCarDTO unloadCarDTO = (UnloadCarDTO) map.get("messageData");
/*
2.通过车次查询来系统中车次绑定的运单
3.通过运单查询货物上的包件
4.需要过滤出来 只要梦天的
*/
List<AdvanceDetailEntity> carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum());
/**
* 安装品类进行分组
*/
Map<String, List<AdvanceDetailEntity>> carNumMapList = carNumList.stream().collect(Collectors.groupingBy(AdvanceDetailEntity::getType));
List<AdvanceDetailEntity> mtListdata = carNumMapList.get("梦天");
if (mtListdata == null || mtListdata.size() == 0) {
log.info("##################{} 车次 不存在梦天的数据 无需返回", unloadCarDTO.getUnloadCarNum());
return;
}
// 得到车次下面梦天的包条码集合
List<String> mtStrs = mtListdata.stream().map(AdvanceDetailEntity::getUnitNo).collect(Collectors.toList());
if (mtStrs == null || mtStrs.size() == 0) {
log.error("##################{} 车次 梦天的包条数据存在异常! 请联系管理员", unloadCarDTO.getUnloadCarNum());
return;
}
List<MTOrderPackageRelationVO> allMtData = mtFactoryOrderMainService.mtOrderPackageRelation();
// 对这个集合内进行分组
Map<String, List<MTOrderPackageRelationVO>> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode));
Set<String> set = stringListMap.keySet();
boolean isPush = false;
for (String s : set) {
// 得到某个工厂运输批次的集合
List<MTOrderPackageRelationVO> t = stringListMap.get(s);
//得到这个批次下面所有的包间
List<String> strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList());
// 当前批次的包间 在 这个配载计划中存在一个 则进行通知
for (String mtStr : mtStrs) {
if (strs.contains(mtStr)) {
isPush = true;
break;
}
}
if (isPush) {
break;
}
}
if (isPush) {
try {
Date data = new SimpleDateFormat().parse(unloadCarDTO.getCompleteDate());
R r = mtFactoryDataService.sendUnloadCarNum(unloadCarDTO.getUnloadCarNum(), data);
if(r.isSuccess()){
// 更新订单状态
UpdateChainWrapper<MtFactoryOrderMain> updateChainWrapper =new UpdateChainWrapper<MtFactoryOrderMain>(MtFactoryOrderMain.class);
updateChainWrapper.set("push_status","1");
updateChainWrapper.set("push_time",data);
updateChainWrapper.eq("invoice_order_code",unloadCarDTO.getUnloadCarNum());
mtFactoryOrderMainService.update(updateChainWrapper);
}
} catch (ParseException e) {
e.printStackTrace();
} catch (JsonProcessingException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
}
}

138
blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

@ -1,17 +1,133 @@
package com.logpm.factory; package com.logpm.factory;
//@ExtendWith(BladeSpringExtension.class) import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
//@BladeBootTest(appName = "logpm-factory", enableLoader = true) import com.fasterxml.jackson.core.JsonProcessingException;
import com.logpm.factory.comfac.controller.FactoryCommonController;
import com.logpm.factory.comfac.dto.UnloadCarDTO;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
import com.logpm.factory.mt.service.impl.MtFactoryDataServiceImpl;
import com.logpm.factory.snm.entity.MtFactoryOrderMain;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springblade.core.test.BladeBootTest;
import org.springblade.core.test.BladeSpringExtension;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@ExtendWith(BladeSpringExtension.class)
@BladeBootTest(appName = "logpm-factory-zhy", enableLoader = true)
public class TestService { public class TestService {
// @Autowired
// private MtFactoryDataServiceImpl mtFactoryDataService;
// @Test
// public void contextLoads() {
// @Autowired
// String tolk =mtFactoryDataService.getMtToken(); private IAdvanceDetailClient advanceDetailClient;
// System.out.println(tolk);
//
// } @Autowired
private IMtFactoryOrderMainService mtFactoryOrderMainService;
@Autowired
private IMtFactoryDataService mtFactoryDataService;
@Test
public void contextLoads() {
/*
1.得到传递的车次
2. 需要判断这个车次是否市梦天的
3. 查询这个车次上的运单是否市梦天的
4.查询包间对应的梦天发给我们的批次号
*/
UnloadCarDTO unloadCarDTO = new UnloadCarDTO();
unloadCarDTO.setUnloadCarNum("LQGX230719001");
unloadCarDTO.setCompleteDate("2023-07-19 16:48:45");
/*
2.通过车次查询来系统中车次绑定的运单
3.通过运单查询货物上的包件
4.需要过滤出来 只要梦天的
*/
List<AdvanceDetailEntity> carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum());
/**
* 安装品类进行分组
*/
Map<String, List<AdvanceDetailEntity>> carNumMapList = carNumList.stream().collect(Collectors.groupingBy(AdvanceDetailEntity::getType));
List<AdvanceDetailEntity> mtListdata = carNumMapList.get("梦天");
if (mtListdata == null || mtListdata.size() == 0) {
return;
}
// 得到车次下面梦天的包条码集合
List<String> mtStrs = mtListdata.stream().map(AdvanceDetailEntity::getUnitNo).collect(Collectors.toList());
if (mtStrs == null || mtStrs.size() == 0) {
return;
}
List<MTOrderPackageRelationVO> allMtData = mtFactoryOrderMainService.mtOrderPackageRelation();
// 对这个集合内进行分组
Map<String, List<MTOrderPackageRelationVO>> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode));
Set<String> set = stringListMap.keySet();
boolean isPush = false;
for (String s : set) {
// 得到某个工厂运输批次的集合
List<MTOrderPackageRelationVO> t = stringListMap.get(s);
//得到这个批次下面所有的包间
List<String> strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList());
// 当前批次的包间 在 这个配载计划中存在一个 则进行通知
for (String mtStr : mtStrs) {
if (strs.contains(mtStr)) {
isPush = true;
break;
}
}
if (isPush) {
break;
}
}
if (isPush) {
try {
Date data = new SimpleDateFormat().parse(unloadCarDTO.getCompleteDate());
R r = mtFactoryDataService.sendUnloadCarNum(unloadCarDTO.getUnloadCarNum(), data);
// 更新订单状态
UpdateChainWrapper<MtFactoryOrderMain> updateChainWrapper =new UpdateChainWrapper<MtFactoryOrderMain>(MtFactoryOrderMain.class);
updateChainWrapper.set("push_status","1");
updateChainWrapper.set("push_time",data);
updateChainWrapper.eq("invoice_order_code",unloadCarDTO.getUnloadCarNum());
mtFactoryOrderMainService.update(updateChainWrapper);
} catch (ParseException e) {
e.printStackTrace();
} catch (JsonProcessingException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
}
} }

2
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml

@ -164,7 +164,7 @@ FROM
ht_advance_detail ht_advance_detail
WHERE WHERE
id IN ( advance_id IN (
SELECT SELECT
advance_id advance_id
FROM FROM

24
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/WarehousingEntryDetailExcel.java

@ -55,18 +55,18 @@ public class WarehousingEntryDetailExcel implements Serializable {
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("门店名称") @ExcelProperty("门店名称")
private String storeName; private String storeName;
// /** /**
// * 订单单号 * 订单自编号
// */ */
// @ColumnWidth(20) @ColumnWidth(20)
// @ExcelProperty("订单单号") @ExcelProperty("订单自编号")
// private String orderNumber; private String orderNumber;
// /** /**
// * 运单号 * 运单号
// */ */
// @ColumnWidth(20) @ColumnWidth(20)
// @ExcelProperty("运单号") @ExcelProperty("品牌")
// private String waybillNumber; private String brandName;
/** /**
* 所在仓库 * 所在仓库
*/ */

22
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java

@ -24,8 +24,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basic.entity.BasicMaterialEntity; import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.feign.IBasicMaterialClient; import com.logpm.basic.feign.IBasicMaterialClient;
import com.logpm.basicdata.entity.BasicdataClientEntity; import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataStoreBrandEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataClientClient; import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataStoreBrandClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionStockListEntity; import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.feign.IDistributionStockListClient; import com.logpm.distribution.feign.IDistributionStockListClient;
@ -73,6 +75,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
private final IBasicMaterialClient basicMaterialClient; private final IBasicMaterialClient basicMaterialClient;
private final IBasicdataClientClient basicdataClientClient; private final IBasicdataClientClient basicdataClientClient;
private final IBasicdataWarehouseClient basicdataWarehouseClient; private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final IBasicdataStoreBrandClient basicdataStoreBrandClient;
@ -198,12 +201,12 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
} }
distributionStockListEntity.setUnpack(false); distributionStockListEntity.setUnpack(false);
// distributionStockListEntity.setStockArticleId(distributionParcelList.getStockArticleId()); //订单ID // distributionStockListEntity.setStockArticleId(distributionParcelList.getStockArticleId()); //订单ID
// distributionStockListEntity.setOrderSelfNumbering(distributionStockArticleEntity.getOrderSelfNumbering()); //订单自编号 distributionStockListEntity.setOrderSelfNumbering(warehousingEntryDTO.getOrderNumber()); //订单自编号
distributionStockListEntity.setIncomingBatch(warehousingEntryDTO.getReceiptBatch()); //入库批次号 distributionStockListEntity.setIncomingBatch(warehousingEntryDTO.getReceiptBatch()); //入库批次号
// distributionStockListEntity.setServiceNumber("服务号"); //服务号 // distributionStockListEntity.setServiceNumber("服务号"); //服务号
distributionStockListEntity.setDescriptionGoods(warehousingDetail.getProductName()); //货物名称 distributionStockListEntity.setDescriptionGoods(warehousingDetail.getProductName()); //货物名称
distributionStockListEntity.setCargoNumber(warehousingDetail.getPackagingNumber()); //货物编号 distributionStockListEntity.setCargoNumber(warehousingDetail.getProductCode()); //货物编号
distributionStockListEntity.setWarehouse(warehousingEntryDTO.getWarehouseId()); //仓库 distributionStockListEntity.setWarehouseId(warehousingEntryDTO.getWarehouseId()); //仓库ID
distributionStockListEntity.setMarketId(warehousingEntryDTO.getClientId()); //商场及客户 distributionStockListEntity.setMarketId(warehousingEntryDTO.getClientId()); //商场及客户
distributionStockListEntity.setCargoUnit(warehousingDetail.getProductUnit()); //货物单位 distributionStockListEntity.setCargoUnit(warehousingDetail.getProductUnit()); //货物单位
if(Func.isNotEmpty(warehousingEntryDTO.getStoreId())){ if(Func.isNotEmpty(warehousingEntryDTO.getStoreId())){
@ -227,8 +230,10 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
distributionStockListEntity.setMarketName(warehousingEntryDTO.getCustomerName());//商场名称 distributionStockListEntity.setMarketName(warehousingEntryDTO.getCustomerName());//商场名称
// distributionStockListEntity.setStoreCode(warehousingEntryDTO.getStore);//门店编码 // distributionStockListEntity.setStoreCode(warehousingEntryDTO.getStore);//门店编码
distributionStockListEntity.setStoreName(warehousingEntryDTO.getStoreName());//门店名称 distributionStockListEntity.setStoreName(warehousingEntryDTO.getStoreName());//门店名称
distributionStockListEntity.setBrandName(warehousingDetail.getBrandName());//品牌]名称
distributionStockListEntity.setBrandId(warehousingDetail.getBrandId());//品牌ID
// distributionStockListEntity.setFactory("工厂车次");//工厂车次 // distributionStockListEntity.setFactory("工厂车次");//工厂车次
distributionStockListEntity.setCategory("品分类");//品分类 // distributionStockListEntity.setCategory("品分类");//品分类
distributionStockListEntity.setMaterialId( warehousingDetail.getMaterialId());//货物ID distributionStockListEntity.setMaterialId( warehousingDetail.getMaterialId());//货物ID
// distributionStockListEntity.setStoreName("门店名称");//门店名称 // distributionStockListEntity.setStoreName("门店名称");//门店名称
// distributionStockListEntity.setParcelListId(distributionParcelList.getId());//包件id // distributionStockListEntity.setParcelListId(distributionParcelList.getId());//包件id
@ -338,6 +343,15 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
detail.setCreateInventory(i.getCreateInventory()); detail.setCreateInventory(i.getCreateInventory());
detail.setWarehousingEntryId(entryEntity.getId()); detail.setWarehousingEntryId(entryEntity.getId());
detail.setActualReceipt(0); detail.setActualReceipt(0);
//品牌
BasicdataStoreBrandEntity brandList = basicdataStoreBrandClient.getBrandList(entryEntity.getClientId(), i.getBrandName());
if(Func.isNotEmpty(brandList)){
detail.setBrandName(brandList.getBrandName());
detail.setBrandId(Long.parseLong(brandList.getBrandId()));
}else{
throw new ServiceException(i.getProductName()+i.getProductCode()+i.getSku()+"品牌信息不存在!!请维护客户品牌数据!!!");
}
BasicMaterialEntity materialOwn = basicMaterialClient.getMaterialOwn(i.getProductCode(), i.getProductName(), i.getSku()); BasicMaterialEntity materialOwn = basicMaterialClient.getMaterialOwn(i.getProductCode(), i.getProductName(), i.getSku());
if(Func.isNotEmpty(materialOwn)){ if(Func.isNotEmpty(materialOwn)){
detail.setMaterialId(materialOwn.getId());//物料ID detail.setMaterialId(materialOwn.getId());//物料ID

Loading…
Cancel
Save