diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillLadingEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillLadingEntity.java index 281373b14..45c7f0edd 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillLadingEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillLadingEntity.java @@ -161,6 +161,18 @@ public class DistrilbutionBillLadingEntity extends TenantEntity { @ApiModelProperty(value = "备货库存品数量") private Integer reserveQuantity; + /** + * 审核人ID + */ + @ApiModelProperty(value = "审核人ID") + private Long examineUserId; + + /** + * 审核人名称 + */ + @ApiModelProperty(value = "审核人名称") + private String examineUserName; + diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistrilbutionBillLadingClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistrilbutionBillLadingClient.java index 56d3039c1..5cee28558 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistrilbutionBillLadingClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistrilbutionBillLadingClient.java @@ -54,4 +54,12 @@ public interface IDistrilbutionBillLadingClient { */ @GetMapping(TOP+"/clerkBillCheckPushData") Boolean clerkBillCheckPushData(@RequestParam("id")Long id); + + /** + * 推送信息至工厂 + * @param ids + * @return + */ + @GetMapping(TOP+"/sendFactorySignforInfo") + Boolean sendFactorySignforInfo(@RequestParam("ids")String ids); } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistrilbutionBillLadingViewVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistrilbutionBillLadingViewVO.java index 52022c1c5..a80fe4b6f 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistrilbutionBillLadingViewVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistrilbutionBillLadingViewVO.java @@ -20,6 +20,11 @@ public class DistrilbutionBillLadingViewVO { private String consigneeUnit; private String customerName; private String customerTelephone; + private Integer planNum; + private Integer realNum; + private String signforUserName; + private String examineTime; + private String examineUserName; //图片集合 private List printList; diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataClientMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataClientMapper.xml index 7b32b4177..86e3db6e9 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataClientMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataClientMapper.xml @@ -154,12 +154,6 @@ AND lbc.type_ervice = #{param.typeServiceName} - - - - - - AND t.aaa LIKE CONCAT('%', #{param.brandName}, '%') diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistrilbutionBillLadingClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistrilbutionBillLadingClient.java index 9050311b3..18625cb04 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistrilbutionBillLadingClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistrilbutionBillLadingClient.java @@ -18,6 +18,7 @@ package com.logpm.distribution.feign; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.distribution.entity.DistrilbutionBillLadingEntity; +import com.logpm.distribution.service.IDistributionAsyncService; import com.logpm.distribution.service.IDistrilbutionBillLadingService; import lombok.AllArgsConstructor; import org.springblade.core.mp.support.BladePage; @@ -40,6 +41,8 @@ public class DistrilbutionBillLadingClient implements IDistrilbutionBillLadingCl private final IDistrilbutionBillLadingService distrilbutionBillLadingService; + private final IDistributionAsyncService distributionAsyncService; + @Override @GetMapping(TOP) public BladePage top(Integer current, Integer size) { @@ -55,4 +58,12 @@ public class DistrilbutionBillLadingClient implements IDistrilbutionBillLadingCl return distrilbutionBillLadingService.clerkBillCheckPushData(id); } + @Override + public Boolean sendFactorySignforInfo(String ids) { + for (String string : ids.split(",")) { + distributionAsyncService.sendFactorySignforInfo(string); + } + return null; + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml index b3c2a973d..6d9384253 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml @@ -626,7 +626,31 @@ IFNULL(ldbl.consignee,GROUP_CONCAT( DISTINCT ANY_VALUE ( ldsa.consignee_person ))) AS customerName, GROUP_CONCAT( - DISTINCT ANY_VALUE ( ldsa.consignee_mobile )) AS customerTelephone + DISTINCT ANY_VALUE ( ldsa.consignee_mobile )) AS customerTelephone, + ( SELECT IFNULL( SUM( packet_number ), 0 ) FROM logpm_distrilbution_bill_package WHERE bill_lading_id = ldbl.id AND is_deleted = 0 AND packet_bar_status != 2 ) + ( + SELECT + IFNULL( SUM( quantity ), 0 ) + FROM + logpm_distribution_reservation_zero_package + WHERE + reservation_id = ldbl.id + AND is_deleted = 0 + AND type = 3 + AND zero_package_status + ) +( + SELECT + IFNULL( sum( num ), 0 ) + FROM + logpm_dis_stock_list_detail + WHERE + reservation_id = ldbl.id + AND is_deleted = 0 + AND stock_package_status != 2 + ) AS planNum , + (SELECT IFNULL(sum(quantity),0) FROM logpm_distribution_bill_lading_scan WHERE bill_lading_id = ldbl.id AND is_deleted = 0 ) AS realNum, + (SELECT GROUP_CONCAT(DISTINCT scan_user) FROM logpm_distribution_bill_lading_scan WHERE bill_lading_id = ldbl.id AND is_deleted = 0 GROUP BY bill_lading_id) AS signforUserName, + IF(ldbl.conditions = 30,ldbl.update_time,'') AS examineTime, + ldbl.examine_user_name AS examineUserName FROM logpm_distrilbution_bill_lading ldbl LEFT JOIN logpm_distrilbution_bill_stock ldbs ON ldbl.id = ldbs.bill_lading_id diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java index 07ecd812c..591bef701 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java @@ -1,5 +1,6 @@ package com.logpm.distribution.service; +import com.fasterxml.jackson.core.JsonProcessingException; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.business.entity.DistributionBusinessPreOrderEntity; import com.logpm.distribution.dto.DistributionStockArticleDTO; @@ -20,6 +21,7 @@ import com.logpm.warehouse.entity.WarehouseWaybillEntity; import org.springblade.common.annotations.ChangeAsync; import org.springblade.core.secure.BladeUser; +import java.security.NoSuchAlgorithmException; import java.util.List; /** @@ -341,4 +343,10 @@ public interface IDistributionAsyncService { * @param reservationIds */ void recordsReservationDeliveryLog(String reservationIds,BasicdataWarehouseEntity warehouse,BladeUser user,String trainNumber,Integer node,String content); + + /** + * 自提推送工厂 + * @param s + */ + void sendFactorySignforInfo(String s); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index 481c96bd3..935bc8c32 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.fasterxml.jackson.core.JsonProcessingException; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.business.entity.DistributionBusinessPreOrderEntity; @@ -20,28 +21,7 @@ import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO; import com.logpm.distribution.dto.app.StockupDTO; import com.logpm.distribution.dto.app.StockupZeroDTO; -import com.logpm.distribution.entity.DisStockListDetailEntity; -import com.logpm.distribution.entity.DistributionBillLadingScanEntity; -import com.logpm.distribution.entity.DistributionDeliveryDetailsEntity; -import com.logpm.distribution.entity.DistributionDeliveryListEntity; -import com.logpm.distribution.entity.DistributionLoadscanEntity; -import com.logpm.distribution.entity.DistributionLoadscaninvnEntity; -import com.logpm.distribution.entity.DistributionParcelListEntity; -import com.logpm.distribution.entity.DistributionParcelNumberEntity; -import com.logpm.distribution.entity.DistributionReservationEntity; -import com.logpm.distribution.entity.DistributionReservationPackageEntity; -import com.logpm.distribution.entity.DistributionReservationStockarticleEntity; -import com.logpm.distribution.entity.DistributionReservationStocklistEntity; -import com.logpm.distribution.entity.DistributionReservationZeroPackageEntity; -import com.logpm.distribution.entity.DistributionSignforEntity; -import com.logpm.distribution.entity.DistributionStockArticleEntity; -import com.logpm.distribution.entity.DistributionStockEntity; -import com.logpm.distribution.entity.DistributionStockListEntity; -import com.logpm.distribution.entity.DistributionStockupEntity; -import com.logpm.distribution.entity.DistributionStockupInfoEntity; -import com.logpm.distribution.entity.DistrilbutionBillLadingEntity; -import com.logpm.distribution.entity.DistrilbutionBillPackageEntity; -import com.logpm.distribution.entity.DistrilbutionBillStockEntity; +import com.logpm.distribution.entity.*; import com.logpm.distribution.mapper.DistributionBillLadingScanMapper; import com.logpm.distribution.mapper.DistributionDeliveryDetailsMapper; import com.logpm.distribution.mapper.DistributionDeliveryListMapper; @@ -125,13 +105,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; +import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; @@ -200,6 +176,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { private final ISysClient sysClient; private final ITrunklinePackageTrackLogClient trunklinePackageTrackLogClient; + private final IDistributionPrintService distributionPrintService; @@ -3020,6 +2997,80 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { } + @Override + public void sendFactorySignforInfo(String s) { + try { + MtReceiveDTO mtReceiveDTO = new MtReceiveDTO(); + List list = distrilbutionBillStockService.list(Wrappers.query().lambda() + .eq(DistrilbutionBillStockEntity::getBillLadingId, s) + .apply("order_status in ( '1' , '3')") + ); + List mtReceiveContentDTOList = new ArrayList<>(); + List consigneePerson = new ArrayList<>(); + for (DistrilbutionBillStockEntity distrilbutionBillStock : list) { + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distrilbutionBillStock.getStockArticleId()); + List mtReceiveContentDTOS = handlePushFactorySignforInfo(stockArticleEntity, s); + if (!mtReceiveContentDTOS.isEmpty()) { + mtReceiveContentDTOList.addAll(mtReceiveContentDTOS); + } + consigneePerson.add(stockArticleEntity.getConsigneePerson()); + } + mtReceiveDTO.setSendTaskId(s); + mtReceiveDTO.setReceiver(consigneePerson.stream().distinct().collect(Collectors.joining(","))); + mtReceiveDTO.setReceiveContentList(mtReceiveContentDTOList); + List mtReceiveImagesDTOS = new ArrayList<>(); + List list1 = distributionPrintService.list(Wrappers.query().lambda() + .eq(DistributionPrintEntity::getBillLadingId, s) + ); + for (DistributionPrintEntity distributionPrintEntity : list1) { + MtReceiveImagesDTO mtReceiveImagesDTO = new MtReceiveImagesDTO(); + if (!distributionPrintEntity.getSite().contains("blob")){ + mtReceiveImagesDTO.setImage(distributionPrintEntity.getSite()); + mtReceiveImagesDTOS.add(mtReceiveImagesDTO); + } + } + orderMainClinet.sendReceiveInfoByNewSystem(mtReceiveDTO); + }catch (Exception e){ + log.error("回传工厂数据失败", e); + } + } + + private List handlePushFactorySignforInfo(DistributionStockArticleEntity stockArticleEntity, String s) { + //其他品牌用","拼接 + String brand = "梦天"; + List list = Arrays.asList(brand.split(",")); + List mtReceiveContentDTOS = new ArrayList<>(); + if (list.isEmpty()) { + Iterator iterator = list.iterator(); + while (iterator.hasNext()){ + String next = iterator.next(); + if (stockArticleEntity.getBrand().contains(next)){ + //查询此订单所有签收信息 + List ladingScanEntities = distributionBillLadingScanMapper.selectList(Wrappers.query().lambda() + .eq(DistributionBillLadingScanEntity::getBillLadingId, s) + .eq(DistributionBillLadingScanEntity::getStockArticleId, stockArticleEntity.getId()) + ); + //处理数据构建 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss"); + if (!ladingScanEntities.isEmpty()) { + for (DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities) { + MtReceiveContentDTO mtReceiveContentDTO = new MtReceiveContentDTO(); + mtReceiveContentDTO.setWarehouse(stockArticleEntity.getWarehouse()+""); + mtReceiveContentDTO.setOrderCode(stockArticleEntity.getOrderCode()); + mtReceiveContentDTO.setUnitNo(ladingScanEntity.getPacketBarCode()); + mtReceiveContentDTO.setOperateDate(simpleDateFormat.format(ladingScanEntity.getCreateTime())); + mtReceiveContentDTO.setWaybillNumber(stockArticleEntity.getWaybillNumber()); + } + } + } + } + } + + + return mtReceiveContentDTOS; + } + + private JSONObject handleLogJSONObject(BasicdataWarehouseEntity warehouse, BladeUser user, String orderPackageCode, String content, Integer node) { JSONObject trunklinePackageTrackLog = new JSONObject(); trunklinePackageTrackLog.put("tenantId",user.getTenantId()); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index 158990a3d..dc18abd58 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -783,7 +783,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl reservationEntities = reservationEntityList.stream().filter(r -> Func.isNotEmpty(r.getConsignee()) && r.getConsignee().equals(stockArticleEntity.getCustomerName()) && r.getDeliveryAddress().equals(stockArticleEntity.getCustomerAddress()) && r.getDeliveryPhone().equals(stockArticleEntity.getCustomerTelephone()) && r.getMallName().equals(stockArticleEntity.getMallName())).collect(Collectors.toList()); + List reservationEntities = reservationEntityList.stream().filter(r -> Func.isNotEmpty(r.getConsignee()) && r.getConsignee().equals(stockArticleEntity.getCustomerName()) && r.getDeliveryAddress().equals(stockArticleEntity.getCustomerAddress()) && r.getDeliveryPhone().equals(stockArticleEntity.getCustomerTelephone()) && r.getMallName().equals(stockArticleEntity.getMallName()) && r.getId().equals(distrilbutionloadingscanDTO.getReservationId())).collect(Collectors.toList()); //查看是否存在满足条件的预约单 //存在多个,操作人指定具体客户即可 if (!reservationEntities.isEmpty()) { @@ -805,7 +805,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl r.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue())); if (shangpeiFlag) { - List reservationEntities = reservationEntityList.stream().filter(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName())).collect(Collectors.toList()); + List reservationEntities = reservationEntityList.stream().filter(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName()) && r.getId().equals(distrilbutionloadingscanDTO.getReservationId())).collect(Collectors.toList()); //查询是否满足商配异常装车 boolean flag = reservationEntityList.stream().anyMatch(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName())); if (reservationEntities.size() == 1) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java index 41657ab07..3be9995e9 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java @@ -50,6 +50,9 @@ import com.logpm.distribution.service.*; import com.logpm.distribution.vo.*; import com.logpm.distribution.vo.app.*; import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; +import com.logpm.factory.mt.dto.MtReceiveContentDTO; +import com.logpm.factory.mt.dto.MtReceiveDTO; +import com.logpm.factory.mt.dto.MtReceiveImagesDTO; import com.logpm.factorydata.enums.BrandEnums; import com.logpm.factorydata.util.FactoryDataMessageSender; import com.logpm.factorydata.vo.NodePushMsg; @@ -97,6 +100,7 @@ import org.springblade.system.feign.IUserClient; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -2816,20 +2820,6 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distributionBillLadingScanService.list(Wrappers.query().lambda() -// .eq(DistributionBillLadingScanEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) -// .eq(DistributionBillLadingScanEntity::getMaterialType, '1') -// ); - -// i.setEsauInventoryNum(list.size()); - - -// } else { - //没有备货完成 -// i.setEsauInventoryNum(-1); -// } }); mainVO.setInventoryList(inventory); return mainVO; @@ -3220,6 +3210,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl parcelListIds = new HashSet<>(); + try { for (int i = 0; i < split.length; i++) { String s = split[i]; @@ -3240,6 +3231,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl ew.eq(DistrilbutionBillStockEntity::getBillLadingId, s).apply(DistrilbutionBillStockEntity::getOrderStatus, "2")) ); if (!list.isEmpty()) { + list.forEach(li -> { DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); stockArticleEntity.setId(li.getStockArticleId()); @@ -3290,12 +3284,18 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl sendFactorySignforInfo(String params) { + // 得到当前仓库所有的签收任务 + + + Boolean b =distrilbutionBillLadingClient.sendFactorySignforInfo(params); + return ReturnT.SUCCESS; + } + + +