Browse Source

1.增加商家端预入库扫码作业的功能

master
pref_mail@163.com 10 months ago
parent
commit
ab0af22f59
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 8
      blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java
  3. 7
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/dto/BusinessSanDTO.java
  4. 3
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java
  5. 28
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarDetalPackageVO.java
  6. 42
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarDetalVO.java
  7. 16
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarNumerPageQueryVO.java
  8. 34
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarNumerPageVO.java
  9. 35
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarOrderDetalVO.java
  10. 4
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineAdvanceDetailClient.java
  11. 34
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionBusinessPreOrderAppController.java
  12. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionSignforAppController.java
  13. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockListPDAController.java
  14. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/bean/Resp.java
  15. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/CustomMessageConverter.java
  16. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/GlobalExceptionHandler.java
  17. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java
  18. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/OrderStatusDTO.java
  19. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/excel/DistributionStockListInfoExcel.java
  20. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java
  21. 47
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml
  22. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml
  23. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  24. 25
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java
  25. 19
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  26. 28
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  27. 18
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  28. 12
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  29. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  30. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java
  31. 32
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java
  32. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java
  33. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java
  34. 414
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java
  35. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockArticleNewWrapper.java
  36. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockArticleWrapper.java
  37. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockWrapper.java
  38. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineAdvanceDetailClient.java
  39. 509
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java
  40. 15
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

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

@ -9,7 +9,7 @@ public interface ModuleNameConstant {
/**
* 如果不需要 ""
*/
public static final String DEVAUTH ="";
public static final String DEVAUTH ="-pref";
/**
* 工厂对接服务名称

8
blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java

@ -21,6 +21,14 @@ public class RedisKeyConstant {
public static final String BASIC_DATA_WAREHOUSE_LIST_KEY ="cache:basic-data-warehouse-list:";
public static final String USER_NAME_PHONE_KEY ="cache:user:id:";
public static final String FINAL_CLIENT_CODE ="final:client:code:";
/**
* 商家端预入库车次数量缓存
*/
public static final String BUSINESS_IN_CARNUMBER ="business:in:carnumber:";
/**
* 异常件数
*/
public static final String BUSINESS_INEXCE_CARNUMBER ="business:in:carnumber:";
}

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

@ -1,11 +1,18 @@
package com.logpm.business.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.bind.annotation.RequestParam;
@Data
public class BusinessSanDTO {
@ApiModelProperty(value = "配送车次")
private String distrCarNumber;
@ApiModelProperty(value = "包间码")
String orderPackageCode;
@ApiModelProperty(value = "预约单号")
String reservationCode;
@ApiModelProperty(value = "异常入库 0 正常 1 异常")
private Integer inWarehouseException;
}

3
blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java

@ -257,6 +257,9 @@ public class DistributionBusinessPreOrderEntity extends TenantEntity {
@ApiModelProperty(value = "操作状态 0 正常操作 1.补录操作")
private Integer operationStatus;
@ApiModelProperty(value = "发车时间")
private String taskTime;
// /**
// * 配送状态
// */

28
blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarDetalPackageVO.java

@ -0,0 +1,28 @@
package com.logpm.business.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DistributionBusinessPreCarDetalPackageVO {
@ApiModelProperty(value = "包条码")
private String orderPackageCode;
@ApiModelProperty(value = "一级品")
private String firsts;
@ApiModelProperty(value = "二级品")
private String second;
@ApiModelProperty(value = "三级品")
private String third_product;
@ApiModelProperty(value = "物料名称")
private String materialName;
@ApiModelProperty(value = "运单号")
private String waybillNumber;
@ApiModelProperty(value = "订单号")
private String orderCode;
@ApiModelProperty(value = "是否入库 0 没有入库 1 已入库")
private Integer inWarehouse;
@ApiModelProperty(value = "操作状态 0 正常操作 1.补录操作")
private Integer operationStatus;
}

42
blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarDetalVO.java

@ -0,0 +1,42 @@
package com.logpm.business.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class DistributionBusinessPreCarDetalVO {
@ApiModelProperty(value = "配送车次")
private String distrCarNumber;
@ApiModelProperty(value = "配送司机")
private String driverName;
@ApiModelProperty(value = "配送车辆")
private String vehicleName;
@ApiModelProperty(value = "配送日期")
private String taskTime;
@ApiModelProperty(value = "订单总数")
private Integer orderCount;
@ApiModelProperty(value = "计划件数")
private Integer orderPackageCodeCount;
@ApiModelProperty(value = "装车件数")
private Integer loadCarCount;
@ApiModelProperty(value = "入库件数")
private Integer inWarehouseCount;
@ApiModelProperty(value = "车次订单列表")
private List<DistributionBusinessPreCarOrderDetalVO> distributionBusinessPreCarOrderDetalVOList;
}

16
blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarNumerPageQueryVO.java

@ -0,0 +1,16 @@
package com.logpm.business.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DistributionBusinessPreCarNumerPageQueryVO {
@ApiModelProperty(value = "开始时间")
private String taskTimeStart;
@ApiModelProperty(value = "结束时间")
private String taskTimeEnd;
@ApiModelProperty(value = "订单号")
private String orderCode;
@ApiModelProperty(value = "配送车次号")
private String distrCarNumber;
}

34
blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarNumerPageVO.java

@ -0,0 +1,34 @@
package com.logpm.business.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DistributionBusinessPreCarNumerPageVO {
@ApiModelProperty(value = "配送车次")
private String distrCarNumber;
@ApiModelProperty(value = "配送司机")
private String driverName;
@ApiModelProperty(value = "配送车辆")
private String vehicleName;
@ApiModelProperty(value = "配送日期")
private String taskTime;
@ApiModelProperty(value = "订单总数")
private Integer orderCount;
@ApiModelProperty(value = "计划件数")
private Integer orderPackageCodeCount;
@ApiModelProperty(value = "装车件数")
private Integer loadCarCount;
@ApiModelProperty(value = "入库件数")
private Integer inWarehouseCount;
}

35
blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarOrderDetalVO.java

@ -0,0 +1,35 @@
package com.logpm.business.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class DistributionBusinessPreCarOrderDetalVO {
/**
* 订单自编号
*/
@ApiModelProperty(value = "订单自编号")
private String orderCode;
/**
* 运单号
*/
@ApiModelProperty(value = "运单号")
private String waybillNumber;
@ApiModelProperty(value = "计划件数")
private Integer orderPackageCodeCount;
@ApiModelProperty(value = "装车件数")
private Integer loadCarCount;
@ApiModelProperty(value = "入库件数")
private Integer inWarehouseCount;
@ApiModelProperty(value = "异常入库件数")
private Integer inWarehouseExceCount;
@ApiModelProperty(value = "包件列表")
private List<DistributionBusinessPreCarDetalPackageVO> distributionBusinessPreCarDetalPackageList;
}

4
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineAdvanceDetailClient.java

@ -4,8 +4,10 @@ import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO;
import org.springblade.common.constant.ModuleNameConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -21,4 +23,6 @@ public interface ITrunklineAdvanceDetailClient {
@PostMapping(API_PREFIX+"/findListByAdvanceIds")
List<TrunklineAdvanceDetailVO> findListByAdvanceIds(@RequestBody List<Long> collect);
@GetMapping(API_PREFIX+"/findEntityByOrderPackageCode")
TrunklineAdvanceDetailEntity findEntityByOrderPackageCode(@RequestParam String orderPackageCode);
}

34
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionBusinessPreOrderAppController.java

@ -1,20 +1,23 @@
package com.logpm.distribution.appcontroller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.business.dto.BusinessPreListDTO;
import com.logpm.business.dto.BusinessSanDTO;
import com.logpm.business.vo.DistributionBusinessPreOrderListVO;
import com.logpm.business.vo.DistributionBusinessPreOrderVO;
import com.logpm.business.vo.*;
import com.logpm.distribution.bean.Resp;
import com.logpm.distribution.service.IDistributionBusinessPreOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
@RestController
@ -25,7 +28,6 @@ public class DistributionBusinessPreOrderAppController {
private final IDistributionBusinessPreOrderService distributionBusinessPreOrderService;
@ResponseBody
@PostMapping("/list")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "模糊查询", notes = "传入trayTypeDTO")
@ -37,15 +39,14 @@ public class DistributionBusinessPreOrderAppController {
}
@ResponseBody
@PostMapping("/scanOrderPackageCode")
@ApiOperationSupport(order = 1)
public R scanOrderPackageCode(@RequestBody BusinessSanDTO businessSanDTO){
Resp resp = null;
try {
resp = distributionBusinessPreOrderService.inOrderWarehourse(businessSanDTO.getOrderPackageCode(),businessSanDTO.getReservationCode());
} catch (ExecutionException | InterruptedException e) {
resp = distributionBusinessPreOrderService.inOrderWarehourse(businessSanDTO);
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -54,4 +55,25 @@ public class DistributionBusinessPreOrderAppController {
@GetMapping("/listCarNum")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "条件查询", notes = "传入trayTypeDTO")
public R listCarNum(DistributionBusinessPreCarNumerPageQueryVO distributionBusinessPreCarNumerPageQueryVO, Query query){
IPage<DistributionBusinessPreCarNumerPageVO> data =distributionBusinessPreOrderService.listCarNum(Condition.getPage(query),distributionBusinessPreCarNumerPageQueryVO);
return R.data(data);
}
@GetMapping("/preCarInfoDetailByCarNum")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "条件查询", notes = "传入trayTypeDTO")
public R preCarInfoDetailByCarNum(DistributionBusinessPreCarNumerPageQueryVO distributionBusinessPreCarNumerPageQueryVO){
DistributionBusinessPreCarDetalVO distributionBusinessPreCarDetalVO =distributionBusinessPreOrderService.preCarInfoDetailByCarNumber(distributionBusinessPreCarNumerPageQueryVO);
return R.data(distributionBusinessPreCarDetalVO);
}
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionSignforAppController.java

@ -245,7 +245,7 @@ public class DistributionSignforAppController {
String orderPackageCodes = null;
for (String packageCode : packageCodes) {
if (StringUtils.isBlank(orderPackageCodes)) {
orderPackageCodes = packageCode + "";
orderPackageCodes = packageCode;
} else {
orderPackageCodes = orderPackageCodes + "," + packageCode;
}

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockListPDAController.java

@ -35,8 +35,7 @@ public class DistributionStockListPDAController {
IDistributionStockListService distributionStockListService = SpringUtil.getBean(IDistributionStockListService.class);
List<DistributionMerchantStockListVO> stockListEntityList =distributionStockListService.getMerchantStockList(materielCode);
return R.data(stockListEntityList);
};
}
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/bean/Resp.java

@ -12,6 +12,7 @@ public class Resp extends R {
Resp resp = new Resp();
resp.setCode(200);
resp.setMsg(msg);
resp.setSuccess(true);
resp.setAudio(audio);
return resp;
}
@ -20,6 +21,7 @@ public class Resp extends R {
Resp resp = new Resp();
resp.setCode(200);
resp.setMsg(msg);
resp.setSuccess(true);
resp.setData(data);
resp.setAudio(audio);
return resp;

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/CustomMessageConverter.java

@ -36,7 +36,7 @@ import java.util.Map;
@Component
public class CustomMessageConverter extends AllowedListDeserializingMessageConverter implements BeanClassLoaderAware {
private volatile String defaultCharset = "UTF-8";
private final String defaultCharset = "UTF-8";
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
private String codebaseUrl;
@ -119,7 +119,7 @@ public class CustomMessageConverter extends AllowedListDeserializingMessageConve
messageProperties.setContentType("application/x-java-serialized-object");
}
HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext");
HttpHeaders headers = ThreadLocalUtil.get("bladeContext");
if (headers != null && !headers.isEmpty()) {
headers.forEach((key, values) -> {
values.forEach((value) -> {
@ -136,7 +136,7 @@ public class CustomMessageConverter extends AllowedListDeserializingMessageConve
messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser));
if (bytes != null) {
messageProperties.setContentLength((long) bytes.length);
messageProperties.setContentLength(bytes.length);
return new Message(bytes, messageProperties);
} else {
throw new IllegalArgumentException(this.getClass().getSimpleName() + " only supports String, byte[] and Serializable payloads, received: " + object.getClass().getName());

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/GlobalExceptionHandler.java

@ -10,13 +10,13 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
// @ExceptionHandler(Exception.class)
public ResponseEntity<Object> handleCustomException(Exception e) {
// 从CustomException中获取errorCode和errorMessage
String errorMessage = e.getMessage();
// 创建一个自定义的响应体来封装错误信息
if(errorMessage.contains("Communications link failure")){
if(errorMessage!=null&&errorMessage.contains("Communications link failure")){
// 返回带有错误信息的HTTP响应
return new ResponseEntity<>(R.fail(405,"请求超时,请重试"), HttpStatus.BAD_REQUEST);
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java

@ -307,7 +307,7 @@ public class DistributionSignforController extends BladeController {
String orderPackageCodes = null;
for (String packageCode : packageCodes) {
if(StringUtils.isBlank(orderPackageCodes)){
orderPackageCodes = packageCode+"";
orderPackageCodes = packageCode;
}else{
orderPackageCodes = orderPackageCodes + "," +packageCode;
}

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/OrderStatusDTO.java

@ -104,11 +104,8 @@ public class OrderStatusDTO implements Serializable {
if(StringUtil.isBlank(status)){
return false;
}
if(StringUtil.isBlank(distributionContactId)){
return false;
}
return true;
}
return !StringUtil.isBlank(distributionContactId);
}
}

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/excel/DistributionStockListInfoExcel.java

@ -137,8 +137,7 @@ public class DistributionStockListInfoExcel implements Serializable {
@ColumnWidth(20)
@ExcelProperty("服务类型")
private String serviceTypeName;
;
/**
/**
* 品牌名称
*/
@ColumnWidth(20)

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java

@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.business.dto.BusinessPreListDTO;
import com.logpm.business.entity.DistributionBusinessPreOrderEntity;
import com.logpm.business.vo.DistributionBusinessPreCarNumberVO;
import com.logpm.business.vo.DistributionBusinessPreCarNumerPageQueryVO;
import com.logpm.business.vo.DistributionBusinessPreCarNumerPageVO;
import com.logpm.business.vo.DistributionBusinessPreOrderVO;
import com.logpm.distribution.dto.DistributionBusinessPreOrderDTO;
import org.apache.ibatis.annotations.Param;
@ -60,4 +62,9 @@ public interface DistributionBusinessPreOrderMapper extends BaseMapper<Distribut
Integer updateBusinessPreOrderByOrderPackageCode(@Param("orderPackageCode") String orderPackageCode);
IPage<DistributionBusinessPreCarNumberVO> pageByCarNum(IPage<DistributionBusinessPreCarNumberVO> page, Map<String, Object> distributionBusinessPreOrderDTO);
IPage<DistributionBusinessPreCarNumerPageVO> listCarNum(IPage<Object> page, DistributionBusinessPreCarNumerPageQueryVO distributionBusinessPreCarNumerPageQueryVO);
DistributionBusinessPreCarNumerPageVO listCarInforByCarNum(@Param("distributionBusinessPreCarNumerPageQueryVO") DistributionBusinessPreCarNumerPageQueryVO distributionBusinessPreCarNumerPageQueryVO);
}

47
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml

@ -183,5 +183,52 @@
waybill_number,
order_code
</select>
<select id="listCarNum" resultType="com.logpm.business.vo.DistributionBusinessPreCarNumerPageVO">
SELECT
distr_car_number,
vehicle_name,
driver_name,
task_time,
COUNT(DISTINCT order_code) as orderCount,
COUNT(DISTINCT order_package_code) as orderPackageCodeCount,
sum(case when order_package_loading_status =20 then 1 else 0 end ) as loadCarCount,
sum(case when in_warehouse =1 then 1 else 0 end ) as inWarehouseCount
from logpm_business_pre_order
<where>
is_deleted=0
<if test="distributionBusinessPreCarNumerPageQueryVO.taskTimeStart!=null ">
and task_time &gt;= #{distributionBusinessPreCarNumerPageQueryVO.taskTimeStart}
</if>
<if test="distributionBusinessPreCarNumerPageQueryVO.taskTimeEnd!=null ">
and task_time &lt; #{distributionBusinessPreCarNumerPageQueryVO.taskTimeEnd}
</if>
<if test="distributionBusinessPreCarNumerPageQueryVO.distrCarNumber!=null ">
and distr_car_number =#{distributionBusinessPreCarNumerPageQueryVO.distrCarNumber}
</if>
</where>
GROUP BY distr_car_number,vehicle_name,driver_name,task_time
</select>
<select id="listCarInforByCarNum" resultType="com.logpm.business.vo.DistributionBusinessPreCarNumerPageVO">
SELECT
distr_car_number,
vehicle_name,
driver_name,
task_time,
COUNT(DISTINCT order_code) as orderCount,
COUNT(DISTINCT order_package_code) as orderPackageCodeCount,
sum(case when order_package_loading_status =20 then 1 else 0 end ) as loadCarCount,
sum(case when in_warehouse =1 then 1 else 0 end ) as inWarehouseCount
from logpm_business_pre_order
<where>
is_deleted=0
<if test="distributionBusinessPreCarNumerPageQueryVO.distrCarNumber!=null ">
and distr_car_number =#{distributionBusinessPreCarNumerPageQueryVO.distrCarNumber}
</if>
</where>
GROUP BY distr_car_number,vehicle_name,driver_name,task_time
</select>
</mapper>

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml

@ -798,7 +798,7 @@ FROM
logpm_distribution_stockup_info AS ldsi
LEFT JOIN logpm_distribution_stockup AS ldss ON ldsi.stockup_id = ldss.id
WHERE
ldsi.reservation_id = lds.reservation_id and
ldsi.reservation_id = lds.reservation_id
AND ldsi.stock_status != '4'
) AS forkliftName,
CASE

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml

@ -2038,7 +2038,7 @@
LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldrp.stock_article_id = ldrs.stock_article_id and ldrp.reservation_id = ldr.id
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldrp.parce_list_id and ldpl.stock_article_id = ldsa.id
WHERE
lddl.id=#{deliveryId} AND ldrp.packet_bar_status in ('1','3') AND ldrs.is_zero = 0 AND ldpl.order_package_code = #{orderPackageCode} AND ldr.reservation_status != 40
lddl.id=#{deliveryId} AND ldrp.packet_bar_status in ('1','3') AND ldrs.is_zero = 0 AND ldpl.order_package_code = #{orderPackageCode} AND ldr.reservation_status != 4
</select>
<select id="selectRetentionZeroPackage" resultType="com.logpm.distribution.vo.DistributionRetentionScanVo">

25
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java

@ -2,10 +2,9 @@ package com.logpm.distribution.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.business.dto.BusinessPreListDTO;
import com.logpm.business.dto.BusinessSanDTO;
import com.logpm.business.entity.DistributionBusinessPreOrderEntity;
import com.logpm.business.vo.DistributionBusinessPreCarNumberVO;
import com.logpm.business.vo.DistributionBusinessPreOrderListVO;
import com.logpm.business.vo.DistributionBusinessPreOrderVO;
import com.logpm.business.vo.*;
import com.logpm.distribution.bean.Resp;
import com.logpm.distribution.entity.DistributionBillLadingScanEntity;
import org.springblade.common.exception.CustomerException;
@ -51,8 +50,26 @@ public interface IDistributionBusinessPreOrderService extends BaseService<Distri
Integer deleteBusinessPreOrder(String k, List<String> deletedPackageList);
DistributionBusinessPreOrderListVO list(BusinessPreListDTO queryrderDTO);
Resp inOrderWarehourse(String orderPackageCode,String reservationCode) throws ExecutionException, InterruptedException;
/**
* PDA 扫码入库
* @param businessSanDTO
* @return
* @throws ExecutionException
* @throws InterruptedException
*/
Resp inOrderWarehourse(BusinessSanDTO businessSanDTO) ;
DistributionBusinessPreCarDetalVO preCarInfoDetailByCarNumber(DistributionBusinessPreCarNumerPageQueryVO queryVO);
IPage<DistributionBusinessPreCarNumberVO> pageByCarNum(Map<String, Object> distributionBusinessPreOrderDTO, IPage<DistributionBusinessPreCarNumberVO> page);
/**
* 分页查询配送车次
* @param page
* @return
*/
IPage<DistributionBusinessPreCarNumerPageVO> listCarNum(IPage<Object> page, DistributionBusinessPreCarNumerPageQueryVO distributionBusinessPreCarNumerPageQueryVO);
}

19
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -2848,12 +2848,8 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
queryWrapper1.eq("reservation_id", reservationId);
}
DistributionStockEntity stockEntity = distributionStockService.selectOne(queryWrapper1);
if (ObjectUtils.isNull(stockEntity)) {
//没有扫
return true;
} else {
return false;
}
//没有扫
return ObjectUtils.isNull(stockEntity);
}
@ -2877,11 +2873,8 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
queryWrapper1.eq("reservation_id", reservationId);
}
List<DistributionStockEntity> stockEntityList = distributionStockService.selectList(queryWrapper1);
if (!stockEntityList.isEmpty() && stockEntityList.size() >= num) {
return true; //已完成
} else {
return false; //未完成
}
//未完成
return !stockEntityList.isEmpty() && stockEntityList.size() >= num; //已完成
}
@ -3112,7 +3105,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
continue;
}
MtReceiveContentDTO mtReceiveContentDTO = new MtReceiveContentDTO();
mtReceiveContentDTO.setWarehouse(orderInfo.get(0).getWarehouse() + "");
mtReceiveContentDTO.setWarehouse(orderInfo.get(0).getWarehouse());
mtReceiveContentDTO.setOrderCode(orderInfo.get(0).getOrderCode());
mtReceiveContentDTO.setUnitNo(ladingScanEntity.getPacketBarCode());
mtReceiveContentDTO.setOperateDate(simpleDateFormat.format(ladingScanEntity.getCreateTime()));
@ -3272,7 +3265,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
if (!ladingScanEntities.isEmpty()) {
for (DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities) {
MtReceiveContentDTO mtReceiveContentDTO = new MtReceiveContentDTO();
mtReceiveContentDTO.setWarehouse(stockArticleEntity.getWarehouse() + "");
mtReceiveContentDTO.setWarehouse(stockArticleEntity.getWarehouse());
mtReceiveContentDTO.setOrderCode(stockArticleEntity.getOrderCode());
mtReceiveContentDTO.setUnitNo(ladingScanEntity.getPacketBarCode());
mtReceiveContentDTO.setOperateDate(simpleDateFormat.format(ladingScanEntity.getCreateTime()));

28
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -85,6 +85,7 @@ import org.springblade.common.constant.stockup.StockAssignStatusConstant;
import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.serviceConstant.ServiceConstant;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.QRCodeUtil;
import org.springblade.common.utils.StringSplitUtil;
import org.springblade.common.utils.TemplateUtil;
@ -2982,10 +2983,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
throw new RuntimeException(s.getOrderCode() + "正在操作,请刷新后尝试");
} else {
packageLockIds.addAll(a);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(), packageLockIds, 1 * 60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(), packageLockIds, 60L);
}
} else {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(), packageLockIds, 1 * 60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(), packageLockIds, 60L);
}
}
});
@ -3596,8 +3597,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
this.updateById(deliveryListEntity);
// 执行发送推送
distributionReservationService.createBusinessPreConversionQueue(deliveryListEntity.getId());
// // 执行发送推送
// distributionReservationService.createBusinessPreConversionQueue(deliveryListEntity.getId());
trunklinePackageTrackLogClient.addPackageTrackLog(logs);
return R.status(true);
@ -4557,6 +4558,21 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionAsyncService.sendTrunkineLog(distributionDeliveryListEntity.getId(), null, AuthUtil.getUser(), warehouseClient.getMyCurrentWarehouse(), 1);
Map mapState = new HashMap();
mapState.put("messageId", CommonUtil.getUUID());
mapState.put("messageData", distributionDeliveryListEntity.getId());
mapState.put("createTime", System.currentTimeMillis());
try {
rabbitTemplate.convertAndSend(RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_EXCHANGE, RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_ROUTING, mapState, message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
} catch (Exception customerException) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", customerException);
}
// 推送数据
return Resp.scanFail("发车成功", builder.toString());
}
@ -6983,9 +6999,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
);
if (Func.isNotEmpty(loadscanEntityList)) {
Map<Long, DistributionLoadscanEntity> loadingOrderMap = loadscanEntityList.stream().collect(Collectors.toMap(DistributionLoadscanEntity::getOrderId, Function.identity(), (k1, k2) -> k2));
if (Func.isNotEmpty(loadingOrderMap.get(orderId))) {
return false;
}
return !Func.isNotEmpty(loadingOrderMap.get(orderId));
}
return true;
}

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

@ -1302,7 +1302,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
}
}
if (Func.isNotEmpty(builder)){
throw new RuntimeException(builder.toString()+"该预约单已进行配送请核对");
throw new RuntimeException(builder +"该预约单已进行配送请核对");
}
Long deliveryListId = distributionDeliveryListEntity.getId();
//操作司机信息
@ -1657,7 +1657,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
int indexOf = ids.indexOf(parcelListEntity.getId());
if (indexOf>0){
ids.remove(indexOf);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + parcelListEntity.getOrderCode(),ids,1*60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + parcelListEntity.getOrderCode(),ids, 60L);
}
}
});
@ -1765,10 +1765,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
throw new RuntimeException(v.get(0).getOrderCode()+"正在操作,请刷新后尝试");
}else {
packageLockIds.addAll(a);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + v.get(0).getOrderCode(),packageLockIds,1*60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + v.get(0).getOrderCode(),packageLockIds, 60L);
}
}else {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + v.get(0).getOrderCode(),packageLockIds,1*60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + v.get(0).getOrderCode(),packageLockIds, 60L);
}
}
});
@ -2295,11 +2295,11 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
throw new RuntimeException(s.getOrderCode()+"正在操作,请刷新后尝试");
}else {
packageLockIds.addAll(a);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(),packageLockIds,1*60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(),packageLockIds, 60L);
}
}else {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(),packageLockIds,1*60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(),packageLockIds, 60L);
}
}
});
@ -2448,7 +2448,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
}
// 创建处理商场信息队列
createBusinessPreConversionQueue(distributionDeliveryListEntity.getId());
//createBusinessPreConversionQueue(distributionDeliveryListEntity.getId());
return R.status(true);
}
@ -3110,10 +3110,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
throw new RuntimeException(s.getOrderCode()+"正在操作,请刷新后尝试");
}else {
packageLockIds.addAll(a);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + s.getOrderCode(),packageLockIds,1*60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + s.getOrderCode(),packageLockIds, 60L);
}
}else {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + s.getOrderCode(),packageLockIds,1*60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + s.getOrderCode(),packageLockIds, 60L);
}
}

12
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -2926,17 +2926,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
case "1":
//商配
// if (stockArticleEntity.getConsigneeUnit().equals(distributionReservationEntity.getReceivingUnit()) && stockArticleEntity.getConsigneePerson().equals(distributionReservationEntity.getConsignee()) && stockArticleEntity.getMallName().equals(distributionReservationEntity.getMallName())){
if (stockArticleEntity.getConsigneeUnit().equals(distributionReservationEntity.getReceivingUnit())) {
return true;
} else {
return false;
}
return stockArticleEntity.getConsigneeUnit().equals(distributionReservationEntity.getReceivingUnit());
case "2":
if (stockArticleEntity.getCustomerName().equals(distributionReservationEntity.getConsignee()) && stockArticleEntity.getCustomerAddress().equals(distributionReservationEntity.getDeliveryAddress()) && stockArticleEntity.getCustomerTelephone().equals(distributionReservationEntity.getDeliveryPhone())) {
return true;
} else {
return false;
}
return stockArticleEntity.getCustomerName().equals(distributionReservationEntity.getConsignee()) && stockArticleEntity.getCustomerAddress().equals(distributionReservationEntity.getDeliveryAddress()) && stockArticleEntity.getCustomerTelephone().equals(distributionReservationEntity.getDeliveryPhone());
default:
log.info("未知的配送类型 distributionReservationEntity.getDeliveryType() ={}", distributionReservationEntity.getDeliveryType());
//市配

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

@ -1082,8 +1082,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
queryOrderVO = this.queryOrderVOCont(queryrderDTO.getCondition(), 2);
break;
}
;
return queryOrderVO;
return queryOrderVO;
}
@Override
@ -1136,8 +1135,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
break;
}
;
return arrayList;
return arrayList;
}
@Override
@ -1379,7 +1377,8 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
if (Objects.isNull(stockArticleEntity)) {
log.warn("##############updateOrderInfoByDistributionStockArticleEntity: 订单信息不存在 orderCode={} warehouseId={}", stockArticleEntity.getOrderCode(), stockArticleEntity.getWarehouseId());
throw new CustomerException(405, "订单信息不存在");
// throw new CustomerException(405, "订单信息不存在");
return;
}
String isZero = stockArticleEntity.getIsZero();
@ -1548,6 +1547,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
@Override
public void updateOrderInfo(String orderCode, Long warehouseId) {
DistributionStockArticleEntity stockArticleEntity = findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId);
updateOrderInfoByDistributionStockArticleEntity(stockArticleEntity);
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java

@ -332,7 +332,7 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl<Distributi
basicMaterialEntity.setProductCode(one.getCargoNumber()+"-"+a);
basicMaterialEntity.setPackingSpecification(distributionStockListDTO.getCargoNorms());
basicMaterialEntity.setSku(distributionStockListDTO.getSku());
basicMaterialEntity.setPackageNum(distributionStockListDTO.getPackageNum() + "");
basicMaterialEntity.setPackageNum(distributionStockListDTO.getPackageNum());
basicMaterialEntity.setLogpmUnit(distributionStockListDTO.getCargoUnit());
basicMaterialEntity.setSpecification(distributionStockListDTO.getCargoNorms());
basicMaterialEntity.setExtent("0");

32
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java

@ -345,7 +345,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
);
if (!list.isEmpty()) {
int sum = list.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum();
nu.set((int) (nu.get() + sum));
nu.set(nu.get() + sum);
b.set(true);
}
@ -847,11 +847,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
if (ObjectUtils.isNotNull(wu.getStockArticleId()) && !wu.getStockArticleId().contains(i.getStockArticleId())) {
wu.setStockArticleId(wu.getStockArticleId() + "," + i.getStockArticleId());
}
if (wu.getPlanNum().equals(wu.getScanNum())) {
wu.setCompleteStact(true);
} else {
wu.setCompleteStact(false);
}
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum()));
}
});
} else {
@ -907,11 +903,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
if (ObjectUtils.isNotNull(wu.getStockArticleId()) && ObjectUtils.isNotNull(wu.getStockArticleId()) && !wu.getStockArticleId().contains(i.getStockArticleId())) {
wu.setStockArticleId(wu.getStockArticleId() + "," + i.getStockArticleId());
}
if (wu.getPlanNum().equals(wu.getScanNum())) {
wu.setCompleteStact(true);
} else {
wu.setCompleteStact(false);
}
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum()));
}
});
} else {
@ -993,11 +985,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
if (ObjectUtils.isNotNull(y.getStockArticleId()) && !y.getStockArticleId().contains(p.getStockArticleId())) {
y.setStockArticleId(y.getStockArticleId() + "," + p.getStockArticleId());
}
if (y.getPlanNum().equals(y.getScanNum())) {
y.setCompleteStact(true);
} else {
y.setCompleteStact(false);
}
y.setCompleteStact(y.getPlanNum().equals(y.getScanNum()));
}
});
@ -1081,11 +1069,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
if (ObjectUtils.isNotNull(y.getStockArticleId()) && !y.getStockArticleId().contains(p.getStockArticleId())) {
y.setStockArticleId(y.getStockArticleId() + "," + p.getStockArticleId());
}
if (y.getPlanNum().equals(y.getScanNum())) {
y.setCompleteStact(true);
} else {
y.setCompleteStact(false);
}
y.setCompleteStact(y.getPlanNum().equals(y.getScanNum()));
}
});
} else {
@ -1147,11 +1131,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
if (ObjectUtils.isNotNull(wu.getStockArticleId()) && !wu.getStockArticleId().contains(i.getStockArticleId())) {
wu.setStockArticleId(wu.getStockArticleId() + "," + i.getStockArticleId());
}
if (wu.getPlanNum().equals(wu.getScanNum())) {
wu.setCompleteStact(true);
} else {
wu.setCompleteStact(false);
}
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum()));
}
});
} else {

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -2190,11 +2190,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
int count = (int) list1.stream().filter(ii -> "1".equals(ii.getGenre().toString())).count();
int count1 = (int) list1.stream().filter(ii -> "2".equals(ii.getGenre().toString())).count();
int count2 = (int) list1.stream().filter(ii -> "3".equals(ii.getGenre().toString())).count();
if (count1 >= 1 && count >= 1 && count2 >= 1) {
i.setPrintState(true);
} else {
i.setPrintState(false);
}
i.setPrintState(count1 >= 1 && count >= 1 && count2 >= 1);
}
} else {
@ -2217,7 +2213,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
// 用户勾选数据的ids
String ids = (String) param.get("ids");
List<Long> idArr = null;
if (null != ids && !ids.toString().isEmpty()) {
if (null != ids && !ids.isEmpty()) {
idArr = Func.toLongList(ids);
}
@ -3129,7 +3125,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//修改包件状态
distributionAsyncService.getSelfPickup(distributionParcelListEntity.getId());
distributionBillLadingScan.setParcelListId(distributionParcelListEntity.getId());
distributionBillLadingScan.setPacketBarCode(String.valueOf(coding));
distributionBillLadingScan.setPacketBarCode(coding);
//订单
distributionBillLadingScan.setStockArticleId(one.getId());
distributionBillLadingScan.setQuantity(1);

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java

@ -264,10 +264,7 @@ public class DistrilbutionBillStockServiceImpl extends BaseServiceImpl<Distrilbu
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId)
.eq(DistributionBillLadingScanEntity::getStockArticleId, orderId)
);
if (ladingScanEntities.isEmpty()) {
return true;
}
return false;
}
return ladingScanEntities.isEmpty();
}
}

414
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java

@ -8,10 +8,9 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.business.dto.BusinessPreListDTO;
import com.logpm.business.dto.BusinessSanDTO;
import com.logpm.business.entity.DistributionBusinessPreOrderEntity;
import com.logpm.business.vo.DistributionBusinessPreCarNumberVO;
import com.logpm.business.vo.DistributionBusinessPreOrderListVO;
import com.logpm.business.vo.DistributionBusinessPreOrderVO;
import com.logpm.business.vo.*;
import com.logpm.distribution.bean.Resp;
import com.logpm.distribution.dto.DistributionBusinessPreOrderDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
@ -21,20 +20,25 @@ import com.logpm.distribution.service.IDistributionBusinessPreOrderService;
import com.logpm.distribution.service.IDistributionParcelListService;
import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.trunkline.dto.InComingDTO;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.feign.IInComingClient;
import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient;
import lombok.AllArgsConstructor;
import org.jetbrains.annotations.Nullable;
import org.springblade.common.annotations.ChangeAsync;
import org.springblade.common.constant.IncomingTypeEnum;
import org.springblade.common.constant.RedisKeyConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -49,6 +53,9 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
private final IInComingClient inComingClient;
private final ITrunklineAdvanceDetailClient trunklineAdvanceDetailClient;
private final BladeRedis bladeRedis;
@Override
public Boolean inOrder(String ids) throws ServiceException {
@ -57,49 +64,43 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
QueryWrapper wrapper = new QueryWrapper();
wrapper.in("id", idArray);
InComingDTO inComingDTO = new InComingDTO();
StringBuffer sb = new StringBuffer();
List<DistributionBusinessPreOrderEntity> list = baseMapper.selectList(wrapper);
List<DistributionBusinessPreOrderEntity> data = new ArrayList<>();
List<DistributionBusinessPreOrderEntity> data = new ArrayList<>();
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list) {
if (distributionBusinessPreOrderEntity.getInWarehouse() == 1) {
throw new ServiceException("存在已入库的包件");
}
if(!sb.toString().isEmpty()){
if (!sb.toString().isEmpty()) {
sb.append(",");
}
sb.append(distributionBusinessPreOrderEntity.getOrderPackageCode());
data.add(distributionBusinessPreOrderEntity);
}
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
inComingDTO.setOrderPackageCode(sb.toString());
inComingDTO.setIncomingType(IncomingTypeEnum.LINE_INCOMING.getCode());
inComingDTO.setWarehouseId(myCurrentWarehouse.getId());
inComingDTO.setWarehouseName(myCurrentWarehouse.getName());
R r = inComingClient.incomingPackage(inComingDTO);
if(r.isSuccess()){
R r = inOrderWarehourse(sb.toString());
if (r.isSuccess()) {
// 更新成功
// 更新入库状态
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : data) {
distributionBusinessPreOrderEntity.setInWarehouse(1);
baseMapper.updateById(distributionBusinessPreOrderEntity);
Object o = bladeRedis.get(RedisKeyConstant.BUSINESS_IN_CARNUMBER + distributionBusinessPreOrderEntity.getDistrCarNumber());
if (!Objects.isNull(o)) {
bladeRedis.set(RedisKeyConstant.BUSINESS_IN_CARNUMBER + distributionBusinessPreOrderEntity.getDistrCarNumber(), null);
}
}
}
return true;
}
@Override
public Integer inOrderByOrderPackageCode(String orderPackageCode,String carNum) {
public Integer inOrderByOrderPackageCode(String orderPackageCode, String carNum) {
// int a =baseMapper.updateBusinessPreOrderByOrderPackageCode(orderPackageCode);
@ -109,9 +110,9 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("order_package_code", orderPackageCode);
// wrapper.eq("in_warehouse",0);
wrapper.eq("is_deleted","0");
wrapper.eq("is_deleted", "0");
List<DistributionBusinessPreOrderEntity> list = baseMapper.selectList(wrapper);
if(!list.isEmpty()){
if (!list.isEmpty()) {
DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity = list.get(0);
distributionBusinessPreOrderEntity.setInWarehouse(1);
@ -156,7 +157,7 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
List<DistributionBusinessPreOrderVO> result = new ArrayList<>();
for (DistributionBusinessPreOrderEntity datum : data) {
if(datum.getInWarehouse() .equals(queryrderDTO.getInWarehouse()) ){
if (datum.getInWarehouse().equals(queryrderDTO.getInWarehouse())) {
DistributionBusinessPreOrderVO copy = BeanUtil.copy(datum, DistributionBusinessPreOrderVO.class);
result.add(copy);
}
@ -172,144 +173,271 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
}
private R inOrderWarehourse(String orderPackageCode) {
InComingDTO inComingDTO = new InComingDTO();
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
inComingDTO.setOrderPackageCode(orderPackageCode);
inComingDTO.setIncomingType(IncomingTypeEnum.LINE_INCOMING.getCode());
inComingDTO.setWarehouseId(myCurrentWarehouse.getId());
inComingDTO.setWarehouseName(myCurrentWarehouse.getName());
R r = inComingClient.incomingPackage(inComingDTO);
return r;
}
@Override
public Resp inOrderWarehourse(String orderPackageCode, String reservationCode) {
public Resp inOrderWarehourse(BusinessSanDTO businessSanDTO) {
// // 查询当前预约单所有的包件
//
// LambdaQueryWrapper<DistributionBusinessPreOrderEntity> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(DistributionBusinessPreOrderEntity::getReservationCode, reservationCode);
// List<DistributionBusinessPreOrderEntity> list = baseMapper.selectList(queryWrapper);
//
// // 寻找 当前匹配的包条
// DistributionBusinessPreOrderEntity t = null;
// DistributionBusinessPreOrderEntity t1 = null;
// for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list) {
// if (distributionBusinessPreOrderEntity.getOrderPackageCode().equals(orderPackageCode)) {
// // 找到匹配的包条码
// if (distributionBusinessPreOrderEntity.getInWarehouse() == 1) {
// return Resp.scanSuccess("扫描成功", "包件已入库");
// } else {
// t = distributionBusinessPreOrderEntity;
// }
// }
// if (t1 == null) {
// t1 = distributionBusinessPreOrderEntity;
// }
// }
// if (t == null) {
// try {
// DistributionBusinessPreOrderEntity finalT = t1;
// CompletableFuture<DistributionParcelListEntity> distributionParcelListEntityCompletableFuture = CompletableFuture.supplyAsync(() -> this.selectByOrderPackageCode(orderPackageCode, finalT.getAcceptWarehouseId()));
//
// DistributionParcelListEntity distributionParcelListEntity = distributionParcelListEntityCompletableFuture.get();
//
// // 如找到了 保存在当前的这个配送计划任务中
// if (distributionParcelListEntity != null) {
// // 保存包件
// t = BeanUtil.copy(distributionParcelListEntity, DistributionBusinessPreOrderEntity.class);
// t.setDriverName(finalT.getDriverName());
// t.setVehicleName(finalT.getVehicleName());
// t.setDistrCarNumber(finalT.getTrainNumber());
// t.setOperationStatus(1);
// t.setInWarehouse(0);
// this.save(t);
// list.add(t);
//
// }
// } catch (InterruptedException | ExecutionException e) {
// log.error("inOrderWarehourse:", e);
// throw new ServiceException("包件信息不存在!");
// }
//
//
// }
//
// // 保存订单
// DistributionStockArticleEntity stockArticleEntity = buildDistributionStockArticleEntity(t);
// if (stockArticleEntity == null) {
// return Resp.scanFail("操作失败", "包件数据不存在");
// }
// // 保存包件
// t.setWarehouseId(stockArticleEntity.getWarehouseId());
// t.setWarehouse(stockArticleEntity.getWarehouse());
// t.setStockArticleId(stockArticleEntity.getId());
// buildDistributionParcelListEntity(t);
//
// // 调用入库方法
// t.setInWarehouse(1);
// baseMapper.updateById(t);
//
// queryWrapper.eq(DistributionBusinessPreOrderEntity::getInWarehouse, 1);
// Long l = baseMapper.selectCount(queryWrapper);
try {
String orderPackageCode = businessSanDTO.getOrderPackageCode();
String distrCarNumber = businessSanDTO.getDistrCarNumber();
if (Func.isAllEmpty(orderPackageCode, distrCarNumber, businessSanDTO.getInWarehouseException())) {
return Resp.scanFail("扫描失败", "没有包件或者车次");
}
// 查询配送车次下面所有的包件
LambdaQueryWrapper<DistributionBusinessPreOrderEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DistributionBusinessPreOrderEntity::getDistrCarNumber, distrCarNumber);
queryWrapper.eq(DistributionBusinessPreOrderEntity::getIsDeleted, 0);
List<DistributionBusinessPreOrderEntity> list = baseMapper.selectList(queryWrapper);
if (list.isEmpty()) {
return Resp.scanFail("扫描失败", "车次信息不存在");
}
// 异常入库
if (1 == businessSanDTO.getInWarehouseException()) {
Resp a = handleExceptionalWarehourse(businessSanDTO, list, orderPackageCode, distrCarNumber);
if (a != null) return a;
} else {
Resp scanFail = handleNormalWarehourse(businessSanDTO, orderPackageCode, list, distrCarNumber);
if (scanFail != null) return scanFail;
}
} catch (Exception e) {
log.error("系统异常", e);
throw new CustomerException(e.getMessage());
}
return Resp.scanFail("扫描失败", "系统错误");
return Resp.scanSuccess("扫描成功", "请前往码板打托进行入库!");
}
@Nullable
private Resp handleNormalWarehourse(BusinessSanDTO businessSanDTO, String orderPackageCode, List<DistributionBusinessPreOrderEntity> list, String distrCarNumber) {
LambdaQueryWrapper<DistributionBusinessPreOrderEntity> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(DistributionBusinessPreOrderEntity::getOrderPackageCode, orderPackageCode);
queryWrapper1.eq(DistributionBusinessPreOrderEntity::getInWarehouse, 1);
queryWrapper1.eq(DistributionBusinessPreOrderEntity::getIsDeleted, 0);
List<DistributionBusinessPreOrderEntity> list1 = baseMapper.selectList(queryWrapper1);
if (!list1.isEmpty()) {
return Resp.scanFail("扫描失败", "包件已入库");
}
DistributionBusinessPreOrderEntity selectD = null;
// 检查包件是否入库
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list) {
if (distributionBusinessPreOrderEntity.getOrderPackageCode().equals(orderPackageCode)) {
//找到这个包件
selectD = distributionBusinessPreOrderEntity;
break;
}
}
// 全仓查询
if (selectD == null) {
LambdaQueryWrapper<DistributionBusinessPreOrderEntity> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(DistributionBusinessPreOrderEntity::getOrderPackageCode, orderPackageCode);
queryWrapper2.eq(DistributionBusinessPreOrderEntity::getIsDeleted, 0);
List<DistributionBusinessPreOrderEntity> list2 = baseMapper.selectList(queryWrapper2);
// 全仓查询
if (!list2.isEmpty()) {
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list2) {
if (distributionBusinessPreOrderEntity.getOrderPackageCode().equals(orderPackageCode)) {
return Resp.scanSuccessWithData("是否切换车次", "当前包件不在当前车次,是否切换车次?" , distributionBusinessPreOrderEntity.getDistrCarNumber());
}
selectD = distributionBusinessPreOrderEntity;
break;
}
}
}
if (selectD == null) {
// 暂存单查询
TrunklineAdvanceDetailEntity entityByOrderPackageCode = trunklineAdvanceDetailClient.findEntityByOrderPackageCode(orderPackageCode);
if (Objects.isNull(entityByOrderPackageCode)) {
return Resp.scanFail("扫描失败", "包件信息不存在");
}
return Resp.scanSuccessWithData("是否异常入库", "当前包件不在配送计划内,是否异常入库", entityByOrderPackageCode);
}
R r = inOrderWarehourse(selectD.getOrderPackageCode());
if (r.isSuccess()) {
selectD.setInWarehouse(1);
this.updateById(selectD);
int a = 0;
//记录当前车次的异常件数
Object o = bladeRedis.get(RedisKeyConstant.BUSINESS_IN_CARNUMBER + businessSanDTO.getDistrCarNumber());
if (Objects.isNull(o)) {
// 查询当前车次的异常入库数量
LambdaQueryWrapper<DistributionBusinessPreOrderEntity> queryWrapper3 = new LambdaQueryWrapper<>();
queryWrapper3.eq(DistributionBusinessPreOrderEntity::getDistrCarNumber, distrCarNumber);
queryWrapper3.eq(DistributionBusinessPreOrderEntity::getInWarehouse, 1);
queryWrapper3.eq(DistributionBusinessPreOrderEntity::getIsDeleted, 0);
List<DistributionBusinessPreOrderEntity> list3 = baseMapper.selectList(queryWrapper3);
o = 1;
if (!list3.isEmpty()) {
o = list3.size();
a = (int) o;
}
bladeRedis.setEx(RedisKeyConstant.BUSINESS_IN_CARNUMBER + businessSanDTO.getDistrCarNumber(), o, 60 * 60 * 24L);
} else {
a = (int) o;
a = a + 1;
bladeRedis.setEx(RedisKeyConstant.BUSINESS_IN_CARNUMBER + businessSanDTO.getDistrCarNumber(), a, 60 * 60 * 24L);
}
return Resp.scanSuccess("扫描成功", a + "件");
}
return null;
}
@Nullable
private Resp handleExceptionalWarehourse(BusinessSanDTO businessSanDTO, List<DistributionBusinessPreOrderEntity> list, String orderPackageCode, String distrCarNumber) {
DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity = list.get(0);
TrunklineAdvanceDetailEntity entityByOrderPackageCode = trunklineAdvanceDetailClient.findEntityByOrderPackageCode(orderPackageCode);
// 增加异常预入库信息
// 如找到了 保存在当前的这个配送计划任务中
DistributionBusinessPreOrderEntity t = null;
if (entityByOrderPackageCode != null) {
// 保存包件
t = BeanUtil.copy(entityByOrderPackageCode, DistributionBusinessPreOrderEntity.class);
assert t != null;
t.setWaybillNumber(entityByOrderPackageCode.getWaybillNo());
t.setFirsts(entityByOrderPackageCode.getFirstPackName());
t.setSecond(entityByOrderPackageCode.getSecondPackName());
t.setThirdProduct(entityByOrderPackageCode.getThirdPackName());
t.setBrandName(entityByOrderPackageCode.getBrand());
t.setConditions(1);
t.setDriverName(distributionBusinessPreOrderEntity.getDriverName());
t.setVehicleName(distributionBusinessPreOrderEntity.getVehicleName());
t.setDistrCarNumber(distributionBusinessPreOrderEntity.getDistrCarNumber());
t.setFromTenantId(distributionBusinessPreOrderEntity.getFromTenantId());
t.setOperationStatus(1);
t.setInWarehouse(0);
this.save(t);
}
R r = inOrderWarehourse(entityByOrderPackageCode.getOrderPackageCode());
if (r.isSuccess()) {
t.setInWarehouse(1);
this.updateById(t);
int a = 0;
//记录当前车次的异常件数
Object o = bladeRedis.get(RedisKeyConstant.BUSINESS_INEXCE_CARNUMBER + businessSanDTO.getDistrCarNumber());
if (Objects.isNull(o)) {
// 查询当前车次的异常入库数量
LambdaQueryWrapper<DistributionBusinessPreOrderEntity> queryWrapper3 = new LambdaQueryWrapper<>();
queryWrapper3.eq(DistributionBusinessPreOrderEntity::getDistrCarNumber, distrCarNumber);
queryWrapper3.eq(DistributionBusinessPreOrderEntity::getOperationStatus, 1);
queryWrapper3.eq(DistributionBusinessPreOrderEntity::getInWarehouse, 1);
queryWrapper3.eq(DistributionBusinessPreOrderEntity::getIsDeleted, 0);
List<DistributionBusinessPreOrderEntity> list3 = baseMapper.selectList(queryWrapper3);
a = 1;
if (!list3.isEmpty()) {
a = list3.size();
}
bladeRedis.setEx(RedisKeyConstant.BUSINESS_INEXCE_CARNUMBER + businessSanDTO.getDistrCarNumber(), a, 60 * 60 * 24L);
} else {
a = (int) o;
a = a + 1;
bladeRedis.setEx(RedisKeyConstant.BUSINESS_INEXCE_CARNUMBER + businessSanDTO.getDistrCarNumber(), a, 60 * 60 * 24L);
}
return Resp.scanSuccess("扫描成功", "异常" + a + "件");
}
return null;
}
@Override
public IPage<DistributionBusinessPreCarNumberVO> pageByCarNum(Map<String, Object> distributionBusinessPreOrderDTO, IPage<DistributionBusinessPreCarNumberVO> page) {
public IPage<DistributionBusinessPreCarNumerPageVO> listCarNum(IPage<Object> page, DistributionBusinessPreCarNumerPageQueryVO distributionBusinessPreCarNumerPageQueryVO) {
IPage<DistributionBusinessPreCarNumerPageVO> listCarNum = baseMapper.listCarNum(page, distributionBusinessPreCarNumerPageQueryVO);
return listCarNum;
}
IPage<DistributionBusinessPreCarNumberVO> pageByCarNum =baseMapper.pageByCarNum(page, distributionBusinessPreOrderDTO);
return pageByCarNum;
@Override
public DistributionBusinessPreCarDetalVO preCarInfoDetailByCarNumber(DistributionBusinessPreCarNumerPageQueryVO queryVO) {
if (queryVO == null || queryVO.getDistrCarNumber() == null) {
throw new IllegalArgumentException("查询参数不能为空");
}
List<DistributionBusinessPreCarOrderDetalVO> data = new ArrayList<>();
LambdaQueryWrapper<DistributionBusinessPreOrderEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DistributionBusinessPreOrderEntity::getDistrCarNumber, queryVO.getDistrCarNumber());
queryWrapper.eq(DistributionBusinessPreOrderEntity::getIsDeleted, 0);
List<DistributionBusinessPreOrderEntity> list = this.list(queryWrapper);
if (list != null) {
Map<String, List<DistributionBusinessPreOrderEntity>> groupedData = list.stream()
.collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getOrderCode));
groupedData.forEach((k, v) -> processGroupedData(k, v, data));
}
DistributionBusinessPreCarNumerPageVO distributionBusinessPreCarNumerPageVO = baseMapper.listCarInforByCarNum(queryVO);
DistributionBusinessPreCarDetalVO distributionBusinessPreCarDetalVO = BeanUtil.copy(distributionBusinessPreCarNumerPageVO, DistributionBusinessPreCarDetalVO.class);
if(distributionBusinessPreCarDetalVO != null){
distributionBusinessPreCarDetalVO.setDistributionBusinessPreCarOrderDetalVOList(data);
}else{
throw new ServiceException("系统异常");
}
return distributionBusinessPreCarDetalVO;
}
private void buildDistributionParcelListEntity(DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity) {
DistributionParcelListEntity distributionParcelListEntity = BeanUtil.copy(distributionBusinessPreOrderEntity, DistributionParcelListEntity.class);
distributionParcelListEntity.setId(null);
private void processGroupedData(String orderCode, List<DistributionBusinessPreOrderEntity> entities, List<DistributionBusinessPreCarOrderDetalVO> data) {
DistributionBusinessPreCarOrderDetalVO t = new DistributionBusinessPreCarOrderDetalVO();
t.setOrderCode(orderCode);
int planNum = entities.size();
int loadNum = (int) entities.stream().filter(e -> "20".equals(e.getOrderPackageLoadingStatus())).count();
int inNum = (int) entities.stream().filter(e -> e.getInWarehouse() == 1).count();
int inExceNum = (int) entities.stream().filter(e -> e.getOperationStatus() == 1).count();
String wallbillNum = entities.stream().map(DistributionBusinessPreOrderEntity::getWaybillNumber).distinct().collect(Collectors.joining(","));
t.setWaybillNumber(wallbillNum);
t.setLoadCarCount(loadNum);
t.setInWarehouseCount(inNum);
t.setOrderPackageCodeCount(planNum);
t.setInWarehouseExceCount(inExceNum);
List<DistributionBusinessPreCarDetalPackageVO> packageVOS = entities.stream().map(entity -> BeanUtil.copy(entity, DistributionBusinessPreCarDetalPackageVO.class)).collect(Collectors.toList());
t.setDistributionBusinessPreCarDetalPackageList(packageVOS);
data.add(t);
}
distributionParcelListEntity.setOrderPackageFreezeStatus("10");
distributionParcelListEntity.setOrderPackageStatus("20");
distributionParcelListEntity.setOrderPackageLoadingStatus("10");
distributionParcelListEntity.setOrderPackageReservationStatus("10");
distributionParcelListEntity.setOrderPackageGroundingStatus("10");
distributionParcelListEntity.setOrderPackageStockupStatus("10");
@Override
public IPage<DistributionBusinessPreCarNumberVO> pageByCarNum(Map<String, Object> distributionBusinessPreOrderDTO, IPage<DistributionBusinessPreCarNumberVO> page) {
distributionParcelListService.save(distributionParcelListEntity);
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionParcelListEntity.getStockArticleId());
//增加
// 统计订单下的包间总数
IPage<DistributionBusinessPreCarNumberVO> pageByCarNum = baseMapper.pageByCarNum(page, distributionBusinessPreOrderDTO);
LambdaQueryWrapper<DistributionParcelListEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DistributionParcelListEntity::getStockArticleId, distributionParcelListEntity.getStockArticleId());
long count = distributionParcelListService.count(lambdaQueryWrapper);
stockArticleEntity.setHandQuantity((int) count);
distributionStockArticleService.updateById(stockArticleEntity);
return pageByCarNum;
}
// private DistributionStockArticleEntity buildDistributionStockArticleEntity(DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity) {
// DistributionStockArticleEntity stockArticleEntity = null;
// try {
// BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
// stockArticleEntity = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(distributionBusinessPreOrderEntity.getOrderCode(),
// myCurrentWarehouse.getId());
// if (stockArticleEntity == null) {
// // 需要保存这个对象
// CompletableFuture<DistributionStockArticleEntity> distributionStockArticleEntityCompletableFuture = CompletableFuture.supplyAsync(() -> distributionAsyncService.findDistributionStockArticleEntityByIdForAsync(distributionBusinessPreOrderEntity.getFromTenantId(), distributionBusinessPreOrderEntity.getStockArticleId()));
// stockArticleEntity = distributionStockArticleEntityCompletableFuture.get();
// if (stockArticleEntity == null) {
// return null;
// }
// // 获取当前登录人的仓库信息
// stockArticleEntity.setId(null);
// stockArticleEntity.setTenantId(null);
// stockArticleEntity.setWarehouseId(myCurrentWarehouse.getId());
// stockArticleEntity.setWarehouse(myCurrentWarehouse.getName());
// stockArticleEntity.setHandQuantity(0);
// distributionStockArticleService.save(stockArticleEntity);
// }
// } catch (InterruptedException | ExecutionException e) {
// log.error("buildDistributionStockArticleEntity :", e);
// throw new CustomerException("系统异常,请联系管理员");
// }
// return stockArticleEntity;
// }
@ChangeAsync()
public DistributionParcelListEntity selectByOrderPackageCode(String orderPackageCode, Long warehouseId) {

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockArticleNewWrapper.java

@ -21,9 +21,9 @@ import java.util.Objects;
*/
@Log4j2
public class DistributionStockArticleNewWrapper extends BaseEntityWrapper<DistributionStockArticleEntity, DistributionStockArticleVO> {
private IUserClient userCliient = SpringUtil.getBean(IUserClient.class);
private IDistributionParcelListService distributionParcelListService = SpringUtil.getBean(IDistributionParcelListService.class);
private IDistributionLoadscanService distributionLoadscanService = SpringUtil.getBean(IDistributionLoadscanService.class);
private final IUserClient userCliient = SpringUtil.getBean(IUserClient.class);
private final IDistributionParcelListService distributionParcelListService = SpringUtil.getBean(IDistributionParcelListService.class);
private final IDistributionLoadscanService distributionLoadscanService = SpringUtil.getBean(IDistributionLoadscanService.class);
public static DistributionStockArticleNewWrapper build() {

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockArticleWrapper.java

@ -22,9 +22,9 @@ import java.util.Objects;
*/
@Log4j2
public class DistributionStockArticleWrapper extends BaseEntityWrapper<DistributionStockArticleEntity, DistributionStockArticleVO> {
private IUserClient userCliient = SpringUtil.getBean(IUserClient.class);
private IDistributionParcelListService distributionParcelListService = SpringUtil.getBean(IDistributionParcelListService.class);
private IDistributionLoadscanService distributionLoadscanService = SpringUtil.getBean(IDistributionLoadscanService.class);
private final IUserClient userCliient = SpringUtil.getBean(IUserClient.class);
private final IDistributionParcelListService distributionParcelListService = SpringUtil.getBean(IDistributionParcelListService.class);
private final IDistributionLoadscanService distributionLoadscanService = SpringUtil.getBean(IDistributionLoadscanService.class);
public static DistributionStockArticleWrapper build() {

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockWrapper.java

@ -22,10 +22,10 @@ import java.util.Objects;
@Log4j2
public class DistributionStockWrapper extends BaseEntityWrapper<DistributionStockEntity, DistributionStockVO> {
private IDistributionStockListService stockListService = SpringUtil.getBean(IDistributionStockListService.class);
private IDistributionSignforService signforService = SpringUtil.getBean(IDistributionSignforService.class);
private IDistributionDeliveryListService deliveryListService = SpringUtil.getBean(IDistributionDeliveryListService.class);
private IDistrilbutionBillLadingService billLadingService = SpringUtil.getBean(IDistrilbutionBillLadingService.class);
private final IDistributionStockListService stockListService = SpringUtil.getBean(IDistributionStockListService.class);
private final IDistributionSignforService signforService = SpringUtil.getBean(IDistributionSignforService.class);
private final IDistributionDeliveryListService deliveryListService = SpringUtil.getBean(IDistributionDeliveryListService.class);
private final IDistrilbutionBillLadingService billLadingService = SpringUtil.getBean(IDistrilbutionBillLadingService.class);
public static DistributionStockWrapper build(){
return new DistributionStockWrapper();

7
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineAdvanceDetailClient.java

@ -25,8 +25,11 @@ public class TrunklineAdvanceDetailClient implements ITrunklineAdvanceDetailClie
@Override
public List<TrunklineAdvanceDetailVO> findListByAdvanceIds(List<Long> collect) {
return advanceDetailService.findAdvanceDetailVoByAdvanceIds(collect);
}
@Override
public TrunklineAdvanceDetailEntity findEntityByOrderPackageCode(String orderPackageCode) {
return advanceDetailService.findEntityByOrderPackageCode(orderPackageCode);
}
}

509
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java

@ -188,76 +188,77 @@ public class InComingServiceImpl implements IInComingService {
@Transactional(rollbackFor = Exception.class)
public R incomingPackage(InComingDTO inComingDTO) {
String orderPackageCode = inComingDTO.getOrderPackageCode();//包件码
Long warehouseId = inComingDTO.getWarehouseId();//仓库id
String warehouseName = inComingDTO.getWarehouseName();
if (StringUtil.isBlank(warehouseName)) {
BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId);
if (!Objects.isNull(warehouseEntity)) {
warehouseName = warehouseEntity.getName();
try{
String orderPackageCode = inComingDTO.getOrderPackageCode();//包件码
Long warehouseId = inComingDTO.getWarehouseId();//仓库id
String warehouseName = inComingDTO.getWarehouseName();
if (StringUtil.isBlank(warehouseName)) {
BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId);
if (!Objects.isNull(warehouseEntity)) {
warehouseName = warehouseEntity.getName();
}
}
}
Long billladingId = inComingDTO.getBillladingId();//提货单id
Integer incomingType = inComingDTO.getIncomingType();//入库类型 1码板打托 2扫码入库 3直接入库 4 按车次号入库 5按订单入库 6扫描入库 7 批量卸车入库 8卸车托盘 9卸分一体 10补录数据入库
String trayCode = inComingDTO.getTrayCode();//托盘码
String trayType = inComingDTO.getTrayType();//打托方式
String customerTrain = inComingDTO.getCustomerTrain();//车次号
List<String> packageCodes = Arrays.asList(orderPackageCode.split(","));
log.info("############incomingPackage: 包件入库开始 packageCodes={} billladingId={} warehouseId={}", packageCodes, billladingId, warehouseId);
//包件入库开始
//查询包件是否有数据
QueryWrapper<TrunklineAdvanceDetailEntity> advanceDetailQueryWrapper = new QueryWrapper<>();
advanceDetailQueryWrapper.in("order_package_code", packageCodes);
List<TrunklineAdvanceDetailEntity> advanceDetailEntityList = advanceDetailService.list(advanceDetailQueryWrapper);
if (advanceDetailEntityList.isEmpty()) {
log.warn("############incomingPackage: 包件不存在 packageCodes={} warehouseId={}", packageCodes, warehouseId);
return Resp.scanFail(405, "包件无数据", "包件无数据");
}
if(StringUtil.isNotBlank(customerTrain)){
for (TrunklineAdvanceDetailEntity advanceDetailEntity : advanceDetailEntityList) {
String trainNumber = advanceDetailEntity.getTrainNumber();
if(!trainNumber.equals(customerTrain)){
log.warn("############incomingPackage: 包件车次号不一致 packageCodes={} trainNumber={} trainNumber={}", packageCodes, trainNumber, customerTrain);
return Resp.scanFail(405, "包件车次号不一致", "包件车次号不一致");
Long billladingId = inComingDTO.getBillladingId();//提货单id
Integer incomingType = inComingDTO.getIncomingType();//入库类型 1码板打托 2扫码入库 3直接入库 4 按车次号入库 5按订单入库 6扫描入库 7 批量卸车入库 8卸车托盘 9卸分一体 10补录数据入库
String trayCode = inComingDTO.getTrayCode();//托盘码
String trayType = inComingDTO.getTrayType();//打托方式
String customerTrain = inComingDTO.getCustomerTrain();//车次号
List<String> packageCodes = Arrays.asList(orderPackageCode.split(","));
log.info("############incomingPackage: 包件入库开始 packageCodes={} billladingId={} warehouseId={}", packageCodes, billladingId, warehouseId);
//包件入库开始
//查询包件是否有数据
QueryWrapper<TrunklineAdvanceDetailEntity> advanceDetailQueryWrapper = new QueryWrapper<>();
advanceDetailQueryWrapper.in("order_package_code", packageCodes);
List<TrunklineAdvanceDetailEntity> advanceDetailEntityList = advanceDetailService.list(advanceDetailQueryWrapper);
if (advanceDetailEntityList.isEmpty()) {
log.warn("############incomingPackage: 包件不存在 packageCodes={} warehouseId={}", packageCodes, warehouseId);
return Resp.scanFail(405, "包件无数据", "包件无数据");
}
if(StringUtil.isNotBlank(customerTrain)){
for (TrunklineAdvanceDetailEntity advanceDetailEntity : advanceDetailEntityList) {
String trainNumber = advanceDetailEntity.getTrainNumber();
if(!trainNumber.equals(customerTrain)){
log.warn("############incomingPackage: 包件车次号不一致 packageCodes={} trainNumber={} trainNumber={}", packageCodes, trainNumber, customerTrain);
return Resp.scanFail(405, "包件车次号不一致", "包件车次号不一致");
}
}
}
}
//把advanceDetailEntityList通过packageStatus分组
Map<String, List<TrunklineAdvanceDetailEntity>> advanceDetailEntityMap = advanceDetailEntityList.stream().collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getPackageStatus));
//把advanceDetailEntityList通过packageStatus分组
Map<String, List<TrunklineAdvanceDetailEntity>> advanceDetailEntityMap = advanceDetailEntityList.stream().collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getPackageStatus));
//把advanceDetailEntityList的orderCode提取成一个Set
//把advanceDetailEntityList的orderCode提取成一个Set
// Set<String> orderCodes = advanceDetailEntityList.stream().map(TrunklineAdvanceDetailEntity::getOrderCode).collect(Collectors.toSet());
String finalWarehouseName = warehouseName;
advanceDetailEntityMap.keySet().forEach(packageStatus -> {
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = advanceDetailEntityMap.get(packageStatus);
if (!advanceDetailEntities.isEmpty()) {
//提取advanceDetailEntities中所有元素的orderPackageCode组成一个List<String>
List<String> orderPackageCodes = advanceDetailEntities.stream()
.map(TrunklineAdvanceDetailEntity::getOrderPackageCode)
.collect(Collectors.toList());
if ("0".equals(packageStatus)) {
//未入库包件
Set<Long> advanceIds = new HashSet<>();
//1.修改暂存单包件入库状态
advanceDetailEntities.forEach(advanceDetailEntity -> {
advanceIds.add(advanceDetailEntity.getId());
advanceDetailEntity.setPackageStatus("1");
advanceDetailEntity.setIncomingTime(new Date());
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(finalWarehouseName);
});
advanceDetailService.updateBatchById(advanceDetailEntities);
advanceIds.forEach(advanceId -> {
List<String> incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId);
advanceService.updateIncomingWarehouseName(String.join(",", incomingWarehouseNames), advanceId);
});
String finalWarehouseName = warehouseName;
advanceDetailEntityMap.keySet().forEach(packageStatus -> {
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = advanceDetailEntityMap.get(packageStatus);
if (!advanceDetailEntities.isEmpty()) {
//提取advanceDetailEntities中所有元素的orderPackageCode组成一个List<String>
List<String> orderPackageCodes = advanceDetailEntities.stream()
.map(TrunklineAdvanceDetailEntity::getOrderPackageCode)
.collect(Collectors.toList());
if ("0".equals(packageStatus)) {
//未入库包件
Set<Long> advanceIds = new HashSet<>();
//1.修改暂存单包件入库状态
advanceDetailEntities.forEach(advanceDetailEntity -> {
advanceIds.add(advanceDetailEntity.getId());
advanceDetailEntity.setPackageStatus("1");
advanceDetailEntity.setIncomingTime(new Date());
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(finalWarehouseName);
});
advanceDetailService.updateBatchById(advanceDetailEntities);
advanceIds.forEach(advanceId -> {
List<String> incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId);
advanceService.updateIncomingWarehouseName(String.join(",", incomingWarehouseNames), advanceId);
});
// advanceDetailService.updatePackageStatusById("1", advanceDetailId, warehouseId, warehouseName,new Date());
// List<String> incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId);
@ -265,270 +266,166 @@ public class InComingServiceImpl implements IInComingService {
//
// List<String> orderPackageCodes = new ArrayList<>();
// orderPackageCodes.add(orderPackageCode);
//存入日志
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, finalWarehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.getCode(), "包件" + IncomingTypeEnum.getValue(incomingType));
//2.判断包件和订单是否已经存入在库订单
boolean b = advanceService.saveOrderAndPackages(advanceDetailEntities, warehouseId);
if (b) {
//把advanceDetailEntities通过waybillNo进行分组
Map<String, List<TrunklineAdvanceDetailEntity>> advanceDetailEntityWaybillNoMap = advanceDetailEntities.stream().filter(entity -> StringUtil.isNotBlank(entity.getWaybillNo())).collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getWaybillNo));
Set<String> waybillNoSet = advanceDetailEntityWaybillNoMap.keySet();
if(!waybillNoSet.isEmpty()){
List<WarehouseWaybillEntity> waybillEntityList = warehouseWaybillClient.findWaybillBilllByWaybillNos(new ArrayList<>(waybillNoSet));
//把waybillEntityList转化成waybillNo为key的map
Map<String, WarehouseWaybillEntity> waybillEntityMap = waybillEntityList.stream().collect(Collectors.toMap(WarehouseWaybillEntity::getWaybillNo, Function.identity()));
advanceDetailEntityWaybillNoMap.keySet().forEach(waybillNo -> {
List<TrunklineAdvanceDetailEntity> waybillNoAdvanceDetailEntities = advanceDetailEntityWaybillNoMap.get(waybillNo);
if(!waybillNoAdvanceDetailEntities.isEmpty()){
WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo);
if(!Objects.isNull(waybillEntity)){
Long departureWarehouseId = waybillEntity.getDepartureWarehouseId();
if(departureWarehouseId.equals(warehouseId)){
Integer totalCount = waybillEntity.getTotalCount();
Integer stockCount = waybillEntity.getStockCount();
openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "20", "已入库", "运单入库:"+stockCount+"/"+totalCount+",入库类型:【"+IncomingTypeEnum.getValue(incomingType)+"】,入库时间:"+ CommonUtil.dateToStringGeneral(new Date()), AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, finalWarehouseName);
//存入日志
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, finalWarehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.getCode(), "包件" + IncomingTypeEnum.getValue(incomingType));
//2.判断包件和订单是否已经存入在库订单
boolean b = advanceService.saveOrderAndPackages(advanceDetailEntities, warehouseId);
if (b) {
//把advanceDetailEntities通过waybillNo进行分组
Map<String, List<TrunklineAdvanceDetailEntity>> advanceDetailEntityWaybillNoMap = advanceDetailEntities.stream().filter(entity -> StringUtil.isNotBlank(entity.getWaybillNo())).collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getWaybillNo));
Set<String> waybillNoSet = advanceDetailEntityWaybillNoMap.keySet();
if(!waybillNoSet.isEmpty()){
List<WarehouseWaybillEntity> waybillEntityList = warehouseWaybillClient.findWaybillBilllByWaybillNos(new ArrayList<>(waybillNoSet));
//把waybillEntityList转化成waybillNo为key的map
Map<String, WarehouseWaybillEntity> waybillEntityMap = waybillEntityList.stream().collect(Collectors.toMap(WarehouseWaybillEntity::getWaybillNo, Function.identity()));
advanceDetailEntityWaybillNoMap.keySet().forEach(waybillNo -> {
List<TrunklineAdvanceDetailEntity> waybillNoAdvanceDetailEntities = advanceDetailEntityWaybillNoMap.get(waybillNo);
if(!waybillNoAdvanceDetailEntities.isEmpty()){
WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo);
if(!Objects.isNull(waybillEntity)){
Long departureWarehouseId = waybillEntity.getDepartureWarehouseId();
if(departureWarehouseId!=null&&departureWarehouseId.equals(warehouseId)){
Integer totalCount = waybillEntity.getTotalCount();
Integer stockCount = waybillEntity.getStockCount();
openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "20", "已入库", "运单入库:"+stockCount+"/"+totalCount+",入库类型:【"+IncomingTypeEnum.getValue(incomingType)+"】,入库时间:"+ CommonUtil.dateToStringGeneral(new Date()), AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, finalWarehouseName);
}
}
}
}
});
}
if (!Objects.isNull(billladingId)) {
//先判断该包件是否已经有提货记录了
List<String> noOrderPackageCodes = billladingPackageServicie.findBillladingPackages(orderPackageCodes);
if (!noOrderPackageCodes.isEmpty()) {
billladingPackageServicie.saveEntityBatch(noOrderPackageCodes, billladingId, warehouseId, incomingType);
});
}
}
//4.如果有托盘码
orderPackageCodes.forEach(packageCode -> {
if (StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)) {
Map<String, Object> map = new HashMap<>();
map.put("trayType", trayType);
map.put("trayCode", trayCode);
map.put("warehouseId", warehouseId);
map.put("orderPackageCode", packageCode);
warehouseTrayTypeClient.orderScanOrderPackageCode(map);
if (!Objects.isNull(billladingId)) {
//先判断该包件是否已经有提货记录了
List<String> noOrderPackageCodes = billladingPackageServicie.findBillladingPackages(orderPackageCodes);
if (!noOrderPackageCodes.isEmpty()) {
billladingPackageServicie.saveEntityBatch(noOrderPackageCodes, billladingId, warehouseId, incomingType);
}
}
});
}
try {
advanceDetailEntities.forEach(advanceDetailEntity -> {
R<Tenant> result = sysClient.getTenant(AuthUtil.getTenantId());
if (result.isSuccess()) {
Tenant tenant = result.getData();
if (tenant.getTenantType() == 1) {
// 发送入库消息
OrderStatusDTO orderStatusDTO = new OrderStatusDTO();
// 通过包件id 查询包件
orderStatusDTO.setUnitNo(advanceDetailEntity.getOrderPackageCode());
orderStatusDTO.setOrderNo(advanceDetailEntity.getOrderCode());
orderStatusDTO.setStatus("1");
orderStatusDTO.setOperationTime(DateUtil.now());
orderStatusDTO.setCurrentWarehouse(warehouseId.toString());
//4.如果有托盘码
orderPackageCodes.forEach(packageCode -> {
if (StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)) {
Map<String, Object> map = new HashMap<>();
map.put("messageData", JSONUtil.toJsonStr(orderStatusDTO));
rabbitTemplate.convertAndSend(RabbitConstant.HWY_ORDER_STATUS_EXCHANGE, RabbitConstant.HWY_ORDER_STATUS_ROUTING, map);
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.address("在【" + finalWarehouseName + "】入库")
.brand(BrandEnums.getByValue(advanceDetailEntity.getBrand()))
.node(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY)
.content(Arrays.asList(PushData.builder()
.packageCode(advanceDetailEntity.getOrderPackageCode())
.orderCode(advanceDetailEntity.getOrderCode())
.warehouseName(finalWarehouseName)
.build()))
.build();
factoryDataMessageSender.sendNodeDataByBrand(nodePushMsg);
} else if (tenant.getTenantType() == 2) {
// 完结预入库数据状态
JSONObject jsonObject = new JSONObject();
jsonObject.put("orderPackageCode", advanceDetailEntity.getOrderPackageCode());
jsonObject.put("carNum", null);
Map mapState = new HashMap();
mapState.put("messageId", CommonUtil.getUUID());
mapState.put("messageData", jsonObject);
mapState.put("createTime", System.currentTimeMillis());
try {
rabbitTemplate.convertAndSend(RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_EXCHANGE, RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_ROUTING, mapState, message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
} catch (Exception customerException) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", customerException);
map.put("trayType", trayType);
map.put("trayCode", trayCode);
map.put("warehouseId", warehouseId);
map.put("orderPackageCode", packageCode);
warehouseTrayTypeClient.orderScanOrderPackageCode(map);
}
});
}
try {
advanceDetailEntities.forEach(advanceDetailEntity -> {
R<Tenant> result = sysClient.getTenant(AuthUtil.getTenantId());
if (result.isSuccess()) {
Tenant tenant = result.getData();
if (tenant.getTenantType() == 1) {
// 发送入库消息
OrderStatusDTO orderStatusDTO = new OrderStatusDTO();
// 通过包件id 查询包件
orderStatusDTO.setUnitNo(advanceDetailEntity.getOrderPackageCode());
orderStatusDTO.setOrderNo(advanceDetailEntity.getOrderCode());
orderStatusDTO.setStatus("1");
orderStatusDTO.setOperationTime(DateUtil.now());
orderStatusDTO.setCurrentWarehouse(warehouseId.toString());
Map<String, Object> map = new HashMap<>();
map.put("messageData", JSONUtil.toJsonStr(orderStatusDTO));
rabbitTemplate.convertAndSend(RabbitConstant.HWY_ORDER_STATUS_EXCHANGE, RabbitConstant.HWY_ORDER_STATUS_ROUTING, map);
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.address("在【" + finalWarehouseName + "】入库")
.brand(BrandEnums.getByValue(advanceDetailEntity.getBrand()))
.node(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY)
.content(Arrays.asList(PushData.builder()
.packageCode(advanceDetailEntity.getOrderPackageCode())
.orderCode(advanceDetailEntity.getOrderCode())
.warehouseName(finalWarehouseName)
.build()))
.build();
factoryDataMessageSender.sendNodeDataByBrand(nodePushMsg);
} else if (tenant.getTenantType() == 2) {
// 完结预入库数据状态
JSONObject jsonObject = new JSONObject();
jsonObject.put("orderPackageCode", advanceDetailEntity.getOrderPackageCode());
jsonObject.put("carNum", null);
Map mapState = new HashMap();
mapState.put("messageId", CommonUtil.getUUID());
mapState.put("messageData", jsonObject);
mapState.put("createTime", System.currentTimeMillis());
try {
rabbitTemplate.convertAndSend(RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_EXCHANGE, RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_ROUTING, mapState, message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
} catch (Exception customerException) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", customerException);
// throw new CustomerException(customerException.getMessage());
}
}
} else {
log.warn("未知的租户类型");
}
} else {
log.warn("未知的租户类型");
}
}
});
} catch (Exception e) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 预入库消息推送失败~ 请联系管理员! ", e);
}
});
} catch (Exception e) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 预入库消息推送失败~ 请联系管理员! ", e);
// throw new CustomerException("服务器异常");
}
}
} else if ("1".equals(packageStatus)) {
//已入库包件
if (incomingType != 1) {
log.warn("############incomingPackage: 包件已入库 orderPackageCodes={} warehouseId={}", orderPackageCodes, warehouseId);
throw new CustomerException(405, "包件" + orderPackageCodes + "已入库");
} else {
if (!Objects.isNull(billladingId)) {
//先判断该包件是否已经有提货记录了
List<String> noOrderPackageCodes = billladingPackageServicie.findBillladingPackages(orderPackageCodes);
if (!noOrderPackageCodes.isEmpty()) {
billladingPackageServicie.saveEntityBatch(noOrderPackageCodes, billladingId, warehouseId, incomingType);
} else if ("1".equals(packageStatus)) {
//已入库包件
if (incomingType != 1) {
log.warn("############incomingPackage: 包件已入库 orderPackageCodes={} warehouseId={}", orderPackageCodes, warehouseId);
throw new CustomerException(405, "包件" + orderPackageCodes + "已入库");
} else {
if (!Objects.isNull(billladingId)) {
//先判断该包件是否已经有提货记录了
List<String> noOrderPackageCodes = billladingPackageServicie.findBillladingPackages(orderPackageCodes);
if (!noOrderPackageCodes.isEmpty()) {
billladingPackageServicie.saveEntityBatch(noOrderPackageCodes, billladingId, warehouseId, incomingType);
}
}
}
//4.如果有托盘码
orderPackageCodes.forEach(packageCode -> {
if (StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)) {
Map<String, Object> map = new HashMap<>();
map.put("trayType", trayType);
map.put("trayCode", trayCode);
map.put("warehouseId", warehouseId);
map.put("orderPackageCode", packageCode);
warehouseTrayTypeClient.orderScanOrderPackageCode(map);
}
});
//4.如果有托盘码
orderPackageCodes.forEach(packageCode -> {
if (StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)) {
Map<String, Object> map = new HashMap<>();
map.put("trayType", trayType);
map.put("trayCode", trayCode);
map.put("warehouseId", warehouseId);
map.put("orderPackageCode", packageCode);
warehouseTrayTypeClient.orderScanOrderPackageCode(map);
}
});
}
}
}
}
});
});
}catch (Exception e){
e.printStackTrace();
log.error("入库异常",e);
throw new CustomerException("系统异常,请联系管理员");
}
// for (String packageCode : packageCodes) {
// log.info("############incomingPackage: 包件入库开始 packageCode={} billladingId={} warehouseId={}", packageCode, billladingId, warehouseId);
// //包件入库开始
// //查询包件是否有数据
// QueryWrapper<TrunklineAdvanceDetailEntity> advanceDetailQueryWrapper = new QueryWrapper<>();
// advanceDetailQueryWrapper.eq("order_package_code", packageCode);
// TrunklineAdvanceDetailEntity advanceDetailEntity = advanceDetailService.getOne(advanceDetailQueryWrapper);
// if (Objects.isNull(advanceDetailEntity)) {
// log.warn("############incomingPackage: 包件不存在 packageCode={} warehouseId={}", packageCode, warehouseId);
// return Resp.scanFail(405, "包件无数据", "包件无数据");
// }
// Long advanceDetailId = advanceDetailEntity.getId();
// String packageStatus = advanceDetailEntity.getPackageStatus();
// Long advanceId = advanceDetailEntity.getAdvanceId();
// if ("1".equals(packageStatus)) {
// if (incomingType != 1) {
// log.warn("############incomingPackage: 包件已入库 packageCode={} warehouseId={}", packageCode, warehouseId);
// return Resp.scanFail(405, "包件已入库", "包件已入库");
// } else {
// if (!Objects.isNull(billladingId)) {
// //先判断该包件是否已经有提货记录了
// TrunklineBillladingPackageEntity billladingPackageEntity = billladingPackageServicie.findBillladingPackage(packageCode);
// if (Objects.isNull(billladingPackageEntity)) {
// billladingPackageServicie.saveEntity(packageCode, billladingId, warehouseId, incomingType);
// }
// }
//
// //4.如果有托盘码
// if (StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)) {
// Map<String, Object> map = new HashMap<>();
// map.put("trayType", trayType);
// map.put("trayCode", trayCode);
// map.put("warehouseId", warehouseId);
// map.put("orderPackageCode", packageCode);
// warehouseTrayTypeClient.orderScanOrderPackageCode(map);
// }
// }
// } else {
// if (StringUtil.isBlank(warehouseName)) {
// BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId);
// if (!Objects.isNull(warehouseEntity)) {
// warehouseName = warehouseEntity.getName();
// }
// }
//
// //1.修改暂存单包件入库状态
// advanceDetailService.updatePackageStatusById("1", advanceDetailId, warehouseId, warehouseName,new Date());
// List<String> incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId);
// advanceService.updateIncomingWarehouseName(String.join(",", incomingWarehouseNames), advanceId);
//
// List<String> orderPackageCodes = new ArrayList<>();
// orderPackageCodes.add(orderPackageCode);
// //存入日志
// packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.getCode(), "包件" + IncomingTypeEnum.getValue(incomingType));
//
//
// //2.判断包件和订单是否已经存入在库订单
// boolean b = advanceService.saveOrderAndPackage(advanceDetailEntity, warehouseId);
//
// if (b) {
// //3.根据是否有提货单id绑定提货单
// if (!Objects.isNull(billladingId)) {
// //先判断该包件是否已经有提货记录了
// TrunklineBillladingPackageEntity billladingPackageEntity = billladingPackageServicie.findBillladingPackage(packageCode);
// if (Objects.isNull(billladingPackageEntity)) {
// billladingPackageServicie.saveEntity(packageCode, billladingId, warehouseId, incomingType);
// }
// }
//
// //4.如果有托盘码
// if (StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)) {
// Map<String, Object> map = new HashMap<>();
// map.put("trayType", trayType);
// map.put("trayCode", trayCode);
// map.put("warehouseId", warehouseId);
// map.put("orderPackageCode", packageCode);
// warehouseTrayTypeClient.orderScanOrderPackageCode(map);
// }
// }
// try {
// // 发送入库消息
// OrderStatusDTO orderStatusDTO = new OrderStatusDTO();
// // 通过包件id 查询包件
// orderStatusDTO.setUnitNo(packageCode);
// orderStatusDTO.setOrderNo(advanceDetailEntity.getOrderCode());
// orderStatusDTO.setStatus("1");
// orderStatusDTO.setOperationTime(DateUtil.now());
// orderStatusDTO.setCurrentWarehouse(warehouseId.toString());
// Map<String, Object> map = new HashMap<>();
// map.put("messageData", JSONUtil.toJsonStr(orderStatusDTO));
// rabbitTemplate.convertAndSend(RabbitConstant.HWY_ORDER_STATUS_EXCHANGE, RabbitConstant.HWY_ORDER_STATUS_ROUTING, map);
//
// NodePushMsg nodePushMsg = NodePushMsg.builder()
// .operator(AuthUtil.getNickName())
// .operatorTime(new Date())
// .address("在【"+ warehouseName +"】入库")
// .brand(BrandEnums.getByValue(advanceDetailEntity.getBrand()))
// .node(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY)
// .content(Arrays.asList(PushData.builder().packageCode(packageCode).build()))
// .build();
// factoryDataMessageSender.sendNodeDataByBrand(nodePushMsg);
// } catch (Exception e) {
// log.error("入库推送失败:{}", e);
// }
// }
// }
return R.success("入库成功");
}

15
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

@ -956,13 +956,16 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
String materialCode = advanceDetailEntity.getMaterialCode();
String materialName = advanceDetailEntity.getMaterialName();
if(Objects.isNull(materialId)){
BasicMaterialEntity materialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode,materialName);
if(!Objects.isNull(materialEntity)){
parcelList.setMaterialId(materialEntity.getId());
parcelList.setMaterialName(materialEntity.getName());
parcelList.setMaterialCode(materialEntity.getProductCode());
parcelList.setMaterialUnit(materialEntity.getSpecification());
if(StringUtil.isNotBlank(materialCode)&& StringUtil.isNotBlank(materialName)){
BasicMaterialEntity materialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode,materialName);
if(!Objects.isNull(materialEntity)){
parcelList.setMaterialId(materialEntity.getId());
parcelList.setMaterialName(materialEntity.getName());
parcelList.setMaterialCode(materialEntity.getProductCode());
parcelList.setMaterialUnit(materialEntity.getSpecification());
}
}
}else{
BasicMaterialEntity materialOwnId = basicMaterialClient.getMaterialOwnId(materialId);
if(!Objects.isNull(materialOwnId)){

Loading…
Cancel
Save